@payloadcms/richtext-lexical 4.0.0-internal.40de3ec → 4.0.0-internal.4804abd

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 (282) hide show
  1. package/dist/exports/client/Field-DXKR3OGV.js +2 -0
  2. package/dist/exports/client/Field-DXKR3OGV.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  5. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  6. package/dist/exports/client/index.d.ts +0 -1
  7. package/dist/exports/client/index.d.ts.map +1 -1
  8. package/dist/exports/client/index.js +23 -24
  9. package/dist/exports/client/index.js.map +4 -4
  10. package/dist/features/blockquote/client/index.js +2 -2
  11. package/dist/features/blockquote/client/index.js.map +1 -1
  12. package/dist/features/blockquote/server/index.js +2 -2
  13. package/dist/features/blockquote/server/index.js.map +1 -1
  14. package/dist/features/blocks/client/component/index.css +2 -2
  15. package/dist/features/blocks/client/componentInline/index.css +8 -8
  16. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  17. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  18. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  19. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  20. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  21. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  22. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  23. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  24. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  25. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  26. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  27. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  28. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  29. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  30. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  31. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  32. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  33. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  34. package/dist/features/blocks/server/schema.js +3 -2
  35. package/dist/features/blocks/server/schema.js.map +1 -1
  36. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  37. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  38. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  39. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  40. package/dist/features/converters/markdownToLexical/index.js +5 -2
  41. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  42. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  43. package/dist/features/experimental_table/client/index.js +2 -2
  44. package/dist/features/experimental_table/client/index.js.map +1 -1
  45. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  46. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  47. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  48. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  49. package/dist/features/experimental_table/server/index.js +2 -2
  50. package/dist/features/experimental_table/server/index.js.map +1 -1
  51. package/dist/features/format/bold/feature.client.js +1 -1
  52. package/dist/features/format/bold/feature.client.js.map +1 -1
  53. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  54. package/dist/features/format/bold/feature.server.js +1 -1
  55. package/dist/features/format/bold/feature.server.js.map +1 -1
  56. package/dist/features/format/inlineCode/feature.client.js +1 -1
  57. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  58. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  59. package/dist/features/format/inlineCode/feature.server.js +1 -1
  60. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  61. package/dist/features/format/italic/feature.client.js +1 -1
  62. package/dist/features/format/italic/feature.client.js.map +1 -1
  63. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  64. package/dist/features/format/italic/feature.server.js +1 -1
  65. package/dist/features/format/italic/feature.server.js.map +1 -1
  66. package/dist/features/format/strikethrough/feature.client.js +1 -1
  67. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  68. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  69. package/dist/features/format/strikethrough/feature.server.js +1 -1
  70. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  71. package/dist/features/heading/client/index.js +2 -2
  72. package/dist/features/heading/client/index.js.map +1 -1
  73. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  74. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  75. package/dist/features/heading/markdownTransformer.js +6 -19
  76. package/dist/features/heading/markdownTransformer.js.map +1 -1
  77. package/dist/features/heading/server/index.js +2 -2
  78. package/dist/features/heading/server/index.js.map +1 -1
  79. package/dist/features/horizontalRule/client/index.js +2 -2
  80. package/dist/features/horizontalRule/client/index.js.map +1 -1
  81. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  82. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  83. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  84. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  85. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  86. package/dist/features/horizontalRule/server/index.js +2 -2
  87. package/dist/features/horizontalRule/server/index.js.map +1 -1
  88. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  89. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  90. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  91. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  92. package/dist/features/link/client/index.js +2 -2
  93. package/dist/features/link/client/index.js.map +1 -1
  94. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  95. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  96. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  97. package/dist/features/link/markdownTransformer.d.ts +4 -4
  98. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  99. package/dist/features/link/markdownTransformer.js +2 -2
  100. package/dist/features/link/markdownTransformer.js.map +1 -1
  101. package/dist/features/link/markdownTransformer.spec.js +10 -10
  102. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  103. package/dist/features/link/server/index.js +2 -2
  104. package/dist/features/link/server/index.js.map +1 -1
  105. package/dist/features/link/server/schema.d.ts.map +1 -1
  106. package/dist/features/link/server/schema.js +4 -2
  107. package/dist/features/link/server/schema.js.map +1 -1
  108. package/dist/features/lists/checklist/client/index.js +1 -1
  109. package/dist/features/lists/checklist/client/index.js.map +1 -1
  110. package/dist/features/lists/checklist/server/index.js +1 -1
  111. package/dist/features/lists/checklist/server/index.js.map +1 -1
  112. package/dist/features/lists/orderedList/client/index.js +1 -1
  113. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  114. package/dist/features/lists/orderedList/server/index.js +1 -1
  115. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  116. package/dist/features/lists/unorderedList/client/index.js +1 -1
  117. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  118. package/dist/features/lists/unorderedList/server/index.js +1 -1
  119. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  120. package/dist/features/relationship/server/schema.d.ts +3 -3
  121. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  122. package/dist/features/relationship/server/schema.js +22 -5
  123. package/dist/features/relationship/server/schema.js.map +1 -1
  124. package/dist/features/textState/feature.client.js +1 -1
  125. package/dist/features/textState/feature.client.js.map +1 -1
  126. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  127. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  128. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  129. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  130. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  131. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  132. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  133. package/dist/features/typesClient.d.ts +1 -1
  134. package/dist/features/typesClient.d.ts.map +1 -1
  135. package/dist/features/typesClient.js.map +1 -1
  136. package/dist/features/typesServer.d.ts +2 -2
  137. package/dist/features/typesServer.d.ts.map +1 -1
  138. package/dist/features/typesServer.js.map +1 -1
  139. package/dist/features/upload/client/component/index.css +9 -9
  140. package/dist/features/upload/client/plugin/index.js +5 -5
  141. package/dist/features/upload/client/plugin/index.js.map +1 -1
  142. package/dist/features/upload/server/index.js +2 -2
  143. package/dist/features/upload/server/index.js.map +1 -1
  144. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  145. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  146. package/dist/features/upload/server/markdownTransformer.js +1 -1
  147. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  148. package/dist/features/upload/server/schema.d.ts +4 -4
  149. package/dist/features/upload/server/schema.d.ts.map +1 -1
  150. package/dist/features/upload/server/schema.js +26 -6
  151. package/dist/features/upload/server/schema.js.map +1 -1
  152. package/dist/field/Diff/converters/unknown/index.css +1 -1
  153. package/dist/field/Field.js +1 -1
  154. package/dist/field/Field.js.map +1 -1
  155. package/dist/field/ViewSelector.css +1 -1
  156. package/dist/field/bundled.css +1 -1
  157. package/dist/field/index.css +5 -2
  158. package/dist/index.d.ts +2 -2
  159. package/dist/index.d.ts.map +1 -1
  160. package/dist/index.js +3 -3
  161. package/dist/index.js.map +1 -1
  162. package/dist/lexical/LexicalEditor.css +2 -2
  163. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  164. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  165. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  166. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  167. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  168. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  169. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  170. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +3 -3
  171. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  172. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  173. package/dist/lexical/theme/EditorTheme.css +18 -19
  174. package/dist/lexical/ui/ContentEditable.css +5 -5
  175. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  176. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  177. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  178. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  179. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  180. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  181. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  182. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  183. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  184. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  185. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  186. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  187. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  188. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  189. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  190. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  191. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  192. package/dist/types/index.d.ts.map +1 -1
  193. package/dist/types/index.js.map +1 -1
  194. package/dist/types/schema.d.ts.map +1 -1
  195. package/dist/types/schema.js +12 -5
  196. package/dist/types/schema.js.map +1 -1
  197. package/dist/utilities/fieldsDrawer/index.css +4 -4
  198. package/package.json +20 -24
  199. package/dist/exports/client/Field-VYBSMSRY.js +0 -2
  200. package/dist/exports/client/Field-VYBSMSRY.js.map +0 -7
  201. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  202. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  203. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  204. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  205. package/dist/features/blockquote/markdownTransformer.js +0 -33
  206. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  207. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  208. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  209. package/dist/features/format/bold/markdownTransformers.js +0 -23
  210. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  211. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  212. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  213. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  214. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  215. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  216. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  217. package/dist/features/format/italic/markdownTransformers.js +0 -12
  218. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  219. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  220. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  221. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  222. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  223. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  224. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  225. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  226. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  227. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  228. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  229. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  230. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  231. package/dist/features/lists/shared/markdown.d.ts +0 -6
  232. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  233. package/dist/features/lists/shared/markdown.js +0 -57
  234. package/dist/features/lists/shared/markdown.js.map +0 -1
  235. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  236. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  237. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  238. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  239. package/dist/lexical/utils/guard.d.ts +0 -5
  240. package/dist/lexical/utils/guard.d.ts.map +0 -1
  241. package/dist/lexical/utils/guard.js +0 -9
  242. package/dist/lexical/utils/guard.js.map +0 -1
  243. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  244. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  245. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  246. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  247. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  248. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  249. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  250. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  251. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  252. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  253. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  254. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  255. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  256. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  257. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  258. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  259. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  260. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  261. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  262. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  263. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  264. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  265. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  266. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  267. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  268. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  269. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  270. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  271. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  272. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  273. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  274. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  275. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  276. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  277. package/dist/packages/@lexical/markdown/index.js +0 -39
  278. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  279. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  280. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  281. package/dist/packages/@lexical/markdown/utils.js +0 -267
  282. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n DecoratorNode,\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'\n\nimport type { BlockComponentContextType } from '../features/blocks/client/component/BlockContent.js'\nexport type { BlockComponentContextType }\nimport type { BlockComponentProps } from '../features/blocks/client/component/index.js'\nimport type { InlineBlockComponentContextType } from '../features/blocks/client/componentInline/index.js'\nimport type {\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} 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 { InitialLexicalFormState } from '../utilities/buildInitialState.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\n\n/**\n * Base constraint for serialized Lexical node types.\n * Used as the generic constraint for node map types.\n * Extends the base SerializedLexicalNode with optional type for flexibility.\n */\nexport type SerializedNodeBase = { type?: string }\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\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {\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 node: {\n _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode\n } & DecoratorNode<React.ReactNode>\n } & Omit<WithinEditorArgs, 'node'>),\n ) => React.ReactNode\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\ntype SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> =\n {\n /**\n * True when rendering in the admin editor.\n */\n isEditor: true\n /**\n * False when rendering in the admin editor.\n */\n isJSXConverter: false\n } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {\n /**\n * Hook to access block UI components (BlockCollapsible, EditButton, etc.).\n * Call this inside your component to get the context values.\n * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.\n */\n useBlockComponentContext: () => BlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {\n useInlineBlockComponentContext: () => InlineBlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in JSX converter mode (frontend).\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockJSXConverterProps<\n TNode extends SerializedBlockNode | SerializedInlineBlockNode =\n | SerializedBlockNode\n | SerializedInlineBlockNode,\n> = {\n /**\n * Index of this node among its siblings.\n */\n childIndex: number\n /**\n * Available JSX converters for nested content.\n */\n converters: JSXConverters\n /**\n * The block's form data (field values).\n */\n formData: TNode['fields']\n /**\n * False when rendering via JSX converter (frontend).\n */\n isEditor: false\n /**\n * True when rendering via JSX converter (frontend).\n */\n isJSXConverter: true\n /**\n * The serialized block node.\n */\n node: TNode\n /**\n * Function to convert child nodes to JSX.\n */\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n /**\n * The parent node in the tree.\n */\n parent: SerializedLexicalNodeWithParent\n}\n\n/**\n * Props passed to a custom Block component in a view map.\n * This is a discriminated union - use `isEditor` to narrow the type.\n *\n * When `isEditor` is true, you're in the admin editor with access to `blockContext`.\n * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.\n *\n * @example\n * ```tsx\n * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {\n * if (props.isEditor) {\n * // Admin editor - blockContext available\n * const { BlockCollapsible, EditButton } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * // Frontend - readonly render\n * return <div>{props.formData.title}</div>\n * }\n * ```\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> =\n | ViewMapBlockEditorProps<TNode>\n | ViewMapBlockJSXConverterProps<TNode>\n\nexport type ViewMapInlineBlockComponentProps<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * Block: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\nexport type NodeMapInlineBlockValue<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * InlineBlock: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends SerializedNodeBase =\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 // The index signature must include NodeMapBlockValue in the nested blockSlug mapping because\n // 'blocks' and 'inlineBlocks' properties use NodeMapBlockValue (which adds Block/Label props).\n // TypeScript requires that intersection properties be assignable to index signatures.\n [key: string]:\n | {\n [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<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<TNodes, { type: 'block' }> & SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<\n Extract<Extract<TNodes, { type: 'block' }> & SerializedBlockNode, { fields: { blockType: K } }>\n >\n }\n inlineBlocks?: {\n [K in (Extract<TNodes, { type: 'inlineBlock' }> &\n SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<\n Extract<\n Extract<TNodes, { type: 'inlineBlock' }> & SerializedInlineBlockNode,\n { fields: { blockType: K } }\n >\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 ClientFeaturesMap = {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n}\n\nexport type LexicalEditorViewMap<\n TNodes extends SerializedNodeBase =\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 [viewKey: string]: {\n admin?: LexicalFieldAdminClientProps\n /**\n * Transform the client features for this view.\n * Receives the full clientFeatures map and should return a (potentially modified) map.\n * Can be used to remove features or add new ones per-view.\n *\n * @example Remove toolbars\n * ```ts\n * filterFeatures: (features) => {\n * const { toolbarFixed, toolbarInline, ...rest } = features\n * return rest\n * }\n * ```\n */\n filterFeatures?: (clientFeatures: ClientFeaturesMap) => ClientFeaturesMap\n /**\n * Lexical editor configuration. Can be an object or a function that receives the default config.\n * Using a function avoids needing to import defaultEditorLexicalConfig.\n *\n * @example\n * ```ts\n * lexical: (defaultConfig) => ({\n * ...defaultConfig,\n * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },\n * })\n * ```\n */\n lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig\n nodes: LexicalEditorNodeMap<TNodes>\n }\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: ClientFeaturesMap\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 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":"AAqhBA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/types/index.ts"],"sourcesContent":["import type {\n DecoratorNode,\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'\n\nimport type { BlockComponentContextType } from '../features/blocks/client/component/BlockContent.js'\nexport type { BlockComponentContextType }\nimport type { BlockComponentProps } from '../features/blocks/client/component/index.js'\nimport type { InlineBlockComponentContextType } from '../features/blocks/client/componentInline/index.js'\nimport type {\n JSXConverterArgs,\n JSXConverters,\n SerializedLexicalNodeWithParent,\n} 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 { InitialLexicalFormState } from '../utilities/buildInitialState.js'\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from './nodeTypes.js'\n\n/**\n * Base constraint for serialized Lexical node types.\n * Used as the generic constraint for node map types.\n * Extends the base SerializedLexicalNode with optional type for flexibility.\n */\nexport type SerializedNodeBase = { type?: string }\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\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapValue<TNode extends SerializedNodeBase = SerializedLexicalNode> = {\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 node: {\n _originalDecorate?: (editor: LexicalEditor, config: EditorConfig) => React.ReactNode\n } & DecoratorNode<React.ReactNode>\n } & Omit<WithinEditorArgs, 'node'>),\n ) => React.ReactNode\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\ntype SharedViewMapBlockEditorProps<TNode extends SerializedBlockNode | SerializedInlineBlockNode> =\n {\n /**\n * True when rendering in the admin editor.\n */\n isEditor: true\n /**\n * False when rendering in the admin editor.\n */\n isJSXConverter: false\n } & Pick<BlockComponentProps<TNode['fields']>, 'className' | 'formData' | 'nodeKey'>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockEditorProps<TNode extends SerializedBlockNode> = {\n /**\n * Hook to access block UI components (BlockCollapsible, EditButton, etc.).\n * Call this inside your component to get the context values.\n * Passed as a prop so you don't need to import from @payloadcms/richtext-lexical/client.\n */\n useBlockComponentContext: () => BlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in editor mode.\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapInlineBlockEditorProps<TNode extends SerializedInlineBlockNode> = {\n useInlineBlockComponentContext: () => InlineBlockComponentContextType\n} & SharedViewMapBlockEditorProps<TNode>\n\n/**\n * Props passed to a custom Block component in JSX converter mode (frontend).\n * Use `isEditor` to discriminate between editor and JSX converter modes.\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockJSXConverterProps<\n TNode extends SerializedBlockNode | SerializedInlineBlockNode =\n | SerializedBlockNode\n | SerializedInlineBlockNode,\n> = {\n /**\n * Index of this node among its siblings.\n */\n childIndex: number\n /**\n * Available JSX converters for nested content.\n */\n converters: JSXConverters\n /**\n * The block's form data (field values).\n */\n formData: TNode['fields']\n /**\n * False when rendering via JSX converter (frontend).\n */\n isEditor: false\n /**\n * True when rendering via JSX converter (frontend).\n */\n isJSXConverter: true\n /**\n * The serialized block node.\n */\n node: TNode\n /**\n * Function to convert child nodes to JSX.\n */\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n /**\n * The parent node in the tree.\n */\n parent: SerializedLexicalNodeWithParent\n}\n\n/**\n * Props passed to a custom Block component in a view map.\n * This is a discriminated union - use `isEditor` to narrow the type.\n *\n * When `isEditor` is true, you're in the admin editor with access to `blockContext`.\n * When `isEditor` is false, you're in the frontend JSX converter with `nodesToJSX`.\n *\n * @example\n * ```tsx\n * const MyBlock: React.FC<ViewMapBlockComponentProps> = (props) => {\n * if (props.isEditor) {\n * // Admin editor - blockContext available\n * const { BlockCollapsible, EditButton } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * // Frontend - readonly render\n * return <div>{props.formData.title}</div>\n * }\n * ```\n *\n * @experimental - This API is experimental and may change in a minor release.\n */\nexport type ViewMapBlockComponentProps<TNode extends SerializedBlockNode = SerializedBlockNode> =\n | ViewMapBlockEditorProps<TNode>\n | ViewMapBlockJSXConverterProps<TNode>\n\nexport type ViewMapInlineBlockComponentProps<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = ViewMapBlockJSXConverterProps<TNode> | ViewMapInlineBlockEditorProps<TNode>\n\n/**\n *\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type NodeMapBlockValue<TNode extends SerializedBlockNode = SerializedBlockNode> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * Block: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\nexport type NodeMapInlineBlockValue<\n TNode extends SerializedInlineBlockNode = SerializedInlineBlockNode,\n> = {\n /**\n * A React component that replaces the entire block, including the header/collapsible.\n * Works for both admin editor and frontend JSX conversion.\n *\n * Use `isEditor` to discriminate between modes:\n * - Editor mode: `blockContext` is available with UI components (BlockCollapsible, EditButton, etc.)\n * - JSX converter mode: `nodesToJSX` is available for rendering nested content\n *\n * @example\n * ```tsx\n * InlineBlock: (props) => {\n * if (props.isEditor) {\n * const { BlockCollapsible } = props.blockContext\n * return <BlockCollapsible>{props.formData.title}</BlockCollapsible>\n * }\n * return <div>{props.formData.title}</div>\n * }\n * ```\n */\n Block?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n /**\n * A React component that replaces the block label.\n * Use `useBlockComponentContext()` hook to access block context.\n */\n Label?: React.FC<ViewMapInlineBlockComponentProps<TNode>>\n} & Pick<NodeMapValue<TNode>, 'Component' | 'createDOM' | 'html'>\n\n/**\n * @experimental - This API is experimental and may change in a minor release.\n * @internal\n */\nexport type LexicalEditorNodeMap<\n TNodes extends SerializedNodeBase =\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 // The index signature must include NodeMapBlockValue in the nested blockSlug mapping because\n // 'blocks' and 'inlineBlocks' properties use NodeMapBlockValue (which adds Block/Label props).\n // TypeScript requires that intersection properties be assignable to index signatures.\n [key: string]:\n | {\n [blockSlug: string]: NodeMapBlockValue<any> | NodeMapInlineBlockValue<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<TNodes, { type: 'block' }> &\n SerializedBlockNode)['fields']['blockType']]?: NodeMapBlockValue<\n Extract<\n Extract<TNodes, { type: 'block' }> & SerializedBlockNode,\n { fields: { blockType: K } }\n >\n >\n }\n inlineBlocks?: {\n [K in (Extract<TNodes, { type: 'inlineBlock' }> &\n SerializedInlineBlockNode)['fields']['blockType']]?: NodeMapInlineBlockValue<\n Extract<\n Extract<TNodes, { type: 'inlineBlock' }> & SerializedInlineBlockNode,\n { fields: { blockType: K } }\n >\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 ClientFeaturesMap = {\n [featureKey: string]: {\n clientFeatureProps?: BaseClientFeatureProps<Record<string, any>>\n clientFeatureProvider?: FeatureProviderProviderClient<any, any>\n }\n}\n\nexport type LexicalEditorViewMap<\n TNodes extends SerializedNodeBase =\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 [viewKey: string]: {\n admin?: LexicalFieldAdminClientProps\n /**\n * Transform the client features for this view.\n * Receives the full clientFeatures map and should return a (potentially modified) map.\n * Can be used to remove features or add new ones per-view.\n *\n * @example Remove toolbars\n * ```ts\n * filterFeatures: (features) => {\n * const { toolbarFixed, toolbarInline, ...rest } = features\n * return rest\n * }\n * ```\n */\n filterFeatures?: (clientFeatures: ClientFeaturesMap) => ClientFeaturesMap\n /**\n * Lexical editor configuration. Can be an object or a function that receives the default config.\n * Using a function avoids needing to import defaultEditorLexicalConfig.\n *\n * @example\n * ```ts\n * lexical: (defaultConfig) => ({\n * ...defaultConfig,\n * theme: { ...defaultConfig.theme, paragraph: 'my-paragraph' },\n * })\n * ```\n */\n lexical?: ((defaultConfig: LexicalEditorConfig) => LexicalEditorConfig) | LexicalEditorConfig\n nodes: LexicalEditorNodeMap<TNodes>\n }\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: ClientFeaturesMap\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 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":"AAyhBA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAqBxD,eAAO,MAAM,oBAAoB,EAAE,CAAC,IAAI,EAAE;IACxC,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAK,sBAAsB,CAAC,YAAY,CAsFxC,CAAA"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAC7E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAqBxD,eAAO,MAAM,oBAAoB,EAAE,CAAC,IAAI,EAAE;IACxC,YAAY,EAAE,2BAA2B,CAAA;CAC1C,KAAK,sBAAsB,CAAC,YAAY,CA+FxC,CAAA"}
