@payloadcms/richtext-lexical 3.60.0-internal.8e20fed → 3.60.0-internal.c130254

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 (100) hide show
  1. package/dist/exports/client/Field-YHS7VMOE.js +2 -0
  2. package/dist/exports/client/Field-YHS7VMOE.js.map +7 -0
  3. package/dist/exports/client/{chunk-IBFFIWII.js → chunk-ADWHGDDR.js} +2 -2
  4. package/dist/exports/client/{chunk-IBFFIWII.js.map → chunk-ADWHGDDR.js.map} +2 -2
  5. package/dist/exports/client/componentInline-MIPTDFRK.js +2 -0
  6. package/dist/exports/client/index.js +12 -12
  7. package/dist/exports/client/index.js.map +4 -4
  8. package/dist/features/blockquote/server/index.d.ts +3 -4
  9. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  10. package/dist/features/blockquote/server/index.js.map +1 -1
  11. package/dist/features/blocks/premade/CodeBlock/index.d.ts +3 -1
  12. package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -1
  13. package/dist/features/blocks/premade/CodeBlock/index.js +7 -2
  14. package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -1
  15. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +4 -4
  16. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  17. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  18. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +4 -4
  19. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  20. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  21. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts +10 -1
  22. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts.map +1 -1
  23. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js +10 -1
  24. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js.map +1 -1
  25. package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts.map +1 -1
  26. package/dist/features/converters/lexicalToHtml_deprecated/field/index.js.map +1 -1
  27. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts +2 -1
  28. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts.map +1 -1
  29. package/dist/features/converters/lexicalToHtml_deprecated/index.js +2 -1
  30. package/dist/features/converters/lexicalToHtml_deprecated/index.js.map +1 -1
  31. package/dist/features/experimental_table/server/index.d.ts +5 -10
  32. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  33. package/dist/features/experimental_table/server/index.js.map +1 -1
  34. package/dist/features/heading/server/index.d.ts +3 -4
  35. package/dist/features/heading/server/index.d.ts.map +1 -1
  36. package/dist/features/heading/server/index.js.map +1 -1
  37. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +3 -4
  38. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  39. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  40. package/dist/features/link/nodes/types.d.ts +6 -6
  41. package/dist/features/link/nodes/types.d.ts.map +1 -1
  42. package/dist/features/link/nodes/types.js.map +1 -1
  43. package/dist/features/lists/checklist/client/index.d.ts.map +1 -1
  44. package/dist/features/lists/checklist/client/index.js +4 -2
  45. package/dist/features/lists/checklist/client/index.js.map +1 -1
  46. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  47. package/dist/features/lists/checklist/server/index.js +3 -2
  48. package/dist/features/lists/checklist/server/index.js.map +1 -1
  49. package/dist/features/lists/orderedList/client/index.d.ts.map +1 -1
  50. package/dist/features/lists/orderedList/client/index.js +5 -3
  51. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  52. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  53. package/dist/features/lists/orderedList/server/index.js +3 -2
  54. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  55. package/dist/features/lists/plugin/index.d.ts +6 -7
  56. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  57. package/dist/features/lists/plugin/index.js.map +1 -1
  58. package/dist/features/lists/shared/shouldRegisterListBaseNodes.d.ts +2 -0
  59. package/dist/features/lists/shared/shouldRegisterListBaseNodes.d.ts.map +1 -0
  60. package/dist/features/lists/shared/shouldRegisterListBaseNodes.js +14 -0
  61. package/dist/features/lists/shared/shouldRegisterListBaseNodes.js.map +1 -0
  62. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +3 -4
  63. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  64. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  65. package/dist/features/textState/feature.client.js +9 -7
  66. package/dist/features/textState/feature.client.js.map +1 -1
  67. package/dist/features/textState/textState.d.ts +11 -5
  68. package/dist/features/textState/textState.d.ts.map +1 -1
  69. package/dist/features/textState/textState.js +6 -3
  70. package/dist/features/textState/textState.js.map +1 -1
  71. package/dist/features/typesServer.d.ts +4 -4
  72. package/dist/features/typesServer.d.ts.map +1 -1
  73. package/dist/features/typesServer.js.map +1 -1
  74. package/dist/features/upload/server/nodes/UploadNode.d.ts +3 -4
  75. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  76. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  77. package/dist/field/RenderLexical/index.d.ts +2 -1
  78. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  79. package/dist/field/RenderLexical/index.js.map +1 -1
  80. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  81. package/dist/lexical/LexicalEditor.js +2 -1
  82. package/dist/lexical/LexicalEditor.js.map +1 -1
  83. package/dist/lexical/plugins/ClipboardPlugin/index.d.ts +2 -0
  84. package/dist/lexical/plugins/ClipboardPlugin/index.d.ts.map +1 -0
  85. package/dist/lexical/plugins/ClipboardPlugin/index.js +64 -0
  86. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -0
  87. package/dist/nodeTypes.d.ts +31 -14
  88. package/dist/nodeTypes.d.ts.map +1 -1
  89. package/dist/nodeTypes.js.map +1 -1
  90. package/dist/types.d.ts +2 -1
  91. package/dist/types.d.ts.map +1 -1
  92. package/dist/types.js.map +1 -1
  93. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  94. package/dist/utilities/buildEditorState.js +1 -0
  95. package/dist/utilities/buildEditorState.js.map +1 -1
  96. package/package.json +8 -7
  97. package/dist/exports/client/Field-CJFETHA3.js +0 -2
  98. package/dist/exports/client/Field-CJFETHA3.js.map +0 -7
  99. package/dist/exports/client/componentInline-ZHQ2OTFH.js +0 -2
  100. /package/dist/exports/client/{componentInline-ZHQ2OTFH.js.map → componentInline-MIPTDFRK.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import type { SerializedLineBreakNode as _SerializedLineBreakNode, SerializedTabNode as _SerializedTabNode, SerializedTextNode as _SerializedTextNode, SerializedEditorState, SerializedElementNode, SerializedLexicalNode, Spread } from 'lexical';
1
+ import type { SerializedLineBreakNode as _SerializedLineBreakNode, SerializedTabNode as _SerializedTabNode, SerializedTextNode as _SerializedTextNode, SerializedEditorState, SerializedElementNode, SerializedLexicalNode } from 'lexical';
2
2
  import type { SerializedQuoteNode } from './features/blockquote/server/index.js';
3
3
  import type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js';
4
4
  import type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js';
@@ -9,20 +9,35 @@ import type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link
9
9
  import type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js';
10
10
  import type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js';
11
11
  import type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js';
12
+ /**
13
+ * Helper type to create strongly typed serialized nodes with flexible children types.
14
+ * Omits 'children' and 'type' from the base node type and redeclares them with proper typing.
15
+ *
16
+ * @param TBase - The base Lexical node type (e.g., _SerializedHeadingNode)
17
+ * @param TType - The node type string (e.g., 'heading')
18
+ * @param TChildren - The type for children (defaults to SerializedLexicalNode)
19
+ */
20
+ export type StronglyTypedElementNode<TBase, TType extends string, TChildren extends SerializedLexicalNode = SerializedLexicalNode> = {
21
+ children: TChildren[];
22
+ type: TType;
23
+ } & Omit<TBase, 'children' | 'type'>;
24
+ /**
25
+ * Helper type to create strongly typed leaf nodes (nodes without children).
26
+ * Omits 'children' and 'type' from the base node type and redeclares 'type' with a literal.
27
+ *
28
+ * @param TBase - The base Lexical node type (e.g., _SerializedTextNode)
29
+ * @param TType - The node type string (e.g., 'text')
30
+ */
31
+ export type StronglyTypedLeafNode<TBase, TType extends string> = {
32
+ type: TType;
33
+ } & Omit<TBase, 'children' | 'type'>;
12
34
  export type { SerializedAutoLinkNode, SerializedBlockNode, SerializedHeadingNode, SerializedHorizontalRuleNode, SerializedInlineBlockNode, SerializedLinkNode, SerializedListItemNode, SerializedListNode, SerializedQuoteNode, SerializedRelationshipNode, SerializedTableCellNode, SerializedTableNode, SerializedTableRowNode, SerializedUploadNode, };
13
- export type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> = Spread<{
35
+ export type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {
14
36
  textFormat: number;
15
- type: 'paragraph';
16
- }, Omit<SerializedElementNode<T>, 'type'>>;
17
- export type SerializedTextNode = Omit<Spread<{
18
- type: 'text';
19
- }, Omit<_SerializedTextNode, 'type'>>, 'children'>;
20
- export type SerializedTabNode = Omit<Spread<{
21
- type: 'tab';
22
- }, Omit<_SerializedTabNode, 'type'>>, 'children'>;
23
- export type SerializedLineBreakNode = Omit<Spread<{
24
- type: 'linebreak';
25
- }, Omit<_SerializedLineBreakNode, 'type'>>, 'children'>;
37
+ } & StronglyTypedElementNode<SerializedElementNode, 'paragraph', T>;
38
+ export type SerializedTextNode = StronglyTypedLeafNode<_SerializedTextNode, 'text'>;
39
+ export type SerializedTabNode = StronglyTypedLeafNode<_SerializedTabNode, 'tab'>;
40
+ export type SerializedLineBreakNode = StronglyTypedLeafNode<_SerializedLineBreakNode, 'linebreak'>;
26
41
  /**
27
42
  * Recursively adds typed children to nodes up to a specified depth.
28
43
  *
@@ -31,8 +46,10 @@ export type SerializedLineBreakNode = Omit<Spread<{
31
46
  * - `OriginalUnion`: Preserves full union so nested children accept all node types, not just parent's type. If we just used `T`, the type would be narrowed to the parent's type and the children would only consist of the parent's type.
32
47
  * - `'children' extends keyof T`: Only adds children to container nodes; respects leaf nodes that use `Omit<_, 'children'>`
33
48
  * - `Depth`: Limits recursion to prevent infinite types (default: 4 levels)
49
+ *
50
+ * @internal - this type may change or be removed in a minor release
34
51
  */
35
- type RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4, OriginalUnion extends SerializedLexicalNode = T> = T extends any ? Depth extends 0 ? T : 'children' extends keyof T ? {
52
+ export type RecursiveNodes<T extends SerializedLexicalNode, Depth extends number = 4, OriginalUnion extends SerializedLexicalNode = T> = T extends any ? Depth extends 0 ? T : 'children' extends keyof T ? {
36
53
  children?: RecursiveNodes<OriginalUnion, DecrementDepth<Depth>, OriginalUnion>[];
37
54
  } & T : T : never;
38
55
  /** Decrements depth: 4→3, 3→2, 2→1, 1→0, 0→0 */
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.d.ts","sourceRoot":"","sources":["../src/nodeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uBAAuB,IAAI,wBAAwB,EACnD,iBAAiB,IAAI,kBAAkB,EACvC,kBAAkB,IAAI,mBAAmB,EACzC,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACP,MAAM,SAAS,CAAA;AAEhB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAA;AACvF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,oDAAoD,CAAA;AACnG,OAAO,KAAK,EACV,uBAAuB,EACvB,mB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GAAG,CAAC,GACxF,CAAC,GACL,KAAK,CAAA;AAET,gDAAgD;AAChD,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;AAE7D;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,GAAG,qBAAqB,IAAI;IACtF,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;CACrB,GAAG,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAA;AAE5C;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACxB,sBAAsB,GAEtB,qBAAqB,GACrB,4BAA4B,GAC5B,uBAAuB,GACvB,kBAAkB,GAClB,sBAAsB,GACtB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,GACnB,0BAA0B,GAC1B,iBAAiB,GACjB,kBAAkB,GAClB,oBAAoB,CAAA;AAExB;;;GAGG;AACH,MAAM,MAAM,uBAAuB,CACjC,oBAAoB,SAAS,IAAI,GAAG,qBAAqB,GAAG,IAAI,IAC9D,CAAC,oBAAoB,CAAC,SAAS,IAAI,GACnC,gBAAgB,CAAC,gBAAgB,CAAC,GAClC,gBAAgB,CAAC,gBAAgB,GAAG,WAAW,CAAC,oBAAoB,CAAC,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"nodeTypes.js","names":[],"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedLineBreakNode as _SerializedLineBreakNode,\n SerializedTabNode as _SerializedTabNode,\n SerializedTextNode as _SerializedTextNode,\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/server/index.js'\nimport type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js'\nimport type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './features/experimental_table/server/index.js'\nimport type { SerializedHeadingNode } from './features/heading/server/index.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'\nimport type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js'\nimport type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js'\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\nexport type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> =\n Spread<\n {\n textFormat: number\n type: 'paragraph'\n },\n Omit<SerializedElementNode<T>, 'type'>\n >\nexport type SerializedTextNode = Omit<\n Spread<\n {\n type: 'text'\n },\n Omit<_SerializedTextNode, 'type'>\n >,\n 'children'\n>\n\nexport type SerializedTabNode = Omit<\n Spread<\n {\n type: 'tab'\n },\n Omit<_SerializedTabNode, 'type'>\n >,\n 'children'\n>\n\nexport type SerializedLineBreakNode = Omit<\n Spread<\n {\n type: 'linebreak'\n },\n Omit<_SerializedLineBreakNode, 'type'>\n >,\n 'children'\n>\n\n/**\n * Recursively adds typed children to nodes up to a specified depth.\n *\n * Key behaviors:\n * - `T extends any`: Distributive - processes each union member individually\n * - `OriginalUnion`: Preserves full union so nested children accept all node types, not just parent's type. If we just used `T`, the type would be narrowed to the parent's type and the children would only consist of the parent's type.\n * - `'children' extends keyof T`: Only adds children to container nodes; respects leaf nodes that use `Omit<_, 'children'>`\n * - `Depth`: Limits recursion to prevent infinite types (default: 4 levels)\n */\ntype RecursiveNodes<\n T extends SerializedLexicalNode,\n Depth extends number = 4,\n OriginalUnion extends SerializedLexicalNode = T,\n> = T extends any // Make distributive over unions\n ? Depth extends 0\n ? T\n : 'children' extends keyof T\n ? { children?: RecursiveNodes<OriginalUnion, DecrementDepth<Depth>, OriginalUnion>[] } & T\n : T // Skip leaf nodes\n : never\n\n/** Decrements depth: 4→3, 3→2, 2→1, 1→0, 0→0 */\ntype DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N]\n\n/**\n * Alternative type to `SerializedEditorState` that automatically types your nodes\n * more strictly, narrowing down nodes based on the `type` without having to manually\n * type-cast.\n */\nexport type TypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n [k: string]: unknown\n} & SerializedEditorState<RecursiveNodes<T>>\n\n/**\n * All node types included by default in a lexical editor without configuration.\n */\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * Like `TypedEditorState` but includes all default node types.\n * You can pass *additional* node types as a generic parameter.\n */\nexport type DefaultTypedEditorState<\n TAdditionalNodeTypes extends null | SerializedLexicalNode = null,\n> = [TAdditionalNodeTypes] extends null\n ? TypedEditorState<DefaultNodeTypes>\n : TypedEditorState<DefaultNodeTypes | NonNullable<TAdditionalNodeTypes>>\n"],"mappings":"AAoIA;;;GAIA","ignoreList":[]}
1
+ {"version":3,"file":"nodeTypes.js","names":[],"sources":["../src/nodeTypes.ts"],"sourcesContent":["import type {\n SerializedLineBreakNode as _SerializedLineBreakNode,\n SerializedTabNode as _SerializedTabNode,\n SerializedTextNode as _SerializedTextNode,\n SerializedEditorState,\n SerializedElementNode,\n SerializedLexicalNode,\n} from 'lexical'\n\nimport type { SerializedQuoteNode } from './features/blockquote/server/index.js'\nimport type { SerializedBlockNode } from './features/blocks/server/nodes/BlocksNode.js'\nimport type { SerializedInlineBlockNode } from './features/blocks/server/nodes/InlineBlocksNode.js'\nimport type {\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n} from './features/experimental_table/server/index.js'\nimport type { SerializedHeadingNode } from './features/heading/server/index.js'\nimport type { SerializedHorizontalRuleNode } from './features/horizontalRule/server/nodes/HorizontalRuleNode.js'\nimport type { SerializedAutoLinkNode, SerializedLinkNode } from './features/link/nodes/types.js'\nimport type { SerializedListItemNode, SerializedListNode } from './features/lists/plugin/index.js'\nimport type { SerializedRelationshipNode } from './features/relationship/server/nodes/RelationshipNode.js'\nimport type { SerializedUploadNode } from './features/upload/server/nodes/UploadNode.js'\n\n/**\n * Helper type to create strongly typed serialized nodes with flexible children types.\n * Omits 'children' and 'type' from the base node type and redeclares them with proper typing.\n *\n * @param TBase - The base Lexical node type (e.g., _SerializedHeadingNode)\n * @param TType - The node type string (e.g., 'heading')\n * @param TChildren - The type for children (defaults to SerializedLexicalNode)\n */\nexport type StronglyTypedElementNode<\n TBase,\n TType extends string,\n TChildren extends SerializedLexicalNode = SerializedLexicalNode,\n> = {\n children: TChildren[]\n type: TType\n} & Omit<TBase, 'children' | 'type'>\n\n/**\n * Helper type to create strongly typed leaf nodes (nodes without children).\n * Omits 'children' and 'type' from the base node type and redeclares 'type' with a literal.\n *\n * @param TBase - The base Lexical node type (e.g., _SerializedTextNode)\n * @param TType - The node type string (e.g., 'text')\n */\nexport type StronglyTypedLeafNode<TBase, TType extends string> = {\n type: TType\n} & Omit<TBase, 'children' | 'type'>\n\nexport type {\n SerializedAutoLinkNode,\n SerializedBlockNode,\n SerializedHeadingNode,\n SerializedHorizontalRuleNode,\n SerializedInlineBlockNode,\n SerializedLinkNode,\n SerializedListItemNode,\n SerializedListNode,\n SerializedQuoteNode,\n SerializedRelationshipNode,\n SerializedTableCellNode,\n SerializedTableNode,\n SerializedTableRowNode,\n SerializedUploadNode,\n}\n\nexport type SerializedParagraphNode<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n textFormat: number\n} & StronglyTypedElementNode<SerializedElementNode, 'paragraph', T>\n\nexport type SerializedTextNode = StronglyTypedLeafNode<_SerializedTextNode, 'text'>\n\nexport type SerializedTabNode = StronglyTypedLeafNode<_SerializedTabNode, 'tab'>\n\nexport type SerializedLineBreakNode = StronglyTypedLeafNode<_SerializedLineBreakNode, 'linebreak'>\n\n/**\n * Recursively adds typed children to nodes up to a specified depth.\n *\n * Key behaviors:\n * - `T extends any`: Distributive - processes each union member individually\n * - `OriginalUnion`: Preserves full union so nested children accept all node types, not just parent's type. If we just used `T`, the type would be narrowed to the parent's type and the children would only consist of the parent's type.\n * - `'children' extends keyof T`: Only adds children to container nodes; respects leaf nodes that use `Omit<_, 'children'>`\n * - `Depth`: Limits recursion to prevent infinite types (default: 4 levels)\n *\n * @internal - this type may change or be removed in a minor release\n */\nexport type RecursiveNodes<\n T extends SerializedLexicalNode,\n Depth extends number = 4,\n OriginalUnion extends SerializedLexicalNode = T,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n> = T extends any // Make distributive over unions\n ? Depth extends 0\n ? T\n : 'children' extends keyof T\n ? { children?: RecursiveNodes<OriginalUnion, DecrementDepth<Depth>, OriginalUnion>[] } & T\n : T // Skip leaf nodes\n : never\n\n/** Decrements depth: 4→3, 3→2, 2→1, 1→0, 0→0 */\ntype DecrementDepth<N extends number> = [0, 0, 1, 2, 3, 4][N]\n\n/**\n * Alternative type to `SerializedEditorState` that automatically types your nodes\n * more strictly, narrowing down nodes based on the `type` without having to manually\n * type-cast.\n */\nexport type TypedEditorState<T extends SerializedLexicalNode = SerializedLexicalNode> = {\n [k: string]: unknown\n} & SerializedEditorState<RecursiveNodes<T>>\n\n/**\n * All node types included by default in a lexical editor without configuration.\n */\nexport type DefaultNodeTypes =\n | SerializedAutoLinkNode\n //| SerializedBlockNode // Not included by default\n | SerializedHeadingNode\n | SerializedHorizontalRuleNode\n | SerializedLineBreakNode\n | SerializedLinkNode\n | SerializedListItemNode\n | SerializedListNode\n | SerializedParagraphNode\n | SerializedQuoteNode\n | SerializedRelationshipNode\n | SerializedTabNode\n | SerializedTextNode\n | SerializedUploadNode\n\n/**\n * Like `TypedEditorState` but includes all default node types.\n * You can pass *additional* node types as a generic parameter.\n */\nexport type DefaultTypedEditorState<\n TAdditionalNodeTypes extends null | SerializedLexicalNode = null,\n> = [TAdditionalNodeTypes] extends null\n ? TypedEditorState<DefaultNodeTypes>\n : TypedEditorState<DefaultNodeTypes | NonNullable<TAdditionalNodeTypes>>\n"],"mappings":"AAsIA;;;GAIA","ignoreList":[]}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical';
2
- import type { ClientField, DefaultServerCellComponentProps, LabelFunction, RichTextAdapter, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
2
+ import type { ClientField, DefaultServerCellComponentProps, LabelFunction, RichTextAdapter, RichTextField, RichTextFieldClient, RichTextFieldClientProps, SanitizedConfig, ServerFieldBase, StaticLabel } from 'payload';
3
3
  import type { BaseClientFeatureProps, FeatureProviderProviderClient } from './features/typesClient.js';
4
4
  import type { FeatureProviderServer } from './features/typesServer.js';
5
5
  import type { SanitizedServerEditorConfig } from './lexical/config/types.js';
@@ -101,4 +101,5 @@ export type GeneratedFeatureProviderComponent = {
101
101
  clientFeature: FeatureProviderProviderClient<any, any>;
102
102
  clientFeatureProps: BaseClientFeatureProps<object>;
103
103
  };
104
+ export type LexicalRichTextField = RichTextField<SerializedEditorState, AdapterProps>;
104
105
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src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AAkB,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 { EditorConfig as LexicalEditorConfig, SerializedEditorState } from 'lexical'\nimport type {\n ClientField,\n DefaultServerCellComponentProps,\n LabelFunction,\n RichTextAdapter,\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?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\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"],"mappings":"AA0IA","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?: object\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\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":"AAgJA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"buildEditorState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAA2B,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,EAAE,EAChE,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAwCtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAC1C,CAAA"}
1
+ {"version":3,"file":"buildEditorState.d.ts","sourceRoot":"","sources":["../../src/utilities/buildEditorState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAA2B,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAElG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,qBAAqB,EAAE,EAChE,KAAK,EACL,IAAI,GACL,EAAE;IACD,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAA;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAyCtB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB,EAAE,OAAO,gBAAgB,CAAC,gBAAgB,CAC1C,CAAA"}
@@ -69,6 +69,7 @@
69
69
  });
