@payloadcms/richtext-lexical 3.68.0-internal-debug.e9b66ee → 3.68.0-internal-debug.654e4ad

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 (313) hide show
  1. package/dist/cell/rscEntry.js +21 -2
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/exports/client/index.d.ts +1 -0
  4. package/dist/exports/client/index.d.ts.map +1 -1
  5. package/dist/exports/client/index.js +1 -0
  6. package/dist/exports/client/index.js.map +1 -1
  7. package/dist/exports/client/internal-client.d.ts +3 -0
  8. package/dist/exports/client/internal-client.d.ts.map +1 -0
  9. package/dist/exports/client/internal-client.js +4 -0
  10. package/dist/exports/client/internal-client.js.map +1 -0
  11. package/dist/exports/react/index.d.ts +1 -1
  12. package/dist/exports/react/index.d.ts.map +1 -1
  13. package/dist/exports/react/index.js.map +1 -1
  14. package/dist/features/blocks/client/component/BlockContent.js +48 -13
  15. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  16. package/dist/features/blocks/client/component/components/BlockCollapsible.js +10 -1
  17. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  18. package/dist/features/blocks/client/component/components/BlockEditButton.js +7 -1
  19. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  20. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +7 -1
  21. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  22. package/dist/features/blocks/client/component/index.js +247 -81
  23. package/dist/features/blocks/client/component/index.js.map +1 -1
  24. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +9 -1
  25. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  26. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +7 -1
  27. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +7 -1
  29. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  30. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +7 -1
  31. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  32. package/dist/features/blocks/client/componentInline/index.js +217 -68
  33. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  34. package/dist/features/blocks/client/getBlockImageComponent.js +15 -4
  35. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  36. package/dist/features/blocks/client/nodes/BlocksNode.js +12 -1
  37. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  38. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +12 -2
  39. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  40. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +127 -26
  41. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  42. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +65 -49
  43. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  44. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +16 -3
  45. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  46. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +25 -4
  47. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +2 -14
  49. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/Component/index.js +16 -10
  51. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +8 -1
  53. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +8 -1
  55. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -1
  57. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -1
  59. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  60. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +19 -10
  61. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  62. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +63 -16
  63. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  64. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +19 -4
  65. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  66. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +45 -12
  67. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  68. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +57 -11
  69. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  70. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +46 -7
  71. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  72. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +16 -1
  73. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  74. package/dist/features/converters/lexicalToJSX/converter/index.js +98 -9
  75. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  76. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +14 -10
  77. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  78. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  79. package/dist/features/debug/jsxConverter/client/plugin/index.js +17 -4
  80. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  81. package/dist/features/debug/testRecorder/client/plugin/index.js +113 -38
  82. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  83. package/dist/features/debug/treeView/client/plugin/index.js +15 -1
  84. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  85. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +357 -79
  86. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  87. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +41 -7
  88. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  89. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +39 -9
  90. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  91. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +59 -28
  92. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  93. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -0
  94. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  95. package/dist/features/indent/client/IndentPlugin.js +6 -1
  96. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  97. package/dist/features/link/client/plugins/clickableLink/index.js +7 -1
  98. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  99. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +151 -59
  100. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  101. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +9 -1
  102. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  103. package/dist/features/lists/checklist/client/plugin/index.js +7 -1
  104. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  105. package/dist/features/lists/plugin/index.js +7 -1
  106. package/dist/features/lists/plugin/index.js.map +1 -1
  107. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +18 -3
  108. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  109. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +9 -2
  110. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  111. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +18 -3
  112. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  113. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +9 -2
  114. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  115. package/dist/features/relationship/client/components/RelationshipComponent.js +100 -31
  116. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  117. package/dist/features/relationship/client/drawer/index.js +21 -4
  118. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  119. package/dist/features/relationship/client/nodes/RelationshipNode.js +12 -2
  120. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  121. package/dist/features/relationship/client/plugins/index.js +8 -1
  122. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  123. package/dist/features/textState/feature.client.js +22 -5
  124. package/dist/features/textState/feature.client.js.map +1 -1
  125. package/dist/features/toolbars/fixed/client/Toolbar/index.js +123 -27
  126. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  127. package/dist/features/toolbars/inline/client/Toolbar/index.js +111 -18
  128. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  129. package/dist/features/toolbars/shared/ToolbarButton/index.js +14 -4
  130. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  131. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +135 -56
  132. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  133. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +70 -16
  134. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  135. package/dist/features/upload/client/component/index.js +167 -43
  136. package/dist/features/upload/client/component/index.js.map +1 -1
  137. package/dist/features/upload/client/component/pending/index.js +16 -3
  138. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  139. package/dist/features/upload/client/drawer/index.js +21 -4
  140. package/dist/features/upload/client/drawer/index.js.map +1 -1
  141. package/dist/features/upload/client/nodes/UploadNode.js +17 -3
  142. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  143. package/dist/features/upload/client/plugin/index.js +9 -2
  144. package/dist/features/upload/client/plugin/index.js.map +1 -1
  145. package/dist/field/Diff/converters/listitem/index.js +54 -11
  146. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  147. package/dist/field/Diff/converters/relationship/index.js +60 -18
  148. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  149. package/dist/field/Diff/converters/unknown/index.js +42 -7
  150. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  151. package/dist/field/Diff/converters/upload/index.js +91 -21
  152. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  153. package/dist/field/Diff/index.js +17 -4
  154. package/dist/field/Diff/index.js.map +1 -1
  155. package/dist/field/Field.d.ts.map +1 -1
  156. package/dist/field/Field.js +141 -26
  157. package/dist/field/Field.js.map +1 -1
  158. package/dist/field/RenderLexical/index.js +47 -15
  159. package/dist/field/RenderLexical/index.js.map +1 -1
  160. package/dist/field/RichTextViewProvider.d.ts +83 -0
  161. package/dist/field/RichTextViewProvider.d.ts.map +1 -0
  162. package/dist/field/RichTextViewProvider.js +102 -0
  163. package/dist/field/RichTextViewProvider.js.map +1 -0
  164. package/dist/field/ViewSelector.d.ts +4 -0
  165. package/dist/field/ViewSelector.d.ts.map +1 -0
  166. package/dist/field/ViewSelector.js +90 -0
  167. package/dist/field/ViewSelector.js.map +1 -0
  168. package/dist/field/ViewSelector.scss +34 -0
  169. package/dist/field/index.d.ts +1 -0
  170. package/dist/field/index.d.ts.map +1 -1
  171. package/dist/field/index.js +56 -12
  172. package/dist/field/index.js.map +1 -1
  173. package/dist/field/index.scss +12 -0
  174. package/dist/field/rscEntry.d.ts +1 -1
  175. package/dist/field/rscEntry.d.ts.map +1 -1
  176. package/dist/field/rscEntry.js +21 -1
  177. package/dist/field/rscEntry.js.map +1 -1
  178. package/dist/index.d.ts +1 -1
  179. package/dist/index.d.ts.map +1 -1
  180. package/dist/index.js +3 -1
  181. package/dist/index.js.map +1 -1
  182. package/dist/lexical/EditorPlugin.js +17 -2
  183. package/dist/lexical/EditorPlugin.js.map +1 -1
  184. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  185. package/dist/lexical/LexicalEditor.js +238 -69
  186. package/dist/lexical/LexicalEditor.js.map +1 -1
  187. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  188. package/dist/lexical/LexicalProvider.js +74 -15
  189. package/dist/lexical/LexicalProvider.js.map +1 -1
  190. package/dist/lexical/config/client/EditorConfigProvider.js +11 -2
  191. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  192. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  193. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  194. package/dist/lexical/config/client/sanitize.js +3 -2
  195. package/dist/lexical/config/client/sanitize.js.map +1 -1
  196. package/dist/lexical/config/types.d.ts +4 -0
  197. package/dist/lexical/config/types.d.ts.map +1 -1
  198. package/dist/lexical/config/types.js +3 -1
  199. package/dist/lexical/config/types.js.map +1 -1
  200. package/dist/lexical/nodes/index.d.ts +12 -2
  201. package/dist/lexical/nodes/index.d.ts.map +1 -1
  202. package/dist/lexical/nodes/index.js +187 -2
  203. package/dist/lexical/nodes/index.js.map +1 -1
  204. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +28 -5
  205. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  206. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts +2 -0
  207. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -0
  208. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +31 -0
  209. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -0
  210. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +14 -1
  211. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  212. package/dist/lexical/plugins/SlashMenu/index.js +98 -31
  213. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  214. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +27 -7
  215. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  216. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +45 -7
  217. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  218. package/dist/lexical/ui/ContentEditable.js +18 -3
  219. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  220. package/dist/lexical/ui/icons/AI/index.js +58 -10
  221. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/Add/index.js +31 -4
  223. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/AlignCenter/index.js +45 -5
  225. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/AlignJustify/index.js +45 -5
  227. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/AlignLeft/index.js +45 -5
  229. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/AlignRight/index.js +45 -5
  231. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/Block/index.js +54 -5
  233. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/Blockquote/index.js +24 -3
  235. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/Bold/index.js +24 -3
  237. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/Checklist/index.js +39 -4
  239. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/Code/index.js +34 -4
  241. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/CodeBlock/index.js +22 -3
  243. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  244. package/dist/lexical/ui/icons/Collapse/index.js +23 -3
  245. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  246. package/dist/lexical/ui/icons/H1/index.js +24 -3
  247. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  248. package/dist/lexical/ui/icons/H2/index.js +24 -3
  249. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/H3/index.js +24 -3
  251. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  252. package/dist/lexical/ui/icons/H4/index.js +24 -3
  253. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/H5/index.js +24 -3
  255. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/H6/index.js +24 -3
  257. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  258. package/dist/lexical/ui/icons/HorizontalRule/index.js +27 -3
  259. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  260. package/dist/lexical/ui/icons/IndentDecrease/index.js +53 -6
  261. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  262. package/dist/lexical/ui/icons/IndentIncrease/index.js +53 -6
  263. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  264. package/dist/lexical/ui/icons/InlineBlocks/index.js +26 -3
  265. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  266. package/dist/lexical/ui/icons/Italic/index.js +24 -3
  267. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  268. package/dist/lexical/ui/icons/Link/index.js +25 -3
  269. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  270. package/dist/lexical/ui/icons/Meatballs/index.js +39 -5
  271. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  272. package/dist/lexical/ui/icons/OrderedList/index.js +61 -7
  273. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  274. package/dist/lexical/ui/icons/Relationship/index.js +58 -10
  275. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  276. package/dist/lexical/ui/icons/Strikethrough/index.js +34 -4
  277. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  278. package/dist/lexical/ui/icons/Subscript/index.js +24 -3
  279. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  280. package/dist/lexical/ui/icons/Superscript/index.js +24 -3
  281. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  282. package/dist/lexical/ui/icons/Table/index.js +24 -3
  283. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  284. package/dist/lexical/ui/icons/Text/index.js +24 -3
  285. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  286. package/dist/lexical/ui/icons/TextState/index.js +18 -12
  287. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  288. package/dist/lexical/ui/icons/Underline/index.js +34 -4
  289. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  290. package/dist/lexical/ui/icons/UnorderedList/index.js +81 -8
  291. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  292. package/dist/lexical/ui/icons/Upload/index.js +48 -5
  293. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  294. package/dist/types.d.ts +152 -2
  295. package/dist/types.d.ts.map +1 -1
  296. package/dist/types.js +55 -0
  297. package/dist/types.js.map +1 -1
  298. package/dist/utilities/fieldsDrawer/Drawer.js +41 -16
  299. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  300. package/dist/utilities/fieldsDrawer/DrawerContent.js +42 -10
  301. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  302. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +9 -1
  303. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  304. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +11 -3
  305. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  306. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  307. package/dist/utilities/generateImportMap.js +1 -0
  308. package/dist/utilities/generateImportMap.js.map +1 -1
  309. package/dist/validate/hasText.d.ts +6 -1
  310. package/dist/validate/hasText.d.ts.map +1 -1
  311. package/dist/validate/hasText.js +10 -4
  312. package/dist/validate/hasText.js.map +1 -1
  313. package/package.json +12 -7
