@payloadcms/richtext-lexical 3.0.0-beta.3 → 3.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/field/features/upload/validate.d.ts.map +1 -1
- package/dist/field/features/upload/validate.js +4 -6
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js +4 -2
- package/dist/generateComponentMap.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/validate.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../../../src/field/features/upload/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAIjE,eAAO,MAAM,gBAAgB,QAAO,eAAe,oBAAoB,CAuBtE,CAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getIDType, isValidID } from 'payload/utilities';
|
|
1
|
+
import { isValidID } from 'payload/utilities';
|
|
3
2
|
import { CAN_USE_DOM } from '../../lexical/utils/canUseDOM.js';
|
|
4
3
|
export const uploadValidation = ()=>{
|
|
5
|
-
const uploadValidation = ({ node, validation: { options: { req: { payload
|
|
4
|
+
const uploadValidation = ({ node, validation: { options: { req: { payload, t } } } })=>{
|
|
6
5
|
if (!CAN_USE_DOM) {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
if (!isValidID(node.value?.id, type)) {
|
|
6
|
+
const idType = payload.collections[node.relationTo].customIDType || payload.db.defaultIDType;
|
|
7
|
+
if (!isValidID(node.value?.id, idType)) {
|
|
10
8
|
return t('validation:validUploadID');
|
|
11
9
|
}
|
|
12
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/features/upload/validate.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/features/upload/validate.ts"],"sourcesContent":["import { isValidID } from 'payload/utilities'\n\nimport type { NodeValidation } from '../types.js'\nimport type { SerializedUploadNode } from './nodes/UploadNode.js'\n\nimport { CAN_USE_DOM } from '../../lexical/utils/canUseDOM.js'\n\nexport const uploadValidation = (): NodeValidation<SerializedUploadNode> => {\n const uploadValidation: NodeValidation<SerializedUploadNode> = ({\n node,\n validation: {\n options: {\n req: { payload, t },\n },\n },\n }) => {\n if (!CAN_USE_DOM) {\n const idType = payload.collections[node.relationTo].customIDType || payload.db.defaultIDType\n\n if (!isValidID(node.value?.id, idType)) {\n return t('validation:validUploadID')\n }\n }\n\n // TODO: validate upload collection fields\n\n return true\n }\n\n return uploadValidation\n}\n"],"names":["isValidID","CAN_USE_DOM","uploadValidation","node","validation","options","req","payload","t","idType","collections","relationTo","customIDType","db","defaultIDType","value","id"],"rangeMappings":";;;;;;;;;;;;;;","mappings":"AAAA,SAASA,SAAS,QAAQ,oBAAmB;AAK7C,SAASC,WAAW,QAAQ,mCAAkC;AAE9D,OAAO,MAAMC,mBAAmB;IAC9B,MAAMA,mBAAyD,CAAC,EAC9DC,IAAI,EACJC,YAAY,EACVC,SAAS,EACPC,KAAK,EAAEC,OAAO,EAAEC,CAAC,EAAE,EACpB,EACF,EACF;QACC,IAAI,CAACP,aAAa;YAChB,MAAMQ,SAASF,QAAQG,WAAW,CAACP,KAAKQ,UAAU,CAAC,CAACC,YAAY,IAAIL,QAAQM,EAAE,CAACC,aAAa;YAE5F,IAAI,CAACd,UAAUG,KAAKY,KAAK,EAAEC,IAAIP,SAAS;gBACtC,OAAOD,EAAE;YACX;QACF;QAEA,0CAA0C;QAE1C,OAAO;IACT;IAEA,OAAON;AACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../src/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAMpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAKzE,eAAO,MAAM,uBAAuB,SAC3B;IACL,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../src/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAMpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAKzE,eAAO,MAAM,uBAAuB,SAC3B;IACL,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,sBAAsB,CAoHzC,CAAA"}
|
|
@@ -2,7 +2,7 @@ import { mapFields } from '@payloadcms/ui/utilities/buildComponentMap';
|
|
|
2
2
|
import { sanitizeFields } from 'payload/config';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { cloneDeep } from './field/lexical/utils/cloneDeep.js';
|
|
5
|
-
export const getGenerateComponentMap = (args)=>({ config, i18n, schemaPath })=>{
|
|
5
|
+
export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i18n, schemaPath })=>{
|
|
6
6
|
const validRelationships = config.collections.map((c)=>c.slug) || [];
|
|
7
7
|
const componentMap = new Map();
|
|
8
8
|
// turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:
|
|
@@ -22,7 +22,8 @@ export const getGenerateComponentMap = (args)=>({ config, i18n, schemaPath })=>{
|
|
|
22
22
|
for(const componentKey in components){
|
|
23
23
|
const Component = components[componentKey];
|
|
24
24
|
if (Component) {
|
|
25
|
-
componentMap.set(`feature.${featureKey}.components.${componentKey}`, /*#__PURE__*/ React.createElement(
|
|
25
|
+
componentMap.set(`feature.${featureKey}.components.${componentKey}`, /*#__PURE__*/ React.createElement(WithServerSideProps, {
|
|
26
|
+
Component: Component,
|
|
26
27
|
componentKey: componentKey,
|
|
27
28
|
featureKey: resolvedFeature.key,
|
|
28
29
|
key: `${resolvedFeature.key}-${componentKey}`
|
|
@@ -49,6 +50,7 @@ export const getGenerateComponentMap = (args)=>({ config, i18n, schemaPath })=>{
|
|
|
49
50
|
validRelationships
|
|
50
51
|
});
|
|
51
52
|
const mappedFields = mapFields({
|
|
53
|
+
WithServerSideProps,
|
|
52
54
|
config,
|
|
53
55
|
disableAddingID: true,
|
|
54
56
|
fieldSchema: sanitizedFields,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport { sanitizeFields } from 'payload/config'\nimport React from 'react'\n\nimport type { ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { GeneratedFeatureProviderComponent } from './types.js'\n\nimport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\n\nexport const getGenerateComponentMap =\n (args: {\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateComponentMap'] =>\n ({ config, i18n, schemaPath }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const componentMap = new Map()\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(args.resolvedFeatureMap.entries()).sort(\n (a, b) => a[1].order - b[1].order,\n )\n\n componentMap.set(\n `features`,\n resolvedFeatureMapArray\n .map(([featureKey, resolvedFeature]) => {\n const ClientComponent = resolvedFeature.ClientComponent\n const clientComponentProps = resolvedFeature.clientFeatureProps\n\n /**\n * Handle Feature Component Maps\n */\n if (\n 'generateComponentMap' in resolvedFeature &&\n typeof resolvedFeature.generateComponentMap === 'function'\n ) {\n const components = resolvedFeature.generateComponentMap({\n config,\n i18n,\n props: resolvedFeature.serverFeatureProps,\n schemaPath,\n })\n\n for (const componentKey in components) {\n const Component = components[componentKey]\n\n if (Component) {\n componentMap.set(\n `feature.${featureKey}.components.${componentKey}`,\n <Component\n componentKey={componentKey}\n featureKey={resolvedFeature.key}\n key={`${resolvedFeature.key}-${componentKey}`}\n />,\n )\n }\n }\n }\n\n /**\n * Handle Feature Schema Maps (rendered fields)\n */\n if (\n 'generateSchemaMap' in resolvedFeature &&\n typeof resolvedFeature.generateSchemaMap === 'function'\n ) {\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n i18n,\n props: resolvedFeature.serverFeatureProps,\n schemaMap: new Map(),\n schemaPath,\n })\n\n for (const schemaKey in schemas) {\n const fields = schemas[schemaKey]\n\n const sanitizedFields = sanitizeFields({\n config,\n fields: cloneDeep(fields),\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n })\n\n const mappedFields = mapFields({\n config,\n disableAddingID: true,\n fieldSchema: sanitizedFields,\n i18n,\n parentPath: `${schemaPath}.feature.${featureKey}.fields.${schemaKey}`,\n readOnly: false,\n })\n\n componentMap.set(`feature.${featureKey}.fields.${schemaKey}`, mappedFields)\n }\n }\n\n if (!ClientComponent) {\n return null\n }\n\n return {\n ClientComponent:\n clientComponentProps && typeof clientComponentProps === 'object' ? (\n <ClientComponent\n {...clientComponentProps}\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ) : (\n <ClientComponent\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ),\n key: resolvedFeature.key,\n order: resolvedFeature.order,\n } as GeneratedFeatureProviderComponent\n })\n .filter((feature) => feature !== null),\n )\n\n return componentMap\n }\n"],"names":["mapFields","sanitizeFields","React","cloneDeep","getGenerateComponentMap","args","config","i18n","schemaPath","validRelationships","collections","map","c","slug","componentMap","Map","resolvedFeatureMapArray","Array","from","resolvedFeatureMap","entries","sort","a","b","order","set","featureKey","resolvedFeature","ClientComponent","clientComponentProps","clientFeatureProps","generateComponentMap","components","props","serverFeatureProps","componentKey","Component","key","generateSchemaMap","schemas","schemaMap","schemaKey","fields","sanitizedFields","requireFieldLevelRichTextEditor","mappedFields","disableAddingID","fieldSchema","parentPath","readOnly","filter","feature"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../src/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport { sanitizeFields } from 'payload/config'\nimport React from 'react'\n\nimport type { ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { GeneratedFeatureProviderComponent } from './types.js'\n\nimport { cloneDeep } from './field/lexical/utils/cloneDeep.js'\n\nexport const getGenerateComponentMap =\n (args: {\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateComponentMap'] =>\n ({ WithServerSideProps, config, i18n, schemaPath }) => {\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n const componentMap = new Map()\n\n // turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:\n const resolvedFeatureMapArray = Array.from(args.resolvedFeatureMap.entries()).sort(\n (a, b) => a[1].order - b[1].order,\n )\n\n componentMap.set(\n `features`,\n resolvedFeatureMapArray\n .map(([featureKey, resolvedFeature]) => {\n const ClientComponent = resolvedFeature.ClientComponent\n const clientComponentProps = resolvedFeature.clientFeatureProps\n\n /**\n * Handle Feature Component Maps\n */\n if (\n 'generateComponentMap' in resolvedFeature &&\n typeof resolvedFeature.generateComponentMap === 'function'\n ) {\n const components = resolvedFeature.generateComponentMap({\n config,\n i18n,\n props: resolvedFeature.serverFeatureProps,\n schemaPath,\n })\n\n for (const componentKey in components) {\n const Component = components[componentKey]\n\n if (Component) {\n componentMap.set(\n `feature.${featureKey}.components.${componentKey}`,\n <WithServerSideProps\n Component={Component}\n componentKey={componentKey}\n featureKey={resolvedFeature.key}\n key={`${resolvedFeature.key}-${componentKey}`}\n />,\n )\n }\n }\n }\n\n /**\n * Handle Feature Schema Maps (rendered fields)\n */\n if (\n 'generateSchemaMap' in resolvedFeature &&\n typeof resolvedFeature.generateSchemaMap === 'function'\n ) {\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n i18n,\n props: resolvedFeature.serverFeatureProps,\n schemaMap: new Map(),\n schemaPath,\n })\n\n for (const schemaKey in schemas) {\n const fields = schemas[schemaKey]\n\n const sanitizedFields = sanitizeFields({\n config,\n fields: cloneDeep(fields),\n requireFieldLevelRichTextEditor: true,\n validRelationships,\n })\n\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n disableAddingID: true,\n fieldSchema: sanitizedFields,\n i18n,\n parentPath: `${schemaPath}.feature.${featureKey}.fields.${schemaKey}`,\n readOnly: false,\n })\n\n componentMap.set(`feature.${featureKey}.fields.${schemaKey}`, mappedFields)\n }\n }\n\n if (!ClientComponent) {\n return null\n }\n\n return {\n ClientComponent:\n clientComponentProps && typeof clientComponentProps === 'object' ? (\n <ClientComponent\n {...clientComponentProps}\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ) : (\n <ClientComponent\n featureKey={resolvedFeature.key}\n key={resolvedFeature.key}\n order={resolvedFeature.order}\n />\n ),\n key: resolvedFeature.key,\n order: resolvedFeature.order,\n } as GeneratedFeatureProviderComponent\n })\n .filter((feature) => feature !== null),\n )\n\n return componentMap\n }\n"],"names":["mapFields","sanitizeFields","React","cloneDeep","getGenerateComponentMap","args","WithServerSideProps","config","i18n","schemaPath","validRelationships","collections","map","c","slug","componentMap","Map","resolvedFeatureMapArray","Array","from","resolvedFeatureMap","entries","sort","a","b","order","set","featureKey","resolvedFeature","ClientComponent","clientComponentProps","clientFeatureProps","generateComponentMap","components","props","serverFeatureProps","componentKey","Component","key","generateSchemaMap","schemas","schemaMap","schemaKey","fields","sanitizedFields","requireFieldLevelRichTextEditor","mappedFields","disableAddingID","fieldSch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gBAAgBH,KAAK;YAC9B;QACF,GACC0B,MAAM,CAAC,CAACC,UAAYA,YAAY;QAGrC,OAAOrC;IACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"@types/node": "20.12.5",
|
|
41
41
|
"@types/react": "18.2.74",
|
|
42
42
|
"@types/react-dom": "18.2.24",
|
|
43
|
-
"@payloadcms/
|
|
44
|
-
"payload": "3.0.0-beta.
|
|
45
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
46
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
47
|
-
"@payloadcms/
|
|
43
|
+
"@payloadcms/next": "3.0.0-beta.4",
|
|
44
|
+
"payload": "3.0.0-beta.4",
|
|
45
|
+
"@payloadcms/translations": "3.0.0-beta.4",
|
|
46
|
+
"@payloadcms/ui": "3.0.0-beta.4",
|
|
47
|
+
"@payloadcms/eslint-config": "1.1.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@payloadcms/
|
|
51
|
-
"@payloadcms/
|
|
52
|
-
"
|
|
53
|
-
"
|
|
50
|
+
"@payloadcms/ui": "3.0.0-beta.4",
|
|
51
|
+
"@payloadcms/translations": "3.0.0-beta.4",
|
|
52
|
+
"payload": "3.0.0-beta.4",
|
|
53
|
+
"@payloadcms/next": "3.0.0-beta.4"
|
|
54
54
|
},
|
|
55
55
|
"exports": {
|
|
56
56
|
".": {
|