70
70
  }
71
71
  if (nodes?.length) {
72
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
72
73
  editorJSON.root.children.push(...nodes);
73
74
  }
74
75
  return editorJSON;
@@ -1 +1 @@
1
- {"version":3,"file":"buildEditorState.js","names":["buildEditorState","nodes","text","editorJSON","root","type","children","direction","format","indent","version","push","detail","mode","style","textFormat","textStyle","length","buildDefaultEditorState"],"sources":["../../src/utilities/buildEditorState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { DefaultNodeTypes, DefaultTypedEditorState, TypedEditorState } from '../nodeTypes.js'\n\n/**\n * Helper to build lexical editor state JSON from text and/or nodes.\n *\n * @param nodes - The nodes to include in the editor state. If you pass the `text` argument, this will append your nodes after the first paragraph node.\n * @param text - The text content to include in the editor state. This will create a paragraph node with a text node for you and set that as the first node.\n * @returns The constructed editor state JSON.\n *\n * @example\n *\n * just passing text:\n *\n * ```ts\n * const editorState = buildEditorState<DefaultNodeTypes>({ text: 'Hello world' }) // result typed as DefaultTypedEditorState\n * ```\n *\n * @example\n *\n * passing nodes:\n *\n * ```ts\n * const editorState = // result typed as TypedEditorState<DefaultNodeTypes | SerializedBlockNode> (or TypedEditorState<SerializedBlockNode>)\n * buildEditorState<DefaultNodeTypes | SerializedBlockNode>({ // or just buildEditorState<SerializedBlockNode> if you *only* want to allow block nodes\n * nodes: [\n * {\n * type: 'block',\n * fields: {\n * id: 'id',\n * blockName: 'Cool block',\n * blockType: 'myBlock',\n * },\n * format: 'left',\n * version: 1,\n * }\n * ],\n * })\n * ```\n */\nexport function buildEditorState<T extends SerializedLexicalNode>({\n nodes,\n text,\n}: {\n nodes?: TypedEditorState<T>['root']['children']\n text?: string\n}): TypedEditorState<T> {\n const editorJSON: DefaultTypedEditorState = {\n root: {\n type: 'root',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n\n if (text) {\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n if (nodes?.length) {\n editorJSON.root.children.push(...(nodes as any))\n }\n\n return editorJSON as TypedEditorState<T>\n}\n\n/**\n *\n * Alias for `buildEditorState<DefaultNodeTypes>`\n *\n * @experimental this API may change or be removed in a minor release\n * @internal\n */\nexport const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes> =\n buildEditorState<DefaultNodeTypes>\n"],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCA,OAAO,SAASA,iBAAkD;EAChEC,KAAK;EACLC;AAAI,CAIL;EACC,MAAMC,UAAA,GAAsC;IAC1CC,IAAA,EAAM;MACJC,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRC,OAAA,EAAS;IACX;EACF;EAEA,IAAIR,IAAA,EAAM;IACRC,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,CACR;QACED,IAAA,EAAM;QACNO,MAAA,EAAQ;QACRJ,MAAA,EAAQ;QACRK,IAAA,EAAM;QACNC,KAAA,EAAO;QACPZ,IAAA;QACAQ,OAAA,EAAS;MACX,EACD;MACDH,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,IAAIT,KAAA,EAAOgB,MAAA,EAAQ;IACjBd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,IAAKV,KAAA;EACpC;EAEA,OAAOE,UAAA;AACT;AAEA;;;;;;;AAOA,OAAO,MAAMe,uBAAA,GACXlB,gBAAA","ignoreList":[]}
1
+ {"version":3,"file":"buildEditorState.js","names":["buildEditorState","nodes","text","editorJSON","root","type","children","direction","format","indent","version","push","detail","mode","style","textFormat","textStyle","length","buildDefaultEditorState"],"sources":["../../src/utilities/buildEditorState.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type { DefaultNodeTypes, DefaultTypedEditorState, TypedEditorState } from '../nodeTypes.js'\n\n/**\n * Helper to build lexical editor state JSON from text and/or nodes.\n *\n * @param nodes - The nodes to include in the editor state. If you pass the `text` argument, this will append your nodes after the first paragraph node.\n * @param text - The text content to include in the editor state. This will create a paragraph node with a text node for you and set that as the first node.\n * @returns The constructed editor state JSON.\n *\n * @example\n *\n * just passing text:\n *\n * ```ts\n * const editorState = buildEditorState<DefaultNodeTypes>({ text: 'Hello world' }) // result typed as DefaultTypedEditorState\n * ```\n *\n * @example\n *\n * passing nodes:\n *\n * ```ts\n * const editorState = // result typed as TypedEditorState<DefaultNodeTypes | SerializedBlockNode> (or TypedEditorState<SerializedBlockNode>)\n * buildEditorState<DefaultNodeTypes | SerializedBlockNode>({ // or just buildEditorState<SerializedBlockNode> if you *only* want to allow block nodes\n * nodes: [\n * {\n * type: 'block',\n * fields: {\n * id: 'id',\n * blockName: 'Cool block',\n * blockType: 'myBlock',\n * },\n * format: 'left',\n * version: 1,\n * }\n * ],\n * })\n * ```\n */\nexport function buildEditorState<T extends SerializedLexicalNode>({\n nodes,\n text,\n}: {\n nodes?: TypedEditorState<T>['root']['children']\n text?: string\n}): TypedEditorState<T> {\n const editorJSON: DefaultTypedEditorState = {\n root: {\n type: 'root',\n children: [],\n direction: 'ltr',\n format: '',\n indent: 0,\n version: 1,\n },\n }\n\n if (text) {\n editorJSON.root.children.push({\n type: 'paragraph',\n children: [\n {\n type: 'text',\n detail: 0,\n format: 0,\n mode: 'normal',\n style: '',\n text,\n version: 1,\n },\n ],\n direction: 'ltr',\n format: '',\n indent: 0,\n textFormat: 0,\n textStyle: '',\n version: 1,\n })\n }\n\n if (nodes?.length) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorJSON.root.children.push(...(nodes as any))\n }\n\n return editorJSON as TypedEditorState<T>\n}\n\n/**\n *\n * Alias for `buildEditorState<DefaultNodeTypes>`\n *\n * @experimental this API may change or be removed in a minor release\n * @internal\n */\nexport const buildDefaultEditorState: typeof buildEditorState<DefaultNodeTypes> =\n buildEditorState<DefaultNodeTypes>\n"],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCA,OAAO,SAASA,iBAAkD;EAChEC,KAAK;EACLC;AAAI,CAIL;EACC,MAAMC,UAAA,GAAsC;IAC1CC,IAAA,EAAM;MACJC,IAAA,EAAM;MACNC,QAAA,EAAU,EAAE;MACZC,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRC,OAAA,EAAS;IACX;EACF;EAEA,IAAIR,IAAA,EAAM;IACRC,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,CAAC;MAC5BN,IAAA,EAAM;MACNC,QAAA,EAAU,CACR;QACED,IAAA,EAAM;QACNO,MAAA,EAAQ;QACRJ,MAAA,EAAQ;QACRK,IAAA,EAAM;QACNC,KAAA,EAAO;QACPZ,IAAA;QACAQ,OAAA,EAAS;MACX,EACD;MACDH,SAAA,EAAW;MACXC,MAAA,EAAQ;MACRC,MAAA,EAAQ;MACRM,UAAA,EAAY;MACZC,SAAA,EAAW;MACXN,OAAA,EAAS;IACX;EACF;EAEA,IAAIT,KAAA,EAAOgB,MAAA,EAAQ;IACjB;IACAd,UAAA,CAAWC,IAAI,CAACE,QAAQ,CAACK,IAAI,IAAKV,KAAA;EACpC;EAEA,OAAOE,UAAA;AACT;AAEA;;;;;;;AAOA,OAAO,MAAMe,uBAAA,GACXlB,gBAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.60.0-internal.8e20fed",
3
+ "version": "3.60.0-internal.c130254",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -348,6 +348,7 @@
348
348
  ]
349
349
  },
