@payloadcms/richtext-lexical 3.0.0-beta.24 → 3.0.0-beta.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/components.d.ts +8 -2
- package/dist/exports/components.d.ts.map +1 -1
- package/dist/exports/components.js +8 -2
- package/dist/exports/components.js.map +1 -1
- package/dist/field/features/align/feature.client.d.ts.map +1 -1
- package/dist/field/features/align/feature.client.js +126 -46
- package/dist/field/features/align/feature.client.js.map +1 -1
- 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/{inlineToolbarAlignGroup.js → toolbarAlignGroup.js} +3 -3
- package/dist/field/features/align/toolbarAlignGroup.js.map +1 -0
- package/dist/field/features/blockquote/feature.client.d.ts +1 -1
- package/dist/field/features/blockquote/feature.client.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.client.js +39 -25
- 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.js +3 -3
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blocks/component/index.d.ts.map +1 -1
- package/dist/field/features/blocks/component/index.js +1 -1
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/feature.client.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.client.js +39 -8
- 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 +2 -2
- package/dist/field/features/blocks/feature.server.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 +2 -2
- 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 +2 -1
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/debug/testRecorder/plugin/index.d.ts +2 -2
- package/dist/field/features/debug/testRecorder/plugin/index.d.ts.map +1 -1
- package/dist/field/features/debug/testRecorder/plugin/index.js.map +1 -1
- package/dist/field/features/debug/treeView/plugin/index.d.ts +2 -2
- package/dist/field/features/debug/treeView/plugin/index.d.ts.map +1 -1
- package/dist/field/features/debug/treeView/plugin/index.js +2 -2
- package/dist/field/features/debug/treeView/plugin/index.js.map +1 -1
- package/dist/field/features/format/bold/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/bold/feature.client.js +23 -19
- package/dist/field/features/format/bold/feature.client.js.map +1 -1
- package/dist/field/features/format/inlineCode/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/inlineCode/feature.client.js +23 -19
- package/dist/field/features/format/inlineCode/feature.client.js.map +1 -1
- package/dist/field/features/format/italic/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/italic/feature.client.js +23 -19
- 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.map +1 -1
- package/dist/field/features/format/strikethrough/feature.client.js +23 -19
- package/dist/field/features/format/strikethrough/feature.client.js.map +1 -1
- package/dist/field/features/format/subscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/subscript/feature.client.js +23 -19
- package/dist/field/features/format/subscript/feature.client.js.map +1 -1
- package/dist/field/features/format/superscript/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/superscript/feature.client.js +23 -19
- package/dist/field/features/format/superscript/feature.client.js.map +1 -1
- package/dist/field/features/format/underline/feature.client.d.ts.map +1 -1
- package/dist/field/features/format/underline/feature.client.js +23 -19
- package/dist/field/features/format/underline/feature.client.js.map +1 -1
- package/dist/field/features/heading/feature.client.d.ts.map +1 -1
- package/dist/field/features/heading/feature.client.js +49 -29
- package/dist/field/features/heading/feature.client.js.map +1 -1
- package/dist/field/features/horizontalRule/feature.client.d.ts.map +1 -1
- package/dist/field/features/horizontalRule/feature.client.js +27 -4
- package/dist/field/features/horizontalRule/feature.client.js.map +1 -1
- package/dist/field/features/horizontalRule/plugin/index.d.ts +2 -1
- package/dist/field/features/horizontalRule/plugin/index.d.ts.map +1 -1
- package/dist/field/features/horizontalRule/plugin/index.js +2 -2
- package/dist/field/features/horizontalRule/plugin/index.js.map +1 -1
- package/dist/field/features/indent/feature.client.d.ts.map +1 -1
- package/dist/field/features/indent/feature.client.js +41 -37
- package/dist/field/features/indent/feature.client.js.map +1 -1
- 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 +2 -1
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/types.d.ts +2 -2
- package/dist/field/features/link/drawer/types.d.ts.map +1 -1
- package/dist/field/features/link/drawer/types.js.map +1 -1
- package/dist/field/features/link/feature.client.d.ts.map +1 -1
- package/dist/field/features/link/feature.client.js +54 -40
- package/dist/field/features/link/feature.client.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts +10 -3
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +3 -3
- package/dist/field/features/link/feature.server.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 +2 -2
- 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 +2 -2
- package/dist/field/features/link/plugins/clickableLink/index.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 +75 -68
- 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.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +2 -2
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +3 -3
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +2 -2
- 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 +2 -2
- 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 +2 -1
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/link/validate.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.client.js +44 -19
- package/dist/field/features/lists/checklist/feature.client.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 +2 -2
- package/dist/field/features/lists/checklist/plugin/index.js.map +1 -1
- package/dist/field/features/lists/orderedList/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/orderedList/feature.client.js +44 -19
- package/dist/field/features/lists/orderedList/feature.client.js.map +1 -1
- 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 +2 -2
- package/dist/field/features/lists/plugin/index.js.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.client.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedList/feature.client.js +44 -19
- package/dist/field/features/lists/unorderedList/feature.client.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/paragraph/feature.client.d.ts.map +1 -1
- package/dist/field/features/paragraph/feature.client.js +36 -22
- package/dist/field/features/paragraph/feature.client.js.map +1 -1
- package/dist/field/features/relationship/feature.client.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.client.js +31 -9
- 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 +2 -2
- package/dist/field/features/relationship/feature.server.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 +4 -2
- 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 +6 -6
- 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 -20
- package/dist/field/features/relationship/populationPromise.js.map +1 -1
- 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/{inlineToolbar → toolbar}/textDropdownGroup.js +2 -2
- package/dist/field/features/shared/toolbar/textDropdownGroup.js.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts +4 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.js +152 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.js.map +1 -0
- package/dist/field/features/toolbars/fixed/Toolbar/index.scss +81 -0
- package/dist/field/features/toolbars/fixed/feature.client.d.ts +3 -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 +3 -0
- package/dist/field/features/toolbars/fixed/feature.server.d.ts.map +1 -0
- package/dist/field/features/toolbars/fixed/feature.server.js +16 -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/{lexical/plugins → features}/toolbars/inline/Toolbar/index.js +67 -23
- package/dist/field/features/toolbars/inline/Toolbar/index.js.map +1 -0
- package/dist/field/{lexical/plugins → features}/toolbars/inline/Toolbar/index.scss +3 -8
- package/dist/field/features/toolbars/inline/feature.client.d.ts +3 -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 +16 -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/toolbars/inline → features/toolbars/shared}/ToolbarButton/index.js +21 -8
- package/dist/field/features/toolbars/shared/ToolbarButton/index.js.map +1 -0
- package/dist/field/{lexical/plugins/toolbars/inline → 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/toolbars/inline → features/toolbars/shared}/ToolbarDropdown/DropDown.js +25 -67
- 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 +139 -0
- package/dist/field/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -0
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars/shared}/ToolbarDropdown/index.scss +25 -13
- package/dist/field/{lexical/plugins/toolbars/inline → features/toolbars}/types.d.ts +16 -8
- 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/types.d.ts +27 -19
- 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/index.d.ts.map +1 -1
- package/dist/field/features/upload/component/index.js +6 -2
- package/dist/field/features/upload/component/index.js.map +1 -1
- package/dist/field/features/upload/feature.client.d.ts.map +1 -1
- package/dist/field/features/upload/feature.client.js +29 -4
- 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 +2 -2
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.js +18 -2
- package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/features/upload/plugin/index.d.ts +3 -2
- package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
- package/dist/field/features/upload/plugin/index.js +2 -2
- 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 +5 -2
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/features/upload/validate.d.ts.map +1 -1
- package/dist/field/features/upload/validate.js +3 -0
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/lexical/EditorFocusProvider.d.ts +20 -0
- package/dist/field/lexical/EditorFocusProvider.d.ts.map +1 -0
- package/dist/field/lexical/EditorFocusProvider.js +78 -0
- package/dist/field/lexical/EditorFocusProvider.js.map +1 -0
- 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 +6 -3
- package/dist/field/lexical/EditorPlugin.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +25 -4
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/field/lexical/LexicalProvider.js +3 -2
- package/dist/field/lexical/LexicalProvider.js.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts +2 -3
- package/dist/field/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/field/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/field/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/client/sanitize.js +1 -0
- package/dist/field/lexical/config/client/sanitize.js.map +1 -1
- package/dist/field/lexical/config/server/default.d.ts.map +1 -1
- package/dist/field/lexical/config/server/default.js +5 -3
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/config/server/loader.d.ts +2 -1
- package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/field/lexical/config/server/loader.js +2 -1
- package/dist/field/lexical/config/server/loader.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +6 -6
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/SlashMenu/index.js +10 -10
- package/dist/field/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js +2 -2
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/getNodeCloseToPoint.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js +6 -3
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/index.scss +8 -0
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.d.ts.map +1 -1
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +25 -6
- package/dist/field/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.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 +16 -0
- package/dist/field/lexical/ui/icons/Add/index.js.map +1 -0
- 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 +3 -2
- package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/index.d.ts +11 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/populate/populate.d.ts +2 -1
- 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 +1 -1
- package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populate/populateLexicalPopulationPromises.js +2 -1
- package/dist/populate/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populate/recurseNestedFields.d.ts +2 -1
- package/dist/populate/recurseNestedFields.d.ts.map +1 -1
- package/dist/populate/recurseNestedFields.js +2 -1
- package/dist/populate/recurseNestedFields.js.map +1 -1
- package/dist/types.d.ts +2 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +11 -11
- package/dist/field/features/align/inlineToolbarAlignGroup.d.ts +0 -3
- package/dist/field/features/align/inlineToolbarAlignGroup.d.ts.map +0 -1
- package/dist/field/features/align/inlineToolbarAlignGroup.js.map +0 -1
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.d.ts +0 -3
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.d.ts.map +0 -1
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.js +0 -10
- package/dist/field/features/format/shared/inlineToolbarFormatGroup.js.map +0 -1
- package/dist/field/features/indent/inlineToolbarIndentGroup.d.ts +0 -3
- package/dist/field/features/indent/inlineToolbarIndentGroup.d.ts.map +0 -1
- package/dist/field/features/indent/inlineToolbarIndentGroup.js +0 -10
- package/dist/field/features/indent/inlineToolbarIndentGroup.js.map +0 -1
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.d.ts +0 -3
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.d.ts.map +0 -1
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.js +0 -10
- package/dist/field/features/shared/inlineToolbar/featureButtonsGroup.js.map +0 -1
- package/dist/field/features/shared/inlineToolbar/textDropdownGroup.d.ts +0 -3
- package/dist/field/features/shared/inlineToolbar/textDropdownGroup.d.ts.map +0 -1
- package/dist/field/features/shared/inlineToolbar/textDropdownGroup.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/fixed/types.d.ts +0 -40
- package/dist/field/lexical/plugins/toolbars/fixed/types.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/fixed/types.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.d.ts +0 -6
- package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/Toolbar/index.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.d.ts +0 -8
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarButton/index.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.d.ts +0 -17
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/DropDown.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.d.ts +0 -18
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js +0 -42
- package/dist/field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/types.d.ts.map +0 -1
- package/dist/field/lexical/plugins/toolbars/inline/types.js +0 -3
- package/dist/field/lexical/plugins/toolbars/inline/types.js.map +0 -1
- /package/dist/field/{lexical/plugins/toolbars/fixed → features/toolbars}/types.js +0 -0
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export { RichTextCell } from '../cell/index.js';
|
|
2
|
+
export { createClientComponent } from '../field/features/createClientComponent.js';
|
|
3
|
+
export { toolbarFormatGroupWithItems } from '../field/features/format/shared/toolbarFormatGroup.js';
|
|
4
|
+
export { toolbarAddDropdownGroupWithItems } from '../field/features/shared/toolbar/addDropdownGroup.js';
|
|
5
|
+
export { toolbarFeatureButtonsGroupWithItems } from '../field/features/shared/toolbar/featureButtonsGroup.js';
|
|
6
|
+
export { toolbarTextDropdownGroupWithItems } from '../field/features/shared/toolbar/textDropdownGroup.js';
|
|
7
|
+
export { ToolbarButton } from '../field/features/toolbars/shared/ToolbarButton/index.js';
|
|
8
|
+
export { ToolbarDropdown } from '../field/features/toolbars/shared/ToolbarDropdown/index.js';
|
|
2
9
|
export { RichTextField } from '../field/index.js';
|
|
10
|
+
export { type EditorFocusContextType, EditorFocusProvider, useEditorFocus, } from '../field/lexical/EditorFocusProvider.js';
|
|
3
11
|
export { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js';
|
|
4
|
-
export { ToolbarButton } from '../field/lexical/plugins/toolbars/inline/ToolbarButton/index.js';
|
|
5
|
-
export { ToolbarDropdown } from '../field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js';
|
|
6
12
|
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/exports/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/exports/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAA;AAElF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uDAAuD,CAAA;AACnG,OAAO,EAAE,gCAAgC,EAAE,MAAM,sDAAsD,CAAA;AACvG,OAAO,EAAE,mCAAmC,EAAE,MAAM,yDAAyD,CAAA;AAC7G,OAAO,EAAE,iCAAiC,EAAE,MAAM,uDAAuD,CAAA;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAA;AAE5F,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EACL,KAAK,sBAAsB,EAC3B,mBAAmB,EACnB,cAAc,GACf,MAAM,yCAAyC,CAAA;AAChD,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAA"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
export { RichTextCell } from '../cell/index.js';
|
|
2
|
+
export { createClientComponent } from '../field/features/createClientComponent.js';
|
|
3
|
+
export { toolbarFormatGroupWithItems } from '../field/features/format/shared/toolbarFormatGroup.js';
|
|
4
|
+
export { toolbarAddDropdownGroupWithItems } from '../field/features/shared/toolbar/addDropdownGroup.js';
|
|
5
|
+
export { toolbarFeatureButtonsGroupWithItems } from '../field/features/shared/toolbar/featureButtonsGroup.js';
|
|
6
|
+
export { toolbarTextDropdownGroupWithItems } from '../field/features/shared/toolbar/textDropdownGroup.js';
|
|
7
|
+
export { ToolbarButton } from '../field/features/toolbars/shared/ToolbarButton/index.js';
|
|
8
|
+
export { ToolbarDropdown } from '../field/features/toolbars/shared/ToolbarDropdown/index.js';
|
|
2
9
|
export { RichTextField } from '../field/index.js';
|
|
10
|
+
export { EditorFocusProvider, useEditorFocus } from '../field/lexical/EditorFocusProvider.js';
|
|
3
11
|
export { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js';
|
|
4
|
-
export { ToolbarButton } from '../field/lexical/plugins/toolbars/inline/ToolbarButton/index.js';
|
|
5
|
-
export { ToolbarDropdown } from '../field/lexical/plugins/toolbars/inline/ToolbarDropdown/index.js';
|
|
6
12
|
|
|
7
13
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["export { RichTextCell } from '../cell/index.js'\nexport {
|
|
1
|
+
{"version":3,"sources":["../../src/exports/components.ts"],"sourcesContent":["export { RichTextCell } from '../cell/index.js'\nexport { createClientComponent } from '../field/features/createClientComponent.js'\n\nexport { toolbarFormatGroupWithItems } from '../field/features/format/shared/toolbarFormatGroup.js'\nexport { toolbarAddDropdownGroupWithItems } from '../field/features/shared/toolbar/addDropdownGroup.js'\nexport { toolbarFeatureButtonsGroupWithItems } from '../field/features/shared/toolbar/featureButtonsGroup.js'\nexport { toolbarTextDropdownGroupWithItems } from '../field/features/shared/toolbar/textDropdownGroup.js'\nexport { ToolbarButton } from '../field/features/toolbars/shared/ToolbarButton/index.js'\nexport { ToolbarDropdown } from '../field/features/toolbars/shared/ToolbarDropdown/index.js'\n\nexport { RichTextField } from '../field/index.js'\nexport {\n type EditorFocusContextType,\n EditorFocusProvider,\n useEditorFocus,\n} from '../field/lexical/EditorFocusProvider.js'\nexport { defaultEditorLexicalConfig } from '../field/lexical/config/client/default.js'\n"],"names":["RichTextCell","createClientComponent","toolbarFormatGroupWithItems","toolbarAddDropdownGroupWithItems","toolbarFeatureButtonsGroupWithItems","toolbarTextDropdownGroupWithItems","ToolbarButton","ToolbarDropdown","RichTextField","EditorFocusProvider","useEditorFocus","defaultEditorLexicalConfig"],"rangeMappings":";;;;;;;;;;","mappings":"AAAA,SAASA,YAAY,QAAQ,mBAAkB;AAC/C,SAASC,qBAAqB,QAAQ,6CAA4C;AAElF,SAASC,2BAA2B,QAAQ,wDAAuD;AACnG,SAASC,gCAAgC,QAAQ,uDAAsD;AACvG,SAASC,mCAAmC,QAAQ,0DAAyD;AAC7G,SAASC,iCAAiC,QAAQ,wDAAuD;AACzG,SAASC,aAAa,QAAQ,2DAA0D;AACxF,SAASC,eAAe,QAAQ,6DAA4D;AAE5F,SAASC,aAAa,QAAQ,oBAAmB;AACjD,SAEEC,mBAAmB,EACnBC,cAAc,QACT,0CAAyC;AAChD,SAASC,0BAA0B,QAAQ,4CAA2C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/align/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/align/feature.client.tsx"],"names":[],"mappings":";AA8JA,eAAO,MAAM,2BAA2B,+BAA4C,CAAA"}
|
|
@@ -1,61 +1,141 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { FORMAT_ELEMENT_COMMAND } from 'lexical';
|
|
2
|
+
import { $isElementNode, $isRangeSelection, FORMAT_ELEMENT_COMMAND } from 'lexical';
|
|
3
3
|
import { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js';
|
|
4
4
|
import { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js';
|
|
5
5
|
import { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js';
|
|
6
6
|
import { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js';
|
|
7
7
|
import { createClientComponent } from '../createClientComponent.js';
|
|
8
|
-
import {
|
|
8
|
+
import { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js';
|
|
9
|
+
const toolbarGroups = [
|
|
10
|
+
toolbarAlignGroupWithItems([
|
|
11
|
+
{
|
|
12
|
+
ChildComponent: AlignLeftIcon,
|
|
13
|
+
isActive: ({ selection })=>{
|
|
14
|
+
if (!$isRangeSelection(selection)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
for (const node of selection.getNodes()){
|
|
18
|
+
if ($isElementNode(node)) {
|
|
19
|
+
if (node.getFormatType() === 'left') {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const parent = node.getParent();
|
|
24
|
+
if ($isElementNode(parent)) {
|
|
25
|
+
if (parent.getFormatType() === 'left') {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
},
|
|
33
|
+
key: 'alignLeft',
|
|
34
|
+
label: `Align Left`,
|
|
35
|
+
onSelect: ({ editor })=>{
|
|
36
|
+
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left');
|
|
37
|
+
},
|
|
38
|
+
order: 1
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
ChildComponent: AlignCenterIcon,
|
|
42
|
+
isActive: ({ selection })=>{
|
|
43
|
+
if (!$isRangeSelection(selection)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
for (const node of selection.getNodes()){
|
|
47
|
+
if ($isElementNode(node)) {
|
|
48
|
+
if (node.getFormatType() === 'center') {
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const parent = node.getParent();
|
|
53
|
+
if ($isElementNode(parent)) {
|
|
54
|
+
if (parent.getFormatType() === 'center') {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
return true;
|
|
61
|
+
},
|
|
62
|
+
key: 'alignCenter',
|
|
63
|
+
label: `Align Center`,
|
|
64
|
+
onSelect: ({ editor })=>{
|
|
65
|
+
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center');
|
|
66
|
+
},
|
|
67
|
+
order: 2
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
ChildComponent: AlignRightIcon,
|
|
71
|
+
isActive: ({ selection })=>{
|
|
72
|
+
if (!$isRangeSelection(selection)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
for (const node of selection.getNodes()){
|
|
76
|
+
if ($isElementNode(node)) {
|
|
77
|
+
if (node.getFormatType() === 'right') {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const parent = node.getParent();
|
|
82
|
+
if ($isElementNode(parent)) {
|
|
83
|
+
if (parent.getFormatType() === 'right') {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
return true;
|
|
90
|
+
},
|
|
91
|
+
key: 'alignRight',
|
|
92
|
+
label: `Align Right`,
|
|
93
|
+
onSelect: ({ editor })=>{
|
|
94
|
+
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right');
|
|
95
|
+
},
|
|
96
|
+
order: 3
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
ChildComponent: AlignJustifyIcon,
|
|
100
|
+
isActive: ({ selection })=>{
|
|
101
|
+
if (!$isRangeSelection(selection)) {
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
for (const node of selection.getNodes()){
|
|
105
|
+
if ($isElementNode(node)) {
|
|
106
|
+
if (node.getFormatType() === 'justify') {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const parent = node.getParent();
|
|
111
|
+
if ($isElementNode(parent)) {
|
|
112
|
+
if (parent.getFormatType() === 'justify') {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
key: 'alignJustify',
|
|
121
|
+
label: `Align Justify`,
|
|
122
|
+
onSelect: ({ editor })=>{
|
|
123
|
+
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify');
|
|
124
|
+
},
|
|
125
|
+
order: 4
|
|
126
|
+
}
|
|
127
|
+
])
|
|
128
|
+
];
|
|
9
129
|
const AlignFeatureClient = (props)=>{
|
|
10
130
|
return {
|
|
11
131
|
clientFeatureProps: props,
|
|
12
132
|
feature: ()=>({
|
|
13
133
|
clientFeatureProps: props,
|
|
134
|
+
toolbarFixed: {
|
|
135
|
+
groups: toolbarGroups
|
|
136
|
+
},
|
|
14
137
|
toolbarInline: {
|
|
15
|
-
groups:
|
|
16
|
-
alignGroupWithItems([
|
|
17
|
-
{
|
|
18
|
-
ChildComponent: AlignLeftIcon,
|
|
19
|
-
isActive: ()=>false,
|
|
20
|
-
key: 'alignLeft',
|
|
21
|
-
label: `Align Left`,
|
|
22
|
-
onSelect: ({ editor })=>{
|
|
23
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left');
|
|
24
|
-
},
|
|
25
|
-
order: 1
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
ChildComponent: AlignCenterIcon,
|
|
29
|
-
isActive: ()=>false,
|
|
30
|
-
key: 'alignCenter',
|
|
31
|
-
label: `Align Center`,
|
|
32
|
-
onSelect: ({ editor })=>{
|
|
33
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center');
|
|
34
|
-
},
|
|
35
|
-
order: 2
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
ChildComponent: AlignRightIcon,
|
|
39
|
-
isActive: ()=>false,
|
|
40
|
-
key: 'alignRight',
|
|
41
|
-
label: `Align Right`,
|
|
42
|
-
onSelect: ({ editor })=>{
|
|
43
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right');
|
|
44
|
-
},
|
|
45
|
-
order: 3
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
ChildComponent: AlignJustifyIcon,
|
|
49
|
-
isActive: ()=>false,
|
|
50
|
-
key: 'alignJustify',
|
|
51
|
-
label: `Align Justify`,
|
|
52
|
-
onSelect: ({ editor })=>{
|
|
53
|
-
editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify');
|
|
54
|
-
},
|
|
55
|
-
order: 4
|
|
56
|
-
}
|
|
57
|
-
])
|
|
58
|
-
]
|
|
138
|
+
groups: toolbarGroups
|
|
59
139
|
}
|
|
60
140
|
})
|
|
61
141
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/align/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { FORMAT_ELEMENT_COMMAND } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/align/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $isElementNode, $isRangeSelection, FORMAT_ELEMENT_COMMAND } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { AlignCenterIcon } from '../../lexical/ui/icons/AlignCenter/index.js'\nimport { AlignJustifyIcon } from '../../lexical/ui/icons/AlignJustify/index.js'\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\nimport { AlignRightIcon } from '../../lexical/ui/icons/AlignRight/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarAlignGroupWithItems } from './toolbarAlignGroup.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarAlignGroupWithItems([\n {\n ChildComponent: AlignLeftIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'left') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'left') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignLeft',\n label: `Align Left`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'left')\n },\n order: 1,\n },\n {\n ChildComponent: AlignCenterIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'center') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'center') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignCenter',\n label: `Align Center`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'center')\n },\n order: 2,\n },\n {\n ChildComponent: AlignRightIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'right') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'right') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignRight',\n label: `Align Right`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'right')\n },\n order: 3,\n },\n {\n ChildComponent: AlignJustifyIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if ($isElementNode(node)) {\n if (node.getFormatType() === 'justify') {\n continue\n }\n }\n\n const parent = node.getParent()\n if ($isElementNode(parent)) {\n if (parent.getFormatType() === 'justify') {\n continue\n }\n }\n\n return false\n }\n return true\n },\n key: 'alignJustify',\n label: `Align Justify`,\n onSelect: ({ editor }) => {\n editor.dispatchCommand(FORMAT_ELEMENT_COMMAND, 'justify')\n },\n order: 4,\n },\n ]),\n]\n\nconst AlignFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const AlignFeatureClientComponent = createClientComponent(AlignFeatureClient)\n"],"names":["$isElementNode","$isRangeSelection","FORMAT_ELEMENT_COMMAND","AlignCenterIcon","AlignJustifyIcon","AlignLeftIcon","AlignRightIcon","createClientComponent","toolbarAlignGroupWithItems","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getFormatType","parent","getParent","key","label","onSelect","editor","dispatchCommand","order","AlignFeatureClient","props","clientFeatureProps","feature","toolbarFixed","groups","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,IAAIjB,eAAegB,SAAS;wBAC1B,IAAIA,OAAOD,aAAa,OAAO,WAAW;4BACxC;wBACF;oBACF;oBAEA,OAAO;gBACT;gBACA,OAAO;YACT;YACAG,KAAK;YACLC,OAAO,CAAC,aAAa,CAAC;YACtBC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,eAAe,CAACpB,wBAAwB;YACjD;YACAqB,OAAO;QACT;KACD;CACF;AAED,MAAMC,qBAA+D,CAACC;IACpE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,cAAc;oBACZC,QAAQpB;gBACV;gBACAqB,eAAe;oBACbD,QAAQpB;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAMsB,8BAA8BxB,sBAAsBiB,oBAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolbarAlignGroup.d.ts","sourceRoot":"","sources":["../../../../src/field/features/align/toolbarAlignGroup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAI1E,eAAO,MAAM,0BAA0B,UAAW,gBAAgB,EAAE,KAAG,YAQtE,CAAA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js';
|
|
2
|
-
export const
|
|
2
|
+
export const toolbarAlignGroupWithItems = (items)=>{
|
|
3
3
|
return {
|
|
4
4
|
type: 'dropdown',
|
|
5
5
|
ChildComponent: AlignLeftIcon,
|
|
6
6
|
items,
|
|
7
7
|
key: 'align',
|
|
8
|
-
order:
|
|
8
|
+
order: 30
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
//# sourceMappingURL=
|
|
12
|
+
//# sourceMappingURL=toolbarAlignGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/align/toolbarAlignGroup.ts"],"sourcesContent":["import type { ToolbarGroup, ToolbarGroupItem } from '../toolbars/types.js'\n\nimport { AlignLeftIcon } from '../../lexical/ui/icons/AlignLeft/index.js'\n\nexport const toolbarAlignGroupWithItems = (items: ToolbarGroupItem[]): ToolbarGroup => {\n return {\n type: 'dropdown',\n ChildComponent: AlignLeftIcon,\n items,\n key: 'align',\n order: 30,\n }\n}\n"],"names":["AlignLeftIcon","toolbarAlignGroupWithItems","items","type","ChildComponent","key","order"],"rangeMappings":";;;;;;;;;","mappings":"AAEA,SAASA,aAAa,QAAQ,4CAA2C;AAEzE,OAAO,MAAMC,6BAA6B,CAACC;IACzC,OAAO;QACLC,MAAM;QACNC,gBAAgBJ;QAChBE;QACAG,KAAK;QACLC,OAAO;IACT;AACF,EAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const BlockquoteFeatureClientComponent: import("react").FC<undefined>;
|
|
3
3
|
//# sourceMappingURL=feature.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"names":[],"mappings":";AAkFA,eAAO,MAAM,gCAAgC,+BAAiD,CAAA"}
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { $createQuoteNode, QuoteNode } from '@lexical/rich-text';
|
|
2
|
+
import { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text';
|
|
3
3
|
import { $setBlocksType } from '@lexical/selection';
|
|
4
|
-
import { $getSelection } from 'lexical';
|
|
4
|
+
import { $getSelection, $isRangeSelection } from 'lexical';
|
|
5
5
|
import { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js';
|
|
6
6
|
import { createClientComponent } from '../createClientComponent.js';
|
|
7
|
-
import {
|
|
7
|
+
import { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js';
|
|
8
8
|
import { MarkdownTransformer } from './markdownTransformer.js';
|
|
9
|
-
const
|
|
9
|
+
const toolbarGroups = [
|
|
10
|
+
toolbarTextDropdownGroupWithItems([
|
|
11
|
+
{
|
|
12
|
+
ChildComponent: BlockquoteIcon,
|
|
13
|
+
isActive: ({ selection })=>{
|
|
14
|
+
if (!$isRangeSelection(selection)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
for (const node of selection.getNodes()){
|
|
18
|
+
if (!$isQuoteNode(node) && !$isQuoteNode(node.getParent())) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return true;
|
|
23
|
+
},
|
|
24
|
+
key: 'blockquote',
|
|
25
|
+
label: `Blockquote`,
|
|
26
|
+
onSelect: ({ editor })=>{
|
|
27
|
+
editor.update(()=>{
|
|
28
|
+
const selection = $getSelection();
|
|
29
|
+
$setBlocksType(selection, ()=>$createQuoteNode());
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
order: 20
|
|
33
|
+
}
|
|
34
|
+
])
|
|
35
|
+
];
|
|
36
|
+
const BlockquoteFeatureClient = (props)=>{
|
|
10
37
|
return {
|
|
11
38
|
clientFeatureProps: props,
|
|
12
39
|
feature: ()=>({
|
|
@@ -20,16 +47,15 @@ const BlockQuoteFeatureClient = (props)=>{
|
|
|
20
47
|
slashMenu: {
|
|
21
48
|
groups: [
|
|
22
49
|
{
|
|
23
|
-
displayName: 'Basic',
|
|
24
50
|
items: [
|
|
25
51
|
{
|
|
26
52
|
Icon: BlockquoteIcon,
|
|
27
|
-
displayName: 'Blockquote',
|
|
28
53
|
key: 'blockquote',
|
|
29
54
|
keywords: [
|
|
30
55
|
'quote',
|
|
31
56
|
'blockquote'
|
|
32
57
|
],
|
|
58
|
+
label: 'Blockquote',
|
|
33
59
|
onSelect: ({ editor })=>{
|
|
34
60
|
editor.update(()=>{
|
|
35
61
|
const selection = $getSelection();
|
|
@@ -38,32 +64,20 @@ const BlockQuoteFeatureClient = (props)=>{
|
|
|
38
64
|
}
|
|
39
65
|
}
|
|
40
66
|
],
|
|
41
|
-
key: 'basic'
|
|
67
|
+
key: 'basic',
|
|
68
|
+
label: 'Basic'
|
|
42
69
|
}
|
|
43
70
|
]
|
|
44
71
|
},
|
|
72
|
+
toolbarFixed: {
|
|
73
|
+
groups: toolbarGroups
|
|
74
|
+
},
|
|
45
75
|
toolbarInline: {
|
|
46
|
-
groups:
|
|
47
|
-
inlineToolbarTextDropdownGroupWithItems([
|
|
48
|
-
{
|
|
49
|
-
ChildComponent: BlockquoteIcon,
|
|
50
|
-
isActive: ()=>false,
|
|
51
|
-
key: 'blockquote',
|
|
52
|
-
label: `Blockquote`,
|
|
53
|
-
onSelect: ({ editor })=>{
|
|
54
|
-
editor.update(()=>{
|
|
55
|
-
const selection = $getSelection();
|
|
56
|
-
$setBlocksType(selection, ()=>$createQuoteNode());
|
|
57
|
-
});
|
|
58
|
-
},
|
|
59
|
-
order: 20
|
|
60
|
-
}
|
|
61
|
-
])
|
|
62
|
-
]
|
|
76
|
+
groups: toolbarGroups
|
|
63
77
|
}
|
|
64
78
|
})
|
|
65
79
|
};
|
|
66
80
|
};
|
|
67
|
-
export const
|
|
81
|
+
export const BlockquoteFeatureClientComponent = createClientComponent(BlockquoteFeatureClient);
|
|
68
82
|
|
|
69
83
|
//# sourceMappingURL=feature.client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $createQuoteNode, QuoteNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection } from 'lexical'\n\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport { $createQuoteNode, $isQuoteNode, QuoteNode } from '@lexical/rich-text'\nimport { $setBlocksType } from '@lexical/selection'\nimport { $getSelection, $isRangeSelection } from 'lexical'\n\nimport type { ToolbarGroup } from '../toolbars/types.js'\nimport type { FeatureProviderProviderClient } from '../types.js'\n\nimport { BlockquoteIcon } from '../../lexical/ui/icons/Blockquote/index.js'\nimport { createClientComponent } from '../createClientComponent.js'\nimport { toolbarTextDropdownGroupWithItems } from '../shared/toolbar/textDropdownGroup.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nconst toolbarGroups: ToolbarGroup[] = [\n toolbarTextDropdownGroupWithItems([\n {\n ChildComponent: BlockquoteIcon,\n isActive: ({ selection }) => {\n if (!$isRangeSelection(selection)) {\n return false\n }\n for (const node of selection.getNodes()) {\n if (!$isQuoteNode(node) && !$isQuoteNode(node.getParent())) {\n return false\n }\n }\n return true\n },\n key: 'blockquote',\n label: `Blockquote`,\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n order: 20,\n },\n ]),\n]\n\nconst BlockquoteFeatureClient: FeatureProviderProviderClient<undefined> = (props) => {\n return {\n clientFeatureProps: props,\n feature: () => ({\n clientFeatureProps: props,\n markdownTransformers: [MarkdownTransformer],\n nodes: [QuoteNode],\n\n slashMenu: {\n groups: [\n {\n items: [\n {\n Icon: BlockquoteIcon,\n key: 'blockquote',\n keywords: ['quote', 'blockquote'],\n label: 'Blockquote',\n onSelect: ({ editor }) => {\n editor.update(() => {\n const selection = $getSelection()\n $setBlocksType(selection, () => $createQuoteNode())\n })\n },\n },\n ],\n key: 'basic',\n label: 'Basic',\n },\n ],\n },\n toolbarFixed: {\n groups: toolbarGroups,\n },\n toolbarInline: {\n groups: toolbarGroups,\n },\n }),\n }\n}\n\nexport const BlockquoteFeatureClientComponent = createClientComponent(BlockquoteFeatureClient)\n"],"names":["$createQuoteNode","$isQuoteNode","QuoteNode","$setBlocksType","$getSelection","$isRangeSelection","BlockquoteIcon","createClientComponent","toolbarTextDropdownGroupWithItems","MarkdownTransformer","toolbarGroups","ChildComponent","isActive","selection","node","getNodes","getParent","key","label","onSelect","editor","update","order","BlockquoteFeatureClient","props","clientFeatureProps","feature","markdownTransformers","nodes","slashMenu","groups","items","Icon","keywords","toolbarFixed","toolbarInline","BlockquoteFeatureClientComponent"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAEA,SAASA,gBAAgB,EAAEC,YAAY,EAAEC,SAAS,QAAQ,qBAAoB;AAC9E,SAASC,cAAc,QAAQ,qBAAoB;AACnD,SAASC,aAAa,EAAEC,iBAAiB,QAAQ,UAAS;AAK1D,SAASC,cAAc,QAAQ,6CAA4C;AAC3E,SAASC,qBAAqB,QAAQ,8BAA6B;AACnE,SAASC,iCAAiC,QAAQ,yCAAwC;AAC1F,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,MAAMC,gBAAgC;IACpCF,kCAAkC;QAChC;YACEG,gBAAgBL;YAChBM,UAAU,CAAC,EAAEC,SAAS,EAAE;gBACtB,IAAI,CAACR,kBAAkBQ,YAAY;oBACjC,OAAO;gBACT;gBACA,KAAK,MAAMC,QAAQD,UAAUE,QAAQ,GAAI;oBACvC,IAAI,CAACd,aAAaa,SAAS,CAACb,aAAaa,KAAKE,SAAS,KAAK;wBAC1D,OAAO;oBACT;gBACF;gBACA,OAAO;YACT;YACAC,KAAK;YACLC,OAAO,CAAC,UAAU,CAAC;YACnBC,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnBA,OAAOC,MAAM,CAAC;oBACZ,MAAMR,YAAYT;oBAClBD,eAAeU,WAAW,IAAMb;gBAClC;YACF;YACAsB,OAAO;QACT;KACD;CACF;AAED,MAAMC,0BAAoE,CAACC;IACzE,OAAO;QACLC,oBAAoBD;QACpBE,SAAS,IAAO,CAAA;gBACdD,oBAAoBD;gBACpBG,sBAAsB;oBAAClB;iBAAoB;gBAC3CmB,OAAO;oBAAC1B;iBAAU;gBAElB2B,WAAW;oBACTC,QAAQ;wBACN;4BACEC,OAAO;gCACL;oCACEC,MAAM1B;oCACNW,KAAK;oCACLgB,UAAU;wCAAC;wCAAS;qCAAa;oCACjCf,OAAO;oCACPC,UAAU,CAAC,EAAEC,MAAM,EAAE;wCACnBA,OAAOC,MAAM,CAAC;4CACZ,MAAMR,YAAYT;4CAClBD,eAAeU,WAAW,IAAMb;wCAClC;oCACF;gCACF;6BACD;4BACDiB,KAAK;4BACLC,OAAO;wBACT;qBACD;gBACH;gBACAgB,cAAc;oBACZJ,QAAQpB;gBACV;gBACAyB,eAAe;oBACbL,QAAQpB;gBACV;YACF,CAAA;IACF;AACF;AAEA,OAAO,MAAM0B,mCAAmC7B,sBAAsBgB,yBAAwB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { FeatureProviderProviderServer } from '../types.js';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const BlockquoteFeature: FeatureProviderProviderServer<undefined, undefined>;
|
|
3
3
|
//# sourceMappingURL=feature.server.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { QuoteNode } from '@lexical/rich-text';
|
|
2
2
|
import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
|
|
3
3
|
import { createNode } from '../typeUtilities.js';
|
|
4
|
-
import {
|
|
4
|
+
import { BlockquoteFeatureClientComponent } from './feature.client.js';
|
|
5
5
|
import { MarkdownTransformer } from './markdownTransformer.js';
|
|
6
|
-
export const
|
|
6
|
+
export const BlockquoteFeature = (props)=>{
|
|
7
7
|
return {
|
|
8
8
|
feature: ()=>{
|
|
9
9
|
return {
|
|
10
|
-
ClientComponent:
|
|
10
|
+
ClientComponent: BlockquoteFeatureClientComponent,
|
|
11
11
|
clientFeatureProps: null,
|
|
12
12
|
markdownTransformers: [
|
|
13
13
|
MarkdownTransformer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.server.ts"],"sourcesContent":["import { QuoteNode } from '@lexical/rich-text'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/blockquote/feature.server.ts"],"sourcesContent":["import { QuoteNode } from '@lexical/rich-text'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { BlockquoteFeatureClientComponent } from './feature.client.js'\nimport { MarkdownTransformer } from './markdownTransformer.js'\n\nexport const BlockquoteFeature: FeatureProviderProviderServer<undefined, undefined> = (props) => {\n return {\n feature: () => {\n return {\n ClientComponent: BlockquoteFeatureClientComponent,\n clientFeatureProps: null,\n markdownTransformers: [MarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n return `<blockquote>${childrenText}</blockquote>`\n },\n nodeTypes: [QuoteNode.getType()],\n },\n },\n node: QuoteNode,\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blockquote',\n serverFeatureProps: props,\n }\n}\n"],"names":["QuoteNode","convertLexicalNodesToHTML","createNode","BlockquoteFeatureClientComponent","MarkdownTransformer","BlockquoteFeature","props","feature","ClientComponent","clientFeatureProps","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","nodeTypes","getType","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,qBAAoB;AAI9C,SAASC,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,gCAAgC,QAAQ,sBAAqB;AACtE,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,OAAO,MAAMC,oBAAyE,CAACC;IACrF,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBL;gBACjBM,oBAAoB;gBACpBC,sBAAsB;oBAACN;iBAAoB;gBAC3CO,OAAO;oBACLT,WAAW;wBACTU,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMjB,0BAA0B;wCACnDW;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,OAAO,CAAC,YAAY,EAAEC,aAAa,aAAa,CAAC;gCACnD;gCACAG,WAAW;oCAACrB,UAAUsB,OAAO;iCAAG;4BAClC;wBACF;wBACAP,MAAMf;oBACR;iBACD;gBACDuB,oBAAoBjB;YACtB;QACF;QACAkB,KAAK;QACLD,oBAAoBjB;IACtB;AACF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAuBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAuBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAiJ1C,CAAA"}
|
|
@@ -154,7 +154,7 @@ export const BlockComponent = (props)=>{
|
|
|
154
154
|
]) // Adding formData to the dependencies here might break it
|
|
155
155
|
;
|
|
156
156
|
return /*#__PURE__*/ React.createElement("div", {
|
|
157
|
-
className: baseClass
|
|
157
|
+
className: baseClass + ' ' + baseClass + '-' + formData.blockType
|
|
158
158
|
}, formContent);
|
|
159
159
|
};
|
|
160
160
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { ShimmerEffect } from '@payloadcms/ui/elements/ShimmerEffect'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","Collapsible","Pill","ShimmerEffect","SectionTitle","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","useTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","key","height"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AO;QACAM;QACAjB;QACA4C;QACA5B;QACAV;KACD,EAAE,0DAA0D;;IAE7D,qBAAO,oBAACsD;QAAIH,WAAW5E;OAAYuE;AACrC,EAAC"}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Collapsible } from '@payloadcms/ui/elements/Collapsible'\nimport { Pill } from '@payloadcms/ui/elements/Pill'\nimport { ShimmerEffect } from '@payloadcms/ui/elements/ShimmerEffect'\nimport { SectionTitle } from '@payloadcms/ui/fields/Blocks/SectionTitle'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n const { i18n } = useTranslation()\n\n const classNames = [`${baseClass}__row`, `${baseClass}__row--no-errors`].filter(Boolean).join(' ')\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return reducedBlock && initialState !== false ? (\n <Form\n beforeSubmit={[onChange]}\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n ) : (\n <Collapsible\n className={classNames}\n collapsibleStyle=\"default\"\n header={\n <div className={`${baseClass}__block-header`}>\n <div>\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${formData?.blockType}`}\n pillStyle=\"white\"\n >\n {typeof reducedBlock.labels.singular === 'string'\n ? getTranslation(reducedBlock.labels.singular, i18n)\n : '[Singular Label]'}\n </Pill>\n <SectionTitle path=\"blockName\" readOnly={parentLexicalRichTextField?.readOnly} />\n </div>\n </div>\n }\n key={0}\n >\n <ShimmerEffect height=\"35vh\" />\n </Collapsible>\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n i18n,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n return <div className={baseClass + ' ' + baseClass + '-' + formData.blockType}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","getTranslation","Collapsible","Pill","ShimmerEffect","SectionTitle","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","useTranslation","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","i18n","classNames","filter","Boolean","join","formContent","beforeSubmit","formSchema","Array","isArray","className","collapsibleStyle","header","div","pillStyle","labels","singular","readOnly","key","height"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAIlB,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SAASC,WAAW,QAAQ,sCAAqC;AACjE,SAASC,IAAI,QAAQ,+BAA8B;AACnD,SAASC,aAAa,QAAQ,wCAAuC;AACrE,SAASC,YAAY,QAAQ,4CAA2C;AACxE,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,eAAc;AACrB,SAASC,sBAAsB,QAAQ,8BAA6B;AAcpE,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAEC,qBAAqB,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAG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6BAC1C,oBAAC+E,2BACC,oBAAC5E;gBACCyE,WAAW,CAAC,EAAE5E,UAAU,aAAa,EAAEA,UAAU,aAAa,EAAEoB,UAAUc,UAAU,CAAC;gBACrF8C,WAAU;eAET,OAAO5C,aAAa6C,MAAM,CAACC,QAAQ,KAAK,WACrCjF,eAAemC,aAAa6C,MAAM,CAACC,QAAQ,EAAEhB,QAC7C,mCAEN,oBAAC7D;gBAAaoB,MAAK;gBAAY0D,UAAUtD,4BAA4BsD;;YAI3EC,KAAK;yBAEL,oBAAChF;YAAciF,QAAO;;IAG5B,GAAG;QACDzC;QACAf;QACAR;QACA6C;QACA3C;QACAO;QACAM;QACAjB;QACA4C;QACA5B;QACAV;KACD,EAAE,0DAA0D;;IAC7D,qBAAO,oBAACsD;QAAIH,WAAW5E,YAAY,MAAMA,YAAY,MAAMoB,SAASc,SAAS;OAAGqC;AAClF,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.client.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAY9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AA+
|
|
1
|
+
{"version":3,"file":"feature.client.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.client.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAY9E,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,YAAY,EAAE,CAAA;CAC9B,CAAA;AA+ED,eAAO,MAAM,4BAA4B,0FAA6C,CAAA"}
|