@payloadcms/richtext-lexical 3.0.0-beta.13 → 3.0.0-beta.15
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/blockquote/feature.server.d.ts.map +1 -1
- package/dist/field/features/blockquote/feature.server.js +3 -2
- package/dist/field/features/blockquote/feature.server.js.map +1 -1
- package/dist/field/features/blocks/component/index.d.ts.map +1 -1
- package/dist/field/features/blocks/component/index.js +31 -1
- package/dist/field/features/blocks/component/index.js.map +1 -1
- package/dist/field/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/field/features/blocks/feature.server.js +90 -3
- 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 +3 -5
- 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 +21 -23
- package/dist/field/features/blocks/validate.js.map +1 -1
- package/dist/field/features/heading/feature.server.d.ts.map +1 -1
- package/dist/field/features/heading/feature.server.js +4 -3
- package/dist/field/features/heading/feature.server.js.map +1 -1
- package/dist/field/features/horizontalrule/feature.server.d.ts.map +1 -1
- package/dist/field/features/horizontalrule/feature.server.js +3 -2
- package/dist/field/features/horizontalrule/feature.server.js.map +1 -1
- package/dist/field/features/link/drawer/baseFields.js +1 -1
- package/dist/field/features/link/drawer/baseFields.js.map +1 -1
- package/dist/field/features/link/feature.server.d.ts.map +1 -1
- package/dist/field/features/link/feature.server.js +15 -6
- package/dist/field/features/link/feature.server.js.map +1 -1
- package/dist/field/features/link/populationPromise.d.ts.map +1 -1
- package/dist/field/features/link/populationPromise.js +28 -26
- package/dist/field/features/link/populationPromise.js.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/checklist/feature.server.js +5 -4
- package/dist/field/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/orderedlist/feature.server.js +5 -4
- package/dist/field/features/lists/orderedlist/feature.server.js.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.server.d.ts.map +1 -1
- package/dist/field/features/lists/unorderedlist/feature.server.js +5 -4
- package/dist/field/features/lists/unorderedlist/feature.server.js.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +1 -1
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +2 -4
- package/dist/field/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js +2 -4
- package/dist/field/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +1 -1
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js +2 -4
- package/dist/field/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
- package/dist/field/features/relationship/drawer/index.d.ts.map +1 -1
- package/dist/field/features/relationship/drawer/index.js +5 -9
- package/dist/field/features/relationship/drawer/index.js.map +1 -1
- package/dist/field/features/relationship/feature.server.d.ts.map +1 -1
- package/dist/field/features/relationship/feature.server.js +3 -2
- package/dist/field/features/relationship/feature.server.js.map +1 -1
- package/dist/field/features/relationship/nodes/RelationshipNode.d.ts +1 -4
- package/dist/field/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/RelationshipNode.js +7 -6
- package/dist/field/features/relationship/nodes/RelationshipNode.js.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js +1 -1
- package/dist/field/features/relationship/nodes/components/RelationshipComponent.js.map +1 -1
- package/dist/field/features/relationship/populationPromise.js +7 -6
- package/dist/field/features/relationship/populationPromise.js.map +1 -1
- package/dist/field/features/typeUtilities.d.ts +8 -0
- package/dist/field/features/typeUtilities.d.ts.map +1 -0
- package/dist/field/features/typeUtilities.js +8 -0
- package/dist/field/features/typeUtilities.js.map +1 -0
- package/dist/field/features/types.d.ts +50 -26
- package/dist/field/features/types.d.ts.map +1 -1
- package/dist/field/features/types.js.map +1 -1
- package/dist/field/features/upload/component/index.js +3 -3
- package/dist/field/features/upload/component/index.js.map +1 -1
- package/dist/field/features/upload/drawer/index.d.ts.map +1 -1
- package/dist/field/features/upload/drawer/index.js +6 -8
- package/dist/field/features/upload/drawer/index.js.map +1 -1
- package/dist/field/features/upload/feature.server.d.ts.map +1 -1
- package/dist/field/features/upload/feature.server.js +8 -4
- package/dist/field/features/upload/feature.server.js.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.d.ts +1 -11
- package/dist/field/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/field/features/upload/nodes/UploadNode.js +4 -1
- package/dist/field/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/features/upload/plugin/index.d.ts +2 -2
- package/dist/field/features/upload/plugin/index.d.ts.map +1 -1
- package/dist/field/features/upload/plugin/index.js +1 -3
- package/dist/field/features/upload/plugin/index.js.map +1 -1
- package/dist/field/features/upload/populationPromise.d.ts.map +1 -1
- package/dist/field/features/upload/populationPromise.js +22 -9
- package/dist/field/features/upload/populationPromise.js.map +1 -1
- package/dist/field/features/upload/validate.js +5 -3
- package/dist/field/features/upload/validate.js.map +1 -1
- package/dist/field/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/field/lexical/config/server/sanitize.js +20 -6
- package/dist/field/lexical/config/server/sanitize.js.map +1 -1
- package/dist/field/lexical/utils/url.d.ts.map +1 -1
- package/dist/field/lexical/utils/url.js +1 -0
- package/dist/field/lexical/utils/url.js.map +1 -1
- package/dist/forEachNodeRecursively.d.ts +10 -0
- package/dist/forEachNodeRecursively.d.ts.map +1 -0
- package/dist/forEachNodeRecursively.js +24 -0
- package/dist/forEachNodeRecursively.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +103 -23
- package/dist/index.js.map +1 -1
- package/dist/populate/populate.d.ts +1 -1
- package/dist/populate/populate.d.ts.map +1 -1
- package/dist/populate/populate.js.map +1 -1
- package/dist/populate/populateLexicalPopulationPromises.d.ts +12 -0
- package/dist/populate/populateLexicalPopulationPromises.d.ts.map +1 -0
- package/dist/populate/populateLexicalPopulationPromises.js +35 -0
- package/dist/populate/populateLexicalPopulationPromises.js.map +1 -0
- package/dist/populate/recurseNestedFields.d.ts +5 -2
- package/dist/populate/recurseNestedFields.d.ts.map +1 -1
- package/dist/populate/recurseNestedFields.js +3 -5
- package/dist/populate/recurseNestedFields.js.map +1 -1
- package/package.json +9 -9
- package/dist/populate/richTextRelationshipPromise.d.ts +0 -23
- package/dist/populate/richTextRelationshipPromise.d.ts.map +0 -1
- package/dist/populate/richTextRelationshipPromise.js +0 -68
- package/dist/populate/richTextRelationshipPromise.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { recurseNodes } from '../forEachNodeRecursively.js';
|
|
2
|
+
/**
|
|
3
|
+
* Appends all new populationPromises to the populationPromises prop
|
|
4
|
+
*/ export const populateLexicalPopulationPromises = ({ context, currentDepth, depth, editorPopulationPromises, field, fieldPromises, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc })=>{
|
|
5
|
+
if (depth <= 0 || currentDepth > depth) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
recurseNodes({
|
|
9
|
+
callback: (node)=>{
|
|
10
|
+
if (editorPopulationPromises?.has(node.type)) {
|
|
11
|
+
for (const promise of editorPopulationPromises.get(node.type)){
|
|
12
|
+
promise({
|
|
13
|
+
context,
|
|
14
|
+
currentDepth,
|
|
15
|
+
depth,
|
|
16
|
+
editorPopulationPromises,
|
|
17
|
+
field,
|
|
18
|
+
fieldPromises,
|
|
19
|
+
findMany,
|
|
20
|
+
flattenLocales,
|
|
21
|
+
node,
|
|
22
|
+
overrideAccess,
|
|
23
|
+
populationPromises,
|
|
24
|
+
req,
|
|
25
|
+
showHiddenFields,
|
|
26
|
+
siblingDoc
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
nodes: siblingDoc[field?.name]?.root?.children ?? []
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=populateLexicalPopulationPromises.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/populate/populateLexicalPopulationPromises.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { RichTextAdapter } from 'payload/types'\n\nimport type { PopulationPromise } from '../field/features/types.js'\nimport type { AdapterProps } from '../types.js'\n\nimport { recurseNodes } from '../forEachNodeRecursively.js'\n\nexport type Args = Parameters<\n RichTextAdapter<SerializedEditorState, AdapterProps>['populationPromises']\n>[0] & {\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n}\n\n/**\n * Appends all new populationPromises to the populationPromises prop\n */\nexport const populateLexicalPopulationPromises = ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: Args) => {\n if (depth <= 0 || currentDepth > depth) {\n return\n }\n\n recurseNodes({\n callback: (node) => {\n if (editorPopulationPromises?.has(node.type)) {\n for (const promise of editorPopulationPromises.get(node.type)) {\n promise({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n fieldPromises,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n }\n },\n nodes: (siblingDoc[field?.name] as SerializedEditorState)?.root?.children ?? [],\n })\n}\n"],"names":["recurseNodes","populateLexicalPopulationPromises","context","currentDepth","depth","editorPopulationPromises","field","fieldPromises","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","callback","node","has","type","promise","get","nodes","name","root","children"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAMA,SAASA,YAAY,QAAQ,+BAA8B;AAQ3D;;CAEC,GACD,OAAO,MAAMC,oCAAoC,CAAC,EAChDC,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,KAAK,EACLC,aAAa,EACbC,QAAQ,EACRC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACL;IACL,IAAIV,SAAS,KAAKD,eAAeC,OAAO;QACtC;IACF;IAEAJ,aAAa;QACXe,UAAU,CAACC;YACT,IAAIX,0BAA0BY,IAAID,KAAKE,IAAI,GAAG;gBAC5C,KAAK,MAAMC,WAAWd,yBAAyBe,GAAG,CAACJ,KAAKE,IAAI,EAAG;oBAC7DC,QAAQ;wBACNjB;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAO;wBACAN;wBACAC;wBACAC;wBACAC;wBACAC;oBACF;gBACF;YACF;QACF;QACAO,OAAO,AAACP,UAAU,CAACR,OAAOgB,KAAK,EAA4BC,MAAMC,YAAY,EAAE;IACjF;AACF,EAAC"}
|
|
@@ -10,16 +10,19 @@ type NestedRichTextFieldsArgs = {
|
|
|
10
10
|
* This maps all the population promises to the node types
|
|
11
11
|
*/
|
|
12
12
|
editorPopulationPromises: Map<string, Array<PopulationPromise>>;
|
|
13
|
+
/**
|
|
14
|
+
* fieldPromises are used for things like field hooks. They should be awaited before awaiting populationPromises
|
|
15
|
+
*/
|
|
16
|
+
fieldPromises: Promise<void>[];
|
|
13
17
|
fields: Field[];
|
|
14
18
|
findMany: boolean;
|
|
15
19
|
flattenLocales: boolean;
|
|
16
20
|
overrideAccess: boolean;
|
|
17
21
|
populationPromises: Promise<void>[];
|
|
18
|
-
promises: Promise<void>[];
|
|
19
22
|
req: PayloadRequest;
|
|
20
23
|
showHiddenFields: boolean;
|
|
21
24
|
siblingDoc: Record<string, unknown>;
|
|
22
25
|
};
|
|
23
|
-
export declare const recurseNestedFields: ({ context, currentDepth, data, depth, fields, findMany, flattenLocales, overrideAccess, populationPromises,
|
|
26
|
+
export declare const recurseNestedFields: ({ context, currentDepth, data, depth, fieldPromises, fields, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc, }: NestedRichTextFieldsArgs) => void;
|
|
24
27
|
export {};
|
|
25
28
|
//# sourceMappingURL=recurseNestedFields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recurseNestedFields.d.ts","sourceRoot":"","sources":["../../src/populate/recurseNestedFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAI1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,EAAE,OAAO,CAAA;IACvB,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IACnC,
|
|
1
|
+
{"version":3,"file":"recurseNestedFields.d.ts","sourceRoot":"","sources":["../../src/populate/recurseNestedFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAI1D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAEnE,KAAK,wBAAwB,GAAG;IAC9B,OAAO,EAAE,cAAc,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IAC9B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,EAAE,OAAO,CAAA;IACvB,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IACnC,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,mBAAmB,oKAc7B,wBAAwB,KAAG,IAsB7B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { afterReadTraverseFields } from 'payload/utilities';
|
|
2
|
-
export const recurseNestedFields = ({ context, currentDepth = 0, data, depth, fields, findMany, flattenLocales, overrideAccess = false, populationPromises,
|
|
2
|
+
export const recurseNestedFields = ({ context, currentDepth = 0, data, depth, fieldPromises, fields, findMany, flattenLocales, overrideAccess = false, populationPromises, req, showHiddenFields, siblingDoc })=>{
|
|
3
3
|
afterReadTraverseFields({
|
|
4
4
|
collection: null,
|
|
5
5
|
context,
|
|
@@ -7,7 +7,7 @@ export const recurseNestedFields = ({ context, currentDepth = 0, data, depth, fi
|
|
|
7
7
|
depth,
|
|
8
8
|
doc: data,
|
|
9
9
|
fallbackLocale: req.fallbackLocale,
|
|
10
|
-
fieldPromises
|
|
10
|
+
fieldPromises,
|
|
11
11
|
fields,
|
|
12
12
|
findMany,
|
|
13
13
|
flattenLocales,
|
|
@@ -17,9 +17,7 @@ export const recurseNestedFields = ({ context, currentDepth = 0, data, depth, fi
|
|
|
17
17
|
populationPromises,
|
|
18
18
|
req,
|
|
19
19
|
showHiddenFields,
|
|
20
|
-
siblingDoc
|
|
21
|
-
triggerAccessControl: false,
|
|
22
|
-
triggerHooks: false
|
|
20
|
+
siblingDoc
|
|
23
21
|
});
|
|
24
22
|
};
|
|
25
23
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/populate/recurseNestedFields.ts"],"sourcesContent":["import type { RequestContext } from 'payload'\nimport type { Field, PayloadRequest } from 'payload/types'\n\nimport { afterReadTraverseFields } from 'payload/utilities'\n\nimport type { PopulationPromise } from '../field/features/types.js'\n\ntype NestedRichTextFieldsArgs = {\n context: RequestContext\n currentDepth?: number\n data: unknown\n depth: number\n /**\n * This maps all the population promises to the node types\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n fields: Field[]\n findMany: boolean\n flattenLocales: boolean\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n
|
|
1
|
+
{"version":3,"sources":["../../src/populate/recurseNestedFields.ts"],"sourcesContent":["import type { RequestContext } from 'payload'\nimport type { Field, PayloadRequest } from 'payload/types'\n\nimport { afterReadTraverseFields } from 'payload/utilities'\n\nimport type { PopulationPromise } from '../field/features/types.js'\n\ntype NestedRichTextFieldsArgs = {\n context: RequestContext\n currentDepth?: number\n data: unknown\n depth: number\n /**\n * This maps all the population promises to the node types\n */\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n /**\n * fieldPromises are used for things like field hooks. They should be awaited before awaiting populationPromises\n */\n fieldPromises: Promise<void>[]\n fields: Field[]\n findMany: boolean\n flattenLocales: boolean\n overrideAccess: boolean\n populationPromises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc: Record<string, unknown>\n}\n\nexport const recurseNestedFields = ({\n context,\n currentDepth = 0,\n data,\n depth,\n fieldPromises,\n fields,\n findMany,\n flattenLocales,\n overrideAccess = false,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: NestedRichTextFieldsArgs): void => {\n afterReadTraverseFields({\n collection: null, // Pass from core? This is only needed for hooks, so we can leave this null for now\n context,\n currentDepth,\n depth,\n doc: data as any, // Looks like it's only needed for hooks and access control, so doesn't matter what we pass here right now\n fallbackLocale: req.fallbackLocale,\n fieldPromises,\n fields,\n findMany,\n flattenLocales,\n global: null, // Pass from core? This is only needed for hooks, so we can leave this null for now\n locale: req.locale,\n overrideAccess,\n populationPromises, // This is not the same as populationPromises passed into this recurseNestedFields. These are just promises resolved at the very end.\n req,\n showHiddenFields,\n siblingDoc,\n //triggerAccessControl: false, // TODO: Enable this to support access control\n //triggerHooks: false, // TODO: Enable this to support hooks\n })\n}\n"],"names":["afterReadTraverseFields","recurseNestedFields","context","currentDepth","data","depth","fieldPromises","fields","findMany","flattenLocales","overrideAccess","populationPromises","req","showHiddenFields","siblingDoc","collection","doc","fallbackLocale","global","locale"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":"AAGA,SAASA,uBAAuB,QAAQ,oBAAmB;AA2B3D,OAAO,MAAMC,sBAAsB,CAAC,EAClCC,OAAO,EACPC,eAAe,CAAC,EAChBC,IAAI,EACJC,KAAK,EACLC,aAAa,EACbC,MAAM,EACNC,QAAQ,EACRC,cAAc,EACdC,iBAAiB,KAAK,EACtBC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACe;IACzBd,wBAAwB;QACtBe,YAAY;QACZb;QACAC;QACAE;QACAW,KAAKZ;QACLa,gBAAgBL,IAAIK,cAAc;QAClCX;QACAC;QACAC;QACAC;QACAS,QAAQ;QACRC,QAAQP,IAAIO,MAAM;QAClBT;QACAC;QACAC;QACAC;QACAC;IAGF;AACF,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.15",
|
|
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
|
+
"payload": "3.0.0-beta.15",
|
|
44
|
+
"@payloadcms/translations": "3.0.0-beta.15",
|
|
43
45
|
"@payloadcms/eslint-config": "1.1.1",
|
|
44
|
-
"@payloadcms/
|
|
45
|
-
"
|
|
46
|
-
"@payloadcms/ui": "3.0.0-beta.13",
|
|
47
|
-
"@payloadcms/next": "3.0.0-beta.13"
|
|
46
|
+
"@payloadcms/ui": "3.0.0-beta.15",
|
|
47
|
+
"@payloadcms/next": "3.0.0-beta.15"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@payloadcms/
|
|
51
|
-
"@payloadcms/
|
|
52
|
-
"
|
|
53
|
-
"
|
|
50
|
+
"@payloadcms/ui": "3.0.0-beta.15",
|
|
51
|
+
"@payloadcms/next": "3.0.0-beta.15",
|
|
52
|
+
"payload": "3.0.0-beta.15",
|
|
53
|
+
"@payloadcms/translations": "3.0.0-beta.15"
|
|
54
54
|
},
|
|
55
55
|
"exports": {
|
|
56
56
|
".": {
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
|
|
2
|
-
import type { PayloadRequest, RichTextAdapter, RichTextField } from 'payload/types';
|
|
3
|
-
import type { PopulationPromise } from '../field/features/types.js';
|
|
4
|
-
import type { AdapterProps } from '../types.js';
|
|
5
|
-
export type Args = Parameters<RichTextAdapter<SerializedEditorState, AdapterProps>['populationPromise']>[0] & {
|
|
6
|
-
editorPopulationPromises: Map<string, Array<PopulationPromise>>;
|
|
7
|
-
};
|
|
8
|
-
type RecurseRichTextArgs = {
|
|
9
|
-
children: SerializedLexicalNode[];
|
|
10
|
-
currentDepth: number;
|
|
11
|
-
depth: number;
|
|
12
|
-
editorPopulationPromises: Map<string, Array<PopulationPromise>>;
|
|
13
|
-
field: RichTextField<SerializedEditorState, AdapterProps>;
|
|
14
|
-
overrideAccess: boolean;
|
|
15
|
-
promises: Promise<void>[];
|
|
16
|
-
req: PayloadRequest;
|
|
17
|
-
showHiddenFields: boolean;
|
|
18
|
-
siblingDoc?: Record<string, unknown>;
|
|
19
|
-
};
|
|
20
|
-
export declare const recurseRichText: ({ children, context, currentDepth, depth, editorPopulationPromises, field, findMany, flattenLocales, overrideAccess, populationPromises, promises, req, showHiddenFields, siblingDoc, }: RecurseRichTextArgs & Args) => void;
|
|
21
|
-
export declare const richTextRelationshipPromise: ({ context, currentDepth, depth, editorPopulationPromises, field, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc, }: Args) => Promise<void>;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=richTextRelationshipPromise.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"richTextRelationshipPromise.d.ts","sourceRoot":"","sources":["../../src/populate/richTextRelationshipPromise.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAEnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,MAAM,IAAI,GAAG,UAAU,CAC3B,eAAe,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAC,mBAAmB,CAAC,CAC1E,CAAC,CAAC,CAAC,GAAG;IACL,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;CAChE,CAAA;AAED,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,qBAAqB,EAAE,CAAA;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,wBAAwB,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAA;IAC/D,KAAK,EAAE,aAAa,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAA;IACzD,cAAc,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,CAAA;IACzB,GAAG,EAAE,cAAc,CAAA;IACnB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,eAAe,4LAezB,mBAAmB,GAAG,IAAI,KAAG,IAiD/B,CAAA;AAED,eAAO,MAAM,2BAA2B,wKAarC,IAAI,KAAG,QAAQ,IAAI,CAqBrB,CAAA"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export const recurseRichText = ({ children, context, currentDepth = 0, depth, editorPopulationPromises, field, findMany, flattenLocales, overrideAccess = false, populationPromises, promises, req, showHiddenFields, siblingDoc })=>{
|
|
2
|
-
if (depth <= 0 || currentDepth > depth) {
|
|
3
|
-
return;
|
|
4
|
-
}
|
|
5
|
-
if (Array.isArray(children)) {
|
|
6
|
-
children.forEach((node)=>{
|
|
7
|
-
if (editorPopulationPromises?.has(node.type)) {
|
|
8
|
-
for (const promise of editorPopulationPromises.get(node.type)){
|
|
9
|
-
promises.push(...promise({
|
|
10
|
-
context,
|
|
11
|
-
currentDepth,
|
|
12
|
-
depth,
|
|
13
|
-
editorPopulationPromises,
|
|
14
|
-
field,
|
|
15
|
-
findMany,
|
|
16
|
-
flattenLocales,
|
|
17
|
-
node,
|
|
18
|
-
overrideAccess,
|
|
19
|
-
populationPromises,
|
|
20
|
-
req,
|
|
21
|
-
showHiddenFields,
|
|
22
|
-
siblingDoc
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if ('children' in node && Array.isArray(node?.children) && node?.children?.length) {
|
|
27
|
-
recurseRichText({
|
|
28
|
-
children: node.children,
|
|
29
|
-
context,
|
|
30
|
-
currentDepth,
|
|
31
|
-
depth,
|
|
32
|
-
editorPopulationPromises,
|
|
33
|
-
field,
|
|
34
|
-
findMany,
|
|
35
|
-
flattenLocales,
|
|
36
|
-
overrideAccess,
|
|
37
|
-
populationPromises,
|
|
38
|
-
promises,
|
|
39
|
-
req,
|
|
40
|
-
showHiddenFields,
|
|
41
|
-
siblingDoc
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
export const richTextRelationshipPromise = async ({ context, currentDepth, depth, editorPopulationPromises, field, findMany, flattenLocales, overrideAccess, populationPromises, req, showHiddenFields, siblingDoc })=>{
|
|
48
|
-
const promises = [];
|
|
49
|
-
recurseRichText({
|
|
50
|
-
children: siblingDoc[field?.name]?.root?.children ?? [],
|
|
51
|
-
context,
|
|
52
|
-
currentDepth,
|
|
53
|
-
depth,
|
|
54
|
-
editorPopulationPromises,
|
|
55
|
-
field,
|
|
56
|
-
findMany,
|
|
57
|
-
flattenLocales,
|
|
58
|
-
overrideAccess,
|
|
59
|
-
populationPromises,
|
|
60
|
-
promises,
|
|
61
|
-
req,
|
|
62
|
-
showHiddenFields,
|
|
63
|
-
siblingDoc
|
|
64
|
-
});
|
|
65
|
-
await Promise.all(promises);
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
//# sourceMappingURL=richTextRelationshipPromise.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/populate/richTextRelationshipPromise.ts"],"sourcesContent":["import type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\nimport type { PayloadRequest, RichTextAdapter, RichTextField } from 'payload/types'\n\nimport type { PopulationPromise } from '../field/features/types.js'\nimport type { AdapterProps } from '../types.js'\n\nexport type Args = Parameters<\n RichTextAdapter<SerializedEditorState, AdapterProps>['populationPromise']\n>[0] & {\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n}\n\ntype RecurseRichTextArgs = {\n children: SerializedLexicalNode[]\n currentDepth: number\n depth: number\n editorPopulationPromises: Map<string, Array<PopulationPromise>>\n field: RichTextField<SerializedEditorState, AdapterProps>\n overrideAccess: boolean\n promises: Promise<void>[]\n req: PayloadRequest\n showHiddenFields: boolean\n siblingDoc?: Record<string, unknown>\n}\n\nexport const recurseRichText = ({\n children,\n context,\n currentDepth = 0,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess = false,\n populationPromises,\n promises,\n req,\n showHiddenFields,\n siblingDoc,\n}: RecurseRichTextArgs & Args): void => {\n if (depth <= 0 || currentDepth > depth) {\n return\n }\n\n if (Array.isArray(children)) {\n children.forEach((node) => {\n if (editorPopulationPromises?.has(node.type)) {\n for (const promise of editorPopulationPromises.get(node.type)) {\n promises.push(\n ...promise({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n node,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n }),\n )\n }\n }\n\n if ('children' in node && Array.isArray(node?.children) && node?.children?.length) {\n recurseRichText({\n children: node.children as SerializedLexicalNode[],\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n promises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n }\n })\n }\n}\n\nexport const richTextRelationshipPromise = async ({\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n req,\n showHiddenFields,\n siblingDoc,\n}: Args): Promise<void> => {\n const promises = []\n\n recurseRichText({\n children: (siblingDoc[field?.name] as SerializedEditorState)?.root?.children ?? [],\n context,\n currentDepth,\n depth,\n editorPopulationPromises,\n field,\n findMany,\n flattenLocales,\n overrideAccess,\n populationPromises,\n promises,\n req,\n showHiddenFields,\n siblingDoc,\n })\n\n await Promise.all(promises)\n}\n"],"names":["recurseRichText","children","context","currentDepth","depth","editorPopulationPromises","field","findMany","flattenLocales","overrideAccess","populationPromises","promises","req","showHiddenFields","siblingDoc","Array","isArray","forEach","node","has","type","promise","get","push","length","richTextRelationshipPromise","name","root","Promise","all"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAyBA,OAAO,MAAMA,kBAAkB,CAAC,EAC9BC,QAAQ,EACRC,OAAO,EACPC,eAAe,CAAC,EAChBC,KAAK,EACLC,wBAAwB,EACxBC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACdC,iBAAiB,KAAK,EACtBC,kBAAkB,EAClBC,QAAQ,EACRC,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACiB;IAC3B,IAAIV,SAAS,KAAKD,eAAeC,OAAO;QACtC;IACF;IAEA,IAAIW,MAAMC,OAAO,CAACf,WAAW;QAC3BA,SAASgB,OAAO,CAAC,CAACC;YAChB,IAAIb,0BAA0Bc,IAAID,KAAKE,IAAI,GAAG;gBAC5C,KAAK,MAAMC,WAAWhB,yBAAyBiB,GAAG,CAACJ,KAAKE,IAAI,EAAG;oBAC7DT,SAASY,IAAI,IACRF,QAAQ;wBACTnB;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAC;wBACAU;wBACAT;wBACAC;wBACAE;wBACAC;wBACAC;oBACF;gBAEJ;YACF;YAEA,IAAI,cAAcI,QAAQH,MAAMC,OAAO,CAACE,MAAMjB,aAAaiB,MAAMjB,UAAUuB,QAAQ;gBACjFxB,gBAAgB;oBACdC,UAAUiB,KAAKjB,QAAQ;oBACvBC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;oBACAC;gBACF;YACF;QACF;IACF;AACF,EAAC;AAED,OAAO,MAAMW,8BAA8B,OAAO,EAChDvB,OAAO,EACPC,YAAY,EACZC,KAAK,EACLC,wBAAwB,EACxBC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBE,GAAG,EACHC,gBAAgB,EAChBC,UAAU,EACL;IACL,MAAMH,WAAW,EAAE;IAEnBX,gBAAgB;QACdC,UAAU,AAACa,UAAU,CAACR,OAAOoB,KAAK,EAA4BC,MAAM1B,YAAY,EAAE;QAClFC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,MAAMc,QAAQC,GAAG,CAAClB;AACpB,EAAC"}
|