mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Implement the "removeFormat" editing command
This commit is contained in:
committed by
Andreas Kling
parent
ae12f7036b
commit
aee8a75c40
Notes:
github-actions[bot]
2025-01-10 22:36:28 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/aee8a75c400 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
@@ -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>
|
||||
Reference in New Issue
Block a user