mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +00:00
LibWeb: Implement the "fontSize" editing command
This commit is contained in:
parent
9366a50dd3
commit
1d2500e31f
Notes:
github-actions[bot]
2025-01-10 22:36:54 +00:00
Author: https://github.com/gmta
Commit: 1d2500e31f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
5 changed files with 141 additions and 1 deletions
26
Tests/LibWeb/Text/input/Editing/execCommand-fontSize.html
Normal file
26
Tests/LibWeb/Text/input/Editing/execCommand-fontSize.html
Normal file
|
@ -0,0 +1,26 @@
|
|||
<script src="../include.js"></script>
|
||||
<div contenteditable="true">foobar</div>
|
||||
<script>
|
||||
test(() => {
|
||||
const range = document.createRange();
|
||||
getSelection().addRange(range);
|
||||
|
||||
const divElm = document.querySelector('div');
|
||||
println(`div: "${divElm.innerHTML}"`);
|
||||
println(`fontSize value: ${document.queryCommandValue('fontSize')}`);
|
||||
|
||||
// Set fontSize for 'bar'
|
||||
range.setStart(divElm.childNodes[0], 3);
|
||||
range.setEnd(divElm.childNodes[0], 6);
|
||||
document.execCommand('fontSize', false, '5');
|
||||
println(`div: "${divElm.innerHTML}"`);
|
||||
println(`fontSize value: ${document.queryCommandValue('fontSize')}`);
|
||||
|
||||
// Set fontSize for 'foobar'
|
||||
range.setStart(divElm.childNodes[0], 0);
|
||||
range.setEnd(divElm.childNodes[1].childNodes[0], 3);
|
||||
document.execCommand('fontSize', false, '4');
|
||||
println(`div: "${divElm.innerHTML}"`);
|
||||
println(`fontSize value: ${document.queryCommandValue('fontSize')}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue