@payloadcms/richtext-lexical 3.0.0-beta.2 → 3.0.0-beta.21
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 +1 -1
- package/dist/cell/index.d.ts.map +1 -1
- package/dist/cell/index.js +2 -4
- package/dist/cell/index.js.map +1 -1
- package/dist/field/features/align/feature.client.d.ts.map +1 -1
- package/dist/field/features/align/feature.client.js +1 -2
- package/dist/field/features/align/feature.client.js.map +1 -1
- package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.client.js +3 -6
- package/dist/field/features/blockquote/feature.client.js.map +1 -1
- package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.server.js +4 -4
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blockquote/markdownTransformer.d.ts.map +1 -1
- package/dist/field/features/blockquote/markdownTransformer.js +2 -4
- package/dist/field/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/field/features/blocks/component/BlockContent.d.ts.map +1 -1
- package/dist/field/features/blocks/component/BlockContent.js +3 -5
- package/dist/field/features/blocks/component/BlockContent.js.map +1 -1
- package/dist/field/features/blocks/component/index.d.ts.map +1 -1
- package/dist/field/features/blocks/component/index.js +36 -3
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
- package/dist/field/features/blocks/drawer/index.js +2 -4
- package/dist/field/features/blocks/drawer/index.js.map +1 -1
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +109 -77
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/blocks/nodes/BlocksNode.d.ts +1 -3
- package/dist/field/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/field/features/blocks/nodes/BlocksNode.js +1 -2
- package/dist/field/features/blocks/nodes/BlocksNode.js.map +1 -1
- package/dist/field/features/blocks/plugin/commands.d.ts.map +1 -1
- package/dist/field/features/blocks/plugin/commands.js +1 -2
- package/dist/field/features/blocks/plugin/commands.js.map +1 -1
- package/dist/field/features/blocks/plugin/index.d.ts.map +1 -1
- package/dist/field/features/blocks/plugin/index.js +3 -6
- package/dist/field/features/blocks/plugin/index.js.map +1 -1
- package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
- package/dist/field/features/blocks/populationPromise.js +3 -18
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/blocks/validate.d.ts.map +1 -1
- package/dist/field/features/blocks/validate.js +22 -36
- package/dist/field/features/blocks/validate.js.map +1 -1
- package/dist/field/features/converters/html/field/index.d.ts +8 -2
- package/dist/field/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/field/features/converters/html/field/index.js +6 -3
- package/dist/field/features/converters/html/field/index.js.map +1 -1
- package/dist/field/features/debug/testrecorder/plugin/index.d.ts.map +1 -1
- package/dist/field/features/debug/testrecorder/plugin/index.js +2 -4
- package/dist/field/features/debug/testrecorder/plugin/index.js.map +1 -1
- package/dist/field/features/debug/treeview/plugin/index.d.ts.map +1 -1
- package/dist/field/features/debug/treeview/plugin/index.js +2 -4
- package/dist/field/features/debug/treeview/plugin/index.js.map +1 -1
- package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/bold/feature.client.js +1 -2
- package/dist/field/features/format/bold/feature.client.js.map +1 -1
- package/dist/field/features/format/inlinecode/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/inlinecode/feature.client.js +1 -2
- package/dist/field/features/format/inlinecode/feature.client.js.map +1 -1
- package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/italic/feature.client.js +1 -2
- package/dist/field/features/format/italic/feature.client.js.map +1 -1
- package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/strikethrough/feature.client.js +1 -2
- package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/subscript/feature.client.js +1 -2
- package/dist/field/features/format/subscript/feature.client.js.map +1 -1
- package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/superscript/feature.client.js +1 -2
- package/dist/field/features/format/superscript/feature.client.js.map +1 -1
- package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/underline/feature.client.js +1 -2
- package/dist/field/features/format/underline/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.client.d.ts.map +1 -1
- package/dist/field/features/heading/feature.client.js +3 -6
- package/dist/field/features/heading/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.server.d.ts.map +1 -1
- package/dist/field/features/heading/feature.server.js +5 -5
- package/dist/field/features/heading/feature.server.js.map +1 -1
- package/dist/field/features/heading/markdownTransformer.d.ts.map +1 -1
- package/dist/field/features/heading/markdownTransformer.js +1 -2
- package/dist/field/features/heading/markdownTransformer.js.map +1 -1
- package/dist/field/features/horizontalrule/component/index.d.ts +10 -0
- package/dist/field/features/horizontalrule/component/index.d.ts.map +1 -0
- package/dist/field/features/horizontalrule/component/index.js +62 -0
- package/dist/field/features/horizontalrule/component/index.js.map +1 -0
- package/dist/field/features/horizontalrule/feature.client.d.ts +3 -0
- package/dist/field/features/horizontalrule/feature.client.d.ts.map +1 -0
- package/dist/field/features/horizontalrule/feature.client.js +53 -0
- package/dist/field/features/horizontalrule/feature.client.js.map +1 -0
- package/dist/field/features/horizontalrule/feature.server.d.ts +3 -0
- package/dist/field/features/horizontalrule/feature.server.d.ts.map +1 -0
- package/dist/field/features/horizontalrule/feature.server.js +37 -0
- package/dist/field/features/horizontalrule/feature.server.js.map +1 -0
- package/dist/field/features/horizontalrule/markdownTransformer.d.ts +3 -0
- package/dist/field/features/horizontalrule/markdownTransformer.d.ts.map +1 -0
- package/dist/field/features/horizontalrule/markdownTransformer.js +23 -0
- package/dist/field/features/horizontalrule/markdownTransformer.js.map +1 -0
- package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.d.ts +53 -0
- package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.d.ts.map +1 -0
- package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.js +88 -0
- package/dist/field/features/horizontalrule/nodes/HorizontalRuleNode.js.map +1 -0
- package/dist/field/features/horizontalrule/plugin/index.d.ts +6 -0
- package/dist/field/features/horizontalrule/plugin/index.d.ts.map +1 -0
- package/dist/field/features/horizontalrule/plugin/index.js +31 -0
- package/dist/field/features/horizontalrule/plugin/index.js.map +1 -0
- package/dist/field/features/horizontalrule/plugin/index.scss +20 -0
- package/dist/field/features/indent/feature.client.d.ts.map +1 -1
- package/dist/field/features/indent/feature.client.js +1 -2
- package/dist/field/features/indent/feature.client.js.map +1 -1
- package/dist/field/features/link/drawer/baseFields.d.ts +3 -3
- package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js +28 -42
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/index.js +3 -2
- package/dist/field/features/link/drawer/index.js.map +1 -1
- package/dist/field/features/link/drawer/types.d.ts +4 -2
- package/dist/field/features/link/drawer/types.d.ts.map +1 -1
- package/dist/field/features/link/drawer/types.js.map +1 -1
- package/dist/field/features/link/feature.client.d.ts.map +1 -1
- package/dist/field/features/link/feature.client.js +2 -4
- package/dist/field/features/link/feature.client.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts +0 -2
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +48 -9
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
- package/dist/field/features/link/nodes/AutoLinkNode.js +1 -2
- package/dist/field/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/field/features/link/nodes/LinkNode.d.ts +1 -3
- package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/field/features/link/nodes/LinkNode.js +2 -4
- package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/field/features/link/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/autoLink/index.js +3 -6
- package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js +1 -2
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +56 -39
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +9 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +3 -5
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +11 -29
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/link/index.js +3 -12
- package/dist/field/features/link/plugins/link/index.js.map +1 -1
- package/dist/field/features/link/populationPromise.d.ts.map +1 -1
- package/dist/field/features/link/populationPromise.js +9 -25
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/link/validate.d.ts +5 -0
- package/dist/field/features/link/validate.d.ts.map +1 -0
- package/dist/field/features/link/validate.js +32 -0
- package/dist/field/features/link/validate.js.map +1 -0
- package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.js +1 -2
- package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.js +6 -6
- package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/field/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/markdownTransformers.js +1 -2
- package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
- package/dist/field/features/lists/checklist/plugin/index.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/plugin/index.js +1 -2
- package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
- package/dist/field/features/lists/common/markdown.d.ts.map +1 -1
- package/dist/field/features/lists/common/markdown.js +1 -2
- package/dist/field/features/lists/common/markdown.js.map +1 -1
- package/dist/field/features/lists/htmlConverter.d.ts.map +1 -1
- package/dist/field/features/lists/htmlConverter.js +13 -6
- package/dist/field/features/lists/htmlConverter.js.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.client.js +1 -2
- package/dist/field/features/lists/orderedlist/feature.client.js.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.server.js +6 -6
- package/dist/field/features/lists/orderedlist/feature.server.js.map +1 -1
- package/dist/field/features/lists/orderedlist/markdownTransformer.d.ts.map +1 -1
- package/dist/field/features/lists/orderedlist/markdownTransformer.js +1 -2
- package/dist/field/features/lists/orderedlist/markdownTransformer.js.map +1 -1
- package/dist/field/features/lists/plugin/index.d.ts.map +1 -1
- package/dist/field/features/lists/plugin/index.js +1 -2
- package/dist/field/features/lists/plugin/index.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.client.js +1 -2
- package/dist/field/features/lists/unorderedlist/feature.client.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.server.js +6 -6
- package/dist/field/features/lists/unorderedlist/feature.server.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/markdownTransformer.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedlist/markdownTransformer.js +1 -2
- package/dist/field/features/lists/unorderedlist/markdownTransformer.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +2 -4
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -4
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js +2 -4
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js +2 -4
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/index.js +2 -1
- package/dist/field/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -3
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -4
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.client.js +2 -4
- package/dist/field/features/paragraph/feature.client.js.map +1 -1
- package/dist/field/features/relationship/drawer/commands.d.ts.map +1 -1
- package/dist/field/features/relationship/drawer/commands.js +1 -2
- package/dist/field/features/relationship/drawer/commands.js.map +1 -1
- package/dist/field/features/relationship/drawer/index.d.ts.map +1 -1
- package/dist/field/features/relationship/drawer/index.js +7 -13
- package/dist/field/features/relationship/drawer/index.js.map +1 -1
- package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.server.js +3 -2
- package/dist/field/features/relationship/feature.server.js.map +1 -1
- package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +3 -8
- package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/RelationshipNode.js +8 -8
- package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +54 -7
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
- package/dist/field/features/relationship/plugins/index.js +3 -6
- package/dist/field/features/relationship/plugins/index.js.map +1 -1
- package/dist/field/features/relationship/populationPromise.js +7 -6
- package/dist/field/features/relationship/populationPromise.js.map +1 -1
- package/dist/field/features/typeUtilities.d.ts +8 -0
- package/dist/field/features/typeUtilities.d.ts.map +1 -0
- package/dist/field/features/typeUtilities.js +8 -0
- package/dist/field/features/typeUtilities.js.map +1 -0
- package/dist/field/features/types.d.ts +57 -33
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +1 -1
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js +5 -6
- package/dist/field/features/upload/component/ExtraFieldsDrawer/index.js.map +1 -1
- package/dist/field/features/upload/component/index.d.ts.map +1 -1
- package/dist/field/features/upload/component/index.js +55 -9
- package/dist/field/features/upload/component/index.js.map +1 -1
- package/dist/field/features/upload/drawer/commands.d.ts.map +1 -1
- package/dist/field/features/upload/drawer/commands.js +1 -2
- package/dist/field/features/upload/drawer/commands.js.map +1 -1
- package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
- package/dist/field/features/upload/drawer/index.js +8 -12
- package/dist/field/features/upload/drawer/index.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +39 -11
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.d.ts +2 -14
- package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.js +6 -9
- package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/features/upload/plugin/index.d.ts +2 -2
- package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
- package/dist/field/features/upload/plugin/index.js +4 -9
- package/dist/field/features/upload/plugin/index.js.map +1 -1
- package/dist/field/features/upload/populationPromise.js +11 -8
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/features/upload/validate.d.ts +2 -1
- package/dist/field/features/upload/validate.d.ts.map +1 -1
- package/dist/field/features/upload/validate.js +34 -12
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/index.d.ts +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +6 -11
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalProvider.d.ts +1 -1
- package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/field/lexical/LexicalProvider.js +1 -2
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/client/default.d.ts +1 -1
- package/dist/field/lexical/config/client/default.d.ts.map +1 -1
- package/dist/field/lexical/config/client/default.js.map +1 -1
- package/dist/field/lexical/config/client/sanitize.d.ts +1 -1
- package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/client/sanitize.js.map +1 -1
- package/dist/field/lexical/config/server/default.d.ts +2 -3
- package/dist/field/lexical/config/server/default.d.ts.map +1 -1
- package/dist/field/lexical/config/server/default.js +3 -3
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/config/server/loader.d.ts +4 -2
- package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/field/lexical/config/server/loader.js +3 -2
- package/dist/field/lexical/config/server/loader.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts +2 -1
- package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js +23 -8
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/config/types.d.ts +1 -1
- package/dist/field/lexical/config/types.d.ts.map +1 -1
- package/dist/field/lexical/config/types.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js +3 -6
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js +3 -6
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js +27 -29
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +1 -1
- package/dist/field/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/MarkdownShortcut/index.js +1 -2
- package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +3 -6
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +3 -6
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.js +1 -2
- package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +13 -10
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js +1 -2
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +10 -7
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts +9 -0
- package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -0
- package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +35 -0
- package/dist/field/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -0
- package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js +1 -2
- package/dist/field/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts +1 -1
- package/dist/field/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js +17 -7
- package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/field/lexical/theme/EditorTheme.scss +11 -8
- package/dist/field/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/field/lexical/ui/ContentEditable.js +1 -2
- package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts +3 -0
- package/dist/field/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -0
- package/dist/field/lexical/ui/icons/HorizontalRule/index.js +19 -0
- package/dist/field/lexical/ui/icons/HorizontalRule/index.js.map +1 -0
- package/dist/field/lexical/utils/getSelectedNode.d.ts.map +1 -1
- package/dist/field/lexical/utils/getSelectedNode.js +1 -2
- package/dist/field/lexical/utils/getSelectedNode.js.map +1 -1
- package/dist/field/lexical/utils/nodeFormat.d.ts +2 -1
- package/dist/field/lexical/utils/nodeFormat.d.ts.map +1 -1
- package/dist/field/lexical/utils/nodeFormat.js.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.js +15 -13
- package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/field/lexical/utils/url.d.ts.map +1 -1
- package/dist/field/lexical/utils/url.js +3 -0
- package/dist/field/lexical/utils/url.js.map +1 -1
- package/dist/forEachNodeRecursively.d.ts +10 -0
- package/dist/forEachNodeRecursively.d.ts.map +1 -0
- package/dist/forEachNodeRecursively.js +24 -0
- package/dist/forEachNodeRecursively.js.map +1 -0
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js +16 -22
- package/dist/generateComponentMap.js.map +1 -1
- package/dist/generateSchemaMap.d.ts.map +1 -1
- package/dist/generateSchemaMap.js +4 -12
- package/dist/generateSchemaMap.js.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +260 -173
- package/dist/index.js.map +1 -1
- package/dist/populate/defaultValue.d.ts.map +1 -1
- package/dist/populate/defaultValue.js +1 -0
- package/dist/populate/defaultValue.js.map +1 -1
- package/dist/populate/populate.d.ts +3 -3
- package/dist/populate/populate.d.ts.map +1 -1
- package/dist/populate/populate.js.map +1 -1
- package/dist/populate/populateLexicalPopulationPromises.d.ts +12 -0
- package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -0
- package/dist/populate/populateLexicalPopulationPromises.js +35 -0
- package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
- package/dist/populate/recurseNestedFields.d.ts +7 -4
- package/dist/populate/recurseNestedFields.d.ts.map +1 -1
- package/dist/populate/recurseNestedFields.js +3 -5
- package/dist/populate/recurseNestedFields.js.map +1 -1
- package/dist/scss/app.scss +2 -3
- package/dist/scss/vars.scss +0 -7
- package/dist/types.d.ts +11 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/package.json +47 -46
- package/components.d.ts +0 -6
- package/components.js +0 -7
- package/dist/populate/richTextRelationshipPromise.d.ts +0 -23
- package/dist/populate/richTextRelationshipPromise.d.ts.map +0 -1
- package/dist/populate/richTextRelationshipPromise.js +0 -68
- package/dist/populate/richTextRelationshipPromise.js.map +0 -1
- package/dist/scss/fonts.scss +0 -75
- package/src/index.ts +0 -423
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
export declare const getBaseFields: (config:
|
|
1
|
+
import type { SanitizedConfig } from 'payload/config';
|
|
2
|
+
import type { FieldWithRichTextRequiredEditor } from 'payload/types';
|
|
3
|
+
export declare const getBaseFields: (config: SanitizedConfig, enabledCollections: false | string[], disabledCollections: false | string[]) => FieldWithRichTextRequiredEditor[];
|
|
4
4
|
//# sourceMappingURL=baseFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"baseFields.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/drawer/baseFields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"baseFields.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/drawer/baseFields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAS,+BAA+B,EAAyB,MAAM,eAAe,CAAA;AAIlG,eAAO,MAAM,aAAa,WAChB,eAAe,sBACH,KAAK,GAAG,MAAM,EAAE,uBACf,KAAK,GAAG,MAAM,EAAE,KACpC,+BAA+B,EAqGjC,CAAA"}
|
|
@@ -24,61 +24,47 @@ export const getBaseFields = (config, enabledCollections, disabledCollections)=>
|
|
|
24
24
|
required: true
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
name: '
|
|
28
|
-
type: '
|
|
27
|
+
name: 'linkType',
|
|
28
|
+
type: 'radio',
|
|
29
29
|
admin: {
|
|
30
|
-
|
|
31
|
-
borderBottom: 0,
|
|
32
|
-
borderTop: 0,
|
|
33
|
-
margin: 0,
|
|
34
|
-
padding: 0
|
|
35
|
-
}
|
|
30
|
+
description: ({ t })=>t('fields:chooseBetweenCustomTextOrDocument')
|
|
36
31
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
type: 'radio',
|
|
41
|
-
admin: {
|
|
42
|
-
description: ({ t })=>t('fields:chooseBetweenCustomTextOrDocument')
|
|
43
|
-
},
|
|
44
|
-
defaultValue: 'custom',
|
|
45
|
-
label: ({ t })=>t('fields:linkType'),
|
|
46
|
-
options: [
|
|
47
|
-
{
|
|
48
|
-
label: ({ t })=>t('fields:customURL'),
|
|
49
|
-
value: 'custom'
|
|
50
|
-
}
|
|
51
|
-
],
|
|
52
|
-
required: true
|
|
53
|
-
},
|
|
32
|
+
defaultValue: 'custom',
|
|
33
|
+
label: ({ t })=>t('fields:linkType'),
|
|
34
|
+
options: [
|
|
54
35
|
{
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
36
|
+
label: ({ t })=>t('fields:customURL'),
|
|
37
|
+
value: 'custom'
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'url',
|
|
44
|
+
type: 'text',
|
|
45
|
+
label: ({ t })=>t('fields:enterURL'),
|
|
46
|
+
required: true,
|
|
47
|
+
validate: (value)=>{
|
|
48
|
+
if (!validateUrl(value)) {
|
|
49
|
+
return 'Invalid URL';
|
|
64
50
|
}
|
|
65
|
-
|
|
51
|
+
}
|
|
66
52
|
}
|
|
67
53
|
];
|
|
68
54
|
// Only display internal link-specific fields / options / conditions if there are enabled relations
|
|
69
55
|
if (enabledRelations?.length) {
|
|
70
|
-
baseFields[1].
|
|
56
|
+
baseFields[1].options.push({
|
|
71
57
|
label: ({ t })=>t('fields:internalLink'),
|
|
72
58
|
value: 'internal'
|
|
73
59
|
});
|
|
74
|
-
baseFields[
|
|
75
|
-
condition: ({
|
|
60
|
+
baseFields[2].admin = {
|
|
61
|
+
condition: ({ linkType })=>linkType !== 'internal'
|
|
76
62
|
};
|
|
77
|
-
baseFields
|
|
63
|
+
baseFields.push({
|
|
78
64
|
name: 'doc',
|
|
79
65
|
admin: {
|
|
80
|
-
condition: ({
|
|
81
|
-
return
|
|
66
|
+
condition: ({ linkType })=>{
|
|
67
|
+
return linkType === 'internal';
|
|
82
68
|
}
|
|
83
69
|
},
|
|
84
70
|
// when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown
|
|
@@ -96,7 +82,7 @@ export const getBaseFields = (config, enabledCollections, disabledCollections)=>
|
|
|
96
82
|
required: true
|
|
97
83
|
});
|
|
98
84
|
}
|
|
99
|
-
baseFields
|
|
85
|
+
baseFields.push({
|
|
100
86
|
name: 'newTab',
|
|
101
87
|
type: 'checkbox',
|
|
102
88
|
label: ({ t })=>t('fields:openInNewTab')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/link/drawer/baseFields.ts"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/link/drawer/baseFields.ts"],"sourcesContent":["import type { User } from 'payload/auth'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, FieldWithRichTextRequiredEditor, RadioField, TextField } from 'payload/types'\n\nimport { validateUrl } from '../../../lexical/utils/url.js'\n\nexport const getBaseFields = (\n config: SanitizedConfig,\n enabledCollections: false | string[],\n disabledCollections: false | string[],\n): FieldWithRichTextRequiredEditor[] => {\n let enabledRelations: string[]\n\n /**\n * Figure out which relations should be enabled (enabledRelations) based on a collection's admin.enableRichTextLink property,\n * or the Link Feature's enabledCollections and disabledCollections properties which override it.\n */\n if (enabledCollections) {\n enabledRelations = enabledCollections\n } else if (disabledCollections) {\n enabledRelations = config.collections\n .filter(({ slug }) => !disabledCollections.includes(slug))\n .map(({ slug }) => slug)\n } else {\n enabledRelations = config.collections\n .filter(({ admin: { enableRichTextLink, hidden } }) => {\n if (typeof hidden !== 'function' && hidden) {\n return false\n }\n return enableRichTextLink\n })\n .map(({ slug }) => slug)\n }\n\n const baseFields: Field[] = [\n {\n name: 'text',\n type: 'text',\n label: ({ t }) => t('fields:textToDisplay'),\n required: true,\n },\n {\n name: 'linkType',\n type: 'radio',\n admin: {\n description: ({ t }) => t('fields:chooseBetweenCustomTextOrDocument'),\n },\n defaultValue: 'custom',\n label: ({ t }) => t('fields:linkType'),\n options: [\n {\n label: ({ t }) => t('fields:customURL'),\n value: 'custom',\n },\n ],\n required: true,\n } as RadioField,\n {\n name: 'url',\n type: 'text',\n label: ({ t }) => t('fields:enterURL'),\n required: true,\n validate: (value: string) => {\n if (!validateUrl(value)) {\n return 'Invalid URL'\n }\n },\n },\n ]\n\n // Only display internal link-specific fields / options / conditions if there are enabled relations\n if (enabledRelations?.length) {\n ;(baseFields[1] as RadioField).options.push({\n label: ({ t }) => t('fields:internalLink'),\n value: 'internal',\n })\n ;(baseFields[2] as TextField).admin = {\n condition: ({ linkType }) => linkType !== 'internal',\n }\n\n baseFields.push({\n name: 'doc',\n admin: {\n condition: ({ linkType }) => {\n return linkType === 'internal'\n },\n },\n // when admin.hidden is a function we need to dynamically call hidden with the user to know if the collection should be shown\n type: 'relationship',\n filterOptions:\n !enabledCollections && !disabledCollections\n ? ({ relationTo, user }) => {\n const hidden = config.collections.find(({ slug }) => slug === relationTo).admin.hidden\n if (typeof hidden === 'function' && hidden({ user } as { user: User })) {\n return false\n }\n }\n : null,\n label: ({ t }) => t('fields:chooseDocumentToLink'),\n relationTo: enabledRelations,\n required: true,\n })\n }\n\n baseFields.push({\n name: 'newTab',\n type: 'checkbox',\n label: ({ t }) => t('fields:openInNewTab'),\n })\n\n return baseFields as FieldWithRichTextRequiredEditor[]\n}\n"],"names":["validateUrl","getBaseFields","config","enabledCollections","disabledCollections","enabledRelations","collections","filter","slug","includes","map","admin","enableRichTextLink","hidden","baseFields","name","type","label","t","required","description","defaultValue","options","value","validate","length","push","condition","linkType","filterO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ACVK,UAAU,CAACD;gBACT,IAAI,CAACvB,YAAYuB,QAAQ;oBACvB,OAAO;gBACT;YACF;QACF;KACD;IAED,mGAAmG;IACnG,IAAIlB,kBAAkBoB,QAAQ;QAC1BX,UAAU,CAAC,EAAE,CAAgBQ,OAAO,CAACI,IAAI,CAAC;YAC1CT,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBK,OAAO;QACT;QACET,UAAU,CAAC,EAAE,CAAeH,KAAK,GAAG;YACpCgB,WAAW,CAAC,EAAEC,QAAQ,EAAE,GAAKA,aAAa;QAC5C;QAEAd,WAAWY,IAAI,CAAC;YACdX,MAAM;YACNJ,OAAO;gBACLgB,WAAW,CAAC,EAAEC,QAAQ,EAAE;oBACtB,OAAOA,aAAa;gBACtB;YACF;YACA,6HAA6H;YAC7HZ,MAAM;YACNa,eACE,CAAC1B,sBAAsB,CAACC,sBACpB,CAAC,EAAE0B,UAAU,EAAEC,IAAI,EAAE;gBACnB,MAAMlB,SAASX,OAAOI,WAAW,CAAC0B,IAAI,CAAC,CAAC,EAAExB,IAAI,EAAE,GAAKA,SAASsB,YAAYnB,KAAK,CAACE,MAAM;gBACtF,IAAI,OAAOA,WAAW,cAAcA,OAAO;oBAAEkB;gBAAK,IAAsB;oBACtE,OAAO;gBACT;YACF,IACA;YACNd,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;YACpBY,YAAYzB;YACZc,UAAU;QACZ;IACF;IAEAL,WAAWY,IAAI,CAAC;QACdX,MAAM;QACNC,MAAM;QACNC,OAAO,CAAC,EAAEC,CAAC,EAAE,GAAKA,EAAE;IACtB;IAEA,OAAOJ;AACT,EAAC"}
|
|
@@ -84,9 +84,10 @@ export const LinkDrawer = ({ drawerSlug, handleModalSubmit, stateData })=>{
|
|
|
84
84
|
}, /*#__PURE__*/ React.createElement(RenderFields, {
|
|
85
85
|
fieldMap: Array.isArray(fieldMap) ? fieldMap : [],
|
|
86
86
|
forceRender: true,
|
|
87
|
-
path: ""
|
|
87
|
+
path: "" // See Blocks feature path for details as for why this is empty
|
|
88
|
+
,
|
|
88
89
|
readOnly: false,
|
|
89
|
-
schemaPath:
|
|
90
|
+
schemaPath: schemaFieldsPath
|
|
90
91
|
}), /*#__PURE__*/ React.createElement(FormSubmit, null, t('general:submit'))));
|
|
91
92
|
};
|
|
92
93
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/link/drawer/index.tsx"],"sourcesContent":["import type { FormProps } from '@payloadcms/ui/forms/Form'\nimport type { FormState } from 'payload/types'\n\nimport { Drawer } from '@payloadcms/ui/elements/Drawer'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { type Props } from './types.js'\n\nconst baseClass = 'lexical-link-edit-drawer'\n\nexport const LinkDrawer: React.FC<Props> = ({ drawerSlug, handleModalSubmit, stateData }) => {\n const { t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const config = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.link.fields.fields`\n const schemaFieldsPath = `${schemaPath}.feature.link.fields`\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: stateData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n if (stateData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, stateData])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n return (\n <Drawer className={baseClass} slug={drawerSlug} title={t('fields:editLink') ?? ''}>\n {initialState !== false && (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fieldMap) ? fieldMap : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleModalSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n forceRender\n path=\"\"\n readOnly={false}\n schemaPath
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/link/drawer/index.tsx"],"sourcesContent":["import type { FormProps } from '@payloadcms/ui/forms/Form'\nimport type { FormState } from 'payload/types'\n\nimport { Drawer } from '@payloadcms/ui/elements/Drawer'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { type Props } from './types.js'\n\nconst baseClass = 'lexical-link-edit-drawer'\n\nexport const LinkDrawer: React.FC<Props> = ({ drawerSlug, handleModalSubmit, stateData }) => {\n const { t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const config = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.link.fields.fields`\n const schemaFieldsPath = `${schemaPath}.feature.link.fields`\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: stateData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n if (stateData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, stateData])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n return (\n <Drawer className={baseClass} slug={drawerSlug} title={t('fields:editLink') ?? ''}>\n {initialState !== false && (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fieldMap) ? fieldMap : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleModalSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n forceRender\n path=\"\" // See Blocks feature path for details as for why this is empty\n readOnly={false}\n schemaPath={schemaFieldsPath}\n />\n\n <FormSubmit>{t('general:submit')}</FormSubmit>\n </Form>\n )}\n </Drawer>\n )\n}\n"],"names":["Drawer","useFieldProps","Form","RenderFields","FormSubmit","useConfig","useDocumentInfo","useTranslation","getFormState","React","useCallback","useEffect","useState","v4","uuid","useEditorConfigContext","baseClass","LinkDrawer","drawerSlug","handleModalSubmit","stateData","t","id","schemaPath","config","initialState","setInitialState","field","richTextComponentMap","componentMapRenderedFieldsPath","schemaFieldsPath","fieldMap","get","awaitInitialState","state","apiRoute","routes","api","body","data","operation","serverURL","onChange","formState","prevFormState","className","slug","title","beforeSubmit","disableValidationOnSubmit","fields","Array","isArray","onSubmit","forceRender","path","readOnly"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,MAAM,QAAQ,iCAAgC;AACvD,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,IAAI,QAAQ,4BAA2B;AAChD,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,UAAU,QAAQ,8BAA6B;AACxD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAEjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,OAAO,eAAc;AAGrB,MAAMC,YAAY;AAElB,OAAO,MAAMC,aAA8B,CAAC,EAAEC,UAAU,EAAEC,iBAAiB,EAAEC,SAAS,EAAE;IACtF,MAAM,EAAEC,CAAC,EAAE,GAAGd;IACd,MAAM,EAAEe,EAAE,EAAE,GAAGhB;IACf,MAAM,EAAEiB,UAAU,EAAE,GAAGtB;IACvB,MAAMuB,SAASnB;IACf,MAAM,CAACoB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,UAAUlC;QACVL,MAAMA;qBAEN,oBAACX;QACC4B,UAAUoB,MAAMC,OAAO,CAACrB,YAAYA,WAAW,EAAE;QACjDuB,aAAAA;QACAC,MAAK,GAAG,+DAA+D;;QACvEC,UAAU;QACVjC,YAAYO;sBAGd,oBAAC1B,kBAAYiB,EAAE;AAKzB,EAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { FormState } from 'payload/types';
|
|
2
|
-
import type {
|
|
2
|
+
import type { LinkFields } from '../nodes/types.js';
|
|
3
3
|
export interface Props {
|
|
4
4
|
drawerSlug: string;
|
|
5
5
|
handleModalSubmit: (fields: FormState, data: Record<string, unknown>) => void;
|
|
6
|
-
stateData?:
|
|
6
|
+
stateData?: LinkFields & {
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/drawer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/drawer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAEnD,MAAM,WAAW,KAAK;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,iBAAiB,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IAC7E,SAAS,CAAC,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAC1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/link/drawer/types.ts"],"sourcesContent":["import type { FormState } from 'payload/types'\n\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/link/drawer/types.ts"],"sourcesContent":["import type { FormState } from 'payload/types'\n\nimport type { LinkFields } from '../nodes/types.js'\n\nexport interface Props {\n drawerSlug: string\n handleModalSubmit: (fields: FormState, data: Record<string, unknown>) => void\n stateData?: LinkFields & { text: string }\n}\n"],"names":[],"rangeMappings":"","mappings":"AAIA,WAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.client.tsx"],"names":[],"mappings":";AAMA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAA;AAexE,MAAM,MAAM,WAAW,GAAG,6BAA6B,CAAA;AAuEvD,eAAO,MAAM,0BAA0B,+FAA2C,CAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import lexicalImport from 'lexical';
|
|
5
|
-
const { $getSelection, $isRangeSelection } = lexicalImport;
|
|
2
|
+
import { $findMatchingParent } from '@lexical/utils';
|
|
3
|
+
import { $getSelection, $isRangeSelection } from 'lexical';
|
|
6
4
|
import { LinkIcon } from '../../lexical/ui/icons/Link/index.js';
|
|
7
5
|
import { getSelectedNode } from '../../lexical/utils/getSelectedNode.js';
|
|
8
6
|
import { FeaturesSectionWithEntries } from '../common/floatingSelectToolbarFeaturesButtonsSection/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/link/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/link/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $findMatchingParent } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\nimport type { ExclusiveLinkCollectionsProps } from './feature.server.js'\nimport type { LinkFields } from './nodes/types.js'\n\nimport { LinkIcon } from '../../lexical/ui/icons/Link/index.js'\nimport { getSelectedNode } from '../../lexical/utils/getSelectedNode.js'\nimport { FeaturesSectionWithEntries } from '../common/floatingSelectToolbarFeaturesButtonsSection/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { $isLinkNode, LinkNode, TOGGLE_LINK_COMMAND } from './nodes/LinkNode.js'\nimport { AutoLinkPlugin } from './plugins/autoLink/index.js'\nimport { ClickableLinkPlugin } from './plugins/clickableLink/index.js'\nimport { TOGGLE_LINK_WITH_MODAL_COMMAND } from './plugins/floatingLinkEditor/LinkEditor/commands.js'\nimport { FloatingLinkEditorPlugin } from './plugins/floatingLinkEditor/index.js'\nimport { LinkPlugin } from './plugins/link/index.js'\n\nexport type ClientProps = ExclusiveLinkCollectionsProps\n\nconst LinkFeatureClient: FeatureProviderProviderClient<ClientProps> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n floatingSelectToolbar: {\n sections: [\n FeaturesSectionWithEntries([\n {\n ChildComponent: LinkIcon,\n isActive: ({ selection }) => {\n if ($isRangeSelection(selection)) {\n const selectedNode = getSelectedNode(selection)\n const linkParent = $findMatchingParent(selectedNode, $isLinkNode)\n return linkParent != null\n }\n return false\n },\n key: 'link',\n label: `Link`,\n onClick: ({ editor, isActive }) => {\n if (!isActive) {\n let selectedText = null\n editor.getEditorState().read(() => {\n selectedText = $getSelection().getTextContent()\n })\n const linkFields: LinkFields = {\n doc: null,\n linkType: 'custom',\n newTab: false,\n url: 'https://',\n }\n editor.dispatchCommand(TOGGLE_LINK_WITH_MODAL_COMMAND, {\n fields: linkFields,\n text: selectedText,\n })\n } else {\n // remove link\n editor.dispatchCommand(TOGGLE_LINK_COMMAND, null)\n }\n },\n order: 1,\n },\n ]),\n ],\n },\n nodes: [LinkNode, AutoLinkNode],\n plugins: [\n {\n Component: LinkPlugin,\n position: 'normal',\n },\n {\n Component: AutoLinkPlugin,\n position: 'normal',\n },\n {\n Component: ClickableLinkPlugin,\n position: 'normal',\n },\n {\n Component: FloatingLinkEditorPlugin,\n position: 'floatingAnchorElem',\n },\n ],\n }),\n }\n}\n\nexport const LinkFeatureClientComponent = createClientComponent(LinkFeatureClient)\n"],"names":["$findMatchingParent","$getSelection","$isRangeSelection","LinkIcon","getSelectedNode","FeaturesSectionWithEntries","createClientComponent","AutoLinkNode","$isLinkNode","LinkNode","TOGGLE_LINK_COMMAND","AutoLinkPlugin","ClickableLinkPlugin","TOGGLE_LINK_WITH_MODAL_COMMAND","FloatingLinkEditorPlugin","LinkPlugin","LinkFeatureClient","props","clientFeatureProps","feature","floatingSelectToolbar","sections","ChildComponent","isActive","selection","selectedNode","linkParent","key","label","onClick","editor","selectedText","getEditorState","read","getTextContent","linkFields","doc","linkType","newTab","url","dispatchCommand","fields","text","order","nodes","plugins","Component","position","LinkFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,mBAAmB,QAAQ,iBAAgB;AACpD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAM1D,SAASC,QAAQ,QAAQ,uCAAsC;AAC/D,SAASC,eAAe,QAAQ,yCAAwC;AACxE,SAASC,0BAA0B,QAAQ,iEAAgE;AAC3G,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,WAAW,EAAEC,QAAQ,EAAEC,mBAAmB,QAAQ,sBAAqB;AAChF,SAASC,cAAc,QAAQ,8BA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ACZ;iBACD;YACH,CAAA;IACF;AACF;AAEA,OAAO,MAAMC,6BAA6B1C,sBAAsBU,mBAAkB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { I18n } from '@payloadcms/translations';
|
|
2
1
|
import type { SanitizedConfig } from 'payload/config';
|
|
3
2
|
import type { FieldWithRichTextRequiredEditor } from 'payload/types';
|
|
4
3
|
import type { FeatureProviderProviderServer } from '../types.js';
|
|
@@ -26,7 +25,6 @@ export type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {
|
|
|
26
25
|
fields?: ((args: {
|
|
27
26
|
config: SanitizedConfig;
|
|
28
27
|
defaultFields: FieldWithRichTextRequiredEditor[];
|
|
29
|
-
i18n: I18n;
|
|
30
28
|
}) => FieldWithRichTextRequiredEditor[]) | FieldWithRichTextRequiredEditor[];
|
|
31
29
|
};
|
|
32
30
|
export declare const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAU,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC7D,OAAO,KAAK,EAAS,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAM3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAWtD,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG;IACnE;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,+BAA+B,EAAE,CAAA;KACjD,KAAK,+BAA+B,EAAE,CAAC,GACxC,+BAA+B,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CAmI1F,CAAA"}
|
|
@@ -1,28 +1,54 @@
|
|
|
1
|
+
import { traverseFields } from '@payloadcms/next/utilities';
|
|
2
|
+
import { sanitizeFields } from 'payload/config';
|
|
3
|
+
import { deepCopyObject } from 'payload/utilities';
|
|
1
4
|
import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
|
|
5
|
+
import { createNode } from '../typeUtilities.js';
|
|
2
6
|
import { LinkFeatureClientComponent } from './feature.client.js';
|
|
3
7
|
import { AutoLinkNode } from './nodes/AutoLinkNode.js';
|
|
4
8
|
import { LinkNode } from './nodes/LinkNode.js';
|
|
5
9
|
import { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js';
|
|
6
10
|
import { linkPopulationPromiseHOC } from './populationPromise.js';
|
|
11
|
+
import { linkValidation } from './validate.js';
|
|
7
12
|
export const LinkFeature = (props)=>{
|
|
8
13
|
if (!props) {
|
|
9
14
|
props = {};
|
|
10
15
|
}
|
|
11
16
|
return {
|
|
12
|
-
feature: ()=>{
|
|
17
|
+
feature: async ({ config: _config })=>{
|
|
18
|
+
const validRelationships = _config.collections.map((c)=>c.slug) || [];
|
|
19
|
+
const _transformedFields = transformExtraFields(deepCopyObject(props.fields), _config, props.enabledCollections, props.disabledCollections);
|
|
20
|
+
const sanitizedFields = await sanitizeFields({
|
|
21
|
+
config: _config,
|
|
22
|
+
fields: _transformedFields,
|
|
23
|
+
requireFieldLevelRichTextEditor: true,
|
|
24
|
+
validRelationships
|
|
25
|
+
});
|
|
26
|
+
props.fields = sanitizedFields;
|
|
13
27
|
return {
|
|
14
28
|
ClientComponent: LinkFeatureClientComponent,
|
|
15
29
|
clientFeatureProps: {
|
|
16
30
|
disabledCollections: props.disabledCollections,
|
|
17
31
|
enabledCollections: props.enabledCollections
|
|
18
32
|
},
|
|
19
|
-
generateSchemaMap: ({ config, i18n
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
33
|
+
generateSchemaMap: ({ config, i18n })=>{
|
|
34
|
+
if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const schemaMap = new Map();
|
|
38
|
+
const validRelationships = config.collections.map((c)=>c.slug) || [];
|
|
39
|
+
schemaMap.set('fields', sanitizedFields);
|
|
40
|
+
traverseFields({
|
|
41
|
+
config,
|
|
42
|
+
fields: sanitizedFields,
|
|
43
|
+
i18n,
|
|
44
|
+
schemaMap,
|
|
45
|
+
schemaPath: 'fields',
|
|
46
|
+
validRelationships
|
|
47
|
+
});
|
|
48
|
+
return schemaMap;
|
|
23
49
|
},
|
|
24
50
|
nodes: [
|
|
25
|
-
{
|
|
51
|
+
createNode({
|
|
26
52
|
converters: {
|
|
27
53
|
html: {
|
|
28
54
|
converter: async ({ converters, node, parent, payload })=>{
|
|
@@ -47,12 +73,22 @@ export const LinkFeature = (props)=>{
|
|
|
47
73
|
]
|
|
48
74
|
}
|
|
49
75
|
},
|
|
76
|
+
hooks: {
|
|
77
|
+
afterRead: [
|
|
78
|
+
({ node })=>{
|
|
79
|
+
return node;
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
},
|
|
50
83
|
node: AutoLinkNode,
|
|
51
84
|
populationPromises: [
|
|
52
85
|
linkPopulationPromiseHOC(props)
|
|
86
|
+
],
|
|
87
|
+
validations: [
|
|
88
|
+
linkValidation(props)
|
|
53
89
|
]
|
|
54
|
-
},
|
|
55
|
-
{
|
|
90
|
+
}),
|
|
91
|
+
createNode({
|
|
56
92
|
converters: {
|
|
57
93
|
html: {
|
|
58
94
|
converter: async ({ converters, node, parent, payload })=>{
|
|
@@ -77,8 +113,11 @@ export const LinkFeature = (props)=>{
|
|
|
77
113
|
node: LinkNode,
|
|
78
114
|
populationPromises: [
|
|
79
115
|
linkPopulationPromiseHOC(props)
|
|
116
|
+
],
|
|
117
|
+
validations: [
|
|
118
|
+
linkValidation(props)
|
|
80
119
|
]
|
|
81
|
-
}
|
|
120
|
+
})
|
|
82
121
|
],
|
|
83
122
|
serverFeatureProps: props
|
|
84
123
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './nodes/types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { LinkNode } from './nodes/LinkNode.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\nimport { linkPopulationPromiseHOC } from './populationPromise.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldWithRichTextRequiredEditor[]\n i18n: I18n\n }) => FieldWithRichTextRequiredEditor[])\n | FieldWithRichTextRequiredEditor[]\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: () => {\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n return {\n fields: transformExtraFields(\n props.fields,\n config,\n i18n,\n props.enabledCollections,\n props.disabledCollections,\n ),\n }\n },\n nodes: [\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n } as HTMLConverter<SerializedAutoLinkNode>,\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n } as HTMLConverter<SerializedLinkNode>,\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["convertLexicalNodesToHTML","LinkFeatureClientComponent","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","LinkFeature","props","feature","ClientComponent","clientFeatureProps","disabledCollections","enabledCollections","generateSchemaMap","config","i18n","fields","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","href","url","linkType","doc","value","id","nodeTypes","getType","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AASA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,0BAA0B,QAAQ,sBAAqB;AAChE,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,oBAAoB,QAAQ,4CAA2C;AAChF,SAASC,wBAAwB,QAAQ,yBAAwB;AAsCjE,OAAO,MAAMC,cAAkF,CAC7FC;IAEA,IAAI,CAACA,OAAO;QACVA,QAAQ,CAAC;IACX;IACA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBR;gBACjBS,oBAAoB;oBAClBC,qBAAqBJ,MAAMI,mBAAmB;oBAC9CC,oBAAoBL,MAAMK,kBAAkB;gBAC9C;gBACAC,mBAAmB,CAAC,EAAEC,MAAM,EAAEC,IAAI,EAAER,KAAK,EAAE;oBACzC,OAAO;wBACLS,QAAQZ,qBACNG,MAAMS,MAAM,EACZF,QACA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rBV,KAAKL,MAAM,CAACc,GAAG,GACdT,KAAKL,MAAM,CAACgB,GAAG,EAAEC;oCAExB,OAAO,CAAC,SAAS,EAAEJ,KAAK,CAAC,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCACtD;gCACAW,WAAW;oCAAChC,SAASiC,OAAO;iCAAG;4BACjC;wBACF;wBACAf,MAAMlB;wBACNkC,oBAAoB;4BAAChC,yBAAyBE;yBAAO;oBACvD;iBACD;gBACD+B,oBAAoB/B;YACtB;QACF;QACAgC,KAAK;QACLD,oBAAoB/B;IACtB;AACF,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload/config'\nimport type { Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { sanitizeFields } from 'payload/config'\nimport { deepCopyObject } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { LinkNode } from './nodes/LinkNode.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\nimport { linkPopulationPromiseHOC } from './populationPromise.js'\nimport { linkValidation } from './validate.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldWithRichTextRequiredEditor[]\n }) => FieldWithRichTextRequiredEditor[])\n | FieldWithRichTextRequiredEditor[]\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: async ({ config: _config }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n _config,\n props.enabledCollections,\n props.disabledCollections,\n )\n\n const sanitizedFields = (await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n })) as FieldWithRichTextRequiredEditor[]\n props.fields = sanitizedFields\n\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n }) => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap = new Map<string, Field[]>()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n schemaMap.set('fields', sanitizedFields)\n\n traverseFields({\n config,\n fields: sanitizedFields,\n i18n,\n schemaMap,\n schemaPath: 'fields',\n validRelationships,\n })\n\n return schemaMap\n },\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n },\n },\n hooks: {\n afterRead: [\n ({ node }) => {\n return node\n },\n ],\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n validations: [linkValidation(props)],\n }),\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n },\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n validations: [linkValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","deepCopyObject","convertLexicalNodesToHTML","createNode","LinkFeatureClientComponent","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","linkValidation","LinkFeature","props","feature","config","_config","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","sanitizedFields","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","i18n","Array","isArray","length","schemaMap","Map","set","schemaPath","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","href","url","linkType","doc","value","id","nodeTypes","getType","hooks","afterRead","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAM1C,0BAA0B;wCACnDoC;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,MAAMI,MAAcN,KAAKpB,MAAM,CAAC2B,MAAM,GAAG,+BAA+B;oCAExE,MAAMC,OACJR,KAAKpB,MAAM,CAAC8B,QAAQ,KAAK,WACrBV,KAAKpB,MAAM,CAAC6B,GAAG,GACdT,KAAKpB,MAAM,CAAC+B,GAAG,EAAEC;oCAExB,OAAO,CAAC,SAAS,EAAEJ,KAAK,CAAC,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCACtD;gCACAW,WAAW;oCAACjD,SAASkD,OAAO;iCAAG;4BACjC;wBACF;wBACAf,MAAMnC;wBACNqD,oBAAoB;4BAACnD,yBAAyBG;yBAAO;wBACrDiD,aAAa;4BAACnD,eAAeE;yBAAO;oBACtC;iBACD;gBACDkD,oBAAoBlD;YACtB;QACF;QACAmD,KAAK;QACLD,oBAAoBlD;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AutoLinkNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/nodes/AutoLinkNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"AutoLinkNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/nodes/AutoLinkNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAIvE,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAKxC,qBAAa,YAAa,SAAQ,QAAQ;IACxC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY;IAI9C,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,SAAS,IAAI,IAAI;IAKxB,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,sBAAsB,GAAG,YAAY;IAkBvE,UAAU,IAAI,sBAAsB;IAQpC,cAAc,CAAC,SAAS,EAAE,cAAc,EAAE,gBAAgB,UAAO,GAAG,WAAW,GAAG,IAAI;CASvF;AAED,wBAAgB,mBAAmB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG,YAAY,CAEpF;AACD,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,YAAY,CAE1F"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
const { $applyNodeReplacement, $isElementNode } = lexicalImport;
|
|
1
|
+
import { $applyNodeReplacement, $isElementNode } from 'lexical';
|
|
3
2
|
import { LinkNode } from './LinkNode.js';
|
|
4
3
|
// Custom node type to override `canInsertTextAfter` that will
|
|
5
4
|
// allow typing within the link
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/link/nodes/AutoLinkNode.ts"],"sourcesContent":["import type { ElementNode, LexicalNode, RangeSelection } from 'lexical'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/link/nodes/AutoLinkNode.ts"],"sourcesContent":["import type { ElementNode, LexicalNode, RangeSelection } from 'lexical'\n\nimport { $applyNodeReplacement, $isElementNode } from 'lexical'\n\nimport type { LinkFields, SerializedAutoLinkNode } from './types.js'\n\nimport { LinkNode } from './LinkNode.js'\n\n// Custom node type to override `canInsertTextAfter` that will\n// allow typing within the link\n\nexport class AutoLinkNode extends LinkNode {\n static clone(node: AutoLinkNode): AutoLinkNode {\n return new AutoLinkNode({ fields: node.__fields, key: node.__key })\n }\n\n static getType(): string {\n return 'autolink'\n }\n\n static importDOM(): null {\n // TODO: Should link node should handle the import over autolink?\n return null\n }\n\n static importJSON(serializedNode: SerializedAutoLinkNode): AutoLinkNode {\n if (\n serializedNode.version === 1 &&\n typeof serializedNode.fields?.doc?.value === 'object' &&\n serializedNode.fields?.doc?.value?.id\n ) {\n serializedNode.fields.doc.value = serializedNode.fields.doc.value.id\n serializedNode.version = 2\n }\n\n const node = $createAutoLinkNode({ fields: serializedNode.fields })\n\n node.setFormat(serializedNode.format)\n node.setIndent(serializedNode.indent)\n node.setDirection(serializedNode.direction)\n return node\n }\n\n exportJSON(): SerializedAutoLinkNode {\n return {\n ...super.exportJSON(),\n type: 'autolink',\n version: 2,\n }\n }\n\n insertNewAfter(selection: RangeSelection, restoreSelection = true): ElementNode | null {\n const element = this.getParentOrThrow().insertNewAfter(selection, restoreSelection)\n if ($isElementNode(element)) {\n const linkNode = $createAutoLinkNode({ fields: this.__fields })\n element.append(linkNode)\n return linkNode\n }\n return null\n }\n}\n\nexport function $createAutoLinkNode({ fields }: { fields: LinkFields }): AutoLinkNode {\n return $applyNodeReplacement(new AutoLinkNode({ fields }))\n}\nexport function $isAutoLinkNode(node: LexicalNode | null | undefined): node is AutoLinkNode {\n return node instanceof AutoLinkNode\n}\n"],"names":["$applyNodeReplacement","$isElementNode","LinkNode","AutoLinkNode","clone","node","fields","__fields","key","__key","getType","importDOM","importJSON","serializedNode","version","doc","value","id","$createAutoLinkNode","setFormat","format","setIndent","indent","setDirection","direction","exportJSON","type","insertNewAfter","selection","restoreSelection","element","getParentOrThrow","linkNode","append","$isAutoLinkNode"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,qBAAqB,EAAEC,cAAc,QAAQ,UAAS;AAI/D,SAASC,QAAQ,QAAQ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AsB,IAAIG,aAAa;QAAEG;IAAO;AACzD;AACA,OAAO,SAAS4B,gBAAgB7B,IAAoC;IAClE,OAAOA,gBAAgBF;AACzB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { BaseSelection } from 'lexical';
|
|
2
|
-
import lexicalImport from 'lexical';
|
|
3
|
-
declare const ElementNode: typeof lexicalImport.ElementNode;
|
|
4
2
|
import type { DOMConversionMap, EditorConfig, ElementNode as ElementNodeType, LexicalCommand, LexicalNode, NodeKey, RangeSelection } from 'lexical';
|
|
3
|
+
import { ElementNode } from 'lexical';
|
|
5
4
|
import type { LinkPayload } from '../plugins/floatingLinkEditor/types.js';
|
|
6
5
|
import type { LinkFields, SerializedLinkNode } from './types.js';
|
|
7
6
|
/** @noInheritDoc */
|
|
@@ -34,5 +33,4 @@ export declare function $createLinkNode({ fields }: {
|
|
|
34
33
|
export declare function $isLinkNode(node: LexicalNode | null | undefined): node is LinkNode;
|
|
35
34
|
export declare const TOGGLE_LINK_COMMAND: LexicalCommand<LinkPayload | null>;
|
|
36
35
|
export declare function toggleLink(payload: LinkPayload): void;
|
|
37
|
-
export {};
|
|
38
36
|
//# sourceMappingURL=LinkNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/nodes/LinkNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"LinkNode.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/link/nodes/LinkNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,KAAK,EACV,gBAAgB,EAEhB,YAAY,EACZ,WAAW,IAAI,eAAe,EAC9B,cAAc,EACd,WAAW,EACX,OAAO,EACP,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,OAAO,EAML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E,MAAM,EAAE,UAAU,CAAA;CAAE,GAAG,QAAQ,CAE5E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,SAAS,GAAG,IAAI,IAAI,QAAQ,CAElF;AAED,eAAO,MAAM,mBAAmB,EAAE,cAAc,CAAC,WAAW,GAAG,IAAI,CAC7B,CAAA;AAEtC,wBAAgB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CA6GrD"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import lexicalImport from 'lexical';
|
|
4
|
-
const { $applyNodeReplacement, $createTextNode, $getSelection, $isElementNode, $isRangeSelection, ElementNode, createCommand } = lexicalImport;
|
|
1
|
+
import { addClassNamesToElement, isHTMLAnchorElement } from '@lexical/utils';
|
|
2
|
+
import { $applyNodeReplacement, $createTextNode, $getSelection, $isElementNode, $isRangeSelection, ElementNode, createCommand } from 'lexical';
|
|
5
3
|
const SUPPORTED_URL_PROTOCOLS = new Set([
|
|
6
4
|
'http:',
|
|
7
5
|
'https:',
|