@payloadcms/richtext-lexical 3.30.0 → 3.31.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/field/rscEntry.js
CHANGED
|
@@ -27,7 +27,7 @@ export const RscEntryLexicalField = async args => {
|
|
|
27
27
|
schemaPath
|
|
28
28
|
});
|
|
29
29
|
let initialLexicalFormState = {};
|
|
30
|
-
if (args.
|
|
30
|
+
if (args.siblingData?.[field.name]?.root?.children?.length) {
|
|
31
31
|
initialLexicalFormState = await buildInitialState({
|
|
32
32
|
context: {
|
|
33
33
|
id: args.id,
|
|
@@ -43,7 +43,7 @@ export const RscEntryLexicalField = async args => {
|
|
|
43
43
|
renderFieldFn: renderField,
|
|
44
44
|
req: args.req
|
|
45
45
|
},
|
|
46
|
-
nodeData: args.
|
|
46
|
+
nodeData: args.siblingData?.[field.name]?.root?.children
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
const placeholderFromArgs = args.admin?.placeholder;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rscEntry.js","names":["getTranslation","renderField","React","RichTextField","buildInitialState","initLexicalFeatures","RscEntryLexicalField","args","field","path","clientField","name","schemaPath","Error","clientFeatures","featureClientImportMap","featureClientSchemaMap","clientFieldSchemaMap","fieldSchemaMap","i18n","payload","sanitizedEditorConfig","initialLexicalFormState","
|
|
1
|
+
{"version":3,"file":"rscEntry.js","names":["getTranslation","renderField","React","RichTextField","buildInitialState","initLexicalFeatures","RscEntryLexicalField","args","field","path","clientField","name","schemaPath","Error","clientFeatures","featureClientImportMap","featureClientSchemaMap","clientFieldSchemaMap","fieldSchemaMap","i18n","payload","sanitizedEditorConfig","initialLexicalFormState","siblingData","root","children","length","context","id","collectionSlug","documentData","data","lexicalFieldSchemaPath","operation","permissions","preferences","renderFieldFn","req","nodeData","placeholderFromArgs","admin","placeholder","undefined","hideGutter","hideInsertParagraphAtEnd","props","forceRender","lexicalEditorConfig","lexical","readOnly","renderedBlocks","Object","keys","key","_jsx"],"sources":["../../src/field/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\nimport type {\n ClientComponentProps,\n FieldPaths,\n RichTextFieldClient,\n RichTextField as RichTextFieldType,\n ServerComponentProps,\n} from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { renderField } from '@payloadcms/ui/forms/renderField'\nimport React from 'react'\n\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type {\n LexicalFieldAdminClientProps,\n LexicalFieldAdminProps,\n LexicalRichTextFieldProps,\n} from '../types.js'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { RichTextField } from '../exports/client/index.js'\nimport { buildInitialState } from '../utilities/buildInitialState.js'\nimport { initLexicalFeatures } from '../utilities/initLexicalFeatures.js'\n\nexport const RscEntryLexicalField: React.FC<\n {\n admin: LexicalFieldAdminProps\n sanitizedEditorConfig: SanitizedServerEditorConfig\n } & ClientComponentProps &\n Pick<FieldPaths, 'path'> &\n ServerComponentProps\n> = async (args) => {\n const field: RichTextFieldType = args.field as RichTextFieldType\n const path = args.path ?? (args.clientField as RichTextFieldClient).name\n const schemaPath = args.schemaPath ?? path\n\n if (!(args?.clientField as RichTextFieldClient)?.name) {\n throw new Error('Initialized lexical RSC field without a field name')\n }\n\n const { clientFeatures, featureClientImportMap, featureClientSchemaMap } = initLexicalFeatures({\n clientFieldSchemaMap: args.clientFieldSchemaMap,\n fieldSchemaMap: args.fieldSchemaMap,\n i18n: args.i18n,\n path,\n payload: args.payload,\n sanitizedEditorConfig: args.sanitizedEditorConfig,\n schemaPath,\n })\n\n let initialLexicalFormState = {}\n if (args.siblingData?.[field.name]?.root?.children?.length) {\n initialLexicalFormState = await buildInitialState({\n context: {\n id: args.id,\n clientFieldSchemaMap: args.clientFieldSchemaMap,\n collectionSlug: args.collectionSlug,\n documentData: args.data,\n field,\n fieldSchemaMap: args.fieldSchemaMap,\n lexicalFieldSchemaPath: schemaPath,\n operation: args.operation,\n permissions: args.permissions,\n preferences: args.preferences,\n renderFieldFn: renderField,\n req: args.req,\n },\n nodeData: args.siblingData?.[field.name]?.root?.children as SerializedLexicalNode[],\n })\n }\n\n const placeholderFromArgs = args.admin?.placeholder\n const placeholder = placeholderFromArgs\n ? getTranslation(placeholderFromArgs, args.i18n)\n : undefined\n\n const admin: LexicalFieldAdminClientProps = {}\n if (placeholder) {\n admin.placeholder = placeholder\n }\n if (args.admin?.hideGutter) {\n admin.hideGutter = true\n }\n if (args.admin?.hideInsertParagraphAtEnd) {\n admin.hideInsertParagraphAtEnd = true\n }\n\n const props: LexicalRichTextFieldProps = {\n clientFeatures,\n featureClientImportMap,\n featureClientSchemaMap, // TODO: Does client need this? Why cant this just live in the server\n field: args.clientField as RichTextFieldClient,\n forceRender: args.forceRender,\n initialLexicalFormState,\n lexicalEditorConfig: args.sanitizedEditorConfig.lexical,\n path,\n permissions: args.permissions,\n readOnly: args.readOnly,\n renderedBlocks: args.renderedBlocks,\n schemaPath,\n }\n if (Object.keys(admin).length) {\n props.admin = admin\n }\n\n for (const key in props) {\n if (props[key as keyof LexicalRichTextFieldProps] === undefined) {\n delete props[key as keyof LexicalRichTextFieldProps]\n }\n }\n\n return <RichTextField {...props} />\n}\n"],"mappings":";AASA,SAASA,cAAc,QAAQ;AAC/B,SAASC,WAAW,QAAQ;AAC5B,OAAOC,KAAA,MAAW;AASlB;AACA,SAASC,aAAa,QAAQ;AAC9B,SAASC,iBAAiB,QAAQ;AAClC,SAASC,mBAAmB,QAAQ;AAEpC,OAAO,MAAMC,oBAAA,GAOT,MAAOC,IAAA;EACT,MAAMC,KAAA,GAA2BD,IAAA,CAAKC,KAAK;EAC3C,MAAMC,IAAA,GAAOF,IAAA,CAAKE,IAAI,IAAIF,IAAC,CAAKG,WAAW,CAAyBC,IAAI;EACxE,MAAMC,UAAA,GAAaL,IAAA,CAAKK,UAAU,IAAIH,IAAA;EAEtC,IAAI,CAAEF,IA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
|
3
|
+
"version": "3.31.0-canary.0",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -364,8 +364,8 @@
|
|
|
364
364
|
"react-error-boundary": "4.1.2",
|
|
365
365
|
"ts-essentials": "10.0.3",
|
|
366
366
|
"uuid": "10.0.0",
|
|
367
|
-
"@payloadcms/translations": "3.
|
|
368
|
-
"@payloadcms/ui": "3.
|
|
367
|
+
"@payloadcms/translations": "3.31.0-canary.0",
|
|
368
|
+
"@payloadcms/ui": "3.31.0-canary.0"
|
|
369
369
|
},
|
|
370
370
|
"devDependencies": {
|
|
371
371
|
"@babel/cli": "7.26.4",
|
|
@@ -385,7 +385,7 @@
|
|
|
385
385
|
"esbuild-sass-plugin": "3.3.1",
|
|
386
386
|
"eslint-plugin-react-compiler": "19.0.0-beta-714736e-20250131",
|
|
387
387
|
"swc-plugin-transform-remove-imports": "3.1.0",
|
|
388
|
-
"payload": "3.
|
|
388
|
+
"payload": "3.31.0-canary.0",
|
|
389
389
|
"@payloadcms/eslint-config": "3.28.0"
|
|
390
390
|
},
|
|
391
391
|
"peerDependencies": {
|
|
@@ -393,8 +393,8 @@
|
|
|
393
393
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
394
394
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
395
395
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
396
|
-
"@payloadcms/next": "3.
|
|
397
|
-
"payload": "3.
|
|
396
|
+
"@payloadcms/next": "3.31.0-canary.0",
|
|
397
|
+
"payload": "3.31.0-canary.0"
|
|
398
398
|
},
|
|
399
399
|
"engines": {
|
|
400
400
|
"node": "^18.20.2 || >=20.9.0"
|