blob: 29ee228fea44fdaedb85188610f5088619ff8c4f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Test removing right block while joining it and parent left block</title>
<script>
addEventListener("load", () => {
const editingHosts = document.querySelectorAll("div[contenteditable]");
for (const editingHost of editingHosts) {
editingHost.focus();
const rightChildBlock = editingHost.querySelector("div > div > div");
getSelection().collapse(rightChildBlock.firstChild.firstChild, 0);
editingHost.addEventListener("DOMSubtreeModified", () => {
document.body.appendChild(rightChildBlock);
});
document.execCommand("delete");
}
});
</script>
</head>
<body>
<div contenteditable>
<div>parent<div><b>child</b></div>parent</div>
</div>
<div contenteditable>
<div>parent<div><b>child<br>2nd line</b></div>parent</div>
</div>
<div contenteditable style="white-space:pre">
<div>parent<div>child
2nd line</div>parent</div>
</div>
</body>
</html>
|