@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,22 @@
|
|
|
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 {Doc} from 'yjs';
|
|
11
|
+
|
|
12
|
+
type CollaborationContextType = {
|
|
13
|
+
clientID: number,
|
|
14
|
+
color: string,
|
|
15
|
+
isCollabActive: boolean,
|
|
16
|
+
name: string,
|
|
17
|
+
yjsDocMap: Map<string, Doc>,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare export var CollaborationContext: React.Context<CollaborationContextType>;
|
|
21
|
+
declare export function useCollaborationContext(): CollaborationContextType;
|
|
22
|
+
declare export function LexicalCollaboration({children: React.Node}): React.Node;
|
|
@@ -0,0 +1,14 @@
|
|
|
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 './LexicalCollaborationContext.dev.mjs';
|
|
10
|
+
import * as modProd from './LexicalCollaborationContext.prod.mjs';
|
|
11
|
+
const mod = process.env.NODE_ENV !== 'production' ? modDev : modProd;
|
|
12
|
+
export const CollaborationContext = mod.CollaborationContext;
|
|
13
|
+
export const LexicalCollaboration = mod.LexicalCollaboration;
|
|
14
|
+
export const useCollaborationContext = mod.useCollaborationContext;
|
|
@@ -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
|
+
|
|
9
|
+
const mod = await (process.env.NODE_ENV !== 'production' ? import('./LexicalCollaborationContext.dev.mjs') : import('./LexicalCollaborationContext.prod.mjs'));
|
|
10
|
+
export const CollaborationContext = mod.CollaborationContext;
|
|
11
|
+
export const LexicalCollaboration = mod.LexicalCollaboration;
|
|
12
|
+
export const useCollaborationContext = mod.useCollaborationContext;
|
|
@@ -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 r=require("react"),e=require("react/jsx-runtime");const o=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],n=o[Math.floor(Math.random()*o.length)],t=r.createContext(null);function l(){return{color:n[1],isCollabActive:!1,name:n[0],yjsDocMap:new Map}}const a=l();exports.CollaborationContext=t,exports.LexicalCollaboration=function({children:o}){const n=r.useMemo(()=>l(),[]);return e.jsx(t.Provider,{value:n,children:o})},exports.useCollaborationContext=function(e,o){let n=r.useContext(t);return null==n&&function(r,...e){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",r);for(const r of e)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),n=n??a,null!=e&&(n.name=e),null!=o&&(n.color=o),n};
|
|
@@ -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{createContext as r,useMemo as n,useContext as e}from"react";import{jsx as o}from"react/jsx-runtime";const t=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],i=t[Math.floor(Math.random()*t.length)],l=r(null);function a(){return{color:i[1],isCollabActive:!1,name:i[0],yjsDocMap:new Map}}const g=a();function c({children:r}){const e=n(()=>a(),[]);return o(l.Provider,{value:e,children:r})}function b(r,n){let o=e(l);return null==o&&function(r,...n){const e=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of n)o.append("v",r);e.search=o.toString(),console.warn(`Minified Lexical warning #${r}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),o=o??g,null!=r&&(o.name=r),null!=n&&(o.color=n),o}export{l as CollaborationContext,c as LexicalCollaboration,b as useCollaborationContext};
|
|
@@ -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 { JSX } from 'react';
|
|
9
|
+
import { ExcludedProperties, Provider, SyncCursorPositionsFn } from '@ekz/lexical-yjs';
|
|
10
|
+
import { Doc } from 'yjs';
|
|
11
|
+
import { InitialEditorStateType } from './LexicalComposer';
|
|
12
|
+
import { CursorsContainerRef } from './shared/useYjsCollaboration';
|
|
13
|
+
type ProviderFactory = (id: string, yjsDocMap: Map<string, Doc>) => Provider;
|
|
14
|
+
type CollaborationPluginProps = {
|
|
15
|
+
id: string;
|
|
16
|
+
providerFactory: ProviderFactory;
|
|
17
|
+
shouldBootstrap: boolean;
|
|
18
|
+
username?: string;
|
|
19
|
+
cursorColor?: string;
|
|
20
|
+
cursorsContainerRef?: CursorsContainerRef;
|
|
21
|
+
initialEditorState?: InitialEditorStateType;
|
|
22
|
+
excludedProperties?: ExcludedProperties;
|
|
23
|
+
awarenessData?: object;
|
|
24
|
+
syncCursorPositionsFn?: SyncCursorPositionsFn;
|
|
25
|
+
};
|
|
26
|
+
export declare function CollaborationPlugin({ id, providerFactory, shouldBootstrap, username, cursorColor, cursorsContainerRef, initialEditorState, excludedProperties, awarenessData, syncCursorPositionsFn, }: CollaborationPluginProps): JSX.Element;
|
|
27
|
+
type CollaborationPluginV2Props = {
|
|
28
|
+
id: string;
|
|
29
|
+
doc: Doc;
|
|
30
|
+
provider: Provider;
|
|
31
|
+
__shouldBootstrapUnsafe?: boolean;
|
|
32
|
+
username?: string;
|
|
33
|
+
cursorColor?: string;
|
|
34
|
+
cursorsContainerRef?: CursorsContainerRef;
|
|
35
|
+
excludedProperties?: ExcludedProperties;
|
|
36
|
+
awarenessData?: object;
|
|
37
|
+
};
|
|
38
|
+
export declare function CollaborationPluginV2__EXPERIMENTAL({ id, doc, provider, __shouldBootstrapUnsafe, username, cursorColor, cursorsContainerRef, excludedProperties, awarenessData, }: CollaborationPluginV2Props): JSX.Element;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,584 @@
|
|
|
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 LexicalCollaborationContext = require('@ekz/lexical-react/LexicalCollaborationContext');
|
|
12
|
+
var LexicalComposerContext = require('@ekz/lexical-react/LexicalComposerContext');
|
|
13
|
+
var lexicalYjs = require('@ekz/lexical-yjs');
|
|
14
|
+
var React = require('react');
|
|
15
|
+
var lexicalUtils = require('@ekz/lexical-utils');
|
|
16
|
+
var lexical = require('@ekz/lexical');
|
|
17
|
+
var reactDom = require('react-dom');
|
|
18
|
+
var yjs = require('yjs');
|
|
19
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
20
|
+
|
|
21
|
+
function _interopNamespaceDefault(e) {
|
|
22
|
+
var n = Object.create(null);
|
|
23
|
+
if (e) {
|
|
24
|
+
for (var k in e) {
|
|
25
|
+
n[k] = e[k];
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
n.default = e;
|
|
29
|
+
return n;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
function useYjsCollaboration(editor, id, provider, docMap, name, color, shouldBootstrap, binding, setDoc, cursorsContainerRef, initialEditorState, awarenessData, syncCursorPositionsFn = lexicalYjs.syncCursorPositions) {
|
|
43
|
+
const isReloadingDoc = React.useRef(false);
|
|
44
|
+
const onBootstrap = React.useCallback(() => {
|
|
45
|
+
const {
|
|
46
|
+
root
|
|
47
|
+
} = binding;
|
|
48
|
+
if (shouldBootstrap && root.isEmpty() && root._xmlText._length === 0) {
|
|
49
|
+
initializeEditor(editor, initialEditorState);
|
|
50
|
+
}
|
|
51
|
+
}, [binding, editor, initialEditorState, shouldBootstrap]);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
const {
|
|
54
|
+
root
|
|
55
|
+
} = binding;
|
|
56
|
+
const onYjsTreeChanges = (events, transaction) => {
|
|
57
|
+
const origin = transaction.origin;
|
|
58
|
+
if (origin !== binding) {
|
|
59
|
+
const isFromUndoManger = origin instanceof yjs.UndoManager;
|
|
60
|
+
lexicalYjs.syncYjsChangesToLexical(binding, provider, events, isFromUndoManger, syncCursorPositionsFn);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// This updates the local editor state when we receive updates from other clients
|
|
65
|
+
root.getSharedType().observeDeep(onYjsTreeChanges);
|
|
66
|
+
const removeListener = editor.registerUpdateListener(({
|
|
67
|
+
prevEditorState,
|
|
68
|
+
editorState,
|
|
69
|
+
dirtyLeaves,
|
|
70
|
+
dirtyElements,
|
|
71
|
+
normalizedNodes,
|
|
72
|
+
tags
|
|
73
|
+
}) => {
|
|
74
|
+
if (!tags.has(lexical.SKIP_COLLAB_TAG)) {
|
|
75
|
+
lexicalYjs.syncLexicalUpdateToYjs(binding, provider, prevEditorState, editorState, dirtyElements, dirtyLeaves, normalizedNodes, tags);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
return () => {
|
|
79
|
+
root.getSharedType().unobserveDeep(onYjsTreeChanges);
|
|
80
|
+
removeListener();
|
|
81
|
+
};
|
|
82
|
+
}, [binding, provider, editor, setDoc, docMap, id, syncCursorPositionsFn]);
|
|
83
|
+
|
|
84
|
+
// Note: 'reload' is not an actual Yjs event type. Included here for legacy support (#1409).
|
|
85
|
+
React.useEffect(() => {
|
|
86
|
+
const onProviderDocReload = ydoc => {
|
|
87
|
+
clearEditorSkipCollab(editor, binding);
|
|
88
|
+
setDoc(ydoc);
|
|
89
|
+
docMap.set(id, ydoc);
|
|
90
|
+
isReloadingDoc.current = true;
|
|
91
|
+
};
|
|
92
|
+
const onSync = () => {
|
|
93
|
+
isReloadingDoc.current = false;
|
|
94
|
+
};
|
|
95
|
+
provider.on('reload', onProviderDocReload);
|
|
96
|
+
provider.on('sync', onSync);
|
|
97
|
+
return () => {
|
|
98
|
+
provider.off('reload', onProviderDocReload);
|
|
99
|
+
provider.off('sync', onSync);
|
|
100
|
+
};
|
|
101
|
+
}, [binding, provider, editor, setDoc, docMap, id]);
|
|
102
|
+
useProvider(editor, provider, name, color, isReloadingDoc, awarenessData, onBootstrap);
|
|
103
|
+
useAwareness(binding, provider);
|
|
104
|
+
return useYjsCursors(binding, cursorsContainerRef);
|
|
105
|
+
}
|
|
106
|
+
function useYjsCollaborationV2__EXPERIMENTAL(editor, id, doc, provider, docMap, name, color, options = {}) {
|
|
107
|
+
const {
|
|
108
|
+
awarenessData,
|
|
109
|
+
excludedProperties,
|
|
110
|
+
rootName,
|
|
111
|
+
__shouldBootstrapUnsafe: shouldBootstrap
|
|
112
|
+
} = options;
|
|
113
|
+
|
|
114
|
+
// Note: v2 does not support 'reload' event, which is not an actual Yjs event type.
|
|
115
|
+
const isReloadingDoc = React.useMemo(() => ({
|
|
116
|
+
current: false
|
|
117
|
+
}), []);
|
|
118
|
+
const binding = React.useMemo(() => lexicalYjs.createBindingV2__EXPERIMENTAL(editor, id, doc, docMap, {
|
|
119
|
+
excludedProperties,
|
|
120
|
+
rootName
|
|
121
|
+
}), [editor, id, doc, docMap, excludedProperties, rootName]);
|
|
122
|
+
React.useEffect(() => {
|
|
123
|
+
docMap.set(id, doc);
|
|
124
|
+
return () => {
|
|
125
|
+
docMap.delete(id);
|
|
126
|
+
};
|
|
127
|
+
}, [doc, docMap, id]);
|
|
128
|
+
const onBootstrap = React.useCallback(() => {
|
|
129
|
+
const {
|
|
130
|
+
root
|
|
131
|
+
} = binding;
|
|
132
|
+
if (shouldBootstrap && root._length === 0) {
|
|
133
|
+
initializeEditor(editor);
|
|
134
|
+
}
|
|
135
|
+
}, [binding, editor, shouldBootstrap]);
|
|
136
|
+
const [diffSnapshots, setDiffSnapshots] = React.useState();
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
lexicalUtils.mergeRegister(editor.registerCommand(lexicalYjs.CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL, () => {
|
|
139
|
+
setDiffSnapshots(null);
|
|
140
|
+
// Ensure that any state already in Yjs is loaded into the editor (eg: after clearing diff view).
|
|
141
|
+
lexicalYjs.syncYjsStateToLexicalV2__EXPERIMENTAL(binding, provider);
|
|
142
|
+
return true;
|
|
143
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexicalYjs.DIFF_VERSIONS_COMMAND__EXPERIMENTAL, ({
|
|
144
|
+
prevSnapshot,
|
|
145
|
+
snapshot
|
|
146
|
+
}) => {
|
|
147
|
+
setDiffSnapshots({
|
|
148
|
+
prevSnapshot,
|
|
149
|
+
snapshot
|
|
150
|
+
});
|
|
151
|
+
return true;
|
|
152
|
+
}, lexical.COMMAND_PRIORITY_EDITOR));
|
|
153
|
+
}, [editor, binding, provider]);
|
|
154
|
+
React.useEffect(() => {
|
|
155
|
+
const {
|
|
156
|
+
root
|
|
157
|
+
} = binding;
|
|
158
|
+
if (diffSnapshots) {
|
|
159
|
+
lexicalYjs.renderSnapshot__EXPERIMENTAL(binding, diffSnapshots.snapshot, diffSnapshots.prevSnapshot);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const onYjsTreeChanges = (events, transaction) => {
|
|
163
|
+
const origin = transaction.origin;
|
|
164
|
+
if (origin !== binding) {
|
|
165
|
+
const isFromUndoManger = origin instanceof yjs.UndoManager;
|
|
166
|
+
lexicalYjs.syncYjsChangesToLexicalV2__EXPERIMENTAL(binding, provider, events, transaction, isFromUndoManger);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// This updates the local editor state when we receive updates from other clients
|
|
171
|
+
root.observeDeep(onYjsTreeChanges);
|
|
172
|
+
const removeListener = editor.registerUpdateListener(({
|
|
173
|
+
prevEditorState,
|
|
174
|
+
editorState,
|
|
175
|
+
dirtyElements,
|
|
176
|
+
normalizedNodes,
|
|
177
|
+
tags
|
|
178
|
+
}) => {
|
|
179
|
+
if (!tags.has(lexical.SKIP_COLLAB_TAG)) {
|
|
180
|
+
lexicalYjs.syncLexicalUpdateToYjsV2__EXPERIMENTAL(binding, provider, prevEditorState, editorState, dirtyElements, normalizedNodes, tags);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
return () => {
|
|
184
|
+
root.unobserveDeep(onYjsTreeChanges);
|
|
185
|
+
removeListener();
|
|
186
|
+
};
|
|
187
|
+
}, [binding, provider, editor, diffSnapshots]);
|
|
188
|
+
useProvider(editor, provider, name, color, isReloadingDoc, awarenessData, onBootstrap);
|
|
189
|
+
useAwareness(binding, provider);
|
|
190
|
+
return binding;
|
|
191
|
+
}
|
|
192
|
+
function useProvider(editor, provider, name, color, isReloadingDoc, awarenessData, onBootstrap) {
|
|
193
|
+
const connect = React.useCallback(() => provider.connect(), [provider]);
|
|
194
|
+
const disconnect = React.useCallback(() => {
|
|
195
|
+
try {
|
|
196
|
+
provider.disconnect();
|
|
197
|
+
} catch (_e) {
|
|
198
|
+
// Do nothing
|
|
199
|
+
}
|
|
200
|
+
}, [provider]);
|
|
201
|
+
React.useEffect(() => {
|
|
202
|
+
const onStatus = ({
|
|
203
|
+
status
|
|
204
|
+
}) => {
|
|
205
|
+
editor.dispatchCommand(lexicalYjs.CONNECTED_COMMAND, status === 'connected');
|
|
206
|
+
};
|
|
207
|
+
const onSync = isSynced => {
|
|
208
|
+
if (isSynced && isReloadingDoc.current === false && onBootstrap) {
|
|
209
|
+
onBootstrap();
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
lexicalYjs.initLocalState(provider, name, color, document.activeElement === editor.getRootElement(), awarenessData || {});
|
|
213
|
+
provider.on('status', onStatus);
|
|
214
|
+
provider.on('sync', onSync);
|
|
215
|
+
const connectionPromise = connect();
|
|
216
|
+
return () => {
|
|
217
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- expected that isReloadingDoc.current may change
|
|
218
|
+
if (isReloadingDoc.current === false) {
|
|
219
|
+
if (connectionPromise) {
|
|
220
|
+
connectionPromise.then(disconnect);
|
|
221
|
+
} else {
|
|
222
|
+
// Workaround for race condition in StrictMode. It's possible there
|
|
223
|
+
// is a different race for the above case where connect returns a
|
|
224
|
+
// promise, but we don't have an example of that in-repo.
|
|
225
|
+
// It's possible that there is a similar issue with
|
|
226
|
+
// TOGGLE_CONNECT_COMMAND below when the provider connect returns a
|
|
227
|
+
// promise.
|
|
228
|
+
// https://github.com/facebook/lexical/issues/6640
|
|
229
|
+
disconnect();
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
provider.off('sync', onSync);
|
|
233
|
+
provider.off('status', onStatus);
|
|
234
|
+
};
|
|
235
|
+
}, [editor, provider, name, color, isReloadingDoc, awarenessData, onBootstrap, connect, disconnect]);
|
|
236
|
+
React.useEffect(() => {
|
|
237
|
+
return editor.registerCommand(lexicalYjs.TOGGLE_CONNECT_COMMAND, payload => {
|
|
238
|
+
const shouldConnect = payload;
|
|
239
|
+
if (shouldConnect) {
|
|
240
|
+
// eslint-disable-next-line no-console
|
|
241
|
+
console.log('Collaboration connected!');
|
|
242
|
+
connect();
|
|
243
|
+
} else {
|
|
244
|
+
// eslint-disable-next-line no-console
|
|
245
|
+
console.log('Collaboration disconnected!');
|
|
246
|
+
disconnect();
|
|
247
|
+
}
|
|
248
|
+
return true;
|
|
249
|
+
}, lexical.COMMAND_PRIORITY_EDITOR);
|
|
250
|
+
}, [connect, disconnect, editor]);
|
|
251
|
+
|
|
252
|
+
// Clear awareness state immediately when tab is refreshed or closed
|
|
253
|
+
// This prevents ghost cursors from appearing for several seconds after disconnect
|
|
254
|
+
// See: https://github.com/facebook/lexical/issues/8061
|
|
255
|
+
React.useEffect(() => {
|
|
256
|
+
const clearAwarenessState = () => {
|
|
257
|
+
// Immediately clear local awareness state to signal disconnection
|
|
258
|
+
// This broadcasts to other clients that this client has disconnected,
|
|
259
|
+
// causing them to remove the cursor immediately instead of waiting for timeout
|
|
260
|
+
try {
|
|
261
|
+
provider.awareness.setLocalState(null);
|
|
262
|
+
} catch (_e) {
|
|
263
|
+
// Ignore errors during cleanup (e.g., if provider is already disconnected)
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
// Use both beforeunload and pagehide for maximum browser compatibility
|
|
268
|
+
// beforeunload: fires before page unloads (may be cancelable)
|
|
269
|
+
// pagehide: fires when page is being unloaded (more reliable, especially on mobile)
|
|
270
|
+
window.addEventListener('beforeunload', clearAwarenessState);
|
|
271
|
+
window.addEventListener('pagehide', clearAwarenessState);
|
|
272
|
+
return () => {
|
|
273
|
+
window.removeEventListener('beforeunload', clearAwarenessState);
|
|
274
|
+
window.removeEventListener('pagehide', clearAwarenessState);
|
|
275
|
+
};
|
|
276
|
+
}, [provider]);
|
|
277
|
+
}
|
|
278
|
+
function useAwareness(binding, provider) {
|
|
279
|
+
React.useEffect(() => {
|
|
280
|
+
const {
|
|
281
|
+
awareness
|
|
282
|
+
} = provider;
|
|
283
|
+
const onAwarenessUpdate = () => {
|
|
284
|
+
lexicalYjs.syncCursorPositions(binding, provider);
|
|
285
|
+
};
|
|
286
|
+
awareness.on('update', onAwarenessUpdate);
|
|
287
|
+
return () => {
|
|
288
|
+
awareness.off('update', onAwarenessUpdate);
|
|
289
|
+
};
|
|
290
|
+
}, [binding, provider]);
|
|
291
|
+
}
|
|
292
|
+
function useYjsCursors(binding, cursorsContainerRef) {
|
|
293
|
+
return React.useMemo(() => {
|
|
294
|
+
const ref = element => {
|
|
295
|
+
binding.cursorsContainer = element;
|
|
296
|
+
};
|
|
297
|
+
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
298
|
+
ref: ref
|
|
299
|
+
}), cursorsContainerRef && cursorsContainerRef.current || document.body);
|
|
300
|
+
}, [binding, cursorsContainerRef]);
|
|
301
|
+
}
|
|
302
|
+
function useYjsFocusTracking(editor, provider, name, color, awarenessData) {
|
|
303
|
+
React.useEffect(() => {
|
|
304
|
+
return lexicalUtils.mergeRegister(editor.registerCommand(lexical.FOCUS_COMMAND, () => {
|
|
305
|
+
lexicalYjs.setLocalStateFocus(provider, name, color, true, awarenessData || {});
|
|
306
|
+
return false;
|
|
307
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.BLUR_COMMAND, () => {
|
|
308
|
+
lexicalYjs.setLocalStateFocus(provider, name, color, false, awarenessData || {});
|
|
309
|
+
return false;
|
|
310
|
+
}, lexical.COMMAND_PRIORITY_EDITOR));
|
|
311
|
+
}, [color, editor, name, provider, awarenessData]);
|
|
312
|
+
}
|
|
313
|
+
function useYjsHistory(editor, binding) {
|
|
314
|
+
const undoManager = React.useMemo(() => lexicalYjs.createUndoManager(binding, binding.root.getSharedType()), [binding]);
|
|
315
|
+
return useYjsUndoManager(editor, undoManager);
|
|
316
|
+
}
|
|
317
|
+
function useYjsHistoryV2(editor, binding) {
|
|
318
|
+
const undoManager = React.useMemo(() => lexicalYjs.createUndoManager(binding, binding.root), [binding]);
|
|
319
|
+
return useYjsUndoManager(editor, undoManager);
|
|
320
|
+
}
|
|
321
|
+
function useYjsUndoManager(editor, undoManager) {
|
|
322
|
+
React.useEffect(() => {
|
|
323
|
+
const undo = () => {
|
|
324
|
+
undoManager.undo();
|
|
325
|
+
};
|
|
326
|
+
const redo = () => {
|
|
327
|
+
undoManager.redo();
|
|
328
|
+
};
|
|
329
|
+
return lexicalUtils.mergeRegister(editor.registerCommand(lexical.UNDO_COMMAND, () => {
|
|
330
|
+
undo();
|
|
331
|
+
return true;
|
|
332
|
+
}, lexical.COMMAND_PRIORITY_EDITOR), editor.registerCommand(lexical.REDO_COMMAND, () => {
|
|
333
|
+
redo();
|
|
334
|
+
return true;
|
|
335
|
+
}, lexical.COMMAND_PRIORITY_EDITOR));
|
|
336
|
+
});
|
|
337
|
+
const clearHistory = React.useCallback(() => {
|
|
338
|
+
undoManager.clear();
|
|
339
|
+
}, [undoManager]);
|
|
340
|
+
|
|
341
|
+
// Exposing undo and redo states
|
|
342
|
+
React__namespace.useEffect(() => {
|
|
343
|
+
const updateUndoRedoStates = () => {
|
|
344
|
+
editor.dispatchCommand(lexical.CAN_UNDO_COMMAND, undoManager.undoStack.length > 0);
|
|
345
|
+
editor.dispatchCommand(lexical.CAN_REDO_COMMAND, undoManager.redoStack.length > 0);
|
|
346
|
+
};
|
|
347
|
+
undoManager.on('stack-item-added', updateUndoRedoStates);
|
|
348
|
+
undoManager.on('stack-item-popped', updateUndoRedoStates);
|
|
349
|
+
undoManager.on('stack-cleared', updateUndoRedoStates);
|
|
350
|
+
return () => {
|
|
351
|
+
undoManager.off('stack-item-added', updateUndoRedoStates);
|
|
352
|
+
undoManager.off('stack-item-popped', updateUndoRedoStates);
|
|
353
|
+
undoManager.off('stack-cleared', updateUndoRedoStates);
|
|
354
|
+
};
|
|
355
|
+
}, [editor, undoManager]);
|
|
356
|
+
return clearHistory;
|
|
357
|
+
}
|
|
358
|
+
function initializeEditor(editor, initialEditorState) {
|
|
359
|
+
editor.update(() => {
|
|
360
|
+
const root = lexical.$getRoot();
|
|
361
|
+
if (root.isEmpty()) {
|
|
362
|
+
if (initialEditorState) {
|
|
363
|
+
switch (typeof initialEditorState) {
|
|
364
|
+
case 'string':
|
|
365
|
+
{
|
|
366
|
+
const parsedEditorState = editor.parseEditorState(initialEditorState);
|
|
367
|
+
editor.setEditorState(parsedEditorState, {
|
|
368
|
+
tag: lexical.HISTORY_MERGE_TAG
|
|
369
|
+
});
|
|
370
|
+
break;
|
|
371
|
+
}
|
|
372
|
+
case 'object':
|
|
373
|
+
{
|
|
374
|
+
editor.setEditorState(initialEditorState, {
|
|
375
|
+
tag: lexical.HISTORY_MERGE_TAG
|
|
376
|
+
});
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
case 'function':
|
|
380
|
+
{
|
|
381
|
+
editor.update(() => {
|
|
382
|
+
const root1 = lexical.$getRoot();
|
|
383
|
+
if (root1.isEmpty()) {
|
|
384
|
+
initialEditorState(editor);
|
|
385
|
+
}
|
|
386
|
+
}, {
|
|
387
|
+
tag: lexical.HISTORY_MERGE_TAG
|
|
388
|
+
});
|
|
389
|
+
break;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
} else {
|
|
393
|
+
const paragraph = lexical.$createParagraphNode();
|
|
394
|
+
root.append(paragraph);
|
|
395
|
+
const {
|
|
396
|
+
activeElement
|
|
397
|
+
} = document;
|
|
398
|
+
if (lexical.$getSelection() !== null || activeElement !== null && activeElement === editor.getRootElement()) {
|
|
399
|
+
paragraph.select();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
tag: lexical.HISTORY_MERGE_TAG
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
function clearEditorSkipCollab(editor, binding) {
|
|
408
|
+
// reset editor state
|
|
409
|
+
editor.update(() => {
|
|
410
|
+
const root = lexical.$getRoot();
|
|
411
|
+
root.clear();
|
|
412
|
+
root.select();
|
|
413
|
+
}, {
|
|
414
|
+
tag: lexical.SKIP_COLLAB_TAG
|
|
415
|
+
});
|
|
416
|
+
if (binding.cursors == null) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
const cursors = binding.cursors;
|
|
420
|
+
if (cursors == null) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const cursorsContainer = binding.cursorsContainer;
|
|
424
|
+
if (cursorsContainer == null) {
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// reset cursors in dom
|
|
429
|
+
const cursorsArr = Array.from(cursors.values());
|
|
430
|
+
for (let i = 0; i < cursorsArr.length; i++) {
|
|
431
|
+
const cursor = cursorsArr[i];
|
|
432
|
+
const selection = cursor.selection;
|
|
433
|
+
if (selection && selection.selections != null) {
|
|
434
|
+
const selections = selection.selections;
|
|
435
|
+
for (let j = 0; j < selections.length; j++) {
|
|
436
|
+
cursorsContainer.removeChild(selections[i]);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
444
|
+
*
|
|
445
|
+
* This source code is licensed under the MIT license found in the
|
|
446
|
+
* LICENSE file in the root directory of this source tree.
|
|
447
|
+
*
|
|
448
|
+
*/
|
|
449
|
+
|
|
450
|
+
function CollaborationPlugin({
|
|
451
|
+
id,
|
|
452
|
+
providerFactory,
|
|
453
|
+
shouldBootstrap,
|
|
454
|
+
username,
|
|
455
|
+
cursorColor,
|
|
456
|
+
cursorsContainerRef,
|
|
457
|
+
initialEditorState,
|
|
458
|
+
excludedProperties,
|
|
459
|
+
awarenessData,
|
|
460
|
+
syncCursorPositionsFn
|
|
461
|
+
}) {
|
|
462
|
+
const isBindingInitialized = React.useRef(false);
|
|
463
|
+
const isProviderInitialized = React.useRef(false);
|
|
464
|
+
const collabContext = LexicalCollaborationContext.useCollaborationContext(username, cursorColor);
|
|
465
|
+
const {
|
|
466
|
+
yjsDocMap,
|
|
467
|
+
name,
|
|
468
|
+
color
|
|
469
|
+
} = collabContext;
|
|
470
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
471
|
+
useCollabActive(collabContext, editor);
|
|
472
|
+
const [provider, setProvider] = React.useState();
|
|
473
|
+
const [doc, setDoc] = React.useState();
|
|
474
|
+
React.useEffect(() => {
|
|
475
|
+
if (isProviderInitialized.current) {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
isProviderInitialized.current = true;
|
|
479
|
+
const newProvider = providerFactory(id, yjsDocMap);
|
|
480
|
+
setProvider(newProvider);
|
|
481
|
+
setDoc(yjsDocMap.get(id));
|
|
482
|
+
return () => {
|
|
483
|
+
newProvider.disconnect();
|
|
484
|
+
};
|
|
485
|
+
}, [id, providerFactory, yjsDocMap]);
|
|
486
|
+
const [binding, setBinding] = React.useState();
|
|
487
|
+
React.useEffect(() => {
|
|
488
|
+
if (!provider) {
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
if (isBindingInitialized.current) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
isBindingInitialized.current = true;
|
|
495
|
+
const newBinding = lexicalYjs.createBinding(editor, provider, id, doc || yjsDocMap.get(id), yjsDocMap, excludedProperties);
|
|
496
|
+
setBinding(newBinding);
|
|
497
|
+
return () => {
|
|
498
|
+
newBinding.root.destroy(newBinding);
|
|
499
|
+
};
|
|
500
|
+
}, [editor, provider, id, yjsDocMap, doc, excludedProperties]);
|
|
501
|
+
if (!provider || !binding) {
|
|
502
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
503
|
+
}
|
|
504
|
+
return /*#__PURE__*/jsxRuntime.jsx(YjsCollaborationCursors, {
|
|
505
|
+
awarenessData: awarenessData,
|
|
506
|
+
binding: binding,
|
|
507
|
+
collabContext: collabContext,
|
|
508
|
+
color: color,
|
|
509
|
+
cursorsContainerRef: cursorsContainerRef,
|
|
510
|
+
editor: editor,
|
|
511
|
+
id: id,
|
|
512
|
+
initialEditorState: initialEditorState,
|
|
513
|
+
name: name,
|
|
514
|
+
provider: provider,
|
|
515
|
+
setDoc: setDoc,
|
|
516
|
+
shouldBootstrap: shouldBootstrap,
|
|
517
|
+
yjsDocMap: yjsDocMap,
|
|
518
|
+
syncCursorPositionsFn: syncCursorPositionsFn
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
function YjsCollaborationCursors({
|
|
522
|
+
editor,
|
|
523
|
+
id,
|
|
524
|
+
provider,
|
|
525
|
+
yjsDocMap,
|
|
526
|
+
name,
|
|
527
|
+
color,
|
|
528
|
+
shouldBootstrap,
|
|
529
|
+
cursorsContainerRef,
|
|
530
|
+
initialEditorState,
|
|
531
|
+
awarenessData,
|
|
532
|
+
collabContext,
|
|
533
|
+
binding,
|
|
534
|
+
setDoc,
|
|
535
|
+
syncCursorPositionsFn
|
|
536
|
+
}) {
|
|
537
|
+
const cursors = useYjsCollaboration(editor, id, provider, yjsDocMap, name, color, shouldBootstrap, binding, setDoc, cursorsContainerRef, initialEditorState, awarenessData, syncCursorPositionsFn);
|
|
538
|
+
useYjsHistory(editor, binding);
|
|
539
|
+
useYjsFocusTracking(editor, provider, name, color, awarenessData);
|
|
540
|
+
return cursors;
|
|
541
|
+
}
|
|
542
|
+
function CollaborationPluginV2__EXPERIMENTAL({
|
|
543
|
+
id,
|
|
544
|
+
doc,
|
|
545
|
+
provider,
|
|
546
|
+
__shouldBootstrapUnsafe,
|
|
547
|
+
username,
|
|
548
|
+
cursorColor,
|
|
549
|
+
cursorsContainerRef,
|
|
550
|
+
excludedProperties,
|
|
551
|
+
awarenessData
|
|
552
|
+
}) {
|
|
553
|
+
const collabContext = LexicalCollaborationContext.useCollaborationContext(username, cursorColor);
|
|
554
|
+
const {
|
|
555
|
+
yjsDocMap,
|
|
556
|
+
name,
|
|
557
|
+
color
|
|
558
|
+
} = collabContext;
|
|
559
|
+
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
560
|
+
useCollabActive(collabContext, editor);
|
|
561
|
+
const binding = useYjsCollaborationV2__EXPERIMENTAL(editor, id, doc, provider, yjsDocMap, name, color, {
|
|
562
|
+
__shouldBootstrapUnsafe,
|
|
563
|
+
awarenessData,
|
|
564
|
+
excludedProperties
|
|
565
|
+
});
|
|
566
|
+
useYjsHistoryV2(editor, binding);
|
|
567
|
+
useYjsFocusTracking(editor, provider, name, color, awarenessData);
|
|
568
|
+
return useYjsCursors(binding, cursorsContainerRef);
|
|
569
|
+
}
|
|
570
|
+
const useCollabActive = (collabContext, editor) => {
|
|
571
|
+
React.useEffect(() => {
|
|
572
|
+
collabContext.isCollabActive = true;
|
|
573
|
+
return () => {
|
|
574
|
+
// Resetting flag only when unmount top level editor collab plugin. Nested
|
|
575
|
+
// editors (e.g. image caption) should unmount without affecting it
|
|
576
|
+
if (editor._parentEditor == null) {
|
|
577
|
+
collabContext.isCollabActive = false;
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
}, [collabContext, editor]);
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
exports.CollaborationPlugin = CollaborationPlugin;
|
|
584
|
+
exports.CollaborationPluginV2__EXPERIMENTAL = CollaborationPluginV2__EXPERIMENTAL;
|