@payloadcms/richtext-slate 3.0.0-beta.2 → 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.
|
@@ -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,gBAAgB,EAA6C,MAAM,YAAY,CAAA;AAQ7F,eAAO,MAAM,uBAAuB,SAC3B,gBAAgB,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,gBAAgB,EAA6C,MAAM,YAAY,CAAA;AAQ7F,eAAO,MAAM,uBAAuB,SAC3B,gBAAgB,KAAG,eAAe,CAAC,sBAAsB,CAiH/D,CAAA"}
|
|
@@ -6,7 +6,7 @@ import { linkFieldsSchemaPath } from './field/elements/link/shared.js';
|
|
|
6
6
|
import { transformExtraFields } from './field/elements/link/utilities.js';
|
|
7
7
|
import { uploadFieldsSchemaPath } from './field/elements/upload/shared.js';
|
|
8
8
|
import { defaultLeaves as leafTypes } from './field/leaves/index.js';
|
|
9
|
-
export const getGenerateComponentMap = (args)=>({ config, i18n })=>{
|
|
9
|
+
export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i18n })=>{
|
|
10
10
|
const componentMap = new Map();
|
|
11
11
|
const validRelationships = config.collections.map((c)=>c.slug) || [];
|
|
12
12
|
(args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf)=>{
|
|
@@ -54,6 +54,7 @@ export const getGenerateComponentMap = (args)=>({ config, i18n })=>{
|
|
|
54
54
|
validRelationships
|
|
55
55
|
});
|
|
56
56
|
const mappedFields = mapFields({
|
|
57
|
+
WithServerSideProps,
|
|
57
58
|
config,
|
|
58
59
|
fieldSchema: linkFields,
|
|
59
60
|
i18n,
|
|
@@ -78,6 +79,7 @@ export const getGenerateComponentMap = (args)=>({ config, i18n })=>{
|
|
|
78
79
|
validRelationships
|
|
79
80
|
});
|
|
80
81
|
const mappedFields = mapFields({
|
|
82
|
+
WithServerSideProps,
|
|
81
83
|
config,
|
|
82
84
|
fieldSchema: uploadFields,
|
|
83
85
|
i18n,
|
|
@@ -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 { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.js'\n\nimport { elements as elementTypes } from './field/elements/index.js'\nimport { linkFieldsSchemaPath } from './field/elements/link/shared.js'\nimport { transformExtraFields } from './field/elements/link/utilities.js'\nimport { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'\nimport { defaultLeaves as leafTypes } from './field/leaves/index.js'\n\nexport const getGenerateComponentMap =\n (args: AdapterArguments): RichTextAdapter['generateComponentMap'] =>\n ({ config, i18n }) => {\n const componentMap = new Map()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n ;(args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf) => {\n let leafObject: RichTextCustomLeaf\n\n if (typeof leaf === 'object' && leaf !== null) {\n leafObject = leaf\n } else if (typeof leaf === 'string' && leafTypes[leaf]) {\n leafObject = leafTypes[leaf]\n }\n\n if (leafObject) {\n const LeafButton = leafObject.Button\n const LeafComponent = leafObject.Leaf\n\n componentMap.set(`leaf.button.${leafObject.name}`, <LeafButton />)\n componentMap.set(`leaf.component.${leafObject.name}`, <LeafComponent />)\n\n if (Array.isArray(leafObject.plugins)) {\n leafObject.plugins.forEach((Plugin, i) => {\n componentMap.set(`leaf.plugin.${leafObject.name}.${i}`, <Plugin />)\n })\n }\n }\n })\n ;(args?.admin?.elements || Object.values(elementTypes)).forEach((el) => {\n let element: RichTextCustomElement\n\n if (typeof el === 'object' && el !== null) {\n element = el\n } else if (typeof el === 'string' && elementTypes[el]) {\n element = elementTypes[el]\n }\n\n if (element) {\n const ElementButton = element.Button\n const ElementComponent = element.Element\n\n if (ElementButton) componentMap.set(`element.button.${element.name}`, <ElementButton />)\n componentMap.set(`element.component.${element.name}`, <ElementComponent />)\n\n if (Array.isArray(element.plugins)) {\n element.plugins.forEach((Plugin, i) => {\n componentMap.set(`element.plugin.${element.name}.${i}`, <Plugin />)\n })\n }\n\n switch (element.name) {\n case 'link': {\n const linkFields = sanitizeFields({\n config,\n fields: transformExtraFields(args.admin?.link?.fields, config, i18n),\n validRelationships,\n })\n\n const mappedFields = mapFields({\n config,\n fieldSchema: linkFields,\n i18n,\n readOnly: false,\n })\n\n componentMap.set(linkFieldsSchemaPath, mappedFields)\n\n break\n }\n\n case 'upload': {\n const uploadEnabledCollections = config.collections.filter(\n ({ admin: { enableRichTextRelationship, hidden }, upload }) => {\n if (hidden === true) {\n return false\n }\n\n return enableRichTextRelationship && Boolean(upload) === true\n },\n )\n\n uploadEnabledCollections.forEach((collection) => {\n if (args?.admin?.upload?.collections[collection.slug]?.fields) {\n const uploadFields = sanitizeFields({\n config,\n fields: args?.admin?.upload?.collections[collection.slug]?.fields,\n validRelationships,\n })\n\n const mappedFields = mapFields({\n config,\n fieldSchema: uploadFields,\n i18n,\n readOnly: false,\n })\n\n componentMap.set(`${uploadFieldsSchemaPath}.${collection.slug}`, mappedFields)\n }\n })\n\n break\n }\n\n case 'relationship':\n break\n }\n }\n })\n\n return componentMap\n }\n"],"names":["mapFields","sanitizeFields","React","elements","elementTypes","linkFieldsSchemaPath","transformExtraFields","uploadFieldsSchemaPath","defaultLeaves","leafTypes","getGenerateComponentMap","args","config","i18n","componentMap","Map","validRelationships","collections","map","c","slug","admin","leaves","Object","values","forEach","leaf","leafObject","LeafButton","Button","LeafComponent","Leaf","set","name","Array","isArray","plugins","Plugin","i","el","element","ElementButton","ElementComponent","Element","linkFields","fields","link","mappedFields","fieldSchema","readOnly","uploadEnabledCollections","filter","enableRichTextRelationship","hidden","upload","Boolean","collection","uploadFields"],"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 { AdapterArguments, RichTextCustomElement, RichTextCustomLeaf } from './types.js'\n\nimport { elements as elementTypes } from './field/elements/index.js'\nimport { linkFieldsSchemaPath } from './field/elements/link/shared.js'\nimport { transformExtraFields } from './field/elements/link/utilities.js'\nimport { uploadFieldsSchemaPath } from './field/elements/upload/shared.js'\nimport { defaultLeaves as leafTypes } from './field/leaves/index.js'\n\nexport const getGenerateComponentMap =\n (args: AdapterArguments): RichTextAdapter['generateComponentMap'] =>\n ({ WithServerSideProps, config, i18n }) => {\n const componentMap = new Map()\n\n const validRelationships = config.collections.map((c) => c.slug) || []\n\n ;(args?.admin?.leaves || Object.values(leafTypes)).forEach((leaf) => {\n let leafObject: RichTextCustomLeaf\n\n if (typeof leaf === 'object' && leaf !== null) {\n leafObject = leaf\n } else if (typeof leaf === 'string' && leafTypes[leaf]) {\n leafObject = leafTypes[leaf]\n }\n\n if (leafObject) {\n const LeafButton = leafObject.Button\n const LeafComponent = leafObject.Leaf\n\n componentMap.set(`leaf.button.${leafObject.name}`, <LeafButton />)\n componentMap.set(`leaf.component.${leafObject.name}`, <LeafComponent />)\n\n if (Array.isArray(leafObject.plugins)) {\n leafObject.plugins.forEach((Plugin, i) => {\n componentMap.set(`leaf.plugin.${leafObject.name}.${i}`, <Plugin />)\n })\n }\n }\n })\n ;(args?.admin?.elements || Object.values(elementTypes)).forEach((el) => {\n let element: RichTextCustomElement\n\n if (typeof el === 'object' && el !== null) {\n element = el\n } else if (typeof el === 'string' && elementTypes[el]) {\n element = elementTypes[el]\n }\n\n if (element) {\n const ElementButton = element.Button\n const ElementComponent = element.Element\n\n if (ElementButton) componentMap.set(`element.button.${element.name}`, <ElementButton />)\n componentMap.set(`element.component.${element.name}`, <ElementComponent />)\n\n if (Array.isArray(element.plugins)) {\n element.plugins.forEach((Plugin, i) => {\n componentMap.set(`element.plugin.${element.name}.${i}`, <Plugin />)\n })\n }\n\n switch (element.name) {\n case 'link': {\n const linkFields = sanitizeFields({\n config,\n fields: transformExtraFields(args.admin?.link?.fields, config, i18n),\n validRelationships,\n })\n\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n fieldSchema: linkFields,\n i18n,\n readOnly: false,\n })\n\n componentMap.set(linkFieldsSchemaPath, mappedFields)\n\n break\n }\n\n case 'upload': {\n const uploadEnabledCollections = config.collections.filter(\n ({ admin: { enableRichTextRelationship, hidden }, upload }) => {\n if (hidden === true) {\n return false\n }\n\n return enableRichTextRelationship && Boolean(upload) === true\n },\n )\n\n uploadEnabledCollections.forEach((collection) => {\n if (args?.admin?.upload?.collections[collection.slug]?.fields) {\n const uploadFields = sanitizeFields({\n config,\n fields: args?.admin?.upload?.collections[collection.slug]?.fields,\n validRelationships,\n })\n\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n fieldSchema: uploadFields,\n i18n,\n readOnly: false,\n })\n\n componentMap.set(`${uploadFieldsSchemaPath}.${collection.slug}`, mappedFields)\n }\n })\n\n break\n }\n\n case 'relationship':\n break\n }\n }\n })\n\n return componentMap\n }\n"],"names":["mapFields","sanitizeFields","React","elements","elementTypes","linkFieldsSchemaPath","transformExtraFields","uploadFieldsSchemaPath","defaultLeaves","leafTypes","getGenerateComponentMap","args","WithServerSideProps","config","i18n","componentMap","Map","validRelationships","collections","map","c","slug","admin","leaves","Object","values","forEach","leaf","leafObject","LeafButton","Button","LeafComponent","Leaf","set","name","Array","isArray","plugins","Plugin","i","el","element","ElementButton","ElementComponent","Element","linkFields","fields","link","mappedFields","fieldSchema","readOnly","uploadEnabledCollections","filter","enableRichTextRelationship","hidden","upload","Boolean","collection","uploadFields"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,SAAS,QAAQ,6CAA4C;AACtE,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAIzB,SAASC,YAAYC,YAAY,QAAQ,4BAA2B;AACpE,SAASC,oBAAoB,QAAQ,kCAAiC;AACtE,SAASC,oBAAoB,QAAQ,qCAAoC;AACzE,SAASC,sBAAsB,QAAQ,oCAAmC;AAC1E,SAASC,iBAAiBC,SAAS,QAAQ,0BAAyB;AAEpE,OAAO,MAAMC,0BACX,CAACC,OACD,CAAC,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,IAAI,EAAE;QACpC,MAAMC,eAAe,IAAIC;QAEzB,MAAMC,qBAAqBJ,OAAOK,WAAW,CAACC,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI,KAAK,EAAE;QAEpEV,CAAAA,MAAMW,OAAOC,UAAUC,OAAOC,MAAM,CAAChB,UAAS,EAAGiB,OAAO,CAAC,CAACC;YAC1D,IAAIC;YAEJ,IAAI,OAAOD,SAAS,YAAYA,SAAS,MAAM;gBAC7CC,aAAaD;YACf,OAAO,IAAI,OAAOA,SAAS,YAAYlB,SAAS,CAACkB,KAAK,EAAE;gBACtDC,aAAanB,SAAS,CAACkB,KAAK;YAC9B;YAEA,IAAIC,YAAY;gBACd,MAAMC,aAAaD,WAAWE,MAAM;gBACpC,MAAMC,gBAAgBH,WAAWI,IAAI;gBAErCjB,aAAakB,GAAG,CAAC,CAAC,YAAY,EAAEL,WAAWM,IAAI,CAAC,CAAC,gBAAE,oBAACL;gBAC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KW,KAAK,EAAEyB,MAAMD,QAAQjC,QAAQC;gCAC/DG;4BACF;4BAEA,MAAM+B,eAAehD,UAAU;gCAC7BY;gCACAC;gCACAoC,aAAaJ;gCACb/B;gCACAoC,UAAU;4BACZ;4BAEAnC,aAAakB,GAAG,CAAC5B,sBAAsB2C;4BAEvC;wBACF;oBAEA,KAAK;wBAAU;4BACb,MAAMG,2BAA2BtC,OAAOK,WAAW,CAACkC,MAAM,CACxD,CAAC,EAAE9B,OAAO,EAAE+B,0BAA0B,EAAEC,MAAM,EAAE,EAAEC,MAAM,EAAE;gCACxD,IAAID,WAAW,MAAM;oCACnB,OAAO;gCACT;gCAEA,OAAOD,8BAA8BG,QAAQD,YAAY;4BAC3D;4BAGFJ,yBAAyBzB,OAAO,CAAC,CAAC+B;gCAChC,IAAI9C,MAAMW,OAAOiC,QAAQrC,WAAW,CAACuC,WAAWpC,IAAI,CAAC,EAAEyB,QAAQ;oCAC7D,MAAMY,eAAezD,eAAe;wCAClCY;wCACAiC,QAAQnC,MAAMW,OAAOiC,QAAQrC,WAAW,CAACuC,WAAWpC,IAAI,CAAC,EAAEyB;wCAC3D7B;oCACF;oCAEA,MAAM+B,eAAehD,UAAU;wCAC7BY;wCACAC;wCACAoC,aAAaS;wCACb5C;wCACAoC,UAAU;oCACZ;oCAEAnC,aAAakB,GAAG,CAAC,CAAC,EAAE1B,uBAAuB,CAAC,EAAEkD,WAAWpC,IAAI,CAAC,CAAC,EAAE2B;gCACnE;4BACF;4BAEA;wBACF;oBAEA,KAAK;wBACH;gBACJ;YACF;QACF;QAEA,OAAOjC;IACT,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-slate",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.4",
|
|
4
4
|
"description": "The officially supported Slate richtext adapter for Payload",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,14 +25,14 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@types/node": "20.12.5",
|
|
27
27
|
"@types/react": "18.2.74",
|
|
28
|
-
"@payloadcms/ui": "3.0.0-beta.
|
|
29
|
-
"
|
|
30
|
-
"
|
|
28
|
+
"@payloadcms/ui": "3.0.0-beta.4",
|
|
29
|
+
"payload": "3.0.0-beta.4",
|
|
30
|
+
"@payloadcms/eslint-config": "1.1.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
|
-
"payload": "3.0.0-beta.
|
|
34
|
-
"@payloadcms/
|
|
35
|
-
"@payloadcms/
|
|
33
|
+
"payload": "3.0.0-beta.4",
|
|
34
|
+
"@payloadcms/translations": "3.0.0-beta.4",
|
|
35
|
+
"@payloadcms/ui": "3.0.0-beta.4"
|
|
36
36
|
},
|
|
37
37
|
"exports": null,
|
|
38
38
|
"publishConfig": {
|