lexical 0.32.2-nightly.20250606.0 → 0.32.2-nightly.20250610.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Lexical.dev.js CHANGED
@@ -3055,10 +3055,14 @@ class LexicalNode {
3055
3055
  *
3056
3056
  */
3057
3057
  afterCloneFrom(prevNode) {
3058
- this.__parent = prevNode.__parent;
3059
- this.__next = prevNode.__next;
3060
- this.__prev = prevNode.__prev;
3061
- this.__state = prevNode.__state;
3058
+ if (this.__key === prevNode.__key) {
3059
+ this.__parent = prevNode.__parent;
3060
+ this.__next = prevNode.__next;
3061
+ this.__prev = prevNode.__prev;
3062
+ this.__state = prevNode.__state;
3063
+ } else if (prevNode.__state) {
3064
+ this.__state = prevNode.__state.getWritable(this);
3065
+ }
3062
3066
  }
3063
3067
 
3064
3068
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -8608,9 +8612,11 @@ class ElementNode extends LexicalNode {
8608
8612
  }
8609
8613
  afterCloneFrom(prevNode) {
8610
8614
  super.afterCloneFrom(prevNode);
8611
- this.__first = prevNode.__first;
8612
- this.__last = prevNode.__last;
8613
- this.__size = prevNode.__size;
8615
+ if (this.__key === prevNode.__key) {
8616
+ this.__first = prevNode.__first;
8617
+ this.__last = prevNode.__last;
8618
+ this.__size = prevNode.__size;
8619
+ }
8614
8620
  this.__indent = prevNode.__indent;
8615
8621
  this.__format = prevNode.__format;
8616
8622
  this.__style = prevNode.__style;
@@ -10461,7 +10467,7 @@ class LexicalEditor {
10461
10467
  };
10462
10468
  }
10463
10469
  }
10464
- LexicalEditor.version = "0.32.2-nightly.20250606.0+dev.cjs";
10470
+ LexicalEditor.version = "0.32.2-nightly.20250610.0+dev.cjs";
10465
10471
 
10466
10472
  let keyCounter = 1;
10467
10473
  function resetRandomKey() {
@@ -11496,7 +11502,11 @@ function $isRootOrShadowRoot(node) {
11496
11502
  }
11497
11503
 
11498
11504
  /**
11499
- * Returns a shallow clone of node with a new key
11505
+ * Returns a shallow clone of node with a new key. All properties of the node
11506
+ * will be copied to the new node (by `clone` and then `afterCloneFrom`),
11507
+ * except those related to parent/sibling/child
11508
+ * relationships in the `EditorState`. This means that the copy must be
11509
+ * separately added to the document, and it will not have any children.
11500
11510
  *
11501
11511
  * @param node - The node to be copied.
11502
11512
  * @returns The copy of the node.
@@ -11504,6 +11514,7 @@ function $isRootOrShadowRoot(node) {
11504
11514
  function $copyNode(node) {
11505
11515
  const copy = node.constructor.clone(node);
11506
11516
  $setNodeKey(copy, null);
11517
+ copy.afterCloneFrom(node);
11507
11518
  return copy;
11508
11519
  }
11509
11520
  function $applyNodeReplacement(node) {
package/Lexical.dev.mjs CHANGED
@@ -3053,10 +3053,14 @@ class LexicalNode {
3053
3053
  *
3054
3054
  */
3055
3055
  afterCloneFrom(prevNode) {
3056
- this.__parent = prevNode.__parent;
3057
- this.__next = prevNode.__next;
3058
- this.__prev = prevNode.__prev;
3059
- this.__state = prevNode.__state;
3056
+ if (this.__key === prevNode.__key) {
3057
+ this.__parent = prevNode.__parent;
3058
+ this.__next = prevNode.__next;
3059
+ this.__prev = prevNode.__prev;
3060
+ this.__state = prevNode.__state;
3061
+ } else if (prevNode.__state) {
3062
+ this.__state = prevNode.__state.getWritable(this);
3063
+ }
3060
3064
  }
3061
3065
 
3062
3066
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -8606,9 +8610,11 @@ class ElementNode extends LexicalNode {
8606
8610
  }
8607
8611
  afterCloneFrom(prevNode) {
8608
8612
  super.afterCloneFrom(prevNode);
8609
- this.__first = prevNode.__first;
8610
- this.__last = prevNode.__last;
8611
- this.__size = prevNode.__size;
8613
+ if (this.__key === prevNode.__key) {
8614
+ this.__first = prevNode.__first;
8615
+ this.__last = prevNode.__last;
8616
+ this.__size = prevNode.__size;
8617
+ }
8612
8618
  this.__indent = prevNode.__indent;
8613
8619
  this.__format = prevNode.__format;
8614
8620
  this.__style = prevNode.__style;
@@ -10459,7 +10465,7 @@ class LexicalEditor {
10459
10465
  };
10460
10466
  }
10461
10467
  }
10462
- LexicalEditor.version = "0.32.2-nightly.20250606.0+dev.esm";
10468
+ LexicalEditor.version = "0.32.2-nightly.20250610.0+dev.esm";
10463
10469
 
10464
10470
  let keyCounter = 1;
10465
10471
  function resetRandomKey() {
@@ -11494,7 +11500,11 @@ function $isRootOrShadowRoot(node) {
11494
11500
  }
11495
11501
 
11496
11502
  /**
11497
- * Returns a shallow clone of node with a new key
11503
+ * Returns a shallow clone of node with a new key. All properties of the node
11504
+ * will be copied to the new node (by `clone` and then `afterCloneFrom`),
11505
+ * except those related to parent/sibling/child
11506
+ * relationships in the `EditorState`. This means that the copy must be
11507
+ * separately added to the document, and it will not have any children.
11498
11508
  *
11499
11509
  * @param node - The node to be copied.
11500
11510
  * @returns The copy of the node.
@@ -11502,6 +11512,7 @@ function $isRootOrShadowRoot(node) {
11502
11512
  function $copyNode(node) {
11503
11513
  const copy = node.constructor.clone(node);
11504
11514
  $setNodeKey(copy, null);
11515
+ copy.afterCloneFrom(node);
11505
11516
  return copy;
11506
11517
  }
11507
11518
  function $applyNodeReplacement(node) {