@payloadcms/richtext-lexical 3.0.0-beta.10 → 3.0.0-beta.12

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAkBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAuH1C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/field/features/blocks/component/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAkBzD,OAAO,cAAc,CAAA;AAGrB,KAAK,KAAK,GAAG;IACX,qBAAqB,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B,QAAQ,EAAE,WAAW,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;OAEG;IACH,mBAAmB,EAAE,WAAW,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAyH1C,CAAA"}
@@ -118,8 +118,11 @@ export const BlockComponent = (props)=>{
118
118
  initialState,
119
119
  reducedBlock,
120
120
  blockFieldWrapperName,
121
- onChange
122
- ]);
121
+ onChange,
122
+ schemaFieldsPath,
123
+ path
124
+ ]) // Adding formData to the dependencies here might break it
125
+ ;
123
126
  return /*#__PURE__*/ React.createElement("div", {
124
127
  className: baseClass
125
128
  }, formContent);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return (\n reducedBlock &&\n initialState !== false && (\n <Form\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n )\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n ])\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","formContent","formSchema","Array","isArray","div","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAKlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yD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"version":3,"sources":["../../../../../src/field/features/blocks/component/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { type BlockFields } from '../nodes/BlocksNode.js'\nconst baseClass = 'lexical-block'\n\nimport type { ReducedBlock } from '@payloadcms/ui/utilities/buildComponentMap'\nimport type { FormState } from 'payload/types'\n\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { useFormSubmitted } from '@payloadcms/ui/forms/Form'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ClientComponentProps } from '../../types.js'\nimport type { BlocksFeatureClientProps } from '../feature.client.js'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport { BlockContent } from './BlockContent.js'\nimport './index.scss'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n blockFieldWrapperName: string\n children?: React.ReactNode\n\n formData: BlockFields\n nodeKey?: string\n /**\n * This transformedFormData already comes wrapped in blockFieldWrapperName\n */\n transformedFormData: BlockFields\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { blockFieldWrapperName, formData, nodeKey } = props\n const config = useConfig()\n const submitted = useFormSubmitted()\n const { id } = useDocumentInfo()\n const { path, schemaPath } = useFieldProps()\n const { editorConfig, field: parentLexicalRichTextField } = useEditorConfigContext()\n\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.blocks.fields.${formData?.blockType}`\n const schemaFieldsPath = `${schemaPath}.feature.blocks.${formData?.blockType}`\n\n const reducedBlock: ReducedBlock = (\n editorConfig?.resolvedFeatureMap?.get('blocks')\n ?.clientFeatureProps as ClientComponentProps<BlocksFeatureClientProps>\n )?.reducedBlocks?.find((block) => block.slug === formData?.blockType)\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath)\n // Field Schema\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: JSON.parse(JSON.stringify(formData)),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n if (state) {\n setInitialState({\n ...removeEmptyArrayValues({ fields: state }),\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n })\n }\n }\n\n if (formData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n const formState = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n\n return {\n ...formState,\n blockName: {\n initialValue: '',\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n },\n }\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id, formData.blockName],\n )\n\n // Memoized Form JSX\n const formContent = useMemo(() => {\n return (\n reducedBlock &&\n initialState !== false && (\n <Form\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n field={parentLexicalRichTextField}\n formData={formData}\n formSchema={Array.isArray(fieldMap) ? fieldMap : []}\n nodeKey={nodeKey}\n path={`${path}.feature.blocks.${formData.blockType}`}\n reducedBlock={reducedBlock}\n schemaPath={schemaFieldsPath}\n />\n </Form>\n )\n )\n }, [\n fieldMap,\n parentLexicalRichTextField,\n nodeKey,\n submitted,\n initialState,\n reducedBlock,\n blockFieldWrapperName,\n onChange,\n schemaFieldsPath,\n path,\n ]) // Adding formData to the dependencies here might break it\n\n return <div className={baseClass}>{formContent}</div>\n}\n"],"names":["Form","React","useCallback","useEffect","useMemo","useState","baseClass","useFieldProps","useFormSubmitted","useConfig","useDocumentInfo","getFormState","v4","uuid","useEditorConfigContext","BlockContent","removeEmptyArrayValues","BlockComponent","props","blockFieldWrapperName","formData","nodeKey","config","submitted","id","path","schemaPath","editorConfig","field","parentLexicalRichTextField","initialState","setInitialState","richTextComponentMap","componentMapRenderedFieldsPath","blockType","schemaFieldsPath","reducedBlock","resolvedFeatureMap","get","clientFeatureProps","reducedBlocks","find","block","slug","fieldMap","awaitInitialState","state","apiRoute","routes","api","body","data","JSON","parse","stringify","operation","serverURL","fields","blockName","initialValue","passesCondition","valid","value","onChange","formState","prevFormState","formContent","formSchema","Array","isArray","div","className"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAIA,SAASA,IAAI,QAAQ,4BAA2B;AAChD,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AAGxE,MAAMC,YAAY;AAKlB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,gBAAgB,QAAQ,4BAA2B;AAC5D,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAKjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,SAASC,YAAY,QAAQ,oBAAmB;AAChD,OAAO,eAAc;AACrB,SAASC,sBAAsB,QAAQ,8BAA6B;AAcpE,OAAO,MAAMC,iBAAkC,CAACC;IAC9C,MAAM,EAAE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AG;QAAE3B,OAAOkC,SAAS;QAAErB;QAAkBX;KAAG;IAE9D,MAAMuC,WAAqC7D,YACzC,OAAO,EAAE8D,WAAWC,aAAa,EAAE;QACjC,MAAMD,YAAY,MAAMrD,aAAa;YACnCoC,UAAUzB,OAAO0B,MAAM,CAACC,GAAG;YAC3BC,MAAM;gBACJ1B;gBACAwC,WAAWC;gBACXV,WAAW;gBACX7B,YAAYS;YACd;YACAqB,WAAWlC,OAAOkC,SAAS;QAC7B;QAEA,OAAO;YACL,GAAGQ,SAAS;YACZN,WAAW;gBACTC,cAAc;gBACdC,iBAAiB;gBACjBC,OAAO;gBACPC,OAAO1C,SAASsC,SAAS;YAC3B;QACF;IACF,GAEA;QAACpC,OAAO0B,MAAM,CAACC,GAAG;QAAE3B,OAAOkC,SAAS;QAAErB;QAAkBX;QAAIJ,SAASsC,SAAS;KAAC;IAGjF,oBAAoB;IACpB,MAAMQ,cAAc9D,QAAQ;QAC1B,OACEgC,gBACAN,iBAAiB,uBACf,oBAAC9B;YACC,kCAAkC;YAClCyD,QAAQb;YACRd,cAAcA;YACdiC,UAAU;gBAACA;aAAS;YACpBxC,WAAWA;YACXV,MAAMA;yBAEN,oBAACE;YACCT,WAAWA;YACXsB,OAAOC;YACPT,UAAUA;YACV+C,YAAYC,MAAMC,OAAO,CAACzB,YAAYA,WAAW,EAAE;YACnDvB,SAASA;YACTI,MAAM,CAAC,EAAEA,KAAK,gBAAgB,EAAEL,SAASc,SAAS,CAAC,CAAC;YACpDE,cAAcA;YACdV,YAAYS;;IAKtB,GAAG;QACDS;QACAf;QACAR;QACAE;QACAO;QACAM;QACAjB;QACA4C;QACA5B;QACAV;KACD,EAAE,0DAA0D;;IAE7D,qBAAO,oBAAC6C;QAAIC,WAAWjE;OAAY4D;AACrC,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAqB,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAK9F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAQnE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG;IACjD,MAAM,EAAE,+BAA+B,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAyIzB,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/blocks/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAqB,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAM9F,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAQnE,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG;IACjD,MAAM,EAAE,+BAA+B,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,YAAY,EAAE,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAwHzB,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { traverseFields } from '@payloadcms/next/utilities';
1
2
  import { baseBlockFields, sanitizeFields } from 'payload/config';
2
3
  import { fieldsToJSONSchema, formatLabels } from 'payload/utilities';
3
4
  import { cloneDeep } from '../../lexical/utils/cloneDeep.js';
@@ -38,38 +39,22 @@ export const BlocksFeature = (props)=>{
38
39
  return {
39
40
  ClientComponent: BlocksFeatureClientComponent,
40
41
  clientFeatureProps: clientProps,
41
- generateSchemaMap: ({ config, props, schemaMap: schemaMapFromProps, schemaPath })=>{
42
- const schemaMap = {};
42
+ generateSchemaMap: ({ config, i18n, props })=>{
43
+ const validRelationships = config.collections.map((c)=>c.slug) || [];
43
44
  /**
44
- * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block and it runs addRow, it will request these
45
- * sub-fields from the component map. Thus we need to put them in the component map here.
46
- */ const handleFields = (parentPath, fields)=>{
47
- for (const field of fields){
48
- if ('name' in field && 'fields' in field) {
49
- schemaMap[parentPath + '.' + field.name] = field.fields;
50
- handleFields(parentPath + '.' + field.name, field.fields);
51
- }
52
- if ('blocks' in field) {
53
- for (const block of field.blocks){
54
- schemaMap[parentPath + '.' + field.name + '.' + block.slug] = block.fields || [];
55
- handleFields(parentPath + '.' + field.name + '.' + block.slug, block.fields);
56
- }
57
- }
58
- if ('tabs' in field) {
59
- for (const tab of field.tabs){
60
- if ('name' in tab) {
61
- schemaMap[parentPath + '.' + tab.name] = tab.fields || [];
62
- handleFields(parentPath + '.' + tab.name, tab.fields);
63
- } else {
64
- handleFields(parentPath, tab.fields);
65
- }
66
- }
67
- }
68
- }
69
- };
45
+ * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block, and it runs addRow, it will request these
46
+ * sub-fields from the component map. Thus, we need to put them in the component map here.
47
+ */ const schemaMap = new Map();
70
48
  for (const block of props.blocks){
71
- schemaMap[block.slug] = block.fields || [];
72
- handleFields(block.slug, block.fields);
49
+ schemaMap.set(block.slug, block.fields || []);
50
+ traverseFields({
51
+ config,
52
+ fields: block.fields,
53
+ i18n,
54
+ schemaMap,
55
+ schemaPath: block.slug,
56
+ validRelationships
57
+ });
73
58
  }
74
59
  return schemaMap;
75
60
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { cloneDeep } from '../../lexical/utils/cloneDeep.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type LexicalBlock = Omit<Block, 'fields'> & {\n fields: FieldWithRichTextRequiredEditor[]\n}\n\nexport type BlocksFeatureProps = {\n blocks: LexicalBlock[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n // Sanitization taken from payload/src/fields/config/sanitize.ts\n\n if (props?.blocks?.length) {\n props.blocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n\n return {\n ...blockCopy,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n fields: blockCopy.fields.concat(baseBlockFields as FieldWithRichTextRequiredEditor[]),\n labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels,\n }\n })\n // unSanitizedBlock.fields are sanitized in the React component and not here.\n // That's because we do not have access to the payload config here.\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n feature: () => {\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, props, schemaMap: schemaMapFromProps, schemaPath }) => {\n const schemaMap: {\n [key: string]: Field[]\n } = {}\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block and it runs addRow, it will request these\n * sub-fields from the component map. Thus we need to put them in the component map here.\n */\n const handleFields = (parentPath: string, fields: Field[]) => {\n for (const field of fields) {\n if ('name' in field && 'fields' in field) {\n schemaMap[parentPath + '.' + field.name] = field.fields\n handleFields(parentPath + '.' + field.name, field.fields)\n }\n if ('blocks' in field) {\n for (const block of field.blocks) {\n schemaMap[parentPath + '.' + field.name + '.' + block.slug] = block.fields || []\n handleFields(parentPath + '.' + field.name + '.' + block.slug, block.fields)\n }\n }\n if ('tabs' in field) {\n for (const tab of field.tabs) {\n if ('name' in tab) {\n schemaMap[parentPath + '.' + tab.name] = tab.fields || []\n handleFields(parentPath + '.' + tab.name, tab.fields)\n } else {\n handleFields(parentPath, tab.fields)\n }\n }\n }\n }\n }\n\n for (const block of props.blocks) {\n schemaMap[block.slug] = block.fields || []\n handleFields(block.slug, block.fields)\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n // sanitize blocks\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedBlocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n return {\n ...blockCopy,\n fields: sanitizeFields({\n config,\n fields: blockCopy.fields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n }),\n }\n })\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: sanitizedBlocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n nodes: [\n {\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","cloneDeep","BlocksFeatureClientComponent","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","blocks","length","map","block","blockCopy","fields","concat","labels","slug","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","feature","ClientComponent","clientFeatureProps","generateSchemaMap","config","schemaMap","schemaMapFromProps","schemaPath","handleFields","parentPath","field","name","tab","tabs","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","interfaceNameDefinitions","validRelationships","collections","c","sanitizedBlocks","requireFieldLevelRichTextEditor","blocksField","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAmB;AAKpE,SAASC,SAAS,QAAQ,mCAAkC;AAC5D,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,yBAAyB,QAAQ,yBAAwB;AAClE,SAASC,kBAAkB,QAAQ,gBAAe;AAUlD,OAAO,MAAMC,gBAGT,CAACC;IACH,gEAAgE;IAEhE,IAAIA,OAAOC,QAAQC,QAAQ;QACzBF,MAAMC,MAAM,GAAGD,MAAMC,MAAM,CAACE,GAAG,CAAC,CAACC;YAC/B,MAAMC,YAAYX,UAAUU;YAE5B,OAAO;gBACL,GAAGC,SAAS;gBACZ,4EAA4E;gBAC5EC,QAAQD,UAAUC,MAAM,CAACC,MAAM,CAACjB;gBAChCkB,QAAQ,CAACH,UAAUG,MAAM,GAAGf,aAAaY,UAAUI,IAAI,IAAIJ,UAAUG,MAA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;oBAC1C;iBACD;gBACD8C,oBAAoB9C;YACtB;QACF;QACA+C,KAAK;QACLD,oBAAoB9C;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Block, BlockField, Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { baseBlockFields, sanitizeFields } from 'payload/config'\nimport { fieldsToJSONSchema, formatLabels } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { BlocksFeatureClientProps } from './feature.client.js'\n\nimport { cloneDeep } from '../../lexical/utils/cloneDeep.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type LexicalBlock = Omit<Block, 'fields'> & {\n fields: FieldWithRichTextRequiredEditor[]\n}\n\nexport type BlocksFeatureProps = {\n blocks: LexicalBlock[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n // Sanitization taken from payload/src/fields/config/sanitize.ts\n\n if (props?.blocks?.length) {\n props.blocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n\n return {\n ...blockCopy,\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n fields: blockCopy.fields.concat(baseBlockFields as FieldWithRichTextRequiredEditor[]),\n labels: !blockCopy.labels ? formatLabels(blockCopy.slug) : blockCopy.labels,\n }\n })\n // unSanitizedBlock.fields are sanitized in the React component and not here.\n // That's because we do not have access to the payload config here.\n }\n\n // Build clientProps\n const clientProps: BlocksFeatureClientProps = {\n reducedBlocks: [],\n }\n for (const block of props.blocks) {\n clientProps.reducedBlocks.push({\n slug: block.slug,\n fieldMap: [],\n imageAltText: block.imageAltText,\n imageURL: block.imageURL,\n labels: block.labels,\n })\n }\n\n return {\n feature: () => {\n return {\n ClientComponent: BlocksFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n /**\n * Add sub-fields to the schemaMap. E.g. if you have an array field as part of the block, and it runs addRow, it will request these\n * sub-fields from the component map. Thus, we need to put them in the component map here.\n */\n const schemaMap = new Map<string, Field[]>()\n\n for (const block of props.blocks) {\n schemaMap.set(block.slug, block.fields || [])\n\n traverseFields({\n config,\n fields: block.fields,\n i18n,\n schemaMap,\n schemaPath: block.slug,\n validRelationships,\n })\n }\n\n return schemaMap\n },\n generatedTypes: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n }) => {\n if (!props?.blocks?.length) {\n return currentSchema\n }\n\n // sanitize blocks\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const sanitizedBlocks = props.blocks.map((block) => {\n const blockCopy = cloneDeep(block)\n return {\n ...blockCopy,\n fields: sanitizeFields({\n config,\n fields: blockCopy.fields,\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n }),\n }\n })\n\n const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: sanitizedBlocks,\n }\n // This is only done so that interfaceNameDefinitions sets those block's interfaceNames.\n // we don't actually use the JSON Schema itself in the generated types yet.\n fieldsToJSONSchema(\n collectionIDFieldTypes,\n [blocksField],\n interfaceNameDefinitions,\n config,\n )\n\n return currentSchema\n },\n },\n nodes: [\n {\n node: BlockNode,\n populationPromises: [blockPopulationPromiseHOC(props)],\n validations: [blockValidationHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'blocks',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","baseBlockFields","sanitizeFields","fieldsToJSONSchema","formatLabels","cloneDeep","BlocksFeatureClientComponent","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","blocks","length","map","block","blockCopy","fields","concat","labels","slug","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","feature","ClientComponent","clientFeatureProps","generateSchemaMap","config","i18n","validRelationships","collections","c","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","sanitizedBlocks","requireFieldLevelRichTextEditor","blocksField","name","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAmB;AAKpE,SAASC,SAAS,QAAQ,mCAAkC;AAC5D,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,yBAAyB,QAAQ,yBAAwB;AAClE,SAASC,kBAAkB,QAAQ,gBAAe;AAUlD,OAAO,MAAMC,gBAGT,CAACC;IACH,gEAAgE;IAEhE,IAAIA,OAAOC,QAAQC,QAAQ;QACzBF,MAAMC,MAAM,GAAGD,MAAMC,MAAM,CAACE,GAAG,CAAC,CAACC;YAC/B,MAAMC,YAAYX,UAAUU;YAE5B,OAAO;gBACL,GAAGC,SAAS;gBACZ,4EAA4E;gBAC5EC,QAAQD,UAAUC,MAAM,CAACC,MAAM,CAACjB;gBAChCkB,QAAQ,CAACH,UAAUG,MAAM,GAAGf,aAAaY,UAAUI,IAAI,IAAIJ,UAAUG,MAAM;YAC7E;QACF;IACA,8EAA8E;IAC9E,mEAAmE;IACrE;IAEA,oBAAoB;IACpB,MAAME,cAAwC;QAC5CC,eAAe,EAAE;IACnB;IACA,KAAK,MAAMP,SAASJ,MAAMC,MAA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CACF;4BACF;wBACF;wBAEA,MAAMe,cAA0B;4BAC9BC,MAAML,OAAOK,OAAO;4BACpBC,MAAM;4BACNtC,QAAQkC;wBACV;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3E3C,mBACEuC,wBACA;4BAACM;yBAAY,EACbH,0BACAd;wBAGF,OAAOY;oBACT;gBACF;gBACAQ,OAAO;oBACL;wBACEC,MAAM7C;wBACN8C,oBAAoB;4BAAC7C,0BAA0BG;yBAAO;wBACtD2C,aAAa;4BAAC7C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD4C,oBAAoB5C;YACtB;QACF;QACA6C,KAAK;QACLD,oBAAoB5C;IACtB;AACF,EAAC"}
@@ -84,9 +84,10 @@ export const LinkDrawer = ({ drawerSlug, handleModalSubmit, stateData })=>{
84
84
  }, /*#__PURE__*/ React.createElement(RenderFields, {
85
85
  fieldMap: Array.isArray(fieldMap) ? fieldMap : [],
86
86
  forceRender: true,
87
- path: "",
87
+ path: "" // See Blocks feature path for details as for why this is empty
88
+ ,
88
89
  readOnly: false,
89
- schemaPath: ""
90
+ schemaPath: schemaFieldsPath
90
91
  }), /*#__PURE__*/ React.createElement(FormSubmit, null, t('general:submit'))));
91
92
  };
92
93
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/field/features/link/drawer/index.tsx"],"sourcesContent":["import type { FormProps } from '@payloadcms/ui/forms/Form'\nimport type { FormState } from 'payload/types'\n\nimport { Drawer } from '@payloadcms/ui/elements/Drawer'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { type Props } from './types.js'\n\nconst baseClass = 'lexical-link-edit-drawer'\n\nexport const LinkDrawer: React.FC<Props> = ({ drawerSlug, handleModalSubmit, stateData }) => {\n const { t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const config = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.link.fields.fields`\n const schemaFieldsPath = `${schemaPath}.feature.link.fields`\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: stateData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n if (stateData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, stateData])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n return (\n <Drawer className={baseClass} slug={drawerSlug} title={t('fields:editLink') ?? ''}>\n {initialState !== false && (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fieldMap) ? fieldMap : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleModalSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n forceRender\n path=\"\"\n readOnly={false}\n schemaPath=\"\"\n />\n\n <FormSubmit>{t('general:submit')}</FormSubmit>\n </Form>\n )}\n </Drawer>\n )\n}\n"],"names":["Drawer","useFieldProps","Form","RenderFields","FormSubmit","useConfig","useDocumentInfo","useTranslation","getFormState","React","useCallback","useEffect","useState","v4","uuid","useEditorConfigContext","baseClass","LinkDrawer","drawerSlug","handleModalSubmit","stateData","t","id","schemaPath","config","initialState","setInitialState","field","richTextComponentMap","componentMapRenderedFieldsPath","schemaFieldsPath","fieldMap","get","awaitInitialState","state","apiRoute","routes","api","body","data","operation","serverURL","onChange","formState","prevFormState","className","slug","title","beforeSubmit","disableValidationOnSubmit","fields","Array","isArray","onSubmit","forceRender","path","readOnly"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,MAAM,QAAQ,iCAAgC;AACvD,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,IAAI,QAAQ,4BAA2B;AAChD,SAASC,YAAY,QAAQ,oCAAmC;AAChE,SAASC,UAAU,QAAQ,8BAA6B;AACxD,SAASC,SAAS,QAAQ,kCAAiC;AAC3D,SAASC,eAAe,QAAQ,wCAAuC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,YAAY,QAAQ,wCAAuC;AACpE,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAC/D,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAEjC,SAASC,sBAAsB,QAAQ,yDAAwD;AAC/F,OAAO,eAAc;AAGrB,MAAMC,YAAY;AAElB,OAAO,MAAMC,aAA8B,CAAC,EAAEC,UAAU,EAAEC,iBAAiB,EAAEC,SAAS,EAAE;IACtF,MAAM,EAAEC,CAAC,EAAE,GAAGd;IACd,MAAM,EAAEe,EAAE,EAAE,GAAGhB;IACf,MAAM,EAAEiB,UAAU,EAAE,GAAGtB;IAC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AcA;QACdiB,UAAU;YAACA;SAAS;QACpBW,UAAUlC;QACVL,MAAMA;qBAEN,oBAACX;QACC4B,UAAUoB,MAAMC,OAAO,CAACrB,YAAYA,WAAW,EAAE;QACjDuB,aAAAA;QACAC,MAAK;QACLC,UAAU;QACVjC,YAAW;sBAGb,oBAACnB,kBAAYiB,EAAE;AAKzB,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/field/features/link/drawer/index.tsx"],"sourcesContent":["import type { FormProps } from '@payloadcms/ui/forms/Form'\nimport type { FormState } from 'payload/types'\n\nimport { Drawer } from '@payloadcms/ui/elements/Drawer'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport { useEditorConfigContext } from '../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { type Props } from './types.js'\n\nconst baseClass = 'lexical-link-edit-drawer'\n\nexport const LinkDrawer: React.FC<Props> = ({ drawerSlug, handleModalSubmit, stateData }) => {\n const { t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const config = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.link.fields.fields`\n const schemaFieldsPath = `${schemaPath}.feature.link.fields`\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: stateData,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n if (stateData) {\n void awaitInitialState()\n }\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, stateData])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n return (\n <Drawer className={baseClass} slug={drawerSlug} title={t('fields:editLink') ?? ''}>\n {initialState !== false && (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fieldMap) ? fieldMap : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleModalSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n forceRender\n path=\"\" // See Blocks feature path for details as for why this is empty\n readOnly={false}\n schemaPath={schemaFieldsPath}\n />\n\n <FormSubmit>{t('general:submit')}</FormSubmit>\n </Form>\n )}\n </Drawer>\n )\n}\n"],"names":["Drawer","useFieldProps","Form","RenderFields","FormSubmit","useConfig","useDocumentInfo","useTranslation","getFormState","React","useCallback","useEffect","useState","v4","uuid","useEditorConfigContext","baseClass","LinkDrawer","drawerSlug","handleModalSubmit","stateData","t","id","schemaPath","config","initialState","setInitialState","field","richTextComponentMap","componentMapRenderedFieldsPath","schemaFieldsPath","fieldMap","get","awaitInitialState","state","apiRoute","routes","api","body","data","operation","serverURL","onChange","formState","prevFormState","className","slug","title","beforeSubmit","disableValidationOnSubmit","fields","Array","isArray","onSubmit","forceRender","path","readOnly"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAG,aAAa;;YAEhBf,gBAAgBQ;QAClB;QAEA,IAAId,WAAW;YACb,KAAKa;QACP;IACF,GAAG;QAACT,OAAOY,MAAM,CAACC,GAAG;QAAEb,OAAOiB,SAAS;QAAEX;QAAkBR;QAAIF;KAAU;IAEzE,MAAMsB,WAAqChC,YACzC,OAAO,EAAEiC,WAAWC,aAAa,EAAE;QACjC,OAAO,MAAMpC,aAAa;YACxB2B,UAAUX,OAAOY,MAAM,CAACC,GAAG;YAC3BC,MAAM;gBACJhB;gBACAqB,WAAWC;gBACXJ,WAAW;gBACXjB,YAAYO;YACd;YACAW,WAAWjB,OAAOiB,SAAS;QAC7B;IACF,GAEA;QAACjB,OAAOY,MAAM,CAACC,GAAG;QAAEb,OAAOiB,SAAS;QAAEX;QAAkBR;KAAG;IAG7D,qBACE,oBAACtB;QAAO6C,WAAW7B;QAAW8B,MAAM5B;QAAY6B,OAAO1B,EAAE,sBAAsB;OAC5EI,iBAAiB,uBAChB,oBAACvB;QACC8C,cAAc;YAACN;SAAS;QACxBO,2BAAAA;QACAC,QAAQC,MAAMC,OAAO,CAACrB,YAAYA,WAAW,EAAE;QAC/CN,cAAcA;QACdiB,UAAU;YAACA;SAAS;QACpBW,UAAUlC;QACVL,MAAMA;qBAEN,oBAACX;QACC4B,UAAUoB,MAAMC,OAAO,CAACrB,YAAYA,WAAW,EAAE;QACjDuB,aAAAA;QACAC,MAAK,GAAG,+DAA+D;;QACvEC,UAAU;QACVjC,YAAYO;sBAGd,oBAAC1B,kBAAYiB,EAAE;AAKzB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAGpE,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAUtD,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG;IACnE;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,+BAA+B,EAAE,CAAA;QAChD,IAAI,EAAE,IAAI,CAAA;KACX,KAAK,+BAA+B,EAAE,CAAC,GACxC,+BAA+B,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CA8F1F,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/link/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAS,+BAA+B,EAAE,MAAM,eAAe,CAAA;AAK3E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAUtD,MAAM,MAAM,6BAA6B,GACrC;IACE;;;QAGI;IACJ,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAG9B,kBAAkB,CAAC,EAAE,KAAK,CAAA;CAC3B,GACD;IAEE,mBAAmB,CAAC,EAAE,KAAK,CAAA;IAE3B;;;QAGI;IACJ,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC9B,CAAA;AAEL,MAAM,MAAM,sBAAsB,GAAG,6BAA6B,GAAG;IACnE;;;OAGG;IACH,MAAM,CAAC,EACH,CAAC,CAAC,IAAI,EAAE;QACN,MAAM,EAAE,eAAe,CAAA;QACvB,aAAa,EAAE,+BAA+B,EAAE,CAAA;QAChD,IAAI,EAAE,IAAI,CAAA;KACX,KAAK,+BAA+B,EAAE,CAAC,GACxC,+BAA+B,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,6BAA6B,CAAC,sBAAsB,EAAE,WAAW,CAgH1F,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { traverseFields } from '@payloadcms/next/utilities';
1
2
  import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
2
3
  import { LinkFeatureClientComponent } from './feature.client.js';
3
4
  import { AutoLinkNode } from './nodes/AutoLinkNode.js';
@@ -17,9 +18,22 @@ export const LinkFeature = (props)=>{
17
18
  enabledCollections: props.enabledCollections
18
19
  },
19
20
  generateSchemaMap: ({ config, i18n, props })=>{
20
- return {
21
- fields: transformExtraFields(props.fields, config, i18n, props.enabledCollections, props.disabledCollections)
22
- };
21
+ if (!props?.fields || !Array.isArray(props.fields) || props.fields.length === 0) {
22
+ return null;
23
+ }
24
+ const schemaMap = new Map();
25
+ const validRelationships = config.collections.map((c)=>c.slug) || [];
26
+ const transformedFields = transformExtraFields(props.fields, config, i18n, props.enabledCollections, props.disabledCollections);
27
+ schemaMap.set('fields', transformedFields);
28
+ traverseFields({
29
+ config,
30
+ fields: transformedFields,
31
+ i18n,
32
+ schemaMap,
33
+ schemaPath: 'fields',
34
+ validRelationships
35
+ });
36
+ return schemaMap;
23
37
  },
24
38
  nodes: [
25
39
  {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './nodes/types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { LinkNode } from './nodes/LinkNode.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\nimport { linkPopulationPromiseHOC } from './populationPromise.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldWithRichTextRequiredEditor[]\n i18n: I18n\n }) => FieldWithRichTextRequiredEditor[])\n | FieldWithRichTextRequiredEditor[]\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: () => {\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n return {\n fields: transformExtraFields(\n props.fields,\n config,\n i18n,\n props.enabledCollections,\n props.disabledCollections,\n ),\n }\n },\n nodes: [\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n } as HTMLConverter<SerializedAutoLinkNode>,\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n } as HTMLConverter<SerializedLinkNode>,\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["convertLexicalNodesToHTML","LinkFeatureClientComponent","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","LinkFeature","props","feature","ClientComponent","clientFeatureProps","disabledCollections","enabledCollections","generateSchemaMap","config","i18n","fields","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","href","url","linkType","doc","value","id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R,KAAKL,MAAM,CAACgB,GAAG,EAAEC,UAAU,WAC9BZ,KAAKL,MAAM,CAACgB,GAAG,EAAEC,QACjBZ,KAAKL,MAAM,CAACgB,GAAG,EAAEC,OAAOC;oCAChC;oCAEA,OAAO,CAAC,SAAS,EAAEL,KAAK,CAAC,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCACtD;gCACAW,WAAW;oCAACjC,aAAakC,OAAO;iCAAG;4BACrC;wBACF;wBACAf,MAAMnB;wBACNmC,oBAAoB;4BAAChC,yBAAyBE;yBAAO;oBACvD;oBACA;wBACEW,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAMxB,0BAA0B;wCACnDkB;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,MAAMI,MAAcN,KAAKL,MAAM,CAACY,MAAM,GAAG,+BAA+B;oCAExE,MAAMC,OACJR,KAAKL,MAAM,CAACe,QAAQ,KAAK,WACrBV,KAAKL,MAAM,CAACc,GAAG,GACdT,KAAKL,MAAM,CAACgB,GAAG,EAAEC;oCAExB,OAAO,CAAC,SAAS,EAAEJ,KAAK,CAAC,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCACtD;gCACAW,WAAW;oCAAChC,SAASiC,OAAO;iCAAG;4BACjC;wBACF;wBACAf,MAAMlB;wBACNkC,oBAAoB;4BAAChC,yBAAyBE;yBAAO;oBACvD;iBACD;gBACD+B,oBAAoB/B;YACtB;QACF;QACAgC,KAAK;QACLD,oBAAoB/B;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, FieldWithRichTextRequiredEditor } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\n\nimport type { HTMLConverter } from '../converters/html/converter/types.js'\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './nodes/types.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { AutoLinkNode } from './nodes/AutoLinkNode.js'\nimport { LinkNode } from './nodes/LinkNode.js'\nimport { transformExtraFields } from './plugins/floatingLinkEditor/utilities.js'\nimport { linkPopulationPromiseHOC } from './populationPromise.js'\n\nexport type ExclusiveLinkCollectionsProps =\n | {\n /**\n * The collections that should be disabled for internal linking. Overrides the `enableRichTextLink` property in the collection config.\n * When this property is set, `enabledCollections` will not be available.\n **/\n disabledCollections?: string[]\n\n // Ensures that enabledCollections is not available when disabledCollections is set\n enabledCollections?: never\n }\n | {\n // Ensures that disabledCollections is not available when enabledCollections is set\n disabledCollections?: never\n\n /**\n * The collections that should be enabled for internal linking. Overrides the `enableRichTextLink` property in the collection config\n * When this property is set, `disabledCollections` will not be available.\n **/\n enabledCollections?: string[]\n }\n\nexport type LinkFeatureServerProps = ExclusiveLinkCollectionsProps & {\n /**\n * A function or array defining additional fields for the link feature. These will be\n * displayed in the link editor drawer.\n */\n fields?:\n | ((args: {\n config: SanitizedConfig\n defaultFields: FieldWithRichTextRequiredEditor[]\n i18n: I18n\n }) => FieldWithRichTextRequiredEditor[])\n | FieldWithRichTextRequiredEditor[]\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: () => {\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n if (!props?.fields || !Array.isArray(props.fields) || props.fields.length === 0) {\n return null\n }\n const schemaMap = new Map<string, Field[]>()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const transformedFields = transformExtraFields(\n props.fields,\n config,\n i18n,\n props.enabledCollections,\n props.disabledCollections,\n )\n\n schemaMap.set('fields', transformedFields)\n\n traverseFields({\n config,\n fields: transformedFields,\n i18n,\n schemaMap,\n schemaPath: 'fields',\n validRelationships,\n })\n\n return schemaMap\n },\n nodes: [\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n let href: string = node.fields.url\n if (node.fields.linkType === 'internal') {\n href =\n typeof node.fields.doc?.value === 'string'\n ? node.fields.doc?.value\n : node.fields.doc?.value?.id\n }\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n } as HTMLConverter<SerializedAutoLinkNode>,\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n {\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n\n const href: string =\n node.fields.linkType === 'custom'\n ? node.fields.url\n : (node.fields.doc?.value as string)\n\n return `<a href=\"${href}\"${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n } as HTMLConverter<SerializedLinkNode>,\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n },\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","convertLexicalNodesToHTML","LinkFeatureClientComponent","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","LinkFeature","props","feature","ClientComponent","clientFeatureProps","disabledCollections","enabledCollections","generateSchemaMap","config","i18n","fields","Array","isArray","length","schemaMap","Map","validRelationships","collections","map","c","slug","transformedFields","set","schemaPath","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","href","url","linkType","doc","value","id","nodeTypes","getType","populationPromises","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAIA,SAASA,cAAc,QAAQ,6BAA4B;AAO3D,SAASC,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,0BAA0B,QAAQ,sBAAqB;AAChE,SAASC,YAAY,QAAQ,0BAAyB;AACtD,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,oBAAoB,QAAQ,4CAA2C;AAChF,SAASC,wBAAwB,QAAQ,yBAAwB;AAsCjE,OAAO,MAAMC,cAAkF,CAC7FC;IAEA,IAAI,CAACA,OAAO;QACVA,QAAQ,CAAC;IACX;IACA,OAAO;QACLC,SAAS;YACP,OAAO;gBACLC,iBAAiBR;gBACjBS,oBAAoB;oBAClBC,qBAAqBJ,MAAMI,mBAAmB;oBAC9CC,oBAAoBL,MAAMK,kBAAkB;gBAC9C;gBACAC,mBAAmB,CAAC,EAAEC,MAAM,EAAEC,IAAI,EAAER,KAAK,EAAE;oBACzC,IAAI,CAACA,OAAOS,UAAU,CAACC,MAAMC,OAAO,CAACX,MAAMS,MAAM,KAAKT,MAAMS,MAAM,CAACG,MAAM,KAAK,GAAG;wBAC/E,OAAO;oBACT;oBACA,MAAMC,YAAY,IAAIC;oBAEtB,MAAMC,qBAAqBR,OAAOS,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;oBAEtE,M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AKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,MAAMI,MAAcN,KAAKlB,MAAM,CAACyB,MAAM,GAAG,+BAA+B;oCAExE,MAAMC,OACJR,KAAKlB,MAAM,CAAC4B,QAAQ,KAAK,WACrBV,KAAKlB,MAAM,CAAC2B,GAAG,GACdT,KAAKlB,MAAM,CAAC6B,GAAG,EAAEC;oCAExB,OAAO,CAAC,SAAS,EAAEJ,KAAK,CAAC,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCACtD;gCACAW,WAAW;oCAAC7C,SAAS8C,OAAO;iCAAG;4BACjC;wBACF;wBACAf,MAAM/B;wBACN+C,oBAAoB;4BAAC7C,yBAAyBE;yBAAO;oBACvD;iBACD;gBACD4C,oBAAoB5C;YACtB;QACF;QACA6C,KAAK;QACLD,oBAAoB5C;IACtB;AACF,EAAC"}
@@ -142,11 +142,7 @@ export type ServerFeature<ServerProps, ClientFeatureProps> = {
142
142
  props: ServerProps;
143
143
  schemaMap: Map<string, Field[]>;
144
144
  schemaPath: string;
145
- }) => {
146
- [key: string]: Field[];
147
- } | Promise<{
148
- [key: string]: Field[];
149
- }>;
145
+ }) => Map<string, Field[]> | null;
150
146
  generatedTypes?: {
151
147
  modifyOutputSchema: ({ collectionIDFieldTypes, config, currentSchema, field, interfaceNameDefinitions, isRequired, }: {
152
148
  collectionIDFieldTypes: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/field/features/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAA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} from '@lexical/markdown'\nimport type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { Klass, LexicalEditor, LexicalNode, SerializedEditorState } from 'lexical'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { LexicalNodeReplacement } from 'lexical'\nimport type { RequestContext } from 'payload'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, PayloadRequest, RichTextField, ValidateOptions } from 'payload/types'\nimport type React from 'react'\n\nimport type { AdapterProps } from '../../types.js'\nimport type { ClientEditorConfig, ServerEditorConfig } from '../lexical/config/types.js'\nimport type { FloatingToolbarSection } from '../lexical/plugins/FloatingSelectToolbar/types.js'\nimport type { SlashMenuGroup } from '../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n}) => Promise<void>[]\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<ServerFeatureProps, ClientFeatureProps> = (\n props?: ServerFeatureProps,\n) => FeatureProviderServer<ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<ServerFeatureProps, ClientFeatureProps> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first and are available in the `feature` property*/\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. The FeatureProviders dependencies are optional, but are considered as last-priority in the loading process */\n dependenciesSoft?: string[]\n\n feature: (props: {\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) => ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerFeatureProps\n}\n\nexport type FeatureProviderProviderClient<ClientFeatureProps> = (\n props?: ClientComponentProps<ClientFeatureProps>,\n) => FeatureProviderClient<ClientFeatureProps>\n\n/**\n * No dependencies => Features need to be sorted on the server first, then sent to client in right order\n */\nexport type FeatureProviderClient<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n feature: (props: {\n clientFunctions: Record<string, any>\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ClientFeatureProviderMap\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedClientFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ClientEditorConfig\n }) => ClientFeature<ClientFeatureProps>\n}\n\nexport type ClientFeature<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n\n floatingSelectToolbar?: {\n sections: FloatingToolbarSection[]\n }\n hooks?: {\n load?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n save?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<Klass<LexicalNode> | LexicalNodeReplacement>\n plugins?: Array<\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC<{ anchorElem: HTMLElement }>\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n >\n slashMenu?: {\n dynamicOptions?: ({\n editor,\n queryString,\n }: {\n editor: LexicalEditor\n queryString: string\n }) => SlashMenuGroup[]\n options?: SlashMenuGroup[]\n }\n}\n\nexport type ClientComponentProps<ClientFeatureProps> = ClientFeatureProps & {\n featureKey: string\n order: number\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientComponent?: React.FC<ClientComponentProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n generateComponentMap?: (args: {\n config: SanitizedConfig\n i18n: I18n\n props: ServerProps\n schemaPath: string\n }) => {\n [key: string]: React.FC<{ componentKey: string; featureKey: string }>\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n i18n: I18n\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) =>\n | {\n [key: string]: Field[]\n }\n | Promise<{\n [key: string]: Field[]\n }>\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n hooks?: {\n afterReadPromise?: ({\n field,\n incomingEditorState,\n siblingDoc,\n }: {\n field: RichTextField<SerializedEditorState, AdapterProps>\n incomingEditorState: SerializedEditorState\n siblingDoc: Record<string, unknown>\n }) => Promise<void> | null\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<{\n converters?: {\n html?: HTMLConverter\n }\n node: Klass<LexicalNode> | LexicalNodeReplacement\n populationPromises?: Array<PopulationPromise>\n validations?: Array<NodeValidation>\n }>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = ServerFeature<\n ServerProps,\n ClientFeatureProps\n> &\n Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n > & {\n order: number\n }\n\nexport type ResolvedClientFeature<ClientFeatureProps> = ClientFeature<ClientFeatureProps> & {\n key: string\n order: number\n}\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<unknown, unknown>>\nexport type ResolvedClientFeatureMap = Map<string, ResolvedClientFeature<unknown>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<unknown, unknown>>\nexport type ClientFeatureProviderMap = Map<string, FeatureProviderClient<unknown>>\n\nexport type SanitizedPlugin =\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n key: string\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n key: string\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n key: string\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC<{ anchorElem: HTMLElement }>\n desktopOnly?: boolean\n key: string\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n\nexport type SanitizedServerFeatures = Required<\n Pick<ResolvedServerFeature<unknown, unknown>, 'markdownTransformers' | 'nodes'>\n> & {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n hooks: {\n afterReadPromises: Array<\n ({\n field,\n incomingEditorState,\n siblingDoc,\n }: {\n field: RichTextField<SerializedEditorState, AdapterProps>\n incomingEditorState: SerializedEditorState\n siblingDoc: Record<string, unknown>\n }) => Promise<void> | null\n >\n }\n /** The node types mapped to their populationPromises */\n populationPromises: Map<string, Array<PopulationPromise>>\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n}\n\nexport type SanitizedClientFeatures = Required<\n Pick<ResolvedClientFeature<unknown>, 'markdownTransformers' | 'nodes'>\n> & {\n /** The keys of all enabled features */\n enabledFeatures: string[]\n floatingSelectToolbar: {\n sections: FloatingToolbarSection[]\n }\n hooks: {\n load: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n save: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n }\n plugins?: Array<SanitizedPlugin>\n slashMenu: {\n dynamicOptions: Array<\n ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => SlashMenuGroup[]\n >\n groupsWithOptions: SlashMenuGroup[]\n }\n}\n"],"names":[],"rangeMappings":"","mappings":"AAgWA,WA+BC"}
1
+ {"version":3,"sources":["../../../src/field/features/types.ts"],"sourcesContent":["import type { Transformer } from '@lexical/markdown'\nimport type { I18n } from '@payloadcms/translations'\nimport type { JSONSchema4 } from 'json-schema'\nimport type { Klass, LexicalEditor, LexicalNode, SerializedEditorState } from 'lexical'\nimport type { SerializedLexicalNode } from 'lexical'\nimport type { LexicalNodeReplacement } from 'lexical'\nimport type { RequestContext } from 'payload'\nimport type { SanitizedConfig } from 'payload/config'\nimport type { Field, PayloadRequest, RichTextField, ValidateOptions } from 'payload/types'\nimport type React from 'react'\n\nimport type { AdapterProps } from '../../types.js'\nimport type { ClientEditorConfig, ServerEditorConfig } from '../lexical/config/types.js'\nimport type { FloatingToolbarSection } from '../lexical/plugins/FloatingSelectToolbar/types.js'\nimport type { SlashMenuGroup } from '../lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js'\nimport type { HTMLConverter } from './converters/html/converter/types.js'\n\nexport type PopulationPromise<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: {\n context: RequestContext\n currentDepth: number\n depth: number\n /**\n * This maps all population promises to the node type\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n findMany: boolean\n flattenLocales: boolean\n node: T\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n}) => Promise<void>[]\n\nexport type NodeValidation<T extends SerializedLexicalNode = SerializedLexicalNode> = ({\n node,\n nodeValidations,\n validation,\n}: {\n node: T\n nodeValidations: Map<string, Array<NodeValidation>>\n validation: {\n options: ValidateOptions<unknown, unknown, RichTextField>\n value: SerializedEditorState\n }\n}) => Promise<string | true> | string | true\n\nexport type FeatureProviderProviderServer<ServerFeatureProps, ClientFeatureProps> = (\n props?: ServerFeatureProps,\n) => FeatureProviderServer<ServerFeatureProps, ClientFeatureProps>\n\nexport type FeatureProviderServer<ServerFeatureProps, ClientFeatureProps> = {\n /** Keys of dependencies needed for this feature. These dependencies do not have to be loaded first */\n dependencies?: string[]\n /** Keys of priority dependencies needed for this feature. These dependencies have to be loaded first and are available in the `feature` property*/\n dependenciesPriority?: string[]\n /** Keys of soft-dependencies needed for this feature. The FeatureProviders dependencies are optional, but are considered as last-priority in the loading process */\n dependenciesSoft?: string[]\n\n feature: (props: {\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ServerFeatureProviderMap\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedServerFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ServerEditorConfig\n }) => ServerFeature<ServerFeatureProps, ClientFeatureProps>\n key: string\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerFeatureProps\n}\n\nexport type FeatureProviderProviderClient<ClientFeatureProps> = (\n props?: ClientComponentProps<ClientFeatureProps>,\n) => FeatureProviderClient<ClientFeatureProps>\n\n/**\n * No dependencies => Features need to be sorted on the server first, then sent to client in right order\n */\nexport type FeatureProviderClient<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n feature: (props: {\n clientFunctions: Record<string, any>\n /** unSanitizedEditorConfig.features, but mapped */\n featureProviderMap: ClientFeatureProviderMap\n // other resolved features, which have been loaded before this one. All features declared in 'dependencies' should be available here\n resolvedFeatures: ResolvedClientFeatureMap\n // unSanitized EditorConfig,\n unSanitizedEditorConfig: ClientEditorConfig\n }) => ClientFeature<ClientFeatureProps>\n}\n\nexport type ClientFeature<ClientFeatureProps> = {\n /**\n * Return props, to make it easy to retrieve passed in props to this Feature for the client if anyone wants to\n */\n clientFeatureProps: ClientComponentProps<ClientFeatureProps>\n\n floatingSelectToolbar?: {\n sections: FloatingToolbarSection[]\n }\n hooks?: {\n load?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n save?: ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<Klass<LexicalNode> | LexicalNodeReplacement>\n plugins?: Array<\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC<{ anchorElem: HTMLElement }>\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n >\n slashMenu?: {\n dynamicOptions?: ({\n editor,\n queryString,\n }: {\n editor: LexicalEditor\n queryString: string\n }) => SlashMenuGroup[]\n options?: SlashMenuGroup[]\n }\n}\n\nexport type ClientComponentProps<ClientFeatureProps> = ClientFeatureProps & {\n featureKey: string\n order: number\n}\n\nexport type ServerFeature<ServerProps, ClientFeatureProps> = {\n ClientComponent?: React.FC<ClientComponentProps<ClientFeatureProps>>\n /**\n * This determines what props will be available on the Client.\n */\n clientFeatureProps?: ClientFeatureProps\n generateComponentMap?: (args: {\n config: SanitizedConfig\n i18n: I18n\n props: ServerProps\n schemaPath: string\n }) => {\n [key: string]: React.FC<{ componentKey: string; featureKey: string }>\n }\n generateSchemaMap?: (args: {\n config: SanitizedConfig\n i18n: I18n\n props: ServerProps\n schemaMap: Map<string, Field[]>\n schemaPath: string\n }) => Map<string, Field[]> | null\n generatedTypes?: {\n modifyOutputSchema: ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n }\n hooks?: {\n afterReadPromise?: ({\n field,\n incomingEditorState,\n siblingDoc,\n }: {\n field: RichTextField<SerializedEditorState, AdapterProps>\n incomingEditorState: SerializedEditorState\n siblingDoc: Record<string, unknown>\n }) => Promise<void> | null\n }\n markdownTransformers?: Transformer[]\n nodes?: Array<{\n converters?: {\n html?: HTMLConverter\n }\n node: Klass<LexicalNode> | LexicalNodeReplacement\n populationPromises?: Array<PopulationPromise>\n validations?: Array<NodeValidation>\n }>\n\n /** Props which were passed into your feature will have to be passed here. This will allow them to be used / read in other places of the code, e.g. wherever you can use useEditorConfigContext */\n serverFeatureProps: ServerProps\n}\n\nexport type ResolvedServerFeature<ServerProps, ClientFeatureProps> = ServerFeature<\n ServerProps,\n ClientFeatureProps\n> &\n Required<\n Pick<\n FeatureProviderServer<ServerProps, ClientFeatureProps>,\n 'dependencies' | 'dependenciesPriority' | 'dependenciesSoft' | 'key'\n >\n > & {\n order: number\n }\n\nexport type ResolvedClientFeature<ClientFeatureProps> = ClientFeature<ClientFeatureProps> & {\n key: string\n order: number\n}\n\nexport type ResolvedServerFeatureMap = Map<string, ResolvedServerFeature<unknown, unknown>>\nexport type ResolvedClientFeatureMap = Map<string, ResolvedClientFeature<unknown>>\n\nexport type ServerFeatureProviderMap = Map<string, FeatureProviderServer<unknown, unknown>>\nexport type ClientFeatureProviderMap = Map<string, FeatureProviderClient<unknown>>\n\nexport type SanitizedPlugin =\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n key: string\n position: 'bottom' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n key: string\n position: 'normal' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC\n key: string\n position: 'top' // Determines at which position the Component will be added.\n }\n | {\n // plugins are anything which is not directly part of the editor. Like, creating a command which creates a node, or opens a modal, or some other more \"outside\" functionality\n Component: React.FC<{ anchorElem: HTMLElement }>\n desktopOnly?: boolean\n key: string\n position: 'floatingAnchorElem' // Determines at which position the Component will be added.\n }\n\nexport type SanitizedServerFeatures = Required<\n Pick<ResolvedServerFeature<unknown, unknown>, 'markdownTransformers' | 'nodes'>\n> & {\n /** The node types mapped to their converters */\n converters: {\n html: HTMLConverter[]\n }\n /** The keys of all enabled features */\n enabledFeatures: string[]\n generatedTypes: {\n modifyOutputSchemas: Array<\n ({\n collectionIDFieldTypes,\n config,\n currentSchema,\n field,\n interfaceNameDefinitions,\n isRequired,\n }: {\n collectionIDFieldTypes: { [key: string]: 'number' | 'string' }\n config?: SanitizedConfig\n /**\n * Current schema which will be modified by this function.\n */\n currentSchema: JSONSchema4\n field: RichTextField<SerializedEditorState, AdapterProps>\n /**\n * Allows you to define new top-level interfaces that can be re-used in the output schema.\n */\n interfaceNameDefinitions: Map<string, JSONSchema4>\n isRequired: boolean\n }) => JSONSchema4\n >\n }\n hooks: {\n afterReadPromises: Array<\n ({\n field,\n incomingEditorState,\n siblingDoc,\n }: {\n field: RichTextField<SerializedEditorState, AdapterProps>\n incomingEditorState: SerializedEditorState\n siblingDoc: Record<string, unknown>\n }) => Promise<void> | null\n >\n }\n /** The node types mapped to their populationPromises */\n populationPromises: Map<string, Array<PopulationPromise>>\n /** The node types mapped to their validations */\n validations: Map<string, Array<NodeValidation>>\n}\n\nexport type SanitizedClientFeatures = Required<\n Pick<ResolvedClientFeature<unknown>, 'markdownTransformers' | 'nodes'>\n> & {\n /** The keys of all enabled features */\n enabledFeatures: string[]\n floatingSelectToolbar: {\n sections: FloatingToolbarSection[]\n }\n hooks: {\n load: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n save: Array<\n ({\n incomingEditorState,\n }: {\n incomingEditorState: SerializedEditorState\n }) => SerializedEditorState\n >\n }\n plugins?: Array<SanitizedPlugin>\n slashMenu: {\n dynamicOptions: Array<\n ({ editor, queryString }: { editor: LexicalEditor; queryString: string }) => SlashMenuGroup[]\n >\n groupsWithOptions: SlashMenuGroup[]\n }\n}\n"],"names":[],"rangeMappings":"","mappings":"AA0VA,WA+BC"}
@@ -116,9 +116,10 @@ import { useEditorConfigContext } from '../../../../lexical/config/client/Editor
116
116
  }, /*#__PURE__*/ React.createElement(RenderFields, {
117
117
  fieldMap: Array.isArray(fieldMap) ? fieldMap : [],
118
118
  forceRender: true,
119
- path: "",
119
+ path: "" // See Blocks feature path for details as for why this is empty
120
+ ,
120
121
  readOnly: false,
121
- schemaPath: ""
122
+ schemaPath: schemaFieldsPath
122
123
  }), /*#__PURE__*/ React.createElement(FormSubmit, null, t('fields:saveChanges'))));
123
124
  };
124
125
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/field/features/upload/component/ExtraFieldsDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, FormState } from 'payload/types'\n\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { getTranslation } from '@payloadcms/translations'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Drawer } from '@payloadcms/ui/elements/Drawer'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { deepCopyObject } from 'payload/utilities'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { UploadData, UploadNode } from '../../nodes/UploadNode.js'\nimport type { ElementProps } from '../index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\n\n/**\n * This handles the extra fields, e.g. captions or alt text, which are\n * potentially added to the upload feature.\n */\nexport const ExtraFieldsUploadDrawer: React.FC<\n ElementProps & {\n drawerSlug: string\n relatedCollection: ClientCollectionConfig\n }\n> = (props) => {\n const { useModal } = facelessUIImport\n\n const {\n data: { fields, relationTo, value },\n drawerSlug,\n nodeKey,\n relatedCollection,\n } = props\n\n const [editor] = useLexicalComposerContext()\n\n const { closeModal } = useModal()\n\n const { i18n, t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const config = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.upload.fields.${relatedCollection.slug}`\n const schemaFieldsPath = `${schemaPath}.feature.upload.${relatedCollection.slug}`\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: deepCopyObject(fields || {}),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, fields])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n const handleUpdateEditData = useCallback(\n (_, data) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: UploadNode | null = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n\n closeModal(drawerSlug)\n },\n [closeModal, editor, drawerSlug, nodeKey],\n )\n\n return (\n <Drawer\n slug={drawerSlug}\n title={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n >\n {initialState !== false && (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleUpdateEditData}\n uuid={uuid()}\n >\n <RenderFields\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n forceRender\n path=\"\"\n readOnly={false}\n schemaPath=\"\"\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )}\n </Drawer>\n )\n}\n"],"names":["facelessUIImport","lexicalComposerContextImport","useLexicalComposerContext","getTranslation","lexicalImport","$getNodeByKey","Drawer","useFieldProps","Form","RenderFields","FormSubmit","useConfig","useDocumentInfo","useTranslation","getFormState","deepCopyObject","React","useCallback","useEffect","useState","v4","uuid","useEditorConfigContext","ExtraFieldsUploadDrawer","props","useModal","data","fields","relationTo","value","drawerSlug","nodeKey","relatedCollection","editor","closeModal","i18n","t","id","schemaPath","config","initialState","setInitialState","field","richTextComponentMap","componentMapRenderedFieldsPath","slug","schemaFieldsPath","fieldMap","get","awaitInitialState","state","apiRoute","routes","api","body","operation","serverURL","onChange","formState","prevFormState","handleUpdateEditData","_","update","uploadNode","newData","getData","setData","title","label","labels","singular","beforeSubmit","disableValidationOnSubmit","onSubmit","Array","isArray","forceRender","path","readOnly"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,YAAYA,sBAAsB,qBAAoB;AACtD,OAAOC,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,mBAAmB,UAAS;AACnC,MAAM,EAAEC,aAAa,EAAE,GAAGD;AAG1B,SAASE,MAAM,QAAQ,i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S;QACxBe,2BAAAA;QACA,kCAAkC;QAClC7C,QAAQoB;QACRP,cAAcA;QACdiB,UAAU;YAACA;SAAS;QACpBgB,UAAUb;QACVvC,MAAMA;qBAEN,oBAACZ;QACCsC,UAAU2B,MAAMC,OAAO,CAAC5B,YAAYA,WAAW,EAAE;QACjD6B,aAAAA;QACAC,MAAK;QACLC,UAAU;QACVxC,YAAW;sBAEb,oBAAC5B,kBAAY0B,EAAE;AAKzB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/field/features/upload/component/ExtraFieldsDrawer/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, FormState } from 'payload/types'\n\nimport * as facelessUIImport from '@faceless-ui/modal'\nimport lexicalComposerContextImport from '@lexical/react/LexicalComposerContext.js'\nconst { useLexicalComposerContext } = lexicalComposerContextImport\nimport { getTranslation } from '@payloadcms/translations'\nimport lexicalImport from 'lexical'\nconst { $getNodeByKey } = lexicalImport\nimport type { FormProps } from '@payloadcms/ui/forms/Form'\n\nimport { Drawer } from '@payloadcms/ui/elements/Drawer'\nimport { useFieldProps } from '@payloadcms/ui/forms/FieldPropsProvider'\nimport { Form } from '@payloadcms/ui/forms/Form'\nimport { RenderFields } from '@payloadcms/ui/forms/RenderFields'\nimport { FormSubmit } from '@payloadcms/ui/forms/Submit'\nimport { useConfig } from '@payloadcms/ui/providers/Config'\nimport { useDocumentInfo } from '@payloadcms/ui/providers/DocumentInfo'\nimport { useTranslation } from '@payloadcms/ui/providers/Translation'\nimport { getFormState } from '@payloadcms/ui/utilities/getFormState'\nimport { deepCopyObject } from 'payload/utilities'\nimport React, { useCallback, useEffect, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { UploadData, UploadNode } from '../../nodes/UploadNode.js'\nimport type { ElementProps } from '../index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\n\n/**\n * This handles the extra fields, e.g. captions or alt text, which are\n * potentially added to the upload feature.\n */\nexport const ExtraFieldsUploadDrawer: React.FC<\n ElementProps & {\n drawerSlug: string\n relatedCollection: ClientCollectionConfig\n }\n> = (props) => {\n const { useModal } = facelessUIImport\n\n const {\n data: { fields, relationTo, value },\n drawerSlug,\n nodeKey,\n relatedCollection,\n } = props\n\n const [editor] = useLexicalComposerContext()\n\n const { closeModal } = useModal()\n\n const { i18n, t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const config = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `feature.upload.fields.${relatedCollection.slug}`\n const schemaFieldsPath = `${schemaPath}.feature.upload.${relatedCollection.slug}`\n\n const fieldMap = richTextComponentMap.get(componentMapRenderedFieldsPath) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: deepCopyObject(fields || {}),\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, fields])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n const handleUpdateEditData = useCallback(\n (_, data) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: UploadNode | null = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n\n closeModal(drawerSlug)\n },\n [closeModal, editor, drawerSlug, nodeKey],\n )\n\n return (\n <Drawer\n slug={drawerSlug}\n title={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n >\n {initialState !== false && (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n // @ts-expect-error TODO: Fix this\n fields={fieldMap}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleUpdateEditData}\n uuid={uuid()}\n >\n <RenderFields\n fieldMap={Array.isArray(fieldMap) ? fieldMap : []}\n forceRender\n path=\"\" // See Blocks feature path for details as for why this is empty\n readOnly={false}\n schemaPath={schemaFieldsPath}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )}\n </Drawer>\n )\n}\n"],"names":["facelessUIImport","lexicalComposerContextImport","useLexicalComposerContext","getTranslation","lexicalImport","$getNodeByKey","Drawer","useFieldProps","Form","RenderFields","FormSubmit","useConfig","useDocumentInfo","useTranslation","getFormState","deepCopyObject","React","useCallback","useEffect","useState","v4","uuid","useEditorConfigContext","ExtraFieldsUploadDrawer","props","useModal","data","fields","relationTo","value","drawerSlug","nodeKey","relatedCollection","editor","closeModal","i18n","t","id","schemaPath","config","initialState","setInitialState","field","richTextComponentMap","componentMapRenderedFieldsPath","slug","schemaFieldsPath","fieldMap","get","awaitInitialState","state","apiRoute","routes","api","body","operation","serverURL","onChange","formState","prevFormState","handleUpdateEditData","_","update","uploadNode","newData","getData","setData","title","label","labels","singular","beforeSubmit","disableValidationOnSubmit","onSubmit","Array","isArray","forceRender","path","readOnly"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;AAGA,YAAYA,sBAAsB,qBAAoB;AACtD,OAAOC,kCAAkC,2CAA0C;AACnF,MAAM,EAAEC,yBAAyB,EAAE,GAAGD;AACtC,SAASE,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,mBAAmB,UAAS;AACnC,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QAC3D;OAECK,iBAAiB,uBAChB,oBAAChC;QACC+D,cAAc;YAACd;SAAS;QACxBe,2BAAAA;QACA,kCAAkC;QAClC7C,QAAQoB;QACRP,cAAcA;QACdiB,UAAU;YAACA;SAAS;QACpBgB,UAAUb;QACVvC,MAAMA;qBAEN,oBAACZ;QACCsC,UAAU2B,MAAMC,OAAO,CAAC5B,YAAYA,WAAW,EAAE;QACjD6B,aAAAA;QACAC,MAAK,GAAG,+DAA+D;;QACvEC,UAAU;QACVxC,YAAYQ;sBAEd,oBAACpC,kBAAY0B,EAAE;AAKzB,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,+BAA+B,EAAW,MAAM,eAAe,CAAA;AAGpF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAOnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE;QACX,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,MAAM,EAAE,+BAA+B,EAAE,CAAA;SAC1C,CAAA;KACF,CAAA;CACF,CAAA;AASD,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAuHzB,CAAA"}
1
+ {"version":3,"file":"feature.server.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/feature.server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,+BAA+B,EAAW,MAAM,eAAe,CAAA;AAKpF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAA;AAChE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAOnE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE;QACX,CAAC,UAAU,EAAE,MAAM,GAAG;YACpB,MAAM,EAAE,+BAA+B,EAAE,CAAA;SAC1C,CAAA;KACF,CAAA;CACF,CAAA;AASD,eAAO,MAAM,aAAa,EAAE,6BAA6B,CACvD,kBAAkB,EAClB,wBAAwB,CAgIzB,CAAA"}
@@ -1,3 +1,4 @@
1
+ import { traverseFields } from '@payloadcms/next/utilities';
1
2
  import { UploadFeatureClientComponent } from './feature.client.js';
2
3
  import { UploadNode } from './nodes/UploadNode.js';
3
4
  import { uploadPopulationPromiseHOC } from './populationPromise.js';
@@ -28,13 +29,24 @@ export const UploadFeature = (props)=>{
28
29
  return {
29
30
  ClientComponent: UploadFeatureClientComponent,
30
31
  clientFeatureProps: clientProps,
31
- generateSchemaMap: ({ props })=>{
32
- if (!props?.collections) return {};
33
- const map = {};
32
+ generateSchemaMap: ({ config, i18n, props })=>{
33
+ if (!props?.collections) return null;
34
+ const schemaMap = new Map();
35
+ const validRelationships = config.collections.map((c)=>c.slug) || [];
34
36
  for(const collection in props.collections){
35
- map[collection] = props.collections[collection].fields;
37
+ if (props.collections[collection].fields?.length) {
38
+ schemaMap.set(collection, props.collections[collection].fields);
39
+ traverseFields({
40
+ config,
41
+ fields: props.collections[collection].fields,
42
+ i18n,
43
+ schemaMap,
44
+ schemaPath: collection,
45
+ validRelationships
46
+ });
47
+ }
36
48
  }
37
- return map;
49
+ return schemaMap;
38
50
  },
39
51
  nodes: [
40
52
  {