@payloadcms/richtext-lexical 3.0.0-beta.106 → 3.0.0-beta.108
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.js +1 -1
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/client/Field-ETCEVZLL.js +2 -0
- package/dist/exports/client/Field-ETCEVZLL.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-F6JI75HS.js +2 -0
- package/dist/exports/client/{RelationshipComponent-Z5SZ5FFT.js.map → RelationshipComponent-F6JI75HS.js.map} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-76MVRKRT.js +2 -0
- package/dist/exports/client/chunk-76MVRKRT.js.map +7 -0
- package/dist/exports/client/{chunk-TXEIKM77.js → chunk-GD6LBQBJ.js} +2 -2
- package/dist/exports/client/chunk-GD6LBQBJ.js.map +7 -0
- package/dist/exports/client/chunk-HIGLONP6.js +2 -0
- package/dist/exports/client/chunk-HIGLONP6.js.map +7 -0
- package/dist/exports/client/{chunk-GK7ZKYHL.js → chunk-IIWHHN4J.js} +2 -2
- package/dist/exports/client/chunk-IIWHHN4J.js.map +7 -0
- package/dist/exports/client/{chunk-PY6JO5OH.js → chunk-JYCJEIVA.js} +2 -2
- package/dist/exports/client/{chunk-PY6JO5OH.js.map → chunk-JYCJEIVA.js.map} +2 -2
- package/dist/exports/client/{chunk-GTKNWSQW.js → chunk-N2PXHNGO.js} +2 -2
- package/dist/exports/client/{chunk-GTKNWSQW.js.map → chunk-N2PXHNGO.js.map} +2 -2
- package/dist/exports/client/{chunk-PECDZEZY.js → chunk-YREZUOA6.js} +2 -2
- package/dist/exports/client/{chunk-PECDZEZY.js.map → chunk-YREZUOA6.js.map} +2 -2
- package/dist/exports/client/component-4IBTSHL5.js +2 -0
- package/dist/exports/client/component-4IBTSHL5.js.map +7 -0
- package/dist/exports/client/{component-GAX6BHKZ.js → component-GQ5M6NF6.js} +2 -2
- package/dist/exports/client/component-P34B4EPY.js +2 -0
- package/dist/exports/client/component-P34B4EPY.js.map +7 -0
- package/dist/exports/client/componentInline-XX7FVAIV.js +2 -0
- package/dist/exports/client/{componentInline-HAGGWKA7.js.map → componentInline-XX7FVAIV.js.map} +2 -2
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/features/blockquote/server/index.d.ts +1 -1
- package/dist/features/blockquote/server/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +5 -4
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/index.d.ts +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +15 -5
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +4 -4
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +21 -11
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts +2 -2
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +4 -4
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +4 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts +10 -4
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -2
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/converters/html/converter/index.js +2 -2
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/server/index.js +2 -2
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/horizontalRule/client/component/index.d.ts +1 -1
- package/dist/features/horizontalRule/client/component/index.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -2
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/indent/client/index.d.ts.map +1 -1
- package/dist/features/indent/client/index.js +2 -1
- package/dist/features/indent/client/index.js.map +1 -1
- package/dist/features/link/client/index.js +1 -1
- package/dist/features/link/client/index.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -7
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +2 -2
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +11 -6
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/nodes/types.d.ts +3 -3
- package/dist/features/link/nodes/types.d.ts.map +1 -1
- package/dist/features/link/nodes/types.js.map +1 -1
- package/dist/features/link/server/baseFields.d.ts +1 -1
- package/dist/features/link/server/baseFields.d.ts.map +1 -1
- package/dist/features/link/server/baseFields.js +3 -1
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +2 -2
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/link/server/transformExtraFields.d.ts +1 -1
- package/dist/features/link/server/transformExtraFields.d.ts.map +1 -1
- package/dist/features/link/server/transformExtraFields.js.map +1 -1
- package/dist/features/link/server/validate.js.map +1 -1
- package/dist/features/lists/shared/markdown.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +1 -0
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/paragraph/server/index.d.ts +1 -1
- package/dist/features/paragraph/server/index.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +8 -6
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +3 -3
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +1 -1
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +40 -41
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +33 -34
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +3 -4
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +82 -64
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +21 -11
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.js +1 -1
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
- package/dist/features/upload/client/drawer/index.js +2 -0
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +1 -1
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/feature.server.js +3 -4
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +11 -11
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.js +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -63
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.d.ts.map +1 -1
- package/dist/lexical/EditorPlugin.js +2 -1
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +5 -5
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +8 -7
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.js +2 -2
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +11 -11
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +2 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +9 -6
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +5 -5
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +9 -4
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +3 -4
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
- package/dist/lexical/utils/rect.d.ts +4 -4
- package/dist/lexical/utils/setFloatingElemPosition.d.ts +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/populateGraphQL/populate.js +1 -1
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js +5 -4
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -3
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +1 -0
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/dist/validate/validateNodes.d.ts.map +1 -1
- package/dist/validate/validateNodes.js +2 -2
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +13 -13
- package/dist/exports/client/Field-EL5TNVZW.js +0 -2
- package/dist/exports/client/Field-EL5TNVZW.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-Z5SZ5FFT.js +0 -2
- package/dist/exports/client/chunk-366OGJYE.js +0 -2
- package/dist/exports/client/chunk-366OGJYE.js.map +0 -7
- package/dist/exports/client/chunk-GK7ZKYHL.js.map +0 -7
- package/dist/exports/client/chunk-TXEIKM77.js.map +0 -7
- package/dist/exports/client/component-OVIYSCND.js +0 -2
- package/dist/exports/client/component-OVIYSCND.js.map +0 -7
- package/dist/exports/client/component-UJILB3MH.js +0 -2
- package/dist/exports/client/component-UJILB3MH.js.map +0 -7
- package/dist/exports/client/componentInline-HAGGWKA7.js +0 -2
- /package/dist/exports/client/{component-GAX6BHKZ.js.map → component-GQ5M6NF6.js.map} +0 -0
|
@@ -101,14 +101,13 @@ const ToolbarItem = t0 => {
|
|
|
101
101
|
return t3;
|
|
102
102
|
};
|
|
103
103
|
export const ToolbarDropdown = t0 => {
|
|
104
|
-
const $ = _c(
|
|
104
|
+
const $ = _c(42);
|
|
105
105
|
const {
|
|
106
106
|
anchorElem,
|
|
107
107
|
classNames,
|
|
108
108
|
editor,
|
|
109
|
-
|
|
109
|
+
group,
|
|
110
110
|
Icon,
|
|
111
|
-
items,
|
|
112
111
|
itemsContainerClassNames,
|
|
113
112
|
label,
|
|
114
113
|
maxActiveItems,
|
|
@@ -130,12 +129,20 @@ export const ToolbarDropdown = t0 => {
|
|
|
130
129
|
t2 = $[1];
|
|
131
130
|
}
|
|
132
131
|
const [enabledItemKeys, setEnabledItemKeys] = React.useState(t2);
|
|
132
|
+
const [enabledGroup, setEnabledGroup] = React.useState(true);
|
|
133
133
|
const editorConfigContext = useEditorConfigContext();
|
|
134
|
+
const {
|
|
135
|
+
items,
|
|
136
|
+
key: groupKey
|
|
137
|
+
} = group;
|
|
134
138
|
let t3;
|
|
135
|
-
if ($[2] !== editor || $[3] !== items || $[4] !== maxActiveItems || $[5] !== editorConfigContext || $[6] !== onActiveChange) {
|
|
139
|
+
if ($[2] !== editor || $[3] !== items || $[4] !== maxActiveItems || $[5] !== editorConfigContext || $[6] !== group || $[7] !== onActiveChange) {
|
|
136
140
|
t3 = () => {
|
|
137
141
|
editor.getEditorState().read(() => {
|
|
138
142
|
const selection = $getSelection();
|
|
143
|
+
if (!selection) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
139
146
|
const _activeItemKeys = [];
|
|
140
147
|
const _activeItems = [];
|
|
141
148
|
const _enabledItemKeys = [];
|
|
@@ -164,6 +171,13 @@ export const ToolbarDropdown = t0 => {
|
|
|
164
171
|
_enabledItemKeys.push(item.key);
|
|
165
172
|
}
|
|
166
173
|
}
|
|
174
|
+
if (group.isEnabled) {
|
|
175
|
+
setEnabledGroup(group.isEnabled({
|
|
176
|
+
editor,
|
|
177
|
+
editorConfigContext,
|
|
178
|
+
selection
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
167
181
|
setActiveItemKeys(_activeItemKeys);
|
|
168
182
|
setEnabledItemKeys(_enabledItemKeys);
|
|
169
183
|
if (onActiveChange) {
|
|
@@ -177,114 +191,118 @@ export const ToolbarDropdown = t0 => {
|
|
|
177
191
|
$[3] = items;
|
|
178
192
|
$[4] = maxActiveItems;
|
|
179
193
|
$[5] = editorConfigContext;
|
|
180
|
-
$[6] =
|
|
181
|
-
$[7] =
|
|
194
|
+
$[6] = group;
|
|
195
|
+
$[7] = onActiveChange;
|
|
196
|
+
$[8] = t3;
|
|
182
197
|
} else {
|
|
183
|
-
t3 = $[
|
|
198
|
+
t3 = $[8];
|
|
184
199
|
}
|
|
185
200
|
const updateStates = t3;
|
|
186
201
|
let t4;
|
|
187
202
|
let t5;
|
|
188
|
-
if ($[
|
|
203
|
+
if ($[9] !== updateStates) {
|
|
189
204
|
t4 = () => {
|
|
190
205
|
updateStates();
|
|
191
206
|
};
|
|
192
207
|
t5 = [updateStates];
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
208
|
+
$[9] = updateStates;
|
|
209
|
+
$[10] = t4;
|
|
210
|
+
$[11] = t5;
|
|
196
211
|
} else {
|
|
197
|
-
t4 = $[
|
|
198
|
-
t5 = $[
|
|
212
|
+
t4 = $[10];
|
|
213
|
+
t5 = $[11];
|
|
199
214
|
}
|
|
200
215
|
useEffect(t4, t5);
|
|
201
216
|
let t6;
|
|
202
217
|
let t7;
|
|
203
|
-
if ($[
|
|
218
|
+
if ($[12] !== editor || $[13] !== updateStates) {
|
|
204
219
|
t6 = () => mergeRegister(editor.registerUpdateListener(() => {
|
|
205
220
|
updateStates();
|
|
206
221
|
}));
|
|
207
222
|
t7 = [editor, updateStates];
|
|
208
|
-
$[
|
|
209
|
-
$[
|
|
210
|
-
$[
|
|
211
|
-
$[
|
|
223
|
+
$[12] = editor;
|
|
224
|
+
$[13] = updateStates;
|
|
225
|
+
$[14] = t6;
|
|
226
|
+
$[15] = t7;
|
|
212
227
|
} else {
|
|
213
|
-
t6 = $[
|
|
214
|
-
t7 = $[
|
|
228
|
+
t6 = $[14];
|
|
229
|
+
t7 = $[15];
|
|
215
230
|
}
|
|
216
231
|
useEffect(t6, t7);
|
|
217
232
|
const t8 = `${groupKey} dropdown`;
|
|
218
233
|
const t9 = `${baseClass}-${groupKey}`;
|
|
219
234
|
let t10;
|
|
220
|
-
if ($[
|
|
235
|
+
if ($[16] !== classNames) {
|
|
221
236
|
t10 = classNames || [];
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
237
|
+
$[16] = classNames;
|
|
238
|
+
$[17] = t10;
|
|
224
239
|
} else {
|
|
225
|
-
t10 = $[
|
|
240
|
+
t10 = $[17];
|
|
226
241
|
}
|
|
227
242
|
let t11;
|
|
228
|
-
if ($[
|
|
243
|
+
if ($[18] !== t9 || $[19] !== t10) {
|
|
229
244
|
t11 = [baseClass, t9, ...t10].filter(Boolean);
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
$[
|
|
245
|
+
$[18] = t9;
|
|
246
|
+
$[19] = t10;
|
|
247
|
+
$[20] = t11;
|
|
233
248
|
} else {
|
|
234
|
-
t11 = $[
|
|
249
|
+
t11 = $[20];
|
|
235
250
|
}
|
|
236
251
|
const t12 = t11.join(" ");
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
$[21] =
|
|
252
|
+
const t13 = !enabledGroup;
|
|
253
|
+
let t14;
|
|
254
|
+
if ($[21] !== itemsContainerClassNames) {
|
|
255
|
+
t14 = itemsContainerClassNames || [];
|
|
256
|
+
$[21] = itemsContainerClassNames;
|
|
257
|
+
$[22] = t14;
|
|
242
258
|
} else {
|
|
243
|
-
|
|
259
|
+
t14 = $[22];
|
|
244
260
|
}
|
|
245
|
-
let
|
|
246
|
-
if ($[
|
|
247
|
-
let
|
|
248
|
-
if ($[
|
|
249
|
-
|
|
261
|
+
let t15;
|
|
262
|
+
if ($[23] !== t14 || $[24] !== items || $[25] !== activeItemKeys || $[26] !== anchorElem || $[27] !== editor || $[28] !== enabledItemKeys || $[29] !== t8 || $[30] !== t12 || $[31] !== t13 || $[32] !== Icon || $[33] !== label || $[34] !== groupKey) {
|
|
263
|
+
let t16;
|
|
264
|
+
if ($[36] !== items || $[37] !== activeItemKeys || $[38] !== anchorElem || $[39] !== editor || $[40] !== enabledItemKeys) {
|
|
265
|
+
t16 = items.length && items.map(item_0 => _jsx(ToolbarItem, {
|
|
250
266
|
active: activeItemKeys.includes(item_0.key),
|
|
251
267
|
anchorElem,
|
|
252
268
|
editor,
|
|
253
269
|
enabled: enabledItemKeys.includes(item_0.key),
|
|
254
270
|
item: item_0
|
|
255
271
|
}, item_0.key));
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
272
|
+
$[36] = items;
|
|
273
|
+
$[37] = activeItemKeys;
|
|
274
|
+
$[38] = anchorElem;
|
|
275
|
+
$[39] = editor;
|
|
276
|
+
$[40] = enabledItemKeys;
|
|
277
|
+
$[41] = t16;
|
|
262
278
|
} else {
|
|
263
|
-
|
|
279
|
+
t16 = $[41];
|
|
264
280
|
}
|
|
265
|
-
|
|
281
|
+
t15 = _jsx(DropDown, {
|
|
266
282
|
buttonAriaLabel: t8,
|
|
267
283
|
buttonClassName: t12,
|
|
284
|
+
disabled: t13,
|
|
268
285
|
Icon,
|
|
269
|
-
itemsContainerClassNames: [`${baseClass}-items`, ...
|
|
286
|
+
itemsContainerClassNames: [`${baseClass}-items`, ...t14],
|
|
270
287
|
label,
|
|
271
|
-
children:
|
|
288
|
+
children: t16
|
|
272
289
|
}, groupKey);
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
$[
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
290
|
+
$[23] = t14;
|
|
291
|
+
$[24] = items;
|
|
292
|
+
$[25] = activeItemKeys;
|
|
293
|
+
$[26] = anchorElem;
|
|
294
|
+
$[27] = editor;
|
|
295
|
+
$[28] = enabledItemKeys;
|
|
296
|
+
$[29] = t8;
|
|
297
|
+
$[30] = t12;
|
|
298
|
+
$[31] = t13;
|
|
299
|
+
$[32] = Icon;
|
|
300
|
+
$[33] = label;
|
|
301
|
+
$[34] = groupKey;
|
|
302
|
+
$[35] = t15;
|
|
285
303
|
} else {
|
|
286
|
-
|
|
304
|
+
t15 = $[35];
|
|
287
305
|
}
|
|
288
|
-
return
|
|
306
|
+
return t15;
|
|
289
307
|
};
|
|
290
308
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","useCallback","useEffect","baseClass","mergeRegister","useTranslation","$getSelection","useEditorConfigContext","DropDown","DropDownItem","ToolbarItem","t0","$","active","anchorElem","editor","enabled","item","i18n","field","t1","richTextComponentMap","Component","t2","_jsx","key","title","label","length","substring","ChildComponent","t3","_jsxs","children","className","ToolbarDropdown","classNames","groupKey","Icon","items","itemsContainerClassNames","maxActiveItems","onActiveChange","Symbol","for","activeItemKeys","setActiveItemKeys","useState","enabledItemKeys","setEnabledItemKeys","editorConfigContext","getEditorState","read","selection","_activeItemKeys","_activeItems","_enabledItemKeys","isActive","push","isEnabled","activeItems","updateStates","t4","t5","t6","t7","registerUpdateListener","t8","t9","t10","t11","filter","Boolean","t12","join","t13","t14","t15","map","item_0","includes","buttonAriaLabel","buttonClassName"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"sourcesContent":["'use client'\nimport React, { useCallback, useEffect } from 'react'\n\nconst baseClass = 'toolbar-popup__dropdown'\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { mergeRegister } from '@lexical/utils'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $getSelection } from 'lexical'\n\nimport type { ToolbarGroupItem } from '../../types.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { DropDown, DropDownItem } from './DropDown.js'\nimport './index.scss'\n\nconst ToolbarItem = ({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n}) => {\n const { i18n } = useTranslation()\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component\n active={active}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabled}\n item={item}\n key={item.key}\n />\n )\n )\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function' ? item.label({ i18n, richTextComponentMap }) : 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 <DropDownItem active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n {item?.ChildComponent && <item.ChildComponent />}\n <span className=\"text\">{title}</span>\n </DropDownItem>\n )\n}\n\nexport const ToolbarDropdown = ({\n anchorElem,\n classNames,\n editor,\n groupKey,\n Icon,\n items,\n itemsContainerClassNames,\n label,\n maxActiveItems,\n onActiveChange,\n}: {\n anchorElem: HTMLElement\n classNames?: string[]\n editor: LexicalEditor\n groupKey: string\n Icon?: React.FC\n items: ToolbarGroupItem[]\n itemsContainerClassNames?: string[]\n label?: string\n /**\n * Maximum number of active items allowed. This is a performance optimization to prevent\n * unnecessary item active checks when the maximum number of active items is reached.\n */\n maxActiveItems?: number\n onActiveChange?: ({ activeItems }: { activeItems: ToolbarGroupItem[] }) => void\n}) => {\n const [activeItemKeys, setActiveItemKeys] = React.useState<string[]>([])\n const [enabledItemKeys, setEnabledItemKeys] = React.useState<string[]>([])\n const editorConfigContext = useEditorConfigContext()\n\n const updateStates = useCallback(() => {\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n\n const _activeItemKeys: string[] = []\n const _activeItems: ToolbarGroupItem[] = []\n const _enabledItemKeys: string[] = []\n\n for (const item of items) {\n if (item.isActive && (!maxActiveItems || _activeItemKeys.length < maxActiveItems)) {\n const isActive = item.isActive({ editor, editorConfigContext, selection })\n if (isActive) {\n _activeItemKeys.push(item.key)\n _activeItems.push(item)\n }\n }\n if (item.isEnabled) {\n const isEnabled = item.isEnabled({ editor, editorConfigContext, selection })\n if (isEnabled) {\n _enabledItemKeys.push(item.key)\n }\n } else {\n _enabledItemKeys.push(item.key)\n }\n }\n setActiveItemKeys(_activeItemKeys)\n setEnabledItemKeys(_enabledItemKeys)\n\n if (onActiveChange) {\n onActiveChange({ activeItems: _activeItems })\n }\n })\n }, [editor, editorConfigContext, items, maxActiveItems, onActiveChange])\n\n useEffect(() => {\n updateStates()\n }, [updateStates])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updateStates()\n }),\n )\n }, [editor, updateStates])\n\n return (\n <DropDown\n buttonAriaLabel={`${groupKey} dropdown`}\n buttonClassName={[baseClass, `${baseClass}-${groupKey}`, ...(classNames || [])]\n .filter(Boolean)\n .join(' ')}\n Icon={Icon}\n itemsContainerClassNames={[`${baseClass}-items`, ...(itemsContainerClassNames || [])]}\n key={groupKey}\n label={label}\n >\n {items.length &&\n items.map((item) => {\n return (\n <ToolbarItem\n active={activeItemKeys.includes(item.key)}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabledItemKeys.includes(item.key)}\n item={item}\n key={item.key}\n />\n )\n })}\n </DropDown>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAE9C,MAAMC,SAAA,GAAY;AAIlB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAI9B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,QAAQ,EAAEC,YAAY,QAAQ;AAGvC,MAAMC,WAAA,GAAcC,EAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EAAC;IAAAc,MAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC;EAAA,IAAAN,EAYpB;EACC;IAAAO;EAAA,IAAiBb,cAAA;EACjB;IAAAc,KAAA,EAAAC;EAAA,IAEIb,sBAAA;EADK;IAAAc;EAAA,IAAAD,EAAwB;EAAA,IAG7BH,IAAA,CAAAK,SAAA;IAAA,IAAAC,EAAA;IAAA,IAAAX,CAAA,QAAAK,IAAA,IAAAL,CAAA,QAAAC,MAAA,IAAAD,CAAA,QAAAE,UAAA,IAAAF,CAAA,QAAAG,MAAA,IAAAH,CAAA,QAAAI,OAAA;MAEAO,EAAA,GAAAN,IAAA,EAAAK,SAAA,IACEE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ect","baseClass","mergeRegister","useTranslation","$getSelection","useEditorConfigContext","DropDown","DropDownItem","ToolbarItem","t0","$","active","anchorElem","editor","enabled","item","i18n","field","t1","richTextComponentMap","Component","t2","_jsx","key","title","label","length","substring","ChildComponent","t3","_jsxs","children","className","ToolbarDropdown","classNames","group","Icon","itemsContainerClassNames","maxActiveItems","onActiveChange","Symbol","for","activeItemKeys","setActiveItemKeys","useState","enabledItemKeys","setEnabledItemKeys","enabledGroup","setEnabledGroup","editorConfigContext","items","groupKey","getEditorState","read","selection","_activeItemKeys","_activeItems","_enabledItemKeys","isActive","push","isEnabled","activeItems","updateStates","t4","t5","t6","t7","registerUpdateListener","t8","t9","t10","t11","filter","Boolean","t12","join","t13","t14","t15","t16","map","item_0","includes","buttonAriaLabel","buttonClassName","disabled"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"sourcesContent":["'use client'\nimport React, { useCallback, useEffect } from 'react'\n\nconst baseClass = 'toolbar-popup__dropdown'\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { mergeRegister } from '@lexical/utils'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $getSelection } from 'lexical'\n\nimport type { ToolbarDropdownGroup, ToolbarGroupItem } from '../../types.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { DropDown, DropDownItem } from './DropDown.js'\nimport './index.scss'\n\nconst ToolbarItem = ({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n}) => {\n const { i18n } = useTranslation()\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component\n active={active}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabled}\n item={item}\n key={item.key}\n />\n )\n )\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function' ? item.label({ i18n, richTextComponentMap }) : 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 <DropDownItem active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n {item?.ChildComponent && <item.ChildComponent />}\n <span className=\"text\">{title}</span>\n </DropDownItem>\n )\n}\n\nexport const ToolbarDropdown = ({\n anchorElem,\n classNames,\n editor,\n group,\n Icon,\n itemsContainerClassNames,\n label,\n maxActiveItems,\n onActiveChange,\n}: {\n anchorElem: HTMLElement\n classNames?: string[]\n editor: LexicalEditor\n group: ToolbarDropdownGroup\n Icon?: React.FC\n itemsContainerClassNames?: string[]\n label?: string\n /**\n * Maximum number of active items allowed. This is a performance optimization to prevent\n * unnecessary item active checks when the maximum number of active items is reached.\n */\n maxActiveItems?: number\n onActiveChange?: ({ activeItems }: { activeItems: ToolbarGroupItem[] }) => void\n}) => {\n const [activeItemKeys, setActiveItemKeys] = React.useState<string[]>([])\n const [enabledItemKeys, setEnabledItemKeys] = React.useState<string[]>([])\n const [enabledGroup, setEnabledGroup] = React.useState<boolean>(true)\n const editorConfigContext = useEditorConfigContext()\n const { items, key: groupKey } = group\n\n const updateStates = useCallback(() => {\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!selection) {\n return\n }\n\n const _activeItemKeys: string[] = []\n const _activeItems: ToolbarGroupItem[] = []\n const _enabledItemKeys: string[] = []\n\n for (const item of items) {\n if (item.isActive && (!maxActiveItems || _activeItemKeys.length < maxActiveItems)) {\n const isActive = item.isActive({ editor, editorConfigContext, selection })\n if (isActive) {\n _activeItemKeys.push(item.key)\n _activeItems.push(item)\n }\n }\n if (item.isEnabled) {\n const isEnabled = item.isEnabled({ editor, editorConfigContext, selection })\n if (isEnabled) {\n _enabledItemKeys.push(item.key)\n }\n } else {\n _enabledItemKeys.push(item.key)\n }\n }\n if (group.isEnabled) {\n setEnabledGroup(group.isEnabled({ editor, editorConfigContext, selection }))\n }\n setActiveItemKeys(_activeItemKeys)\n setEnabledItemKeys(_enabledItemKeys)\n\n if (onActiveChange) {\n onActiveChange({ activeItems: _activeItems })\n }\n })\n }, [editor, editorConfigContext, group, items, maxActiveItems, onActiveChange])\n\n useEffect(() => {\n updateStates()\n }, [updateStates])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updateStates()\n }),\n )\n }, [editor, updateStates])\n\n return (\n <DropDown\n buttonAriaLabel={`${groupKey} dropdown`}\n buttonClassName={[baseClass, `${baseClass}-${groupKey}`, ...(classNames || [])]\n .filter(Boolean)\n .join(' ')}\n disabled={!enabledGroup}\n Icon={Icon}\n itemsContainerClassNames={[`${baseClass}-items`, ...(itemsContainerClassNames || [])]}\n key={groupKey}\n label={label}\n >\n {items.length &&\n items.map((item) => {\n return (\n <ToolbarItem\n active={activeItemKeys.includes(item.key)}\n anchorElem={anchorElem}\n editor={editor}\n enabled={enabledItemKeys.includes(item.key)}\n item={item}\n key={item.key}\n />\n )\n })}\n </DropDown>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAE9C,MAAMC,SAAA,GAAY;AAIlB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAI9B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,QAAQ,EAAEC,YAAY,QAAQ;AAGvC,MAAMC,WAAA,GAAcC,EAAA;EAAA,MAAAC,CAAA,GAAAb,EAAA;EAAC;IAAAc,MAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC;EAAA,IAAAN,EAYpB;EACC;IAAAO;EAAA,IAAiBb,cAAA;EACjB;IAAAc,KAAA,EAAAC;EAAA,IAEIb,sBAAA;EADK;IAAAc;EAAA,IAAAD,EAAwB;EAAA,IAG7BH,IAAA,CAAAK,SAAA;IAAA,IAAAC,EAAA;IAAA,IAAAX,CAAA,QAAAK,I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,wBAAA,GAEgB,GAAApC,SAAA,QAAoB,KAAM4E,GAA8B;MAAApD,KAAA;MAAAM,QAAA,EAIlFgD;IAYC,GAfG5B,QAAA;IAAAzC,CAAA,OAAAmE,GAAA;IAAAnE,CAAA,OAAAwC,KAAA;IAAAxC,CAAA,OAAAgC,cAAA;IAAAhC,CAAA,OAAAE,UAAA;IAAAF,CAAA,OAAAG,MAAA;IAAAH,CAAA,OAAAmC,eAAA;IAAAnC,CAAA,OAAA0D,EAAA;IAAA1D,CAAA,OAAAgE,GAAA;IAAAhE,CAAA,OAAAkE,GAAA;IAAAlE,CAAA,OAAA0B,IAAA;IAAA1B,CAAA,OAAAe,KAAA;IAAAf,CAAA,OAAAyC,QAAA;IAAAzC,CAAA,OAAAoE,GAAA;EAAA;IAAAA,GAAA,GAAApE,CAAA;EAAA;EAAA,OARPoE,GAQO;AAAA,CAkBX","ignoreList":[]}
|
|
@@ -2,7 +2,20 @@ import type { I18nClient } from '@payloadcms/translations';
|
|
|
2
2
|
import type { BaseSelection, LexicalEditor } from 'lexical';
|
|
3
3
|
import type React from 'react';
|
|
4
4
|
import type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js';
|
|
5
|
-
export type ToolbarGroup =
|
|
5
|
+
export type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup;
|
|
6
|
+
export type ToolbarDropdownGroup = {
|
|
7
|
+
/**
|
|
8
|
+
* The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.
|
|
9
|
+
*/
|
|
10
|
+
ChildComponent?: React.FC;
|
|
11
|
+
/**
|
|
12
|
+
* This is optional and controls if the toolbar group is highlighted or not.
|
|
13
|
+
*/
|
|
14
|
+
isEnabled?: ({ editor, editorConfigContext, selection, }: {
|
|
15
|
+
editor: LexicalEditor;
|
|
16
|
+
editorConfigContext: EditorConfigContextType;
|
|
17
|
+
selection: BaseSelection;
|
|
18
|
+
}) => boolean;
|
|
6
19
|
/**
|
|
7
20
|
* All toolbar items part of this toolbar group need to be added here.
|
|
8
21
|
*/
|
|
@@ -16,14 +29,11 @@ export type ToolbarGroup = {
|
|
|
16
29
|
*/
|
|
17
30
|
order?: number;
|
|
18
31
|
/**
|
|
19
|
-
* Controls the toolbar group type. Set to `
|
|
20
|
-
*/
|
|
21
|
-
type: 'buttons';
|
|
22
|
-
} | {
|
|
23
|
-
/**
|
|
24
|
-
* The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.
|
|
32
|
+
* Controls the toolbar group type. Set to `dropdown` to create a buttons toolbar group, which displays toolbar items vertically using their icons and labels, if the dropdown is open.
|
|
25
33
|
*/
|
|
26
|
-
|
|
34
|
+
type: 'dropdown';
|
|
35
|
+
};
|
|
36
|
+
export type ToolbarButtonsGroup = {
|
|
27
37
|
/**
|
|
28
38
|
* All toolbar items part of this toolbar group need to be added here.
|
|
29
39
|
*/
|
|
@@ -37,9 +47,9 @@ export type ToolbarGroup = {
|
|
|
37
47
|
*/
|
|
38
48
|
order?: number;
|
|
39
49
|
/**
|
|
40
|
-
* Controls the toolbar group type. Set to `
|
|
50
|
+
* Controls the toolbar group type. Set to `buttons` to create a buttons toolbar group, which displays toolbar items horizontally using only their icons.
|
|
41
51
|
*/
|
|
42
|
-
type: '
|
|
52
|
+
type: 'buttons';
|
|
43
53
|
};
|
|
44
54
|
export type ToolbarGroupItem = {
|
|
45
55
|
/** A React component which is rendered within your toolbar item's default button component. Usually, you want this to be an icon. */
|
|
@@ -69,7 +79,7 @@ export type ToolbarGroupItem = {
|
|
|
69
79
|
/** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */
|
|
70
80
|
label?: ((args: {
|
|
71
81
|
i18n: I18nClient<{}, string>;
|
|
72
|
-
richTextComponentMap
|
|
82
|
+
richTextComponentMap?: Map<string, React.ReactNode>;
|
|
73
83
|
}) => string) | string;
|
|
74
84
|
/** Each toolbar item needs to have a unique key. */
|
|
75
85
|
onSelect?: ({ editor, isActive }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/toolbars/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAElG,MAAM,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/toolbars/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC3D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qDAAqD,CAAA;AAElG,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,oBAAoB,CAAA;AAErE,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACzB;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,EACX,MAAM,EACN,mBAAmB,EACnB,SAAS,GACV,EAAE;QACD,MAAM,EAAE,aAAa,CAAA;QACrB,mBAAmB,EAAE,uBAAuB,CAAA;QAC5C,SAAS,EAAE,aAAa,CAAA;KACzB,KAAK,OAAO,CAAA;IACb;;OAEG;IACH,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAC9B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAA;IACX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;OAEG;IACH,IAAI,EAAE,UAAU,CAAA;CACjB,CAA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AAS,CAAC,CAAA;KACpD,KAAK,MAAM,CAAC,GACb,MAAM,CAAA;IACV,oDAAoD;IACpD,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE;QAAE,MAAM,EAAE,aAAa,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;IACvF,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/features/toolbars/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\nimport type React from 'react'\n\nimport type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport type ToolbarGroup
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/features/toolbars/types.ts"],"sourcesContent":["import type { I18nClient } from '@payloadcms/translations'\nimport type { BaseSelection, LexicalEditor } from 'lexical'\nimport type React from 'react'\n\nimport type { EditorConfigContextType } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport type ToolbarGroup = ToolbarButtonsGroup | ToolbarDropdownGroup\n\nexport type ToolbarDropdownGroup = {\n /**\n * The dropdown toolbar ChildComponent allows you to pass in a React Component which will be displayed within the dropdown button.\n */\n ChildComponent?: React.FC\n /**\n * This is optional and controls if the toolbar group is highlighted or not.\n */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `dropdown` to create a buttons toolbar group, which displays toolbar items vertically using their icons and labels, if the dropdown is open.\n */\n type: 'dropdown'\n}\n\nexport type ToolbarButtonsGroup = {\n /**\n * All toolbar items part of this toolbar group need to be added here.\n */\n items: Array<ToolbarGroupItem>\n /**\n * Each toolbar group needs to have a unique key. Groups with the same keys will have their items merged together.\n */\n key: string\n /**\n * Determines where the toolbar group will be.\n */\n order?: number\n /**\n * Controls the toolbar group type. Set to `buttons` to create a buttons toolbar group, which displays toolbar items horizontally using only their icons.\n */\n type: 'buttons'\n}\n\nexport type ToolbarGroupItem = {\n /** A React component which is rendered within your toolbar item's default button component. Usually, you want this to be an icon. */\n ChildComponent?: React.FC\n /** A React component which is rendered in place of the toolbar item's default button component, thus completely replacing it. The `ChildComponent` and `onSelect` properties will be ignored. */\n Component?: React.FC<{\n active?: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n }>\n /** This is optional and controls if the toolbar item is highlighted or not. */\n isActive?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** This is optional and controls if the toolbar item is clickable or not. If `false` is returned here, it will be grayed out and unclickable. */\n isEnabled?: ({\n editor,\n editorConfigContext,\n selection,\n }: {\n editor: LexicalEditor\n editorConfigContext: EditorConfigContextType\n selection: BaseSelection\n }) => boolean\n /** Each toolbar item needs to have a unique key. */\n key: string\n /** The label will be displayed in your toolbar item, if it's within a dropdown group. In order to make use of i18n, this can be a function. */\n label?:\n | ((args: {\n i18n: I18nClient<{}, string>\n richTextComponentMap?: Map<string, React.ReactNode>\n }) => string)\n | string\n /** Each toolbar item needs to have a unique key. */\n onSelect?: ({ editor, isActive }: { editor: LexicalEditor; isActive: boolean }) => void\n order?: number\n}\n"],"mappings":"AA8DA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typesServer.d.ts","sourceRoot":"","sources":["../../src/features/typesServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE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AI;IAC3D,aAAa,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAA;IACnF;;OAEG;IACH,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"typesServer.d.ts","sourceRoot":"","sources":["../../src/features/typesServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EACV,KAAK,EACL,WAAW,EACX,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,MAAM,EACN,KAAK,EACL,UAAU,EACV,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,cAAc,EACd,aAAa,EACb,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AACpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAE9D,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI,CAAC,EACxF,OAAO,EACP,YAAY,EACZ,KAAK,EACL,KAAK,EACL,wBAAwB,EACxB,KAAK,EACL,aAAa,EACb,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,cAAc,EACd,kBAAkB,EAClB,GAAG,EACH,gBAAgB,EAChB,UAAU,GACX,EAAE;IACD,OAAO,EAAE,cAAc,CAAA;IACv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EAAE,KAAK,CAAC,mBAAmB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QAC5E,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QACxE,YAAY,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;QAC9E,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;KACnF,CAAA,CAAC,yDAAyD;IAC3D,kDAAkD;IAClD,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAA;CAChD,GAAG,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,sBAAsB,GAAG,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typesServer.js","names":[],"sources":["../../src/features/typesServer.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { GenericLanguages, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type {\n Klass,\n LexicalNode,\n LexicalNodeReplacement,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n Config,\n Field,\n JsonObject,\n Payload,\n PayloadComponent,\n PayloadRequest,\n ReplaceAny,\n RequestContext,\n RichTextField,\n RichTextHooks,\n SanitizedConfig,\n ValidateOptions,\n} from 'payload'\n\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\nimport type { AdapterProps } from '../types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\nimport type { BaseClientFeatureProps } from './typesClient.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = (\n props?: UnSanitizedServerFeatureProps,\n) => FeatureProviderServer<UnSanitizedServerFeatureProps, ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first, but they have to exist, otherwise an error will be thrown. */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first AND have to exist, otherwise an error will be thrown. They will be available in the `feature` property. */\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. These are optional. Payload will attempt to load them before this feature, but doesn't throw an error if that's not possible. */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n parentIsLocalized: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>)\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: UnSanitizedServerFeatureProps\n}\n\nexport type AfterReadNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `afterRead` hooks.\n */\n currentDepth: number\n /**\n * Only available in `afterRead` hooks.\n */\n depth: number\n draft: boolean\n fallbackLocale: string\n /**\n * Only available in `afterRead` field hooks.\n */\n fieldPromises: Promise<void>[]\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany: boolean\n flattenLocales: boolean\n /**\n * The requested locale.\n */\n locale: string\n overrideAccess: boolean\n /**\n * Only available in `afterRead` field hooks.\n */\n populationPromises: Promise<void>[]\n /**\n * Only available in `afterRead` hooks.\n */\n showHiddenFields: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerAccessControl: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerHooks: boolean\n}\n\nexport type AfterChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n}\nexport type BeforeValidateNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n overrideAccess: boolean\n}\n\nexport type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `beforeChange` hooks.\n */\n errors: { field: string; message: string }[]\n mergeLocaleActions: (() => Promise<void>)[]\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n /**\n * The original node with locales (not modified by any hooks).\n */\n originalNodeWithLocales?: T\n skipValidation: boolean\n}\n\nexport type BaseNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** The value of the node. */\n node: T\n parentRichTextFieldPath: (number | string)[]\n parentRichTextFieldSchemaPath: string[]\n /** The payload request object. It is mocked for Local API operations. */\n req: PayloadRequest\n}\n\nexport type AfterReadNodeHook<T extends SerializedLexicalNode> = (\n args: AfterReadNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type AfterChangeNodeHook<T extends SerializedLexicalNode> = (\n args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n /**\n * Allows you to define how a node can be serialized into different formats. Currently, only supports html.\n * Markdown converters are defined in `markdownTransformers` and not here.\n */\n converters?: {\n html?: HTMLConverter<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n }\n /**\n * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload\n * automatically populate, run hooks, and generate component import maps for them\n */\n getSubFields?: (args: {\n /**\n * Optional. If not provided, all possible sub-fields should be returned.\n */\n node?: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req?: PayloadRequest\n }) => Field[] | null\n /**\n * If a node includes sub-fields, the sub-fields data needs to be returned here, alongside `getSubFields` which returns their schema.\n */\n getSubFieldsData?: (args: {\n node: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req: PayloadRequest\n }) => JsonObject\n /**\n * Allows you to run population logic when a node's data was requested from graphQL.\n * While `getSubFields` and `getSubFieldsData` automatically handle populating sub-fields (since they run hooks on them), those are only populated in the Rest API.\n * This is because the Rest API hooks do not have access to the 'depth' property provided by graphQL.\n * In order for them to be populated correctly in graphQL, the population logic needs to be provided here.\n */\n graphQLPopulationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n /**\n * Just like payload fields, you can provide hooks which are run for this specific node. These are called Node Hooks.\n */\n hooks?: {\n afterChange?: Array<AfterChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<AfterReadNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<\n BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n }\n /**\n * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).\n */\n node: Klass<T> | LexicalNodeReplacement\n /**\n * This allows you to provide node validations, which are run when your document is being validated, alongside other payload fields.\n * You can use it to throw a validation error for a specific node in case its data is incorrect.\n */\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientFeature?: PayloadComponent<never, BaseClientFeatureProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n componentImports?: Config['admin']['importMap']['generators'][0] | PayloadComponent[]\n componentMap?:\n | ((args: { i18n: I18nClient; payload: Payload; props: ServerProps; schemaPath: string }) => {\n [key: string]: PayloadComponent\n })\n | {\n [key: string]: PayloadComponent\n }\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18nClient\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]> | null\n hooks?: RichTextHooks\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: Transformer[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n sanitizedServerFeatureProps?: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = {\n order: number\n} & Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n> &\n ServerFeature<ServerProps, ClientFeatureProps>\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<any, any>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, any, any>>\n\nexport type SanitizedServerFeatures = {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n getSubFields?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => Field[] | null\n >\n getSubFieldsData?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => JsonObject\n >\n graphQLPopulationPromises: Map<string, Array<PopulationPromise>>\n hooks: RichTextHooks\n nodeHooks?: {\n afterChange?: Map<string, Array<AfterChangeNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<AfterReadNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<BeforeChangeNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<BeforeValidateNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n} & Required<Pick<ResolvedServerFeature<any, any>, 'i18n' | 'markdownTransformers' | 'nodes'>>\n"],"mappings":"AAgXA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"typesServer.js","names":[],"sources":["../../src/features/typesServer.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { GenericLanguages, I18nClient } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type {\n Klass,\n LexicalNode,\n LexicalNodeReplacement,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n Config,\n Field,\n JsonObject,\n Payload,\n PayloadComponent,\n PayloadRequest,\n ReplaceAny,\n RequestContext,\n RichTextField,\n RichTextHooks,\n SanitizedConfig,\n ValidateOptions,\n} from 'payload'\n\nimport type { ServerEditorConfig } from '../lexical/config/types.js'\nimport type { AdapterProps } from '../types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\nimport type { BaseClientFeatureProps } from './typesClient.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n draft,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n draft: boolean\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * fieldPromises are used for things like field hooks. They will be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: JsonObject\n}) => void\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField, SerializedEditorState>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = (\n props?: UnSanitizedServerFeatureProps,\n) => FeatureProviderServer<UnSanitizedServerFeatureProps, ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<\n UnSanitizedServerFeatureProps = undefined,\n ServerFeatureProps = UnSanitizedServerFeatureProps,\n ClientFeatureProps = undefined,\n> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first, but they have to exist, otherwise an error will be thrown. */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first AND have to exist, otherwise an error will be thrown. They will be available in the `feature` property. */\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. These are optional. Payload will attempt to load them before this feature, but doesn't throw an error if that's not possible. */\n dependenciesSoft?: string[]\n\n /**\n * This is being called during the payload sanitization process\n */\n feature:\n | ((props: {\n config: SanitizedConfig\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n isRoot?: boolean\n parentIsLocalized: boolean\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) =>\n | Promise<ServerFeature<ServerFeatureProps, ClientFeatureProps>>\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>)\n | ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: UnSanitizedServerFeatureProps\n}\n\nexport type AfterReadNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `afterRead` hooks.\n */\n currentDepth: number\n /**\n * Only available in `afterRead` hooks.\n */\n depth: number\n draft: boolean\n fallbackLocale: string\n /**\n * Only available in `afterRead` field hooks.\n */\n fieldPromises: Promise<void>[]\n /** Boolean to denote if this hook is running against finding one, or finding many within the afterRead hook. */\n findMany: boolean\n flattenLocales: boolean\n /**\n * The requested locale.\n */\n locale: string\n overrideAccess: boolean\n /**\n * Only available in `afterRead` field hooks.\n */\n populationPromises: Promise<void>[]\n /**\n * Only available in `afterRead` hooks.\n */\n showHiddenFields: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerAccessControl: boolean\n /**\n * Only available in `afterRead` hooks.\n */\n triggerHooks: boolean\n}\n\nexport type AfterChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n}\nexport type BeforeValidateNodeHookArgs<T extends SerializedLexicalNode> = {\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n overrideAccess: boolean\n}\n\nexport type BeforeChangeNodeHookArgs<T extends SerializedLexicalNode> = {\n /**\n * Only available in `beforeChange` hooks.\n */\n errors: { field: string; message: string }[]\n mergeLocaleActions: (() => Promise<void>)[]\n /** A string relating to which operation the field type is currently executing within. Useful within beforeValidate, beforeChange, and afterChange hooks to differentiate between create and update operations. */\n operation: 'create' | 'delete' | 'read' | 'update'\n /** The value of the node before any changes. Not available in afterRead hooks */\n originalNode: T\n /**\n * The original node with locales (not modified by any hooks).\n */\n originalNodeWithLocales?: T\n skipValidation: boolean\n}\n\nexport type BaseNodeHookArgs<T extends SerializedLexicalNode> = {\n context: RequestContext\n /** The value of the node. */\n node: T\n parentRichTextFieldPath: (number | string)[]\n parentRichTextFieldSchemaPath: string[]\n /** The payload request object. It is mocked for Local API operations. */\n req: PayloadRequest\n}\n\nexport type AfterReadNodeHook<T extends SerializedLexicalNode> = (\n args: AfterReadNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type AfterChangeNodeHook<T extends SerializedLexicalNode> = (\n args: AfterChangeNodeHookArgs<T> & BaseNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeChangeNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeChangeNodeHookArgs<T>,\n) => Promise<T> | T\n\nexport type BeforeValidateNodeHook<T extends SerializedLexicalNode> = (\n args: BaseNodeHookArgs<T> & BeforeValidateNodeHookArgs<T>,\n) => Promise<T> | T\n\n// Define the node with hooks that use the node's exportJSON return type\nexport type NodeWithHooks<T extends LexicalNode = any> = {\n /**\n * Allows you to define how a node can be serialized into different formats. Currently, only supports html.\n * Markdown converters are defined in `markdownTransformers` and not here.\n */\n converters?: {\n html?: HTMLConverter<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n }\n /**\n * If a node includes sub-fields (e.g. block and link nodes), passing those subFields here will make payload\n * automatically populate, run hooks, and generate component import maps for them\n */\n getSubFields?: (args: {\n /**\n * Optional. If not provided, all possible sub-fields should be returned.\n */\n node?: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req?: PayloadRequest\n }) => Field[] | null\n /**\n * If a node includes sub-fields, the sub-fields data needs to be returned here, alongside `getSubFields` which returns their schema.\n */\n getSubFieldsData?: (args: {\n node: ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>\n req: PayloadRequest\n }) => JsonObject\n /**\n * Allows you to run population logic when a node's data was requested from graphQL.\n * While `getSubFields` and `getSubFieldsData` automatically handle populating sub-fields (since they run hooks on them), those are only populated in the Rest API.\n * This is because the Rest API hooks do not have access to the 'depth' property provided by graphQL.\n * In order for them to be populated correctly in graphQL, the population logic needs to be provided here.\n */\n graphQLPopulationPromises?: Array<\n PopulationPromise<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n /**\n * Just like payload fields, you can provide hooks which are run for this specific node. These are called Node Hooks.\n */\n hooks?: {\n afterChange?: Array<AfterChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n afterRead?: Array<AfterReadNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeChange?: Array<BeforeChangeNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n beforeValidate?: Array<\n BeforeValidateNodeHook<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>\n >\n }\n /**\n * The actual lexical node needs to be provided here. This also supports [lexical node replacements](https://lexical.dev/docs/concepts/node-replacement).\n */\n node: Klass<T> | LexicalNodeReplacement\n /**\n * This allows you to provide node validations, which are run when your document is being validated, alongside other payload fields.\n * You can use it to throw a validation error for a specific node in case its data is incorrect.\n */\n validations?: Array<NodeValidation<ReturnType<ReplaceAny<T, LexicalNode>['exportJSON']>>>\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientFeature?: PayloadComponent<never, BaseClientFeatureProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n // @ts-expect-error - TODO: fix this\n componentImports?: Config['admin']['importMap']['generators'][0] | PayloadComponent[]\n componentMap?:\n | ((args: { i18n: I18nClient; payload: Payload; props: ServerProps; schemaPath: string }) => {\n [key: string]: PayloadComponent\n })\n | {\n [key: string]: PayloadComponent\n }\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n field: RichTextField\n i18n: I18nClient\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]> | null\n hooks?: RichTextHooks\n /**\n * Here you can provide i18n translations for your feature. These will only be available on the server and client.\n *\n * Translations here are automatically scoped to `lexical.featureKey.yourKey`\n *\n * @Example\n * ```ts\n * i18n: {\n * en: {\n * label: 'Horizontal Rule',\n * },\n * de: {\n * label: 'Trennlinie',\n * },\n * }\n * ```\n * In order to access these translations, you would use `i18n.t('lexical:horizontalRule:label')`.\n */\n i18n?: Partial<GenericLanguages>\n markdownTransformers?: Transformer[]\n nodes?: Array<NodeWithHooks>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n sanitizedServerFeatureProps?: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = {\n order: number\n} & Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n> &\n ServerFeature<ServerProps, ClientFeatureProps>\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<any, any>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<any, any, any>>\n\nexport type SanitizedServerFeatures = {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n /** The node types mapped to their hooks */\n\n getSubFields?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => Field[] | null\n >\n getSubFieldsData?: Map<\n string,\n (args: { node: SerializedLexicalNode; req: PayloadRequest }) => JsonObject\n >\n graphQLPopulationPromises: Map<string, Array<PopulationPromise>>\n hooks: RichTextHooks\n nodeHooks?: {\n afterChange?: Map<string, Array<AfterChangeNodeHook<SerializedLexicalNode>>>\n afterRead?: Map<string, Array<AfterReadNodeHook<SerializedLexicalNode>>>\n beforeChange?: Map<string, Array<BeforeChangeNodeHook<SerializedLexicalNode>>>\n beforeValidate?: Map<string, Array<BeforeValidateNodeHook<SerializedLexicalNode>>>\n } /** The node types mapped to their populationPromises */\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n} & Required<Pick<ResolvedServerFeature<any, any>, 'i18n' | 'markdownTransformers' | 'nodes'>>\n"],"mappings":"AAiXA","ignoreList":[]}
|
|
@@ -80,7 +80,7 @@ const Component = props => {
|
|
|
80
80
|
const thumbnailSRC = data?.thumbnailURL || data?.url;
|
|
81
81
|
const removeUpload = useCallback(() => {
|
|
82
82
|
editor.update(() => {
|
|
83
|
-
$getNodeByKey(nodeKey)
|
|
83
|
+
$getNodeByKey(nodeKey)?.remove();
|
|
84
84
|
});
|
|
85
85
|
}, [editor, nodeKey]);
|
|
86
86
|
const updateUpload = useCallback(data_0 => {
|