@payloadcms/richtext-lexical 3.57.0-canary.6 → 3.57.0-internal.1d2ebbc
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/exports/client/{Field-D5RCNN4A.js → Field-PKJPWZJL.js} +2 -2
- package/dist/exports/client/Field-PKJPWZJL.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/client/pendingComponent-WFSCE6LJ.js +2 -0
- package/dist/exports/client/pendingComponent-WFSCE6LJ.js.map +7 -0
- package/dist/features/align/server/i18n.d.ts.map +1 -1
- package/dist/features/align/server/i18n.js +0 -6
- package/dist/features/align/server/i18n.js.map +1 -1
- package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
- package/dist/features/blockquote/server/i18n.js +0 -3
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blocks/server/i18n.d.ts.map +1 -1
- package/dist/features/blocks/server/i18n.js +0 -9
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/heading/client/index.d.ts.map +1 -1
- package/dist/features/heading/client/index.js +0 -60
- package/dist/features/heading/client/index.js.map +1 -1
- package/dist/features/heading/server/i18n.d.ts.map +1 -1
- package/dist/features/heading/server/i18n.js +0 -3
- package/dist/features/heading/server/i18n.js.map +1 -1
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +0 -1
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/i18n.js +0 -3
- package/dist/features/horizontalRule/server/i18n.js.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +0 -4
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/server/i18n.d.ts.map +1 -1
- package/dist/features/link/server/i18n.js +0 -4
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/i18n.js +0 -3
- package/dist/features/lists/checklist/server/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.js +0 -3
- package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.js +0 -3
- package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
- package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
- package/dist/features/paragraph/server/i18n.js +0 -4
- package/dist/features/paragraph/server/i18n.js.map +1 -1
- package/dist/features/relationship/server/i18n.d.ts.map +1 -1
- package/dist/features/relationship/server/i18n.js +0 -3
- package/dist/features/relationship/server/i18n.js.map +1 -1
- package/dist/features/textState/i18n.d.ts.map +1 -1
- package/dist/features/textState/i18n.js +0 -3
- package/dist/features/textState/i18n.js.map +1 -1
- package/dist/features/upload/client/index.d.ts.map +1 -1
- package/dist/features/upload/client/index.js +2 -1
- package/dist/features/upload/client/index.js.map +1 -1
- package/dist/features/upload/client/nodes/PendingUploadNode.d.ts +17 -0
- package/dist/features/upload/client/nodes/PendingUploadNode.d.ts.map +1 -0
- package/dist/features/upload/client/nodes/PendingUploadNode.js +57 -0
- package/dist/features/upload/client/nodes/PendingUploadNode.js.map +1 -0
- package/dist/features/upload/client/nodes/UploadNode.d.ts +2 -7
- package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +3 -27
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/pendingComponent/index.d.ts +7 -0
- package/dist/features/upload/client/pendingComponent/index.d.ts.map +1 -0
- package/dist/features/upload/client/pendingComponent/index.js +14 -0
- package/dist/features/upload/client/pendingComponent/index.js.map +1 -0
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js +269 -22
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/i18n.d.ts.map +1 -1
- package/dist/features/upload/server/i18n.js +0 -3
- package/dist/features/upload/server/i18n.js.map +1 -1
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +4 -1
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/features/upload/server/nodes/PendingUploadNode.d.ts +42 -0
- package/dist/features/upload/server/nodes/PendingUploadNode.d.ts.map +1 -0
- package/dist/features/upload/server/nodes/PendingUploadNode.js +92 -0
- package/dist/features/upload/server/nodes/PendingUploadNode.js.map +1 -0
- package/dist/features/upload/server/nodes/UploadNode.d.ts +0 -1
- package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js +3 -37
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/server/nodes/conversions.d.ts +9 -0
- package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -0
- package/dist/features/upload/server/nodes/conversions.js +53 -0
- package/dist/features/upload/server/nodes/conversions.js.map +1 -0
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +0 -6
- package/dist/i18n.js.map +1 -1
- package/package.json +7 -7
- package/dist/exports/client/Field-D5RCNN4A.js.map +0 -7
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
|
|
3
|
+
import { $applyNodeReplacement } from 'lexical';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { $convertPendingUploadElement } from './conversions.js';
|
|
6
|
+
export class PendingUploadServerNode extends DecoratorBlockNode {
|
|
7
|
+
__data;
|
|
8
|
+
constructor({
|
|
9
|
+
data,
|
|
10
|
+
format,
|
|
11
|
+
key
|
|
12
|
+
}) {
|
|
13
|
+
super(format, key);
|
|
14
|
+
this.__data = data;
|
|
15
|
+
}
|
|
16
|
+
static clone(node) {
|
|
17
|
+
return new this({
|
|
18
|
+
data: node.__data,
|
|
19
|
+
format: node.__format,
|
|
20
|
+
key: node.__key
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
static getType() {
|
|
24
|
+
return 'pendingUpload';
|
|
25
|
+
}
|
|
26
|
+
static importDOM() {
|
|
27
|
+
return {
|
|
28
|
+
img: node => ({
|
|
29
|
+
conversion: domNode => $convertPendingUploadElement(domNode, $createPendingUploadServerNode),
|
|
30
|
+
priority: 0
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
static importJSON(serializedNode) {
|
|
35
|
+
const importedData = {
|
|
36
|
+
formID: serializedNode.formID,
|
|
37
|
+
src: serializedNode.src
|
|
38
|
+
};
|
|
39
|
+
const node = $createPendingUploadServerNode({
|
|
40
|
+
data: importedData
|
|
41
|
+
});
|
|
42
|
+
node.setFormat(serializedNode.format);
|
|
43
|
+
return node;
|
|
44
|
+
}
|
|
45
|
+
static isInline() {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
decorate() {
|
|
49
|
+
// @ts-expect-error
|
|
50
|
+
return /*#__PURE__*/_jsx(RawUploadComponent, {
|
|
51
|
+
data: this.__data,
|
|
52
|
+
format: this.__format,
|
|
53
|
+
nodeKey: this.getKey()
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exportDOM() {
|
|
57
|
+
const element = document.createElement('img');
|
|
58
|
+
element.setAttribute('data-lexical-pending-upload-form-id', String(this.__data?.formID));
|
|
59
|
+
return {
|
|
60
|
+
element
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
exportJSON() {
|
|
64
|
+
return {
|
|
65
|
+
...super.exportJSON(),
|
|
66
|
+
...this.getData(),
|
|
67
|
+
type: 'pendingUpload',
|
|
68
|
+
version: 1
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
getData() {
|
|
72
|
+
return this.getLatest().__data;
|
|
73
|
+
}
|
|
74
|
+
setData(data) {
|
|
75
|
+
const writable = this.getWritable();
|
|
76
|
+
writable.__data = data;
|
|
77
|
+
}
|
|
78
|
+
updateDOM() {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
export function $createPendingUploadServerNode({
|
|
83
|
+
data
|
|
84
|
+
}) {
|
|
85
|
+
return $applyNodeReplacement(new PendingUploadServerNode({
|
|
86
|
+
data
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
export function $isPendingUploadServerNode(node) {
|
|
90
|
+
return node instanceof PendingUploadServerNode;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=PendingUploadNode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PendingUploadNode.js","names":["DecoratorBlockNode","$applyNodeReplacement","React","$convertPendingUploadElement","PendingUploadServerNode","__data","constructor","data","format","key","clone","node","__format","__key","getType","importDOM","img","conversion","domNode","$createPendingUploadServerNode","priority","importJSON","serializedNode","importedData","formID","src","setFormat","isInline","decorate","_jsx","RawUploadComponent","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","String","exportJSON","getData","type","version","getLatest","setData","writable","getWritable","updateDOM","$isPendingUploadServerNode"],"sources":["../../../../../src/features/upload/server/nodes/PendingUploadNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport { $convertPendingUploadElement } from './conversions.js'\n\nexport type PendingUploadData = {\n /**\n * ID that corresponds to the bulk upload form ID\n */\n formID: string\n /**\n * src value of the image dom element\n */\n src: string\n}\n\nexport type SerializedPendingUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'pendingUpload'\n} & Spread<PendingUploadData, SerializedDecoratorBlockNode>\n\nexport class PendingUploadServerNode extends DecoratorBlockNode {\n __data: PendingUploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: PendingUploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: PendingUploadServerNode): PendingUploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'pendingUpload'\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: (domNode) =>\n $convertPendingUploadElement(domNode, $createPendingUploadServerNode),\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedPendingUploadNode): PendingUploadServerNode {\n const importedData: PendingUploadData = {\n formID: serializedNode.formID,\n src: serializedNode.src,\n }\n\n const node = $createPendingUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-pending-upload-form-id', String(this.__data?.formID))\n\n return { element }\n }\n\n override exportJSON(): SerializedPendingUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'pendingUpload',\n version: 1,\n }\n }\n\n getData(): PendingUploadData {\n return this.getLatest().__data\n }\n\n setData(data: PendingUploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n override updateDOM(): false {\n return false\n }\n}\n\nexport function $createPendingUploadServerNode({\n data,\n}: {\n data: PendingUploadData\n}): PendingUploadServerNode {\n return $applyNodeReplacement(new PendingUploadServerNode({ data }))\n}\n\nexport function $isPendingUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is PendingUploadServerNode {\n return node instanceof PendingUploadServerNode\n}\n"],"mappings":";AAWA,SAASA,kBAAkB,QAAQ;AACnC,SAASC,qBAAqB,QAAQ;AACtC,YAAYC,KAAA,MAAW;AAEvB,SAASC,4BAA4B,QAAQ;AAkB7C,OAAO,MAAMC,uBAAA,SAAgCJ,kBAAA;EAC3CK,MAAA;EAEAC,YAAY;IACVC,IAAI;IACJC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACJ,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBG,MAAMC,IAA6B,EAA2B;IAC5E,OAAO,IAAI,IAAI,CAAC;MACdJ,IAAA,EAAMI,IAAA,CAAKN,MAAM;MACjBG,MAAA,EAAQG,IAAA,CAAKC,QAAQ;MACrBH,GAAA,EAAKE,IAAA,CAAKE;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAgD;IAC9D,OAAO;MACLC,GAAA,EAAML,IAAA,KAAU;QACdM,UAAA,EAAaC,OAAA,IACXf,4BAAA,CAA6Be,OAAA,EAASC,8BAAA;QACxCC,QAAA,EAAU;MACZ;IACF;EACF;EAEA,OAAgBC,WAAWC,cAA2C,EAA2B;IAC/F,MAAMC,YAAA,GAAkC;MACtCC,MAAA,EAAQF,cAAA,CAAeE,MAAM;MAC7BC,GAAA,EAAKH,cAAA,CAAeG;IACtB;IAEA,MAAMd,IAAA,GAAOQ,8BAAA,CAA+B;MAAEZ,IAAA,EAAMgB;IAAa;IACjEZ,IAAA,CAAKe,SAAS,CAACJ,cAAA,CAAed,MAAM;IAEpC,OAAOG,IAAA;EACT;EAEA,OAAOgB,SAAA,EAAkB;IACvB,OAAO;EACT;EAESC,SAAA,EAAwB;IAC/B;IACA,oBAAOC,IAAA,CAACC,kBAAA;MAAmBvB,IAAA,EAAM,IAAI,CAACF,MAAM;MAAEG,MAAA,EAAQ,IAAI,CAACI,QAAQ;MAAEmB,OAAA,EAAS,IAAI,CAACC,MAAM;;EAC3F;EAESC,UAAA,EAA6B;IACpC,MAAMC,OAAA,GAAUC,QAAA,CAASC,aAAa,CAAC;IACvCF,OAAA,CAAQG,YAAY,CAAC,uCAAuCC,MAAA,CAAO,IAAI,CAACjC,MAAM,EAAEmB,MAAA;IAEhF,OAAO;MAAEU;IAAQ;EACnB;EAESK,WAAA,EAA0C;IACjD,OAAO;MACL,GAAG,KAAK,CAACA,UAAA,EAAY;MACrB,GAAG,IAAI,CAACC,OAAO,EAAE;MACjBC,IAAA,EAAM;MACNC,OAAA,EAAS;IACX;EACF;EAEAF,QAAA,EAA6B;IAC3B,OAAO,IAAI,CAACG,SAAS,GAAGtC,MAAM;EAChC;EAEAuC,QAAQrC,IAAuB,EAAQ;IACrC,MAAMsC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASxC,MAAM,GAAGE,IAAA;EACpB;EAESwC,UAAA,EAAmB;IAC1B,OAAO;EACT;AACF;AAEA,OAAO,SAAS5B,+BAA+B;EAC7CZ;AAAI,CAGL;EACC,OAAON,qBAAA,CAAsB,IAAIG,uBAAA,CAAwB;IAAEG;EAAK;AAClE;AAEA,OAAO,SAASyC,2BACdrC,IAAoC;EAEpC,OAAOA,IAAA,YAAgBP,uBAAA;AACzB","ignoreList":[]}
|
|
@@ -38,7 +38,6 @@ export type UploadDataImproved<TUploadExtraFieldsData extends JsonObject = JsonO
|
|
|
38
38
|
value: number | string | TypedUploadCollection[TCollectionSlug];
|
|
39
39
|
};
|
|
40
40
|
}[UploadCollectionSlug];
|
|
41
|
-
export declare function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean;
|
|
42
41
|
export type SerializedUploadNode = {
|
|
43
42
|
children?: never;
|
|
44
43
|
type: 'upload';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/server/nodes/UploadNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"UploadNode.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/server/nodes/UploadNode.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAA;AAC/F,OAAO,KAAK,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,cAAc,EACd,sBAAsB,EACtB,UAAU,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAMhF,MAAM,MAAM,UAAU,CAAC,sBAAsB,SAAS,UAAU,GAAG,UAAU,IAAI;KAC9E,eAAe,IAAI,cAAc,GAAG;QACnC,MAAM,EAAE,sBAAsB,CAAA;QAC9B;;WAEG;QACH,EAAE,EAAE,MAAM,CAAA;QACV,UAAU,EAAE,eAAe,CAAA;QAC3B;;WAEG;QACH,KAAK,EAAE,sBAAsB,CAAC,eAAe,CAAC,GAAG,MAAM,GAAG,MAAM,CAAA;KACjE;CACF,CAAC,cAAc,CAAC,CAAA;AAEjB;;;;;;GAMG;AACH,MAAM,MAAM,kBAAkB,CAAC,sBAAsB,SAAS,UAAU,GAAG,UAAU,IAAI;KACtF,eAAe,IAAI,oBAAoB,GAAG;QACzC,MAAM,EAAE,sBAAsB,CAAA;QAC9B;;WAEG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AAW,GAAG,IAAI,GAAG,SAAS,GACnC,IAAI,IAAI,gBAAgB,CAE1B"}
|
|
@@ -1,36 +1,7 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js';
|
|
3
2
|
import ObjectID from 'bson-objectid';
|
|
4
3
|
import { $applyNodeReplacement } from 'lexical';
|
|
5
|
-
import
|
|
6
|
-
export function isGoogleDocCheckboxImg(img) {
|
|
7
|
-
return img.parentElement != null && img.parentElement.tagName === 'LI' && img.previousSibling === null && img.getAttribute('aria-roledescription') === 'checkbox';
|
|
8
|
-
}
|
|
9
|
-
function $convertUploadServerElement(domNode) {
|
|
10
|
-
if (domNode.hasAttribute('data-lexical-upload-relation-to') && domNode.hasAttribute('data-lexical-upload-id')) {
|
|
11
|
-
const id = domNode.getAttribute('data-lexical-upload-id');
|
|
12
|
-
const relationTo = domNode.getAttribute('data-lexical-upload-relation-to');
|
|
13
|
-
if (id != null && relationTo != null) {
|
|
14
|
-
const node = $createUploadServerNode({
|
|
15
|
-
data: {
|
|
16
|
-
fields: {},
|
|
17
|
-
relationTo,
|
|
18
|
-
value: id
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return {
|
|
22
|
-
node
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
const img = domNode;
|
|
27
|
-
if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
// TODO: Auto-upload functionality here!
|
|
31
|
-
//}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
4
|
+
import { $convertUploadElement } from './conversions.js';
|
|
34
5
|
export class UploadServerNode extends DecoratorBlockNode {
|
|
35
6
|
__data;
|
|
36
7
|
constructor({
|
|
@@ -54,7 +25,7 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|
|
54
25
|
static importDOM() {
|
|
55
26
|
return {
|
|
56
27
|
img: node => ({
|
|
57
|
-
conversion: $
|
|
28
|
+
conversion: domNode => $convertUploadElement(domNode, $createUploadServerNode),
|
|
58
29
|
priority: 0
|
|
59
30
|
})
|
|
60
31
|
};
|
|
@@ -83,12 +54,7 @@ export class UploadServerNode extends DecoratorBlockNode {
|
|
|
83
54
|
return false;
|
|
84
55
|
}
|
|
85
56
|
decorate() {
|
|
86
|
-
|
|
87
|
-
return /*#__PURE__*/_jsx(RawUploadComponent, {
|
|
88
|
-
data: this.__data,
|
|
89
|
-
format: this.__format,
|
|
90
|
-
nodeKey: this.getKey()
|
|
91
|
-
});
|
|
57
|
+
return null;
|
|
92
58
|
}
|
|
93
59
|
exportDOM() {
|
|
94
60
|
const element = document.createElement('img');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadNode.js","names":["DecoratorBlockNode","ObjectID","$applyNodeReplacement","React","isGoogleDocCheckboxImg","img","parentElement","tagName","previousSibling","getAttribute","$convertUploadServerElement","domNode","hasAttribute","id","relationTo","node","$createUploadServerNode","data","fields","value","src","startsWith","UploadServerNode","__data","constructor","format","key","clone","__format","__key","getType","importDOM","conversion","priority","importJSON","serializedNode","version","default","toHexString","importedData","setFormat","isInline","decorate","_jsx","RawUploadComponent","nodeKey","getKey","exportDOM","element","document","createElement","setAttribute","String","exportJSON","getData","type","getLatest","setData","writable","getWritable","updateDOM","$isUploadServerNode"],"sources":["../../../../../src/features/upload/server/nodes/UploadNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n JsonObject,\n TypedUploadCollection,\n UploadCollectionSlug,\n} from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nexport type UploadData<TUploadExtraFieldsData extends JsonObject = JsonObject> = {\n [TCollectionSlug in CollectionSlug]: {\n fields: TUploadExtraFieldsData\n /**\n * Every lexical node that has sub-fields needs to have a unique ID. This is the ID of this upload node, not the ID of the linked upload document\n */\n id: string\n relationTo: TCollectionSlug\n /**\n * Value can be just the document ID, or the full, populated document\n */\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * UploadDataImproved is a more precise type, and will replace UploadData in Payload v4.\n * This type is for internal use only as it will be deprecated in the future.\n * @internal\n *\n * @todo Replace UploadData with UploadDataImproved in 4.0\n */\nexport type UploadDataImproved<TUploadExtraFieldsData extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TUploadExtraFieldsData\n /**\n * Every lexical node that has sub-fields needs to have a unique ID. This is the ID of this upload node, not the ID of the linked upload document\n */\n id: string\n relationTo: TCollectionSlug\n /**\n * Value can be just the document ID, or the full, populated document\n */\n value: number | string | TypedUploadCollection[TCollectionSlug]\n }\n}[UploadCollectionSlug]\n\nexport function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nfunction $convertUploadServerElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadServerNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadServerNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: UploadServerNode): UploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'upload'\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: $convertUploadServerElement,\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedUploadNode): UploadServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n override exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'upload',\n version: 3,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n override updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadServerNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadServerNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadServerNode({ data: data as UploadData }))\n}\n\nexport function $isUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is UploadServerNode {\n return node instanceof UploadServerNode\n}\n"],"mappings":";AAmBA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AACrB,SAASC,qBAAqB,QAAQ;AACtC,YAAYC,KAAA,MAAW;AAuCvB,OAAO,SAASC,uBAAuBC,GAAqB;EAC1D,OACEA,GAAA,CAAIC,aAAa,IAAI,QACrBD,GAAA,CAAIC,aAAa,CAACC,OAAO,KAAK,QAC9BF,GAAA,CAAIG,eAAe,KAAK,QACxBH,GAAA,CAAII,YAAY,CAAC,4BAA4B;AAEjD;AAEA,SAASC,4BAA4BC,OAAyB;EAC5D,IACEA,OAAA,CAAQC,YAAY,CAAC,sCACrBD,OAAA,CAAQC,YAAY,CAAC,2BACrB;IACA,MAAMC,EAAA,GAAKF,OAAA,CAAQF,YAAY,CAAC;IAChC,MAAMK,UAAA,GAAaH,OAAA,CAAQF,YAAY,CAAC;IAExC,IAAII,EAAA,IAAM,QAAQC,UAAA,IAAc,MAAM;MACpC,MAAMC,IAAA,GAAOC,uBAAA,CAAwB;QACnCC,IAAA,EAAM;UACJC,MAAA,EAAQ,CAAC;UACTJ,UAAA;UACAK,KAAA,EAAON;QACT;MACF;MACA,OAAO;QAAEE;MAAK;IAChB;EACF;EACA,MAAMV,GAAA,GAAMM,OAAA;EACZ,IAAIN,GAAA,CAAIe,GAAG,CAACC,UAAU,CAAC,eAAejB,sBAAA,CAAuBC,GAAA,GAAM;IACjE,OAAO;EACT;EACA;EACA;EACA,OAAO;AACT;AAOA,OAAO,MAAMiB,gBAAA,SA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C;EAEpC,OAAOA,IAAA,YAAgBO,gBAAA;AACzB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"UploadNode.js","names":["DecoratorBlockNode","ObjectID","$applyNodeReplacement","$convertUploadElement","UploadServerNode","__data","constructor","data","format","key","clone","node","__format","__key","getType","importDOM","img","conversion","domNode","$createUploadServerNode","priority","importJSON","serializedNode","version","value","id","default","toHexString","importedData","fields","relationTo","setFormat","isInline","decorate","exportDOM","element","document","createElement","setAttribute","String","exportJSON","getData","type","getLatest","setData","writable","getWritable","updateDOM","$isUploadServerNode"],"sources":["../../../../../src/features/upload/server/nodes/UploadNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMExportOutput,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type {\n CollectionSlug,\n DataFromCollectionSlug,\n JsonObject,\n TypedUploadCollection,\n UploadCollectionSlug,\n} from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\n\nimport { $convertUploadElement } from './conversions.js'\n\nexport type UploadData<TUploadExtraFieldsData extends JsonObject = JsonObject> = {\n [TCollectionSlug in CollectionSlug]: {\n fields: TUploadExtraFieldsData\n /**\n * Every lexical node that has sub-fields needs to have a unique ID. This is the ID of this upload node, not the ID of the linked upload document\n */\n id: string\n relationTo: TCollectionSlug\n /**\n * Value can be just the document ID, or the full, populated document\n */\n value: DataFromCollectionSlug<TCollectionSlug> | number | string\n }\n}[CollectionSlug]\n\n/**\n * UploadDataImproved is a more precise type, and will replace UploadData in Payload v4.\n * This type is for internal use only as it will be deprecated in the future.\n * @internal\n *\n * @todo Replace UploadData with UploadDataImproved in 4.0\n */\nexport type UploadDataImproved<TUploadExtraFieldsData extends JsonObject = JsonObject> = {\n [TCollectionSlug in UploadCollectionSlug]: {\n fields: TUploadExtraFieldsData\n /**\n * Every lexical node that has sub-fields needs to have a unique ID. This is the ID of this upload node, not the ID of the linked upload document\n */\n id: string\n relationTo: TCollectionSlug\n /**\n * Value can be just the document ID, or the full, populated document\n */\n value: number | string | TypedUploadCollection[TCollectionSlug]\n }\n}[UploadCollectionSlug]\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadServerNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: UploadServerNode): UploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'upload'\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: (domNode) => $convertUploadElement(domNode, $createUploadServerNode),\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedUploadNode): UploadServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override decorate(): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n override exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'upload',\n version: 3,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n override updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadServerNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadServerNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadServerNode({ data: data as UploadData }))\n}\n\nexport function $isUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is UploadServerNode {\n return node instanceof UploadServerNode\n}\n"],"mappings":"AAkBA,SAASA,kBAAkB,QAAQ;AACnC,OAAOC,QAAA,MAAc;AACrB,SAASC,qBAAqB,QAAQ;AAEtC,SAASC,qBAAqB,QAAQ;AA4CtC,OAAO,MAAMC,gBAAA,SAAyBJ,kBAAA;EACpCK,MAAA;EAEAC,YAAY;IACVC,IAAI;IACJC,MAAM;IACNC;EAAG,CAKJ,EAAE;IACD,KAAK,CAACD,MAAA,EAAQC,GAAA;IACd,IAAI,CAACJ,MAAM,GAAGE,IAAA;EAChB;EAEA,OAAgBG,MAAMC,IAAsB,EAAoB;IAC9D,OAAO,IAAI,IAAI,CAAC;MACdJ,IAAA,EAAMI,IAAA,CAAKN,MAAM;MACjBG,MAAA,EAAQG,IAAA,CAAKC,QAAQ;MACrBH,GAAA,EAAKE,IAAA,CAAKE;IACZ;EACF;EAEA,OAAgBC,QAAA,EAAkB;IAChC,OAAO;EACT;EAEA,OAAgBC,UAAA,EAAgD;IAC9D,OAAO;MACLC,GAAA,EAAML,IAAA,KAAU;QACdM,UAAA,EAAaC,OAAA,IAAYf,qBAAA,CAAsBe,OAAA,EAASC,uBAAA;QACxDC,QAAA,EAAU;MACZ;IACF;EACF;EAEA,OAAgBC,WAAWC,cAAoC,EAAoB;IACjF,I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,GAAGtC,MAAM;EAChC;EAEAuC,QAAQrC,IAAgB,EAAQ;IAC9B,MAAMsC,QAAA,GAAW,IAAI,CAACC,WAAW;IACjCD,QAAA,CAASxC,MAAM,GAAGE,IAAA;EACpB;EAESwC,UAAA,EAAmB;IAC1B,OAAO;EACT;AACF;AAEA,OAAO,SAAS5B,wBAAwB;EACtCZ;AAAI,CAGL;EACC,IAAI,CAACA,IAAA,EAAMkB,EAAA,EAAI;IACblB,IAAA,CAAKkB,EAAE,GAAG,IAAIxB,QAAA,CAASyB,OAAO,GAAGC,WAAW;EAC9C;EACA,OAAOzB,qBAAA,CAAsB,IAAIE,gBAAA,CAAiB;IAAEG,IAAA,EAAMA;EAAmB;AAC/E;AAEA,OAAO,SAASyC,oBACdrC,IAAoC;EAEpC,OAAOA,IAAA,YAAgBP,gBAAA;AACzB","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DOMConversionOutput } from 'lexical';
|
|
2
|
+
import type { $createPendingUploadNode } from '../../client/nodes/PendingUploadNode.js';
|
|
3
|
+
import type { $createUploadNode } from '../../client/nodes/UploadNode.js';
|
|
4
|
+
import type { $createPendingUploadServerNode } from './PendingUploadNode.js';
|
|
5
|
+
import type { $createUploadServerNode } from './UploadNode.js';
|
|
6
|
+
export declare function $convertPendingUploadElement(domNode: HTMLImageElement, $createNode: typeof $createPendingUploadNode | typeof $createPendingUploadServerNode): DOMConversionOutput | null;
|
|
7
|
+
export declare function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean;
|
|
8
|
+
export declare function $convertUploadElement(domNode: HTMLImageElement, $createNode: typeof $createUploadNode | typeof $createUploadServerNode): DOMConversionOutput | null;
|
|
9
|
+
//# sourceMappingURL=conversions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversions.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/server/nodes/conversions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAIlD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAE9D,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,OAAO,wBAAwB,GAAG,OAAO,8BAA8B,GACnF,mBAAmB,GAAG,IAAI,CAsB5B;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAOrE;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,gBAAgB,EACzB,WAAW,EAAE,OAAO,iBAAiB,GAAG,OAAO,uBAAuB,GACrE,mBAAmB,GAAG,IAAI,CAqB5B"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// This file contains functions used to convert dom elements to upload or pending upload lexical nodes. It requires the actual node
|
|
2
|
+
// creation functions to be passed in to stay compatible with both client and server code.
|
|
3
|
+
import ObjectID from 'bson-objectid';
|
|
4
|
+
export function $convertPendingUploadElement(domNode, $createNode) {
|
|
5
|
+
if (domNode.hasAttribute('data-lexical-pending-upload-form-id')) {
|
|
6
|
+
const formID = domNode.getAttribute('data-lexical-pending-upload-form-id');
|
|
7
|
+
if (formID != null) {
|
|
8
|
+
const node = $createNode({
|
|
9
|
+
data: {
|
|
10
|
+
formID,
|
|
11
|
+
src: domNode.getAttribute('src') || ''
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
node
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Create a new pending upload node with a new form ID
|
|
20
|
+
const node = $createNode({
|
|
21
|
+
data: {
|
|
22
|
+
formID: new ObjectID.default().toHexString(),
|
|
23
|
+
src: domNode.getAttribute('src') || ''
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
node
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function isGoogleDocCheckboxImg(img) {
|
|
31
|
+
return img.parentElement != null && img.parentElement.tagName === 'LI' && img.previousSibling === null && img.getAttribute('aria-roledescription') === 'checkbox';
|
|
32
|
+
}
|
|
33
|
+
export function $convertUploadElement(domNode, $createNode) {
|
|
34
|
+
if (domNode.hasAttribute('data-lexical-upload-relation-to') && domNode.hasAttribute('data-lexical-upload-id')) {
|
|
35
|
+
const id = domNode.getAttribute('data-lexical-upload-id');
|
|
36
|
+
const relationTo = domNode.getAttribute('data-lexical-upload-relation-to');
|
|
37
|
+
if (id != null && relationTo != null) {
|
|
38
|
+
const node = $createNode({
|
|
39
|
+
data: {
|
|
40
|
+
fields: {},
|
|
41
|
+
relationTo,
|
|
42
|
+
value: id
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
node
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Auto-upload functionality is handled here by the PendingUploadNode
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=conversions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversions.js","names":["ObjectID","$convertPendingUploadElement","domNode","$createNode","hasAttribute","formID","getAttribute","node","data","src","default","toHexString","isGoogleDocCheckboxImg","img","parentElement","tagName","previousSibling","$convertUploadElement","id","relationTo","fields","value"],"sources":["../../../../../src/features/upload/server/nodes/conversions.ts"],"sourcesContent":["// This file contains functions used to convert dom elements to upload or pending upload lexical nodes. It requires the actual node\n// creation functions to be passed in to stay compatible with both client and server code.\nimport type { DOMConversionOutput } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\n\nimport type { $createPendingUploadNode } from '../../client/nodes/PendingUploadNode.js'\nimport type { $createUploadNode } from '../../client/nodes/UploadNode.js'\nimport type { $createPendingUploadServerNode } from './PendingUploadNode.js'\nimport type { $createUploadServerNode } from './UploadNode.js'\n\nexport function $convertPendingUploadElement(\n domNode: HTMLImageElement,\n $createNode: typeof $createPendingUploadNode | typeof $createPendingUploadServerNode,\n): DOMConversionOutput | null {\n if (domNode.hasAttribute('data-lexical-pending-upload-form-id')) {\n const formID = domNode.getAttribute('data-lexical-pending-upload-form-id')\n\n if (formID != null) {\n const node = $createNode({\n data: {\n formID,\n src: domNode.getAttribute('src') || '',\n },\n })\n return { node }\n }\n }\n // Create a new pending upload node with a new form ID\n const node = $createNode({\n data: {\n formID: new ObjectID.default().toHexString(),\n src: domNode.getAttribute('src') || '',\n },\n })\n return { node }\n}\n\nexport function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nexport function $convertUploadElement(\n domNode: HTMLImageElement,\n $createNode: typeof $createUploadNode | typeof $createUploadServerNode,\n): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n // Auto-upload functionality is handled here by the PendingUploadNode\n return null\n}\n"],"mappings":"AAAA;AACA;AAGA,OAAOA,QAAA,MAAc;AAOrB,OAAO,SAASC,6BACdC,OAAyB,EACzBC,WAAoF;EAEpF,IAAID,OAAA,CAAQE,YAAY,CAAC,wCAAwC;IAC/D,MAAMC,MAAA,GAASH,OAAA,CAAQI,YAAY,CAAC;IAEpC,IAAID,MAAA,IAAU,MAAM;MAClB,MAAME,IAAA,GAAOJ,WAAA,CAAY;QACvBK,IAAA,EAAM;UACJH,MAAA;UACAI,GAAA,EAAKP,OAAA,CAAQI,YAAY,CAAC,UAAU;QACtC;MACF;MACA,OAAO;QAAEC;MAAK;IAChB;EACF;EACA;EACA,MAAMA,IAAA,GAAOJ,WAAA,CAAY;IACvBK,IAAA,EAAM;MACJH,MAAA,EAAQ,IAAIL,QAAA,CAASU,OAAO,GAAGC,WAAW;MAC1CF,GAAA,EAAKP,OAAA,CAAQI,YAAY,CAAC,UAAU;IACtC;EACF;EACA,OAAO;IAAEC;EAAK;AAChB;AAEA,OAAO,SAASK,uBAAuBC,GAAqB;EAC1D,OACEA,GAAA,CAAIC,aAAa,IAAI,QACrBD,GAAA,CAAIC,aAAa,CAACC,OAAO,KAAK,QAC9BF,GAAA,CAAIG,eAAe,KAAK,QACxBH,GAAA,CAAIP,YAAY,CAAC,4BAA4B;AAEjD;AAEA,OAAO,SAASW,sBACdf,OAAyB,EACzBC,WAAsE;EAEtE,IACED,OAAA,CAAQE,YAAY,CAAC,sCACrBF,OAAA,CAAQE,YAAY,CAAC,2BACrB;IACA,MAAMc,EAAA,GAAKhB,OAAA,CAAQI,YAAY,CAAC;IAChC,MAAMa,UAAA,GAAajB,OAAA,CAAQI,YAAY,CAAC;IAExC,IAAIY,EAAA,IAAM,QAAQC,UAAA,IAAc,MAAM;MACpC,MAAMZ,IAAA,GAAOJ,WAAA,CAAY;QACvBK,IAAA,EAAM;UACJY,MAAA,EAAQ,CAAC;UACTD,UAAA;UACAE,KAAA,EAAOH;QACT;MACF;MACA,OAAO;QAAEX;MAAK;IAChB;EACF;EACA;EACA,OAAO;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAO5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,
|
|
1
|
+
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAO5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAiK9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
|
package/dist/field/Field.js
CHANGED
|
@@ -144,7 +144,7 @@ const RichTextComponent = props => {
|
|
|
144
144
|
path,
|
|
145
145
|
rerenderProviderKey
|
|
146
146
|
})), AfterInput]
|
|
147
|
-
}), /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
147
|
+
}), Description, /*#__PURE__*/_jsx(RenderCustomComponent, {
|
|
148
148
|
CustomComponent: Description,
|
|
149
149
|
Fallback: /*#__PURE__*/_jsx(FieldDescription, {
|
|
150
150
|
description: description,
|
package/dist/field/Field.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useEffectEvent","useField","mergeFieldStyles","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","stringify","Date","Object","is","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary\n if (\n prevValueRef.current !== value &&\n JSON.stringify(prevValueRef.current) !== JSON.stringify(value)\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} path={path} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,YAAY,EACZC,cAAc,EACdC,QAAQ,QACH;AACP,SAASC,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AACjE,SAASC,aAAa,QAAQ;AAK9B,OAAO;AAKP,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AAEpC,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnEC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC;EAAQ,CACT,GAAGd,KAAA;EAEJ,MAAMe,iBAAA,GAAoBF,yBAAA,IAA6BN,iBAAA;EAEvD,MAAMS,SAAA,GAAY9B,YAAA;EAElB,MAAM+B,gBAAA,GAAmB1B,WAAA,CACvB,CAAC2B,KAAA,EAAOC,iBAAA;IACN,IAAI,OAAOL,QAAA,KAAa,YAAY;MAClC;MACA,OAAOA,QAAA,CAASI,KAAA,EAAO;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AAEA,OAAO,MAAMC,QAAA,GAAqCjF,iBAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useEffectEvent","useField","mergeFieldStyles","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","stringify","Date","Object","is","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\nimport type { Validate } from 'payload'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary\n if (\n prevValueRef.current !== value &&\n JSON.stringify(prevValueRef.current) !== JSON.stringify(value)\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} path={path} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n {Description}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"AAAA;;;AAIA,SACEA,gBAAgB,EAChBC,UAAU,EACVC,UAAU,EACVC,qBAAqB,EACrBC,YAAY,EACZC,cAAc,EACdC,QAAQ,QACH;AACP,SAASC,gBAAgB,QAAQ;AACjC,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AACjE,SAASC,aAAa,QAAQ;AAK9B,OAAO;AAKP,SAASC,eAAe,QAAQ;AAChC,SAASC,mBAAmB,QAAQ;AAEpC,MAAMC,SAAA,GAAY;AAElB,MAAMC,iBAAA,GAIDC,KAAA;EACH,MAAM;IACJC,YAAY;IACZC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,QAAA,EAAUC;MAAiB,CAAE,GAAG,CAAC,CAAC;MACnEC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,IAAA,EAAMC,aAAa;IACnBN,QAAA,EAAUO,yBAAyB;IACnCC;EAAQ,CACT,GAAGd,KAAA;EAEJ,MAAMe,iBAAA,GAAoBF,yBAAA,IAA6BN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