@@ -1,3 +1,4 @@
1
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
1
2
  export const UploadJSXConverter = {
2
3
  upload: ({ node })=>{
3
4
  // TO-DO (v4): SerializedUploadNode should use UploadData_P4
@@ -10,14 +11,29 @@ export const UploadJSXConverter = {
10
11
  /**
11
12
  * If the upload is not an image, return a link to the upload
12
13
  */ if (!uploadDoc.mimeType.startsWith('image')) {
13
- return <a href={url} rel="noopener noreferrer">
14
- {uploadDoc.filename}
15
- </a>;
14
+ return /*#__PURE__*/ _jsxDEV("a", {
15
+ href: url,
16
+ rel: "noopener noreferrer",
17
+ children: uploadDoc.filename
18
+ }, void 0, false, {
19
+ fileName: "src/features/converters/lexicalToJSX/converter/converters/upload.tsx",
20
+ lineNumber: 24,
21
+ columnNumber: 9
22
+ }, this);
16
23
  }
17
24
  /**
18
25
  * If the upload is a simple image with no different sizes, return a simple img tag
19
26
  */ if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {
20
- return <img alt={uploadDoc.filename} height={uploadDoc.height} src={url} width={uploadDoc.width}/>;
27
+ return /*#__PURE__*/ _jsxDEV("img", {
28
+ alt: uploadDoc.filename,
29
+ height: uploadDoc.height,
30
+ src: url,
31
+ width: uploadDoc.width
32
+ }, void 0, false, {
33
+ fileName: "src/features/converters/lexicalToJSX/converter/converters/upload.tsx",
34
+ lineNumber: 35,
35
+ columnNumber: 9
36
+ }, this);
21
37
  }
22
38
  /**
23
39
  * If the upload is an image with different sizes, return a picture element
@@ -30,11 +46,34 @@ export const UploadJSXConverter = {
30
46
  continue;
31
47
  }
32
48
  const imageSizeURL = imageSize?.url;
33
- pictureJSX.push(<source key={size} media={`(max-width: ${imageSize.width}px)`} srcSet={imageSizeURL} type={imageSize.mimeType}/>);
49
+ pictureJSX.push(/*#__PURE__*/ _jsxDEV("source", {
50
+ media: `(max-width: ${imageSize.width}px)`,
51
+ srcSet: imageSizeURL,
52
+ type: imageSize.mimeType
53
+ }, size, false, {
54
+ fileName: "src/features/converters/lexicalToJSX/converter/converters/upload.tsx",
55
+ lineNumber: 63,
56
+ columnNumber: 9
57
+ }, this));
34
58
  }
35
59
  // Add the default img tag
36
- pictureJSX.push(<img alt={uploadDoc?.filename} height={uploadDoc?.height} key={'image'} src={url} width={uploadDoc?.width}/>);
37
- return <picture>{pictureJSX}</picture>;
60
+ pictureJSX.push(/*#__PURE__*/ _jsxDEV("img", {
61
+ alt: uploadDoc?.filename,
62
+ height: uploadDoc?.height,
63
+ src: url,
64
+ width: uploadDoc?.width
65
+ }, 'image', false, {
66
+ fileName: "src/features/converters/lexicalToJSX/converter/converters/upload.tsx",
67
+ lineNumber: 74,
68
+ columnNumber: 7
69
+ }, this));
70
+ return /*#__PURE__*/ _jsxDEV("picture", {
71
+ children: pictureJSX
72
+ }, void 0, false, {
73
+ fileName: "src/features/converters/lexicalToJSX/converter/converters/upload.tsx",
74
+ lineNumber: 82,
75
+ columnNumber: 12
76
+ }, this);
38
77
  }
