mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb: Implement document.execCommand("insertParagraph")
This commit is contained in:
parent
2e29d3fb57
commit
4f76cec096
Notes:
github-actions[bot]
2024-12-04 05:53:10 +00:00
Author: https://github.com/gmta
Commit: 4f76cec096
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2735
Reviewed-by: https://github.com/tcl3
6 changed files with 668 additions and 9 deletions
|
@ -0,0 +1,18 @@
|
|||
<script src="../include.js"></script>
|
||||
<div contenteditable="true"><ul><li>foobar</li></ul></div>
|
||||
<script>
|
||||
test(() => {
|
||||
var divElm = document.querySelector('div');
|
||||
println(`Before: ${divElm.innerHTML}`);
|
||||
|
||||
// Put cursor after 'foo'
|
||||
var range = document.createRange();
|
||||
range.setStart(divElm.firstChild.firstChild.firstChild, 3);
|
||||
getSelection().addRange(range);
|
||||
|
||||
// Press return
|
||||
document.execCommand('insertParagraph');
|
||||
|
||||
println(`After: ${divElm.innerHTML}`);
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue