mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 17:55:07 +02:00
LibWeb: Implement document.execCommand("insertParagraph")
This commit is contained in:
committed by
Jelle Raaijmakers
parent
2e29d3fb57
commit
4f76cec096
Notes:
github-actions[bot]
2024-12-04 05:53:10 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/4f76cec0965 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2735 Reviewed-by: https://github.com/tcl3
@@ -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>
|
||||
Reference in New Issue
Block a user