39
78
  };
40
79
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/converters/lexicalToJSX/converter/converters/upload.tsx"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { JSXConverters } from '../types.js'\n\nexport const UploadJSXConverter: JSXConverters<SerializedUploadNode> = {\n upload: ({ node }) => {\n // TO-DO (v4): SerializedUploadNode should use UploadData_P4\n const uploadNode = node as UploadDataImproved\n if (typeof uploadNode.value !== 'object') {\n return null\n }\n\n const uploadDoc = uploadNode.value as FileData & TypeWithID\n\n const url = uploadDoc.url\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDoc.mimeType.startsWith('image')) {\n return (\n <a href={url} rel=\"noopener noreferrer\">\n {uploadDoc.filename}\n </a>\n )\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return (\n <img alt={uploadDoc.filename} height={uploadDoc.height} src={url} width={uploadDoc.width} />\n )\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n const pictureJSX: React.ReactNode[] = []\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n // Skip if any property of the size object is null\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = imageSize?.url\n\n pictureJSX.push(\n <source\n key={size}\n media={`(max-width: ${imageSize.width}px)`}\n srcSet={imageSizeURL}\n type={imageSize.mimeType}\n />,\n )\n }\n\n // Add the default img tag\n pictureJSX.push(\n <img\n alt={uploadDoc?.filename}\n height={uploadDoc?.height}\n key={'image'}\n src={url}\n width={uploadDoc?.width}\n />,\n )\n return <picture>{pictureJSX}</picture>\n },\n}\n"],"names":["UploadJSXConverter","upload","node","uploadNode","value","uploadDoc","url","mimeType","startsWith","a","href","rel","filename","sizes","Object","keys","length","img","alt","height","src","width","pictureJSX","size","imageSize","filesize","imageSizeURL","push","source","key","media","srcSet","type","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CC,KAAKb,WAAWO,UAChBO,QAAQd,WAAWc,QACnBU,KAAK,SACLT,KAAKd,KACLe,OAAOhB,WAAWgB;QAGtB,QAAQY,SAASX,aAAaW;IAChC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/converters/lexicalToJSX/converter/converters/upload.tsx"],"sourcesContent":["import type { FileData, FileSizeImproved, TypeWithID } from 'payload'\n\nimport type { SerializedUploadNode } from '../../../../../nodeTypes.js'\nimport type { UploadDataImproved } from '../../../../upload/server/nodes/UploadNode.js'\nimport type { JSXConverters } from '../types.js'\n\nexport const UploadJSXConverter: JSXConverters<SerializedUploadNode> = {\n upload: ({ node }) => {\n // TO-DO (v4): SerializedUploadNode should use UploadData_P4\n const uploadNode = node as UploadDataImproved\n if (typeof uploadNode.value !== 'object') {\n return null\n }\n\n const uploadDoc = uploadNode.value as FileData & TypeWithID\n\n const url = uploadDoc.url\n\n /**\n * If the upload is not an image, return a link to the upload\n */\n if (!uploadDoc.mimeType.startsWith('image')) {\n return (\n <a href={url} rel=\"noopener noreferrer\">\n {uploadDoc.filename}\n </a>\n )\n }\n\n /**\n * If the upload is a simple image with no different sizes, return a simple img tag\n */\n if (!uploadDoc.sizes || !Object.keys(uploadDoc.sizes).length) {\n return (\n <img alt={uploadDoc.filename} height={uploadDoc.height} src={url} width={uploadDoc.width} />\n )\n }\n\n /**\n * If the upload is an image with different sizes, return a picture element\n */\n const pictureJSX: React.ReactNode[] = []\n\n // Iterate through each size in the data.sizes object\n for (const size in uploadDoc.sizes) {\n const imageSize = uploadDoc.sizes[size] as FileSizeImproved\n\n // Skip if any property of the size object is null\n if (\n !imageSize ||\n !imageSize.width ||\n !imageSize.height ||\n !imageSize.mimeType ||\n !imageSize.filesize ||\n !imageSize.filename ||\n !imageSize.url\n ) {\n continue\n }\n const imageSizeURL = imageSize?.url\n\n pictureJSX.push(\n <source\n key={size}\n media={`(max-width: ${imageSize.width}px)`}\n srcSet={imageSizeURL}\n type={imageSize.mimeType}\n />,\n )\n }\n\n // Add the default img tag\n pictureJSX.push(\n <img\n alt={uploadDoc?.filename}\n height={uploadDoc?.height}\n key={'image'}\n src={url}\n width={uploadDoc?.width}\n />,\n )\n return <picture>{pictureJSX}</picture>\n },\n}\n"],"names":["UploadJSXConverter","upload","node","uploadNode","value","uploadDoc","url","mimeType","startsWith","a","href","rel","filename","sizes","Object","keys","length","img","alt","height","src","width","pictureJSX","size","imageSize","filesize","imageSizeURL","push","source","media","srcSet","type","picture"],"mappings":";AAMA,OAAO,MAAMA,qBAA0D;IACrEC,QAAQ,CAAC,EAAEC,IAAI,EAAE;QACf,4DAA4D;QAC5D,MAAMC,aAAaD;QACnB,IAAI,OAAOC,WAAWC,KAAK,KAAK,UAAU;YACxC,OAAO;QACT;QAEA,MAAMC,YAAYF,WAAWC,KAAK;QAElC,MAAME,MAAMD,UAAUC,GAAG;QAEzB;;KAEC,GACD,IAAI,CAACD,UAAUE,QAAQ,CAACC,UAAU,CAAC,UAAU;YAC3C,qBACE,QAACC;gBAAEC,MAAMJ;gBAAKK,KAAI;0BACfN,UAAUO,QAAQ;;;;;;QAGzB;QAEA;;KAEC,GACD,IAAI,CAACP,UAAUQ,KAAK,IAAI,CAACC,OAAOC,IAAI,CAACV,UAAUQ,KAAK,EAAEG,MAAM,EAAE;YAC5D,qBACE,QAACC;gBAAIC,KAAKb,UAAUO,QAAQ;gBAAEO,QAAQd,UAAUc,MAAM;gBAAEC,KAAKd;gBAAKe,OAAOhB,UAAUgB,KAAK;;;;;;QAE5F;QAEA;;KAEC,GACD,MAAMC,aAAgC,EAAE;QAExC,qDAAqD;QACrD,IAAK,MAAMC,QAAQlB,UAAUQ,KAAK,CAAE;YAClC,MAAMW,YAAYnB,UAAUQ,KAAK,CAACU,KAAK;YAEvC,kDAAkD;YAClD,IACE,CAACC,aACD,CAACA,UAAUH,KAAK,IAChB,CAACG,UAAUL,MAAM,IACjB,CAACK,UAAUjB,QAAQ,IACnB,CAACiB,UAAUC,QAAQ,IACnB,CAACD,UAAUZ,QAAQ,IACnB,CAACY,UAAUlB,GAAG,EACd;gBACA;YACF;YACA,MAAMoB,eAAeF,WAAWlB;YAEhCgB,WAAWK,IAAI,eACb,QAACC;gBAECC,OAAO,CAAC,YAAY,EAAEL,UAAUH,KAAK,CAAC,GAAG,CAAC;gBAC1CS,QAAQJ;gBACRK,MAAMP,UAAUjB,QAAQ;eAHnBgB;;;;;QAMX;QAEA,0BAA0B;QAC1BD,WAAWK,IAAI,eACb,QAACV;YACCC,KAAKb,WAAWO;YAChBO,QAAQd,WAAWc;YAEnBC,KAAKd;YACLe,OAAOhB,WAAWgB;WAFb;;;;;QAKT,qBAAO,QAACW;sBAASV;;;;;;IACnB;AACF,EAAC"}
@@ -1,13 +1,28 @@
1
1
  import type { SerializedEditorState, SerializedLexicalNode } from 'lexical';