@@ -18,7 +18,8 @@ export const getFieldToJSONSchema = ({
18
18
  field,
19
19
  i18n,
20
20
  interfaceNameDefinitions,
21
- typeStringDefinitions
21
+ typeStringDefinitions,
22
+ variant = 'output'
22
23
  }) => {
23
24
  // Step 1: build the schema for every node type allowed in this field.
24
25
  typeStringDefinitions.add(CORE_LEXICAL_TYPE_STRING);
@@ -36,7 +37,8 @@ export const getFieldToJSONSchema = ({
36
37
  i18n,
37
38
  interfaceNameDefinitions,
38
39
  nodeUnionName: NODE_UNION_NAME_PLACEHOLDER,
39
- typeStringDefinitions
40
+ typeStringDefinitions,
41
+ variant
40
42
  };
41
43
  const nodeSchemas = [
42
44
  // Add built-in node schemas
@@ -62,14 +64,19 @@ export const getFieldToJSONSchema = ({
62
64
  oneOf: nodeSchemas
63
65
  }) : nodeUnionJson;
64
66
  const hash = createHash('sha256').update(hashInput).digest('hex').slice(0, 8).toUpperCase();
65
- const nodeUnionName = `LexicalNodes_${hash}`;
67
+ // Distinguish an input node union from an output one with an `_Input` suffix - unless an
68
+ // identical output union already exists (a relationship-free editor whose input == output), in
69
+ // which case share it. The content hash means differing unions split and identical ones merge.
70
+ const sharesOutputUnion = variant === 'input' && interfaceNameDefinitions.has(`LexicalNodes_${hash}`);
71
+ const resolvedHash = variant === 'input' && !sharesOutputUnion ? `${hash}_Input` : hash;
72
+ const nodeUnionName = `LexicalNodes_${resolvedHash}`;
66
73
  // Replacing the hash resolves the union name and any feature-derived
67
74
  // sibling names in one pass.
68
- const replacePlaceholder = schemaString => JSON.parse(schemaString.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash));
75
+ const replacePlaceholder = schemaString => JSON.parse(schemaString.replaceAll(NODE_UNION_HASH_PLACEHOLDER, resolvedHash));
69
76
  // Resolve placeholders left in feature-registered definitions so Map keys
70
77
  // and `$ref` targets line up.
71
78
  for (const [oldKey, schema] of [...interfaceNameDefinitions.entries()]) {
72
- const newKey = oldKey.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash);
79
+ const newKey = oldKey.replaceAll(NODE_UNION_HASH_PLACEHOLDER, resolvedHash);
73
80
  const resolvedSchema = replacePlaceholder(JSON.stringify(schema));
74
81
  if (newKey !== oldKey) {
75
82
  interfaceNameDefinitions.delete(oldKey);
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","names":["createHash","CORE_LEXICAL_TYPE_STRING","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","rootNodeJSONSchema","tabNodeJSONSchema","textNodeJSONSchema","elementNodeSchema","NODE_UNION_HASH_PLACEHOLDER","NODE_UNION_NAME_PLACEHOLDER","getFieldToJSONSchema","editorConfig","collectionIDFieldTypes","config","field","i18n","interfaceNameDefinitions","typeStringDefinitions","add","nodeJsonSchemaArgs","args","nodeUnionRef","$ref","nodeUnionName","nodeSchemas","features","nodes","filter","node","jsonSchema","map","rootSchemaWithPlaceholder","nodeUnionJson","JSON","stringify","oneOf","pendingDefinitions","entries","key","includes","sort","a","b","hashInput","length","definitions","hash","update","digest","slice","toUpperCase","replacePlaceholder","schemaString","parse","replaceAll","oldKey","schema","newKey","resolvedSchema","delete","set"],"sources":["../../src/types/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { createHash } from 'crypto'\n\nimport type { JSONSchemaArgs } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextAdapter } from './index.js'\n\nimport {\n CORE_LEXICAL_TYPE_STRING,\n lineBreakNodeJSONSchema,\n paragraphNodeJSONSchema,\n rootNodeJSONSchema,\n tabNodeJSONSchema,\n textNodeJSONSchema,\n} from './builtInNodes.js'\nimport { elementNodeSchema } from './jsonSchemaHelpers.js'\n\n/**\n * The node-union name is a hash of its own schema (so identical editors dedupe).\n * Since the schema references the union name, we use a placeholder during build\n * and substitute the real hash once everything's assembled. Features can derive\n * sibling names (e.g. `LexicalLinkFields_<hash>`) using the bare hash placeholder.\n */\nconst NODE_UNION_HASH_PLACEHOLDER = '__LEXICAL_NODE_UNION_HASH__'\nconst NODE_UNION_NAME_PLACEHOLDER = `LexicalNodes_${NODE_UNION_HASH_PLACEHOLDER}`\n\nexport const getFieldToJSONSchema: (args: {\n editorConfig: SanitizedServerEditorConfig\n}) => LexicalRichTextAdapter['jsonSchema'] = ({ editorConfig }) => {\n return ({\n collectionIDFieldTypes,\n config,\n field,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n }) => {\n // Step 1: build the schema for every node type allowed in this field.\n\n typeStringDefinitions.add(CORE_LEXICAL_TYPE_STRING)\n\n const nodeJsonSchemaArgs: JSONSchemaArgs = {\n collectionIDFieldTypes,\n config,\n // Each element node needs its children typed using the union node type recursively\n elementNodeSchema: (args) =>\n elementNodeSchema({\n ...args,\n nodeUnionRef: {\n $ref: `#/$defs/${NODE_UNION_NAME_PLACEHOLDER}`,\n },\n }),\n field,\n i18n,\n interfaceNameDefinitions,\n nodeUnionName: NODE_UNION_NAME_PLACEHOLDER,\n typeStringDefinitions,\n }\n\n const nodeSchemas: JSONSchema4[] = [\n // Add built-in node schemas\n textNodeJSONSchema(nodeJsonSchemaArgs),\n tabNodeJSONSchema(nodeJsonSchemaArgs),\n lineBreakNodeJSONSchema(nodeJsonSchemaArgs),\n paragraphNodeJSONSchema(nodeJsonSchemaArgs),\n // Add feature node schemas\n ...editorConfig.features.nodes\n .filter((node) => node.jsonSchema)\n .map((node) => node.jsonSchema!(nodeJsonSchemaArgs)),\n ]\n const rootSchemaWithPlaceholder = rootNodeJSONSchema(nodeJsonSchemaArgs)\n\n // Step 2: get the final node union name, then replace the placeholder\n // in both the union members and the root node.\n //\n // See JSDocs for `NODE_UNION_NAME_PLACEHOLDER` for why we use a placeholder and hashing.\n const nodeUnionJson = JSON.stringify({ oneOf: nodeSchemas })\n\n // Features can register per-editor definitions during node-schema build (e.g. a link node's\n // custom `LexicalLinkFields_<hash>`), keyed by the not-yet-resolved hash placeholder. The node\n // union only `$ref`s them, so their content isn't in `nodeUnionJson` - two editors with the same\n // nodes but different feature config (e.g. different custom link fields) would otherwise hash\n // identically and overwrite each other's definition. To avoid that, include that content into the hash too.\n const pendingDefinitions = [...interfaceNameDefinitions.entries()]\n .filter(([key]) => key.includes(NODE_UNION_HASH_PLACEHOLDER))\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n\n const hashInput = pendingDefinitions.length\n ? JSON.stringify({ definitions: pendingDefinitions, oneOf: nodeSchemas })\n : nodeUnionJson\n\n const hash = createHash('sha256').update(hashInput).digest('hex').slice(0, 8).toUpperCase()\n const nodeUnionName = `LexicalNodes_${hash}`\n\n // Replacing the hash resolves the union name and any feature-derived\n // sibling names in one pass.\n const replacePlaceholder = (schemaString: string) =>\n JSON.parse(schemaString.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash)) as JSONSchema4\n\n // Resolve placeholders left in feature-registered definitions so Map keys\n // and `$ref` targets line up.\n for (const [oldKey, schema] of [...interfaceNameDefinitions.entries()]) {\n const newKey = oldKey.replaceAll(NODE_UNION_HASH_PLACEHOLDER, hash)\n const resolvedSchema = replacePlaceholder(JSON.stringify(schema))\n if (newKey !== oldKey) {\n interfaceNameDefinitions.delete(oldKey)\n }\n interfaceNameDefinitions.set(newKey, resolvedSchema)\n }\n\n interfaceNameDefinitions.set(nodeUnionName, replacePlaceholder(nodeUnionJson))\n\n return replacePlaceholder(JSON.stringify(rootSchemaWithPlaceholder))\n }\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"schema.js","names":["createHash","CORE_LEXICAL_TYPE_STRING","lineBreakNodeJSONSchema","paragraphNodeJSONSchema","rootNodeJSONSchema","tabNodeJSONSchema","textNodeJSONSchema","elementNodeSchema","NODE_UNION_HASH_PLACEHOLDER","NODE_UNION_NAME_PLACEHOLDER","getFieldToJSONSchema","editorConfig","collectionIDFieldTypes","config","field","i18n","interfaceNameDefinitions","typeStringDefinitions","variant","add","nodeJsonSchemaArgs","args","nodeUnionRef","$ref","nodeUnionName","nodeSchemas","features","nodes","filter","node","jsonSchema","map","rootSchemaWithPlaceholder","nodeUnionJson","JSON","stringify","oneOf","pendingDefinitions","entries","key","includes","sort","a","b","hashInput","length","definitions","hash","update","digest","slice","toUpperCase","sharesOutputUnion","has","resolvedHash","replacePlaceholder","schemaString","parse","replaceAll","oldKey","schema","newKey","resolvedSchema","delete","set"],"sources":["../../src/types/schema.ts"],"sourcesContent":["import type { JSONSchema4 } from 'json-schema'\n\nimport { createHash } from 'crypto'\n\nimport type { JSONSchemaArgs } from '../features/typesServer.js'\nimport type { SanitizedServerEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextAdapter } from './index.js'\n\nimport {\n CORE_LEXICAL_TYPE_STRING,\n lineBreakNodeJSONSchema,\n paragraphNodeJSONSchema,\n rootNodeJSONSchema,\n tabNodeJSONSchema,\n textNodeJSONSchema,\n} from './builtInNodes.js'\nimport { elementNodeSchema } from './jsonSchemaHelpers.js'\n\n/**\n * The node-union name is a hash of its own schema (so identical editors dedupe).\n * Since the schema references the union name, we use a placeholder during build\n * and substitute the real hash once everything's assembled. Features can derive\n * sibling names (e.g. `LexicalLinkFields_<hash>`) using the bare hash placeholder.\n */\nconst NODE_UNION_HASH_PLACEHOLDER = '__LEXICAL_NODE_UNION_HASH__'\nconst NODE_UNION_NAME_PLACEHOLDER = `LexicalNodes_${NODE_UNION_HASH_PLACEHOLDER}`\n\nexport const getFieldToJSONSchema: (args: {\n editorConfig: SanitizedServerEditorConfig\n}) => LexicalRichTextAdapter['jsonSchema'] = ({ editorConfig }) => {\n return ({\n collectionIDFieldTypes,\n config,\n field,\n i18n,\n interfaceNameDefinitions,\n typeStringDefinitions,\n variant = 'output',\n }) => {\n // Step 1: build the schema for every node type allowed in this field.\n\n typeStringDefinitions.add(CORE_LEXICAL_TYPE_STRING)\n\n const nodeJsonSchemaArgs: JSONSchemaArgs = {\n collectionIDFieldTypes,\n config,\n // Each element node needs its children typed using the union node type recursively\n elementNodeSchema: (args) =>\n elementNodeSchema({\n ...args,\n nodeUnionRef: {\n $ref: `#/$defs/${NODE_UNION_NAME_PLACEHOLDER}`,\n },\n }),\n field,\n i18n,\n interfaceNameDefinitions,\n nodeUnionName: NODE_UNION_NAME_PLACEHOLDER,\n typeStringDefinitions,\n variant,\n }\n\n const nodeSchemas: JSONSchema4[] = [\n // Add built-in node schemas\n textNodeJSONSchema(nodeJsonSchemaArgs),\n tabNodeJSONSchema(nodeJsonSchemaArgs),\n lineBreakNodeJSONSchema(nodeJsonSchemaArgs),\n paragraphNodeJSONSchema(nodeJsonSchemaArgs),\n // Add feature node schemas\n ...editorConfig.features.nodes\n .filter((node) => node.jsonSchema)\n .map((node) => node.jsonSchema!(nodeJsonSchemaArgs)),\n ]\n const rootSchemaWithPlaceholder = rootNodeJSONSchema(nodeJsonSchemaArgs)\n\n // Step 2: get the final node union name, then replace the placeholder\n // in both the union members and the root node.\n //\n // See JSDocs for `NODE_UNION_NAME_PLACEHOLDER` for why we use a placeholder and hashing.\n const nodeUnionJson = JSON.stringify({ oneOf: nodeSchemas })\n\n // Features can register per-editor definitions during node-schema build (e.g. a link node's\n // custom `LexicalLinkFields_<hash>`), keyed by the not-yet-resolved hash placeholder. The node\n // union only `$ref`s them, so their content isn't in `nodeUnionJson` - two editors with the same\n // nodes but different feature config (e.g. different custom link fields) would otherwise hash\n // identically and overwrite each other's definition. To avoid that, include that content into the hash too.\n const pendingDefinitions = [...interfaceNameDefinitions.entries()]\n .filter(([key]) => key.includes(NODE_UNION_HASH_PLACEHOLDER))\n .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))\n\n const hashInput = pendingDefinitions.length\n ? JSON.stringify({ definitions: pendingDefinitions, oneOf: nodeSchemas })\n : nodeUnionJson\n\n const hash = createHash('sha256').update(hashInput).digest('hex').slice(0, 8).toUpperCase()\n\n // Distinguish an input node union from an output one with an `_Input` suffix - unless an\n // identical output union already exists (a relationship-free editor whose input == output), in\n // which case share it. The content hash means differing unions split and identical ones merge.\n const sharesOutputUnion =\n variant === 'input' && interfaceNameDefinitions.has(`LexicalNodes_${hash}`)\n const resolvedHash = variant === 'input' && !sharesOutputUnion ? `${hash}_Input` : hash\n const nodeUnionName = `LexicalNodes_${resolvedHash}`\n\n // Replacing the hash resolves the union name and any feature-derived\n // sibling names in one pass.\n const replacePlaceholder = (schemaString: string) =>\n JSON.parse(schemaString.replaceAll(NODE_UNION_HASH_PLACEHOLDER, resolvedHash)) as JSONSchema4\n\n // Resolve placeholders left in feature-registered definitions so Map keys\n // and `$ref` targets line up.\n for (const [oldKey, schema] of [...interfaceNameDefinitions.entries()]) {\n const newKey = oldKey.replaceAll(NODE_UNION_HASH_PLACEHOLDER, resolvedHash)\n const resolvedSchema = replacePlaceholder(JSON.stringify(schema))\n if (newKey !== oldKey) {\n interfaceNameDefinitions.delete(oldKey)\n }\n interfaceNameDefinitions.set(newKey, resolvedSchema)\n }\n\n interfaceNameDefinitions.set(nodeUnionName, replacePlaceholder(nodeUnionJson))\n\n return replacePlaceholder(JSON.stringify(rootSchemaWithPlaceholder))\n }\n}\n"],"mappings":"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","ignoreList":[]}
@@ -3,10 +3,10 @@
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  gap: var(--spacer-3);
6
- padding: var(--spacer-2-5);
7
- }
6
+ padding: var(--spacer-4);
8
7
 
9
- .fields-drawer .radio-group .field-description {
10
- margin-top: var(--spacer-2);
8
+ @media (max-width: 768px) {
9
+ padding: var(--spacer-3);
10
+ }
11
11
  }
12
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-internal.40de3ec",
3
+ "version": "4.0.0-internal.4804abd",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -179,11 +179,6 @@
179
179
  "types": "./dist/lexical-proxy/@lexical-react/LexicalContentEditable.d.ts",
180
180
  "default": "./dist/lexical-proxy/@lexical-react/LexicalContentEditable.js"
181
181
  },
182
- "./lexical/react/LexicalContextMenuPlugin": {
183
- "import": "./dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js",
184
- "types": "./dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts",
185
- "default": "./dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js"
186
- },
187
182
  "./lexical/react/LexicalNodeContextMenuPlugin": {
188
183
  "import": "./dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.js",
189
184
  "types": "./dist/lexical-proxy/@lexical-react/LexicalNodeContextMenuPlugin.d.ts",
@@ -349,24 +344,25 @@
349
344
  ]
350
345
  },
351
346
  "dependencies": {
352
- "@lexical/clipboard": "0.41.0",
353
- "@lexical/headless": "0.41.0",
354
- "@lexical/html": "0.41.0",
355
- "@lexical/link": "0.41.0",
356
- "@lexical/list": "0.41.0",
357
- "@lexical/mark": "0.41.0",
358
- "@lexical/react": "0.41.0",
359
- "@lexical/rich-text": "0.41.0",
360
- "@lexical/selection": "0.41.0",
361
- "@lexical/table": "0.41.0",
362
- "@lexical/utils": "0.41.0",
347
+ "@lexical/clipboard": "0.45.0",
348
+ "@lexical/headless": "0.45.0",
349
+ "@lexical/html": "0.45.0",
350
+ "@lexical/link": "0.45.0",
351
+ "@lexical/list": "0.45.0",
352
+ "@lexical/mark": "0.45.0",
353
+ "@lexical/markdown": "0.45.0",
354
+ "@lexical/react": "0.45.0",
355
+ "@lexical/rich-text": "0.45.0",
356
+ "@lexical/selection": "0.45.0",
357
+ "@lexical/table": "0.45.0",
358
+ "@lexical/utils": "0.45.0",
363
359
  "acorn": "8.16.0",
364
360
  "bson-objectid": "2.0.4",
365
361
  "csstype": "3.2.3",
366
362
  "dequal": "2.0.3",
367
363
  "escape-html": "1.0.3",
368
364
  "jsox": "1.2.125",
369
- "lexical": "0.41.0",
365
+ "lexical": "0.45.0",
370
366
  "mdast-util-from-markdown": "2.0.3",
371
367
  "mdast-util-mdx-jsx": "3.2.0",
372
368
  "micromark-extension-mdx-jsx": "3.0.2",
@@ -374,8 +370,8 @@
374
370
  "react-error-boundary": "6.1.1",
375
371
  "ts-essentials": "10.0.3",
376
372
  "uuid": "14.0.0",
377
- "@payloadcms/translations": "4.0.0-internal.40de3ec",
378
- "@payloadcms/ui": "4.0.0-internal.40de3ec"
373
+ "@payloadcms/ui": "4.0.0-internal.4804abd",
374
+ "@payloadcms/translations": "4.0.0-internal.4804abd"
379
375
  },
380
376
  "devDependencies": {
381
377
  "@babel/cli": "7.27.2",
@@ -383,7 +379,7 @@
383
379
  "@babel/preset-env": "7.27.2",
384
380
  "@babel/preset-react": "7.27.1",
385
381
  "@babel/preset-typescript": "7.27.1",
386
- "@lexical/eslint-plugin": "0.41.0",
382
+ "@lexical/eslint-plugin": "0.45.0",
387
383
  "@types/escape-html": "1.0.4",
388
384
  "@types/json-schema": "7.0.15",
389
385
  "@types/node": "24.12.3",
@@ -395,15 +391,15 @@
395
391
  "esbuild-sass-plugin": "3.3.1",
396
392
  "swc-plugin-transform-remove-imports": "8.3.0",
397
393
  "@payloadcms/eslint-config": "3.28.0",
398
- "payload": "4.0.0-internal.40de3ec"
394
+ "payload": "4.0.0-internal.4804abd"
399
395
  },
400
396
  "peerDependencies": {
401
397
  "@faceless-ui/modal": "3.0.0",
402
398
  "@faceless-ui/scroll-info": "2.0.0",
403
399
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
404
400
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
405
- "payload": "4.0.0-internal.40de3ec",
406
- "@payloadcms/next": "4.0.0-internal.40de3ec"
401
+ "@payloadcms/next": "4.0.0-internal.4804abd",
402
+ "payload": "4.0.0-internal.4804abd"
407
403
  },
408
404
  "engines": {
409
405
  "node": ">=24.15.0"
@@ -1,2 +0,0 @@
1
- "use client";import{a as Oe,e as Ie,g as $,h as K,j as Fe,k as $e,l as Ke,m as je,n as Se,o as Pe,p as ze}from"./chunk-LH634DPU.js";import{a as Be,b as P}from"./chunk-RJ5MAOKZ.js";import{jsx as L,jsxs as le}from"react/jsx-runtime";import{BulkUploadProvider as tr,FieldDescription as or,FieldError as nr,FieldLabel as rr,isFieldRTL as ir,RenderCustomComponent as Ft,useConfig as sr,useEditDepth as lr,useEffectEvent as ar,useField as cr,useLocale as ur}from"@payloadcms/ui";import{mergeFieldStyles as dr}from"@payloadcms/ui/shared";import{dequal as fr}from"dequal/lite";import $t,{useCallback as Kt,useEffect as jt,useMemo as mr,useState as zt}from"react";import{ErrorBoundary as pr}from"react-error-boundary";import"./bundled.css";import{jsx as j}from"react/jsx-runtime";import{LexicalComposer as Gn}from"@lexical/react/LexicalComposer.js";import{useEditDepth as Un}from"@payloadcms/ui";import*as De from"react";import{useMemo as Mt}from"react";import{c as kt}from"react/compiler-runtime";import{jsx as b,jsxs as ie}from"react/jsx-runtime";import{useLexicalComposerContext as _t}from"@lexical/react/LexicalComposerContext.js";import{LexicalErrorBoundary as Mn}from"@lexical/react/LexicalErrorBoundary.js";import{HistoryPlugin as An}from"@lexical/react/LexicalHistoryPlugin.js";import{OnChangePlugin as Bn}from"@lexical/react/LexicalOnChangePlugin.js";import{RichTextPlugin as On}from"@lexical/react/LexicalRichTextPlugin.js";import{useLexicalEditable as In}from"@lexical/react/useLexicalEditable";import{BLUR_COMMAND as Fn,COMMAND_PRIORITY_LOW as vt,FOCUS_COMMAND as $n}from"lexical";import*as Q from"react";import{useEffect as Lt,useState as Kn}from"react";import{jsx as He}from"react/jsx-runtime";import"react";var z=({anchorElem:e,clientProps:t,plugin:o})=>o.position==="floatingAnchorElem"&&e?o.Component&&He(o.Component,{anchorElem:e,clientProps:t}):o.Component&&He(o.Component,{clientProps:t});import{c as Yt}from"react/compiler-runtime";import{copyToClipboard as Ve}from"@lexical/clipboard";import{useLexicalComposerContext as Gt}from"@lexical/react/LexicalComposerContext.js";import{objectKlassEquals as Ut}from"@lexical/utils";import We from"bson-objectid";import{$getSelection as Jt,$isNodeSelection as qt,COMMAND_PRIORITY_LOW as Qt,COPY_COMMAND as Xt}from"lexical";import{useEffect as Zt}from"react";var Re=e=>{if("fields"in e&&typeof e.fields=="object"&&e.fields!==null&&"id"in e.fields?e.fields.id=new We.default().toHexString():"id"in e&&(e.id=new We.default().toHexString()),e.children)for(let t of e.children)Re(t)};function Ye(){let e=Yt(3),[t]=Gt(),o,n;return e[0]!==t?(o=()=>t.registerCommand(Xt,r=>{let c=Jt();if(qt(c)){let l=c.getNodes()[0]?.exportJSON(),u=JSON.parse(JSON.stringify(l));Re(u);let d={namespace:t._config.namespace,nodes:[u]},m=JSON.stringify(d);return Ve(t,null,{"application/x-lexical-editor":m,"text/plain":""}).catch(eo),!0}return Ve(t,Ut(r,ClipboardEvent)?r:null).then(()=>{if(!(r instanceof ClipboardEvent)||!r.clipboardData)throw new Error("No clipboard event");let i=r.clipboardData.getData("application/x-lexical-editor");if(!i)return!0;let l=JSON.parse(i);for(let d of l.nodes)Re(d);let u=JSON.stringify(l);r.clipboardData.setData("application/x-lexical-editor",u)}).catch(i=>{throw r instanceof ClipboardEvent&&r.clipboardData?.setData("application/x-lexical-editor",""),i}),!0},Qt),n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),Zt(o,n),null}function eo(e){throw e}import{c as to}from"react/compiler-runtime";import{useLexicalComposerContext as oo}from"@lexical/react/LexicalComposerContext";import{$findMatchingParent as fe,mergeRegister as no}from"@lexical/utils";import{$createNodeSelection as ro,$getEditor as te,$getNearestNodeFromDOMNode as io,$getSelection as me,$isDecoratorNode as H,$isElementNode as Te,$isLineBreakNode as so,$isNodeSelection as pe,$isRangeSelection as Ge,$isRootOrShadowRoot as lo,$isTextNode as ao,$setSelection as Ue,CLICK_COMMAND as co,COMMAND_PRIORITY_LOW as Y,KEY_ARROW_DOWN_COMMAND as uo,KEY_ARROW_UP_COMMAND as fo,KEY_BACKSPACE_COMMAND as mo,KEY_DELETE_COMMAND as po,SELECTION_CHANGE_COMMAND as go}from"lexical";import{useEffect as ho}from"react";function Je(){let e=to(3),[t]=oo(),o=wo,n,r;return e[0]!==t?(n=()=>no(t.registerCommand(co,No,Y),t.registerCommand(po,o,Y),t.registerCommand(mo,o,Y),t.registerCommand(go,Co,Y),t.registerCommand(fo,Eo,Y),t.registerCommand(uo,yo,Y)),r=[t],e[0]=t,e[1]=n,e[2]=r):(n=e[1],r=e[2]),ho(n,r),null}function yo(e){let t=me();if(pe(t)){e.preventDefault();let i=t.getNodes()[0]?.getNextSibling();if(H(i)){let d=te().getElementByKey(i.getKey());return d&&oe({element:d,node:i}),!0}if(!Te(i))return!0;let l=i.getFirstDescendant()??i;return l&&(fe(l,ge)?.selectEnd(),e.preventDefault()),!0}if(!Ge(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=fe(n,xo),c=r?.getNextSibling();if(!r||c!==qe(r))return!1;if(H(c)){let i=te().getElementByKey(c.getKey());if(i)return oe({element:i,node:c}),e.preventDefault(),!0}return!1}function xo(e){return qe(e)!==null}function Eo(e){let t=me();if(pe(t)){let i=t.getNodes()[0]?.getPreviousSibling();if(H(i)){let d=te().getElementByKey(i.getKey());return d?(oe({element:d,node:i}),e.preventDefault(),!0):!1}if(!Te(i))return!1;let l=i.getLastDescendant()??i;return l?(fe(l,ge)?.selectStart(),e.preventDefault(),!0):!1}if(!Ge(t))return!1;let n=(t.isBackward()?t.anchor:t.focus).getNode(),r=fe(n,bo),c=r?.getPreviousSibling();if(!r||c!==Qe(r))return!1;if(H(c)){let i=te().getElementByKey(c.getKey());if(i)return oe({element:i,node:c}),e.preventDefault(),!0}return!1}function bo(e){return Qe(e)!==null}function Co(){let e=Ro();return document.querySelector(".decorator-selected")?.classList.remove("decorator-selected"),e?(e.element?.classList.add("decorator-selected"),!0):!1}function No(e){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let t=Po(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"]')?Ue(null):oe(t),!0}function wo(e){let t=me();return pe(t)?(e.preventDefault(),t.getNodes().forEach(So),!0):!1}function So(e){e.remove()}function Po(e){if(!(e.target instanceof HTMLElement))return;let t=e.target.closest('[data-lexical-decorator="true"]');if(!(t instanceof HTMLElement))return;let o=io(t);return H(o)?{element:t,node:o}:void 0}function Ro(){let e=me();if(!pe(e))return;let t=e.getNodes();if(t.length!==1)return;let o=t[0];return H(o)?{decorator:o,element:te().getElementByKey(o.getKey())}:void 0}function oe({element:e,node:t}){document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");let o=ro();o.add(t.getKey()),Ue(o),e.scrollIntoView({behavior:"smooth",block:"nearest"}),e.classList.add("decorator-selected")}function ge(e){if(H(e)&&!e.isInline())return!0;if(!Te(e)||lo(e))return!1;let t=e.getFirstChild(),o=t===null||so(t)||ao(t)||t.isInline();return!e.isInline()&&e.canBeEmpty()!==!1&&o}function qe(e){let t=e.getNextSibling();for(;t!==null;){if(ge(t))return t;t=t.getNextSibling()}return null}function Qe(e){let t=e.getPreviousSibling();for(;t!==null;){if(ge(t))return t;t=t.getPreviousSibling()}return null}import{jsx as ve}from"react/jsx-runtime";import{useLexicalComposerContext as Do}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Mo,isHTMLElement as Ao}from"lexical";import*as tt from"react";import{useCallback as Bo,useEffect as et,useRef as Oo,useState as Io}from"react";import{createPortal as Fo}from"react-dom";var G=(e,t,o,n,r=50,c=25)=>{let i=0;if(e&&!e.contains(n)){let{bottom:l,left:u,right:d,top:m}=e.getBoundingClientRect(),a=m+window.scrollY,s=l+window.scrollY;if(o<a-c||o>s+c||t<u-r||t>d+r)return-1;(t<u||t>d)&&(i=t<u?t-u:t-d)}return i};import{$getNodeByKey as ye}from"lexical";function U(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 he(e){let t=(u,d)=>u?parseFloat(window.getComputedStyle(u)[d]):0,{marginBottom:o,marginTop:n}=window.getComputedStyle(e),r=t(e.previousElementSibling,"marginBottom"),c=t(e.nextElementSibling,"marginTop"),i=Math.max(parseFloat(n),r);return{marginBottom:Math.max(parseFloat(o),c),marginTop:i}}import{$getRoot as To}from"lexical";function V(e){return e.getEditorState().read(()=>To().getChildrenKeys())}var vo=1,ko=-1,Xe=0,B={props:null,result:null};function _o(e,t,o=20){let n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=o*o}function J(e){let{anchorElem:t,cache_threshold:o=20,editor:n,fuzzy:r=!1,horizontalOffset:c=0,point:{x:i,y:l},startIndex:u=0,useEdgeAsDefault:d=!1}=e;if(o>0&&B.props&&B.result&&B.props.fuzzy===e.fuzzy&&B.props.horizontalOffset===e.horizontalOffset&&B.props.useEdgeAsDefault===e.useEdgeAsDefault&&_o(B.props.point,e.point,o))return B.result;let m=t.getBoundingClientRect(),a=V(n),s={blockElem:null,blockNode:null,distance:1/0,foundAtIndex:-1,isFoundNodeEmptyParagraph:!1};return n.getEditorState().read(()=>{if(d){let p=n.getElementByKey(a[0]),g=n.getElementByKey(a[a.length-1]);if(p&&g){let[f,x]=[U(p),U(g)];if(l<f.top?(s.blockElem=p,s.distance=f.top-l,s.blockNode=ye(a[0]),s.foundAtIndex=0):l>x.bottom&&(s.distance=l-x.bottom,s.blockNode=ye(a[a.length-1]),s.blockElem=g,s.foundAtIndex=a.length-1),s?.blockElem)return{blockElem:null,isFoundNodeEmptyParagraph:!1}}}let E=u,y=Xe;for(;E>=0&&E<a.length;){let p=a[E],g=n.getElementByKey(p);if(g===null)break;let f=new K(i+c,l),x=je.fromDOMRect(U(g)),{marginBottom:h,marginTop:C}=he(g),k=x.generateNewRect({bottom:x.bottom+h,left:m.left,right:m.right,top:x.top-C}),{distance:w,isOnBottomSide:v,isOnTopSide:D}=k.distanceFromPoint(f);if(w===0){s.blockElem=g,s.blockNode=ye(p),s.foundAtIndex=E,s.distance=w,s.blockNode&&s.blockNode.getType()==="paragraph"&&s.blockNode.getTextContent()===""&&(!r&&!e.returnEmptyParagraphs&&(s.blockElem=null,s.blockNode=null),s.isFoundNodeEmptyParagraph=!0);break}else r&&w<s.distance&&(s.blockElem=g,s.blockNode=ye(p),s.distance=w,s.foundAtIndex=E);y===Xe&&(D?y=ko:v?y=vo:y=1/0),E+=y}}),B.props=e,B.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 xe(e,t){return!!e.closest(`.${t}`)}var Lo=["IMG","INPUT","TEXTAREA","SELECT","BUTTON","VIDEO","OBJECT","EMBED","IFRAME","HR"];function Ze(e){if(!e||Lo.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 Ee(e,t,o,n=0){if(!e){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let r=e.getBoundingClientRect(),c=window.getComputedStyle(e),i=t.getBoundingClientRect(),l=o.getBoundingClientRect(),u;if(["LexicalEditorTheme__block","LexicalEditorTheme__upload","LexicalEditorTheme__relationship"].some(a=>e.classList.contains(a)||e.firstElementChild?.classList.contains(a)))u=r.top+8-l.top;else{let a=Ze(e)?parseInt(c.lineHeight,10):0;u=r.top+(a-i.height)/2-l.top}let m=n;t.style.opacity="1",t.style.transform=`translate(${m}px, ${u}px)`}var $o="add-block-menu",be=1/0;function Ko(e){return e===0?1/0:be>=0&&be<e?be:Math.floor(e/2)}function jo(e,t,o){let n=t.parentElement,{editorConfig:r}=P(),c=r?.admin?.hideGutter?-24:12,i=Oo(null),[l,u]=Io(null);et(()=>{function m(a){let s=a.target;if(!Ao(s))return;let E=G(n,a.pageX,a.pageY,s);if(E===-1){u(null);return}if(xe(s,$o))return;let y=V(e),{blockElem:p,blockNode:g,foundAtIndex:f}=J({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-E,point:new K(a.x,a.y),returnEmptyParagraphs:!0,startIndex:Ko(y.length),useEdgeAsDefault:!1});be=f,p&&g&&(l?.node!==g||l?.elem!==p)&&u({elem:p,node:g})}return document?.addEventListener("mousemove",m),()=>{document?.removeEventListener("mousemove",m)}},[n,t,e,l]),et(()=>{i.current&&l?.node&&Ee(l?.elem,i.current,t,c)},[t,l,c]);let d=Bo(m=>{let a=l;a?.node&&(e.update(()=>{let s=!0;if((a?.node.getType()!=="paragraph"||a.node.getTextContent()!=="")&&(s=!1),!s){let E=Mo();a?.node.insertAfter(E),setTimeout(()=>{a={elem:e.getElementByKey(E.getKey()),node:E},u(a)},0)}}),setTimeout(()=>{e.update(()=>{e.focus(),a?.node&&"select"in a.node&&typeof a.node.select=="function"&&a.node.select()})},1),setTimeout(()=>{e.dispatchCommand($e,{node:a?.node})},2),m.stopPropagation(),m.preventDefault())},[e,l]);return Fo(ve(tt.Fragment,{children:ve("button",{"aria-label":"Add block",className:"icon add-block-menu",onClick:m=>{d(m)},ref:i,type:"button",children:ve("div",{className:o?"icon":""})})}),t)}function ot(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=Do();return jo(n,o,n._editable)}import{jsx as Ce,jsxs as Ho}from"react/jsx-runtime";import{useLexicalComposerContext as Vo}from"@lexical/react/LexicalComposerContext.js";import{eventFiles as it}from"@lexical/rich-text";import{$getNearestNodeFromDOMNode as st,$getNodeByKey as Wo,isHTMLElement as ke}from"lexical";import*as dt from"react";import{useEffect as _e,useRef as ne,useState as lt}from"react";import{createPortal as Yo}from"react-dom";var nt=0,zo=-24;var W=0;function rt(e,t,o,n,r,c,i,l,u,d=!1){let{height:m,top:a}=n.getBoundingClientRect(),{top:s,width:E}=i.getBoundingClientRect(),{marginBottom:y,marginTop:p}=he(n),g=a,f=c>=a+m/2+window.scrollY,x=!1;if(r?.elem)if(n!==r?.elem)(f&&r?.elem&&r?.elem===n.nextElementSibling||!f&&r?.elem&&r?.elem===n.previousElementSibling)&&(W++,W<200&&(x=!0));else{W++;let w=r?.boundingBox?.y,v=n.getBoundingClientRect().y;(f===r?.isBelow&&w===v||W<200)&&(x=!1)}if(x)return{isBelow:f,willStayInSamePosition:x};d?g+=m/2:f?g+=m+y/2:g-=p/2;let h=0;d||(f?h=-nt:h=nt);let C=g-s+h,k=zo-t;return o.style.width=`calc(${E}px - ${e} - var(--spacer-5))`,o.style.opacity=".8",o.style.transform=`translate(${k}px, calc(${C}px - 2px))`,r?.elem&&(r.elem.style.opacity="",r?.elem===n?f?r.elem.style.marginTop="":r.elem.style.marginBottom="":(r.elem.style.marginBottom="",r.elem.style.marginTop="")),W=0,{isBelow:f,willStayInSamePosition:x}}var Go="draggable-block-menu",at="application/x-lexical-drag-block",re=1/0;function ct(e){return e===0?1/0:re>=0&&re<e?re:Math.floor(e/2)}function Uo(e,t){let{transform:o}=t.style;e.setDragImage(t,0,0),setTimeout(()=>{t.style.transform=o})}function ut(e,t){e&&(e.style.opacity="0"),t&&(t.style.opacity="",t.style.marginBottom="",t.style.marginTop="")}function Jo(e,t,o){let n=t.parentElement,r=ne(null),c=ne(null),i=ne(null),l=ne(!1),u=ne([]),[d,m]=lt(null),[a,s]=lt(null),{editorConfig:E}=P(),y=E?.admin?.hideGutter?-44:-8;_e(()=>{function f(x){let h=x.target;if(!ke(h))return;let C=G(n,x.pageX,x.pageY,h);if(C===-1){m(null);return}if(xe(h,Go))return;let k=V(e),{blockElem:w,foundAtIndex:v,isFoundNodeEmptyParagraph:D}=J({anchorElem:t,cache_threshold:0,editor:e,horizontalOffset:-C,point:new K(x.x,x.y),startIndex:ct(k.length),useEdgeAsDefault:!1,verbose:!1});re=v,!(!w&&!D)&&d!==w&&m(w)}return document?.addEventListener("mousemove",f),()=>{document?.removeEventListener("mousemove",f)}},[n,t,e,d]),_e(()=>{r.current&&Ee(d,r.current,t,y)},[t,d,y]),_e(()=>{function f(h){if(!l.current)return!1;let[C]=it(h);if(C)return!1;let{pageY:k,target:w}=h;if(!ke(w))return!1;let v=G(n,h.pageX,h.pageY,w,100,50),D=V(e),{blockElem:S,foundAtIndex:I,isFoundNodeEmptyParagraph:T}=J({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-v,point:new K(h.x,h.y),startIndex:ct(D.length),useEdgeAsDefault:!0,verbose:!0});re=I;let F=c.current;if(S===null||F===null)return!1;if(h.preventDefault(),h.dataTransfer.dropEffect="move",d!==S){let{isBelow:_,willStayInSamePosition:M}=rt(E?.admin?.hideGutter?"0px":"var(--spacer-5)",y+(E?.admin?.hideGutter?r?.current?.getBoundingClientRect()?.width??0:-(r?.current?.getBoundingClientRect()?.width??0)),F,S,a,k,t,h,i,T);M||s({boundingBox:S.getBoundingClientRect(),elem:S,isBelow:_})}else a?.elem&&(ut(F,a.elem),s({boundingBox:S.getBoundingClientRect(),elem:S,isBelow:!1}));return!0}function x(h){if(!l.current)return!1;let[C]=it(h);if(C)return!1;let{dataTransfer:k,pageY:w,target:v}=h,D=k?.getData(at)||"";return e.update(()=>{let S=Wo(D);if(!S||!ke(v))return!1;let I=G(n,h.pageX,h.pageY,v,100,50),{blockElem:T,isFoundNodeEmptyParagraph:F}=J({anchorElem:t,editor:e,fuzzy:!0,horizontalOffset:-I,point:new K(h.x,h.y),useEdgeAsDefault:!0});if(!T)return!1;let _=st(T);if(!_)return!1;if(_===S)return!0;let{height:M,top:ae}=U(T),Ne=w>=ae+M/2+window.scrollY;F?(_.insertBefore(S),_.remove()):Ne?_.insertAfter(S):_.insertBefore(S),d!==null&&m(null),document.querySelectorAll(".lexical-block-highlighter").forEach(R=>{R.remove()});let we=e.getElementByKey(S.getKey()),ce=setTimeout(()=>{let R=we?.getBoundingClientRect();if(!R)return;let N=document.createElement("div");N.className="lexical-block-highlighter",N.style.backgroundColor="var(--theme-elevation-1000",N.style.transition="opacity 0.5s ease-in-out",N.style.zIndex="1",N.style.pointerEvents="none",N.style.boxSizing="border-box",N.style.borderRadius="4px",N.style.position="absolute",document.body.appendChild(N),N.style.opacity="0.1",N.style.height=`${R.height+8}px`,N.style.width=`${R.width+8}px`,N.style.top=`${R.top+window.scrollY-4}px`,N.style.left=`${R.left-4}px`;let ue=setTimeout(()=>{N.style.opacity="0";let de=setTimeout(()=>{N.remove()},500);u.current.push(de)},1e3);u.current.push(ue)},120);u.current.push(ce)}),!0}return document.addEventListener("dragover",f),document.addEventListener("drop",x),()=>{document.removeEventListener("dragover",f),document.removeEventListener("drop",x),u.current.forEach(clearTimeout),u.current=[]}},[n,y,t,e,a,d,E?.admin?.hideGutter]);function p(f){let x=f.dataTransfer;if(!x||!d)return;Uo(x,d),x.effectAllowed="move";let h="";e.update(()=>{let C=st(d);C&&(h=C.getKey())}),l.current=!0,x.setData(at,h)}function g(){l.current=!1,a?.elem&&ut(c.current,a?.elem)}return Yo(Ho(dt.Fragment,{children:[Ce("button",{"aria-label":"Drag to move",className:"icon draggable-block-menu",draggable:!0,onDragEnd:g,onDragStart:p,ref:r,type:"button",children:Ce("div",{className:o?"icon":""})}),Ce("div",{className:"draggable-block-target-line",ref:c}),Ce("div",{className:"debug-highlight",ref:i})]}),t)}function ft(e){let{anchorElem:t}=e,o=t===void 0?document.body:t,[n]=Vo();return Jo(n,o,n._editable)}import{c as qo}from"react/compiler-runtime";import{jsx as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Qo}from"@lexical/react/LexicalComposerContext";import{$createParagraphNode as Xo,$getRoot as Zo}from"lexical";import"react";var mt="insert-paragraph-at-end",pt=()=>{let e=qo(2),[t]=Qo(),{editorConfig:o}=P();if(o?.admin?.hideInsertParagraphAtEnd)return null;let n;return e[0]!==t?(n=Le("div",{"aria-label":"Insert Paragraph",className:mt,onClick:()=>{t.update(en)},role:"button",tabIndex:0,children:Le("div",{className:`${mt}-inside`,children:Le("span",{children:"+"})})}),e[0]=t,e[1]=n):n=e[1],n};function en(){let e=Xo();Zo().append(e),e.select()}import{c as tn}from"react/compiler-runtime";import{useLexicalComposerContext as on}from"@lexical/react/LexicalComposerContext";import*as gt from"react";var ht=()=>{let e=tn(4),{editorConfig:t}=P(),[o]=on(),n,r;return e[0]!==o||e[1]!==t.features.markdownTransformers?(n=()=>Oe(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]),gt.useEffect(n,r),null};import{c as nn}from"react/compiler-runtime";import{useLexicalComposerContext as rn}from"@lexical/react/LexicalComposerContext.js";import{useEffect as sn}from"react";function yt(){let e=nn(5),[t]=rn(),{currentView:o,views:n}=$(),r,c;return e[0]!==o||e[1]!==t||e[2]!==n?(r=()=>{n&&(o==="default"?n.default?Se(t,n.default?.nodes):Pe(t):n[o]&&(Pe(t),Se(t,n[o]?.nodes)))},c=[t,n,o],e[0]=o,e[1]=t,e[2]=n,e[3]=r,e[4]=c):(r=e[3],c=e[4]),sn(r,c),null}import{useLexicalComposerContext as ln}from"@lexical/react/LexicalComposerContext";import{$getSelection as an,$isRangeSelection as cn,RootNode as un}from"lexical";import{useEffect as dn}from"react";function xt(){let[e]=ln();return dn(()=>e.registerNodeTransform(un,t=>{let o=an();if(cn(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 fn}from"@lexical/react/LexicalComposerContext";import{$getSelection as mn,COMMAND_PRIORITY_LOW as pn,SELECT_ALL_COMMAND as gn}from"lexical";import{useEffect as hn}from"react";function Et(){let[e]=fn();return hn(()=>e.registerCommand(gn,()=>{if(mn())return!1;let o=document.activeElement;return o instanceof HTMLInputElement&&o.select(),!0},pn),[e]),null}import{jsx as q,jsxs as Ct}from"react/jsx-runtime";import{useLexicalComposerContext as xn}from"@lexical/react/LexicalComposerContext.js";import{useTranslation as Nt}from"@payloadcms/ui";import{useCallback as En,useMemo as bn,useState as Cn}from"react";import"react";import*as wt from"react-dom";import{c as yn}from"react/compiler-runtime";import"react";function bt(e,t){let o=yn(4),{maxLength:n,minLength:r}=t,c=n===void 0?75:n,i=r===void 0?1:r,l;return o[0]!==c||o[1]!==i||o[2]!==e?(l=u=>{let{query:d}=u,m="[^"+e+Fe+"\\s]",s=new RegExp("(^|\\s|\\()(["+e+"]((?:"+m+"){0,"+c+"}))$").exec(d);if(s!==null){let E=s[1],y=s[3];if(y.length>=i)return{leadOffset:s.index+E.length,matchingString:y,replaceableString:s[2]}}return null},o[0]=c,o[1]=i,o[2]=e,o[3]=l):l=o[3],l}var O="slash-menu-popup";function Nn({isSelected:e,item:t,onClick:o,onMouseEnter:n,ref:r}){let{fieldProps:{featureClientSchemaMap:c,schemaPath:i}}=P(),{i18n:l}=Nt(),u=`${O}__item ${O}__item-${t.key}`;e&&(u+=` ${O}__item--selected`);let d=t.key;return t.label&&(d=typeof t.label=="function"?t.label({featureClientSchemaMap:c,i18n:l,schemaPath:i}):t.label),d.length>25&&(d=d.substring(0,25)+"..."),Ct("button",{"aria-selected":e,className:u,id:O+"__item-"+t.key,onClick:o,onMouseEnter:n,ref:r,role:"option",tabIndex:-1,type:"button",children:[t?.Icon&&q(t.Icon,{}),q("span",{className:`${O}__item-text`,children:d})]},t.key)}function St({anchorElem:e=document.body}){let[t]=xn(),[o,n]=Cn(null),{editorConfig:r}=P(),{i18n:c}=Nt(),{fieldProps:{featureClientSchemaMap:i,schemaPath:l}}=P(),u=bt("/",{minLength:0}),d=En(()=>{let a=[];for(let s of r.features.slashMenu.dynamicGroups)if(o){let E=s({editor:t,queryString:o});a=a.concat(E)}return a},[t,o,r?.features]),m=bn(()=>{let a=[];for(let s of r?.features.slashMenu.groups??[])a.push(s);if(o){let s=o.toLowerCase().replace(/[\s\-_]/g,"");a=a.map(y=>{let p=y.items.filter(g=>{let f=g.key;return g.label&&(f=typeof g.label=="function"?g.label({featureClientSchemaMap:i,i18n:c,schemaPath:l}):g.label),new RegExp(o,"gi").exec(f)||f.toLowerCase().replace(/[\s\-_]/g,"").includes(s)?!0:g.keywords!=null?g.keywords.some(h=>new RegExp(o,"gi").exec(h)?!0:h.toLowerCase().replace(/[\s\-_]/g,"").includes(s)):!1});return p.length?{...y,items:p}:null}),a=a.filter(y=>y!=null);let E=d();for(let y of E){let p=a.find(g=>g.key===y.key);p?a=a.filter(g=>g.key!==y.key):p={...y,items:[]},p?.items?.length&&(p.items=p.items.concat(p.items)),a.push(p)}}return a},[o,r?.features.slashMenu.groups,d,i,c,l]);return q(Ke,{anchorElem:e,groups:m,menuRenderFn:(a,{selectedItemKey:s,selectItemAndCleanUp:E,setSelectedItemKey:y})=>a.current&&m.length?wt.createPortal(q("div",{className:O,"data-theme":"dark",children:m.map(p=>{let g=p.key;return p.label&&i&&(g=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:c,schemaPath:l}):p.label),Ct("div",{className:`${O}__group ${O}__group-${p.key}`,children:[q("div",{className:`${O}__group-title`,children:g}),p.items.map((f,x)=>q(Nn,{index:x,isSelected:s===f.key,item:f,onClick:()=>{y(f.key),E(f)},onMouseEnter:()=>{y(f.key)},ref:h=>{f.ref={current:h}}},f.key))]},p.key)})}),a.current):null,onQueryChange:n,triggerFn:u})}import{c as wn}from"react/compiler-runtime";import{useLexicalComposerContext as Sn}from"@lexical/react/LexicalComposerContext";import{TEXT_TYPE_TO_FORMAT as Pn,TextNode as Rn}from"lexical";import{useEffect as Tn}from"react";function Pt(e){let t=wn(6),{features:o}=e,[n]=Sn(),r;t[0]!==n||t[1]!==o.enabledFormats?(r=()=>{let i=vn(o.enabledFormats);if(i.length!==0)return n.registerNodeTransform(Rn,l=>{i.forEach(u=>{l.hasFormat(u)&&l.toggleFormat(u)})})},t[0]=n,t[1]=o.enabledFormats,t[2]=r):r=t[2];let c;return t[3]!==n||t[4]!==o?(c=[n,o],t[3]=n,t[4]=o,t[5]=c):c=t[5],Tn(r,c),null}function vn(e){let t=Object.keys(Pn),o=new Set(e);return t.filter(n=>!o.has(n))}import{c as kn}from"react/compiler-runtime";import{jsx as Rt}from"react/jsx-runtime";import{useLexicalComposerContext as _n}from"@lexical/react/LexicalComposerContext";import{ContentEditable as Ln}from"@lexical/react/LexicalContentEditable.js";import{useTranslation as Dn}from"@payloadcms/ui";import"react";function Tt(e){let t=kn(5),{className:o,editorConfig:n}=e,{t:r}=Dn(),[,c]=_n(),{getTheme:i}=c,l;if(t[0]!==o||t[1]!==n?.admin?.placeholder||t[2]!==i||t[3]!==r){let u=i();l=Rt(Ln,{"aria-placeholder":r("lexical:general:placeholder"),className:o??"ContentEditable__root",placeholder:Rt("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}function jn(){let e=kt(3),[t]=_t(),o,n;return e[0]!==t?(o=()=>{let r=t.getRootElement();return r&&(r.dataset.lexicalEditable=String(t.isEditable())),t.registerEditableListener(c=>{let i=t.getRootElement();i&&(i.dataset.lexicalEditable=String(c))})},n=[t],e[0]=t,e[1]=o,e[2]=n):(o=e[1],n=e[2]),Lt(o,n),null}var Dt=e=>{let t=kt(13),{editorConfig:o,editorContainerRef:n,isSmallWidthViewport:r,onChange:c,rtl:i}=e,l=P(),[u]=_t(),d=In(),[m,a]=Kn(null),s;t[0]===Symbol.for("react.memo_cache_sentinel")?(s=f=>{f!==null&&a(f)},t[0]=s):s=t[0];let E=s,y,p;t[1]!==u||t[2]!==l?(y=()=>{if(!l?.uuid){console.error("Lexical Editor must be used within an EditorConfigProvider");return}l?.parentEditor?.uuid&&l.parentEditor?.registerChild(l.uuid,l);let f=()=>{l.focusEditor(l)},x=()=>{l.blurEditor(l)},h=u.registerCommand($n,()=>(f(),!0),vt),C=u.registerCommand(Fn,()=>(x(),!0),vt);return()=>{h(),C(),l.parentEditor?.unregisterChild?.(l.uuid)}},p=[u,l],t[1]=u,t[2]=l,t[3]=y,t[4]=p):(y=t[3],p=t[4]),Lt(y,p);let g;return t[5]!==o||t[6]!==n||t[7]!==m||t[8]!==d||t[9]!==r||t[10]!==c||t[11]!==i?(g=ie(Q.Fragment,{children:[o.features.plugins?.map(zn),ie("div",{className:"editor-container",dir:i?"rtl":void 0,ref:n,children:[o.features.plugins?.map(Hn),b(On,{contentEditable:b("div",{className:"editor-scroller",children:b("div",{className:"editor",ref:E,children:b(Tt,{editorConfig:o})})}),ErrorBoundary:Mn}),b(jn,{}),b(xt,{}),d&&b(pt,{}),b(Je,{}),b(Ye,{}),b(Pt,{features:o.features}),b(Et,{}),b(yt,{}),d&&b(Bn,{ignoreSelectionChange:!0,onChange:(f,x,h)=>{(!h.has("focus")||h.size>1)&&c?.(f,x,h)}}),m&&ie(Q.Fragment,{children:[!r&&d&&ie(Q.Fragment,{children:[o.admin?.hideDraggableBlockElement?null:b(ft,{anchorElem:m}),o.admin?.hideAddBlockButton?null:b(ot,{anchorElem:m})]}),o.features.plugins?.map(f=>{if(f.position==="floatingAnchorElem"&&!(f.desktopOnly===!0&&r))return b(z,{anchorElem:m,clientProps:f.clientProps,plugin:f},f.key)}),d&&b(Q.Fragment,{children:b(St,{anchorElem:m})})]}),d&&ie(Q.Fragment,{children:[b(An,{}),o?.features?.markdownTransformers?.length>0&&b(ht,{})]}),o.features.plugins?.map(Vn),o.features.plugins?.map(Wn)]}),o.features.plugins?.map(Yn)]}),t[5]=o,t[6]=n,t[7]=m,t[8]=d,t[9]=r,t[10]=c,t[11]=i,t[12]=g):g=t[12],g};function zn(e){if(e.position==="aboveContainer")return b(z,{clientProps:e.clientProps,plugin:e},e.key)}function Hn(e){if(e.position==="top")return b(z,{clientProps:e.clientProps,plugin:e},e.key)}function Vn(e){if(e.position==="normal")return b(z,{clientProps:e.clientProps,plugin:e},e.key)}function Wn(e){if(e.position==="bottom")return b(z,{clientProps:e.clientProps,plugin:e},e.key)}function Yn(e){if(e.position==="belowContainer")return b(z,{clientProps:e.clientProps,plugin:e},e.key)}var At=({children:e,providers:t})=>{if(!t?.length)return e;let o=t[0];return t.length>1?j(o,{children:j(At,{providers:t.slice(1),children:e})}):j(o,{children:e})},Bt=e=>{let{composerKey:t,editorConfig:o,fieldProps:n,isSmallWidthViewport:r,onChange:c,readOnly:i,rtl:l,value:u}=e,{currentView:d,views:m}=$(),a=P(),s=Un(),E=De.useRef(null),y=Mt(()=>{if(u&&typeof u!="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(u));if(u&&Array.isArray(u)&&!("root"in u))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(u&&"jsonContent"in u)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 x=m?.[d]?.nodes;return{editable:i!==!0,editorState:u!=null?JSON.stringify(u):void 0,namespace:o.lexical.namespace,nodes:ze({editorConfig:o,nodeViews:x}),onError:h=>{throw h},theme:o.lexical.theme}},[o,m,d]),p=De.useRef(i!==!0);i!==!0&&(p.current=!0);let g=Mt(()=>({...y,editable:i!==!0}),[y,i]);if(!g)return j("p",{children:"Loading..."});let f=p.current?"editable":"readonly";return j(Gn,{initialConfig:g,children:j(Be,{editorConfig:o,editorContainerRef:E,fieldProps:n,parentContext:a?.editDepth===s?a:void 0,children:j(At,{providers:o.features.providers,children:j(Dt,{editorConfig:o,editorContainerRef:E,isSmallWidthViewport:r,onChange:c,rtl:l})})})},t+f+d)};import{c as Jn}from"react/compiler-runtime";import{jsx as X,jsxs as qn}from"react/jsx-runtime";import{ChevronIcon as Qn,Popup as Xn,PopupList as Ot}from"@payloadcms/ui";import"react";function It(){let e=Jn(5),{currentView:t,setCurrentView:o,views:n}=$();if(!n||Object.keys(n).length===0)return null;let r,c;if(e[0]!==t||e[1]!==o||e[2]!==n){c=Symbol.for("react.early_return_sentinel");e:{let i=Object.keys(n);if(!i.some(er)){c=null;break e}let u=["default",...i.filter(Zn)],d=t.charAt(0).toUpperCase()+t.slice(1);r=X("div",{className:"lexical-view-selector",children:X(Xn,{button:qn("button",{className:"lexical-view-selector__button",type:"button",children:[X("span",{className:"lexical-view-selector__label",children:d}),X(Qn,{className:"lexical-view-selector__icon"})]}),buttonType:"custom",horizontalAlign:"left",render:m=>{let{close:a}=m;return X(Ot.ButtonGroup,{children:u.map(s=>{let E=s.charAt(0).toUpperCase()+s.slice(1);return X(Ot.Button,{active:s===t,disabled:s===t,onClick:()=>{o?.(s),a()},children:E},s)})})},size:"large"})})}e[0]=t,e[1]=o,e[2]=n,e[3]=r,e[4]=c}else r=e[3],c=e[4];return c!==Symbol.for("react.early_return_sentinel")?c:r}function Zn(e){return e!=="default"}function er(e){return e!=="default"}var se="rich-text-lexical",gr=e=>{let{editorConfig:t,field:o,field:{admin:{className:n,description:r,readOnly:c}={},label:i,localized:l,required:u},path:d,readOnly:m,schemaPath:a,validate:s}=e,E=m||c,y=ur(),{config:{localization:p}}=sr(),g=ir({fieldLocalized:l,locale:y,localizationConfig:p||void 0}),f=lr(),{isControlledByParent:x}=$(),h=Kt((A,ee)=>typeof s=="function"?s(A,{...ee,required:u}):!0,[s,u]),{customComponents:{AfterInput:C,BeforeInput:k,Description:w,Error:v,Label:D}={},disabled:S,initialValue:I,path:T,setValue:F,showError:_,value:M}=cr({potentiallyStalePath:d,validate:h}),ae=E||S,[Z,Ne]=zt(!1),[Me,we]=zt(),ce=$t.useRef(I),R=$t.useRef(M);jt(()=>{let A=()=>{let ee=window.matchMedia("(max-width: 768px)").matches;ee!==Z&&Ne(ee)};return A(),window.addEventListener("resize",A),()=>{window.removeEventListener("resize",A)}},[Z]);let N=["field-type",se,n,_&&"error",ae&&`${se}--read-only`,t?.admin?.hideGutter!==!0&&!Z?`${se}--show-gutter`:null].filter(Boolean).join(" "),ue=`${T}.${f}`,de=Ie(),Ht=Kt(A=>{de(()=>{let Ae=A.toJSON();R.current=Ae,F(Ae)})},[F,de]),Vt=mr(()=>dr(o),[o]),Wt=ar(A=>{R.current!==M&&!fr(R.current!=null?JSON.parse(JSON.stringify(R.current)):R.current,M)&&(ce.current=A,R.current=M,we(new Date))});return jt(()=>{Object.is(I,ce.current)||Wt(I)},[I]),le("div",{className:N,"data-field-path":T,"data-field-schemapath":a,"data-lexical-view":t?.view,style:Vt,children:[le("div",{className:`${se}__label-row`,children:[D||L(rr,{label:i,localized:l,path:T,required:u}),!x&&L(It,{})]}),le("div",{className:`${se}__wrap`,children:[L(Ft,{CustomComponent:v,Fallback:L(nr,{path:T,showError:_})}),le(pr,{fallbackRender:hr,onReset:()=>{},children:[k,L(tr,{drawerSlugPrefix:`lexical-${T}`,children:L(Bt,{composerKey:ue,editorConfig:t,fieldProps:e,isSmallWidthViewport:Z,onChange:Ht,readOnly:ae,rtl:g,value:M},JSON.stringify({path:T,rerenderProviderKey:Me}))}),C]}),L(Ft,{CustomComponent:w,Fallback:L(or,{description:r,path:T})})]})]},ue)};function hr({error:e}){return le("div",{className:"errorBoundary",role:"alert",children:[L("p",{children:"Something went wrong:"}),L("pre",{style:{color:"red"},children:e instanceof Error?e.message:String(e)})]})}var Tl=gr;export{Tl as RichText};
2
- //# sourceMappingURL=Field-VYBSMSRY.js.map