350
350
  "dependencies": {
351
+ "@lexical/clipboard": "0.35.0",
351
352
  "@lexical/headless": "0.35.0",
352
353
  "@lexical/html": "0.35.0",
353
354
  "@lexical/link": "0.35.0",
@@ -373,8 +374,8 @@
373
374
  "react-error-boundary": "4.1.2",
374
375
  "ts-essentials": "10.0.3",
375
376
  "uuid": "10.0.0",
376
- "@payloadcms/translations": "3.60.0-internal.8e20fed",
377
- "@payloadcms/ui": "3.60.0-internal.8e20fed"
377
+ "@payloadcms/ui": "3.60.0-internal.c130254",
378
+ "@payloadcms/translations": "3.60.0-internal.c130254"
378
379
  },
379
380
  "devDependencies": {
380
381
  "@babel/cli": "7.27.2",
@@ -393,16 +394,16 @@
393
394
  "esbuild": "0.25.5",
394
395
  "esbuild-sass-plugin": "3.3.1",
395
396
  "swc-plugin-transform-remove-imports": "4.0.4",
396
- "payload": "3.60.0-internal.8e20fed",
397
- "@payloadcms/eslint-config": "3.28.0"
397
+ "@payloadcms/eslint-config": "3.28.0",
398
+ "payload": "3.60.0-internal.c130254"
398
399
  },
