@ekz/lexical-react 0.40.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/@ekz/lexicalExtensionComponent.dev.js +53 -0
- package/@ekz/lexicalExtensionComponent.dev.mjs +51 -0
- package/@ekz/lexicalExtensionComponent.js +11 -0
- package/@ekz/lexicalExtensionComponent.mjs +12 -0
- package/@ekz/lexicalExtensionComponent.node.mjs +10 -0
- package/@ekz/lexicalExtensionComponent.prod.js +9 -0
- package/@ekz/lexicalExtensionComponent.prod.mjs +9 -0
- package/@ekz/lexicalReactExtension.dev.js +187 -0
- package/@ekz/lexicalReactExtension.dev.mjs +184 -0
- package/@ekz/lexicalReactExtension.js +11 -0
- package/@ekz/lexicalReactExtension.mjs +13 -0
- package/@ekz/lexicalReactExtension.node.mjs +11 -0
- package/@ekz/lexicalReactExtension.prod.js +9 -0
- package/@ekz/lexicalReactExtension.prod.mjs +9 -0
- package/@ekz/lexicalReactPluginHostExtension.dev.js +189 -0
- package/@ekz/lexicalReactPluginHostExtension.dev.mjs +181 -0
- package/@ekz/lexicalReactPluginHostExtension.js +11 -0
- package/@ekz/lexicalReactPluginHostExtension.mjs +18 -0
- package/@ekz/lexicalReactPluginHostExtension.node.mjs +16 -0
- package/@ekz/lexicalReactPluginHostExtension.prod.js +9 -0
- package/@ekz/lexicalReactPluginHostExtension.prod.mjs +9 -0
- package/@ekz/lexicalReactProviderExtension.dev.js +33 -0
- package/@ekz/lexicalReactProviderExtension.dev.mjs +31 -0
- package/@ekz/lexicalReactProviderExtension.js +11 -0
- package/@ekz/lexicalReactProviderExtension.mjs +12 -0
- package/@ekz/lexicalReactProviderExtension.node.mjs +10 -0
- package/@ekz/lexicalReactProviderExtension.prod.js +9 -0
- package/@ekz/lexicalReactProviderExtension.prod.mjs +9 -0
- package/@ekz/lexicalTreeViewExtension.dev.js +57 -0
- package/@ekz/lexicalTreeViewExtension.dev.mjs +54 -0
- package/@ekz/lexicalTreeViewExtension.js +11 -0
- package/@ekz/lexicalTreeViewExtension.mjs +13 -0
- package/@ekz/lexicalTreeViewExtension.node.mjs +11 -0
- package/@ekz/lexicalTreeViewExtension.prod.js +9 -0
- package/@ekz/lexicalTreeViewExtension.prod.mjs +9 -0
- package/ExtensionComponent.d.ts +42 -0
- package/LICENSE +21 -0
- package/LexicalAutoEmbedPlugin.d.ts +39 -0
- package/LexicalAutoEmbedPlugin.dev.js +146 -0
- package/LexicalAutoEmbedPlugin.dev.mjs +141 -0
- package/LexicalAutoEmbedPlugin.js +11 -0
- package/LexicalAutoEmbedPlugin.js.flow +64 -0
- package/LexicalAutoEmbedPlugin.mjs +15 -0
- package/LexicalAutoEmbedPlugin.node.mjs +13 -0
- package/LexicalAutoEmbedPlugin.prod.js +9 -0
- package/LexicalAutoEmbedPlugin.prod.mjs +9 -0
- package/LexicalAutoFocusPlugin.d.ts +12 -0
- package/LexicalAutoFocusPlugin.dev.js +47 -0
- package/LexicalAutoFocusPlugin.dev.mjs +45 -0
- package/LexicalAutoFocusPlugin.js +11 -0
- package/LexicalAutoFocusPlugin.js.flow +14 -0
- package/LexicalAutoFocusPlugin.mjs +12 -0
- package/LexicalAutoFocusPlugin.node.mjs +10 -0
- package/LexicalAutoFocusPlugin.prod.js +9 -0
- package/LexicalAutoFocusPlugin.prod.mjs +9 -0
- package/LexicalAutoLinkPlugin.d.ts +14 -0
- package/LexicalAutoLinkPlugin.dev.js +54 -0
- package/LexicalAutoLinkPlugin.dev.mjs +52 -0
- package/LexicalAutoLinkPlugin.js +11 -0
- package/LexicalAutoLinkPlugin.js.flow +18 -0
- package/LexicalAutoLinkPlugin.mjs +13 -0
- package/LexicalAutoLinkPlugin.node.mjs +11 -0
- package/LexicalAutoLinkPlugin.prod.js +9 -0
- package/LexicalAutoLinkPlugin.prod.mjs +9 -0
- package/LexicalBlockWithAlignableContents.d.ts +21 -0
- package/LexicalBlockWithAlignableContents.dev.js +81 -0
- package/LexicalBlockWithAlignableContents.dev.mjs +79 -0
- package/LexicalBlockWithAlignableContents.js +11 -0
- package/LexicalBlockWithAlignableContents.js.flow +28 -0
- package/LexicalBlockWithAlignableContents.mjs +12 -0
- package/LexicalBlockWithAlignableContents.node.mjs +10 -0
- package/LexicalBlockWithAlignableContents.prod.js +9 -0
- package/LexicalBlockWithAlignableContents.prod.mjs +9 -0
- package/LexicalCharacterLimitPlugin.d.ts +15 -0
- package/LexicalCharacterLimitPlugin.dev.js +292 -0
- package/LexicalCharacterLimitPlugin.dev.mjs +290 -0
- package/LexicalCharacterLimitPlugin.js +11 -0
- package/LexicalCharacterLimitPlugin.js.flow +12 -0
- package/LexicalCharacterLimitPlugin.mjs +12 -0
- package/LexicalCharacterLimitPlugin.node.mjs +10 -0
- package/LexicalCharacterLimitPlugin.prod.js +9 -0
- package/LexicalCharacterLimitPlugin.prod.mjs +9 -0
- package/LexicalCheckListPlugin.d.ts +8 -0
- package/LexicalCheckListPlugin.dev.js +31 -0
- package/LexicalCheckListPlugin.dev.mjs +29 -0
- package/LexicalCheckListPlugin.js +11 -0
- package/LexicalCheckListPlugin.js.flow +10 -0
- package/LexicalCheckListPlugin.mjs +12 -0
- package/LexicalCheckListPlugin.node.mjs +10 -0
- package/LexicalCheckListPlugin.prod.js +9 -0
- package/LexicalCheckListPlugin.prod.mjs +9 -0
- package/LexicalClearEditorPlugin.d.ts +13 -0
- package/LexicalClearEditorPlugin.dev.js +55 -0
- package/LexicalClearEditorPlugin.dev.mjs +53 -0
- package/LexicalClearEditorPlugin.js +11 -0
- package/LexicalClearEditorPlugin.js.flow +14 -0
- package/LexicalClearEditorPlugin.mjs +12 -0
- package/LexicalClearEditorPlugin.node.mjs +10 -0
- package/LexicalClearEditorPlugin.prod.js +9 -0
- package/LexicalClearEditorPlugin.prod.mjs +9 -0
- package/LexicalClickableLinkPlugin.d.ts +11 -0
- package/LexicalClickableLinkPlugin.dev.js +38 -0
- package/LexicalClickableLinkPlugin.dev.mjs +36 -0
- package/LexicalClickableLinkPlugin.js +11 -0
- package/LexicalClickableLinkPlugin.js.flow +12 -0
- package/LexicalClickableLinkPlugin.mjs +12 -0
- package/LexicalClickableLinkPlugin.node.mjs +10 -0
- package/LexicalClickableLinkPlugin.prod.js +9 -0
- package/LexicalClickableLinkPlugin.prod.mjs +9 -0
- package/LexicalCollaborationContext.d.ts +19 -0
- package/LexicalCollaborationContext.dev.js +69 -0
- package/LexicalCollaborationContext.dev.mjs +65 -0
- package/LexicalCollaborationContext.js +11 -0
- package/LexicalCollaborationContext.js.flow +22 -0
- package/LexicalCollaborationContext.mjs +14 -0
- package/LexicalCollaborationContext.node.mjs +12 -0
- package/LexicalCollaborationContext.prod.js +9 -0
- package/LexicalCollaborationContext.prod.mjs +9 -0
- package/LexicalCollaborationPlugin.d.ts +39 -0
- package/LexicalCollaborationPlugin.dev.js +584 -0
- package/LexicalCollaborationPlugin.dev.mjs +569 -0
- package/LexicalCollaborationPlugin.js +11 -0
- package/LexicalCollaborationPlugin.js.flow +50 -0
- package/LexicalCollaborationPlugin.mjs +13 -0
- package/LexicalCollaborationPlugin.node.mjs +11 -0
- package/LexicalCollaborationPlugin.prod.js +9 -0
- package/LexicalCollaborationPlugin.prod.mjs +9 -0
- package/LexicalComposer.d.ts +25 -0
- package/LexicalComposer.dev.js +134 -0
- package/LexicalComposer.dev.mjs +132 -0
- package/LexicalComposer.js +11 -0
- package/LexicalComposer.js.flow +40 -0
- package/LexicalComposer.mjs +12 -0
- package/LexicalComposer.node.mjs +10 -0
- package/LexicalComposer.prod.js +9 -0
- package/LexicalComposer.prod.mjs +9 -0
- package/LexicalComposerContext.d.ts +18 -0
- package/LexicalComposerContext.dev.js +55 -0
- package/LexicalComposerContext.dev.mjs +51 -0
- package/LexicalComposerContext.js +11 -0
- package/LexicalComposerContext.js.flow +27 -0
- package/LexicalComposerContext.mjs +14 -0
- package/LexicalComposerContext.node.mjs +12 -0
- package/LexicalComposerContext.prod.js +9 -0
- package/LexicalComposerContext.prod.mjs +9 -0
- package/LexicalContentEditable.d.ts +26 -0
- package/LexicalContentEditable.dev.js +242 -0
- package/LexicalContentEditable.dev.mjs +239 -0
- package/LexicalContentEditable.js +11 -0
- package/LexicalContentEditable.js.flow +80 -0
- package/LexicalContentEditable.mjs +13 -0
- package/LexicalContentEditable.node.mjs +11 -0
- package/LexicalContentEditable.prod.js +9 -0
- package/LexicalContentEditable.prod.mjs +9 -0
- package/LexicalContextMenuPlugin.d.ts +36 -0
- package/LexicalContextMenuPlugin.dev.js +524 -0
- package/LexicalContextMenuPlugin.dev.mjs +509 -0
- package/LexicalContextMenuPlugin.js +11 -0
- package/LexicalContextMenuPlugin.js.flow +13 -0
- package/LexicalContextMenuPlugin.mjs +13 -0
- package/LexicalContextMenuPlugin.node.mjs +11 -0
- package/LexicalContextMenuPlugin.prod.js +9 -0
- package/LexicalContextMenuPlugin.prod.mjs +9 -0
- package/LexicalDecoratorBlockNode.d.ts +25 -0
- package/LexicalDecoratorBlockNode.dev.js +59 -0
- package/LexicalDecoratorBlockNode.dev.mjs +56 -0
- package/LexicalDecoratorBlockNode.js +11 -0
- package/LexicalDecoratorBlockNode.js.flow +35 -0
- package/LexicalDecoratorBlockNode.mjs +13 -0
- package/LexicalDecoratorBlockNode.node.mjs +11 -0
- package/LexicalDecoratorBlockNode.prod.js +9 -0
- package/LexicalDecoratorBlockNode.prod.mjs +9 -0
- package/LexicalDraggableBlockPlugin.d.ts +18 -0
- package/LexicalDraggableBlockPlugin.dev.js +655 -0
- package/LexicalDraggableBlockPlugin.dev.mjs +653 -0
- package/LexicalDraggableBlockPlugin.js +11 -0
- package/LexicalDraggableBlockPlugin.js.flow +24 -0
- package/LexicalDraggableBlockPlugin.mjs +12 -0
- package/LexicalDraggableBlockPlugin.node.mjs +10 -0
- package/LexicalDraggableBlockPlugin.prod.js +9 -0
- package/LexicalDraggableBlockPlugin.prod.mjs +9 -0
- package/LexicalEditorRefPlugin.d.ts +20 -0
- package/LexicalEditorRefPlugin.dev.js +58 -0
- package/LexicalEditorRefPlugin.dev.mjs +43 -0
- package/LexicalEditorRefPlugin.js +11 -0
- package/LexicalEditorRefPlugin.js.flow +19 -0
- package/LexicalEditorRefPlugin.mjs +12 -0
- package/LexicalEditorRefPlugin.node.mjs +10 -0
- package/LexicalEditorRefPlugin.prod.js +9 -0
- package/LexicalEditorRefPlugin.prod.mjs +9 -0
- package/LexicalErrorBoundary.d.ts +13 -0
- package/LexicalErrorBoundary.dev.js +40 -0
- package/LexicalErrorBoundary.dev.mjs +38 -0
- package/LexicalErrorBoundary.js +11 -0
- package/LexicalErrorBoundary.js.flow +17 -0
- package/LexicalErrorBoundary.mjs +12 -0
- package/LexicalErrorBoundary.node.mjs +10 -0
- package/LexicalErrorBoundary.prod.js +9 -0
- package/LexicalErrorBoundary.prod.mjs +9 -0
- package/LexicalExtensionComponent.js.flow +12 -0
- package/LexicalExtensionComposer.d.ts +69 -0
- package/LexicalExtensionComposer.dev.js +105 -0
- package/LexicalExtensionComposer.dev.mjs +103 -0
- package/LexicalExtensionComposer.js +11 -0
- package/LexicalExtensionComposer.js.flow +20 -0
- package/LexicalExtensionComposer.mjs +12 -0
- package/LexicalExtensionComposer.node.mjs +10 -0
- package/LexicalExtensionComposer.prod.js +9 -0
- package/LexicalExtensionComposer.prod.mjs +9 -0
- package/LexicalHashtagPlugin.d.ts +9 -0
- package/LexicalHashtagPlugin.dev.js +34 -0
- package/LexicalHashtagPlugin.dev.mjs +32 -0
- package/LexicalHashtagPlugin.js +11 -0
- package/LexicalHashtagPlugin.js.flow +10 -0
- package/LexicalHashtagPlugin.mjs +12 -0
- package/LexicalHashtagPlugin.node.mjs +10 -0
- package/LexicalHashtagPlugin.prod.js +9 -0
- package/LexicalHashtagPlugin.prod.mjs +9 -0
- package/LexicalHistoryPlugin.d.ts +14 -0
- package/LexicalHistoryPlugin.dev.js +48 -0
- package/LexicalHistoryPlugin.dev.mjs +46 -0
- package/LexicalHistoryPlugin.js +11 -0
- package/LexicalHistoryPlugin.js.flow +28 -0
- package/LexicalHistoryPlugin.mjs +13 -0
- package/LexicalHistoryPlugin.node.mjs +11 -0
- package/LexicalHistoryPlugin.prod.js +9 -0
- package/LexicalHistoryPlugin.prod.mjs +9 -0
- package/LexicalHorizontalRuleNode.d.ts +25 -0
- package/LexicalHorizontalRuleNode.dev.js +102 -0
- package/LexicalHorizontalRuleNode.dev.mjs +98 -0
- package/LexicalHorizontalRuleNode.js +11 -0
- package/LexicalHorizontalRuleNode.js.flow +27 -0
- package/LexicalHorizontalRuleNode.mjs +15 -0
- package/LexicalHorizontalRuleNode.node.mjs +13 -0
- package/LexicalHorizontalRuleNode.prod.js +9 -0
- package/LexicalHorizontalRuleNode.prod.mjs +9 -0
- package/LexicalHorizontalRulePlugin.d.ts +8 -0
- package/LexicalHorizontalRulePlugin.dev.js +44 -0
- package/LexicalHorizontalRulePlugin.dev.mjs +42 -0
- package/LexicalHorizontalRulePlugin.js +11 -0
- package/LexicalHorizontalRulePlugin.js.flow +12 -0
- package/LexicalHorizontalRulePlugin.mjs +12 -0
- package/LexicalHorizontalRulePlugin.node.mjs +10 -0
- package/LexicalHorizontalRulePlugin.prod.js +9 -0
- package/LexicalHorizontalRulePlugin.prod.mjs +9 -0
- package/LexicalLinkPlugin.d.ts +14 -0
- package/LexicalLinkPlugin.dev.js +43 -0
- package/LexicalLinkPlugin.dev.mjs +41 -0
- package/LexicalLinkPlugin.js +11 -0
- package/LexicalLinkPlugin.js.flow +21 -0
- package/LexicalLinkPlugin.mjs +12 -0
- package/LexicalLinkPlugin.node.mjs +10 -0
- package/LexicalLinkPlugin.prod.js +9 -0
- package/LexicalLinkPlugin.prod.mjs +9 -0
- package/LexicalListPlugin.d.ts +20 -0
- package/LexicalListPlugin.dev.js +55 -0
- package/LexicalListPlugin.dev.mjs +53 -0
- package/LexicalListPlugin.js +11 -0
- package/LexicalListPlugin.js.flow +15 -0
- package/LexicalListPlugin.mjs +12 -0
- package/LexicalListPlugin.node.mjs +10 -0
- package/LexicalListPlugin.prod.js +9 -0
- package/LexicalListPlugin.prod.mjs +9 -0
- package/LexicalMarkdownShortcutPlugin.d.ts +12 -0
- package/LexicalMarkdownShortcutPlugin.dev.js +55 -0
- package/LexicalMarkdownShortcutPlugin.dev.mjs +52 -0
- package/LexicalMarkdownShortcutPlugin.js +11 -0
- package/LexicalMarkdownShortcutPlugin.js.flow +16 -0
- package/LexicalMarkdownShortcutPlugin.mjs +13 -0
- package/LexicalMarkdownShortcutPlugin.node.mjs +11 -0
- package/LexicalMarkdownShortcutPlugin.prod.js +9 -0
- package/LexicalMarkdownShortcutPlugin.prod.mjs +9 -0
- package/LexicalNestedComposer.d.ts +57 -0
- package/LexicalNestedComposer.dev.js +161 -0
- package/LexicalNestedComposer.dev.mjs +159 -0
- package/LexicalNestedComposer.js +11 -0
- package/LexicalNestedComposer.js.flow +26 -0
- package/LexicalNestedComposer.mjs +12 -0
- package/LexicalNestedComposer.node.mjs +10 -0
- package/LexicalNestedComposer.prod.js +9 -0
- package/LexicalNestedComposer.prod.mjs +9 -0
- package/LexicalNodeContextMenuPlugin.d.ts +46 -0
- package/LexicalNodeContextMenuPlugin.dev.js +257 -0
- package/LexicalNodeContextMenuPlugin.dev.mjs +253 -0
- package/LexicalNodeContextMenuPlugin.js +11 -0
- package/LexicalNodeContextMenuPlugin.js.flow +12 -0
- package/LexicalNodeContextMenuPlugin.mjs +14 -0
- package/LexicalNodeContextMenuPlugin.node.mjs +12 -0
- package/LexicalNodeContextMenuPlugin.prod.js +9 -0
- package/LexicalNodeContextMenuPlugin.prod.mjs +9 -0
- package/LexicalNodeEventPlugin.d.ts +13 -0
- package/LexicalNodeEventPlugin.dev.js +61 -0
- package/LexicalNodeEventPlugin.dev.mjs +59 -0
- package/LexicalNodeEventPlugin.js +11 -0
- package/LexicalNodeEventPlugin.js.flow +20 -0
- package/LexicalNodeEventPlugin.mjs +12 -0
- package/LexicalNodeEventPlugin.node.mjs +10 -0
- package/LexicalNodeEventPlugin.prod.js +9 -0
- package/LexicalNodeEventPlugin.prod.mjs +9 -0
- package/LexicalNodeMenuPlugin.d.ts +24 -0
- package/LexicalNodeMenuPlugin.dev.js +527 -0
- package/LexicalNodeMenuPlugin.dev.mjs +524 -0
- package/LexicalNodeMenuPlugin.js +11 -0
- package/LexicalNodeMenuPlugin.js.flow +64 -0
- package/LexicalNodeMenuPlugin.mjs +13 -0
- package/LexicalNodeMenuPlugin.node.mjs +11 -0
- package/LexicalNodeMenuPlugin.prod.js +9 -0
- package/LexicalNodeMenuPlugin.prod.mjs +9 -0
- package/LexicalOnChangePlugin.d.ts +13 -0
- package/LexicalOnChangePlugin.dev.js +72 -0
- package/LexicalOnChangePlugin.dev.mjs +70 -0
- package/LexicalOnChangePlugin.js +11 -0
- package/LexicalOnChangePlugin.js.flow +16 -0
- package/LexicalOnChangePlugin.mjs +12 -0
- package/LexicalOnChangePlugin.node.mjs +10 -0
- package/LexicalOnChangePlugin.prod.js +9 -0
- package/LexicalOnChangePlugin.prod.mjs +9 -0
- package/LexicalPlainTextPlugin.d.ts +14 -0
- package/LexicalPlainTextPlugin.dev.js +235 -0
- package/LexicalPlainTextPlugin.dev.mjs +233 -0
- package/LexicalPlainTextPlugin.js +11 -0
- package/LexicalPlainTextPlugin.js.flow +29 -0
- package/LexicalPlainTextPlugin.mjs +12 -0
- package/LexicalPlainTextPlugin.node.mjs +10 -0
- package/LexicalPlainTextPlugin.prod.js +9 -0
- package/LexicalPlainTextPlugin.prod.mjs +9 -0
- package/LexicalReactExtension.js.flow +68 -0
- package/LexicalReactPluginHostExtension.js.flow +84 -0
- package/LexicalReactProviderExtension.js.flow +12 -0
- package/LexicalRichTextPlugin.d.ts +14 -0
- package/LexicalRichTextPlugin.dev.js +235 -0
- package/LexicalRichTextPlugin.dev.mjs +233 -0
- package/LexicalRichTextPlugin.js +11 -0
- package/LexicalRichTextPlugin.js.flow +29 -0
- package/LexicalRichTextPlugin.mjs +12 -0
- package/LexicalRichTextPlugin.node.mjs +10 -0
- package/LexicalRichTextPlugin.prod.js +9 -0
- package/LexicalRichTextPlugin.prod.mjs +9 -0
- package/LexicalSelectionAlwaysOnDisplay.d.ts +12 -0
- package/LexicalSelectionAlwaysOnDisplay.dev.js +33 -0
- package/LexicalSelectionAlwaysOnDisplay.dev.mjs +31 -0
- package/LexicalSelectionAlwaysOnDisplay.js +11 -0
- package/LexicalSelectionAlwaysOnDisplay.js.flow +15 -0
- package/LexicalSelectionAlwaysOnDisplay.mjs +12 -0
- package/LexicalSelectionAlwaysOnDisplay.node.mjs +10 -0
- package/LexicalSelectionAlwaysOnDisplay.prod.js +9 -0
- package/LexicalSelectionAlwaysOnDisplay.prod.mjs +9 -0
- package/LexicalTabIndentationPlugin.d.ts +17 -0
- package/LexicalTabIndentationPlugin.dev.js +40 -0
- package/LexicalTabIndentationPlugin.dev.mjs +38 -0
- package/LexicalTabIndentationPlugin.js +11 -0
- package/LexicalTabIndentationPlugin.js.flow +21 -0
- package/LexicalTabIndentationPlugin.mjs +13 -0
- package/LexicalTabIndentationPlugin.node.mjs +11 -0
- package/LexicalTabIndentationPlugin.prod.js +9 -0
- package/LexicalTabIndentationPlugin.prod.mjs +9 -0
- package/LexicalTableOfContentsPlugin.d.ts +20 -0
- package/LexicalTableOfContentsPlugin.dev.js +209 -0
- package/LexicalTableOfContentsPlugin.dev.mjs +207 -0
- package/LexicalTableOfContentsPlugin.js +11 -0
- package/LexicalTableOfContentsPlugin.js.flow +18 -0
- package/LexicalTableOfContentsPlugin.mjs +12 -0
- package/LexicalTableOfContentsPlugin.node.mjs +10 -0
- package/LexicalTableOfContentsPlugin.prod.js +9 -0
- package/LexicalTableOfContentsPlugin.prod.mjs +9 -0
- package/LexicalTablePlugin.d.ts +46 -0
- package/LexicalTablePlugin.dev.js +81 -0
- package/LexicalTablePlugin.dev.mjs +79 -0
- package/LexicalTablePlugin.js +11 -0
- package/LexicalTablePlugin.js.flow +15 -0
- package/LexicalTablePlugin.mjs +12 -0
- package/LexicalTablePlugin.node.mjs +10 -0
- package/LexicalTablePlugin.prod.js +9 -0
- package/LexicalTablePlugin.prod.mjs +9 -0
- package/LexicalTreeView.d.ts +37 -0
- package/LexicalTreeView.dev.js +105 -0
- package/LexicalTreeView.dev.mjs +91 -0
- package/LexicalTreeView.js +11 -0
- package/LexicalTreeView.js.flow +21 -0
- package/LexicalTreeView.mjs +12 -0
- package/LexicalTreeView.node.mjs +10 -0
- package/LexicalTreeView.prod.js +9 -0
- package/LexicalTreeView.prod.mjs +9 -0
- package/LexicalTreeViewExtension.js.flow +12 -0
- package/LexicalTypeaheadMenuPlugin.d.ts +40 -0
- package/LexicalTypeaheadMenuPlugin.dev.js +654 -0
- package/LexicalTypeaheadMenuPlugin.dev.mjs +646 -0
- package/LexicalTypeaheadMenuPlugin.js +11 -0
- package/LexicalTypeaheadMenuPlugin.js.flow +83 -0
- package/LexicalTypeaheadMenuPlugin.mjs +18 -0
- package/LexicalTypeaheadMenuPlugin.node.mjs +16 -0
- package/LexicalTypeaheadMenuPlugin.prod.js +9 -0
- package/LexicalTypeaheadMenuPlugin.prod.mjs +9 -0
- package/README.md +90 -0
- package/ReactExtension.d.ts +41 -0
- package/ReactPluginHostExtension.d.ts +56 -0
- package/ReactProviderExtension.d.ts +9 -0
- package/TreeViewExtension.d.ts +18 -0
- package/package.json +1549 -0
- package/shared/LegacyDecorators.d.ts +23 -0
- package/shared/LexicalContentEditableElement.d.ts +43 -0
- package/shared/LexicalMenu.d.ts +52 -0
- package/shared/buildEditorComponent.d.ts +11 -0
- package/shared/mergeRefs.d.ts +9 -0
- package/shared/point.d.ts +21 -0
- package/shared/rect.d.ts +45 -0
- package/shared/types.d.ts +89 -0
- package/shared/useCanShowPlaceholder.d.ts +9 -0
- package/shared/useCharacterLimit.d.ts +16 -0
- package/shared/useDecorators.d.ts +17 -0
- package/shared/useHistory.d.ts +10 -0
- package/shared/useList.d.ts +9 -0
- package/shared/usePlainTextSetup.d.ts +9 -0
- package/shared/useReactDecorators.d.ts +12 -0
- package/shared/useRichTextSetup.d.ts +9 -0
- package/shared/useYjsCollaboration.d.ts +25 -0
- package/useExtensionComponent.d.ts +10 -0
- package/useLexicalEditable.d.ts +16 -0
- package/useLexicalEditable.dev.js +102 -0
- package/useLexicalEditable.dev.mjs +100 -0
- package/useLexicalEditable.js +11 -0
- package/useLexicalEditable.js.flow +12 -0
- package/useLexicalEditable.mjs +12 -0
- package/useLexicalEditable.node.mjs +10 -0
- package/useLexicalEditable.prod.js +9 -0
- package/useLexicalEditable.prod.mjs +9 -0
- package/useLexicalExtensionComponent.dev.js +37 -0
- package/useLexicalExtensionComponent.dev.mjs +34 -0
- package/useLexicalExtensionComponent.js +11 -0
- package/useLexicalExtensionComponent.js.flow +12 -0
- package/useLexicalExtensionComponent.mjs +13 -0
- package/useLexicalExtensionComponent.node.mjs +11 -0
- package/useLexicalExtensionComponent.prod.js +9 -0
- package/useLexicalExtensionComponent.prod.mjs +9 -0
- package/useLexicalIsTextContentEmpty.d.ts +9 -0
- package/useLexicalIsTextContentEmpty.dev.js +60 -0
- package/useLexicalIsTextContentEmpty.dev.mjs +58 -0
- package/useLexicalIsTextContentEmpty.js +11 -0
- package/useLexicalIsTextContentEmpty.js.flow +15 -0
- package/useLexicalIsTextContentEmpty.mjs +12 -0
- package/useLexicalIsTextContentEmpty.node.mjs +10 -0
- package/useLexicalIsTextContentEmpty.prod.js +9 -0
- package/useLexicalIsTextContentEmpty.prod.mjs +9 -0
- package/useLexicalNodeSelection.d.ts +24 -0
- package/useLexicalNodeSelection.dev.js +102 -0
- package/useLexicalNodeSelection.dev.mjs +100 -0
- package/useLexicalNodeSelection.js +11 -0
- package/useLexicalNodeSelection.js.flow +14 -0
- package/useLexicalNodeSelection.mjs +12 -0
- package/useLexicalNodeSelection.node.mjs +10 -0
- package/useLexicalNodeSelection.prod.js +9 -0
- package/useLexicalNodeSelection.prod.mjs +9 -0
- package/useLexicalSubscription.d.ts +17 -0
- package/useLexicalSubscription.dev.js +73 -0
- package/useLexicalSubscription.dev.mjs +71 -0
- package/useLexicalSubscription.js +11 -0
- package/useLexicalSubscription.js.flow +19 -0
- package/useLexicalSubscription.mjs +12 -0
- package/useLexicalSubscription.node.mjs +10 -0
- package/useLexicalSubscription.prod.js +9 -0
- package/useLexicalSubscription.prod.mjs +9 -0
- package/useLexicalTextEntity.d.ts +10 -0
- package/useLexicalTextEntity.dev.js +31 -0
- package/useLexicalTextEntity.dev.mjs +29 -0
- package/useLexicalTextEntity.js +11 -0
- package/useLexicalTextEntity.js.flow +18 -0
- package/useLexicalTextEntity.mjs +12 -0
- package/useLexicalTextEntity.node.mjs +10 -0
- package/useLexicalTextEntity.prod.js +9 -0
- package/useLexicalTextEntity.prod.mjs +9 -0
|
@@ -0,0 +1,54 @@
|
|
|
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 { useLexicalComposerContext } from '@ekz/lexical-react/LexicalComposerContext';
|
|
10
|
+
import { TreeView } from '@ekz/lexical-react/LexicalTreeView';
|
|
11
|
+
import { ReactExtension } from '@ekz/lexical-react/ReactExtension';
|
|
12
|
+
import { useExtensionDependency } from '@ekz/lexical-react/useExtensionComponent';
|
|
13
|
+
import { defineExtension } from '@ekz/lexical';
|
|
14
|
+
import { jsx } from 'react/jsx-runtime';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the MIT license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function TreeViewExtensionComponent(props) {
|
|
25
|
+
const [editor] = useLexicalComposerContext();
|
|
26
|
+
return /*#__PURE__*/jsx(TreeView, {
|
|
27
|
+
editor: editor,
|
|
28
|
+
...useExtensionDependency(TreeViewExtension).config,
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const config = {
|
|
33
|
+
timeTravelButtonClassName: 'debug-timetravel-button',
|
|
34
|
+
timeTravelPanelButtonClassName: 'debug-timetravel-panel-button',
|
|
35
|
+
timeTravelPanelClassName: 'debug-timetravel-panel',
|
|
36
|
+
timeTravelPanelSliderClassName: 'debug-timetravel-panel-slider',
|
|
37
|
+
treeTypeButtonClassName: 'debug-treetype-button',
|
|
38
|
+
viewClassName: 'tree-view-output'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Provides a configured TreeView debugging tool (React dependent)
|
|
43
|
+
* as an output component with configurable class names.
|
|
44
|
+
*/
|
|
45
|
+
const TreeViewExtension = defineExtension({
|
|
46
|
+
build: () => ({
|
|
47
|
+
Component: TreeViewExtensionComponent
|
|
48
|
+
}),
|
|
49
|
+
config,
|
|
50
|
+
dependencies: [ReactExtension],
|
|
51
|
+
name: '@ekz/lexical-react/TreeView'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export { TreeViewExtension, TreeViewExtensionComponent };
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
'use strict'
|
|
10
|
+
const @ekz/lexicalTreeViewExtension = process.env.NODE_ENV !== 'production' ? require('./@ekz/lexicalTreeViewExtension.dev.js') : require('./@ekz/lexicalTreeViewExtension.prod.js');
|
|
11
|
+
module.exports = @ekz/lexicalTreeViewExtension;
|
|
@@ -0,0 +1,13 @@
|
|
|
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 * as modDev from './@ekz/lexicalTreeViewExtension.dev.mjs';
|
|
10
|
+
import * as modProd from './@ekz/lexicalTreeViewExtension.prod.mjs';
|
|
11
|
+
const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
|
|
12
|
+
export const TreeViewExtension = mod.TreeViewExtension;
|
|
13
|
+
export const TreeViewExtensionComponent = mod.TreeViewExtensionComponent;
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
const mod = await (process.env.NODE_ENV !== 'production' ? import('./@ekz/lexicalTreeViewExtension.dev.mjs') : import('./@ekz/lexicalTreeViewExtension.prod.mjs'));
|
|
10
|
+
export const TreeViewExtension = mod.TreeViewExtension;
|
|
11
|
+
export const TreeViewExtensionComponent = mod.TreeViewExtensionComponent;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
"use strict";var e=require("@ekz/lexical-react/LexicalComposerContext"),t=require("@ekz/lexical-react/LexicalTreeView"),i=require("@ekz/lexical-react/ReactExtension"),n=require("@ekz/lexical-react/useExtensionComponent"),r=require("@ekz/lexical"),a=require("react/jsx-runtime");function l(i){const[r]=e.useLexicalComposerContext();return a.jsx(t.TreeView,{editor:r,...n.useExtensionDependency(o).config,...i})}const o=r.defineExtension({build:()=>({Component:l}),config:{timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"},dependencies:[i.ReactExtension],name:"@ekz/lexical-react/TreeView"});exports.TreeViewExtension=o,exports.TreeViewExtensionComponent=l;
|
|
@@ -0,0 +1,9 @@
|
|
|
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{useLexicalComposerContext as e}from"@ekz/lexical-react/LexicalComposerContext";import{TreeView as t}from"@ekz/lexical-react/LexicalTreeView";import{ReactExtension as a}from"@ekz/lexical-react/ReactExtension";import{useExtensionDependency as r}from"@ekz/lexical-react/useExtensionComponent";import{defineExtension as i}from"@ekz/lexical";import{jsx as l}from"react/jsx-runtime";function o(a){const[i]=e();return l(t,{editor:i,...r(n).config,...a})}const n=i({build:()=>({Component:o}),config:{timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"},dependencies:[a],name:"@ekz/lexical-react/TreeView"});export{n as TreeViewExtension,o as TreeViewExtensionComponent};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
import type { ComponentProps } from 'react';
|
|
9
|
+
import { type AnyLexicalExtension, type LexicalExtensionOutput } from '@ekz/lexical';
|
|
10
|
+
/**
|
|
11
|
+
* The lexical:extension prop combined with the props of the given Extension's
|
|
12
|
+
* output Component.
|
|
13
|
+
*/
|
|
14
|
+
export type ExtensionComponentProps<Extension extends AnyLexicalExtension> = {
|
|
15
|
+
/** The Extension */ 'lexical:extension': Extension;
|
|
16
|
+
} & ([LexicalExtensionOutput<Extension>] extends [
|
|
17
|
+
{
|
|
18
|
+
Component: infer OutputComponentType extends React.ComponentType;
|
|
19
|
+
}
|
|
20
|
+
] ? Omit<ComponentProps<OutputComponentType>, 'lexical:extension'> : never);
|
|
21
|
+
/**
|
|
22
|
+
* A convenient way to get an Extension's output Component with {@link useExtensionComponent}
|
|
23
|
+
* and construct it in one step.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* Usage
|
|
27
|
+
* ```tsx
|
|
28
|
+
* return (
|
|
29
|
+
* <ExtensionComponent
|
|
30
|
+
* lexical:extension={TreeViewExtension}
|
|
31
|
+
* viewClassName="tree-view-output" />
|
|
32
|
+
* );
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Alternative without ExtensionComponent
|
|
37
|
+
* ```tsx
|
|
38
|
+
* const TreeViewComponent = useExtensionComponent(TreeViewExtension);
|
|
39
|
+
* return (<TreeViewComponent viewClassName="tree-view-output" />);
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function ExtensionComponent<Extension extends AnyLexicalExtension>({ 'lexical:extension': extension, ...props }: ExtensionComponentProps<Extension>): import("react/jsx-runtime").JSX.Element;
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
import type { CommandListenerPriority, LexicalNode } from '@ekz/lexical';
|
|
9
|
+
import type { JSX } from 'react';
|
|
10
|
+
import { MenuOption, MenuRenderFn } from '@ekz/lexical-react/LexicalNodeMenuPlugin';
|
|
11
|
+
import { LexicalCommand, LexicalEditor } from '@ekz/lexical';
|
|
12
|
+
export type EmbedMatchResult<TEmbedMatchResult = unknown> = {
|
|
13
|
+
url: string;
|
|
14
|
+
id: string;
|
|
15
|
+
data?: TEmbedMatchResult;
|
|
16
|
+
};
|
|
17
|
+
export interface EmbedConfig<TEmbedMatchResultData = unknown, TEmbedMatchResult = EmbedMatchResult<TEmbedMatchResultData>> {
|
|
18
|
+
type: string;
|
|
19
|
+
parseUrl: (text: string) => Promise<TEmbedMatchResult | null> | TEmbedMatchResult | null;
|
|
20
|
+
insertNode: (editor: LexicalEditor, result: TEmbedMatchResult) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const URL_MATCHER: RegExp;
|
|
23
|
+
export declare const INSERT_EMBED_COMMAND: LexicalCommand<EmbedConfig['type']>;
|
|
24
|
+
export declare class AutoEmbedOption extends MenuOption {
|
|
25
|
+
title: string;
|
|
26
|
+
onSelect: (targetNode: LexicalNode | null) => void;
|
|
27
|
+
constructor(title: string, options: {
|
|
28
|
+
onSelect: (targetNode: LexicalNode | null) => void;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
type LexicalAutoEmbedPluginProps<TEmbedConfig extends EmbedConfig> = {
|
|
32
|
+
embedConfigs: Array<TEmbedConfig>;
|
|
33
|
+
onOpenEmbedModalForConfig: (embedConfig: TEmbedConfig) => void;
|
|
34
|
+
getMenuOptions: (activeEmbedConfig: TEmbedConfig, embedFn: () => void, dismissFn: () => void) => Array<AutoEmbedOption>;
|
|
35
|
+
menuRenderFn: MenuRenderFn<AutoEmbedOption>;
|
|
36
|
+
menuCommandPriority?: CommandListenerPriority;
|
|
37
|
+
};
|
|
38
|
+
export declare function LexicalAutoEmbedPlugin<TEmbedConfig extends EmbedConfig>({ embedConfigs, onOpenEmbedModalForConfig, getMenuOptions, menuRenderFn, menuCommandPriority, }: LexicalAutoEmbedPluginProps<TEmbedConfig>): JSX.Element | null;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,146 @@
|
|
|
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
|
+
'use strict';
|
|
10
|
+
|
|
11
|
+
var lexicalLink = require('@ekz/lexical-link');
|
|
12
|
+
var LexicalComposerContext = require('@ekz/lexical-react/LexicalComposerContext');
|
|
13
|
+
var LexicalNodeMenuPlugin = require('@ekz/lexical-react/LexicalNodeMenuPlugin');
|
|
14
|
+
var lexicalUtils = require('@ekz/lexical-utils');
|
|
15
|
+
var lexical = require('@ekz/lexical');
|
|
16
|
+
var react = require('react');
|
|
17
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
28
|
+
const INSERT_EMBED_COMMAND = lexical.createCommand('INSERT_EMBED_COMMAND');
|
|
29
|
+
class AutoEmbedOption extends LexicalNodeMenuPlugin.MenuOption {
|
|
30
|
+
title;
|
|
31
|
+
onSelect;
|
|
32
|
+
constructor(title, options) {
|
|
33
|
+
super(title);
|
|
34
|
+
this.title = title;
|
|
35
|
+
this.onSelect = options.onSelect.bind(this);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function LexicalAutoEmbedPlugin({
|
|
39
|
+
embedConfigs,
|
|
40
|
+
onOpenEmbedModalForConfig,
|
|
41
|
+
getMenuOptions,
|
|
42
|
+
menuRenderFn,
|
|
43
|
+
menuCommandPriority = lexical.COMMAND_PRIORITY_LOW
|
|
44
|
+
}) {
|
|
45
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
46
|
+
const [nodeKey, setNodeKey] = react.useState(null);
|
|
47
|
+
const [activeEmbedConfig, setActiveEmbedConfig] = react.useState(null);
|
|
48
|
+
const reset = react.useCallback(() => {
|
|
49
|
+
setNodeKey(null);
|
|
50
|
+
setActiveEmbedConfig(null);
|
|
51
|
+
}, []);
|
|
52
|
+
const checkIfLinkNodeIsEmbeddable = react.useCallback(async key => {
|
|
53
|
+
const url = editor.getEditorState().read(function () {
|
|
54
|
+
const linkNode = lexical.$getNodeByKey(key);
|
|
55
|
+
if (lexicalLink.$isLinkNode(linkNode)) {
|
|
56
|
+
return linkNode.getURL();
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (url === undefined) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
for (const embedConfig of embedConfigs) {
|
|
63
|
+
const urlMatch = await Promise.resolve(embedConfig.parseUrl(url));
|
|
64
|
+
if (urlMatch != null) {
|
|
65
|
+
setActiveEmbedConfig(embedConfig);
|
|
66
|
+
setNodeKey(key);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, [editor, embedConfigs]);
|
|
70
|
+
react.useEffect(() => {
|
|
71
|
+
const listener = (nodeMutations, {
|
|
72
|
+
updateTags,
|
|
73
|
+
dirtyLeaves
|
|
74
|
+
}) => {
|
|
75
|
+
for (const [key, mutation] of nodeMutations) {
|
|
76
|
+
if (mutation === 'created' && updateTags.has(lexical.PASTE_TAG) && dirtyLeaves.size <= 3) {
|
|
77
|
+
checkIfLinkNodeIsEmbeddable(key);
|
|
78
|
+
} else if (key === nodeKey) {
|
|
79
|
+
reset();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
return lexicalUtils.mergeRegister(...[lexicalLink.LinkNode, lexicalLink.AutoLinkNode].map(Klass => editor.registerMutationListener(Klass, (...args) => listener(...args), {
|
|
84
|
+
skipInitialization: true
|
|
85
|
+
})));
|
|
86
|
+
}, [checkIfLinkNodeIsEmbeddable, editor, embedConfigs, nodeKey, reset]);
|
|
87
|
+
react.useEffect(() => {
|
|
88
|
+
return editor.registerCommand(INSERT_EMBED_COMMAND, embedConfigType => {
|
|
89
|
+
const embedConfig = embedConfigs.find(({
|
|
90
|
+
type
|
|
91
|
+
}) => type === embedConfigType);
|
|
92
|
+
if (embedConfig) {
|
|
93
|
+
onOpenEmbedModalForConfig(embedConfig);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
return false;
|
|
97
|
+
}, lexical.COMMAND_PRIORITY_EDITOR);
|
|
98
|
+
}, [editor, embedConfigs, onOpenEmbedModalForConfig]);
|
|
99
|
+
const embedLinkViaActiveEmbedConfig = react.useCallback(async function () {
|
|
100
|
+
if (activeEmbedConfig != null && nodeKey != null) {
|
|
101
|
+
const linkNode = editor.getEditorState().read(() => {
|
|
102
|
+
const node = lexical.$getNodeByKey(nodeKey);
|
|
103
|
+
if (lexicalLink.$isLinkNode(node)) {
|
|
104
|
+
return node;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
});
|
|
108
|
+
if (lexicalLink.$isLinkNode(linkNode)) {
|
|
109
|
+
const result = await Promise.resolve(activeEmbedConfig.parseUrl(linkNode.__url));
|
|
110
|
+
if (result != null) {
|
|
111
|
+
editor.update(() => {
|
|
112
|
+
if (!lexical.$getSelection()) {
|
|
113
|
+
linkNode.selectEnd();
|
|
114
|
+
}
|
|
115
|
+
activeEmbedConfig.insertNode(editor, result);
|
|
116
|
+
if (linkNode.isAttached()) {
|
|
117
|
+
linkNode.remove();
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}, [activeEmbedConfig, editor, nodeKey]);
|
|
124
|
+
const options = react.useMemo(() => {
|
|
125
|
+
return activeEmbedConfig != null && nodeKey != null ? getMenuOptions(activeEmbedConfig, embedLinkViaActiveEmbedConfig, reset) : [];
|
|
126
|
+
}, [activeEmbedConfig, embedLinkViaActiveEmbedConfig, getMenuOptions, nodeKey, reset]);
|
|
127
|
+
const onSelectOption = react.useCallback((selectedOption, targetNode, closeMenu) => {
|
|
128
|
+
editor.update(() => {
|
|
129
|
+
selectedOption.onSelect(targetNode);
|
|
130
|
+
closeMenu();
|
|
131
|
+
});
|
|
132
|
+
}, [editor]);
|
|
133
|
+
return nodeKey != null ? /*#__PURE__*/jsxRuntime.jsx(LexicalNodeMenuPlugin.LexicalNodeMenuPlugin, {
|
|
134
|
+
nodeKey: nodeKey,
|
|
135
|
+
onClose: reset,
|
|
136
|
+
onSelectOption: onSelectOption,
|
|
137
|
+
options: options,
|
|
138
|
+
menuRenderFn: menuRenderFn,
|
|
139
|
+
commandPriority: menuCommandPriority
|
|
140
|
+
}) : null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
exports.AutoEmbedOption = AutoEmbedOption;
|
|
144
|
+
exports.INSERT_EMBED_COMMAND = INSERT_EMBED_COMMAND;
|
|
145
|
+
exports.LexicalAutoEmbedPlugin = LexicalAutoEmbedPlugin;
|
|
146
|
+
exports.URL_MATCHER = URL_MATCHER;
|
|
@@ -0,0 +1,141 @@
|
|
|
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 { $isLinkNode, LinkNode, AutoLinkNode } from '@ekz/lexical-link';
|
|
10
|
+
import { useLexicalComposerContext } from '@ekz/lexical-react/LexicalComposerContext';
|
|
11
|
+
import { MenuOption, LexicalNodeMenuPlugin } from '@ekz/lexical-react/LexicalNodeMenuPlugin';
|
|
12
|
+
import { mergeRegister } from '@ekz/lexical-utils';
|
|
13
|
+
import { createCommand, $getNodeByKey, COMMAND_PRIORITY_EDITOR, $getSelection, COMMAND_PRIORITY_LOW, PASTE_TAG } from '@ekz/lexical';
|
|
14
|
+
import { useState, useCallback, useEffect, useMemo } from 'react';
|
|
15
|
+
import { jsx } from 'react/jsx-runtime';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
19
|
+
*
|
|
20
|
+
* This source code is licensed under the MIT license found in the
|
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
26
|
+
const INSERT_EMBED_COMMAND = createCommand('INSERT_EMBED_COMMAND');
|
|
27
|
+
class AutoEmbedOption extends MenuOption {
|
|
28
|
+
title;
|
|
29
|
+
onSelect;
|
|
30
|
+
constructor(title, options) {
|
|
31
|
+
super(title);
|
|
32
|
+
this.title = title;
|
|
33
|
+
this.onSelect = options.onSelect.bind(this);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function LexicalAutoEmbedPlugin({
|
|
37
|
+
embedConfigs,
|
|
38
|
+
onOpenEmbedModalForConfig,
|
|
39
|
+
getMenuOptions,
|
|
40
|
+
menuRenderFn,
|
|
41
|
+
menuCommandPriority = COMMAND_PRIORITY_LOW
|
|
42
|
+
}) {
|
|
43
|
+
const [editor] = useLexicalComposerContext();
|
|
44
|
+
const [nodeKey, setNodeKey] = useState(null);
|
|
45
|
+
const [activeEmbedConfig, setActiveEmbedConfig] = useState(null);
|
|
46
|
+
const reset = useCallback(() => {
|
|
47
|
+
setNodeKey(null);
|
|
48
|
+
setActiveEmbedConfig(null);
|
|
49
|
+
}, []);
|
|
50
|
+
const checkIfLinkNodeIsEmbeddable = useCallback(async key => {
|
|
51
|
+
const url = editor.getEditorState().read(function () {
|
|
52
|
+
const linkNode = $getNodeByKey(key);
|
|
53
|
+
if ($isLinkNode(linkNode)) {
|
|
54
|
+
return linkNode.getURL();
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (url === undefined) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
for (const embedConfig of embedConfigs) {
|
|
61
|
+
const urlMatch = await Promise.resolve(embedConfig.parseUrl(url));
|
|
62
|
+
if (urlMatch != null) {
|
|
63
|
+
setActiveEmbedConfig(embedConfig);
|
|
64
|
+
setNodeKey(key);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}, [editor, embedConfigs]);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const listener = (nodeMutations, {
|
|
70
|
+
updateTags,
|
|
71
|
+
dirtyLeaves
|
|
72
|
+
}) => {
|
|
73
|
+
for (const [key, mutation] of nodeMutations) {
|
|
74
|
+
if (mutation === 'created' && updateTags.has(PASTE_TAG) && dirtyLeaves.size <= 3) {
|
|
75
|
+
checkIfLinkNodeIsEmbeddable(key);
|
|
76
|
+
} else if (key === nodeKey) {
|
|
77
|
+
reset();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return mergeRegister(...[LinkNode, AutoLinkNode].map(Klass => editor.registerMutationListener(Klass, (...args) => listener(...args), {
|
|
82
|
+
skipInitialization: true
|
|
83
|
+
})));
|
|
84
|
+
}, [checkIfLinkNodeIsEmbeddable, editor, embedConfigs, nodeKey, reset]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
return editor.registerCommand(INSERT_EMBED_COMMAND, embedConfigType => {
|
|
87
|
+
const embedConfig = embedConfigs.find(({
|
|
88
|
+
type
|
|
89
|
+
}) => type === embedConfigType);
|
|
90
|
+
if (embedConfig) {
|
|
91
|
+
onOpenEmbedModalForConfig(embedConfig);
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
return false;
|
|
95
|
+
}, COMMAND_PRIORITY_EDITOR);
|
|
96
|
+
}, [editor, embedConfigs, onOpenEmbedModalForConfig]);
|
|
97
|
+
const embedLinkViaActiveEmbedConfig = useCallback(async function () {
|
|
98
|
+
if (activeEmbedConfig != null && nodeKey != null) {
|
|
99
|
+
const linkNode = editor.getEditorState().read(() => {
|
|
100
|
+
const node = $getNodeByKey(nodeKey);
|
|
101
|
+
if ($isLinkNode(node)) {
|
|
102
|
+
return node;
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
});
|
|
106
|
+
if ($isLinkNode(linkNode)) {
|
|
107
|
+
const result = await Promise.resolve(activeEmbedConfig.parseUrl(linkNode.__url));
|
|
108
|
+
if (result != null) {
|
|
109
|
+
editor.update(() => {
|
|
110
|
+
if (!$getSelection()) {
|
|
111
|
+
linkNode.selectEnd();
|
|
112
|
+
}
|
|
113
|
+
activeEmbedConfig.insertNode(editor, result);
|
|
114
|
+
if (linkNode.isAttached()) {
|
|
115
|
+
linkNode.remove();
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, [activeEmbedConfig, editor, nodeKey]);
|
|
122
|
+
const options = useMemo(() => {
|
|
123
|
+
return activeEmbedConfig != null && nodeKey != null ? getMenuOptions(activeEmbedConfig, embedLinkViaActiveEmbedConfig, reset) : [];
|
|
124
|
+
}, [activeEmbedConfig, embedLinkViaActiveEmbedConfig, getMenuOptions, nodeKey, reset]);
|
|
125
|
+
const onSelectOption = useCallback((selectedOption, targetNode, closeMenu) => {
|
|
126
|
+
editor.update(() => {
|
|
127
|
+
selectedOption.onSelect(targetNode);
|
|
128
|
+
closeMenu();
|
|
129
|
+
});
|
|
130
|
+
}, [editor]);
|
|
131
|
+
return nodeKey != null ? /*#__PURE__*/jsx(LexicalNodeMenuPlugin, {
|
|
132
|
+
nodeKey: nodeKey,
|
|
133
|
+
onClose: reset,
|
|
134
|
+
onSelectOption: onSelectOption,
|
|
135
|
+
options: options,
|
|
136
|
+
menuRenderFn: menuRenderFn,
|
|
137
|
+
commandPriority: menuCommandPriority
|
|
138
|
+
}) : null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export { AutoEmbedOption, INSERT_EMBED_COMMAND, LexicalAutoEmbedPlugin, URL_MATCHER };
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
'use strict'
|
|
10
|
+
const LexicalAutoEmbedPlugin = process.env.NODE_ENV !== 'production' ? require('./LexicalAutoEmbedPlugin.dev.js') : require('./LexicalAutoEmbedPlugin.prod.js');
|
|
11
|
+
module.exports = LexicalAutoEmbedPlugin;
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
* @flow strict
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type {LexicalNode, MutationListener} from '@ekz/lexical';
|
|
11
|
+
|
|
12
|
+
import {MenuOption} from '@ekz/lexical-react/LexicalTypeaheadMenuPlugin';
|
|
13
|
+
import type {LexicalCommand, LexicalEditor, NodeKey, TextNode} from '@ekz/lexical';
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import {createCommand} from '@ekz/lexical';
|
|
16
|
+
import type {MenuRenderFn} from './LexicalTypeaheadMenuPlugin';
|
|
17
|
+
|
|
18
|
+
export type EmbedMatchResult = {
|
|
19
|
+
url: string,
|
|
20
|
+
id: string,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export interface EmbedConfig {
|
|
24
|
+
// Used to identify this config e.g. youtube, tweet, google-maps.
|
|
25
|
+
type: string;
|
|
26
|
+
// Determine if a given URL is a match and return url data.
|
|
27
|
+
parseUrl: (text: string) => EmbedMatchResult | null;
|
|
28
|
+
// Create the Lexical embed node from the url data.
|
|
29
|
+
insertNode: (editor: LexicalEditor, result: EmbedMatchResult) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const URL_MATCHER: RegExp =
|
|
33
|
+
/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
34
|
+
|
|
35
|
+
export const INSERT_EMBED_COMMAND: LexicalCommand<EmbedConfig['type']> =
|
|
36
|
+
createCommand('INSERT_EMBED_COMMAND');
|
|
37
|
+
|
|
38
|
+
type LexicalAutoEmbedPluginProps<TEmbedConfig> = {
|
|
39
|
+
embedConfigs: Array<TEmbedConfig>,
|
|
40
|
+
onOpenEmbedModalForConfig: (embedConfig: TEmbedConfig) => void,
|
|
41
|
+
getMenuOptions: (
|
|
42
|
+
activeEmbedConfig: TEmbedConfig,
|
|
43
|
+
embedFn: () => void,
|
|
44
|
+
dismissFn: () => void,
|
|
45
|
+
) => Array<AutoEmbedOption>,
|
|
46
|
+
menuRenderFn: MenuRenderFn<AutoEmbedOption>,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
declare export class AutoEmbedOption extends MenuOption {
|
|
50
|
+
title: string;
|
|
51
|
+
icon: React.MixedElement;
|
|
52
|
+
onSelect: (targetNode: LexicalNode | null) => void;
|
|
53
|
+
constructor(
|
|
54
|
+
title: string,
|
|
55
|
+
options: {
|
|
56
|
+
icon: React.MixedElement,
|
|
57
|
+
onSelect: (targetNode: LexicalNode | null) => void,
|
|
58
|
+
},
|
|
59
|
+
): void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare export function LexicalAutoEmbedPlugin<TEmbedConfig>(
|
|
63
|
+
LexicalAutoEmbedPluginProps<TEmbedConfig>,
|
|
64
|
+
): React.MixedElement | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
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 * as modDev from './LexicalAutoEmbedPlugin.dev.mjs';
|
|
10
|
+
import * as modProd from './LexicalAutoEmbedPlugin.prod.mjs';
|
|
11
|
+
const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
|
|
12
|
+
export const AutoEmbedOption = mod.AutoEmbedOption;
|
|
13
|
+
export const INSERT_EMBED_COMMAND = mod.INSERT_EMBED_COMMAND;
|
|
14
|
+
export const LexicalAutoEmbedPlugin = mod.LexicalAutoEmbedPlugin;
|
|
15
|
+
export const URL_MATCHER = mod.URL_MATCHER;
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalAutoEmbedPlugin.dev.mjs') : import('./LexicalAutoEmbedPlugin.prod.mjs'));
|
|
10
|
+
export const AutoEmbedOption = mod.AutoEmbedOption;
|
|
11
|
+
export const INSERT_EMBED_COMMAND = mod.INSERT_EMBED_COMMAND;
|
|
12
|
+
export const LexicalAutoEmbedPlugin = mod.LexicalAutoEmbedPlugin;
|
|
13
|
+
export const URL_MATCHER = mod.URL_MATCHER;
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
"use strict";var e=require("@ekz/lexical-link"),t=require("@ekz/lexical-react/LexicalComposerContext"),n=require("@ekz/lexical-react/LexicalNodeMenuPlugin"),o=require("@ekz/lexical-utils"),i=require("@ekz/lexical"),l=require("react"),r=require("react/jsx-runtime");const s=i.createCommand("INSERT_EMBED_COMMAND");class u extends n.MenuOption{title;onSelect;constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}exports.AutoEmbedOption=u,exports.INSERT_EMBED_COMMAND=s,exports.LexicalAutoEmbedPlugin=function({embedConfigs:u,onOpenEmbedModalForConfig:a,getMenuOptions:c,menuRenderFn:d,menuCommandPriority:m=i.COMMAND_PRIORITY_LOW}){const[p]=t.useLexicalComposerContext(),[x,C]=l.useState(null),[f,M]=l.useState(null),g=l.useCallback(()=>{C(null),M(null)},[]),E=l.useCallback(async t=>{const n=p.getEditorState().read(function(){const n=i.$getNodeByKey(t);if(e.$isLinkNode(n))return n.getURL()});if(void 0!==n)for(const e of u){null!=await Promise.resolve(e.parseUrl(n))&&(M(e),C(t))}},[p,u]);l.useEffect(()=>o.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map(e=>p.registerMutationListener(e,(...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,l]of e)"created"===l&&t.has(i.PASTE_TAG)&&n.size<=3?E(o):o===x&&g()})(...e),{skipInitialization:!0}))),[E,p,u,x,g]),l.useEffect(()=>p.registerCommand(s,e=>{const t=u.find(({type:t})=>t===e);return!!t&&(a(t),!0)},i.COMMAND_PRIORITY_EDITOR),[p,u,a]);const k=l.useCallback(async function(){if(null!=f&&null!=x){const t=p.getEditorState().read(()=>{const t=i.$getNodeByKey(x);return e.$isLinkNode(t)?t:null});if(e.$isLinkNode(t)){const e=await Promise.resolve(f.parseUrl(t.__url));null!=e&&p.update(()=>{i.$getSelection()||t.selectEnd(),f.insertNode(p,e),t.isAttached()&&t.remove()})}}},[f,p,x]),N=l.useMemo(()=>null!=f&&null!=x?c(f,k,g):[],[f,k,c,x,g]),L=l.useCallback((e,t,n)=>{p.update(()=>{e.onSelect(t),n()})},[p]);return null!=x?r.jsx(n.LexicalNodeMenuPlugin,{nodeKey:x,onClose:g,onSelectOption:L,options:N,menuRenderFn:d,commandPriority:m}):null},exports.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
|
|
@@ -0,0 +1,9 @@
|
|
|
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{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@ekz/lexical-link";import{useLexicalComposerContext as o}from"@ekz/lexical-react/LexicalComposerContext";import{MenuOption as r,LexicalNodeMenuPlugin as i}from"@ekz/lexical-react/LexicalNodeMenuPlugin";import{mergeRegister as l}from"@ekz/lexical-utils";import{createCommand as s,$getNodeByKey as a,COMMAND_PRIORITY_EDITOR as c,$getSelection as u,COMMAND_PRIORITY_LOW as m,PASTE_TAG as d}from"@ekz/lexical";import{useState as p,useCallback as f,useEffect as x,useMemo as g}from"react";import{jsx as z}from"react/jsx-runtime";const w=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,C=s("INSERT_EMBED_COMMAND");class S extends r{title;onSelect;constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}function k({embedConfigs:r,onOpenEmbedModalForConfig:s,getMenuOptions:w,menuRenderFn:S,menuCommandPriority:k=m}){const[y]=o(),[E,M]=p(null),[h,_]=p(null),v=f(()=>{M(null),_(null)},[]),A=f(async t=>{const n=y.getEditorState().read(function(){const n=a(t);if(e(n))return n.getURL()});if(void 0!==n)for(const e of r){null!=await Promise.resolve(e.parseUrl(n))&&(_(e),M(t))}},[y,r]);x(()=>l(...[t,n].map(e=>y.registerMutationListener(e,(...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has(d)&&n.size<=3?A(o):o===E&&v()})(...e),{skipInitialization:!0}))),[A,y,r,E,v]),x(()=>y.registerCommand(C,e=>{const t=r.find(({type:t})=>t===e);return!!t&&(s(t),!0)},c),[y,r,s]);const L=f(async function(){if(null!=h&&null!=E){const t=y.getEditorState().read(()=>{const t=a(E);return e(t)?t:null});if(e(t)){const e=await Promise.resolve(h.parseUrl(t.__url));null!=e&&y.update(()=>{u()||t.selectEnd(),h.insertNode(y,e),t.isAttached()&&t.remove()})}}},[h,y,E]),P=g(()=>null!=h&&null!=E?w(h,L,v):[],[h,L,w,E,v]),b=f((e,t,n)=>{y.update(()=>{e.onSelect(t),n()})},[y]);return null!=E?z(i,{nodeKey:E,onClose:v,onSelectOption:b,options:P,menuRenderFn:S,commandPriority:k}):null}export{S as AutoEmbedOption,C as INSERT_EMBED_COMMAND,k as LexicalAutoEmbedPlugin,w as URL_MATCHER};
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
type Props = {
|
|
9
|
+
defaultSelection?: 'rootStart' | 'rootEnd';
|
|
10
|
+
};
|
|
11
|
+
export declare function AutoFocusPlugin({ defaultSelection }: Props): null;
|
|
12
|
+
export {};
|