lexical 0.35.1-nightly.20250912.0 → 0.35.1-nightly.20250916.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
@@ -10740,7 +10740,7 @@ class LexicalEditor {
10740
10740
  };
10741
10741
  }
10742
10742
  }
10743
- LexicalEditor.version = "0.35.1-nightly.20250912.0+dev.cjs";
10743
+ LexicalEditor.version = "0.35.1-nightly.20250916.0+dev.cjs";
10744
10744
 
10745
10745
  let pendingNodeToClone = null;
10746
10746
  function setPendingNodeToClone(pendingNode) {
@@ -11988,16 +11988,6 @@ function $splitNode(node, offset) {
11988
11988
  const [leftTree, rightTree] = recurse(startNode);
11989
11989
  return [leftTree, rightTree];
11990
11990
  }
11991
- function $findMatchingParent(startingNode, findFn) {
11992
- let curr = startingNode;
11993
- while (curr !== $getRoot() && curr != null) {
11994
- if (findFn(curr)) {
11995
- return curr;
11996
- }
11997
- curr = curr.getParent();
11998
- }
11999
- return null;
12000
- }
12001
11991
 
12002
11992
  /**
12003
11993
  * @param x - The element being tested
@@ -12301,6 +12291,25 @@ function $create(klass) {
12301
12291
  return new registeredNode.klass();
12302
12292
  }
12303
12293
 
12294
+ /**
12295
+ * Starts with a node and moves up the tree (toward the root node) to find a matching node based on
12296
+ * the search parameters of the findFn. (Consider JavaScripts' .find() function where a testing function must be
12297
+ * passed as an argument. eg. if( (node) => node.__type === 'div') ) return true; otherwise return false
12298
+ * @param startingNode - The node where the search starts.
12299
+ * @param findFn - A testing function that returns true if the current node satisfies the testing parameters.
12300
+ * @returns `startingNode` or one of its ancestors that matches the `findFn` predicate and is not the `RootNode`, or `null` if no match was found.
12301
+ */
12302
+ const $findMatchingParent = (startingNode, findFn) => {
12303
+ let curr = startingNode;
12304
+ while (curr != null && !$isRootNode(curr)) {
12305
+ if (findFn(curr)) {
12306
+ return curr;
12307
+ }
12308
+ curr = curr.getParent();
12309
+ }
12310
+ return null;
12311
+ };
12312
+
12304
12313
  /**
12305
12314
  * The direction of a caret, 'next' points towards the end of the document
12306
12315
  * and 'previous' points towards the beginning
@@ -13662,6 +13671,7 @@ exports.$createRangeSelectionFromDom = $createRangeSelectionFromDom;
13662
13671
  exports.$createTabNode = $createTabNode;
13663
13672
  exports.$createTextNode = $createTextNode;
13664
13673
  exports.$extendCaretToRange = $extendCaretToRange;
13674
+ exports.$findMatchingParent = $findMatchingParent;
13665
13675
  exports.$getAdjacentChildCaret = $getAdjacentChildCaret;
13666
13676
  exports.$getAdjacentNode = $getAdjacentNode;
13667
13677
  exports.$getAdjacentSiblingOrParentSiblingCaret = $getAdjacentSiblingOrParentSiblingCaret;
package/Lexical.dev.mjs CHANGED
@@ -10738,7 +10738,7 @@ class LexicalEditor {
10738
10738
  };
10739
10739
  }
10740
10740
  }
10741
- LexicalEditor.version = "0.35.1-nightly.20250912.0+dev.esm";
10741
+ LexicalEditor.version = "0.35.1-nightly.20250916.0+dev.esm";
10742
10742
 
10743
10743
  let pendingNodeToClone = null;
10744
10744
  function setPendingNodeToClone(pendingNode) {
@@ -11986,16 +11986,6 @@ function $splitNode(node, offset) {
11986
11986
  const [leftTree, rightTree] = recurse(startNode);
11987
11987
  return [leftTree, rightTree];
11988
11988
  }
11989
- function $findMatchingParent(startingNode, findFn) {
11990
- let curr = startingNode;
11991
- while (curr !== $getRoot() && curr != null) {
11992
- if (findFn(curr)) {
11993
- return curr;
11994
- }
11995
- curr = curr.getParent();
11996
- }
11997
- return null;
11998
- }
11999
11989
 
12000
11990
  /**
12001
11991
  * @param x - The element being tested
@@ -12299,6 +12289,25 @@ function $create(klass) {
12299
12289
  return new registeredNode.klass();
12300
12290
  }
12301
12291
 
12292
+ /**
12293
+ * Starts with a node and moves up the tree (toward the root node) to find a matching node based on
12294
+ * the search parameters of the findFn. (Consider JavaScripts' .find() function where a testing function must be
12295
+ * passed as an argument. eg. if( (node) => node.__type === 'div') ) return true; otherwise return false
12296
+ * @param startingNode - The node where the search starts.
12297
+ * @param findFn - A testing function that returns true if the current node satisfies the testing parameters.
12298
+ * @returns `startingNode` or one of its ancestors that matches the `findFn` predicate and is not the `RootNode`, or `null` if no match was found.
12299
+ */
12300
+ const $findMatchingParent = (startingNode, findFn) => {
12301
+ let curr = startingNode;
12302
+ while (curr != null && !$isRootNode(curr)) {
12303
+ if (findFn(curr)) {
12304
+ return curr;
12305
+ }
12306
+ curr = curr.getParent();
12307
+ }
12308
+ return null;
12309
+ };
12310
+
12302
12311
  /**
12303
12312
  * The direction of a caret, 'next' points towards the end of the document
12304
12313
  * and 'previous' points towards the beginning
@@ -13643,4 +13652,4 @@ function $splitAtPointCaretNext(pointCaret, {
13643
13652
  return parentCaret;
13644
13653
  }
13645
13654
 
13646
- export { $addUpdateTag, $applyNodeReplacement, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $comparePointCaretNext, $copyNode, $create, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createPoint, $createRangeSelection, $createRangeSelectionFromDom, $createTabNode, $createTextNode, $extendCaretToRange, $getAdjacentChildCaret, $getAdjacentNode, $getAdjacentSiblingOrParentSiblingCaret, $getCaretInDirection, $getCaretRange, $getCaretRangeInDirection, $getCharacterOffsets, $getChildCaret, $getChildCaretAtIndex, $getChildCaretOrSelf, $getCollapsedCaretRange, $getCommonAncestor, $getCommonAncestorResultBranchOrder, $getEditor, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getNodeByKeyOrThrow, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isElementNode, $isExtendableTextPointCaret, $isInlineElementOrDecoratorNode, $isLeafNode, $isLineBreakNode, $isNodeCaret, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isRootOrShadowRoot, $isSiblingCaret, $isTabNode, $isTextNode, $isTextPointCaret, $isTextPointCaretSlice, $isTokenOrSegmented, $isTokenOrTab, $nodesOfType, $normalizeCaret, $normalizeSelection as $normalizeSelection__EXPERIMENTAL, $onUpdate, $parseSerializedNode, $removeTextFromCaretRange, $rewindSiblingCaret, $selectAll, $setCompositionKey, $setPointFromCaret, $setSelection, $setSelectionFromCaretRange, $setState, $splitAtPointCaretNext, $splitNode, $updateRangeSelectionFromCaretRange, ArtificialNode__DO_NOT_USE, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, COLLABORATION_TAG, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, DecoratorNode, ElementNode, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, HISTORIC_TAG, HISTORY_MERGE_TAG, HISTORY_PUSH_TAG, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, INTERNAL_$isBlock, IS_ALL_FORMATTING, IS_BOLD, IS_CODE, IS_HIGHLIGHT, IS_ITALIC, IS_STRIKETHROUGH, IS_SUBSCRIPT, IS_SUPERSCRIPT, IS_UNDERLINE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, LineBreakNode, MOVE_TO_END, MOVE_TO_START, NODE_STATE_KEY, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, PASTE_TAG, ParagraphNode, REDO_COMMAND, REMOVE_TEXT_COMMAND, RootNode, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, SELECT_ALL_COMMAND, SKIP_COLLAB_TAG, SKIP_DOM_SELECTION_TAG, SKIP_SCROLL_INTO_VIEW_TAG, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, buildImportMap, createCommand, createEditor, createSharedNodeState, createState, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, getRegisteredNode, getRegisteredNodeOrThrow, getStaticNodeConfig, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isExactShortcutMatch, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, isLexicalEditor, isModifierMatch, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, removeFromParent, resetRandomKey, setDOMUnmanaged, setNodeIndentFromDOM };
13655
+ export { $addUpdateTag, $applyNodeReplacement, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $comparePointCaretNext, $copyNode, $create, $createLineBreakNode, $createNodeSelection, $createParagraphNode, $createPoint, $createRangeSelection, $createRangeSelectionFromDom, $createTabNode, $createTextNode, $extendCaretToRange, $findMatchingParent, $getAdjacentChildCaret, $getAdjacentNode, $getAdjacentSiblingOrParentSiblingCaret, $getCaretInDirection, $getCaretRange, $getCaretRangeInDirection, $getCharacterOffsets, $getChildCaret, $getChildCaretAtIndex, $getChildCaretOrSelf, $getCollapsedCaretRange, $getCommonAncestor, $getCommonAncestorResultBranchOrder, $getEditor, $getNearestNodeFromDOMNode, $getNearestRootOrShadowRoot, $getNodeByKey, $getNodeByKeyOrThrow, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isElementNode, $isExtendableTextPointCaret, $isInlineElementOrDecoratorNode, $isLeafNode, $isLineBreakNode, $isNodeCaret, $isNodeSelection, $isParagraphNode, $isRangeSelection, $isRootNode, $isRootOrShadowRoot, $isSiblingCaret, $isTabNode, $isTextNode, $isTextPointCaret, $isTextPointCaretSlice, $isTokenOrSegmented, $isTokenOrTab, $nodesOfType, $normalizeCaret, $normalizeSelection as $normalizeSelection__EXPERIMENTAL, $onUpdate, $parseSerializedNode, $removeTextFromCaretRange, $rewindSiblingCaret, $selectAll, $setCompositionKey, $setPointFromCaret, $setSelection, $setSelectionFromCaretRange, $setState, $splitAtPointCaretNext, $splitNode, $updateRangeSelectionFromCaretRange, ArtificialNode__DO_NOT_USE, BLUR_COMMAND, CAN_REDO_COMMAND, CAN_UNDO_COMMAND, CLEAR_EDITOR_COMMAND, CLEAR_HISTORY_COMMAND, CLICK_COMMAND, COLLABORATION_TAG, COMMAND_PRIORITY_CRITICAL, COMMAND_PRIORITY_EDITOR, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_NORMAL, CONTROLLED_TEXT_INSERTION_COMMAND, COPY_COMMAND, CUT_COMMAND, DELETE_CHARACTER_COMMAND, DELETE_LINE_COMMAND, DELETE_WORD_COMMAND, DRAGEND_COMMAND, DRAGOVER_COMMAND, DRAGSTART_COMMAND, DROP_COMMAND, DecoratorNode, ElementNode, FOCUS_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, HISTORIC_TAG, HISTORY_MERGE_TAG, HISTORY_PUSH_TAG, INDENT_CONTENT_COMMAND, INSERT_LINE_BREAK_COMMAND, INSERT_PARAGRAPH_COMMAND, INSERT_TAB_COMMAND, INTERNAL_$isBlock, IS_ALL_FORMATTING, IS_BOLD, IS_CODE, IS_HIGHLIGHT, IS_ITALIC, IS_STRIKETHROUGH, IS_SUBSCRIPT, IS_SUPERSCRIPT, IS_UNDERLINE, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, KEY_DOWN_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND, KEY_MODIFIER_COMMAND, KEY_SPACE_COMMAND, KEY_TAB_COMMAND, LineBreakNode, MOVE_TO_END, MOVE_TO_START, NODE_STATE_KEY, OUTDENT_CONTENT_COMMAND, PASTE_COMMAND, PASTE_TAG, ParagraphNode, REDO_COMMAND, REMOVE_TEXT_COMMAND, RootNode, SELECTION_CHANGE_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, SELECT_ALL_COMMAND, SKIP_COLLAB_TAG, SKIP_DOM_SELECTION_TAG, SKIP_SCROLL_INTO_VIEW_TAG, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, buildImportMap, createCommand, createEditor, createSharedNodeState, createState, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, getRegisteredNode, getRegisteredNodeOrThrow, getStaticNodeConfig, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isExactShortcutMatch, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, isLexicalEditor, isModifierMatch, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, removeFromParent, resetRandomKey, setDOMUnmanaged, setNodeIndentFromDOM };
package/Lexical.mjs CHANGED
@@ -26,6 +26,7 @@ export const $createRangeSelectionFromDom = mod.$createRangeSelectionFromDom;
26
26
  export const $createTabNode = mod.$createTabNode;
27
27
  export const $createTextNode = mod.$createTextNode;
28
28
  export const $extendCaretToRange = mod.$extendCaretToRange;
29
+ export const $findMatchingParent = mod.$findMatchingParent;
29
30
  export const $getAdjacentChildCaret = mod.$getAdjacentChildCaret;
30
31
  export const $getAdjacentNode = mod.$getAdjacentNode;
31
32
  export const $getAdjacentSiblingOrParentSiblingCaret = mod.$getAdjacentSiblingOrParentSiblingCaret;
package/Lexical.node.mjs CHANGED
@@ -24,6 +24,7 @@ export const $createRangeSelectionFromDom = mod.$createRangeSelectionFromDom;
24
24
  export const $createTabNode = mod.$createTabNode;
25
25
  export const $createTextNode = mod.$createTextNode;
26
26
  export const $extendCaretToRange = mod.$extendCaretToRange;
27
+ export const $findMatchingParent = mod.$findMatchingParent;
27
28
  export const $getAdjacentChildCaret = mod.$getAdjacentChildCaret;
28
29
  export const $getAdjacentNode = mod.$getAdjacentNode;
29
30
  export const $getAdjacentSiblingOrParentSiblingCaret = mod.$getAdjacentSiblingOrParentSiblingCaret;