mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-16 15:30:09 +00:00
LibWeb: Implement the "insertText" editing command
Minus the autolinking algorithm.
This commit is contained in:
parent
199eaf0d3e
commit
26cadf06d2
Notes:
github-actions[bot]
2025-01-10 22:35:07 +00:00
Author: https://github.com/gmta
Commit: 26cadf06d2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3216
6 changed files with 216 additions and 11 deletions
18
Tests/LibWeb/Text/input/Editing/execCommand-insertText.html
Normal file
18
Tests/LibWeb/Text/input/Editing/execCommand-insertText.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 text
|
||||
document.execCommand('insertText', false, 'baz');
|
||||
|
||||
println(divElm.innerHTML);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue