@payloadcms/richtext-lexical 3.55.0-internal.b47bfce → 3.55.0-internal.f8c92b5
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/bundled.css +1 -1
- package/dist/exports/client/index.d.ts +1 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +9 -9
- package/dist/exports/client/index.js.map +4 -4
- package/dist/exports/server/rsc.d.ts +1 -0
- package/dist/exports/server/rsc.d.ts.map +1 -1
- package/dist/exports/server/rsc.js +1 -0
- package/dist/exports/server/rsc.js.map +1 -1
- package/dist/field/RenderLexical/renderLexical.d.ts +38 -0
- package/dist/field/RenderLexical/renderLexical.d.ts.map +1 -0
- package/dist/field/RenderLexical/renderLexical.js +96 -0
- package/dist/field/RenderLexical/renderLexical.js.map +1 -0
- package/dist/field/RenderLexical/useRenderEditor.d.ts +15 -0
- package/dist/field/RenderLexical/useRenderEditor.d.ts.map +1 -0
- package/dist/field/RenderLexical/useRenderEditor.js +159 -0
- package/dist/field/RenderLexical/useRenderEditor.js.map +1 -0
- package/dist/field/bundled.css +1 -1
- package/package.json +6 -6
- package/dist/field/RenderLexical/index.d.ts +0 -19
- package/dist/field/RenderLexical/index.d.ts.map +0 -1
- package/dist/field/RenderLexical/index.js +0 -123
- package/dist/field/RenderLexical/index.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/richtext-lexical",
|
|
3
|
-
"version": "3.55.0-internal.
|
|
3
|
+
"version": "3.55.0-internal.f8c92b5",
|
|
4
4
|
"description": "The officially supported Lexical richtext adapter for Payload",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -368,8 +368,8 @@
|
|
|
368
368
|
"react-error-boundary": "4.1.2",
|
|
369
369
|
"ts-essentials": "10.0.3",
|
|
370
370
|
"uuid": "10.0.0",
|
|
371
|
-
"@payloadcms/translations": "3.55.0-internal.
|
|
372
|
-
"@payloadcms/ui": "3.55.0-internal.
|
|
371
|
+
"@payloadcms/translations": "3.55.0-internal.f8c92b5",
|
|
372
|
+
"@payloadcms/ui": "3.55.0-internal.f8c92b5"
|
|
373
373
|
},
|
|
374
374
|
"devDependencies": {
|
|
375
375
|
"@babel/cli": "7.27.2",
|
|
@@ -389,15 +389,15 @@
|
|
|
389
389
|
"esbuild-sass-plugin": "3.3.1",
|
|
390
390
|
"swc-plugin-transform-remove-imports": "4.0.4",
|
|
391
391
|
"@payloadcms/eslint-config": "3.28.0",
|
|
392
|
-
"payload": "3.55.0-internal.
|
|
392
|
+
"payload": "3.55.0-internal.f8c92b5"
|
|
393
393
|
},
|
|
394
394
|
"peerDependencies": {
|
|
395
395
|
"@faceless-ui/modal": "3.0.0-beta.2",
|
|
396
396
|
"@faceless-ui/scroll-info": "2.0.0",
|
|
397
397
|
"react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
398
398
|
"react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
|
|
399
|
-
"@payloadcms/next": "3.55.0-internal.
|
|
400
|
-
"payload": "3.55.0-internal.
|
|
399
|
+
"@payloadcms/next": "3.55.0-internal.f8c92b5",
|
|
400
|
+
"payload": "3.55.0-internal.f8c92b5"
|
|
401
401
|
},
|
|
402
402
|
"engines": {
|
|
403
403
|
"node": "^18.20.2 || >=20.9.0"
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { type FieldType, type RenderFieldServerFnArgs } from '@payloadcms/ui';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { DefaultTypedEditorState } from '../../nodeTypes.js';
|
|
4
|
-
/**
|
|
5
|
-
* Utility to render a lexical editor on the client.
|
|
6
|
-
*
|
|
7
|
-
* @experimental - may break in minor releases
|
|
8
|
-
* @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx
|
|
9
|
-
*/
|
|
10
|
-
export declare const RenderLexical: React.FC<
|
|
11
|
-
/**
|
|
12
|
-
* If value or setValue, or both, is provided, this component will manage its own value.
|
|
13
|
-
* If neither is passed, it will rely on the parent form to manage the value.
|
|
14
|
-
*/
|
|
15
|
-
{
|
|
16
|
-
setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue'];
|
|
17
|
-
value?: FieldType<DefaultTypedEditorState | undefined>['value'];
|
|
18
|
-
} & RenderFieldServerFnArgs>;
|
|
19
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/field/RenderLexical/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,uBAAuB,EAK7B,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAyC,MAAM,OAAO,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE;AAClC;;;GAGG;AACH;IACE,QAAQ,CAAC,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,UAAU,CAAC,CAAA;IAErE,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAA;CAChE,GAAG,uBAAuB,CAoF5B,CAAA"}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import { c as _c } from "react/compiler-runtime";
|
|
4
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
import { FieldContext, FieldPathContext, ServerFunctionsContext, ShimmerEffect, useServerFunctions } from '@payloadcms/ui';
|
|
6
|
-
import React, { useCallback, useEffect, useRef } from 'react';
|
|
7
|
-
/**
|
|
8
|
-
* Utility to render a lexical editor on the client.
|
|
9
|
-
*
|
|
10
|
-
* @experimental - may break in minor releases
|
|
11
|
-
* @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx
|
|
12
|
-
*/
|
|
13
|
-
export const RenderLexical = args => {
|
|
14
|
-
const $ = _c(9);
|
|
15
|
-
const {
|
|
16
|
-
field,
|
|
17
|
-
initialValue,
|
|
18
|
-
path,
|
|
19
|
-
schemaPath,
|
|
20
|
-
setValue,
|
|
21
|
-
value
|
|
22
|
-
} = args;
|
|
23
|
-
const [Component, setComponent] = React.useState(null);
|
|
24
|
-
const serverFunctionContext = useServerFunctions();
|
|
25
|
-
const {
|
|
26
|
-
_internal_renderField
|
|
27
|
-
} = serverFunctionContext;
|
|
28
|
-
const [entityType, entitySlug] = schemaPath.split(".");
|
|
29
|
-
const fieldPath = path ?? (field && "name" in field ? field?.name : "") ?? "";
|
|
30
|
-
let t0;
|
|
31
|
-
if ($[0] !== _internal_renderField || $[1] !== field || $[2] !== initialValue || $[3] !== path || $[4] !== schemaPath) {
|
|
32
|
-
t0 = () => {
|
|
33
|
-
const render = async function render() {
|
|
34
|
-
const {
|
|
35
|
-
Field
|
|
36
|
-
} = await _internal_renderField({
|
|
37
|
-
field,
|
|
38
|
-
initialValue: initialValue ?? undefined,
|
|
39
|
-
path,
|
|
40
|
-
schemaPath
|
|
41
|
-
});
|
|
42
|
-
setComponent(Field);
|
|
43
|
-
};
|
|
44
|
-
render();
|
|
45
|
-
};
|
|
46
|
-
$[0] = _internal_renderField;
|
|
47
|
-
$[1] = field;
|
|
48
|
-
$[2] = initialValue;
|
|
49
|
-
$[3] = path;
|
|
50
|
-
$[4] = schemaPath;
|
|
51
|
-
$[5] = t0;
|
|
52
|
-
} else {
|
|
53
|
-
t0 = $[5];
|
|
54
|
-
}
|
|
55
|
-
const renderLexical = t0;
|
|
56
|
-
const mounted = useRef(false);
|
|
57
|
-
let t1;
|
|
58
|
-
let t2;
|
|
59
|
-
if ($[6] !== renderLexical) {
|
|
60
|
-
t1 = () => {
|
|
61
|
-
if (mounted.current) {
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
mounted.current = true;
|
|
65
|
-
renderLexical();
|
|
66
|
-
};
|
|
67
|
-
t2 = [renderLexical];
|
|
68
|
-
$[6] = renderLexical;
|
|
69
|
-
$[7] = t1;
|
|
70
|
-
$[8] = t2;
|
|
71
|
-
} else {
|
|
72
|
-
t1 = $[7];
|
|
73
|
-
t2 = $[8];
|
|
74
|
-
}
|
|
75
|
-
useEffect(t1, t2);
|
|
76
|
-
if (!Component) {
|
|
77
|
-
return _jsx(ShimmerEffect, {});
|
|
78
|
-
}
|
|
79
|
-
const adjustedServerFunctionContext = {
|
|
80
|
-
...serverFunctionContext,
|
|
81
|
-
getFormState: async getFormStateArgs => serverFunctionContext.getFormState({
|
|
82
|
-
...getFormStateArgs,
|
|
83
|
-
collectionSlug: entityType === "collection" ? entitySlug : undefined,
|
|
84
|
-
globalSlug: entityType === "global" ? entitySlug : undefined
|
|
85
|
-
})
|
|
86
|
-
};
|
|
87
|
-
if (typeof value === "undefined" && !setValue) {
|
|
88
|
-
return _jsx(ServerFunctionsContext, {
|
|
89
|
-
value: {
|
|
90
|
-
...adjustedServerFunctionContext
|
|
91
|
-
},
|
|
92
|
-
children: _jsx(FieldPathContext, {
|
|
93
|
-
value: fieldPath,
|
|
94
|
-
children: Component
|
|
95
|
-
}, fieldPath)
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
const fieldValue = {
|
|
99
|
-
disabled: false,
|
|
100
|
-
formInitializing: false,
|
|
101
|
-
formProcessing: false,
|
|
102
|
-
formSubmitted: false,
|
|
103
|
-
initialValue: value,
|
|
104
|
-
path: fieldPath,
|
|
105
|
-
setValue: setValue ?? _temp,
|
|
106
|
-
showError: false,
|
|
107
|
-
value
|
|
108
|
-
};
|
|
109
|
-
return _jsx(ServerFunctionsContext, {
|
|
110
|
-
value: {
|
|
111
|
-
...adjustedServerFunctionContext
|
|
112
|
-
},
|
|
113
|
-
children: _jsx(FieldPathContext, {
|
|
114
|
-
value: fieldPath,
|
|
115
|
-
children: _jsx(FieldContext, {
|
|
116
|
-
value: fieldValue,
|
|
117
|
-
children: Component
|
|
118
|
-
})
|
|
119
|
-
}, fieldPath)
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
function _temp() {}
|
|
123
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","FieldContext","FieldPathContext","ServerFunctionsContext","ShimmerEffect","useServerFunctions","React","useCallback","useEffect","useRef","RenderLexical","args","$","field","initialValue","path","schemaPath","setValue","value","Component","setComponent","useState","serverFunctionContext","_internal_renderField","entityType","entitySlug","split","fieldPath","name","t0","render","Field","undefined","renderLexical","mounted","t1","t2","current","_jsx","adjustedServerFunctionContext","getFormState","getFormStateArgs","collectionSlug","globalSlug","children","fieldValue","disabled","formInitializing","formProcessing","formSubmitted","_temp","showError"],"sources":["../../../src/field/RenderLexical/index.tsx"],"sourcesContent":["'use client'\nimport {\n FieldContext,\n FieldPathContext,\n type FieldType,\n type RenderFieldServerFnArgs,\n ServerFunctionsContext,\n type ServerFunctionsContextType,\n ShimmerEffect,\n useServerFunctions,\n} from '@payloadcms/ui'\nimport React, { useCallback, useEffect, useRef } from 'react'\n\nimport type { DefaultTypedEditorState } from '../../nodeTypes.js'\n\n/**\n * Utility to render a lexical editor on the client.\n *\n * @experimental - may break in minor releases\n * @todo - replace this with a general utility that works for all fields. Maybe merge with packages/ui/src/forms/RenderFields/RenderField.tsx\n */\nexport const RenderLexical: React.FC<\n /**\n * If value or setValue, or both, is provided, this component will manage its own value.\n * If neither is passed, it will rely on the parent form to manage the value.\n */\n {\n setValue?: FieldType<DefaultTypedEditorState | undefined>['setValue']\n\n value?: FieldType<DefaultTypedEditorState | undefined>['value']\n } & RenderFieldServerFnArgs\n> = (args) => {\n const { field, initialValue, path, schemaPath, setValue, value } = args\n const [Component, setComponent] = React.useState<null | React.ReactNode>(null)\n const serverFunctionContext = useServerFunctions()\n const { _internal_renderField } = serverFunctionContext\n\n const [entityType, entitySlug] = schemaPath.split('.')\n\n const fieldPath = path ?? (field && 'name' in field ? field?.name : '') ?? ''\n\n const renderLexical = useCallback(() => {\n async function render() {\n const { Field } = await _internal_renderField({\n field,\n initialValue: initialValue ?? undefined,\n path,\n schemaPath,\n })\n\n setComponent(Field)\n }\n void render()\n }, [_internal_renderField, schemaPath, path, field, initialValue])\n\n const mounted = useRef(false)\n\n useEffect(() => {\n if (mounted.current) {\n return\n }\n mounted.current = true\n void renderLexical()\n }, [renderLexical])\n\n if (!Component) {\n return <ShimmerEffect />\n }\n\n /**\n * By default, the lexical will make form state requests (e.g. to get drawer fields), passing in the arguments\n * of the current field. However, we need to override those arguments to get it to make requests based on the\n * *target* field. The server only knows the schema map of the target field.\n */\n const adjustedServerFunctionContext: ServerFunctionsContextType = {\n ...serverFunctionContext,\n getFormState: async (getFormStateArgs) => {\n return serverFunctionContext.getFormState({\n ...getFormStateArgs,\n collectionSlug: entityType === 'collection' ? entitySlug : undefined,\n globalSlug: entityType === 'global' ? entitySlug : undefined,\n })\n },\n }\n\n if (typeof value === 'undefined' && !setValue) {\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n {Component}\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n }\n\n const fieldValue: FieldType<DefaultTypedEditorState | undefined> = {\n disabled: false,\n formInitializing: false,\n formProcessing: false,\n formSubmitted: false,\n initialValue: value,\n path: fieldPath,\n setValue: setValue ?? (() => undefined),\n showError: false,\n value,\n }\n\n return (\n <ServerFunctionsContext value={{ ...adjustedServerFunctionContext }}>\n <FieldPathContext key={fieldPath} value={fieldPath}>\n <FieldContext value={fieldValue}>{Component}</FieldContext>\n </FieldPathContext>\n </ServerFunctionsContext>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;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