399
400
  "peerDependencies": {
400
401
  "@faceless-ui/modal": "3.0.0",
401
402
  "@faceless-ui/scroll-info": "2.0.0",
402
403
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
403
404
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
404
- "@payloadcms/next": "3.60.0-internal.8e20fed",
405
- "payload": "3.60.0-internal.8e20fed"
405
+ "@payloadcms/next": "3.60.0-internal.c130254",
406
+ "payload": "3.60.0-internal.c130254"
406
407
  },
407
408
  "engines": {
408
409
  "node": "^18.20.2 || >=20.9.0"
@@ -1,2 +0,0 @@
1
- "use client";import{a as ke,e as we,f as _,h as ve,i as Te,j as De,k as Le,l as Me}from"./chunk-TLQLXR6Q.js";import{a as Re,b as R}from"./chunk-BZZVLW4U.js";import{jsx as F,jsxs as ge}from"react/jsx-runtime";import{FieldDescription as En,FieldError as Cn,FieldLabel as bn,RenderCustomComponent as Et,useEditDepth as Nn,useEffectEvent as Pn,useField as Sn}from"@payloadcms/ui";import{mergeFieldStyles as Rn}from"@payloadcms/ui/shared";import{dequal as kn}from"dequal/lite";import Ct,{useCallback as bt,useEffect as Nt,useMemo as wn,useState as Pt}from"react";import{ErrorBoundary as vn}from"react-error-boundary";import"./bundled.css";import{jsx as O}from"react/jsx-runtime";import{LexicalComposer as hn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as yn}from"@payloadcms/ui";import*as ht from"react";import{useMemo as xn}from"react";import{c as Zo}from"react/compiler-runtime";import{jsx as E,jsxs as te}from"react/jsx-runtime";import{useLexicalComposerContext as en}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as tn}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as on}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as nn}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as rn}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as sn}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as ln,COMMAND_PRIORITY_LOW as pt,FOCUS_COMMAND as an}from"lexical";import*as q from"react";import{useEffect as cn,useState as un}from"react";import{jsx as Ae}from"react/jsx-runtime";import"react";var $=({anchorElem:t,clientProps:e,plugin:o})=>o.position==="floatingAnchorElem"&&t?o.Component&&Ae(o.Component,{anchorElem:t,clientProps:e}):o.Component&&Ae(o.Component,{clientProps:e});import{c as kt}from"react/compiler-runtime";import{useLexicalComposerContext as wt}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as ne,mergeRegister as vt}from"@lexical/utils";import{$createNodeSelection as Tt,$getEditor as X,$getNearestNodeFromDOMNode as Dt,$getSelection as re,$isDecoratorNode as K,$isElementNode as xe,$isLineBreakNode as Lt,$isNodeSelection as ie,$isRangeSelection as Be,$isRootOrShadowRoot as Mt,$isTextNode as At,$setSelection as Ie,CLICK_COMMAND as Bt,COMMAND_PRIORITY_LOW as W,KEY_ARROW_DOWN_COMMAND as It,KEY_ARROW_UP_COMMAND as _t,KEY_BACKSPACE_COMMAND as Ot,KEY_DELETE_COMMAND as Ft,SELECTION_CHANGE_COMMAND as $t}from"lexical";import{useEffect as Kt}from"react";function _e(){let t=kt(3),[e]=wt(),o=Gt,n,r;return t[0]!==e?(n=()=>vt(e.registerCommand(Bt,Vt,W),e.registerCommand(Ft,o,W),e.registerCommand(Ot,o,W),e.registerCommand($t,Yt,W),e.registerCommand(_t,zt,W),e.registerCommand(It,Ht,W)),r=[e],t[0]=e,t[1]=n,t[2]=r):(n=t[1],r=t[2]),Kt(n,r),null}function Ht(t){let e=re();if(ie(e)){t.preventDefault();let s=e.getNodes()[0]?.getNextSibling();if(K(s)){let m=X().getElementByKey(s.getKey());return m&&Z({element:m,node:s}),!0}if(!xe(s))return!0;let a=s.getFirstDescendant()??s;return a&&(ne(a,se)?.selectEnd(),t.preventDefault()),!0}if(!Be(e))return!1;let n=(e.isBackward()?e.anchor:e.focus).getNode(),r=ne(n,jt),c=r?.getNextSibling();if(!r||c!==Oe(r))return!1;if(K(c)){let s=X().getElementByKey(c.getKey());if(s)return Z({element:s,node:c}),t.preventDefault(),!0}return!1}function jt(t){return Oe(t)!==null}function zt(t){let e=re();if(ie(e)){let s=e.getNodes()[0]?.getPreviousSibling();if(K(s)){let m=X().getElementByKey(s.getKey());return m?(Z({element:m,node:s}),t.preventDefault(),!0):!1}if(!xe(s))return!1;let a=s.getLastDescendant()??s;return a?(ne(a,se)?.selectStart(),t.preventDefault(),!0):!1}if(!Be(e))return!1;let n=(e.isBackward()?e.anchor:e.focus).getNode(),r=ne(n,Wt),c=r?.getPreviousSibling();if(!r||c!==Fe(r))return!1;if(K(c)){let s=X().getElementByKey(c.getKey());if(s)return Z({element:s,node:c}),t.preventDefault(),!0}return!1}function Wt(t){return Fe(t)!==null}function Yt(){let t=Jt();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),t?(t.element?.classList.add("decorator-selected"),!0):!1}function Vt(t){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let e=qt(t);if(!e)return!0;let{target:o}=t;return!(o instanceof HTMLElement)||o.isContentEditable||o.closest('button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role="button"]')?Ie(null):Z(e),!0}function Gt(t){let e=re();return ie(e)?(t.preventDefault(),e.getNodes().forEach(Ut),!0):!1}function Ut(t){t.remove()}function qt(t){if(!(t.target instanceof HTMLElement))return;let e=t.target.closest('[data-lexical-decorator="true"]');if(!(e instanceof HTMLElement))return;let o=Dt(e);return K(o)?{element:e,node:o}:void 0}function Jt(){let t=re();if(!ie(t))return;let e=t.getNodes();if(e.length!==1)return;let o=e[0];return K(o)?{decorator:o,element:X().getElementByKey(o.getKey())}:void 0}function Z({element:t,node:e}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=Tt();o.add(e.getKey()),Ie(o),t.scrollIntoView({behavior:"smooth",block:"nearest"}),t.classList.add("decorator-selected")}function se(t){if(K(t)&&!t.isInline())return!0;if(!xe(t)||Mt(t))return!1;let e=t.getFirstChild(),o=e===null||Lt(e)||At(e)||e.isInline();return!t.isInline()&&t.canBeEmpty()!==!1&&o}function Oe(t){let e=t.getNextSibling();for(;e!==null;){if(se(e))return e;e=e.getNextSibling()}return null}function Fe(t){let e=t.getPreviousSibling();for(;e!==null;){if(se(e))return e;e=e.getPreviousSibling()}return null}import{jsx as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as oo}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as no,isHTMLElement as ro}from"lexical";import*as je from"react";import{useCallback as io,useEffect as He,useRef as so,useState as lo}from"react";import{createPortal as ao}from"react-dom";var Y=(t,e,o,n,r=50,c=25)=>{let s=0;if(t&&!t.contains(n)){let{bottom:a,left:u,right:m,top:y}=t.getBoundingClientRect(),i=y+window.scrollY,l=a+window.scrollY;if(o<i-c||o>l+c||e<u-r||e>m+r)return-1;(e<u||e>m)&&(s=e<u?e-u:e-m)}return s};import{$getNodeByKey as ae}from"lexical";function V(t){let e=t.getBoundingClientRect(),o=getComputedStyle(t).getPropertyValue("transform");if(!o||o==="none")return e;let n=o.split(",").pop();return e.y=e.y-Number(n?.replace(")","")),e}function le(t){let e=(u,m)=>u?parseFloat(window.getComputedStyle(u)[m]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(t),r=e(t.previousElementSibling,"marginBottom"),c=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),c),marginTop:s}}import{$getRoot as Qt}from"lexical";function H(t){return t.getEditorState().read(()=>Qt().getChildrenKeys())}var Xt=1,Zt=-1,$e=0,A={props:null,result:null};function eo(t,e,o=20){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=o*o}function G(t){let{anchorElem:e,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:c=0,point:{x:s,y:a},startIndex:u=0,useEdgeAsDefault:m=!1}=t;if(o>0&&A.props&&A.result&&A.props.fuzzy===t.fuzzy&&A.props.horizontalOffset===t.horizontalOffset&&A.props.useEdgeAsDefault===t.useEdgeAsDefault&&eo(A.props.point,t.point,o))return A.result;let y=e.getBoundingClientRect(),i=H(n),l={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(m){let g=n.getElementByKey(i[0]),d=n.getElementByKey(i[i.length-1]);if(g&&d){let[p,f]=[V(g),V(d)];if(a<p.top?(l.blockElem=g,l.distance=p.top-a,l.blockNode=ae(i[0]),l.foundAtIndex=0):a>f.bottom&&(l.distance=a-f.bottom,l.blockNode=ae(i[i.length-1]),l.blockElem=d,l.foundAtIndex=i.length-1),l?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let h=u,x=$e;for(;h>=0&&h<i.length;){let g=i[h],d=n.getElementByKey(g);if(d===null)break;let p=new _(s+c,a),f=Le.fromDOMRect(V(d)),{marginBottom:C,marginTop:w}=le(d),S=f.generateNewRect({bottom:f.bottom+C,left:y.left,right:y.right,top:f.top-w}),{distance:b,isOnBottomSide:k,isOnTopSide:N}=S.distanceFromPoint(p);if(b===0){l.blockElem=d,l.blockNode=ae(g),l.foundAtIndex=h,l.distance=b,l.blockNode&&l.blockNode.getType()==="paragraph"&&l.blockNode.getTextContent()===""&&(!r&&!t.returnEmptyParagraphs&&(l.blockElem=null,l.blockNode=null),l.isFoundNodeEmptyParagraph=!0);break}else r&&b<l.distance&&(l.blockElem=d,l.blockNode=ae(g),l.distance=b,l.foundAtIndex=h);x===$e&&(N?x=Zt:k?x=Xt:x=1/0),h+=x}}),A.props=t,A.result={blockElem:l.blockElem,blockNode:l.blockNode,foundAtIndex:l.foundAtIndex,isFoundNodeEmptyParagraph:l.isFoundNodeEmptyParagraph},{blockElem:l.blockElem,blockNode:l.blockNode,foundAtIndex:l.foundAtIndex,isFoundNodeEmptyParagraph:l.isFoundNodeEmptyParagraph}}function ce(t,e){return!!t.closest(`.${e}`)}var to=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Ke(t){if(!t||to.includes(t.tagName)||t.offsetHeight===0||t.offsetWidth===0)return!1;let e=window.getComputedStyle(t);return!(e.display==="table-cell"||e.position==="absolute"||e.visibility==="hidden"||e.opacity==="0")}function ue(t,e,o,n=0){if(!t){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let r=t.getBoundingClientRect(),c=window.getComputedStyle(t),s=e.getBoundingClientRect(),a=o.getBoundingClientRect(),u;if(["lexical-block","lexical-upload","lexical-relationship"].some(i=>t.firstElementChild?.classList.contains(i)))u=r.top+8-a.top;else{let i=Ke(t)?parseInt(c.lineHeight,10):0;u=r.top+(i-s.height)/2-a.top}let y=n;e.style.opacity="1",e.style.transform=`translate(${y}px, ${u}px)`}var co="add-block-menu",de=1/0;function uo(t){return t===0?1/0:de>=0&&de<t?de:Math.floor(t/2)}function mo(t,e,o){let n=e.parentElement,{editorConfig:r}=R(),c=r?.admin?.hideGutter?-24:12,s=so(null),[a,u]=lo(null);He(()=>{function y(i){let l=i.target;if(!ro(l))return;let h=Y(n,i.pageX,i.pageY,l);if(h===-1){u(null);return}if(ce(l,co))return;let x=H(t),{blockElem:g,blockNode:d,foundAtIndex:p}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-h,point:new _(i.x,i.y),returnEmptyParagraphs:!0,startIndex:uo(x.length),useEdgeAsDefault:!1});de=p,g&&d&&(a?.node!==d||a?.elem!==g)&&u({elem:g,node:d})}return document?.addEventListener("mousemove",y),()=>{document?.removeEventListener("mousemove",y)}},[n,e,t,a]),He(()=>{s.current&&a?.node&&ue(a?.elem,s.current,e,c)},[e,a,c]);let m=io(y=>{let i=a;i?.node&&(t.update(()=>{let l=!0;if((i?.node.getType()!=="paragraph"||i.node.getTextContent()!=="")&&(l=!1),!l){let h=no();i?.node.insertAfter(h),setTimeout(()=>{i={elem:t.getElementByKey(h.getKey()),node:h},u(i)},0)}}),setTimeout(()=>{t.update(()=>{t.focus(),i?.node&&"select"in i.node&&typeof i.node.select=="function"&&i.node.select()})},1),setTimeout(()=>{t.dispatchCommand(Te,{node:i?.node})},2),y.stopPropagation(),y.preventDefault())},[t,a]);return ao(Ee(je.Fragment,{children:Ee("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:y=>{m(y)},ref:s,type:"button",children:Ee("div",{className:o?"icon":""})})}),e)}function ze(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=oo();return mo(n,o,n._editable)}import{jsx as me,jsxs as po}from"react/jsx-runtime";import{useLexicalComposerContext as go}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as Ve}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as Ge,$getNodeByKey as ho,isHTMLElement as Ce}from"lexical";import*as Xe from"react";import{useEffect as be,useRef as fe,useState as Ue}from"react";import{createPortal as yo}from"react-dom";var We=0,fo=-24;var j=0;function Ye(t,e,o,n,r,c,s,a,u,m=!1){let{height:y,top:i}=n.getBoundingClientRect(),{top:l,width:h}=s.getBoundingClientRect(),{marginBottom:x,marginTop:g}=le(n),d=i,p=c>=i+y/2+window.scrollY,f=!1;if(r?.elem)if(n!==r?.elem)(p&&r?.elem&&r?.elem===n.nextElementSibling||!p&&r?.elem&&r?.elem===n.previousElementSibling)&&(j++,j<200&&(f=!0));else{j++;let b=r?.boundingBox?.y,k=n.getBoundingClientRect().y;(p===r?.isBelow&&b===k||j<200)&&(f=!1)}if(f)return{isBelow:p,willStayInSamePosition:f};m?d+=y/2:p?d+=y+x/2:d-=g/2;let C=0;m||(p?C=-We:C=We);let w=d-l+C,S=fo-e;return o.style.width=`calc(${h}px - ${t})`,o.style.opacity=".8",o.style.transform=`translate(${S}px, calc(${w}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?p?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),j=0,{isBelow:p,willStayInSamePosition:f}}var xo="draggable-block-menu",qe="application/x-lexical-drag-block",ee=1/0;function Je(t){return t===0?1/0:ee>=0&&ee<t?ee:Math.floor(t/2)}function Eo(t,e){let{transform:o}=e.style;t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=o})}function Qe(t,e){t&&(t.style.opacity="0"),e&&(e.style.opacity="",e.style.marginBottom="",e.style.marginTop="")}function Co(t,e,o){let n=e.parentElement,r=fe(null),c=fe(null),s=fe(null),a=fe(!1),[u,m]=Ue(null),[y,i]=Ue(null),{editorConfig:l}=R(),h=l?.admin?.hideGutter?-44:-8;be(()=>{function d(p){let f=p.target;if(!Ce(f))return;let C=Y(n,p.pageX,p.pageY,f);if(C===-1){m(null);return}if(ce(f,xo))return;let w=H(t),{blockElem:S,foundAtIndex:b,isFoundNodeEmptyParagraph:k}=G({anchorElem:e,cache_threshold:0,editor:t,horizontalOffset:-C,point:new _(p.x,p.y),startIndex:Je(w.length),useEdgeAsDefault:!1,verbose:!1});ee=b,!(!S&&!k)&&u!==S&&m(S)}return document?.addEventListener("mousemove",d),()=>{document?.removeEventListener("mousemove",d)}},[n,e,t,u]),be(()=>{r.current&&ue(u,r.current,e,h)},[e,u,h]),be(()=>{function d(f){if(!a.current)return!1;let[C]=Ve(f);if(C)return!1;let{pageY:w,target:S}=f;if(!Ce(S))return!1;let b=Y(n,f.pageX,f.pageY,S,100,50),k=H(t),{blockElem:N,foundAtIndex:L,isFoundNodeEmptyParagraph:I}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-b,point:new _(f.x,f.y),startIndex:Je(k.length),useEdgeAsDefault:!0,verbose:!0});ee=L;let v=c.current;if(N===null||v===null)return!1;if(u!==N){let{isBelow:T,willStayInSamePosition:J}=Ye(l?.admin?.hideGutter?"0px":"3rem",h+(l?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),v,N,y,w,e,f,s,I);f.preventDefault(),J||i({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:T})}else y?.elem&&(Qe(v,y.elem),i({boundingBox:N.getBoundingClientRect(),elem:N,isBelow:!1}));return!0}function p(f){if(!a.current)return!1;let[C]=Ve(f);if(C)return!1;let{dataTransfer:w,pageY:S,target:b}=f,k=w?.getData(qe)||"";return t.update(()=>{let N=ho(k);if(!N||!Ce(b))return!1;let L=Y(n,f.pageX,f.pageY,b,100,50),{blockElem:I,isFoundNodeEmptyParagraph:v}=G({anchorElem:e,editor:t,fuzzy:!0,horizontalOffset:-L,point:new _(f.x,f.y),useEdgeAsDefault:!0});if(!I)return!1;let T=Ge(I);if(!T)return!1;if(T===N)return!0;let{height:J,top:he}=V(I),z=S>=he+J/2+window.scrollY;v?(T.insertBefore(N),T.remove()):z?T.insertAfter(N):T.insertBefore(N),u!==null&&m(null),document.querySelectorAll(".lexical-block-highlighter").forEach(D=>{D.remove()});let oe=t.getElementByKey(N.getKey());setTimeout(()=>{let D=oe?.getBoundingClientRect();if(!D)return;let P=document.createElement("div");P.className="lexical-block-highlighter",P.style.backgroundColor="var(--theme-elevation-1000",P.style.transition="opacity 0.5s ease-in-out",P.style.zIndex="1",P.style.pointerEvents="none",P.style.boxSizing="border-box",P.style.borderRadius="4px",P.style.position="absolute",document.body.appendChild(P),P.style.opacity="0.1",P.style.height=`${D.height+8}px`,P.style.width=`${D.width+8}px`,P.style.top=`${D.top+window.scrollY-4}px`,P.style.left=`${D.left-4}px`,setTimeout(()=>{P.style.opacity="0",setTimeout(()=>{P.remove()},500)},1e3)},120)}),!0}return document.addEventListener("dragover",d),document.addEventListener("drop",p),()=>{document.removeEventListener("dragover",d),document.removeEventListener("drop",p)}},[n,h,e,t,y,u,l?.admin?.hideGutter]);function x(d){let p=d.dataTransfer;if(!p||!u)return;Eo(p,u);let f="";t.update(()=>{let C=Ge(u);C&&(f=C.getKey())}),a.current=!0,p.setData(qe,f)}function g(){a.current=!1,y?.elem&&Qe(c.current,y?.elem)}return yo(po(Xe.Fragment,{children:[me("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:g,onDragStart:x,ref:r,type:"button",children:me("div",{className:o?"icon":""})}),me("div",{className:"draggable-block-target-line",ref:c}),me("div",{className:"debug-highlight",ref:s})]}),e)}function Ze(t){let{anchorElem:e}=t,o=e===void 0?document.body:e,[n]=go();return Co(n,o,n._editable)}import{c as bo}from"react/compiler-runtime";import{jsx as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as No}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Po,$getRoot as So}from"lexical";import"react";var et="insert-paragraph-at-end",tt=()=>{let t=bo(2),[e]=No(),{editorConfig:o}=R();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return t[0]!==e?(n=Ne("div",{"aria-label":"Insert Paragraph",className:et,onClick:()=>{e.update(Ro)},role:"button",tabIndex:0,children:Ne("div",{className:`${et}-inside`,children:Ne("span",{children:"+"})})}),t[0]=e,t[1]=n):n=t[1],n};function Ro(){let t=Po();So().append(t),t.select()}import{c as ko}from"react/compiler-runtime";import{useLexicalComposerContext as wo}from"@lexical/react/LexicalComposerContext";import*as ot from"react";var nt=()=>{let t=ko(4),{editorConfig:e}=R(),[o]=wo(),n,r;return t[0]!==o||t[1]!==e.features.markdownTransformers?(n=()=>ke(o,e.features.markdownTransformers??[]),r=[o,e.features.markdownTransformers],t[0]=o,t[1]=e.features.markdownTransformers,t[2]=n,t[3]=r):(n=t[2],r=t[3]),ot.useEffect(n,r),null};import{useLexicalComposerContext as vo}from"@lexical/react/LexicalComposerContext";import{$getSelection as To,$isRangeSelection as Do,RootNode as Lo}from"lexical";import{useEffect as Mo}from"react";function rt(){let[t]=vo();return Mo(()=>t.registerNodeTransform(Lo,e=>{let o=To();if(Do(o)){let n=o.anchor.getNode(),r=o.focus.getNode();(!n.isAttached()||!r.isAttached())&&(e.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}),[t]),null}import{useLexicalComposerContext as Ao}from"@lexical/react/LexicalComposerContext";import{$getSelection as Bo,COMMAND_PRIORITY_LOW as Io,SELECT_ALL_COMMAND as _o}from"lexical";import{useEffect as Oo}from"react";function it(){let[t]=Ao();return Oo(()=>t.registerCommand(_o,()=>{if(Bo())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},Io),[t]),null}import{jsx as U,jsxs as lt}from"react/jsx-runtime";import{useLexicalComposerContext as $o}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as at}from"@payloadcms/ui";import{useCallback as Ko,useMemo as Ho,useState as jo}from"react";import"react";import*as ct from"react-dom";import{c as Fo}from"react/compiler-runtime";import"react";function st(t,e){let o=Fo(4),{maxLength:n,minLength:r}=e,c=n===void 0?75:n,s=r===void 0?1:r,a;return o[0]!==c||o[1]!==s||o[2]!==t?(a=u=>{let{query:m}=u,y="[^"+t+ve+"\\s]",l=new RegExp("(^|\\s|\\()(["+t+"]((?:"+y+"){0,"+c+"}))$").exec(m);if(l!==null){let h=l[1],x=l[3];if(x.length>=s)return{leadOffset:l.index+h.length,matchingString:x,replaceableString:l[2]}}return null},o[0]=c,o[1]=s,o[2]=t,o[3]=a):a=o[3],a}var B="slash-menu-popup";function zo({isSelected:t,item:e,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:c,schemaPath:s}}=R(),{i18n:a}=at(),u=`${B}__item ${B}__item-${e.key}`;t&&(u+=` ${B}__item--selected`);let m=e.key;return e.label&&(m=typeof e.label=="function"?e.label({featureClientSchemaMap:c,i18n:a,schemaPath:s}):e.label),m.length>25&&(m=m.substring(0,25)+"..."),lt("button",{"aria-selected":t,className:u,id:B+"__item-"+e.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[e?.Icon&&U(e.Icon,{}),U("span",{className:`${B}__item-text`,children:m})]},e.key)}function ut({anchorElem:t=document.body}){let[e]=$o(),[o,n]=jo(null),{editorConfig:r}=R(),{i18n:c}=at(),{fieldProps:{featureClientSchemaMap:s,schemaPath:a}}=R(),u=st("/",{minLength:0}),m=Ko(()=>{let i=[];for(let l of r.features.slashMenu.dynamicGroups)if(o){let h=l({editor:e,queryString:o});i=i.concat(h)}return i},[e,o,r?.features]),y=Ho(()=>{let i=[];for(let l of r?.features.slashMenu.groups??[])i.push(l);if(o){i=i.map(h=>{let x=h.items.filter(g=>{let d=g.key;return g.label&&(d=typeof g.label=="function"?g.label({featureClientSchemaMap:s,i18n:c,schemaPath:a}):g.label),new RegExp(o,"gi").exec(d)?!0:g.keywords!=null?g.keywords.some(p=>new RegExp(o,"gi").exec(p)):!1});return x.length?{...h,items:x}:null}),i=i.filter(h=>h!=null);let l=m();for(let h of l){let x=i.find(g=>g.key===h.key);x?i=i.filter(g=>g.key!==h.key):x={...h,items:[]},x?.items?.length&&(x.items=x.items.concat(x.items)),i.push(x)}}return i},[o,r?.features.slashMenu.groups,m,s,c,a]);return U(De,{anchorElem:t,groups:y,menuRenderFn:(i,{selectedItemKey:l,selectItemAndCleanUp:h,setSelectedItemKey:x})=>i.current&&y.length?ct.createPortal(U("div",{className:B,children:y.map(g=>{let d=g.key;return g.label&&s&&(d=typeof g.label=="function"?g.label({featureClientSchemaMap:s,i18n:c,schemaPath:a}):g.label),lt("div",{className:`${B}__group ${B}__group-${g.key}`,children:[U("div",{className:`${B}__group-title`,children:d}),g.items.map((p,f)=>U(zo,{index:f,isSelected:l===p.key,item:p,onClick:()=>{x(p.key),h(p)},onMouseEnter:()=>{x(p.key)},ref:C=>{p.ref={current:C}}},p.key))]},g.key)})}),i.current):null,onQueryChange:n,triggerFn:u})}import{c as Wo}from"react/compiler-runtime";import{useLexicalComposerContext as Yo}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Vo,TextNode as Go}from"lexical";import{useEffect as Uo}from"react";function dt(t){let e=Wo(6),{features:o}=t,[n]=Yo(),r;e[0]!==n||e[1]!==o.enabledFormats?(r=()=>{let s=qo(o.enabledFormats);if(s.length!==0)return n.registerNodeTransform(Go,a=>{s.forEach(u=>{a.hasFormat(u)&&a.toggleFormat(u)})})},e[0]=n,e[1]=o.enabledFormats,e[2]=r):r=e[2];let c;return e[3]!==n||e[4]!==o?(c=[n,o],e[3]=n,e[4]=o,e[5]=c):c=e[5],Uo(r,c),null}function qo(t){let e=Object.keys(Vo),o=new Set(t);return e.filter(n=>!o.has(n))}import{c as Jo}from"react/compiler-runtime";import{jsx as mt}from"react/jsx-runtime";import{ContentEditable as Qo}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Xo}from"@payloadcms/ui";import"react";function ft(t){let e=Jo(4),{className:o,editorConfig:n}=t,{t:r}=Xo(),c;return e[0]!==o||e[1]!==n?.admin?.placeholder||e[2]!==r?(c=mt(Qo,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:mt("p",{className:"editor-placeholder",children:n?.admin?.placeholder??r("lexical:general:placeholder")})}),e[0]=o,e[1]=n?.admin?.placeholder,e[2]=r,e[3]=c):c=e[3],c}var gt=t=>{let e=Zo(12),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:c}=t,s=R(),[a]=en(),u=sn(),[m,y]=un(null),i;e[0]===Symbol.for("react.memo_cache_sentinel")?(i=d=>{d!==null&&y(d)},e[0]=i):i=e[0];let l=i,h,x;e[1]!==a||e[2]!==s?(h=()=>{if(!s?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}s?.parentEditor?.uuid&&s.parentEditor?.registerChild(s.uuid,s);let d=()=>{s.focusEditor(s)},p=()=>{s.blurEditor(s)},f=a.registerCommand(an,()=>(d(),!0),pt),C=a.registerCommand(ln,()=>(p(),!0),pt);return()=>{f(),C(),s.parentEditor?.unregisterChild?.(s.uuid)}},x=[a,s],e[1]=a,e[2]=s,e[3]=h,e[4]=x):(h=e[3],x=e[4]),cn(h,x);let g;return e[5]!==o||e[6]!==n||e[7]!==m||e[8]!==u||e[9]!==r||e[10]!==c?(g=te(q.Fragment,{children:[o.features.plugins?.map(dn),te("div",{className:"editor-container",ref:n,children:[o.features.plugins?.map(mn),E(rn,{contentEditable:E("div",{className:"editor-scroller",children:E("div",{className:"editor",ref:l,children:E(ft,{editorConfig:o})})}),ErrorBoundary:tn}),E(rt,{}),u&&E(tt,{}),E(_e,{}),E(dt,{features:o.features}),E(it,{}),u&&E(nn,{ignoreSelectionChange:!0,onChange:(d,p,f)=>{(!f.has("focus")||f.size>1)&&c?.(d,p,f)}}),m&&te(q.Fragment,{children:[!r&&u&&te(q.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:E(Ze,{anchorElem:m}),o.admin?.hideAddBlockButton?null:E(ze,{anchorElem:m})]}),o.features.plugins?.map(d=>{if(d.position==="floatingAnchorElem"&&!(d.desktopOnly===!0&&r))return E($,{anchorElem:m,clientProps:d.clientProps,plugin:d},d.key)}),u&&E(q.Fragment,{children:E(ut,{anchorElem:m})})]}),u&&te(q.Fragment,{children:[E(on,{}),o?.features?.markdownTransformers?.length>0&&E(nt,{})]}),o.features.plugins?.map(fn),o.features.plugins?.map(pn)]}),o.features.plugins?.map(gn)]}),e[5]=o,e[6]=n,e[7]=m,e[8]=u,e[9]=r,e[10]=c,e[11]=g):g=e[11],g};function dn(t){if(t.position==="aboveContainer")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function mn(t){if(t.position==="top")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function fn(t){if(t.position==="normal")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function pn(t){if(t.position==="bottom")return E($,{clientProps:t.clientProps,plugin:t},t.key)}function gn(t){if(t.position==="belowContainer")return E($,{clientProps:t.clientProps,plugin:t},t.key)}var yt=({children:t,providers:e})=>{if(!e?.length)return t;let o=e[0];return e.length>1?O(o,{children:O(yt,{providers:e.slice(1),children:t})}):O(o,{children:t})},xt=t=>{let{composerKey:e,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:c,readOnly:s,value:a}=t,u=R(),m=yn(),y=ht.useRef(null),i=xn(()=>{if(a&&typeof a!="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(a));if(a&&Array.isArray(a)&&!("root"in a))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(a&&"jsonContent"in a)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");return{editable:s!==!0,editorState:a!=null?JSON.stringify(a):void 0,namespace:o.lexical.namespace,nodes:Me({editorConfig:o}),onError:l=>{throw l},theme:o.lexical.theme}},[o]);return i?O(hn,{initialConfig:i,children:O(Re,{editorConfig:o,editorContainerRef:y,fieldProps:n,parentContext:u?.editDepth===m?u:void 0,children:O(yt,{providers:o.features.providers,children:O(gt,{editorConfig:o,editorContainerRef:y,isSmallWidthViewport:r,onChange:c})})})},e+i.editable):O("p",{children:"Loading..."})};var pe="rich-text-lexical",Tn=t=>{let{editorConfig:e,field:o,field:{admin:{className:n,description:r,readOnly:c}={},label:s,localized:a,required:u},path:m,readOnly:y,validate:i}=t,l=y||c,h=Nn(),x=bt((M,Q)=>typeof i=="function"?i(M,{...Q,required:u}):!0,[i,u]),{customComponents:{AfterInput:g,BeforeInput:d,Description:p,Error:f,Label:C}={},disabled:w,initialValue:S,path:b,setValue:k,showError:N,value:L}=Sn({potentiallyStalePath:m,validate:x}),I=l||w,[v,T]=Pt(!1),[J,he]=Pt(),ye=Ct.useRef(S),z=Ct.useRef(L);Nt(()=>{let M=()=>{let Q=window.matchMedia("(max-width: 768px)").matches;Q!==v&&T(Q)};return M(),window.addEventListener("resize",M),()=>{window.removeEventListener("resize",M)}},[v]);let Pe=[pe,"field-type",n,N&&"error",I&&`${pe}--read-only`,e?.admin?.hideGutter!==!0&&!v?`${pe}--show-gutter`:null].filter(Boolean).join(" "),oe=`${b}.${h}`,D=we(),P=bt(M=>{D(()=>{let Se=M.toJSON();z.current=Se,k(Se)})},[k,D]),St=wn(()=>Rn(o),[o]),Rt=Pn(M=>{z.current!==L&&!kn(JSON.parse(JSON.stringify(z.current)),L)&&(ye.current=M,z.current=L,he(new Date))});return Nt(()=>{Object.is(S,ye.current)||Rt(S)},[S]),ge("div",{className:Pe,style:St,children:[F(Et,{CustomComponent:f,Fallback:F(Cn,{path:b,showError:N})}),C||F(bn,{label:s,localized:a,path:b,required:u}),ge("div",{className:`${pe}__wrap`,children:[ge(vn,{fallbackRender:Dn,onReset:()=>{},children:[d,F(xt,{composerKey:oe,editorConfig:e,fieldProps:t,isSmallWidthViewport:v,onChange:P,readOnly:I,value:L},JSON.stringify({path:b,rerenderProviderKey:J})),g]}),F(Et,{CustomComponent:p,Fallback:F(En,{description:r,path:b})})]})]},oe)};function Dn({error:t}){return ge("div",{className:"errorBoundary",role:"alert",children:[F("p",{children:"Something went wrong:"}),F("pre",{style:{color:"red"},children:t.message})]})}var fs=Tn;export{fs as RichText};
2
- //# sourceMappingURL=Field-CJFETHA3.js.map