@payloadcms/richtext-lexical 3.84.0 → 4.0.0-internal.38b7f1d
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/exports/client/Field-PJW7KUJG.js +2 -0
- package/dist/exports/client/Field-PJW7KUJG.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-5RONAYJM.js +2 -0
- package/dist/exports/client/RelationshipComponent-5RONAYJM.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-44G3K3W7.js +2 -0
- package/dist/exports/client/chunk-44G3K3W7.js.map +7 -0
- package/dist/exports/client/chunk-WSAPGI3Z.js +2 -0
- package/dist/exports/client/chunk-WSAPGI3Z.js.map +7 -0
- package/dist/exports/client/component-53Y3RYR5.js +2 -0
- package/dist/exports/client/component-53Y3RYR5.js.map +7 -0
- package/dist/exports/client/componentInline-PM4PLNUK.js +2 -0
- package/dist/exports/client/index.d.ts +0 -2
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +30 -30
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
- package/dist/features/align/client/toolbarAlignGroup.js +1 -0
- package/dist/features/align/client/toolbarAlignGroup.js.map +1 -1
- package/dist/features/blockquote/server/index.d.ts.map +1 -1
- package/dist/features/blockquote/server/index.js +0 -39
- package/dist/features/blockquote/server/index.js.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.d.ts +10 -0
- package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/index.css +178 -0
- package/dist/features/blocks/client/component/index.d.ts +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +88 -16
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.css +85 -0
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +29 -6
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +0 -2
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +3 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +26 -0
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +4 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +40 -0
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +7 -8
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
- package/dist/features/blocks/premade/CodeBlock/Component/index.css +171 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
- package/dist/features/debug/jsxConverter/client/plugin/style.css +9 -0
- package/dist/features/debug/testRecorder/client/plugin/index.css +51 -0
- package/dist/features/debug/testRecorder/client/plugin/index.d.ts +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.d.ts.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js +1 -0
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.css +81 -0
- package/dist/features/debug/treeView/client/plugin/index.d.ts +1 -1
- package/dist/features/debug/treeView/client/plugin/index.d.ts.map +1 -1
- package/dist/features/debug/treeView/client/plugin/index.js +1 -0
- package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.css +91 -0
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +3 -2
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.css +11 -0
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +1 -0
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.css +166 -0
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts +17 -0
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js +219 -0
- package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.css +235 -0
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +95 -104
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/experimental_table/server/index.d.ts.map +1 -1
- package/dist/features/experimental_table/server/index.js +0 -102
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +0 -39
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/horizontalRule/client/plugin/index.css +25 -0
- package/dist/features/horizontalRule/client/plugin/index.d.ts +1 -1
- package/dist/features/horizontalRule/client/plugin/index.d.ts.map +1 -1
- package/dist/features/horizontalRule/client/plugin/index.js +73 -4
- package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
- package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/index.js +0 -8
- package/dist/features/horizontalRule/server/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +28 -8
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.css +112 -0
- package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -0
- package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +0 -71
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/index.js +0 -7
- package/dist/features/lists/checklist/server/index.js.map +1 -1
- package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/index.js +0 -7
- package/dist/features/lists/orderedList/server/index.js.map +1 -1
- package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/index.js +0 -7
- package/dist/features/lists/unorderedList/server/index.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +27 -2
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/components/index.css +112 -0
- package/dist/features/toolbars/fixed/client/Toolbar/index.css +87 -0
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -0
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.css +43 -0
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +1 -0
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.css +57 -0
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +80 -74
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +4 -0
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.css +214 -0
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +11 -7
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +4 -0
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typesServer.d.ts +0 -17
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.css +218 -0
- package/dist/features/upload/client/component/index.d.ts +1 -1
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +86 -63
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/component/pending/index.d.ts +0 -1
- package/dist/features/upload/client/component/pending/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/pending/index.js.map +1 -1
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +0 -78
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/field/Diff/converters/listitem/index.css +44 -0
- package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
- package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
- package/dist/field/Diff/converters/listitem/index.js +1 -0
- package/dist/field/Diff/converters/listitem/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.css +68 -0
- package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
- package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
- package/dist/field/Diff/converters/relationship/index.js +1 -0
- package/dist/field/Diff/converters/relationship/index.js.map +1 -1
- package/dist/field/Diff/converters/unknown/index.css +37 -0
- package/dist/field/Diff/converters/unknown/index.d.ts +1 -1
- package/dist/field/Diff/converters/unknown/index.d.ts.map +1 -1
- package/dist/field/Diff/converters/unknown/index.js +1 -0
- package/dist/field/Diff/converters/unknown/index.js.map +1 -1
- package/dist/field/Diff/converters/upload/index.css +112 -0
- package/dist/field/Diff/converters/upload/index.d.ts +1 -1
- package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
- package/dist/field/Diff/converters/upload/index.js +1 -0
- package/dist/field/Diff/converters/upload/index.js.map +1 -1
- package/dist/field/Diff/index.css +101 -0
- package/dist/field/Diff/index.d.ts +1 -1
- package/dist/field/Diff/index.d.ts.map +1 -1
- package/dist/field/Diff/index.js +1 -0
- package/dist/field/Diff/index.js.map +1 -1
- package/dist/field/Field.d.ts +2 -2
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +11 -9
- package/dist/field/Field.js.map +1 -1
- package/dist/field/ViewSelector.css +32 -0
- package/dist/field/ViewSelector.d.ts +1 -1
- package/dist/field/ViewSelector.d.ts.map +1 -1
- package/dist/field/ViewSelector.js +1 -0
- package/dist/field/ViewSelector.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +60 -0
- package/dist/index.d.ts +0 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -10
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.css +50 -0
- package/dist/lexical/LexicalEditor.d.ts +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +1 -0
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/lexical/config/server/loader.js +12 -9
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +0 -6
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.css +11 -0
- package/dist/lexical/plugins/DecoratorPlugin/index.d.ts +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.js +1 -0
- package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +52 -0
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +1 -0
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.css +65 -0
- package/dist/lexical/plugins/SlashMenu/index.d.ts +1 -1
- package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +2 -0
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +40 -0
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +1 -0
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +84 -0
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +15 -8
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.css +359 -0
- package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
- package/dist/lexical/theme/EditorTheme.js +1 -0
- package/dist/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.css +95 -0
- package/dist/lexical/ui/ContentEditable.d.ts +1 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +1 -0
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.d.ts +4 -1
- package/dist/lexical/ui/icons/Add/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js +19 -12
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.svg +2 -3
- package/dist/lexical/ui/icons/Add/light.svg +2 -3
- package/dist/lexical/ui/icons/AlignCenter/index.d.ts +3 -1
- package/dist/lexical/ui/icons/AlignCenter/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js +15 -19
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.d.ts +3 -1
- package/dist/lexical/ui/icons/AlignJustify/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js +15 -19
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.d.ts +3 -1
- package/dist/lexical/ui/icons/AlignLeft/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js +15 -19
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.d.ts +3 -1
- package/dist/lexical/ui/icons/AlignRight/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js +15 -19
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Block/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js +13 -28
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Blockquote/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js +9 -6
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Bold/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js +13 -8
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.d.ts +4 -1
- package/dist/lexical/ui/icons/Checklist/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js +17 -18
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Code/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js +15 -13
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.d.ts +4 -1
- package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +18 -7
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Collapse/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Collapse/index.js +10 -8
- package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
- package/dist/lexical/ui/icons/DraggableBlock/index.svg +7 -7
- package/dist/lexical/ui/icons/DraggableBlock/light.svg +7 -7
- package/dist/lexical/ui/icons/Expand/index.d.ts +5 -0
- package/dist/lexical/ui/icons/Expand/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/Expand/index.js +22 -0
- package/dist/lexical/ui/icons/Expand/index.js.map +1 -0
- package/dist/lexical/ui/icons/H1/index.d.ts +3 -1
- package/dist/lexical/ui/icons/H1/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js +9 -6
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.d.ts +3 -1
- package/dist/lexical/ui/icons/H2/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js +9 -6
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.d.ts +3 -1
- package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js +9 -6
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.d.ts +3 -1
- package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js +9 -6
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.d.ts +3 -1
- package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js +9 -6
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.d.ts +3 -1
- package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js +9 -6
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.d.ts +3 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js +11 -11
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.d.ts +3 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js +18 -22
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.d.ts +3 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js +15 -22
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.d.ts +3 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/InlineBlocks/index.js +9 -6
- package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Italic/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js +13 -8
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.d.ts +4 -1
- package/dist/lexical/ui/icons/Link/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js +14 -9
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.d.ts +4 -1
- package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Meatballs/index.js +19 -15
- package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.d.ts +4 -1
- package/dist/lexical/ui/icons/OrderedList/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js +19 -25
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Page/index.d.ts +5 -0
- package/dist/lexical/ui/icons/Page/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/Page/index.js +21 -0
- package/dist/lexical/ui/icons/Page/index.js.map +1 -0
- package/dist/lexical/ui/icons/Relationship/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Relationship/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js +13 -25
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Strikethrough/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js +13 -13
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Subscript/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js +10 -7
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Superscript/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js +10 -7
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.d.ts +4 -1
- package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +20 -15
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.d.ts +4 -1
- package/dist/lexical/ui/icons/Text/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js +17 -8
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/Trash/index.d.ts +10 -0
- package/dist/lexical/ui/icons/Trash/index.d.ts.map +1 -0
- package/dist/lexical/ui/icons/Trash/index.js +29 -0
- package/dist/lexical/ui/icons/Trash/index.js.map +1 -0
- package/dist/lexical/ui/icons/Underline/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Underline/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js +16 -14
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.d.ts +3 -1
- package/dist/lexical/ui/icons/UnorderedList/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js +13 -40
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.d.ts +3 -1
- package/dist/lexical/ui/icons/Upload/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +15 -22
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/utilities/buildEditorState.d.ts.map +1 -1
- package/dist/utilities/buildEditorState.js +13 -0
- package/dist/utilities/buildEditorState.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts +1 -0
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +34 -18
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
- package/package.json +11 -16
- package/dist/exports/client/Component-DOSSWC76.js +0 -2
- package/dist/exports/client/Component-DOSSWC76.js.map +0 -7
- package/dist/exports/client/Component-MBLHTKDK.js +0 -2
- package/dist/exports/client/Component-MBLHTKDK.js.map +0 -7
- package/dist/exports/client/Field-4UEGQMIN.js +0 -2
- package/dist/exports/client/Field-4UEGQMIN.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-BG3DPV3T.js +0 -2
- package/dist/exports/client/RelationshipComponent-BG3DPV3T.js.map +0 -7
- package/dist/exports/client/chunk-F26IQ5RE.js +0 -2
- package/dist/exports/client/chunk-F26IQ5RE.js.map +0 -7
- package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
- package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
- package/dist/exports/client/component-XIHC3W6W.js +0 -2
- package/dist/exports/client/component-XIHC3W6W.js.map +0 -7
- package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
- package/dist/exports/server/migrate.d.ts +0 -16
- package/dist/exports/server/migrate.d.ts.map +0 -1
- package/dist/exports/server/migrate.js +0 -16
- package/dist/exports/server/migrate.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.d.ts +0 -4
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.js +0 -7
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts +0 -4
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js +0 -38
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.d.ts +0 -4
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.js +0 -9
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.d.ts +0 -4
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.js +0 -33
- package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.d.ts +0 -6
- package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.js +0 -9
- package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts +0 -70
- package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js +0 -104
- package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/types.d.ts +0 -27
- package/dist/features/converters/lexicalToHtml_deprecated/converter/types.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/converter/types.js +0 -2
- package/dist/features/converters/lexicalToHtml_deprecated/converter/types.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts +0 -39
- package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/field/index.js +0 -122
- package/dist/features/converters/lexicalToHtml_deprecated/field/index.js.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts +0 -12
- package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts.map +0 -1
- package/dist/features/converters/lexicalToHtml_deprecated/index.js +0 -11
- package/dist/features/converters/lexicalToHtml_deprecated/index.js.map +0 -1
- package/dist/features/lists/htmlConverter.d.ts +0 -5
- package/dist/features/lists/htmlConverter.d.ts.map +0 -1
- package/dist/features/lists/htmlConverter.js +0 -81
- package/dist/features/lists/htmlConverter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js +0 -22
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js +0 -33
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js +0 -24
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js +0 -25
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js +0 -22
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js +0 -28
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +0 -22
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts +0 -3
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js +0 -9
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts +0 -19
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +0 -78
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts +0 -23
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.js +0 -2
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +0 -2
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +0 -10
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts +0 -10
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +0 -49
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +0 -15
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +0 -74
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js +0 -23
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js +0 -24
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js +0 -33
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +0 -30
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js +0 -26
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js +0 -26
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js +0 -15
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js +0 -27
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js +0 -26
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js +0 -18
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts +0 -3
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.js +0 -12
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/index.d.ts +0 -19
- package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +0 -130
- package/dist/features/migrations/slateToLexical/converter/index.js.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/types.d.ts +0 -16
- package/dist/features/migrations/slateToLexical/converter/types.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/converter/types.js +0 -2
- package/dist/features/migrations/slateToLexical/converter/types.js.map +0 -1
- package/dist/features/migrations/slateToLexical/feature.client.d.ts +0 -2
- package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/feature.client.js +0 -10
- package/dist/features/migrations/slateToLexical/feature.client.js.map +0 -1
- package/dist/features/migrations/slateToLexical/feature.server.d.ts +0 -40
- package/dist/features/migrations/slateToLexical/feature.server.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/feature.server.js +0 -68
- package/dist/features/migrations/slateToLexical/feature.server.js.map +0 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +0 -15
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +0 -74
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
- package/dist/lexical/ui/icons/AI/index.d.ts +0 -3
- package/dist/lexical/ui/icons/AI/index.d.ts.map +0 -1
- package/dist/lexical/ui/icons/AI/index.js +0 -34
- package/dist/lexical/ui/icons/AI/index.js.map +0 -1
- package/dist/lexical/ui/icons/Caret/index.svg +0 -3
- package/dist/lexical/ui/icons/Edit/index.svg +0 -10
- package/dist/lexical/ui/icons/Remove/index.svg +0 -4
- package/dist/utilities/migrateSlateToLexical/index.d.ts +0 -15
- package/dist/utilities/migrateSlateToLexical/index.d.ts.map +0 -1
- package/dist/utilities/migrateSlateToLexical/index.js +0 -152
- package/dist/utilities/migrateSlateToLexical/index.js.map +0 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +0 -10
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +0 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +0 -85
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +0 -1
- /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-PM4PLNUK.js.map} +0 -0
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import { c as _c } from "react/compiler-runtime";
|
|
4
4
|
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
5
|
-
import { $insertNodeToNearestRoot } from '@lexical/utils';
|
|
6
|
-
import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
5
|
+
import { $findMatchingParent, $insertNodeToNearestRoot } from '@lexical/utils';
|
|
6
|
+
import { $getRoot, $getSelection, $isRangeSelection, $isRootOrShadowRoot, COMMAND_PRIORITY_EDITOR } from 'lexical';
|
|
7
7
|
import { useEffect } from 'react';
|
|
8
8
|
import { INSERT_HORIZONTAL_RULE_COMMAND } from '../../server/nodes/HorizontalRuleNode.js';
|
|
9
|
-
import { $createHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js';
|
|
9
|
+
import { $createHorizontalRuleNode, $isHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js';
|
|
10
|
+
import './index.css';
|
|
11
|
+
const HR_SELECTED_CLASS = 'LexicalEditorTheme__hrSelected';
|
|
10
12
|
/**
|
|
11
13
|
* Registers the INSERT_HORIZONTAL_RULE_COMMAND lexical command and defines the behavior for when it is called.
|
|
12
14
|
*/
|
|
@@ -16,7 +18,68 @@ export const HorizontalRulePlugin = () => {
|
|
|
16
18
|
let t0;
|
|
17
19
|
let t1;
|
|
18
20
|
if ($[0] !== editor) {
|
|
19
|
-
t0 = () =>
|
|
21
|
+
t0 = () => {
|
|
22
|
+
const unregisterCommand = editor.registerCommand(INSERT_HORIZONTAL_RULE_COMMAND, _temp, COMMAND_PRIORITY_EDITOR);
|
|
23
|
+
const unregisterUpdateListener = editor.registerUpdateListener(t2 => {
|
|
24
|
+
const {
|
|
25
|
+
editorState
|
|
26
|
+
} = t2;
|
|
27
|
+
editorState.read(() => {
|
|
28
|
+
const root = $getRoot();
|
|
29
|
+
const children = root.getChildren();
|
|
30
|
+
const selection_0 = $getSelection();
|
|
31
|
+
const hrEntries = [];
|
|
32
|
+
for (let i = 0; i < children.length; i++) {
|
|
33
|
+
const child = children[i];
|
|
34
|
+
if ($isHorizontalRuleNode(child)) {
|
|
35
|
+
const element = editor.getElementByKey(child.getKey());
|
|
36
|
+
if (element) {
|
|
37
|
+
hrEntries.push({
|
|
38
|
+
element,
|
|
39
|
+
index: i
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (hrEntries.length === 0) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!$isRangeSelection(selection_0) || selection_0.isCollapsed()) {
|
|
48
|
+
for (const {
|
|
49
|
+
element: element_0
|
|
50
|
+
} of hrEntries) {
|
|
51
|
+
element_0.classList.remove(HR_SELECTED_CLASS);
|
|
52
|
+
}
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const anchorNode = selection_0.anchor.getNode();
|
|
56
|
+
const focusNode_0 = selection_0.focus.getNode();
|
|
57
|
+
const anchorTopLevel = $findMatchingParent(anchorNode, _temp2) || anchorNode;
|
|
58
|
+
const focusTopLevel = $findMatchingParent(focusNode_0, _temp3) || focusNode_0;
|
|
59
|
+
const anchorIdx = children.indexOf(anchorTopLevel);
|
|
60
|
+
const focusIdx = children.indexOf(focusTopLevel);
|
|
61
|
+
if (anchorIdx === -1 || focusIdx === -1) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const startIdx = Math.min(anchorIdx, focusIdx);
|
|
65
|
+
const endIdx = Math.max(anchorIdx, focusIdx);
|
|
66
|
+
for (const {
|
|
67
|
+
element: element_1,
|
|
68
|
+
index
|
|
69
|
+
} of hrEntries) {
|
|
70
|
+
if (index >= startIdx && index <= endIdx) {
|
|
71
|
+
element_1.classList.add(HR_SELECTED_CLASS);
|
|
72
|
+
} else {
|
|
73
|
+
element_1.classList.remove(HR_SELECTED_CLASS);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
return () => {
|
|
79
|
+
unregisterCommand();
|
|
80
|
+
unregisterUpdateListener();
|
|
81
|
+
};
|
|
82
|
+
};
|
|
20
83
|
t1 = [editor];
|
|
21
84
|
$[0] = editor;
|
|
22
85
|
$[1] = t0;
|
|
@@ -40,4 +103,10 @@ function _temp(type) {
|
|
|
40
103
|
}
|
|
41
104
|
return true;
|
|
42
105
|
}
|
|
106
|
+
function _temp2(n) {
|
|
107
|
+
return $isRootOrShadowRoot(n.getParent());
|
|
108
|
+
}
|
|
109
|
+
function _temp3(n_0) {
|
|
110
|
+
return $isRootOrShadowRoot(n_0.getParent());
|
|
111
|
+
}
|
|
43
112
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$insertNodeToNearestRoot","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","useEffect","INSERT_HORIZONTAL_RULE_COMMAND","$createHorizontalRuleNode","HorizontalRulePlugin","$","editor","t0","t1","registerCommand","_temp","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","$insertNodeToNearestRoot","$getRoot","$getSelection","$isRangeSelection","$isRootOrShadowRoot","COMMAND_PRIORITY_EDITOR","useEffect","INSERT_HORIZONTAL_RULE_COMMAND","$createHorizontalRuleNode","$isHorizontalRuleNode","HR_SELECTED_CLASS","HorizontalRulePlugin","$","editor","t0","t1","unregisterCommand","registerCommand","_temp","unregisterUpdateListener","registerUpdateListener","t2","editorState","read","root","children","getChildren","selection_0","hrEntries","i","length","child","element","getElementByKey","getKey","push","index","selection","isCollapsed","element_0","classList","remove","anchorNode","anchor","getNode","focusNode_0","focus","anchorTopLevel","_temp2","focusTopLevel","focusNode","_temp3","anchorIdx","indexOf","focusIdx","startIdx","Math","min","endIdx","max","element_1","add","type","horizontalRuleNode","n","getParent","n_0"],"sources":["../../../../../src/features/horizontalRule/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $findMatchingParent, $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getRoot,\n $getSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n COMMAND_PRIORITY_EDITOR,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\n\nimport { INSERT_HORIZONTAL_RULE_COMMAND } from '../../server/nodes/HorizontalRuleNode.js'\nimport { $createHorizontalRuleNode, $isHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js'\nimport './index.css'\n\nconst HR_SELECTED_CLASS = 'LexicalEditorTheme__hrSelected'\n\n/**\n * Registers the INSERT_HORIZONTAL_RULE_COMMAND lexical command and defines the behavior for when it is called.\n */\nexport const HorizontalRulePlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n const unregisterCommand = editor.registerCommand(\n INSERT_HORIZONTAL_RULE_COMMAND,\n (type) => {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const focusNode = selection.focus.getNode()\n\n if (focusNode !== null) {\n const horizontalRuleNode = $createHorizontalRuleNode()\n $insertNodeToNearestRoot(horizontalRuleNode)\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n\n const unregisterUpdateListener = editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n const root = $getRoot()\n const children = root.getChildren()\n const selection = $getSelection()\n\n // Collect all HR nodes and their elements\n const hrEntries: Array<{ element: HTMLElement; index: number }> = []\n for (let i = 0; i < children.length; i++) {\n const child = children[i]\n if ($isHorizontalRuleNode(child)) {\n const element = editor.getElementByKey(child.getKey())\n if (element) {\n hrEntries.push({ element, index: i })\n }\n }\n }\n\n if (hrEntries.length === 0) {\n return\n }\n\n if (!$isRangeSelection(selection) || selection.isCollapsed()) {\n // Remove range-selection highlighting from all HRs\n for (const { element } of hrEntries) {\n element.classList.remove(HR_SELECTED_CLASS)\n }\n return\n }\n\n const anchorNode = selection.anchor.getNode()\n const focusNode = selection.focus.getNode()\n\n const anchorTopLevel =\n $findMatchingParent(anchorNode, (n) => $isRootOrShadowRoot(n.getParent())) || anchorNode\n const focusTopLevel =\n $findMatchingParent(focusNode, (n) => $isRootOrShadowRoot(n.getParent())) || focusNode\n\n const anchorIdx = children.indexOf(anchorTopLevel)\n const focusIdx = children.indexOf(focusTopLevel)\n\n if (anchorIdx === -1 || focusIdx === -1) {\n return\n }\n\n const startIdx = Math.min(anchorIdx, focusIdx)\n const endIdx = Math.max(anchorIdx, focusIdx)\n\n for (const { element, index } of hrEntries) {\n if (index >= startIdx && index <= endIdx) {\n element.classList.add(HR_SELECTED_CLASS)\n } else {\n element.classList.remove(HR_SELECTED_CLASS)\n }\n }\n })\n })\n\n return () => {\n unregisterCommand()\n unregisterUpdateListener()\n }\n }, [editor])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,wBAAwB,QAAQ;AAC9D,SACEC,QAAQ,EACRC,aAAa,EACbC,iBAAiB,EACjBC,mBAAmB,EACnBC,uBAAuB,QAClB;AACP,SAASC,SAAS,QAAQ;AAI1B,SAASC,8BAA8B,QAAQ;AAC/C,SAASC,yBAAyB,EAAEC,qBAAqB,QAAQ;AACjE,OAAO;AAEP,MAAMC,iBAAA,GAAoB;AAE1B;;;AAGA,OAAO,MAAMC,oBAAA,GAAmDA,CAAA;EAAA,MAAAC,CAAA,GAAAf,EAAA;EAC9D,OAAAgB,MAAA,IAAiBf,yBAAA;EAAA,IAAAgB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAH,CAA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,yBAAA;IAC3BR,wBAAA,CAAyB+D,kBAAA;EAAA;EAAA;AAAA;AAjB6B,SAAAf,OAAAgB,CAAA;EAAA,OA2Df5D,mBAAA,CAAoB4D,CAAA,CAAAC,SAAA,CAAW;AAAA;AA3DhB,SAAAd,OAAAe,GAAA;EAAA,OA6DhB9D,mBAAA,CAAoB4D,GAAA,CAAAC,SAAA,CAAW;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,+
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/horizontalRule/server/index.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB,+FAYhC,CAAA"}
|
|
@@ -9,14 +9,6 @@ export const HorizontalRuleFeature = createServerFeature({
|
|
|
9
9
|
i18n,
|
|
10
10
|
markdownTransformers: [MarkdownTransformer],
|
|
11
11
|
nodes: [createNode({
|
|
12
|
-
converters: {
|
|
13
|
-
html: {
|
|
14
|
-
converter: () => {
|
|
15
|
-
return `<hr/>`;
|
|
16
|
-
},
|
|
17
|
-
nodeTypes: [HorizontalRuleServerNode.getType()]
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
12
|
node: HorizontalRuleServerNode
|
|
21
13
|
})]
|
|
22
14
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["createServerFeature","createNode","i18n","MarkdownTransformer","HorizontalRuleServerNode","HorizontalRuleFeature","feature","ClientFeature","markdownTransformers","nodes","
|
|
1
|
+
{"version":3,"file":"index.js","names":["createServerFeature","createNode","i18n","MarkdownTransformer","HorizontalRuleServerNode","HorizontalRuleFeature","feature","ClientFeature","markdownTransformers","nodes","node","key"],"sources":["../../../../src/features/horizontalRule/server/index.ts"],"sourcesContent":["import { createServerFeature } from '../../../utilities/createServerFeature.js'\nimport { createNode } from '../../typeUtilities.js'\nimport { i18n } from './i18n.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\nimport { HorizontalRuleServerNode } from './nodes/HorizontalRuleNode.js'\n\nexport const HorizontalRuleFeature = createServerFeature({\n feature: {\n ClientFeature: '@payloadcms/richtext-lexical/client#HorizontalRuleFeatureClient',\n i18n,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n node: HorizontalRuleServerNode,\n }),\n ],\n },\n key: 'horizontalRule',\n})\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ;AACpC,SAASC,UAAU,QAAQ;AAC3B,SAASC,IAAI,QAAQ;AACrB,SAASC,mBAAmB,QAAQ;AACpC,SAASC,wBAAwB,QAAQ;AAEzC,OAAO,MAAMC,qBAAA,GAAwBL,mBAAA,CAAoB;EACvDM,OAAA,EAAS;IACPC,aAAA,EAAe;IACfL,IAAA;IACAM,oBAAA,EAAsB,CAACL,mBAAA,CAAoB;IAC3CM,KAAA,EAAO,CACLR,UAAA,CAAW;MACTS,IAAA,EAAMN;IACR;EAEJ;EACAO,GAAA,EAAK;AACP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAoE,MAAM,OAAO,CAAA;AAwBxF,wBAAgB,UAAU,CAAC,EAAE,UAAU,EAAE,EAAE;IAAE,UAAU,EAAE,WAAW,CAAA;CAAE,GAAG,KAAK,CAAC,SAAS,CAgavF"}
|
|
@@ -5,12 +5,15 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
|
|
|
5
5
|
import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
6
6
|
import { $findMatchingParent, mergeRegister } from '@lexical/utils';
|
|
7
7
|
import { getTranslation } from '@payloadcms/translations';
|
|
8
|
-
import {
|
|
8
|
+
import { ExternalLinkIcon, formatDrawerSlug, useConfig, useEditDepth, useLocale, useTranslation, WriteIcon } from '@payloadcms/ui';
|
|
9
9
|
import { requests } from '@payloadcms/ui/shared';
|
|
10
10
|
import { $getSelection, $isLineBreakNode, $isRangeSelection, COMMAND_PRIORITY_HIGH, COMMAND_PRIORITY_LOW, getDOMSelection, KEY_ESCAPE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
11
11
|
import { formatAdminURL } from 'payload/shared';
|
|
12
12
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
13
13
|
import { useEditorConfigContext } from '../../../../../../lexical/config/client/EditorConfigProvider.js';
|
|
14
|
+
import { LinkIcon } from '../../../../../../lexical/ui/icons/Link/index.js';
|
|
15
|
+
import { PageIcon } from '../../../../../../lexical/ui/icons/Page/index.js';
|
|
16
|
+
import { TrashIcon } from '../../../../../../lexical/ui/icons/Trash/index.js';
|
|
14
17
|
import { getSelectedNode } from '../../../../../../lexical/utils/getSelectedNode.js';
|
|
15
18
|
import { setFloatingElemPositionForLinkEditor } from '../../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js';
|
|
16
19
|
import { FieldsDrawer } from '../../../../../../utilities/fieldsDrawer/Drawer.js';
|
|
@@ -254,20 +257,35 @@ export function LinkEditor({
|
|
|
254
257
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
255
258
|
children: [/*#__PURE__*/_jsx("div", {
|
|
256
259
|
className: "link-editor",
|
|
260
|
+
"data-theme": "dark",
|
|
257
261
|
ref: editorRef,
|
|
258
262
|
children: /*#__PURE__*/_jsxs("div", {
|
|
259
263
|
className: "link-input",
|
|
260
|
-
children: [linkUrl && linkUrl.length > 0 ? /*#__PURE__*/_jsxs("a", {
|
|
264
|
+
children: [linkNode?.__fields?.linkType === 'custom' ? /*#__PURE__*/_jsx(LinkIcon, {}) : /*#__PURE__*/_jsx(PageIcon, {}), linkUrl && linkUrl.length > 0 ? /*#__PURE__*/_jsxs("a", {
|
|
265
|
+
className: "link-input__url",
|
|
261
266
|
href: linkUrl,
|
|
262
267
|
rel: "noopener noreferrer",
|
|
263
268
|
target: "_blank",
|
|
264
|
-
children: [
|
|
269
|
+
children: [linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl, linkNode?.__fields.newTab ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
270
|
+
children: [/*#__PURE__*/_jsx(ExternalLinkIcon, {
|
|
271
|
+
size: 16
|
|
272
|
+
}), " ", /*#__PURE__*/_jsx("div", {
|
|
273
|
+
className: "link-input__divider"
|
|
274
|
+
}), ' ']
|
|
275
|
+
}) : null]
|
|
265
276
|
}) : linkLabel != null && linkLabel.length > 0 ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
266
|
-
children: [
|
|
277
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
267
278
|
className: "link-input__label-pure",
|
|
268
279
|
children: linkLabel
|
|
269
|
-
})
|
|
270
|
-
|
|
280
|
+
}), linkNode?.__fields.newTab ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
281
|
+
children: [/*#__PURE__*/_jsx(ExternalLinkIcon, {
|
|
282
|
+
size: 16
|
|
283
|
+
}), " ", /*#__PURE__*/_jsx("div", {
|
|
284
|
+
className: "link-input__divider"
|
|
285
|
+
}), ' ']
|
|
286
|
+
}) : null]
|
|
287
|
+
}) : null, isEditable && /*#__PURE__*/_jsxs("div", {
|
|
288
|
+
className: "link-input__actions",
|
|
271
289
|
children: [/*#__PURE__*/_jsx("button", {
|
|
272
290
|
"aria-label": "Edit link",
|
|
273
291
|
className: "link-edit",
|
|
@@ -278,7 +296,7 @@ export function LinkEditor({
|
|
|
278
296
|
onMouseDown: preventDefault,
|
|
279
297
|
tabIndex: 0,
|
|
280
298
|
type: "button",
|
|
281
|
-
children: /*#__PURE__*/_jsx(
|
|
299
|
+
children: /*#__PURE__*/_jsx(WriteIcon, {})
|
|
282
300
|
}), !isAutoLink && /*#__PURE__*/_jsx("button", {
|
|
283
301
|
"aria-label": "Remove link",
|
|
284
302
|
className: "link-trash",
|
|
@@ -288,7 +306,9 @@ export function LinkEditor({
|
|
|
288
306
|
onMouseDown: preventDefault,
|
|
289
307
|
tabIndex: 0,
|
|
290
308
|
type: "button",
|
|
291
|
-
children: /*#__PURE__*/_jsx(
|
|
309
|
+
children: /*#__PURE__*/_jsx(TrashIcon, {
|
|
310
|
+
small: true
|
|
311
|
+
})
|
|
292
312
|
})]
|
|
293
313
|
})]
|
|
294
314
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","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","formatAdminURL","React","useCallback","useEffect","useLayoutEffect","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","selectedNodeRectRef","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","apiRoute","api","path","serverURL","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","_jsxs","Fragment","_jsx","ref","length","href","rel","target","__fields","newTab","_Fragment","onClick","onMouseDown","tabIndex","type","drawerTitle","featureKey","handleDrawerSubmit","newLinkPayload","bareLinkFields","linkParent","getParent","schemaPathSuffix"],"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 { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useEffect, useLayoutEffect, 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 selectedNodeRectRef = useRef<DOMRect | 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(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/${collection}/${id}`,\n serverURL: config.serverURL,\n }),\n {\n headers: {\n 'Accept-Language': i18n.language,\n },\n params: {\n depth: 0,\n locale: locale?.code,\n },\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 // Store the rect for positioning in useLayoutEffect after content renders\n selectedNodeRectRef.current = selectedNodeDomRect\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 // Position the tooltip after React renders the link content\n useLayoutEffect(() => {\n if (!isLink || !editorRef.current || !anchorElem || !selectedNodeRectRef.current) {\n return\n }\n\n // Now the DOM has the actual link element, we can position the tooltip\n setFloatingElemPositionForLinkEditor(selectedNodeRectRef.current, editorRef.current, anchorElem)\n // linkNode dependency ensures re-positioning when clicking between different links with the same URL\n }, [linkUrl, linkLabel, isLink, anchorElem, linkNode])\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"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SAASC,cAAc,QAAQ;AAC/B,SACEC,aAAa,EACbC,QAAQ,EACRC,gBAAgB,EAChBC,gBAAgB,EAChBC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,cAAc,QACT;AACP,SAASC,QAAQ,QAAQ;AACzB,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,eAAe,EACfC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAE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kF,cAAA,GAAiBlF,MAAA;QAEvB,MAAMmF,cAAA,GAA6B;UACjC,GAAGD;QACL;QACA,OAAOC,cAAA,CAAehF,IAAI;QAE1B;QACAxD,MAAA,CAAO6G,MAAM,CAAC;UACZ,MAAMvE,WAAA,GAAYnE,aAAA;UAClB,IAAIsK,UAAA,GAAiC;UACrC,IAAIpK,iBAAA,CAAkBiE,WAAA,GAAY;YAChCmG,UAAA,GAAatJ,eAAA,CAAgBmD,WAAA,EAAWoG,SAAS;UACnD,OAAO;YACL,IAAIpH,aAAA,CAAcmG,MAAM,EAAE;cACxBgB,UAAA,GAAanH,aAAa,CAAC,EAAE,EAAEoH,SAAA,MAAe;YAChD;UACF;UAEA,IAAID,UAAA,IAAclJ,eAAA,CAAgBkJ,UAAA,GAAa;YAC7C,MAAMxI,UAAA,GAAWT,eAAA,CAAgB;cAC/B2D,MAAA,EAAQqF;YACV;YACAC,UAAA,CAAW/D,OAAO,CAACzE,UAAA,EAAU;UAC/B;QACF;QAEA;QACA;QACAD,MAAA,CAAO0G,eAAe,CAAChH,mBAAA,EAAqB;UAC1CyD,MAAA,EAAQqF,cAAA;UACRlH,aAAA;UACAkC,IAAA,EAAM+E,cAAA,CAAe/E;QACvB;MACF;MACA9C,UAAA,EAAYA,UAAA;MACZiI,gBAAA,EAAiB;;;AAIzB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","$findMatchingParent","mergeRegister","getTranslation","ExternalLinkIcon","formatDrawerSlug","useConfig","useEditDepth","useLocale","useTranslation","WriteIcon","requests","$getSelection","$isLineBreakNode","$isRangeSelection","COMMAND_PRIORITY_HIGH","COMMAND_PRIORITY_LOW","getDOMSelection","KEY_ESCAPE_COMMAND","SELECTION_CHANGE_COMMAND","formatAdminURL","React","useCallback","useEffect","useLayoutEffect","useRef","useState","useEditorConfigContext","LinkIcon","PageIcon","TrashIcon","getSelectedNode","setFloatingElemPositionForLinkEditor","FieldsDrawer","useLexicalDrawer","$isAutoLinkNode","$createLinkNode","$isLinkNode","TOGGLE_LINK_COMMAND","TOGGLE_LINK_WITH_MODAL_COMMAND","preventDefault","event","LinkEditor","anchorElem","editor","linkNode","setLinkNode","editorRef","selectedNodeRectRef","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","apiRoute","api","path","serverURL","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","_jsxs","Fragment","_jsx","ref","__fields","length","href","rel","target","newTab","_Fragment","size","onClick","onMouseDown","tabIndex","type","small","drawerTitle","featureKey","handleDrawerSubmit","newLinkPayload","bareLinkFields","linkParent","getParent","schemaPathSuffix"],"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 ExternalLinkIcon,\n formatDrawerSlug,\n useConfig,\n useEditDepth,\n useLocale,\n useTranslation,\n WriteIcon,\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 { formatAdminURL } from 'payload/shared'\nimport React, { useCallback, useEffect, useLayoutEffect, 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 { LinkIcon } from '../../../../../../lexical/ui/icons/Link/index.js'\nimport { PageIcon } from '../../../../../../lexical/ui/icons/Page/index.js'\nimport { TrashIcon } from '../../../../../../lexical/ui/icons/Trash/index.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 selectedNodeRectRef = useRef<DOMRect | 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(\n formatAdminURL({\n apiRoute: config.routes.api,\n path: `/${collection}/${id}`,\n serverURL: config.serverURL,\n }),\n {\n headers: {\n 'Accept-Language': i18n.language,\n },\n params: {\n depth: 0,\n locale: locale?.code,\n },\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 // Store the rect for positioning in useLayoutEffect after content renders\n selectedNodeRectRef.current = selectedNodeDomRect\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 // Position the tooltip after React renders the link content\n useLayoutEffect(() => {\n if (!isLink || !editorRef.current || !anchorElem || !selectedNodeRectRef.current) {\n return\n }\n\n // Now the DOM has the actual link element, we can position the tooltip\n setFloatingElemPositionForLinkEditor(selectedNodeRectRef.current, editorRef.current, anchorElem)\n // linkNode dependency ensures re-positioning when clicking between different links with the same URL\n }, [linkUrl, linkLabel, isLink, anchorElem, linkNode])\n\n return (\n <React.Fragment>\n <div className=\"link-editor\" data-theme=\"dark\" ref={editorRef}>\n <div className=\"link-input\">\n {linkNode?.__fields?.linkType === 'custom' ? <LinkIcon /> : <PageIcon />}\n {linkUrl && linkUrl.length > 0 ? (\n <a className=\"link-input__url\" href={linkUrl} rel=\"noopener noreferrer\" target=\"_blank\">\n {linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl}\n {linkNode?.__fields.newTab ? (\n <>\n <ExternalLinkIcon size={16} /> <div className=\"link-input__divider\" />{' '}\n </>\n ) : null}\n </a>\n ) : linkLabel != null && linkLabel.length > 0 ? (\n <>\n <span className=\"link-input__label-pure\">{linkLabel}</span>\n {linkNode?.__fields.newTab ? (\n <>\n <ExternalLinkIcon size={16} /> <div className=\"link-input__divider\" />{' '}\n </>\n ) : null}\n </>\n ) : null}\n\n {isEditable && (\n <div className=\"link-input__actions\">\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 <WriteIcon />\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 <TrashIcon small />\n </button>\n )}\n </div>\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"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SAASC,cAAc,QAAQ;AAC/B,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,SAAS,EACTC,YAAY,EACZC,SAAS,EACTC,cAAc,EACdC,SAAS,QACJ;AACP,SAASC,QAAQ,QAAQ;AACzB,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,eAAe,EACfC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,eAAe,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAMjF,SAASC,sBAAsB,QAAQ;AACvC,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,SAAS,QAAQ;AAC1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oCAAoC,QAAQ;AACrD,SAASC,YAAY,QAAQ;AAC7B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,EAAEC,WAAW,EAAEC,mBAAmB,QAAQ;AAClE,SAASC,8BAA8B,QAAQ;AAE/C,SAASC,eACPC,KAA4E;EAE5EA,KAAA,CAAMD,cAAc;AACtB;AAEA,OAAO,SAASE,WAAW;EAAEC;AAAU,CAA+B;EACpE,MAAM,CAACC,MAAA,CAAO,GAAG7C,yBAAA;EACjB;EACA;EACA,MAAM,CAAC8C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AI;QAE1B;QACAxD,MAAA,CAAO6G,MAAM,CAAC;UACZ,MAAMvE,WAAA,GAAYtE,aAAA;UAClB,IAAI2K,UAAA,GAAiC;UACrC,IAAIzK,iBAAA,CAAkBoE,WAAA,GAAY;YAChCqG,UAAA,GAAaxJ,eAAA,CAAgBmD,WAAA,EAAWsG,SAAS;UACnD,OAAO;YACL,IAAItH,aAAA,CAAcoG,MAAM,EAAE;cACxBiB,UAAA,GAAarH,aAAa,CAAC,EAAE,EAAEsH,SAAA,MAAe;YAChD;UACF;UAEA,IAAID,UAAA,IAAcpJ,eAAA,CAAgBoJ,UAAA,GAAa;YAC7C,MAAM1I,UAAA,GAAWT,eAAA,CAAgB;cAC/B2D,MAAA,EAAQuF;YACV;YACAC,UAAA,CAAWjE,OAAO,CAACzE,UAAA,EAAU;UAC/B;QACF;QAEA;QACA;QACAD,MAAA,CAAO0G,eAAe,CAAChH,mBAAA,EAAqB;UAC1CyD,MAAA,EAAQuF,cAAA;UACRpH,aAAA;UACAkC,IAAA,EAAMiF,cAAA,CAAejF;QACvB;MACF;MACA9C,UAAA,EAAYA,UAAA;MACZmI,gBAAA,EAAiB;;;AAIzB","ignoreList":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
@layer payload-default {
|
|
2
|
+
.link-editor {
|
|
3
|
+
z-index: 1;
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
gap: var(--spacer-2);
|
|
7
|
+
background: var(--color-bg-menu);
|
|
8
|
+
padding: 0 var(--spacer-2);
|
|
9
|
+
height: var(--spacer-6);
|
|
10
|
+
vertical-align: middle;
|
|
11
|
+
position: absolute;
|
|
12
|
+
top: 0;
|
|
13
|
+
left: 0;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
border-radius: var(--radius-large);
|
|
16
|
+
transition: opacity 0.2s;
|
|
17
|
+
will-change: transform;
|
|
18
|
+
overflow: clip;
|
|
19
|
+
box-shadow:
|
|
20
|
+
0px 3px 8px 0px rgba(0, 0, 0, 0.35),
|
|
21
|
+
0px 1px 3px 0px rgba(0, 0, 0, 0.5),
|
|
22
|
+
inset 0px 0.5px 0px 0px rgba(255, 255, 255, 0.08),
|
|
23
|
+
inset 0px 0px 0.5px 0px rgba(255, 255, 255, 0.3);
|
|
24
|
+
|
|
25
|
+
.link-input {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
flex-wrap: nowrap;
|
|
30
|
+
width: 100%;
|
|
31
|
+
min-width: 0;
|
|
32
|
+
box-sizing: border-box;
|
|
33
|
+
gap: var(--spacer-2);
|
|
34
|
+
border: 0;
|
|
35
|
+
outline: 0;
|
|
36
|
+
position: relative;
|
|
37
|
+
font-family: var(--font-body);
|
|
38
|
+
|
|
39
|
+
> .icon:first-child {
|
|
40
|
+
color: var(--color-white-400);
|
|
41
|
+
flex-shrink: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& a {
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
text-decoration: underline;
|
|
49
|
+
gap: var(--spacer-1);
|
|
50
|
+
white-space: nowrap;
|
|
51
|
+
overflow: hidden;
|
|
52
|
+
text-overflow: ellipsis;
|
|
53
|
+
color: var(--color-text-onbrand);
|
|
54
|
+
font-size: var(--text-body-medium-font-size);
|
|
55
|
+
line-height: var(--text-body-medium-line-height);
|
|
56
|
+
min-width: 0;
|
|
57
|
+
height: 100%;
|
|
58
|
+
|
|
59
|
+
&:hover {
|
|
60
|
+
color: var(--color-text-onbrand);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.link-input__divider {
|
|
66
|
+
width: var(--stroke-width-small);
|
|
67
|
+
align-self: stretch;
|
|
68
|
+
background-color: var(--color-white-400);
|
|
69
|
+
margin-left: var(--spacer-2);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.link-input__label-pure {
|
|
73
|
+
color: var(--color-text-onbrand);
|
|
74
|
+
margin-right: var(--spacer-3);
|
|
75
|
+
display: block;
|
|
76
|
+
white-space: nowrap;
|
|
77
|
+
overflow: hidden;
|
|
78
|
+
font-size: var(--text-body-medium-font-size);
|
|
79
|
+
line-height: var(--text-body-medium-line-height);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.link-input__actions {
|
|
83
|
+
display: flex;
|
|
84
|
+
gap: var(--spacer-1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
button {
|
|
88
|
+
all: unset;
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: center;
|
|
92
|
+
min-width: var(--spacer-4);
|
|
93
|
+
min-height: var(--spacer-4);
|
|
94
|
+
cursor: pointer;
|
|
95
|
+
color: var(--color-icon-onbrand);
|
|
96
|
+
border-radius: var(--radius-medium);
|
|
97
|
+
|
|
98
|
+
&:hover:not([disabled]) {
|
|
99
|
+
color: var(--color-icon-onbrand);
|
|
100
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
&:focus-visible {
|
|
104
|
+
outline: var(--stroke-width-small) solid var(--color-border-brand-strong);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.icon {
|
|
109
|
+
color: var(--color-icon-onbrand);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PluginComponentWithAnchor } from '../../../../typesClient.js';
|
|
2
2
|
import type { ClientProps } from '../../index.js';
|
|
3
|
-
import './index.
|
|
3
|
+
import './index.css';
|
|
4
4
|
export declare const FloatingLinkEditorPlugin: PluginComponentWithAnchor<ClientProps>;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/link/client/plugins/floatingLinkEditor/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/link/client/plugins/floatingLinkEditor/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,OAAO,aAAa,CAAA;AAGpB,eAAO,MAAM,wBAAwB,EAAE,yBAAyB,CAAC,WAAW,CAI3E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","createPortal","LinkEditor","FloatingLinkEditorPlugin","props","anchorElem","document","body","_jsx"],"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.
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","createPortal","LinkEditor","FloatingLinkEditorPlugin","props","anchorElem","document","body","_jsx"],"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.css'\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"],"mappings":"AAAA;;;AACA,YAAYA,KAAA,MAAW;AACvB,SAASC,YAAY,QAAQ;AAK7B,OAAO;AACP,SAASC,UAAU,QAAQ;AAE3B,OAAO,MAAMC,wBAAA,GAAoEC,KAAA;EAC/E,MAAM;IAAEC,UAAA,GAAaC,QAAA,CAASC;EAAI,CAAE,GAAGH,KAAA;EAEvC,oBAAOH,YAAA,cAAaO,IAAA,CAACN,UAAA;IAAWG,UAAA,EAAYA;MAAgBA,UAAA;AAC9D","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,KAAK,EACL,kBAAkB,EAElB,eAAe,EAChB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/link/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,KAAK,EACL,kBAAkB,EAElB,eAAe,EAChB,MAAM,SAAS,CAAA;AAKhB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAY3D,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,cAAc,EAAE,CAAA;IAGtC,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,cAAc,EAAE,CAAA;CACtC,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;;;;;OAQG;IACH,gBAAgB,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACxC;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,kBAAkB,EAAE,CAAA;KACpC,KAAK,CAAC,KAAK,GAAG,kBAAkB,CAAC,EAAE,CAAC,GACrC,KAAK,EAAE,CAAA;IACX;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,kBAAkB,CAAA;KAAE,KAAK,MAAM,CAAA;IACtE;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,6BAA6B,CAAA;AAEjC,eAAO,MAAM,WAAW,2HA6GtB,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import escapeHTML from 'escape-html';
|
|
2
1
|
import { sanitizeFields } from 'payload';
|
|
3
2
|
import { createServerFeature } from '../../../utilities/createServerFeature.js';
|
|
4
|
-
import { convertLexicalNodesToHTML } from '../../converters/lexicalToHtml_deprecated/converter/index.js';
|
|
5
3
|
import { createNode } from '../../typeUtilities.js';
|
|
6
4
|
import { createLinkMarkdownTransformer } from '../markdownTransformer.js';
|
|
7
5
|
import { AutoLinkNode } from '../nodes/AutoLinkNode.js';
|
|
@@ -70,79 +68,10 @@ export const LinkFeature = createServerFeature({
|
|
|
70
68
|
internalDocToHref: props.internalDocToHref
|
|
71
69
|
})],
|
|
72
70
|
nodes: [props?.disableAutoLinks === true ? null : createNode({
|
|
73
|
-
converters: {
|
|
74
|
-
html: {
|
|
75
|
-
converter: async ({
|
|
76
|
-
converters,
|
|
77
|
-
currentDepth,
|
|
78
|
-
depth,
|
|
79
|
-
draft,
|
|
80
|
-
node,
|
|
81
|
-
overrideAccess,
|
|
82
|
-
parent,
|
|
83
|
-
req,
|
|
84
|
-
showHiddenFields
|
|
85
|
-
}) => {
|
|
86
|
-
const childrenText = await convertLexicalNodesToHTML({
|
|
87
|
-
converters,
|
|
88
|
-
currentDepth,
|
|
89
|
-
depth,
|
|
90
|
-
draft,
|
|
91
|
-
lexicalNodes: node.children,
|
|
92
|
-
overrideAccess,
|
|
93
|
-
parent: {
|
|
94
|
-
...node,
|
|
95
|
-
parent
|
|
96
|
-
},
|
|
97
|
-
req,
|
|
98
|
-
showHiddenFields
|
|
99
|
-
});
|
|
100
|
-
let href = node.fields.url ?? '';
|
|
101
|
-
if (node.fields.linkType === 'internal') {
|
|
102
|
-
href = typeof node.fields.doc?.value !== 'object' ? String(node.fields.doc?.value) : String(node.fields.doc?.value?.id);
|
|
103
|
-
}
|
|
104
|
-
return `<a href="${href}"${node.fields.newTab ? ' rel="noopener noreferrer" target="_blank"' : ''}>${childrenText}</a>`;
|
|
105
|
-
},
|
|
106
|
-
nodeTypes: [AutoLinkNode.getType()]
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
71
|
node: AutoLinkNode,
|
|
110
72
|
// Since AutoLinkNodes are just internal links, they need no hooks or graphQL population promises
|
|
111
73
|
validations: [linkValidation(props, sanitizedFieldsWithoutText)]
|
|
112
74
|
}), createNode({
|
|
113
|
-
converters: {
|
|
114
|
-
html: {
|
|
115
|
-
converter: async ({
|
|
116
|
-
converters,
|
|
117
|
-
currentDepth,
|
|
118
|
-
depth,
|
|
119
|
-
draft,
|
|
120
|
-
node,
|
|
121
|
-
overrideAccess,
|
|
122
|
-
parent,
|
|
123
|
-
req,
|
|
124
|
-
showHiddenFields
|
|
125
|
-
}) => {
|
|
126
|
-
const childrenText = await convertLexicalNodesToHTML({
|
|
127
|
-
converters,
|
|
128
|
-
currentDepth,
|
|
129
|
-
depth,
|
|
130
|
-
draft,
|
|
131
|
-
lexicalNodes: node.children,
|
|
132
|
-
overrideAccess,
|
|
133
|
-
parent: {
|
|
134
|
-
...node,
|
|
135
|
-
parent
|
|
136
|
-
},
|
|
137
|
-
req,
|
|
138
|
-
showHiddenFields
|
|
139
|
-
});
|
|
140
|
-
const href = node.fields.linkType === 'custom' ? escapeHTML(node.fields.url) : node.fields.doc?.value;
|
|
141
|
-
return `<a href="${href}"${node.fields.newTab ? ' rel="noopener noreferrer" target="_blank"' : ''}>${childrenText}</a>`;
|
|
142
|
-
},
|
|
143
|
-
nodeTypes: [LinkNode.getType()]
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
75
|
getSubFields: () => {
|
|
147
76
|
return sanitizedFieldsWithoutText;
|
|
148
77
|
},
|