@payloadcms/richtext-lexical 3.0.0-beta.37 → 3.0.0-beta.39

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.
@@ -0,0 +1,6 @@
1
+ export { RichTextCell } from './dist/cell/index.js';
2
+ export { RichTextField } from './dist/field/index.js';
3
+ export { defaultEditorLexicalConfig } from './dist/field/lexical/config/client/default.js';
4
+ export { ToolbarButton } from './dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js';
5
+ export { ToolbarDropdown } from './dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js';
6
+ //# sourceMappingURL=components.d.ts.map
package/components.js ADDED
@@ -0,0 +1,7 @@
1
+ export { RichTextCell } from './dist/cell/index.js';
2
+ export { RichTextField } from './dist/field/index.js';
3
+ export { defaultEditorLexicalConfig } from './dist/field/lexical/config/client/default.js';
4
+ export { ToolbarButton } from './dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarButton/index.js';
5
+ export { ToolbarDropdown } from './dist/field/lexical/plugins/FloatingSelectToolbar/ToolbarDropdown/index.js';
6
+
7
+ //# sourceMappingURL=components.js.map
@@ -1,4 +1,4 @@
1
- import { traverseFields } from '@payloadcms/next/utilities';
1
+ import { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields';
2
2
  import { baseBlockFields, sanitizeFields } from 'payload/config';
3
3
  import { fieldsToJSONSchema, formatLabels } from 'payload/utilities';
4
4
  import { createNode } from '../typeUtilities.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Block, BlockField, Field } 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 { createNode } from '../typeUtilities.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Block[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n return {\n feature: async ({ config: _config, isRoot }) => {\n if (props?.blocks?.length) {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const block of props.blocks) {\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: block.fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\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 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 const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: props.blocks,\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 i18n,\n nodes: [\n createNode({\n /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out\n hooks: {\n beforeChange: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n await beforeChangeTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n mergeLocaleActions: [],\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n path: '',\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n\n return node\n },\n ],\n beforeValidate: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n\n await beforeValidateTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n return node\n },\n ],\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","createNode","BlocksFeatureClientComponent","i18n","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","feature","config","_config","isRoot","blocks","length","validRelationships","collections","map","c","slug","block","fields","concat","labels","requireFieldLevelRichTextEditor","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","blocksField","name","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,eAAe,EAAEC,cAAc,QAAQ,iBAAgB;AAChE,SAASC,kBAAkB,EAAEC,YAAY,QAAQ,oBAAmB;AAKpE,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,SAAS,QAAQ,wBAAuB;AACjD,SAASC,yBAAyB,QAAQ,yBAAwB;AAClE,SAASC,kBAAkB,QAAQ,gBAAe;AAMlD,OAAO,MAAMC,gBAGT,CAACC;IACH,OAAO;QACLC,SAAS,OAAO,EAAEC,QAAQC,OAAO,EAAEC,MAAM,EAAE;YACzC,IAAIJ,OAAOK,QAAQC,QAAQ;gBACzB,MAAMC,qBAAqBJ,QAAQK,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;gBAEvE,KAAK,MAAMC,SAASZ,MAAMK,MAAM,CAAE;oBAChCO,MAAMC,MAAM,GAAGD,MAAMC,MAAM,CAACC,MAAM,CAACzB;oBACnCuB,MAAMG,MAAM,GAAG,CAACH,MAAMG,MAAM,GAAGvB,aAAaoB,MAAMD,IAAI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AAMK,MAAM;wBACtB;wBACA,wFAAwF;wBACxF,2EAA2E;wBAC3Ed,mBACEyC,wBACA;4BAACI;yBAAY,EACbD,0BACAjC;wBAGF,OAAO+B;oBACT;gBACF;gBACAtC;gBACA4C,OAAO;oBACL9C,WAAW;wBACT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8DE,GACF+C,MAAM5C;wBACN6C,oBAAoB;4BAAC5C,0BAA0BG;yBAAO;wBACtD0C,aAAa;4BAAC5C,mBAAmBE;yBAAO;oBAC1C;iBACD;gBACD2C,oBAAoB3C;YACtB;QACF;QACA4C,KAAK;QACLD,oBAAoB3C;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/blocks/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Block, BlockField, Field } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\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 { createNode } from '../typeUtilities.js'\nimport { BlocksFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { BlockNode } from './nodes/BlocksNode.js'\nimport { blockPopulationPromiseHOC } from './populationPromise.js'\nimport { blockValidationHOC } from './validate.js'\n\nexport type BlocksFeatureProps = {\n blocks: Block[]\n}\n\nexport const BlocksFeature: FeatureProviderProviderServer<\n BlocksFeatureProps,\n BlocksFeatureClientProps\n> = (props) => {\n return {\n feature: async ({ config: _config, isRoot }) => {\n if (props?.blocks?.length) {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const block of props.blocks) {\n block.fields = block.fields.concat(baseBlockFields)\n block.labels = !block.labels ? formatLabels(block.slug) : block.labels\n\n block.fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: block.fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\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 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 const blocksField: BlockField = {\n name: field?.name + '_lexical_blocks',\n type: 'blocks',\n blocks: props.blocks,\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 i18n,\n nodes: [\n createNode({\n /* // TODO: Implement these hooks once docWithLocales / originalSiblingDoc => node matching has been figured out\n hooks: {\n beforeChange: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n await beforeChangeTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n mergeLocaleActions: [],\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n path: '',\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n\n return node\n },\n ],\n beforeValidate: [\n async ({ context, findMany, node, operation, overrideAccess, req }) => {\n const blockType = node.fields.blockType\n\n const block = deepCopyObject(\n props.blocks.find((block) => block.slug === blockType),\n )\n\n\n\n await beforeValidateTraverseFields({\n id: null,\n collection: null,\n context,\n data: node.fields,\n doc: node.fields,\n fields: sanitizedBlock.fields,\n global: null,\n operation:\n operation === 'create' || operation === 'update' ? operation : 'update',\n overrideAccess,\n req,\n siblingData: node.fields,\n siblingDoc: node.fields,\n })\n\n return node\n },\n ],\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","createNode","BlocksFeatureClientComponent","i18n","BlockNode","blockPopulationPromiseHOC","blockValidationHOC","BlocksFeature","props","feature","config","_config","isRoot","blocks","length","validRelationships","collections","map","c","slug","block","fields","concat","labels","requireFieldLevelRichTextEditor","clientProps","reducedBlocks","push","fieldMap","imageAltText","imageURL","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","generatedTypes","modifyOutputSchema","collectionIDFieldTypes","currentSchema","field","interfaceNameDefinitions","blocksField","name","type","nodes","node","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA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@payloadcms/next/utilities';
1
+ import { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields';
2
2
  import { sanitizeFields } from 'payload/config';
3
3
  import { deepCopyObject } from 'payload/utilities';
4
4
  import { convertLexicalNodesToHTML } from '../converters/html/converter/index.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload/config'\nimport type { Field } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { sanitizeFields } from 'payload/config'\nimport { deepCopyObject } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { LinkMarkdownTransformer } from './markdownTransformer.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'\nimport { linkValidation } from './validate.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?: ((args: { config: SanitizedConfig; defaultFields: Field[] }) => Field[]) | Field[]\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: async ({ config: _config, isRoot }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n }) => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap = new Map<string, Field[]>()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n schemaMap.set('fields', sanitizedFields)\n\n traverseFields({\n config,\n fields: sanitizedFields,\n i18n,\n schemaMap,\n schemaPath: 'fields',\n validRelationships,\n })\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [LinkMarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\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}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n },\n },\n hooks: {\n afterRead: [\n ({ node }) => {\n return node\n },\n ],\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n validations: [linkValidation(props)],\n }),\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\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}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n },\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n validations: [linkValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","deepCopyObject","convertLexicalNodesToHTML","createNode","LinkFeatureClientComponent","i18n","LinkMarkdownTransformer","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","linkValidation","LinkFeature","props","feature","config","_config","isRoot","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","schemaPath","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","target","href","url","linkType","doc","value","id","nodeTypes","getType","hooks","afterRead","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;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,IAAI,CAAC;gCAC/D;gCACAY,WAAW;oCAACrD,aAAasD,OAAO;iCAAG;4BACrC;wBACF;wBACAC,OAAO;4BACLC,WAAW;gCACT,CAAC,EAAElB,IAAI,EAAE;oCACP,OAAOA;gCACT;6BACD;wBACH;wBACAA,MAAMtC;wBACNyD,oBAAoB;4BAACtD,yBAAyBG;yBAAO;wBACrDoD,aAAa;4BAACtD,eAAeE;yBAAO;oBACtC;oBACAV,WAAW;wBACTuC,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAM9C,0BAA0B;wCACnDwC;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,MAAMI,MAAcN,KAAKrB,MAAM,CAAC4B,MAAM,GAAG,+BAA+B;oCACxE,MAAMC,SAAiBR,KAAKrB,MAAM,CAAC4B,MAAM,GAAG,qBAAqB;oCAEjE,MAAME,OACJT,KAAKrB,MAAM,CAACgC,QAAQ,KAAK,WACrBX,KAAKrB,MAAM,CAAC+B,GAAG,GACdV,KAAKrB,MAAM,CAACiC,GAAG,EAAEC;oCAExB,OAAO,CAAC,SAAS,EAAEJ,KAAK,CAAC,EAAED,OAAO,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCAC/D;gCACAY,WAAW;oCAACpD,SAASqD,OAAO;iCAAG;4BACjC;wBACF;wBACAhB,MAAMrC;wBACNwD,oBAAoB;4BAACtD,yBAAyBG;yBAAO;wBACrDoD,aAAa;4BAACtD,eAAeE;yBAAO;oBACtC;iBACD;gBACDqD,oBAAoBrD;YACtB;QACF;QACAsD,KAAK;QACLD,oBAAoBrD;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/link/feature.server.ts"],"sourcesContent":["import type { Config, SanitizedConfig } from 'payload/config'\nimport type { Field } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\nimport { sanitizeFields } from 'payload/config'\nimport { deepCopyObject } from 'payload/utilities'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { ClientProps } from './feature.client.js'\n\nimport { convertLexicalNodesToHTML } from '../converters/html/converter/index.js'\nimport { createNode } from '../typeUtilities.js'\nimport { LinkFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { LinkMarkdownTransformer } from './markdownTransformer.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'\nimport { linkValidation } from './validate.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?: ((args: { config: SanitizedConfig; defaultFields: Field[] }) => Field[]) | Field[]\n /**\n * Sets a maximum population depth for the internal doc default field of link, regardless of the remaining depth when the field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n}\n\nexport const LinkFeature: FeatureProviderProviderServer<LinkFeatureServerProps, ClientProps> = (\n props,\n) => {\n if (!props) {\n props = {}\n }\n return {\n feature: async ({ config: _config, isRoot }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n const _transformedFields = transformExtraFields(\n deepCopyObject(props.fields),\n _config,\n props.enabledCollections,\n props.disabledCollections,\n props.maxDepth,\n )\n\n const sanitizedFields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: _transformedFields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n props.fields = sanitizedFields\n\n return {\n ClientComponent: LinkFeatureClientComponent,\n clientFeatureProps: {\n disabledCollections: props.disabledCollections,\n enabledCollections: props.enabledCollections,\n } as ExclusiveLinkCollectionsProps,\n generateSchemaMap: ({ config, i18n }) => {\n if (!sanitizedFields || !Array.isArray(sanitizedFields) || sanitizedFields.length === 0) {\n return null\n }\n\n const schemaMap = new Map<string, Field[]>()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n schemaMap.set('fields', sanitizedFields)\n\n traverseFields({\n config,\n fields: sanitizedFields,\n i18n,\n schemaMap,\n schemaPath: 'fields',\n validRelationships,\n })\n\n return schemaMap\n },\n i18n,\n markdownTransformers: [LinkMarkdownTransformer],\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\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}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [AutoLinkNode.getType()],\n },\n },\n hooks: {\n afterRead: [\n ({ node }) => {\n return node\n },\n ],\n },\n node: AutoLinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n validations: [linkValidation(props)],\n }),\n createNode({\n converters: {\n html: {\n converter: async ({ converters, node, parent, payload }) => {\n const childrenText = await convertLexicalNodesToHTML({\n converters,\n lexicalNodes: node.children,\n parent: {\n ...node,\n parent,\n },\n payload,\n })\n\n const rel: string = node.fields.newTab ? ' rel=\"noopener noreferrer\"' : ''\n const target: string = node.fields.newTab ? ' target=\"_blank\"' : ''\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}\"${target}${rel}>${childrenText}</a>`\n },\n nodeTypes: [LinkNode.getType()],\n },\n },\n node: LinkNode,\n populationPromises: [linkPopulationPromiseHOC(props)],\n validations: [linkValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'link',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","deepCopyObject","convertLexicalNodesToHTML","createNode","LinkFeatureClientComponent","i18n","LinkMarkdownTransformer","AutoLinkNode","LinkNode","transformExtraFields","linkPopulationPromiseHOC","linkValidation","LinkFeature","props","feature","config","_config","isRoot","validRelationships","collections","map","c","slug","_transformedFields","fields","enabledCollections","disabledCollections","maxDepth","sanitizedFields","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","Array","isArray","length","schemaMap","Map","set","schemaPath","markdownTransformers","nodes","converters","html","converter","node","parent","payload","childrenText","lexicalNodes","children","rel","newTab","target","href","url","linkType","doc","value","id","nodeTypes","getType","hooks","afterRead","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,8DAA6D;AAC5F,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,SAASC,cAAc,QAAQ,oBAAmB;AAKlD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eE;yBAAO;oBACtC;oBACAV,WAAW;wBACTuC,YAAY;4BACVC,MAAM;gCACJC,WAAW,OAAO,EAAEF,UAAU,EAAEG,IAAI,EAAEC,MAAM,EAAEC,OAAO,EAAE;oCACrD,MAAMC,eAAe,MAAM9C,0BAA0B;wCACnDwC;wCACAO,cAAcJ,KAAKK,QAAQ;wCAC3BJ,QAAQ;4CACN,GAAGD,IAAI;4CACPC;wCACF;wCACAC;oCACF;oCAEA,MAAMI,MAAcN,KAAKrB,MAAM,CAAC4B,MAAM,GAAG,+BAA+B;oCACxE,MAAMC,SAAiBR,KAAKrB,MAAM,CAAC4B,MAAM,GAAG,qBAAqB;oCAEjE,MAAME,OACJT,KAAKrB,MAAM,CAACgC,QAAQ,KAAK,WACrBX,KAAKrB,MAAM,CAAC+B,GAAG,GACdV,KAAKrB,MAAM,CAACiC,GAAG,EAAEC;oCAExB,OAAO,CAAC,SAAS,EAAEJ,KAAK,CAAC,EAAED,OAAO,EAAEF,IAAI,CAAC,EAAEH,aAAa,IAAI,CAAC;gCAC/D;gCACAY,WAAW;oCAACpD,SAASqD,OAAO;iCAAG;4BACjC;wBACF;wBACAhB,MAAMrC;wBACNwD,oBAAoB;4BAACtD,yBAAyBG;yBAAO;wBACrDoD,aAAa;4BAACtD,eAAeE;yBAAO;oBACtC;iBACD;gBACDqD,oBAAoBrD;YACtB;QACF;QACAsD,KAAK;QACLD,oBAAoBrD;IACtB;AACF,EAAC"}
@@ -1,4 +1,4 @@
1
- import { traverseFields } from '@payloadcms/next/utilities';
1
+ import { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields';
2
2
  import { sanitizeFields } from 'payload/config';
3
3
  import { createNode } from '../typeUtilities.js';
4
4
  import { UploadFeatureClientComponent } from './feature.client.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/field/features/upload/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Field, FileData, FileSize, Payload, TypeWithID } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/next/utilities'\nimport { sanitizeFields } from 'payload/config'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { UploadFeaturePropsClient } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { UploadFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { UploadNode } from './nodes/UploadNode.js'\nimport { uploadPopulationPromiseHOC } from './populationPromise.js'\nimport { uploadValidation } from './validate.js'\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: string]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n}\n\n/**\n * Get the absolute URL for an upload URL by potentially prepending the serverURL\n */\nfunction getAbsoluteURL(url: string, payload: Payload): string {\n return url?.startsWith('http') ? url : (payload?.config?.serverURL || '') + url\n}\n\nexport const UploadFeature: FeatureProviderProviderServer<\n UploadFeatureProps,\n UploadFeaturePropsClient\n> = (props) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n }\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection].fields.length >= 1,\n }\n }\n }\n\n return {\n feature: async ({ config: _config, isRoot }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n props.collections[collection].fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: props.collections[collection].fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientComponent: UploadFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n if (!props?.collections) return null\n\n const schemaMap = new Map<string, Field[]>()\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n schemaMap.set(collection, props.collections[collection].fields)\n traverseFields({\n config,\n fields: props.collections[collection].fields,\n i18n,\n schemaMap,\n schemaPath: collection,\n validRelationships,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ node, payload }) => {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n if (payload) {\n let uploadDocument: TypeWithID & FileData\n\n try {\n uploadDocument = (await payload.findByID({\n id,\n collection: node.relationTo,\n })) as TypeWithID & FileData\n } catch (ignored) {\n // eslint-disable-next-line no-console\n console.error(\n 'Lexical upload node HTML converter: error fetching upload file',\n ignored,\n 'Node:',\n node,\n )\n return `<img />`\n }\n\n const url = getAbsoluteURL(uploadDocument?.url, payload)\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDocument?.mimeType?.startsWith('image')) {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${uploadDocument.filename}</a>`\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDocument?.sizes || !Object.keys(uploadDocument?.sizes).length) {\n return `<img src=\"${url}\" alt=\"${uploadDocument?.filename}\" width=\"${uploadDocument?.width}\" height=\"${uploadDocument?.height}\"/>`\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n let pictureHTML = '<picture>'\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDocument.sizes) {\n const imageSize: FileSize & {\n url?: string\n } = uploadDocument.sizes[size]\n\n // Skip if any property of the size object is null\n if (\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = getAbsoluteURL(imageSize?.url, payload)\n\n pictureHTML += `<source srcset=\"${imageSizeURL}\" media=\"(max-width: ${imageSize.width}px)\" type=\"${imageSize.mimeType}\">`\n }\n\n // Add the default img tag\n pictureHTML += `<img src=\"${url}\" alt=\"Image\" width=\"${uploadDocument.width}\" height=\"${uploadDocument.height}\">`\n pictureHTML += '</picture>'\n return pictureHTML\n } else {\n return `<img src=\"${id}\" />`\n }\n },\n nodeTypes: [UploadNode.getType()],\n },\n },\n node: UploadNode,\n populationPromises: [uploadPopulationPromiseHOC(props)],\n validations: [uploadValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'upload',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","createNode","UploadFeatureClientComponent","i18n","UploadNode","uploadPopulationPromiseHOC","uploadValidation","getAbsoluteURL","url","payload","startsWith","config","serverURL","UploadFeature","props","collections","clientProps","collection","hasExtraFields","fields","length","feature","_config","isRoot","validRelationships","map","c","slug","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","nodes","converters","html","converter","node","id","value","uploadDocument","findByID","relationTo","ignored","console","error","mimeType","filename","sizes","Object","keys","width","height","pictureHTML","size","imageSize","filesize","imageSizeURL","nodeTypes","getType","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,6BAA4B;AAC3D,SAASC,cAAc,QAAQ,iBAAgB;AAK/C,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,UAAU,QAAQ,wBAAuB;AAClD,SAASC,0BAA0B,QAAQ,yBAAwB;AACnE,SAASC,gBAAgB,QAAQ,gBAAe;AAiBhD;;CAEC,GACD,SAASC,eAAeC,GAAW,EAAEC,OAAgB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qBAEC,GACD,IAAIC,cAAc;wCAElB,qDAAqD;wCACrD,IAAK,MAAMC,QAAQd,eAAeQ,KAAK,CAAE;4CACvC,MAAMO,YAEFf,eAAeQ,KAAK,CAACM,KAAK;4CAE9B,kDAAkD;4CAClD,IACE,CAACC,UAAUJ,KAAK,IAChB,CAACI,UAAUH,MAAM,IACjB,CAACG,UAAUT,QAAQ,IACnB,CAACS,UAAUC,QAAQ,IACnB,CAACD,UAAUR,QAAQ,IACnB,CAACQ,UAAUlD,GAAG,EACd;gDACA;4CACF;4CACA,MAAMoD,eAAerD,eAAemD,WAAWlD,KAAKC;4CAEpD+C,eAAe,CAAC,gBAAgB,EAAEI,aAAa,qBAAqB,EAAEF,UAAUJ,KAAK,CAAC,WAAW,EAAEI,UAAUT,QAAQ,CAAC,EAAE,CAAC;wCAC3H;wCAEA,0BAA0B;wCAC1BO,eAAe,CAAC,UAAU,EAAEhD,IAAI,qBAAqB,EAAEmC,eAAeW,KAAK,CAAC,UAAU,EAAEX,eAAeY,MAAM,CAAC,EAAE,CAAC;wCACjHC,eAAe;wCACf,OAAOA;oCACT,OAAO;wCACL,OAAO,CAAC,UAAU,EAAEf,GAAG,IAAI,CAAC;oCAC9B;gCACF;gCACAoB,WAAW;oCAACzD,WAAW0D,OAAO;iCAAG;4BACnC;wBACF;wBACAtB,MAAMpC;wBACN2D,oBAAoB;4BAAC1D,2BAA2BS;yBAAO;wBACvDkD,aAAa;4BAAC1D,iBAAiBQ;yBAAO;oBACxC;iBACD;gBACDmD,oBAAoBnD;YACtB;QACF;QACAoD,KAAK;QACLD,oBAAoBnD;IACtB;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../src/field/features/upload/feature.server.ts"],"sourcesContent":["import type { Config } from 'payload/config'\nimport type { Field, FileData, FileSize, Payload, TypeWithID } from 'payload/types'\n\nimport { traverseFields } from '@payloadcms/ui/utilities/buildFieldSchemaMap/traverseFields'\nimport { sanitizeFields } from 'payload/config'\n\nimport type { FeatureProviderProviderServer } from '../types.js'\nimport type { UploadFeaturePropsClient } from './feature.client.js'\n\nimport { createNode } from '../typeUtilities.js'\nimport { UploadFeatureClientComponent } from './feature.client.js'\nimport { i18n } from './i18n.js'\nimport { UploadNode } from './nodes/UploadNode.js'\nimport { uploadPopulationPromiseHOC } from './populationPromise.js'\nimport { uploadValidation } from './validate.js'\n\nexport type UploadFeatureProps = {\n collections?: {\n [collection: string]: {\n fields: Field[]\n }\n }\n /**\n * Sets a maximum population depth for this upload (not the fields for this upload), regardless of the remaining depth when the respective field is reached.\n * This behaves exactly like the maxDepth properties of relationship and upload fields.\n *\n * {@link https://payloadcms.com/docs/getting-started/concepts#field-level-max-depth}\n */\n maxDepth?: number\n}\n\n/**\n * Get the absolute URL for an upload URL by potentially prepending the serverURL\n */\nfunction getAbsoluteURL(url: string, payload: Payload): string {\n return url?.startsWith('http') ? url : (payload?.config?.serverURL || '') + url\n}\n\nexport const UploadFeature: FeatureProviderProviderServer<\n UploadFeatureProps,\n UploadFeaturePropsClient\n> = (props) => {\n if (!props) {\n props = { collections: {} }\n }\n\n const clientProps: UploadFeaturePropsClient = {\n collections: {},\n }\n if (props.collections) {\n for (const collection in props.collections) {\n clientProps.collections[collection] = {\n hasExtraFields: props.collections[collection].fields.length >= 1,\n }\n }\n }\n\n return {\n feature: async ({ config: _config, isRoot }) => {\n const validRelationships = _config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n props.collections[collection].fields = await sanitizeFields({\n config: _config as unknown as Config,\n fields: props.collections[collection].fields,\n requireFieldLevelRichTextEditor: isRoot,\n validRelationships,\n })\n }\n }\n\n return {\n ClientComponent: UploadFeatureClientComponent,\n clientFeatureProps: clientProps,\n generateSchemaMap: ({ config, i18n, props }) => {\n if (!props?.collections) return null\n\n const schemaMap = new Map<string, Field[]>()\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n for (const collection in props.collections) {\n if (props.collections[collection].fields?.length) {\n schemaMap.set(collection, props.collections[collection].fields)\n traverseFields({\n config,\n fields: props.collections[collection].fields,\n i18n,\n schemaMap,\n schemaPath: collection,\n validRelationships,\n })\n }\n }\n\n return schemaMap\n },\n i18n,\n nodes: [\n createNode({\n converters: {\n html: {\n converter: async ({ node, payload }) => {\n // @ts-expect-error\n const id = node?.value?.id || node?.value // for backwards-compatibility\n\n if (payload) {\n let uploadDocument: TypeWithID & FileData\n\n try {\n uploadDocument = (await payload.findByID({\n id,\n collection: node.relationTo,\n })) as TypeWithID & FileData\n } catch (ignored) {\n // eslint-disable-next-line no-console\n console.error(\n 'Lexical upload node HTML converter: error fetching upload file',\n ignored,\n 'Node:',\n node,\n )\n return `<img />`\n }\n\n const url = getAbsoluteURL(uploadDocument?.url, payload)\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDocument?.mimeType?.startsWith('image')) {\n return `<a href=\"${url}\" rel=\"noopener noreferrer\">${uploadDocument.filename}</a>`\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDocument?.sizes || !Object.keys(uploadDocument?.sizes).length) {\n return `<img src=\"${url}\" alt=\"${uploadDocument?.filename}\" width=\"${uploadDocument?.width}\" height=\"${uploadDocument?.height}\"/>`\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n let pictureHTML = '<picture>'\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDocument.sizes) {\n const imageSize: FileSize & {\n url?: string\n } = uploadDocument.sizes[size]\n\n // Skip if any property of the size object is null\n if (\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = getAbsoluteURL(imageSize?.url, payload)\n\n pictureHTML += `<source srcset=\"${imageSizeURL}\" media=\"(max-width: ${imageSize.width}px)\" type=\"${imageSize.mimeType}\">`\n }\n\n // Add the default img tag\n pictureHTML += `<img src=\"${url}\" alt=\"Image\" width=\"${uploadDocument.width}\" height=\"${uploadDocument.height}\">`\n pictureHTML += '</picture>'\n return pictureHTML\n } else {\n return `<img src=\"${id}\" />`\n }\n },\n nodeTypes: [UploadNode.getType()],\n },\n },\n node: UploadNode,\n populationPromises: [uploadPopulationPromiseHOC(props)],\n validations: [uploadValidation(props)],\n }),\n ],\n serverFeatureProps: props,\n }\n },\n key: 'upload',\n serverFeatureProps: props,\n }\n}\n"],"names":["traverseFields","sanitizeFields","createNode","UploadFeatureClientComponent","i18n","UploadNode","uploadPopulationPromiseHOC","uploadValidation","getAbsoluteURL","url","payload","startsWith","config","serverURL","UploadFeature","props","collections","clientProps","collection","hasExtraFields","fields","length","feature","_config","isRoot","validRelationships","map","c","slug","requireFieldLevelRichTextEditor","ClientComponent","clientFeatureProps","generateSchemaMap","schemaMap","Map","set","schemaPath","nodes","converters","html","converter","node","id","value","uploadDocument","findByID","relationTo","ignored","console","error","mimeType","filename","sizes","Object","keys","width","height","pictureHTML","size","imageSize","filesize","imageSizeURL","nodeTypes","getType","populationPromises","validations","serverFeatureProps","key"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,cAAc,QAAQ,8DAA6D;AAC5F,SAASC,cAAc,QAAQ,iBAAgB;AAK/C,SAASC,UAAU,QAAQ,sBAAqB;AAChD,SAASC,4BAA4B,QAAQ,sBAAqB;AAClE,SAASC,IAAI,QAAQ,YAAW;AAChC,SAASC,UAAU,QAAQ,wBAAuB;AAClD,SAASC,0BAA0B,QAAQ,yBAAwB;AACnE,SAASC,gBAAgB,QAAQ,gBAAe;AAiBhD;;CAEC,GACD,SAASC,eAAeC,GAAW,EAAEC,OAAgB;IACnD,OAAOD,KAAKE,WAAW,UAAUF,MAAM,AAACC,CAAAA,SAASE,QAAQC,aAAa,EAAC,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AK,CAAE;4CACvC,MAAMO,YAEFf,eAAeQ,KAAK,CAACM,KAAK;4CAE9B,kDAAkD;4CAClD,IACE,CAACC,UAAUJ,KAAK,IAChB,CAACI,UAAUH,MAAM,IACjB,CAACG,UAAUT,QAAQ,IACnB,CAACS,UAAUC,QAAQ,IACnB,CAACD,UAAUR,QAAQ,IACnB,CAACQ,UAAUlD,GAAG,EACd;gDACA;4CACF;4CACA,MAAMoD,eAAerD,eAAemD,WAAWlD,KAAKC;4CAEpD+C,eAAe,CAAC,gBAAgB,EAAEI,aAAa,qBAAqB,EAAEF,UAAUJ,KAAK,CAAC,WAAW,EAAEI,UAAUT,QAAQ,CAAC,EAAE,CAAC;wCAC3H;wCAEA,0BAA0B;wCAC1BO,eAAe,CAAC,UAAU,EAAEhD,IAAI,qBAAqB,EAAEmC,eAAeW,KAAK,CAAC,UAAU,EAAEX,eAAeY,MAAM,CAAC,EAAE,CAAC;wCACjHC,eAAe;wCACf,OAAOA;oCACT,OAAO;wCACL,OAAO,CAAC,UAAU,EAAEf,GAAG,IAAI,CAAC;oCAC9B;gCACF;gCACAoB,WAAW;oCAACzD,WAAW0D,OAAO;iCAAG;4BACnC;wBACF;wBACAtB,MAAMpC;wBACN2D,oBAAoB;4BAAC1D,2BAA2BS;yBAAO;wBACvDkD,aAAa;4BAAC1D,iBAAiBQ;yBAAO;oBACxC;iBACD;gBACDmD,oBAAoBnD;YACtB;QACF;QACAoD,KAAK;QACLD,oBAAoBnD;IACtB;AACF,EAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.0.0-beta.37",
3
+ "version": "3.0.0-beta.39",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -58,10 +58,10 @@
58
58
  "@types/react": "npm:types-react@19.0.0-beta.2",
59
59
  "@types/react-dom": "npm:types-react-dom@19.0.0-beta.2",
60
60
  "@payloadcms/eslint-config": "1.1.1",
61
- "payload": "3.0.0-beta.37",
62
- "@payloadcms/next": "3.0.0-beta.37",
63
- "@payloadcms/translations": "3.0.0-beta.37",
64
- "@payloadcms/ui": "3.0.0-beta.37"
61
+ "@payloadcms/next": "3.0.0-beta.39",
62
+ "@payloadcms/translations": "3.0.0-beta.39",
63
+ "payload": "3.0.0-beta.39",
64
+ "@payloadcms/ui": "3.0.0-beta.39"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "@faceless-ui/modal": "2.0.2",
@@ -77,10 +77,10 @@
77
77
  "lexical": "0.15.0",
78
78
  "react": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
79
79
  "react-dom": "^19.0.0 || ^19.0.0-rc-f994737d14-20240522",
80
- "@payloadcms/ui": "3.0.0-beta.37",
81
- "@payloadcms/next": "3.0.0-beta.37",
82
- "payload": "3.0.0-beta.37",
83
- "@payloadcms/translations": "3.0.0-beta.37"
80
+ "@payloadcms/translations": "3.0.0-beta.39",
81
+ "@payloadcms/ui": "3.0.0-beta.39",
82
+ "@payloadcms/next": "3.0.0-beta.39",
83
+ "payload": "3.0.0-beta.39"
84
84
  },
85
85
  "engines": {
86
86
  "node": ">=18.20.2"