zurfyx-lexical-react 0.39.1-nightly.20251225.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/README.md +90 -0
- package/dist/ExtensionComponent.d.ts +42 -0
- package/dist/LexicalAutoEmbedPlugin.d.ts +39 -0
- package/dist/LexicalAutoEmbedPlugin.dev.js +146 -0
- package/dist/LexicalAutoEmbedPlugin.dev.mjs +141 -0
- package/dist/LexicalAutoEmbedPlugin.js +11 -0
- package/dist/LexicalAutoEmbedPlugin.mjs +15 -0
- package/dist/LexicalAutoEmbedPlugin.node.mjs +13 -0
- package/dist/LexicalAutoEmbedPlugin.prod.js +9 -0
- package/dist/LexicalAutoEmbedPlugin.prod.mjs +9 -0
- package/dist/LexicalAutoFocusPlugin.d.ts +12 -0
- package/dist/LexicalAutoFocusPlugin.dev.js +47 -0
- package/dist/LexicalAutoFocusPlugin.dev.mjs +45 -0
- package/dist/LexicalAutoFocusPlugin.js +11 -0
- package/dist/LexicalAutoFocusPlugin.mjs +12 -0
- package/dist/LexicalAutoFocusPlugin.node.mjs +10 -0
- package/dist/LexicalAutoFocusPlugin.prod.js +9 -0
- package/dist/LexicalAutoFocusPlugin.prod.mjs +9 -0
- package/dist/LexicalAutoLinkPlugin.d.ts +14 -0
- package/dist/LexicalAutoLinkPlugin.dev.js +54 -0
- package/dist/LexicalAutoLinkPlugin.dev.mjs +52 -0
- package/dist/LexicalAutoLinkPlugin.js +11 -0
- package/dist/LexicalAutoLinkPlugin.mjs +13 -0
- package/dist/LexicalAutoLinkPlugin.node.mjs +11 -0
- package/dist/LexicalAutoLinkPlugin.prod.js +9 -0
- package/dist/LexicalAutoLinkPlugin.prod.mjs +9 -0
- package/dist/LexicalBlockWithAlignableContents.d.ts +21 -0
- package/dist/LexicalBlockWithAlignableContents.dev.js +81 -0
- package/dist/LexicalBlockWithAlignableContents.dev.mjs +79 -0
- package/dist/LexicalBlockWithAlignableContents.js +11 -0
- package/dist/LexicalBlockWithAlignableContents.mjs +12 -0
- package/dist/LexicalBlockWithAlignableContents.node.mjs +10 -0
- package/dist/LexicalBlockWithAlignableContents.prod.js +9 -0
- package/dist/LexicalBlockWithAlignableContents.prod.mjs +9 -0
- package/dist/LexicalCharacterLimitPlugin.d.ts +15 -0
- package/dist/LexicalCharacterLimitPlugin.dev.js +292 -0
- package/dist/LexicalCharacterLimitPlugin.dev.mjs +290 -0
- package/dist/LexicalCharacterLimitPlugin.js +11 -0
- package/dist/LexicalCharacterLimitPlugin.mjs +12 -0
- package/dist/LexicalCharacterLimitPlugin.node.mjs +10 -0
- package/dist/LexicalCharacterLimitPlugin.prod.js +9 -0
- package/dist/LexicalCharacterLimitPlugin.prod.mjs +9 -0
- package/dist/LexicalCheckListPlugin.d.ts +8 -0
- package/dist/LexicalCheckListPlugin.dev.js +31 -0
- package/dist/LexicalCheckListPlugin.dev.mjs +29 -0
- package/dist/LexicalCheckListPlugin.js +11 -0
- package/dist/LexicalCheckListPlugin.mjs +12 -0
- package/dist/LexicalCheckListPlugin.node.mjs +10 -0
- package/dist/LexicalCheckListPlugin.prod.js +9 -0
- package/dist/LexicalCheckListPlugin.prod.mjs +9 -0
- package/dist/LexicalClearEditorPlugin.d.ts +13 -0
- package/dist/LexicalClearEditorPlugin.dev.js +55 -0
- package/dist/LexicalClearEditorPlugin.dev.mjs +53 -0
- package/dist/LexicalClearEditorPlugin.js +11 -0
- package/dist/LexicalClearEditorPlugin.mjs +12 -0
- package/dist/LexicalClearEditorPlugin.node.mjs +10 -0
- package/dist/LexicalClearEditorPlugin.prod.js +9 -0
- package/dist/LexicalClearEditorPlugin.prod.mjs +9 -0
- package/dist/LexicalClickableLinkPlugin.d.ts +11 -0
- package/dist/LexicalClickableLinkPlugin.dev.js +38 -0
- package/dist/LexicalClickableLinkPlugin.dev.mjs +36 -0
- package/dist/LexicalClickableLinkPlugin.js +11 -0
- package/dist/LexicalClickableLinkPlugin.mjs +12 -0
- package/dist/LexicalClickableLinkPlugin.node.mjs +10 -0
- package/dist/LexicalClickableLinkPlugin.prod.js +9 -0
- package/dist/LexicalClickableLinkPlugin.prod.mjs +9 -0
- package/dist/LexicalCollaborationContext.d.ts +19 -0
- package/dist/LexicalCollaborationContext.dev.js +69 -0
- package/dist/LexicalCollaborationContext.dev.mjs +65 -0
- package/dist/LexicalCollaborationContext.js +11 -0
- package/dist/LexicalCollaborationContext.mjs +14 -0
- package/dist/LexicalCollaborationContext.node.mjs +12 -0
- package/dist/LexicalCollaborationContext.prod.js +9 -0
- package/dist/LexicalCollaborationContext.prod.mjs +9 -0
- package/dist/LexicalCollaborationPlugin.d.ts +39 -0
- package/dist/LexicalCollaborationPlugin.dev.js +558 -0
- package/dist/LexicalCollaborationPlugin.dev.mjs +543 -0
- package/dist/LexicalCollaborationPlugin.js +11 -0
- package/dist/LexicalCollaborationPlugin.mjs +13 -0
- package/dist/LexicalCollaborationPlugin.node.mjs +11 -0
- package/dist/LexicalCollaborationPlugin.prod.js +9 -0
- package/dist/LexicalCollaborationPlugin.prod.mjs +9 -0
- package/dist/LexicalComposer.d.ts +25 -0
- package/dist/LexicalComposer.dev.js +134 -0
- package/dist/LexicalComposer.dev.mjs +132 -0
- package/dist/LexicalComposer.js +11 -0
- package/dist/LexicalComposer.mjs +12 -0
- package/dist/LexicalComposer.node.mjs +10 -0
- package/dist/LexicalComposer.prod.js +9 -0
- package/dist/LexicalComposer.prod.mjs +9 -0
- package/dist/LexicalComposerContext.d.ts +18 -0
- package/dist/LexicalComposerContext.dev.js +55 -0
- package/dist/LexicalComposerContext.dev.mjs +51 -0
- package/dist/LexicalComposerContext.js +11 -0
- package/dist/LexicalComposerContext.mjs +14 -0
- package/dist/LexicalComposerContext.node.mjs +12 -0
- package/dist/LexicalComposerContext.prod.js +9 -0
- package/dist/LexicalComposerContext.prod.mjs +9 -0
- package/dist/LexicalContentEditable.d.ts +26 -0
- package/dist/LexicalContentEditable.dev.js +242 -0
- package/dist/LexicalContentEditable.dev.mjs +239 -0
- package/dist/LexicalContentEditable.js +11 -0
- package/dist/LexicalContentEditable.mjs +13 -0
- package/dist/LexicalContentEditable.node.mjs +11 -0
- package/dist/LexicalContentEditable.prod.js +9 -0
- package/dist/LexicalContentEditable.prod.mjs +9 -0
- package/dist/LexicalContextMenuPlugin.d.ts +36 -0
- package/dist/LexicalContextMenuPlugin.dev.js +524 -0
- package/dist/LexicalContextMenuPlugin.dev.mjs +509 -0
- package/dist/LexicalContextMenuPlugin.js +11 -0
- package/dist/LexicalContextMenuPlugin.mjs +13 -0
- package/dist/LexicalContextMenuPlugin.node.mjs +11 -0
- package/dist/LexicalContextMenuPlugin.prod.js +9 -0
- package/dist/LexicalContextMenuPlugin.prod.mjs +9 -0
- package/dist/LexicalDecoratorBlockNode.d.ts +25 -0
- package/dist/LexicalDecoratorBlockNode.dev.js +59 -0
- package/dist/LexicalDecoratorBlockNode.dev.mjs +56 -0
- package/dist/LexicalDecoratorBlockNode.js +11 -0
- package/dist/LexicalDecoratorBlockNode.mjs +13 -0
- package/dist/LexicalDecoratorBlockNode.node.mjs +11 -0
- package/dist/LexicalDecoratorBlockNode.prod.js +9 -0
- package/dist/LexicalDecoratorBlockNode.prod.mjs +9 -0
- package/dist/LexicalDraggableBlockPlugin.d.ts +18 -0
- package/dist/LexicalDraggableBlockPlugin.dev.js +534 -0
- package/dist/LexicalDraggableBlockPlugin.dev.mjs +532 -0
- package/dist/LexicalDraggableBlockPlugin.js +11 -0
- package/dist/LexicalDraggableBlockPlugin.mjs +12 -0
- package/dist/LexicalDraggableBlockPlugin.node.mjs +10 -0
- package/dist/LexicalDraggableBlockPlugin.prod.js +9 -0
- package/dist/LexicalDraggableBlockPlugin.prod.mjs +9 -0
- package/dist/LexicalEditorRefPlugin.d.ts +20 -0
- package/dist/LexicalEditorRefPlugin.dev.js +58 -0
- package/dist/LexicalEditorRefPlugin.dev.mjs +43 -0
- package/dist/LexicalEditorRefPlugin.js +11 -0
- package/dist/LexicalEditorRefPlugin.mjs +12 -0
- package/dist/LexicalEditorRefPlugin.node.mjs +10 -0
- package/dist/LexicalEditorRefPlugin.prod.js +9 -0
- package/dist/LexicalEditorRefPlugin.prod.mjs +9 -0
- package/dist/LexicalErrorBoundary.d.ts +13 -0
- package/dist/LexicalErrorBoundary.dev.js +40 -0
- package/dist/LexicalErrorBoundary.dev.mjs +38 -0
- package/dist/LexicalErrorBoundary.js +11 -0
- package/dist/LexicalErrorBoundary.mjs +12 -0
- package/dist/LexicalErrorBoundary.node.mjs +10 -0
- package/dist/LexicalErrorBoundary.prod.js +9 -0
- package/dist/LexicalErrorBoundary.prod.mjs +9 -0
- package/dist/LexicalExtensionComponent.dev.js +53 -0
- package/dist/LexicalExtensionComponent.dev.mjs +51 -0
- package/dist/LexicalExtensionComponent.js +11 -0
- package/dist/LexicalExtensionComponent.mjs +12 -0
- package/dist/LexicalExtensionComponent.node.mjs +10 -0
- package/dist/LexicalExtensionComponent.prod.js +9 -0
- package/dist/LexicalExtensionComponent.prod.mjs +9 -0
- package/dist/LexicalExtensionComposer.d.ts +69 -0
- package/dist/LexicalExtensionComposer.dev.js +105 -0
- package/dist/LexicalExtensionComposer.dev.mjs +103 -0
- package/dist/LexicalExtensionComposer.js +11 -0
- package/dist/LexicalExtensionComposer.mjs +12 -0
- package/dist/LexicalExtensionComposer.node.mjs +10 -0
- package/dist/LexicalExtensionComposer.prod.js +9 -0
- package/dist/LexicalExtensionComposer.prod.mjs +9 -0
- package/dist/LexicalHashtagPlugin.d.ts +9 -0
- package/dist/LexicalHashtagPlugin.dev.js +34 -0
- package/dist/LexicalHashtagPlugin.dev.mjs +32 -0
- package/dist/LexicalHashtagPlugin.js +11 -0
- package/dist/LexicalHashtagPlugin.mjs +12 -0
- package/dist/LexicalHashtagPlugin.node.mjs +10 -0
- package/dist/LexicalHashtagPlugin.prod.js +9 -0
- package/dist/LexicalHashtagPlugin.prod.mjs +9 -0
- package/dist/LexicalHistoryPlugin.d.ts +14 -0
- package/dist/LexicalHistoryPlugin.dev.js +48 -0
- package/dist/LexicalHistoryPlugin.dev.mjs +46 -0
- package/dist/LexicalHistoryPlugin.js +11 -0
- package/dist/LexicalHistoryPlugin.mjs +13 -0
- package/dist/LexicalHistoryPlugin.node.mjs +11 -0
- package/dist/LexicalHistoryPlugin.prod.js +9 -0
- package/dist/LexicalHistoryPlugin.prod.mjs +9 -0
- package/dist/LexicalHorizontalRuleNode.d.ts +25 -0
- package/dist/LexicalHorizontalRuleNode.dev.js +102 -0
- package/dist/LexicalHorizontalRuleNode.dev.mjs +98 -0
- package/dist/LexicalHorizontalRuleNode.js +11 -0
- package/dist/LexicalHorizontalRuleNode.mjs +15 -0
- package/dist/LexicalHorizontalRuleNode.node.mjs +13 -0
- package/dist/LexicalHorizontalRuleNode.prod.js +9 -0
- package/dist/LexicalHorizontalRuleNode.prod.mjs +9 -0
- package/dist/LexicalHorizontalRulePlugin.d.ts +8 -0
- package/dist/LexicalHorizontalRulePlugin.dev.js +44 -0
- package/dist/LexicalHorizontalRulePlugin.dev.mjs +42 -0
- package/dist/LexicalHorizontalRulePlugin.js +11 -0
- package/dist/LexicalHorizontalRulePlugin.mjs +12 -0
- package/dist/LexicalHorizontalRulePlugin.node.mjs +10 -0
- package/dist/LexicalHorizontalRulePlugin.prod.js +9 -0
- package/dist/LexicalHorizontalRulePlugin.prod.mjs +9 -0
- package/dist/LexicalLinkPlugin.d.ts +14 -0
- package/dist/LexicalLinkPlugin.dev.js +43 -0
- package/dist/LexicalLinkPlugin.dev.mjs +41 -0
- package/dist/LexicalLinkPlugin.js +11 -0
- package/dist/LexicalLinkPlugin.mjs +12 -0
- package/dist/LexicalLinkPlugin.node.mjs +10 -0
- package/dist/LexicalLinkPlugin.prod.js +9 -0
- package/dist/LexicalLinkPlugin.prod.mjs +9 -0
- package/dist/LexicalListPlugin.d.ts +15 -0
- package/dist/LexicalListPlugin.dev.js +56 -0
- package/dist/LexicalListPlugin.dev.mjs +54 -0
- package/dist/LexicalListPlugin.js +11 -0
- package/dist/LexicalListPlugin.mjs +12 -0
- package/dist/LexicalListPlugin.node.mjs +10 -0
- package/dist/LexicalListPlugin.prod.js +9 -0
- package/dist/LexicalListPlugin.prod.mjs +9 -0
- package/dist/LexicalMarkdownShortcutPlugin.d.ts +12 -0
- package/dist/LexicalMarkdownShortcutPlugin.dev.js +55 -0
- package/dist/LexicalMarkdownShortcutPlugin.dev.mjs +52 -0
- package/dist/LexicalMarkdownShortcutPlugin.js +11 -0
- package/dist/LexicalMarkdownShortcutPlugin.mjs +13 -0
- package/dist/LexicalMarkdownShortcutPlugin.node.mjs +11 -0
- package/dist/LexicalMarkdownShortcutPlugin.prod.js +9 -0
- package/dist/LexicalMarkdownShortcutPlugin.prod.mjs +9 -0
- package/dist/LexicalNestedComposer.d.ts +57 -0
- package/dist/LexicalNestedComposer.dev.js +161 -0
- package/dist/LexicalNestedComposer.dev.mjs +159 -0
- package/dist/LexicalNestedComposer.js +11 -0
- package/dist/LexicalNestedComposer.mjs +12 -0
- package/dist/LexicalNestedComposer.node.mjs +10 -0
- package/dist/LexicalNestedComposer.prod.js +9 -0
- package/dist/LexicalNestedComposer.prod.mjs +9 -0
- package/dist/LexicalNodeContextMenuPlugin.d.ts +46 -0
- package/dist/LexicalNodeContextMenuPlugin.dev.js +257 -0
- package/dist/LexicalNodeContextMenuPlugin.dev.mjs +253 -0
- package/dist/LexicalNodeContextMenuPlugin.js +11 -0
- package/dist/LexicalNodeContextMenuPlugin.mjs +14 -0
- package/dist/LexicalNodeContextMenuPlugin.node.mjs +12 -0
- package/dist/LexicalNodeContextMenuPlugin.prod.js +9 -0
- package/dist/LexicalNodeContextMenuPlugin.prod.mjs +9 -0
- package/dist/LexicalNodeEventPlugin.d.ts +13 -0
- package/dist/LexicalNodeEventPlugin.dev.js +61 -0
- package/dist/LexicalNodeEventPlugin.dev.mjs +59 -0
- package/dist/LexicalNodeEventPlugin.js +11 -0
- package/dist/LexicalNodeEventPlugin.mjs +12 -0
- package/dist/LexicalNodeEventPlugin.node.mjs +10 -0
- package/dist/LexicalNodeEventPlugin.prod.js +9 -0
- package/dist/LexicalNodeEventPlugin.prod.mjs +9 -0
- package/dist/LexicalNodeMenuPlugin.d.ts +24 -0
- package/dist/LexicalNodeMenuPlugin.dev.js +527 -0
- package/dist/LexicalNodeMenuPlugin.dev.mjs +524 -0
- package/dist/LexicalNodeMenuPlugin.js +11 -0
- package/dist/LexicalNodeMenuPlugin.mjs +13 -0
- package/dist/LexicalNodeMenuPlugin.node.mjs +11 -0
- package/dist/LexicalNodeMenuPlugin.prod.js +9 -0
- package/dist/LexicalNodeMenuPlugin.prod.mjs +9 -0
- package/dist/LexicalOnChangePlugin.d.ts +13 -0
- package/dist/LexicalOnChangePlugin.dev.js +72 -0
- package/dist/LexicalOnChangePlugin.dev.mjs +70 -0
- package/dist/LexicalOnChangePlugin.js +11 -0
- package/dist/LexicalOnChangePlugin.mjs +12 -0
- package/dist/LexicalOnChangePlugin.node.mjs +10 -0
- package/dist/LexicalOnChangePlugin.prod.js +9 -0
- package/dist/LexicalOnChangePlugin.prod.mjs +9 -0
- package/dist/LexicalPlainTextPlugin.d.ts +14 -0
- package/dist/LexicalPlainTextPlugin.dev.js +235 -0
- package/dist/LexicalPlainTextPlugin.dev.mjs +233 -0
- package/dist/LexicalPlainTextPlugin.js +11 -0
- package/dist/LexicalPlainTextPlugin.mjs +12 -0
- package/dist/LexicalPlainTextPlugin.node.mjs +10 -0
- package/dist/LexicalPlainTextPlugin.prod.js +9 -0
- package/dist/LexicalPlainTextPlugin.prod.mjs +9 -0
- package/dist/LexicalReactExtension.dev.js +187 -0
- package/dist/LexicalReactExtension.dev.mjs +184 -0
- package/dist/LexicalReactExtension.js +11 -0
- package/dist/LexicalReactExtension.mjs +13 -0
- package/dist/LexicalReactExtension.node.mjs +11 -0
- package/dist/LexicalReactExtension.prod.js +9 -0
- package/dist/LexicalReactExtension.prod.mjs +9 -0
- package/dist/LexicalReactPluginHostExtension.dev.js +189 -0
- package/dist/LexicalReactPluginHostExtension.dev.mjs +181 -0
- package/dist/LexicalReactPluginHostExtension.js +11 -0
- package/dist/LexicalReactPluginHostExtension.mjs +18 -0
- package/dist/LexicalReactPluginHostExtension.node.mjs +16 -0
- package/dist/LexicalReactPluginHostExtension.prod.js +9 -0
- package/dist/LexicalReactPluginHostExtension.prod.mjs +9 -0
- package/dist/LexicalReactProviderExtension.dev.js +33 -0
- package/dist/LexicalReactProviderExtension.dev.mjs +31 -0
- package/dist/LexicalReactProviderExtension.js +11 -0
- package/dist/LexicalReactProviderExtension.mjs +12 -0
- package/dist/LexicalReactProviderExtension.node.mjs +10 -0
- package/dist/LexicalReactProviderExtension.prod.js +9 -0
- package/dist/LexicalReactProviderExtension.prod.mjs +9 -0
- package/dist/LexicalRichTextPlugin.d.ts +14 -0
- package/dist/LexicalRichTextPlugin.dev.js +235 -0
- package/dist/LexicalRichTextPlugin.dev.mjs +233 -0
- package/dist/LexicalRichTextPlugin.js +11 -0
- package/dist/LexicalRichTextPlugin.mjs +12 -0
- package/dist/LexicalRichTextPlugin.node.mjs +10 -0
- package/dist/LexicalRichTextPlugin.prod.js +9 -0
- package/dist/LexicalRichTextPlugin.prod.mjs +9 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.d.ts +8 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.dev.js +31 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.dev.mjs +29 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.js +11 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.mjs +12 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.node.mjs +10 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.prod.js +9 -0
- package/dist/LexicalSelectionAlwaysOnDisplay.prod.mjs +9 -0
- package/dist/LexicalTabIndentationPlugin.d.ts +17 -0
- package/dist/LexicalTabIndentationPlugin.dev.js +40 -0
- package/dist/LexicalTabIndentationPlugin.dev.mjs +38 -0
- package/dist/LexicalTabIndentationPlugin.js +11 -0
- package/dist/LexicalTabIndentationPlugin.mjs +13 -0
- package/dist/LexicalTabIndentationPlugin.node.mjs +11 -0
- package/dist/LexicalTabIndentationPlugin.prod.js +9 -0
- package/dist/LexicalTabIndentationPlugin.prod.mjs +9 -0
- package/dist/LexicalTableOfContentsPlugin.d.ts +20 -0
- package/dist/LexicalTableOfContentsPlugin.dev.js +209 -0
- package/dist/LexicalTableOfContentsPlugin.dev.mjs +207 -0
- package/dist/LexicalTableOfContentsPlugin.js +11 -0
- package/dist/LexicalTableOfContentsPlugin.mjs +12 -0
- package/dist/LexicalTableOfContentsPlugin.node.mjs +10 -0
- package/dist/LexicalTableOfContentsPlugin.prod.js +9 -0
- package/dist/LexicalTableOfContentsPlugin.prod.mjs +9 -0
- package/dist/LexicalTablePlugin.d.ts +40 -0
- package/dist/LexicalTablePlugin.dev.js +77 -0
- package/dist/LexicalTablePlugin.dev.mjs +75 -0
- package/dist/LexicalTablePlugin.js +11 -0
- package/dist/LexicalTablePlugin.mjs +12 -0
- package/dist/LexicalTablePlugin.node.mjs +10 -0
- package/dist/LexicalTablePlugin.prod.js +9 -0
- package/dist/LexicalTablePlugin.prod.mjs +9 -0
- package/dist/LexicalTreeView.d.ts +37 -0
- package/dist/LexicalTreeView.dev.js +105 -0
- package/dist/LexicalTreeView.dev.mjs +91 -0
- package/dist/LexicalTreeView.js +11 -0
- package/dist/LexicalTreeView.mjs +12 -0
- package/dist/LexicalTreeView.node.mjs +10 -0
- package/dist/LexicalTreeView.prod.js +9 -0
- package/dist/LexicalTreeView.prod.mjs +9 -0
- package/dist/LexicalTreeViewExtension.dev.js +57 -0
- package/dist/LexicalTreeViewExtension.dev.mjs +54 -0
- package/dist/LexicalTreeViewExtension.js +11 -0
- package/dist/LexicalTreeViewExtension.mjs +13 -0
- package/dist/LexicalTreeViewExtension.node.mjs +11 -0
- package/dist/LexicalTreeViewExtension.prod.js +9 -0
- package/dist/LexicalTreeViewExtension.prod.mjs +9 -0
- package/dist/LexicalTypeaheadMenuPlugin.d.ts +40 -0
- package/dist/LexicalTypeaheadMenuPlugin.dev.js +654 -0
- package/dist/LexicalTypeaheadMenuPlugin.dev.mjs +646 -0
- package/dist/LexicalTypeaheadMenuPlugin.js +11 -0
- package/dist/LexicalTypeaheadMenuPlugin.mjs +18 -0
- package/dist/LexicalTypeaheadMenuPlugin.node.mjs +16 -0
- package/dist/LexicalTypeaheadMenuPlugin.prod.js +9 -0
- package/dist/LexicalTypeaheadMenuPlugin.prod.mjs +9 -0
- package/dist/ReactExtension.d.ts +41 -0
- package/dist/ReactPluginHostExtension.d.ts +56 -0
- package/dist/ReactProviderExtension.d.ts +9 -0
- package/dist/TreeViewExtension.d.ts +18 -0
- package/dist/shared/LegacyDecorators.d.ts +23 -0
- package/dist/shared/LexicalContentEditableElement.d.ts +43 -0
- package/dist/shared/LexicalMenu.d.ts +52 -0
- package/dist/shared/buildEditorComponent.d.ts +11 -0
- package/dist/shared/mergeRefs.d.ts +9 -0
- package/dist/shared/point.d.ts +21 -0
- package/dist/shared/rect.d.ts +45 -0
- package/dist/shared/types.d.ts +89 -0
- package/dist/shared/useCanShowPlaceholder.d.ts +9 -0
- package/dist/shared/useCharacterLimit.d.ts +16 -0
- package/dist/shared/useDecorators.d.ts +17 -0
- package/dist/shared/useHistory.d.ts +10 -0
- package/dist/shared/useList.d.ts +9 -0
- package/dist/shared/usePlainTextSetup.d.ts +9 -0
- package/dist/shared/useReactDecorators.d.ts +12 -0
- package/dist/shared/useRichTextSetup.d.ts +9 -0
- package/dist/shared/useYjsCollaboration.d.ts +25 -0
- package/dist/useExtensionComponent.d.ts +10 -0
- package/dist/useLexicalEditable.d.ts +16 -0
- package/dist/useLexicalEditable.dev.js +102 -0
- package/dist/useLexicalEditable.dev.mjs +100 -0
- package/dist/useLexicalEditable.js +11 -0
- package/dist/useLexicalEditable.mjs +12 -0
- package/dist/useLexicalEditable.node.mjs +10 -0
- package/dist/useLexicalEditable.prod.js +9 -0
- package/dist/useLexicalEditable.prod.mjs +9 -0
- package/dist/useLexicalExtensionComponent.dev.js +37 -0
- package/dist/useLexicalExtensionComponent.dev.mjs +34 -0
- package/dist/useLexicalExtensionComponent.js +11 -0
- package/dist/useLexicalExtensionComponent.mjs +13 -0
- package/dist/useLexicalExtensionComponent.node.mjs +11 -0
- package/dist/useLexicalExtensionComponent.prod.js +9 -0
- package/dist/useLexicalExtensionComponent.prod.mjs +9 -0
- package/dist/useLexicalIsTextContentEmpty.d.ts +9 -0
- package/dist/useLexicalIsTextContentEmpty.dev.js +60 -0
- package/dist/useLexicalIsTextContentEmpty.dev.mjs +58 -0
- package/dist/useLexicalIsTextContentEmpty.js +11 -0
- package/dist/useLexicalIsTextContentEmpty.mjs +12 -0
- package/dist/useLexicalIsTextContentEmpty.node.mjs +10 -0
- package/dist/useLexicalIsTextContentEmpty.prod.js +9 -0
- package/dist/useLexicalIsTextContentEmpty.prod.mjs +9 -0
- package/dist/useLexicalNodeSelection.d.ts +24 -0
- package/dist/useLexicalNodeSelection.dev.js +102 -0
- package/dist/useLexicalNodeSelection.dev.mjs +100 -0
- package/dist/useLexicalNodeSelection.js +11 -0
- package/dist/useLexicalNodeSelection.mjs +12 -0
- package/dist/useLexicalNodeSelection.node.mjs +10 -0
- package/dist/useLexicalNodeSelection.prod.js +9 -0
- package/dist/useLexicalNodeSelection.prod.mjs +9 -0
- package/dist/useLexicalSubscription.d.ts +17 -0
- package/dist/useLexicalSubscription.dev.js +73 -0
- package/dist/useLexicalSubscription.dev.mjs +71 -0
- package/dist/useLexicalSubscription.js +11 -0
- package/dist/useLexicalSubscription.mjs +12 -0
- package/dist/useLexicalSubscription.node.mjs +10 -0
- package/dist/useLexicalSubscription.prod.js +9 -0
- package/dist/useLexicalSubscription.prod.mjs +9 -0
- package/dist/useLexicalTextEntity.d.ts +10 -0
- package/dist/useLexicalTextEntity.dev.js +31 -0
- package/dist/useLexicalTextEntity.dev.mjs +29 -0
- package/dist/useLexicalTextEntity.js +11 -0
- package/dist/useLexicalTextEntity.mjs +12 -0
- package/dist/useLexicalTextEntity.node.mjs +10 -0
- package/dist/useLexicalTextEntity.prod.js +9 -0
- package/dist/useLexicalTextEntity.prod.mjs +9 -0
- package/flow/LexicalAutoEmbedPlugin.js.flow +64 -0
- package/flow/LexicalAutoFocusPlugin.js.flow +14 -0
- package/flow/LexicalAutoLinkPlugin.js.flow +18 -0
- package/flow/LexicalBlockWithAlignableContents.js.flow +28 -0
- package/flow/LexicalCharacterLimitPlugin.js.flow +12 -0
- package/flow/LexicalCheckListPlugin.js.flow +10 -0
- package/flow/LexicalClearEditorPlugin.js.flow +14 -0
- package/flow/LexicalClickableLinkPlugin.js.flow +12 -0
- package/flow/LexicalCollaborationContext.js.flow +22 -0
- package/flow/LexicalCollaborationPlugin.js.flow +50 -0
- package/flow/LexicalComposer.js.flow +40 -0
- package/flow/LexicalComposerContext.js.flow +27 -0
- package/flow/LexicalContentEditable.js.flow +80 -0
- package/flow/LexicalContextMenuPlugin.js.flow +13 -0
- package/flow/LexicalDecoratorBlockNode.js.flow +35 -0
- package/flow/LexicalDraggableBlockPlugin.js.flow +24 -0
- package/flow/LexicalEditorRefPlugin.js.flow +19 -0
- package/flow/LexicalErrorBoundary.js.flow +17 -0
- package/flow/LexicalExtensionComponent.js.flow +12 -0
- package/flow/LexicalExtensionComposer.js.flow +20 -0
- package/flow/LexicalHashtagPlugin.js.flow +10 -0
- package/flow/LexicalHistoryPlugin.js.flow +28 -0
- package/flow/LexicalHorizontalRuleNode.js.flow +27 -0
- package/flow/LexicalHorizontalRulePlugin.js.flow +12 -0
- package/flow/LexicalLinkPlugin.js.flow +21 -0
- package/flow/LexicalListPlugin.js.flow +15 -0
- package/flow/LexicalMarkdownShortcutPlugin.js.flow +16 -0
- package/flow/LexicalNestedComposer.js.flow +26 -0
- package/flow/LexicalNodeContextMenuPlugin.js.flow +12 -0
- package/flow/LexicalNodeEventPlugin.js.flow +20 -0
- package/flow/LexicalNodeMenuPlugin.js.flow +64 -0
- package/flow/LexicalOnChangePlugin.js.flow +16 -0
- package/flow/LexicalPlainTextPlugin.js.flow +29 -0
- package/flow/LexicalReactExtension.js.flow +68 -0
- package/flow/LexicalReactPluginHostExtension.js.flow +84 -0
- package/flow/LexicalReactProviderExtension.js.flow +12 -0
- package/flow/LexicalRichTextPlugin.js.flow +29 -0
- package/flow/LexicalSelectionAlwaysOnDisplay.js.flow +13 -0
- package/flow/LexicalTabIndentationPlugin.js.flow +21 -0
- package/flow/LexicalTableOfContentsPlugin.js.flow +18 -0
- package/flow/LexicalTablePlugin.js.flow +15 -0
- package/flow/LexicalTreeView.js.flow +21 -0
- package/flow/LexicalTreeViewExtension.js.flow +12 -0
- package/flow/LexicalTypeaheadMenuPlugin.js.flow +83 -0
- package/flow/useLexicalEditable.js.flow +12 -0
- package/flow/useLexicalExtensionComponent.js.flow +12 -0
- package/flow/useLexicalIsTextContentEmpty.js.flow +15 -0
- package/flow/useLexicalNodeSelection.js.flow +14 -0
- package/flow/useLexicalSubscription.js.flow +19 -0
- package/flow/useLexicalTextEntity.js.flow +18 -0
- package/npm/ExtensionComponent.d.ts +42 -0
- package/npm/LICENSE +21 -0
- package/npm/LexicalAutoEmbedPlugin.d.ts +39 -0
- package/npm/LexicalAutoEmbedPlugin.dev.js +146 -0
- package/npm/LexicalAutoEmbedPlugin.dev.mjs +141 -0
- package/npm/LexicalAutoEmbedPlugin.js +11 -0
- package/npm/LexicalAutoEmbedPlugin.js.flow +64 -0
- package/npm/LexicalAutoEmbedPlugin.mjs +15 -0
- package/npm/LexicalAutoEmbedPlugin.node.mjs +13 -0
- package/npm/LexicalAutoEmbedPlugin.prod.js +9 -0
- package/npm/LexicalAutoEmbedPlugin.prod.mjs +9 -0
- package/npm/LexicalAutoFocusPlugin.d.ts +12 -0
- package/npm/LexicalAutoFocusPlugin.dev.js +47 -0
- package/npm/LexicalAutoFocusPlugin.dev.mjs +45 -0
- package/npm/LexicalAutoFocusPlugin.js +11 -0
- package/npm/LexicalAutoFocusPlugin.js.flow +14 -0
- package/npm/LexicalAutoFocusPlugin.mjs +12 -0
- package/npm/LexicalAutoFocusPlugin.node.mjs +10 -0
- package/npm/LexicalAutoFocusPlugin.prod.js +9 -0
- package/npm/LexicalAutoFocusPlugin.prod.mjs +9 -0
- package/npm/LexicalAutoLinkPlugin.d.ts +14 -0
- package/npm/LexicalAutoLinkPlugin.dev.js +54 -0
- package/npm/LexicalAutoLinkPlugin.dev.mjs +52 -0
- package/npm/LexicalAutoLinkPlugin.js +11 -0
- package/npm/LexicalAutoLinkPlugin.js.flow +18 -0
- package/npm/LexicalAutoLinkPlugin.mjs +13 -0
- package/npm/LexicalAutoLinkPlugin.node.mjs +11 -0
- package/npm/LexicalAutoLinkPlugin.prod.js +9 -0
- package/npm/LexicalAutoLinkPlugin.prod.mjs +9 -0
- package/npm/LexicalBlockWithAlignableContents.d.ts +21 -0
- package/npm/LexicalBlockWithAlignableContents.dev.js +81 -0
- package/npm/LexicalBlockWithAlignableContents.dev.mjs +79 -0
- package/npm/LexicalBlockWithAlignableContents.js +11 -0
- package/npm/LexicalBlockWithAlignableContents.js.flow +28 -0
- package/npm/LexicalBlockWithAlignableContents.mjs +12 -0
- package/npm/LexicalBlockWithAlignableContents.node.mjs +10 -0
- package/npm/LexicalBlockWithAlignableContents.prod.js +9 -0
- package/npm/LexicalBlockWithAlignableContents.prod.mjs +9 -0
- package/npm/LexicalCharacterLimitPlugin.d.ts +15 -0
- package/npm/LexicalCharacterLimitPlugin.dev.js +292 -0
- package/npm/LexicalCharacterLimitPlugin.dev.mjs +290 -0
- package/npm/LexicalCharacterLimitPlugin.js +11 -0
- package/npm/LexicalCharacterLimitPlugin.js.flow +12 -0
- package/npm/LexicalCharacterLimitPlugin.mjs +12 -0
- package/npm/LexicalCharacterLimitPlugin.node.mjs +10 -0
- package/npm/LexicalCharacterLimitPlugin.prod.js +9 -0
- package/npm/LexicalCharacterLimitPlugin.prod.mjs +9 -0
- package/npm/LexicalCheckListPlugin.d.ts +8 -0
- package/npm/LexicalCheckListPlugin.dev.js +31 -0
- package/npm/LexicalCheckListPlugin.dev.mjs +29 -0
- package/npm/LexicalCheckListPlugin.js +11 -0
- package/npm/LexicalCheckListPlugin.js.flow +10 -0
- package/npm/LexicalCheckListPlugin.mjs +12 -0
- package/npm/LexicalCheckListPlugin.node.mjs +10 -0
- package/npm/LexicalCheckListPlugin.prod.js +9 -0
- package/npm/LexicalCheckListPlugin.prod.mjs +9 -0
- package/npm/LexicalClearEditorPlugin.d.ts +13 -0
- package/npm/LexicalClearEditorPlugin.dev.js +55 -0
- package/npm/LexicalClearEditorPlugin.dev.mjs +53 -0
- package/npm/LexicalClearEditorPlugin.js +11 -0
- package/npm/LexicalClearEditorPlugin.js.flow +14 -0
- package/npm/LexicalClearEditorPlugin.mjs +12 -0
- package/npm/LexicalClearEditorPlugin.node.mjs +10 -0
- package/npm/LexicalClearEditorPlugin.prod.js +9 -0
- package/npm/LexicalClearEditorPlugin.prod.mjs +9 -0
- package/npm/LexicalClickableLinkPlugin.d.ts +11 -0
- package/npm/LexicalClickableLinkPlugin.dev.js +38 -0
- package/npm/LexicalClickableLinkPlugin.dev.mjs +36 -0
- package/npm/LexicalClickableLinkPlugin.js +11 -0
- package/npm/LexicalClickableLinkPlugin.js.flow +12 -0
- package/npm/LexicalClickableLinkPlugin.mjs +12 -0
- package/npm/LexicalClickableLinkPlugin.node.mjs +10 -0
- package/npm/LexicalClickableLinkPlugin.prod.js +9 -0
- package/npm/LexicalClickableLinkPlugin.prod.mjs +9 -0
- package/npm/LexicalCollaborationContext.d.ts +19 -0
- package/npm/LexicalCollaborationContext.dev.js +69 -0
- package/npm/LexicalCollaborationContext.dev.mjs +65 -0
- package/npm/LexicalCollaborationContext.js +11 -0
- package/npm/LexicalCollaborationContext.js.flow +22 -0
- package/npm/LexicalCollaborationContext.mjs +14 -0
- package/npm/LexicalCollaborationContext.node.mjs +12 -0
- package/npm/LexicalCollaborationContext.prod.js +9 -0
- package/npm/LexicalCollaborationContext.prod.mjs +9 -0
- package/npm/LexicalCollaborationPlugin.d.ts +39 -0
- package/npm/LexicalCollaborationPlugin.dev.js +558 -0
- package/npm/LexicalCollaborationPlugin.dev.mjs +543 -0
- package/npm/LexicalCollaborationPlugin.js +11 -0
- package/npm/LexicalCollaborationPlugin.js.flow +50 -0
- package/npm/LexicalCollaborationPlugin.mjs +13 -0
- package/npm/LexicalCollaborationPlugin.node.mjs +11 -0
- package/npm/LexicalCollaborationPlugin.prod.js +9 -0
- package/npm/LexicalCollaborationPlugin.prod.mjs +9 -0
- package/npm/LexicalComposer.d.ts +25 -0
- package/npm/LexicalComposer.dev.js +134 -0
- package/npm/LexicalComposer.dev.mjs +132 -0
- package/npm/LexicalComposer.js +11 -0
- package/npm/LexicalComposer.js.flow +40 -0
- package/npm/LexicalComposer.mjs +12 -0
- package/npm/LexicalComposer.node.mjs +10 -0
- package/npm/LexicalComposer.prod.js +9 -0
- package/npm/LexicalComposer.prod.mjs +9 -0
- package/npm/LexicalComposerContext.d.ts +18 -0
- package/npm/LexicalComposerContext.dev.js +55 -0
- package/npm/LexicalComposerContext.dev.mjs +51 -0
- package/npm/LexicalComposerContext.js +11 -0
- package/npm/LexicalComposerContext.js.flow +27 -0
- package/npm/LexicalComposerContext.mjs +14 -0
- package/npm/LexicalComposerContext.node.mjs +12 -0
- package/npm/LexicalComposerContext.prod.js +9 -0
- package/npm/LexicalComposerContext.prod.mjs +9 -0
- package/npm/LexicalContentEditable.d.ts +26 -0
- package/npm/LexicalContentEditable.dev.js +242 -0
- package/npm/LexicalContentEditable.dev.mjs +239 -0
- package/npm/LexicalContentEditable.js +11 -0
- package/npm/LexicalContentEditable.js.flow +80 -0
- package/npm/LexicalContentEditable.mjs +13 -0
- package/npm/LexicalContentEditable.node.mjs +11 -0
- package/npm/LexicalContentEditable.prod.js +9 -0
- package/npm/LexicalContentEditable.prod.mjs +9 -0
- package/npm/LexicalContextMenuPlugin.d.ts +36 -0
- package/npm/LexicalContextMenuPlugin.dev.js +524 -0
- package/npm/LexicalContextMenuPlugin.dev.mjs +509 -0
- package/npm/LexicalContextMenuPlugin.js +11 -0
- package/npm/LexicalContextMenuPlugin.js.flow +13 -0
- package/npm/LexicalContextMenuPlugin.mjs +13 -0
- package/npm/LexicalContextMenuPlugin.node.mjs +11 -0
- package/npm/LexicalContextMenuPlugin.prod.js +9 -0
- package/npm/LexicalContextMenuPlugin.prod.mjs +9 -0
- package/npm/LexicalDecoratorBlockNode.d.ts +25 -0
- package/npm/LexicalDecoratorBlockNode.dev.js +59 -0
- package/npm/LexicalDecoratorBlockNode.dev.mjs +56 -0
- package/npm/LexicalDecoratorBlockNode.js +11 -0
- package/npm/LexicalDecoratorBlockNode.js.flow +35 -0
- package/npm/LexicalDecoratorBlockNode.mjs +13 -0
- package/npm/LexicalDecoratorBlockNode.node.mjs +11 -0
- package/npm/LexicalDecoratorBlockNode.prod.js +9 -0
- package/npm/LexicalDecoratorBlockNode.prod.mjs +9 -0
- package/npm/LexicalDraggableBlockPlugin.d.ts +18 -0
- package/npm/LexicalDraggableBlockPlugin.dev.js +534 -0
- package/npm/LexicalDraggableBlockPlugin.dev.mjs +532 -0
- package/npm/LexicalDraggableBlockPlugin.js +11 -0
- package/npm/LexicalDraggableBlockPlugin.js.flow +24 -0
- package/npm/LexicalDraggableBlockPlugin.mjs +12 -0
- package/npm/LexicalDraggableBlockPlugin.node.mjs +10 -0
- package/npm/LexicalDraggableBlockPlugin.prod.js +9 -0
- package/npm/LexicalDraggableBlockPlugin.prod.mjs +9 -0
- package/npm/LexicalEditorRefPlugin.d.ts +20 -0
- package/npm/LexicalEditorRefPlugin.dev.js +58 -0
- package/npm/LexicalEditorRefPlugin.dev.mjs +43 -0
- package/npm/LexicalEditorRefPlugin.js +11 -0
- package/npm/LexicalEditorRefPlugin.js.flow +19 -0
- package/npm/LexicalEditorRefPlugin.mjs +12 -0
- package/npm/LexicalEditorRefPlugin.node.mjs +10 -0
- package/npm/LexicalEditorRefPlugin.prod.js +9 -0
- package/npm/LexicalEditorRefPlugin.prod.mjs +9 -0
- package/npm/LexicalErrorBoundary.d.ts +13 -0
- package/npm/LexicalErrorBoundary.dev.js +40 -0
- package/npm/LexicalErrorBoundary.dev.mjs +38 -0
- package/npm/LexicalErrorBoundary.js +11 -0
- package/npm/LexicalErrorBoundary.js.flow +17 -0
- package/npm/LexicalErrorBoundary.mjs +12 -0
- package/npm/LexicalErrorBoundary.node.mjs +10 -0
- package/npm/LexicalErrorBoundary.prod.js +9 -0
- package/npm/LexicalErrorBoundary.prod.mjs +9 -0
- package/npm/LexicalExtensionComponent.dev.js +53 -0
- package/npm/LexicalExtensionComponent.dev.mjs +51 -0
- package/npm/LexicalExtensionComponent.js +11 -0
- package/npm/LexicalExtensionComponent.js.flow +12 -0
- package/npm/LexicalExtensionComponent.mjs +12 -0
- package/npm/LexicalExtensionComponent.node.mjs +10 -0
- package/npm/LexicalExtensionComponent.prod.js +9 -0
- package/npm/LexicalExtensionComponent.prod.mjs +9 -0
- package/npm/LexicalExtensionComposer.d.ts +69 -0
- package/npm/LexicalExtensionComposer.dev.js +105 -0
- package/npm/LexicalExtensionComposer.dev.mjs +103 -0
- package/npm/LexicalExtensionComposer.js +11 -0
- package/npm/LexicalExtensionComposer.js.flow +20 -0
- package/npm/LexicalExtensionComposer.mjs +12 -0
- package/npm/LexicalExtensionComposer.node.mjs +10 -0
- package/npm/LexicalExtensionComposer.prod.js +9 -0
- package/npm/LexicalExtensionComposer.prod.mjs +9 -0
- package/npm/LexicalHashtagPlugin.d.ts +9 -0
- package/npm/LexicalHashtagPlugin.dev.js +34 -0
- package/npm/LexicalHashtagPlugin.dev.mjs +32 -0
- package/npm/LexicalHashtagPlugin.js +11 -0
- package/npm/LexicalHashtagPlugin.js.flow +10 -0
- package/npm/LexicalHashtagPlugin.mjs +12 -0
- package/npm/LexicalHashtagPlugin.node.mjs +10 -0
- package/npm/LexicalHashtagPlugin.prod.js +9 -0
- package/npm/LexicalHashtagPlugin.prod.mjs +9 -0
- package/npm/LexicalHistoryPlugin.d.ts +14 -0
- package/npm/LexicalHistoryPlugin.dev.js +48 -0
- package/npm/LexicalHistoryPlugin.dev.mjs +46 -0
- package/npm/LexicalHistoryPlugin.js +11 -0
- package/npm/LexicalHistoryPlugin.js.flow +28 -0
- package/npm/LexicalHistoryPlugin.mjs +13 -0
- package/npm/LexicalHistoryPlugin.node.mjs +11 -0
- package/npm/LexicalHistoryPlugin.prod.js +9 -0
- package/npm/LexicalHistoryPlugin.prod.mjs +9 -0
- package/npm/LexicalHorizontalRuleNode.d.ts +25 -0
- package/npm/LexicalHorizontalRuleNode.dev.js +102 -0
- package/npm/LexicalHorizontalRuleNode.dev.mjs +98 -0
- package/npm/LexicalHorizontalRuleNode.js +11 -0
- package/npm/LexicalHorizontalRuleNode.js.flow +27 -0
- package/npm/LexicalHorizontalRuleNode.mjs +15 -0
- package/npm/LexicalHorizontalRuleNode.node.mjs +13 -0
- package/npm/LexicalHorizontalRuleNode.prod.js +9 -0
- package/npm/LexicalHorizontalRuleNode.prod.mjs +9 -0
- package/npm/LexicalHorizontalRulePlugin.d.ts +8 -0
- package/npm/LexicalHorizontalRulePlugin.dev.js +44 -0
- package/npm/LexicalHorizontalRulePlugin.dev.mjs +42 -0
- package/npm/LexicalHorizontalRulePlugin.js +11 -0
- package/npm/LexicalHorizontalRulePlugin.js.flow +12 -0
- package/npm/LexicalHorizontalRulePlugin.mjs +12 -0
- package/npm/LexicalHorizontalRulePlugin.node.mjs +10 -0
- package/npm/LexicalHorizontalRulePlugin.prod.js +9 -0
- package/npm/LexicalHorizontalRulePlugin.prod.mjs +9 -0
- package/npm/LexicalLinkPlugin.d.ts +14 -0
- package/npm/LexicalLinkPlugin.dev.js +43 -0
- package/npm/LexicalLinkPlugin.dev.mjs +41 -0
- package/npm/LexicalLinkPlugin.js +11 -0
- package/npm/LexicalLinkPlugin.js.flow +21 -0
- package/npm/LexicalLinkPlugin.mjs +12 -0
- package/npm/LexicalLinkPlugin.node.mjs +10 -0
- package/npm/LexicalLinkPlugin.prod.js +9 -0
- package/npm/LexicalLinkPlugin.prod.mjs +9 -0
- package/npm/LexicalListPlugin.d.ts +15 -0
- package/npm/LexicalListPlugin.dev.js +56 -0
- package/npm/LexicalListPlugin.dev.mjs +54 -0
- package/npm/LexicalListPlugin.js +11 -0
- package/npm/LexicalListPlugin.js.flow +15 -0
- package/npm/LexicalListPlugin.mjs +12 -0
- package/npm/LexicalListPlugin.node.mjs +10 -0
- package/npm/LexicalListPlugin.prod.js +9 -0
- package/npm/LexicalListPlugin.prod.mjs +9 -0
- package/npm/LexicalMarkdownShortcutPlugin.d.ts +12 -0
- package/npm/LexicalMarkdownShortcutPlugin.dev.js +55 -0
- package/npm/LexicalMarkdownShortcutPlugin.dev.mjs +52 -0
- package/npm/LexicalMarkdownShortcutPlugin.js +11 -0
- package/npm/LexicalMarkdownShortcutPlugin.js.flow +16 -0
- package/npm/LexicalMarkdownShortcutPlugin.mjs +13 -0
- package/npm/LexicalMarkdownShortcutPlugin.node.mjs +11 -0
- package/npm/LexicalMarkdownShortcutPlugin.prod.js +9 -0
- package/npm/LexicalMarkdownShortcutPlugin.prod.mjs +9 -0
- package/npm/LexicalNestedComposer.d.ts +57 -0
- package/npm/LexicalNestedComposer.dev.js +161 -0
- package/npm/LexicalNestedComposer.dev.mjs +159 -0
- package/npm/LexicalNestedComposer.js +11 -0
- package/npm/LexicalNestedComposer.js.flow +26 -0
- package/npm/LexicalNestedComposer.mjs +12 -0
- package/npm/LexicalNestedComposer.node.mjs +10 -0
- package/npm/LexicalNestedComposer.prod.js +9 -0
- package/npm/LexicalNestedComposer.prod.mjs +9 -0
- package/npm/LexicalNodeContextMenuPlugin.d.ts +46 -0
- package/npm/LexicalNodeContextMenuPlugin.dev.js +257 -0
- package/npm/LexicalNodeContextMenuPlugin.dev.mjs +253 -0
- package/npm/LexicalNodeContextMenuPlugin.js +11 -0
- package/npm/LexicalNodeContextMenuPlugin.js.flow +12 -0
- package/npm/LexicalNodeContextMenuPlugin.mjs +14 -0
- package/npm/LexicalNodeContextMenuPlugin.node.mjs +12 -0
- package/npm/LexicalNodeContextMenuPlugin.prod.js +9 -0
- package/npm/LexicalNodeContextMenuPlugin.prod.mjs +9 -0
- package/npm/LexicalNodeEventPlugin.d.ts +13 -0
- package/npm/LexicalNodeEventPlugin.dev.js +61 -0
- package/npm/LexicalNodeEventPlugin.dev.mjs +59 -0
- package/npm/LexicalNodeEventPlugin.js +11 -0
- package/npm/LexicalNodeEventPlugin.js.flow +20 -0
- package/npm/LexicalNodeEventPlugin.mjs +12 -0
- package/npm/LexicalNodeEventPlugin.node.mjs +10 -0
- package/npm/LexicalNodeEventPlugin.prod.js +9 -0
- package/npm/LexicalNodeEventPlugin.prod.mjs +9 -0
- package/npm/LexicalNodeMenuPlugin.d.ts +24 -0
- package/npm/LexicalNodeMenuPlugin.dev.js +527 -0
- package/npm/LexicalNodeMenuPlugin.dev.mjs +524 -0
- package/npm/LexicalNodeMenuPlugin.js +11 -0
- package/npm/LexicalNodeMenuPlugin.js.flow +64 -0
- package/npm/LexicalNodeMenuPlugin.mjs +13 -0
- package/npm/LexicalNodeMenuPlugin.node.mjs +11 -0
- package/npm/LexicalNodeMenuPlugin.prod.js +9 -0
- package/npm/LexicalNodeMenuPlugin.prod.mjs +9 -0
- package/npm/LexicalOnChangePlugin.d.ts +13 -0
- package/npm/LexicalOnChangePlugin.dev.js +72 -0
- package/npm/LexicalOnChangePlugin.dev.mjs +70 -0
- package/npm/LexicalOnChangePlugin.js +11 -0
- package/npm/LexicalOnChangePlugin.js.flow +16 -0
- package/npm/LexicalOnChangePlugin.mjs +12 -0
- package/npm/LexicalOnChangePlugin.node.mjs +10 -0
- package/npm/LexicalOnChangePlugin.prod.js +9 -0
- package/npm/LexicalOnChangePlugin.prod.mjs +9 -0
- package/npm/LexicalPlainTextPlugin.d.ts +14 -0
- package/npm/LexicalPlainTextPlugin.dev.js +235 -0
- package/npm/LexicalPlainTextPlugin.dev.mjs +233 -0
- package/npm/LexicalPlainTextPlugin.js +11 -0
- package/npm/LexicalPlainTextPlugin.js.flow +29 -0
- package/npm/LexicalPlainTextPlugin.mjs +12 -0
- package/npm/LexicalPlainTextPlugin.node.mjs +10 -0
- package/npm/LexicalPlainTextPlugin.prod.js +9 -0
- package/npm/LexicalPlainTextPlugin.prod.mjs +9 -0
- package/npm/LexicalReactExtension.dev.js +187 -0
- package/npm/LexicalReactExtension.dev.mjs +184 -0
- package/npm/LexicalReactExtension.js +11 -0
- package/npm/LexicalReactExtension.js.flow +68 -0
- package/npm/LexicalReactExtension.mjs +13 -0
- package/npm/LexicalReactExtension.node.mjs +11 -0
- package/npm/LexicalReactExtension.prod.js +9 -0
- package/npm/LexicalReactExtension.prod.mjs +9 -0
- package/npm/LexicalReactPluginHostExtension.dev.js +189 -0
- package/npm/LexicalReactPluginHostExtension.dev.mjs +181 -0
- package/npm/LexicalReactPluginHostExtension.js +11 -0
- package/npm/LexicalReactPluginHostExtension.js.flow +84 -0
- package/npm/LexicalReactPluginHostExtension.mjs +18 -0
- package/npm/LexicalReactPluginHostExtension.node.mjs +16 -0
- package/npm/LexicalReactPluginHostExtension.prod.js +9 -0
- package/npm/LexicalReactPluginHostExtension.prod.mjs +9 -0
- package/npm/LexicalReactProviderExtension.dev.js +33 -0
- package/npm/LexicalReactProviderExtension.dev.mjs +31 -0
- package/npm/LexicalReactProviderExtension.js +11 -0
- package/npm/LexicalReactProviderExtension.js.flow +12 -0
- package/npm/LexicalReactProviderExtension.mjs +12 -0
- package/npm/LexicalReactProviderExtension.node.mjs +10 -0
- package/npm/LexicalReactProviderExtension.prod.js +9 -0
- package/npm/LexicalReactProviderExtension.prod.mjs +9 -0
- package/npm/LexicalRichTextPlugin.d.ts +14 -0
- package/npm/LexicalRichTextPlugin.dev.js +235 -0
- package/npm/LexicalRichTextPlugin.dev.mjs +233 -0
- package/npm/LexicalRichTextPlugin.js +11 -0
- package/npm/LexicalRichTextPlugin.js.flow +29 -0
- package/npm/LexicalRichTextPlugin.mjs +12 -0
- package/npm/LexicalRichTextPlugin.node.mjs +10 -0
- package/npm/LexicalRichTextPlugin.prod.js +9 -0
- package/npm/LexicalRichTextPlugin.prod.mjs +9 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.d.ts +8 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.dev.js +31 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.dev.mjs +29 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.js +11 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.js.flow +13 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.mjs +12 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.node.mjs +10 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.prod.js +9 -0
- package/npm/LexicalSelectionAlwaysOnDisplay.prod.mjs +9 -0
- package/npm/LexicalTabIndentationPlugin.d.ts +17 -0
- package/npm/LexicalTabIndentationPlugin.dev.js +40 -0
- package/npm/LexicalTabIndentationPlugin.dev.mjs +38 -0
- package/npm/LexicalTabIndentationPlugin.js +11 -0
- package/npm/LexicalTabIndentationPlugin.js.flow +21 -0
- package/npm/LexicalTabIndentationPlugin.mjs +13 -0
- package/npm/LexicalTabIndentationPlugin.node.mjs +11 -0
- package/npm/LexicalTabIndentationPlugin.prod.js +9 -0
- package/npm/LexicalTabIndentationPlugin.prod.mjs +9 -0
- package/npm/LexicalTableOfContentsPlugin.d.ts +20 -0
- package/npm/LexicalTableOfContentsPlugin.dev.js +209 -0
- package/npm/LexicalTableOfContentsPlugin.dev.mjs +207 -0
- package/npm/LexicalTableOfContentsPlugin.js +11 -0
- package/npm/LexicalTableOfContentsPlugin.js.flow +18 -0
- package/npm/LexicalTableOfContentsPlugin.mjs +12 -0
- package/npm/LexicalTableOfContentsPlugin.node.mjs +10 -0
- package/npm/LexicalTableOfContentsPlugin.prod.js +9 -0
- package/npm/LexicalTableOfContentsPlugin.prod.mjs +9 -0
- package/npm/LexicalTablePlugin.d.ts +40 -0
- package/npm/LexicalTablePlugin.dev.js +77 -0
- package/npm/LexicalTablePlugin.dev.mjs +75 -0
- package/npm/LexicalTablePlugin.js +11 -0
- package/npm/LexicalTablePlugin.js.flow +15 -0
- package/npm/LexicalTablePlugin.mjs +12 -0
- package/npm/LexicalTablePlugin.node.mjs +10 -0
- package/npm/LexicalTablePlugin.prod.js +9 -0
- package/npm/LexicalTablePlugin.prod.mjs +9 -0
- package/npm/LexicalTreeView.d.ts +37 -0
- package/npm/LexicalTreeView.dev.js +105 -0
- package/npm/LexicalTreeView.dev.mjs +91 -0
- package/npm/LexicalTreeView.js +11 -0
- package/npm/LexicalTreeView.js.flow +21 -0
- package/npm/LexicalTreeView.mjs +12 -0
- package/npm/LexicalTreeView.node.mjs +10 -0
- package/npm/LexicalTreeView.prod.js +9 -0
- package/npm/LexicalTreeView.prod.mjs +9 -0
- package/npm/LexicalTreeViewExtension.dev.js +57 -0
- package/npm/LexicalTreeViewExtension.dev.mjs +54 -0
- package/npm/LexicalTreeViewExtension.js +11 -0
- package/npm/LexicalTreeViewExtension.js.flow +12 -0
- package/npm/LexicalTreeViewExtension.mjs +13 -0
- package/npm/LexicalTreeViewExtension.node.mjs +11 -0
- package/npm/LexicalTreeViewExtension.prod.js +9 -0
- package/npm/LexicalTreeViewExtension.prod.mjs +9 -0
- package/npm/LexicalTypeaheadMenuPlugin.d.ts +40 -0
- package/npm/LexicalTypeaheadMenuPlugin.dev.js +654 -0
- package/npm/LexicalTypeaheadMenuPlugin.dev.mjs +646 -0
- package/npm/LexicalTypeaheadMenuPlugin.js +11 -0
- package/npm/LexicalTypeaheadMenuPlugin.js.flow +83 -0
- package/npm/LexicalTypeaheadMenuPlugin.mjs +18 -0
- package/npm/LexicalTypeaheadMenuPlugin.node.mjs +16 -0
- package/npm/LexicalTypeaheadMenuPlugin.prod.js +9 -0
- package/npm/LexicalTypeaheadMenuPlugin.prod.mjs +9 -0
- package/npm/README.md +90 -0
- package/npm/ReactExtension.d.ts +41 -0
- package/npm/ReactPluginHostExtension.d.ts +56 -0
- package/npm/ReactProviderExtension.d.ts +9 -0
- package/npm/TreeViewExtension.d.ts +18 -0
- package/npm/package.json +1549 -0
- package/npm/shared/LegacyDecorators.d.ts +23 -0
- package/npm/shared/LexicalContentEditableElement.d.ts +43 -0
- package/npm/shared/LexicalMenu.d.ts +52 -0
- package/npm/shared/buildEditorComponent.d.ts +11 -0
- package/npm/shared/mergeRefs.d.ts +9 -0
- package/npm/shared/point.d.ts +21 -0
- package/npm/shared/rect.d.ts +45 -0
- package/npm/shared/types.d.ts +89 -0
- package/npm/shared/useCanShowPlaceholder.d.ts +9 -0
- package/npm/shared/useCharacterLimit.d.ts +16 -0
- package/npm/shared/useDecorators.d.ts +17 -0
- package/npm/shared/useHistory.d.ts +10 -0
- package/npm/shared/useList.d.ts +9 -0
- package/npm/shared/usePlainTextSetup.d.ts +9 -0
- package/npm/shared/useReactDecorators.d.ts +12 -0
- package/npm/shared/useRichTextSetup.d.ts +9 -0
- package/npm/shared/useYjsCollaboration.d.ts +25 -0
- package/npm/useExtensionComponent.d.ts +10 -0
- package/npm/useLexicalEditable.d.ts +16 -0
- package/npm/useLexicalEditable.dev.js +102 -0
- package/npm/useLexicalEditable.dev.mjs +100 -0
- package/npm/useLexicalEditable.js +11 -0
- package/npm/useLexicalEditable.js.flow +12 -0
- package/npm/useLexicalEditable.mjs +12 -0
- package/npm/useLexicalEditable.node.mjs +10 -0
- package/npm/useLexicalEditable.prod.js +9 -0
- package/npm/useLexicalEditable.prod.mjs +9 -0
- package/npm/useLexicalExtensionComponent.dev.js +37 -0
- package/npm/useLexicalExtensionComponent.dev.mjs +34 -0
- package/npm/useLexicalExtensionComponent.js +11 -0
- package/npm/useLexicalExtensionComponent.js.flow +12 -0
- package/npm/useLexicalExtensionComponent.mjs +13 -0
- package/npm/useLexicalExtensionComponent.node.mjs +11 -0
- package/npm/useLexicalExtensionComponent.prod.js +9 -0
- package/npm/useLexicalExtensionComponent.prod.mjs +9 -0
- package/npm/useLexicalIsTextContentEmpty.d.ts +9 -0
- package/npm/useLexicalIsTextContentEmpty.dev.js +60 -0
- package/npm/useLexicalIsTextContentEmpty.dev.mjs +58 -0
- package/npm/useLexicalIsTextContentEmpty.js +11 -0
- package/npm/useLexicalIsTextContentEmpty.js.flow +15 -0
- package/npm/useLexicalIsTextContentEmpty.mjs +12 -0
- package/npm/useLexicalIsTextContentEmpty.node.mjs +10 -0
- package/npm/useLexicalIsTextContentEmpty.prod.js +9 -0
- package/npm/useLexicalIsTextContentEmpty.prod.mjs +9 -0
- package/npm/useLexicalNodeSelection.d.ts +24 -0
- package/npm/useLexicalNodeSelection.dev.js +102 -0
- package/npm/useLexicalNodeSelection.dev.mjs +100 -0
- package/npm/useLexicalNodeSelection.js +11 -0
- package/npm/useLexicalNodeSelection.js.flow +14 -0
- package/npm/useLexicalNodeSelection.mjs +12 -0
- package/npm/useLexicalNodeSelection.node.mjs +10 -0
- package/npm/useLexicalNodeSelection.prod.js +9 -0
- package/npm/useLexicalNodeSelection.prod.mjs +9 -0
- package/npm/useLexicalSubscription.d.ts +17 -0
- package/npm/useLexicalSubscription.dev.js +73 -0
- package/npm/useLexicalSubscription.dev.mjs +71 -0
- package/npm/useLexicalSubscription.js +11 -0
- package/npm/useLexicalSubscription.js.flow +19 -0
- package/npm/useLexicalSubscription.mjs +12 -0
- package/npm/useLexicalSubscription.node.mjs +10 -0
- package/npm/useLexicalSubscription.prod.js +9 -0
- package/npm/useLexicalSubscription.prod.mjs +9 -0
- package/npm/useLexicalTextEntity.d.ts +10 -0
- package/npm/useLexicalTextEntity.dev.js +31 -0
- package/npm/useLexicalTextEntity.dev.mjs +29 -0
- package/npm/useLexicalTextEntity.js +11 -0
- package/npm/useLexicalTextEntity.js.flow +18 -0
- package/npm/useLexicalTextEntity.mjs +12 -0
- package/npm/useLexicalTextEntity.node.mjs +10 -0
- package/npm/useLexicalTextEntity.prod.js +9 -0
- package/npm/useLexicalTextEntity.prod.mjs +9 -0
- package/package.json +1549 -0
- package/src/ExtensionComponent.tsx +57 -0
- package/src/LexicalAutoEmbedPlugin.tsx +242 -0
- package/src/LexicalAutoFocusPlugin.ts +41 -0
- package/src/LexicalAutoLinkPlugin.ts +57 -0
- package/src/LexicalBlockWithAlignableContents.tsx +119 -0
- package/src/LexicalCharacterLimitPlugin.tsx +91 -0
- package/src/LexicalCheckListPlugin.tsx +20 -0
- package/src/LexicalClearEditorPlugin.ts +26 -0
- package/src/LexicalClickableLinkPlugin.tsx +28 -0
- package/src/LexicalCollaborationContext.tsx +89 -0
- package/src/LexicalCollaborationPlugin.tsx +265 -0
- package/src/LexicalComposer.tsx +151 -0
- package/src/LexicalComposerContext.ts +63 -0
- package/src/LexicalContentEditable.tsx +97 -0
- package/src/LexicalContextMenuPlugin.tsx +169 -0
- package/src/LexicalDecoratorBlockNode.ts +78 -0
- package/src/LexicalDraggableBlockPlugin.tsx +481 -0
- package/src/LexicalEditorRefPlugin.tsx +40 -0
- package/src/LexicalErrorBoundary.tsx +39 -0
- package/src/LexicalExtensionComposer.tsx +117 -0
- package/src/LexicalHashtagPlugin.ts +26 -0
- package/src/LexicalHistoryPlugin.ts +31 -0
- package/src/LexicalHorizontalRuleNode.tsx +123 -0
- package/src/LexicalHorizontalRulePlugin.ts +49 -0
- package/src/LexicalLinkPlugin.ts +32 -0
- package/src/LexicalListPlugin.ts +49 -0
- package/src/LexicalMarkdownShortcutPlugin.tsx +55 -0
- package/src/LexicalNestedComposer.tsx +215 -0
- package/src/LexicalNodeContextMenuPlugin.tsx +316 -0
- package/src/LexicalNodeEventPlugin.ts +73 -0
- package/src/LexicalNodeMenuPlugin.tsx +130 -0
- package/src/LexicalOnChangePlugin.ts +51 -0
- package/src/LexicalPlainTextPlugin.tsx +65 -0
- package/src/LexicalRichTextPlugin.tsx +65 -0
- package/src/LexicalSelectionAlwaysOnDisplay.tsx +20 -0
- package/src/LexicalTabIndentationPlugin.tsx +27 -0
- package/src/LexicalTableOfContentsPlugin.tsx +277 -0
- package/src/LexicalTablePlugin.ts +110 -0
- package/src/LexicalTreeView.tsx +128 -0
- package/src/LexicalTypeaheadMenuPlugin.tsx +354 -0
- package/src/ReactExtension.tsx +113 -0
- package/src/ReactPluginHostExtension.tsx +228 -0
- package/src/ReactProviderExtension.tsx +20 -0
- package/src/TreeViewExtension.tsx +48 -0
- package/src/__tests__/unit/Collaboration.test.ts +563 -0
- package/src/__tests__/unit/CollaborationSnapshot.test.ts +461 -0
- package/src/__tests__/unit/CollaborationWithCollisions.test.ts +246 -0
- package/src/__tests__/unit/LexicalCollaborationPlugin.test.tsx +101 -0
- package/src/__tests__/unit/LexicalComposer.test.tsx +129 -0
- package/src/__tests__/unit/LexicalContentEditableElement.test.tsx +264 -0
- package/src/__tests__/unit/LexicalExtensionComposer.test.tsx +85 -0
- package/src/__tests__/unit/LexicalNestedComposer.test.tsx +1142 -0
- package/src/__tests__/unit/PlainRichTextPlugin.test.tsx +246 -0
- package/src/__tests__/unit/React19.test.tsx +52 -0
- package/src/__tests__/unit/ReactExtension.test.tsx +32 -0
- package/src/__tests__/unit/ReactPluginHostExtension.test.tsx +137 -0
- package/src/__tests__/unit/useLexicalCharacterLimit.test.ts +194 -0
- package/src/__tests__/unit/useLexicalIsTextContentEmpty.test.tsx +96 -0
- package/src/__tests__/unit/useMenuAnchorRef.test.tsx +65 -0
- package/src/__tests__/unit/utils.tsx +356 -0
- package/src/shared/LegacyDecorators.tsx +62 -0
- package/src/shared/LexicalContentEditableElement.tsx +126 -0
- package/src/shared/LexicalMenu.ts +664 -0
- package/src/shared/buildEditorComponent.tsx +61 -0
- package/src/shared/mergeRefs.ts +20 -0
- package/src/shared/point.ts +55 -0
- package/src/shared/rect.ts +158 -0
- package/src/shared/types.ts +106 -0
- package/src/shared/useCanShowPlaceholder.ts +49 -0
- package/src/shared/useCharacterLimit.ts +315 -0
- package/src/shared/useDecorators.tsx +71 -0
- package/src/shared/useHistory.ts +28 -0
- package/src/shared/useList.ts +18 -0
- package/src/shared/usePlainTextSetup.ts +26 -0
- package/src/shared/useReactDecorators.tsx +53 -0
- package/src/shared/useRichTextSetup.ts +26 -0
- package/src/shared/useYjsCollaboration.tsx +666 -0
- package/src/useExtensionComponent.tsx +38 -0
- package/src/useLexicalEditable.ts +33 -0
- package/src/useLexicalIsTextContentEmpty.ts +36 -0
- package/src/useLexicalNodeSelection.ts +114 -0
- package/src/useLexicalSubscription.tsx +51 -0
- package/src/useLexicalTextEntity.ts +29 -0
|
@@ -0,0 +1,1142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {LexicalComposer} from '@lexical/react/LexicalComposer';
|
|
10
|
+
import {useLexicalComposerContext} from '@lexical/react/LexicalComposerContext';
|
|
11
|
+
import {ContentEditable} from '@lexical/react/LexicalContentEditable';
|
|
12
|
+
import {LexicalErrorBoundary} from '@lexical/react/LexicalErrorBoundary';
|
|
13
|
+
import {LexicalNestedComposer} from '@lexical/react/LexicalNestedComposer';
|
|
14
|
+
import {RichTextPlugin} from '@lexical/react/LexicalRichTextPlugin';
|
|
15
|
+
import {mergeRegister} from '@lexical/utils';
|
|
16
|
+
import {axe, toHaveNoViolations} from 'jest-axe';
|
|
17
|
+
import {
|
|
18
|
+
$applyNodeReplacement,
|
|
19
|
+
$createParagraphNode,
|
|
20
|
+
$createTextNode,
|
|
21
|
+
$getEditor,
|
|
22
|
+
$getRoot,
|
|
23
|
+
COMMAND_PRIORITY_CRITICAL,
|
|
24
|
+
COMMAND_PRIORITY_EDITOR,
|
|
25
|
+
createCommand,
|
|
26
|
+
createEditor,
|
|
27
|
+
DecoratorNode,
|
|
28
|
+
EditorConfig,
|
|
29
|
+
getRegisteredNode,
|
|
30
|
+
LexicalEditor,
|
|
31
|
+
SerializedLexicalNode,
|
|
32
|
+
TextNode,
|
|
33
|
+
} from 'lexical';
|
|
34
|
+
import {
|
|
35
|
+
expectHtmlToBeEqual,
|
|
36
|
+
html,
|
|
37
|
+
invariant,
|
|
38
|
+
} from 'lexical/src/__tests__/utils';
|
|
39
|
+
import * as React from 'react';
|
|
40
|
+
import {useEffect} from 'react';
|
|
41
|
+
import {createRoot, Root} from 'react-dom/client';
|
|
42
|
+
import * as ReactTestUtils from 'shared/react-test-utils';
|
|
43
|
+
import {
|
|
44
|
+
afterEach,
|
|
45
|
+
beforeEach,
|
|
46
|
+
describe,
|
|
47
|
+
expect,
|
|
48
|
+
MockInstance,
|
|
49
|
+
test,
|
|
50
|
+
vi,
|
|
51
|
+
} from 'vitest';
|
|
52
|
+
|
|
53
|
+
expect.extend(toHaveNoViolations);
|
|
54
|
+
class ReactDecoratorNode extends DecoratorNode<React.ReactNode> {
|
|
55
|
+
__decorate?: (node: this) => React.ReactNode;
|
|
56
|
+
__inline?: boolean;
|
|
57
|
+
static getType() {
|
|
58
|
+
return 'react-decorator';
|
|
59
|
+
}
|
|
60
|
+
static clone(node: ReactDecoratorNode): ReactDecoratorNode {
|
|
61
|
+
return new ReactDecoratorNode(node.__key);
|
|
62
|
+
}
|
|
63
|
+
static importJSON(json: SerializedLexicalNode): ReactDecoratorNode {
|
|
64
|
+
throw new Error('not implemented');
|
|
65
|
+
}
|
|
66
|
+
createDOM(_config: EditorConfig, editor: LexicalEditor): HTMLElement {
|
|
67
|
+
return (editor._window || window).document.createElement(
|
|
68
|
+
this.__inline ? 'span' : 'div',
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
updateDOM(prevNode: this, _dom: HTMLElement, _config: EditorConfig): boolean {
|
|
72
|
+
return !!prevNode.__inline !== this.__inline;
|
|
73
|
+
}
|
|
74
|
+
afterCloneFrom(prevNode: this): void {
|
|
75
|
+
super.afterCloneFrom(prevNode);
|
|
76
|
+
this.__decorate = prevNode.__decorate;
|
|
77
|
+
}
|
|
78
|
+
setDecorate(decorate: (typeof this)['__decorate']): this {
|
|
79
|
+
const self = this.getWritable();
|
|
80
|
+
self.__decorate = decorate;
|
|
81
|
+
return self;
|
|
82
|
+
}
|
|
83
|
+
setInline(inline: boolean): this {
|
|
84
|
+
const self = this.getWritable();
|
|
85
|
+
self.__inline = inline;
|
|
86
|
+
return self;
|
|
87
|
+
}
|
|
88
|
+
isInline(): boolean {
|
|
89
|
+
return !!this.__inline;
|
|
90
|
+
}
|
|
91
|
+
decorate() {
|
|
92
|
+
return this.__decorate ? this.__decorate(this) : null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function $createReactDecoratorNode() {
|
|
96
|
+
return $applyNodeReplacement(new ReactDecoratorNode());
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
describe('LexicalNestedComposer', () => {
|
|
100
|
+
let container: HTMLDivElement | null = null;
|
|
101
|
+
let reactRoot: Root;
|
|
102
|
+
let warn: MockInstance;
|
|
103
|
+
|
|
104
|
+
beforeEach(() => {
|
|
105
|
+
warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
106
|
+
container = document.createElement('div');
|
|
107
|
+
reactRoot = createRoot(container);
|
|
108
|
+
document.body.appendChild(container);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
afterEach(() => {
|
|
112
|
+
document.body.removeChild(container!);
|
|
113
|
+
container = null;
|
|
114
|
+
warn.mockReset();
|
|
115
|
+
|
|
116
|
+
vi.restoreAllMocks();
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
test('with inherited configuration and namespace', async () => {
|
|
120
|
+
let editor: undefined | LexicalEditor;
|
|
121
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
122
|
+
function App() {
|
|
123
|
+
return (
|
|
124
|
+
<LexicalComposer
|
|
125
|
+
initialConfig={{
|
|
126
|
+
editorState: () => {
|
|
127
|
+
editor = $getEditor();
|
|
128
|
+
nestedEditor = createEditor();
|
|
129
|
+
nestedEditor.update(() =>
|
|
130
|
+
$getRoot()
|
|
131
|
+
.clear()
|
|
132
|
+
.append(
|
|
133
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
$getRoot()
|
|
137
|
+
.clear()
|
|
138
|
+
.append(
|
|
139
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
140
|
+
$createReactDecoratorNode()
|
|
141
|
+
.setInline(false)
|
|
142
|
+
.setDecorate(() => {
|
|
143
|
+
return nestedEditor ? (
|
|
144
|
+
<LexicalNestedComposer initialEditor={nestedEditor}>
|
|
145
|
+
<RichTextPlugin
|
|
146
|
+
contentEditable={<ContentEditable />}
|
|
147
|
+
placeholder={<></>}
|
|
148
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
149
|
+
/>
|
|
150
|
+
</LexicalNestedComposer>
|
|
151
|
+
) : null;
|
|
152
|
+
}),
|
|
153
|
+
);
|
|
154
|
+
},
|
|
155
|
+
namespace: 'parent',
|
|
156
|
+
nodes: [ReactDecoratorNode],
|
|
157
|
+
onError: (err) => {
|
|
158
|
+
throw err;
|
|
159
|
+
},
|
|
160
|
+
}}>
|
|
161
|
+
<RichTextPlugin
|
|
162
|
+
contentEditable={<ContentEditable />}
|
|
163
|
+
placeholder={<></>}
|
|
164
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
165
|
+
/>
|
|
166
|
+
</LexicalComposer>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
await ReactTestUtils.act(async () => {
|
|
171
|
+
reactRoot.render(<App />);
|
|
172
|
+
});
|
|
173
|
+
invariant(editor !== undefined, 'editor defined');
|
|
174
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
175
|
+
// namespace inherited
|
|
176
|
+
expect(editor._config.namespace).toBe('parent');
|
|
177
|
+
expect(nestedEditor._config.namespace).toBe('parent');
|
|
178
|
+
// nodes inherited
|
|
179
|
+
expect([...nestedEditor._nodes.keys()]).toEqual([...editor._nodes.keys()]);
|
|
180
|
+
expect(warn.mock.calls).toEqual([]);
|
|
181
|
+
expectHtmlToBeEqual(
|
|
182
|
+
container?.innerHTML || '',
|
|
183
|
+
html`
|
|
184
|
+
<div
|
|
185
|
+
contenteditable="true"
|
|
186
|
+
role="textbox"
|
|
187
|
+
spellcheck="true"
|
|
188
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
189
|
+
data-lexical-editor="true">
|
|
190
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
191
|
+
<div data-lexical-decorator="true">
|
|
192
|
+
<div
|
|
193
|
+
contenteditable="true"
|
|
194
|
+
role="textbox"
|
|
195
|
+
spellcheck="true"
|
|
196
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
197
|
+
data-lexical-editor="true">
|
|
198
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
`,
|
|
203
|
+
);
|
|
204
|
+
await ReactTestUtils.act(async () => {
|
|
205
|
+
reactRoot.render(null);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
test('with deprecated initialNodes configuration and inherited namespace', async () => {
|
|
210
|
+
let editor: undefined | LexicalEditor;
|
|
211
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
212
|
+
function App() {
|
|
213
|
+
return (
|
|
214
|
+
<LexicalComposer
|
|
215
|
+
initialConfig={{
|
|
216
|
+
editorState: () => {
|
|
217
|
+
editor = $getEditor();
|
|
218
|
+
nestedEditor = createEditor();
|
|
219
|
+
nestedEditor.update(() =>
|
|
220
|
+
$getRoot()
|
|
221
|
+
.clear()
|
|
222
|
+
.append(
|
|
223
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
224
|
+
),
|
|
225
|
+
);
|
|
226
|
+
$getRoot()
|
|
227
|
+
.clear()
|
|
228
|
+
.append(
|
|
229
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
230
|
+
$createReactDecoratorNode()
|
|
231
|
+
.setInline(false)
|
|
232
|
+
.setDecorate(() => {
|
|
233
|
+
return nestedEditor ? (
|
|
234
|
+
<LexicalNestedComposer
|
|
235
|
+
initialEditor={nestedEditor}
|
|
236
|
+
initialNodes={[]}>
|
|
237
|
+
<RichTextPlugin
|
|
238
|
+
contentEditable={<ContentEditable />}
|
|
239
|
+
placeholder={<></>}
|
|
240
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
241
|
+
/>
|
|
242
|
+
</LexicalNestedComposer>
|
|
243
|
+
) : null;
|
|
244
|
+
}),
|
|
245
|
+
);
|
|
246
|
+
},
|
|
247
|
+
namespace: 'parent',
|
|
248
|
+
nodes: [ReactDecoratorNode],
|
|
249
|
+
onError: (err) => {
|
|
250
|
+
throw err;
|
|
251
|
+
},
|
|
252
|
+
}}>
|
|
253
|
+
<RichTextPlugin
|
|
254
|
+
contentEditable={<ContentEditable />}
|
|
255
|
+
placeholder={<></>}
|
|
256
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
257
|
+
/>
|
|
258
|
+
</LexicalComposer>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
await ReactTestUtils.act(async () => {
|
|
263
|
+
reactRoot.render(<App />);
|
|
264
|
+
});
|
|
265
|
+
invariant(editor !== undefined, 'editor defined');
|
|
266
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
267
|
+
// namespace inherited
|
|
268
|
+
expect(editor._config.namespace).toBe('parent');
|
|
269
|
+
expect(nestedEditor._config.namespace).toBe('parent');
|
|
270
|
+
// nodes inherited
|
|
271
|
+
expect([...nestedEditor._nodes.keys()]).toEqual([...editor._nodes.keys()]);
|
|
272
|
+
expect(warn.mock.calls).toEqual([
|
|
273
|
+
[
|
|
274
|
+
`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`,
|
|
275
|
+
],
|
|
276
|
+
[
|
|
277
|
+
`LexicalNestedComposer initialEditor should explicitly initialize its namespace when the node configuration differs from the parentEditor. For backwards compatibility, the namespace will be initialized from parentEditor until v0.32.0, but this has always had incorrect copy/paste behavior when the configuration differed.\nYou can configure your editor's namespace with createEditor({namespace: 'nested-editor-namespace', nodes: [], parentEditor: $getEditor()}).`,
|
|
278
|
+
],
|
|
279
|
+
]);
|
|
280
|
+
expectHtmlToBeEqual(
|
|
281
|
+
container?.innerHTML || '',
|
|
282
|
+
html`
|
|
283
|
+
<div
|
|
284
|
+
contenteditable="true"
|
|
285
|
+
role="textbox"
|
|
286
|
+
spellcheck="true"
|
|
287
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
288
|
+
data-lexical-editor="true">
|
|
289
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
290
|
+
<div data-lexical-decorator="true">
|
|
291
|
+
<div
|
|
292
|
+
contenteditable="true"
|
|
293
|
+
role="textbox"
|
|
294
|
+
spellcheck="true"
|
|
295
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
296
|
+
data-lexical-editor="true">
|
|
297
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
`,
|
|
302
|
+
);
|
|
303
|
+
await ReactTestUtils.act(async () => {
|
|
304
|
+
reactRoot.render(null);
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
test('with deprecated initialNodes configuration and explicit namespace', async () => {
|
|
309
|
+
let editor: undefined | LexicalEditor;
|
|
310
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
311
|
+
function App() {
|
|
312
|
+
return (
|
|
313
|
+
<LexicalComposer
|
|
314
|
+
initialConfig={{
|
|
315
|
+
editorState: () => {
|
|
316
|
+
editor = $getEditor();
|
|
317
|
+
nestedEditor = createEditor({
|
|
318
|
+
namespace: 'nested',
|
|
319
|
+
nodes: [],
|
|
320
|
+
parentEditor: editor,
|
|
321
|
+
});
|
|
322
|
+
nestedEditor.update(() =>
|
|
323
|
+
$getRoot()
|
|
324
|
+
.clear()
|
|
325
|
+
.append(
|
|
326
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
327
|
+
),
|
|
328
|
+
);
|
|
329
|
+
$getRoot()
|
|
330
|
+
.clear()
|
|
331
|
+
.append(
|
|
332
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
333
|
+
$createReactDecoratorNode()
|
|
334
|
+
.setInline(false)
|
|
335
|
+
.setDecorate(() => {
|
|
336
|
+
return nestedEditor ? (
|
|
337
|
+
<LexicalNestedComposer
|
|
338
|
+
initialEditor={nestedEditor}
|
|
339
|
+
initialNodes={[ReactDecoratorNode]}>
|
|
340
|
+
<RichTextPlugin
|
|
341
|
+
contentEditable={<ContentEditable />}
|
|
342
|
+
placeholder={<></>}
|
|
343
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
344
|
+
/>
|
|
345
|
+
</LexicalNestedComposer>
|
|
346
|
+
) : null;
|
|
347
|
+
}),
|
|
348
|
+
);
|
|
349
|
+
},
|
|
350
|
+
namespace: 'parent',
|
|
351
|
+
nodes: [ReactDecoratorNode],
|
|
352
|
+
onError: (err) => {
|
|
353
|
+
throw err;
|
|
354
|
+
},
|
|
355
|
+
}}>
|
|
356
|
+
<RichTextPlugin
|
|
357
|
+
contentEditable={<ContentEditable />}
|
|
358
|
+
placeholder={<></>}
|
|
359
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
360
|
+
/>
|
|
361
|
+
</LexicalComposer>
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
await ReactTestUtils.act(async () => {
|
|
366
|
+
reactRoot.render(<App />);
|
|
367
|
+
});
|
|
368
|
+
invariant(editor !== undefined, 'editor defined');
|
|
369
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
370
|
+
// namespace inherited
|
|
371
|
+
expect(editor._config.namespace).toBe('parent');
|
|
372
|
+
expect(nestedEditor._config.namespace).toBe('nested');
|
|
373
|
+
// nodes inherited
|
|
374
|
+
expect([...nestedEditor._nodes.keys()].sort()).toEqual(
|
|
375
|
+
[...editor._nodes.keys()].sort(),
|
|
376
|
+
);
|
|
377
|
+
expectHtmlToBeEqual(
|
|
378
|
+
container?.innerHTML || '',
|
|
379
|
+
html`
|
|
380
|
+
<div
|
|
381
|
+
contenteditable="true"
|
|
382
|
+
role="textbox"
|
|
383
|
+
spellcheck="true"
|
|
384
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
385
|
+
data-lexical-editor="true">
|
|
386
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
387
|
+
<div data-lexical-decorator="true">
|
|
388
|
+
<div
|
|
389
|
+
contenteditable="true"
|
|
390
|
+
role="textbox"
|
|
391
|
+
spellcheck="true"
|
|
392
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
393
|
+
data-lexical-editor="true">
|
|
394
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
</div>
|
|
398
|
+
`,
|
|
399
|
+
);
|
|
400
|
+
expect(warn.mock.calls).toEqual([
|
|
401
|
+
[
|
|
402
|
+
`LexicalNestedComposer initialNodes is deprecated and will be removed in v0.32.0, it has never worked correctly.\nYou can configure your editor's nodes with createEditor({nodes: [], parentEditor: $getEditor()})`,
|
|
403
|
+
],
|
|
404
|
+
]);
|
|
405
|
+
await ReactTestUtils.act(async () => {
|
|
406
|
+
reactRoot.render(null);
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
test('with explicit nodes configuration and explicit namespace', async () => {
|
|
411
|
+
let editor: undefined | LexicalEditor;
|
|
412
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
413
|
+
function App() {
|
|
414
|
+
return (
|
|
415
|
+
<LexicalComposer
|
|
416
|
+
initialConfig={{
|
|
417
|
+
editorState: () => {
|
|
418
|
+
editor = $getEditor();
|
|
419
|
+
nestedEditor = createEditor({
|
|
420
|
+
namespace: 'nested',
|
|
421
|
+
nodes: [],
|
|
422
|
+
parentEditor: editor,
|
|
423
|
+
});
|
|
424
|
+
nestedEditor.update(() =>
|
|
425
|
+
$getRoot()
|
|
426
|
+
.clear()
|
|
427
|
+
.append(
|
|
428
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
429
|
+
),
|
|
430
|
+
);
|
|
431
|
+
$getRoot()
|
|
432
|
+
.clear()
|
|
433
|
+
.append(
|
|
434
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
435
|
+
$createReactDecoratorNode()
|
|
436
|
+
.setInline(false)
|
|
437
|
+
.setDecorate(() => {
|
|
438
|
+
return nestedEditor ? (
|
|
439
|
+
<LexicalNestedComposer initialEditor={nestedEditor}>
|
|
440
|
+
<RichTextPlugin
|
|
441
|
+
contentEditable={<ContentEditable />}
|
|
442
|
+
placeholder={<></>}
|
|
443
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
444
|
+
/>
|
|
445
|
+
</LexicalNestedComposer>
|
|
446
|
+
) : null;
|
|
447
|
+
}),
|
|
448
|
+
);
|
|
449
|
+
},
|
|
450
|
+
namespace: 'parent',
|
|
451
|
+
nodes: [ReactDecoratorNode],
|
|
452
|
+
onError: (err) => {
|
|
453
|
+
throw err;
|
|
454
|
+
},
|
|
455
|
+
}}>
|
|
456
|
+
<RichTextPlugin
|
|
457
|
+
contentEditable={<ContentEditable />}
|
|
458
|
+
placeholder={<></>}
|
|
459
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
460
|
+
/>
|
|
461
|
+
</LexicalComposer>
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
await ReactTestUtils.act(async () => {
|
|
466
|
+
reactRoot.render(<App />);
|
|
467
|
+
});
|
|
468
|
+
invariant(editor !== undefined, 'editor defined');
|
|
469
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
470
|
+
// namespace inherited
|
|
471
|
+
expect(editor._config.namespace).toBe('parent');
|
|
472
|
+
expect(nestedEditor._config.namespace).toBe('nested');
|
|
473
|
+
// nodes inherited
|
|
474
|
+
expect([...nestedEditor._nodes.keys()].sort()).toEqual(
|
|
475
|
+
[...editor._nodes.keys()]
|
|
476
|
+
.filter((k) => k !== ReactDecoratorNode.getType())
|
|
477
|
+
.sort(),
|
|
478
|
+
);
|
|
479
|
+
expectHtmlToBeEqual(
|
|
480
|
+
container?.innerHTML || '',
|
|
481
|
+
html`
|
|
482
|
+
<div
|
|
483
|
+
contenteditable="true"
|
|
484
|
+
role="textbox"
|
|
485
|
+
spellcheck="true"
|
|
486
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
487
|
+
data-lexical-editor="true">
|
|
488
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
489
|
+
<div data-lexical-decorator="true">
|
|
490
|
+
<div
|
|
491
|
+
contenteditable="true"
|
|
492
|
+
role="textbox"
|
|
493
|
+
spellcheck="true"
|
|
494
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
495
|
+
data-lexical-editor="true">
|
|
496
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
497
|
+
</div>
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
`,
|
|
501
|
+
);
|
|
502
|
+
expect(warn.mock.calls).toEqual([]);
|
|
503
|
+
await ReactTestUtils.act(async () => {
|
|
504
|
+
reactRoot.render(null);
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
|
|
508
|
+
test('default editable inheritance', async () => {
|
|
509
|
+
let editor: undefined | LexicalEditor;
|
|
510
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
511
|
+
function App() {
|
|
512
|
+
return (
|
|
513
|
+
<LexicalComposer
|
|
514
|
+
initialConfig={{
|
|
515
|
+
editorState: () => {
|
|
516
|
+
editor = $getEditor();
|
|
517
|
+
nestedEditor = createEditor({
|
|
518
|
+
// this gets overwritten immediately
|
|
519
|
+
editable: false,
|
|
520
|
+
namespace: 'nested',
|
|
521
|
+
nodes: [],
|
|
522
|
+
parentEditor: editor,
|
|
523
|
+
});
|
|
524
|
+
nestedEditor.update(() =>
|
|
525
|
+
$getRoot()
|
|
526
|
+
.clear()
|
|
527
|
+
.append(
|
|
528
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
529
|
+
),
|
|
530
|
+
);
|
|
531
|
+
$getRoot()
|
|
532
|
+
.clear()
|
|
533
|
+
.append(
|
|
534
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
535
|
+
$createReactDecoratorNode()
|
|
536
|
+
.setInline(false)
|
|
537
|
+
.setDecorate(() => {
|
|
538
|
+
return nestedEditor ? (
|
|
539
|
+
<LexicalNestedComposer initialEditor={nestedEditor}>
|
|
540
|
+
<RichTextPlugin
|
|
541
|
+
contentEditable={
|
|
542
|
+
<ContentEditable aria-label="nested" />
|
|
543
|
+
}
|
|
544
|
+
placeholder={<></>}
|
|
545
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
546
|
+
/>
|
|
547
|
+
</LexicalNestedComposer>
|
|
548
|
+
) : null;
|
|
549
|
+
}),
|
|
550
|
+
);
|
|
551
|
+
},
|
|
552
|
+
namespace: 'parent',
|
|
553
|
+
nodes: [ReactDecoratorNode],
|
|
554
|
+
onError: (err) => {
|
|
555
|
+
throw err;
|
|
556
|
+
},
|
|
557
|
+
}}>
|
|
558
|
+
<RichTextPlugin
|
|
559
|
+
contentEditable={<ContentEditable aria-label="parent" />}
|
|
560
|
+
placeholder={<></>}
|
|
561
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
562
|
+
/>
|
|
563
|
+
</LexicalComposer>
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
await ReactTestUtils.act(async () => {
|
|
568
|
+
reactRoot.render(<App />);
|
|
569
|
+
});
|
|
570
|
+
invariant(editor !== undefined, 'editor defined');
|
|
571
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
572
|
+
// namespace inherited
|
|
573
|
+
expect(editor._config.namespace).toBe('parent');
|
|
574
|
+
expect(nestedEditor._config.namespace).toBe('nested');
|
|
575
|
+
// nodes inherited
|
|
576
|
+
expect([...nestedEditor._nodes.keys()].sort()).toEqual(
|
|
577
|
+
[...editor._nodes.keys()]
|
|
578
|
+
.filter((k) => k !== ReactDecoratorNode.getType())
|
|
579
|
+
.sort(),
|
|
580
|
+
);
|
|
581
|
+
expect(editor.isEditable()).toBe(true);
|
|
582
|
+
expect(nestedEditor.isEditable()).toBe(true);
|
|
583
|
+
expectHtmlToBeEqual(
|
|
584
|
+
container?.innerHTML || '',
|
|
585
|
+
html`
|
|
586
|
+
<div
|
|
587
|
+
contenteditable="true"
|
|
588
|
+
role="textbox"
|
|
589
|
+
spellcheck="true"
|
|
590
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
591
|
+
aria-label="parent"
|
|
592
|
+
data-lexical-editor="true">
|
|
593
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
594
|
+
<div data-lexical-decorator="true">
|
|
595
|
+
<div
|
|
596
|
+
contenteditable="true"
|
|
597
|
+
role="textbox"
|
|
598
|
+
spellcheck="true"
|
|
599
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
600
|
+
aria-label="nested"
|
|
601
|
+
data-lexical-editor="true">
|
|
602
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
603
|
+
</div>
|
|
604
|
+
</div>
|
|
605
|
+
</div>
|
|
606
|
+
`,
|
|
607
|
+
);
|
|
608
|
+
const editableA11yResults = await axe(container!);
|
|
609
|
+
expect(editableA11yResults).toHaveNoViolations();
|
|
610
|
+
expect(warn.mock.calls).toEqual([]);
|
|
611
|
+
await ReactTestUtils.act(async () => {
|
|
612
|
+
editor!.setEditable(false);
|
|
613
|
+
});
|
|
614
|
+
expect(editor.isEditable()).toBe(false);
|
|
615
|
+
expect(nestedEditor.isEditable()).toBe(false);
|
|
616
|
+
expectHtmlToBeEqual(
|
|
617
|
+
container?.innerHTML || '',
|
|
618
|
+
html`
|
|
619
|
+
<div
|
|
620
|
+
contenteditable="false"
|
|
621
|
+
role="textbox"
|
|
622
|
+
spellcheck="true"
|
|
623
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
624
|
+
aria-autocomplete="none"
|
|
625
|
+
aria-label="parent"
|
|
626
|
+
aria-readonly="true"
|
|
627
|
+
data-lexical-editor="true">
|
|
628
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
629
|
+
<div data-lexical-decorator="true">
|
|
630
|
+
<div
|
|
631
|
+
contenteditable="false"
|
|
632
|
+
role="textbox"
|
|
633
|
+
spellcheck="true"
|
|
634
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
635
|
+
aria-autocomplete="none"
|
|
636
|
+
aria-label="nested"
|
|
637
|
+
aria-readonly="true"
|
|
638
|
+
data-lexical-editor="true">
|
|
639
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
640
|
+
</div>
|
|
641
|
+
</div>
|
|
642
|
+
</div>
|
|
643
|
+
`,
|
|
644
|
+
);
|
|
645
|
+
const uneditableA11yResults = await axe(container!);
|
|
646
|
+
expect(uneditableA11yResults).toHaveNoViolations();
|
|
647
|
+
await ReactTestUtils.act(async () => {
|
|
648
|
+
editor!.setEditable(true);
|
|
649
|
+
});
|
|
650
|
+
expect(editor.isEditable()).toBe(true);
|
|
651
|
+
expect(nestedEditor.isEditable()).toBe(true);
|
|
652
|
+
|
|
653
|
+
await ReactTestUtils.act(async () => {
|
|
654
|
+
reactRoot.render(null);
|
|
655
|
+
});
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
test('skipEditableListener', async () => {
|
|
659
|
+
let editor: undefined | LexicalEditor;
|
|
660
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
661
|
+
function App() {
|
|
662
|
+
return (
|
|
663
|
+
<LexicalComposer
|
|
664
|
+
initialConfig={{
|
|
665
|
+
editorState: () => {
|
|
666
|
+
editor = $getEditor();
|
|
667
|
+
nestedEditor = createEditor({
|
|
668
|
+
editable: false,
|
|
669
|
+
namespace: 'nested',
|
|
670
|
+
nodes: [],
|
|
671
|
+
parentEditor: editor,
|
|
672
|
+
});
|
|
673
|
+
nestedEditor.update(() =>
|
|
674
|
+
$getRoot()
|
|
675
|
+
.clear()
|
|
676
|
+
.append(
|
|
677
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
678
|
+
),
|
|
679
|
+
);
|
|
680
|
+
$getRoot()
|
|
681
|
+
.clear()
|
|
682
|
+
.append(
|
|
683
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
684
|
+
$createReactDecoratorNode()
|
|
685
|
+
.setInline(false)
|
|
686
|
+
.setDecorate(() => {
|
|
687
|
+
return nestedEditor ? (
|
|
688
|
+
<LexicalNestedComposer
|
|
689
|
+
initialEditor={nestedEditor}
|
|
690
|
+
skipEditableListener={true}>
|
|
691
|
+
<RichTextPlugin
|
|
692
|
+
contentEditable={
|
|
693
|
+
<ContentEditable aria-label="nested" />
|
|
694
|
+
}
|
|
695
|
+
placeholder={<></>}
|
|
696
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
697
|
+
/>
|
|
698
|
+
</LexicalNestedComposer>
|
|
699
|
+
) : null;
|
|
700
|
+
}),
|
|
701
|
+
);
|
|
702
|
+
},
|
|
703
|
+
namespace: 'parent',
|
|
704
|
+
nodes: [ReactDecoratorNode],
|
|
705
|
+
onError: (err) => {
|
|
706
|
+
throw err;
|
|
707
|
+
},
|
|
708
|
+
}}>
|
|
709
|
+
<RichTextPlugin
|
|
710
|
+
contentEditable={<ContentEditable aria-label="parent" />}
|
|
711
|
+
placeholder={<></>}
|
|
712
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
713
|
+
/>
|
|
714
|
+
</LexicalComposer>
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
await ReactTestUtils.act(async () => {
|
|
719
|
+
reactRoot.render(<App />);
|
|
720
|
+
});
|
|
721
|
+
invariant(editor !== undefined, 'editor defined');
|
|
722
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
723
|
+
// namespace not inherited
|
|
724
|
+
expect(editor._config.namespace).toBe('parent');
|
|
725
|
+
expect(nestedEditor._config.namespace).toBe('nested');
|
|
726
|
+
// nodes not inherited
|
|
727
|
+
expect([...nestedEditor._nodes.keys()].sort()).toEqual(
|
|
728
|
+
[...editor._nodes.keys()]
|
|
729
|
+
.filter((k) => k !== ReactDecoratorNode.getType())
|
|
730
|
+
.sort(),
|
|
731
|
+
);
|
|
732
|
+
expect(editor.isEditable()).toBe(true);
|
|
733
|
+
expect(nestedEditor.isEditable()).toBe(false);
|
|
734
|
+
expectHtmlToBeEqual(
|
|
735
|
+
container?.innerHTML || '',
|
|
736
|
+
html`
|
|
737
|
+
<div
|
|
738
|
+
contenteditable="true"
|
|
739
|
+
role="textbox"
|
|
740
|
+
spellcheck="true"
|
|
741
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
742
|
+
aria-label="parent"
|
|
743
|
+
data-lexical-editor="true">
|
|
744
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
745
|
+
<div data-lexical-decorator="true">
|
|
746
|
+
<div
|
|
747
|
+
contenteditable="false"
|
|
748
|
+
role="textbox"
|
|
749
|
+
spellcheck="true"
|
|
750
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
751
|
+
aria-autocomplete="none"
|
|
752
|
+
aria-label="nested"
|
|
753
|
+
aria-readonly="true"
|
|
754
|
+
data-lexical-editor="true">
|
|
755
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
756
|
+
</div>
|
|
757
|
+
</div>
|
|
758
|
+
</div>
|
|
759
|
+
`,
|
|
760
|
+
);
|
|
761
|
+
const editableA11yResults = await axe(container!);
|
|
762
|
+
expect(editableA11yResults).toHaveNoViolations();
|
|
763
|
+
expect(warn.mock.calls).toEqual([]);
|
|
764
|
+
await ReactTestUtils.act(async () => {
|
|
765
|
+
editor!.setEditable(false);
|
|
766
|
+
});
|
|
767
|
+
expect(editor.isEditable()).toBe(false);
|
|
768
|
+
expect(nestedEditor.isEditable()).toBe(false);
|
|
769
|
+
expectHtmlToBeEqual(
|
|
770
|
+
container?.innerHTML || '',
|
|
771
|
+
html`
|
|
772
|
+
<div
|
|
773
|
+
contenteditable="false"
|
|
774
|
+
role="textbox"
|
|
775
|
+
spellcheck="true"
|
|
776
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
777
|
+
aria-autocomplete="none"
|
|
778
|
+
aria-label="parent"
|
|
779
|
+
aria-readonly="true"
|
|
780
|
+
data-lexical-editor="true">
|
|
781
|
+
<p dir="auto"><span data-lexical-text="true">parent</span></p>
|
|
782
|
+
<div data-lexical-decorator="true">
|
|
783
|
+
<div
|
|
784
|
+
contenteditable="false"
|
|
785
|
+
role="textbox"
|
|
786
|
+
spellcheck="true"
|
|
787
|
+
style="user-select: text; white-space: pre-wrap; word-break: break-word"
|
|
788
|
+
aria-autocomplete="none"
|
|
789
|
+
aria-label="nested"
|
|
790
|
+
aria-readonly="true"
|
|
791
|
+
data-lexical-editor="true">
|
|
792
|
+
<p dir="auto"><span data-lexical-text="true">nested</span></p>
|
|
793
|
+
</div>
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
`,
|
|
797
|
+
);
|
|
798
|
+
const uneditableA11yResults = await axe(container!);
|
|
799
|
+
expect(uneditableA11yResults).toHaveNoViolations();
|
|
800
|
+
await ReactTestUtils.act(async () => {
|
|
801
|
+
editor!.setEditable(true);
|
|
802
|
+
});
|
|
803
|
+
expect(editor.isEditable()).toBe(true);
|
|
804
|
+
expect(nestedEditor.isEditable()).toBe(false);
|
|
805
|
+
|
|
806
|
+
await ReactTestUtils.act(async () => {
|
|
807
|
+
reactRoot.render(null);
|
|
808
|
+
});
|
|
809
|
+
});
|
|
810
|
+
|
|
811
|
+
test('command listener delegation', async () => {
|
|
812
|
+
let editor: undefined | LexicalEditor;
|
|
813
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
814
|
+
const DELEGATED_COMMAND = createCommand<unknown>('DELEGATED_COMMAND');
|
|
815
|
+
const $commandListener = vi.fn((_) => false);
|
|
816
|
+
function DelegateListenerPlugin() {
|
|
817
|
+
const [currentEditor] = useLexicalComposerContext();
|
|
818
|
+
useEffect(() => {
|
|
819
|
+
return mergeRegister(
|
|
820
|
+
currentEditor.registerCommand(
|
|
821
|
+
DELEGATED_COMMAND,
|
|
822
|
+
(payload, dispatchEditor) =>
|
|
823
|
+
$commandListener({
|
|
824
|
+
currentEditor: $getEditor(),
|
|
825
|
+
dispatchEditor,
|
|
826
|
+
payload,
|
|
827
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
828
|
+
}),
|
|
829
|
+
COMMAND_PRIORITY_CRITICAL,
|
|
830
|
+
),
|
|
831
|
+
currentEditor.registerCommand(
|
|
832
|
+
DELEGATED_COMMAND,
|
|
833
|
+
(payload, dispatchEditor) =>
|
|
834
|
+
$commandListener({
|
|
835
|
+
currentEditor: $getEditor(),
|
|
836
|
+
dispatchEditor,
|
|
837
|
+
payload,
|
|
838
|
+
priority: COMMAND_PRIORITY_EDITOR,
|
|
839
|
+
}),
|
|
840
|
+
COMMAND_PRIORITY_EDITOR,
|
|
841
|
+
),
|
|
842
|
+
);
|
|
843
|
+
}, [currentEditor]);
|
|
844
|
+
return null;
|
|
845
|
+
}
|
|
846
|
+
function App() {
|
|
847
|
+
return (
|
|
848
|
+
<LexicalComposer
|
|
849
|
+
initialConfig={{
|
|
850
|
+
editorState: () => {
|
|
851
|
+
editor = $getEditor();
|
|
852
|
+
nestedEditor = createEditor({
|
|
853
|
+
namespace: 'nested',
|
|
854
|
+
nodes: [],
|
|
855
|
+
parentEditor: editor,
|
|
856
|
+
});
|
|
857
|
+
nestedEditor.update(() =>
|
|
858
|
+
$getRoot()
|
|
859
|
+
.clear()
|
|
860
|
+
.append(
|
|
861
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
862
|
+
),
|
|
863
|
+
);
|
|
864
|
+
$getRoot()
|
|
865
|
+
.clear()
|
|
866
|
+
.append(
|
|
867
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
868
|
+
$createReactDecoratorNode()
|
|
869
|
+
.setInline(false)
|
|
870
|
+
.setDecorate(() => {
|
|
871
|
+
return nestedEditor ? (
|
|
872
|
+
<LexicalNestedComposer
|
|
873
|
+
initialEditor={nestedEditor}
|
|
874
|
+
skipEditableListener={true}>
|
|
875
|
+
<RichTextPlugin
|
|
876
|
+
contentEditable={<ContentEditable />}
|
|
877
|
+
placeholder={<></>}
|
|
878
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
879
|
+
/>
|
|
880
|
+
<DelegateListenerPlugin />
|
|
881
|
+
</LexicalNestedComposer>
|
|
882
|
+
) : null;
|
|
883
|
+
}),
|
|
884
|
+
);
|
|
885
|
+
},
|
|
886
|
+
namespace: 'parent',
|
|
887
|
+
nodes: [ReactDecoratorNode],
|
|
888
|
+
onError: (err) => {
|
|
889
|
+
throw err;
|
|
890
|
+
},
|
|
891
|
+
}}>
|
|
892
|
+
<RichTextPlugin
|
|
893
|
+
contentEditable={<ContentEditable />}
|
|
894
|
+
placeholder={<></>}
|
|
895
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
896
|
+
/>
|
|
897
|
+
<DelegateListenerPlugin />
|
|
898
|
+
</LexicalComposer>
|
|
899
|
+
);
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
await ReactTestUtils.act(async () => {
|
|
903
|
+
reactRoot.render(<App />);
|
|
904
|
+
});
|
|
905
|
+
invariant(editor !== undefined, 'editor defined');
|
|
906
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
907
|
+
// namespace not inherited
|
|
908
|
+
expect(editor._config.namespace).toBe('parent');
|
|
909
|
+
expect(nestedEditor._config.namespace).toBe('nested');
|
|
910
|
+
// nodes not inherited
|
|
911
|
+
expect([...nestedEditor._nodes.keys()].sort()).toEqual(
|
|
912
|
+
[...editor._nodes.keys()]
|
|
913
|
+
.filter((k) => k !== ReactDecoratorNode.getType())
|
|
914
|
+
.sort(),
|
|
915
|
+
);
|
|
916
|
+
expect(warn.mock.calls).toEqual([]);
|
|
917
|
+
await ReactTestUtils.act(async () => {
|
|
918
|
+
expect(editor?.dispatchCommand(DELEGATED_COMMAND, undefined)).toBe(false);
|
|
919
|
+
expect($commandListener.mock.calls).toEqual([
|
|
920
|
+
[
|
|
921
|
+
{
|
|
922
|
+
currentEditor: editor,
|
|
923
|
+
dispatchEditor: editor,
|
|
924
|
+
payload: undefined,
|
|
925
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
926
|
+
},
|
|
927
|
+
],
|
|
928
|
+
[
|
|
929
|
+
{
|
|
930
|
+
currentEditor: editor,
|
|
931
|
+
dispatchEditor: editor,
|
|
932
|
+
payload: undefined,
|
|
933
|
+
priority: COMMAND_PRIORITY_EDITOR,
|
|
934
|
+
},
|
|
935
|
+
],
|
|
936
|
+
]);
|
|
937
|
+
$commandListener.mockClear();
|
|
938
|
+
expect(nestedEditor?.dispatchCommand(DELEGATED_COMMAND, undefined)).toBe(
|
|
939
|
+
false,
|
|
940
|
+
);
|
|
941
|
+
expect($commandListener.mock.calls).toEqual([
|
|
942
|
+
[
|
|
943
|
+
{
|
|
944
|
+
currentEditor: nestedEditor,
|
|
945
|
+
dispatchEditor: nestedEditor,
|
|
946
|
+
payload: undefined,
|
|
947
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
948
|
+
},
|
|
949
|
+
],
|
|
950
|
+
[
|
|
951
|
+
{
|
|
952
|
+
currentEditor: editor,
|
|
953
|
+
dispatchEditor: nestedEditor,
|
|
954
|
+
payload: undefined,
|
|
955
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
956
|
+
},
|
|
957
|
+
],
|
|
958
|
+
[
|
|
959
|
+
{
|
|
960
|
+
currentEditor: nestedEditor,
|
|
961
|
+
dispatchEditor: nestedEditor,
|
|
962
|
+
payload: undefined,
|
|
963
|
+
priority: COMMAND_PRIORITY_EDITOR,
|
|
964
|
+
},
|
|
965
|
+
],
|
|
966
|
+
[
|
|
967
|
+
{
|
|
968
|
+
currentEditor: editor,
|
|
969
|
+
dispatchEditor: nestedEditor,
|
|
970
|
+
payload: undefined,
|
|
971
|
+
priority: COMMAND_PRIORITY_EDITOR,
|
|
972
|
+
},
|
|
973
|
+
],
|
|
974
|
+
]);
|
|
975
|
+
$commandListener.mockClear();
|
|
976
|
+
// Can stop propagation from nested editor
|
|
977
|
+
$commandListener.mockImplementation(
|
|
978
|
+
(opts) =>
|
|
979
|
+
opts.dispatchEditor === opts.currentEditor &&
|
|
980
|
+
opts.priority === COMMAND_PRIORITY_EDITOR,
|
|
981
|
+
);
|
|
982
|
+
expect(nestedEditor?.dispatchCommand(DELEGATED_COMMAND, undefined)).toBe(
|
|
983
|
+
true,
|
|
984
|
+
);
|
|
985
|
+
expect($commandListener.mock.calls).toEqual([
|
|
986
|
+
[
|
|
987
|
+
{
|
|
988
|
+
currentEditor: nestedEditor,
|
|
989
|
+
dispatchEditor: nestedEditor,
|
|
990
|
+
payload: undefined,
|
|
991
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
992
|
+
},
|
|
993
|
+
],
|
|
994
|
+
[
|
|
995
|
+
{
|
|
996
|
+
currentEditor: editor,
|
|
997
|
+
dispatchEditor: nestedEditor,
|
|
998
|
+
payload: undefined,
|
|
999
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
1000
|
+
},
|
|
1001
|
+
],
|
|
1002
|
+
[
|
|
1003
|
+
{
|
|
1004
|
+
currentEditor: nestedEditor,
|
|
1005
|
+
dispatchEditor: nestedEditor,
|
|
1006
|
+
payload: undefined,
|
|
1007
|
+
priority: COMMAND_PRIORITY_EDITOR,
|
|
1008
|
+
},
|
|
1009
|
+
],
|
|
1010
|
+
]);
|
|
1011
|
+
$commandListener.mockClear();
|
|
1012
|
+
|
|
1013
|
+
// Can stop propagation from parent editor
|
|
1014
|
+
$commandListener.mockImplementation(
|
|
1015
|
+
(opts) => opts.dispatchEditor !== opts.currentEditor,
|
|
1016
|
+
);
|
|
1017
|
+
expect(nestedEditor?.dispatchCommand(DELEGATED_COMMAND, undefined)).toBe(
|
|
1018
|
+
true,
|
|
1019
|
+
);
|
|
1020
|
+
expect($commandListener.mock.calls).toEqual([
|
|
1021
|
+
[
|
|
1022
|
+
{
|
|
1023
|
+
currentEditor: nestedEditor,
|
|
1024
|
+
dispatchEditor: nestedEditor,
|
|
1025
|
+
payload: undefined,
|
|
1026
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
1027
|
+
},
|
|
1028
|
+
],
|
|
1029
|
+
[
|
|
1030
|
+
{
|
|
1031
|
+
currentEditor: editor,
|
|
1032
|
+
dispatchEditor: nestedEditor,
|
|
1033
|
+
payload: undefined,
|
|
1034
|
+
priority: COMMAND_PRIORITY_CRITICAL,
|
|
1035
|
+
},
|
|
1036
|
+
],
|
|
1037
|
+
]);
|
|
1038
|
+
$commandListener.mockClear();
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
await ReactTestUtils.act(async () => {
|
|
1042
|
+
reactRoot.render(null);
|
|
1043
|
+
});
|
|
1044
|
+
});
|
|
1045
|
+
test('static transform and $config.transform inheritance', async () => {
|
|
1046
|
+
let editor: undefined | LexicalEditor;
|
|
1047
|
+
let nestedEditor: undefined | LexicalEditor;
|
|
1048
|
+
const $transform = vi.fn();
|
|
1049
|
+
const transform = vi.fn();
|
|
1050
|
+
class StaticTransformNode extends TextNode {
|
|
1051
|
+
static getType() {
|
|
1052
|
+
return 'static-transform';
|
|
1053
|
+
}
|
|
1054
|
+
static transform() {
|
|
1055
|
+
return transform;
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
class ConfigTransformNode extends TextNode {
|
|
1059
|
+
$config() {
|
|
1060
|
+
return this.config('$config-transform', {$transform});
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
function App() {
|
|
1064
|
+
return (
|
|
1065
|
+
<LexicalComposer
|
|
1066
|
+
initialConfig={{
|
|
1067
|
+
editorState: () => {
|
|
1068
|
+
editor = $getEditor();
|
|
1069
|
+
nestedEditor = createEditor();
|
|
1070
|
+
nestedEditor.update(() =>
|
|
1071
|
+
$getRoot()
|
|
1072
|
+
.clear()
|
|
1073
|
+
.append(
|
|
1074
|
+
$createParagraphNode().append($createTextNode('nested')),
|
|
1075
|
+
),
|
|
1076
|
+
);
|
|
1077
|
+
$getRoot()
|
|
1078
|
+
.clear()
|
|
1079
|
+
.append(
|
|
1080
|
+
$createParagraphNode().append($createTextNode('parent')),
|
|
1081
|
+
$createReactDecoratorNode()
|
|
1082
|
+
.setInline(false)
|
|
1083
|
+
.setDecorate(() => {
|
|
1084
|
+
return nestedEditor ? (
|
|
1085
|
+
<LexicalNestedComposer
|
|
1086
|
+
initialEditor={nestedEditor}
|
|
1087
|
+
skipEditableListener={true}>
|
|
1088
|
+
<RichTextPlugin
|
|
1089
|
+
contentEditable={<ContentEditable />}
|
|
1090
|
+
placeholder={<></>}
|
|
1091
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
1092
|
+
/>
|
|
1093
|
+
</LexicalNestedComposer>
|
|
1094
|
+
) : null;
|
|
1095
|
+
}),
|
|
1096
|
+
);
|
|
1097
|
+
},
|
|
1098
|
+
namespace: 'parent',
|
|
1099
|
+
nodes: [
|
|
1100
|
+
ReactDecoratorNode,
|
|
1101
|
+
StaticTransformNode,
|
|
1102
|
+
ConfigTransformNode,
|
|
1103
|
+
],
|
|
1104
|
+
onError: (err) => {
|
|
1105
|
+
throw err;
|
|
1106
|
+
},
|
|
1107
|
+
}}>
|
|
1108
|
+
<RichTextPlugin
|
|
1109
|
+
contentEditable={<ContentEditable />}
|
|
1110
|
+
placeholder={<></>}
|
|
1111
|
+
ErrorBoundary={LexicalErrorBoundary}
|
|
1112
|
+
/>
|
|
1113
|
+
</LexicalComposer>
|
|
1114
|
+
);
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
await ReactTestUtils.act(async () => {
|
|
1118
|
+
reactRoot.render(<App />);
|
|
1119
|
+
});
|
|
1120
|
+
invariant(editor !== undefined, 'editor defined');
|
|
1121
|
+
invariant(nestedEditor !== undefined, 'nestedEditor defined');
|
|
1122
|
+
// namespace inherited
|
|
1123
|
+
expect(editor._config.namespace).toBe('parent');
|
|
1124
|
+
expect(nestedEditor._config.namespace).toBe('parent');
|
|
1125
|
+
// nodes inherited
|
|
1126
|
+
expect([...nestedEditor._nodes.keys()].sort()).toEqual(
|
|
1127
|
+
[...editor._nodes.keys()].sort(),
|
|
1128
|
+
);
|
|
1129
|
+
for (const {type, fn} of [
|
|
1130
|
+
{fn: transform, type: 'static-transform'},
|
|
1131
|
+
{fn: $transform, type: '$config-transform'},
|
|
1132
|
+
]) {
|
|
1133
|
+
expect(getRegisteredNode(nestedEditor, type)?.transforms).toEqual(
|
|
1134
|
+
new Set([fn]),
|
|
1135
|
+
);
|
|
1136
|
+
}
|
|
1137
|
+
expect(warn.mock.calls).toEqual([]);
|
|
1138
|
+
await ReactTestUtils.act(async () => {
|
|
1139
|
+
reactRoot.render(null);
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
});
|