@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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport type { ElementNode, LexicalNode } from 'lexical'\nimport type { Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n CloseMenuIcon,\n EditIcon,\n ExternalLinkIcon,\n formatDrawerSlug,\n useConfig,\n useEditDepth,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { requests } from '@payloadcms/ui/shared'\nimport {\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n COMMAND_PRIORITY_HIGH,\n COMMAND_PRIORITY_LOW,\n getDOMSelection,\n KEY_ESCAPE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\n\nimport type { LinkNode } from '../../../../nodes/LinkNode.js'\nimport type { LinkFields } from '../../../../nodes/types.js'\nimport type { LinkPayload } from '../types.js'\n\nimport { useEditorConfigContext } from '../../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getSelectedNode } from '../../../../../../lexical/utils/getSelectedNode.js'\nimport { setFloatingElemPositionForLinkEditor } from '../../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\nimport { FieldsDrawer } from '../../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isAutoLinkNode } from '../../../../nodes/AutoLinkNode.js'\nimport { $createLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '../../../../nodes/LinkNode.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './commands.js'\n\nfunction preventDefault(\n event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLElement>,\n): void {\n event.preventDefault()\n}\n\nexport function LinkEditor({ anchorElem }: { anchorElem: HTMLElement }): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n // TO-DO: There are several states that should not be state, because they\n // are derived from linkNode (linkUrl, linkLabel, stateData, isLink, isAutoLink...)\n const [linkNode, setLinkNode] = useState<LinkNode>()\n\n const editorRef = useRef<HTMLDivElement | null>(null)\n const [linkUrl, setLinkUrl] = useState<null | string>(null)\n const [linkLabel, setLinkLabel] = useState<null | string>(null)\n\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n\n const { config, getEntityConfig } = useConfig()\n\n const { i18n, t } = useTranslation<object, 'lexical:link:loadingWithEllipsis'>()\n\n const [stateData, setStateData] = useState<\n ({ id?: string; text: string } & LinkFields) | undefined\n >()\n\n const editDepth = useEditDepth()\n const [isLink, setIsLink] = useState(false)\n const [selectedNodes, setSelectedNodes] = useState<LexicalNode[]>([])\n const locale = useLocale()\n\n const [isAutoLink, setIsAutoLink] = useState(false)\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-link-` + uuid,\n depth: editDepth,\n })\n\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n const setNotLink = useCallback(() => {\n setIsLink(false)\n if (editorRef && editorRef.current) {\n editorRef.current.style.opacity = '0'\n editorRef.current.style.transform = 'translate(-10000px, -10000px)'\n }\n setIsAutoLink(false)\n setLinkUrl(null)\n setLinkLabel(null)\n setSelectedNodes([])\n setStateData(undefined)\n }, [setIsLink, setLinkUrl, setLinkLabel, setSelectedNodes])\n\n const $updateLinkEditor = useCallback(() => {\n const selection = $getSelection()\n let selectedNodeDomRect: DOMRect | undefined\n\n if (!$isRangeSelection(selection) || !selection) {\n void setNotLink()\n return\n }\n\n // Handle the data displayed in the floating link editor & drawer when you click on a link node\n\n const focusNode = getSelectedNode(selection)\n selectedNodeDomRect = editor.getElementByKey(focusNode.getKey())?.getBoundingClientRect()\n const focusLinkParent = $findMatchingParent(focusNode, $isLinkNode)\n\n // Prevent link modal from showing if selection spans further than the link: https://github.com/facebook/lexical/issues/4064\n const badNode = selection\n .getNodes()\n .filter((node) => !$isLineBreakNode(node))\n .find((node) => {\n const linkNode = $findMatchingParent(node, $isLinkNode)\n return (\n (focusLinkParent && !focusLinkParent.is(linkNode)) ||\n (linkNode && !linkNode.is(focusLinkParent))\n )\n })\n\n if (focusLinkParent == null || badNode) {\n setNotLink()\n return\n }\n setLinkNode(focusLinkParent)\n\n const fields = focusLinkParent.getFields()\n\n // Initial state:\n const data: { text: string } & LinkFields = {\n ...fields,\n id: focusLinkParent.getID(),\n text: focusLinkParent.getTextContent(),\n }\n\n if (fields?.linkType === 'custom') {\n setLinkUrl(fields?.url ?? null)\n setLinkLabel(null)\n } else {\n // internal link\n setLinkUrl(\n `${config.routes.admin === '/' ? '' : config.routes.admin}/collections/${fields?.doc?.relationTo}/${\n fields?.doc?.value\n }`,\n )\n\n const relatedField = fields?.doc?.relationTo\n ? getEntityConfig({ collectionSlug: fields?.doc?.relationTo })\n : undefined\n if (!relatedField) {\n // Usually happens if the user removed all default fields. In this case, we let them specify the label or do not display the label at all.\n // label could be a virtual field the user added. This is useful if they want to use the link feature for things other than links.\n setLinkLabel(fields?.label ? String(fields?.label) : null)\n setLinkUrl(fields?.url ? String(fields?.url) : null)\n } else {\n const id = typeof fields.doc?.value === 'object' ? fields.doc.value.id : fields.doc?.value\n const collection = fields.doc?.relationTo\n if (!id || !collection) {\n throw new Error(`Focus link parent is missing doc.value or doc.relationTo`)\n }\n\n const loadingLabel = t('fields:linkedTo', {\n label: `${getTranslation(relatedField.labels.singular, i18n)} - ${t('lexical:link:loadingWithEllipsis', i18n)}`,\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(loadingLabel)\n\n requests\n .get(`${config.serverURL}${config.routes.api}/${collection}/${id}`, {\n headers: {\n 'Accept-Language': i18n.language,\n },\n params: {\n depth: 0,\n locale: locale?.code,\n },\n })\n .then(async (res) => {\n if (!res.ok) {\n throw new Error(`HTTP error! Status: ${res.status}`)\n }\n const data = await res.json()\n const useAsTitle = relatedField?.admin?.useAsTitle || 'id'\n const title = data[useAsTitle]\n const label = t('fields:linkedTo', {\n label: `${getTranslation(relatedField.labels.singular, i18n)} - ${title}`,\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(label)\n })\n .catch(() => {\n const label = t('fields:linkedTo', {\n label: `${getTranslation(relatedField.labels.singular, i18n)} - ${t('general:untitled', i18n)} - ID: ${id}`,\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(label)\n })\n }\n }\n\n setStateData(data)\n setIsLink(true)\n setSelectedNodes(selection ? selection?.getNodes() : [])\n\n if ($isAutoLinkNode(focusLinkParent)) {\n setIsAutoLink(true)\n } else {\n setIsAutoLink(false)\n }\n\n const editorElem = editorRef.current\n const nativeSelection = getDOMSelection(editor._window)\n const { activeElement } = document\n\n if (editorElem === null) {\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n if (!selectedNodeDomRect) {\n // Get the DOM rect of the selected node using the native selection. This sometimes produces the wrong\n // result, which is why we use lexical's selection preferably.\n selectedNodeDomRect = nativeSelection.getRangeAt(0).getBoundingClientRect()\n }\n\n if (selectedNodeDomRect != null) {\n selectedNodeDomRect.y += 40\n setFloatingElemPositionForLinkEditor(selectedNodeDomRect, editorElem, anchorElem)\n }\n } else if (activeElement == null || activeElement.className !== 'link-input') {\n if (rootElement !== null) {\n setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem)\n }\n setLinkUrl(null)\n setLinkLabel(null)\n }\n\n return true\n }, [\n editor,\n setNotLink,\n config.routes.admin,\n config.routes.api,\n config.serverURL,\n getEntityConfig,\n t,\n i18n,\n locale?.code,\n anchorElem,\n ])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n TOGGLE_LINK_WITH_MODAL_COMMAND,\n (payload: LinkPayload) => {\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, payload)\n\n // Now, open the modal\n $updateLinkEditor()\n toggleDrawer()\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateLinkEditor, toggleDrawer, drawerSlug])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = (): void => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }\n\n window.addEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [anchorElem.parentElement, editor, $updateLinkEditor])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n void $updateLinkEditor()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n void $updateLinkEditor()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n () => {\n if (isLink) {\n setNotLink()\n\n return true\n }\n return false\n },\n COMMAND_PRIORITY_HIGH,\n ),\n )\n }, [editor, $updateLinkEditor, isLink, setNotLink])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }, [editor, $updateLinkEditor])\n\n return (\n <React.Fragment>\n <div className=\"link-editor\" ref={editorRef}>\n <div className=\"link-input\">\n {linkUrl && linkUrl.length > 0 ? (\n <a href={linkUrl} rel=\"noopener noreferrer\" target=\"_blank\">\n {linkNode?.__fields.newTab ? <ExternalLinkIcon /> : null}\n {linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl}\n </a>\n ) : linkLabel != null && linkLabel.length > 0 ? (\n <>\n {linkNode?.__fields.newTab ? <ExternalLinkIcon /> : null}\n <span className=\"link-input__label-pure\">{linkLabel}</span>\n </>\n ) : null}\n\n {isEditable && (\n <React.Fragment>\n <button\n aria-label=\"Edit link\"\n className=\"link-edit\"\n onClick={(event) => {\n event.preventDefault()\n toggleDrawer()\n }}\n onMouseDown={preventDefault}\n tabIndex={0}\n type=\"button\"\n >\n <EditIcon />\n </button>\n {!isAutoLink && (\n <button\n aria-label=\"Remove link\"\n className=\"link-trash\"\n onClick={() => {\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }}\n onMouseDown={preventDefault}\n tabIndex={0}\n type=\"button\"\n >\n <CloseMenuIcon />\n </button>\n )}\n </React.Fragment>\n )}\n </div>\n </div>\n <FieldsDrawer\n className=\"lexical-link-edit-drawer\"\n data={stateData}\n drawerSlug={drawerSlug}\n drawerTitle={t('fields:editLink')}\n featureKey=\"link\"\n handleDrawerSubmit={(fields: FormState, data: Data) => {\n const newLinkPayload = data as { text: string } & LinkFields\n\n const bareLinkFields: LinkFields = {\n ...newLinkPayload,\n }\n delete bareLinkFields.text\n\n // See: https://github.com/facebook/lexical/pull/5536. This updates autolink nodes to link nodes whenever a change was made (which is good!).\n editor.update(() => {\n const selection = $getSelection()\n let linkParent: ElementNode | null = null\n if ($isRangeSelection(selection)) {\n linkParent = getSelectedNode(selection).getParent()\n } else {\n if (selectedNodes.length) {\n linkParent = selectedNodes[0]?.getParent() ?? null\n }\n }\n\n if (linkParent && $isAutoLinkNode(linkParent)) {\n const linkNode = $createLinkNode({\n fields: bareLinkFields,\n })\n linkParent.replace(linkNode, true)\n }\n })\n\n // Needs to happen AFTER a potential auto link => link node conversion, as otherwise, the updated text to display may be lost due to\n // it being applied to the auto link node instead of the link node.\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, {\n fields: bareLinkFields,\n selectedNodes,\n text: newLinkPayload.text,\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$findMatchingParent","mergeRegister","getTranslation","CloseMenuIcon","EditIcon","ExternalLinkIcon","formatDrawerSlug","useConfig","useEditDepth","useLocale","useTranslation","requests","$getSelection","$isLineBreakNode","$isRangeSelection","COMMAND_PRIORITY_HIGH","COMMAND_PRIORITY_LOW","getDOMSelection","KEY_ESCAPE_COMMAND","SELECTION_CHANGE_COMMAND","React","useCallback","useEffect","useRef","useState","useEditorConfigContext","getSelectedNode","setFloatingElemPositionForLinkEditor","FieldsDrawer","useLexicalDrawer","$isAutoLinkNode","$createLinkNode","$isLinkNode","TOGGLE_LINK_COMMAND","TOGGLE_LINK_WITH_MODAL_COMMAND","preventDefault","event","LinkEditor","anchorElem","editor","linkNode","setLinkNode","editorRef","linkUrl","setLinkUrl","linkLabel","setLinkLabel","fieldProps","schemaPath","uuid","isEditable","config","getEntityConfig","i18n","t","stateData","setStateData","editDepth","isLink","setIsLink","selectedNodes","setSelectedNodes","locale","isAutoLink","setIsAutoLink","drawerSlug","slug","depth","toggleDrawer","setNotLink","current","style","opacity","transform","undefined","$updateLinkEditor","selection","selectedNodeDomRect","focusNode","getElementByKey","getKey","getBoundingClientRect","focusLinkParent","badNode","getNodes","filter","node","find","is","fields","getFields","data","id","getID","text","getTextContent","linkType","url","routes","admin","doc","relationTo","value","relatedField","collectionSlug","label","String","collection","Error","loadingLabel","labels","singular","replace","get","serverURL","api","headers","language","params","code","then","res","ok","status","json","useAsTitle","title","catch","editorElem","nativeSelection","_window","activeElement","document","rootElement","getRootElement","contains","anchorNode","getRangeAt","y","className","registerCommand","payload","dispatchCommand","scrollerElem","parentElement","update","getEditorState","read","window","addEventListener","removeEventListener","registerUpdateListener","editorState","Fragment","div","ref","length","a","href","rel","target","__fields","newTab","span","button","aria-label","onClick","onMouseDown","tabIndex","type","drawerTitle","featureKey","handleDrawerSubmit","newLinkPayload","bareLinkFields","linkParent","getParent","schemaPathSuffix"],"mappings":"AAAA;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,aAAa,EACbC,QAAQ,EACRC,gBAAgB,EAChBC,gBAAgB,EAChBC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,eAAe,EACfC,kBAAkB,EAClBC,wB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U,GACVC,KAAK,SACN;kBACC,CAACtK,eAAgB;gBACnB,EAAEiK,QACF;YACJ,EAAEhJ,MAAMqI,UACR;QACJ,EAAEC,IAAI;MACR,EAAEA,IAAI;MACN,CAAC9H,aACC+G,UAAU,2BACVhD,MAAMpC,WACNU,YAAYA,YACZyG,aAAapH,EAAE,oBACfqH,WAAW,OACXC,oBAAoB,CAACnF,QAAmBE;QACtC,MAAMkF,iBAAiBlF;QAEvB,MAAMmF,iBAA6B;YACjC,GAAGD,cAAc;QACnB;QACA,OAAOC,eAAehF,IAAI;QAE1B,6IAA6I;QAC7IvD,OAAO0G,MAAM,CAAC;YACZ,MAAMrE,YAAYhE;YAClB,IAAImK,aAAiC;YACrC,IAAIjK,kBAAkB8D,YAAY;gBAChCmG,aAAarJ,gBAAgBkD,WAAWoG,SAAS;YACnD,OAAO;gBACL,IAAIpH,cAAcgG,MAAM,EAAE;oBACxBmB,aAAanH,aAAa,CAAC,EAAE,EAAEoH,eAAe;gBAChD;YACF;YAEA,IAAID,cAAcjJ,gBAAgBiJ,aAAa;gBAC7C,MAAMvI,WAAWT,gBAAgB;oBAC/B0D,QAAQqF;gBACV;gBACAC,WAAW/D,OAAO,CAACxE,UAAU;YAC/B;QACF;QAEA,oIAAoI;QACpI,mEAAmE;QACnED,OAAOuG,eAAe,CAAC7G,qBAAqB;YAC1CwD,QAAQqF;YACRlH;YACAkC,MAAM+E,eAAe/E,IAAI;QAC3B;IACF,GACA9C,YAAYA,YACZiI,iBAAiB,UACjB;IACJ,EAAE7J,MAAMqI;AAEZ"}
|
|
1
|
+
{"version":3,"sources":["../../../../../../../src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport type { ElementNode, LexicalNode } from 'lexical'\nimport type { Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n CloseMenuIcon,\n EditIcon,\n ExternalLinkIcon,\n formatDrawerSlug,\n useConfig,\n useEditDepth,\n useLocale,\n useTranslation,\n} from '@payloadcms/ui'\nimport { requests } from '@payloadcms/ui/shared'\nimport {\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n COMMAND_PRIORITY_HIGH,\n COMMAND_PRIORITY_LOW,\n getDOMSelection,\n KEY_ESCAPE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\n\nimport type { LinkNode } from '../../../../nodes/LinkNode.js'\nimport type { LinkFields } from '../../../../nodes/types.js'\nimport type { LinkPayload } from '../types.js'\n\nimport { useEditorConfigContext } from '../../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getSelectedNode } from '../../../../../../lexical/utils/getSelectedNode.js'\nimport { setFloatingElemPositionForLinkEditor } from '../../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\nimport { FieldsDrawer } from '../../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isAutoLinkNode } from '../../../../nodes/AutoLinkNode.js'\nimport { $createLinkNode, $isLinkNode, TOGGLE_LINK_COMMAND } from '../../../../nodes/LinkNode.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './commands.js'\n\nfunction preventDefault(\n event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLElement>,\n): void {\n event.preventDefault()\n}\n\nexport function LinkEditor({ anchorElem }: { anchorElem: HTMLElement }): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n // TO-DO: There are several states that should not be state, because they\n // are derived from linkNode (linkUrl, linkLabel, stateData, isLink, isAutoLink...)\n const [linkNode, setLinkNode] = useState<LinkNode>()\n\n const editorRef = useRef<HTMLDivElement | null>(null)\n const [linkUrl, setLinkUrl] = useState<null | string>(null)\n const [linkLabel, setLinkLabel] = useState<null | string>(null)\n\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n\n const { config, getEntityConfig } = useConfig()\n\n const { i18n, t } = useTranslation<object, 'lexical:link:loadingWithEllipsis'>()\n\n const [stateData, setStateData] = useState<\n ({ id?: string; text: string } & LinkFields) | undefined\n >()\n\n const editDepth = useEditDepth()\n const [isLink, setIsLink] = useState(false)\n const [selectedNodes, setSelectedNodes] = useState<LexicalNode[]>([])\n const locale = useLocale()\n\n const [isAutoLink, setIsAutoLink] = useState(false)\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-rich-text-link-` + uuid,\n depth: editDepth,\n })\n\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n const setNotLink = useCallback(() => {\n setIsLink(false)\n if (editorRef && editorRef.current) {\n editorRef.current.style.opacity = '0'\n editorRef.current.style.transform = 'translate(-10000px, -10000px)'\n }\n setIsAutoLink(false)\n setLinkUrl(null)\n setLinkLabel(null)\n setSelectedNodes([])\n setStateData(undefined)\n }, [setIsLink, setLinkUrl, setLinkLabel, setSelectedNodes])\n\n const $updateLinkEditor = useCallback(() => {\n const selection = $getSelection()\n let selectedNodeDomRect: DOMRect | undefined\n\n if (!$isRangeSelection(selection) || !selection) {\n void setNotLink()\n return\n }\n\n // Handle the data displayed in the floating link editor & drawer when you click on a link node\n\n const focusNode = getSelectedNode(selection)\n selectedNodeDomRect = editor.getElementByKey(focusNode.getKey())?.getBoundingClientRect()\n const focusLinkParent = $findMatchingParent(focusNode, $isLinkNode)\n\n // Prevent link modal from showing if selection spans further than the link: https://github.com/facebook/lexical/issues/4064\n const badNode = selection\n .getNodes()\n .filter((node) => !$isLineBreakNode(node))\n .find((node) => {\n const linkNode = $findMatchingParent(node, $isLinkNode)\n return (\n (focusLinkParent && !focusLinkParent.is(linkNode)) ||\n (linkNode && !linkNode.is(focusLinkParent))\n )\n })\n\n if (focusLinkParent == null || badNode) {\n setNotLink()\n return\n }\n setLinkNode(focusLinkParent)\n\n const fields = focusLinkParent.getFields()\n\n // Initial state:\n const data: { text: string } & LinkFields = {\n ...fields,\n id: focusLinkParent.getID(),\n text: focusLinkParent.getTextContent(),\n }\n\n if (fields?.linkType === 'custom') {\n setLinkUrl(fields?.url ?? null)\n setLinkLabel(null)\n } else {\n // internal link\n setLinkUrl(\n `${config.routes.admin === '/' ? '' : config.routes.admin}/collections/${fields?.doc?.relationTo}/${\n fields?.doc?.value\n }`,\n )\n\n const relatedField = fields?.doc?.relationTo\n ? getEntityConfig({ collectionSlug: fields?.doc?.relationTo })\n : undefined\n if (!relatedField) {\n // Usually happens if the user removed all default fields. In this case, we let them specify the label or do not display the label at all.\n // label could be a virtual field the user added. This is useful if they want to use the link feature for things other than links.\n setLinkLabel(fields?.label ? String(fields?.label) : null)\n setLinkUrl(fields?.url ? String(fields?.url) : null)\n } else {\n const id = typeof fields.doc?.value === 'object' ? fields.doc.value.id : fields.doc?.value\n const collection = fields.doc?.relationTo\n if (!id || !collection) {\n throw new Error(`Focus link parent is missing doc.value or doc.relationTo`)\n }\n\n const loadingLabel = t('fields:linkedTo', {\n label: `${getTranslation(relatedField.labels.singular, i18n)} - ${t('lexical:link:loadingWithEllipsis', i18n)}`,\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(loadingLabel)\n\n requests\n .get(`${config.serverURL}${config.routes.api}/${collection}/${id}`, {\n headers: {\n 'Accept-Language': i18n.language,\n },\n params: {\n depth: 0,\n locale: locale?.code,\n },\n })\n .then(async (res) => {\n if (!res.ok) {\n throw new Error(`HTTP error! Status: ${res.status}`)\n }\n const data = await res.json()\n const useAsTitle = relatedField?.admin?.useAsTitle || 'id'\n const title = data[useAsTitle]\n const label = t('fields:linkedTo', {\n label: `${getTranslation(relatedField.labels.singular, i18n)} - ${title}`,\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(label)\n })\n .catch(() => {\n const label = t('fields:linkedTo', {\n label: `${getTranslation(relatedField.labels.singular, i18n)} - ${t('general:untitled', i18n)} - ID: ${id}`,\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(label)\n })\n }\n }\n\n setStateData(data)\n setIsLink(true)\n setSelectedNodes(selection ? selection?.getNodes() : [])\n\n if ($isAutoLinkNode(focusLinkParent)) {\n setIsAutoLink(true)\n } else {\n setIsAutoLink(false)\n }\n\n const editorElem = editorRef.current\n const nativeSelection = getDOMSelection(editor._window)\n const { activeElement } = document\n\n if (editorElem === null) {\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n if (!selectedNodeDomRect) {\n // Get the DOM rect of the selected node using the native selection. This sometimes produces the wrong\n // result, which is why we use lexical's selection preferably.\n selectedNodeDomRect = nativeSelection.getRangeAt(0).getBoundingClientRect()\n }\n\n if (selectedNodeDomRect != null) {\n selectedNodeDomRect.y += 40\n setFloatingElemPositionForLinkEditor(selectedNodeDomRect, editorElem, anchorElem)\n }\n } else if (activeElement == null || activeElement.className !== 'link-input') {\n if (rootElement !== null) {\n setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem)\n }\n setLinkUrl(null)\n setLinkLabel(null)\n }\n\n return true\n }, [\n editor,\n setNotLink,\n config.routes.admin,\n config.routes.api,\n config.serverURL,\n getEntityConfig,\n t,\n i18n,\n locale?.code,\n anchorElem,\n ])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n TOGGLE_LINK_WITH_MODAL_COMMAND,\n (payload: LinkPayload) => {\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, payload)\n\n // Now, open the modal\n $updateLinkEditor()\n toggleDrawer()\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateLinkEditor, toggleDrawer, drawerSlug])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = (): void => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }\n\n window.addEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [anchorElem.parentElement, editor, $updateLinkEditor])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n void $updateLinkEditor()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n void $updateLinkEditor()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n () => {\n if (isLink) {\n setNotLink()\n\n return true\n }\n return false\n },\n COMMAND_PRIORITY_HIGH,\n ),\n )\n }, [editor, $updateLinkEditor, isLink, setNotLink])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }, [editor, $updateLinkEditor])\n\n return (\n <React.Fragment>\n <div className=\"link-editor\" ref={editorRef}>\n <div className=\"link-input\">\n {linkUrl && linkUrl.length > 0 ? (\n <a href={linkUrl} rel=\"noopener noreferrer\" target=\"_blank\">\n {linkNode?.__fields.newTab ? <ExternalLinkIcon /> : null}\n {linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl}\n </a>\n ) : linkLabel != null && linkLabel.length > 0 ? (\n <>\n {linkNode?.__fields.newTab ? <ExternalLinkIcon /> : null}\n <span className=\"link-input__label-pure\">{linkLabel}</span>\n </>\n ) : null}\n\n {isEditable && (\n <React.Fragment>\n <button\n aria-label=\"Edit link\"\n className=\"link-edit\"\n onClick={(event) => {\n event.preventDefault()\n toggleDrawer()\n }}\n onMouseDown={preventDefault}\n tabIndex={0}\n type=\"button\"\n >\n <EditIcon />\n </button>\n {!isAutoLink && (\n <button\n aria-label=\"Remove link\"\n className=\"link-trash\"\n onClick={() => {\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }}\n onMouseDown={preventDefault}\n tabIndex={0}\n type=\"button\"\n >\n <CloseMenuIcon />\n </button>\n )}\n </React.Fragment>\n )}\n </div>\n </div>\n <FieldsDrawer\n className=\"lexical-link-edit-drawer\"\n data={stateData}\n drawerSlug={drawerSlug}\n drawerTitle={t('fields:editLink')}\n featureKey=\"link\"\n handleDrawerSubmit={(fields: FormState, data: Data) => {\n const newLinkPayload = data as { text: string } & LinkFields\n\n const bareLinkFields: LinkFields = {\n ...newLinkPayload,\n }\n delete bareLinkFields.text\n\n // See: https://github.com/facebook/lexical/pull/5536. This updates autolink nodes to link nodes whenever a change was made (which is good!).\n editor.update(() => {\n const selection = $getSelection()\n let linkParent: ElementNode | null = null\n if ($isRangeSelection(selection)) {\n linkParent = getSelectedNode(selection).getParent()\n } else {\n if (selectedNodes.length) {\n linkParent = selectedNodes[0]?.getParent() ?? null\n }\n }\n\n if (linkParent && $isAutoLinkNode(linkParent)) {\n const linkNode = $createLinkNode({\n fields: bareLinkFields,\n })\n linkParent.replace(linkNode, true)\n }\n })\n\n // Needs to happen AFTER a potential auto link => link node conversion, as otherwise, the updated text to display may be lost due to\n // it being applied to the auto link node instead of the link node.\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, {\n fields: bareLinkFields,\n selectedNodes,\n text: newLinkPayload.text,\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$findMatchingParent","mergeRegister","getTranslation","CloseMenuIcon","EditIcon","ExternalLinkIcon","formatDrawerSlug","useConfig","useEditDepth","useLocale","useTranslation","requests","$getSelection","$isLineBreakNode","$isRangeSelection","COMMAND_PRIORITY_HIGH","COMMAND_PRIORITY_LOW","getDOMSelection","KEY_ESCAPE_COMMAND","SELECTION_CHANGE_COMMAND","React","useCallback","useEffect","useRef","useState","useEditorConfigContext","getSelectedNode","setFloatingElemPositionForLinkEditor","FieldsDrawer","useLexicalDrawer","$isAutoLinkNode","$createLinkNode","$isLinkNode","TOGGLE_LINK_COMMAND","TOGGLE_LINK_WITH_MODAL_COMMAND","preventDefault","event","LinkEditor","anchorElem","editor","linkNode","setLinkNode","editorRef","linkUrl","setLinkUrl","linkLabel","setLinkLabel","fieldProps","schemaPath","uuid","isEditable","config","getEntityConfig","i18n","t","stateData","setStateData","editDepth","isLink","setIsLink","selectedNodes","setSelectedNodes","locale","isAutoLink","setIsAutoLink","drawerSlug","slug","depth","toggleDrawer","setNotLink","current","style","opacity","transform","undefined","$updateLinkEditor","selection","selectedNodeDomRect","focusNode","getElementByKey","getKey","getBoundingClientRect","focusLinkParent","badNode","getNodes","filter","node","find","is","fields","getFields","data","id","getID","text","getTextContent","linkType","url","routes","admin","doc","relationTo","value","relatedField","collectionSlug","label","String","collection","Error","loadingLabel","labels","singular","replace","get","serverURL","api","headers","language","params","code","then","res","ok","status","json","useAsTitle","title","catch","editorElem","nativeSelection","_window","activeElement","document","rootElement","getRootElement","contains","anchorNode","getRangeAt","y","className","registerCommand","payload","dispatchCommand","scrollerElem","parentElement","update","getEditorState","read","window","addEventListener","removeEventListener","registerUpdateListener","editorState","Fragment","div","ref","length","a","href","rel","target","__fields","newTab","span","button","aria-label","onClick","onMouseDown","tabIndex","type","drawerTitle","featureKey","handleDrawerSubmit","newLinkPayload","bareLinkFields","linkParent","getParent","schemaPathSuffix"],"mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,aAAa,EACbC,QAAQ,EACRC,gBAAgB,EAChBC,gBAAgB,EAChBC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,cAAc,QACT,iBAAgB;AACvB,SAASC,QAAQ,QAAQ,wBAAuB;AAChD,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC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AqB;oCAC9C;oCACAsI,aAAapI;oCACbqI,UAAU;oCACVC,MAAK;8CAEL,cAAA,QAACtK;;;;;;;;;;;;;;;;;;;;;;;;;;;0BAOb,QAACyB;gBACC+G,WAAU;gBACVhD,MAAMpC;gBACNU,YAAYA;gBACZyG,aAAapH,EAAE;gBACfqH,YAAW;gBACXC,oBAAoB,CAACnF,QAAmBE;oBACtC,MAAMkF,iBAAiBlF;oBAEvB,MAAMmF,iBAA6B;wBACjC,GAAGD,cAAc;oBACnB;oBACA,OAAOC,eAAehF,IAAI;oBAE1B,6IAA6I;oBAC7IvD,OAAO0G,MAAM,CAAC;wBACZ,MAAMrE,YAAYhE;wBAClB,IAAImK,aAAiC;wBACrC,IAAIjK,kBAAkB8D,YAAY;4BAChCmG,aAAarJ,gBAAgBkD,WAAWoG,SAAS;wBACnD,OAAO;4BACL,IAAIpH,cAAcgG,MAAM,EAAE;gCACxBmB,aAAanH,aAAa,CAAC,EAAE,EAAEoH,eAAe;4BAChD;wBACF;wBAEA,IAAID,cAAcjJ,gBAAgBiJ,aAAa;4BAC7C,MAAMvI,WAAWT,gBAAgB;gCAC/B0D,QAAQqF;4BACV;4BACAC,WAAW/D,OAAO,CAACxE,UAAU;wBAC/B;oBACF;oBAEA,oIAAoI;oBACpI,mEAAmE;oBACnED,OAAOuG,eAAe,CAAC7G,qBAAqB;wBAC1CwD,QAAQqF;wBACRlH;wBACAkC,MAAM+E,eAAe/E,IAAI;oBAC3B;gBACF;gBACA9C,YAAYA;gBACZiI,kBAAiB;;;;;;;;;;;;AAIzB"}
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
2
4
|
import { createPortal } from 'react-dom';
|
|
3
5
|
import './index.scss';
|
|
4
6
|
import { LinkEditor } from './LinkEditor/index.js';
|
|
5
7
|
export const FloatingLinkEditorPlugin = (props)=>{
|
|
6
8
|
const { anchorElem = document.body } = props;
|
|
7
|
-
return createPortal(
|
|
9
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ _jsxDEV(LinkEditor, {
|
|
10
|
+
anchorElem: anchorElem
|
|
11
|
+
}, void 0, false, {
|
|
12
|
+
fileName: "src/features/link/client/plugins/floatingLinkEditor/index.tsx",
|
|
13
|
+
lineNumber: 14,
|
|
14
|
+
columnNumber: 23
|
|
15
|
+
}, this), anchorElem);
|
|
8
16
|
};
|
|
9
17
|
|
|
10
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/link/client/plugins/floatingLinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../../typesClient.js'\nimport type { ClientProps } from '../../index.js'\n\nimport './index.scss'\nimport { LinkEditor } from './LinkEditor/index.js'\n\nexport const FloatingLinkEditorPlugin: PluginComponentWithAnchor<ClientProps> = (props) => {\n const { anchorElem = document.body } = props\n\n return createPortal(<LinkEditor anchorElem={anchorElem} />, anchorElem)\n}\n"],"names":["createPortal","LinkEditor","FloatingLinkEditorPlugin","props","anchorElem","document","body"],"mappings":"AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/link/client/plugins/floatingLinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../../typesClient.js'\nimport type { ClientProps } from '../../index.js'\n\nimport './index.scss'\nimport { LinkEditor } from './LinkEditor/index.js'\n\nexport const FloatingLinkEditorPlugin: PluginComponentWithAnchor<ClientProps> = (props) => {\n const { anchorElem = document.body } = props\n\n return createPortal(<LinkEditor anchorElem={anchorElem} />, anchorElem)\n}\n"],"names":["React","createPortal","LinkEditor","FloatingLinkEditorPlugin","props","anchorElem","document","body"],"mappings":"AAAA;;AACA,YAAYA,WAAW,QAAO;AAC9B,SAASC,YAAY,QAAQ,YAAW;AAKxC,OAAO,eAAc;AACrB,SAASC,UAAU,QAAQ,wBAAuB;AAElD,OAAO,MAAMC,2BAAmE,CAACC;IAC/E,MAAM,EAAEC,aAAaC,SAASC,IAAI,EAAE,GAAGH;IAEvC,qBAAOH,2BAAa,QAACC;QAAWG,YAAYA;;;;;cAAgBA;AAC9D,EAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin.js';
|
|
4
|
+
import React from 'react';
|
|
3
5
|
export const LexicalCheckListPlugin = ()=>{
|
|
4
|
-
return
|
|
6
|
+
return /*#__PURE__*/ _jsxDEV(CheckListPlugin, {}, void 0, false, {
|
|
7
|
+
fileName: "src/features/lists/checklist/client/plugin/index.tsx",
|
|
8
|
+
lineNumber: 8,
|
|
9
|
+
columnNumber: 10
|
|
10
|
+
}, this);
|
|
5
11
|
};
|
|
6
12
|
|
|
7
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/lists/checklist/client/plugin/index.tsx"],"sourcesContent":["'use client'\nimport { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nexport const LexicalCheckListPlugin: PluginComponent<undefined> = () => {\n return <CheckListPlugin />\n}\n"],"names":["CheckListPlugin","LexicalCheckListPlugin"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/lists/checklist/client/plugin/index.tsx"],"sourcesContent":["'use client'\nimport { CheckListPlugin } from '@lexical/react/LexicalCheckListPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nexport const LexicalCheckListPlugin: PluginComponent<undefined> = () => {\n return <CheckListPlugin />\n}\n"],"names":["CheckListPlugin","React","LexicalCheckListPlugin"],"mappings":"AAAA;;AACA,SAASA,eAAe,QAAQ,2CAA0C;AAC1E,OAAOC,WAAW,QAAO;AAIzB,OAAO,MAAMC,yBAAqD;IAChE,qBAAO,QAACF;;;;;AACV,EAAC"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { ListPlugin } from '@lexical/react/LexicalListPlugin.js';
|
|
4
|
+
import React from 'react';
|
|
3
5
|
export const LexicalListPlugin = ()=>{
|
|
4
|
-
return
|
|
6
|
+
return /*#__PURE__*/ _jsxDEV(ListPlugin, {}, void 0, false, {
|
|
7
|
+
fileName: "src/features/lists/plugin/index.tsx",
|
|
8
|
+
lineNumber: 23,
|
|
9
|
+
columnNumber: 10
|
|
10
|
+
}, this);
|
|
5
11
|
};
|
|
6
12
|
|
|
7
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/lists/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type {\n SerializedListItemNode as _SerializedListItemNode,\n SerializedListNode as _SerializedListNode,\n} from '@lexical/list'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport { ListPlugin } from '@lexical/react/LexicalListPlugin.js'\nimport React from 'react'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\nimport type { PluginComponent } from '../../typesClient.js'\n\nexport type SerializedListItemNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n checked?: boolean\n} & StronglyTypedElementNode<_SerializedListItemNode, 'listitem', T>\n\nexport type SerializedListNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n checked?: boolean\n} & StronglyTypedElementNode<_SerializedListNode, 'list', T>\n\nexport const LexicalListPlugin: PluginComponent<undefined> = () => {\n return <ListPlugin />\n}\n"],"names":["ListPlugin","LexicalListPlugin"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/lists/plugin/index.tsx"],"sourcesContent":["'use client'\nimport type {\n SerializedListItemNode as _SerializedListItemNode,\n SerializedListNode as _SerializedListNode,\n} from '@lexical/list'\nimport type { SerializedLexicalNode } from 'lexical'\n\nimport { ListPlugin } from '@lexical/react/LexicalListPlugin.js'\nimport React from 'react'\n\nimport type { StronglyTypedElementNode } from '../../../nodeTypes.js'\nimport type { PluginComponent } from '../../typesClient.js'\n\nexport type SerializedListItemNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n checked?: boolean\n} & StronglyTypedElementNode<_SerializedListItemNode, 'listitem', T>\n\nexport type SerializedListNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n checked?: boolean\n} & StronglyTypedElementNode<_SerializedListNode, 'list', T>\n\nexport const LexicalListPlugin: PluginComponent<undefined> = () => {\n return <ListPlugin />\n}\n"],"names":["ListPlugin","React","LexicalListPlugin"],"mappings":"AAAA;;AAOA,SAASA,UAAU,QAAQ,sCAAqC;AAChE,OAAOC,WAAW,QAAO;AAazB,OAAO,MAAMC,oBAAgD;IAC3D,qBAAO,QAACF;;;;;AACV,EAAC"}
|
package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
+
import React from 'react';
|
|
2
4
|
import './index.scss';
|
|
3
5
|
export const UnknownConvertedNodeComponent = (props)=>{
|
|
4
6
|
const { data } = props;
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
return /*#__PURE__*/ _jsxDEV("div", {
|
|
8
|
+
children: [
|
|
9
|
+
"Unknown converted payload-plugin-lexical node: ",
|
|
10
|
+
/*#__PURE__*/ _jsxDEV("strong", {
|
|
11
|
+
children: data?.nodeType
|
|
12
|
+
}, void 0, false, {
|
|
13
|
+
fileName: "src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.tsx",
|
|
14
|
+
lineNumber: 17,
|
|
15
|
+
columnNumber: 54
|
|
16
|
+
}, this)
|
|
17
|
+
]
|
|
18
|
+
}, void 0, true, {
|
|
19
|
+
fileName: "src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.tsx",
|
|
20
|
+
lineNumber: 16,
|
|
21
|
+
columnNumber: 5
|
|
22
|
+
}, this);
|
|
8
23
|
};
|
|
9
24
|
|
|
10
25
|
//# sourceMappingURL=Component.js.map
|
package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport type { UnknownConvertedNodeData } from './index.js'\n\nimport './index.scss'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted payload-plugin-lexical node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],"names":["UnknownConvertedNodeComponent","props","data","div","strong","nodeType"],"mappings":"AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport type { UnknownConvertedNodeData } from './index.js'\n\nimport './index.scss'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted payload-plugin-lexical node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],"names":["React","UnknownConvertedNodeComponent","props","data","div","strong","nodeType"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAIzB,OAAO,eAAc;AAMrB,OAAO,MAAMC,gCAAiD,CAACC;IAC7D,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjB,qBACE,QAACE;;YAAI;0BAC4C,QAACC;0BAAQF,MAAMG;;;;;;;;;;;;AAGpE,EAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
1
2
|
import { addClassNamesToElement } from '@lexical/utils';
|
|
2
3
|
import { $applyNodeReplacement, DecoratorNode } from 'lexical';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
const Component = React.lazy(()=>import('./Component.js').then((module)=>({
|
|
5
|
+
const Component = /*#__PURE__*/ React.lazy(()=>import('./Component.js').then((module)=>({
|
|
5
6
|
default: module.UnknownConvertedNodeComponent
|
|
6
7
|
})));
|
|
7
8
|
/** @noInheritDoc */ export class UnknownConvertedNode extends DecoratorNode {
|
|
@@ -37,7 +38,13 @@ const Component = React.lazy(()=>import('./Component.js').then((module)=>({
|
|
|
37
38
|
return element;
|
|
38
39
|
}
|
|
39
40
|
decorate() {
|
|
40
|
-
return
|
|
41
|
+
return /*#__PURE__*/ _jsxDEV(Component, {
|
|
42
|
+
data: this.__data
|
|
43
|
+
}, void 0, false, {
|
|
44
|
+
fileName: "src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx",
|
|
45
|
+
lineNumber: 66,
|
|
46
|
+
columnNumber: 12
|
|
47
|
+
}, this);
|
|
41
48
|
}
|
|
42
49
|
exportJSON() {
|
|
43
50
|
return {
|
package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new this({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'unknownConverted'\n }\n\n static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n override decorate(): JSX.Element {\n return <Component data={this.__data} />\n }\n\n override exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n override isInline(): boolean {\n return true\n }\n\n override updateDOM(prevNode: this, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return $applyNodeReplacement(\n new UnknownConvertedNode({\n data,\n }),\n )\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"mappings":"AAGA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,UAAS;AAC9D,YAAYC,WAAW,QAAO;AAc9B,MAAMC,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new this({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'unknownConverted'\n }\n\n static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n override decorate(): JSX.Element {\n return <Component data={this.__data} />\n }\n\n override exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n override isInline(): boolean {\n return true\n }\n\n override updateDOM(prevNode: this, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return $applyNodeReplacement(\n new UnknownConvertedNode({\n data,\n }),\n )\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"mappings":";AAGA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,UAAS;AAC9D,YAAYC,WAAW,QAAO;AAc9B,MAAMC,0BAAYD,MAAME,IAAI,CAAC,IAC3B,MAAM,CAAC,kBAAkBC,IAAI,CAAC,CAACC,SAAY,CAAA;YACzCC,SAASD,OAAOE,6BAA6B;QAC/C,CAAA;AAGF,kBAAkB,GAClB,OAAO,MAAMC,6BAA6BR;IACxCS,OAAgC;IAEhC,YAAY,EAAEC,IAAI,EAAEC,GAAG,EAAqD,CAAE;QAC5E,KAAK,CAACA;QACN,IAAI,CAACF,MAAM,GAAGC;IAChB;IAEA,OAAgBE,MAAMC,IAA0B,EAAwB;QACtE,OAAO,IAAI,IAAI,CAAC;YACdH,MAAMG,KAAKJ,MAAM;YACjBE,KAAKE,KAAKC,KAAK;QACjB;IACF;IAEA,OAAgBC,UAAkB;QAChC,OAAO;IACT;IAEA,OAAgBC,WAAWC,cAA8C,EAAwB;QAC/F,MAAMJ,OAAOK,4BAA4B;YAAER,MAAMO,eAAeP,IAAI;QAAC;QACrE,OAAOG;IACT;IAEAM,qBAA2B;QACzB,OAAO;IACT;IAEAC,sBAA4B;QAC1B,OAAO;IACT;IAESC,UAAUC,MAAoB,EAAe;QACpD,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvC3B,uBAAuByB,SAAS;QAChC,OAAOA;IACT;IAESG,WAAwB;QAC/B,qBAAO,QAACxB;YAAUQ,MAAM,IAAI,CAACD,MAAM;;;;;;IACrC;IAESkB,aAA6C;QACpD,OAAO;YACLC,MAAM,IAAI,CAACb,OAAO;YAClBL,MAAM,IAAI,CAACD,MAAM;YACjBoB,SAAS;QACX;IACF;IAEA,WAAW;IAEFC,WAAoB;QAC3B,OAAO;IACT;IAESC,UAAUC,QAAc,EAAEC,GAAgB,EAAW;QAC5D,OAAO;IACT;AACF;AAEA,OAAO,SAASf,4BAA4B,EAC1CR,IAAI,EAGL;IACC,OAAOX,sBACL,IAAIS,qBAAqB;QACvBE;IACF;AAEJ;AAEA,OAAO,SAASwB,wBACdrB,IAAoC;IAEpC,OAAOA,gBAAgBL;AACzB"}
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
3
|
+
import React from 'react';
|
|
2
4
|
import './index.scss';
|
|
3
5
|
export const UnknownConvertedNodeComponent = (props)=>{
|
|
4
6
|
const { data } = props;
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
return /*#__PURE__*/ _jsxDEV("div", {
|
|
8
|
+
children: [
|
|
9
|
+
"Unknown converted Slate node: ",
|
|
10
|
+
/*#__PURE__*/ _jsxDEV("strong", {
|
|
11
|
+
children: data?.nodeType
|
|
12
|
+
}, void 0, false, {
|
|
13
|
+
fileName: "src/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.tsx",
|
|
14
|
+
lineNumber: 17,
|
|
15
|
+
columnNumber: 37
|
|
16
|
+
}, this)
|
|
17
|
+
]
|
|
18
|
+
}, void 0, true, {
|
|
19
|
+
fileName: "src/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.tsx",
|
|
20
|
+
lineNumber: 16,
|
|
21
|
+
columnNumber: 5
|
|
22
|
+
}, this);
|
|
8
23
|
};
|
|
9
24
|
|
|
10
25
|
//# sourceMappingURL=Component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport type { UnknownConvertedNodeData } from './index.js'\n\nimport './index.scss'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted Slate node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],"names":["UnknownConvertedNodeComponent","props","data","div","strong","nodeType"],"mappings":"AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport type { UnknownConvertedNodeData } from './index.js'\n\nimport './index.scss'\n\ntype Props = {\n data: UnknownConvertedNodeData\n}\n\nexport const UnknownConvertedNodeComponent: React.FC<Props> = (props) => {\n const { data } = props\n\n return (\n <div>\n Unknown converted Slate node: <strong>{data?.nodeType}</strong>\n </div>\n )\n}\n"],"names":["React","UnknownConvertedNodeComponent","props","data","div","strong","nodeType"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAIzB,OAAO,eAAc;AAMrB,OAAO,MAAMC,gCAAiD,CAACC;IAC7D,MAAM,EAAEC,IAAI,EAAE,GAAGD;IAEjB,qBACE,QAACE;;YAAI;0BAC2B,QAACC;0BAAQF,MAAMG;;;;;;;;;;;;AAGnD,EAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
1
2
|
import { addClassNamesToElement } from '@lexical/utils';
|
|
2
3
|
import { $applyNodeReplacement, DecoratorNode } from 'lexical';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
const Component = React.lazy(()=>import('./Component.js').then((module)=>({
|
|
5
|
+
const Component = /*#__PURE__*/ React.lazy(()=>import('./Component.js').then((module)=>({
|
|
5
6
|
default: module.UnknownConvertedNodeComponent
|
|
6
7
|
})));
|
|
7
8
|
/** @noInheritDoc */ export class UnknownConvertedNode extends DecoratorNode {
|
|
@@ -37,7 +38,13 @@ const Component = React.lazy(()=>import('./Component.js').then((module)=>({
|
|
|
37
38
|
return element;
|
|
38
39
|
}
|
|
39
40
|
decorate() {
|
|
40
|
-
return
|
|
41
|
+
return /*#__PURE__*/ _jsxDEV(Component, {
|
|
42
|
+
data: this.__data
|
|
43
|
+
}, void 0, false, {
|
|
44
|
+
fileName: "src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx",
|
|
45
|
+
lineNumber: 66,
|
|
46
|
+
columnNumber: 12
|
|
47
|
+
}, this);
|
|
41
48
|
}
|
|
42
49
|
exportJSON() {
|
|
43
50
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new this({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'unknownConverted'\n }\n\n static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n override decorate(): JSX.Element {\n return <Component data={this.__data} />\n }\n\n override exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n override isInline(): boolean {\n return true\n }\n\n override updateDOM(prevNode: this, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return $applyNodeReplacement(\n new UnknownConvertedNode({\n data,\n }),\n )\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"mappings":"AAGA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,UAAS;AAC9D,YAAYC,WAAW,QAAO;AAc9B,MAAMC,
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.tsx"],"sourcesContent":["import type { EditorConfig, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\nimport * as React from 'react'\n\nexport type UnknownConvertedNodeData = {\n nodeData: unknown\n nodeType: string\n}\n\nexport type SerializedUnknownConvertedNode = Spread<\n {\n data: UnknownConvertedNodeData\n },\n SerializedLexicalNode\n>\n\nconst Component = React.lazy(() =>\n import('./Component.js').then((module) => ({\n default: module.UnknownConvertedNodeComponent,\n })),\n)\n\n/** @noInheritDoc */\nexport class UnknownConvertedNode extends DecoratorNode<JSX.Element> {\n __data: UnknownConvertedNodeData\n\n constructor({ data, key }: { data: UnknownConvertedNodeData; key?: NodeKey }) {\n super(key)\n this.__data = data\n }\n\n static override clone(node: UnknownConvertedNode): UnknownConvertedNode {\n return new this({\n data: node.__data,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'unknownConverted'\n }\n\n static override importJSON(serializedNode: SerializedUnknownConvertedNode): UnknownConvertedNode {\n const node = $createUnknownConvertedNode({ data: serializedNode.data })\n return node\n }\n\n canInsertTextAfter(): true {\n return true\n }\n\n canInsertTextBefore(): true {\n return true\n }\n\n override createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, 'unknownConverted')\n return element\n }\n\n override decorate(): JSX.Element {\n return <Component data={this.__data} />\n }\n\n override exportJSON(): SerializedUnknownConvertedNode {\n return {\n type: this.getType(),\n data: this.__data,\n version: 1,\n }\n }\n\n // Mutation\n\n override isInline(): boolean {\n return true\n }\n\n override updateDOM(prevNode: this, dom: HTMLElement): boolean {\n return false\n }\n}\n\nexport function $createUnknownConvertedNode({\n data,\n}: {\n data: UnknownConvertedNodeData\n}): UnknownConvertedNode {\n return $applyNodeReplacement(\n new UnknownConvertedNode({\n data,\n }),\n )\n}\n\nexport function $isUnknownConvertedNode(\n node: LexicalNode | null | undefined,\n): node is UnknownConvertedNode {\n return node instanceof UnknownConvertedNode\n}\n"],"names":["addClassNamesToElement","$applyNodeReplacement","DecoratorNode","React","Component","lazy","then","module","default","UnknownConvertedNodeComponent","UnknownConvertedNode","__data","data","key","clone","node","__key","getType","importJSON","serializedNode","$createUnknownConvertedNode","canInsertTextAfter","canInsertTextBefore","createDOM","config","element","document","createElement","decorate","exportJSON","type","version","isInline","updateDOM","prevNode","dom","$isUnknownConvertedNode"],"mappings":";AAGA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,UAAS;AAC9D,YAAYC,WAAW,QAAO;AAc9B,MAAMC,0BAAYD,MAAME,IAAI,CAAC,IAC3B,MAAM,CAAC,kBAAkBC,IAAI,CAAC,CAACC,SAAY,CAAA;YACzCC,SAASD,OAAOE,6BAA6B;QAC/C,CAAA;AAGF,kBAAkB,GAClB,OAAO,MAAMC,6BAA6BR;IACxCS,OAAgC;IAEhC,YAAY,EAAEC,IAAI,EAAEC,GAAG,EAAqD,CAAE;QAC5E,KAAK,CAACA;QACN,IAAI,CAACF,MAAM,GAAGC;IAChB;IAEA,OAAgBE,MAAMC,IAA0B,EAAwB;QACtE,OAAO,IAAI,IAAI,CAAC;YACdH,MAAMG,KAAKJ,MAAM;YACjBE,KAAKE,KAAKC,KAAK;QACjB;IACF;IAEA,OAAgBC,UAAkB;QAChC,OAAO;IACT;IAEA,OAAgBC,WAAWC,cAA8C,EAAwB;QAC/F,MAAMJ,OAAOK,4BAA4B;YAAER,MAAMO,eAAeP,IAAI;QAAC;QACrE,OAAOG;IACT;IAEAM,qBAA2B;QACzB,OAAO;IACT;IAEAC,sBAA4B;QAC1B,OAAO;IACT;IAESC,UAAUC,MAAoB,EAAe;QACpD,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvC3B,uBAAuByB,SAAS;QAChC,OAAOA;IACT;IAESG,WAAwB;QAC/B,qBAAO,QAACxB;YAAUQ,MAAM,IAAI,CAACD,MAAM;;;;;;IACrC;IAESkB,aAA6C;QACpD,OAAO;YACLC,MAAM,IAAI,CAACb,OAAO;YAClBL,MAAM,IAAI,CAACD,MAAM;YACjBoB,SAAS;QACX;IACF;IAEA,WAAW;IAEFC,WAAoB;QAC3B,OAAO;IACT;IAESC,UAAUC,QAAc,EAAEC,GAAgB,EAAW;QAC5D,OAAO;IACT;AACF;AAEA,OAAO,SAASf,4BAA4B,EAC1CR,IAAI,EAGL;IACC,OAAOX,sBACL,IAAIS,qBAAqB;QACvBE;IACF;AAEJ;AAEA,OAAO,SAASwB,wBACdrB,IAAoC;IAEpC,OAAOA,gBAAgBL;AACzB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
|
|
2
3
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
3
4
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
4
5
|
import { getTranslation } from '@payloadcms/translations';
|
|
@@ -53,37 +54,105 @@ export const RelationshipComponent = (props)=>{
|
|
|
53
54
|
setParams,
|
|
54
55
|
closeDocumentDrawer
|
|
55
56
|
]);
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
57
|
+
return /*#__PURE__*/ _jsxDEV("div", {
|
|
58
|
+
className: `${baseClass}__contents`,
|
|
59
|
+
contentEditable: false,
|
|
60
|
+
ref: relationshipElemRef,
|
|
61
|
+
children: [
|
|
62
|
+
/*#__PURE__*/ _jsxDEV("div", {
|
|
63
|
+
className: `${baseClass}__wrap`,
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ _jsxDEV("p", {
|
|
66
|
+
className: `${baseClass}__label`,
|
|
67
|
+
children: t('fields:labelRelationship', {
|
|
68
|
+
label: relatedCollection.labels?.singular ? getTranslation(relatedCollection.labels?.singular, i18n) : relatedCollection.slug
|
|
69
|
+
})
|
|
70
|
+
}, void 0, false, {
|
|
71
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
72
|
+
lineNumber: 86,
|
|
73
|
+
columnNumber: 9
|
|
74
|
+
}, this),
|
|
75
|
+
/*#__PURE__*/ _jsxDEV(DocumentDrawerToggler, {
|
|
76
|
+
className: `${baseClass}__doc-drawer-toggler`,
|
|
77
|
+
children: /*#__PURE__*/ _jsxDEV("p", {
|
|
78
|
+
className: `${baseClass}__title`,
|
|
79
|
+
children: data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : value
|
|
80
|
+
}, void 0, false, {
|
|
81
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
82
|
+
lineNumber: 94,
|
|
83
|
+
columnNumber: 11
|
|
84
|
+
}, this)
|
|
85
|
+
}, void 0, false, {
|
|
86
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
87
|
+
lineNumber: 93,
|
|
88
|
+
columnNumber: 9
|
|
89
|
+
}, this)
|
|
90
|
+
]
|
|
91
|
+
}, void 0, true, {
|
|
92
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
93
|
+
lineNumber: 85,
|
|
94
|
+
columnNumber: 7
|
|
95
|
+
}, this),
|
|
96
|
+
isEditable && /*#__PURE__*/ _jsxDEV("div", {
|
|
97
|
+
className: `${baseClass}__actions`,
|
|
98
|
+
children: [
|
|
99
|
+
/*#__PURE__*/ _jsxDEV(Button, {
|
|
100
|
+
buttonStyle: "icon-label",
|
|
101
|
+
className: `${baseClass}__swapButton`,
|
|
102
|
+
disabled: !isEditable,
|
|
103
|
+
el: "button",
|
|
104
|
+
icon: "swap",
|
|
105
|
+
onClick: ()=>{
|
|
106
|
+
if (nodeKey) {
|
|
107
|
+
editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {
|
|
108
|
+
replace: {
|
|
109
|
+
nodeKey
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
round: true,
|
|
115
|
+
tooltip: t('fields:swapRelationship')
|
|
116
|
+
}, void 0, false, {
|
|
117
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
118
|
+
lineNumber: 101,
|
|
119
|
+
columnNumber: 11
|
|
120
|
+
}, this),
|
|
121
|
+
/*#__PURE__*/ _jsxDEV(Button, {
|
|
122
|
+
buttonStyle: "icon-label",
|
|
123
|
+
className: `${baseClass}__removeButton`,
|
|
124
|
+
disabled: !isEditable,
|
|
125
|
+
icon: "x",
|
|
126
|
+
onClick: (e)=>{
|
|
127
|
+
e.preventDefault();
|
|
128
|
+
removeRelationship();
|
|
129
|
+
},
|
|
130
|
+
round: true,
|
|
131
|
+
tooltip: t('fields:removeRelationship')
|
|
132
|
+
}, void 0, false, {
|
|
133
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
134
|
+
lineNumber: 117,
|
|
135
|
+
columnNumber: 11
|
|
136
|
+
}, this)
|
|
137
|
+
]
|
|
138
|
+
}, void 0, true, {
|
|
139
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
140
|
+
lineNumber: 100,
|
|
141
|
+
columnNumber: 9
|
|
142
|
+
}, this),
|
|
143
|
+
!!value && /*#__PURE__*/ _jsxDEV(DocumentDrawer, {
|
|
144
|
+
onSave: updateRelationship
|
|
145
|
+
}, void 0, false, {
|
|
146
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
147
|
+
lineNumber: 132,
|
|
148
|
+
columnNumber: 19
|
|
149
|
+
}, this)
|
|
150
|
+
]
|
|
151
|
+
}, void 0, true, {
|
|
152
|
+
fileName: "src/features/relationship/client/components/RelationshipComponent.tsx",
|
|
153
|
+
lineNumber: 84,
|
|
154
|
+
columnNumber: 5
|
|
155
|
+
}, this);
|
|
87
156
|
};
|
|
88
157
|
|
|
89
158
|
//# sourceMappingURL=RelationshipComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/relationship/client/components/RelationshipComponent.tsx"],"sourcesContent":["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, useConfig, usePayloadAPI, useTranslation } from '@payloadcms/ui'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport './index.scss'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n className: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nexport const RelationshipComponent: React.FC<Props> = (props) => {\n const {\n className: baseClass,\n data: { relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.',\n )\n }\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const [relatedCollection] = useState(() => getEntityConfig({ collectionSlug: relationTo }))\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey!)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(() => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDocumentDrawer()\n dispatchCacheBust()\n }, [cacheBust, setParams, closeDocumentDrawer])\n\n return (\n <div className={`${baseClass}__contents`} contentEditable={false} ref={relationshipElemRef}>\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: relatedCollection.labels?.singular\n ? getTranslation(relatedCollection.labels?.singular, i18n)\n : relatedCollection.slug,\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : value}\n </p>\n </DocumentDrawerToggler>\n </div>\n {isEditable && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n if (nodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {!!value && <DocumentDrawer onSave={updateRelationship} />}\n </div>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","useConfig","usePayloadAPI","useTranslation","$getNodeByKey","React","useCallback","useReducer","useRef","useState","useLexicalDocumentDrawer","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","initialParams","depth","RelationshipComponent","props","className","baseClass","data","relationTo","value","nodeKey","Error","relationshipElemRef","editor","isEditable","config","routes","api","serverURL","getEntityConfig","relatedCollection","collectionSlug","i18n","t","cacheBust","dispatchCacheBust","state","setParams","slug","closeDocumentDrawer","DocumentDrawer","DocumentDrawerToggler","id","removeRelationship","update","remove","updateRelationship","div","contentEditable","ref","p","label","labels","singular","admin","useAsTitle","buttonStyle","disabled","el","icon","onClick","dispatchCommand","replace","round","tooltip","e","preventDefault","onSave"],"mappings":"AAAA
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/relationship/client/components/RelationshipComponent.tsx"],"sourcesContent":["'use client'\nimport type { ElementFormatType } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport { Button, useConfig, usePayloadAPI, useTranslation } from '@payloadcms/ui'\nimport { $getNodeByKey } from 'lexical'\nimport React, { useCallback, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport './index.scss'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n className: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nexport const RelationshipComponent: React.FC<Props> = (props) => {\n const {\n className: baseClass,\n data: { relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Relationship value should be a string or number. The Lexical Relationship component should not receive the populated value object.',\n )\n }\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n\n const [relatedCollection] = useState(() => getEntityConfig({ collectionSlug: relationTo }))\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey!)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(() => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n closeDocumentDrawer()\n dispatchCacheBust()\n }, [cacheBust, setParams, closeDocumentDrawer])\n\n return (\n <div className={`${baseClass}__contents`} contentEditable={false} ref={relationshipElemRef}>\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: relatedCollection.labels?.singular\n ? getTranslation(relatedCollection.labels?.singular, i18n)\n : relatedCollection.slug,\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : value}\n </p>\n </DocumentDrawerToggler>\n </div>\n {isEditable && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n if (nodeKey) {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }\n }}\n round\n tooltip={t('fields:swapRelationship')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {!!value && <DocumentDrawer onSave={updateRelationship} />}\n </div>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","useConfig","usePayloadAPI","useTranslation","$getNodeByKey","React","useCallback","useReducer","useRef","useState","useLexicalDocumentDrawer","INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND","initialParams","depth","RelationshipComponent","props","className","baseClass","data","relationTo","value","nodeKey","Error","relationshipElemRef","editor","isEditable","config","routes","api","serverURL","getEntityConfig","relatedCollection","collectionSlug","i18n","t","cacheBust","dispatchCacheBust","state","setParams","slug","closeDocumentDrawer","DocumentDrawer","DocumentDrawerToggler","id","removeRelationship","update","remove","updateRelationship","div","contentEditable","ref","p","label","labels","singular","admin","useAsTitle","buttonStyle","disabled","el","icon","onClick","dispatchCommand","replace","round","tooltip","e","preventDefault","onSave"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,MAAM,EAAEC,SAAS,EAAEC,aAAa,EAAEC,cAAc,QAAQ,iBAAgB;AACjF,SAASC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