lexical 0.29.1-nightly.20250404.0 → 0.30.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
@@ -850,7 +850,7 @@ class NodeState {
850
850
  * its parent or siblings change).
851
851
  *
852
852
  * @param node The node to associate with the state
853
- * @returns The next writaable state
853
+ * @returns The next writable state
854
854
  */
855
855
  getWritable(node) {
856
856
  if (this.node === node) {
@@ -3009,7 +3009,7 @@ class LexicalNode {
3009
3009
  /**
3010
3010
  * Returns true if there is a path between this node and the RootNode, false otherwise.
3011
3011
  * This is a way of determining if the node is "attached" EditorState. Unattached nodes
3012
- * won't be reconciled and will ultimatelt be cleaned up by the Lexical GC.
3012
+ * won't be reconciled and will ultimately be cleaned up by the Lexical GC.
3013
3013
  */
3014
3014
  isAttached() {
3015
3015
  let nodeKey = this.__key;
@@ -3452,7 +3452,7 @@ class LexicalNode {
3452
3452
  *
3453
3453
  * This method must return exactly one HTMLElement. Nested elements are not supported.
3454
3454
  *
3455
- * Do not attempt to update the Lexical EditorState during this phase of the update lifecyle.
3455
+ * Do not attempt to update the Lexical EditorState during this phase of the update lifecycle.
3456
3456
  *
3457
3457
  * @param _config - allows access to things like the EditorTheme (to apply classes) during reconciliation.
3458
3458
  * @param _editor - allows access to the editor for context during reconciliation.
@@ -3951,7 +3951,7 @@ function isOnlyChildInBlockNode(node) {
3951
3951
  function isLastChildInBlockNode(node) {
3952
3952
  const parentElement = node.parentElement;
3953
3953
  if (parentElement !== null && isBlockDomNode(parentElement)) {
3954
- // check if node is first child, because only childs dont count
3954
+ // check if node is first child, because only child dont count
3955
3955
  const firstChild = parentElement.firstChild;
3956
3956
  if (firstChild === node || firstChild.nextSibling === node && isWhitespaceDomTextNode(firstChild)) {
3957
3957
  return false;
@@ -4176,7 +4176,7 @@ class TextNode extends LexicalNode {
4176
4176
 
4177
4177
  /**
4178
4178
  * Returns whether or not the node is in "token" mode. TextNodes in token mode can be navigated through character-by-character
4179
- * with a RangeSelection, but are deleted as a single entity (not invdividually by character).
4179
+ * with a RangeSelection, but are deleted as a single entity (not individually by character).
4180
4180
  *
4181
4181
  * @returns true if the node is in token mode, false otherwise.
4182
4182
  */
@@ -4195,7 +4195,7 @@ class TextNode extends LexicalNode {
4195
4195
  }
4196
4196
 
4197
4197
  /**
4198
- * Returns whether or not the node is in "segemented" mode. TextNodes in segemented mode can be navigated through character-by-character
4198
+ * Returns whether or not the node is in "segmented" mode. TextNodes in segmented mode can be navigated through character-by-character
4199
4199
  * with a RangeSelection, but are deleted in space-delimited "segments".
4200
4200
  *
4201
4201
  * @returns true if the node is in segmented mode, false otherwise.
@@ -4428,6 +4428,16 @@ class TextNode extends LexicalNode {
4428
4428
  formatDevErrorMessage(`Expected TextNode createDOM to always return a HTMLElement`);
4429
4429
  }
4430
4430
  element.style.whiteSpace = 'pre-wrap';
4431
+
4432
+ // Add text-transform styles for capitalization formats
4433
+ if (this.hasFormat('lowercase')) {
4434
+ element.style.textTransform = 'lowercase';
4435
+ } else if (this.hasFormat('uppercase')) {
4436
+ element.style.textTransform = 'uppercase';
4437
+ } else if (this.hasFormat('capitalize')) {
4438
+ element.style.textTransform = 'capitalize';
4439
+ }
4440
+
4431
4441
  // This is the only way to properly add support for most clients,
4432
4442
  // even if it's semantically incorrect to have to resort to using
4433
4443
  // <b>, <u>, <s>, <i> elements.
@@ -4660,7 +4670,7 @@ class TextNode extends LexicalNode {
4660
4670
  }
4661
4671
 
4662
4672
  /**
4663
- * This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
4673
+ * This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
4664
4674
  * when a user event would cause text to be inserted before them in the editor. If true, Lexical will attempt
4665
4675
  * to insert text into this node. If false, it will insert the text in a new sibling node.
4666
4676
  *
@@ -4671,7 +4681,7 @@ class TextNode extends LexicalNode {
4671
4681
  }
4672
4682
 
4673
4683
  /**
4674
- * This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
4684
+ * This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
4675
4685
  * when a user event would cause text to be inserted after them in the editor. If true, Lexical will attempt
4676
4686
  * to insert text into this node. If false, it will insert the text in a new sibling node.
4677
4687
  *
@@ -4851,7 +4861,7 @@ class TextNode extends LexicalNode {
4851
4861
  }
4852
4862
 
4853
4863
  /**
4854
- * This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
4864
+ * This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
4855
4865
  * when used with the registerLexicalTextEntity function. If you're using registerLexicalTextEntity, the
4856
4866
  * node class that you create and replace matched text with should return true from this method.
4857
4867
  *
@@ -4937,7 +4947,7 @@ function $convertTextDOMNode(domNode) {
4937
4947
  };
4938
4948
  }
4939
4949
  if (textContent[0] === ' ') {
4940
- // Traverse backward while in the same line. If content contains new line or tab -> pontential
4950
+ // Traverse backward while in the same line. If content contains new line or tab -> potential
4941
4951
  // delete, other elements can borrow from this one. Deletion depends on whether it's also the
4942
4952
  // last space (see next condition: textContent[textContent.length - 1] === ' '))
4943
4953
  let previousText = domNode_;
@@ -5405,7 +5415,7 @@ class RangeSelection {
5405
5415
 
5406
5416
  /**
5407
5417
  * Used to check if the provided selections is equal to this one by value,
5408
- * inluding anchor, focus, format, and style properties.
5418
+ * including anchor, focus, format, and style properties.
5409
5419
  * @param selection - the Selection to compare this one to.
5410
5420
  * @returns true if the Selections are equal, false otherwise.
5411
5421
  */
@@ -9032,7 +9042,7 @@ class ElementNode extends LexicalNode {
9032
9042
  return false;
9033
9043
  }
9034
9044
  // A shadow root is a Node that behaves like RootNode. The shadow root (and RootNode) mark the
9035
- // end of the hiercharchy, most implementations should treat it as there's nothing (upwards)
9045
+ // end of the hierarchy, most implementations should treat it as there's nothing (upwards)
9036
9046
  // beyond this point. For example, node.getTopLevelElement(), when performed inside a TableCellNode
9037
9047
  // will return the immediate first child underneath TableCellNode instead of RootNode.
9038
9048
  isShadowRoot() {
@@ -10238,7 +10248,7 @@ class LexicalEditor {
10238
10248
  });
10239
10249
  });
10240
10250
  // In the case where onUpdate doesn't fire (due to the focus update not
10241
- // occuring).
10251
+ // occurring).
10242
10252
  if (this._pendingEditorState === null) {
10243
10253
  rootElement.removeAttribute('autocapitalize');
10244
10254
  }
@@ -10291,7 +10301,7 @@ class LexicalEditor {
10291
10301
  };
10292
10302
  }
10293
10303
  }
10294
- LexicalEditor.version = "0.29.1-nightly.20250404.0+dev.cjs";
10304
+ LexicalEditor.version = "0.30.0+dev.cjs";
10295
10305
 
10296
10306
  let keyCounter = 1;
10297
10307
  function resetRandomKey() {
@@ -11626,7 +11636,7 @@ function $cloneWithProperties(latestNode) {
11626
11636
  formatDevErrorMessage(`$cloneWithProperties: ${constructor.name}.clone(node) (with type '${constructor.getType()}') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor`);
11627
11637
  }
11628
11638
  if (!(mutableNode.__parent === latestNode.__parent && mutableNode.__next === latestNode.__next && mutableNode.__prev === latestNode.__prev)) {
11629
- formatDevErrorMessage(`$cloneWithProperties: ${constructor.name}.clone(node) (with type '${constructor.getType()}') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)`);
11639
+ formatDevErrorMessage(`$cloneWithProperties: ${constructor.name}.clone(node) (with type '${constructor.getType()}') overrode afterCloneFrom but did not call super.afterCloneFrom(prevNode)`);
11630
11640
  }
11631
11641
  }
11632
11642
  return mutableNode;
package/Lexical.dev.mjs CHANGED
@@ -848,7 +848,7 @@ class NodeState {
848
848
  * its parent or siblings change).
849
849
  *
850
850
  * @param node The node to associate with the state
851
- * @returns The next writaable state
851
+ * @returns The next writable state
852
852
  */
853
853
  getWritable(node) {
854
854
  if (this.node === node) {
@@ -3007,7 +3007,7 @@ class LexicalNode {
3007
3007
  /**
3008
3008
  * Returns true if there is a path between this node and the RootNode, false otherwise.
3009
3009
  * This is a way of determining if the node is "attached" EditorState. Unattached nodes
3010
- * won't be reconciled and will ultimatelt be cleaned up by the Lexical GC.
3010
+ * won't be reconciled and will ultimately be cleaned up by the Lexical GC.
3011
3011
  */
3012
3012
  isAttached() {
3013
3013
  let nodeKey = this.__key;
@@ -3450,7 +3450,7 @@ class LexicalNode {
3450
3450
  *
3451
3451
  * This method must return exactly one HTMLElement. Nested elements are not supported.
3452
3452
  *
3453
- * Do not attempt to update the Lexical EditorState during this phase of the update lifecyle.
3453
+ * Do not attempt to update the Lexical EditorState during this phase of the update lifecycle.
3454
3454
  *
3455
3455
  * @param _config - allows access to things like the EditorTheme (to apply classes) during reconciliation.
3456
3456
  * @param _editor - allows access to the editor for context during reconciliation.
@@ -3949,7 +3949,7 @@ function isOnlyChildInBlockNode(node) {
3949
3949
  function isLastChildInBlockNode(node) {
3950
3950
  const parentElement = node.parentElement;
3951
3951
  if (parentElement !== null && isBlockDomNode(parentElement)) {
3952
- // check if node is first child, because only childs dont count
3952
+ // check if node is first child, because only child dont count
3953
3953
  const firstChild = parentElement.firstChild;
3954
3954
  if (firstChild === node || firstChild.nextSibling === node && isWhitespaceDomTextNode(firstChild)) {
3955
3955
  return false;
@@ -4174,7 +4174,7 @@ class TextNode extends LexicalNode {
4174
4174
 
4175
4175
  /**
4176
4176
  * Returns whether or not the node is in "token" mode. TextNodes in token mode can be navigated through character-by-character
4177
- * with a RangeSelection, but are deleted as a single entity (not invdividually by character).
4177
+ * with a RangeSelection, but are deleted as a single entity (not individually by character).
4178
4178
  *
4179
4179
  * @returns true if the node is in token mode, false otherwise.
4180
4180
  */
@@ -4193,7 +4193,7 @@ class TextNode extends LexicalNode {
4193
4193
  }
4194
4194
 
4195
4195
  /**
4196
- * Returns whether or not the node is in "segemented" mode. TextNodes in segemented mode can be navigated through character-by-character
4196
+ * Returns whether or not the node is in "segmented" mode. TextNodes in segmented mode can be navigated through character-by-character
4197
4197
  * with a RangeSelection, but are deleted in space-delimited "segments".
4198
4198
  *
4199
4199
  * @returns true if the node is in segmented mode, false otherwise.
@@ -4426,6 +4426,16 @@ class TextNode extends LexicalNode {
4426
4426
  formatDevErrorMessage(`Expected TextNode createDOM to always return a HTMLElement`);
4427
4427
  }
4428
4428
  element.style.whiteSpace = 'pre-wrap';
4429
+
4430
+ // Add text-transform styles for capitalization formats
4431
+ if (this.hasFormat('lowercase')) {
4432
+ element.style.textTransform = 'lowercase';
4433
+ } else if (this.hasFormat('uppercase')) {
4434
+ element.style.textTransform = 'uppercase';
4435
+ } else if (this.hasFormat('capitalize')) {
4436
+ element.style.textTransform = 'capitalize';
4437
+ }
4438
+
4429
4439
  // This is the only way to properly add support for most clients,
4430
4440
  // even if it's semantically incorrect to have to resort to using
4431
4441
  // <b>, <u>, <s>, <i> elements.
@@ -4658,7 +4668,7 @@ class TextNode extends LexicalNode {
4658
4668
  }
4659
4669
 
4660
4670
  /**
4661
- * This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
4671
+ * This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
4662
4672
  * when a user event would cause text to be inserted before them in the editor. If true, Lexical will attempt
4663
4673
  * to insert text into this node. If false, it will insert the text in a new sibling node.
4664
4674
  *
@@ -4669,7 +4679,7 @@ class TextNode extends LexicalNode {
4669
4679
  }
4670
4680
 
4671
4681
  /**
4672
- * This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
4682
+ * This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
4673
4683
  * when a user event would cause text to be inserted after them in the editor. If true, Lexical will attempt
4674
4684
  * to insert text into this node. If false, it will insert the text in a new sibling node.
4675
4685
  *
@@ -4849,7 +4859,7 @@ class TextNode extends LexicalNode {
4849
4859
  }
4850
4860
 
4851
4861
  /**
4852
- * This method is meant to be overriden by TextNode subclasses to control the behavior of those nodes
4862
+ * This method is meant to be overridden by TextNode subclasses to control the behavior of those nodes
4853
4863
  * when used with the registerLexicalTextEntity function. If you're using registerLexicalTextEntity, the
4854
4864
  * node class that you create and replace matched text with should return true from this method.
4855
4865
  *
@@ -4935,7 +4945,7 @@ function $convertTextDOMNode(domNode) {
4935
4945
  };
4936
4946
  }
4937
4947
  if (textContent[0] === ' ') {
4938
- // Traverse backward while in the same line. If content contains new line or tab -> pontential
4948
+ // Traverse backward while in the same line. If content contains new line or tab -> potential
4939
4949
  // delete, other elements can borrow from this one. Deletion depends on whether it's also the
4940
4950
  // last space (see next condition: textContent[textContent.length - 1] === ' '))
4941
4951
  let previousText = domNode_;
@@ -5403,7 +5413,7 @@ class RangeSelection {
5403
5413
 
5404
5414
  /**
5405
5415
  * Used to check if the provided selections is equal to this one by value,
5406
- * inluding anchor, focus, format, and style properties.
5416
+ * including anchor, focus, format, and style properties.
5407
5417
  * @param selection - the Selection to compare this one to.
5408
5418
  * @returns true if the Selections are equal, false otherwise.
5409
5419
  */
@@ -9030,7 +9040,7 @@ class ElementNode extends LexicalNode {
9030
9040
  return false;
9031
9041
  }
9032
9042
  // A shadow root is a Node that behaves like RootNode. The shadow root (and RootNode) mark the
9033
- // end of the hiercharchy, most implementations should treat it as there's nothing (upwards)
9043
+ // end of the hierarchy, most implementations should treat it as there's nothing (upwards)
9034
9044
  // beyond this point. For example, node.getTopLevelElement(), when performed inside a TableCellNode
9035
9045
  // will return the immediate first child underneath TableCellNode instead of RootNode.
9036
9046
  isShadowRoot() {
@@ -10236,7 +10246,7 @@ class LexicalEditor {
10236
10246
  });
10237
10247
  });
10238
10248
  // In the case where onUpdate doesn't fire (due to the focus update not
10239
- // occuring).
10249
+ // occurring).
10240
10250
  if (this._pendingEditorState === null) {
10241
10251
  rootElement.removeAttribute('autocapitalize');
10242
10252
  }
@@ -10289,7 +10299,7 @@ class LexicalEditor {
10289
10299
  };
10290
10300
  }
10291
10301
  }
10292
- LexicalEditor.version = "0.29.1-nightly.20250404.0+dev.esm";
10302
+ LexicalEditor.version = "0.30.0+dev.esm";
10293
10303
 
10294
10304
  let keyCounter = 1;
10295
10305
  function resetRandomKey() {
@@ -11624,7 +11634,7 @@ function $cloneWithProperties(latestNode) {
11624
11634
  formatDevErrorMessage(`$cloneWithProperties: ${constructor.name}.clone(node) (with type '${constructor.getType()}') did not return a node with the same key, make sure to specify node.__key as the last argument to the constructor`);
11625
11635
  }
11626
11636
  if (!(mutableNode.__parent === latestNode.__parent && mutableNode.__next === latestNode.__next && mutableNode.__prev === latestNode.__prev)) {
11627
- formatDevErrorMessage(`$cloneWithProperties: ${constructor.name}.clone(node) (with type '${constructor.getType()}') overrided afterCloneFrom but did not call super.afterCloneFrom(prevNode)`);
11637
+ formatDevErrorMessage(`$cloneWithProperties: ${constructor.name}.clone(node) (with type '${constructor.getType()}') overrode afterCloneFrom but did not call super.afterCloneFrom(prevNode)`);
11628
11638
  }
11629
11639
  }
11630
11640
  return mutableNode;