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