mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibWeb: Implement the "removeFormat" editing command
This commit is contained in:
parent
ae12f7036b
commit
aee8a75c40
Notes:
github-actions[bot]
2025-01-10 22:36:28 +00:00
Author: https://github.com/gmta
Commit: aee8a75c40
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
6 changed files with 143 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
<script src="../include.js"></script>
|
||||
<div contenteditable="true">f<b>o</b>ob<i>a</i>r</div>
|
||||
<script>
|
||||
test(() => {
|
||||
const range = document.createRange();
|
||||
getSelection().addRange(range);
|
||||
|
||||
const divElm = document.querySelector('div');
|
||||
println(`Div contents: "${divElm.innerHTML}"`);
|
||||
|
||||
// Remove all formatting from 'foobar'
|
||||
range.setStart(divElm, 0);
|
||||
range.setEnd(divElm, 5);
|
||||
document.execCommand('removeFormat');
|
||||
println(`Div contents: "${divElm.innerHTML}"`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue