@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';
|
|
3
4
|
import { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin';
|
|
4
5
|
import { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table';
|
|
@@ -12,7 +13,7 @@ import { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js';
|
|
|
12
13
|
import { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
|
|
13
14
|
import './index.scss';
|
|
14
15
|
export const OPEN_TABLE_DRAWER_COMMAND = createCommand('OPEN_EMBED_DRAWER_COMMAND');
|
|
15
|
-
export const CellContext = createContext({
|
|
16
|
+
export const CellContext = /*#__PURE__*/ createContext({
|
|
16
17
|
cellEditorConfig: null,
|
|
17
18
|
cellEditorPlugins: null,
|
|
18
19
|
set: ()=>{}
|
|
@@ -23,21 +24,26 @@ export function TableContext({ children }) {
|
|
|
23
24
|
cellEditorConfig: null,
|
|
24
25
|
cellEditorPlugins: null
|
|
25
26
|
});
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
27
|
+
return /*#__PURE__*/ _jsxDEV(CellContext, {
|
|
28
|
+
value: useMemo(()=>({
|
|
29
|
+
cellEditorConfig: contextValue.cellEditorConfig,
|
|
30
|
+
cellEditorPlugins: contextValue.cellEditorPlugins,
|
|
31
|
+
set: (cellEditorConfig, cellEditorPlugins)=>{
|
|
32
|
+
setContextValue({
|
|
33
|
+
cellEditorConfig,
|
|
34
|
+
cellEditorPlugins
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}), [
|
|
38
|
+
contextValue.cellEditorConfig,
|
|
39
|
+
contextValue.cellEditorPlugins
|
|
40
|
+
]),
|
|
41
|
+
children: children
|
|
42
|
+
}, void 0, false, {
|
|
43
|
+
fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
|
|
44
|
+
lineNumber: 67,
|
|
45
|
+
columnNumber: 5
|
|
46
|
+
}, this);
|
|
41
47
|
}
|
|
42
48
|
export const TablePlugin = ()=>{
|
|
43
49
|
const [editor] = useLexicalComposerContext();
|
|
@@ -75,18 +81,43 @@ export const TablePlugin = ()=>{
|
|
|
75
81
|
editor,
|
|
76
82
|
toggleDrawer
|
|
77
83
|
]);
|
|
78
|
-
return
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
return /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ _jsxDEV(FieldsDrawer, {
|
|
87
|
+
drawerSlug: drawerSlug,
|
|
88
|
+
drawerTitle: "Create Table",
|
|
89
|
+
featureKey: "experimental_table",
|
|
90
|
+
handleDrawerSubmit: (_fields, data)=>{
|
|
91
|
+
if (!data.columns || !data.rows) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
editor.dispatchCommand(INSERT_TABLE_COMMAND, {
|
|
95
|
+
columns: String(data.columns),
|
|
96
|
+
rows: String(data.rows)
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
schemaPath: schemaPath,
|
|
100
|
+
schemaPathSuffix: "fields"
|
|
101
|
+
}, void 0, false, {
|
|
102
|
+
fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
|
|
103
|
+
lineNumber: 131,
|
|
104
|
+
columnNumber: 7
|
|
105
|
+
}, this),
|
|
106
|
+
/*#__PURE__*/ _jsxDEV(LexicalReactTablePlugin, {
|
|
107
|
+
hasCellBackgroundColor: false,
|
|
108
|
+
hasCellMerge: true,
|
|
109
|
+
hasHorizontalScroll: true
|
|
110
|
+
}, void 0, false, {
|
|
111
|
+
fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
|
|
112
|
+
lineNumber: 148,
|
|
113
|
+
columnNumber: 7
|
|
114
|
+
}, this)
|
|
115
|
+
]
|
|
116
|
+
}, void 0, true, {
|
|
117
|
+
fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
|
|
118
|
+
lineNumber: 130,
|
|
119
|
+
columnNumber: 5
|
|
120
|
+
}, this);
|
|
90
121
|
};
|
|
91
122
|
|
|
92
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TablePlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n EditorThemeClasses,\n Klass,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n RangeSelection,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin'\nimport { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { mergeRegister } from '@lexical/utils'\nimport { formatDrawerSlug, useEditDepth } from '@payloadcms/ui'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport { createContext, use, useEffect, useMemo, useState } from 'react'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport './index.scss'\n\nexport type CellContextShape = {\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n set: (\n cellEditorConfig: CellEditorConfig | null,\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null,\n ) => void\n}\n\nexport type CellEditorConfig = Readonly<{\n namespace: string\n nodes?: ReadonlyArray<Klass<LexicalNode>>\n onError: (error: Error, editor: LexicalEditor) => void\n readOnly?: boolean\n theme?: EditorThemeClasses\n}>\n\nexport const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}> = createCommand(\n 'OPEN_EMBED_DRAWER_COMMAND',\n)\n\nexport const CellContext = createContext<CellContextShape>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n set: () => {\n // Empty\n },\n})\n\nexport function TableContext({ children }: { children: JSX.Element }) {\n const [contextValue, setContextValue] = useState<{\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n }>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n })\n return (\n <CellContext\n value={useMemo(\n () => ({\n cellEditorConfig: contextValue.cellEditorConfig,\n cellEditorPlugins: contextValue.cellEditorPlugins,\n set: (cellEditorConfig, cellEditorPlugins) => {\n setContextValue({ cellEditorConfig, cellEditorPlugins })\n },\n }),\n [contextValue.cellEditorConfig, contextValue.cellEditorPlugins],\n )}\n >\n {children}\n </CellContext>\n )\n}\n\nexport const TablePlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const cellContext = use(CellContext)\n const editDepth = useEditDepth()\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n\n const drawerSlug = formatDrawerSlug({\n slug: 'lexical-table-create-' + uuid,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n useEffect(() => {\n if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {\n throw new Error(\n 'TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor',\n )\n }\n\n return mergeRegister(\n editor.registerCommand(\n OPEN_TABLE_DRAWER_COMMAND,\n () => {\n let rangeSelection: null | RangeSelection = null\n\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n rangeSelection = selection\n }\n })\n\n if (rangeSelection) {\n toggleDrawer()\n }\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [cellContext, editor, toggleDrawer])\n\n return (\n <React.Fragment>\n <FieldsDrawer\n drawerSlug={drawerSlug}\n drawerTitle=\"Create Table\"\n featureKey=\"experimental_table\"\n handleDrawerSubmit={(_fields, data) => {\n if (!data.columns || !data.rows) {\n return\n }\n\n editor.dispatchCommand(INSERT_TABLE_COMMAND, {\n columns: String(data.columns),\n rows: String(data.rows),\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n <LexicalReactTablePlugin\n hasCellBackgroundColor={false}\n hasCellMerge\n hasHorizontalScroll={true}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","TablePlugin","LexicalReactTablePlugin","INSERT_TABLE_COMMAND","TableCellNode","TableNode","TableRowNode","mergeRegister","formatDrawerSlug","useEditDepth","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","createContext","use","useEffect","useMemo","useState","React","useEditorConfigContext","FieldsDrawer","useLexicalDrawer","OPEN_TABLE_DRAWER_COMMAND","CellContext","cellEditorConfig","cellEditorPlugins","set","TableContext","children","contextValue","setContextValue","value","editor","cellContext","editDepth","fieldProps","schemaPath","uuid","drawerSlug","slug","depth","toggleDrawer","hasNodes","Error","registerCommand","rangeSelection","getEditorState","read","selection","Fragment","drawerTitle","featureKey","handleDrawerSubmit","_fields","data","columns","rows","dispatchCommand","String","schemaPathSuffix","hasCellBackgroundColor","hasCellMerge","hasHorizontalScroll"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TablePlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n EditorThemeClasses,\n Klass,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n RangeSelection,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin'\nimport { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { mergeRegister } from '@lexical/utils'\nimport { formatDrawerSlug, useEditDepth } from '@payloadcms/ui'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport { createContext, use, useEffect, useMemo, useState } from 'react'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport './index.scss'\n\nexport type CellContextShape = {\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n set: (\n cellEditorConfig: CellEditorConfig | null,\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null,\n ) => void\n}\n\nexport type CellEditorConfig = Readonly<{\n namespace: string\n nodes?: ReadonlyArray<Klass<LexicalNode>>\n onError: (error: Error, editor: LexicalEditor) => void\n readOnly?: boolean\n theme?: EditorThemeClasses\n}>\n\nexport const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}> = createCommand(\n 'OPEN_EMBED_DRAWER_COMMAND',\n)\n\nexport const CellContext = createContext<CellContextShape>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n set: () => {\n // Empty\n },\n})\n\nexport function TableContext({ children }: { children: JSX.Element }) {\n const [contextValue, setContextValue] = useState<{\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n }>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n })\n return (\n <CellContext\n value={useMemo(\n () => ({\n cellEditorConfig: contextValue.cellEditorConfig,\n cellEditorPlugins: contextValue.cellEditorPlugins,\n set: (cellEditorConfig, cellEditorPlugins) => {\n setContextValue({ cellEditorConfig, cellEditorPlugins })\n },\n }),\n [contextValue.cellEditorConfig, contextValue.cellEditorPlugins],\n )}\n >\n {children}\n </CellContext>\n )\n}\n\nexport const TablePlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const cellContext = use(CellContext)\n const editDepth = useEditDepth()\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n\n const drawerSlug = formatDrawerSlug({\n slug: 'lexical-table-create-' + uuid,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n useEffect(() => {\n if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {\n throw new Error(\n 'TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor',\n )\n }\n\n return mergeRegister(\n editor.registerCommand(\n OPEN_TABLE_DRAWER_COMMAND,\n () => {\n let rangeSelection: null | RangeSelection = null\n\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n rangeSelection = selection\n }\n })\n\n if (rangeSelection) {\n toggleDrawer()\n }\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [cellContext, editor, toggleDrawer])\n\n return (\n <React.Fragment>\n <FieldsDrawer\n drawerSlug={drawerSlug}\n drawerTitle=\"Create Table\"\n featureKey=\"experimental_table\"\n handleDrawerSubmit={(_fields, data) => {\n if (!data.columns || !data.rows) {\n return\n }\n\n editor.dispatchCommand(INSERT_TABLE_COMMAND, {\n columns: String(data.columns),\n rows: String(data.rows),\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n <LexicalReactTablePlugin\n hasCellBackgroundColor={false}\n hasCellMerge\n hasHorizontalScroll={true}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","TablePlugin","LexicalReactTablePlugin","INSERT_TABLE_COMMAND","TableCellNode","TableNode","TableRowNode","mergeRegister","formatDrawerSlug","useEditDepth","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","createContext","use","useEffect","useMemo","useState","React","useEditorConfigContext","FieldsDrawer","useLexicalDrawer","OPEN_TABLE_DRAWER_COMMAND","CellContext","cellEditorConfig","cellEditorPlugins","set","TableContext","children","contextValue","setContextValue","value","editor","cellContext","editDepth","fieldProps","schemaPath","uuid","drawerSlug","slug","depth","toggleDrawer","hasNodes","Error","registerCommand","rangeSelection","getEditorState","read","selection","Fragment","drawerTitle","featureKey","handleDrawerSubmit","_fields","data","columns","rows","dispatchCommand","String","schemaPathSuffix","hasCellBackgroundColor","hasCellMerge","hasHorizontalScroll"],"mappings":"AAAA;;AAYA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,eAAeC,uBAAuB,QAAQ,oCAAmC;AAC1F,SAASC,oBAAoB,EAAEC,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AAC7F,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,iBAAgB;AAC/D,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,uBAAuB,EAAEC,aAAa,QAAQ,UAAS;AAClG,SAASC,aAAa,EAAEC,GAAG,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACxE,YAAYC,WAAW,QAAO;AAI9B,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,YAAY,QAAQ,kDAAiD;AAC9E,SAASC,gBAAgB,QAAQ,4DAA2D;AAC5F,OAAO,eAAc;AAmBrB,OAAO,MAAMC,4BAAgDV,cAC3D,6BACD;AAED,OAAO,MAAMW,4BAAcV,cAAgC;IACzDW,kBAAkB;IAClBC,mBAAmB;IACnBC,KAAK,KAEL;AACF,GAAE;AAFE,QAAQ;AAIZ,OAAO,SAASC,aAAa,EAAEC,QAAQ,EAA6B;IAClE,MAAM,CAACC,cAAcC,gBAAgB,GAAGb,SAGrC;QACDO,kBAAkB;QAClBC,mBAAmB;IACrB;IACA,qBACE,QAACF;QACCQ,OAAOf,QACL,IAAO,CAAA;gBACLQ,kBAAkBK,aAAaL,gBAAgB;gBAC/CC,mBAAmBI,aAAaJ,iBAAiB;gBACjDC,KAAK,CAACF,kBAAkBC;oBACtBK,gBAAgB;wBAAEN;wBAAkBC;oBAAkB;gBACxD;YACF,CAAA,GACA;YAACI,aAAaL,gBAAgB;YAAEK,aAAaJ,iBAAiB;SAAC;kBAGhEG;;;;;;AAGP;AAEA,OAAO,MAAM5B,cAA+B;IAC1C,MAAM,CAACgC,OAAO,GAAGjC;IACjB,MAAMkC,cAAcnB,IAAIS;IACxB,MAAMW,YAAY1B;IAClB,MAAM,EACJ2B,YAAY,EAAEC,UAAU,EAAE,EAC1BC,IAAI,EACL,GAAGlB;IAEJ,MAAMmB,aAAa/B,iBAAiB;QAClCgC,MAAM,0BAA0BF;QAChCG,OAAON;IACT;IACA,MAAM,EAAEO,YAAY,EAAE,GAAGpB,iBAAiBiB,YAAY;IAEtDvB,UAAU;QACR,IAAI,CAACiB,OAAOU,QAAQ,CAAC;YAACtC;YAAWC;YAAcF;SAAc,GAAG;YAC9D,MAAM,IAAIwC,MACR;QAEJ;QAEA,OAAOrC,cACL0B,OAAOY,eAAe,CACpBtB,2BACA;YACE,IAAIuB,iBAAwC;YAE5Cb,OAAOc,cAAc,GAAGC,IAAI,CAAC;gBAC3B,MAAMC,YAAYvC;gBAClB,IAAIC,kBAAkBsC,YAAY;oBAChCH,iBAAiBG;gBACnB;YACF;YAEA,IAAIH,gBAAgB;gBAClBJ;YACF;YACA,OAAO;QACT,GACA9B;IAGN,GAAG;QAACsB;QAAaD;QAAQS;KAAa;IAEtC,qBACE,QAACvB,MAAM+B,QAAQ;;0BACb,QAAC7B;gBACCkB,YAAYA;gBACZY,aAAY;gBACZC,YAAW;gBACXC,oBAAoB,CAACC,SAASC;oBAC5B,IAAI,CAACA,KAAKC,OAAO,IAAI,CAACD,KAAKE,IAAI,EAAE;wBAC/B;oBACF;oBAEAxB,OAAOyB,eAAe,CAACvD,sBAAsB;wBAC3CqD,SAASG,OAAOJ,KAAKC,OAAO;wBAC5BC,MAAME,OAAOJ,KAAKE,IAAI;oBACxB;gBACF;gBACApB,YAAYA;gBACZuB,kBAAiB;;;;;;0BAEnB,QAAC1D;gBACC2D,wBAAwB;gBACxBC,YAAY;gBACZC,qBAAqB;;;;;;;;;;;;AAI7B,EAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { $applyNodeReplacement } from 'lexical';
|
|
3
|
+
import * as React from 'react';
|
|
3
4
|
import { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js';
|
|
4
5
|
export class HorizontalRuleNode extends HorizontalRuleServerNode {
|
|
5
6
|
static clone(node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"names":["$applyNodeReplacement","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,UAAS;
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx"],"sourcesContent":["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static override clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static override importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n override decorate() {\n return null\n }\n\n override exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n"],"names":["$applyNodeReplacement","React","HorizontalRuleServerNode","HorizontalRuleNode","clone","node","getType","importJSON","serializedNode","$createHorizontalRuleNode","decorate","exportJSON","$convertHorizontalRuleElement","$isHorizontalRuleNode"],"mappings":"AAAA;AAGA,SAASA,qBAAqB,QAAQ,UAAS;AAC/C,YAAYC,WAAW,QAAO;AAI9B,SAASC,wBAAwB,QAAQ,2CAA0C;AAEnF,OAAO,MAAMC,2BAA2BD;IACtC,OAAgBE,MAAMC,IAA8B,EAA4B;QAC9E,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA;;GAEC,GACD,OAAgBC,WAAWC,cAA4C,EAAsB;QAC3F,OAAOC;IACT;IAEA;;GAEC,GACD,AAASC,WAAW;QAClB,OAAO;IACT;IAESC,aAAoC;QAC3C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,SAASC;IACP,OAAO;QAAEP,MAAMI;IAA4B;AAC7C;AAEA,OAAO,SAASA;IACd,OAAOT,sBAAsB,IAAIG;AACnC;AAEA,OAAO,SAASU,sBACdR,IAAoC;IAEpC,OAAOA,gBAAgBF;AACzB"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
1
2
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
|
|
2
3
|
import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin';
|
|
3
4
|
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
@@ -55,7 +56,11 @@ export const IndentPlugin = ({ clientProps })=>{
|
|
|
55
56
|
editor,
|
|
56
57
|
disableTabNode
|
|
57
58
|
]);
|
|
58
|
-
return
|
|
59
|
+
return /*#__PURE__*/ _jsxDEV(TabIndentationPlugin, {}, void 0, false, {
|
|
60
|
+
fileName: "src/features/indent/client/IndentPlugin.tsx",
|
|
61
|
+
lineNumber: 87,
|
|
62
|
+
columnNumber: 10
|
|
63
|
+
}, this);
|
|
59
64
|
};
|
|
60
65
|
function $handleIndentAndOutdent(indentOrOutdent) {
|
|
61
66
|
const selection = $getSelection();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n KEY_TAB_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n TabNode,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes, disableTabNode } = clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n // If we disable indenting for certain nodes, we need to ensure that these are not indented,\n // if they get transformed from an indented state (e.g. an indented list node gets transformed into a\n // paragraph node for which indenting is disabled).\n editor.registerUpdateListener(({ dirtyElements, editorState }) => {\n editor.update(() => {\n for (const [nodeKey] of dirtyElements) {\n const node = editorState._nodeMap.get(nodeKey)\n if ($isElementNode(node) && disabledNodes.includes(node.getType())) {\n const currentIndent = node.getIndent()\n if (currentIndent > 0) {\n node.setIndent(0)\n }\n }\n }\n })\n }),\n )\n }, [editor, disabledNodes])\n\n useEffect(() => {\n if (!editor || !disableTabNode) {\n return\n }\n return mergeRegister(\n // This is so that when you press Tab in the middle of a paragraph,\n // it indents the paragraph, instead of inserting a TabNode.\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault()\n return editor.dispatchCommand(\n event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND,\n undefined,\n )\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Tab isn't the only way to insert a TabNode. We have to make sure\n // it doesn't happen, for example, when pasting from the clipboard.\n editor.registerNodeTransform(TabNode, (node) => {\n node.remove()\n }),\n )\n }, [editor, disableTabNode])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","KEY_TAB_COMMAND","OUTDENT_CONTENT_COMMAND","TabNode","useEffect","IndentPlugin","clientProps","editor","disabledNodes","disableTabNode","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","registerUpdateListener","dirtyElements","editorState","update","nodeKey","node","_nodeMap","get","currentIndent","event","preventDefault","dispatchCommand","shiftKey","undefined","registerNodeTransform","remove","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,QAAQ,6CAA4C;AACjF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,eAAe,EACfC,uBAAuB,EACvBC,OAAO,QACF,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAKjC,OAAO,MAAMC,eAAoD,CAAC,EAAEC,WAAW,EAAE;IAC/E,MAAM,CAACC,OAAO,GAAGf;IACjB,MAAM,EAAEgB,aAAa,EAAEC,cAAc,EAAE,GAAGH;IAE1CF,UAAU;QACR,IAAI,CAACG,UAAU,CAACC,eAAeE,QAAQ;YACrC;QACF;QACA,OAAOf,cACLY,OAAOI,eAAe,CACpBX,wBACA;YACE,OAAOY,wBAAwB,CAACC;gBAC9B,IAAI,CAACL,cAAcM,QAAQ,CAACD,MAAME,OAAO,KAAK;oBAC5C,MAAMC,SAASH,MAAMI,SAAS;oBAC9BJ,MAAMK,SAAS,CAACF,SAAS;gBAC3B;YACF;QACF,GACAjB,uBAEF,4FAA4F;QAC5F,qGAAqG;QACrG,mDAAmD;QACnDQ,OAAOY,sBAAsB,CAAC,CAAC,EAAEC,aAAa,EAAEC,WAAW,EAAE;YAC3Dd,OAAOe,MAAM,CAAC;gBACZ,KAAK,MAAM,CAACC,QAAQ,IAAIH,cAAe;oBACrC,MAAMI,OAAOH,YAAYI,QAAQ,CAACC,GAAG,CAACH;oBACtC,IAAI1B,eAAe2B,SAAShB,cAAcM,QAAQ,CAACU,KAAKT,OAAO,KAAK;wBAClE,MAAMY,gBAAgBH,KAAKP,SAAS;wBACpC,IAAIU,gBAAgB,GAAG;4BACrBH,KAAKN,SAAS,CAAC;wBACjB;oBACF;gBACF;YACF;QACF;IAEJ,GAAG;QAACX;QAAQC;KAAc;IAE1BJ,UAAU;QACR,IAAI,CAACG,UAAU,CAACE,gBAAgB;YAC9B;QACF;QACA,OAAOd,cACL,mEAAmE;QACnE,4DAA4D;QAC5DY,OAAOI,eAAe,CACpBV,iBACA,CAAC2B;YACCA,MAAMC,cAAc;YACpB,OAAOtB,OAAOuB,eAAe,CAC3BF,MAAMG,QAAQ,GAAG7B,0BAA0BF,wBAC3CgC;QAEJ,GACAjC,uBAEF,mEAAmE;QACnE,mEAAmE;QACnEQ,OAAO0B,qBAAqB,CAAC9B,SAAS,CAACqB;YACrCA,KAAKU,MAAM;QACb;IAEJ,GAAG;QAAC3B;QAAQE;KAAe;IAE3B,
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n KEY_TAB_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n TabNode,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes, disableTabNode } = clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n // If we disable indenting for certain nodes, we need to ensure that these are not indented,\n // if they get transformed from an indented state (e.g. an indented list node gets transformed into a\n // paragraph node for which indenting is disabled).\n editor.registerUpdateListener(({ dirtyElements, editorState }) => {\n editor.update(() => {\n for (const [nodeKey] of dirtyElements) {\n const node = editorState._nodeMap.get(nodeKey)\n if ($isElementNode(node) && disabledNodes.includes(node.getType())) {\n const currentIndent = node.getIndent()\n if (currentIndent > 0) {\n node.setIndent(0)\n }\n }\n }\n })\n }),\n )\n }, [editor, disabledNodes])\n\n useEffect(() => {\n if (!editor || !disableTabNode) {\n return\n }\n return mergeRegister(\n // This is so that when you press Tab in the middle of a paragraph,\n // it indents the paragraph, instead of inserting a TabNode.\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault()\n return editor.dispatchCommand(\n event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND,\n undefined,\n )\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Tab isn't the only way to insert a TabNode. We have to make sure\n // it doesn't happen, for example, when pasting from the clipboard.\n editor.registerNodeTransform(TabNode, (node) => {\n node.remove()\n }),\n )\n }, [editor, disableTabNode])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","KEY_TAB_COMMAND","OUTDENT_CONTENT_COMMAND","TabNode","useEffect","IndentPlugin","clientProps","editor","disabledNodes","disableTabNode","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","registerUpdateListener","dirtyElements","editorState","update","nodeKey","node","_nodeMap","get","currentIndent","event","preventDefault","dispatchCommand","shiftKey","undefined","registerNodeTransform","remove","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"mappings":";AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,QAAQ,6CAA4C;AACjF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,eAAe,EACfC,uBAAuB,EACvBC,OAAO,QACF,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAKjC,OAAO,MAAMC,eAAoD,CAAC,EAAEC,WAAW,EAAE;IAC/E,MAAM,CAACC,OAAO,GAAGf;IACjB,MAAM,EAAEgB,aAAa,EAAEC,cAAc,EAAE,GAAGH;IAE1CF,UAAU;QACR,IAAI,CAACG,UAAU,CAACC,eAAeE,QAAQ;YACrC;QACF;QACA,OAAOf,cACLY,OAAOI,eAAe,CACpBX,wBACA;YACE,OAAOY,wBAAwB,CAACC;gBAC9B,IAAI,CAACL,cAAcM,QAAQ,CAACD,MAAME,OAAO,KAAK;oBAC5C,MAAMC,SAASH,MAAMI,SAAS;oBAC9BJ,MAAMK,SAAS,CAACF,SAAS;gBAC3B;YACF;QACF,GACAjB,uBAEF,4FAA4F;QAC5F,qGAAqG;QACrG,mDAAmD;QACnDQ,OAAOY,sBAAsB,CAAC,CAAC,EAAEC,aAAa,EAAEC,WAAW,EAAE;YAC3Dd,OAAOe,MAAM,CAAC;gBACZ,KAAK,MAAM,CAACC,QAAQ,IAAIH,cAAe;oBACrC,MAAMI,OAAOH,YAAYI,QAAQ,CAACC,GAAG,CAACH;oBACtC,IAAI1B,eAAe2B,SAAShB,cAAcM,QAAQ,CAACU,KAAKT,OAAO,KAAK;wBAClE,MAAMY,gBAAgBH,KAAKP,SAAS;wBACpC,IAAIU,gBAAgB,GAAG;4BACrBH,KAAKN,SAAS,CAAC;wBACjB;oBACF;gBACF;YACF;QACF;IAEJ,GAAG;QAACX;QAAQC;KAAc;IAE1BJ,UAAU;QACR,IAAI,CAACG,UAAU,CAACE,gBAAgB;YAC9B;QACF;QACA,OAAOd,cACL,mEAAmE;QACnE,4DAA4D;QAC5DY,OAAOI,eAAe,CACpBV,iBACA,CAAC2B;YACCA,MAAMC,cAAc;YACpB,OAAOtB,OAAOuB,eAAe,CAC3BF,MAAMG,QAAQ,GAAG7B,0BAA0BF,wBAC3CgC;QAEJ,GACAjC,uBAEF,mEAAmE;QACnE,mEAAmE;QACnEQ,OAAO0B,qBAAqB,CAAC9B,SAAS,CAACqB;YACrCA,KAAKU,MAAM;QACb;IAEJ,GAAG;QAAC3B;QAAQE;KAAe;IAE3B,qBAAO,QAAChB;;;;;AACV,EAAC;AAED,SAASmB,wBAAwBuB,eAA6C;IAC5E,MAAMC,YAAYxC;IAClB,IAAI,CAACE,kBAAkBsC,YAAY;QACjC,OAAO;IACT;IACA,MAAMC,iBAAiB,IAAIC;IAC3B,MAAMC,QAAQH,UAAUI,QAAQ;IAChC,IAAK,IAAIC,IAAI,GAAGA,IAAIF,MAAM7B,MAAM,EAAE+B,IAAK;QACrC,MAAMjB,OAAOe,KAAK,CAACE,EAAE;QACrB,MAAMC,MAAMlB,KAAKmB,MAAM;QACvB,IAAIN,eAAeO,GAAG,CAACF,MAAM;YAC3B;QACF;QACA,MAAMG,cAAcnD,oBAClB8B,MACA,CAACsB,aACCjD,eAAeiD,eAAe,CAACA,WAAWC,QAAQ;QAEtD,IAAIF,gBAAgB,MAAM;YACxB;QACF;QACA,MAAMG,YAAYH,YAAYF,MAAM;QACpC,IAAIE,YAAYI,SAAS,MAAM,CAACZ,eAAeO,GAAG,CAACI,YAAY;YAC7DX,eAAea,GAAG,CAACF;YACnBb,gBAAgBU;QAClB;IACF;IACA,OAAOR,eAAec,IAAI,GAAG;AAC/B"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js';
|
|
4
|
+
import React from 'react';
|
|
3
5
|
export const ClickableLinkPlugin = ()=>{
|
|
4
|
-
return
|
|
6
|
+
return /*#__PURE__*/ _jsxDEV(LexicalClickableLinkPlugin, {}, void 0, false, {
|
|
7
|
+
fileName: "src/features/link/client/plugins/clickableLink/index.tsx",
|
|
8
|
+
lineNumber: 9,
|
|
9
|
+
columnNumber: 10
|
|
10
|
+
}, this);
|
|
5
11
|
};
|
|
6
12
|
|
|
7
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/link/client/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { ClientProps } from '../../index.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n return <LexicalClickableLinkPlugin />\n}\n"],"names":["ClickableLinkPlugin","LexicalClickableLinkPlugin"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/link/client/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { ClientProps } from '../../index.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n return <LexicalClickableLinkPlugin />\n}\n"],"names":["ClickableLinkPlugin","LexicalClickableLinkPlugin","React"],"mappings":"AAAA;;AACA,SAASA,uBAAuBC,0BAA0B,QAAQ,+CAA8C;AAChH,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMF,sBAAoD;IAC/D,qBAAO,QAACC;;;;;AACV,EAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
|
|
2
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
3
4
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
4
5
|
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
@@ -247,65 +248,156 @@ export function LinkEditor({ anchorElem }) {
|
|
|
247
248
|
editor,
|
|
248
249
|
$updateLinkEditor
|
|
249
250
|
]);
|
|
250
|
-
return
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
251
|
+
return /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
252
|
+
children: [
|
|
253
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
254
|
+
className: "link-editor",
|
|
255
|
+
ref: editorRef,
|
|
256
|
+
children: /*#__PURE__*/ _jsxDEV("div", {
|
|
257
|
+
className: "link-input",
|
|
258
|
+
children: [
|
|
259
|
+
linkUrl && linkUrl.length > 0 ? /*#__PURE__*/ _jsxDEV("a", {
|
|
260
|
+
href: linkUrl,
|
|
261
|
+
rel: "noopener noreferrer",
|
|
262
|
+
target: "_blank",
|
|
263
|
+
children: [
|
|
264
|
+
linkNode?.__fields.newTab ? /*#__PURE__*/ _jsxDEV(ExternalLinkIcon, {}, void 0, false, {
|
|
265
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
266
|
+
lineNumber: 348,
|
|
267
|
+
columnNumber: 44
|
|
268
|
+
}, this) : null,
|
|
269
|
+
linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl
|
|
270
|
+
]
|
|
271
|
+
}, void 0, true, {
|
|
272
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
273
|
+
lineNumber: 347,
|
|
274
|
+
columnNumber: 13
|
|
275
|
+
}, this) : linkLabel != null && linkLabel.length > 0 ? /*#__PURE__*/ _jsxDEV(_Fragment, {
|
|
276
|
+
children: [
|
|
277
|
+
linkNode?.__fields.newTab ? /*#__PURE__*/ _jsxDEV(ExternalLinkIcon, {}, void 0, false, {
|
|
278
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
279
|
+
lineNumber: 353,
|
|
280
|
+
columnNumber: 44
|
|
281
|
+
}, this) : null,
|
|
282
|
+
/*#__PURE__*/ _jsxDEV("span", {
|
|
283
|
+
className: "link-input__label-pure",
|
|
284
|
+
children: linkLabel
|
|
285
|
+
}, void 0, false, {
|
|
286
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
287
|
+
lineNumber: 354,
|
|
288
|
+
columnNumber: 15
|
|
289
|
+
}, this)
|
|
290
|
+
]
|
|
291
|
+
}, void 0, true) : null,
|
|
292
|
+
isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
|
|
293
|
+
children: [
|
|
294
|
+
/*#__PURE__*/ _jsxDEV("button", {
|
|
295
|
+
"aria-label": "Edit link",
|
|
296
|
+
className: "link-edit",
|
|
297
|
+
onClick: (event)=>{
|
|
298
|
+
event.preventDefault();
|
|
299
|
+
toggleDrawer();
|
|
300
|
+
},
|
|
301
|
+
onMouseDown: preventDefault,
|
|
302
|
+
tabIndex: 0,
|
|
303
|
+
type: "button",
|
|
304
|
+
children: /*#__PURE__*/ _jsxDEV(EditIcon, {}, void 0, false, {
|
|
305
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
306
|
+
lineNumber: 371,
|
|
307
|
+
columnNumber: 17
|
|
308
|
+
}, this)
|
|
309
|
+
}, void 0, false, {
|
|
310
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
311
|
+
lineNumber: 360,
|
|
312
|
+
columnNumber: 15
|
|
313
|
+
}, this),
|
|
314
|
+
!isAutoLink && /*#__PURE__*/ _jsxDEV("button", {
|
|
315
|
+
"aria-label": "Remove link",
|
|
316
|
+
className: "link-trash",
|
|
317
|
+
onClick: ()=>{
|
|
318
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, null);
|
|
319
|
+
},
|
|
320
|
+
onMouseDown: preventDefault,
|
|
321
|
+
tabIndex: 0,
|
|
322
|
+
type: "button",
|
|
323
|
+
children: /*#__PURE__*/ _jsxDEV(CloseMenuIcon, {}, void 0, false, {
|
|
324
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
325
|
+
lineNumber: 384,
|
|
326
|
+
columnNumber: 19
|
|
327
|
+
}, this)
|
|
328
|
+
}, void 0, false, {
|
|
329
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
330
|
+
lineNumber: 374,
|
|
331
|
+
columnNumber: 17
|
|
332
|
+
}, this)
|
|
333
|
+
]
|
|
334
|
+
}, void 0, true, {
|
|
335
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
336
|
+
lineNumber: 359,
|
|
337
|
+
columnNumber: 13
|
|
338
|
+
}, this)
|
|
339
|
+
]
|
|
340
|
+
}, void 0, true, {
|
|
341
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
342
|
+
lineNumber: 345,
|
|
343
|
+
columnNumber: 9
|
|
344
|
+
}, this)
|
|
345
|
+
}, void 0, false, {
|
|
346
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
347
|
+
lineNumber: 344,
|
|
348
|
+
columnNumber: 7
|
|
349
|
+
}, this),
|
|
350
|
+
/*#__PURE__*/ _jsxDEV(FieldsDrawer, {
|
|
351
|
+
className: "lexical-link-edit-drawer",
|
|
352
|
+
data: stateData,
|
|
353
|
+
drawerSlug: drawerSlug,
|
|
354
|
+
drawerTitle: t('fields:editLink'),
|
|
355
|
+
featureKey: "link",
|
|
356
|
+
handleDrawerSubmit: (fields, data)=>{
|
|
357
|
+
const newLinkPayload = data;
|
|
358
|
+
const bareLinkFields = {
|
|
359
|
+
...newLinkPayload
|
|
360
|
+
};
|
|
361
|
+
delete bareLinkFields.text;
|
|
362
|
+
// See: https://github.com/facebook/lexical/pull/5536. This updates autolink nodes to link nodes whenever a change was made (which is good!).
|
|
363
|
+
editor.update(()=>{
|
|
364
|
+
const selection = $getSelection();
|
|
365
|
+
let linkParent = null;
|
|
366
|
+
if ($isRangeSelection(selection)) {
|
|
367
|
+
linkParent = getSelectedNode(selection).getParent();
|
|
368
|
+
} else {
|
|
369
|
+
if (selectedNodes.length) {
|
|
370
|
+
linkParent = selectedNodes[0]?.getParent() ?? null;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
if (linkParent && $isAutoLinkNode(linkParent)) {
|
|
374
|
+
const linkNode = $createLinkNode({
|
|
375
|
+
fields: bareLinkFields
|
|
376
|
+
});
|
|
377
|
+
linkParent.replace(linkNode, true);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
// Needs to happen AFTER a potential auto link => link node conversion, as otherwise, the updated text to display may be lost due to
|
|
381
|
+
// it being applied to the auto link node instead of the link node.
|
|
382
|
+
editor.dispatchCommand(TOGGLE_LINK_COMMAND, {
|
|
383
|
+
fields: bareLinkFields,
|
|
384
|
+
selectedNodes,
|
|
385
|
+
text: newLinkPayload.text
|
|
386
|
+
});
|
|
387
|
+
},
|
|
388
|
+
schemaPath: schemaPath,
|
|
389
|
+
schemaPathSuffix: "fields"
|
|
390
|
+
}, void 0, false, {
|
|
391
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
392
|
+
lineNumber: 391,
|
|
393
|
+
columnNumber: 7
|
|
394
|
+
}, this)
|
|
395
|
+
]
|
|
396
|
+
}, void 0, true, {
|
|
397
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx",
|
|
398
|
+
lineNumber: 343,
|
|
399
|
+
columnNumber: 5
|
|
400
|
+
}, this);
|
|
309
401
|
}
|
|
310
402
|
|
|
311
403
|
//# sourceMappingURL=index.js.map
|