@payloadcms/richtext-lexical 3.0.0-beta.20 → 3.0.0-beta.21
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/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +28 -68
- package/dist/field/features/blocks/feature.server.js.map +1 -1
- package/dist/field/features/blocks/populationPromise.d.ts.map +1 -1
- package/dist/field/features/blocks/populationPromise.js +0 -13
- package/dist/field/features/blocks/populationPromise.js.map +1 -1
- package/dist/field/features/blocks/validate.d.ts.map +1 -1
- package/dist/field/features/blocks/validate.js +2 -14
- package/dist/field/features/blocks/validate.js.map +1 -1
- package/dist/field/features/link/drawer/baseFields.d.ts +3 -3
- package/dist/field/features/link/drawer/baseFields.d.ts.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js +28 -42
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/drawer/types.d.ts +4 -2
- package/dist/field/features/link/drawer/types.d.ts.map +1 -1
- package/dist/field/features/link/drawer/types.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts +0 -2
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +22 -6
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +38 -24
- package/dist/field/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/index.scss +9 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts +3 -5
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.d.ts.map +1 -1
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js +11 -29
- package/dist/field/features/link/plugins/floatingLinkEditor/utilities.js.map +1 -1
- package/dist/field/features/link/plugins/link/index.d.ts.map +1 -1
- package/dist/field/features/link/plugins/link/index.js +0 -6
- package/dist/field/features/link/plugins/link/index.js.map +1 -1
- package/dist/field/features/link/populationPromise.d.ts.map +1 -1
- package/dist/field/features/link/populationPromise.js +5 -23
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/link/validate.d.ts +5 -0
- package/dist/field/features/link/validate.d.ts.map +1 -0
- package/dist/field/features/link/validate.js +32 -0
- package/dist/field/features/link/validate.js.map +1 -0
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +51 -2
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/types.d.ts +5 -1
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +14 -2
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
- package/dist/field/features/upload/populationPromise.js +2 -12
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/features/upload/validate.d.ts +2 -1
- package/dist/field/features/upload/validate.d.ts.map +1 -1
- package/dist/field/features/upload/validate.js +33 -11
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/lexical/LexicalEditor.js +1 -1
- package/dist/field/lexical/LexicalEditor.js.map +1 -1
- package/dist/field/lexical/config/server/default.d.ts +1 -2
- package/dist/field/lexical/config/server/default.d.ts.map +1 -1
- package/dist/field/lexical/config/server/default.js +0 -2
- package/dist/field/lexical/config/server/default.js.map +1 -1
- package/dist/field/lexical/config/server/loader.d.ts +4 -2
- package/dist/field/lexical/config/server/loader.d.ts.map +1 -1
- package/dist/field/lexical/config/server/loader.js +3 -2
- package/dist/field/lexical/config/server/loader.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts +2 -1
- package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js +3 -2
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.d.ts.map +1 -1
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js +24 -23
- package/dist/field/lexical/plugins/FloatingSelectToolbar/index.js.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/field/lexical/utils/setFloatingElemPosition.js +15 -13
- package/dist/field/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/field/lexical/utils/url.d.ts.map +1 -1
- package/dist/field/lexical/utils/url.js +2 -0
- package/dist/field/lexical/utils/url.js.map +1 -1
- package/dist/generateComponentMap.d.ts.map +1 -1
- package/dist/generateComponentMap.js +1 -10
- package/dist/generateComponentMap.js.map +1 -1
- package/dist/generateSchemaMap.d.ts.map +1 -1
- package/dist/generateSchemaMap.js +1 -10
- package/dist/generateSchemaMap.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +241 -234
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +8 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +9 -9
|
@@ -7,6 +7,8 @@ export function sanitizeUrl(url) {
|
|
|
7
7
|
}
|
|
8
8
|
// Source: https://stackoverflow.com/a/8234912/2013580
|
|
9
9
|
const urlRegExp = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)((?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*)?)/;
|
|
10
|
+
// Do not keep validateUrl function too loose. This is run when pasting in text, to determine if links are in that text and if it should create AutoLinkNodes.
|
|
11
|
+
// This is why we do not allow stuff like anchors here, as we don't want copied anchors to be turned into AutoLinkNodes.
|
|
10
12
|
export function validateUrl(url) {
|
|
11
13
|
// TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.
|
|
12
14
|
// Maybe show a dialog where they user can type the URL before inserting it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/field/lexical/utils/url.ts"],"sourcesContent":["export function sanitizeUrl(url: string): string {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z\\d+/]+=*$/i\n\n url = String(url).trim()\n\n if (url.match(SAFE_URL_PATTERN) != null || url.match(DATA_URL_PATTERN) != null) return url\n\n return 'https://'\n}\n\n// Source: https://stackoverflow.com/a/8234912/2013580\nconst urlRegExp =\n /((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=+$,\\w]+@)?[A-Za-z\\d.-]+|(?:www.|[-;:&=+$,\\w]+@)[A-Za-z\\d.-]+)((?:\\/[+~%/.\\w-]*)?\\??[-+=&;%@.\\w]*#?\\w*)?)/\n\nexport function validateUrl(url: string): boolean {\n // TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.\n // Maybe show a dialog where they user can type the URL before inserting it.\n\n if (!url) return false\n\n if (url === 'https://') return true\n\n // This makes sure URLs starting with www. instead of https are valid too\n if (urlRegExp.test(url)) return true\n\n // While this doesn't allow URLs starting with www (which is why we use the regex above), it does properly handle tel: URLs\n try {\n new URL(url)\n return true\n } catch {\n /* empty */\n }\n\n return false\n}\n"],"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match","urlRegExp","validateUrl","test","URL"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../../../../src/field/lexical/utils/url.ts"],"sourcesContent":["export function sanitizeUrl(url: string): string {\n /** A pattern that matches safe URLs. */\n const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /** A pattern that matches safe data URLs. */\n const DATA_URL_PATTERN =\n /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z\\d+/]+=*$/i\n\n url = String(url).trim()\n\n if (url.match(SAFE_URL_PATTERN) != null || url.match(DATA_URL_PATTERN) != null) return url\n\n return 'https://'\n}\n\n// Source: https://stackoverflow.com/a/8234912/2013580\nconst urlRegExp =\n /((([A-Za-z]{3,9}:(?:\\/\\/)?)(?:[-;:&=+$,\\w]+@)?[A-Za-z\\d.-]+|(?:www.|[-;:&=+$,\\w]+@)[A-Za-z\\d.-]+)((?:\\/[+~%/.\\w-]*)?\\??[-+=&;%@.\\w]*#?\\w*)?)/\n\n// Do not keep validateUrl function too loose. This is run when pasting in text, to determine if links are in that text and if it should create AutoLinkNodes.\n// This is why we do not allow stuff like anchors here, as we don't want copied anchors to be turned into AutoLinkNodes.\nexport function validateUrl(url: string): boolean {\n // TODO Fix UI for link insertion; it should never default to an invalid URL such as https://.\n // Maybe show a dialog where they user can type the URL before inserting it.\n\n if (!url) return false\n\n if (url === 'https://') return true\n\n // This makes sure URLs starting with www. instead of https are valid too\n if (urlRegExp.test(url)) return true\n\n // While this doesn't allow URLs starting with www (which is why we use the regex above), it does properly handle tel: URLs\n try {\n new URL(url)\n return true\n } catch {\n /* empty */\n }\n\n return false\n}\n"],"names":["sanitizeUrl","url","SAFE_URL_PATTERN","DATA_URL_PATTERN","String","trim","match","urlRegExp","validateUrl","test","URL"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAO,SAASA,YAAYC,GAAW;IACrC,uCAAuC,GACvC,MAAMC,mBAAmB;IAEzB,2CAA2C,GAC3C,MAAMC,mBACJ;IAEFF,MAAMG,OAAOH,KAAKI,IAAI;IAEtB,IAAIJ,IAAIK,KAAK,CAACJ,qBAAqB,QAAQD,IAAIK,KAAK,CAACH,qBAAqB,MAAM,OAAOF;IAEvF,OAAO;AACT;AAEA,sDAAsD;AACtD,MAAMM,YACJ;AAEF,8JAA8J;AAC9J,wHAAwH;AACxH,OAAO,SAASC,YAAYP,GAAW;IACrC,8FAA8F;IAC9F,4EAA4E;IAE5E,IAAI,CAACA,KAAK,OAAO;IAEjB,IAAIA,QAAQ,YAAY,OAAO;IAE/B,yEAAyE;IACzE,IAAIM,UAAUE,IAAI,CAACR,MAAM,OAAO;IAEhC,2HAA2H;IAC3H,IAAI;QACF,IAAIS,IAAIT;QACR,OAAO;IACT,EAAE,OAAM;IACN,SAAS,GACX;IAEA,OAAO;AACT"}
|
|
@@ -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;
|
|
1
|
+
{"version":3,"file":"generateComponentMap.d.ts","sourceRoot":"","sources":["../src/generateComponentMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAKpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAGzE,eAAO,MAAM,uBAAuB,SAC3B;IACL,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,sBAAsB,CA2GzC,CAAA"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { mapFields } from '@payloadcms/ui/utilities/buildComponentMap';
|
|
2
|
-
import { sanitizeFields } from 'payload/config';
|
|
3
2
|
import React from 'react';
|
|
4
|
-
import { cloneDeep } from './field/lexical/utils/cloneDeep.js';
|
|
5
3
|
export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i18n, schemaPath })=>{
|
|
6
|
-
const validRelationships = config.collections.map((c)=>c.slug) || [];
|
|
7
4
|
const componentMap = new Map();
|
|
8
5
|
// turn args.resolvedFeatureMap into an array of [key, value] pairs, ordered by value.order, lowest order first:
|
|
9
6
|
const resolvedFeatureMapArray = Array.from(args.resolvedFeatureMap.entries()).sort((a, b)=>a[1].order - b[1].order);
|
|
@@ -43,17 +40,11 @@ export const getGenerateComponentMap = (args)=>({ WithServerSideProps, config, i
|
|
|
43
40
|
});
|
|
44
41
|
if (schemas) {
|
|
45
42
|
for (const [schemaKey, fields] of schemas.entries()){
|
|
46
|
-
const sanitizedFields = sanitizeFields({
|
|
47
|
-
config,
|
|
48
|
-
fields: cloneDeep(fields),
|
|
49
|
-
requireFieldLevelRichTextEditor: true,
|
|
50
|
-
validRelationships
|
|
51
|
-
});
|
|
52
43
|
const mappedFields = mapFields({
|
|
53
44
|
WithServerSideProps,
|
|
54
45
|
config,
|
|
55
46
|
disableAddingID: true,
|
|
56
|
-
fieldSchema:
|
|
47
|
+
fieldSchema: fields,
|
|
57
48
|
i18n,
|
|
58
49
|
parentPath: `${schemaPath}.feature.${featureKey}.fields.${schemaKey}`,
|
|
59
50
|
readOnly: false
|
|
@@ -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
|
|
1
|
+
{"version":3,"sources":["../src/generateComponentMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport { mapFields } from '@payloadcms/ui/utilities/buildComponentMap'\nimport React from 'react'\n\nimport type { ResolvedServerFeatureMap } from './field/features/types.js'\nimport type { GeneratedFeatureProviderComponent } from './types.js'\n\nexport const getGenerateComponentMap =\n (args: {\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateComponentMap'] =>\n ({ WithServerSideProps, config, i18n, schemaPath }) => {\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 if (schemas) {\n for (const [schemaKey, fields] of schemas.entries()) {\n const mappedFields = mapFields({\n WithServerSideProps,\n config,\n disableAddingID: true,\n fieldSchema: fields,\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\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","React","getGenerateComponentMap","args","WithServerSideProps","config","i18n","schemaPath","componentMap","Map","resolvedFeatureMapArray","Array","from","resolvedFeatureMap","entries","sort","a","b","order","set","map","featureKey","resolvedFeature","ClientComponent","clientComponentProps","clientFeatureProps","generateComponentMap","components","props","serverFeatureProps","componentKey","Component","key","generateSchemaMap","schemas","schemaMap","schemaKey","fields","mappedFields","disableAddingID","fieldSchema","parentPath","readOnly","filter","feature"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,SAAS,QAAQ,6CAA4C;AACtE,OAAOC,WAAW,QAAO;AAKzB,OAAO,MAAMC,0BACX,CAACC,OAGD,CAAC,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,IAAI,EAAEC,UAAU,EAAE;QAChD,MAAMC,eAAe,IAAIC;QAEzB,gHAAgH;QAChH,MAAMC,0BAA0BC,MAAMC,IAAI,CAACT,KAAKU,kBAAkB,CAACC,OAAO,IAAIC,IAAI,CAChF,CAACC,GAAGC,IAAMD,CAAC,CAAC,EAAE,CAACE,KAAK,GAAGD,CAAC,CAAC,EAAE,CAACC,KAAK;QAGnCV,aAAaW,GAAG,CACd,CAAC,QAAQ,CAAC,EACVT,wBACGU,GAAG,CAAC,CAAC,CAACC,YAAYC,gBAAgB;YACjC,MAAMC,kBAAkBD,gBAAgBC,eAAe;YACvD,MAAMC,uBAAuBF,gBAAgBG,kBAAkB;YAE/D;;WAEC,GACD,IACE,0BAA0BH,mBAC1B,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C,gBAAgBU,GAAG;oBAC/BA,KAAKV,gBAAgBU,GAAG;oBACxBd,OAAOI,gBAAgBJ,KAAK;mCAG9B,oBAACK;oBACCF,YAAYC,gBAAgBU,GAAG;oBAC/BA,KAAKV,gBAAgBU,GAAG;oBACxBd,OAAOI,gBAAgBJ,KAAK;;gBAGlCc,KAAKV,gBAAgBU,GAAG;gBACxBd,OAAOI,gBAAgBJ,KAAK;YAC9B;QACF,GACCyB,MAAM,CAAC,CAACC,UAAYA,YAAY;QAGrC,OAAOpC;IACT,EAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSchemaMap.d.ts","sourceRoot":"","sources":["../src/generateSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"generateSchemaMap.d.ts","sourceRoot":"","sources":["../src/generateSchemaMap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAEpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAEzE,eAAO,MAAM,oBAAoB,SACxB;IAAE,kBAAkB,EAAE,wBAAwB,CAAA;CAAE,KAAG,eAAe,CAAC,mBAAmB,CAyB5F,CAAA"}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { sanitizeFields } from 'payload/config';
|
|
2
|
-
import { cloneDeep } from './field/lexical/utils/cloneDeep.js';
|
|
3
1
|
export const getGenerateSchemaMap = (args)=>({ config, i18n, schemaMap, schemaPath })=>{
|
|
4
|
-
const validRelationships = config.collections.map((c)=>c.slug) || [];
|
|
5
2
|
for (const [featureKey, resolvedFeature] of args.resolvedFeatureMap.entries()){
|
|
6
3
|
if (!('generateSchemaMap' in resolvedFeature) || typeof resolvedFeature.generateSchemaMap !== 'function') {
|
|
7
4
|
continue;
|
|
@@ -15,13 +12,7 @@ export const getGenerateSchemaMap = (args)=>({ config, i18n, schemaMap, schemaPa
|
|
|
15
12
|
});
|
|
16
13
|
if (schemas) {
|
|
17
14
|
for (const [schemaKey, fields] of schemas.entries()){
|
|
18
|
-
|
|
19
|
-
config,
|
|
20
|
-
fields: cloneDeep(fields),
|
|
21
|
-
requireFieldLevelRichTextEditor: true,
|
|
22
|
-
validRelationships
|
|
23
|
-
});
|
|
24
|
-
schemaMap.set(`${schemaPath}.feature.${featureKey}.${schemaKey}`, sanitizedFields);
|
|
15
|
+
schemaMap.set(`${schemaPath}.feature.${featureKey}.${schemaKey}`, fields);
|
|
25
16
|
}
|
|
26
17
|
}
|
|
27
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generateSchemaMap.ts"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport
|
|
1
|
+
{"version":3,"sources":["../src/generateSchemaMap.ts"],"sourcesContent":["import type { RichTextAdapter } from 'payload/types'\n\nimport type { ResolvedServerFeatureMap } from './field/features/types.js'\n\nexport const getGenerateSchemaMap =\n (args: { resolvedFeatureMap: ResolvedServerFeatureMap }): RichTextAdapter['generateSchemaMap'] =>\n ({ config, i18n, schemaMap, schemaPath }) => {\n for (const [featureKey, resolvedFeature] of args.resolvedFeatureMap.entries()) {\n if (\n !('generateSchemaMap' in resolvedFeature) ||\n typeof resolvedFeature.generateSchemaMap !== 'function'\n ) {\n continue\n }\n const schemas = resolvedFeature.generateSchemaMap({\n config,\n i18n,\n props: resolvedFeature.serverFeatureProps,\n schemaMap,\n schemaPath,\n })\n\n if (schemas) {\n for (const [schemaKey, fields] of schemas.entries()) {\n schemaMap.set(`${schemaPath}.feature.${featureKey}.${schemaKey}`, fields)\n }\n }\n }\n\n return schemaMap\n }\n"],"names":["getGenerateSchemaMap","args","config","i18n","schemaMap","schemaPath","featureKey","resolvedFeature","resolvedFeatureMap","entries","generateSchemaMap","schemas","props","serverFeatureProps","schemaKey","fields","set"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AAIA,OAAO,MAAMA,uBACX,CAACC,OACD,CAAC,EAAEC,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAEC,UAAU,EAAE;QACtC,KAAK,MAAM,CAACC,YAAYC,gBAAgB,IAAIN,KAAKO,kBAAkB,CAACC,OAAO,GAAI;YAC7E,IACE,CAAE,CAAA,uBAAuBF,eAAc,KACvC,OAAOA,gBAAgBG,iBAAiB,KAAK,YAC7C;gBACA;YACF;YACA,MAAMC,UAAUJ,gBAAgBG,iBAAiB,CAAC;gBAChDR;gBACAC;gBACAS,OAAOL,gBAAgBM,kBAAkB;gBACzCT;gBACAC;YACF;YAEA,IAAIM,SAAS;gBACX,KAAK,MAAM,CAACG,WAAWC,OAAO,IAAIJ,QAAQF,OAAO,GAAI;oBACnDL,UAAUY,GAAG,CAAC,CAAC,EAAEX,WAAW,SAAS,EAAEC,WAAW,CAAC,EAAEQ,UAAU,CAAC,EAAEC;gBACpE;YACF;QACF;QAEA,OAAOX;IACT,EAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AdapterProps, LexicalEditorProps,
|
|
2
|
-
export declare function lexicalEditor(props?: LexicalEditorProps):
|
|
1
|
+
import type { AdapterProps, LexicalEditorProps, LexicalRichTextAdapterProvider } from './types.js';
|
|
2
|
+
export declare function lexicalEditor(props?: LexicalEditorProps): LexicalRichTextAdapterProvider;
|
|
3
3
|
export { AlignFeature } from './field/features/align/feature.server.js';
|
|
4
4
|
export { BlockQuoteFeature } from './field/features/blockquote/feature.server.js';
|
|
5
5
|
export { BlocksFeature, type BlocksFeatureProps, type LexicalBlock, } from './field/features/blocks/feature.server.js';
|
|
@@ -59,7 +59,7 @@ export type { UploadFeatureProps } from './field/features/upload/feature.server.
|
|
|
59
59
|
export { $createUploadNode, $isUploadNode, type SerializedUploadNode, type UploadData, UploadNode, } from './field/features/upload/nodes/UploadNode.js';
|
|
60
60
|
export { EditorConfigProvider, useEditorConfigContext, } from './field/lexical/config/client/EditorConfigProvider.js';
|
|
61
61
|
export { sanitizeClientEditorConfig, sanitizeClientFeatures, } from './field/lexical/config/client/sanitize.js';
|
|
62
|
-
export { defaultEditorConfig, defaultEditorFeatures, defaultEditorLexicalConfig,
|
|
62
|
+
export { defaultEditorConfig, defaultEditorFeatures, defaultEditorLexicalConfig, } from './field/lexical/config/server/default.js';
|
|
63
63
|
export { loadFeatures, sortFeaturesForOptimalLoading, } from './field/lexical/config/server/loader.js';
|
|
64
64
|
export { sanitizeServerEditorConfig, sanitizeServerFeatures, } from './field/lexical/config/server/sanitize.js';
|
|
65
65
|
export type { ClientEditorConfig, SanitizedClientEditorConfig, SanitizedServerEditorConfig, ServerEditorConfig, } from './field/lexical/config/types.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,8BAA8B,EAAE,MAAM,YAAY,CAAA;AAqBlG,wBAAgB,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,8BAA8B,CA+QxF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAA;AACjF,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,YAAY,GAClB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,KAAK,WAAW,EAChB,SAAS,EACT,KAAK,mBAAmB,GACzB,MAAM,6CAA6C,CAAA;AAEpD,OAAO,EAAE,8BAA8B,EAAE,MAAM,2EAA2E,CAAA;A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