@payloadcms/richtext-lexical 3.68.0-internal-debug.e9b66ee → 3.68.0-internal-debug.654e4ad
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/dist/cell/rscEntry.js +21 -2
- package/dist/cell/rscEntry.js.map +1 -1
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +1 -0
- package/dist/exports/client/index.js.map +1 -1
- package/dist/exports/client/internal-client.d.ts +3 -0
- package/dist/exports/client/internal-client.d.ts.map +1 -0
- package/dist/exports/client/internal-client.js +4 -0
- package/dist/exports/client/internal-client.js.map +1 -0
- package/dist/exports/react/index.d.ts +1 -1
- package/dist/exports/react/index.d.ts.map +1 -1
- package/dist/exports/react/index.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +48 -13
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +10 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockEditButton.js +7 -1
- package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js +7 -1
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/component/index.js +247 -81
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +9 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +7 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +7 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +7 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +217 -68
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/getBlockImageComponent.js +15 -4
- package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +12 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +12 -2
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +127 -26
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +65 -49
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +16 -3
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +25 -4
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
- package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.js +16 -10
- package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +8 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +8 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js +19 -10
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js +63 -16
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +19 -4
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js +45 -12
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js +57 -11
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +46 -7
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
- package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js +98 -9
- package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
- package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +17 -4
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js +113 -38
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.js +15 -1
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +357 -79
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +41 -7
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +39 -9
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +59 -28
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -0
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/indent/client/IndentPlugin.js +6 -1
- package/dist/features/indent/client/IndentPlugin.js.map +1 -1
- package/dist/features/link/client/plugins/clickableLink/index.js +7 -1
- package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +151 -59
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +9 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/lists/checklist/client/plugin/index.js +7 -1
- package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
- package/dist/features/lists/plugin/index.js +7 -1
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +18 -3
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +9 -2
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +18 -3
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +9 -2
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +100 -31
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +21 -4
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +12 -2
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +8 -1
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/textState/feature.client.js +22 -5
- package/dist/features/textState/feature.client.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +123 -27
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +111 -18
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +14 -4
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +135 -56
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +70 -16
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/upload/client/component/index.js +167 -43
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/component/pending/index.js +16 -3
- package/dist/features/upload/client/component/pending/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.js +21 -4
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +17 -3
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +9 -2
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +54 -11
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.js +60 -18
- package/dist/field/Diff/converters/relationship/index.js.map +1 -1
- package/dist/field/Diff/converters/unknown/index.js +42 -7
- package/dist/field/Diff/converters/unknown/index.js.map +1 -1
- package/dist/field/Diff/converters/upload/index.js +91 -21
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/Diff/index.js +17 -4
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +141 -26
- package/dist/field/Field.js.map +1 -1
- package/dist/field/RenderLexical/index.js +47 -15
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/RichTextViewProvider.d.ts +83 -0
- package/dist/field/RichTextViewProvider.d.ts.map +1 -0
- package/dist/field/RichTextViewProvider.js +102 -0
- package/dist/field/RichTextViewProvider.js.map +1 -0
- package/dist/field/ViewSelector.d.ts +4 -0
- package/dist/field/ViewSelector.d.ts.map +1 -0
- package/dist/field/ViewSelector.js +90 -0
- package/dist/field/ViewSelector.js.map +1 -0
- package/dist/field/ViewSelector.scss +34 -0
- package/dist/field/index.d.ts +1 -0
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +56 -12
- package/dist/field/index.js.map +1 -1
- package/dist/field/index.scss +12 -0
- package/dist/field/rscEntry.d.ts +1 -1
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +21 -1
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.js +17 -2
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +238 -69
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +74 -15
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +11 -2
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +3 -2
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/types.d.ts +4 -0
- package/dist/lexical/config/types.d.ts.map +1 -1
- package/dist/lexical/config/types.js +3 -1
- package/dist/lexical/config/types.js.map +1 -1
- package/dist/lexical/nodes/index.d.ts +12 -2
- package/dist/lexical/nodes/index.d.ts.map +1 -1
- package/dist/lexical/nodes/index.js +187 -2
- package/dist/lexical/nodes/index.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +28 -5
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +31 -0
- package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +14 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +98 -31
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +27 -7
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +45 -7
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +18 -3
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/AI/index.js +58 -10
- package/dist/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js +31 -4
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js +45 -5
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js +45 -5
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js +45 -5
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js +45 -5
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js +54 -5
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js +24 -3
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js +24 -3
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js +39 -4
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js +34 -4
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +22 -3
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.js +23 -3
- package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js +24 -3
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js +24 -3
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +24 -3
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +24 -3
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +24 -3
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +24 -3
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js +27 -3
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js +53 -6
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js +53 -6
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.js +26 -3
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js +24 -3
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js +25 -3
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.js +39 -5
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js +61 -7
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js +58 -10
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js +34 -4
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js +24 -3
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js +24 -3
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +24 -3
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js +24 -3
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/TextState/index.js +18 -12
- package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js +34 -4
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js +81 -8
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +48 -5
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/types.d.ts +152 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +55 -0
- package/dist/types.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +41 -16
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +42 -10
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +9 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +11 -3
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +1 -0
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/validate/hasText.d.ts +6 -1
- package/dist/validate/hasText.d.ts.map +1 -1
- package/dist/validate/hasText.js +10 -4
- package/dist/validate/hasText.js.map +1 -1
- package/package.json +12 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
3
4
|
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js';
|
|
4
5
|
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
|
|
@@ -17,6 +18,7 @@ import { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/ind
|
|
|
17
18
|
import { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js';
|
|
18
19
|
import { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js';
|
|
19
20
|
import { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js';
|
|
21
|
+
import { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js';
|
|
20
22
|
import { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js';
|
|
21
23
|
import { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js';
|
|
22
24
|
import { SlashMenuPlugin } from './plugins/SlashMenu/index.js';
|
|
@@ -64,75 +66,242 @@ export const LexicalEditor = (props)=>{
|
|
|
64
66
|
editor,
|
|
65
67
|
editorConfigContext
|
|
66
68
|
]);
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
69
|
+
return /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
70
|
+
children: [
|
|
71
|
+
editorConfig.features.plugins?.map((plugin)=>{
|
|
72
|
+
if (plugin.position === 'aboveContainer') {
|
|
73
|
+
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
74
|
+
clientProps: plugin.clientProps,
|
|
75
|
+
plugin: plugin
|
|
76
|
+
}, plugin.key, false, {
|
|
77
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
78
|
+
lineNumber: 94,
|
|
79
|
+
columnNumber: 18
|
|
80
|
+
}, this);
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
84
|
+
className: "editor-container",
|
|
85
|
+
ref: editorContainerRef,
|
|
86
|
+
children: [
|
|
87
|
+
editorConfig.features.plugins?.map((plugin)=>{
|
|
88
|
+
if (plugin.position === 'top') {
|
|
89
|
+
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
90
|
+
clientProps: plugin.clientProps,
|
|
91
|
+
plugin: plugin
|
|
92
|
+
}, plugin.key, false, {
|
|
93
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
94
|
+
lineNumber: 101,
|
|
95
|
+
columnNumber: 15
|
|
96
|
+
}, this);
|
|
97
|
+
}
|
|
98
|
+
}),
|
|
99
|
+
/*#__PURE__*/ _jsxDEV(RichTextPlugin, {
|
|
100
|
+
contentEditable: /*#__PURE__*/ _jsxDEV("div", {
|
|
101
|
+
className: "editor-scroller",
|
|
102
|
+
children: /*#__PURE__*/ _jsxDEV("div", {
|
|
103
|
+
className: "editor",
|
|
104
|
+
ref: onRef,
|
|
105
|
+
children: /*#__PURE__*/ _jsxDEV(LexicalContentEditable, {
|
|
106
|
+
editorConfig: editorConfig
|
|
107
|
+
}, void 0, false, {
|
|
108
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
109
|
+
lineNumber: 109,
|
|
110
|
+
columnNumber: 17
|
|
111
|
+
}, void 0)
|
|
112
|
+
}, void 0, false, {
|
|
113
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
114
|
+
lineNumber: 108,
|
|
115
|
+
columnNumber: 15
|
|
116
|
+
}, void 0)
|
|
117
|
+
}, void 0, false, {
|
|
118
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
119
|
+
lineNumber: 107,
|
|
120
|
+
columnNumber: 13
|
|
121
|
+
}, void 0),
|
|
122
|
+
ErrorBoundary: LexicalErrorBoundary
|
|
123
|
+
}, void 0, false, {
|
|
124
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
125
|
+
lineNumber: 105,
|
|
126
|
+
columnNumber: 9
|
|
127
|
+
}, this),
|
|
128
|
+
/*#__PURE__*/ _jsxDEV(NormalizeSelectionPlugin, {}, void 0, false, {
|
|
129
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
130
|
+
lineNumber: 115,
|
|
131
|
+
columnNumber: 9
|
|
132
|
+
}, this),
|
|
133
|
+
isEditable && /*#__PURE__*/ _jsxDEV(InsertParagraphAtEndPlugin, {}, void 0, false, {
|
|
134
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
135
|
+
lineNumber: 116,
|
|
136
|
+
columnNumber: 24
|
|
137
|
+
}, this),
|
|
138
|
+
/*#__PURE__*/ _jsxDEV(DecoratorPlugin, {}, void 0, false, {
|
|
139
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
140
|
+
lineNumber: 117,
|
|
141
|
+
columnNumber: 9
|
|
142
|
+
}, this),
|
|
143
|
+
/*#__PURE__*/ _jsxDEV(ClipboardPlugin, {}, void 0, false, {
|
|
144
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
145
|
+
lineNumber: 118,
|
|
146
|
+
columnNumber: 9
|
|
147
|
+
}, this),
|
|
148
|
+
/*#__PURE__*/ _jsxDEV(TextPlugin, {
|
|
149
|
+
features: editorConfig.features
|
|
150
|
+
}, void 0, false, {
|
|
151
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
152
|
+
lineNumber: 119,
|
|
153
|
+
columnNumber: 9
|
|
154
|
+
}, this),
|
|
155
|
+
/*#__PURE__*/ _jsxDEV(SelectAllPlugin, {}, void 0, false, {
|
|
156
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
157
|
+
lineNumber: 120,
|
|
158
|
+
columnNumber: 9
|
|
159
|
+
}, this),
|
|
160
|
+
/*#__PURE__*/ _jsxDEV(NodeViewOverridePlugin, {}, void 0, false, {
|
|
161
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
162
|
+
lineNumber: 121,
|
|
163
|
+
columnNumber: 9
|
|
164
|
+
}, this),
|
|
165
|
+
isEditable && /*#__PURE__*/ _jsxDEV(OnChangePlugin, {
|
|
166
|
+
// Selection changes can be ignored here, reducing the
|
|
167
|
+
// frequency that the FieldComponent and Payload receive updates.
|
|
168
|
+
// Selection changes are only needed if you are saving selection state
|
|
169
|
+
ignoreSelectionChange: true,
|
|
170
|
+
onChange: (editorState, editor, tags)=>{
|
|
171
|
+
// Ignore any onChange event triggered by focus only
|
|
172
|
+
if (!tags.has('focus') || tags.size > 1) {
|
|
173
|
+
if (onChange != null) {
|
|
174
|
+
onChange(editorState, editor, tags);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}, void 0, false, {
|
|
179
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
180
|
+
lineNumber: 123,
|
|
181
|
+
columnNumber: 11
|
|
182
|
+
}, this),
|
|
183
|
+
floatingAnchorElem && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
184
|
+
children: [
|
|
185
|
+
!isSmallWidthViewport && isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
186
|
+
children: [
|
|
187
|
+
editorConfig.admin?.hideDraggableBlockElement ? null : /*#__PURE__*/ _jsxDEV(DraggableBlockPlugin, {
|
|
188
|
+
anchorElem: floatingAnchorElem
|
|
189
|
+
}, void 0, false, {
|
|
190
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
191
|
+
lineNumber: 143,
|
|
192
|
+
columnNumber: 19
|
|
193
|
+
}, this),
|
|
194
|
+
editorConfig.admin?.hideAddBlockButton ? null : /*#__PURE__*/ _jsxDEV(AddBlockHandlePlugin, {
|
|
195
|
+
anchorElem: floatingAnchorElem
|
|
196
|
+
}, void 0, false, {
|
|
197
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
198
|
+
lineNumber: 146,
|
|
199
|
+
columnNumber: 19
|
|
200
|
+
}, this)
|
|
201
|
+
]
|
|
202
|
+
}, void 0, true, {
|
|
203
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
204
|
+
lineNumber: 141,
|
|
205
|
+
columnNumber: 15
|
|
206
|
+
}, this),
|
|
207
|
+
editorConfig.features.plugins?.map((plugin)=>{
|
|
208
|
+
if (plugin.position === 'floatingAnchorElem' && !(plugin.desktopOnly === true && isSmallWidthViewport)) {
|
|
209
|
+
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
210
|
+
anchorElem: floatingAnchorElem,
|
|
211
|
+
clientProps: plugin.clientProps,
|
|
212
|
+
plugin: plugin
|
|
213
|
+
}, plugin.key, false, {
|
|
214
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
215
|
+
lineNumber: 156,
|
|
216
|
+
columnNumber: 19
|
|
217
|
+
}, this);
|
|
218
|
+
}
|
|
219
|
+
}),
|
|
220
|
+
isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
221
|
+
children: /*#__PURE__*/ _jsxDEV(SlashMenuPlugin, {
|
|
222
|
+
anchorElem: floatingAnchorElem
|
|
223
|
+
}, void 0, false, {
|
|
224
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
225
|
+
lineNumber: 167,
|
|
226
|
+
columnNumber: 17
|
|
227
|
+
}, this)
|
|
228
|
+
}, void 0, false, {
|
|
229
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
230
|
+
lineNumber: 166,
|
|
231
|
+
columnNumber: 15
|
|
232
|
+
}, this)
|
|
233
|
+
]
|
|
234
|
+
}, void 0, true, {
|
|
235
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
236
|
+
lineNumber: 139,
|
|
237
|
+
columnNumber: 11
|
|
238
|
+
}, this),
|
|
239
|
+
isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
240
|
+
children: [
|
|
241
|
+
/*#__PURE__*/ _jsxDEV(HistoryPlugin, {}, void 0, false, {
|
|
242
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
243
|
+
lineNumber: 174,
|
|
244
|
+
columnNumber: 13
|
|
245
|
+
}, this),
|
|
246
|
+
editorConfig?.features?.markdownTransformers?.length > 0 && /*#__PURE__*/ _jsxDEV(MarkdownShortcutPlugin, {}, void 0, false, {
|
|
247
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
248
|
+
lineNumber: 175,
|
|
249
|
+
columnNumber: 74
|
|
250
|
+
}, this)
|
|
251
|
+
]
|
|
252
|
+
}, void 0, true, {
|
|
253
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
254
|
+
lineNumber: 173,
|
|
255
|
+
columnNumber: 11
|
|
256
|
+
}, this),
|
|
257
|
+
editorConfig.features.plugins?.map((plugin)=>{
|
|
258
|
+
if (plugin.position === 'normal') {
|
|
259
|
+
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
260
|
+
clientProps: plugin.clientProps,
|
|
261
|
+
plugin: plugin
|
|
262
|
+
}, plugin.key, false, {
|
|
263
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
264
|
+
lineNumber: 181,
|
|
265
|
+
columnNumber: 15
|
|
266
|
+
}, this);
|
|
267
|
+
}
|
|
268
|
+
}),
|
|
269
|
+
editorConfig.features.plugins?.map((plugin)=>{
|
|
270
|
+
if (plugin.position === 'bottom') {
|
|
271
|
+
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
272
|
+
clientProps: plugin.clientProps,
|
|
273
|
+
plugin: plugin
|
|
274
|
+
}, plugin.key, false, {
|
|
275
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
276
|
+
lineNumber: 188,
|
|
277
|
+
columnNumber: 15
|
|
278
|
+
}, this);
|
|
279
|
+
}
|
|
280
|
+
})
|
|
281
|
+
]
|
|
282
|
+
}, void 0, true, {
|
|
283
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
284
|
+
lineNumber: 97,
|
|
285
|
+
columnNumber: 7
|
|
286
|
+
}, this),
|
|
287
|
+
editorConfig.features.plugins?.map((plugin)=>{
|
|
288
|
+
if (plugin.position === 'belowContainer') {
|
|
289
|
+
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
290
|
+
clientProps: plugin.clientProps,
|
|
291
|
+
plugin: plugin
|
|
292
|
+
}, plugin.key, false, {
|
|
293
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
294
|
+
lineNumber: 195,
|
|
295
|
+
columnNumber: 18
|
|
296
|
+
}, this);
|
|
297
|
+
}
|
|
298
|
+
})
|
|
299
|
+
]
|
|
300
|
+
}, void 0, true, {
|
|
301
|
+
fileName: "src/lexical/LexicalEditor.tsx",
|
|
302
|
+
lineNumber: 91,
|
|
303
|
+
columnNumber: 5
|
|
304
|
+
}, this);
|
|
136
305
|
};
|
|
137
306
|
|
|
138
307
|
//# sourceMappingURL=LexicalEditor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","contentEditable","ErrorBoundary","ignoreSelectionChange","editorState","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","desktopOnly","markdownTransformers","length"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,OAAO,uBAAsB;AAC7B,SAASC,YAAY,QAAQ,oBAAmB;AAChD,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,oBAAoB,QAAQ,kDAAiD;AACtF,SAASC,0BAA0B,QAAQ,0CAAyC;AACpF,SAASC,sBAAsB,QAAQ,sCAAqC;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sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","onRef","_floatingAnchorElem","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","Fragment","features","plugins","map","plugin","position","clientProps","key","div","className","ref","contentEditable","ErrorBoundary","ignoreSelectionChange","editorState","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","desktopOnly","markdownTransformers","length"],"mappings":"AAAA;;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,oBAAoB,QAAQ,yCAAwC;AAC7E,SAASC,aAAa,QAAQ,yCAAwC;AACtE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,cAAc,QAAQ,0CAAyC;AACxE,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,UAAS;AAC3E,YAAYC,WAAW,QAAO;AAC9B,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAI3C,SAASC,sBAAsB,QAAQ,0CAAyC;AAChF,OAAO,uBAAsB;AAC7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ayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;gBACnC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,QAAC5C;wBAAa6C,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;;;;;gBACvE;YACF;;;;;;;AAGN,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LexicalProvider.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"LexicalProvider.d.ts","sourceRoot":"","sources":["../../src/lexical/LexicalProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAIhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAA;AAUpE,MAAM,MAAM,oBAAoB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,2BAA2B,CAAA;IACzC,UAAU,EAAE,yBAAyB,CAAA;IACrC,oBAAoB,EAAE,OAAO,CAAA;IAC7B,QAAQ,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,IAAI,CAAA;IACtF,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAwBD,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAqF1D,CAAA"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { LexicalComposer } from '@lexical/react/LexicalComposer.js';
|
|
3
4
|
import { useEditDepth } from '@payloadcms/ui';
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { useMemo } from 'react';
|
|
7
|
+
import { useRichTextView } from '../field/RichTextViewProvider.js';
|
|
6
8
|
import { EditorConfigProvider, useEditorConfigContext } from './config/client/EditorConfigProvider.js';
|
|
7
9
|
import { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js';
|
|
8
10
|
import { getEnabledNodes } from './nodes/index.js';
|
|
@@ -13,14 +15,32 @@ const NestProviders = ({ children, providers })=>// eslint-disable-next-line @ty
|
|
|
13
15
|
}
|
|
14
16
|
const Component = providers[0];
|
|
15
17
|
if (providers.length > 1) {
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
return /*#__PURE__*/ _jsxDEV(Component, {
|
|
19
|
+
children: /*#__PURE__*/ _jsxDEV(NestProviders, {
|
|
20
|
+
providers: providers.slice(1),
|
|
21
|
+
children: children
|
|
22
|
+
}, void 0, false, {
|
|
23
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
24
|
+
lineNumber: 46,
|
|
25
|
+
columnNumber: 9
|
|
26
|
+
}, this)
|
|
27
|
+
}, void 0, false, {
|
|
28
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
29
|
+
lineNumber: 45,
|
|
30
|
+
columnNumber: 7
|
|
31
|
+
}, this);
|
|
19
32
|
}
|
|
20
|
-
return
|
|
33
|
+
return /*#__PURE__*/ _jsxDEV(Component, {
|
|
34
|
+
children: children
|
|
35
|
+
}, void 0, false, {
|
|
36
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
37
|
+
lineNumber: 50,
|
|
38
|
+
columnNumber: 10
|
|
39
|
+
}, this);
|
|
21
40
|
};
|
|
22
41
|
export const LexicalProvider = (props)=>{
|
|
23
42
|
const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } = props;
|
|
43
|
+
const { currentView, views } = useRichTextView();
|
|
24
44
|
const parentContext = useEditorConfigContext();
|
|
25
45
|
const editDepth = useEditDepth();
|
|
26
46
|
const editorContainerRef = React.useRef(null);
|
|
@@ -35,12 +55,15 @@ export const LexicalProvider = (props)=>{
|
|
|
35
55
|
if (value && 'jsonContent' in value) {
|
|
36
56
|
throw new Error('You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical');
|
|
37
57
|
}
|
|
58
|
+
// Use the 'default' view if available, otherwise undefined
|
|
59
|
+
const nodeViews = views?.[currentView]?.nodes;
|
|
38
60
|
return {
|
|
39
61
|
editable: readOnly !== true,
|
|
40
62
|
editorState: value != null ? JSON.stringify(value) : undefined,
|
|
41
63
|
namespace: editorConfig.lexical.namespace,
|
|
42
64
|
nodes: getEnabledNodes({
|
|
43
|
-
editorConfig
|
|
65
|
+
editorConfig,
|
|
66
|
+
nodeViews
|
|
44
67
|
}),
|
|
45
68
|
onError: (error)=>{
|
|
46
69
|
throw error;
|
|
@@ -50,22 +73,58 @@ export const LexicalProvider = (props)=>{
|
|
|
50
73
|
}, // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will
|
|
51
74
|
// cause the editor to lose focus.
|
|
52
75
|
[
|
|
53
|
-
editorConfig
|
|
76
|
+
editorConfig,
|
|
77
|
+
views,
|
|
78
|
+
currentView
|
|
54
79
|
]);
|
|
55
80
|
if (!initialConfig) {
|
|
56
|
-
return
|
|
81
|
+
return /*#__PURE__*/ _jsxDEV("p", {
|
|
82
|
+
children: "Loading..."
|
|
83
|
+
}, void 0, false, {
|
|
84
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
85
|
+
lineNumber: 107,
|
|
86
|
+
columnNumber: 12
|
|
87
|
+
}, this);
|
|
57
88
|
}
|
|
58
89
|
// We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.
|
|
59
90
|
// Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.
|
|
60
|
-
|
|
61
|
-
|
|
91
|
+
// We also add currentView to force re-render when the view changes.
|
|
92
|
+
return /*#__PURE__*/ _jsxDEV(LexicalComposer, {
|
|
93
|
+
initialConfig: initialConfig,
|
|
94
|
+
children: /*#__PURE__*/ _jsxDEV(EditorConfigProvider, {
|
|
95
|
+
editorConfig: editorConfig,
|
|
96
|
+
editorContainerRef: editorContainerRef,
|
|
97
|
+
fieldProps: fieldProps,
|
|
98
|
+
/**
|
|
62
99
|
* Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.
|
|
63
|
-
*/ parentContext
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
100
|
+
*/ parentContext: parentContext?.editDepth === editDepth ? parentContext : undefined,
|
|
101
|
+
children: /*#__PURE__*/ _jsxDEV(NestProviders, {
|
|
102
|
+
providers: editorConfig.features.providers,
|
|
103
|
+
children: /*#__PURE__*/ _jsxDEV(LexicalEditorComponent, {
|
|
104
|
+
editorConfig: editorConfig,
|
|
105
|
+
editorContainerRef: editorContainerRef,
|
|
106
|
+
isSmallWidthViewport: isSmallWidthViewport,
|
|
107
|
+
onChange: onChange
|
|
108
|
+
}, void 0, false, {
|
|
109
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
110
|
+
lineNumber: 128,
|
|
111
|
+
columnNumber: 11
|
|
112
|
+
}, this)
|
|
113
|
+
}, void 0, false, {
|
|
114
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
115
|
+
lineNumber: 127,
|
|
116
|
+
columnNumber: 9
|
|
117
|
+
}, this)
|
|
118
|
+
}, void 0, false, {
|
|
119
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
120
|
+
lineNumber: 118,
|
|
121
|
+
columnNumber: 7
|
|
122
|
+
}, this)
|
|
123
|
+
}, composerKey + initialConfig.editable + currentView, false, {
|
|
124
|
+
fileName: "src/lexical/LexicalProvider.tsx",
|
|
125
|
+
lineNumber: 114,
|
|
126
|
+
columnNumber: 5
|
|
127
|
+
}, this);
|
|
69
128
|
};
|
|
70
129
|
|
|
71
130
|
//# sourceMappingURL=LexicalProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } =\n props\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({
|
|
1
|
+
{"version":3,"sources":["../../src/lexical/LexicalProvider.tsx"],"sourcesContent":["'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { useRichTextView } from '../field/RichTextViewProvider.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n composerKey: string\n editorConfig: SanitizedClientEditorConfig\n fieldProps: LexicalRichTextFieldProps\n isSmallWidthViewport: boolean\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({\n children,\n providers,\n}: {\n children: React.ReactNode\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n providers: any[]\n}) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } =\n props\n\n const { currentView, views } = useRichTextView()\n\n const parentContext = useEditorConfigContext()\n\n const editDepth = useEditDepth()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n // useMemo for the initialConfig that depends on readOnly and value\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (value && typeof value !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(value),\n )\n }\n\n if (value && Array.isArray(value) && !('root' in value)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (value && 'jsonContent' in value) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n // Use the 'default' view if available, otherwise undefined\n const nodeViews = views?.[currentView]?.nodes\n\n return {\n editable: readOnly !== true,\n editorState: value != null ? JSON.stringify(value) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: getEnabledNodes({\n editorConfig,\n nodeViews,\n }),\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n // Important: do not add readOnly and value to the dependencies array. This will cause the entire lexical editor to re-render if the document is saved, which will\n // cause the editor to lose focus.\n }, [editorConfig, views, currentView])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n // We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.\n // Without it, there were cases where lexical editors inside drawers turn readOnly initially - a few miliseconds later they turn editable, but the editor does not re-render and stays readOnly.\n // We also add currentView to force re-render when the view changes.\n return (\n <LexicalComposer\n initialConfig={initialConfig}\n key={composerKey + initialConfig.editable + currentView}\n >\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n fieldProps={fieldProps}\n /**\n * Parent editor is not truly the parent editor, if the current editor is part of a drawer and the parent editor is the main editor.\n */\n parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n isSmallWidthViewport={isSmallWidthViewport}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n"],"names":["LexicalComposer","useEditDepth","React","useMemo","useRichTextView","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","value","currentView","views","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","nodeViews","nodes","editable","editorState","undefined","namespace","lexical","onError","error","theme","p","features"],"mappings":"AAAA;;AAIA,SAASA,eAAe,QAAQ,o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ACR;QAEJ;QAEA,2DAA2D;QAC3D,MAAMK,YAAYX,OAAO,CAACD,YAAY,EAAEa;QAExC,OAAO;YACLC,UAAUhB,aAAa;YACvBiB,aAAahB,SAAS,OAAOS,KAAKC,SAAS,CAACV,SAASiB;YACrDC,WAAWvB,aAAawB,OAAO,CAACD,SAAS;YACzCJ,OAAO7B,gBAAgB;gBACrBU;gBACAkB;YACF;YACAO,SAAS,CAACC;gBACR,MAAMA;YACR;YACAC,OAAO3B,aAAawB,OAAO,CAACG,KAAK;QACnC;IAGF,GAFE,kKAAkK;IAClK,kCAAkC;IACjC;QAAC3B;QAAcO;QAAOD;KAAY;IAErC,IAAI,CAACM,eAAe;QAClB,qBAAO,QAACgB;sBAAE;;;;;;IACZ;IAEA,wGAAwG;IACxG,gMAAgM;IAChM,oEAAoE;IACpE,qBACE,QAAC/C;QACC+B,eAAeA;kBAGf,cAAA,QAAC1B;YACCc,cAAcA;YACdU,oBAAoBA;YACpBT,YAAYA;YACZ;;SAEC,GACDO,eAAeA,eAAeC,cAAcA,YAAYD,gBAAgBc;sBAExE,cAAA,QAAC/B;gBAAcE,WAAWO,aAAa6B,QAAQ,CAACpC,SAAS;0BACvD,cAAA,QAACJ;oBACCW,cAAcA;oBACdU,oBAAoBA;oBACpBR,sBAAsBA;oBACtBC,UAAUA;;;;;;;;;;;;;;;;OAhBXJ,cAAca,cAAcQ,QAAQ,GAAGd;;;;;AAsBlD,EAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
3
4
|
import { useEditDepth } from '@payloadcms/ui';
|
|
5
|
+
import * as React from 'react';
|
|
4
6
|
import { createContext, use, useMemo, useRef, useState } from 'react';
|
|
5
7
|
// Should always produce a 20 character pseudo-random string
|
|
6
8
|
function generateQuickGuid() {
|
|
@@ -9,7 +11,7 @@ function generateQuickGuid() {
|
|
|
9
11
|
// Editor focus handling
|
|
10
12
|
// Editor focus handling
|
|
11
13
|
// @ts-expect-error: TODO: Fix this
|
|
12
|
-
const Context = createContext({
|
|
14
|
+
const Context = /*#__PURE__*/ createContext({
|
|
13
15
|
editorConfig: null,
|
|
14
16
|
fieldProps: null,
|
|
15
17
|
uuid: null
|
|
@@ -85,7 +87,14 @@ export const EditorConfigProvider = ({ children, editorConfig, editorContainerRe
|
|
|
85
87
|
parentContext,
|
|
86
88
|
uuid
|
|
87
89
|
]);
|
|
88
|
-
return
|
|
90
|
+
return /*#__PURE__*/ _jsxDEV(Context, {
|
|
91
|
+
value: editorContext,
|
|
92
|
+
children: children
|
|
93
|
+
}, void 0, false, {
|
|
94
|
+
fileName: "src/lexical/config/client/EditorConfigProvider.tsx",
|
|
95
|
+
lineNumber: 143,
|
|
96
|
+
columnNumber: 10
|
|
97
|
+
}, this);
|
|
89
98
|
};
|
|
90
99
|
export const useEditorConfigContext = ()=>{
|
|
91
100
|
const context = use(Context);
|