2
2
  import React from 'react';
3
+ import type { LexicalEditorNodeMap } from '../../../../types.js';
3
4
  import type { JSXConverters, SerializedLexicalNodeWithParent } from './types.js';
4
5
  export type ConvertLexicalToJSXArgs = {
5
6
  converters: JSXConverters;
7
+ /**
8
+ * Serialized editor state to render.
9
+ */
6
10
  data: SerializedEditorState;
11
+ /**
12
+ * If true, disables indentation globally. If an array, disables for specific node `type` values.
13
+ */
7
14
  disableIndent?: boolean | string[];
15
+ /**
16
+ * If true, disables text alignment globally. If an array, disables for specific node `type` values.
17
+ */
8
18
  disableTextAlign?: boolean | string[];
19
+ /**
20
+ * You can use the lexical editor node map or view map as converters. NodeMap converters will override converters passed
21
+ * in the `converters` prop. If a LexicalEditorViewMap is provided, the `default` view will be used.
22
+ */
23
+ nodeMap?: LexicalEditorNodeMap;
9
24
  };
10
- export declare function convertLexicalToJSX({ converters, data, disableIndent, disableTextAlign, }: ConvertLexicalToJSXArgs): React.ReactNode;
25
+ export declare function convertLexicalToJSX({ converters, data, disableIndent, disableTextAlign, nodeMap, }: ConvertLexicalToJSXArgs): React.ReactNode;
11
26
  export declare function convertLexicalNodesToJSX({ converters, disableIndent, disableTextAlign, nodes, parent, }: {
12
27
  converters: JSXConverters;
13
28
  disableIndent?: boolean | string[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAgB,aAAa,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AAI9F,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,qBAAqB,CAAA;IAC3B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACtC,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,GACjB,EAAE,uBAAuB,GAAG,KAAK,CAAC,SAAS,CAW3C;AAED,wBAAgB,wBAAwB,CAAC,EACvC,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,MAAM,GACP,EAAE;IACD,UAAU,EAAE,aAAa,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;IAC9B,MAAM,EAAE,+BAA+B,CAAA;CACxC,GAAG,KAAK,CAAC,SAAS,EAAE,CAmIpB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAE3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,sBAAsB,CAAA;AAC9E,OAAO,KAAK,EAAgB,aAAa,EAAE,+BAA+B,EAAE,MAAM,YAAY,CAAA;AA8E9F,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,aAAa,CAAA;IACzB;;OAEG;IACH,IAAI,EAAE,qBAAqB,CAAA;IAC3B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC;;;OAGG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAA;CAC/B,CAAA;AAED,wBAAgB,mBAAmB,CAAC,EAClC,UAAU,EACV,IAAI,EACJ,aAAa,EACb,gBAAgB,EAChB,OAAO,GACR,EAAE,uBAAuB,GAAG,KAAK,CAAC,SAAS,CAoB3C;AAED,wBAAgB,wBAAwB,CAAC,EACvC,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,KAAK,EACL,MAAM,GACP,EAAE;IACD,UAAU,EAAE,aAAa,CAAA;IACzB,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;IAC9B,MAAM,EAAE,+BAA+B,CAAA;CACxC,GAAG,KAAK,CAAC,SAAS,EAAE,CAmIpB"}
@@ -1,16 +1,99 @@
1
+ import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
1
2
  /* eslint-disable no-console */ import React from 'react';
2
3
  import { hasText } from '../../../../validate/hasText.js';
3
- export function convertLexicalToJSX({ converters, data, disableIndent, disableTextAlign }) {
4
+ /**
5
+ * Creates a JSX converter from a NodeMapValue
6
+ */ function createConverterFromNodeMapValue(viewDef) {
7
+ return (args)=>{
8
+ const converterArgs = {
9
+ ...args,
10
+ isEditor: false,
11
+ isJSXConverter: true
12
+ };
13
+ // If Component is provided, use it
14
+ if (viewDef.Component) {
15
+ return viewDef.Component(converterArgs);
16
+ }
17
+ // If html is provided (as a function or string), use it
18
+ // Note: Using span instead of div to avoid forcing block-level semantics
19
+ if (viewDef.html) {
20
+ const htmlContent = typeof viewDef.html === 'function' ? viewDef.html(converterArgs) : viewDef.html;
21
+ return /*#__PURE__*/ _jsxDEV("span", {
22
+ dangerouslySetInnerHTML: {
23
+ __html: htmlContent
24
+ }
25
+ }, void 0, false, {
26
+ fileName: "src/features/converters/lexicalToJSX/converter/index.tsx",
27
+ lineNumber: 34,
28
+ columnNumber: 14
29
+ }, this);
30
+ }
31
+ return null;
32
+ };
33
+ }
34
+ /**
35
+ * Converts a LexicalEditorNodeMap into JSXConverters
36
+ */ function nodeMapToConverters(nodeMap) {
37
+ const converters = {};
38
+ for (const [nodeType, value] of Object.entries(nodeMap)){
39
+ if (!value || typeof value !== 'object') {
40
+ continue;
41
+ }
42
+ // Handle special keys: blocks, inlineBlocks
43
+ if (nodeType === 'blocks') {
44
+ converters.blocks = {};
45
+ for (const [blockType, _viewDef] of Object.entries(value)){
46
+ const viewDef = _viewDef;
47
+ if (viewDef.Component || viewDef.html) {
48
+ converters.blocks[blockType] = createConverterFromNodeMapValue(viewDef);
49
+ }
50
+ }
51
+ continue;
52
+ }
53
+ if (nodeType === 'inlineBlocks') {
54
+ converters.inlineBlocks = {};
55
+ for (const [blockType, _viewDef] of Object.entries(value)){
56
+ const viewDef = _viewDef;
57
+ if (viewDef.Component || viewDef.html) {
58
+ converters.inlineBlocks[blockType] = createConverterFromNodeMapValue(viewDef);
59
+ }
60
+ }
61
+ continue;
62
+ }
63
+ // Handle regular node types
64
+ const viewDef = value;
65
+ if (viewDef.Component || viewDef.html) {
66
+ converters[nodeType] = createConverterFromNodeMapValue(viewDef);
67
+ }
68
+ }
69
+ return converters;
70
+ }
71
+ /**
72
+ * Serialized editor state to render.
73
+ */ /**
74
+ * If true, disables indentation globally. If an array, disables for specific node `type` values.
75
+ */ /**
76
+ * If true, disables text alignment globally. If an array, disables for specific node `type` values.
77
+ */ /**
78
+ * You can use the lexical editor node map or view map as converters. NodeMap converters will override converters passed
79
+ * in the `converters` prop. If a LexicalEditorViewMap is provided, the `default` view will be used.
80
+ */ export function convertLexicalToJSX({ converters, data, disableIndent, disableTextAlign, nodeMap }) {
4
81
  if (hasText(data)) {
82
+ // Merge nodeMap converters with existing converters
83
+ // NodeMap converters override existing converters
84
+ const mergedConverters = nodeMap ? {
85
+ ...converters,
86
+ ...nodeMapToConverters(nodeMap)
87
+ } : converters;
5
88
  return convertLexicalNodesToJSX({
6
- converters,
89
+ converters: mergedConverters,
7
90
  disableIndent,
8
91
  disableTextAlign,
9
- nodes: data?.root?.children,
10
- parent: data?.root
92
+ nodes: data.root.children,
93
+ parent: data.root
11
94
  });
12
95
  }
13
- return <></>;
96
+ return /*#__PURE__*/ _jsxDEV(_Fragment, {}, void 0, false);
14
97
  }
15
98
  export function convertLexicalNodesToJSX({ converters, disableIndent, disableTextAlign, nodes, parent }) {
16
99
  const unknownConverter = converters.unknown;
@@ -55,7 +138,13 @@ export function convertLexicalNodesToJSX({ converters, disableIndent, disableTex
55
138
  }) : converterForNode;
56
139
  reactNode = converted;
57
140
  } else {
58
- reactNode = <span key={i}>unknown node</span>;
141
+ reactNode = /*#__PURE__*/ _jsxDEV("span", {
142
+ children: "unknown node"
143
+ }, i, false, {
144
+ fileName: "src/features/converters/lexicalToJSX/converter/index.tsx",
145
+ lineNumber: 201,
146
+ columnNumber: 21
147
+ }, this);
59
148
  }
60
149
  const style = {};
61
150
  // Check if disableTextAlign is not true and does not include node type
@@ -91,7 +180,7 @@ export function convertLexicalNodesToJSX({ converters, disableIndent, disableTex
91
180
  style.paddingInlineStart = `${Number(node.indent) * 40}px`;
92
181
  }
93
182
  }
94
- if (React.isValidElement(reactNode)) {
183
+ if (/*#__PURE__*/ React.isValidElement(reactNode)) {
95
184
  // Inject style into reactNode
96
185
  if (style.textAlign || style.paddingInlineStart) {
97
186
  const newStyle = {
@@ -100,13 +189,13 @@ export function convertLexicalNodesToJSX({ converters, disableIndent, disableTex
100
189
  ...reactNode?.props?.style ?? {}
101
190
  };
102
191
  // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here
103
- return React.cloneElement(reactNode, {
192
+ return /*#__PURE__*/ React.cloneElement(reactNode, {
104
193
  key: i,
105
194
  // @ts-expect-error type better later
106
195
  style: newStyle
107
196
  });
108
197
  }
109
- return React.cloneElement(reactNode, {
198
+ return /*#__PURE__*/ React.cloneElement(reactNode, {
110
199
  key: i
111
200
  });
112
201
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\nexport type ConvertLexicalToJSXArgs = {\n converters: JSXConverters\n data: SerializedEditorState\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n}\n\nexport function convertLexicalToJSX({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n}: ConvertLexicalToJSXArgs): React.ReactNode {\n if (hasText(data)) {\n return convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes: data?.root?.children,\n parent: data?.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as JSXConverter<any>\n }\n\n try {\n if (!converterForNode && unknownConverter) {\n converterForNode = unknownConverter\n }\n\n let reactNode: React.ReactNode\n if (converterForNode) {\n const converted =\n typeof converterForNode === 'function'\n ? converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n : converterForNode\n reactNode = converted\n } else {\n reactNode = <span key={i}>unknown node</span>\n }\n\n const style: React.CSSProperties = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n style.paddingInlineStart = `${Number(node.indent) * 40}px`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to JSX:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean)\n}\n"],"names":["React","hasText","convertLexicalToJSX","converters","data","disableIndent","disableTextAlign","convertLexicalNodesToJSX","nodes","root","children","parent","unknownConverter","unknown","jsxArray","map","node","i","converterForNode","type","blocks","fields","blockType","console","error","inlineBlocks","reactNode","converted","childIndex","nodesToJSX","args","span","key","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","filter","Boolean"],"mappings":"AAAA,6BAA6B,GAG7B,OAAOA,WAAW,QAAO;AAKzB,SAASC,OAAO,QAAQ,kCAAiC;AASzD,OAAO,SAASC,oBAAoB,EAClCC,UAAU,EACVC,IAAI,EACJC,aAAa,EACbC,gBAAgB,EACQ;IACxB,IAAIL,QAAQG,OAAO;QACjB,OAAOG,yBAAyB;YAC9BJ;YACAE;YACAC;YACAE,OAAOJ,MAAMK,MAAMC;YACnBC,QAAQP,MAAMK;QAChB;IACF;IACA;AACF;AAEA,OAAO,SAASF,yBAAyB,EACvCJ,UAAU,EACVE,aAAa,EACb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AAO3C,MAAM6C,YAAY,CAACnB,WAAW;oBACnCM,KAAKf;gBACP;YACF;YAEA,OAAOS;QACT,EAAE,OAAOF,OAAO;YACdD,QAAQC,KAAK,CAAC,yCAAyCA,OAAO,SAASR;YACvE,OAAO;QACT;IACF;IAEA,OAAOF,SAASgC,MAAM,CAACC;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/converters/lexicalToJSX/converter/index.tsx"],"sourcesContent":["/* eslint-disable no-console */\nimport type { SerializedEditorState, SerializedLexicalNode } from 'lexical'\n\nimport React from 'react'\n\nimport type { SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js'\nimport type { LexicalEditorNodeMap, NodeMapValue } from '../../../../types.js'\nimport type { JSXConverter, JSXConverters, SerializedLexicalNodeWithParent } from './types.js'\n\nimport { hasText } from '../../../../validate/hasText.js'\n\n/**\n * Creates a JSX converter from a NodeMapValue\n */\nfunction createConverterFromNodeMapValue(viewDef: NodeMapValue): JSXConverter {\n return (args) => {\n const converterArgs = {\n ...args,\n isEditor: false as const,\n isJSXConverter: true as const,\n }\n\n // If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component(converterArgs)\n }\n\n // If html is provided (as a function or string), use it\n // Note: Using span instead of div to avoid forcing block-level semantics\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function' ? viewDef.html(converterArgs) : viewDef.html\n\n return <span dangerouslySetInnerHTML={{ __html: htmlContent }} />\n }\n\n return null\n }\n}\n\n/**\n * Converts a LexicalEditorNodeMap into JSXConverters\n */\nfunction nodeMapToConverters(nodeMap: LexicalEditorNodeMap): JSXConverters {\n const converters: JSXConverters = {}\n\n for (const [nodeType, value] of Object.entries(nodeMap)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle special keys: blocks, inlineBlocks\n if (nodeType === 'blocks') {\n converters.blocks = {}\n for (const [blockType, _viewDef] of Object.entries(value)) {\n const viewDef = _viewDef as NodeMapValue\n if (viewDef.Component || viewDef.html) {\n converters.blocks[blockType] = createConverterFromNodeMapValue(viewDef)\n }\n }\n continue\n }\n\n if (nodeType === 'inlineBlocks') {\n converters.inlineBlocks = {}\n for (const [blockType, _viewDef] of Object.entries(value)) {\n const viewDef = _viewDef as NodeMapValue\n if (viewDef.Component || viewDef.html) {\n converters.inlineBlocks[blockType] = createConverterFromNodeMapValue(viewDef)\n }\n }\n continue\n }\n\n // Handle regular node types\n const viewDef = value as NodeMapValue\n\n if (viewDef.Component || viewDef.html) {\n converters[nodeType] = createConverterFromNodeMapValue(viewDef)\n }\n }\n\n return converters\n}\n\nexport type ConvertLexicalToJSXArgs = {\n converters: JSXConverters\n /**\n * Serialized editor state to render.\n */\n data: SerializedEditorState\n /**\n * If true, disables indentation globally. If an array, disables for specific node `type` values.\n */\n disableIndent?: boolean | string[]\n /**\n * If true, disables text alignment globally. If an array, disables for specific node `type` values.\n */\n disableTextAlign?: boolean | string[]\n /**\n * You can use the lexical editor node map or view map as converters. NodeMap converters will override converters passed\n * in the `converters` prop. If a LexicalEditorViewMap is provided, the `default` view will be used.\n */\n nodeMap?: LexicalEditorNodeMap\n}\n\nexport function convertLexicalToJSX({\n converters,\n data,\n disableIndent,\n disableTextAlign,\n nodeMap,\n}: ConvertLexicalToJSXArgs): React.ReactNode {\n if (hasText(data)) {\n // Merge nodeMap converters with existing converters\n // NodeMap converters override existing converters\n const mergedConverters = nodeMap\n ? {\n ...converters,\n ...nodeMapToConverters(nodeMap),\n }\n : converters\n\n return convertLexicalNodesToJSX({\n converters: mergedConverters,\n disableIndent,\n disableTextAlign,\n nodes: data.root.children,\n parent: data.root,\n })\n }\n return <></>\n}\n\nexport function convertLexicalNodesToJSX({\n converters,\n disableIndent,\n disableTextAlign,\n nodes,\n parent,\n}: {\n converters: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent: SerializedLexicalNodeWithParent\n}): React.ReactNode[] {\n const unknownConverter: JSXConverter<any> = converters.unknown as JSXConverter<any>\n\n const jsxArray: React.ReactNode[] = nodes.map((node, i) => {\n let converterForNode: JSXConverter<any> | undefined\n if (node.type === 'block') {\n converterForNode = converters?.blocks?.[(node as SerializedBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Blocks converter: found ${(node as SerializedBlockNode)?.fields?.blockType} block, but no converter is provided`,\n )\n }\n } else if (node.type === 'inlineBlock') {\n converterForNode =\n converters?.inlineBlocks?.[(node as SerializedInlineBlockNode)?.fields?.blockType]\n if (!converterForNode && !unknownConverter) {\n console.error(\n `Lexical => JSX converter: Inline Blocks converter: found ${(node as SerializedInlineBlockNode)?.fields?.blockType} inline block, but no converter is provided`,\n )\n }\n } else {\n converterForNode = converters[node.type] as JSXConverter<any>\n }\n\n try {\n if (!converterForNode && unknownConverter) {\n converterForNode = unknownConverter\n }\n\n let reactNode: React.ReactNode\n if (converterForNode) {\n const converted =\n typeof converterForNode === 'function'\n ? converterForNode({\n childIndex: i,\n converters,\n node,\n nodesToJSX: (args) => {\n return convertLexicalNodesToJSX({\n converters: args.converters ?? converters,\n disableIndent: args.disableIndent ?? disableIndent,\n disableTextAlign: args.disableTextAlign ?? disableTextAlign,\n nodes: args.nodes,\n parent: args.parent ?? {\n ...node,\n parent,\n },\n })\n },\n parent,\n })\n : converterForNode\n reactNode = converted\n } else {\n reactNode = <span key={i}>unknown node</span>\n }\n\n const style: React.CSSProperties = {}\n\n // Check if disableTextAlign is not true and does not include node type\n if (\n !disableTextAlign &&\n (!Array.isArray(disableTextAlign) || !disableTextAlign?.includes(node.type))\n ) {\n if ('format' in node && node.format) {\n switch (node.format) {\n case 'center':\n style.textAlign = 'center'\n break\n case 'end':\n style.textAlign = 'right'\n break\n case 'justify':\n style.textAlign = 'justify'\n break\n case 'left':\n //style.textAlign = 'left'\n // Do nothing, as left is the default\n break\n case 'right':\n style.textAlign = 'right'\n break\n case 'start':\n style.textAlign = 'left'\n break\n }\n }\n }\n\n if (\n !disableIndent &&\n (!Array.isArray(disableIndent) || !disableIndent?.includes(node.type))\n ) {\n if ('indent' in node && node.indent && node.type !== 'listitem') {\n // the unit should be px. Do not change it to rem, em, or something else.\n // The quantity should be 40px. Do not change it either.\n // See rationale in\n // https://github.com/payloadcms/payload/issues/13130#issuecomment-3058348085\n style.paddingInlineStart = `${Number(node.indent) * 40}px`\n }\n }\n\n if (React.isValidElement(reactNode)) {\n // Inject style into reactNode\n if (style.textAlign || style.paddingInlineStart) {\n const newStyle = {\n ...style,\n // @ts-expect-error type better later\n ...(reactNode?.props?.style ?? {}),\n // reactNode style comes after, thus a textAlign specified in the converter has priority over the one we inject here\n }\n\n return React.cloneElement(reactNode, {\n key: i,\n // @ts-expect-error type better later\n style: newStyle,\n })\n }\n return React.cloneElement(reactNode, {\n key: i,\n })\n }\n\n return reactNode\n } catch (error) {\n console.error('Error converting lexical node to JSX:', error, 'node:', node)\n return null\n }\n })\n\n return jsxArray.filter(Boolean)\n}\n"],"names":["React","hasText","createConverterFromNodeMapValue","viewDef","args","converterArgs","isEditor","isJSXConverter","Component","html","htmlContent","span","dangerouslySetInnerHTML","__html","nodeMapToConverters","nodeMap","converters","nodeType","value","Object","entries","blocks","blockType","_viewDef","inlineBlocks","convertLexicalToJSX","data","disableIndent","disableTextAlign","mergedConverters","convertLexicalNodesToJSX","nodes","root","children","parent","unknownConverter","unknown","jsxArray","map","node","i","converterForNode","type","fields","console","error","reactNode","converted","childIndex","nodesToJSX","style","Array","isArray","includes","format","textAlign","indent","paddingInlineStart","Number","isValidElement","newStyle","props","cloneElement","key","filter","Boolean"],"mappings":";AAAA,6BAA6B,GAG7B,OAAOA,WAAW,QAAO;AAMzB,SAASC,OAAO,QAAQ,kCAAiC;AAEzD;;CAEC,GACD,SAASC,gCAAgCC,OAAqB;IAC5D,OAAO,CAACC;QACN,MAAMC,gBAAgB;YACpB,GAAGD,IAAI;YACPE,UAAU;YACVC,gBAAgB;QAClB;QAEA,mCAAmC;QACnC,IAAIJ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D,yEAAyE;oBACzE,wDAAwD;oBACxD,mBAAmB;oBACnB,6EAA6E;oBAC7EQ,MAAMO,kBAAkB,GAAG,GAAGC,OAAOnB,KAAKiB,MAAM,IAAI,GAAG,EAAE,CAAC;gBAC5D;YACF;YAEA,kBAAIxD,MAAM2D,cAAc,CAACb,YAAY;gBACnC,8BAA8B;gBAC9B,IAAII,MAAMK,SAAS,IAAIL,MAAMO,kBAAkB,EAAE;oBAC/C,MAAMG,WAAW;wBACf,GAAGV,KAAK;wBACR,qCAAqC;wBACrC,GAAIJ,WAAWe,OAAOX,SAAS,CAAC,CAAC;oBAEnC;oBADE,oHAAoH;oBAGtH,qBAAOlD,MAAM8D,YAAY,CAAChB,WAAW;wBACnCiB,KAAKvB;wBACL,qCAAqC;wBACrCU,OAAOU;oBACT;gBACF;gBACA,qBAAO5D,MAAM8D,YAAY,CAAChB,WAAW;oBACnCiB,KAAKvB;gBACP;YACF;YAEA,OAAOM;QACT,EAAE,OAAOD,OAAO;YACdD,QAAQC,KAAK,CAAC,yCAAyCA,OAAO,SAASN;YACvE,OAAO;QACT;IACF;IAEA,OAAOF,SAAS2B,MAAM,CAACC;AACzB"}
@@ -1,12 +1,12 @@
1
1
  import type { SerializedLexicalNode } from 'lexical';
2
2
  import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js';
3
- export type JSXConverter<T extends {
3
+ export type JSXConverterArgs<TNode extends {
4
4
  [key: string]: any;
5
5
  type?: string;
6
- } = SerializedLexicalNode> = ((args: {
6
+ } = SerializedLexicalNode> = {
7
7
  childIndex: number;
8
8
  converters: JSXConverters;
9
- node: T;
9
+ node: TNode;
10
10
  nodesToJSX: (args: {
11
11
  converters?: JSXConverters;
12
12
  disableIndent?: boolean | string[];
@@ -15,8 +15,12 @@ export type JSXConverter<T extends {
15
15
  parent?: SerializedLexicalNodeWithParent;
16
16
  }) => React.ReactNode[];
17
17
  parent: SerializedLexicalNodeWithParent;
18
- }) => React.ReactNode) | React.ReactNode;
19
- export type JSXConverters<T extends {
18
+ };
19
+ export type JSXConverter<TNode extends {
20
+ [key: string]: any;
21
+ type?: string;
22
+ } = SerializedLexicalNode> = ((args: JSXConverterArgs<TNode>) => React.ReactNode) | React.ReactNode;
23
+ export type JSXConverters<TNodes extends {
20
24
  [key: string]: any;
21
25
  type?: string;
22
26
  } = DefaultNodeTypes | SerializedBlockNode<{
@@ -30,27 +34,27 @@ export type JSXConverters<T extends {
30
34
  [blockSlug: string]: JSXConverter<any>;
31
35
  } | JSXConverter<any> | undefined;
32
36
  } & {
33
- [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<Extract<T, {
37
+ [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<Extract<TNodes, {
34
38
  type: nodeType;
35
39
  }>>;
36
40
  } & {
37
41
  blocks?: {
38
- [K in Extract<Extract<T, {
42
+ [K in Extract<Extract<TNodes, {
39
43
  type: 'block';
40
44
  }> extends SerializedBlockNode<infer B> ? B extends {
41
45
  blockType: string;
42
- } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<T, {
46
+ } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<TNodes, {
43
47
  type: 'block';
44
48
  }> extends SerializedBlockNode<infer B> ? SerializedBlockNode<Extract<B, {
45
49
  blockType: K;
46
50
  }>> : SerializedBlockNode>;
47
51
  };
48
52
  inlineBlocks?: {
49
- [K in Extract<Extract<T, {
53
+ [K in Extract<Extract<TNodes, {
50
54
  type: 'inlineBlock';
51
55
  }> extends SerializedInlineBlockNode<infer B> ? B extends {
52
56
  blockType: string;
53
- } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<T, {
57
+ } ? B['blockType'] : never : never, string>]?: JSXConverter<Extract<TNodes, {
54
58
  type: 'inlineBlock';
55
59
  }> extends SerializedInlineBlockNode<infer B> ? SerializedInlineBlockNode<Extract<B, {
56
60
  blockType: K;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AACjC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IAC5F,CAAC,CAAC,IAAI,EAAE;IACN,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,CAAC,CAAA;IACP,UAAU,EAAE,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,EAAE,aAAa,CAAA;QAC1B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAA;IACvB,MAAM,EAAE,+BAA+B,CAAA;CACxC,KAAK,KAAK,CAAC,SAAS,CAAC,GACtB,KAAK,CAAC,SAAS,CAAA;AAEnB,MAAM,MAAM,aAAa,CACvB,CAAC,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3C,gBAAgB,GAChB,mBAAmB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACrE,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;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EACT,MAAM,CACP,CAAC,CAAC,EAAE,YAAY,CACf,OAAO,CAAC,CAAC,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC1E,yBAAyB,CAAC,OAAO,CAAC,CAAC,EAAE;YAAE,SAAS,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC,GACvD,yBAAyB,CAC9B;KACF,CAAA;IACD,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CAC9C,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AAEjC,MAAM,MAAM,gBAAgB,CAC1B,KAAK,SAAS;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,qBAAqB,IACzE;IACF,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,aAAa,CAAA;IACzB,IAAI,EAAE,KAAK,CAAA;IACX,UAAU,EAAE,CAAC,IAAI,EAAE;QACjB,UAAU,CAAC,EAAE,aAAa,CAAA;QAC1B,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QAClC,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;QACrC,KAAK,EAAE,qBAAqB,EAAE,CAAA;QAC9B,MAAM,CAAC,EAAE,+BAA+B,CAAA;KACzC,KAAK,KAAK,CAAC,SAAS,EAAE,CAAA;I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S;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,GAC7B,CAAC,CAAC,WAAW,CAAC,GACd,KAAK,GACP,KAAK,EACT,MAAM,CACP,CAAC,CAAC,EAAE,YAAY,CACf,OAAO,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,OAAO,CAAA;SAAE,CAAC,SAAS,mBAAmB,CAAC,MAAM,CAAC,CAAC,GACnE,mBAAmB,CAAC,OAAO,CAAC,CAAC,EAAE;YAAE,SAAS,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC,GACjD,mBAAmB,CACxB;KACF,CAAA;IACD,YAAY,CAAC,EAAE;SACZ,CAAC,IAAI,OAAO,CACX,OAAO,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC/E,CAAC,SAAS;YAAE,SAAS,EAAE,MAAM,CAAA;SAAE,GAC7B,CAAC,CAAC,WAAW,CAAC,GACd,KAAK,GACP,KAAK,EACT,MAAM,CACP,CAAC,CAAC,EAAE,YAAY,CACf,OAAO,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,aAAa,CAAA;SAAE,CAAC,SAAS,yBAAyB,CAAC,MAAM,CAAC,CAAC,GAC/E,yBAAyB,CAAC,OAAO,CAAC,CAAC,EAAE;YAAE,SAAS,EAAE,CAAC,CAAA;SAAE,CAAC,CAAC,GACvD,yBAAyB,CAC9B;KACF,CAAA;IACD,OAAO,CAAC,EAAE,YAAY,CAAC,qBAAqB,CAAC,CAAA;CAC9C,CAAA;AACD,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,EAAE,qBAAqB,CAAA;CAC/B,GAAG,qBAAqB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\nexport type JSXConverter<T extends { [key: string]: any; type?: string } = SerializedLexicalNode> =\n | ((args: {\n childIndex: number\n converters: JSXConverters\n node: T\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n }) => React.ReactNode)\n | React.ReactNode\n\nexport type JSXConverters<\n T extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<T['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<T, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<T, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<T, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<T, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<T, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n unknown?: JSXConverter<SerializedLexicalNode>\n}\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"names":[],"mappings":"AA0B4E,0FAA0F;AACnF,0FAA0F;AA2C7K,WAEyB"}
1
+ {"version":3,"sources":["../../../../../src/features/converters/lexicalToJSX/converter/types.ts"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport type {\n DefaultNodeTypes,\n SerializedBlockNode,\n SerializedInlineBlockNode,\n} from '../../../../nodeTypes.js'\n\nexport type JSXConverterArgs<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = {\n childIndex: number\n converters: JSXConverters\n node: TNode\n nodesToJSX: (args: {\n converters?: JSXConverters\n disableIndent?: boolean | string[]\n disableTextAlign?: boolean | string[]\n nodes: SerializedLexicalNode[]\n parent?: SerializedLexicalNodeWithParent\n }) => React.ReactNode[]\n parent: SerializedLexicalNodeWithParent\n}\nexport type JSXConverter<\n TNode extends { [key: string]: any; type?: string } = SerializedLexicalNode,\n> = ((args: JSXConverterArgs<TNode>) => React.ReactNode) | React.ReactNode\n\nexport type JSXConverters<\n TNodes extends { [key: string]: any; type?: string } =\n | DefaultNodeTypes\n | SerializedBlockNode<{ blockName?: null | string; blockType: string }> // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n | SerializedInlineBlockNode<{ blockName?: null | string; blockType: string }>, // need these to ensure types for blocks and inlineBlocks work if no generics are provided\n> = {\n [key: string]:\n | {\n [blockSlug: string]: JSXConverter<any>\n }\n | JSXConverter<any>\n | undefined\n} & {\n [nodeType in Exclude<NonNullable<TNodes['type']>, 'block' | 'inlineBlock'>]?: JSXConverter<\n Extract<TNodes, { type: nodeType }>\n >\n} & {\n blocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<TNodes, { type: 'block' }> extends SerializedBlockNode<infer B>\n ? SerializedBlockNode<Extract<B, { blockType: K }>>\n : SerializedBlockNode\n >\n }\n inlineBlocks?: {\n [K in Extract<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? B extends { blockType: string }\n ? B['blockType']\n : never\n : never,\n string\n >]?: JSXConverter<\n Extract<TNodes, { type: 'inlineBlock' }> extends SerializedInlineBlockNode<infer B>\n ? SerializedInlineBlockNode<Extract<B, { blockType: K }>>\n : SerializedInlineBlockNode\n >\n }\n unknown?: JSXConverter<SerializedLexicalNode>\n}\nexport type SerializedLexicalNodeWithParent = {\n parent?: SerializedLexicalNode\n} & SerializedLexicalNode\n"],"names":[],"mappings":"AA8B4E,0FAA0F;AACnF,0FAA0F;AA2C7K,WAEyB"}
@@ -1,4 +1,5 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
4
  import { useEffect, useState } from 'react';
4
5
  // eslint-disable-next-line payload/no-imports-from-exports-dir
@@ -6,7 +7,7 @@ import { defaultJSXConverters, RichText } from '../../../../../exports/react/ind
6
7
  import './style.scss';
7
8
  export function RichTextPlugin() {
8
9
  const [editor] = useLexicalComposerContext();
9
- const [editorState, setEditorState] = useState(editor.getEditorState().toJSON());
10
+ const [editorState, setEditorState] = useState(()=>editor.getEditorState().toJSON());
10
11
  useEffect(()=>{
11
12
  return editor.registerUpdateListener(({ editorState })=>{
12
13
  setEditorState(editorState.toJSON());
@@ -14,9 +15,21 @@ export function RichTextPlugin() {
14
15
  }, [
15
16
  editor
16
17
  ]);
17
- return <div className="debug-jsx-converter">
18
- <RichText converters={defaultJSXConverters} data={editorState}/>
19
- </div>;
18
+ return /*#__PURE__*/ _jsxDEV("div", {
19
+ className: "debug-jsx-converter",
20
+ children: /*#__PURE__*/ _jsxDEV(RichText, {
21
+ converters: defaultJSXConverters,
22
+ data: editorState
23
+ }, void 0, false, {
24
+ fileName: "src/features/debug/jsxConverter/client/plugin/index.tsx",
25
+ lineNumber: 22,
26
+ columnNumber: 7
27
+ }, this)
28
+ }, void 0, false, {
29
+ fileName: "src/features/debug/jsxConverter/client/plugin/index.tsx",
30
+ lineNumber: 21,
31
+ columnNumber: 5
32
+ }, this);
20
33
  }
21
34
 
22
35
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useEffect, useState } from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { defaultJSXConverters, RichText } from '../../../../../exports/react/index.js'\nimport './style.scss'\n\nexport function RichTextPlugin() {\n const [editor] = useLexicalComposerContext()\n const [editorState, setEditorState] = useState(editor.getEditorState().toJSON())\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n setEditorState(editorState.toJSON())\n })\n }, [editor])\n\n return (\n <div className=\"debug-jsx-converter\">\n <RichText converters={defaultJSXConverters} data={editorState} />\n </div>\n )\n}\n"],"names":["useLexicalComposerContext","useEffect","useState","defaultJSXConverters","RichText","RichTextPlugin","editor","editorState","setEditorState","getEditorState","toJSON","registerUpdateListener","div","className","converters","data"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE3C,+DAA+D;AAC/D,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ,wCAAuC;AACtF,OAAO,eAAc;AAErB,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAGN;IACjB,MAAM,CAACO,aAAaC,eAAe,GAAGN,SAASI,OAAOG,cAAc,GAAGC,MAAM;IAE7ET,UAAU;QACR,OAAOK,OAAOK,sBAAsB,CAAC,CAAC,EAAEJ,WAAW,EAAE;YACnDC,eAAeD,YAAYG,MAAM;QACnC;IACF,GAAG;QAACJ;KAAO;IAEX,QACGM,IAAIC,UAAU,sBAAsB;MACnC,CAACT,SAASU,YAAYX,sBAAsBY,MAAMR,cAAe;IACnE,EAAEK;AAEN"}
1
+ {"version":3,"sources":["../../../../../../src/features/debug/jsxConverter/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useEffect, useState } from 'react'\n\n// eslint-disable-next-line payload/no-imports-from-exports-dir\nimport { defaultJSXConverters, RichText } from '../../../../../exports/react/index.js'\nimport './style.scss'\n\nexport function RichTextPlugin() {\n const [editor] = useLexicalComposerContext()\n const [editorState, setEditorState] = useState(() => editor.getEditorState().toJSON())\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n setEditorState(editorState.toJSON())\n })\n }, [editor])\n\n return (\n <div className=\"debug-jsx-converter\">\n <RichText converters={defaultJSXConverters} data={editorState} />\n </div>\n )\n}\n"],"names":["useLexicalComposerContext","useEffect","useState","defaultJSXConverters","RichText","RichTextPlugin","editor","editorState","setEditorState","getEditorState","toJSON","registerUpdateListener","div","className","converters","data"],"mappings":"AAAA;;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE3C,+DAA+D;AAC/D,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ,wCAAuC;AACtF,OAAO,eAAc;AAErB,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAGN;IACjB,MAAM,CAACO,aAAaC,eAAe,GAAGN,SAAS,IAAMI,OAAOG,cAAc,GAAGC,MAAM;IAEnFT,UAAU;QACR,OAAOK,OAAOK,sBAAsB,CAAC,CAAC,EAAEJ,WAAW,EAAE;YACnDC,eAAeD,YAAYG,MAAM;QACnC;IACF,GAAG;QAACJ;KAAO;IAEX,qBACE,QAACM;QAAIC,WAAU;kBACb,cAAA,QAACT;YAASU,YAAYX;YAAsBY,MAAMR;;;;;;;;;;;AAGxD"}