@payloadcms/richtext-lexical 3.23.0 → 3.24.0-canary.10637cd
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/dependencyChecker.spec.js +0 -2
- package/dist/dependencyChecker.spec.js.map +1 -1
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-EE27FURT.js +2 -0
- package/dist/exports/client/chunk-EE27FURT.js.map +7 -0
- package/dist/exports/client/componentInline-XEH2GDVO.js +2 -0
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +3 -3
- package/dist/exports/react/components/RichText/converter/converters/upload.d.ts.map +1 -1
- package/dist/exports/react/components/RichText/converter/converters/upload.js +14 -10
- package/dist/exports/react/components/RichText/converter/converters/upload.js.map +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +5 -2
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +5 -2
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +3 -2
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts +3 -3
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +58 -38
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/validate.d.ts +5 -0
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.js +5 -0
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/converters/html/field/index.d.ts.map +1 -1
- package/dist/features/converters/html/field/index.js +3 -43
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/indent/client/index.d.ts.map +1 -1
- package/dist/features/indent/client/index.js +23 -7
- package/dist/features/indent/client/index.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.d.ts +19 -8
- package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/index.js +8 -4
- package/dist/utilities/migrateSlateToLexical/index.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +3 -2
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +14 -9
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/index.js +8 -4
- package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +3 -2
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +14 -9
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/package.json +7 -17
- package/dist/exports/client/chunk-KEEUF5NK.js +0 -2
- package/dist/exports/client/chunk-KEEUF5NK.js.map +0 -7
- package/dist/exports/client/componentInline-UG3ZWWJY.js +0 -2
- /package/dist/exports/client/{componentInline-UG3ZWWJY.js.map → componentInline-XEH2GDVO.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["upgradeDocumentFieldsRecursively","upgradeLexicalData","payload","collections","config","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","upgradeCollection","cur","max","global","globals","upgradeGlobal","console","log","slug","document","findGlobal","depth","undefined","overrideAccess","found","upgradeDocument","fields","updateGlobal","data","documentCount","count","totalDocs","page","upgraded","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/upgradeLexicalData/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { upgradeDocumentFieldsRecursively } from './upgradeDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single document in your payload app and re-saves it, if it has a lexical editor.\n * This way, the data is automatically converted to the new format, and that automatic conversion gets applied to every single document in your app.\n *\n * @param payload\n */\nexport async function upgradeLexicalData({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await upgradeCollection({\n collection,\n cur: curCollection,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await upgradeGlobal({\n global,\n locale,\n payload,\n })\n }\n }\n}\n\nasync function upgradeGlobal({\n global,\n locale,\n payload,\n}: {\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`Lexical Upgrader: ${locale}: Upgrading global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = upgradeDocument({\n document,\n fields: global.fields,\n })\n\n if (found) {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n}\n\nasync function upgradeCollection({\n collection,\n cur,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n })\n ).totalDocs\n\n let page = 1\n let upgraded = 0\n\n while (upgraded < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n upgraded++\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Upgrading Document: ' +\n document.id +\n ' (' +\n upgraded +\n '/' +\n documentCount +\n ')',\n )\n const found = upgradeDocument({\n document,\n fields: collection.fields,\n })\n\n if (found) {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n }\n page++\n }\n}\n\nfunction upgradeDocument({\n document,\n fields,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n}): boolean {\n return !!upgradeDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n })\n}\n"],"mappings":"AAEA,SAASA,gCAAgC,QAAQ;AAEjD;;;;;;AAMA,OAAO,eAAeC,mBAAmB;EAAEC;AAAO,CAAwB;EACxE,MAAMC,WAAA,GAAcD,OAAA,CAAQE,MAAM,CAACD,WAAW;EAE9C,MAAME,UAAA,GAAaH,OAAA,CAAQE,MAAM,CAACE,YAAY,GAAGJ,OAAA,CAAQE,MAAM,CAACE,YAAY,CAACC,WAAW,GAAG,CAAC,KAAK;EAEjG,MAAMC,gBAAA,GAAmBL,WAAA,CAAYM,MAAM;EAC3C,KAAK,MAAMC,MAAA,IAAUL,UAAA,EAAY;IAC/B,IAAIM,aAAA,GAAgB;IACpB,KAAK,MAAMC,UAAA,IAAcT,WAAA,EAAa;MACpCQ,aAAA;MACA,MAAME,iBAAA,CAAkB;QACtBD,UAAA;QACAE,GAAA,EAAKH,aAAA;QACLD,MAAA;QACAK,GAAA,EAAKP,gBAAA;QACLN;MACF;IACF;IACA,KAAK,MAAMc,MAAA,IAAUd,OAAA,CAAQE,MAAM,CAACa,OAAO,EAAE;MAC3C,MAAMC,aAAA,CAAc;QAClBF,MAAA;QACAN,MAAA;QACAR;MACF;IACF;EACF;AACF;AAEA,eAAegB,cAAc;EAC3BF,MAAM;EACNN,MAAM;EACNR;AAAO,CAKR;EACCiB,OAAA,CAAQC,GAAG,CAAC,qBAAqBV,MAAA,qBAA2B,EAAEM,MAAA,CAAOK,IAAI;EAEzE,MAAMC,QAAA,GAAW,MAAMpB,OAAA,CAAQqB,UAAU,CAAC;IACxCF,IAAA,EAAML,MAAA,CAAOK,IAAI;IACjBG,KAAA,EAAO;IACPd,MAAA,EAAQA,MAAA,IAAUe,SAAA;IAClBC,cAAA,EAAgB;EAClB;EAEA,MAAMC,KAAA,GAAQC,eAAA,CAAgB;IAC5BN,QAAA;IACAO,MAAA,EAAQb,MAAA,CAAOa;
|
|
1
|
+
{"version":3,"file":"index.js","names":["upgradeDocumentFieldsRecursively","upgradeLexicalData","payload","collections","config","allLocales","localization","localeCodes","totalCollections","length","locale","curCollection","collection","upgradeCollection","cur","max","global","globals","upgradeGlobal","console","log","slug","document","findGlobal","depth","undefined","overrideAccess","found","upgradeDocument","fields","updateGlobal","data","documentCount","count","totalDocs","page","upgraded","documents","find","pagination","docs","id","update"],"sources":["../../../src/utilities/upgradeLexicalData/index.ts"],"sourcesContent":["import type { CollectionConfig, Field, GlobalConfig, Payload } from 'payload'\n\nimport { upgradeDocumentFieldsRecursively } from './upgradeDocumentFieldsRecursively.js'\n\n/**\n * This goes through every single document in your payload app and re-saves it, if it has a lexical editor.\n * This way, the data is automatically converted to the new format, and that automatic conversion gets applied to every single document in your app.\n *\n * @param payload\n */\nexport async function upgradeLexicalData({ payload }: { payload: Payload }) {\n const collections = payload.config.collections\n\n const allLocales = payload.config.localization ? payload.config.localization.localeCodes : [null]\n\n const totalCollections = collections.length\n for (const locale of allLocales) {\n let curCollection = 0\n for (const collection of collections) {\n curCollection++\n await upgradeCollection({\n collection,\n cur: curCollection,\n locale,\n max: totalCollections,\n payload,\n })\n }\n for (const global of payload.config.globals) {\n await upgradeGlobal({\n global,\n locale,\n payload,\n })\n }\n }\n}\n\nasync function upgradeGlobal({\n global,\n locale,\n payload,\n}: {\n global: GlobalConfig\n locale: null | string\n payload: Payload\n}) {\n console.log(`Lexical Upgrader: ${locale}: Upgrading global:`, global.slug)\n\n const document = await payload.findGlobal({\n slug: global.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n })\n\n const found = upgradeDocument({\n document,\n fields: global.fields,\n payload,\n })\n\n if (found) {\n await payload.updateGlobal({\n slug: global.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n}\n\nasync function upgradeCollection({\n collection,\n cur,\n locale,\n max,\n payload,\n}: {\n collection: CollectionConfig\n cur: number\n locale: null | string\n max: number\n payload: Payload\n}) {\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' + cur + '/' + max + ')',\n )\n\n const documentCount = (\n await payload.count({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n })\n ).totalDocs\n\n let page = 1\n let upgraded = 0\n\n while (upgraded < documentCount) {\n const documents = await payload.find({\n collection: collection.slug,\n depth: 0,\n locale: locale || undefined,\n overrideAccess: true,\n page,\n pagination: true,\n })\n\n for (const document of documents.docs) {\n upgraded++\n console.log(\n `Lexical Upgrade: ${locale}: Upgrading collection:`,\n collection.slug,\n '(' +\n cur +\n '/' +\n max +\n ') - Upgrading Document: ' +\n document.id +\n ' (' +\n upgraded +\n '/' +\n documentCount +\n ')',\n )\n const found = upgradeDocument({\n document,\n fields: collection.fields,\n payload,\n })\n\n if (found) {\n await payload.update({\n id: document.id,\n collection: collection.slug,\n data: document,\n depth: 0,\n locale: locale || undefined,\n })\n }\n }\n page++\n }\n}\n\nfunction upgradeDocument({\n document,\n fields,\n payload,\n}: {\n document: Record<string, unknown>\n fields: Field[]\n payload: Payload\n}): boolean {\n return !!upgradeDocumentFieldsRecursively({\n data: document,\n fields,\n found: 0,\n payload,\n })\n}\n"],"mappings":"AAEA,SAASA,gCAAgC,QAAQ;AAEjD;;;;;;AAMA,OAAO,eAAeC,mBAAmB;EAAEC;AAAO,C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B,UAAA,EAAYA,UAAA,CAAWS,IAAI;UAC3BU,IAAA,EAAMT,QAAA;UACNE,KAAA,EAAO;UACPd,MAAA,EAAQA,MAAA,IAAUe;QACpB;MACF;IACF;IACAU,IAAA;EACF;AACF;AAEA,SAASP,gBAAgB;EACvBN,QAAQ;EACRO,MAAM;EACN3B;AAAO,CAKR;EACC,OAAO,CAAC,CAACF,gCAAA,CAAiC;IACxC+B,IAAA,EAAMT,QAAA;IACNO,MAAA;IACAF,KAAA,EAAO;IACPzB;EACF;AACF","ignoreList":[]}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Field } from 'payload';
|
|
1
|
+
import type { Field, Payload } from 'payload';
|
|
2
2
|
type NestedRichTextFieldsArgs = {
|
|
3
3
|
data: Record<string, unknown>;
|
|
4
4
|
fields: Field[];
|
|
5
5
|
found: number;
|
|
6
|
+
payload: Payload;
|
|
6
7
|
};
|
|
7
|
-
export declare const upgradeDocumentFieldsRecursively: ({ data, fields, found, }: NestedRichTextFieldsArgs) => number;
|
|
8
|
+
export declare const upgradeDocumentFieldsRecursively: ({ data, fields, found, payload, }: NestedRichTextFieldsArgs) => number;
|
|
8
9
|
export {};
|
|
9
10
|
//# sourceMappingURL=upgradeDocumentFieldsRecursively.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeDocumentFieldsRecursively.d.ts","sourceRoot":"","sources":["../../../src/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"upgradeDocumentFieldsRecursively.d.ts","sourceRoot":"","sources":["../../../src/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAkB,OAAO,EAAE,MAAM,SAAS,CAAA;AAS7D,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAE7B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,gCAAgC,sCAK1C,wBAAwB,KAAG,MAgG7B,CAAA"}
|
|
@@ -4,7 +4,8 @@ import { getEnabledNodes } from '../../lexical/nodes/index.js';
|
|
|
4
4
|
export const upgradeDocumentFieldsRecursively = ({
|
|
5
5
|
data,
|
|
6
6
|
fields,
|
|
7
|
-
found
|
|
7
|
+
found,
|
|
8
|
+
payload
|
|
8
9
|
}) => {
|
|
9
10
|
for (const field of fields) {
|
|
10
11
|
if (fieldHasSubFields(field) && !fieldIsArrayType(field)) {
|
|
@@ -12,13 +13,15 @@ export const upgradeDocumentFieldsRecursively = ({
|
|
|
12
13
|
found += upgradeDocumentFieldsRecursively({
|
|
13
14
|
data: data[field.name],
|
|
14
15
|
fields: field.fields,
|
|
15
|
-
found
|
|
16
|
+
found,
|
|
17
|
+
payload
|
|
16
18
|
});
|
|
17
19
|
} else {
|
|
18
20
|
found += upgradeDocumentFieldsRecursively({
|
|
19
21
|
data,
|
|
20
22
|
fields: field.fields,
|
|
21
|
-
found
|
|
23
|
+
found,
|
|
24
|
+
payload
|
|
22
25
|
});
|
|
23
26
|
}
|
|
24
27
|
} else if (field.type === 'tabs') {
|
|
@@ -26,20 +29,21 @@ export const upgradeDocumentFieldsRecursively = ({
|
|
|
26
29
|
found += upgradeDocumentFieldsRecursively({
|
|
27
30
|
data: tabHasName(tab) ? data[tab.name] : data,
|
|
28
31
|
fields: tab.fields,
|
|
29
|
-
found
|
|
32
|
+
found,
|
|
33
|
+
payload
|
|
30
34
|
});
|
|
31
35
|
});
|
|
32
36
|
} else if (Array.isArray(data[field.name])) {
|
|
33
37
|
if (field.type === 'blocks') {
|
|
34
38
|
data[field.name].forEach((row, i) => {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
}) => slug === row?.blockType);
|
|
39
|
+
const blockTypeToMatch = row?.blockType;
|
|
40
|
+
const block = payload.blocks[blockTypeToMatch] ?? (field.blockReferences ?? field.blocks).find(block => typeof block !== 'string' && block.slug === blockTypeToMatch);
|
|
38
41
|
if (block) {
|
|
39
42
|
found += upgradeDocumentFieldsRecursively({
|
|
40
43
|
data: data[field.name][i],
|
|
41
44
|
fields: block.fields,
|
|
42
|
-
found
|
|
45
|
+
found,
|
|
46
|
+
payload
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
});
|
|
@@ -49,7 +53,8 @@ export const upgradeDocumentFieldsRecursively = ({
|
|
|
49
53
|
found += upgradeDocumentFieldsRecursively({
|
|
50
54
|
data: data[field.name][i],
|
|
51
55
|
fields: field.fields,
|
|
52
|
-
found
|
|
56
|
+
found,
|
|
57
|
+
payload
|
|
53
58
|
});
|
|
54
59
|
});
|
|
55
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgradeDocumentFieldsRecursively.js","names":["createHeadlessEditor","fieldAffectsData","fieldHasSubFields","fieldIsArrayType","tabHasName","getEnabledNodes","upgradeDocumentFieldsRecursively","data","fields","found","field","name","type","tabs","forEach","tab","Array","isArray","row","i","block","blocks","
|
|
1
|
+
{"version":3,"file":"upgradeDocumentFieldsRecursively.js","names":["createHeadlessEditor","fieldAffectsData","fieldHasSubFields","fieldIsArrayType","tabHasName","getEnabledNodes","upgradeDocumentFieldsRecursively","data","fields","found","payload","field","name","type","tabs","forEach","tab","Array","isArray","row","i","blockTypeToMatch","blockType","block","blocks","blockReferences","find","slug","_","editor","features","length","editorState","headlessEditor","nodes","editorConfig","update","setEditorState","parseEditorState","discrete","getEditorState","toJSON"],"sources":["../../../src/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.ts"],"sourcesContent":["import type { SerializedEditorState } from 'lexical'\nimport type { Field, FlattenedBlock, Payload } from 'payload'\n\nimport { createHeadlessEditor } from '@lexical/headless'\nimport { fieldAffectsData, fieldHasSubFields, fieldIsArrayType, tabHasName } from 'payload/shared'\n\nimport type { LexicalRichTextAdapter } from '../../types.js'\n\nimport { getEnabledNodes } from '../../lexical/nodes/index.js'\n\ntype NestedRichTextFieldsArgs = {\n data: Record<string, unknown>\n\n fields: Field[]\n found: number\n payload: Payload\n}\n\nexport const upgradeDocumentFieldsRecursively = ({\n data,\n fields,\n found,\n payload,\n}: NestedRichTextFieldsArgs): number => {\n for (const field of fields) {\n if (fieldHasSubFields(field) && !fieldIsArrayType(field)) {\n if (fieldAffectsData(field) && typeof data[field.name] === 'object') {\n found += upgradeDocumentFieldsRecursively({\n data: data[field.name] as Record<string, unknown>,\n fields: field.fields,\n found,\n payload,\n })\n } else {\n found += upgradeDocumentFieldsRecursively({\n data,\n fields: field.fields,\n found,\n payload,\n })\n }\n } else if (field.type === 'tabs') {\n field.tabs.forEach((tab) => {\n found += upgradeDocumentFieldsRecursively({\n data: (tabHasName(tab) ? data[tab.name] : data) as Record<string, unknown>,\n fields: tab.fields,\n found,\n payload,\n })\n })\n } else if (Array.isArray(data[field.name])) {\n if (field.type === 'blocks') {\n ;(data[field.name] as Record<string, unknown>[]).forEach((row, i) => {\n const blockTypeToMatch: string = row?.blockType as string\n\n const block =\n payload.blocks[blockTypeToMatch] ??\n ((field.blockReferences ?? field.blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockTypeToMatch,\n ) as FlattenedBlock | undefined)\n\n if (block) {\n found += upgradeDocumentFieldsRecursively({\n data: (data[field.name] as Record<string, unknown>[])[i],\n fields: block.fields,\n found,\n payload,\n })\n }\n })\n }\n\n if (field.type === 'array') {\n ;(data[field.name] as Record<string, unknown>[]).forEach((_, i) => {\n found += upgradeDocumentFieldsRecursively({\n data: (data[field.name] as Record<string, unknown>[])[i],\n fields: field.fields,\n found,\n payload,\n })\n })\n }\n }\n\n if (\n field.type === 'richText' &&\n data[field.name] &&\n !Array.isArray(data[field.name]) &&\n 'root' in (data[field.name] as Record<string, unknown>)\n ) {\n // Lexical richText\n const editor: LexicalRichTextAdapter = field.editor as LexicalRichTextAdapter\n if (editor && typeof editor === 'object') {\n if ('features' in editor && editor.features?.length) {\n // Load lexical editor into lexical, then save it immediately\n const editorState = data[field.name] as SerializedEditorState\n\n const headlessEditor = createHeadlessEditor({\n nodes: getEnabledNodes({\n editorConfig: editor.editorConfig,\n }),\n })\n headlessEditor.update(\n () => {\n headlessEditor.setEditorState(headlessEditor.parseEditorState(editorState))\n },\n { discrete: true },\n )\n\n // get editor state\n data[field.name] = headlessEditor.getEditorState().toJSON()\n\n found++\n }\n }\n }\n }\n\n return found\n}\n"],"mappings":"AAGA,SAASA,oBAAoB,QAAQ;AACrC,SAASC,gBAAgB,EAAEC,iBAAiB,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ;AAIlF,SAASC,eAAe,QAAQ;AAUhC,OAAO,MAAMC,gCAAA,GAAmCA,CAAC;EAC/CC,IAAI;EACJC,MAAM;EACNC,KAAK;EACLC;AAAO,CACkB;EACzB,KAAK,MAAMC,KAAA,IAASH,MAAA,EAAQ;IAC1B,IAAIN,iBAAA,CAAkBS,KAAA,KAAU,CAACR,gBAAA,CAAiBQ,KAAA,GAAQ;MACxD,IAAIV,gBAAA,CAAiBU,KAAA,KAAU,OAAOJ,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC,KAAK,UAAU;QACnEH,KAAA,IAASH,gCAAA,CAAiC;UACxCC,IAAA,EAAMA,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC;UACtBJ,MAAA,EAAQG,KAAA,CAAMH,MAAM;UACpBC,KAAA;UACAC;QACF;MACF,OAAO;QACLD,KAAA,IAASH,gCAAA,CAAiC;UACxCC,IAAA;UACAC,MAAA,EAAQG,KAAA,CAAMH,MAAM;UACpBC,KAAA;UACAC;QACF;MACF;IACF,OAAO,IAAIC,KAAA,CAAME,IAAI,KAAK,QAAQ;MAChCF,KAAA,CAAMG,IAAI,CAACC,OAAO,CAAEC,GAAA;QAClB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AEA,IACEC,KAAA,CAAME,IAAI,KAAK,cACfN,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC,IAChB,CAACK,KAAA,CAAMC,OAAO,CAACX,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC,KAC/B,UAAWL,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC,EAC3B;MACA;MACA,MAAMiB,MAAA,GAAiClB,KAAA,CAAMkB,MAAM;MACnD,IAAIA,MAAA,IAAU,OAAOA,MAAA,KAAW,UAAU;QACxC,IAAI,cAAcA,MAAA,IAAUA,MAAA,CAAOC,QAAQ,EAAEC,MAAA,EAAQ;UACnD;UACA,MAAMC,WAAA,GAAczB,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC;UAEpC,MAAMqB,cAAA,GAAiBjC,oBAAA,CAAqB;YAC1CkC,KAAA,EAAO7B,eAAA,CAAgB;cACrB8B,YAAA,EAAcN,MAAA,CAAOM;YACvB;UACF;UACAF,cAAA,CAAeG,MAAM,CACnB;YACEH,cAAA,CAAeI,cAAc,CAACJ,cAAA,CAAeK,gBAAgB,CAACN,WAAA;UAChE,GACA;YAAEO,QAAA,EAAU;UAAK;UAGnB;UACAhC,IAAI,CAACI,KAAA,CAAMC,IAAI,CAAC,GAAGqB,cAAA,CAAeO,cAAc,GAAGC,MAAM;UAEzDhC,KAAA;QACF;MACF;IACF;EACF;EAEA,OAAOA,KAAA;AACT","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0-canary.10637cd",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -339,6 +339,7 @@
|
|
|
339
339
|
"@lexical/rich-text": "0.21.0",
|
|
340
340
|
"@lexical/selection": "0.21.0",
|
|
341
341
|
"@lexical/utils": "0.21.0",
|
|
342
|
+
"@lexical/table": "0.21.0",
|
|
342
343
|
"@types/uuid": "10.0.0",
|
|
343
344
|
"acorn": "8.12.1",
|
|
344
345
|
"bson-objectid": "2.0.4",
|
|
@@ -352,8 +353,8 @@
|
|
|
352
353
|
"react-error-boundary": "4.1.2",
|
|
353
354
|
"ts-essentials": "10.0.3",
|
|
354
355
|
"uuid": "10.0.0",
|
|
355
|
-
"@payloadcms/translations": "3.
|
|
356
|
-
"@payloadcms/ui": "3.
|
|
356
|
+
"@payloadcms/translations": "3.24.0-canary.10637cd",
|
|
357
|
+
"@payloadcms/ui": "3.24.0-canary.10637cd"
|
|
357
358
|
},
|
|
358
359
|
"devDependencies": {
|
|
359
360
|
"@babel/cli": "7.26.4",
|
|
@@ -373,27 +374,16 @@
|
|
|
373
374
|
"esbuild-sass-plugin": "3.3.1",
|
|
374
375
|
"eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
|
|
375
376
|
"swc-plugin-transform-remove-imports": "3.1.0",
|
|
376
|
-
"payload": "3.
|
|
377
|
+
"payload": "3.24.0-canary.10637cd",
|
|
377
378
|
"@payloadcms/eslint-config": "3.9.0"
|
|
378
379
|
},
|
|
379
380
|
"peerDependencies": {
|
|
380
381
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
381
382
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
382
|
-
"@lexical/headless": "0.21.0",
|
|
383
|
-
"@lexical/html": "0.21.0",
|
|
384
|
-
"@lexical/link": "0.21.0",
|
|
385
|
-
"@lexical/list": "0.21.0",
|
|
386
|
-
"@lexical/mark": "0.21.0",
|
|
387
|
-
"@lexical/react": "0.21.0",
|
|
388
|
-
"@lexical/rich-text": "0.21.0",
|
|
389
|
-
"@lexical/selection": "0.21.0",
|
|
390
|
-
"@lexical/table": "0.21.0",
|
|
391
|
-
"@lexical/utils": "0.21.0",
|
|
392
|
-
"lexical": "0.21.0",
|
|
393
383
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
394
384
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
395
|
-
"@payloadcms/next": "3.
|
|
396
|
-
"payload": "3.
|
|
385
|
+
"@payloadcms/next": "3.24.0-canary.10637cd",
|
|
386
|
+
"payload": "3.24.0-canary.10637cd"
|
|
397
387
|
},
|
|
398
388
|
"engines": {
|
|
399
389
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as ie}from"./chunk-INBEEENE.js";import{b as le}from"./chunk-3LGFOM34.js";import{jsx as o,jsxs as f,Fragment as De}from"react/jsx-runtime";import v,{createContext as we,useCallback as M,useEffect as I,useMemo as N,useRef as g}from"react";import{useLexicalComposerContext as Ie}from"@lexical/react/LexicalComposerContext";import{getTranslation as se}from"@payloadcms/translations";import{Button as ce,Drawer as Ne,EditDepthProvider as ve,Form as Te,formatDrawerSlug as $e,FormSubmit as Pe,RenderFields as Oe,ShimmerEffect as Ee,useDocumentForm as Le,useDocumentInfo as je,useEditDepth as Me,useServerFunctions as Re,useTranslation as Ae}from"@payloadcms/ui";import{abortAndIgnore as R}from"@payloadcms/ui/shared";import{$getNodeByKey as A}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as J,reduceFieldsToValues as Je}from"payload/shared";import{v4 as Ke}from"uuid";import{jsx as _e}from"react/jsx-runtime";import Se from"bson-objectid";import Ce from"react";import Be from"bson-objectid";import{DecoratorNode as ge}from"lexical";var B=class extends ge{__cacheBuster;__fields;constructor({cacheBuster:e,fields:t,key:r}){super(r),this.__fields=t,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return xe(e.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(){let e=document.createElement("span");return e.classList.add("inline-block-container"),e}decorate(e,t){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let t=document.createTextNode(this.getTextContent());return e.append(t),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e,t){let r=this.getWritable();r.__fields=e,t||r.__cacheBuster++}updateDOM(){return!1}};function xe(l){return new B({fields:{...l,id:l?.id||new Be.default().toHexString()}})}var ye=Ce.lazy(()=>import("./componentInline-UG3ZWWJY.js").then(l=>({default:l.InlineBlockComponent}))),w=class extends B{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Fe(e.fields)}decorate(e,t){return _e(ye,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(l){return new w({fields:{...l,id:l?.id||new Se.default().toHexString()}})}function j(l){return l instanceof w}var m="inline-block",ae=we({initialState:!1}),dt=()=>v.useContext(ae),mt=l=>{let{cacheBuster:e,formData:t,nodeKey:r}=l,[a]=Ie(),{i18n:T,t:d}=Ae(),{createdInlineBlock:K,fieldProps:{featureClientSchemaMap:ue,initialLexicalFormState:de,permissions:me,readOnly:x,schemaPath:z},setCreatedInlineBlock:H,uuid:pe}=le(),{fields:_}=Le(),{getFormState:S}=Re(),fe=Me(),V=g(!1),[u,W]=v.useState(()=>de?.[t.id]?.formState),q=g(!1),G=g(e);I(()=>{q.current?(G.current!==e&&W(!1),G.current=e):q.current=!0},[e]);let[$,Q]=v.useState(u?._components?.customComponents?.BlockLabel),[U,X]=v.useState(u?._components?.customComponents?.Block),Y=$e({slug:`lexical-inlineBlocks-create-${pe}-${t.id}`,depth:fe}),{toggleDrawer:b}=ie(Y,!0),be=g(null),{id:C,collectionSlug:y,getDocPreferences:F,globalSlug:D}=je(),he=`${z}.lexical_internal_feature.blocks.lexical_inline_blocks.${t.blockType}`,s=ue.blocks?.[he]?.[0]?.blocks?.[0],Z=s?.fields??[];I(()=>{!V.current&&K?.getKey()===r&&(Z.length>2&&b(),H?.(void 0),V.current=!0)},[Z.length,K,r,H,b]);let ee=M(()=>{a.update(()=>{A(r)?.remove()})},[a,r]),h=s?.labels?.singular?se(s?.labels.singular,T):s?.slug,P=g(new AbortController),k=`${z}.lexical_internal_feature.blocks.lexical_inline_blocks.${s?.slug}.fields`;I(()=>{let n=new AbortController;return t&&!u&&(async()=>{let{state:i}=await S({id:C,collectionSlug:y,data:t,docPermissions:{fields:!0},docPreferences:await F(),documentFormState:J(_),globalSlug:D,initialBlockData:t,initialBlockFormState:t,operation:"update",renderAllFields:!0,schemaPath:k,signal:n.signal});if(i){let p=Je(J(i),!0);a.update(()=>{let L=A(r);if(L&&j(L)){let re=p;re.blockType=t.blockType,L.setFields(re,!0)}}),W(i),Q(i._components?.customComponents?.BlockLabel),X(i._components?.customComponents?.Block)}})(),()=>{R(n)}},[S,a,r,k,C,t,u,y,D,F,_]);let te=M(async({formState:n,submit:c})=>{R(P.current);let i=new AbortController;P.current=i;let{state:p}=await S({id:C,collectionSlug:y,docPermissions:{fields:!0},docPreferences:await F(),documentFormState:J(_),formState:n,globalSlug:D,initialBlockFormState:n,operation:"update",renderAllFields:!!c,schemaPath:k,signal:i.signal});return p?(c&&(Q(p._components?.customComponents?.BlockLabel),X(p._components?.customComponents?.Block)),p):n},[S,C,y,F,_,D,k]);I(()=>()=>{R(P.current)},[]);let ke=M((n,c)=>{c.blockType=t.blockType,a.update(()=>{let i=A(r);i&&j(i)&&i.setFields(c,!0)})},[a,r,t]),O=N(()=>()=>o(ce,{buttonStyle:"icon-label",className:`${m}__removeButton`,disabled:x,icon:"x",onClick:n=>{n.preventDefault(),ee()},round:!0,size:"small",tooltip:d("lexical:blocks:inlineBlocks:remove",{label:h})}),[h,x,ee,d]),ne=N(()=>()=>o(ce,{buttonStyle:"icon-label",className:`${m}__editButton`,disabled:x,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"small",tooltip:d("lexical:blocks:inlineBlocks:edit",{label:h})}),[h,x,d,b]),E=N(()=>({children:n,className:c})=>o("div",{className:[m,m+"-"+t.blockType,c].filter(Boolean).join(" "),ref:be,children:n}),[t.blockType]),oe=N(()=>$?()=>$:()=>o("div",{children:s?.labels?se(s?.labels.singular,T):""}),[$,s?.labels,T]);return s?f(Te,{beforeSubmit:[async({formState:n})=>await te({formState:n,submit:!0})],disableValidationOnSubmit:!0,fields:s?.fields,initialState:u||{},onChange:[te],onSubmit:(n,c)=>{ke(n,c),b()},uuid:Ke(),children:[o(ve,{children:o(Ne,{className:"",slug:Y,title:d(`lexical:blocks:inlineBlocks:${t?.id?"edit":"create"}`,{label:h??d("lexical:blocks:inlineBlocks:label")}),children:u?f(De,{children:[o(Oe,{fields:s?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:k,permissions:me,readOnly:!1}),o(Pe,{programmaticSubmit:!0,children:d("fields:saveChanges")})]}):null})}),U?o(ae.Provider,{value:{EditButton:ne,initialState:u,InlineBlockContainer:E,Label:oe,nodeKey:r,RemoveButton:O},children:U}):f(E,{children:[u?o(oe,{}):o(Ee,{height:"15px",width:"40px"}),a.isEditable()?f("div",{className:`${m}__actions`,children:[o(ne,{}),o(O,{})]}):null]})]}):f(E,{className:`${m}-not-found`,children:[f("span",{children:["Error: Block '",t.blockType,"' not found"]}),a.isEditable()?o("div",{className:`${m}__actions`,children:o(O,{})}):null]})};export{dt as a,mt as b,w as c,Fe as d,j as e};
|
|
2
|
-
//# sourceMappingURL=chunk-KEEUF5NK.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.useContext(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: {\n featureClientSchemaMap,\n initialLexicalFormState,\n permissions,\n readOnly,\n schemaPath,\n },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock = blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, readOnly, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[baseClass, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={permissions}\n readOnly={false}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext.Provider\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext.Provider>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {editor.isEditable() ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields<TBlockFields>\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],
|
|
5
|
-
"mappings": "mJAEA,OAAOA,GAASC,iBAAAA,GAAeC,eAAAA,EAAaC,aAAAA,EAAWC,WAAAA,EAASC,UAAAA,MAAc,QAK9E,OAASC,6BAAAA,OAAiC,wCAC1C,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,iBAAAA,MAAq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,CAAA,sBACjB6G,EAACa,GAAA,CAAA,CAAA,EACDb,EAACF,EAAA,CAAA,CAAA,CAAA,IAED,IAAA,OA1ERwB,EAACP,EAAA,CAAqBZ,UAAW,GAAGhH,CAAA,uBAClCmI,EAAC,OAAA,WAAK,iBAAezH,EAASsD,UAAU,aAAA,IACvCpD,EAAO4I,WAAU,EAChB3C,EAAC,MAAA,CAAIG,UAAW,GAAGhH,CAAA,qBACjB6G,EAACF,EAAA,CAAA,CAAA,IAED,IAAA,GAyEZ",
|
|
6
|
-
"names": ["React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "useLexicalComposerContext", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "v4", "uuid", "ObjectID", "React", "ObjectID", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "element", "document", "createElement", "classList", "add", "decorate", "editor", "config", "exportDOM", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "editor", "config", "_jsx", "cacheBuster", "getCacheBuster", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "baseClass", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "useContext", "InlineBlockComponent", "props", "cacheBuster", "formData", "nodeKey", "editor", "useLexicalComposerContext", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "permissions", "readOnly", "schemaPath", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "fields", "parentDocumentFields", "useDocumentForm", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "useRef", "setInitialState", "useState", "id", "formState", "hasMounted", "prevCacheBuster", "useEffect", "current", "CustomLabel", "setCustomLabel", "customComponents", "BlockLabel", "CustomBlock", "setCustomBlock", "Block", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "componentMapRenderedBlockPath", "blockType", "clientBlock", "blocks", "clientBlockFields", "getKey", "length", "undefined", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "initialBlockData", "initialBlockFormState", "operation", "renderAllFields", "signal", "newFormStateData", "reduceFieldsToValues", "node", "$isInlineBlockNode", "newData", "setFields", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "onFormSubmit", "RemoveButton", "useMemo", "_jsx", "Button", "buttonStyle", "className", "disabled", "icon", "onClick", "e", "preventDefault", "round", "size", "tooltip", "label", "EditButton", "el", "InlineBlockContainer", "children", "filter", "Boolean", "join", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "FormSubmit", "programmaticSubmit", "Provider", "value", "ShimmerEffect", "height", "width", "isEditable"]
|
|
7
|
-
}
|
/package/dist/exports/client/{componentInline-UG3ZWWJY.js.map → componentInline-XEH2GDVO.js.map}
RENAMED
|
File without changes
|