mirror of
https://github.com/facebook/lexical.git
synced 2025-08-06 08:30:33 +08:00

committed by
acywatson

parent
ed43e133dc
commit
b2f73f34e8
@ -557,7 +557,7 @@ export class Selection {
|
|||||||
|
|
||||||
// If the last element is an "inline" element, don't move it's text nodes to the first node.
|
// If the last element is an "inline" element, don't move it's text nodes to the first node.
|
||||||
// Instead, preserve the "inline" element's children and append to the first element.
|
// Instead, preserve the "inline" element's children and append to the first element.
|
||||||
if (!lastElement.canBeEmpty()) {
|
if (!lastElement.canBeEmpty() && firstElement !== lastElement) {
|
||||||
firstElement.append(lastElement);
|
firstElement.append(lastElement);
|
||||||
} else {
|
} else {
|
||||||
for (let i = lastNodeChildren.length - 1; i >= 0; i--) {
|
for (let i = lastNodeChildren.length - 1; i >= 0; i--) {
|
||||||
|
@ -260,6 +260,9 @@ export class ElementNode extends LexicalNode {
|
|||||||
}
|
}
|
||||||
for (let i = 0; i < nodesToAppendLength; i++) {
|
for (let i = 0; i < nodesToAppendLength; i++) {
|
||||||
const nodeToAppend = nodesToAppend[i];
|
const nodeToAppend = nodesToAppend[i];
|
||||||
|
if (nodeToAppend.__key === writableSelfKey) {
|
||||||
|
invariant(false, 'append: attemtping to append self');
|
||||||
|
}
|
||||||
const writableNodeToAppend = nodeToAppend.getWritable();
|
const writableNodeToAppend = nodeToAppend.getWritable();
|
||||||
|
|
||||||
// Remove node from previous parent
|
// Remove node from previous parent
|
||||||
|
@ -45,5 +45,8 @@
|
|||||||
"43": "reconcileNode: prevNode or nextNode does not exist in nodeMap",
|
"43": "reconcileNode: prevNode or nextNode does not exist in nodeMap",
|
||||||
"44": "reconcileNode: parentDOM is null",
|
"44": "reconcileNode: parentDOM is null",
|
||||||
"45": "Reconciliation: could not find DOM element for node key \"${key}\"",
|
"45": "Reconciliation: could not find DOM element for node key \"${key}\"",
|
||||||
"46": "rootNode.append: Only element or decorator nodes can be appended to the root node"
|
"46": "rootNode.append: Only element or decorator nodes can be appended to the root node",
|
||||||
|
"47": "getListItemValue: list node is not parent of list item node",
|
||||||
|
"48": "Should never happen",
|
||||||
|
"49": "append: attemtping to append self"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user