@payloadcms/richtext-lexical 3.0.0-beta.4 → 3.0.0-beta.40
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 +5 -2
- package/dist/cell/index.d.ts.map +1 -1
- package/dist/cell/index.js +44 -29
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/components.d.ts +7 -2
- package/dist/exports/components.d.ts.map +1 -1
- package/dist/exports/components.js +7 -2
- package/dist/exports/components.js.map +1 -1
- package/dist/field/Field.d.ts +0 -2
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +66 -47
- package/dist/field/Field.js.map +1 -1
- package/dist/field/features/align/feature.client.d.ts +4 -1
- package/dist/field/features/align/feature.client.d.ts.map +1 -1
- package/dist/field/features/align/feature.client.js +135 -54
- package/dist/field/features/align/feature.client.js.map +1 -1
- package/dist/field/features/align/feature.server.d.ts.map +1 -1
- package/dist/field/features/align/feature.server.js +2 -0
- package/dist/field/features/align/feature.server.js.map +1 -1
- package/dist/field/features/align/i18n.d.ts +3 -0
- package/dist/field/features/align/i18n.d.ts.map +1 -0
- package/dist/field/features/align/i18n.js +196 -0
- package/dist/field/features/align/i18n.js.map +1 -0
- package/dist/field/features/align/toolbarAlignGroup.d.ts +3 -0
- package/dist/field/features/align/toolbarAlignGroup.d.ts.map +1 -0
- package/dist/field/features/align/toolbarAlignGroup.js +12 -0
- package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
- package/dist/field/features/blockquote/feature.client.d.ts +4 -1
- package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.client.js +60 -46
- package/dist/field/features/blockquote/feature.client.js.map +1 -1
- package/dist/field/features/blockquote/feature.server.d.ts +1 -1
- package/dist/field/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.server.js +9 -7
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blockquote/i18n.d.ts +3 -0
- package/dist/field/features/blockquote/i18n.d.ts.map +1 -0
- package/dist/field/features/blockquote/i18n.js +100 -0
- package/dist/field/features/blockquote/i18n.js.map +1 -0
- 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 +65 -50
- 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 +60 -17
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/component/index.scss +0 -4
- package/dist/field/features/blocks/drawer/index.d.ts.map +1 -1
- package/dist/field/features/blocks/drawer/index.js +4 -5
- package/dist/field/features/blocks/drawer/index.js.map +1 -1
- package/dist/field/features/blocks/feature.client.d.ts +4 -1
- package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.client.js +58 -27
- package/dist/field/features/blocks/feature.client.js.map +1 -1
- package/dist/field/features/blocks/feature.server.d.ts +2 -5
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +111 -77
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/blocks/i18n.d.ts +3 -0
- package/dist/field/features/blocks/i18n.d.ts.map +1 -0
- package/dist/field/features/blocks/i18n.js +100 -0
- package/dist/field/features/blocks/i18n.js.map +1 -0
- package/dist/field/features/blocks/nodes/BlocksNode.d.ts +2 -4
- package/dist/field/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/field/features/blocks/nodes/BlocksNode.js +3 -3
- 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 +3 -2
- package/dist/field/features/blocks/plugin/index.d.ts.map +1 -1
- package/dist/field/features/blocks/plugin/index.js +10 -11
- 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 +5 -19
- 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 +36 -5
- package/dist/field/features/converters/html/field/index.js.map +1 -1
- package/dist/field/features/createFeaturePropComponent.d.ts.map +1 -1
- package/dist/field/features/createFeaturePropComponent.js +6 -1
- package/dist/field/features/createFeaturePropComponent.js.map +1 -1
- package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.d.ts +4 -1
- package/dist/field/features/debug/testRecorder/feature.client.d.ts.map +1 -0
- package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js.map +1 -1
- package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts.map +1 -1
- package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js +1 -1
- package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.js.map +1 -1
- package/dist/field/features/debug/testRecorder/plugin/index.d.ts +5 -0
- package/dist/field/features/debug/testRecorder/plugin/index.d.ts.map +1 -0
- package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.js +68 -44
- package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -0
- package/dist/field/features/debug/{treeview → treeView}/feature.client.d.ts +4 -1
- package/dist/field/features/debug/treeView/feature.client.d.ts.map +1 -0
- package/dist/field/features/debug/{treeview → treeView}/feature.client.js.map +1 -1
- package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts.map +1 -1
- package/dist/field/features/debug/{treeview → treeView}/feature.server.js +1 -1
- package/dist/field/features/debug/{treeview → treeView}/feature.server.js.map +1 -1
- package/dist/field/features/debug/treeView/plugin/index.d.ts +4 -0
- package/dist/field/features/debug/treeView/plugin/index.d.ts.map +1 -0
- package/dist/field/features/debug/{treeview → treeView}/plugin/index.js +6 -7
- package/dist/field/features/debug/treeView/plugin/index.js.map +1 -0
- package/dist/field/features/format/bold/feature.client.d.ts +4 -1
- package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/bold/feature.client.js +26 -23
- package/dist/field/features/format/bold/feature.client.js.map +1 -1
- package/dist/field/features/format/{inlinecode → inlineCode}/feature.client.d.ts +4 -1
- package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -0
- package/dist/field/features/format/inlineCode/feature.client.js +46 -0
- package/dist/field/features/format/inlineCode/feature.client.js.map +1 -0
- package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts.map +1 -1
- package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js +1 -1
- package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.js.map +1 -1
- package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts.map +1 -1
- package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js.map +1 -1
- package/dist/field/features/format/italic/feature.client.d.ts +4 -1
- package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/italic/feature.client.js +27 -24
- package/dist/field/features/format/italic/feature.client.js.map +1 -1
- package/dist/field/features/format/shared/toolbarFormatGroup.d.ts +3 -0
- package/dist/field/features/format/shared/toolbarFormatGroup.d.ts.map +1 -0
- package/dist/field/features/format/shared/toolbarFormatGroup.js +10 -0
- package/dist/field/features/format/shared/toolbarFormatGroup.js.map +1 -0
- package/dist/field/features/format/strikethrough/feature.client.d.ts +4 -1
- package/dist/field/features/format/strikethrough/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/strikethrough/feature.client.js +27 -24
- package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/field/features/format/subscript/feature.client.d.ts +4 -1
- package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/subscript/feature.client.js +25 -22
- package/dist/field/features/format/subscript/feature.client.js.map +1 -1
- package/dist/field/features/format/superscript/feature.client.d.ts +4 -1
- package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/superscript/feature.client.js +25 -22
- package/dist/field/features/format/superscript/feature.client.js.map +1 -1
- package/dist/field/features/format/underline/feature.client.d.ts +4 -1
- package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/underline/feature.client.js +25 -22
- package/dist/field/features/format/underline/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.client.d.ts +4 -1
- package/dist/field/features/heading/feature.client.d.ts.map +1 -1
- package/dist/field/features/heading/feature.client.js +76 -54
- 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 +7 -5
- package/dist/field/features/heading/feature.server.js.map +1 -1
- package/dist/field/features/heading/i18n.d.ts +3 -0
- package/dist/field/features/heading/i18n.d.ts.map +1 -0
- package/dist/field/features/heading/i18n.js +100 -0
- package/dist/field/features/heading/i18n.js.map +1 -0
- 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 +6 -0
- package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -0
- package/dist/field/features/horizontalRule/feature.client.js +77 -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 +38 -0
- package/dist/field/features/horizontalRule/feature.server.js.map +1 -0
- package/dist/field/features/horizontalRule/i18n.d.ts +3 -0
- package/dist/field/features/horizontalRule/i18n.d.ts.map +1 -0
- package/dist/field/features/horizontalRule/i18n.js +100 -0
- package/dist/field/features/horizontalRule/i18n.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 +89 -0
- package/dist/field/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -0
- package/dist/field/features/horizontalRule/plugin/index.d.ts +7 -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 +4 -1
- package/dist/field/features/indent/feature.client.d.ts.map +1 -1
- package/dist/field/features/indent/feature.client.js +47 -42
- package/dist/field/features/indent/feature.client.js.map +1 -1
- package/dist/field/features/indent/feature.server.d.ts.map +1 -1
- package/dist/field/features/indent/feature.server.js +2 -0
- package/dist/field/features/indent/feature.server.js.map +1 -1
- package/dist/field/features/indent/i18n.d.ts +3 -0
- package/dist/field/features/indent/i18n.d.ts.map +1 -0
- package/dist/field/features/indent/i18n.js +132 -0
- package/dist/field/features/indent/i18n.js.map +1 -0
- package/dist/field/features/indent/toolbarIndentGroup.d.ts +3 -0
- package/dist/field/features/indent/toolbarIndentGroup.d.ts.map +1 -0
- package/dist/field/features/indent/toolbarIndentGroup.js +10 -0
- package/dist/field/features/indent/toolbarIndentGroup.js.map +1 -0
- package/dist/field/features/link/drawer/baseFields.d.ts +2 -2
- package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js +30 -43
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/index.js +30 -21
- 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 +13 -1
- package/dist/field/features/link/feature.client.d.ts.map +1 -1
- package/dist/field/features/link/feature.client.js +65 -47
- package/dist/field/features/link/feature.client.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts +10 -5
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +58 -11
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/i18n.d.ts +3 -0
- package/dist/field/features/link/i18n.d.ts.map +1 -0
- package/dist/field/features/link/i18n.js +100 -0
- package/dist/field/features/link/i18n.js.map +1 -0
- package/dist/field/features/link/markdownTransformer.d.ts +6 -0
- package/dist/field/features/link/markdownTransformer.d.ts.map +1 -0
- package/dist/field/features/link/markdownTransformer.js +50 -0
- package/dist/field/features/link/markdownTransformer.js.map +1 -0
- 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 +4 -4
- package/dist/field/features/link/nodes/LinkNode.d.ts.map +1 -1
- package/dist/field/features/link/nodes/LinkNode.js +6 -7
- package/dist/field/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/field/features/link/plugins/autoLink/index.d.ts +3 -2
- package/dist/field/features/link/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/autoLink/index.js +11 -12
- package/dist/field/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/field/features/link/plugins/clickableLink/index.d.ts +3 -2
- package/dist/field/features/link/plugins/clickableLink/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/clickableLink/index.js +4 -3
- package/dist/field/features/link/plugins/clickableLink/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 +177 -135
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.d.ts +3 -4
- package/dist/field/features/link/plugins/floatingLinkEditor/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.js +2 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +11 -3
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +1 -3
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +12 -30
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/field/features/link/plugins/link/index.d.ts +3 -1
- package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/link/index.js +5 -14
- 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 +11 -26
- 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 +4 -1
- package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.js +69 -44
- package/dist/field/features/lists/checklist/feature.client.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.d.ts +1 -1
- package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.js +12 -10
- package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/field/features/lists/checklist/i18n.d.ts +3 -0
- package/dist/field/features/lists/checklist/i18n.d.ts.map +1 -0
- package/dist/field/features/lists/checklist/i18n.js +100 -0
- package/dist/field/features/lists/checklist/i18n.js.map +1 -0
- package/dist/field/features/lists/checklist/markdownTransformers.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/markdownTransformers.js +2 -3
- package/dist/field/features/lists/checklist/markdownTransformers.js.map +1 -1
- package/dist/field/features/lists/checklist/plugin/index.d.ts +2 -2
- package/dist/field/features/lists/checklist/plugin/index.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/plugin/index.js +5 -5
- package/dist/field/features/lists/checklist/plugin/index.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 → orderedList}/feature.client.d.ts +4 -1
- package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -0
- package/dist/field/features/lists/orderedList/feature.client.js +97 -0
- package/dist/field/features/lists/orderedList/feature.client.js.map +1 -0
- package/dist/field/features/lists/orderedList/feature.server.d.ts.map +1 -0
- package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.js +10 -8
- package/dist/field/features/lists/orderedList/feature.server.js.map +1 -0
- package/dist/field/features/lists/orderedList/i18n.d.ts +3 -0
- package/dist/field/features/lists/orderedList/i18n.d.ts.map +1 -0
- package/dist/field/features/lists/orderedList/i18n.js +100 -0
- package/dist/field/features/lists/orderedList/i18n.js.map +1 -0
- package/dist/field/features/lists/orderedList/markdownTransformer.d.ts.map +1 -0
- package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.js +2 -3
- package/dist/field/features/lists/orderedList/markdownTransformer.js.map +1 -0
- package/dist/field/features/lists/plugin/index.d.ts +2 -2
- package/dist/field/features/lists/plugin/index.d.ts.map +1 -1
- package/dist/field/features/lists/plugin/index.js +5 -5
- package/dist/field/features/lists/plugin/index.js.map +1 -1
- package/dist/field/features/lists/{common → shared}/markdown.d.ts.map +1 -1
- package/dist/field/features/lists/{common → shared}/markdown.js +1 -2
- package/dist/field/features/lists/shared/markdown.js.map +1 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.d.ts +3 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.d.ts.map +1 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.js +11 -0
- package/dist/field/features/lists/shared/slashMenuListGroup.js.map +1 -0
- package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.client.d.ts +4 -1
- package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -0
- package/dist/field/features/lists/unorderedList/feature.client.js +97 -0
- package/dist/field/features/lists/unorderedList/feature.client.js.map +1 -0
- package/dist/field/features/lists/unorderedList/feature.server.d.ts.map +1 -0
- package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.js +9 -7
- package/dist/field/features/lists/unorderedList/feature.server.js.map +1 -0
- package/dist/field/features/lists/unorderedList/i18n.d.ts +3 -0
- package/dist/field/features/lists/unorderedList/i18n.d.ts.map +1 -0
- package/dist/field/features/lists/unorderedList/i18n.js +100 -0
- package/dist/field/features/lists/unorderedList/i18n.js.map +1 -0
- package/dist/field/features/lists/unorderedList/markdownTransformer.d.ts.map +1 -0
- package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.js +2 -3
- package/dist/field/features/lists/unorderedList/markdownTransformer.js.map +1 -0
- 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/feature.client.d.ts +4 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +9 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +2 -4
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +4 -5
- package/dist/field/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.d.ts +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/client.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/index.js +2 -2
- package/dist/field/features/migrations/slateToLexical/converter/converters/blockquote/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/feature.client.d.ts +4 -1
- package/dist/field/features/migrations/slateToLexical/feature.client.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +9 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +2 -4
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +4 -5
- package/dist/field/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/field/features/paragraph/feature.client.d.ts +4 -1
- package/dist/field/features/paragraph/feature.client.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.client.js +54 -41
- package/dist/field/features/paragraph/feature.client.js.map +1 -1
- package/dist/field/features/paragraph/feature.server.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.server.js +2 -0
- package/dist/field/features/paragraph/feature.server.js.map +1 -1
- package/dist/field/features/paragraph/i18n.d.ts +3 -0
- package/dist/field/features/paragraph/i18n.d.ts.map +1 -0
- package/dist/field/features/paragraph/i18n.js +132 -0
- package/dist/field/features/paragraph/i18n.js.map +1 -0
- 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 +17 -15
- package/dist/field/features/relationship/drawer/index.js.map +1 -1
- package/dist/field/features/relationship/feature.client.d.ts +17 -2
- package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.client.js +51 -28
- package/dist/field/features/relationship/feature.client.js.map +1 -1
- package/dist/field/features/relationship/feature.server.d.ts +10 -1
- package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.server.js +7 -4
- package/dist/field/features/relationship/feature.server.js.map +1 -1
- package/dist/field/features/relationship/i18n.d.ts +3 -0
- package/dist/field/features/relationship/i18n.d.ts.map +1 -0
- package/dist/field/features/relationship/i18n.js +100 -0
- package/dist/field/features/relationship/i18n.js.map +1 -0
- package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +4 -9
- package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/RelationshipNode.js +12 -11
- 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 +119 -50
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/relationship/plugins/index.d.ts +2 -2
- package/dist/field/features/relationship/plugins/index.d.ts.map +1 -1
- package/dist/field/features/relationship/plugins/index.js +14 -15
- package/dist/field/features/relationship/plugins/index.js.map +1 -1
- package/dist/field/features/relationship/populationPromise.d.ts +2 -1
- package/dist/field/features/relationship/populationPromise.d.ts.map +1 -1
- package/dist/field/features/relationship/populationPromise.js +25 -19
- package/dist/field/features/relationship/populationPromise.js.map +1 -1
- package/dist/field/features/shared/slashMenu/basicGroup.d.ts +3 -0
- package/dist/field/features/shared/slashMenu/basicGroup.d.ts.map +1 -0
- package/dist/field/features/shared/slashMenu/basicGroup.js +11 -0
- package/dist/field/features/shared/slashMenu/basicGroup.js.map +1 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts +3 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.js +12 -0
- package/dist/field/features/shared/toolbar/addDropdownGroup.js.map +1 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts +3 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.js +10 -0
- package/dist/field/features/shared/toolbar/featureButtonsGroup.js.map +1 -0
- package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts +3 -0
- package/dist/field/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -0
- package/dist/field/features/shared/toolbar/textDropdownGroup.js +12 -0
- package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +5 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.js +211 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.scss +119 -0
- package/dist/field/features/toolbars/fixed/feature.client.d.ts +7 -0
- package/dist/field/features/toolbars/fixed/feature.client.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.client.js +20 -0
- package/dist/field/features/toolbars/fixed/feature.client.js.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.server.d.ts +19 -0
- package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.server.js +20 -0
- package/dist/field/features/toolbars/fixed/feature.server.js.map +1 -0
- package/dist/field/features/toolbars/inline/Toolbar/index.d.ts +4 -0
- package/dist/field/features/toolbars/inline/Toolbar/index.d.ts.map +1 -0
- package/dist/field/features/toolbars/inline/Toolbar/index.js +320 -0
- package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
- package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/inline/Toolbar}/index.scss +7 -11
- package/dist/field/features/toolbars/inline/feature.client.d.ts +6 -0
- package/dist/field/features/toolbars/inline/feature.client.d.ts.map +1 -0
- package/dist/field/features/toolbars/inline/feature.client.js +20 -0
- package/dist/field/features/toolbars/inline/feature.client.js.map +1 -0
- package/dist/field/features/toolbars/inline/feature.server.d.ts +3 -0
- package/dist/field/features/toolbars/inline/feature.server.d.ts.map +1 -0
- package/dist/field/features/toolbars/inline/feature.server.js +15 -0
- package/dist/field/features/toolbars/inline/feature.server.js.map +1 -0
- package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts +10 -0
- package/dist/field/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -0
- package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.js +34 -22
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
- package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarButton/index.scss +3 -1
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +23 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -0
- package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/DropDown.js +74 -100
- package/dist/field/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts +23 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js +142 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
- package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
- package/dist/field/features/toolbars/types.d.ts +48 -0
- package/dist/field/features/toolbars/types.d.ts.map +1 -0
- package/dist/field/features/toolbars/types.js.map +1 -0
- 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 +172 -63
- 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 +32 -25
- 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 +159 -76
- 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 +16 -16
- package/dist/field/features/upload/drawer/index.js.map +1 -1
- package/dist/field/features/upload/feature.client.d.ts +4 -1
- package/dist/field/features/upload/feature.client.d.ts.map +1 -1
- package/dist/field/features/upload/feature.client.js +52 -26
- package/dist/field/features/upload/feature.client.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts +10 -3
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +41 -11
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/i18n.d.ts +3 -0
- package/dist/field/features/upload/i18n.d.ts.map +1 -0
- package/dist/field/features/upload/i18n.js +100 -0
- package/dist/field/features/upload/i18n.js.map +1 -0
- package/dist/field/features/upload/nodes/UploadNode.d.ts +3 -15
- package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.js +28 -14
- package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/features/upload/plugin/index.d.ts +5 -4
- package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
- package/dist/field/features/upload/plugin/index.js +16 -19
- package/dist/field/features/upload/plugin/index.js.map +1 -1
- package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
- package/dist/field/features/upload/populationPromise.js +16 -10
- 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 +36 -9
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/index.d.ts +3 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +39 -26
- package/dist/field/index.js.map +1 -1
- package/dist/field/index.scss +1 -22
- package/dist/field/lexical/EditorPlugin.d.ts +1 -0
- package/dist/field/lexical/EditorPlugin.d.ts.map +1 -1
- package/dist/field/lexical/EditorPlugin.js +8 -4
- package/dist/field/lexical/EditorPlugin.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.d.ts +3 -1
- package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +157 -74
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.scss +13 -20
- 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 +52 -41
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +15 -4
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.js +61 -11
- package/dist/field/lexical/config/client/EditorConfigProvider.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 +3 -2
- package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/client/sanitize.js +83 -33
- 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 +12 -10
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/config/server/loader.d.ts +5 -2
- package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/field/lexical/config/server/loader.js +4 -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 +32 -6
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/config/types.d.ts +3 -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/MarkdownShortcut/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/MarkdownShortcut/index.js +3 -3
- package/dist/field/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +10 -10
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +74 -77
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +5 -5
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +8 -10
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +19 -27
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -37
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.d.ts +2 -2
- package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.js +108 -92
- package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts +2 -2
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js +47 -125
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +2 -2
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.d.ts +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts +2 -2
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +116 -66
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +20 -3
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts +8 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +83 -16
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
- package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts +5 -0
- package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -0
- package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js +21 -0
- package/dist/field/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js.map +1 -0
- 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/{DraggableBlockPlugin → utils}/getNodeCloseToPoint.d.ts +5 -1
- package/dist/field/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -0
- package/dist/field/lexical/plugins/handles/{DraggableBlockPlugin → utils}/getNodeCloseToPoint.js +5 -18
- package/dist/field/lexical/plugins/handles/utils/getNodeCloseToPoint.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 +19 -7
- package/dist/field/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/field/lexical/theme/EditorTheme.scss +18 -14
- package/dist/field/lexical/ui/ContentEditable.d.ts +1 -1
- package/dist/field/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/field/lexical/ui/ContentEditable.js +3 -3
- package/dist/field/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/field/lexical/ui/ContentEditable.scss +55 -4
- package/dist/field/lexical/ui/icons/AI/index.js +26 -17
- package/dist/field/lexical/ui/icons/AI/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Add/index.d.ts +3 -0
- package/dist/field/lexical/ui/icons/Add/index.d.ts.map +1 -0
- package/dist/field/lexical/ui/icons/Add/index.js +21 -0
- package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
- package/dist/field/lexical/ui/icons/Add/light.svg +4 -0
- package/dist/field/lexical/ui/icons/AlignCenter/index.js +21 -15
- package/dist/field/lexical/ui/icons/AlignCenter/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignJustify/index.js +21 -15
- package/dist/field/lexical/ui/icons/AlignJustify/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignLeft/index.js +21 -15
- package/dist/field/lexical/ui/icons/AlignLeft/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/AlignRight/index.js +21 -15
- package/dist/field/lexical/ui/icons/AlignRight/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Block/index.js +30 -24
- package/dist/field/lexical/ui/icons/Block/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Blockquote/index.js +8 -6
- package/dist/field/lexical/ui/icons/Blockquote/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Bold/index.js +8 -6
- package/dist/field/lexical/ui/icons/Bold/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Checklist/index.js +19 -14
- package/dist/field/lexical/ui/icons/Checklist/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Code/index.js +14 -9
- package/dist/field/lexical/ui/icons/Code/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/CodeBlock/index.js +14 -9
- package/dist/field/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/DraggableBlock/light.svg +9 -0
- package/dist/field/lexical/ui/icons/H1/index.js +8 -6
- package/dist/field/lexical/ui/icons/H1/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H2/index.js +8 -6
- package/dist/field/lexical/ui/icons/H2/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H3/index.js +8 -6
- package/dist/field/lexical/ui/icons/H3/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H4/index.js +8 -6
- package/dist/field/lexical/ui/icons/H4/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H5/index.js +8 -6
- package/dist/field/lexical/ui/icons/H5/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/H6/index.js +8 -6
- package/dist/field/lexical/ui/icons/H6/index.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 +21 -0
- package/dist/field/lexical/ui/icons/HorizontalRule/index.js.map +1 -0
- package/dist/field/lexical/ui/icons/IndentDecrease/index.js +25 -18
- package/dist/field/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/IndentIncrease/index.js +25 -18
- package/dist/field/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Italic/index.js +8 -6
- package/dist/field/lexical/ui/icons/Italic/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Link/index.d.ts.map +1 -1
- package/dist/field/lexical/ui/icons/Link/index.js +10 -18
- package/dist/field/lexical/ui/icons/Link/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/OrderedList/index.js +29 -21
- package/dist/field/lexical/ui/icons/OrderedList/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Relationship/index.js +26 -17
- package/dist/field/lexical/ui/icons/Relationship/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Strikethrough/index.js +14 -9
- package/dist/field/lexical/ui/icons/Strikethrough/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Subscript/index.js +8 -6
- package/dist/field/lexical/ui/icons/Subscript/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Superscript/index.js +8 -6
- package/dist/field/lexical/ui/icons/Superscript/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Text/index.js +8 -6
- package/dist/field/lexical/ui/icons/Text/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Underline/index.js +14 -9
- package/dist/field/lexical/ui/icons/Underline/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/UnorderedList/index.js +45 -36
- package/dist/field/lexical/ui/icons/UnorderedList/index.js.map +1 -1
- package/dist/field/lexical/ui/icons/Upload/index.js +24 -18
- package/dist/field/lexical/ui/icons/Upload/index.js.map +1 -1
- 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 +11 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.js +16 -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 +13 -2
- 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 +21 -29
- 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/i18n.d.ts +3 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +164 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +25 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +296 -183
- package/dist/index.js.map +1 -1
- package/dist/populate/defaultValue.d.ts +0 -1
- package/dist/populate/defaultValue.d.ts.map +1 -1
- package/dist/populate/defaultValue.js +1 -19
- package/dist/populate/defaultValue.js.map +1 -1
- package/dist/populate/populate.d.ts +5 -4
- package/dist/populate/populate.d.ts.map +1 -1
- package/dist/populate/populate.js +13 -11
- 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 +36 -0
- package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
- package/dist/populate/recurseNestedFields.d.ts +8 -4
- package/dist/populate/recurseNestedFields.d.ts.map +1 -1
- package/dist/populate/recurseNestedFields.js +4 -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 +45 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/useLexicalFeature.d.ts.map +1 -1
- package/dist/useLexicalFeature.js +6 -1
- package/dist/useLexicalFeature.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/dist/validate/index.js +3 -2
- package/dist/validate/index.js.map +1 -1
- package/dist/validate/validateNodes.js +1 -1
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +70 -50
- package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts +0 -3
- package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.d.ts.map +0 -1
- package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js +0 -12
- package/dist/field/features/align/floatingSelectToolbarAlignDropdownSection.js.map +0 -1
- package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts +0 -3
- package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.d.ts.map +0 -1
- package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js +0 -10
- package/dist/field/features/common/floatingSelectToolbarFeaturesButtonsSection/index.js.map +0 -1
- package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts +0 -3
- package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.d.ts.map +0 -1
- package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js +0 -12
- package/dist/field/features/common/floatingSelectToolbarTextDropdownSection/index.js.map +0 -1
- package/dist/field/features/debug/testrecorder/feature.client.d.ts.map +0 -1
- package/dist/field/features/debug/testrecorder/plugin/index.d.ts +0 -5
- package/dist/field/features/debug/testrecorder/plugin/index.d.ts.map +0 -1
- package/dist/field/features/debug/testrecorder/plugin/index.js.map +0 -1
- package/dist/field/features/debug/treeview/feature.client.d.ts.map +0 -1
- package/dist/field/features/debug/treeview/plugin/index.d.ts +0 -4
- package/dist/field/features/debug/treeview/plugin/index.d.ts.map +0 -1
- package/dist/field/features/debug/treeview/plugin/index.js.map +0 -1
- package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts +0 -3
- package/dist/field/features/format/common/floatingSelectToolbarSection.d.ts.map +0 -1
- package/dist/field/features/format/common/floatingSelectToolbarSection.js +0 -10
- package/dist/field/features/format/common/floatingSelectToolbarSection.js.map +0 -1
- package/dist/field/features/format/inlinecode/feature.client.d.ts.map +0 -1
- package/dist/field/features/format/inlinecode/feature.client.js +0 -43
- package/dist/field/features/format/inlinecode/feature.client.js.map +0 -1
- package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts +0 -3
- package/dist/field/features/indent/floatingSelectToolbarIndentSection.d.ts.map +0 -1
- package/dist/field/features/indent/floatingSelectToolbarIndentSection.js +0 -10
- package/dist/field/features/indent/floatingSelectToolbarIndentSection.js.map +0 -1
- package/dist/field/features/indent/index.scss +0 -4
- package/dist/field/features/lists/common/markdown.js.map +0 -1
- package/dist/field/features/lists/orderedlist/feature.client.d.ts.map +0 -1
- package/dist/field/features/lists/orderedlist/feature.client.js +0 -72
- package/dist/field/features/lists/orderedlist/feature.client.js.map +0 -1
- package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +0 -1
- package/dist/field/features/lists/orderedlist/feature.server.js.map +0 -1
- package/dist/field/features/lists/orderedlist/markdownTransformer.d.ts.map +0 -1
- package/dist/field/features/lists/orderedlist/markdownTransformer.js.map +0 -1
- package/dist/field/features/lists/unorderedlist/feature.client.d.ts.map +0 -1
- package/dist/field/features/lists/unorderedlist/feature.client.js +0 -72
- package/dist/field/features/lists/unorderedlist/feature.client.js.map +0 -1
- package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +0 -1
- package/dist/field/features/lists/unorderedlist/feature.server.js.map +0 -1
- package/dist/field/features/lists/unorderedlist/markdownTransformer.d.ts.map +0 -1
- package/dist/field/features/lists/unorderedlist/markdownTransformer.js.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts +0 -8
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts +0 -17
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.d.ts.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/DropDown.js.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts +0 -18
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js +0 -42
- package/dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts +0 -6
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js +0 -270
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts +0 -40
- package/dist/field/lexical/plugins/FloatingSelectToolbar/types.d.ts.map +0 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/types.js.map +0 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +0 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +0 -1
- 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
- /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.client.js +0 -0
- /package/dist/field/features/debug/{testrecorder → testRecorder}/feature.server.d.ts +0 -0
- /package/dist/field/features/debug/{testrecorder → testRecorder}/plugin/index.scss +0 -0
- /package/dist/field/features/debug/{treeview → treeView}/feature.client.js +0 -0
- /package/dist/field/features/debug/{treeview → treeView}/feature.server.d.ts +0 -0
- /package/dist/field/features/debug/{treeview → treeView}/plugin/index.scss +0 -0
- /package/dist/field/features/format/{inlinecode → inlineCode}/feature.server.d.ts +0 -0
- /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.d.ts +0 -0
- /package/dist/field/features/format/{inlinecode → inlineCode}/markdownTransformers.js +0 -0
- /package/dist/field/features/lists/{orderedlist → orderedList}/feature.server.d.ts +0 -0
- /package/dist/field/features/lists/{orderedlist → orderedList}/markdownTransformer.d.ts +0 -0
- /package/dist/field/features/lists/{common → shared}/markdown.d.ts +0 -0
- /package/dist/field/features/lists/{unorderedlist → unorderedList}/feature.server.d.ts +0 -0
- /package/dist/field/features/lists/{unorderedlist → unorderedList}/markdownTransformer.d.ts +0 -0
- /package/dist/field/{lexical/plugins/FloatingSelectToolbar → features/toolbars}/types.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
4
4
|
import { useTranslation } from '@payloadcms/ui/providers/Translation';
|
|
5
5
|
import { useCallback, useMemo, useState } from 'react';
|
|
6
6
|
import * as React from 'react';
|
|
@@ -10,36 +10,40 @@ import { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.j
|
|
|
10
10
|
import './index.scss';
|
|
11
11
|
import { useMenuTriggerMatch } from './useMenuTriggerMatch.js';
|
|
12
12
|
const baseClass = 'slash-menu-popup';
|
|
13
|
-
function SlashMenuItem({ isSelected, onClick, onMouseEnter
|
|
13
|
+
function SlashMenuItem({ isSelected, item, onClick, onMouseEnter }) {
|
|
14
14
|
const { i18n } = useTranslation();
|
|
15
|
-
let className = `${baseClass}__item ${baseClass}__item-${
|
|
15
|
+
let className = `${baseClass}__item ${baseClass}__item-${item.key}`;
|
|
16
16
|
if (isSelected) {
|
|
17
17
|
className += ` ${baseClass}__item--selected`;
|
|
18
18
|
}
|
|
19
|
-
let title =
|
|
20
|
-
if (
|
|
21
|
-
title = typeof
|
|
19
|
+
let title = item.key;
|
|
20
|
+
if (item.label) {
|
|
21
|
+
title = typeof item.label === 'function' ? item.label({
|
|
22
22
|
i18n
|
|
23
|
-
}) :
|
|
23
|
+
}) : item.label;
|
|
24
24
|
}
|
|
25
|
-
// Crop title to max.
|
|
25
|
+
// Crop title to max. 25 characters
|
|
26
26
|
if (title.length > 25) {
|
|
27
27
|
title = title.substring(0, 25) + '...';
|
|
28
28
|
}
|
|
29
|
-
return /*#__PURE__*/
|
|
29
|
+
return /*#__PURE__*/ _jsxs("button", {
|
|
30
30
|
"aria-selected": isSelected,
|
|
31
31
|
className: className,
|
|
32
|
-
id: baseClass + '__item-' +
|
|
33
|
-
key: option.key,
|
|
32
|
+
id: baseClass + '__item-' + item.key,
|
|
34
33
|
onClick: onClick,
|
|
35
34
|
onMouseEnter: onMouseEnter,
|
|
36
|
-
ref:
|
|
37
|
-
role: "
|
|
35
|
+
ref: item.ref,
|
|
36
|
+
role: "item",
|
|
38
37
|
tabIndex: -1,
|
|
39
|
-
type: "button"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
type: "button",
|
|
39
|
+
children: [
|
|
40
|
+
item?.Icon && /*#__PURE__*/ _jsx(item.Icon, {}),
|
|
41
|
+
/*#__PURE__*/ _jsx("span", {
|
|
42
|
+
className: `${baseClass}__item-text`,
|
|
43
|
+
children: title
|
|
44
|
+
})
|
|
45
|
+
]
|
|
46
|
+
}, item.key);
|
|
43
47
|
}
|
|
44
48
|
export function SlashMenuPlugin({ anchorElem = document.body }) {
|
|
45
49
|
const [editor] = useLexicalComposerContext();
|
|
@@ -49,124 +53,136 @@ export function SlashMenuPlugin({ anchorElem = document.body }) {
|
|
|
49
53
|
const checkForTriggerMatch = useMenuTriggerMatch('/', {
|
|
50
54
|
minLength: 0
|
|
51
55
|
});
|
|
52
|
-
const
|
|
53
|
-
let
|
|
54
|
-
for (const
|
|
55
|
-
const
|
|
56
|
+
const getDynamicItems = useCallback(()=>{
|
|
57
|
+
let groupWithItems = [];
|
|
58
|
+
for (const dynamicItem of editorConfig.features.slashMenu.dynamicGroups){
|
|
59
|
+
const dynamicGroupWithItems = dynamicItem({
|
|
56
60
|
editor,
|
|
57
61
|
queryString
|
|
58
62
|
});
|
|
59
|
-
|
|
63
|
+
groupWithItems = groupWithItems.concat(dynamicGroupWithItems);
|
|
60
64
|
}
|
|
61
|
-
return
|
|
65
|
+
return groupWithItems;
|
|
62
66
|
}, [
|
|
63
67
|
editor,
|
|
64
68
|
queryString,
|
|
65
69
|
editorConfig?.features
|
|
66
70
|
]);
|
|
67
71
|
const groups = useMemo(()=>{
|
|
68
|
-
let
|
|
69
|
-
for (const
|
|
70
|
-
|
|
72
|
+
let groupsWithItems = [];
|
|
73
|
+
for (const groupWithItem of editorConfig?.features.slashMenu.groups ?? []){
|
|
74
|
+
groupsWithItems.push(groupWithItem);
|
|
71
75
|
}
|
|
72
76
|
if (queryString) {
|
|
73
77
|
// Filter current groups first
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
let
|
|
77
|
-
if (
|
|
78
|
-
|
|
78
|
+
groupsWithItems = groupsWithItems.map((group)=>{
|
|
79
|
+
const filteredItems = group.items.filter((item)=>{
|
|
80
|
+
let itemTitle = item.key;
|
|
81
|
+
if (item.label) {
|
|
82
|
+
itemTitle = typeof item.label === 'function' ? item.label({
|
|
79
83
|
i18n
|
|
80
|
-
}) :
|
|
84
|
+
}) : item.label;
|
|
81
85
|
}
|
|
82
|
-
|
|
86
|
+
if (new RegExp(queryString, 'gi').exec(itemTitle)) {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
if (item.keywords != null) {
|
|
90
|
+
return item.keywords.some((keyword)=>new RegExp(queryString, 'gi').exec(keyword));
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
83
93
|
});
|
|
84
|
-
if (
|
|
94
|
+
if (filteredItems.length) {
|
|
85
95
|
return {
|
|
86
96
|
...group,
|
|
87
|
-
|
|
97
|
+
items: filteredItems
|
|
88
98
|
};
|
|
89
99
|
}
|
|
90
100
|
return null;
|
|
91
101
|
});
|
|
92
|
-
|
|
102
|
+
groupsWithItems = groupsWithItems.filter((group)=>group != null);
|
|
93
103
|
// Now add dynamic groups
|
|
94
|
-
const
|
|
95
|
-
// merge dynamic
|
|
96
|
-
for (const dynamicGroup of
|
|
104
|
+
const dynamicItemGroups = getDynamicItems();
|
|
105
|
+
// merge dynamic items into groups
|
|
106
|
+
for (const dynamicGroup of dynamicItemGroups){
|
|
97
107
|
// 1. find the group with the same name or create new one
|
|
98
|
-
let group =
|
|
108
|
+
let group = groupsWithItems.find((group)=>group.key === dynamicGroup.key);
|
|
99
109
|
if (!group) {
|
|
100
110
|
group = {
|
|
101
111
|
...dynamicGroup,
|
|
102
|
-
|
|
112
|
+
items: []
|
|
103
113
|
};
|
|
104
114
|
} else {
|
|
105
|
-
|
|
115
|
+
groupsWithItems = groupsWithItems.filter((group)=>group.key !== dynamicGroup.key);
|
|
106
116
|
}
|
|
107
|
-
// 2. Add
|
|
108
|
-
if (group?.
|
|
109
|
-
group.
|
|
117
|
+
// 2. Add items to group items array and add to sanitized.slashMenu.groupsWithItems
|
|
118
|
+
if (group?.items?.length) {
|
|
119
|
+
group.items = group.items.concat(group.items);
|
|
110
120
|
}
|
|
111
|
-
|
|
121
|
+
groupsWithItems.push(group);
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
|
-
return
|
|
124
|
+
return groupsWithItems;
|
|
115
125
|
}, [
|
|
116
|
-
|
|
126
|
+
getDynamicItems,
|
|
117
127
|
queryString,
|
|
118
128
|
editorConfig?.features,
|
|
119
129
|
i18n
|
|
120
130
|
]);
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
const onSelectItem = useCallback((selectedItem, nodeToRemove, closeMenu, matchingString)=>{
|
|
132
|
+
if (nodeToRemove) {
|
|
133
|
+
editor.update(()=>{
|
|
124
134
|
nodeToRemove.remove();
|
|
125
|
-
}
|
|
126
|
-
selectedOption.onSelect({
|
|
127
|
-
editor,
|
|
128
|
-
queryString: matchingString
|
|
129
135
|
});
|
|
130
|
-
|
|
136
|
+
}
|
|
137
|
+
selectedItem.onSelect({
|
|
138
|
+
editor,
|
|
139
|
+
queryString: matchingString
|
|
131
140
|
});
|
|
141
|
+
closeMenu();
|
|
132
142
|
}, [
|
|
133
143
|
editor
|
|
134
144
|
]);
|
|
135
|
-
return /*#__PURE__*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
145
|
+
return /*#__PURE__*/ _jsx(React.Fragment, {
|
|
146
|
+
children: /*#__PURE__*/ _jsx(LexicalTypeaheadMenuPlugin, {
|
|
147
|
+
anchorElem: anchorElem,
|
|
148
|
+
groups: groups,
|
|
149
|
+
menuRenderFn: (anchorElementRef, { selectItemAndCleanUp, selectedItemKey, setSelectedItemKey })=>anchorElementRef.current && groups.length ? /*#__PURE__*/ ReactDOM.createPortal(/*#__PURE__*/ _jsx("div", {
|
|
150
|
+
className: baseClass,
|
|
151
|
+
children: groups.map((group)=>{
|
|
152
|
+
let groupTitle = group.key;
|
|
153
|
+
if (group.label) {
|
|
154
|
+
groupTitle = typeof group.label === 'function' ? group.label({
|
|
155
|
+
i18n
|
|
156
|
+
}) : group.label;
|
|
157
|
+
}
|
|
158
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
159
|
+
className: `${baseClass}__group ${baseClass}__group-${group.key}`,
|
|
160
|
+
children: [
|
|
161
|
+
/*#__PURE__*/ _jsx("div", {
|
|
162
|
+
className: `${baseClass}__group-title`,
|
|
163
|
+
children: groupTitle
|
|
164
|
+
}),
|
|
165
|
+
group.items.map((item, oi)=>/*#__PURE__*/ _jsx(SlashMenuItem, {
|
|
166
|
+
index: oi,
|
|
167
|
+
isSelected: selectedItemKey === item.key,
|
|
168
|
+
item: item,
|
|
169
|
+
onClick: ()=>{
|
|
170
|
+
setSelectedItemKey(item.key);
|
|
171
|
+
selectItemAndCleanUp(item);
|
|
172
|
+
},
|
|
173
|
+
onMouseEnter: ()=>{
|
|
174
|
+
setSelectedItemKey(item.key);
|
|
175
|
+
}
|
|
176
|
+
}, item.key))
|
|
177
|
+
]
|
|
178
|
+
}, group.key);
|
|
179
|
+
})
|
|
180
|
+
}), anchorElementRef.current) : null,
|
|
181
|
+
onQueryChange: setQueryString,
|
|
182
|
+
onSelectItem: onSelectItem,
|
|
183
|
+
triggerFn: checkForTriggerMatch
|
|
184
|
+
})
|
|
185
|
+
});
|
|
170
186
|
}
|
|
171
187
|
|
|
172
188
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/lexical/plugins/SlashMenu/index.tsx"],"sourcesContent":["'use client'\nimport type { TextNode } from 'lexical'\n\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\n\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { useCallback, useMemo, useState } from 'react'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport type { SlashMenuGroup, SlashMenuOption } from './LexicalTypeaheadMenuPlugin/types.js'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js'\nimport './index.scss'\nimport { useMenuTriggerMatch } from './useMenuTriggerMatch.js'\n\nconst baseClass = 'slash-menu-popup'\n\nfunction SlashMenuItem({\n isSelected,\n onClick,\n onMouseEnter,\n option,\n}: {\n index: number\n isSelected: boolean\n onClick: () => void\n onMouseEnter: () => void\n option: SlashMenuOption\n}) {\n const { i18n } = useTranslation()\n\n let className = `${baseClass}__item ${baseClass}__item-${option.key}`\n if (isSelected) {\n className += ` ${baseClass}__item--selected`\n }\n\n let title = option.key\n if (option.displayName) {\n title =\n typeof option.displayName === 'function' ? option.displayName({ i18n }) : option.displayName\n }\n // Crop title to max. 50 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <button\n aria-selected={isSelected}\n className={className}\n id={baseClass + '__item-' + option.key}\n key={option.key}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n ref={option.setRefElement}\n role=\"option\"\n tabIndex={-1}\n type=\"button\"\n >\n {option?.Icon && <option.Icon />}\n\n <span className={`${baseClass}__item-text`}>{title}</span>\n </button>\n )\n}\n\nexport function SlashMenuPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): JSX.Element {\n const [editor] = useLexicalComposerContext()\n const [queryString, setQueryString] = useState<null | string>(null)\n const { editorConfig } = useEditorConfigContext()\n const { i18n } = useTranslation()\n\n const checkForTriggerMatch = useMenuTriggerMatch('/', {\n minLength: 0,\n })\n\n const getDynamicOptions = useCallback(() => {\n let groupWithOptions: Array<SlashMenuGroup> = []\n\n for (const dynamicOption of editorConfig.features.slashMenu.dynamicOptions) {\n const dynamicGroupWithOptions = dynamicOption({\n editor,\n queryString,\n })\n groupWithOptions = groupWithOptions.concat(dynamicGroupWithOptions)\n }\n\n return groupWithOptions\n }, [editor, queryString, editorConfig?.features])\n\n const groups: SlashMenuGroup[] = useMemo(() => {\n let groupsWithOptions: SlashMenuGroup[] = []\n for (const groupWithOption of editorConfig?.features.slashMenu.groupsWithOptions ?? []) {\n groupsWithOptions.push(groupWithOption)\n }\n\n if (queryString) {\n // Filter current groups first\n groupsWithOptions = groupsWithOptions.map((group) => {\n const filteredOptions = group.options.filter((option) => {\n let optionTitle = option.key\n if (option.displayName) {\n optionTitle =\n typeof option.displayName === 'function'\n ? option.displayName({ i18n })\n : option.displayName\n }\n\n return new RegExp(queryString, 'gi').exec(optionTitle) || option.keywords != null\n ? option.keywords.some((keyword) => new RegExp(queryString, 'gi').exec(keyword))\n : false\n })\n if (filteredOptions.length) {\n return {\n ...group,\n options: filteredOptions,\n }\n }\n return null\n })\n\n groupsWithOptions = groupsWithOptions.filter((group) => group != null)\n\n // Now add dynamic groups\n const dynamicOptionGroups = getDynamicOptions()\n\n // merge dynamic options into groups\n for (const dynamicGroup of dynamicOptionGroups) {\n // 1. find the group with the same name or create new one\n let group = groupsWithOptions.find((group) => group.key === dynamicGroup.key)\n if (!group) {\n group = {\n ...dynamicGroup,\n options: [],\n }\n } else {\n groupsWithOptions = groupsWithOptions.filter((group) => group.key !== dynamicGroup.key)\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (group?.options?.length) {\n group.options = group.options.concat(group.options)\n }\n groupsWithOptions.push(group)\n }\n }\n\n return groupsWithOptions\n }, [getDynamicOptions, queryString, editorConfig?.features, i18n])\n\n const onSelectOption = useCallback(\n (\n selectedOption: SlashMenuOption,\n nodeToRemove: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => {\n editor.update(() => {\n if (nodeToRemove) {\n nodeToRemove.remove()\n }\n selectedOption.onSelect({ editor, queryString: matchingString })\n closeMenu()\n })\n },\n [editor],\n )\n\n return (\n <React.Fragment>\n <LexicalTypeaheadMenuPlugin\n anchorElem={anchorElem}\n groupsWithOptions={groups}\n menuRenderFn={(\n anchorElementRef,\n { selectOptionAndCleanUp, selectedOptionKey, setSelectedOptionKey },\n ) =>\n anchorElementRef.current && groups.length\n ? ReactDOM.createPortal(\n <div className={baseClass}>\n {groups.map((group) => {\n let groupTitle = group.key\n if (group.displayName) {\n groupTitle =\n typeof group.displayName === 'function'\n ? group.displayName({ i18n })\n : group.displayName\n }\n\n return (\n <div\n className={`${baseClass}__group ${baseClass}__group-${group.key}`}\n key={group.key}\n >\n <div className={`${baseClass}__group-title`}>{groupTitle}</div>\n {group.options.map((option, oi: number) => (\n <SlashMenuItem\n index={oi}\n isSelected={selectedOptionKey === option.key}\n key={option.key}\n onClick={() => {\n setSelectedOptionKey(option.key)\n selectOptionAndCleanUp(option)\n }}\n onMouseEnter={() => {\n setSelectedOptionKey(option.key)\n }}\n option={option}\n />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n onSelectOption={onSelectOption}\n triggerFn={checkForTriggerMatch}\n />\n </React.Fragment>\n )\n}\n"],"names":["lexicalComposerContextImport","useLexicalComposerContext","useTranslation","useCallback","useMemo","useState","React","ReactDOM","useEditorConfigContext","LexicalTypeaheadMenuPlugin","useMenuTriggerMatch","baseClass","SlashMenuItem","isSelected","onClick","onMouseEnter","option","i18n","className","key","title","displayName","length","substring","button","aria-selected","id","ref","setRefElement","role","tabIndex","type","Icon","span","SlashMenuPlugin","anchorElem","document","body","editor","queryString","setQueryString","editorConfig","checkForTriggerMatch","minLength","getDynamicOptions","groupWithOptions","dynamicOption","features","slashMenu","dynamicOptions","dynamicGroupWithOptions","concat","groups","groupsWithOptions","groupWithOption","push","map","group","filteredOptions","options","filter","optionTitle","RegExp","exec","keywords","some","keyword","dynamicOptionGroups","dynamicGroup","find","onSelectOption","selectedOption","nodeToRemove","closeMenu","matchingString","update","remove","onSelect","Fragment","menuRenderFn","anchorElementRef","selectOptionAndCleanUp","selectedOptionKey","setSelectedOptionKey","current","createPortal","div","groupTitle","oi","index","onQueryChange","triggerFn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AACrE;QACC0B,YAAYA;QACZkB,mBAAmBD;QACnB2B,cAAc,CACZC,kBACA,EAAEC,sBAAsB,EAAEC,iBAAiB,EAAEC,oBAAoB,EAAE,GAEnEH,iBAAiBI,OAAO,IAAIhC,OAAO9B,MAAM,iBACrCf,SAAS8E,YAAY,eACnB,oBAACC;gBAAIpE,WAAWP;eACbyC,OAAOI,GAAG,CAAC,CAACC;gBACX,IAAI8B,aAAa9B,MAAMtC,GAAG;gBAC1B,IAAIsC,MAAMpC,WAAW,EAAE;oBACrBkE,aACE,OAAO9B,MAAMpC,WAAW,KAAK,aACzBoC,MAAMpC,WAAW,CAAC;wBAAEJ;oBAAK,KACzBwC,MAAMpC,WAAW;gBACzB;gBAEA,qBACE,oBAACiE;oBACCpE,WAAW,CAAC,EAAEP,UAAU,QAAQ,EAAEA,UAAU,QAAQ,EAAE8C,MAAMtC,GAAG,CAAC,CAAC;oBACjEA,KAAKsC,MAAMtC,GAAG;iCAEd,oBAACmE;oBAAIpE,WAAW,CAAC,EAAEP,UAAU,aAAa,CAAC;mBAAG4E,aAC7C9B,MAAME,OAAO,CAACH,GAAG,CAAC,CAACxC,QAAQwE,mBAC1B,oBAAC5E;wBACC6E,OAAOD;wBACP3E,YAAYqE,sBAAsBlE,OAAOG,GAAG;wBAC5CA,KAAKH,OAAOG,GAAG;wBACfL,SAAS;4BACPqE,qBAAqBnE,OAAOG,GAAG;4BAC/B8D,uBAAuBjE;wBACzB;wBACAD,cAAc;4BACZoE,qBAAqBnE,OAAOG,GAAG;wBACjC;wBACAH,QAAQA;;YAKlB,KAEFgE,iBAAiBI,OAAO,IAE1B;QAENM,eAAelD;QACf8B,gBAAgBA;QAChBqB,WAAWjD;;AAInB"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/lexical/plugins/SlashMenu/index.tsx"],"sourcesContent":["'use client'\nimport type { TextNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { useCallback, useMemo, useState } from 'react'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport type {\n SlashMenuGroup,\n SlashMenuGroupInternal,\n SlashMenuItemInternal,\n SlashMenuItem as SlashMenuItemType,\n} from './LexicalTypeaheadMenuPlugin/types.js'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js'\nimport './index.scss'\nimport { useMenuTriggerMatch } from './useMenuTriggerMatch.js'\n\nconst baseClass = 'slash-menu-popup'\n\nfunction SlashMenuItem({\n isSelected,\n item,\n onClick,\n onMouseEnter,\n}: {\n index: number\n isSelected: boolean\n item: SlashMenuItemInternal\n onClick: () => void\n onMouseEnter: () => void\n}) {\n const { i18n } = useTranslation()\n\n let className = `${baseClass}__item ${baseClass}__item-${item.key}`\n if (isSelected) {\n className += ` ${baseClass}__item--selected`\n }\n\n let title = item.key\n if (item.label) {\n title = typeof item.label === 'function' ? item.label({ i18n }) : item.label\n }\n // Crop title to max. 25 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <button\n aria-selected={isSelected}\n className={className}\n id={baseClass + '__item-' + item.key}\n key={item.key}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n ref={item.ref}\n role=\"item\"\n tabIndex={-1}\n type=\"button\"\n >\n {item?.Icon && <item.Icon />}\n\n <span className={`${baseClass}__item-text`}>{title}</span>\n </button>\n )\n}\n\nexport function SlashMenuPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n const [queryString, setQueryString] = useState<null | string>(null)\n const { editorConfig } = useEditorConfigContext()\n const { i18n } = useTranslation()\n\n const checkForTriggerMatch = useMenuTriggerMatch('/', {\n minLength: 0,\n })\n\n const getDynamicItems = useCallback(() => {\n let groupWithItems: Array<SlashMenuGroup> = []\n\n for (const dynamicItem of editorConfig.features.slashMenu.dynamicGroups) {\n const dynamicGroupWithItems = dynamicItem({\n editor,\n queryString,\n })\n groupWithItems = groupWithItems.concat(dynamicGroupWithItems)\n }\n\n return groupWithItems\n }, [editor, queryString, editorConfig?.features])\n\n const groups: SlashMenuGroup[] = useMemo(() => {\n let groupsWithItems: SlashMenuGroup[] = []\n for (const groupWithItem of editorConfig?.features.slashMenu.groups ?? []) {\n groupsWithItems.push(groupWithItem)\n }\n\n if (queryString) {\n // Filter current groups first\n groupsWithItems = groupsWithItems.map((group) => {\n const filteredItems = group.items.filter((item) => {\n let itemTitle = item.key\n if (item.label) {\n itemTitle = typeof item.label === 'function' ? item.label({ i18n }) : item.label\n }\n\n if (new RegExp(queryString, 'gi').exec(itemTitle)) {\n return true\n }\n if (item.keywords != null) {\n return item.keywords.some((keyword) => new RegExp(queryString, 'gi').exec(keyword))\n }\n return false\n })\n if (filteredItems.length) {\n return {\n ...group,\n items: filteredItems,\n }\n }\n return null\n })\n\n groupsWithItems = groupsWithItems.filter((group) => group != null)\n\n // Now add dynamic groups\n const dynamicItemGroups = getDynamicItems()\n\n // merge dynamic items into groups\n for (const dynamicGroup of dynamicItemGroups) {\n // 1. find the group with the same name or create new one\n let group = groupsWithItems.find((group) => group.key === dynamicGroup.key)\n if (!group) {\n group = {\n ...dynamicGroup,\n items: [],\n }\n } else {\n groupsWithItems = groupsWithItems.filter((group) => group.key !== dynamicGroup.key)\n }\n\n // 2. Add items to group items array and add to sanitized.slashMenu.groupsWithItems\n if (group?.items?.length) {\n group.items = group.items.concat(group.items)\n }\n groupsWithItems.push(group)\n }\n }\n\n return groupsWithItems\n }, [getDynamicItems, queryString, editorConfig?.features, i18n])\n\n const onSelectItem = useCallback(\n (\n selectedItem: SlashMenuItemType,\n nodeToRemove: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => {\n if (nodeToRemove) {\n editor.update(() => {\n nodeToRemove.remove()\n })\n }\n selectedItem.onSelect({ editor, queryString: matchingString })\n\n closeMenu()\n },\n [editor],\n )\n\n return (\n <React.Fragment>\n <LexicalTypeaheadMenuPlugin\n anchorElem={anchorElem}\n groups={groups as SlashMenuGroupInternal[]}\n menuRenderFn={(\n anchorElementRef,\n { selectItemAndCleanUp, selectedItemKey, setSelectedItemKey },\n ) =>\n anchorElementRef.current && groups.length\n ? ReactDOM.createPortal(\n <div className={baseClass}>\n {groups.map((group) => {\n let groupTitle = group.key\n if (group.label) {\n groupTitle =\n typeof group.label === 'function' ? group.label({ i18n }) : group.label\n }\n\n return (\n <div\n className={`${baseClass}__group ${baseClass}__group-${group.key}`}\n key={group.key}\n >\n <div className={`${baseClass}__group-title`}>{groupTitle}</div>\n {group.items.map((item, oi: number) => (\n <SlashMenuItem\n index={oi}\n isSelected={selectedItemKey === item.key}\n item={item as SlashMenuItemInternal}\n key={item.key}\n onClick={() => {\n setSelectedItemKey(item.key)\n selectItemAndCleanUp(item)\n }}\n onMouseEnter={() => {\n setSelectedItemKey(item.key)\n }}\n />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n onSelectItem={onSelectItem}\n triggerFn={checkForTriggerMatch}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","useTranslation","useCallback","useMemo","useState","React","ReactDOM","useEditorConfigContext","LexicalTypeaheadMenuPlugin","useMenuTriggerMatch","baseClass","SlashMenuItem","isSelected","item","onClick","onMouseEnter","i18n","className","key","title","label","length","substring","button","aria-selected","id","ref","role","tabIndex","type","Icon","span","SlashMenuPlugin","anchorElem","document","body","editor","queryString","setQueryString","editorConfig","checkForTriggerMatch","minLength","getDynamicItems","groupWithItems","dynamicItem","features","slashMenu","dynamicGroups","dynamicGroupWithItems","concat","groups","groupsWithItems","groupWithItem","push","map","group","filteredItems","items","filter","itemTitle","RegExp","exec","keywords","some","keyword","dynamicItemGroups","dynamicGroup","find","onSelectItem","selectedItem","nodeToRemove","closeMenu","matchingString","update","remove","onSelect","Fragment","menuRenderFn","anchorElementRef","selectItemAndCleanUp","selectedItemKey","setSelectedItemKey","current","createPortal","div","groupTitle","oi","index","onQueryChange","triggerFn"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACtD,YAAYC,WAAW,QAAO;AAC9B,YAAYC,cAAc,YAAW;AASrC,SAASC,sBAAsB,QAAQ,8CAA6C;AACpF,SAASC,0BAA0B,QAAQ,wCAAuC;AAClF,OAAO,eAAc;AACrB,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,YAAY;AAElB,SAASC,cAAc,EACrBC,UAAU,EACVC,IAAI,EACJC,OAAO,EACPC,YAAY,EAOb;IACC,MAAM,EAAEC,IAAI,EAAE,GAAGf;IAEjB,IAAIgB,YAAY,CAAC,EAAEP,UAAU,OAAO,EAAEA,UAAU,OAAO,EAAEG,KAAKK,GAAG,CAAC,CAAC;IACnE,IAAIN,YAAY;QACdK,aAAa,CAAC,CAAC,EAAEP,UAAU,gBAAgB,CAAC;IAC9C;IAEA,IAAIS,QAAQN,KAAKK,GAAG;IACpB,IAAIL,KAAKO,KAAK,EAAE;QACdD,QAAQ,OAAON,KAAKO,KAAK,KAAK,aAAaP,KAAKO,KAAK,CAAC;YAAEJ;QAAK,KAAKH,KAAKO,KAAK;IAC9E;IACA,mCAAmC;IACnC,IAAID,MAAME,MAAM,GAAG,IAAI;QACrBF,QAAQA,MAAMG,SAAS,CAAC,GAAG,MAAM;IACnC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IAE1B;YAENM,eAAelD;YACf8B,cAAcA;YACdqB,WAAWjD;;;AAInB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import './index.scss';
|
|
3
3
|
export declare function AddBlockHandlePlugin({ anchorElem, }: {
|
|
4
4
|
anchorElem?: HTMLElement;
|
|
5
|
-
}):
|
|
5
|
+
}): React.ReactElement;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/lexical/plugins/handles/AddBlockHandlePlugin/index.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/field/lexical/plugins/handles/AddBlockHandlePlugin/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAa9B,OAAO,cAAc,CAAA;AAwLrB,wBAAgB,oBAAoB,CAAC,EACnC,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB,GAAG,KAAK,CAAC,YAAY,CAGrB"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
const { $createParagraphNode, $getNodeByKey } = lexicalImport;
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
|
|
4
|
+
import { $createParagraphNode } from 'lexical';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
7
|
import { createPortal } from 'react-dom';
|
|
8
|
+
import { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js';
|
|
9
9
|
import { isHTMLElement } from '../../../utils/guard.js';
|
|
10
10
|
import { Point } from '../../../utils/point.js';
|
|
11
|
-
import { Rect } from '../../../utils/rect.js';
|
|
12
11
|
import { ENABLE_SLASH_MENU_COMMAND } from '../../SlashMenu/LexicalTypeaheadMenuPlugin/index.js';
|
|
13
|
-
import {
|
|
12
|
+
import { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js';
|
|
13
|
+
import { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js';
|
|
14
14
|
import { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js';
|
|
15
15
|
import { isOnHandleElement } from '../utils/isOnHandleElement.js';
|
|
16
16
|
import { setHandlePosition } from '../utils/setHandlePosition.js';
|
|
17
17
|
import './index.scss';
|
|
18
|
-
const SPACE = -24;
|
|
19
18
|
const ADD_BLOCK_MENU_CLASSNAME = 'add-block-menu';
|
|
20
|
-
const Downward = 1;
|
|
21
|
-
const Upward = -1;
|
|
22
|
-
const Indeterminate = 0;
|
|
23
19
|
let prevIndex = Infinity;
|
|
24
20
|
function getCurrentIndex(keysLength) {
|
|
25
21
|
if (keysLength === 0) {
|
|
@@ -30,80 +26,10 @@ function getCurrentIndex(keysLength) {
|
|
|
30
26
|
}
|
|
31
27
|
return Math.floor(keysLength / 2);
|
|
32
28
|
}
|
|
33
|
-
function getBlockElement(anchorElem, editor, event, useEdgeAsDefault = false, horizontalOffset = 0) {
|
|
34
|
-
const anchorElementRect = anchorElem.getBoundingClientRect();
|
|
35
|
-
const topLevelNodeKeys = getTopLevelNodeKeys(editor);
|
|
36
|
-
let blockElem = null;
|
|
37
|
-
let blockNode = null;
|
|
38
|
-
// Return null if matching block element is the first or last node
|
|
39
|
-
editor.getEditorState().read(()=>{
|
|
40
|
-
if (useEdgeAsDefault) {
|
|
41
|
-
const [firstNode, lastNode] = [
|
|
42
|
-
editor.getElementByKey(topLevelNodeKeys[0]),
|
|
43
|
-
editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1])
|
|
44
|
-
];
|
|
45
|
-
const [firstNodeRect, lastNodeRect] = [
|
|
46
|
-
firstNode?.getBoundingClientRect(),
|
|
47
|
-
lastNode?.getBoundingClientRect()
|
|
48
|
-
];
|
|
49
|
-
if (firstNodeRect && lastNodeRect) {
|
|
50
|
-
if (event.y < firstNodeRect.top) {
|
|
51
|
-
blockElem = firstNode;
|
|
52
|
-
} else if (event.y > lastNodeRect.bottom) {
|
|
53
|
-
blockElem = lastNode;
|
|
54
|
-
}
|
|
55
|
-
if (blockElem) {
|
|
56
|
-
return {
|
|
57
|
-
blockElem: null
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// Find matching block element
|
|
63
|
-
let index = getCurrentIndex(topLevelNodeKeys.length);
|
|
64
|
-
let direction = Indeterminate;
|
|
65
|
-
while(index >= 0 && index < topLevelNodeKeys.length){
|
|
66
|
-
const key = topLevelNodeKeys[index];
|
|
67
|
-
const elem = editor.getElementByKey(key);
|
|
68
|
-
if (elem === null) {
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
const point = new Point(event.x + horizontalOffset, event.y);
|
|
72
|
-
const domRect = Rect.fromDOM(elem);
|
|
73
|
-
const { marginBottom, marginTop } = getCollapsedMargins(elem);
|
|
74
|
-
const rect = domRect.generateNewRect({
|
|
75
|
-
bottom: domRect.bottom + marginBottom,
|
|
76
|
-
left: anchorElementRect.left,
|
|
77
|
-
right: anchorElementRect.right,
|
|
78
|
-
top: domRect.top - marginTop
|
|
79
|
-
});
|
|
80
|
-
const { reason: { isOnBottomSide, isOnTopSide }, result } = rect.contains(point);
|
|
81
|
-
if (result) {
|
|
82
|
-
blockElem = elem;
|
|
83
|
-
blockNode = $getNodeByKey(key);
|
|
84
|
-
prevIndex = index;
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
if (direction === Indeterminate) {
|
|
88
|
-
if (isOnTopSide) {
|
|
89
|
-
direction = Upward;
|
|
90
|
-
} else if (isOnBottomSide) {
|
|
91
|
-
direction = Downward;
|
|
92
|
-
} else {
|
|
93
|
-
// stop search block element
|
|
94
|
-
direction = Infinity;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
index += direction;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return {
|
|
101
|
-
blockElem,
|
|
102
|
-
blockNode
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
29
|
function useAddBlockHandle(editor, anchorElem, isEditable) {
|
|
106
30
|
const scrollerElem = anchorElem.parentElement;
|
|
31
|
+
const { editorConfig } = useEditorConfigContext();
|
|
32
|
+
const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -24 : 12;
|
|
107
33
|
const menuRef = useRef(null);
|
|
108
34
|
const [hoveredElement, setHoveredElement] = useState(null);
|
|
109
35
|
useEffect(()=>{
|
|
@@ -112,36 +38,35 @@ function useAddBlockHandle(editor, anchorElem, isEditable) {
|
|
|
112
38
|
if (!isHTMLElement(target)) {
|
|
113
39
|
return;
|
|
114
40
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const { pageX, pageY } = event;
|
|
120
|
-
const horizontalBuffer = 50;
|
|
121
|
-
const verticalBuffer = 25;
|
|
122
|
-
const adjustedTop = top + window.scrollY;
|
|
123
|
-
const adjustedBottom = bottom + window.scrollY;
|
|
124
|
-
if (pageY < adjustedTop - verticalBuffer || pageY > adjustedBottom + verticalBuffer || pageX < left - horizontalBuffer || pageX > right + horizontalBuffer) {
|
|
125
|
-
setHoveredElement(null);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
// This is used to allow the _emptyBlockElem to be found when the mouse is in the
|
|
129
|
-
// buffer zone around the scrollerElem.
|
|
130
|
-
if (pageX < left || pageX > right) {
|
|
131
|
-
distanceFromScrollerElem = pageX < left ? pageX - left : pageX - right;
|
|
132
|
-
}
|
|
41
|
+
const distanceFromScrollerElem = calculateDistanceFromScrollerElem(scrollerElem, event.pageX, event.pageY, target);
|
|
42
|
+
if (distanceFromScrollerElem === -1) {
|
|
43
|
+
setHoveredElement(null);
|
|
44
|
+
return;
|
|
133
45
|
}
|
|
134
46
|
if (isOnHandleElement(target, ADD_BLOCK_MENU_CLASSNAME)) {
|
|
135
47
|
return;
|
|
136
48
|
}
|
|
137
|
-
const
|
|
49
|
+
const topLevelNodeKeys = getTopLevelNodeKeys(editor);
|
|
50
|
+
const { blockElem: _emptyBlockElem, blockNode, foundAtIndex } = getNodeCloseToPoint({
|
|
51
|
+
anchorElem,
|
|
52
|
+
cache_threshold: 0,
|
|
53
|
+
editor,
|
|
54
|
+
horizontalOffset: -distanceFromScrollerElem,
|
|
55
|
+
point: new Point(event.x, event.y),
|
|
56
|
+
returnEmptyParagraphs: true,
|
|
57
|
+
startIndex: getCurrentIndex(topLevelNodeKeys.length),
|
|
58
|
+
useEdgeAsDefault: false
|
|
59
|
+
});
|
|
60
|
+
prevIndex = foundAtIndex;
|
|
138
61
|
if (!_emptyBlockElem) {
|
|
139
62
|
return;
|
|
140
63
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
64
|
+
if (hoveredElement?.node !== blockNode || hoveredElement?.elem !== _emptyBlockElem) {
|
|
65
|
+
setHoveredElement({
|
|
66
|
+
elem: _emptyBlockElem,
|
|
67
|
+
node: blockNode
|
|
68
|
+
});
|
|
69
|
+
}
|
|
145
70
|
}
|
|
146
71
|
// Since the draggableBlockElem is outside the actual editor, we need to listen to the document
|
|
147
72
|
// to be able to detect when the mouse is outside the editor and respect a buffer around
|
|
@@ -153,23 +78,17 @@ function useAddBlockHandle(editor, anchorElem, isEditable) {
|
|
|
153
78
|
}, [
|
|
154
79
|
scrollerElem,
|
|
155
80
|
anchorElem,
|
|
156
|
-
editor
|
|
81
|
+
editor,
|
|
82
|
+
hoveredElement
|
|
157
83
|
]);
|
|
158
84
|
useEffect(()=>{
|
|
159
85
|
if (menuRef.current && hoveredElement?.node) {
|
|
160
|
-
|
|
161
|
-
// Check if blockNode is an empty text node
|
|
162
|
-
let isEmptyParagraph = true;
|
|
163
|
-
if (hoveredElement.node.getType() !== 'paragraph' || hoveredElement.node.getTextContent() !== '') {
|
|
164
|
-
isEmptyParagraph = false;
|
|
165
|
-
}
|
|
166
|
-
setHandlePosition(hoveredElement?.elem, menuRef.current, anchorElem, isEmptyParagraph ? SPACE : SPACE - 20);
|
|
167
|
-
});
|
|
86
|
+
setHandlePosition(hoveredElement?.elem, menuRef.current, anchorElem, blockHandleHorizontalOffset);
|
|
168
87
|
}
|
|
169
88
|
}, [
|
|
170
89
|
anchorElem,
|
|
171
90
|
hoveredElement,
|
|
172
|
-
|
|
91
|
+
blockHandleHorizontalOffset
|
|
173
92
|
]);
|
|
174
93
|
const handleAddClick = useCallback((event)=>{
|
|
175
94
|
let hoveredElementToUse = hoveredElement;
|
|
@@ -217,16 +136,19 @@ function useAddBlockHandle(editor, anchorElem, isEditable) {
|
|
|
217
136
|
editor,
|
|
218
137
|
hoveredElement
|
|
219
138
|
]);
|
|
220
|
-
return /*#__PURE__*/ createPortal(/*#__PURE__*/
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
139
|
+
return /*#__PURE__*/ createPortal(/*#__PURE__*/ _jsx(React.Fragment, {
|
|
140
|
+
children: /*#__PURE__*/ _jsx("button", {
|
|
141
|
+
className: "icon add-block-menu",
|
|
142
|
+
onClick: (event)=>{
|
|
143
|
+
handleAddClick(event);
|
|
144
|
+
},
|
|
145
|
+
ref: menuRef,
|
|
146
|
+
type: "button",
|
|
147
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
148
|
+
className: isEditable ? 'icon' : ''
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
}), anchorElem);
|
|
230
152
|
}
|
|
231
153
|
export function AddBlockHandlePlugin({ anchorElem = document.body }) {
|
|
232
154
|
const [editor] = useLexicalComposerContext();
|