@payloadcms/richtext-lexical 3.0.0-beta.53 → 3.0.0-beta.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cell/index.d.ts.map +1 -1
- package/dist/cell/index.js +1 -1
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/client/Field-XBUN6QOM.js +2 -0
- package/dist/exports/client/Field-XBUN6QOM.js.map +7 -0
- package/dist/exports/client/{RelationshipComponent-5OU5HATX.js → RelationshipComponent-AFXEJMZQ.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-QU5MKT75.js → chunk-5RJS5YZT.js} +2 -2
- package/dist/exports/client/chunk-5RJS5YZT.js.map +7 -0
- package/dist/exports/client/chunk-JIP5PWU3.js +2 -0
- package/dist/exports/client/chunk-JIP5PWU3.js.map +7 -0
- package/dist/exports/client/{chunk-MLIITFAS.js → chunk-Q5DYR7MH.js} +2 -2
- package/dist/exports/client/chunk-Q5DYR7MH.js.map +7 -0
- package/dist/exports/client/{chunk-OSR74ZNW.js → chunk-YL52LJO3.js} +2 -2
- package/dist/exports/client/chunk-YL52LJO3.js.map +7 -0
- package/dist/exports/client/{component-E2NHAHBC.js → component-F6V63OLD.js} +2 -2
- package/dist/exports/client/component-F6V63OLD.js.map +7 -0
- package/dist/exports/client/component-PEFMKIXI.js +2 -0
- package/dist/exports/client/component-PEFMKIXI.js.map +7 -0
- package/dist/exports/client/{component-QWIGEOVD.js → component-VM36FRT2.js} +2 -2
- package/dist/exports/client/index.d.ts +37 -27
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +7 -5
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/feature.client.d.ts +1 -2
- package/dist/features/align/feature.client.d.ts.map +1 -1
- package/dist/features/align/feature.client.js +9 -16
- package/dist/features/align/feature.client.js.map +1 -1
- package/dist/features/align/feature.server.d.ts +1 -2
- package/dist/features/align/feature.server.d.ts.map +1 -1
- package/dist/features/align/feature.server.js +9 -15
- package/dist/features/align/feature.server.js.map +1 -1
- package/dist/features/align/i18n.js.map +1 -1
- package/dist/features/align/toolbarAlignGroup.js.map +1 -1
- package/dist/features/blockquote/feature.client.d.ts +1 -2
- package/dist/features/blockquote/feature.client.d.ts.map +1 -1
- package/dist/features/blockquote/feature.client.js +37 -44
- package/dist/features/blockquote/feature.client.js.map +1 -1
- package/dist/features/blockquote/feature.server.d.ts +6 -2
- package/dist/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/features/blockquote/feature.server.js +35 -40
- package/dist/features/blockquote/feature.server.js.map +1 -1
- package/dist/features/blockquote/i18n.js.map +1 -1
- package/dist/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/component/BlockContent.js +2 -2
- package/dist/features/blocks/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/component/FormSavePlugin.js.map +1 -1
- package/dist/features/blocks/component/index.js +1 -1
- package/dist/features/blocks/component/index.js.map +1 -1
- package/dist/features/blocks/component/removeEmptyArrayValues.js.map +1 -1
- package/dist/features/blocks/drawer/index.js +1 -1
- package/dist/features/blocks/drawer/index.js.map +1 -1
- package/dist/features/blocks/feature.client.d.ts +1 -2
- package/dist/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/features/blocks/feature.client.js +74 -80
- package/dist/features/blocks/feature.client.js.map +1 -1
- package/dist/features/blocks/feature.server.d.ts +1 -2
- package/dist/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/features/blocks/feature.server.js +88 -90
- package/dist/features/blocks/feature.server.js.map +1 -1
- package/dist/features/blocks/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/blocks/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/blocks/i18n.js.map +1 -1
- package/dist/features/blocks/nodes/BlocksNode.d.ts +2 -0
- package/dist/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/nodes/BlocksNode.js +1 -1
- package/dist/features/blocks/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/plugin/commands.js.map +1 -1
- package/dist/features/blocks/plugin/index.d.ts +1 -1
- package/dist/features/blocks/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/plugin/index.js.map +1 -1
- package/dist/features/blocks/validate.d.ts +1 -1
- package/dist/features/blocks/validate.d.ts.map +1 -1
- package/dist/features/blocks/validate.js.map +1 -1
- package/dist/features/converters/html/converter/converters/linebreak.js.map +1 -1
- package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
- package/dist/features/converters/html/converter/converters/text.js.map +1 -1
- package/dist/features/converters/html/converter/defaultConverters.js.map +1 -1
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/converter/types.js.map +1 -1
- package/dist/features/converters/html/feature.server.d.ts +1 -2
- package/dist/features/converters/html/feature.server.d.ts.map +1 -1
- package/dist/features/converters/html/feature.server.js +6 -12
- package/dist/features/converters/html/feature.server.js.map +1 -1
- package/dist/features/converters/html/field/index.js +1 -1
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/createClientComponent.d.ts +3 -2
- package/dist/features/createClientComponent.d.ts.map +1 -1
- package/dist/features/createClientComponent.js.map +1 -1
- package/dist/features/createFeaturePropComponent.d.ts.map +1 -1
- package/dist/features/createFeaturePropComponent.js.map +1 -1
- package/dist/features/debug/testRecorder/feature.client.d.ts +1 -2
- package/dist/features/debug/testRecorder/feature.client.d.ts.map +1 -1
- package/dist/features/debug/testRecorder/feature.client.js +9 -16
- package/dist/features/debug/testRecorder/feature.client.js.map +1 -1
- package/dist/features/debug/testRecorder/feature.server.d.ts +1 -2
- package/dist/features/debug/testRecorder/feature.server.d.ts.map +1 -1
- package/dist/features/debug/testRecorder/feature.server.js +8 -13
- package/dist/features/debug/testRecorder/feature.server.js.map +1 -1
- package/dist/features/debug/testRecorder/plugin/index.d.ts +1 -1
- package/dist/features/debug/testRecorder/plugin/index.d.ts.map +1 -1
- package/dist/features/debug/testRecorder/plugin/index.js.map +1 -1
- package/dist/features/debug/treeView/feature.client.d.ts +1 -2
- package/dist/features/debug/treeView/feature.client.d.ts.map +1 -1
- package/dist/features/debug/treeView/feature.client.js +9 -16
- package/dist/features/debug/treeView/feature.client.js.map +1 -1
- package/dist/features/debug/treeView/feature.server.d.ts +1 -2
- package/dist/features/debug/treeView/feature.server.d.ts.map +1 -1
- package/dist/features/debug/treeView/feature.server.js +8 -13
- package/dist/features/debug/treeView/feature.server.js.map +1 -1
- package/dist/features/debug/treeView/plugin/index.d.ts +1 -1
- package/dist/features/debug/treeView/plugin/index.d.ts.map +1 -1
- package/dist/features/debug/treeView/plugin/index.js.map +1 -1
- package/dist/features/format/bold/feature.client.d.ts +1 -2
- package/dist/features/format/bold/feature.client.d.ts.map +1 -1
- package/dist/features/format/bold/feature.client.js +16 -23
- package/dist/features/format/bold/feature.client.js.map +1 -1
- package/dist/features/format/bold/feature.server.d.ts +1 -2
- package/dist/features/format/bold/feature.server.d.ts.map +1 -1
- package/dist/features/format/bold/feature.server.js +21 -24
- package/dist/features/format/bold/feature.server.js.map +1 -1
- package/dist/features/format/bold/markdownTransformers.js.map +1 -1
- package/dist/features/format/inlineCode/feature.client.d.ts +1 -2
- package/dist/features/format/inlineCode/feature.client.d.ts.map +1 -1
- package/dist/features/format/inlineCode/feature.client.js +12 -21
- package/dist/features/format/inlineCode/feature.client.js.map +1 -1
- package/dist/features/format/inlineCode/feature.server.d.ts +1 -2
- package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
- package/dist/features/format/inlineCode/feature.server.js +11 -16
- package/dist/features/format/inlineCode/feature.server.js.map +1 -1
- package/dist/features/format/inlineCode/markdownTransformers.js.map +1 -1
- package/dist/features/format/italic/feature.client.d.ts +1 -2
- package/dist/features/format/italic/feature.client.d.ts.map +1 -1
- package/dist/features/format/italic/feature.client.js +13 -22
- package/dist/features/format/italic/feature.client.js.map +1 -1
- package/dist/features/format/italic/feature.server.d.ts +1 -2
- package/dist/features/format/italic/feature.server.d.ts.map +1 -1
- package/dist/features/format/italic/feature.server.js +12 -17
- package/dist/features/format/italic/feature.server.js.map +1 -1
- package/dist/features/format/italic/markdownTransformers.js.map +1 -1
- package/dist/features/format/shared/toolbarFormatGroup.js.map +1 -1
- package/dist/features/format/strikethrough/feature.client.d.ts +1 -2
- package/dist/features/format/strikethrough/feature.client.d.ts.map +1 -1
- package/dist/features/format/strikethrough/feature.client.js +12 -21
- package/dist/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/features/format/strikethrough/feature.server.d.ts +1 -2
- package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
- package/dist/features/format/strikethrough/feature.server.js +11 -16
- package/dist/features/format/strikethrough/feature.server.js.map +1 -1
- package/dist/features/format/strikethrough/markdownTransformers.js.map +1 -1
- package/dist/features/format/subscript/feature.client.d.ts +1 -2
- package/dist/features/format/subscript/feature.client.d.ts.map +1 -1
- package/dist/features/format/subscript/feature.client.js +9 -18
- package/dist/features/format/subscript/feature.client.js.map +1 -1
- package/dist/features/format/subscript/feature.server.d.ts +1 -2
- package/dist/features/format/subscript/feature.server.d.ts.map +1 -1
- package/dist/features/format/subscript/feature.server.js +8 -13
- package/dist/features/format/subscript/feature.server.js.map +1 -1
- package/dist/features/format/superscript/feature.client.d.ts +1 -2
- package/dist/features/format/superscript/feature.client.d.ts.map +1 -1
- package/dist/features/format/superscript/feature.client.js +9 -18
- package/dist/features/format/superscript/feature.client.js.map +1 -1
- package/dist/features/format/superscript/feature.server.d.ts +1 -2
- package/dist/features/format/superscript/feature.server.d.ts.map +1 -1
- package/dist/features/format/superscript/feature.server.js +8 -13
- package/dist/features/format/superscript/feature.server.js.map +1 -1
- package/dist/features/format/underline/feature.client.d.ts +1 -2
- package/dist/features/format/underline/feature.client.d.ts.map +1 -1
- package/dist/features/format/underline/feature.client.js +9 -18
- package/dist/features/format/underline/feature.client.js.map +1 -1
- package/dist/features/format/underline/feature.server.d.ts +1 -2
- package/dist/features/format/underline/feature.server.d.ts.map +1 -1
- package/dist/features/format/underline/feature.server.js +8 -13
- package/dist/features/format/underline/feature.server.js.map +1 -1
- package/dist/features/heading/feature.client.d.ts +1 -2
- package/dist/features/heading/feature.client.d.ts.map +1 -1
- package/dist/features/heading/feature.client.js +70 -76
- package/dist/features/heading/feature.client.js.map +1 -1
- package/dist/features/heading/feature.server.d.ts +1 -2
- package/dist/features/heading/feature.server.d.ts.map +1 -1
- package/dist/features/heading/feature.server.js +51 -53
- package/dist/features/heading/feature.server.js.map +1 -1
- package/dist/features/heading/i18n.js +2 -2
- package/dist/features/heading/i18n.js.map +1 -1
- package/dist/features/heading/markdownTransformer.js.map +1 -1
- package/dist/features/horizontalRule/component/index.js.map +1 -1
- package/dist/features/horizontalRule/feature.client.d.ts +1 -2
- package/dist/features/horizontalRule/feature.client.d.ts.map +1 -1
- package/dist/features/horizontalRule/feature.client.js +58 -65
- package/dist/features/horizontalRule/feature.client.js.map +1 -1
- package/dist/features/horizontalRule/feature.server.d.ts +1 -2
- package/dist/features/horizontalRule/feature.server.d.ts.map +1 -1
- package/dist/features/horizontalRule/feature.server.js +26 -31
- package/dist/features/horizontalRule/feature.server.js.map +1 -1
- package/dist/features/horizontalRule/i18n.js.map +1 -1
- package/dist/features/horizontalRule/markdownTransformer.js.map +1 -1
- package/dist/features/horizontalRule/nodes/HorizontalRuleNode.d.ts +5 -2
- package/dist/features/horizontalRule/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/horizontalRule/plugin/index.d.ts +1 -1
- package/dist/features/horizontalRule/plugin/index.d.ts.map +1 -1
- package/dist/features/horizontalRule/plugin/index.js.map +1 -1
- package/dist/features/indent/feature.client.d.ts +1 -2
- package/dist/features/indent/feature.client.d.ts.map +1 -1
- package/dist/features/indent/feature.client.js +9 -16
- package/dist/features/indent/feature.client.js.map +1 -1
- package/dist/features/indent/feature.server.d.ts +1 -2
- package/dist/features/indent/feature.server.d.ts.map +1 -1
- package/dist/features/indent/feature.server.js +9 -15
- package/dist/features/indent/feature.server.js.map +1 -1
- package/dist/features/indent/i18n.js.map +1 -1
- package/dist/features/indent/toolbarIndentGroup.js.map +1 -1
- package/dist/features/link/drawer/baseFields.d.ts +2 -2
- package/dist/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/features/link/drawer/baseFields.js.map +1 -1
- package/dist/features/link/drawer/index.js.map +1 -1
- package/dist/features/link/drawer/types.js.map +1 -1
- package/dist/features/link/feature.client.d.ts +3 -4
- package/dist/features/link/feature.client.d.ts.map +1 -1
- package/dist/features/link/feature.client.js +34 -41
- package/dist/features/link/feature.client.js.map +1 -1
- package/dist/features/link/feature.server.d.ts +4 -6
- package/dist/features/link/feature.server.d.ts.map +1 -1
- package/dist/features/link/feature.server.js +123 -125
- package/dist/features/link/feature.server.js.map +1 -1
- package/dist/features/link/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/link/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/link/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/link/i18n.js.map +1 -1
- package/dist/features/link/markdownTransformer.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +7 -1
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +1 -1
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/nodes/types.d.ts +7 -4
- package/dist/features/link/nodes/types.d.ts.map +1 -1
- package/dist/features/link/nodes/types.js.map +1 -1
- package/dist/features/link/plugins/autoLink/index.d.ts +1 -1
- package/dist/features/link/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/plugins/clickableLink/index.d.ts +1 -1
- package/dist/features/link/plugins/clickableLink/index.d.ts.map +1 -1
- package/dist/features/link/plugins/clickableLink/index.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/index.d.ts +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/types.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/utilities.d.ts +2 -2
- package/dist/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/features/link/plugins/link/index.d.ts +1 -1
- package/dist/features/link/plugins/link/index.d.ts.map +1 -1
- package/dist/features/link/plugins/link/index.js.map +1 -1
- package/dist/features/link/validate.d.ts +1 -1
- package/dist/features/link/validate.d.ts.map +1 -1
- package/dist/features/link/validate.js.map +1 -1
- package/dist/features/lists/checklist/feature.client.d.ts +1 -2
- package/dist/features/lists/checklist/feature.client.d.ts.map +1 -1
- package/dist/features/lists/checklist/feature.client.js +50 -57
- package/dist/features/lists/checklist/feature.client.js.map +1 -1
- package/dist/features/lists/checklist/feature.server.d.ts +1 -2
- package/dist/features/lists/checklist/feature.server.d.ts.map +1 -1
- package/dist/features/lists/checklist/feature.server.js +28 -31
- package/dist/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/features/lists/checklist/i18n.js.map +1 -1
- package/dist/features/lists/checklist/markdownTransformers.js.map +1 -1
- package/dist/features/lists/checklist/plugin/index.d.ts +1 -1
- package/dist/features/lists/checklist/plugin/index.d.ts.map +1 -1
- package/dist/features/lists/checklist/plugin/index.js.map +1 -1
- package/dist/features/lists/htmlConverter.d.ts +1 -1
- package/dist/features/lists/htmlConverter.d.ts.map +1 -1
- package/dist/features/lists/htmlConverter.js.map +1 -1
- package/dist/features/lists/orderedList/feature.client.d.ts +1 -2
- package/dist/features/lists/orderedList/feature.client.d.ts.map +1 -1
- package/dist/features/lists/orderedList/feature.client.js +39 -46
- package/dist/features/lists/orderedList/feature.client.js.map +1 -1
- package/dist/features/lists/orderedList/feature.server.d.ts +1 -2
- package/dist/features/lists/orderedList/feature.server.d.ts.map +1 -1
- package/dist/features/lists/orderedList/feature.server.js +28 -31
- package/dist/features/lists/orderedList/feature.server.js.map +1 -1
- package/dist/features/lists/orderedList/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/markdownTransformer.js.map +1 -1
- package/dist/features/lists/plugin/index.d.ts +11 -1
- package/dist/features/lists/plugin/index.d.ts.map +1 -1
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/lists/shared/markdown.d.ts +1 -1
- package/dist/features/lists/shared/markdown.js.map +1 -1
- package/dist/features/lists/shared/slashMenuListGroup.js.map +1 -1
- package/dist/features/lists/unorderedList/feature.client.d.ts +1 -2
- package/dist/features/lists/unorderedList/feature.client.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/feature.client.js +40 -49
- package/dist/features/lists/unorderedList/feature.client.js.map +1 -1
- package/dist/features/lists/unorderedList/feature.server.d.ts +1 -2
- package/dist/features/lists/unorderedList/feature.server.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/feature.server.js +26 -31
- package/dist/features/lists/unorderedList/feature.server.js.map +1 -1
- package/dist/features/lists/unorderedList/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/markdownTransformer.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/client.d.ts +0 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/index.js +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +1 -2
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +20 -27
- package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts +1 -2
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +39 -42
- package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/indent/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/relationship/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/client.d.ts +0 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/index.js +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/upload/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/types.d.ts +1 -1
- package/dist/features/migrations/slateToLexical/converter/types.js.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.client.d.ts +1 -2
- package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.client.js +20 -27
- package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.server.d.ts +3 -2
- package/dist/features/migrations/slateToLexical/feature.server.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.server.js +41 -42
- package/dist/features/migrations/slateToLexical/feature.server.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/paragraph/feature.client.d.ts +1 -2
- package/dist/features/paragraph/feature.client.d.ts.map +1 -1
- package/dist/features/paragraph/feature.client.js +33 -40
- package/dist/features/paragraph/feature.client.js.map +1 -1
- package/dist/features/paragraph/feature.server.d.ts +1 -2
- package/dist/features/paragraph/feature.server.d.ts.map +1 -1
- package/dist/features/paragraph/feature.server.js +10 -15
- package/dist/features/paragraph/feature.server.js.map +1 -1
- package/dist/features/paragraph/i18n.js.map +1 -1
- package/dist/features/relationship/drawer/commands.js.map +1 -1
- package/dist/features/relationship/drawer/index.d.ts.map +1 -1
- package/dist/features/relationship/drawer/index.js.map +1 -1
- package/dist/features/relationship/feature.client.d.ts +3 -4
- package/dist/features/relationship/feature.client.d.ts.map +1 -1
- package/dist/features/relationship/feature.client.js +60 -67
- package/dist/features/relationship/feature.client.js.map +1 -1
- package/dist/features/relationship/feature.server.d.ts +4 -4
- package/dist/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/features/relationship/feature.server.js +45 -51
- package/dist/features/relationship/feature.server.js.map +1 -1
- package/dist/features/relationship/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/relationship/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/relationship/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/relationship/i18n.js.map +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.d.ts +6 -2
- package/dist/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.js +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/plugins/index.d.ts +1 -1
- package/dist/features/relationship/plugins/index.d.ts.map +1 -1
- package/dist/features/relationship/plugins/index.js.map +1 -1
- package/dist/features/relationship/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/shared/slashMenu/basicGroup.js.map +1 -1
- package/dist/features/shared/toolbar/addDropdownGroup.js.map +1 -1
- package/dist/features/shared/toolbar/featureButtonsGroup.js.map +1 -1
- package/dist/features/shared/toolbar/textDropdownGroup.js.map +1 -1
- package/dist/features/toolbars/fixed/Toolbar/index.d.ts +1 -1
- package/dist/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/fixed/feature.client.d.ts +1 -2
- package/dist/features/toolbars/fixed/feature.client.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/feature.client.js +9 -16
- package/dist/features/toolbars/fixed/feature.client.js.map +1 -1
- package/dist/features/toolbars/fixed/feature.server.d.ts +1 -2
- package/dist/features/toolbars/fixed/feature.server.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/feature.server.js +16 -18
- package/dist/features/toolbars/fixed/feature.server.js.map +1 -1
- package/dist/features/toolbars/inline/Toolbar/index.d.ts +1 -1
- package/dist/features/toolbars/inline/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/feature.client.d.ts +1 -2
- package/dist/features/toolbars/inline/feature.client.d.ts.map +1 -1
- package/dist/features/toolbars/inline/feature.client.js +9 -16
- package/dist/features/toolbars/inline/feature.client.js.map +1 -1
- package/dist/features/toolbars/inline/feature.server.d.ts +1 -2
- package/dist/features/toolbars/inline/feature.server.d.ts.map +1 -1
- package/dist/features/toolbars/inline/feature.server.js +8 -13
- package/dist/features/toolbars/inline/feature.server.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +37 -5
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typeUtilities.d.ts +1 -1
- package/dist/features/typeUtilities.d.ts.map +1 -1
- package/dist/features/typeUtilities.js.map +1 -1
- package/dist/features/typesClient.d.ts +182 -0
- package/dist/features/typesClient.d.ts.map +1 -0
- package/dist/features/typesClient.js +3 -0
- package/dist/features/typesClient.js.map +1 -0
- package/dist/features/{types.d.ts → typesServer.d.ts} +40 -193
- package/dist/features/typesServer.d.ts.map +1 -0
- package/dist/features/typesServer.js +3 -0
- package/dist/features/typesServer.js.map +1 -0
- package/dist/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
- package/dist/features/upload/component/index.d.ts.map +1 -1
- package/dist/features/upload/component/index.js +1 -1
- package/dist/features/upload/component/index.js.map +1 -1
- package/dist/features/upload/drawer/commands.js.map +1 -1
- package/dist/features/upload/drawer/index.d.ts.map +1 -1
- package/dist/features/upload/drawer/index.js.map +1 -1
- package/dist/features/upload/feature.client.d.ts +1 -2
- package/dist/features/upload/feature.client.d.ts.map +1 -1
- package/dist/features/upload/feature.client.js +62 -69
- package/dist/features/upload/feature.client.js.map +1 -1
- package/dist/features/upload/feature.server.d.ts +3 -4
- package/dist/features/upload/feature.server.d.ts.map +1 -1
- package/dist/features/upload/feature.server.js +166 -168
- package/dist/features/upload/feature.server.js.map +1 -1
- package/dist/features/upload/graphQLPopulationPromise.d.ts +1 -1
- package/dist/features/upload/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/upload/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/upload/i18n.js.map +1 -1
- package/dist/features/upload/nodes/UploadNode.d.ts +6 -2
- package/dist/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/nodes/UploadNode.js +1 -1
- package/dist/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/plugin/index.d.ts +1 -1
- package/dist/features/upload/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/plugin/index.js.map +1 -1
- package/dist/features/upload/validate.d.ts +1 -1
- package/dist/features/upload/validate.d.ts.map +1 -1
- package/dist/features/upload/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +9 -7
- package/dist/field/index.js.map +1 -1
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +12 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.d.ts +1 -1
- package/dist/lexical/EditorPlugin.d.ts.map +1 -1
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/config/client/default.js.map +1 -1
- package/dist/lexical/config/client/loader.d.ts +1 -1
- package/dist/lexical/config/client/loader.d.ts.map +1 -1
- package/dist/lexical/config/client/loader.js +2 -2
- package/dist/lexical/config/client/loader.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +1 -1
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/server/default.d.ts +2 -2
- package/dist/lexical/config/server/default.d.ts.map +1 -1
- package/dist/lexical/config/server/default.js.map +1 -1
- package/dist/lexical/config/server/loader.d.ts +2 -2
- package/dist/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/lexical/config/server/loader.js +2 -2
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/config/types.d.ts +4 -3
- package/dist/lexical/config/types.d.ts.map +1 -1
- package/dist/lexical/config/types.js.map +1 -1
- package/dist/lexical/nodes/index.js.map +1 -1
- package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +16 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts +0 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getCollapsedMargins.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/isOnHandleElement.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/lexical/ui/icons/Add/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/lexical/ui/icons/H6/index.js.map +1 -1
- package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/lexical/utils/canUseDOM.js.map +1 -1
- package/dist/lexical/utils/cloneDeep.js.map +1 -1
- package/dist/lexical/utils/environment.js.map +1 -1
- package/dist/lexical/utils/getDOMRangeRect.js.map +1 -1
- package/dist/lexical/utils/getSelectedNode.js.map +1 -1
- package/dist/lexical/utils/guard.js.map +1 -1
- package/dist/lexical/utils/invariant.js.map +1 -1
- package/dist/lexical/utils/joinClasses.js.map +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
- package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
- package/dist/lexical/utils/nodeFormat.js.map +1 -1
- package/dist/lexical/utils/point.js.map +1 -1
- package/dist/lexical/utils/rect.js.map +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.js.map +1 -1
- package/dist/lexical/utils/swipe.js.map +1 -1
- package/dist/lexical/utils/url.js.map +1 -1
- package/dist/nodeTypes.d.ts +27 -0
- package/dist/nodeTypes.d.ts.map +1 -0
- package/dist/nodeTypes.js +3 -0
- package/dist/nodeTypes.js.map +1 -0
- package/dist/populateGraphQL/defaultValue.js.map +1 -1
- package/dist/populateGraphQL/populate.d.ts.map +1 -1
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
- package/dist/types.d.ts +7 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/createClientFeature.d.ts +13 -0
- package/dist/utilities/createClientFeature.d.ts.map +1 -0
- package/dist/utilities/createClientFeature.js +30 -0
- package/dist/utilities/createClientFeature.js.map +1 -0
- package/dist/utilities/createServerFeature.d.ts +16 -0
- package/dist/utilities/createServerFeature.d.ts.map +1 -0
- package/dist/utilities/createServerFeature.js +34 -0
- package/dist/utilities/createServerFeature.js.map +1 -0
- package/dist/utilities/forEachNodeRecursively.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts +2 -2
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +4 -4
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/dist/utilities/generateSchemaMap.d.ts +2 -2
- package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
- package/dist/utilities/generateSchemaMap.js +1 -1
- package/dist/utilities/generateSchemaMap.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/index.d.ts +15 -0
- package/dist/utilities/migrateSlateToLexical/index.d.ts.map +1 -0
- package/dist/utilities/migrateSlateToLexical/index.js +105 -0
- package/dist/utilities/migrateSlateToLexical/index.js.map +1 -0
- package/dist/utilities/migrateSlateToLexical/recurse.d.ts +9 -0
- package/dist/utilities/migrateSlateToLexical/recurse.d.ts.map +1 -0
- package/dist/utilities/migrateSlateToLexical/recurse.js +77 -0
- package/dist/utilities/migrateSlateToLexical/recurse.js.map +1 -0
- package/dist/utilities/recurseNodeTree.js.map +1 -1
- package/dist/utilities/useLexicalFeature.d.ts +1 -1
- package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
- package/dist/utilities/useLexicalFeature.js.map +1 -1
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/validateNodes.d.ts +1 -1
- package/dist/validate/validateNodes.d.ts.map +1 -1
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +10 -10
- package/dist/exports/client/Field-YMWNSE3A.js +0 -2
- package/dist/exports/client/Field-YMWNSE3A.js.map +0 -7
- package/dist/exports/client/chunk-MLIITFAS.js.map +0 -7
- package/dist/exports/client/chunk-OSR74ZNW.js.map +0 -7
- package/dist/exports/client/chunk-QU5MKT75.js.map +0 -7
- package/dist/exports/client/chunk-ZITHDR53.js +0 -2
- package/dist/exports/client/chunk-ZITHDR53.js.map +0 -7
- package/dist/exports/client/component-E2NHAHBC.js.map +0 -7
- package/dist/exports/client/component-X4LSLSWF.js +0 -2
- package/dist/exports/client/component-X4LSLSWF.js.map +0 -7
- package/dist/features/types.d.ts.map +0 -1
- package/dist/features/types.js +0 -3
- package/dist/features/types.js.map +0 -1
- /package/dist/exports/client/{RelationshipComponent-5OU5HATX.js.map → RelationshipComponent-AFXEJMZQ.js.map} +0 -0
- /package/dist/exports/client/{component-QWIGEOVD.js.map → component-VM36FRT2.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/link/nodes/types.ts"],"sourcesContent":["import type { SerializedElementNode, Spread } from 'lexical'\n\nexport type LinkFields = {\n // unknown, custom fields:\n [key: string]: unknown\n doc: {\n relationTo: string\n value:\n | {\n // Actual doc data, populated in afterRead hook\n [key: string]: unknown\n id: string\n }\n | string\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url: string\n}\n\nexport type SerializedLinkNode = Spread<\n {\n fields: LinkFields\n id?: string // optional if AutoLinkNode\n },\n SerializedElementNode
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/link/nodes/types.ts"],"sourcesContent":["import type { SerializedElementNode, SerializedLexicalNode, Spread } from 'lexical'\n\nexport type LinkFields = {\n // unknown, custom fields:\n [key: string]: unknown\n doc: {\n relationTo: string\n value:\n | {\n // Actual doc data, populated in afterRead hook\n [key: string]: unknown\n id: string\n }\n | string\n } | null\n linkType: 'custom' | 'internal'\n newTab: boolean\n url: string\n}\n\nexport type SerializedLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<\n {\n fields: LinkFields\n id?: string // optional if AutoLinkNode\n type: 'link'\n },\n SerializedElementNode<T>\n>\nexport type SerializedAutoLinkNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n type: 'autolink'\n} & Omit<SerializedLinkNode<T>, 'id' | 'type'>\n"],"names":[],"mappings":"AA4BA,WAE8C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginComponent } from '../../../
|
|
1
|
+
import type { PluginComponent } from '../../../typesClient.js';
|
|
2
2
|
import type { ClientProps } from '../../feature.client.js';
|
|
3
3
|
import type { LinkFields } from '../../nodes/types.js';
|
|
4
4
|
interface LinkMatcherResult {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/autoLink/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/autoLink/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAQtD,UAAU,iBAAiB;IACzB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,GAAG,IAAI,CAAA;AAEpE,wBAAgB,2BAA2B,CACzC,MAAM,EAAE,MAAM,EACd,cAAc,GAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAuB,UAE3C,MAAM;;;;;EAUrB;AA8XD,eAAO,MAAM,cAAc,EAAE,eAAe,CAAC,WAAW,CAMvD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/link/plugins/autoLink/index.tsx"],"sourcesContent":["'use client'\nimport type { ElementNode, LexicalEditor, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isTextNode,\n type TextNode,\n TextNode as TextNodeValue,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../types.js'\nimport type { ClientProps } from '../../feature.client.js'\nimport type { LinkFields } from '../../nodes/types.js'\n\nimport { invariant } from '../../../../lexical/utils/invariant.js'\nimport { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode } from '../../nodes/AutoLinkNode.js'\nimport { $isLinkNode } from '../../nodes/LinkNode.js'\n\ntype ChangeHandler = (url: null | string, prevUrl: null | string) => void\n\ninterface LinkMatcherResult {\n fields?: LinkFields\n index: number\n length: number\n text: string\n url: string\n}\n\nexport type LinkMatcher = (text: string) => LinkMatcherResult | null\n\nexport function createLinkMatcherWithRegExp(\n regExp: RegExp,\n urlTransformer: (text: string) => string = (text) => text,\n) {\n return (text: string) => {\n const match = regExp.exec(text)\n if (match === null) return null\n return {\n index: match.index,\n length: match[0].length,\n text: match[0],\n url: urlTransformer(match[0]),\n }\n }\n}\n\nfunction findFirstMatch(text: string, matchers: LinkMatcher[]): LinkMatcherResult | null {\n for (let i = 0; i < matchers.length; i++) {\n const match = matchers[i](text)\n\n if (match != null) {\n return match\n }\n }\n\n return null\n}\n\nconst PUNCTUATION_OR_SPACE = /[.,;\\s]/\n\nfunction isSeparator(char: string): boolean {\n return PUNCTUATION_OR_SPACE.test(char)\n}\n\nfunction endsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[textContent.length - 1])\n}\n\nfunction startsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[0])\n}\n\nfunction isPreviousNodeValid(node: LexicalNode): boolean {\n let previousNode = node.getPreviousSibling()\n if ($isElementNode(previousNode)) {\n previousNode = previousNode.getLastDescendant()\n }\n return (\n previousNode === null ||\n $isLineBreakNode(previousNode) ||\n ($isTextNode(previousNode) && endsWithSeparator(previousNode.getTextContent()))\n )\n}\n\nfunction isNextNodeValid(node: LexicalNode): boolean {\n let nextNode = node.getNextSibling()\n if ($isElementNode(nextNode)) {\n nextNode = nextNode.getFirstDescendant()\n }\n return (\n nextNode === null ||\n $isLineBreakNode(nextNode) ||\n ($isTextNode(nextNode) && startsWithSeparator(nextNode.getTextContent()))\n )\n}\n\nfunction isContentAroundIsValid(\n matchStart: number,\n matchEnd: number,\n text: string,\n nodes: TextNode[],\n): boolean {\n const contentBeforeIsValid =\n matchStart > 0 ? isSeparator(text[matchStart - 1]) : isPreviousNodeValid(nodes[0])\n if (!contentBeforeIsValid) {\n return false\n }\n\n const contentAfterIsValid =\n matchEnd < text.length ? isSeparator(text[matchEnd]) : isNextNodeValid(nodes[nodes.length - 1])\n return contentAfterIsValid\n}\n\nfunction extractMatchingNodes(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n): [\n matchingOffset: number,\n unmodifiedBeforeNodes: TextNode[],\n matchingNodes: TextNode[],\n unmodifiedAfterNodes: TextNode[],\n] {\n const unmodifiedBeforeNodes: TextNode[] = []\n const matchingNodes: TextNode[] = []\n const unmodifiedAfterNodes: TextNode[] = []\n let matchingOffset = 0\n\n let currentOffset = 0\n const currentNodes = [...nodes]\n\n while (currentNodes.length > 0) {\n const currentNode = currentNodes[0]\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = currentOffset\n const currentNodeEnd = currentOffset + currentNodeLength\n\n if (currentNodeEnd <= startIndex) {\n unmodifiedBeforeNodes.push(currentNode)\n matchingOffset += currentNodeLength\n } else if (currentNodeStart >= endIndex) {\n unmodifiedAfterNodes.push(currentNode)\n } else {\n matchingNodes.push(currentNode)\n }\n currentOffset += currentNodeLength\n currentNodes.shift()\n }\n return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes]\n}\n\nfunction $createAutoLinkNode_(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n match: LinkMatcherResult,\n): TextNode | undefined {\n const fields: LinkFields = {\n linkType: 'custom',\n url: match.url,\n ...match.fields,\n }\n\n const linkNode = $createAutoLinkNode({ fields })\n if (nodes.length === 1) {\n let remainingTextNode = nodes[0]\n let linkTextNode\n if (startIndex === 0) {\n ;[linkTextNode, remainingTextNode] = remainingTextNode.splitText(endIndex)\n } else {\n ;[, linkTextNode, remainingTextNode] = remainingTextNode.splitText(startIndex, endIndex)\n }\n const textNode = $createTextNode(match.text)\n textNode.setFormat(linkTextNode.getFormat())\n textNode.setDetail(linkTextNode.getDetail())\n textNode.setStyle(linkTextNode.getStyle())\n linkNode.append(textNode)\n linkTextNode.replace(linkNode)\n return remainingTextNode\n } else if (nodes.length > 1) {\n const firstTextNode = nodes[0]\n let offset = firstTextNode.getTextContent().length\n let firstLinkTextNode\n if (startIndex === 0) {\n firstLinkTextNode = firstTextNode\n } else {\n ;[, firstLinkTextNode] = firstTextNode.splitText(startIndex)\n }\n const linkNodes = []\n let remainingTextNode\n for (let i = 1; i < nodes.length; i++) {\n const currentNode = nodes[i]\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = offset\n const currentNodeEnd = offset + currentNodeLength\n if (currentNodeStart < endIndex) {\n if (currentNodeEnd <= endIndex) {\n linkNodes.push(currentNode)\n } else {\n const [linkTextNode, endNode] = currentNode.splitText(endIndex - currentNodeStart)\n linkNodes.push(linkTextNode)\n remainingTextNode = endNode\n }\n }\n offset += currentNodeLength\n }\n const selection = $getSelection()\n const selectedTextNode = selection ? selection.getNodes().find($isTextNode) : undefined\n const textNode = $createTextNode(firstLinkTextNode.getTextContent())\n textNode.setFormat(firstLinkTextNode.getFormat())\n textNode.setDetail(firstLinkTextNode.getDetail())\n textNode.setStyle(firstLinkTextNode.getStyle())\n linkNode.append(textNode, ...linkNodes)\n // it does not preserve caret position if caret was at the first text node\n // so we need to restore caret position\n if (selectedTextNode && selectedTextNode === firstLinkTextNode) {\n if ($isRangeSelection(selection)) {\n textNode.select(selection.anchor.offset, selection.focus.offset)\n } else if ($isNodeSelection(selection)) {\n textNode.select(0, textNode.getTextContent().length)\n }\n }\n firstLinkTextNode.replace(linkNode)\n return remainingTextNode\n }\n return undefined\n}\n\nfunction $handleLinkCreation(\n nodes: TextNode[],\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n let currentNodes = [...nodes]\n const initialText = currentNodes.map((node) => node.getTextContent()).join('')\n let text = initialText\n\n let match\n let invalidMatchEnd = 0\n\n while ((match = findFirstMatch(text, matchers)) != null && match !== null) {\n const matchStart: number = match.index\n const matchLength: number = match.length\n const matchEnd = matchStart + matchLength\n const isValid = isContentAroundIsValid(\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n initialText,\n currentNodes,\n )\n\n if (isValid) {\n const [matchingOffset, , matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(\n currentNodes,\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n )\n\n const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset\n const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset\n const remainingTextNode = $createAutoLinkNode_(\n matchingNodes,\n actualMatchStart,\n actualMatchEnd,\n match,\n )\n currentNodes = remainingTextNode\n ? [remainingTextNode, ...unmodifiedAfterNodes]\n : unmodifiedAfterNodes\n onChange(match.url, null)\n invalidMatchEnd = 0\n } else {\n invalidMatchEnd += matchEnd\n }\n\n text = text.substring(matchEnd)\n }\n}\n\nfunction handleLinkEdit(\n linkNode: AutoLinkNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n // Check children are simple text\n const children = linkNode.getChildren()\n const childrenLength = children.length\n for (let i = 0; i < childrenLength; i++) {\n const child = children[i]\n if (!$isTextNode(child) || !child.isSimpleText()) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n }\n\n // Check text content fully matches\n const text = linkNode.getTextContent()\n const match = findFirstMatch(text, matchers)\n if (match === null || match.text !== text) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n // Check neighbors\n if (!isPreviousNodeValid(linkNode) || !isNextNodeValid(linkNode)) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n const url = linkNode.getFields()?.url\n if (url !== match?.url) {\n const flds = linkNode.getFields()\n flds.url = match?.url\n linkNode.setFields(flds)\n onChange(match.url, url ?? null)\n }\n}\n\n// Bad neighbors are edits in neighbor nodes that make AutoLinks incompatible.\n// Given the creation preconditions, these can only be simple text nodes.\nfunction handleBadNeighbors(\n textNode: TextNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n const previousSibling = textNode.getPreviousSibling()\n const nextSibling = textNode.getNextSibling()\n const text = textNode.getTextContent()\n\n if ($isAutoLinkNode(previousSibling) && !startsWithSeparator(text)) {\n previousSibling.append(textNode)\n handleLinkEdit(previousSibling, matchers, onChange)\n onChange(null, previousSibling.getFields()?.url ?? null)\n }\n\n if ($isAutoLinkNode(nextSibling) && !endsWithSeparator(text)) {\n replaceWithChildren(nextSibling)\n handleLinkEdit(nextSibling, matchers, onChange)\n onChange(null, nextSibling.getFields()?.url ?? null)\n }\n}\n\nfunction replaceWithChildren(node: ElementNode): LexicalNode[] {\n const children = node.getChildren()\n const childrenLength = children.length\n\n for (let j = childrenLength - 1; j >= 0; j--) {\n node.insertAfter(children[j])\n }\n\n node.remove()\n return children.map((child) => child.getLatest())\n}\n\nfunction getTextNodesToMatch(textNode: TextNode): TextNode[] {\n // check if next siblings are simple text nodes till a node contains a space separator\n const textNodesToMatch = [textNode]\n let nextSibling = textNode.getNextSibling()\n while (nextSibling !== null && $isTextNode(nextSibling) && nextSibling.isSimpleText()) {\n textNodesToMatch.push(nextSibling)\n if (/\\s/.test(nextSibling.getTextContent())) {\n break\n }\n nextSibling = nextSibling.getNextSibling()\n }\n return textNodesToMatch\n}\n\nfunction useAutoLink(\n editor: LexicalEditor,\n matchers: LinkMatcher[],\n onChange?: ChangeHandler,\n): void {\n useEffect(() => {\n if (!editor.hasNodes([AutoLinkNode])) {\n invariant(false, 'LexicalAutoLinkPlugin: AutoLinkNode not registered on editor')\n }\n\n const onChangeWrapped = (url: null | string, prevUrl: null | string): void => {\n if (onChange != null) {\n onChange(url, prevUrl)\n }\n }\n\n return mergeRegister(\n editor.registerNodeTransform(TextNodeValue, (textNode: TextNode) => {\n const parent = textNode.getParentOrThrow()\n const previous = textNode.getPreviousSibling()\n if ($isAutoLinkNode(parent)) {\n handleLinkEdit(parent, matchers, onChangeWrapped)\n } else if (!$isLinkNode(parent)) {\n if (\n textNode.isSimpleText() &&\n (startsWithSeparator(textNode.getTextContent()) || !$isAutoLinkNode(previous))\n ) {\n const textNodesToMatch = getTextNodesToMatch(textNode)\n $handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped)\n }\n\n handleBadNeighbors(textNode, matchers, onChangeWrapped)\n }\n }),\n )\n }, [editor, matchers, onChange])\n}\n\nconst URL_REGEX =\n /((https?:\\/\\/(www\\.)?)|(www\\.))[-\\w@:%.+~#=]{1,256}\\.[a-zA-Z\\d()]{1,6}\\b([-\\w()@:%+.~#?&/=]*)/\n\nconst EMAIL_REGEX =\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-z\\-\\d]+\\.)+[a-z]{2,}))/i\n\nconst MATCHERS = [\n createLinkMatcherWithRegExp(URL_REGEX, (text) => {\n return text.startsWith('http') ? text : `https://${text}`\n }),\n createLinkMatcherWithRegExp(EMAIL_REGEX, (text) => {\n return `mailto:${text}`\n }),\n]\n\nexport const AutoLinkPlugin: PluginComponent<ClientProps> = () => {\n const [editor] = useLexicalComposerContext()\n\n useAutoLink(editor, MATCHERS)\n\n return null\n}\n"],"names":["useLexicalComposerContext","mergeRegister","$createTextNode","$getSelection","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isTextNode","TextNode","TextNodeValue","useEffect","invariant","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$isLinkNode","createLinkMatcherWithRegExp","regExp","urlTransformer","text","match","exec","index","length","url","findFirstMatch","matchers","i","PUNCTUATION_OR_SPACE","isSeparator","char","test","endsWithSeparator","textContent","startsWithSeparator","isPreviousNodeValid","node","previousNode","getPreviousSibling","getLastDescendant","getTextContent","isNextNodeValid","nextNode","getNextSibling","getFirstDescendant","isContentAroundIsValid","matchStart","matchEnd","nodes","contentBeforeIsValid","contentAfterIsValid","extractMatchingNodes","startIndex","endIndex","unmodifiedBeforeNodes","matchingNodes","unmodifiedAfterNodes","matchingOffset","currentOffset","currentNodes","currentNode","currentNodeText","currentNodeLength","currentNodeStart","currentNodeEnd","push","shift","$createAutoLinkNode_","fields","linkType","linkNode","remainingTextNode","linkTextNode","splitText","textNode","setFormat","getFormat","setDetail","getDetail","setStyle","getStyle","append","replace","firstTextNode","offset","firstLinkTextNode","linkNodes","endNode","selection","selectedTextNode","getNodes","find","undefined","select","anchor","focus","$handleLinkCreation","onChange","initialText","map","join","invalidMatchEnd","matchLength","isValid","actualMatchStart","actualMatchEnd","substring","handleLinkEdit","children","getChildren","childrenLength","child","isSimpleText","replaceWithChildren","getFields","flds","setFields","handleBadNeighbors","previousSibling","nextSibling","j","insertAfter","remove","getLatest","getTextNodesToMatch","textNodesToMatch","useAutoLink","editor","hasNodes","onChangeWrapped","prevUrl","registerNodeTransform","parent","getParentOrThrow","previous","URL_REGEX","EMAIL_REGEX","MATCHERS","startsWith","AutoLinkPlugin"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,WAAW,EAEXC,YAAYC,aAAa,QACpB,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAMjC,SAASC,SAAS,QAAQ,yCAAwC;AAClE,SAASC,mBAAmB,EAAEC,eAAe,EAAEC,YAAY,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4BAA4BuH,WAAW,CAACpH;QACtC,OAAOA,KAAKuH,UAAU,CAAC,UAAUvH,OAAO,CAAC,QAAQ,EAAEA,KAAK,CAAC;IAC3D;IACAH,4BAA4BwH,aAAa,CAACrH;QACxC,OAAO,CAAC,OAAO,EAAEA,KAAK,CAAC;IACzB;CACD;AAED,OAAO,MAAMwH,iBAA+C;IAC1D,MAAM,CAACZ,OAAO,GAAGhI;IAEjB+H,YAAYC,QAAQU;IAEpB,OAAO;AACT,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/link/plugins/autoLink/index.tsx"],"sourcesContent":["'use client'\nimport type { ElementNode, LexicalEditor, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $createTextNode,\n $getSelection,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isTextNode,\n type TextNode,\n TextNode as TextNodeValue,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { ClientProps } from '../../feature.client.js'\nimport type { LinkFields } from '../../nodes/types.js'\n\nimport { invariant } from '../../../../lexical/utils/invariant.js'\nimport { $createAutoLinkNode, $isAutoLinkNode, AutoLinkNode } from '../../nodes/AutoLinkNode.js'\nimport { $isLinkNode } from '../../nodes/LinkNode.js'\n\ntype ChangeHandler = (url: null | string, prevUrl: null | string) => void\n\ninterface LinkMatcherResult {\n fields?: LinkFields\n index: number\n length: number\n text: string\n url: string\n}\n\nexport type LinkMatcher = (text: string) => LinkMatcherResult | null\n\nexport function createLinkMatcherWithRegExp(\n regExp: RegExp,\n urlTransformer: (text: string) => string = (text) => text,\n) {\n return (text: string) => {\n const match = regExp.exec(text)\n if (match === null) return null\n return {\n index: match.index,\n length: match[0].length,\n text: match[0],\n url: urlTransformer(match[0]),\n }\n }\n}\n\nfunction findFirstMatch(text: string, matchers: LinkMatcher[]): LinkMatcherResult | null {\n for (let i = 0; i < matchers.length; i++) {\n const match = matchers[i](text)\n\n if (match != null) {\n return match\n }\n }\n\n return null\n}\n\nconst PUNCTUATION_OR_SPACE = /[.,;\\s]/\n\nfunction isSeparator(char: string): boolean {\n return PUNCTUATION_OR_SPACE.test(char)\n}\n\nfunction endsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[textContent.length - 1])\n}\n\nfunction startsWithSeparator(textContent: string): boolean {\n return isSeparator(textContent[0])\n}\n\nfunction isPreviousNodeValid(node: LexicalNode): boolean {\n let previousNode = node.getPreviousSibling()\n if ($isElementNode(previousNode)) {\n previousNode = previousNode.getLastDescendant()\n }\n return (\n previousNode === null ||\n $isLineBreakNode(previousNode) ||\n ($isTextNode(previousNode) && endsWithSeparator(previousNode.getTextContent()))\n )\n}\n\nfunction isNextNodeValid(node: LexicalNode): boolean {\n let nextNode = node.getNextSibling()\n if ($isElementNode(nextNode)) {\n nextNode = nextNode.getFirstDescendant()\n }\n return (\n nextNode === null ||\n $isLineBreakNode(nextNode) ||\n ($isTextNode(nextNode) && startsWithSeparator(nextNode.getTextContent()))\n )\n}\n\nfunction isContentAroundIsValid(\n matchStart: number,\n matchEnd: number,\n text: string,\n nodes: TextNode[],\n): boolean {\n const contentBeforeIsValid =\n matchStart > 0 ? isSeparator(text[matchStart - 1]) : isPreviousNodeValid(nodes[0])\n if (!contentBeforeIsValid) {\n return false\n }\n\n const contentAfterIsValid =\n matchEnd < text.length ? isSeparator(text[matchEnd]) : isNextNodeValid(nodes[nodes.length - 1])\n return contentAfterIsValid\n}\n\nfunction extractMatchingNodes(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n): [\n matchingOffset: number,\n unmodifiedBeforeNodes: TextNode[],\n matchingNodes: TextNode[],\n unmodifiedAfterNodes: TextNode[],\n] {\n const unmodifiedBeforeNodes: TextNode[] = []\n const matchingNodes: TextNode[] = []\n const unmodifiedAfterNodes: TextNode[] = []\n let matchingOffset = 0\n\n let currentOffset = 0\n const currentNodes = [...nodes]\n\n while (currentNodes.length > 0) {\n const currentNode = currentNodes[0]\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = currentOffset\n const currentNodeEnd = currentOffset + currentNodeLength\n\n if (currentNodeEnd <= startIndex) {\n unmodifiedBeforeNodes.push(currentNode)\n matchingOffset += currentNodeLength\n } else if (currentNodeStart >= endIndex) {\n unmodifiedAfterNodes.push(currentNode)\n } else {\n matchingNodes.push(currentNode)\n }\n currentOffset += currentNodeLength\n currentNodes.shift()\n }\n return [matchingOffset, unmodifiedBeforeNodes, matchingNodes, unmodifiedAfterNodes]\n}\n\nfunction $createAutoLinkNode_(\n nodes: TextNode[],\n startIndex: number,\n endIndex: number,\n match: LinkMatcherResult,\n): TextNode | undefined {\n const fields: LinkFields = {\n linkType: 'custom',\n url: match.url,\n ...match.fields,\n }\n\n const linkNode = $createAutoLinkNode({ fields })\n if (nodes.length === 1) {\n let remainingTextNode = nodes[0]\n let linkTextNode\n if (startIndex === 0) {\n ;[linkTextNode, remainingTextNode] = remainingTextNode.splitText(endIndex)\n } else {\n ;[, linkTextNode, remainingTextNode] = remainingTextNode.splitText(startIndex, endIndex)\n }\n const textNode = $createTextNode(match.text)\n textNode.setFormat(linkTextNode.getFormat())\n textNode.setDetail(linkTextNode.getDetail())\n textNode.setStyle(linkTextNode.getStyle())\n linkNode.append(textNode)\n linkTextNode.replace(linkNode)\n return remainingTextNode\n } else if (nodes.length > 1) {\n const firstTextNode = nodes[0]\n let offset = firstTextNode.getTextContent().length\n let firstLinkTextNode\n if (startIndex === 0) {\n firstLinkTextNode = firstTextNode\n } else {\n ;[, firstLinkTextNode] = firstTextNode.splitText(startIndex)\n }\n const linkNodes = []\n let remainingTextNode\n for (let i = 1; i < nodes.length; i++) {\n const currentNode = nodes[i]\n const currentNodeText = currentNode.getTextContent()\n const currentNodeLength = currentNodeText.length\n const currentNodeStart = offset\n const currentNodeEnd = offset + currentNodeLength\n if (currentNodeStart < endIndex) {\n if (currentNodeEnd <= endIndex) {\n linkNodes.push(currentNode)\n } else {\n const [linkTextNode, endNode] = currentNode.splitText(endIndex - currentNodeStart)\n linkNodes.push(linkTextNode)\n remainingTextNode = endNode\n }\n }\n offset += currentNodeLength\n }\n const selection = $getSelection()\n const selectedTextNode = selection ? selection.getNodes().find($isTextNode) : undefined\n const textNode = $createTextNode(firstLinkTextNode.getTextContent())\n textNode.setFormat(firstLinkTextNode.getFormat())\n textNode.setDetail(firstLinkTextNode.getDetail())\n textNode.setStyle(firstLinkTextNode.getStyle())\n linkNode.append(textNode, ...linkNodes)\n // it does not preserve caret position if caret was at the first text node\n // so we need to restore caret position\n if (selectedTextNode && selectedTextNode === firstLinkTextNode) {\n if ($isRangeSelection(selection)) {\n textNode.select(selection.anchor.offset, selection.focus.offset)\n } else if ($isNodeSelection(selection)) {\n textNode.select(0, textNode.getTextContent().length)\n }\n }\n firstLinkTextNode.replace(linkNode)\n return remainingTextNode\n }\n return undefined\n}\n\nfunction $handleLinkCreation(\n nodes: TextNode[],\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n let currentNodes = [...nodes]\n const initialText = currentNodes.map((node) => node.getTextContent()).join('')\n let text = initialText\n\n let match\n let invalidMatchEnd = 0\n\n while ((match = findFirstMatch(text, matchers)) != null && match !== null) {\n const matchStart: number = match.index\n const matchLength: number = match.length\n const matchEnd = matchStart + matchLength\n const isValid = isContentAroundIsValid(\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n initialText,\n currentNodes,\n )\n\n if (isValid) {\n const [matchingOffset, , matchingNodes, unmodifiedAfterNodes] = extractMatchingNodes(\n currentNodes,\n invalidMatchEnd + matchStart,\n invalidMatchEnd + matchEnd,\n )\n\n const actualMatchStart = invalidMatchEnd + matchStart - matchingOffset\n const actualMatchEnd = invalidMatchEnd + matchEnd - matchingOffset\n const remainingTextNode = $createAutoLinkNode_(\n matchingNodes,\n actualMatchStart,\n actualMatchEnd,\n match,\n )\n currentNodes = remainingTextNode\n ? [remainingTextNode, ...unmodifiedAfterNodes]\n : unmodifiedAfterNodes\n onChange(match.url, null)\n invalidMatchEnd = 0\n } else {\n invalidMatchEnd += matchEnd\n }\n\n text = text.substring(matchEnd)\n }\n}\n\nfunction handleLinkEdit(\n linkNode: AutoLinkNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n // Check children are simple text\n const children = linkNode.getChildren()\n const childrenLength = children.length\n for (let i = 0; i < childrenLength; i++) {\n const child = children[i]\n if (!$isTextNode(child) || !child.isSimpleText()) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n }\n\n // Check text content fully matches\n const text = linkNode.getTextContent()\n const match = findFirstMatch(text, matchers)\n if (match === null || match.text !== text) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n // Check neighbors\n if (!isPreviousNodeValid(linkNode) || !isNextNodeValid(linkNode)) {\n replaceWithChildren(linkNode)\n onChange(null, linkNode.getFields()?.url ?? null)\n return\n }\n\n const url = linkNode.getFields()?.url\n if (url !== match?.url) {\n const flds = linkNode.getFields()\n flds.url = match?.url\n linkNode.setFields(flds)\n onChange(match.url, url ?? null)\n }\n}\n\n// Bad neighbors are edits in neighbor nodes that make AutoLinks incompatible.\n// Given the creation preconditions, these can only be simple text nodes.\nfunction handleBadNeighbors(\n textNode: TextNode,\n matchers: LinkMatcher[],\n onChange: ChangeHandler,\n): void {\n const previousSibling = textNode.getPreviousSibling()\n const nextSibling = textNode.getNextSibling()\n const text = textNode.getTextContent()\n\n if ($isAutoLinkNode(previousSibling) && !startsWithSeparator(text)) {\n previousSibling.append(textNode)\n handleLinkEdit(previousSibling, matchers, onChange)\n onChange(null, previousSibling.getFields()?.url ?? null)\n }\n\n if ($isAutoLinkNode(nextSibling) && !endsWithSeparator(text)) {\n replaceWithChildren(nextSibling)\n handleLinkEdit(nextSibling, matchers, onChange)\n onChange(null, nextSibling.getFields()?.url ?? null)\n }\n}\n\nfunction replaceWithChildren(node: ElementNode): LexicalNode[] {\n const children = node.getChildren()\n const childrenLength = children.length\n\n for (let j = childrenLength - 1; j >= 0; j--) {\n node.insertAfter(children[j])\n }\n\n node.remove()\n return children.map((child) => child.getLatest())\n}\n\nfunction getTextNodesToMatch(textNode: TextNode): TextNode[] {\n // check if next siblings are simple text nodes till a node contains a space separator\n const textNodesToMatch = [textNode]\n let nextSibling = textNode.getNextSibling()\n while (nextSibling !== null && $isTextNode(nextSibling) && nextSibling.isSimpleText()) {\n textNodesToMatch.push(nextSibling)\n if (/\\s/.test(nextSibling.getTextContent())) {\n break\n }\n nextSibling = nextSibling.getNextSibling()\n }\n return textNodesToMatch\n}\n\nfunction useAutoLink(\n editor: LexicalEditor,\n matchers: LinkMatcher[],\n onChange?: ChangeHandler,\n): void {\n useEffect(() => {\n if (!editor.hasNodes([AutoLinkNode])) {\n invariant(false, 'LexicalAutoLinkPlugin: AutoLinkNode not registered on editor')\n }\n\n const onChangeWrapped = (url: null | string, prevUrl: null | string): void => {\n if (onChange != null) {\n onChange(url, prevUrl)\n }\n }\n\n return mergeRegister(\n editor.registerNodeTransform(TextNodeValue, (textNode: TextNode) => {\n const parent = textNode.getParentOrThrow()\n const previous = textNode.getPreviousSibling()\n if ($isAutoLinkNode(parent)) {\n handleLinkEdit(parent, matchers, onChangeWrapped)\n } else if (!$isLinkNode(parent)) {\n if (\n textNode.isSimpleText() &&\n (startsWithSeparator(textNode.getTextContent()) || !$isAutoLinkNode(previous))\n ) {\n const textNodesToMatch = getTextNodesToMatch(textNode)\n $handleLinkCreation(textNodesToMatch, matchers, onChangeWrapped)\n }\n\n handleBadNeighbors(textNode, matchers, onChangeWrapped)\n }\n }),\n )\n }, [editor, matchers, onChange])\n}\n\nconst URL_REGEX =\n /((https?:\\/\\/(www\\.)?)|(www\\.))[-\\w@:%.+~#=]{1,256}\\.[a-zA-Z\\d()]{1,6}\\b([-\\w()@:%+.~#?&/=]*)/\n\nconst EMAIL_REGEX =\n /(([^<>()[\\]\\\\.,;:\\s@\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\])|(([a-z\\-\\d]+\\.)+[a-z]{2,}))/i\n\nconst MATCHERS = [\n createLinkMatcherWithRegExp(URL_REGEX, (text) => {\n return text.startsWith('http') ? text : `https://${text}`\n }),\n createLinkMatcherWithRegExp(EMAIL_REGEX, (text) => {\n return `mailto:${text}`\n }),\n]\n\nexport const AutoLinkPlugin: PluginComponent<ClientProps> = () => {\n const [editor] = useLexicalComposerContext()\n\n useAutoLink(editor, MATCHERS)\n\n return null\n}\n"],"names":["useLexicalComposerContext","mergeRegister","$createTextNode","$getSelection","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isTextNode","TextNode","TextNodeValue","useEffect","invariant","$createAutoLinkNode","$isAutoLinkNode","AutoLinkNode","$isLinkNode","createLinkMatcherWithRegExp","regExp","urlTransformer","text","match","exec","index","length","url","findFirstMatch","matchers","i","PUNCTUATION_OR_SPACE","isSeparator","char","test","endsWithSeparator","textContent","startsWithSeparator","isPreviousNodeValid","node","previousNode","getPreviousSibling","getLastDescendant","getTextContent","isNextNodeValid","nextNode","getNextSibling","getFirstDescendant","isContentAroundIsValid","matchStart","matchEnd","nodes","contentBeforeIsValid","contentAfterIsValid","extractMatchingNodes","startIndex","endIndex","unmodifiedBeforeNodes","matchingNodes","unmodifiedAfterNodes","matchingOffset","currentOffset","currentNodes","currentNode","currentNodeText","currentNodeLength","currentNodeStart","currentNodeEnd","push","shift","$createAutoLinkNode_","fields","linkType","linkNode","remainingTextNode","linkTextNode","splitText","textNode","setFormat","getFormat","setDetail","getDetail","setStyle","getStyle","append","replace","firstTextNode","offset","firstLinkTextNode","linkNodes","endNode","selection","selectedTextNode","getNodes","find","undefined","select","anchor","focus","$handleLinkCreation","onChange","initialText","map","join","invalidMatchEnd","matchLength","isValid","actualMatchStart","actualMatchEnd","substring","handleLinkEdit","children","getChildren","childrenLength","child","isSimpleText","replaceWithChildren","getFields","flds","setFields","handleBadNeighbors","previousSibling","nextSibling","j","insertAfter","remove","getLatest","getTextNodesToMatch","textNodesToMatch","useAutoLink","editor","hasNodes","onChangeWrapped","prevUrl","registerNodeTransform","parent","getParentOrThrow","previous","URL_REGEX","EMAIL_REGEX","MATCHERS","startsWith","AutoLinkPlugin"],"mappings":"AAAA;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,eAAe,EACfC,aAAa,EACbC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,WAAW,EAEXC,YAAYC,aAAa,QACpB,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAMjC,SAASC,SAAS,QAAQ,yCAAwC;AAClE,SAASC,mBAAmB,EAAEC,eAAe,EAAEC,YAAY,QAAQ,8BAA6B;AAChG,SAASC,WAAW,QAAQ,0BAAyB;AAcrD,OAAO,SAASC,4BACdC,MAAc,EACdC,iBAA2C,CAACC,OAASA,IAAI;IAEzD,OAAO,CAACA;QACN,MAAMC,QAAQH,OAAOI,IAAI,CAACF;QAC1B,IAAIC,UAAU,MAAM,OAAO;QAC3B,OAAO;YACLE,OAAOF,MAAME,KAAK;YAClBC,QAAQH,KAAK,CAAC,EAAE,CAACG,MAAM;YACvBJ,MAAMC,KAAK,CAAC,EAAE;YACdI,KAAKN,eAAeE,KAAK,CAAC,EAAE;QAC9B;IACF;AACF;AAEA,SAASK,eAAeN,IAAY,EAAEO,QAAuB;IAC3D,IAAK,IAAIC,IAAI,GAAGA,IAAID,SAASH,MAAM,EAAEI,IAAK;QACxC,MAAMP,QAAQM,QAAQ,CAACC,EAAE,CAACR;QAE1B,IAAIC,SAAS,MAAM;YACjB,OAAOA;QACT;IACF;IAEA,OAAO;AACT;AAEA,MAAMQ,uBAAu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,KAAK0G;YAChB;QACF;QAEA,OAAOlI,cACL+H,OAAOI,qBAAqB,CAAC1H,eAAe,CAACiE;YAC3C,MAAM0D,SAAS1D,SAAS2D,gBAAgB;YACxC,MAAMC,WAAW5D,SAASpC,kBAAkB;YAC5C,IAAIzB,gBAAgBuH,SAAS;gBAC3BzB,eAAeyB,QAAQ1G,UAAUuG;YACnC,OAAO,IAAI,CAAClH,YAAYqH,SAAS;gBAC/B,IACE1D,SAASsC,YAAY,MACpB9E,CAAAA,oBAAoBwC,SAASlC,cAAc,OAAO,CAAC3B,gBAAgByH,SAAQ,GAC5E;oBACA,MAAMT,mBAAmBD,oBAAoBlD;oBAC7CsB,oBAAoB6B,kBAAkBnG,UAAUuG;gBAClD;gBAEAZ,mBAAmB3C,UAAUhD,UAAUuG;YACzC;QACF;IAEJ,GAAG;QAACF;QAAQrG;QAAUuE;KAAS;AACjC;AAEA,MAAMsC,YACJ;AAEF,MAAMC,cACJ;AAEF,MAAMC,WAAW;IACfzH,4BAA4BuH,WAAW,CAACpH;QACtC,OAAOA,KAAKuH,UAAU,CAAC,UAAUvH,OAAO,CAAC,QAAQ,EAAEA,KAAK,CAAC;IAC3D;IACAH,4BAA4BwH,aAAa,CAACrH;QACxC,OAAO,CAAC,OAAO,EAAEA,KAAK,CAAC;IACzB;CACD;AAED,OAAO,MAAMwH,iBAA+C;IAC1D,MAAM,CAACZ,OAAO,GAAGhI;IAEjB+H,YAAYC,QAAQU;IAEpB,OAAO;AACT,EAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginComponent } from '../../../
|
|
1
|
+
import type { PluginComponent } from '../../../typesClient.js';
|
|
2
2
|
import type { ClientProps } from '../../feature.client.js';
|
|
3
3
|
export declare const ClickableLinkPlugin: PluginComponent<ClientProps>;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/clickableLink/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/clickableLink/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAE1D,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,WAAW,CAE5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/link/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/link/plugins/clickableLink/index.tsx"],"sourcesContent":["'use client'\nimport { ClickableLinkPlugin as LexicalClickableLinkPlugin } from '@lexical/react/LexicalClickableLinkPlugin.js'\nimport React from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { ClientProps } from '../../feature.client.js'\n\nexport const ClickableLinkPlugin: PluginComponent<ClientProps> = () => {\n return <LexicalClickableLinkPlugin />\n}\n"],"names":["ClickableLinkPlugin","LexicalClickableLinkPlugin","React"],"mappings":"AAAA;;AACA,SAASA,uBAAuBC,0BAA0B,QAAQ,+CAA8C;AAChH,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMF,sBAAoD;IAC/D,qBAAO,KAACC;AACV,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/link/plugins/floatingLinkEditor/LinkEditor/commands.ts"],"sourcesContent":["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nimport type { LinkPayload } from '../types.js'\n\nexport const TOGGLE_LINK_WITH_MODAL_COMMAND: LexicalCommand<LinkPayload | null> = createCommand(\n 'TOGGLE_LINK_WITH_MODAL_COMMAND',\n)\n"],"names":["createCommand","TOGGLE_LINK_WITH_MODAL_COMMAND"],"
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/features/link/plugins/floatingLinkEditor/LinkEditor/commands.ts"],"sourcesContent":["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nimport type { LinkPayload } from '../types.js'\n\nexport const TOGGLE_LINK_WITH_MODAL_COMMAND: LexicalCommand<LinkPayload | null> = createCommand(\n 'TOGGLE_LINK_WITH_MODAL_COMMAND',\n)\n"],"names":["createCommand","TOGGLE_LINK_WITH_MODAL_COMMAND"],"mappings":"AAEA,SAASA,aAAa,QAAQ,UAAS;AAIvC,OAAO,MAAMC,iCAAqED,cAChF,kCACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../src/features/link/plugins/floatingLinkEditor/LinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalNode } from 'lexical'\nimport type { Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport { formatDrawerSlug, useConfig, useEditDepth, useModal, useTranslation } from '@payloadcms/ui'\nimport {\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n COMMAND_PRIORITY_HIGH,\n COMMAND_PRIORITY_LOW,\n KEY_ESCAPE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\n\nimport type { LinkNode } from '../../../nodes/LinkNode.js'\nimport type { LinkFields } from '../../../nodes/types.js'\nimport type { LinkPayload } from '../types.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getSelectedNode } from '../../../../../lexical/utils/getSelectedNode.js'\nimport { setFloatingElemPositionForLinkEditor } from '../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\nimport { LinkDrawer } from '../../../drawer/index.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\nexport function LinkEditor({ anchorElem }: { anchorElem: HTMLElement }): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n\n const editorRef = useRef<HTMLDivElement | null>(null)\n const [linkUrl, setLinkUrl] = useState(null)\n const [linkLabel, setLinkLabel] = useState(null)\n\n const { uuid } = useEditorConfigContext()\n\n const config = useConfig()\n\n const { i18n, t } = useTranslation()\n\n const [stateData, setStateData] = useState<{} | (LinkFields & { id?: string; text: string })>({})\n\n const { closeModal, isModalOpen, toggleModal } = useModal()\n const editDepth = useEditDepth()\n const [isLink, setIsLink] = useState(false)\n const [selectedNodes, setSelectedNodes] = useState<LexicalNode[]>([])\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 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({})\n }, [setIsLink, setLinkUrl, setLinkLabel, setSelectedNodes])\n\n const $updateLinkEditor = useCallback(() => {\n const selection = $getSelection()\n let selectedNodeDomRect: DOMRect | undefined = null\n\n if (!$isRangeSelection(selection) || !selection) {\n 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: LinkNode = $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\n // Initial state:\n const data: LinkFields & { text: string } = {\n doc: undefined,\n linkType: undefined,\n newTab: undefined,\n url: '',\n ...focusLinkParent.getFields(),\n id: focusLinkParent.getID(),\n text: focusLinkParent.getTextContent(),\n }\n\n if (focusLinkParent.getFields()?.linkType === 'custom') {\n setLinkUrl(focusLinkParent.getFields()?.url ?? null)\n setLinkLabel(null)\n } else {\n // internal link\n setLinkUrl(\n `/admin/collections/${focusLinkParent.getFields()?.doc?.relationTo}/${\n focusLinkParent.getFields()?.doc?.value\n }`,\n )\n\n const relatedField = config.collections.find(\n (coll) => coll.slug === focusLinkParent.getFields()?.doc?.relationTo,\n )\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(\n focusLinkParent.getFields()?.label ? String(focusLinkParent.getFields()?.label) : null,\n )\n setLinkUrl(\n focusLinkParent.getFields()?.url ? String(focusLinkParent.getFields()?.url) : null,\n )\n } else {\n const label = t('fields:linkedTo', {\n label: getTranslation(relatedField.labels.singular, i18n),\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(label)\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 = window.getSelection()\n const { activeElement } = document\n\n if (editorElem === null) {\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n if (!selectedNodeDomRect) {\n // Get the DOM rect of the selected node using the native selection. This sometimes produces the wrong\n // result, which is why we use lexical's selection preferably.\n selectedNodeDomRect = nativeSelection.getRangeAt(0).getBoundingClientRect()\n }\n\n if (selectedNodeDomRect != null) {\n selectedNodeDomRect.y += 40\n setFloatingElemPositionForLinkEditor(selectedNodeDomRect, editorElem, anchorElem)\n }\n } else if (activeElement == null || activeElement.className !== 'link-input') {\n if (rootElement !== null) {\n setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem)\n }\n setLinkUrl(null)\n setLinkLabel(null)\n }\n\n return true\n }, [editor, setNotLink, config.collections, t, i18n, anchorElem])\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 toggleModal(drawerSlug)\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateLinkEditor, toggleModal, drawerSlug])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = (): void => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }\n\n window.addEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [anchorElem.parentElement, editor, $updateLinkEditor])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n void $updateLinkEditor()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n void $updateLinkEditor()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n () => {\n if (isLink) {\n setNotLink()\n\n return true\n }\n return false\n },\n COMMAND_PRIORITY_HIGH,\n ),\n )\n }, [editor, $updateLinkEditor, isLink, setNotLink])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }, [editor, $updateLinkEditor])\n\n return (\n <React.Fragment>\n <div className=\"link-editor\" ref={editorRef}>\n <div className=\"link-input\">\n {linkUrl && linkUrl.length > 0 ? (\n <a href={linkUrl} rel=\"noopener noreferrer\" target=\"_blank\">\n {linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl}\n </a>\n ) : linkLabel != null && linkLabel.length > 0 ? (\n <span className=\"link-input__label-pure\">{linkLabel}</span>\n ) : null}\n\n {editor.isEditable() && (\n <React.Fragment>\n <button\n aria-label=\"Edit link\"\n className=\"link-edit\"\n onClick={() => {\n toggleModal(drawerSlug)\n }}\n onMouseDown={(event) => {\n event.preventDefault()\n }}\n tabIndex={0}\n type=\"button\"\n />\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={(event) => {\n event.preventDefault()\n }}\n tabIndex={0}\n type=\"button\"\n />\n )}\n </React.Fragment>\n )}\n </div>\n </div>\n {isModalOpen(drawerSlug) && (\n <LinkDrawer\n drawerSlug={drawerSlug}\n handleModalSubmit={(fields: FormState, data: Data) => {\n closeModal(drawerSlug)\n\n const newLinkPayload = data as LinkFields & { text: string }\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 = null\n if ($isRangeSelection(selection)) {\n linkParent = getSelectedNode(selection).getParent()\n } else {\n if (selectedNodes.length) {\n linkParent = selectedNodes[0].getParent()\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 stateData={stateData}\n />\n )}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$findMatchingParent","mergeRegister","getTranslation","formatDrawerSlug","useConfig","useEditDepth","useModal","useTranslation","$getSelection","$isLineBreakNode","$isRangeSelection","COMMAND_PRIORITY_HIGH","COMMAND_PRIORITY_LOW","KEY_ESCAPE_COMMAND","SELECTION_CHANGE_COMMAND","React","useCallback","useEffect","useRef","useState","useEditorConfigContext","getSelectedNode","setFloatingElemPositionForLinkEditor","LinkDrawer","$isAutoLinkNode","$createLinkNode","$isLinkNode","TOGGLE_LINK_COMMAND","TOGGLE_LINK_WITH_MODAL_COMMAND","LinkEditor","anchorElem","editor","editorRef","linkUrl","setLinkUrl","linkLabel","setLinkLabel","uuid","config","i18n","t","stateData","setStateData","closeModal","isModalOpen","toggleModal","editDepth","isLink","setIsLink","selectedNodes","setSelectedNodes","isAutoLink","setIsAutoLink","drawerSlug","slug","depth","setNotLink","current","style","opacity","transform","$updateLinkEditor","selection","selectedNodeDomRect","focusNode","getElementByKey","getKey","getBoundingClientRect","focusLinkParent","badNode","getNodes","filter","node","find","linkNode","is","data","doc","undefined","linkType","newTab","url","getFields","id","getID","text","getTextContent","relationTo","value","relatedField","collections","coll","label","String","labels","singular","replace","editorElem","nativeSelection","window","getSelection","activeElement","document","rootElement","getRootElement","contains","anchorNode","getRangeAt","y","className","registerCommand","payload","dispatchCommand","scrollerElem","parentElement","update","getEditorState","read","addEventListener","removeEventListener","registerUpdateListener","editorState","Fragment","div","ref","length","a","href","rel","target","span","isEditable","button","aria-label","onClick","onMouseDown","event","preventDefault","tabIndex","type","handleModalSubmit","fields","newLinkPayload","bareLinkFields","linkParent","getParent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,EAAEC,SAAS,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,iBAAgB;AACpG,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,wBAAwB,QACnB,UAAS;AAChB,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAMvE,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,eAAe,QAAQ,kDAAiD;AACjF,SAASC,oCAAoC,QAAQ,uEAAsE;AAC3H,SAASC,UAAU,QAAQ,2BAA0B;AACrD,SAASC,eAAe,QAAQ,iCAAgC;AAChE,SAASC,eAAe,EAAEC,WAAW,EAAEC,mBAAmB,QAAQ,6BAA4B;AAC9F,SAASC,8BAA8B,QAAQ,gBAAe;AAE9D,OAAO,SAASC,WAAW,EAAEC,UAAU,EAA+B;IACpE,MAAM,CAACC,OAAO,GAAGhC;IAEjB,MA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"version":3,"sources":["../../../../../../src/features/link/plugins/floatingLinkEditor/LinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalNode } from 'lexical'\nimport type { Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport { formatDrawerSlug, useConfig, useEditDepth, useModal, useTranslation } from '@payloadcms/ui'\nimport {\n $getSelection,\n $isLineBreakNode,\n $isRangeSelection,\n COMMAND_PRIORITY_HIGH,\n COMMAND_PRIORITY_LOW,\n KEY_ESCAPE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\n\nimport type { LinkNode } from '../../../nodes/LinkNode.js'\nimport type { LinkFields } from '../../../nodes/types.js'\nimport type { LinkPayload } from '../types.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getSelectedNode } from '../../../../../lexical/utils/getSelectedNode.js'\nimport { setFloatingElemPositionForLinkEditor } from '../../../../../lexical/utils/setFloatingElemPositionForLinkEditor.js'\nimport { LinkDrawer } from '../../../drawer/index.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\nexport function LinkEditor({ anchorElem }: { anchorElem: HTMLElement }): React.ReactNode {\n const [editor] = useLexicalComposerContext()\n\n const editorRef = useRef<HTMLDivElement | null>(null)\n const [linkUrl, setLinkUrl] = useState(null)\n const [linkLabel, setLinkLabel] = useState(null)\n\n const { uuid } = useEditorConfigContext()\n\n const config = useConfig()\n\n const { i18n, t } = useTranslation()\n\n const [stateData, setStateData] = useState<{} | (LinkFields & { id?: string; text: string })>({})\n\n const { closeModal, isModalOpen, toggleModal } = useModal()\n const editDepth = useEditDepth()\n const [isLink, setIsLink] = useState(false)\n const [selectedNodes, setSelectedNodes] = useState<LexicalNode[]>([])\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 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({})\n }, [setIsLink, setLinkUrl, setLinkLabel, setSelectedNodes])\n\n const $updateLinkEditor = useCallback(() => {\n const selection = $getSelection()\n let selectedNodeDomRect: DOMRect | undefined = null\n\n if (!$isRangeSelection(selection) || !selection) {\n 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: LinkNode = $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\n // Initial state:\n const data: LinkFields & { text: string } = {\n doc: undefined,\n linkType: undefined,\n newTab: undefined,\n url: '',\n ...focusLinkParent.getFields(),\n id: focusLinkParent.getID(),\n text: focusLinkParent.getTextContent(),\n }\n\n if (focusLinkParent.getFields()?.linkType === 'custom') {\n setLinkUrl(focusLinkParent.getFields()?.url ?? null)\n setLinkLabel(null)\n } else {\n // internal link\n setLinkUrl(\n `/admin/collections/${focusLinkParent.getFields()?.doc?.relationTo}/${\n focusLinkParent.getFields()?.doc?.value\n }`,\n )\n\n const relatedField = config.collections.find(\n (coll) => coll.slug === focusLinkParent.getFields()?.doc?.relationTo,\n )\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(\n focusLinkParent.getFields()?.label ? String(focusLinkParent.getFields()?.label) : null,\n )\n setLinkUrl(\n focusLinkParent.getFields()?.url ? String(focusLinkParent.getFields()?.url) : null,\n )\n } else {\n const label = t('fields:linkedTo', {\n label: getTranslation(relatedField.labels.singular, i18n),\n }).replace(/<[^>]*>?/g, '')\n setLinkLabel(label)\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 = window.getSelection()\n const { activeElement } = document\n\n if (editorElem === null) {\n return\n }\n\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n if (!selectedNodeDomRect) {\n // Get the DOM rect of the selected node using the native selection. This sometimes produces the wrong\n // result, which is why we use lexical's selection preferably.\n selectedNodeDomRect = nativeSelection.getRangeAt(0).getBoundingClientRect()\n }\n\n if (selectedNodeDomRect != null) {\n selectedNodeDomRect.y += 40\n setFloatingElemPositionForLinkEditor(selectedNodeDomRect, editorElem, anchorElem)\n }\n } else if (activeElement == null || activeElement.className !== 'link-input') {\n if (rootElement !== null) {\n setFloatingElemPositionForLinkEditor(null, editorElem, anchorElem)\n }\n setLinkUrl(null)\n setLinkLabel(null)\n }\n\n return true\n }, [editor, setNotLink, config.collections, t, i18n, anchorElem])\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 toggleModal(drawerSlug)\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateLinkEditor, toggleModal, drawerSlug])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = (): void => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }\n\n window.addEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n\n if (scrollerElem != null) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [anchorElem.parentElement, editor, $updateLinkEditor])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n void $updateLinkEditor()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n void $updateLinkEditor()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ESCAPE_COMMAND,\n () => {\n if (isLink) {\n setNotLink()\n\n return true\n }\n return false\n },\n COMMAND_PRIORITY_HIGH,\n ),\n )\n }, [editor, $updateLinkEditor, isLink, setNotLink])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n void $updateLinkEditor()\n })\n }, [editor, $updateLinkEditor])\n\n return (\n <React.Fragment>\n <div className=\"link-editor\" ref={editorRef}>\n <div className=\"link-input\">\n {linkUrl && linkUrl.length > 0 ? (\n <a href={linkUrl} rel=\"noopener noreferrer\" target=\"_blank\">\n {linkLabel != null && linkLabel.length > 0 ? linkLabel : linkUrl}\n </a>\n ) : linkLabel != null && linkLabel.length > 0 ? (\n <span className=\"link-input__label-pure\">{linkLabel}</span>\n ) : null}\n\n {editor.isEditable() && (\n <React.Fragment>\n <button\n aria-label=\"Edit link\"\n className=\"link-edit\"\n onClick={() => {\n toggleModal(drawerSlug)\n }}\n onMouseDown={(event) => {\n event.preventDefault()\n }}\n tabIndex={0}\n type=\"button\"\n />\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={(event) => {\n event.preventDefault()\n }}\n tabIndex={0}\n type=\"button\"\n />\n )}\n </React.Fragment>\n )}\n </div>\n </div>\n {isModalOpen(drawerSlug) && (\n <LinkDrawer\n drawerSlug={drawerSlug}\n handleModalSubmit={(fields: FormState, data: Data) => {\n closeModal(drawerSlug)\n\n const newLinkPayload = data as LinkFields & { text: string }\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 = null\n if ($isRangeSelection(selection)) {\n linkParent = getSelectedNode(selection).getParent()\n } else {\n if (selectedNodes.length) {\n linkParent = selectedNodes[0].getParent()\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 stateData={stateData}\n />\n )}\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","$findMatchingParent","mergeRegister","getTranslation","formatDrawerSlug","useConfig","useEditDepth","useModal","useTranslation","$getSelection","$isLineBreakNode","$isRangeSelection","COMMAND_PRIORITY_HIGH","COMMAND_PRIORITY_LOW","KEY_ESCAPE_COMMAND","SELECTION_CHANGE_COMMAND","React","useCallback","useEffect","useRef","useState","useEditorConfigContext","getSelectedNode","setFloatingElemPositionForLinkEditor","LinkDrawer","$isAutoLinkNode","$createLinkNode","$isLinkNode","TOGGLE_LINK_COMMAND","TOGGLE_LINK_WITH_MODAL_COMMAND","LinkEditor","anchorElem","editor","editorRef","linkUrl","setLinkUrl","linkLabel","setLinkLabel","uuid","config","i18n","t","stateData","setStateData","closeModal","isModalOpen","toggleModal","editDepth","isLink","setIsLink","selectedNodes","setSelectedNodes","isAutoLink","setIsAutoLink","drawerSlug","slug","depth","setNotLink","current","style","opacity","transform","$updateLinkEditor","selection","selectedNodeDomRect","focusNode","getElementByKey","getKey","getBoundingClientRect","focusLinkParent","badNode","getNodes","filter","node","find","linkNode","is","data","doc","undefined","linkType","newTab","url","getFields","id","getID","text","getTextContent","relationTo","value","relatedField","collections","coll","label","String","labels","singular","replace","editorElem","nativeSelection","window","getSelection","activeElement","document","rootElement","getRootElement","contains","anchorNode","getRangeAt","y","className","registerCommand","payload","dispatchCommand","scrollerElem","parentElement","update","getEditorState","read","addEventListener","removeEventListener","registerUpdateListener","editorState","Fragment","div","ref","length","a","href","rel","target","span","isEditable","button","aria-label","onClick","onMouseDown","event","preventDefault","tabIndex","type","handleModalSubmit","fields","newLinkPayload","bareLinkFields","linkParent","getParent"],"mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,gBAAgB,EAAEC,SAAS,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,cAAc,QAAQ,iBAAgB;AACpG,SACEC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,qBAAqB,EACrBC,oBAAoB,EACpBC,kBAAkB,EAClBC,wBAAwB,QACnB,UAAS;AAChB,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAMvE,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,eAAe,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BAAgBwH,aAAa;4BAC7C,MAAMtE,WAAWjD,gBAAgB;gCAC/BoH,QAAQE;4BACV;4BACAC,WAAWhD,OAAO,CAACtB,UAAU;wBAC/B;oBACF;oBAEA,oIAAoI;oBACpI,mEAAmE;oBACnE3C,OAAOiF,eAAe,CAACrF,qBAAqB;wBAC1CkH,QAAQE;wBACR9F;wBACAoC,MAAMyD,eAAezD,IAAI;oBAC3B;gBACF;gBACA5C,WAAWA;;;;AAKrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginComponentWithAnchor } from '../../../
|
|
1
|
+
import type { PluginComponentWithAnchor } from '../../../typesClient.js';
|
|
2
2
|
import type { ClientProps } from '../../feature.client.js';
|
|
3
3
|
import './index.scss';
|
|
4
4
|
export declare const FloatingLinkEditorPlugin: PluginComponentWithAnchor<ClientProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/floatingLinkEditor/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/floatingLinkEditor/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAG1D,OAAO,cAAc,CAAA;AAErB,eAAO,MAAM,wBAAwB,EAAE,yBAAyB,CAAC,WAAW,CAI3E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/link/plugins/floatingLinkEditor/index.tsx"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/link/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 '../../feature.client.js'\n\nimport { LinkEditor } from './LinkEditor/index.js'\nimport './index.scss'\n\nexport const FloatingLinkEditorPlugin: PluginComponentWithAnchor<ClientProps> = (props) => {\n const { anchorElem = document.body } = props\n\n return createPortal(<LinkEditor anchorElem={anchorElem} />, anchorElem)\n}\n"],"names":["React","createPortal","LinkEditor","FloatingLinkEditorPlugin","props","anchorElem","document","body"],"mappings":"AAAA;;AACA,YAAYA,WAAW,QAAO;AAC9B,SAASC,YAAY,QAAQ,YAAW;AAKxC,SAASC,UAAU,QAAQ,wBAAuB;AAGlD,OAAO,MAAMC,2BAAmE,CAACC;IAC/E,MAAM,EAAEC,aAAaC,SAASC,IAAI,EAAE,GAAGH;IAEvC,qBAAOH,2BAAa,KAACC;QAAWG,YAAYA;QAAgBA;AAC9D,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/link/plugins/floatingLinkEditor/types.ts"],"sourcesContent":["import type { LexicalNode } from 'lexical'\n\nimport type { LinkFields } from '../../nodes/types.js'\n\n/**\n * The payload of a link node\n * This can be delivered from the link node to the drawer, or from the drawer/anything to the TOGGLE_LINK_COMMAND\n */\nexport type LinkPayload = {\n fields: LinkFields\n selectedNodes?: LexicalNode[]\n /**\n * The text content of the link node - will be displayed in the drawer\n */\n text: null | string\n}\n"],"names":[],"
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/link/plugins/floatingLinkEditor/types.ts"],"sourcesContent":["import type { LexicalNode } from 'lexical'\n\nimport type { LinkFields } from '../../nodes/types.js'\n\n/**\n * The payload of a link node\n * This can be delivered from the link node to the drawer, or from the drawer/anything to the TOGGLE_LINK_COMMAND\n */\nexport type LinkPayload = {\n fields: LinkFields\n selectedNodes?: LexicalNode[]\n /**\n * The text content of the link node - will be displayed in the drawer\n */\n text: null | string\n}\n"],"names":[],"mappings":"AAIA;;;CAGC,GACD,WAOC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { Field, FieldAffectingData, SanitizedConfig } from 'payload';
|
|
1
|
+
import type { CollectionSlug, Field, FieldAffectingData, SanitizedConfig } from 'payload';
|
|
2
2
|
/**
|
|
3
3
|
* This function is run to enrich the basefields which every link has with potential, custom user-added fields.
|
|
4
4
|
*/
|
|
5
5
|
export declare function transformExtraFields(customFieldSchema: ((args: {
|
|
6
6
|
config: SanitizedConfig;
|
|
7
7
|
defaultFields: FieldAffectingData[];
|
|
8
|
-
}) => Field[]) | Field[], config: SanitizedConfig, enabledCollections?:
|
|
8
|
+
}) => Field[]) | Field[], config: SanitizedConfig, enabledCollections?: CollectionSlug[], disabledCollections?: CollectionSlug[], maxDepth?: number): Field[];
|
|
9
9
|
//# sourceMappingURL=utilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/floatingLinkEditor/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/floatingLinkEditor/utilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAIzF;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,iBAAiB,EACb,CAAC,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,aAAa,EAAE,kBAAkB,EAAE,CAAA;CAAE,KAAK,KAAK,EAAE,CAAC,GACrF,KAAK,EAAE,EACX,MAAM,EAAE,eAAe,EACvB,kBAAkB,CAAC,EAAE,cAAc,EAAE,EACrC,mBAAmB,CAAC,EAAE,cAAc,EAAE,EACtC,QAAQ,CAAC,EAAE,MAAM,GAChB,KAAK,EAAE,CAmBT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/link/plugins/floatingLinkEditor/utilities.ts"],"sourcesContent":["import type { Field, FieldAffectingData, SanitizedConfig } from 'payload'\n\nimport { getBaseFields } from '../../drawer/baseFields.js'\n\n/**\n * This function is run to enrich the basefields which every link has with potential, custom user-added fields.\n */\nexport function transformExtraFields(\n customFieldSchema:\n | ((args: { config: SanitizedConfig; defaultFields: FieldAffectingData[] }) => Field[])\n | Field[],\n config: SanitizedConfig,\n enabledCollections?:
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/link/plugins/floatingLinkEditor/utilities.ts"],"sourcesContent":["import type { CollectionSlug, Field, FieldAffectingData, SanitizedConfig } from 'payload'\n\nimport { getBaseFields } from '../../drawer/baseFields.js'\n\n/**\n * This function is run to enrich the basefields which every link has with potential, custom user-added fields.\n */\nexport function transformExtraFields(\n customFieldSchema:\n | ((args: { config: SanitizedConfig; defaultFields: FieldAffectingData[] }) => Field[])\n | Field[],\n config: SanitizedConfig,\n enabledCollections?: CollectionSlug[],\n disabledCollections?: CollectionSlug[],\n maxDepth?: number,\n): Field[] {\n const baseFields: FieldAffectingData[] = getBaseFields(\n config,\n enabledCollections,\n disabledCollections,\n maxDepth,\n )\n\n let fields: Field[]\n\n if (typeof customFieldSchema === 'function') {\n fields = customFieldSchema({ config, defaultFields: baseFields })\n } else if (Array.isArray(customFieldSchema)) {\n fields = customFieldSchema\n } else {\n fields = baseFields as Field[]\n }\n\n return fields\n}\n"],"names":["getBaseFields","transformExtraFields","customFieldSchema","config","enabledCollections","disabledCollections","maxDepth","baseFields","fields","defaultFields","Array","isArray"],"mappings":"AAEA,SAASA,aAAa,QAAQ,6BAA4B;AAE1D;;CAEC,GACD,OAAO,SAASC,qBACdC,iBAEW,EACXC,MAAuB,EACvBC,kBAAqC,EACrCC,mBAAsC,EACtCC,QAAiB;IAEjB,MAAMC,aAAmCP,cACvCG,QACAC,oBACAC,qBACAC;IAGF,IAAIE;IAEJ,IAAI,OAAON,sBAAsB,YAAY;QAC3CM,SAASN,kBAAkB;YAAEC;YAAQM,eAAeF;QAAW;IACjE,OAAO,IAAIG,MAAMC,OAAO,CAACT,oBAAoB;QAC3CM,SAASN;IACX,OAAO;QACLM,SAASD;IACX;IAEA,OAAOC;AACT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginComponent } from '../../../
|
|
1
|
+
import type { PluginComponent } from '../../../typesClient.js';
|
|
2
2
|
import type { ClientProps } from '../../feature.client.js';
|
|
3
3
|
export declare const LinkPlugin: PluginComponent<ClientProps>;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/link/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/link/plugins/link/index.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAO1D,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,WAAW,CA2DnD,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/features/link/plugins/link/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n PASTE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../
|
|
1
|
+
{"version":3,"sources":["../../../../../src/features/link/plugins/link/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n PASTE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { ClientProps } from '../../feature.client.js'\nimport type { LinkFields } from '../../nodes/types.js'\nimport type { LinkPayload } from '../floatingLinkEditor/types.js'\n\nimport { validateUrl } from '../../../../lexical/utils/url.js'\nimport { $toggleLink, LinkNode, TOGGLE_LINK_COMMAND } from '../../nodes/LinkNode.js'\n\nexport const LinkPlugin: PluginComponent<ClientProps> = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n if (!editor.hasNodes([LinkNode])) {\n throw new Error('LinkPlugin: LinkNode not registered on editor')\n }\n return mergeRegister(\n editor.registerCommand(\n TOGGLE_LINK_COMMAND,\n (payload: LinkPayload) => {\n $toggleLink(payload)\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n validateUrl !== undefined\n ? editor.registerCommand(\n PASTE_COMMAND,\n (event) => {\n const selection = $getSelection()\n if (\n !$isRangeSelection(selection) ||\n selection.isCollapsed() ||\n !(event instanceof ClipboardEvent) ||\n event.clipboardData == null\n ) {\n return false\n }\n const clipboardText = event.clipboardData.getData('text')\n if (!validateUrl(clipboardText)) {\n return false\n }\n // If we select nodes that are elements then avoid applying the link.\n if (!selection.getNodes().some((node) => $isElementNode(node))) {\n const linkFields: LinkFields = {\n doc: null,\n linkType: 'custom',\n newTab: false,\n url: clipboardText,\n }\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, {\n fields: linkFields,\n text: null,\n })\n event.preventDefault()\n return true\n }\n return false\n },\n COMMAND_PRIORITY_LOW,\n )\n : () => {\n // Don't paste arbitrary text as a link when there's no validate function\n },\n )\n }, [editor])\n\n return null\n}\n"],"names":["useLexicalComposerContext","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","PASTE_COMMAND","useEffect","validateUrl","$toggleLink","LinkNode","TOGGLE_LINK_COMMAND","LinkPlugin","editor","hasNodes","Error","registerCommand","payload","undefined","event","selection","isCollapsed","ClipboardEvent","clipboardData","clipboardText","getData","getNodes","some","node","linkFields","doc","linkType","newTab","url","dispatchCommand","fields","text","preventDefault"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,aAAa,QACR,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAOjC,SAASC,WAAW,QAAQ,mCAAkC;AAC9D,SAASC,WAAW,EAAEC,QAAQ,EAAEC,mBAAmB,QAAQ,0BAAyB;AAEpF,OAAO,MAAMC,aAA2C;IACtD,MAAM,CAACC,OAAO,GAAGb;IAEjBO,UAAU;QACR,IAAI,CAACM,OAAOC,QAAQ,CAAC;YAACJ;SAAS,GAAG;YAChC,MAAM,IAAIK,MAAM;QAClB;QACA,OAAOd,cACLY,OAAOG,eAAe,CACpBL,qBACA,CAACM;YACCR,YAAYQ;YACZ,OAAO;QACT,GACAZ,uBAEFG,gBAAgBU,YACZL,OAAOG,eAAe,CACpBV,eACA,CAACa;YACC,MAAMC,YAAYlB;YAClB,IACE,CAACE,kBAAkBgB,cACnBA,UAAUC,WAAW,MACrB,CAAEF,CAAAA,iBAAiBG,cAAa,KAChCH,MAAMI,aAAa,IAAI,MACvB;gBACA,OAAO;YACT;YACA,MAAMC,gBAAgBL,MAAMI,aAAa,CAACE,OAAO,CAAC;YAClD,IAAI,CAACjB,YAAYgB,gBAAgB;gBAC/B,OAAO;YACT;YACA,qEAAqE;YACrE,IAAI,CAACJ,UAAUM,QAAQ,GAAGC,IAAI,CAAC,CAACC,OAASzB,eAAeyB,QAAQ;gBAC9D,MAAMC,aAAyB;oBAC7BC,KAAK;oBACLC,UAAU;oBACVC,QAAQ;oBACRC,KAAKT;gBACP;gBACAX,OAAOqB,eAAe,CAACvB,qBAAqB;oBAC1CwB,QAAQN;oBACRO,MAAM;gBACR;gBACAjB,MAAMkB,cAAc;gBACpB,OAAO;YACT;YACA,OAAO;QACT,GACAhC,wBAEF;QACE,yEAAyE;QAC3E;IAER,GAAG;QAACQ;KAAO;IAEX,OAAO;AACT,EAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Field } from 'payload';
|
|
2
|
-
import type { NodeValidation } from '../
|
|
2
|
+
import type { NodeValidation } from '../typesServer.js';
|
|
3
3
|
import type { LinkFeatureServerProps } from './feature.server.js';
|
|
4
4
|
import type { SerializedAutoLinkNode, SerializedLinkNode } from './nodes/types.js';
|
|
5
5
|
export declare const linkValidation: (props: LinkFeatureServerProps, sanitizedFieldsWithoutText: Field[]) => NodeValidation<SerializedAutoLinkNode | SerializedLinkNode>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/features/link/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../src/features/link/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAIpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAElF,eAAO,MAAM,cAAc,UAClB,sBAAsB,8BACD,KAAK,EAAE,KAElC,cAAc,CAAC,sBAAsB,GAAG,kBAAkB,CAkC5D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/features/link/validate.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { buildStateFromSchema } from '@payloadcms/ui/forms/buildStateFromSchema'\n\nimport type { NodeValidation } from '../
|
|
1
|
+
{"version":3,"sources":["../../../src/features/link/validate.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { buildStateFromSchema } from '@payloadcms/ui/forms/buildStateFromSchema'\n\nimport type { NodeValidation } from '../typesServer.js'\nimport type { LinkFeatureServerProps } from './feature.server.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './nodes/types.js'\n\nexport const linkValidation = (\n props: LinkFeatureServerProps,\n sanitizedFieldsWithoutText: Field[],\n // eslint-disable-next-line @typescript-eslint/no-duplicate-type-constituents\n): NodeValidation<SerializedAutoLinkNode | SerializedLinkNode> => {\n return async ({\n node,\n validation: {\n options: { id, operation, preferences, req },\n },\n }) => {\n /**\n * Run buildStateFromSchema as that properly validates link fields and link sub-fields\n */\n\n const result = await buildStateFromSchema({\n id,\n data: node.fields,\n fieldSchema: sanitizedFieldsWithoutText, // Sanitized in feature.server.ts\n operation: operation === 'create' || operation === 'update' ? operation : 'update',\n preferences,\n req,\n siblingData: node.fields,\n })\n\n let errorPaths = []\n for (const fieldKey in result) {\n if (result[fieldKey].errorPaths) {\n errorPaths = errorPaths.concat(result[fieldKey].errorPaths)\n }\n }\n\n if (errorPaths.length) {\n return 'The following fields are invalid: ' + errorPaths.join(', ')\n }\n\n return true\n }\n}\n"],"names":["buildStateFromSchema","linkValidation","props","sanitizedFieldsWithoutText","node","validation","options","id","operation","preferences","req","result","data","fields","fieldSchema","siblingData","errorPaths","fieldKey","concat","length","join"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ,4CAA2C;AAMhF,OAAO,MAAMC,iBAAiB,CAC5BC,OACAC;IAGA,OAAO,OAAO,EACZC,IAAI,EACJC,YAAY,EACVC,SAAS,EAAEC,EAAE,EAAEC,SAAS,EAAEC,WAAW,EAAEC,GAAG,EAAE,EAC7C,EACF;QACC;;KAEC,GAED,MAAMC,SAAS,MAAMX,qBAAqB;YACxCO;YACAK,MAAMR,KAAKS,MAAM;YACjBC,aAAaX;YACbK,WAAWA,cAAc,YAAYA,cAAc,WAAWA,YAAY;YAC1EC;YACAC;YACAK,aAAaX,KAAKS,MAAM;QAC1B;QAEA,IAAIG,aAAa,EAAE;QACnB,IAAK,MAAMC,YAAYN,OAAQ;YAC7B,IAAIA,MAAM,CAACM,SAAS,CAACD,UAAU,EAAE;gBAC/BA,aAAaA,WAAWE,MAAM,CAACP,MAAM,CAACM,SAAS,CAACD,UAAU;YAC5D;QACF;QAEA,IAAIA,WAAWG,MAAM,EAAE;YACrB,OAAO,uCAAuCH,WAAWI,IAAI,CAAC;QAChE;QAEA,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/features/lists/checklist/feature.client.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/features/lists/checklist/feature.client.tsx"],"names":[],"mappings":"AAwDA,eAAO,MAAM,sBAAsB;;;EA8CjC,CAAA"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { $isListNode, INSERT_CHECK_LIST_COMMAND, ListItemNode, ListNode } from '@lexical/list';
|
|
3
3
|
import { $isRangeSelection } from 'lexical';
|
|
4
4
|
import { ChecklistIcon } from '../../../lexical/ui/icons/Checklist/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { createClientFeature } from '../../../utilities/createClientFeature.js';
|
|
6
6
|
import { toolbarTextDropdownGroupWithItems } from '../../shared/toolbar/textDropdownGroup.js';
|
|
7
7
|
import { LexicalListPlugin } from '../plugin/index.js';
|
|
8
8
|
import { slashMenuListGroupWithItems } from '../shared/slashMenuListGroup.js';
|
|
@@ -44,64 +44,57 @@ const toolbarGroups = [
|
|
|
44
44
|
}
|
|
45
45
|
])
|
|
46
46
|
];
|
|
47
|
-
const ChecklistFeatureClient = (
|
|
47
|
+
export const ChecklistFeatureClient = createClientFeature(({ featureProviderMap })=>{
|
|
48
|
+
const plugins = [
|
|
49
|
+
{
|
|
50
|
+
Component: LexicalCheckListPlugin,
|
|
51
|
+
position: 'normal'
|
|
52
|
+
}
|
|
53
|
+
];
|
|
54
|
+
if (!featureProviderMap.has('unorderedList') && !featureProviderMap.has('orderedList')) {
|
|
55
|
+
plugins.push({
|
|
56
|
+
Component: LexicalListPlugin,
|
|
57
|
+
position: 'normal'
|
|
58
|
+
});
|
|
59
|
+
}
|
|
48
60
|
return {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
],
|
|
85
|
-
label: ({ i18n })=>{
|
|
86
|
-
return i18n.t('lexical:checklist:label');
|
|
87
|
-
},
|
|
88
|
-
onSelect: ({ editor })=>{
|
|
89
|
-
editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
])
|
|
93
|
-
]
|
|
94
|
-
},
|
|
95
|
-
toolbarFixed: {
|
|
96
|
-
groups: toolbarGroups
|
|
97
|
-
},
|
|
98
|
-
toolbarInline: {
|
|
99
|
-
groups: toolbarGroups
|
|
100
|
-
}
|
|
101
|
-
};
|
|
61
|
+
markdownTransformers: [
|
|
62
|
+
CHECK_LIST
|
|
63
|
+
],
|
|
64
|
+
nodes: featureProviderMap.has('unorderedList') || featureProviderMap.has('orderedList') ? [] : [
|
|
65
|
+
ListNode,
|
|
66
|
+
ListItemNode
|
|
67
|
+
],
|
|
68
|
+
plugins,
|
|
69
|
+
slashMenu: {
|
|
70
|
+
groups: [
|
|
71
|
+
slashMenuListGroupWithItems([
|
|
72
|
+
{
|
|
73
|
+
Icon: ChecklistIcon,
|
|
74
|
+
key: 'checklist',
|
|
75
|
+
keywords: [
|
|
76
|
+
'check list',
|
|
77
|
+
'check',
|
|
78
|
+
'checklist',
|
|
79
|
+
'cl'
|
|
80
|
+
],
|
|
81
|
+
label: ({ i18n })=>{
|
|
82
|
+
return i18n.t('lexical:checklist:label');
|
|
83
|
+
},
|
|
84
|
+
onSelect: ({ editor })=>{
|
|
85
|
+
editor.dispatchCommand(INSERT_CHECK_LIST_COMMAND, undefined);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
])
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
toolbarFixed: {
|
|
92
|
+
groups: toolbarGroups
|
|
93
|
+
},
|
|
94
|
+
toolbarInline: {
|
|
95
|
+
groups: toolbarGroups
|
|
102
96
|
}
|
|
103
97
|
};
|
|
104
|
-
};
|
|
105
|
-
export const ChecklistFeatureClientComponent = createClientComponent(ChecklistFeatureClient);
|
|
98
|
+
});
|
|
106
99
|
|
|
107
100
|
//# sourceMappingURL=feature.client.js.map
|