@payloadcms/richtext-lexical 3.68.0-internal-debug.35482da → 3.68.0-internal-debug.e9b66ee
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 +2 -21
- package/dist/cell/rscEntry.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +13 -48
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +1 -10
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockEditButton.js +1 -7
- package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js +1 -7
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/component/index.js +81 -247
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +1 -9
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +1 -7
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +1 -7
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +1 -7
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +68 -217
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/getBlockImageComponent.js +4 -15
- package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +1 -12
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +2 -12
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +26 -127
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +49 -65
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +3 -16
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +4 -25
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/Component/index.js +2 -13
- package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +1 -8
- package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +1 -8
- package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +1 -6
- package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +1 -6
- package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js +10 -19
- package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js +16 -63
- package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +4 -19
- package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js +12 -45
- package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js +11 -57
- package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +7 -46
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/index.js +5 -12
- package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +3 -16
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js +38 -113
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.js +1 -15
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +79 -357
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +7 -41
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +9 -39
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +28 -59
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +0 -1
- package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/indent/client/IndentPlugin.js +1 -6
- package/dist/features/indent/client/IndentPlugin.js.map +1 -1
- package/dist/features/link/client/plugins/clickableLink/index.js +1 -7
- package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +59 -151
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -9
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/lists/checklist/client/plugin/index.js +1 -7
- package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
- package/dist/features/lists/plugin/index.js +1 -7
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +3 -18
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -9
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +3 -18
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -9
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +31 -100
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +4 -21
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/nodes/RelationshipNode.js +2 -12
- package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +1 -8
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/textState/feature.client.js +5 -22
- package/dist/features/textState/feature.client.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +27 -123
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +18 -111
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -14
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +56 -135
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +16 -70
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/upload/client/component/index.js +43 -167
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/component/pending/index.js +3 -16
- package/dist/features/upload/client/component/pending/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.js +4 -21
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +3 -17
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +2 -9
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +11 -54
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.js +18 -60
- package/dist/field/Diff/converters/relationship/index.js.map +1 -1
- package/dist/field/Diff/converters/unknown/index.js +7 -42
- package/dist/field/Diff/converters/unknown/index.js.map +1 -1
- package/dist/field/Diff/converters/upload/index.js +21 -91
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/Diff/index.js +4 -17
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Field.js +25 -124
- package/dist/field/Field.js.map +1 -1
- package/dist/field/RenderLexical/index.js +15 -47
- package/dist/field/RenderLexical/index.js.map +1 -1
- package/dist/field/index.js +5 -24
- package/dist/field/index.js.map +1 -1
- package/dist/field/rscEntry.js +1 -9
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/lexical/EditorPlugin.js +2 -17
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +69 -232
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.js +13 -64
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +2 -11
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +5 -28
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +1 -14
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +31 -98
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +7 -27
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +7 -45
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +3 -18
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/AI/index.js +10 -58
- package/dist/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js +4 -31
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js +5 -45
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js +5 -45
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js +5 -45
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js +5 -45
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js +5 -54
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js +3 -24
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js +3 -24
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js +4 -39
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js +4 -34
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +3 -22
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.js +3 -23
- package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js +3 -24
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js +3 -24
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +3 -24
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +3 -24
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +3 -24
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +3 -24
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js +3 -27
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js +6 -53
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js +6 -53
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.js +3 -26
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js +3 -24
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js +3 -25
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.js +5 -39
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js +7 -61
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js +10 -58
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js +4 -34
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js +3 -24
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js +3 -24
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +3 -24
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js +3 -24
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/TextState/index.js +12 -18
- package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js +4 -34
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js +8 -81
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +5 -48
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/lexical/utils/point.js.map +1 -1
- package/dist/lexical/utils/rect.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js +16 -41
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +10 -42
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +1 -9
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +3 -11
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
-
import React from 'react';
|
|
4
2
|
export const EditorPlugin = ({ anchorElem, clientProps, plugin })=>{
|
|
5
3
|
if (plugin.position === 'floatingAnchorElem' && anchorElem) {
|
|
6
|
-
return plugin.Component &&
|
|
7
|
-
anchorElem: anchorElem,
|
|
8
|
-
clientProps: clientProps
|
|
9
|
-
}, void 0, false, {
|
|
10
|
-
fileName: "src/lexical/EditorPlugin.tsx",
|
|
11
|
-
lineNumber: 13,
|
|
12
|
-
columnNumber: 27
|
|
13
|
-
}, this);
|
|
4
|
+
return plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps}/>;
|
|
14
5
|
}
|
|
15
6
|
// @ts-expect-error - ts is not able to infer that plugin.Component is of type PluginComponent
|
|
16
|
-
return plugin.Component &&
|
|
17
|
-
clientProps: clientProps
|
|
18
|
-
}, void 0, false, {
|
|
19
|
-
fileName: "src/lexical/EditorPlugin.tsx",
|
|
20
|
-
lineNumber: 18,
|
|
21
|
-
columnNumber: 30
|
|
22
|
-
}, this);
|
|
7
|
+
return plugin.Component && <plugin.Component clientProps={clientProps}/>;
|
|
23
8
|
};
|
|
24
9
|
|
|
25
10
|
//# sourceMappingURL=EditorPlugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lexical/EditorPlugin.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport type { SanitizedPlugin } from '../features/typesClient.js'\n\nexport const EditorPlugin: React.FC<{\n anchorElem?: HTMLDivElement\n clientProps: unknown\n plugin: SanitizedPlugin\n}> = ({ anchorElem, clientProps, plugin }) => {\n if (plugin.position === 'floatingAnchorElem' && anchorElem) {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\n // @ts-expect-error - ts is not able to infer that plugin.Component is of type PluginComponent\n return plugin.Component && <plugin.Component clientProps={clientProps} />\n}\n"],"names":["
|
|
1
|
+
{"version":3,"sources":["../../src/lexical/EditorPlugin.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport type { SanitizedPlugin } from '../features/typesClient.js'\n\nexport const EditorPlugin: React.FC<{\n anchorElem?: HTMLDivElement\n clientProps: unknown\n plugin: SanitizedPlugin\n}> = ({ anchorElem, clientProps, plugin }) => {\n if (plugin.position === 'floatingAnchorElem' && anchorElem) {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\n // @ts-expect-error - ts is not able to infer that plugin.Component is of type PluginComponent\n return plugin.Component && <plugin.Component clientProps={clientProps} />\n}\n"],"names":["EditorPlugin","anchorElem","clientProps","plugin","position","Component"],"mappings":"AAAA;AAKA,OAAO,MAAMA,eAIR,CAAC,EAAEC,UAAU,EAAEC,WAAW,EAAEC,MAAM,EAAE;IACvC,IAAIA,OAAOC,QAAQ,KAAK,wBAAwBH,YAAY;QAC1D,OACEE,OAAOE,SAAS,KAAKF,OAAOE,UAAUJ,YAAYA,YAAYC,aAAaA;IAE/E;IAEA,8FAA8F;IAC9F,OAAOC,OAAOE,SAAS,KAAKF,OAAOE,UAAUH,aAAaA;AAC5D,EAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
4
3
|
import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js';
|
|
5
4
|
import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js';
|
|
@@ -65,237 +64,75 @@ export const LexicalEditor = (props)=>{
|
|
|
65
64
|
editor,
|
|
66
65
|
editorConfigContext
|
|
67
66
|
]);
|
|
68
|
-
return
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
/*#__PURE__*/ _jsxDEV(DecoratorPlugin, {}, void 0, false, {
|
|
138
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
139
|
-
lineNumber: 116,
|
|
140
|
-
columnNumber: 9
|
|
141
|
-
}, this),
|
|
142
|
-
/*#__PURE__*/ _jsxDEV(ClipboardPlugin, {}, void 0, false, {
|
|
143
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
144
|
-
lineNumber: 117,
|
|
145
|
-
columnNumber: 9
|
|
146
|
-
}, this),
|
|
147
|
-
/*#__PURE__*/ _jsxDEV(TextPlugin, {
|
|
148
|
-
features: editorConfig.features
|
|
149
|
-
}, void 0, false, {
|
|
150
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
151
|
-
lineNumber: 118,
|
|
152
|
-
columnNumber: 9
|
|
153
|
-
}, this),
|
|
154
|
-
/*#__PURE__*/ _jsxDEV(SelectAllPlugin, {}, void 0, false, {
|
|
155
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
156
|
-
lineNumber: 119,
|
|
157
|
-
columnNumber: 9
|
|
158
|
-
}, this),
|
|
159
|
-
isEditable && /*#__PURE__*/ _jsxDEV(OnChangePlugin, {
|
|
160
|
-
// Selection changes can be ignored here, reducing the
|
|
161
|
-
// frequency that the FieldComponent and Payload receive updates.
|
|
162
|
-
// Selection changes are only needed if you are saving selection state
|
|
163
|
-
ignoreSelectionChange: true,
|
|
164
|
-
onChange: (editorState, editor, tags)=>{
|
|
165
|
-
// Ignore any onChange event triggered by focus only
|
|
166
|
-
if (!tags.has('focus') || tags.size > 1) {
|
|
167
|
-
if (onChange != null) {
|
|
168
|
-
onChange(editorState, editor, tags);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}, void 0, false, {
|
|
173
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
174
|
-
lineNumber: 121,
|
|
175
|
-
columnNumber: 11
|
|
176
|
-
}, this),
|
|
177
|
-
floatingAnchorElem && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
178
|
-
children: [
|
|
179
|
-
!isSmallWidthViewport && isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
180
|
-
children: [
|
|
181
|
-
editorConfig.admin?.hideDraggableBlockElement ? null : /*#__PURE__*/ _jsxDEV(DraggableBlockPlugin, {
|
|
182
|
-
anchorElem: floatingAnchorElem
|
|
183
|
-
}, void 0, false, {
|
|
184
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
185
|
-
lineNumber: 141,
|
|
186
|
-
columnNumber: 19
|
|
187
|
-
}, this),
|
|
188
|
-
editorConfig.admin?.hideAddBlockButton ? null : /*#__PURE__*/ _jsxDEV(AddBlockHandlePlugin, {
|
|
189
|
-
anchorElem: floatingAnchorElem
|
|
190
|
-
}, void 0, false, {
|
|
191
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
192
|
-
lineNumber: 144,
|
|
193
|
-
columnNumber: 19
|
|
194
|
-
}, this)
|
|
195
|
-
]
|
|
196
|
-
}, void 0, true, {
|
|
197
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
198
|
-
lineNumber: 139,
|
|
199
|
-
columnNumber: 15
|
|
200
|
-
}, this),
|
|
201
|
-
editorConfig.features.plugins?.map((plugin)=>{
|
|
202
|
-
if (plugin.position === 'floatingAnchorElem' && !(plugin.desktopOnly === true && isSmallWidthViewport)) {
|
|
203
|
-
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
204
|
-
anchorElem: floatingAnchorElem,
|
|
205
|
-
clientProps: plugin.clientProps,
|
|
206
|
-
plugin: plugin
|
|
207
|
-
}, plugin.key, false, {
|
|
208
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
209
|
-
lineNumber: 154,
|
|
210
|
-
columnNumber: 19
|
|
211
|
-
}, this);
|
|
212
|
-
}
|
|
213
|
-
}),
|
|
214
|
-
isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
215
|
-
children: /*#__PURE__*/ _jsxDEV(SlashMenuPlugin, {
|
|
216
|
-
anchorElem: floatingAnchorElem
|
|
217
|
-
}, void 0, false, {
|
|
218
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
219
|
-
lineNumber: 165,
|
|
220
|
-
columnNumber: 17
|
|
221
|
-
}, this)
|
|
222
|
-
}, void 0, false, {
|
|
223
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
224
|
-
lineNumber: 164,
|
|
225
|
-
columnNumber: 15
|
|
226
|
-
}, this)
|
|
227
|
-
]
|
|
228
|
-
}, void 0, true, {
|
|
229
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
230
|
-
lineNumber: 137,
|
|
231
|
-
columnNumber: 11
|
|
232
|
-
}, this),
|
|
233
|
-
isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
234
|
-
children: [
|
|
235
|
-
/*#__PURE__*/ _jsxDEV(HistoryPlugin, {}, void 0, false, {
|
|
236
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
237
|
-
lineNumber: 172,
|
|
238
|
-
columnNumber: 13
|
|
239
|
-
}, this),
|
|
240
|
-
editorConfig?.features?.markdownTransformers?.length > 0 && /*#__PURE__*/ _jsxDEV(MarkdownShortcutPlugin, {}, void 0, false, {
|
|
241
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
242
|
-
lineNumber: 173,
|
|
243
|
-
columnNumber: 74
|
|
244
|
-
}, this)
|
|
245
|
-
]
|
|
246
|
-
}, void 0, true, {
|
|
247
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
248
|
-
lineNumber: 171,
|
|
249
|
-
columnNumber: 11
|
|
250
|
-
}, this),
|
|
251
|
-
editorConfig.features.plugins?.map((plugin)=>{
|
|
252
|
-
if (plugin.position === 'normal') {
|
|
253
|
-
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
254
|
-
clientProps: plugin.clientProps,
|
|
255
|
-
plugin: plugin
|
|
256
|
-
}, plugin.key, false, {
|
|
257
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
258
|
-
lineNumber: 179,
|
|
259
|
-
columnNumber: 15
|
|
260
|
-
}, this);
|
|
261
|
-
}
|
|
262
|
-
}),
|
|
263
|
-
editorConfig.features.plugins?.map((plugin)=>{
|
|
264
|
-
if (plugin.position === 'bottom') {
|
|
265
|
-
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
266
|
-
clientProps: plugin.clientProps,
|
|
267
|
-
plugin: plugin
|
|
268
|
-
}, plugin.key, false, {
|
|
269
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
270
|
-
lineNumber: 186,
|
|
271
|
-
columnNumber: 15
|
|
272
|
-
}, this);
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
]
|
|
276
|
-
}, void 0, true, {
|
|
277
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
278
|
-
lineNumber: 96,
|
|
279
|
-
columnNumber: 7
|
|
280
|
-
}, this),
|
|
281
|
-
editorConfig.features.plugins?.map((plugin)=>{
|
|
282
|
-
if (plugin.position === 'belowContainer') {
|
|
283
|
-
return /*#__PURE__*/ _jsxDEV(EditorPlugin, {
|
|
284
|
-
clientProps: plugin.clientProps,
|
|
285
|
-
plugin: plugin
|
|
286
|
-
}, plugin.key, false, {
|
|
287
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
288
|
-
lineNumber: 193,
|
|
289
|
-
columnNumber: 18
|
|
290
|
-
}, this);
|
|
291
|
-
}
|
|
292
|
-
})
|
|
293
|
-
]
|
|
294
|
-
}, void 0, true, {
|
|
295
|
-
fileName: "src/lexical/LexicalEditor.tsx",
|
|
296
|
-
lineNumber: 90,
|
|
297
|
-
columnNumber: 5
|
|
298
|
-
}, this);
|
|
67
|
+
return <React.Fragment>
|
|
68
|
+
{editorConfig.features.plugins?.map((plugin)=>{
|
|
69
|
+
if (plugin.position === 'aboveContainer') {
|
|
70
|
+
return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin}/>;
|
|
71
|
+
}
|
|
72
|
+
})}
|
|
73
|
+
<div className="editor-container" ref={editorContainerRef}>
|
|
74
|
+
{editorConfig.features.plugins?.map((plugin)=>{
|
|
75
|
+
if (plugin.position === 'top') {
|
|
76
|
+
return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin}/>;
|
|
77
|
+
}
|
|
78
|
+
})}
|
|
79
|
+
<RichTextPlugin contentEditable={<div className="editor-scroller">
|
|
80
|
+
<div className="editor" ref={onRef}>
|
|
81
|
+
<LexicalContentEditable editorConfig={editorConfig}/>
|
|
82
|
+
</div>
|
|
83
|
+
</div>} ErrorBoundary={LexicalErrorBoundary}/>
|
|
84
|
+
<NormalizeSelectionPlugin/>
|
|
85
|
+
{isEditable && <InsertParagraphAtEndPlugin/>}
|
|
86
|
+
<DecoratorPlugin/>
|
|
87
|
+
<ClipboardPlugin/>
|
|
88
|
+
<TextPlugin features={editorConfig.features}/>
|
|
89
|
+
<SelectAllPlugin/>
|
|
90
|
+
{isEditable && <OnChangePlugin // Selection changes can be ignored here, reducing the
|
|
91
|
+
// frequency that the FieldComponent and Payload receive updates.
|
|
92
|
+
// Selection changes are only needed if you are saving selection state
|
|
93
|
+
ignoreSelectionChange onChange={(editorState, editor, tags)=>{
|
|
94
|
+
// Ignore any onChange event triggered by focus only
|
|
95
|
+
if (!tags.has('focus') || tags.size > 1) {
|
|
96
|
+
if (onChange != null) {
|
|
97
|
+
onChange(editorState, editor, tags);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}}/>}
|
|
101
|
+
{floatingAnchorElem && <React.Fragment>
|
|
102
|
+
{!isSmallWidthViewport && isEditable && <React.Fragment>
|
|
103
|
+
{editorConfig.admin?.hideDraggableBlockElement ? null : <DraggableBlockPlugin anchorElem={floatingAnchorElem}/>}
|
|
104
|
+
{editorConfig.admin?.hideAddBlockButton ? null : <AddBlockHandlePlugin anchorElem={floatingAnchorElem}/>}
|
|
105
|
+
</React.Fragment>}
|
|
106
|
+
{editorConfig.features.plugins?.map((plugin)=>{
|
|
107
|
+
if (plugin.position === 'floatingAnchorElem' && !(plugin.desktopOnly === true && isSmallWidthViewport)) {
|
|
108
|
+
return <EditorPlugin anchorElem={floatingAnchorElem} clientProps={plugin.clientProps} key={plugin.key} plugin={plugin}/>;
|
|
109
|
+
}
|
|
110
|
+
})}
|
|
111
|
+
{isEditable && <React.Fragment>
|
|
112
|
+
<SlashMenuPlugin anchorElem={floatingAnchorElem}/>
|
|
113
|
+
</React.Fragment>}
|
|
114
|
+
</React.Fragment>}
|
|
115
|
+
{isEditable && <React.Fragment>
|
|
116
|
+
<HistoryPlugin/>
|
|
117
|
+
{editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin/>}
|
|
118
|
+
</React.Fragment>}
|
|
119
|
+
{editorConfig.features.plugins?.map((plugin)=>{
|
|
120
|
+
if (plugin.position === 'normal') {
|
|
121
|
+
return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin}/>;
|
|
122
|
+
}
|
|
123
|
+
})}
|
|
124
|
+
{editorConfig.features.plugins?.map((plugin)=>{
|
|
125
|
+
if (plugin.position === 'bottom') {
|
|
126
|
+
return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin}/>;
|
|
127
|
+
}
|
|
128
|
+
})}
|
|
129
|
+
</div>
|
|
130
|
+
{editorConfig.features.plugins?.map((plugin)=>{
|
|
131
|
+
if (plugin.position === 'belowContainer') {
|
|
132
|
+
return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin}/>;
|
|
133
|
+
}
|
|
134
|
+
})}
|
|
135
|
+
</React.Fragment>;
|
|
299
136
|
};
|
|
300
137
|
|
|
301
138
|
//# 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;AAC5E,SAASC,wBAAwB,QAA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AayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;gCACnC,IACEA,OAAOC,QAAQ,KAAK,wBACpB,CAAED,CAAAA,OAAOkB,WAAW,KAAK,QAAQ5C,oBAAmB,GACpD;oCACA,qBACE,QAAChB;wCACC0D,YAAYrC;wCACZuB,aAAaF,OAAOE,WAAW;wCAE/BF,QAAQA;uCADHA,OAAOG,GAAG;;;;;gCAIrB;4BACF;4BACCzB,4BACC,QAACxB,MAAM0C,QAAQ;0CACb,cAAA,QAAC7B;oCAAgBiD,YAAYrC;;;;;;;;;;;;;;;;;oBAKpCD,4BACC,QAACxB,MAAM0C,QAAQ;;0CACb,QAACjD;;;;;4BACAyB,cAAcyB,UAAUsB,sBAAsBC,SAAS,mBAAK,QAACxD;;;;;;;;;;;oBAGjEQ,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;wBACnC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,QAAC3C;gCAAa4C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;;;;;wBAElE;oBACF;oBACC/B,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;wBACnC,IAAIA,OAAOC,QAAQ,KAAK,UAAU;4BAChC,qBACE,QAAC3C;gCAAa4C,aAAaF,OAAOE,WAAW;gCAAmBF,QAAQA;+BAApBA,OAAOG,GAAG;;;;;wBAElE;oBACF;;;;;;;YAED/B,aAAayB,QAAQ,CAACC,OAAO,EAAEC,IAAI,CAACC;gBACnC,IAAIA,OAAOC,QAAQ,KAAK,kBAAkB;oBACxC,qBAAO,QAAC3C;wBAAa4C,aAAaF,OAAOE,WAAW;wBAAmBF,QAAQA;uBAApBA,OAAOG,GAAG;;;;;gBACvE;YACF;;;;;;;AAGN,EAAC"}
|
|
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;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jF;IACF,GAAG;IACL,EAAE9C,MAAM0C;AAEZ,EAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { LexicalComposer } from '@lexical/react/LexicalComposer.js';
|
|
4
3
|
import { useEditDepth } from '@payloadcms/ui';
|
|
5
4
|
import * as React from 'react';
|
|
@@ -14,28 +13,11 @@ const NestProviders = ({ children, providers })=>// eslint-disable-next-line @ty
|
|
|
14
13
|
}
|
|
15
14
|
const Component = providers[0];
|
|
16
15
|
if (providers.length > 1) {
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
children: children
|
|
21
|
-
}, void 0, false, {
|
|
22
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
23
|
-
lineNumber: 45,
|
|
24
|
-
columnNumber: 9
|
|
25
|
-
}, this)
|
|
26
|
-
}, void 0, false, {
|
|
27
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
28
|
-
lineNumber: 44,
|
|
29
|
-
columnNumber: 7
|
|
30
|
-
}, this);
|
|
16
|
+
return <Component>
|
|
17
|
+
<NestProviders providers={providers.slice(1)}>{children}</NestProviders>
|
|
18
|
+
</Component>;
|
|
31
19
|
}
|
|
32
|
-
return
|
|
33
|
-
children: children
|
|
34
|
-
}, void 0, false, {
|
|
35
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
36
|
-
lineNumber: 49,
|
|
37
|
-
columnNumber: 10
|
|
38
|
-
}, this);
|
|
20
|
+
return <Component>{children}</Component>;
|
|
39
21
|
};
|
|
40
22
|
export const LexicalProvider = (props)=>{
|
|
41
23
|
const { composerKey, editorConfig, fieldProps, isSmallWidthViewport, onChange, readOnly, value } = props;
|
|
@@ -71,52 +53,19 @@ export const LexicalProvider = (props)=>{
|
|
|
71
53
|
editorConfig
|
|
72
54
|
]);
|
|
73
55
|
if (!initialConfig) {
|
|
74
|
-
return
|
|
75
|
-
children: "Loading..."
|
|
76
|
-
}, void 0, false, {
|
|
77
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
78
|
-
lineNumber: 98,
|
|
79
|
-
columnNumber: 12
|
|
80
|
-
}, this);
|
|
56
|
+
return <p>Loading...</p>;
|
|
81
57
|
}
|
|
82
58
|
// We need to add initialConfig.editable to the key to force a re-render when the readOnly prop changes.
|
|
83
59
|
// 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.
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
children: /*#__PURE__*/ _jsxDEV(EditorConfigProvider, {
|
|
87
|
-
editorConfig: editorConfig,
|
|
88
|
-
editorContainerRef: editorContainerRef,
|
|
89
|
-
fieldProps: fieldProps,
|
|
90
|
-
/**
|
|
60
|
+
return <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>
|
|
61
|
+
<EditorConfigProvider editorConfig={editorConfig} editorContainerRef={editorContainerRef} fieldProps={fieldProps} /**
|
|
91
62
|
* 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.
|
|
92
|
-
*/ parentContext
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
isSmallWidthViewport: isSmallWidthViewport,
|
|
99
|
-
onChange: onChange
|
|
100
|
-
}, void 0, false, {
|
|
101
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
102
|
-
lineNumber: 115,
|
|
103
|
-
columnNumber: 11
|
|
104
|
-
}, this)
|
|
105
|
-
}, void 0, false, {
|
|
106
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
107
|
-
lineNumber: 114,
|
|
108
|
-
columnNumber: 9
|
|
109
|
-
}, this)
|
|
110
|
-
}, void 0, false, {
|
|
111
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
112
|
-
lineNumber: 105,
|
|
113
|
-
columnNumber: 7
|
|
114
|
-
}, this)
|
|
115
|
-
}, composerKey + initialConfig.editable, false, {
|
|
116
|
-
fileName: "src/lexical/LexicalProvider.tsx",
|
|
117
|
-
lineNumber: 104,
|
|
118
|
-
columnNumber: 5
|
|
119
|
-
}, this);
|
|
63
|
+
*/ parentContext={parentContext?.editDepth === editDepth ? parentContext : undefined}>
|
|
64
|
+
<NestProviders providers={editorConfig.features.providers}>
|
|
65
|
+
<LexicalEditorComponent editorConfig={editorConfig} editorContainerRef={editorContainerRef} isSmallWidthViewport={isSmallWidthViewport} onChange={onChange}/>
|
|
66
|
+
</NestProviders>
|
|
67
|
+
</EditorConfigProvider>
|
|
68
|
+
</LexicalComposer>;
|
|
120
69
|
};
|
|
121
70
|
|
|
122
71
|
//# 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({ editorConfig }),\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])\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 return (\n <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>\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","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","value","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","editable","editorState","undefined","namespace","lexical","nodes","onError","error","theme","p","features"],"mappings":"AAAA
|
|
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({ editorConfig }),\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])\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 return (\n <LexicalComposer initialConfig={initialConfig} key={composerKey + initialConfig.editable}>\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","EditorConfigProvider","useEditorConfigContext","LexicalEditor","LexicalEditorComponent","getEnabledNodes","NestProviders","children","providers","length","Component","slice","LexicalProvider","props","composerKey","editorConfig","fieldProps","isSmallWidthViewport","onChange","readOnly","value","parentContext","editDepth","editorContainerRef","useRef","initialConfig","Error","JSON","stringify","Array","isArray","editable","editorState","undefined","namespace","lexical","nodes","onError","error","theme","p","key","features"],"mappings":"AAAA;AAIA,SAASA,eAAe,QAAQ,oCAAmC;AACnE,SAASC,YAAY,QAAQ,iBAAgB;AAC7C,YAAYC,WAAW,QAAO;AAC9B,SAASC,OAAO,QAAQ,QAAO;AAK/B,SACEC,oBAAoB,EACpBC,sBAAsB,QACjB,0CAAyC;AAChD,SAASC,iBAAiBC,sBAAsB,QAAQ,qBAAoB;AAC5E,SAASC,eAAe,QAAQ,mBAAkB;AAYlD,MAAMC,gBAAgB,CAAC,EACrBC,QAAQ,EACRC,SAAS,EAKV,GAFC,8DAA8D;;IAG9D,IAAI,CAACA,WAAWC,QAAQ;QACtB,OAAOF;IACT;IAC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AcW,cAAcM,QAAQ,EAAE;MACxF,CAAC9B,qBACCc,cAAcA,cACdQ,oBAAoBA,oBACpBP,YAAYA,YACZ;;SAEC,GACDK,eAAeA,eAAeC,cAAcA,YAAYD,gBAAgBY,WACzE;QACC,CAAC3B,cAAcE,WAAWO,aAAa2B,QAAQ,CAAClC,SAAS,EAAE;UACzD,CAACJ,uBACCW,cAAcA,cACdQ,oBAAoBA,oBACpBN,sBAAsBA,sBACtBC,UAAUA,WACV;QACJ,EAAEZ,cAAc;MAClB,EAAEL,qBAAqB;IACzB,EAAEJ;AAEN,EAAC"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
4
3
|
import { useEditDepth } from '@payloadcms/ui';
|
|
5
|
-
import * as React from 'react';
|
|
6
4
|
import { createContext, use, useMemo, useRef, useState } from 'react';
|
|
7
5
|
// Should always produce a 20 character pseudo-random string
|
|
8
6
|
function generateQuickGuid() {
|
|
@@ -11,7 +9,7 @@ function generateQuickGuid() {
|
|
|
11
9
|
// Editor focus handling
|
|
12
10
|
// Editor focus handling
|
|
13
11
|
// @ts-expect-error: TODO: Fix this
|
|
14
|
-
const Context =
|
|
12
|
+
const Context = createContext({
|
|
15
13
|
editorConfig: null,
|
|
16
14
|
fieldProps: null,
|
|
17
15
|
uuid: null
|
|
@@ -87,14 +85,7 @@ export const EditorConfigProvider = ({ children, editorConfig, editorContainerRe
|
|
|
87
85
|
parentContext,
|
|
88
86
|
uuid
|
|
89
87
|
]);
|
|
90
|
-
return
|
|
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);
|
|
88
|
+
return <Context value={editorContext}>{children}</Context>;
|
|
98
89
|
};
|
|
99
90
|
export const useEditorConfigContext = ()=>{
|
|
100
91
|
const context = use(Context);
|