@payloadcms/richtext-lexical 3.84.1 → 3.86.0-internal.8bd478e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/{Field-4UEGQMIN.js → Field-KR4W3EZZ.js} +2 -2
- package/dist/exports/client/Field-KR4W3EZZ.js.map +7 -0
- package/dist/exports/client/chunk-XFA5M7FY.js +2 -0
- package/dist/exports/client/chunk-XFA5M7FY.js.map +7 -0
- package/dist/exports/client/componentInline-A4H3EY3L.js +2 -0
- package/dist/exports/client/index.js +14 -14
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +16 -1
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +11 -1
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/exports/client/Field-4UEGQMIN.js.map +0 -7
- package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
- package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
- package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
- /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-A4H3EY3L.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/component/index.tsx"],"names":[],"mappings":"AAkCA,OAAO,KAAkD,MAAM,OAAO,CAAA;AAGtE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,KAAK,EAAE,WAA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,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CAAC,CAAA;IAC3D;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAkqBxD,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
|
6
6
|
import { getTranslation } from '@payloadcms/translations';
|
|
7
7
|
import { Button, Collapsible, Drawer, EditDepthProvider, ErrorPill, Form, formatDrawerSlug, FormSubmit, Pill, RenderFields, SectionTitle, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useFormSubmitted, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
8
8
|
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
9
|
-
import { $getNodeByKey } from 'lexical';
|
|
9
|
+
import { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical';
|
|
10
10
|
import { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared';
|
|
11
11
|
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
|
12
12
|
import { v4 as uuid } from 'uuid';
|
|
@@ -199,6 +199,11 @@ export const BlockComponent = props => {
|
|
|
199
199
|
newData.blockType = blockType;
|
|
200
200
|
node.setFields(newData, true);
|
|
201
201
|
}
|
|
202
|
+
},
|
|
203
|
+
// Without this, the outer editor's reconciler resets DOM selection
|
|
204
|
+
// back into its own root, kicking focus out of any nested richText.
|
|
205
|
+
{
|
|
206
|
+
tag: SKIP_DOM_SELECTION_TAG
|
|
202
207
|
});
|
|
203
208
|
setInitialState(state);
|
|
204
209
|
if (!CustomLabelFromProps) {
|
|
@@ -272,6 +277,11 @@ export const BlockComponent = props => {
|
|
|
272
277
|
newData_0.blockType = blockType;
|
|
273
278
|
node_0.setFields(newData_0, true);
|
|
274
279
|
}
|
|
280
|
+
},
|
|
281
|
+
// Without this, the outer editor's reconciler resets DOM selection
|
|
282
|
+
// back into its own root, kicking focus out of any nested richText.
|
|
283
|
+
{
|
|
284
|
+
tag: SKIP_DOM_SELECTION_TAG
|
|
275
285
|
});
|
|
276
286
|
}, 0);
|
|
277
287
|
if (submit) {
|
|
@@ -465,6 +475,11 @@ export const BlockComponent = props => {
|
|
|
465
475
|
if (node_1 && $isBlockNode(node_1)) {
|
|
466
476
|
node_1.setFields(newData_1, true);
|
|
467
477
|
}
|
|
478
|
+
},
|
|
479
|
+
// Without this, the outer editor's reconciler resets DOM selection
|
|
480
|
+
// back into its own root, kicking focus out of any nested richText.
|
|
481
|
+
{
|
|
482
|
+
tag: SKIP_DOM_SELECTION_TAG
|
|
468
483
|
});
|
|
469
484
|
toggleDrawer();
|
|
470
485
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","FormSubmit","Pill","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isBlockNode","BlockContent","useBlockComponentContext","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","children","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","filter","Boolean","join","collapsibleStyle","header","_jsxs","pillStyle","admin","path","count","withMessage","_Fragment","onToggle","incomingCollapsedState","blockID","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","style","display","beforeSubmit","onSubmit","formSchema"],"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n FormSubmit,\n Pill,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types.js'\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport './index.scss'\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport {\n type BlockCollapsibleWithErrorProps,\n BlockContent,\n useBlockComponentContext,\n} from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\nexport type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n /**\n * Custom block component from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>\n /**\n * Custom block label from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>\n /**\n * The block's form data (field values).\n */\n readonly formData: TFormData\n /**\n * The unique key identifying this block node in the current editor instance.\n */\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<BlockComponentProps> = (props) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n const mergedState = Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n\n // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist (CustomBlockFromProps/CustomLabelFromProps),\n // we render them directly with formData instead, so these states are unused.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n // When viewMap components exist, render directly with formData (always current from\n // the lexical node). When they don't, fall back to server-rendered state.\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as BlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n CustomLabelFromProps,\n CustomBlockFromProps,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const { i18n, t } = useTranslation<object, string>()\n\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, { excludeFiles: true }),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n node.setFields(newData, true)\n }\n })\n }, 0)\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n }\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof resolvedCustomLabel !== 'undefined' ? (\n resolvedCustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n\n <div className={`${baseClass}__block-actions`}>\n {typeof Actions !== 'undefined' ? (\n Actions\n ) : (\n <>\n {(resolvedCustomBlock && editButton !== false) ||\n (!resolvedCustomBlock && editButton) ? (\n <EditButton />\n ) : null}\n {removeButton !== false && isEditable ? <RemoveButton /> : null}\n </>\n )}\n </div>\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n resolvedCustomBlock,\n resolvedCustomLabel,\n EditButton,\n RemoveButton,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n ],\n )\n\n const blockID = formData?.id\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields ?? []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <div data-block-drawer-slug={drawerSlug} style={{ display: 'contents' }}>\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, true)\n }\n })\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={formUuid}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={resolvedCustomBlock}\n CustomLabel={resolvedCustomLabel}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n </div>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockType,\n drawerSlug,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n formUuid,\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAO9B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,UAAA,EACAjI,SAAA,EACAiC,MAAA,EACAV,UAAA,EACAO,YAAA,EACAgE,WAAA,EAAa5E,MAAA,EACbuC,QAAA,EACAnB,YAAA,EACAhC,OAAA,EACA8F,QAAA,EACA7F,SAAA,CACD;EAED,IAAI,CAACuF,WAAA,EAAa;IAChB,oBACE7B,IAAA,CAAC+E,gBAAA;MAAiBI,gBAAA,EAAkB;MAAME,cAAA,EAAgB;gBACxD,aAAAS,KAAA,CAAC;QAAIhK,SAAA,EAAW,GAAGC,SAAA,YAAqB;mBAAE,kBACzBmC,SAAA,EAAU;;;EAIjC;EAEA,OAAO4B,KAAA;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","FormSubmit","Pill","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isBlockNode","BlockContent","useBlockComponentContext","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","tag","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","children","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","filter","Boolean","join","collapsibleStyle","header","_jsxs","pillStyle","admin","path","count","withMessage","_Fragment","onToggle","incomingCollapsedState","blockID","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","style","display","beforeSubmit","onSubmit","formSchema"],"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n FormSubmit,\n Pill,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapBlockComponentProps } from '../../../../types.js'\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport './index.scss'\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport {\n type BlockCollapsibleWithErrorProps,\n BlockContent,\n useBlockComponentContext,\n} from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\nexport type BlockComponentProps<TFormData extends Record<string, unknown> = BlockFields> = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n /**\n * Custom block component from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomBlock?: React.FC<ViewMapBlockComponentProps>\n /**\n * Custom block label from view map\n * Will be rendered with useBlockComponentContext hook.\n */\n readonly CustomLabel?: React.FC<ViewMapBlockComponentProps>\n /**\n * The block's form data (field values).\n */\n readonly formData: TFormData\n /**\n * The unique key identifying this block node in the current editor instance.\n */\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<BlockComponentProps> = (props) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n const mergedState = Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n\n // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist (CustomBlockFromProps/CustomLabelFromProps),\n // we render them directly with formData instead, so these states are unused.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n // When viewMap components exist, render directly with formData (always current from\n // the lexical node). When they don't, fall back to server-rendered state.\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useBlockComponentContext={useBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as BlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n CustomLabelFromProps,\n CustomBlockFromProps,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const { i18n, t } = useTranslation<object, string>()\n\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState, { excludeFiles: true }),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n }, 0)\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n }\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof resolvedCustomLabel !== 'undefined' ? (\n resolvedCustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n\n <div className={`${baseClass}__block-actions`}>\n {typeof Actions !== 'undefined' ? (\n Actions\n ) : (\n <>\n {(resolvedCustomBlock && editButton !== false) ||\n (!resolvedCustomBlock && editButton) ? (\n <EditButton />\n ) : null}\n {removeButton !== false && isEditable ? <RemoveButton /> : null}\n </>\n )}\n </div>\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n resolvedCustomBlock,\n resolvedCustomLabel,\n EditButton,\n RemoveButton,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n ],\n )\n\n const blockID = formData?.id\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields ?? []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <div data-block-drawer-slug={drawerSlug} style={{ display: 'contents' }}>\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={formUuid}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={resolvedCustomBlock}\n CustomLabel={resolvedCustomLabel}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n </div>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n resolvedCustomBlock,\n resolvedCustomLabel,\n blockType,\n drawerSlug,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n formUuid,\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"mappings":"AAAA;;;AAEA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC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,UAAA,EAAYA,UAAA;UACZ3G,UAAA,EAAYA,UAAA;UACZ+J,UAAA,EAAYvF,WAAA,EAAa7E,MAAA,IAAU,EAAE;UACrCoB,YAAA,EAAcA,YAAA;UACdhC,OAAA,EAASA,OAAA;UACT0I,YAAA,EAAcA;;;;EAKxB,GAAG,CACDC,gBAAA,EACAyB,WAAA,EACA1G,mBAAA,EACAI,mBAAA,EACAjC,SAAA,EACAR,UAAA,EACAqH,YAAA,EACAd,UAAA,EACAlI,SAAA,EACAiC,MAAA,EACAV,UAAA,EACAO,YAAA,EACAiE,WAAA,EAAa7E,MAAA,EACbuC,QAAA,EACAnB,YAAA,EACAhC,OAAA,EACA+F,QAAA,EACA9F,SAAA,CACD;EAED,IAAI,CAACwF,WAAA,EAAa;IAChB,oBACE9B,IAAA,CAACgF,gBAAA;MAAiBI,gBAAA,EAAkB;MAAME,cAAA,EAAgB;gBACxD,aAAAS,KAAA,CAAC;QAAIjK,SAAA,EAAW,GAAGC,SAAA,YAAqB;mBAAE,kBACzBmC,SAAA,EAAU;;;EAIjC;EAEA,OAAO4B,KAAA;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAwC,SAAS,EAAE,MAAM,SAAS,CAAA;AAwB9E,OAAO,cAAc,CAAA;AAGrB,OAAO,KAAiE,MAAM,OAAO,CAAA;AAGrF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAA;AAC5E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAA;AAC/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAMhE,MAAM,MAAM,yBAAyB,CACnC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,IAC3D;IACF,QAAQ,CA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AC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,IAC3D;IACF,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAAC,CAAA;IACjE,QAAQ,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,gCAAgC,CAAC,CAAA;CAClE,GAAG,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,EAAE,aAAa,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,CAAC,CAAA;AAE9F,MAAM,MAAM,+BAA+B,GAAG;IAC5C,UAAU,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACrB,YAAY,EAAE,KAAK,GAAG,SAAS,GAAG,SAAS,CAAA;IAC3C,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,CAAC,CAAA;IAC9D,KAAK,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;CACxB,CAAA;AAMD,eAAO,MAAM,8BAA8B,uCAA+C,CAAA;AAE1F,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,iBAAiB,CAAC,CAifvF,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
|
|
|
6
6
|
import { getTranslation } from '@payloadcms/translations';
|
|
7
7
|
import { Button, Drawer, EditDepthProvider, Form, formatDrawerSlug, FormSubmit, RenderFields, ShimmerEffect, useConfig, useDocumentForm, useDocumentInfo, useEditDepth, useServerFunctions, useTranslation } from '@payloadcms/ui';
|
|
8
8
|
import { abortAndIgnore } from '@payloadcms/ui/shared';
|
|
9
|
-
import { $getNodeByKey } from 'lexical';
|
|
9
|
+
import { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical';
|
|
10
10
|
import { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared';
|
|
11
11
|
import React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
12
12
|
import { v4 as uuid } from 'uuid';
|
|
@@ -205,6 +205,11 @@ export const InlineBlockComponent = props => {
|
|
|
205
205
|
newData.blockType = formData.blockType;
|
|
206
206
|
node.setFields(newData, true);
|
|
207
207
|
}
|
|
208
|
+
},
|
|
209
|
+
// Without this, the outer editor's reconciler resets DOM selection
|
|
210
|
+
// back into its own root, kicking focus out of any nested richText.
|
|
211
|
+
{
|
|
212
|
+
tag: SKIP_DOM_SELECTION_TAG
|
|
208
213
|
});
|
|
209
214
|
setInitialState(state);
|
|
210
215
|
if (!CustomLabelFromProps) {
|
|
@@ -291,6 +296,11 @@ export const InlineBlockComponent = props => {
|
|
|
291
296
|
if (node_0 && $isInlineBlockNode(node_0)) {
|
|
292
297
|
node_0.setFields(newData_0, true);
|
|
293
298
|
}
|
|
299
|
+
},
|
|
300
|
+
// Without this, the outer editor's reconciler resets DOM selection
|
|
301
|
+
// back into its own root, kicking focus out of any nested richText.
|
|
302
|
+
{
|
|
303
|
+
tag: SKIP_DOM_SELECTION_TAG
|
|
294
304
|
});
|
|
295
305
|
}, [editor, nodeKey, formData]);
|
|
296
306
|
const RemoveButton = useMemo(() => () => /*#__PURE__*/_jsx(Button, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types.js'\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,Q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,O,aACDvE,IAAA,CAAC4D,YAAA;WAED;;;AAKd","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","SKIP_DOM_SELECTION_TAG","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","CustomBlock","CustomBlockFromProps","CustomLabel","CustomLabelFromProps","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","formUuid","setCustomLabel","undefined","customComponents","BlockLabel","setCustomBlock","Block","resolvedCustomBlock","_jsx","isEditor","isJSXConverter","resolvedCustomLabel","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","excludeFiles","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","tag","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","filter","Boolean","join","ref","Label","_jsxs","beforeSubmit","disableValidationOnSubmit","onSubmit","title","_Fragment","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types.js'\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SAASA,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT;AACP,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,EAAEC,sBAAsB,QAAQ;AAItD,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ;AACjF,OAAOC,KAAA,IAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ;AAC9E,SAASC,EAAA,IAAMC,IAAI,QAAQ;AAM3B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,kBAAkB,QAAQ;AAkBnC,MAAMC,2BAAA,gBAA8BV,aAAA,CAA+C;EACjFW,YAAA,EAAc;AAChB;AAEA,OAAO,M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BAECjB,YAAA,gBACCuI,KAAA,CAAAK,SAAA;kCACEtF,IAAA,CAAC/E,YAAA;YACCkD,MAAA,EAAQ8C,WAAA,EAAa9C,MAAA;YACrBoH,WAAW;YACXC,eAAA,EAAgB;YAChBC,UAAA,EAAW;YACXC,gBAAA,EAAkB1D,gBAAA;YAClB2D,WAAA,EAAa;YACb/C,QAAA,EAAU,CAACnF;2BAEbuC,IAAA,CAAChF,UAAA;YAAW4K,kBAAA,EAAoB;sBAAOjI,CAAA,CAAE;;aAEzC;;QAGPoC,mBAAA,gBACCC,IAAA,CAACvD,2BAAA;MACC2C,KAAA,EAAO;QACLoF,UAAA;QACA9H,YAAA;QACAgI,oBAAA;QACAM,KAAA;QACAzH,OAAA;QACAsG;MACF;gBAEC9D;sBAGHkF,KAAA,CAACP,oBAAA;iBACEhI,YAAA,gBAAesD,IAAA,CAACgF,KAAA,qBAAWhF,IAAA,CAAC9E,aAAA;QAAc2K,MAAA,EAAO;QAAOC,KAAA,EAAM;UAC9DrI,UAAA,gBACCwH,KAAA,CAAC;QAAIjI,SAAA,EAAW,GAAGC,SAAA,WAAoB;gCACrC+C,IAAA,CAACwE,UAAA,O,aACDxE,IAAA,CAAC6D,YAAA;WAED;;;AAKd","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","React","useMemo","baseClass","useTranslation","useEditorConfigContext","DropDown","DropDownItem","ToolbarItem","t0","$","active","anchorElem","editor","enabled","item","i18n","fieldProps","t1","featureClientSchemaMap","schemaPath","Component","t2","_jsx","
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","React","useMemo","baseClass","useTranslation","useEditorConfigContext","DropDown","DropDownItem","ToolbarItem","t0","$","active","anchorElem","editor","enabled","item","i18n","fieldProps","t1","featureClientSchemaMap","schemaPath","Component","t2","_jsx","title","key","croppedTitle","label","length","substring","Icon","ChildComponent","undefined","itemKey","tooltip","children","className","MemoToolbarItem","memo","ToolbarDropdown","classNames","group","groupState","itemsContainerClassNames","items","groupKey","renderedItems","map","activeItemKeys","includes","enabledItemKeys","buttonAriaLabel","buttonClassName","filter","Boolean","join","disabled","enabledGroup","dropdownKey"],"sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/index.tsx"],"sourcesContent":["'use client'\nimport React, { useMemo } from 'react'\n\nconst baseClass = 'toolbar-popup__dropdown'\n\nimport type { LexicalEditor } from 'lexical'\n\nimport { useTranslation } from '@payloadcms/ui'\n\nimport type { ToolbarDropdownGroup, ToolbarGroupItem } from '../../types.js'\nimport type { ToolbarGroupState } from '../useToolbarStates.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { DropDown, DropDownItem } from './DropDown.js'\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<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\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 let croppedTitle = item.key\n if (item.label) {\n title =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n if (title.length > 25) {\n croppedTitle = title.substring(0, 25) + '...'\n } else {\n croppedTitle = title\n }\n\n return (\n <DropDownItem\n active={active}\n editor={editor}\n enabled={enabled}\n Icon={item?.ChildComponent ? <item.ChildComponent /> : undefined}\n item={item}\n itemKey={item.key}\n key={item.key}\n tooltip={title}\n >\n <span className=\"text\">{croppedTitle}</span>\n </DropDownItem>\n )\n}\n\nconst MemoToolbarItem = React.memo(ToolbarItem)\n\nexport const ToolbarDropdown = ({\n anchorElem,\n classNames,\n editor,\n group,\n groupState,\n Icon,\n itemsContainerClassNames,\n label,\n}: {\n anchorElem: HTMLElement\n classNames?: string[]\n editor: LexicalEditor\n group: ToolbarDropdownGroup\n groupState: ToolbarGroupState\n Icon?: React.FC\n itemsContainerClassNames?: string[]\n label?: string\n}) => {\n const { items, key: groupKey } = group\n\n const renderedItems = useMemo(() => {\n return items?.length\n ? items.map((item) => (\n <MemoToolbarItem\n active={groupState.activeItemKeys.includes(item.key)}\n anchorElem={anchorElem}\n editor={editor}\n enabled={groupState.enabledItemKeys.includes(item.key)}\n item={item}\n key={item.key}\n />\n ))\n : null\n }, [items, groupState.activeItemKeys, groupState.enabledItemKeys, anchorElem, editor])\n\n return (\n <DropDown\n buttonAriaLabel={`${groupKey} dropdown`}\n buttonClassName={[baseClass, `${baseClass}-${groupKey}`, ...(classNames || [])]\n .filter(Boolean)\n .join(' ')}\n disabled={!groupState.enabledGroup}\n dropdownKey={groupKey}\n Icon={Icon}\n itemsContainerClassNames={[`${baseClass}-items`, ...(itemsContainerClassNames || [])]}\n key={groupKey}\n label={label}\n >\n {renderedItems}\n </DropDown>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,OAAOC,KAAA,IAASC,OAAO,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAIlB,SAASC,cAAc,QAAQ;AAK/B,SAASC,sBAAsB,QAAQ;AAEvC,SAASC,QAAQ,EAAEC,YAAY,QAAQ;AAEvC,MAAMC,WAAA,GAAcC,EAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAAC;IAAAW,MAAA;IAAAC,UAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC;EAAA,IAAAN,EAYpB;EACC;IAAAO;EAAA,IAAiBZ,cAAA;EACjB;IAAAa,UAAA,EAAAC;EAAA,IAEIb,sBAAA;EADU;IAAAc,sBAAA;IAAAC;EAAA,IAAAF,EAAsC;EAAA,IAGhDH,IAAA,CAAAM,SAAA;IAAA,IAAAC,EAAA;I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,eAAe,CAACD,QAAQ,CAAClC,IAAA,CAAKU,GAAG;MACrDV,IAAA,EAAMA;OACDA,IAAA,CAAKU,GAAG,KAGjB;EACN,GAAG,CAACmB,KAAA,EAAOF,UAAA,CAAWM,cAAc,EAAEN,UAAA,CAAWQ,eAAe,EAAEtC,UAAA,EAAYC,MAAA,CAAO;EAErF,oBACEU,IAAA,CAACjB,QAAA;IACC6C,eAAA,EAAiB,GAAGN,QAAA,WAAmB;IACvCO,eAAA,EAAiB,CAACjD,SAAA,EAAW,GAAGA,SAAA,IAAa0C,QAAA,EAAU,E,IAAML,UAAA,IAAc,EAAE,EAAE,CAC5Ea,MAAM,CAACC,OAAA,EACPC,IAAI,CAAC;IACRC,QAAA,EAAU,CAACd,UAAA,CAAWe,YAAY;IAClCC,WAAA,EAAab,QAAA;IACbf,IAAA,EAAMA,IAAA;IACNa,wBAAA,EAA0B,CAAC,GAAGxC,SAAA,QAAiB,E,IAAMwC,wBAAA,IAA4B,EAAE,EAAE;IAErFhB,KAAA,EAAOA,KAAA;cAENmB;KAHID,QAAA;AAMX","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAS5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAS5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAuM9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
|
package/dist/field/Field.js
CHANGED
|
@@ -160,7 +160,7 @@ const RichTextComponent = props => {
|
|
|
160
160
|
fallbackRender: fallbackRender,
|
|
161
161
|
onReset: () => {},
|
|
162
162
|
children: [BeforeInput, /*#__PURE__*/_jsx(BulkUploadProvider, {
|
|
163
|
-
drawerSlugPrefix: path
|
|
163
|
+
drawerSlugPrefix: `lexical-${path}`,
|
|
164
164
|
children: /*#__PURE__*/_jsx(LexicalProvider, {
|
|
165
165
|
composerKey: pathWithEditDepth,
|
|
166
166
|
editorConfig: editorConfig,
|