@payloadcms/richtext-lexical 3.0.0-canary.a5aaf21 → 3.0.0-canary.a7293f6
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-FTWR5YDX.js +2 -0
- package/dist/exports/client/RelationshipComponent-FTWR5YDX.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-PY6JO5OH.js → chunk-32KXGBIQ.js} +2 -2
- package/dist/exports/client/{chunk-PY6JO5OH.js.map → chunk-32KXGBIQ.js.map} +2 -2
- package/dist/exports/client/chunk-6LZZDOEO.js +2 -0
- package/dist/exports/client/chunk-6LZZDOEO.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-GK7ZKYHL.js → chunk-IIWHHN4J.js} +2 -2
- package/dist/exports/client/chunk-IIWHHN4J.js.map +7 -0
- package/dist/exports/client/{chunk-GTKNWSQW.js → chunk-QZNJUROL.js} +2 -2
- package/dist/exports/client/{chunk-GTKNWSQW.js.map → chunk-QZNJUROL.js.map} +2 -2
- package/dist/exports/client/chunk-WAMTSCVM.js +2 -0
- package/dist/exports/client/{chunk-F5DIILW3.js.map → chunk-WAMTSCVM.js.map} +2 -2
- package/dist/exports/client/{chunk-PECDZEZY.js → chunk-XCEM47RI.js} +2 -2
- package/dist/exports/client/{chunk-PECDZEZY.js.map → chunk-XCEM47RI.js.map} +2 -2
- package/dist/exports/client/component-6PBZ2U3Z.js +2 -0
- package/dist/exports/client/component-6PBZ2U3Z.js.map +7 -0
- package/dist/exports/client/component-6Y2K2RNP.js +2 -0
- package/dist/exports/client/component-6Y2K2RNP.js.map +7 -0
- package/dist/exports/client/component-ANB7VZLA.js +2 -0
- package/dist/exports/client/component-ANB7VZLA.js.map +7 -0
- package/dist/exports/client/componentInline-NUDJIIQ4.js +2 -0
- package/dist/exports/client/componentInline-NUDJIIQ4.js.map +7 -0
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- 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 +3 -3
- 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 +14 -11
- 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.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +29 -43
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +39 -39
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +19 -18
- package/dist/features/experimental_table/client/plugins/TablePlugin/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/client/component/index.js +12 -9
- package/dist/features/horizontalRule/client/component/index.js.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 -7
- 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 +18 -13
- 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.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +11 -8
- 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 +67 -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/theme/EditorTheme.d.ts.map +1 -1
- package/dist/lexical/theme/EditorTheme.js +1 -0
- package/dist/lexical/theme/EditorTheme.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 +1 -1
- 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 +30 -30
- 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/RelationshipComponent-Z5SZ5FFT.js.map +0 -7
- package/dist/exports/client/chunk-F5DIILW3.js +0 -2
- 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-ATPITPNI.js +0 -2
- package/dist/exports/client/component-ATPITPNI.js.map +0 -7
- package/dist/exports/client/component-GAX6BHKZ.js +0 -2
- package/dist/exports/client/component-GAX6BHKZ.js.map +0 -7
- package/dist/exports/client/component-M3ZCPXEG.js +0 -2
- package/dist/exports/client/component-M3ZCPXEG.js.map +0 -7
- package/dist/exports/client/componentInline-HAGGWKA7.js +0 -2
- package/dist/exports/client/componentInline-HAGGWKA7.js.map +0 -7
package/dist/field/index.js
CHANGED
|
@@ -37,7 +37,7 @@ export const RichTextField = props => {
|
|
|
37
37
|
if (finalSanitizedEditorConfig) {
|
|
38
38
|
return;
|
|
39
39
|
}
|
|
40
|
-
const clientFeatures = richTextComponentMap
|
|
40
|
+
const clientFeatures = richTextComponentMap?.get("features");
|
|
41
41
|
const featureProvidersLocal = [];
|
|
42
42
|
for (const clientFeature of clientFeatures) {
|
|
43
43
|
featureProvidersLocal.push(clientFeature.clientFeature(clientFeature.clientFeatureProps));
|
package/dist/field/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","ShimmerEffect","React","lazy","Suspense","useEffect","useState","defaultEditorLexicalConfig","loadClientFeatures","sanitizeClientEditorConfig","RichTextEditor","then","module","default","RichText","RichTextField","props","$","admin","t0","field","t1","lexicalEditorConfig","t2","undefined","richTextComponentMap","finalSanitizedEditorConfig","setFinalSanitizedEditorConfig","t3","t4","clientFeatures","get","featureProvidersLocal","clientFeature","push","clientFeatureProps","finalLexicalEditorConfig","resolvedClientFeatures","unSanitizedEditorConfig","features","lexical","t5","_jsx","fallback","height","editorConfig"],"sources":["../../src/field/index.tsx"],"sourcesContent":["'use client'\n\nimport { ShimmerEffect } from '@payloadcms/ui'\nimport React, { lazy, Suspense, useEffect, useState } from 'react'\n\nimport type { FeatureProviderClient } from '../features/typesClient.js'\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { GeneratedFeatureProviderComponent, LexicalRichTextFieldProps } from '../types.js'\n\nimport { defaultEditorLexicalConfig } from '../lexical/config/client/default.js'\nimport { loadClientFeatures } from '../lexical/config/client/loader.js'\nimport { sanitizeClientEditorConfig } from '../lexical/config/client/sanitize.js'\n\nconst RichTextEditor = lazy(() =>\n import('./Field.js').then((module) => ({ default: module.RichText })),\n)\n\nexport const RichTextField: React.FC<LexicalRichTextFieldProps> = (props) => {\n const {\n admin = {},\n field: { richTextComponentMap },\n lexicalEditorConfig,\n } = props\n\n const [finalSanitizedEditorConfig, setFinalSanitizedEditorConfig] =\n useState<SanitizedClientEditorConfig>(null)\n\n useEffect(() => {\n if (finalSanitizedEditorConfig) {\n return\n }\n const clientFeatures: GeneratedFeatureProviderComponent[] = richTextComponentMap
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","ShimmerEffect","React","lazy","Suspense","useEffect","useState","defaultEditorLexicalConfig","loadClientFeatures","sanitizeClientEditorConfig","RichTextEditor","then","module","default","RichText","RichTextField","props","$","admin","t0","field","t1","lexicalEditorConfig","t2","undefined","richTextComponentMap","finalSanitizedEditorConfig","setFinalSanitizedEditorConfig","t3","t4","clientFeatures","get","featureProvidersLocal","clientFeature","push","clientFeatureProps","finalLexicalEditorConfig","resolvedClientFeatures","unSanitizedEditorConfig","features","lexical","t5","_jsx","fallback","height","editorConfig"],"sources":["../../src/field/index.tsx"],"sourcesContent":["'use client'\n\nimport { ShimmerEffect } from '@payloadcms/ui'\nimport React, { lazy, Suspense, useEffect, useState } from 'react'\n\nimport type { FeatureProviderClient } from '../features/typesClient.js'\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { GeneratedFeatureProviderComponent, LexicalRichTextFieldProps } from '../types.js'\n\nimport { defaultEditorLexicalConfig } from '../lexical/config/client/default.js'\nimport { loadClientFeatures } from '../lexical/config/client/loader.js'\nimport { sanitizeClientEditorConfig } from '../lexical/config/client/sanitize.js'\n\nconst RichTextEditor = lazy(() =>\n import('./Field.js').then((module) => ({ default: module.RichText })),\n)\n\nexport const RichTextField: React.FC<LexicalRichTextFieldProps> = (props) => {\n const {\n admin = {},\n field: { richTextComponentMap },\n lexicalEditorConfig,\n } = props\n\n const [finalSanitizedEditorConfig, setFinalSanitizedEditorConfig] =\n useState<null | SanitizedClientEditorConfig>(null)\n\n useEffect(() => {\n if (finalSanitizedEditorConfig) {\n return\n }\n const clientFeatures: GeneratedFeatureProviderComponent[] = richTextComponentMap?.get(\n 'features',\n ) as GeneratedFeatureProviderComponent[]\n\n const featureProvidersLocal: FeatureProviderClient<any, any>[] = []\n for (const clientFeature of clientFeatures) {\n featureProvidersLocal.push(clientFeature.clientFeature(clientFeature.clientFeatureProps))\n }\n\n const finalLexicalEditorConfig = lexicalEditorConfig\n ? lexicalEditorConfig\n : defaultEditorLexicalConfig\n\n const resolvedClientFeatures = loadClientFeatures({\n unSanitizedEditorConfig: {\n features: featureProvidersLocal,\n lexical: finalLexicalEditorConfig,\n },\n })\n\n setFinalSanitizedEditorConfig(\n sanitizeClientEditorConfig(resolvedClientFeatures, finalLexicalEditorConfig, admin),\n )\n }, [lexicalEditorConfig, richTextComponentMap, admin, finalSanitizedEditorConfig]) // TODO: Optimize this and use useMemo for this in the future. This might break sub-richtext-blocks from the blocks feature. Need to investigate\n\n return (\n <Suspense fallback={<ShimmerEffect height=\"35vh\" />}>\n {finalSanitizedEditorConfig && (\n <RichTextEditor {...props} editorConfig={finalSanitizedEditorConfig} />\n )}\n </Suspense>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,aAAa,QAAQ;AAC9B,OAAOC,KAAA,IAASC,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,QAAQ;AAM3D,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,0BAA0B,QAAQ;AAE3C,MAAMC,cAAA,gBAAiBP,IAAA,CAAK,MAC1B,MAAM,CAAC,cAAcQ,IAAI,CAAEC,MAAA,KAAY;EAAEC,OAAA,EAASD,MAAA,CAAOE;AAAS;AAGpE,OAAO,MAAMC,aAAA,GAAqDC,KAAA;EAAA,MAAAC,CAAA,GAAAjB,EAAA;EAChE;IAAAkB,KAAA,EAAAC,EAAA;IAAAC,KAAA,EAAA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KAAA;IAAAD,CAAA,MAAAW,EAAA;IAAAX,CAAA,MAAAY,EAAA;EAAA;IAAAD,EAAA,GAAAX,CAAA;IAAAY,EAAA,GAAAZ,CAAA;EAAA;EA3BjFZ,SAAA,CAAUuB,EA2BV,EAAGC,EAA8E;EAAA,IAAAY,EAAA;EAAA,IAAAxB,CAAA,QAAAS,0BAAA,IAAAT,CAAA,QAAAD,KAAA;IAG/EyB,EAAA,GAAAC,IAAA,CAAAtC,QAAA;MAAAuC,QAAA,EAAoBD,IAAA,CAAAzC,aAAA;QAAA2C,MAAA,EAAsB;MAAA,C;gBACvClB,0BAAA,IACCgB,IAAA,CAAAhC,cAAA;QAAA,GAAoBM,KAAK;QAAA6B,YAAA,EAAgBnB;MAAA,C;;;;;;;;SAF7Ce,E;CAMJ","ignoreList":[]}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAElB,8BAA8B,EAC/B,MAAM,YAAY,CAAA;AAkBnB,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,8BAA8B,CA+wBxF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAC1F,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,8CAA8C,CAAA;AAE/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAA;AACrG,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAA;AAErG,OAAO,EAAE,iBAAiB,EAAE,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,MAAM,yCAAyC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ export function lexicalEditor(props) {
|
|
|
22
22
|
dependencyGroups: [{
|
|
23
23
|
name: 'lexical',
|
|
24
24
|
dependencies: ['lexical', '@lexical/headless', '@lexical/link', '@lexical/list', '@lexical/mark', '@lexical/markdown', '@lexical/react', '@lexical/rich-text', '@lexical/selection', '@lexical/utils'],
|
|
25
|
-
targetVersion: '0.
|
|
25
|
+
targetVersion: '0.18.0'
|
|
26
26
|
}]
|
|
27
27
|
});
|
|
28
28
|
}
|
|
@@ -158,7 +158,7 @@ export function lexicalEditor(props) {
|
|
|
158
158
|
value = await hook(args);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
if (!finalSanitizedEditorConfig.features.nodeHooks
|
|
161
|
+
if (!finalSanitizedEditorConfig.features.nodeHooks?.afterChange?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
|
|
162
162
|
return value;
|
|
163
163
|
}
|
|
164
164
|
const context = _context;
|
|
@@ -176,9 +176,10 @@ export function lexicalEditor(props) {
|
|
|
176
176
|
});
|
|
177
177
|
// eslint-disable-next-line prefer-const
|
|
178
178
|
for (let [id, node] of Object.entries(nodeIDMap)) {
|
|
179
|
-
const afterChangeHooks = finalSanitizedEditorConfig.features.nodeHooks
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
const afterChangeHooks = finalSanitizedEditorConfig.features.nodeHooks?.afterChange;
|
|
180
|
+
const afterChangeHooksForNode = afterChangeHooks?.get(node.type);
|
|
181
|
+
if (afterChangeHooksForNode) {
|
|
182
|
+
for (const hook of afterChangeHooksForNode) {
|
|
182
183
|
if (!originalNodeIDMap[id]) {
|
|
183
184
|
console.warn('(afterChange) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
|
|
184
185
|
continue;
|
|
@@ -194,9 +195,9 @@ export function lexicalEditor(props) {
|
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
|
-
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields
|
|
198
|
-
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData
|
|
199
|
-
if (subFieldFn) {
|
|
198
|
+
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
|
|
199
|
+
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
|
|
200
|
+
if (subFieldFn && subFieldDataFn) {
|
|
200
201
|
const subFields = subFieldFn({
|
|
201
202
|
node,
|
|
202
203
|
req
|
|
@@ -269,7 +270,7 @@ export function lexicalEditor(props) {
|
|
|
269
270
|
value = await hook(args);
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
|
-
if (!finalSanitizedEditorConfig.features.nodeHooks
|
|
273
|
+
if (!finalSanitizedEditorConfig.features.nodeHooks?.afterRead?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
|
|
273
274
|
return value;
|
|
274
275
|
}
|
|
275
276
|
const flattenedNodes = [];
|
|
@@ -278,34 +279,35 @@ export function lexicalEditor(props) {
|
|
|
278
279
|
nodes: value?.root?.children ?? []
|
|
279
280
|
});
|
|
280
281
|
for (let node of flattenedNodes) {
|
|
281
|
-
const afterReadHooks = finalSanitizedEditorConfig.features.nodeHooks
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
const afterReadHooks = finalSanitizedEditorConfig.features.nodeHooks?.afterRead;
|
|
283
|
+
const afterReadHooksForNode = afterReadHooks?.get(node.type);
|
|
284
|
+
if (afterReadHooksForNode) {
|
|
285
|
+
for (const hook of afterReadHooksForNode) {
|
|
284
286
|
node = await hook({
|
|
285
287
|
context,
|
|
286
|
-
currentDepth,
|
|
287
|
-
depth,
|
|
288
|
-
draft,
|
|
289
|
-
fallbackLocale,
|
|
290
|
-
fieldPromises,
|
|
291
|
-
findMany,
|
|
292
|
-
flattenLocales,
|
|
293
|
-
locale,
|
|
288
|
+
currentDepth: currentDepth,
|
|
289
|
+
depth: depth,
|
|
290
|
+
draft: draft,
|
|
291
|
+
fallbackLocale: fallbackLocale,
|
|
292
|
+
fieldPromises: fieldPromises,
|
|
293
|
+
findMany: findMany,
|
|
294
|
+
flattenLocales: flattenLocales,
|
|
295
|
+
locale: locale,
|
|
294
296
|
node,
|
|
295
|
-
overrideAccess,
|
|
297
|
+
overrideAccess: overrideAccess,
|
|
296
298
|
parentRichTextFieldPath: path,
|
|
297
299
|
parentRichTextFieldSchemaPath: schemaPath,
|
|
298
|
-
populationPromises,
|
|
300
|
+
populationPromises: populationPromises,
|
|
299
301
|
req,
|
|
300
|
-
showHiddenFields,
|
|
301
|
-
triggerAccessControl,
|
|
302
|
-
triggerHooks
|
|
302
|
+
showHiddenFields: showHiddenFields,
|
|
303
|
+
triggerAccessControl: triggerAccessControl,
|
|
304
|
+
triggerHooks: triggerHooks
|
|
303
305
|
});
|
|
304
306
|
}
|
|
305
307
|
}
|
|
306
|
-
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields
|
|
307
|
-
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData
|
|
308
|
-
if (subFieldFn) {
|
|
308
|
+
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
|
|
309
|
+
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
|
|
310
|
+
if (subFieldFn && subFieldDataFn) {
|
|
309
311
|
const subFields = subFieldFn({
|
|
310
312
|
node,
|
|
311
313
|
req
|
|
@@ -318,23 +320,23 @@ export function lexicalEditor(props) {
|
|
|
318
320
|
afterReadTraverseFields({
|
|
319
321
|
collection,
|
|
320
322
|
context,
|
|
321
|
-
currentDepth,
|
|
322
|
-
depth,
|
|
323
|
+
currentDepth: currentDepth,
|
|
324
|
+
depth: depth,
|
|
323
325
|
doc: data,
|
|
324
|
-
draft,
|
|
325
|
-
fallbackLocale,
|
|
326
|
-
fieldPromises,
|
|
326
|
+
draft: draft,
|
|
327
|
+
fallbackLocale: fallbackLocale,
|
|
328
|
+
fieldPromises: fieldPromises,
|
|
327
329
|
fields: subFields,
|
|
328
|
-
findMany,
|
|
329
|
-
flattenLocales,
|
|
330
|
+
findMany: findMany,
|
|
331
|
+
flattenLocales: flattenLocales,
|
|
330
332
|
global,
|
|
331
|
-
locale,
|
|
332
|
-
overrideAccess,
|
|
333
|
+
locale: locale,
|
|
334
|
+
overrideAccess: overrideAccess,
|
|
333
335
|
path,
|
|
334
|
-
populationPromises,
|
|
336
|
+
populationPromises: populationPromises,
|
|
335
337
|
req,
|
|
336
338
|
schemaPath,
|
|
337
|
-
showHiddenFields,
|
|
339
|
+
showHiddenFields: showHiddenFields,
|
|
338
340
|
siblingDoc: data,
|
|
339
341
|
triggerAccessControl,
|
|
340
342
|
triggerHooks
|
|
@@ -368,7 +370,7 @@ export function lexicalEditor(props) {
|
|
|
368
370
|
value = await hook(args);
|
|
369
371
|
}
|
|
370
372
|
}
|
|
371
|
-
if (!finalSanitizedEditorConfig.features.nodeHooks
|
|
373
|
+
if (!finalSanitizedEditorConfig.features.nodeHooks?.beforeChange?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
|
|
372
374
|
return value;
|
|
373
375
|
}
|
|
374
376
|
const context = _context;
|
|
@@ -385,7 +387,7 @@ export function lexicalEditor(props) {
|
|
|
385
387
|
nodeIDMap,
|
|
386
388
|
nodes: value?.root?.children ?? []
|
|
387
389
|
});
|
|
388
|
-
if (siblingDocWithLocales?.[field.name]) {
|
|
390
|
+
if (field.name && siblingDocWithLocales?.[field.name]) {
|
|
389
391
|
recurseNodeTree({
|
|
390
392
|
nodeIDMap: originalNodeWithLocalesIDMap,
|
|
391
393
|
nodes: siblingDocWithLocales[field.name]?.root?.children ?? []
|
|
@@ -393,31 +395,32 @@ export function lexicalEditor(props) {
|
|
|
393
395
|
}
|
|
394
396
|
// eslint-disable-next-line prefer-const
|
|
395
397
|
for (let [id, node] of Object.entries(nodeIDMap)) {
|
|
396
|
-
const beforeChangeHooks = finalSanitizedEditorConfig.features.nodeHooks
|
|
397
|
-
|
|
398
|
-
|
|
398
|
+
const beforeChangeHooks = finalSanitizedEditorConfig.features.nodeHooks?.beforeChange;
|
|
399
|
+
const beforeChangeHooksForNode = beforeChangeHooks?.get(node.type);
|
|
400
|
+
if (beforeChangeHooksForNode) {
|
|
401
|
+
for (const hook of beforeChangeHooksForNode) {
|
|
399
402
|
if (!originalNodeIDMap[id]) {
|
|
400
403
|
console.warn('(beforeChange) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
|
|
401
404
|
continue;
|
|
402
405
|
}
|
|
403
406
|
node = await hook({
|
|
404
407
|
context,
|
|
405
|
-
errors,
|
|
406
|
-
mergeLocaleActions,
|
|
408
|
+
errors: errors,
|
|
409
|
+
mergeLocaleActions: mergeLocaleActions,
|
|
407
410
|
node,
|
|
408
|
-
operation,
|
|
411
|
+
operation: operation,
|
|
409
412
|
originalNode: originalNodeIDMap[id],
|
|
410
413
|
originalNodeWithLocales: originalNodeWithLocalesIDMap[id],
|
|
411
414
|
parentRichTextFieldPath: path,
|
|
412
415
|
parentRichTextFieldSchemaPath: schemaPath,
|
|
413
416
|
req,
|
|
414
|
-
skipValidation
|
|
417
|
+
skipValidation: skipValidation
|
|
415
418
|
});
|
|
416
419
|
}
|
|
417
420
|
}
|
|
418
|
-
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields
|
|
419
|
-
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData
|
|
420
|
-
if (subFieldFn) {
|
|
421
|
+
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
|
|
422
|
+
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
|
|
423
|
+
if (subFieldFn && subFieldDataFn) {
|
|
421
424
|
const subFields = subFieldFn({
|
|
422
425
|
node,
|
|
423
426
|
req
|
|
@@ -442,11 +445,11 @@ export function lexicalEditor(props) {
|
|
|
442
445
|
data,
|
|
443
446
|
doc: originalData,
|
|
444
447
|
docWithLocales: originalDataWithLocales ?? {},
|
|
445
|
-
errors,
|
|
448
|
+
errors: errors,
|
|
446
449
|
fields: subFields,
|
|
447
450
|
global,
|
|
448
|
-
mergeLocaleActions,
|
|
449
|
-
operation,
|
|
451
|
+
mergeLocaleActions: mergeLocaleActions,
|
|
452
|
+
operation: operation,
|
|
450
453
|
path,
|
|
451
454
|
req,
|
|
452
455
|
schemaPath,
|
|
@@ -507,7 +510,7 @@ export function lexicalEditor(props) {
|
|
|
507
510
|
}
|
|
508
511
|
}
|
|
509
512
|
// return value if there are NO hooks
|
|
510
|
-
if (!finalSanitizedEditorConfig.features.nodeHooks
|
|
513
|
+
if (!finalSanitizedEditorConfig.features.nodeHooks?.beforeValidate?.size && !finalSanitizedEditorConfig.features.nodeHooks?.afterChange?.size && !finalSanitizedEditorConfig.features.nodeHooks?.beforeChange?.size && !finalSanitizedEditorConfig.features.getSubFields?.size) {
|
|
511
514
|
return value;
|
|
512
515
|
}
|
|
513
516
|
/**
|
|
@@ -547,7 +550,7 @@ export function lexicalEditor(props) {
|
|
|
547
550
|
/**
|
|
548
551
|
* Now that the maps for all hooks are set up, we can run the validate hook
|
|
549
552
|
*/
|
|
550
|
-
if (!finalSanitizedEditorConfig.features.nodeHooks
|
|
553
|
+
if (!finalSanitizedEditorConfig.features.nodeHooks?.beforeValidate?.size) {
|
|
551
554
|
return value;
|
|
552
555
|
}
|
|
553
556
|
const nodeIDMap = {};
|
|
@@ -559,8 +562,9 @@ export function lexicalEditor(props) {
|
|
|
559
562
|
// eslint-disable-next-line prefer-const
|
|
560
563
|
for (let [id, node] of Object.entries(nodeIDMap)) {
|
|
561
564
|
const beforeValidateHooks = finalSanitizedEditorConfig.features.nodeHooks.beforeValidate;
|
|
562
|
-
|
|
563
|
-
|
|
565
|
+
const beforeValidateHooksForNode = beforeValidateHooks?.get(node.type);
|
|
566
|
+
if (beforeValidateHooksForNode) {
|
|
567
|
+
for (const hook of beforeValidateHooksForNode) {
|
|
564
568
|
if (!originalNodeIDMap[id]) {
|
|
565
569
|
console.warn('(beforeValidate) No original node found for node with id', id, 'node:', node, 'path', path.join('.'));
|
|
566
570
|
continue;
|
|
@@ -570,16 +574,16 @@ export function lexicalEditor(props) {
|
|
|
570
574
|
node,
|
|
571
575
|
operation,
|
|
572
576
|
originalNode: originalNodeIDMap[id],
|
|
573
|
-
overrideAccess,
|
|
577
|
+
overrideAccess: overrideAccess,
|
|
574
578
|
parentRichTextFieldPath: path,
|
|
575
579
|
parentRichTextFieldSchemaPath: schemaPath,
|
|
576
580
|
req
|
|
577
581
|
});
|
|
578
582
|
}
|
|
579
583
|
}
|
|
580
|
-
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields
|
|
581
|
-
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData
|
|
582
|
-
if (subFieldFn) {
|
|
584
|
+
const subFieldFn = finalSanitizedEditorConfig.features.getSubFields?.get(node.type);
|
|
585
|
+
const subFieldDataFn = finalSanitizedEditorConfig.features.getSubFieldsData?.get(node.type);
|
|
586
|
+
if (subFieldFn && subFieldDataFn) {
|
|
583
587
|
const subFields = subFieldFn({
|
|
584
588
|
node,
|
|
585
589
|
req
|
|
@@ -602,7 +606,7 @@ export function lexicalEditor(props) {
|
|
|
602
606
|
fields: subFields,
|
|
603
607
|
global,
|
|
604
608
|
operation,
|
|
605
|
-
overrideAccess,
|
|
609
|
+
overrideAccess: overrideAccess,
|
|
606
610
|
path,
|
|
607
611
|
req,
|
|
608
612
|
schemaPath,
|