@payloadcms/richtext-lexical 3.61.0-internal.1898a30 → 3.61.0-internal.5662539

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.
Files changed (75) hide show
  1. package/dist/exports/client/Field-F2KOJLMQ.js +2 -0
  2. package/dist/exports/client/Field-F2KOJLMQ.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-AFXLIYGL.js +12 -0
  5. package/dist/exports/client/chunk-AFXLIYGL.js.map +7 -0
  6. package/dist/exports/client/index.js +21 -21
  7. package/dist/exports/client/index.js.map +3 -3
  8. package/dist/exports/react/index.d.ts +1 -1
  9. package/dist/exports/react/index.d.ts.map +1 -1
  10. package/dist/exports/react/index.js.map +1 -1
  11. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +14 -2
  12. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  13. package/dist/features/converters/lexicalToJSX/Component/index.js +2 -4
  14. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  15. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +1 -16
  16. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  17. package/dist/features/converters/lexicalToJSX/converter/index.js +4 -76
  18. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  19. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +10 -14
  20. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  21. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  22. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -1
  23. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  24. package/dist/field/Field.d.ts.map +1 -1
  25. package/dist/field/Field.js +38 -50
  26. package/dist/field/Field.js.map +1 -1
  27. package/dist/field/bundled.css +1 -1
  28. package/dist/field/index.d.ts.map +1 -1
  29. package/dist/field/index.js +11 -25
  30. package/dist/field/index.js.map +1 -1
  31. package/dist/field/rscEntry.d.ts +1 -1
  32. package/dist/field/rscEntry.d.ts.map +1 -1
  33. package/dist/field/rscEntry.js +0 -12
  34. package/dist/field/rscEntry.js.map +1 -1
  35. package/dist/index.d.ts +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +1 -3
  38. package/dist/index.js.map +1 -1
  39. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  40. package/dist/lexical/LexicalEditor.js +1 -2
  41. package/dist/lexical/LexicalEditor.js.map +1 -1
  42. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  43. package/dist/lexical/LexicalProvider.js +3 -12
  44. package/dist/lexical/LexicalProvider.js.map +1 -1
  45. package/dist/lexical/nodes/index.d.ts +2 -12
  46. package/dist/lexical/nodes/index.d.ts.map +1 -1
  47. package/dist/lexical/nodes/index.js +2 -195
  48. package/dist/lexical/nodes/index.js.map +1 -1
  49. package/dist/types.d.ts +2 -132
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/types.js.map +1 -1
  52. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  53. package/dist/utilities/generateImportMap.js +0 -1
  54. package/dist/utilities/generateImportMap.js.map +1 -1
  55. package/dist/validate/hasText.d.ts +1 -6
  56. package/dist/validate/hasText.d.ts.map +1 -1
  57. package/dist/validate/hasText.js +4 -10
  58. package/dist/validate/hasText.js.map +1 -1
  59. package/package.json +6 -6
  60. package/dist/exports/client/Field-5VLZM7KJ.js +0 -2
  61. package/dist/exports/client/Field-5VLZM7KJ.js.map +0 -7
  62. package/dist/exports/client/chunk-U4AOQOHA.js +0 -12
  63. package/dist/exports/client/chunk-U4AOQOHA.js.map +0 -7
  64. package/dist/field/RichTextViewProvider.d.ts +0 -84
  65. package/dist/field/RichTextViewProvider.d.ts.map +0 -1
  66. package/dist/field/RichTextViewProvider.js +0 -92
  67. package/dist/field/RichTextViewProvider.js.map +0 -1
  68. package/dist/field/ViewSelector.d.ts +0 -4
  69. package/dist/field/ViewSelector.d.ts.map +0 -1
  70. package/dist/field/ViewSelector.js +0 -89
  71. package/dist/field/ViewSelector.js.map +0 -1
  72. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +0 -2
  73. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +0 -1
  74. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +0 -48
  75. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +0 -1
package/dist/types.d.ts CHANGED
@@ -1,11 +1,8 @@
1
- import type { EditorConfig, LexicalEditor, EditorConfig as LexicalEditorConfig, LexicalNode, SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
- import type { ClientField, DefaultServerCellComponentProps, LabelFunction, PayloadComponent, RichTextAdapter, RichTextField, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
3
- import type { JSX } from 'react';
4
- import type { JSXConverterArgs } from './features/converters/lexicalToJSX/converter/types.js';
1
+ import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical';
2
+ import type { ClientField, DefaultServerCellComponentProps, LabelFunction, RichTextAdapter, RichTextField, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
5
3
  import type { BaseClientFeatureProps, FeatureProviderProviderClient } from './features/typesClient.js';
6
4
  import type { FeatureProviderServer } from './features/typesServer.js';
7
5
  import type { SanitizedServerEditorConfig } from './lexical/config/types.js';
8
- import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from './nodeTypes.js';
9
6
  import type { InitialLexicalFormState } from './utilities/buildInitialState.js';
10
7
  export type LexicalFieldAdminProps = {
11
8
  /**
@@ -59,135 +56,10 @@ export type FeaturesInput = (({ defaultFeatures, rootFeatures, }: {
59
56
  */
60
57
  rootFeatures: FeatureProviderServer<any, any, any>[];
61
58
  }) => FeatureProviderServer<any, any, any>[]) | FeatureProviderServer<any, any, any>[];
62
- type WithinEditorArgs = {
63
- config: EditorConfig;
64
- editor: LexicalEditor;
65
- node: LexicalNode;
66
- };
67
- export type NodeMapValue<TNode extends {
68
- [key: string]: any;
69
- type?: string;
70
- } = SerializedLexicalNode> = {
71
- /**
72
- * Provide a react component to render the node.
73
- *
74
- * **JSX Converter:** Always works. Takes priority over `html`.
75
- *
76
- * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.
77
- */
78
- Component?: (args: ({
79
- isEditor: false;
80
- isJSXConverter: true;
81
- } & JSXConverterArgs<TNode>) | ({
82
- isEditor: true;
83
- isJSXConverter: false;
84
- } & WithinEditorArgs)) => JSX.Element;
85
- /**
86
- * Provide a function to create the DOM element for the node.
87
- *
88
- * **JSX Converter:** Not used (only `Component` and `html` work).
89
- *
90
- * **Lexical Editor:** Always works (renders in `createDOM` method).
91
- * - For ElementNodes: This is the standard way to customize rendering.
92
- * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.
93
- */
94
- createDOM?: (args: WithinEditorArgs) => HTMLElement;
95
- /**
96
- * Provide HTML string or function to render the node.
97
- *
98
- * **JSX Converter:** Always works (ignored if `Component` is provided).
99
- *
100
- * **Lexical Editor behavior depends on node type:**
101
- *
102
- * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.
103
- *
104
- * - **DecoratorNodes (have both `createDOM` and `decorate`):**
105
- * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`
106
- * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`
107
- * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content
108
- * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)
109
- */
110
- html?: (args: ({
111
- isEditor: false;
112
- isJSXConverter: true;
113
- } & JSXConverterArgs<TNode>) | ({
114
- isEditor: true;
115
- isJSXConverter: false;
116
- } & WithinEditorArgs)) => string;
117
- };
118
- /**
119
- * @experimental - This API is experimental and may change in a minor release.
120
- * @internal
121
- */
122
- export type LexicalEditorNodeMap<TNodes extends {
123
- [key: string]: any;
124
- type?: string;
125
- } = DefaultNodeTypes | SerializedBlockNode<{
126
- blockName?: null | string;
127
- blockType: string;
128
- }> | SerializedInlineBlockNode<{
129
- blockName?: null | string;
130
- blockType: string;
131
- }>> = {
132
- [key: string]: {
133
- [blockSlug: string]: NodeMapValue<any>;
134
- } | NodeMapValue<any> | undefined;
135
- } & {
136
- [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<Extract<TNodes, {
137
- type: nodeType;
138
- }>>;
139
- } & {
140
- blocks?: {
141
- [K in Extract<Extract<TNodes, {
142
- type: 'block';
143
- }> extends SerializedBlockNode<infer B> ? B extends {
144
- blockType: string;
145
- } ? B['blockType'] : never : never, string>]?: NodeMapValue<Extract<TNodes, {
146
- type: 'block';
147
- }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
148
- blockType: K;
149
- }>> : SerializedBlockNode>;
150
- };
151
- inlineBlocks?: {
152
- [K in Extract<Extract<TNodes, {
153
- type: 'inlineBlock';
154
- }> extends SerializedInlineBlockNode<infer B> ? B extends {
155
- blockType: string;
156
- } ? B['blockType'] : never : never, string>]?: NodeMapValue<Extract<TNodes, {
157
- type: 'inlineBlock';
158
- }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
159
- blockType: K;
160
- }>> : SerializedInlineBlockNode>;
161
- };
162
- unknown?: NodeMapValue<SerializedLexicalNode>;
163
- };
164
- /**
165
- * A map of views, which can be used to render the editor in different ways.
166
- *
167
- * In order to override the default view, you can add a `default` key to the map.
168
- *
169
- * @experimental - This API is experimental and may change in a minor release.
170
- * @internal
171
- */
172
- export type LexicalEditorViewMap = {
173
- [viewKey: string]: LexicalEditorNodeMap;
174
- };
175
- /**
176
- * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function
177
- */
178
59
  export type LexicalEditorProps = {
179
60
  admin?: LexicalFieldAdminProps;
180
61
  features?: FeaturesInput;
181
62
  lexical?: LexicalEditorConfig;
182
- /**
183
- * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.
184
- *
185
- * In order to override the default view, you can add a `default` key to the map.
186
- *
187
- * @experimental - This API is experimental and may change in a minor release.
188
- * @internal
189
- */
190
- views?: PayloadComponent;
191
63
  };
