mirror of https://github.com/vector-im/riot-web
remove all non-first-br nodes on new empty line, not just first one
nextSibling returned null after calling removeNode, so get the nextSibling firstpull/21833/head
parent
b2592583c4
commit
4fc23022f4
|
@ -61,12 +61,13 @@ export function renderModel(editor, model) {
|
|||
let foundBR = false;
|
||||
let partNode = lineContainer.firstChild;
|
||||
while (partNode) {
|
||||
const nextNode = partNode.nextSibling;
|
||||
if (!foundBR && partNode.tagName === "BR") {
|
||||
foundBR = true;
|
||||
} else {
|
||||
lineContainer.removeChild(partNode);
|
||||
}
|
||||
partNode = partNode.nextSibling;
|
||||
partNode = nextNode;
|
||||
}
|
||||
if (!foundBR) {
|
||||
lineContainer.appendChild(document.createElement("br"));
|
||||
|
|
Loading…
Reference in New Issue