lexical 0.37.1-nightly.20251017.0 → 0.37.1-nightly.20251021.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
@@ -10058,6 +10058,37 @@ function initializeConversionCache(nodes, additionalConversions) {
10058
10058
  return conversionCache;
10059
10059
  }
10060
10060
 
10061
+ /** @internal */
10062
+ function getTransformSetFromKlass(klass) {
10063
+ const transforms = new Set();
10064
+ const staticTransforms = new Set();
10065
+ let currentKlass = klass;
10066
+ while (currentKlass) {
10067
+ const {
10068
+ ownNodeConfig
10069
+ } = getStaticNodeConfig(currentKlass);
10070
+ const staticTransform = currentKlass.transform;
10071
+ if (!staticTransforms.has(staticTransform)) {
10072
+ staticTransforms.add(staticTransform);
10073
+ const transform = currentKlass.transform();
10074
+ if (transform) {
10075
+ transforms.add(transform);
10076
+ }
10077
+ }
10078
+ if (ownNodeConfig) {
10079
+ const $transform = ownNodeConfig.$transform;
10080
+ if ($transform) {
10081
+ transforms.add($transform);
10082
+ }
10083
+ currentKlass = ownNodeConfig.extends;
10084
+ } else {
10085
+ const parent = Object.getPrototypeOf(currentKlass);
10086
+ currentKlass = parent.prototype instanceof LexicalNode && parent !== LexicalNode ? parent : undefined;
10087
+ }
10088
+ }
10089
+ return transforms;
10090
+ }
10091
+
10061
10092
  /**
10062
10093
  * Creates a new LexicalEditor attached to a single contentEditable (provided in the config). This is
10063
10094
  * the lowest-level initialization API for a LexicalEditor. If you're using React or another framework,
@@ -10095,9 +10126,9 @@ function createEditor(editorConfig) {
10095
10126
  replace = options.with;
10096
10127
  replaceWithKlass = options.withKlass || null;
10097
10128
  }
10098
- const {
10099
- ownNodeConfig
10100
- } = getStaticNodeConfig(klass);
10129
+ // For the side-effect of filling in the static methods
10130
+ void getStaticNodeConfig(klass);
10131
+
10101
10132
  // Ensure custom nodes implement required methods and replaceWithKlass is instance of base klass.
10102
10133
  {
10103
10134
  // ArtificialNode__DO_NOT_USE can get renamed, so we use the type
@@ -10129,14 +10160,7 @@ function createEditor(editorConfig) {
10129
10160
  }
10130
10161
  }
10131
10162
  const type = klass.getType();
10132
- const transform = klass.transform();
10133
- const transforms = new Set();
10134
- if (ownNodeConfig && ownNodeConfig.$transform) {
10135
- transforms.add(ownNodeConfig.$transform);
10136
- }
10137
- if (transform !== null) {
10138
- transforms.add(transform);
10139
- }
10163
+ const transforms = getTransformSetFromKlass(klass);
10140
10164
  registeredNodes.set(type, {
10141
10165
  exportDOM: html && html.export ? html.export.get(klass) : undefined,
10142
10166
  klass,
@@ -10835,7 +10859,7 @@ class LexicalEditor {
10835
10859
  };
10836
10860
  }
10837
10861
  }
10838
- LexicalEditor.version = "0.37.1-nightly.20251017.0+dev.cjs";
10862
+ LexicalEditor.version = "0.37.1-nightly.20251021.0+dev.cjs";
10839
10863
 
10840
10864
  let pendingNodeToClone = null;
10841
10865
  function setPendingNodeToClone(pendingNode) {
@@ -14145,6 +14169,7 @@ exports.getRegisteredNode = getRegisteredNode;
14145
14169
  exports.getRegisteredNodeOrThrow = getRegisteredNodeOrThrow;
14146
14170
  exports.getStaticNodeConfig = getStaticNodeConfig;
14147
14171
  exports.getTextDirection = getTextDirection;
14172
+ exports.getTransformSetFromKlass = getTransformSetFromKlass;
14148
14173
  exports.isBlockDomNode = isBlockDomNode;
14149
14174
  exports.isCurrentlyReadOnlyMode = isCurrentlyReadOnlyMode;
14150
14175
  exports.isDOMDocumentNode = isDOMDocumentNode;
package/Lexical.dev.mjs CHANGED
@@ -10056,6 +10056,37 @@ function initializeConversionCache(nodes, additionalConversions) {
10056
10056
  return conversionCache;
10057
10057
  }
10058
10058
 
10059
+ /** @internal */
10060
+ function getTransformSetFromKlass(klass) {
10061
+ const transforms = new Set();
10062
+ const staticTransforms = new Set();
10063
+ let currentKlass = klass;
10064
+ while (currentKlass) {
10065
+ const {
10066
+ ownNodeConfig
10067
+ } = getStaticNodeConfig(currentKlass);
10068
+ const staticTransform = currentKlass.transform;
10069
+ if (!staticTransforms.has(staticTransform)) {
10070
+ staticTransforms.add(staticTransform);
10071
+ const transform = currentKlass.transform();
10072
+ if (transform) {
10073
+ transforms.add(transform);
10074
+ }
10075
+ }
10076
+ if (ownNodeConfig) {
10077
+ const $transform = ownNodeConfig.$transform;
10078
+ if ($transform) {
10079
+ transforms.add($transform);
10080
+ }
10081
+ currentKlass = ownNodeConfig.extends;
10082
+ } else {
10083
+ const parent = Object.getPrototypeOf(currentKlass);
10084
+ currentKlass = parent.prototype instanceof LexicalNode && parent !== LexicalNode ? parent : undefined;
10085
+ }
10086
+ }
10087
+ return transforms;
10088
+ }
10089
+
10059
10090
  /**
10060
10091
  * Creates a new LexicalEditor attached to a single contentEditable (provided in the config). This is
10061
10092
  * the lowest-level initialization API for a LexicalEditor. If you're using React or another framework,
@@ -10093,9 +10124,9 @@ function createEditor(editorConfig) {
10093
10124
  replace = options.with;
10094
10125
  replaceWithKlass = options.withKlass || null;
10095
10126
  }
10096
- const {
10097
- ownNodeConfig
10098
- } = getStaticNodeConfig(klass);
10127
+ // For the side-effect of filling in the static methods
10128
+ void getStaticNodeConfig(klass);
10129
+
10099
10130
  // Ensure custom nodes implement required methods and replaceWithKlass is instance of base klass.
10100
10131
  {
10101
10132
  // ArtificialNode__DO_NOT_USE can get renamed, so we use the type
@@ -10127,14 +10158,7 @@ function createEditor(editorConfig) {
10127
10158
  }
10128
10159
  }
10129
10160
  const type = klass.getType();
10130
- const transform = klass.transform();
10131
- const transforms = new Set();
10132
- if (ownNodeConfig && ownNodeConfig.$transform) {
10133
- transforms.add(ownNodeConfig.$transform);
10134
- }
10135
- if (transform !== null) {
10136
- transforms.add(transform);
10137
- }
10161
+ const transforms = getTransformSetFromKlass(klass);
10138
10162
  registeredNodes.set(type, {
10139
10163
  exportDOM: html && html.export ? html.export.get(klass) : undefined,
10140
10164
  klass,
@@ -10833,7 +10857,7 @@ class LexicalEditor {
10833
10857
  };
10834
10858
  }
10835
10859
  }
10836
- LexicalEditor.version = "0.37.1-nightly.20251017.0+dev.esm";
10860
+ LexicalEditor.version = "0.37.1-nightly.20251021.0+dev.esm";
10837
10861
 
10838
10862
  let pendingNodeToClone = null;
10839
10863
  function setPendingNodeToClone(pendingNode) {
@@ -13955,4 +13979,4 @@ function shallowMergeConfig(config, overrides) {
13955
13979
  return config;
13956
13980
  }
13957
13981
 
13958
- export { $addUpdateTag, $applyNodeReplacement, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $cloneWithPropertiesEphemeral, $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, $getNodeFromDOMNode, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isEditorState, $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, SKIP_SELECTION_FOCUS_TAG, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, buildImportMap, configExtension, createCommand, createEditor, createSharedNodeState, createState, declarePeerDependency, defineExtension, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, getRegisteredNode, getRegisteredNodeOrThrow, getStaticNodeConfig, getTextDirection, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isExactShortcutMatch, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, isLexicalEditor, isModifierMatch, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, removeFromParent, resetRandomKey, safeCast, setDOMUnmanaged, setNodeIndentFromDOM, shallowMergeConfig };
13982
+ export { $addUpdateTag, $applyNodeReplacement, $caretFromPoint, $caretRangeFromSelection, $cloneWithProperties, $cloneWithPropertiesEphemeral, $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, $getNodeFromDOMNode, $getPreviousSelection, $getRoot, $getSelection, $getSiblingCaret, $getState, $getStateChange, $getTextContent, $getTextNodeOffset, $getTextPointCaret, $getTextPointCaretSlice, $getWritableNodeState, $hasAncestor, $hasUpdateTag, $insertNodes, $isBlockElementNode, $isChildCaret, $isDecoratorNode, $isEditorState, $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, SKIP_SELECTION_FOCUS_TAG, TEXT_TYPE_TO_FORMAT, TabNode, TextNode, UNDO_COMMAND, buildImportMap, configExtension, createCommand, createEditor, createSharedNodeState, createState, declarePeerDependency, defineExtension, flipDirection, getDOMOwnerDocument, getDOMSelection, getDOMSelectionFromTarget, getDOMTextNode, getEditorPropertyFromDOMNode, getNearestEditorFromDOMNode, getRegisteredNode, getRegisteredNodeOrThrow, getStaticNodeConfig, getTextDirection, getTransformSetFromKlass, isBlockDomNode, isCurrentlyReadOnlyMode, isDOMDocumentNode, isDOMNode, isDOMTextNode, isDOMUnmanaged, isDocumentFragment, isExactShortcutMatch, isHTMLAnchorElement, isHTMLElement, isInlineDomNode, isLexicalEditor, isModifierMatch, isSelectionCapturedInDecoratorInput, isSelectionWithinEditor, makeStepwiseIterator, removeFromParent, resetRandomKey, safeCast, setDOMUnmanaged, setNodeIndentFromDOM, shallowMergeConfig };
package/Lexical.js.flow CHANGED
@@ -1678,3 +1678,6 @@ declare export function shallowMergeConfig<T: ExtensionConfigBase>(
1678
1678
  config: T,
1679
1679
  overrides?: Partial<T>,
1680
1680
  ): T;
1681
+ declare export function getTransformSetFromKlass(
1682
+ klass: Class<typeof LexicalNode>,
1683
+ ): Set<Transform<LexicalNode>>;
package/Lexical.mjs CHANGED
@@ -197,6 +197,7 @@ export const getRegisteredNode = mod.getRegisteredNode;
197
197
  export const getRegisteredNodeOrThrow = mod.getRegisteredNodeOrThrow;
198
198
  export const getStaticNodeConfig = mod.getStaticNodeConfig;
199
199
  export const getTextDirection = mod.getTextDirection;
200
+ export const getTransformSetFromKlass = mod.getTransformSetFromKlass;
200
201
  export const isBlockDomNode = mod.isBlockDomNode;
201
202
  export const isCurrentlyReadOnlyMode = mod.isCurrentlyReadOnlyMode;
202
203
  export const isDOMDocumentNode = mod.isDOMDocumentNode;
package/Lexical.node.mjs CHANGED
@@ -195,6 +195,7 @@ export const getRegisteredNode = mod.getRegisteredNode;
195
195
  export const getRegisteredNodeOrThrow = mod.getRegisteredNodeOrThrow;
196
196
  export const getStaticNodeConfig = mod.getStaticNodeConfig;
197
197
  export const getTextDirection = mod.getTextDirection;
198
+ export const getTransformSetFromKlass = mod.getTransformSetFromKlass;
198
199
  export const isBlockDomNode = mod.isBlockDomNode;
199
200
  export const isCurrentlyReadOnlyMode = mod.isCurrentlyReadOnlyMode;
200
201
  export const isDOMDocumentNode = mod.isDOMDocumentNode;