192
64
  export type LexicalRichTextAdapter = {
193
65
  editorConfig: SanitizedServerEditorConfig;
@@ -224,7 +96,6 @@ export type LexicalRichTextFieldProps = {
224
96
  featureClientSchemaMap: FeatureClientSchemaMap;
225
97
  initialLexicalFormState: InitialLexicalFormState;
226
98
  lexicalEditorConfig: LexicalEditorConfig | undefined;
227
- views?: LexicalEditorViewMap;
228
99
  } & Pick<ServerFieldBase, 'permissions'> & RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>;
229
100
  export type LexicalRichTextCellProps = DefaultServerCellComponentProps<RichTextFieldClient<SerializedEditorState, AdapterProps, object>, SerializedEditorState>;
230
101
  export type AdapterProps = {
@@ -235,5 +106,4 @@ export type GeneratedFeatureProviderComponent = {
235
106
  clientFeatureProps: BaseClientFeatureProps<object>;
236
107
  };
237
108
  export type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>;
238
- export {};
239
109
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,YAAY,IAAI,mBAAmB,EACnC,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAChB,OAAO,KAAK,EACV,WAAW,EACX,+BAA+B,EAC/B,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACxB,eAAe,EACf,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAA;AAChB,OAAO,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,EAAE,sBAAsB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAA;YAChE,qBAAqB,CAAC,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;SAChE,CAAA;KACF,CAAA;IACD;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5C,sBAAsB,EAAE,sBAAsB,CAAA;IAC9C,uBAAuB,EAAE,uBAAuB,CAAA;IAChD,mBAAmB,EAAE,mBAAmB,GAAG,SAAS,CAAA;CACrD,GAAG,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,GACtC,wBAAwB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,CAAA;AAEvE,MAAM,MAAM,wBAAwB,GAAG,+BAA+B,CACpE,mBAAmB,CAAC,qBAAqB,EAAE,YAAY,EAAE,MAAM,CAAC,EAChE,qBAAqB,CACtB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,EAAE,2BAA2B,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,iCAAiC,GAAG;IAC9C,aAAa,EAAE,6BAA6B,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;IACtD,kBAAkB,EAAE,sBAAsB,CAAC,MAAM,CAAC,CAAA;CACnD,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,qBAAqB,EAAE,YAAY,CAAC,CAAA"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type {\n EditorConfig,\n LexicalEditor,\n EditorConfig as LexicalEditorConfig,\n LexicalNode,\n SerializedEditorState,\n SerializedLexicalNode,\n} from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n PayloadComponent,\n RichTextAdapter,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\nimport type { JSX } from 'react'\n\nimport type { JSXConverterArgs } from './features/converters/lexicalToJSX/converter/types.js'\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from './features/typesClient.js'\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\nimport type { InitialLexicalFormState } from './utilities/buildInitialState.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\ntype WithinEditorArgs = {\n config: EditorConfig\n editor: LexicalEditor\n node: LexicalNode\n}\n\nexport type NodeMapValue<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\n /**\n * Provide a react component to render the node.\n *\n * **JSX Converter:** Always works. Takes priority over `html`.\n *\n * **Lexical Editor:** Only works for DecoratorNodes (renders in `decorate` method). Takes priority over `html` and `createDOM`.\n */\n Component?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n } & WithinEditorArgs),\n ) => JSX.Element\n /**\n * Provide a function to create the DOM element for the node.\n *\n * **JSX Converter:** Not used (only `Component` and `html` work).\n *\n * **Lexical Editor:** Always works (renders in `createDOM` method).\n * - For ElementNodes: This is the standard way to customize rendering.\n * - For DecoratorNodes: When combined with `html`, the DOM gets custom structure while `decorate` renders the `html` content.\n */\n createDOM?: (args: WithinEditorArgs) => HTMLElement\n /**\n * Provide HTML string or function to render the node.\n *\n * **JSX Converter:** Always works (ignored if `Component` is provided).\n *\n * **Lexical Editor behavior depends on node type:**\n *\n * - **ElementNodes:** `html` is used in `createDOM` to generate the DOM structure.\n *\n * - **DecoratorNodes (have both `createDOM` and `decorate`):**\n * - If only `html` is provided: `createDOM` uses `html` to create DOM, `decorate` returns `null`\n * - If `html` + `Component`: `createDOM` uses `html`, `decorate` uses `Component`\n * - If `html` + `createDOM`: Custom `createDOM` creates structure, `decorate` renders `html` content\n * - If `html` + `Component` + `createDOM`: Custom `createDOM` creates structure, `decorate` uses `Component` (html ignored in editor)\n */\n html?: (\n args:\n | ({\n isEditor: false\n isJSXConverter: true\n } & JSXConverterArgs<TNode>)\n | ({\n isEditor: true\n isJSXConverter: false\n } & WithinEditorArgs),\n ) => string\n}\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: NodeMapValue<any>\n }\n | NodeMapValue<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: NodeMapValue<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: NodeMapValue<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: NodeMapValue<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n unknown?: NodeMapValue<SerializedLexicalNode>\n}\n\n/**\n * A map of views, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorViewMap = {\n [viewKey: string]: LexicalEditorNodeMap\n}\n\n/**\n * @todo rename to LexicalEditorArgs in 4.0, since these are arguments for the lexicalEditor function\n */\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n /**\n * A path to a LexicalEditorViewMap, which can be used to render the editor in different ways.\n *\n * In order to override the default view, you can add a `default` key to the map.\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\n views?: PayloadComponent\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\n /**\n * Part of the import map that contains client components for all lexical features of this field that\n * have been added through `feature.componentImports`.\n */\n featureClientImportMap?: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState: InitialLexicalFormState\n lexicalEditorConfig: LexicalEditorConfig | undefined // Undefined if default lexical editor config should be used\n views?: LexicalEditorViewMap\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n\nexport type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>\n"],"mappings":"AAiTA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n RichTextAdapter,\n RichTextField,\n RichTextFieldClient,\n RichTextFieldClientProps,\n SanitizedConfig,\n ServerFieldBase,\n StaticLabel,\n} from 'payload'\n\nimport type {\n BaseClientFeatureProps,\n FeatureProviderProviderClient,\n} from './features/typesClient.js'\nimport type { FeatureProviderServer } from './features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from './lexical/config/types.js'\nimport type { InitialLexicalFormState } from './utilities/buildInitialState.js'\n\nexport type LexicalFieldAdminProps = {\n /**\n * Controls if the add block button should be hidden. @default false\n */\n hideAddBlockButton?: boolean\n /**\n * Controls if the draggable block element should be hidden. @default false\n */\n hideDraggableBlockElement?: boolean\n /**\n * Controls if the gutter (padding to the left & gray vertical line) should be hidden. @default false\n */\n hideGutter?: boolean\n /**\n * Controls if the insert paragraph at the end button should be hidden. @default false\n */\n hideInsertParagraphAtEnd?: boolean\n /**\n * Changes the placeholder text in the editor if no content is present.\n */\n placeholder?: LabelFunction | StaticLabel\n}\n\nexport type LexicalFieldAdminClientProps = {\n placeholder?: string\n} & Omit<LexicalFieldAdminProps, 'placeholder'>\n\nexport type FeaturesInput =\n | (({\n defaultFeatures,\n rootFeatures,\n }: {\n /**\n * This opinionated array contains all \"recommended\" default features.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ defaultFeatures }) => [...defaultFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n defaultFeatures: FeatureProviderServer<any, any, any>[]\n /**\n * This array contains all features that are enabled in the root richText editor (the one defined in the payload.config.ts).\n * If this field is the root richText editor, or if the root richText editor is not a lexical editor, this array will be empty.\n *\n * @Example\n *\n * ```ts\n * editor: lexicalEditor({\n * features: ({ rootFeatures }) => [...rootFeatures, FixedToolbarFeature()],\n * })\n * ```\n */\n rootFeatures: FeatureProviderServer<any, any, any>[]\n }) => FeatureProviderServer<any, any, any>[])\n | FeatureProviderServer<any, any, any>[]\n\nexport type LexicalEditorProps = {\n admin?: LexicalFieldAdminProps\n features?: FeaturesInput\n lexical?: LexicalEditorConfig\n}\n\nexport type LexicalRichTextAdapter = {\n editorConfig: SanitizedServerEditorConfig\n features: FeatureProviderServer<any, any, any>[]\n} & RichTextAdapter<SerializedEditorState, AdapterProps>\n\nexport type LexicalRichTextAdapterProvider =\n /**\n * This is being called during the payload sanitization process\n */\n ({\n config,\n isRoot,\n parentIsLocalized,\n }: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n }) => Promise<LexicalRichTextAdapter>\n\nexport type SingleFeatureClientSchemaMap = {\n [key: string]: ClientField[]\n}\nexport type FeatureClientSchemaMap = {\n [featureKey: string]: SingleFeatureClientSchemaMap\n}\n\nexport type LexicalRichTextFieldProps = {\n admin?: LexicalFieldAdminClientProps\n // clientFeatures is added through the rsc field\n clientFeatures: {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n }\n /**\n * Part of the import map that contains client components for all lexical features of this field that\n * have been added through `feature.componentImports`.\n */\n featureClientImportMap?: Record<string, any>\n featureClientSchemaMap: FeatureClientSchemaMap\n initialLexicalFormState: InitialLexicalFormState\n lexicalEditorConfig: LexicalEditorConfig | undefined // Undefined if default lexical editor config should be used\n} & Pick<ServerFieldBase, 'permissions'> &\n RichTextFieldClientProps<SerializedEditorState, AdapterProps, object>\n\nexport type LexicalRichTextCellProps = DefaultServerCellComponentProps<\n RichTextFieldClient<SerializedEditorState, AdapterProps, object>,\n SerializedEditorState\n>\n\nexport type AdapterProps = {\n editorConfig: SanitizedServerEditorConfig\n}\n\nexport type GeneratedFeatureProviderComponent = {\n clientFeature: FeatureProviderProviderClient<any, any>\n clientFeatureProps: BaseClientFeatureProps<object>\n}\n\nexport type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>\n"],"mappings":"AAoJA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CAiDtC,CAAA"}
1
+ {"version":3,"file":"generateImportMap.d.ts","sourceRoot":"","sources":["../../src/utilities/generateImportMap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAI9C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AAC1E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,eAAO,MAAM,oBAAoB,SACxB;IACL,iBAAiB,CAAC,EAAE,kBAAkB,CAAA;IACtC,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,KAAG,eAAe,CAAC,mBAAmB,CA+CtC,CAAA"}
@@ -9,7 +9,6 @@ export const getGenerateImportMap = args => ({
9
9
  addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell');
10
10
  addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField');
11
11
  addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent');
12
- addToImportMap(args.lexicalEditorArgs?.views);
13
12
  for (const resolvedFeature of args.resolvedFeatureMap.values()) {
14
13
  if ('componentImports' in resolvedFeature) {
15
14
  if (typeof resolvedFeature.componentImports === 'function') {
@@ -1 +1 @@
1
- {"version":3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","lexicalEditorArgs","views","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","Object","ClientFeature","nodes","length","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { LexicalEditorProps } from '../types.js'\n\nexport const getGenerateImportMap =\n (args: {\n lexicalEditorArgs?: LexicalEditorProps\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n addToImportMap(args.lexicalEditorArgs?.views)\n\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (Array.isArray(resolvedFeature.componentImports)) {\n addToImportMap(resolvedFeature.componentImports)\n } else if (typeof resolvedFeature.componentImports === 'object') {\n addToImportMap(Object.values(resolvedFeature.componentImports))\n }\n }\n\n addToImportMap(resolvedFeature.ClientFeature)\n\n /*\n * Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAK1C,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3,"file":"generateImportMap.js","names":["genImportMapIterateFields","getGenerateImportMap","args","addToImportMap","baseDir","config","importMap","imports","resolvedFeature","resolvedFeatureMap","values","componentImports","Array","isArray","Object","ClientFeature","nodes","length","node","getSubFields","subFields","fields"],"sources":["../../src/utilities/generateImportMap.tsx"],"sourcesContent":["import type { RichTextAdapter } from 'payload'\n\nimport { genImportMapIterateFields } from 'payload'\n\nimport type { ResolvedServerFeatureMap } from '../features/typesServer.js'\nimport type { LexicalEditorProps } from '../types.js'\n\nexport const getGenerateImportMap =\n (args: {\n lexicalEditorArgs?: LexicalEditorProps\n resolvedFeatureMap: ResolvedServerFeatureMap\n }): RichTextAdapter['generateImportMap'] =>\n ({ addToImportMap, baseDir, config, importMap, imports }) => {\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalCell')\n addToImportMap('@payloadcms/richtext-lexical/rsc#RscEntryLexicalField')\n addToImportMap('@payloadcms/richtext-lexical/rsc#LexicalDiffComponent')\n\n for (const resolvedFeature of args.resolvedFeatureMap.values()) {\n if ('componentImports' in resolvedFeature) {\n if (typeof resolvedFeature.componentImports === 'function') {\n resolvedFeature.componentImports({\n addToImportMap,\n baseDir,\n config,\n importMap,\n imports,\n })\n } else if (Array.isArray(resolvedFeature.componentImports)) {\n addToImportMap(resolvedFeature.componentImports)\n } else if (typeof resolvedFeature.componentImports === 'object') {\n addToImportMap(Object.values(resolvedFeature.componentImports))\n }\n }\n\n addToImportMap(resolvedFeature.ClientFeature)\n\n /*\n * Now run for all possible sub-fields\n */\n if (resolvedFeature.nodes?.length) {\n for (const node of resolvedFeature.nodes) {\n if (typeof node?.getSubFields !== 'function') {\n continue\n }\n const subFields = node.getSubFields({})\n if (subFields?.length) {\n genImportMapIterateFields({\n addToImportMap,\n baseDir,\n config,\n fields: subFields,\n importMap,\n imports,\n })\n }\n }\n }\n }\n }\n"],"mappings":"AAEA,SAASA,yBAAyB,QAAQ;AAK1C,OAAO,MAAMC,oBAAA,GACVC,IAAA,IAID,CAAC;EAAEC,cAAc;EAAEC,OAAO;EAAEC,MAAM;EAAEC,SAAS;EAAEC;AAAO,CAAE;EACtDJ,cAAA,CAAe;EACfA,cAAA,CAAe;EACfA,cAAA,CAAe;EAEf,KAAK,MAAMK,eAAA,IAAmBN,IAAA,CAAKO,kBAAkB,CAACC,MAAM,IAAI;IAC9D,IAAI,sBAAsBF,eAAA,EAAiB;MACzC,IAAI,OAAOA,eAAA,CAAgBG,gBAAgB,KAAK,YAAY;QAC1DH,eAAA,CAAgBG,gBAAgB,CAAC;UAC/BR,cAAA;UACAC,OAAA;UACAC,MAAA;UACAC,SAAA;UACAC;QACF;MACF,OAAO,IAAIK,KAAA,CAAMC,OAAO,CAACL,eAAA,CAAgBG,gBAAgB,GAAG;QAC1DR,cAAA,CAAeK,eAAA,CAAgBG,gBAAgB;MACjD,OAAO,IAAI,OAAOH,eAAA,CAAgBG,gBAAgB,KAAK,UAAU;QAC/DR,cAAA,CAAeW,MAAA,CAAOJ,MAAM,CAACF,eAAA,CAAgBG,gBAAgB;MAC/D;IACF;IAEAR,cAAA,CAAeK,eAAA,CAAgBO,aAAa;IAE5C;;;IAGA,IAAIP,eAAA,CAAgBQ,KAAK,EAAEC,MAAA,EAAQ;MACjC,KAAK,MAAMC,IAAA,IAAQV,eAAA,CAAgBQ,KAAK,EAAE;QACxC,IAAI,OAAOE,IAAA,EAAMC,YAAA,KAAiB,YAAY;UAC5C;QACF;QACA,MAAMC,SAAA,GAAYF,IAAA,CAAKC,YAAY,CAAC,CAAC;QACrC,IAAIC,SAAA,EAAWH,MAAA,EAAQ;UACrBjB,yBAAA,CAA0B;YACxBG,cAAA;YACAC,OAAA;YACAC,MAAA;YACAgB,MAAA,EAAQD,SAAA;YACRd,SAAA;YACAC;UACF;QACF;MACF;IACF;EACF;AACF","ignoreList":[]}
@@ -1,8 +1,3 @@
1
1
  import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
- /**
3
- * This function checks if the editor state is empty (has any text). If the editor state has no nodes,
4
- * or only an empty paragraph node (no TextNode with length > 0), it returns false.
5
- * Otherwise, it returns true.
6
- */
7
- export declare function hasText(value: null | SerializedEditorState<SerializedLexicalNode> | undefined): value is SerializedEditorState<SerializedLexicalNode>;
2
+ export declare function hasText(value: null | SerializedEditorState<SerializedLexicalNode> | undefined): boolean;
8
3
  //# sourceMappingURL=hasText.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasText.d.ts","sourceRoot":"","sources":["../../src/validate/hasText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAGtB,MAAM,SAAS,CAAA;AAEhB;;;;GAIG;AACH,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GACrE,KAAK,IAAI,qBAAqB,CAAC,qBAAqB,CAAC,CA6BvD"}
1
+ {"version":3,"file":"hasText.d.ts","sourceRoot":"","sources":["../../src/validate/hasText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,qBAAqB,EAGtB,MAAM,SAAS,CAAA;AAEhB,wBAAgB,OAAO,CACrB,KAAK,EAAE,IAAI,GAAG,qBAAqB,CAAC,qBAAqB,CAAC,GAAG,SAAS,GACrE,OAAO,CA0BT"}
@@ -1,12 +1,5 @@
1
- /**
2
- * This function checks if the editor state is empty (has any text). If the editor state has no nodes,
3
- * or only an empty paragraph node (no TextNode with length > 0), it returns false.
4
- * Otherwise, it returns true.
5
- */export function hasText(value) {
1
+ export function hasText(value) {
6
2
  const hasChildren = !!value?.root?.children?.length;
7
- if (!hasChildren) {
8
- return false;
9
- }
10
3
  let hasOnlyEmptyParagraph = false;
11
4
  if (value?.root?.children?.length === 1) {
12
5
  if (value?.root?.children[0]?.type === 'paragraph') {
@@ -23,9 +16,10 @@
23
16
  }
24
17
  }
25
18
  }
26
- if (hasOnlyEmptyParagraph) {
19
+ if (!hasChildren || hasOnlyEmptyParagraph) {
27
20
  return false;
21
+ } else {
22
+ return true;
28
23
  }
29
- return true;
30
24
  }
31
25
  //# sourceMappingURL=hasText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"hasText.js","names":["hasText","value","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild"],"sources":["../../src/validate/hasText.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\n/**\n * This function checks if the editor state is empty (has any text). If the editor state has no nodes,\n * or only an empty paragraph node (no TextNode with length > 0), it returns false.\n * Otherwise, it returns true.\n */\nexport function hasText(\n value: null | SerializedEditorState<SerializedLexicalNode> | undefined,\n): value is SerializedEditorState<SerializedLexicalNode> {\n const hasChildren = !!value?.root?.children?.length\n if (!hasChildren) {\n return false\n }\n\n let hasOnlyEmptyParagraph = false\n if (value?.root?.children?.length === 1) {\n if (value?.root?.children[0]?.type === 'paragraph') {\n const paragraphNode = value?.root?.children[0] as SerializedParagraphNode\n\n if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {\n hasOnlyEmptyParagraph = true\n } else if (paragraphNode?.children?.length === 1) {\n const paragraphNodeChild = paragraphNode?.children[0]\n if (paragraphNodeChild?.type === 'text') {\n if (!(paragraphNodeChild as SerializedTextNode | undefined)?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (hasOnlyEmptyParagraph) {\n return false\n }\n\n return true\n}\n"],"mappings":"AAOA;;;;GAKA,OAAO,SAASA,QACdC,KAAsE;EAEtE,MAAMC,WAAA,GAAc,CAAC,CAACD,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA;EAC7C,IAAI,CAACH,WAAA,EAAa;IAChB,OAAO;EACT;EAEA,IAAII,qBAAA,GAAwB;EAC5B,IAAIL,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;IACvC,IAAIJ,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;MAClD,MAAMC,aAAA,GAAgBP,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE;MAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QACrEC,qBAAA,GAAwB;MAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;QACrD,IAAIK,kBAAA,EAAoBF,IAAA,KAAS,QAAQ;UACvC,IAAI,CAAEE,kBAAA,GAAwD,OAAO,EAAEJ,MAAA,EAAQ;YAC7EC,qBAAA,GAAwB;UAC1B;QACF;MACF;IACF;EACF;EAEA,IAAIA,qBAAA,EAAuB;IACzB,OAAO;EACT;EAEA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"hasText.js","names":["hasText","value","hasChildren","root","children","length","hasOnlyEmptyParagraph","type","paragraphNode","paragraphNodeChild"],"sources":["../../src/validate/hasText.ts"],"sourcesContent":["import type {\n SerializedEditorState,\n SerializedLexicalNode,\n SerializedParagraphNode,\n SerializedTextNode,\n} from 'lexical'\n\nexport function hasText(\n value: null | SerializedEditorState<SerializedLexicalNode> | undefined,\n): boolean {\n const hasChildren = !!value?.root?.children?.length\n\n let hasOnlyEmptyParagraph = false\n if (value?.root?.children?.length === 1) {\n if (value?.root?.children[0]?.type === 'paragraph') {\n const paragraphNode = value?.root?.children[0] as SerializedParagraphNode\n\n if (!paragraphNode?.children || paragraphNode?.children?.length === 0) {\n hasOnlyEmptyParagraph = true\n } else if (paragraphNode?.children?.length === 1) {\n const paragraphNodeChild = paragraphNode?.children[0]\n if (paragraphNodeChild?.type === 'text') {\n if (!(paragraphNodeChild as SerializedTextNode | undefined)?.['text']?.length) {\n hasOnlyEmptyParagraph = true\n }\n }\n }\n }\n }\n\n if (!hasChildren || hasOnlyEmptyParagraph) {\n return false\n } else {\n return true\n }\n}\n"],"mappings":"AAOA,OAAO,SAASA,QACdC,KAAsE;EAEtE,MAAMC,WAAA,GAAc,CAAC,CAACD,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA;EAE7C,IAAIC,qBAAA,GAAwB;EAC5B,IAAIL,KAAA,EAAOE,IAAA,EAAMC,QAAA,EAAUC,MAAA,KAAW,GAAG;IACvC,IAAIJ,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE,EAAEG,IAAA,KAAS,aAAa;MAClD,MAAMC,aAAA,GAAgBP,KAAA,EAAOE,IAAA,EAAMC,QAAQ,CAAC,EAAE;MAE9C,IAAI,CAACI,aAAA,EAAeJ,QAAA,IAAYI,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QACrEC,qBAAA,GAAwB;MAC1B,OAAO,IAAIE,aAAA,EAAeJ,QAAA,EAAUC,MAAA,KAAW,GAAG;QAChD,MAAMI,kBAAA,GAAqBD,aAAA,EAAeJ,QAAQ,CAAC,EAAE;QACrD,IAAIK,kBAAA,EAAoBF,IAAA,KAAS,QAAQ;UACvC,IAAI,CAAEE,kBAAA,GAAwD,OAAO,EAAEJ,MAAA,EAAQ;YAC7EC,qBAAA,GAAwB;UAC1B;QACF;MACF;IACF;EACF;EAEA,IAAI,CAACJ,WAAA,IAAeI,qBAAA,EAAuB;IACzC,OAAO;EACT,OAAO;IACL,OAAO;EACT;AACF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.61.0-internal.1898a30",
3
+ "version": "3.61.0-internal.5662539",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -374,8 +374,8 @@
374
374
  "react-error-boundary": "4.1.2",
375
375
  "ts-essentials": "10.0.3",
376
376
  "uuid": "10.0.0",
377
- "@payloadcms/translations": "3.61.0-internal.1898a30",
378
- "@payloadcms/ui": "3.61.0-internal.1898a30"
377
+ "@payloadcms/translations": "3.61.0-internal.5662539",
378
+ "@payloadcms/ui": "3.61.0-internal.5662539"
379
379
  },
380
380
  "devDependencies": {
381
381
  "@babel/cli": "7.27.2",
@@ -395,15 +395,15 @@
395
395
  "esbuild-sass-plugin": "3.3.1",
396
396
  "swc-plugin-transform-remove-imports": "4.0.4",
397
397
  "@payloadcms/eslint-config": "3.28.0",
398
- "payload": "3.61.0-internal.1898a30"
398
+ "payload": "3.61.0-internal.5662539"
399
399
  },
400
400
  "peerDependencies": {
401
401
  "@faceless-ui/modal": "3.0.0",
402
402
  "@faceless-ui/scroll-info": "2.0.0",
403
403
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
404
404
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
405
- "@payloadcms/next": "3.61.0-internal.1898a30",
406
- "payload": "3.61.0-internal.1898a30"
405
+ "@payloadcms/next": "3.61.0-internal.5662539",
406
+ "payload": "3.61.0-internal.5662539"
407
407
  },
408
408
  "engines": {
409
409
  "node": "^18.20.2 || >=20.9.0"
@@ -1,2 +0,0 @@
1
- "use client";import{a as De,e as Le,f as O,h as Me,i as Ae,j as Be,k as Ie,l as be,m as Ce,n as Oe}from"./chunk-U4AOQOHA.js";import{a as _e,b as S}from"./chunk-BZZVLW4U.js";import{jsx as D,jsxs as ie}from"react/jsx-runtime";import{FieldDescription as Zn,FieldError as er,FieldLabel as tr,RenderCustomComponent as Lt,useEditDepth as or,useEffectEvent as nr,useField as rr}from"@payloadcms/ui";import{mergeFieldStyles as ir}from"@payloadcms/ui/shared";import{dequal as sr}from"dequal/lite";import Mt,{useCallback as At,useEffect as Bt,useMemo as lr,useState as Te}from"react";import{ErrorBoundary as ar}from"react-error-boundary";import"./bundled.css";import{jsx as F}from"react/jsx-runtime";import{LexicalComposer as zn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as Wn}from"@payloadcms/ui";import*as Tt from"react";import{useMemo as Yn}from"react";import{jsx as Vt}from"react/jsx-runtime";import{createContext as jt,use as Kt,useMemo as Fe}from"react";var $e=jt({currentView:"default",currentViewMap:void 0,setCurrentView:void 0,views:void 0}),Ve=({children:e,currentView:t="default",setCurrentView:o,views:n})=>{let r=Fe(()=>{if(n)return n[t]||n.default},[n,t]),a=Fe(()=>({currentView:t,currentViewMap:r,setCurrentView:o,views:n}),[t,o,r,n]);return Vt($e,{value:a,children:e})};function z(){let e=Kt($e);if(!e)throw new Error("useRichTextView must be used within a RichTextViewProvider");return e}import{c as kn}from"react/compiler-runtime";import{jsx as E,jsxs as ne}from"react/jsx-runtime";import{useLexicalComposerContext as vn}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as _n}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as Dn}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Ln}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as Mn}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as An}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as Bn,COMMAND_PRIORITY_LOW as St,FOCUS_COMMAND as In}from"lexical";import*as J from"react";import{useEffect as On,useState as Fn}from"react";import{jsx as je}from"react/jsx-runtime";import"react";var $=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&je(o.Component,{anchorElem:e,clientProps:t}):o.Component&&je(o.Component,{clientProps:t});import{c as Ht}from"react/compiler-runtime";import{copyToClipboard as zt}from"@lexical/clipboard";import{useLexicalComposerContext as Wt}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Yt}from"@lexical/utils";import Ke from"bson-objectid";import{COMMAND_PRIORITY_LOW as Gt,COPY_COMMAND as Ut}from"lexical";import{useEffect as qt}from"react";function He(){let e=Ht(3),[t]=Wt(),o,n;return e[0]!==t?(o=()=>t.registerCommand(Ut,r=>(zt(t,Yt(r,ClipboardEvent)?r:null).then(()=>{if(!(r instanceof ClipboardEvent)||!r.clipboardData)throw new Error("No clipboard event");let a=r.clipboardData.getData("application/x-lexical-editor");if(!a)return!0;let i=JSON.parse(a),l=d=>{if("fields"in d&&typeof d.fields=="object"&&d.fields!==null&&"id"in d.fields?d.fields.id=new Ke.default().toHexString():"id"in d&&(d.id=new Ke.default().toHexString()),d.children)for(let x of d.children)l(x)};for(let d of i.nodes)l(d);let u=JSON.stringify(i);r.clipboardData.setData("application/x-lexical-editor",u)}).catch(a=>{throw r instanceof ClipboardEvent&&r.clipboardData?.setData("application/x-lexical-editor",""),a}),!0),Gt),n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),qt(o,n),null}import{c as Jt}from"react/compiler-runtime";import{useLexicalComposerContext as Qt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as le,mergeRegister as Xt}from"@lexical/utils";import{$createNodeSelection as Zt,$getEditor as ee,$getNearestNodeFromDOMNode as eo,$getSelection as ae,$isDecoratorNode as V,$isElementNode as Ne,$isLineBreakNode as to,$isNodeSelection as ce,$isRangeSelection as ze,$isRootOrShadowRoot as oo,$isTextNode as no,$setSelection as We,CLICK_COMMAND as ro,COMMAND_PRIORITY_LOW as W,KEY_ARROW_DOWN_COMMAND as io,KEY_ARROW_UP_COMMAND as so,KEY_BACKSPACE_COMMAND as lo,KEY_DELETE_COMMAND as ao,SELECTION_CHANGE_COMMAND as co}from"lexical";import{useEffect as uo}from"react";function Ye(){let e=Jt(3),[t]=Qt(),o=yo,n,r;return e[0]!==t?(n=()=>Xt(t.registerCommand(ro,xo,W),t.registerCommand(ao,o,W),t.registerCommand(lo,o,W),t.registerCommand(co,ho,W),t.registerCommand(so,po,W),t.registerCommand(io,fo,W)),r=[t],e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]),uo(n,r),null}function fo(e){let t=ae();if(ce(t)){e.preventDefault();let i=t.getNodes()[0]?.getNextSibling();if(V(i)){let d=ee().getElementByKey(i.getKey());return d&&te({element:d,node:i}),!0}if(!Ne(i))return!0;let l=i.getFirstDescendant()??i;return l&&(le(l,ue)?.selectEnd(),e.preventDefault()),!0}if(!ze(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=le(n,mo),a=r?.getNextSibling();if(!r||a!==Ge(r))return!1;if(V(a)){let i=ee().getElementByKey(a.getKey());if(i)return te({element:i,node:a}),e.preventDefault(),!0}return!1}function mo(e){return Ge(e)!==null}function po(e){let t=ae();if(ce(t)){let i=t.getNodes()[0]?.getPreviousSibling();if(V(i)){let d=ee().getElementByKey(i.getKey());return d?(te({element:d,node:i}),e.preventDefault(),!0):!1}if(!Ne(i))return!1;let l=i.getLastDescendant()??i;return l?(le(l,ue)?.selectStart(),e.preventDefault(),!0):!1}if(!ze(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=le(n,go),a=r?.getPreviousSibling();if(!r||a!==Ue(r))return!1;if(V(a)){let i=ee().getElementByKey(a.getKey());if(i)return te({element:i,node:a}),e.preventDefault(),!0}return!1}function go(e){return Ue(e)!==null}function ho(){let e=Co();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),e?(e.element?.classList.add("decorator-selected"),!0):!1}function xo(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=bo(e);if(!t)return!0;let{target:o}=e;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?We(null):te(t),!0}function yo(e){let t=ae();return ce(t)?(e.preventDefault(),t.getNodes().forEach(Eo),!0):!1}function Eo(e){e.remove()}function bo(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=eo(t);return V(o)?{element:t,node:o}:void 0}function Co(){let e=ae();if(!ce(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return V(o)?{decorator:o,element:ee().getElementByKey(o.getKey())}:void 0}function te({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=Zt();o.add(t.getKey()),We(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function ue(e){if(V(e)&&!e.isInline())return!0;if(!Ne(e)||oo(e))return!1;let t=e.getFirstChild(),o=t===null||to(t)||no(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function Ge(e){let t=e.getNextSibling();for(;t!==null;){if(ue(t))return t;t=t.getNextSibling()}return null}function Ue(e){let t=e.getPreviousSibling();for(;t!==null;){if(ue(t))return t;t=t.getPreviousSibling()}return null}import{jsx as we}from"react/jsx-runtime";import{useLexicalComposerContext as To}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ko,isHTMLElement as vo}from"lexical";import*as Xe from"react";import{useCallback as _o,useEffect as Qe,useRef as Do,useState as Lo}from"react";import{createPortal as Mo}from"react-dom";var Y=(e,t,o,n,r=50,a=25)=>{let i=0;if(e&&!e.contains(n)){let{bottom:l,left:u,right:d,top:x}=e.getBoundingClientRect(),c=x+window.scrollY,s=l+window.scrollY;if(o<c-a||o>s+a||t<u-r||t>d+r)return-1;(t<u||t>d)&&(i=t<u?t-u:t-d)}return i};import{$getNodeByKey as fe}from"lexical";function G(e){let t=e.getBoundingClientRect(),o=getComputedStyle(e).getPropertyValue("transform");if(!o||o==="none")return t;let n=o.split(",").pop();return t.y=t.y-Number(n?.replace(")","")),t}function de(e){let t=(u,d)=>u?parseFloat(window.getComputedStyle(u)[d]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(e),r=t(e.previousElementSibling,"marginBottom"),a=t(e.nextElementSibling,"marginTop"),i=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),a),marginTop:i}}import{$getRoot as No}from"lexical";function j(e){return e.getEditorState().read(()=>No().getChildrenKeys())}var wo=1,Po=-1,qe=0,A={props:null,result:null};function So(e,t,o=20){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=o*o}function U(e){let{anchorElem:t,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:a=0,point:{x:i,y:l},startIndex:u=0,useEdgeAsDefault:d=!1}=e;if(o>0&&A.props&&A.result&&A.props.fuzzy===e.fuzzy&&A.props.horizontalOffset===e.horizontalOffset&&A.props.useEdgeAsDefault===e.useEdgeAsDefault&&So(A.props.point,e.point,o))return A.result;let x=t.getBoundingClientRect(),c=j(n),s={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(d){let g=n.getElementByKey(c[0]),m=n.getElementByKey(c[c.length-1]);if(g&&m){let[h,p]=[G(g),G(m)];if(l<h.top?(s.blockElem=g,s.distance=h.top-l,s.blockNode=fe(c[0]),s.foundAtIndex=0):l>p.bottom&&(s.distance=l-p.bottom,s.blockNode=fe(c[c.length-1]),s.blockElem=m,s.foundAtIndex=c.length-1),s?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let f=u,y=qe;for(;f>=0&&f<c.length;){let g=c[f],m=n.getElementByKey(g);if(m===null)break;let h=new O(i+a,l),p=Ie.fromDOMRect(G(m)),{marginBottom:b,marginTop:T}=de(m),P=p.generateNewRect({bottom:p.bottom+b,left:x.left,right:x.right,top:p.top-T}),{distance:C,isOnBottomSide:R,isOnTopSide:N}=P.distanceFromPoint(h);if(C===0){s.blockElem=m,s.blockNode=fe(g),s.foundAtIndex=f,s.distance=C,s.blockNode&&s.blockNode.getType()==="paragraph"&&s.blockNode.getTextContent()===""&&(!r&&!e.returnEmptyParagraphs&&(s.blockElem=null,s.blockNode=null),s.isFoundNodeEmptyParagraph=!0);break}else r&&C<s.distance&&(s.blockElem=m,s.blockNode=fe(g),s.distance=C,s.foundAtIndex=f);y===qe&&(N?y=Po:R?y=wo:y=1/0),f+=y}}),A.props=e,A.result={blockElem:s.blockElem,blockNode:s.blockNode,foundAtIndex:s.foundAtIndex,isFoundNodeEmptyParagraph:s.isFoundNodeEmptyParagraph},{blockElem:s.blockElem,blockNode:s.blockNode,foundAtIndex:s.foundAtIndex,isFoundNodeEmptyParagraph:s.isFoundNodeEmptyParagraph}}function me(e,t){return!!e.closest(`.${t}`)}var Ro=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Je(e){if(!e||Ro.includes(e.tagName)||e.offsetHeight===0||e.offsetWidth===0)return!1;let t=window.getComputedStyle(e);return!(t.display==="table-cell"||t.position==="absolute"||t.visibility==="hidden"||t.opacity==="0")}function pe(e,t,o,n=0){if(!e){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let r=e.getBoundingClientRect(),a=window.getComputedStyle(e),i=t.getBoundingClientRect(),l=o.getBoundingClientRect(),u;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(c=>e.classList.contains(c)||e.firstElementChild?.classList.contains(c)))u=r.top+8-l.top;else{let c=Je(e)?parseInt(a.lineHeight,10):0;u=r.top+(c-i.height)/2-l.top}let x=n;t.style.opacity="1",t.style.transform=`translate(${x}px, ${u}px)`}var Ao="add-block-menu",ge=1/0;function Bo(e){return e===0?1/0:ge>=0&&ge<e?ge:Math.floor(e/2)}function Io(e,t,o){let n=t.parentElement,{editorConfig:r}=S(),a=r?.admin?.hideGutter?-24:12,i=Do(null),[l,u]=Lo(null);Qe(()=>{function x(c){let s=c.target;if(!vo(s))return;let f=Y(n,c.pageX,c.pageY,s);if(f===-1){u(null);return}if(me(s,Ao))return;let y=j(e),{blockElem:g,blockNode:m,foundAtIndex:h}=U({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-f,point:new O(c.x,c.y),returnEmptyParagraphs:!0,startIndex:Bo(y.length),useEdgeAsDefault:!1});ge=h,g&&m&&(l?.node!==m||l?.elem!==g)&&u({elem:g,node:m})}return document?.addEventListener("mousemove",x),()=>{document?.removeEventListener("mousemove",x)}},[n,t,e,l]),Qe(()=>{i.current&&l?.node&&pe(l?.elem,i.current,t,a)},[t,l,a]);let d=_o(x=>{let c=l;c?.node&&(e.update(()=>{let s=!0;if((c?.node.getType()!=="paragraph"||c.node.getTextContent()!=="")&&(s=!1),!s){let f=ko();c?.node.insertAfter(f),setTimeout(()=>{c={elem:e.getElementByKey(f.getKey()),node:f},u(c)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),c?.node&&"select"in c.node&&typeof c.node.select=="function"&&c.node.select()})},1),setTimeout(()=>{e.dispatchCommand(Ae,{node:c?.node})},2),x.stopPropagation(),x.preventDefault())},[e,l]);return Mo(we(Xe.Fragment,{children:we("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:x=>{d(x)},ref:i,type:"button",children:we("div",{className:o?"icon":""})})}),t)}function Ze(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=To();return Io(n,o,n._editable)}import{jsx as he,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as $o}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as ot}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as nt,$getNodeByKey as Vo,isHTMLElement as Pe}from"lexical";import*as at from"react";import{useEffect as Se,useRef as xe,useState as rt}from"react";import{createPortal as jo}from"react-dom";var et=0,Oo=-24;var K=0;function tt(e,t,o,n,r,a,i,l,u,d=!1){let{height:x,top:c}=n.getBoundingClientRect(),{top:s,width:f}=i.getBoundingClientRect(),{marginBottom:y,marginTop:g}=de(n),m=c,h=a>=c+x/2+window.scrollY,p=!1;if(r?.elem)if(n!==r?.elem)(h&&r?.elem&&r?.elem===n.nextElementSibling||!h&&r?.elem&&r?.elem===n.previousElementSibling)&&(K++,K<200&&(p=!0));else{K++;let C=r?.boundingBox?.y,R=n.getBoundingClientRect().y;(h===r?.isBelow&&C===R||K<200)&&(p=!1)}if(p)return{isBelow:h,willStayInSamePosition:p};d?m+=x/2:h?m+=x+y/2:m-=g/2;let b=0;d||(h?b=-et:b=et);let T=m-s+b,P=Oo-t;return o.style.width=`calc(${f}px - ${e})`,o.style.opacity=".8",o.style.transform=`translate(${P}px, calc(${T}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?h?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),K=0,{isBelow:h,willStayInSamePosition:p}}var Ko="draggable-block-menu",it="application/x-lexical-drag-block",oe=1/0;function st(e){return e===0?1/0:oe>=0&&oe<e?oe:Math.floor(e/2)}function Ho(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function lt(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function zo(e,t,o){let n=t.parentElement,r=xe(null),a=xe(null),i=xe(null),l=xe(!1),[u,d]=rt(null),[x,c]=rt(null),{editorConfig:s}=S(),f=s?.admin?.hideGutter?-44:-8;Se(()=>{function m(h){let p=h.target;if(!Pe(p))return;let b=Y(n,h.pageX,h.pageY,p);if(b===-1){d(null);return}if(me(p,Ko))return;let T=j(e),{blockElem:P,foundAtIndex:C,isFoundNodeEmptyParagraph:R}=U({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-b,point:new O(h.x,h.y),startIndex:st(T.length),useEdgeAsDefault:!1,verbose:!1});oe=C,!(!P&&!R)&&u!==P&&d(P)}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[n,t,e,u]),Se(()=>{r.current&&pe(u,r.current,t,f)},[t,u,f]),Se(()=>{function m(p){if(!l.current)return!1;let[b]=ot(p);if(b)return!1;let{pageY:T,target:P}=p;if(!Pe(P))return!1;let C=Y(n,p.pageX,p.pageY,P,100,50),R=j(e),{blockElem:N,foundAtIndex:L,isFoundNodeEmptyParagraph:I}=U({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-C,point:new O(p.x,p.y),startIndex:st(R.length),useEdgeAsDefault:!0,verbose:!0});oe=L;let k=a.current;if(N===null||k===null)return!1;if(u!==N){let{isBelow:v,willStayInSamePosition:X}=tt(s?.admin?.hideGutter?"0px":"3rem",f+(s?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),k,N,x,T,t,p,i,I);p.preventDefault(),X||c({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:v})}else x?.elem&&(lt(k,x.elem),c({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function h(p){if(!l.current)return!1;let[b]=ot(p);if(b)return!1;let{dataTransfer:T,pageY:P,target:C}=p,R=T?.getData(it)||"";return e.update(()=>{let N=Vo(R);if(!N||!Pe(C))return!1;let L=Y(n,p.pageX,p.pageY,C,100,50),{blockElem:I,isFoundNodeEmptyParagraph:k}=U({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-L,point:new O(p.x,p.y),useEdgeAsDefault:!0});if(!I)return!1;let v=nt(I);if(!v)return!1;if(v===N)return!0;let{height:X,top:ye}=G(I),H=P>=ye+X/2+window.scrollY;k?(v.insertBefore(N),v.remove()):H?v.insertAfter(N):v.insertBefore(N),u!==null&&d(null),document.querySelectorAll(".lexical-block-highlighter").forEach(_=>{_.remove()});let se=e.getElementByKey(N.getKey());setTimeout(()=>{let _=se?.getBoundingClientRect();if(!_)return;let w=document.createElement("div");w.className="lexical-block-highlighter",w.style.backgroundColor="var(--theme-elevation-1000",w.style.transition="opacity 0.5s ease-in-out",w.style.zIndex="1",w.style.pointerEvents="none",w.style.boxSizing="border-box",w.style.borderRadius="4px",w.style.position="absolute",document.body.appendChild(w),w.style.opacity="0.1",w.style.height=`${_.height+8}px`,w.style.width=`${_.width+8}px`,w.style.top=`${_.top+window.scrollY-4}px`,w.style.left=`${_.left-4}px`,setTimeout(()=>{w.style.opacity="0",setTimeout(()=>{w.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",m),document.addEventListener("drop",h),()=>{document.removeEventListener("dragover",m),document.removeEventListener("drop",h)}},[n,f,t,e,x,u,s?.admin?.hideGutter]);function y(m){let h=m.dataTransfer;if(!h||!u)return;Ho(h,u);let p="";e.update(()=>{let b=nt(u);b&&(p=b.getKey())}),l.current=!0,h.setData(it,p)}function g(){l.current=!1,x?.elem&&lt(a.current,x?.elem)}return jo(Fo(at.Fragment,{children:[he("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:g,onDragStart:y,ref:r,type:"button",children:he("div",{className:o?"icon":""})}),he("div",{className:"draggable-block-target-line",ref:a}),he("div",{className:"debug-highlight",ref:i})]}),t)}function ct(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=$o();return zo(n,o,n._editable)}import{c as Wo}from"react/compiler-runtime";import{jsx as Re}from"react/jsx-runtime";import{useLexicalComposerContext as Yo}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Go,$getRoot as Uo}from"lexical";import"react";var ut="insert-paragraph-at-end",dt=()=>{let e=Wo(2),[t]=Yo(),{editorConfig:o}=S();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return e[0]!==t?(n=Re("div",{"aria-label":"Insert Paragraph",className:ut,onClick:()=>{t.update(qo)},role:"button",tabIndex:0,children:Re("div",{className:`${ut}-inside`,children:Re("span",{children:"+"})})}),e[0]=t,e[1]=n):n=e[1],n};function qo(){let e=Go();Uo().append(e),e.select()}import{c as Jo}from"react/compiler-runtime";import{useLexicalComposerContext as Qo}from"@lexical/react/LexicalComposerContext";import*as ft from"react";var mt=()=>{let e=Jo(4),{editorConfig:t}=S(),[o]=Qo(),n,r;return e[0]!==o||e[1]!==t.features.markdownTransformers?(n=()=>De(o,t.features.markdownTransformers??[]),r=[o,t.features.markdownTransformers],e[0]=o,e[1]=t.features.markdownTransformers,e[2]=n,e[3]=r):(n=e[2],r=e[3]),ft.useEffect(n,r),null};import{c as Xo}from"react/compiler-runtime";import{useLexicalComposerContext as Zo}from"@lexical/react/LexicalComposerContext.js";import{useEffect as en}from"react";function pt(){let e=Xo(5),[t]=Zo(),{currentView:o,views:n}=z(),r,a;return e[0]!==o||e[1]!==t||e[2]!==n?(r=()=>{n&&(o==="default"?n.default?be(t,n.default):Ce(t):n[o]&&(Ce(t),be(t,n[o])))},a=[t,n,o],e[0]=o,e[1]=t,e[2]=n,e[3]=r,e[4]=a):(r=e[3],a=e[4]),en(r,a),null}import{useLexicalComposerContext as tn}from"@lexical/react/LexicalComposerContext";import{$getSelection as on,$isRangeSelection as nn,RootNode as rn}from"lexical";import{useEffect as sn}from"react";function gt(){let[e]=tn();return sn(()=>e.registerNodeTransform(rn,t=>{let o=on();if(nn(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(t.selectEnd(),console.warn("updateEditor: selection has been moved to the end of the editor because the previously selected nodes have been removed and selection wasn't moved to another node. Ensure selection changes after removing/replacing a selected node."))}return!1}),[e]),null}import{useLexicalComposerContext as ln}from"@lexical/react/LexicalComposerContext";import{$getSelection as an,COMMAND_PRIORITY_LOW as cn,SELECT_ALL_COMMAND as un}from"lexical";import{useEffect as dn}from"react";function ht(){let[e]=ln();return dn(()=>e.registerCommand(un,()=>{if(an())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},cn),[e]),null}import{jsx as q,jsxs as yt}from"react/jsx-runtime";import{useLexicalComposerContext as mn}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as Et}from"@payloadcms/ui";import{useCallback as pn,useMemo as gn,useState as hn}from"react";import"react";import*as bt from"react-dom";import{c as fn}from"react/compiler-runtime";import"react";function xt(e,t){let o=fn(4),{maxLength:n,minLength:r}=t,a=n===void 0?75:n,i=r===void 0?1:r,l;return o[0]!==a||o[1]!==i||o[2]!==e?(l=u=>{let{query:d}=u,x="[^"+e+Me+"\\s]",s=new RegExp("(^|\\s|\\()(["+e+"]((?:"+x+"){0,"+a+"}))$").exec(d);if(s!==null){let f=s[1],y=s[3];if(y.length>=i)return{leadOffset:s.index+f.length,matchingString:y,replaceableString:s[2]}}return null},o[0]=a,o[1]=i,o[2]=e,o[3]=l):l=o[3],l}var B="slash-menu-popup";function xn({isSelected:e,item:t,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:a,schemaPath:i}}=S(),{i18n:l}=Et(),u=`${B}__item ${B}__item-${t.key}`;e&&(u+=` ${B}__item--selected`);let d=t.key;return t.label&&(d=typeof t.label=="function"?t.label({featureClientSchemaMap:a,i18n:l,schemaPath:i}):t.label),d.length>25&&(d=d.substring(0,25)+"..."),yt("button",{"aria-selected":e,className:u,id:B+"__item-"+t.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&q(t.Icon,{}),q("span",{className:`${B}__item-text`,children:d})]},t.key)}function Ct({anchorElem:e=document.body}){let[t]=mn(),[o,n]=hn(null),{editorConfig:r}=S(),{i18n:a}=Et(),{fieldProps:{featureClientSchemaMap:i,schemaPath:l}}=S(),u=xt("/",{minLength:0}),d=pn(()=>{let c=[];for(let s of r.features.slashMenu.dynamicGroups)if(o){let f=s({editor:t,queryString:o});c=c.concat(f)}return c},[t,o,r?.features]),x=gn(()=>{let c=[];for(let s of r?.features.slashMenu.groups??[])c.push(s);if(o){c=c.map(f=>{let y=f.items.filter(g=>{let m=g.key;return g.label&&(m=typeof g.label=="function"?g.label({featureClientSchemaMap:i,i18n:a,schemaPath:l}):g.label),new RegExp(o,"gi").exec(m)?!0:g.keywords!=null?g.keywords.some(h=>new RegExp(o,"gi").exec(h)):!1});return y.length?{...f,items:y}:null}),c=c.filter(f=>f!=null);let s=d();for(let f of s){let y=c.find(g=>g.key===f.key);y?c=c.filter(g=>g.key!==f.key):y={...f,items:[]},y?.items?.length&&(y.items=y.items.concat(y.items)),c.push(y)}}return c},[o,r?.features.slashMenu.groups,d,i,a,l]);return q(Be,{anchorElem:e,groups:x,menuRenderFn:(c,{selectedItemKey:s,selectItemAndCleanUp:f,setSelectedItemKey:y})=>c.current&&x.length?bt.createPortal(q("div",{className:B,children:x.map(g=>{let m=g.key;return g.label&&i&&(m=typeof g.label=="function"?g.label({featureClientSchemaMap:i,i18n:a,schemaPath:l}):g.label),yt("div",{className:`${B}__group ${B}__group-${g.key}`,children:[q("div",{className:`${B}__group-title`,children:m}),g.items.map((h,p)=>q(xn,{index:p,isSelected:s===h.key,item:h,onClick:()=>{y(h.key),f(h)},onMouseEnter:()=>{y(h.key)},ref:b=>{h.ref={current:b}}},h.key))]},g.key)})}),c.current):null,onQueryChange:n,triggerFn:u})}import{c as yn}from"react/compiler-runtime";import{useLexicalComposerContext as En}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as bn,TextNode as Cn}from"lexical";import{useEffect as Nn}from"react";function Nt(e){let t=yn(6),{features:o}=e,[n]=En(),r;t[0]!==n||t[1]!==o.enabledFormats?(r=()=>{let i=wn(o.enabledFormats);if(i.length!==0)return n.registerNodeTransform(Cn,l=>{i.forEach(u=>{l.hasFormat(u)&&l.toggleFormat(u)})})},t[0]=n,t[1]=o.enabledFormats,t[2]=r):r=t[2];let a;return t[3]!==n||t[4]!==o?(a=[n,o],t[3]=n,t[4]=o,t[5]=a):a=t[5],Nn(r,a),null}function wn(e){let t=Object.keys(bn),o=new Set(e);return t.filter(n=>!o.has(n))}import{c as Pn}from"react/compiler-runtime";import{jsx as wt}from"react/jsx-runtime";import{useLexicalComposerContext as Sn}from"@lexical/react/LexicalComposerContext";import{ContentEditable as Rn}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Tn}from"@payloadcms/ui";import"react";function Pt(e){let t=Pn(5),{className:o,editorConfig:n}=e,{t:r}=Tn(),[,a]=Sn(),{getTheme:i}=a,l;if(t[0]!==o||t[1]!==n?.admin?.placeholder||t[2]!==i||t[3]!==r){let u=i();l=wt(Rn,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:wt("p",{className:u?.placeholder,children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),t[0]=o,t[1]=n?.admin?.placeholder,t[2]=i,t[3]=r,t[4]=l}else l=t[4];return l}var Rt=e=>{let t=kn(12),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:a}=e,i=S(),[l]=vn(),u=An(),[d,x]=Fn(null),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=m=>{m!==null&&x(m)},t[0]=c):c=t[0];let s=c,f,y;t[1]!==l||t[2]!==i?(f=()=>{if(!i?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}i?.parentEditor?.uuid&&i.parentEditor?.registerChild(i.uuid,i);let m=()=>{i.focusEditor(i)},h=()=>{i.blurEditor(i)},p=l.registerCommand(In,()=>(m(),!0),St),b=l.registerCommand(Bn,()=>(h(),!0),St);return()=>{p(),b(),i.parentEditor?.unregisterChild?.(i.uuid)}},y=[l,i],t[1]=l,t[2]=i,t[3]=f,t[4]=y):(f=t[3],y=t[4]),On(f,y);let g;return t[5]!==o||t[6]!==n||t[7]!==d||t[8]!==u||t[9]!==r||t[10]!==a?(g=ne(J.Fragment,{children:[o.features.plugins?.map($n),ne("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(Vn),E(Mn,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:s,children:E(Pt,{editorConfig:o})})}),ErrorBoundary:_n}),E(gt,{}),u&&E(dt,{}),E(Ye,{}),E(He,{}),E(Nt,{features:o.features}),E(ht,{}),E(pt,{}),u&&E(Ln,{ignoreSelectionChange:!0,onChange:(m,h,p)=>{(!p.has("focus")||p.size>1)&&a?.(m,h,p)}}),d&&ne(J.Fragment,{children:[!r&&u&&ne(J.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(ct,{anchorElem:d}),o.admin?.hideAddBlockButton?null:E(Ze,{anchorElem:d})]}),o.features.plugins?.map(m=>{if(m.position==="floatingAnchorElem"&&!(m.desktopOnly===!0&&r))return E($,{anchorElem:d,clientProps:m.clientProps,plugin:m},m.key)}),u&&E(J.Fragment,{children:E(Ct,{anchorElem:d})})]}),u&&ne(J.Fragment,{children:[E(Dn,{}),o?.features?.markdownTransformers?.length>0&&E(mt,{})]}),o.features.plugins?.map(jn),o.features.plugins?.map(Kn)]}),o.features.plugins?.map(Hn)]}),t[5]=o,t[6]=n,t[7]=d,t[8]=u,t[9]=r,t[10]=a,t[11]=g):g=t[11],g};function $n(e){if(e.position==="aboveContainer")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function Vn(e){if(e.position==="top")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function jn(e){if(e.position==="normal")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function Kn(e){if(e.position==="bottom")return E($,{clientProps:e.clientProps,plugin:e},e.key)}function Hn(e){if(e.position==="belowContainer")return E($,{clientProps:e.clientProps,plugin:e},e.key)}var kt=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?F(o,{children:F(kt,{providers:t.slice(1),children:e})}):F(o,{children:e})},vt=e=>{let{composerKey:t,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:a,readOnly:i,value:l}=e,{currentView:u,views:d}=z(),x=S(),c=Wn(),s=Tt.useRef(null),f=Yn(()=>{if(l&&typeof l!="object")throw new Error("The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: "+JSON.stringify(l));if(l&&Array.isArray(l)&&!("root"in l))throw new Error("You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/lexical/migration#migration-via-migration-script-recommended");if(l&&"jsonContent"in l)throw new Error("You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/lexical/migration#migrating-from-payload-plugin-lexical");let y=d?.default;return{editable:i!==!0,editorState:l!=null?JSON.stringify(l):void 0,namespace:o.lexical.namespace,nodes:Oe({editorConfig:o,nodeViews:y}),onError:g=>{throw g},theme:o.lexical.theme}},[o,d]);return f?F(zn,{initialConfig:f,children:F(_e,{editorConfig:o,editorContainerRef:s,fieldProps:n,parentContext:x?.editDepth===c?x:void 0,children:F(kt,{providers:o.features.providers,children:F(Rt,{editorConfig:o,editorContainerRef:s,isSmallWidthViewport:r,onChange:a})})})},t+f.editable+u):F("p",{children:"Loading..."})};import{c as Gn}from"react/compiler-runtime";import{jsx as Q,jsxs as Un}from"react/jsx-runtime";import{ChevronIcon as qn,Popup as Jn,PopupList as _t}from"@payloadcms/ui";import"react";function Dt(){let e=Gn(5),{currentView:t,setCurrentView:o,views:n}=z();if(!n||Object.keys(n).length===0)return null;let r,a;if(e[0]!==t||e[1]!==o||e[2]!==n){a=Symbol.for("react.early_return_sentinel");e:{let i=Object.keys(n);if(!i.some(Xn)){a=null;break e}let u=["default",...i.filter(Qn)],d=t.charAt(0).toUpperCase()+t.slice(1);r=Q("div",{className:"lexical-view-selector",children:Q(Jn,{button:Un("button",{className:"lexical-view-selector__button",type:"button",children:[Q("span",{className:"lexical-view-selector__label",children:d}),Q(qn,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",render:x=>{let{close:c}=x;return Q(_t.ButtonGroup,{children:u.map(s=>{let f=s.charAt(0).toUpperCase()+s.slice(1);return Q(_t.Button,{active:s===t,disabled:s===t,onClick:()=>{o?.(s),c()},children:f},s)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=a}else r=e[3],a=e[4];return a!==Symbol.for("react.early_return_sentinel")?a:r}function Qn(e){return e!=="default"}function Xn(e){return e!=="default"}var re="rich-text-lexical",cr=e=>{let{editorConfig:t,field:o,field:{admin:{className:n,description:r,readOnly:a}={},label:i,localized:l,required:u},path:d,readOnly:x,validate:c}=e,s=x||a,f=or(),y=At((M,Z)=>typeof c=="function"?c(M,{...Z,required:u}):!0,[c,u]),{customComponents:{AfterInput:g,BeforeInput:m,Description:h,Error:p,Label:b}={},disabled:T,initialValue:P,path:C,setValue:R,showError:N,value:L}=rr({potentiallyStalePath:d,validate:y}),I=s||T,[k,v]=Te(!1),[X,ye]=Te(),Ee=Mt.useRef(P),H=Mt.useRef(L);Bt(()=>{let M=()=>{let Z=window.matchMedia("(max-width: 768px)").matches;Z!==k&&v(Z)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[k]);let ke=[re,"field-type",n,N&&"error",I&&`${re}--read-only`,t?.admin?.hideGutter!==!0&&!k?`${re}--show-gutter`:null].filter(Boolean).join(" "),se=`${C}.${f}`,_=Le(),[w,It]=Te("default"),Ot=At(M=>{_(()=>{let ve=M.toJSON();H.current=ve,R(ve)})},[R,_]),Ft=lr(()=>ir(o),[o]),$t=nr(M=>{H.current!==L&&!sr(JSON.parse(JSON.stringify(H.current)),L)&&(Ee.current=M,H.current=L,ye(new Date))});return Bt(()=>{Object.is(P,Ee.current)||$t(P)},[P]),D(Ve,{currentView:w,setCurrentView:It,views:e.views,children:ie("div",{className:ke,style:Ft,children:[D(Lt,{CustomComponent:p,Fallback:D(er,{path:C,showError:N})}),ie("div",{className:`${re}__label-row`,children:[b||D(tr,{label:i,localized:l,path:C,required:u}),D(Dt,{})]}),ie("div",{className:`${re}__wrap`,children:[ie(ar,{fallbackRender:ur,onReset:()=>{},children:[m,D(vt,{composerKey:se,editorConfig:t,fieldProps:e,isSmallWidthViewport:k,onChange:Ot,readOnly:I,value:L},JSON.stringify({currentView:w,path:C,rerenderProviderKey:X})),g]}),D(Lt,{CustomComponent:h,Fallback:D(Zn,{description:r,path:C})})]})]},se)})};function ur({error:e}){return ie("div",{className:"errorBoundary",role:"alert",children:[D("p",{children:"Something went wrong:"}),D("pre",{style:{color:"red"},children:e.message})]})}var Pl=cr;export{Pl as RichText};
2
- //# sourceMappingURL=Field-5VLZM7KJ.js.map