mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Implement the "insertHTML" editing command
This commit is contained in:
parent
cb05ab6515
commit
20fb7b1a49
Notes:
github-actions[bot]
2025-01-10 22:35:30 +00:00
Author: https://github.com/gmta
Commit: 20fb7b1a49
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
4 changed files with 98 additions and 0 deletions
18
Tests/LibWeb/Text/input/Editing/execCommand-insertHTML.html
Normal file
18
Tests/LibWeb/Text/input/Editing/execCommand-insertHTML.html
Normal file
|
@ -0,0 +1,18 @@
|
|||
<script src="../include.js"></script>
|
||||
<div contenteditable="true">foobar</div>
|
||||
<script>
|
||||
test(() => {
|
||||
var divElm = document.querySelector('div');
|
||||
|
||||
// Put cursor between 'foo' and 'bar'
|
||||
var range = document.createRange();
|
||||
getSelection().addRange(range);
|
||||
range.setStart(divElm.childNodes[0], 3);
|
||||
range.setEnd(divElm.childNodes[0], 3);
|
||||
|
||||
// Insert HTML
|
||||
document.execCommand('insertHTML', false, '<em>Ladybird</em>');
|
||||
|
||||
println(divElm.innerHTML);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue