@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 +1 @@
1
- {"version":3,"sources":["../../../../src/lexical/config/client/EditorConfigProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { MarkRequired } from 'ts-essentials'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { createContext, use, useMemo, useRef, useState } from 'react'\n\nimport type { InlineBlockNode } from '../../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { LexicalRichTextFieldProps } from '../../../types.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\n// Should always produce a 20 character pseudo-random string\nfunction generateQuickGuid(): string {\n return Math.random().toString(36).substring(2, 12) + Math.random().toString(36).substring(2, 12)\n}\n\nexport interface EditorConfigContextType {\n // Editor focus handling\n blurEditor: (editorContext: EditorConfigContextType) => void\n childrenEditors: React.RefObject<Map<string, EditorConfigContextType>>\n createdInlineBlock?: InlineBlockNode\n editDepth: number\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n fieldProps: MarkRequired<LexicalRichTextFieldProps, 'path' | 'schemaPath'>\n focusedEditor: EditorConfigContextType | null\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n setCreatedInlineBlock?: React.Dispatch<React.SetStateAction<InlineBlockNode | undefined>>\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\n// @ts-expect-error: TODO: Fix this\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n fieldProps: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n fieldProps,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n\n fieldProps: LexicalRichTextFieldProps\n parentContext?: EditorConfigContextType\n}): React.ReactNode => {\n const [editor] = useLexicalComposerContext()\n // State to store the UUID\n const [uuid] = useState(() => generateQuickGuid())\n\n const childrenEditors = useRef<Map<string, EditorConfigContextType>>(new Map())\n const [focusedEditor, setFocusedEditor] = useState<EditorConfigContextType | null>(null)\n const focusHistory = useRef<Set<string>>(new Set())\n const [createdInlineBlock, setCreatedInlineBlock] = useState<InlineBlockNode>()\n\n const editDepth = useEditDepth()\n\n const editorContext = useMemo(\n () =>\n ({\n blurEditor: (editorContext: EditorConfigContextType) => {\n //setFocusedEditor(null) // Clear focused editor\n focusHistory.current.clear() // Reset focus history when focus is lost\n },\n childrenEditors,\n createdInlineBlock,\n editDepth,\n editor,\n editorConfig,\n editorContainerRef,\n fieldProps,\n focusedEditor,\n focusEditor: (editorContext: EditorConfigContextType) => {\n const editorUUID = editorContext.uuid\n\n // Avoid recursion by checking if this editor is already focused in this cycle\n if (focusHistory.current.has(editorUUID)) {\n return\n }\n\n // Add this editor to the history to prevent future recursions in this cycle\n focusHistory.current.add(editorUUID)\n setFocusedEditor(editorContext)\n\n // Propagate focus event to parent and children, ensuring they do not refocus this editor\n if (parentContext?.uuid) {\n parentContext.focusEditor(editorContext)\n }\n childrenEditors.current.forEach((childEditor) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n parentEditor: parentContext,\n registerChild: (childUUID, childEditorContext) => {\n if (!childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.set(childUUID, childEditorContext)\n childrenEditors.current = newMap\n }\n },\n setCreatedInlineBlock,\n unregisterChild: (childUUID) => {\n if (childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.delete(childUUID)\n childrenEditors.current = newMap\n }\n },\n\n uuid,\n }) as EditorConfigContextType,\n [\n createdInlineBlock,\n setCreatedInlineBlock,\n editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n editDepth,\n fieldProps,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context value={editorContext}>{children}</Context>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = use(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],"names":["useLexicalComposerContext","useEditDepth","createContext","use","useMemo","useRef","useState","generateQuickGuid","Math","random","toString","substring","Context","editorConfig","fieldProps","uuid","EditorConfigProvider","children","editorContainerRef","parentContext","editor","childrenEditors","Map","focusedEditor","setFocusedEditor","focusHistory","Set","createdInlineBlock","setCreatedInlineBlock","editDepth","editorContext","blurEditor","current","clear","focusEditor","editorUUID","has","add","forEach","childEditor","parentEditor","registerChild","childUUID","childEditorContext","newMap","set","unregisterChild","delete","value","useEditorConfigContext","context","undefined","Error"],"mappings":"AAAA;AAKA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,YAAY,QAAQ,iBAAgB;AAE7C,SAASC,aAAa,EAAEC,GAAG,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAMrE,4DAA4D;AAC5D,SAASC;IACP,OAAOC,KAAKC,MAAM,GAAGC,QAAQ,CAAC,IAAIC,SAAS,CAAC,GAAG,MAAMH,KAAKC,MAAM,GAAGC,QAAQ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CAACI,GAAG,CAACM,YAAY;oBAC3C,MAAME,SAAS,IAAItB,IAAID,gBAAgBW,OAAO;oBAC9CY,OAAOC,GAAG,CAACH,WAAWC;oBACtBtB,gBAAgBW,OAAO,GAAGY;gBAC5B;YACF;YACAhB;YACAkB,iBAAiB,CAACJ;gBAChB,IAAIrB,gBAAgBW,OAAO,CAACI,GAAG,CAACM,YAAY;oBAC1C,MAAME,SAAS,IAAItB,IAAID,gBAAgBW,OAAO;oBAC9CY,OAAOG,MAAM,CAACL;oBACdrB,gBAAgBW,OAAO,GAAGY;gBAC5B;YACF;YAEA7B;QACF,CAAA,GACF;QACEY;QACAC;QACAR;QACAC;QACAR;QACAK;QACAW;QACAf;QACAS;QACAJ;QACAJ;KACD;IAGH,QAAQH,QAAQoC,OAAOlB,gBAAgBb,WAAWL;AACpD,EAAC;AAED,OAAO,MAAMqC,yBAAyB;IACpC,MAAMC,UAAU/C,IAAIS;IACpB,IAAIsC,YAAYC,WAAW;QACzB,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOF;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../src/lexical/config/client/EditorConfigProvider.tsx"],"sourcesContent":["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { MarkRequired } from 'ts-essentials'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { createContext, use, useMemo, useRef, useState } from 'react'\n\nimport type { InlineBlockNode } from '../../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { LexicalRichTextFieldProps } from '../../../types.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\n// Should always produce a 20 character pseudo-random string\nfunction generateQuickGuid(): string {\n return Math.random().toString(36).substring(2, 12) + Math.random().toString(36).substring(2, 12)\n}\n\nexport interface EditorConfigContextType {\n // Editor focus handling\n blurEditor: (editorContext: EditorConfigContextType) => void\n childrenEditors: React.RefObject<Map<string, EditorConfigContextType>>\n createdInlineBlock?: InlineBlockNode\n editDepth: number\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n fieldProps: MarkRequired<LexicalRichTextFieldProps, 'path' | 'schemaPath'>\n focusedEditor: EditorConfigContextType | null\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n setCreatedInlineBlock?: React.Dispatch<React.SetStateAction<InlineBlockNode | undefined>>\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\n// @ts-expect-error: TODO: Fix this\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n fieldProps: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n fieldProps,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n\n fieldProps: LexicalRichTextFieldProps\n parentContext?: EditorConfigContextType\n}): React.ReactNode => {\n const [editor] = useLexicalComposerContext()\n // State to store the UUID\n const [uuid] = useState(() => generateQuickGuid())\n\n const childrenEditors = useRef<Map<string, EditorConfigContextType>>(new Map())\n const [focusedEditor, setFocusedEditor] = useState<EditorConfigContextType | null>(null)\n const focusHistory = useRef<Set<string>>(new Set())\n const [createdInlineBlock, setCreatedInlineBlock] = useState<InlineBlockNode>()\n\n const editDepth = useEditDepth()\n\n const editorContext = useMemo(\n () =>\n ({\n blurEditor: (editorContext: EditorConfigContextType) => {\n //setFocusedEditor(null) // Clear focused editor\n focusHistory.current.clear() // Reset focus history when focus is lost\n },\n childrenEditors,\n createdInlineBlock,\n editDepth,\n editor,\n editorConfig,\n editorContainerRef,\n fieldProps,\n focusedEditor,\n focusEditor: (editorContext: EditorConfigContextType) => {\n const editorUUID = editorContext.uuid\n\n // Avoid recursion by checking if this editor is already focused in this cycle\n if (focusHistory.current.has(editorUUID)) {\n return\n }\n\n // Add this editor to the history to prevent future recursions in this cycle\n focusHistory.current.add(editorUUID)\n setFocusedEditor(editorContext)\n\n // Propagate focus event to parent and children, ensuring they do not refocus this editor\n if (parentContext?.uuid) {\n parentContext.focusEditor(editorContext)\n }\n childrenEditors.current.forEach((childEditor) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n parentEditor: parentContext,\n registerChild: (childUUID, childEditorContext) => {\n if (!childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.set(childUUID, childEditorContext)\n childrenEditors.current = newMap\n }\n },\n setCreatedInlineBlock,\n unregisterChild: (childUUID) => {\n if (childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.delete(childUUID)\n childrenEditors.current = newMap\n }\n },\n\n uuid,\n }) as EditorConfigContextType,\n [\n createdInlineBlock,\n setCreatedInlineBlock,\n editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n editDepth,\n fieldProps,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context value={editorContext}>{children}</Context>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = use(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],"names":["useLexicalComposerContext","useEditDepth","React","createContext","use","useMemo","useRef","useState","generateQuickGuid","Math","random","toString","substring","Context","editorConfig","fieldProps","uuid","EditorConfigProvider","children","editorContainerRef","parentContext","editor","childrenEditors","Map","focusedEditor","setFocusedEditor","focusHistory","Set","createdInlineBlock","setCreatedInlineBlock","editDepth","editorContext","blurEditor","current","clear","focusEditor","editorUUID","has","add","forEach","childEditor","parentEditor","registerChild","childUUID","childEditorContext","newMap","set","unregisterChild","delete","value","useEditorConfigContext","context","undefined","Error"],"mappings":"AAAA;;AAKA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,YAAY,QAAQ,iBAAgB;AAC7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AAM;oBACvBI,cAAce,WAAW,CAACJ;gBAC5B;gBACAT,gBAAgBW,OAAO,CAACM,OAAO,CAAC,CAACC;oBAC/BA,YAAYL,WAAW,CAACJ;gBAC1B;gBAEAL,aAAaO,OAAO,CAACC,KAAK;YAC5B;YACAO,cAAcrB;YACdsB,eAAe,CAACC,WAAWC;gBACzB,IAAI,CAACtB,gBAAgBW,OAAO,CAACI,GAAG,CAACM,YAAY;oBAC3C,MAAME,SAAS,IAAItB,IAAID,gBAAgBW,OAAO;oBAC9CY,OAAOC,GAAG,CAACH,WAAWC;oBACtBtB,gBAAgBW,OAAO,GAAGY;gBAC5B;YACF;YACAhB;YACAkB,iBAAiB,CAACJ;gBAChB,IAAIrB,gBAAgBW,OAAO,CAACI,GAAG,CAACM,YAAY;oBAC1C,MAAME,SAAS,IAAItB,IAAID,gBAAgBW,OAAO;oBAC9CY,OAAOG,MAAM,CAACL;oBACdrB,gBAAgBW,OAAO,GAAGY;gBAC5B;YACF;YAEA7B;QACF,CAAA,GACF;QACEY;QACAC;QACAR;QACAC;QACAR;QACAK;QACAW;QACAf;QACAS;QACAJ;QACAJ;KACD;IAGH,qBAAO,QAACH;QAAQoC,OAAOlB;kBAAgBb;;;;;;AACzC,EAAC;AAED,OAAO,MAAMgC,yBAAyB;IACpC,MAAMC,UAAU/C,IAAIS;IACpB,IAAIsC,YAAYC,WAAW;QACzB,MAAM,IAAIC,MAAM;IAClB;IACA,OAAOF;AACT,EAAC"}
@@ -3,5 +3,5 @@ import type { ResolvedClientFeatureMap, SanitizedClientFeatures } from '../../..
3
3
  import type { LexicalFieldAdminClientProps } from '../../../types.js';
4
4
  import type { SanitizedClientEditorConfig } from '../types.js';
5
5
  export declare const sanitizeClientFeatures: (features: ResolvedClientFeatureMap) => SanitizedClientFeatures;
6
- export declare function sanitizeClientEditorConfig(resolvedClientFeatureMap: ResolvedClientFeatureMap, lexical?: LexicalEditorConfig, admin?: LexicalFieldAdminClientProps): SanitizedClientEditorConfig;
6
+ export declare function sanitizeClientEditorConfig(resolvedClientFeatureMap: ResolvedClientFeatureMap, lexical?: LexicalEditorConfig, admin?: LexicalFieldAdminClientProps, view?: string): SanitizedClientEditorConfig;
7
7
  //# sourceMappingURL=sanitize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKlE,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAE9D,eAAO,MAAM,sBAAsB,aACvB,wBAAwB,KACjC,uBAiOF,CAAA;AAED,wBAAgB,0BAA0B,CACxC,wBAAwB,EAAE,wBAAwB,EAClD,OAAO,CAAC,EAAE,mBAAmB,EAC7B,KAAK,CAAC,EAAE,4BAA4B,GACnC,2BAA2B,CAO7B"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/client/sanitize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAKlE,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAE9D,eAAO,MAAM,sBAAsB,aACvB,wBAAwB,KACjC,uBAiOF,CAAA;AAED,wBAAgB,0BAA0B,CACxC,wBAAwB,EAAE,wBAAwB,EAClD,OAAO,CAAC,EAAE,mBAAmB,EAC7B,KAAK,CAAC,EAAE,4BAA4B,EACpC,IAAI,CAAC,EAAE,MAAM,GACZ,2BAA2B,CAQ7B"}
@@ -195,12 +195,13 @@ export const sanitizeClientFeatures = (features)=>{
195
195
  }
196
196
  return sanitized;
197
197
  };
198
- export function sanitizeClientEditorConfig(resolvedClientFeatureMap, lexical, admin) {
198
+ export function sanitizeClientEditorConfig(resolvedClientFeatureMap, lexical, admin, view) {
199
199
  return {
200
200
  admin,
201
201
  features: sanitizeClientFeatures(resolvedClientFeatureMap),
202
202
  lexical: lexical,
203
- resolvedFeatureMap: resolvedClientFeatureMap
203
+ resolvedFeatureMap: resolvedClientFeatureMap,
204
+ view
204
205
  };
205
206
  }
206
207
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lexical/config/client/sanitize.ts"],"sourcesContent":["'use client'\n\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical'\n\nimport { deepMerge } from 'payload/shared'\n\nimport type { ToolbarGroup } from '../../../features/toolbars/types.js'\nimport type {\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n} from '../../../features/typesClient.js'\nimport type { LexicalFieldAdminClientProps } from '../../../types.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\nexport const sanitizeClientFeatures = (\n features: ResolvedClientFeatureMap,\n): SanitizedClientFeatures => {\n const sanitized: SanitizedClientFeatures = {\n enabledFeatures: [],\n enabledFormats: [],\n markdownTransformers: [],\n nodes: [],\n plugins: [],\n providers: [],\n slashMenu: {\n dynamicGroups: [],\n groups: [],\n },\n toolbarFixed: {\n groups: [],\n },\n toolbarInline: {\n groups: [],\n },\n }\n\n // Allow customization of groups for toolbarFixed\n let customGroups: Record<string, Partial<ToolbarGroup>> = {}\n features.forEach((feature) => {\n if (feature.key === 'toolbarFixed' && feature.sanitizedClientFeatureProps?.customGroups) {\n customGroups = {\n ...customGroups,\n ...feature.sanitizedClientFeatureProps.customGroups,\n }\n }\n })\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature.providers?.length) {\n sanitized.providers = sanitized.providers.concat(feature.providers)\n }\n\n if (feature.enableFormats?.length) {\n sanitized.enabledFormats.push(...feature.enableFormats)\n }\n\n if (feature.nodes?.length) {\n // Important: do not use concat\n for (const node of feature.nodes) {\n sanitized.nodes.push(node)\n }\n }\n if (feature.plugins?.length) {\n feature.plugins.forEach((plugin, i) => {\n sanitized.plugins?.push({\n clientProps: feature.sanitizedClientFeatureProps,\n Component: plugin.Component as any, // Appeases strict: true\n key: feature.key + i,\n position: plugin.position,\n })\n })\n }\n\n if (feature.toolbarInline?.groups?.length) {\n for (const group of feature.toolbarInline.groups) {\n // 1. find the group with the same key or create new one\n let foundGroup = sanitized.toolbarInline.groups.find(\n (sanitizedGroup) => sanitizedGroup.key === group.key,\n )\n if (!foundGroup) {\n foundGroup = {\n ...group,\n items: [],\n }\n } else {\n sanitized.toolbarInline.groups = sanitized.toolbarInline.groups.filter(\n (sanitizedGroup) => sanitizedGroup.key !== group.key,\n )\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (group?.items?.length) {\n foundGroup.items = foundGroup.items.concat(group.items)\n }\n sanitized.toolbarInline?.groups.push(foundGroup)\n }\n }\n\n if (feature.toolbarFixed?.groups?.length) {\n for (const group of feature.toolbarFixed.groups) {\n // 1. find the group with the same key or create new one\n let foundGroup = sanitized.toolbarFixed.groups.find(\n (sanitizedGroup) => sanitizedGroup.key === group.key,\n )\n if (!foundGroup) {\n foundGroup = {\n ...group,\n items: [],\n }\n } else {\n sanitized.toolbarFixed.groups = sanitized.toolbarFixed.groups.filter(\n (sanitizedGroup) => sanitizedGroup.key !== group.key,\n )\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (group?.items?.length) {\n foundGroup.items = foundGroup.items.concat(group.items)\n }\n sanitized.toolbarFixed?.groups.push(foundGroup)\n }\n }\n\n if (feature.slashMenu?.groups) {\n if (feature.slashMenu.dynamicGroups?.length) {\n sanitized.slashMenu.dynamicGroups = sanitized.slashMenu.dynamicGroups.concat(\n feature.slashMenu.dynamicGroups,\n )\n }\n\n for (const optionGroup of feature.slashMenu.groups) {\n // 1. find the group with the same name or create new one\n let group = sanitized.slashMenu.groups.find((group) => group.key === optionGroup.key)\n if (!group) {\n group = {\n ...optionGroup,\n items: [],\n }\n } else {\n sanitized.slashMenu.groups = sanitized.slashMenu.groups.filter(\n (group) => group.key !== optionGroup.key,\n )\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (optionGroup?.items?.length) {\n group.items = group.items.concat(optionGroup.items)\n }\n sanitized.slashMenu.groups.push(group)\n }\n }\n\n if (feature.markdownTransformers?.length) {\n // Important: do not use concat\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n sanitized.enabledFeatures.push(feature.key)\n })\n\n // Apply custom group configurations to toolbarFixed groups\n if (Object.keys(customGroups).length > 0) {\n sanitized.toolbarFixed.groups = sanitized.toolbarFixed.groups.map((group) => {\n const customConfig = customGroups[group.key]\n if (customConfig) {\n return deepMerge(group, customConfig)\n }\n return group\n })\n }\n\n // Sort sanitized.toolbarInline.groups by order property\n sanitized.toolbarInline.groups.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n // Sort sanitized.toolbarFixed.groups by order property\n sanitized.toolbarFixed.groups.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n\n // Sort sanitized.toolbarInline.groups.[group].entries by order property\n for (const group of sanitized.toolbarInline.groups) {\n group.items.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n }\n\n // Sort sanitized.toolbarFixed.groups.[group].entries by order property\n for (const group of sanitized.toolbarFixed.groups) {\n group.items.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n }\n\n return sanitized\n}\n\nexport function sanitizeClientEditorConfig(\n resolvedClientFeatureMap: ResolvedClientFeatureMap,\n lexical?: LexicalEditorConfig,\n admin?: LexicalFieldAdminClientProps,\n): SanitizedClientEditorConfig {\n return {\n admin,\n features: sanitizeClientFeatures(resolvedClientFeatureMap),\n lexical: lexical!,\n resolvedFeatureMap: resolvedClientFeatureMap,\n }\n}\n"],"names":["deepMerge","sanitizeClientFeatures","features","sanitized","enabledFeatures","enabledFormats","markdownTransformers","nodes","plugins","providers","slashMenu","dynamicGroups","groups","toolbarFixed","toolbarInline","customGroups","forEach","feature","key","sanitizedClientFeatureProps","size","length","concat","enableFormats","push","node","plugin","i","clientProps","Component","position","group","foundGroup","find","sanitizedGroup","items","filter","optionGroup","transformer","allNodes","allTransformers","Object","keys","map","customConfig","sort","a","b","order","sanitizeClientEditorConfig","resolvedClientFeatureMap","lexical","admin","resolvedFeatureMap"],"mappings":"AAAA;AAIA,SAASA,SAAS,QAAQ,iBAAgB;AAU1C,OAAO,MAAMC,yBAAyB,CACpCC;IAEA,MAAMC,YAAqC;QACzCC,iBAAiB,EAAE;QACnBC,gBAAgB,EAAE;QAClBC,sBAAsB,EAAE;QACxBC,OAAO,EAAE;QACTC,SAAS,EAAE;QACXC,WAAW,EAAE;QACbC,WAAW;YACTC,eAAe,EAAE;YACjBC,QAAQ,EAAE;QACZ;QACAC,cAAc;YACZD,QAAQ,EAAE;QACZ;QACAE,eAAe;YACbF,QAAQ,EAAE;QACZ;IACF;IAEA,iDAAiD;IACjD,IAAIG,eAAsD,CAAC;IAC3Db,SAASc,OAAO,CAAC,CAACC;QAChB,IAAIA,QAAQC,GAAG,KAAK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AID,EAAEC,KAAK,EAAE;gBACtB,OAAOF,EAAEE,KAAK,GAAGD,EAAEC,KAAK;YAC1B,OAAO,IAAIF,EAAEE,KAAK,EAAE;gBAClB,OAAO,CAAC;YACV,OAAO,IAAID,EAAEC,KAAK,EAAE;gBAClB,OAAO;YACT,OAAO;gBACL,OAAO;YACT;QACF;IACF;IAEA,OAAO7C;AACT,EAAC;AAED,OAAO,SAAS8C,2BACdC,wBAAkD,EAClDC,OAA6B,EAC7BC,KAAoC;IAEpC,OAAO;QACLA;QACAlD,UAAUD,uBAAuBiD;QACjCC,SAASA;QACTE,oBAAoBH;IACtB;AACF"}
1
+ {"version":3,"sources":["../../../../src/lexical/config/client/sanitize.ts"],"sourcesContent":["'use client'\n\nimport type { EditorConfig as LexicalEditorConfig } from 'lexical'\n\nimport { deepMerge } from 'payload/shared'\n\nimport type { ToolbarGroup } from '../../../features/toolbars/types.js'\nimport type {\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n} from '../../../features/typesClient.js'\nimport type { LexicalFieldAdminClientProps } from '../../../types.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\nexport const sanitizeClientFeatures = (\n features: ResolvedClientFeatureMap,\n): SanitizedClientFeatures => {\n const sanitized: SanitizedClientFeatures = {\n enabledFeatures: [],\n enabledFormats: [],\n markdownTransformers: [],\n nodes: [],\n plugins: [],\n providers: [],\n slashMenu: {\n dynamicGroups: [],\n groups: [],\n },\n toolbarFixed: {\n groups: [],\n },\n toolbarInline: {\n groups: [],\n },\n }\n\n // Allow customization of groups for toolbarFixed\n let customGroups: Record<string, Partial<ToolbarGroup>> = {}\n features.forEach((feature) => {\n if (feature.key === 'toolbarFixed' && feature.sanitizedClientFeatureProps?.customGroups) {\n customGroups = {\n ...customGroups,\n ...feature.sanitizedClientFeatureProps.customGroups,\n }\n }\n })\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature.providers?.length) {\n sanitized.providers = sanitized.providers.concat(feature.providers)\n }\n\n if (feature.enableFormats?.length) {\n sanitized.enabledFormats.push(...feature.enableFormats)\n }\n\n if (feature.nodes?.length) {\n // Important: do not use concat\n for (const node of feature.nodes) {\n sanitized.nodes.push(node)\n }\n }\n if (feature.plugins?.length) {\n feature.plugins.forEach((plugin, i) => {\n sanitized.plugins?.push({\n clientProps: feature.sanitizedClientFeatureProps,\n Component: plugin.Component as any, // Appeases strict: true\n key: feature.key + i,\n position: plugin.position,\n })\n })\n }\n\n if (feature.toolbarInline?.groups?.length) {\n for (const group of feature.toolbarInline.groups) {\n // 1. find the group with the same key or create new one\n let foundGroup = sanitized.toolbarInline.groups.find(\n (sanitizedGroup) => sanitizedGroup.key === group.key,\n )\n if (!foundGroup) {\n foundGroup = {\n ...group,\n items: [],\n }\n } else {\n sanitized.toolbarInline.groups = sanitized.toolbarInline.groups.filter(\n (sanitizedGroup) => sanitizedGroup.key !== group.key,\n )\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (group?.items?.length) {\n foundGroup.items = foundGroup.items.concat(group.items)\n }\n sanitized.toolbarInline?.groups.push(foundGroup)\n }\n }\n\n if (feature.toolbarFixed?.groups?.length) {\n for (const group of feature.toolbarFixed.groups) {\n // 1. find the group with the same key or create new one\n let foundGroup = sanitized.toolbarFixed.groups.find(\n (sanitizedGroup) => sanitizedGroup.key === group.key,\n )\n if (!foundGroup) {\n foundGroup = {\n ...group,\n items: [],\n }\n } else {\n sanitized.toolbarFixed.groups = sanitized.toolbarFixed.groups.filter(\n (sanitizedGroup) => sanitizedGroup.key !== group.key,\n )\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (group?.items?.length) {\n foundGroup.items = foundGroup.items.concat(group.items)\n }\n sanitized.toolbarFixed?.groups.push(foundGroup)\n }\n }\n\n if (feature.slashMenu?.groups) {\n if (feature.slashMenu.dynamicGroups?.length) {\n sanitized.slashMenu.dynamicGroups = sanitized.slashMenu.dynamicGroups.concat(\n feature.slashMenu.dynamicGroups,\n )\n }\n\n for (const optionGroup of feature.slashMenu.groups) {\n // 1. find the group with the same name or create new one\n let group = sanitized.slashMenu.groups.find((group) => group.key === optionGroup.key)\n if (!group) {\n group = {\n ...optionGroup,\n items: [],\n }\n } else {\n sanitized.slashMenu.groups = sanitized.slashMenu.groups.filter(\n (group) => group.key !== optionGroup.key,\n )\n }\n\n // 2. Add options to group options array and add to sanitized.slashMenu.groupsWithOptions\n if (optionGroup?.items?.length) {\n group.items = group.items.concat(optionGroup.items)\n }\n sanitized.slashMenu.groups.push(group)\n }\n }\n\n if (feature.markdownTransformers?.length) {\n // Important: do not use concat\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n sanitized.enabledFeatures.push(feature.key)\n })\n\n // Apply custom group configurations to toolbarFixed groups\n if (Object.keys(customGroups).length > 0) {\n sanitized.toolbarFixed.groups = sanitized.toolbarFixed.groups.map((group) => {\n const customConfig = customGroups[group.key]\n if (customConfig) {\n return deepMerge(group, customConfig)\n }\n return group\n })\n }\n\n // Sort sanitized.toolbarInline.groups by order property\n sanitized.toolbarInline.groups.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n // Sort sanitized.toolbarFixed.groups by order property\n sanitized.toolbarFixed.groups.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n\n // Sort sanitized.toolbarInline.groups.[group].entries by order property\n for (const group of sanitized.toolbarInline.groups) {\n group.items.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n }\n\n // Sort sanitized.toolbarFixed.groups.[group].entries by order property\n for (const group of sanitized.toolbarFixed.groups) {\n group.items.sort((a, b) => {\n if (a.order && b.order) {\n return a.order - b.order\n } else if (a.order) {\n return -1\n } else if (b.order) {\n return 1\n } else {\n return 0\n }\n })\n }\n\n return sanitized\n}\n\nexport function sanitizeClientEditorConfig(\n resolvedClientFeatureMap: ResolvedClientFeatureMap,\n lexical?: LexicalEditorConfig,\n admin?: LexicalFieldAdminClientProps,\n view?: string,\n): SanitizedClientEditorConfig {\n return {\n admin,\n features: sanitizeClientFeatures(resolvedClientFeatureMap),\n lexical: lexical!,\n resolvedFeatureMap: resolvedClientFeatureMap,\n view,\n }\n}\n"],"names":["deepMerge","sanitizeClientFeatures","features","sanitized","enabledFeatures","enabledFormats","markdownTransformers","nodes","plugins","providers","slashMenu","dynamicGroups","groups","toolbarFixed","toolbarInline","customGroups","forEach","feature","key","sanitizedClientFeatureProps","size","length","concat","enableFormats","push","node","plugin","i","clientProps","Component","position","group","foundGroup","find","sanitizedGroup","items","filter","optionGroup","transformer","allNodes","allTransformers","Object","keys","map","customConfig","sort","a","b","order","sanitizeClientEditorConfig","resolvedClientFeatureMap","lexical","admin","view","resolvedFeatureMap"],"mappings":"AAAA;AAIA,SAASA,SAAS,QAAQ,iBAAgB;AAU1C,OAAO,MAAMC,yBAAyB,CACpCC;IAEA,MAAMC,YAAqC;QACzCC,iBAAiB,EAAE;QACnBC,gBAAgB,EAAE;QAClBC,sBAAsB,EAAE;QACxBC,OAAO,EAAE;QACTC,SAAS,EAAE;QACXC,WAAW,EAAE;QACbC,WAAW;YACTC,eAAe,EAAE;YACjBC,QAAQ,EAAE;QACZ;QACAC,cAAc;YACZD,QAAQ,EAAE;QACZ;QACAE,eAAe;YACbF,QAAQ,EAAE;QACZ;IACF;IAEA,iDAAiD;IACjD,IAAIG,eAAsD,CAAC;IAC3Db,SAASc,OAAO,CAAC,CAACC;QAChB,IAAIA,QAAQC,GAAG,KAAK,kBAAkBD,QAAQE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EAAE;gBACtB,OAAOF,EAAEE,KAAK,GAAGD,EAAEC,KAAK;YAC1B,OAAO,IAAIF,EAAEE,KAAK,EAAE;gBAClB,OAAO,CAAC;YACV,OAAO,IAAID,EAAEC,KAAK,EAAE;gBAClB,OAAO;YACT,OAAO;gBACL,OAAO;YACT;QACF;IACF;IAEA,OAAO7C;AACT,EAAC;AAED,OAAO,SAAS8C,2BACdC,wBAAkD,EAClDC,OAA6B,EAC7BC,KAAoC,EACpCC,IAAa;IAEb,OAAO;QACLD;QACAlD,UAAUD,uBAAuBiD;QACjCC,SAASA;QACTG,oBAAoBJ;QACpBG;IACF;AACF"}
@@ -20,5 +20,9 @@ export type SanitizedClientEditorConfig = {
20
20
  features: SanitizedClientFeatures;
21
21
  lexical: LexicalEditorConfig;
22
22
  resolvedFeatureMap: ResolvedClientFeatureMap;
23
+ /**
24
+ * To identify what view this editor config was created for.
25
+ */
26
+ view?: string;
23
27
  };
24
28
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lexical/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElE,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EACV,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,+BAA+B,CAAA;AACtC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAA;AAElE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,CAAA;IAChD,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,u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,EAAE,GAAG,CAAC,EAAE,CAAA;IAC3C,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAC9B,CAAA;AAED,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,CAAC,EAAE,4BAA4B,CAAA;IACpC,QAAQ,EAAE,uBAAuB,CAAA;IACjC,OAAO,EAAE,mBAAmB,CAAA;IAC5B,kBAAkB,EAAE,wBAAwB,CAAA;IAC5C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA"}
@@ -1,5 +1,7 @@
1
1
  // If undefined, the default lexical editor config will be used. This can be undefined so that we do not send the default lexical editor config to the client.
2
2
  // If undefined, the default lexical editor config will be used. This can be undefined so that we do not send the default lexical editor config to the client.
3
- export { };
3
+ export { }; /**
4
+ * To identify what view this editor config was created for.
5
+ */
4
6
 
5
7
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lexical/config/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig } from 'lexical'\n\nimport type {\n FeatureProviderClient,\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n} from '../../features/typesClient.js'\nimport type {\n FeatureProviderServer,\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../features/typesServer.js'\nimport type { LexicalFieldAdminClientProps } from '../../types.js'\n\nexport type ServerEditorConfig = {\n features: FeatureProviderServer<any, any, any>[]\n lexical?: LexicalEditorConfig | undefined // If undefined, the default lexical editor config will be used. This can be undefined so that we do not send the default lexical editor config to the client.\n}\n\nexport type SanitizedServerEditorConfig = {\n features: SanitizedServerFeatures\n lexical: LexicalEditorConfig | undefined // If undefined, the default lexical editor config will be used. This can be undefined so that we do not send the default lexical editor config to the client.\n resolvedFeatureMap: ResolvedServerFeatureMap\n}\n\nexport type ClientEditorConfig = {\n features: FeatureProviderClient<any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type SanitizedClientEditorConfig = {\n admin?: LexicalFieldAdminClientProps\n features: SanitizedClientFeatures\n lexical: LexicalEditorConfig\n resolvedFeatureMap: ResolvedClientFeatureMap\n}\n"],"names":[],"mappings":"AAgB4C,8JAA8J;AAK/J,8JAA8J;AASzM,WAKC"}
1
+ {"version":3,"sources":["../../../src/lexical/config/types.ts"],"sourcesContent":["import type { EditorConfig as LexicalEditorConfig } from 'lexical'\n\nimport type {\n FeatureProviderClient,\n ResolvedClientFeatureMap,\n SanitizedClientFeatures,\n} from '../../features/typesClient.js'\nimport type {\n FeatureProviderServer,\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../features/typesServer.js'\nimport type { LexicalFieldAdminClientProps } from '../../types.js'\n\nexport type ServerEditorConfig = {\n features: FeatureProviderServer<any, any, any>[]\n lexical?: LexicalEditorConfig | undefined // If undefined, the default lexical editor config will be used. This can be undefined so that we do not send the default lexical editor config to the client.\n}\n\nexport type SanitizedServerEditorConfig = {\n features: SanitizedServerFeatures\n lexical: LexicalEditorConfig | undefined // If undefined, the default lexical editor config will be used. This can be undefined so that we do not send the default lexical editor config to the client.\n resolvedFeatureMap: ResolvedServerFeatureMap\n}\n\nexport type ClientEditorConfig = {\n features: FeatureProviderClient<any, any>[]\n lexical?: LexicalEditorConfig\n}\n\nexport type SanitizedClientEditorConfig = {\n admin?: LexicalFieldAdminClientProps\n features: SanitizedClientFeatures\n lexical: LexicalEditorConfig\n resolvedFeatureMap: ResolvedClientFeatureMap\n /**\n * To identify what view this editor config was created for.\n */\n view?: string\n}\n"],"names":[],"mappings":"AAgB4C,8JAA8J;AAK/J,8JAA8J;AASzM,WASC,CAJC;;GAEC"}
@@ -1,8 +1,18 @@
1
- import type { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical';
1
+ import type { Klass, LexicalEditor, LexicalNode, LexicalNodeReplacement } from 'lexical';
2
2
  import type { NodeWithHooks } from '../../features/typesServer.js';
3
+ import type { LexicalEditorNodeMap } from '../../types.js';
3
4
  import type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js';
4
- export declare function getEnabledNodes({ editorConfig, }: {
5
+ /**
6
+ * Register view definitions for an editor
7
+ */
8
+ export declare function registerEditorNodeViews(editor: LexicalEditor, nodeViews: LexicalEditorNodeMap): void;
9
+ /**
10
+ * Clear all view overrides for an editor (restores default rendering)
11
+ */
12
+ export declare function clearEditorNodeViews(editor: LexicalEditor): void;
13
+ export declare function getEnabledNodes({ editorConfig, nodeViews, }: {
5
14
  editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig;
15
+ nodeViews?: LexicalEditorNodeMap;
6
16
  }): Array<Klass<LexicalNode> | LexicalNodeReplacement>;
7
17
  export declare function getEnabledNodesFromServerNodes({ nodes, }: {
8
18
  nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lexical/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAElG,wBAAgB,eAAe,CAAC,EAC9B,YAAY,GACb,EAAE;IACD,YAAY,EAAE,2BAA2B,GAAG,2BAA2B,CAAA;CACxE,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAIrD;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,KAAK,GACN,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAA;CACjF,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAOrD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lexical/nodes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,KAAK,EACL,aAAa,EACb,WAAW,EACX,sBAAsB,EACvB,MAAM,SAAS,CAAA;AAIhB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAgB,MAAM,gBAAgB,CAAA;AACxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAMlG;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,oBAAoB,GAC9B,IAAI,CAsCN;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAEhE;AAoID,wBAAgB,eAAe,CAAC,EAC9B,YAAY,EACZ,SAAS,GACV,EAAE;IACD,YAAY,EAAE,2BAA2B,GAAG,2BAA2B,CAAA;IACvE,SAAS,CAAC,EAAE,oBAAoB,CAAA;CACjC,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAyCrD;AAED,wBAAgB,8BAA8B,CAAC,EAC7C,KAAK,GACN,EAAE;IACD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAA;CACjF,GAAG,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,sBAAsB,CAAC,CAOrD"}
@@ -1,7 +1,192 @@
1
- export function getEnabledNodes({ editorConfig }) {
2
- return getEnabledNodesFromServerNodes({
1
+ import React from 'react';
2
+ // Store view definitions for each editor and node type
3
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4
+ const editorNodeViews = new WeakMap();
5
+ /**
6
+ * Register view definitions for an editor
7
+ */ export function registerEditorNodeViews(editor, nodeViews) {
8
+ if (!editorNodeViews.has(editor)) {
9
+ editorNodeViews.set(editor, new Map());
10
+ }
11
+ const editorViews = editorNodeViews.get(editor);
12
+ // Register each node type's view
13
+ for (const [nodeType, value] of Object.entries(nodeViews)){
14
+ if (!value || typeof value !== 'object') {
15
+ continue;
16
+ }
17
+ // Handle blocks specially - store each block type with key 'block:blockType'
18
+ if (nodeType === 'blocks') {
19
+ for (const [blockType, viewDef] of Object.entries(// eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ value)){
21
+ editorViews.set(`block:${blockType}`, viewDef);
22
+ }
23
+ continue;
24
+ }
25
+ // Handle inlineBlocks specially - store each block type with key 'inlineBlock:blockType'
26
+ if (nodeType === 'inlineBlocks') {
27
+ for (const [blockType, viewDef] of Object.entries(// eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ value)){
29
+ editorViews.set(`inlineBlock:${blockType}`, viewDef);
30
+ }
31
+ continue;
32
+ }
33
+ // Regular node types
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ editorViews.set(nodeType, value);
36
+ }
37
+ }
38
+ /**
39
+ * Clear all view overrides for an editor (restores default rendering)
40
+ */ export function clearEditorNodeViews(editor) {
41
+ editorNodeViews.delete(editor);
42
+ }
43
+ /**
44
+ * Get the view definition for a specific editor and node
45
+ */ function getEditorNodeView(editor, nodeType, // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ node) // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ {
48
+ const editorViews = editorNodeViews.get(editor);
49
+ // For block nodes, look up by blockType
50
+ if (nodeType === 'block' && node?.['__fields']?.blockType) {
51
+ const blockType = node['__fields'].blockType;
52
+ return editorViews?.get(`block:${blockType}`);
53
+ }
54
+ // For inlineBlock nodes, look up by blockType
55
+ if (nodeType === 'inlineBlock' && node?.['__fields']?.blockType) {
56
+ const blockType = node['__fields'].blockType;
57
+ return editorViews?.get(`inlineBlock:${blockType}`);
58
+ }
59
+ // Regular node types
60
+ return editorViews?.get(nodeType);
61
+ }
62
+ /**
63
+ * Apply view overrides to a specific node type by modifying its prototype
64
+ * Uses WeakMap to check per-editor at runtime
65
+ */ function applyNodeOverride({ node, nodeType }) {
66
+ if (!('getType' in node) || node.getType() !== nodeType) {
67
+ return;
68
+ }
69
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
70
+ const NodeClass = node;
71
+ // Store original methods if not already stored
72
+ if (!NodeClass.prototype._originalDecorate) {
73
+ NodeClass.prototype._originalDecorate = NodeClass.prototype.decorate;
74
+ }
75
+ if (!NodeClass.prototype._originalCreateDOM) {
76
+ NodeClass.prototype._originalCreateDOM = NodeClass.prototype.createDOM;
77
+ }
78
+ // Override decorate method (for DecoratorNodes)
79
+ if (NodeClass.prototype.decorate && !NodeClass.prototype._decorateOverridden) {
80
+ NodeClass.prototype._decorateOverridden = true;
81
+ const hasCreateDOM = !!NodeClass.prototype.createDOM;
82
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
+ NodeClass.prototype.decorate = function(editor, config) {
84
+ const viewDef = getEditorNodeView(editor, nodeType, this);
85
+ if (viewDef) {
86
+ // Priority 1: If Component is provided, use it
87
+ if (viewDef.Component) {
88
+ return viewDef.Component({
89
+ config,
90
+ editor,
91
+ isEditor: true,
92
+ isJSXConverter: false,
93
+ node: this
94
+ });
95
+ }
96
+ // Priority 2: If custom createDOM is provided, use html in decorate
97
+ if (viewDef.createDOM && viewDef.html) {
98
+ const htmlContent = typeof viewDef.html === 'function' ? viewDef.html({
99
+ config,
100
+ editor,
101
+ isEditor: true,
102
+ isJSXConverter: false,
103
+ node: this
104
+ }) : viewDef.html;
105
+ return React.createElement('span', {
106
+ dangerouslySetInnerHTML: {
107
+ __html: htmlContent
108
+ }
109
+ });
110
+ }
111
+ // Priority 3: If only html is provided (no custom createDOM),
112
+ // createDOM will handle it, so decorate returns empty fragment
113
+ if (viewDef.html && hasCreateDOM && !viewDef.createDOM) {
114
+ return React.createElement(React.Fragment);
115
+ }
116
+ }
117
+ // Otherwise use original
118
+ return NodeClass.prototype._originalDecorate.call(this, editor, config);
119
+ };
120
+ }
121
+ // Override createDOM method (for ElementNodes)
122
+ if (NodeClass.prototype.createDOM && !NodeClass.prototype._createDOMOverridden) {
123
+ NodeClass.prototype._createDOMOverridden = true;
124
+ NodeClass.prototype.createDOM = function(config, editor) {
125
+ const viewDef = getEditorNodeView(editor, nodeType, this);
126
+ if (viewDef) {
127
+ // If createDOM is provided, use it
128
+ if (viewDef.createDOM) {
129
+ return viewDef.createDOM({
130
+ config,
131
+ editor,
132
+ node: this
133
+ });
134
+ }
135
+ // If html is provided (as a function or string), create element from it
136
+ if (viewDef.html) {
137
+ const htmlContent = typeof viewDef.html === 'function' ? viewDef.html({
138
+ config,
139
+ editor,
140
+ isEditor: true,
141
+ isJSXConverter: false,
142
+ node: this
143
+ }) : viewDef.html;
144
+ const tempDiv = document.createElement('div');
145
+ tempDiv.innerHTML = htmlContent;
146
+ return tempDiv.firstElementChild || tempDiv;
147
+ }
148
+ }
149
+ // Otherwise use original
150
+ return NodeClass.prototype._originalCreateDOM.call(this, config, editor);
151
+ };
152
+ }
153
+ }
154
+ export function getEnabledNodes({ editorConfig, nodeViews }) {
155
+ const nodes = getEnabledNodesFromServerNodes({
3
156
  nodes: editorConfig.features.nodes
4
157
  });
158
+ if (nodeViews) {
159
+ // Apply node overrides by modifying prototypes (once globally)
160
+ // The overrides check per-editor at runtime using WeakMap
161
+ const nodeTypesToOverride = new Set();
162
+ for (const [key, value] of Object.entries(nodeViews)){
163
+ if (!value || typeof value !== 'object') {
164
+ continue;
165
+ }
166
+ // If 'blocks' key exists with content, we need to override 'block' nodes
167
+ if (key === 'blocks' && Object.keys(value).length > 0) {
168
+ nodeTypesToOverride.add('block');
169
+ } else // If 'inlineBlocks' key exists with content, we need to override 'inlineBlock' nodes
170
+ if (key === 'inlineBlocks' && Object.keys(value).length > 0) {
171
+ nodeTypesToOverride.add('inlineBlock');
172
+ } else // Regular node types
173
+ {
174
+ nodeTypesToOverride.add(key);
175
+ }
176
+ }
177
+ for (const node of nodes){
178
+ if ('getType' in node) {
179
+ const nodeType = node.getType();
180
+ if (nodeTypesToOverride.has(nodeType)) {
181
+ applyNodeOverride({
182
+ node,
183
+ nodeType
184
+ });
185
+ }
186
+ }
187
+ }
188
+ }
189
+ return nodes;
5
190
  }
6
191
  export function getEnabledNodesFromServerNodes({ nodes }) {
7
192
  return nodes.map((node)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/lexical/nodes/index.ts"],"sourcesContent":["import type { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical'\n\nimport type { NodeWithHooks } from '../../features/typesServer.js'\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\nexport function getEnabledNodes({\n editorConfig,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return getEnabledNodesFromServerNodes({\n nodes: editorConfig.features.nodes,\n })\n}\n\nexport function getEnabledNodesFromServerNodes({\n nodes,\n}: {\n nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n"],"names":["getEnabledNodes","editorConfig","getEnabledNodesFromServerNodes","nodes","features","map","node"],"mappings":"AAKA,OAAO,SAASA,gBAAgB,EAC9BC,YAAY,EAGb;IACC,OAAOC,+BAA+B;QACpCC,OAAOF,aAAaG,QAAQ,CAACD,KAAK;IACpC;AACF;AAEA,OAAO,SAASD,+BAA+B,EAC7CC,KAAK,EAGN;IACC,OAAOA,MAAME,GAAG,CAAC,CAACC;QAChB,IAAI,UAAUA,MAAM;YAClB,OAAOA,KAAKA,IAAI;QAClB;QACA,OAAOA;IACT;AACF"}
1
+ {"version":3,"sources":["../../../src/lexical/nodes/index.ts"],"sourcesContent":["import type {\n EditorConfig,\n Klass,\n LexicalEditor,\n LexicalNode,\n LexicalNodeReplacement,\n} from 'lexical'\n\nimport React from 'react'\n\nimport type { NodeWithHooks } from '../../features/typesServer.js'\nimport type { LexicalEditorNodeMap, NodeMapValue } from '../../types.js'\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\n// Store view definitions for each editor and node type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst editorNodeViews = new WeakMap<LexicalEditor, Map<string, NodeMapValue<any>>>()\n\n/**\n * Register view definitions for an editor\n */\nexport function registerEditorNodeViews(\n editor: LexicalEditor,\n nodeViews: LexicalEditorNodeMap,\n): void {\n if (!editorNodeViews.has(editor)) {\n editorNodeViews.set(editor, new Map())\n }\n const editorViews = editorNodeViews.get(editor)!\n\n // Register each node type's view\n for (const [nodeType, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle blocks specially - store each block type with key 'block:blockType'\n if (nodeType === 'blocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`block:${blockType}`, viewDef)\n }\n continue\n }\n\n // Handle inlineBlocks specially - store each block type with key 'inlineBlock:blockType'\n if (nodeType === 'inlineBlocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`inlineBlock:${blockType}`, viewDef)\n }\n continue\n }\n\n // Regular node types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorViews.set(nodeType, value as NodeMapValue<any>)\n }\n}\n\n/**\n * Clear all view overrides for an editor (restores default rendering)\n */\nexport function clearEditorNodeViews(editor: LexicalEditor): void {\n editorNodeViews.delete(editor)\n}\n\n/**\n * Get the view definition for a specific editor and node\n */\nfunction getEditorNodeView(\n editor: LexicalEditor,\n nodeType: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n node?: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): NodeMapValue<any> | undefined {\n const editorViews = editorNodeViews.get(editor)\n\n // For block nodes, look up by blockType\n if (nodeType === 'block' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`block:${blockType}`)\n }\n\n // For inlineBlock nodes, look up by blockType\n if (nodeType === 'inlineBlock' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`inlineBlock:${blockType}`)\n }\n\n // Regular node types\n return editorViews?.get(nodeType)\n}\n\n/**\n * Apply view overrides to a specific node type by modifying its prototype\n * Uses WeakMap to check per-editor at runtime\n */\nfunction applyNodeOverride({\n node,\n nodeType,\n}: {\n node: Klass<LexicalNode>\n nodeType: string\n}): void {\n if (!('getType' in node) || node.getType() !== nodeType) {\n return\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const NodeClass = node as any\n\n // Store original methods if not already stored\n if (!NodeClass.prototype._originalDecorate) {\n NodeClass.prototype._originalDecorate = NodeClass.prototype.decorate\n }\n if (!NodeClass.prototype._originalCreateDOM) {\n NodeClass.prototype._originalCreateDOM = NodeClass.prototype.createDOM\n }\n\n // Override decorate method (for DecoratorNodes)\n if (NodeClass.prototype.decorate && !NodeClass.prototype._decorateOverridden) {\n NodeClass.prototype._decorateOverridden = true\n const hasCreateDOM = !!NodeClass.prototype.createDOM\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n NodeClass.prototype.decorate = function (editor: LexicalEditor, config: EditorConfig): any {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // Priority 1: If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component({\n config,\n editor,\n isEditor: true,\n isJSXConverter: false,\n node: this,\n })\n }\n\n // Priority 2: If custom createDOM is provided, use html in decorate\n if (viewDef.createDOM && viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n return React.createElement('span', {\n dangerouslySetInnerHTML: { __html: htmlContent },\n })\n }\n\n // Priority 3: If only html is provided (no custom createDOM),\n // createDOM will handle it, so decorate returns empty fragment\n if (viewDef.html && hasCreateDOM && !viewDef.createDOM) {\n return React.createElement(React.Fragment)\n }\n }\n\n // Otherwise use original\n return NodeClass.prototype._originalDecorate.call(this, editor, config)\n }\n }\n\n // Override createDOM method (for ElementNodes)\n if (NodeClass.prototype.createDOM && !NodeClass.prototype._createDOMOverridden) {\n NodeClass.prototype._createDOMOverridden = true\n NodeClass.prototype.createDOM = function (\n config: EditorConfig,\n editor: LexicalEditor,\n ): HTMLElement {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // If createDOM is provided, use it\n if (viewDef.createDOM) {\n return viewDef.createDOM({ config, editor, node: this })\n }\n\n // If html is provided (as a function or string), create element from it\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = htmlContent\n return (tempDiv.firstElementChild as HTMLElement) || tempDiv\n }\n }\n\n // Otherwise use original\n return NodeClass.prototype._originalCreateDOM.call(this, config, editor)\n }\n }\n}\n\nexport function getEnabledNodes({\n editorConfig,\n nodeViews,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n nodeViews?: LexicalEditorNodeMap\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n const nodes = getEnabledNodesFromServerNodes({\n nodes: editorConfig.features.nodes,\n })\n\n if (nodeViews) {\n // Apply node overrides by modifying prototypes (once globally)\n // The overrides check per-editor at runtime using WeakMap\n const nodeTypesToOverride = new Set<string>()\n\n for (const [key, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // If 'blocks' key exists with content, we need to override 'block' nodes\n if (key === 'blocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('block')\n }\n // If 'inlineBlocks' key exists with content, we need to override 'inlineBlock' nodes\n else if (key === 'inlineBlocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('inlineBlock')\n }\n // Regular node types\n else {\n nodeTypesToOverride.add(key)\n }\n }\n\n for (const node of nodes) {\n if ('getType' in node) {\n const nodeType = node.getType()\n\n if (nodeTypesToOverride.has(nodeType)) {\n applyNodeOverride({ node, nodeType })\n }\n }\n }\n }\n\n return nodes\n}\n\nexport function getEnabledNodesFromServerNodes({\n nodes,\n}: {\n nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n"],"names":["React","editorNodeViews","WeakMap","registerEditorNodeViews","editor","nodeViews","has","set","Map","editorViews","get","nodeType","value","Object","entries","blockType","viewDef","clearEditorNodeViews","delete","getEditorNodeView","node","applyNodeOverride","getType","NodeClass","prototype","_originalDecorate","decorate","_originalCreateDOM","createDOM","_decorateOverridden","hasCreateDOM","config","Component","isEditor","isJSXConverter","html","htmlContent","createElement","dangerouslySetInnerHTML","__html","Fragment","call","_createDOMOverridden","tempDiv","document","innerHTML","firstElementChild","getEnabledNodes","editorConfig","nodes","getEnabledNodesFromServerNodes","features","nodeTypesToOverride","Set","key","keys","length","add","map"],"mappings":"AAQA,OAAOA,WAAW,QAAO;AAMzB,uDAAuD;AACvD,8DAA8D;AAC9D,MAAMC,kBAAkB,IAAIC;AAE5B;;CAEC,GACD,OAAO,SAASC,wBACdC,MAAqB,EACrBC,SAA+B;IAE/B,IAAI,CAACJ,gBAAgBK,GAAG,CAACF,SAAS;QAChCH,gBAAgBM,GAAG,CAACH,QAAQ,IAAII;IAClC;IACA,MAAMC,cAAcR,gBAAgBS,GAAG,CAACN;IAExC,iCAAiC;IACjC,KAAK,MAAM,CAACO,UAAUC,MAAM,IAAIC,OAAOC,OAAO,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F;AAEA,OAAO,SAAS2C,gBAAgB,EAC9BC,YAAY,EACZ3C,SAAS,EAIV;IACC,MAAM4C,QAAQC,+BAA+B;QAC3CD,OAAOD,aAAaG,QAAQ,CAACF,KAAK;IACpC;IAEA,IAAI5C,WAAW;QACb,+DAA+D;QAC/D,0DAA0D;QAC1D,MAAM+C,sBAAsB,IAAIC;QAEhC,KAAK,MAAM,CAACC,KAAK1C,MAAM,IAAIC,OAAOC,OAAO,CAACT,WAAY;YACpD,IAAI,CAACO,SAAS,OAAOA,UAAU,UAAU;gBACvC;YACF;YAEA,yEAAyE;YACzE,IAAI0C,QAAQ,YAAYzC,OAAO0C,IAAI,CAAC3C,OAAO4C,MAAM,GAAG,GAAG;gBACrDJ,oBAAoBK,GAAG,CAAC;YAC1B,OACA,qFAAqF;YAChF,IAAIH,QAAQ,kBAAkBzC,OAAO0C,IAAI,CAAC3C,OAAO4C,MAAM,GAAG,GAAG;gBAChEJ,oBAAoBK,GAAG,CAAC;YAC1B,OACA,qBAAqB;YAChB;gBACHL,oBAAoBK,GAAG,CAACH;YAC1B;QACF;QAEA,KAAK,MAAMlC,QAAQ6B,MAAO;YACxB,IAAI,aAAa7B,MAAM;gBACrB,MAAMT,WAAWS,KAAKE,OAAO;gBAE7B,IAAI8B,oBAAoB9C,GAAG,CAACK,WAAW;oBACrCU,kBAAkB;wBAAED;wBAAMT;oBAAS;gBACrC;YACF;QACF;IACF;IAEA,OAAOsC;AACT;AAEA,OAAO,SAASC,+BAA+B,EAC7CD,KAAK,EAGN;IACC,OAAOA,MAAMS,GAAG,CAAC,CAACtC;QAChB,IAAI,UAAUA,MAAM;YAClB,OAAOA,KAAKA,IAAI;QAClB;QACA,OAAOA;IACT;AACF"}
@@ -1,6 +1,8 @@
1
1
  /* eslint-disable jsx-a11y/click-events-have-key-events */ 'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
4
  import { $createParagraphNode, $getRoot } from 'lexical';
5
+ import React from 'react';
4
6
  import './index.scss';
5
7
  import { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js';
6
8
  const baseClass = 'insert-paragraph-at-end';
@@ -17,11 +19,32 @@ export const InsertParagraphAtEndPlugin = ()=>{
17
19
  paragraphNode.select();
18
20
  });
19
21
  };
20
- return(<div aria-label="Insert Paragraph" className={baseClass} onClick={onClick} role="button" tabIndex={0}>
21
- <div className={`${baseClass}-inside`}>
22
- <span>+</span>
23
- </div>
24
- </div>);
22
+ return(// TODO: convert to button
23
+ /*#__PURE__*/ _jsxDEV("div", {
24
+ "aria-label": "Insert Paragraph",
25
+ className: baseClass,
26
+ onClick: onClick,
27
+ role: "button",
28
+ tabIndex: 0,
29
+ children: /*#__PURE__*/ _jsxDEV("div", {
30
+ className: `${baseClass}-inside`,
31
+ children: /*#__PURE__*/ _jsxDEV("span", {
32
+ children: "+"
33
+ }, void 0, false, {
34
+ fileName: "src/lexical/plugins/InsertParagraphAtEnd/index.tsx",
35
+ lineNumber: 38,
36
+ columnNumber: 9
37
+ }, this)
38
+ }, void 0, false, {
39
+ fileName: "src/lexical/plugins/InsertParagraphAtEnd/index.tsx",
40
+ lineNumber: 37,
41
+ columnNumber: 7
42
+ }, this)
43
+ }, void 0, false, {
44
+ fileName: "src/lexical/plugins/InsertParagraphAtEnd/index.tsx",
45
+ lineNumber: 30,
46
+ columnNumber: 5
47
+ }, this));
25
48
  };
26
49
 
27
50
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.scss'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n // TODO: convert to button\n <div\n aria-label=\"Insert Paragraph\"\n className={baseClass}\n onClick={onClick}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}-inside`}>\n <span>+</span>\n </div>\n </div>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$getRoot","useEditorConfigContext","baseClass","InsertParagraphAtEndPlugin","editor","editorConfig","admin","hideInsertParagraphAtEnd","onClick","update","paragraphNode","append","select","div","aria-label","className","role","tabIndex","span"],"mappings":"AAAA,wDAAwD,GACxD;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ,UAAS;AAGxD,OAAO,eAAc;AACrB,SAASC,sBAAsB,QAAQ,8CAA6C;AACpF,MAAMC,YAAY;AAElB,OAAO,MAAMC,6BAAuC;IAClD,MAAM,CAACC,OAAO,GAAGN;IACjB,MAAM,EAAEO,YAAY,EAAE,GAAGJ;IAEzB,IAAII,cAAcC,OAAOC,0BAA0B;QACjD,OAAO;IACT;IAEA,MAAMC,UAAU;QACdJ,OAAOK,MAAM,CAAC;YACZ,MAAMC,gBAAgBX;YACtBC,WAAWW,MAAM,CAACD;YAClBA,cAAcE,MAAM;QACtB;IACF;IAEA,QAEGC,IACCC,WAAW,mBACXC,WAAWb,WACXM,SAASA,SACTQ,KAAK,SACLC,UAAU,GACX;MACC,CAACJ,IAAIE,WAAW,GAAGb,UAAU,OAAO,CAAC,EAAE;QACrC,CAACgB,KAAK,CAAC,EAAEA,KAAK;MAChB,EAAEL,IAAI;IACR,EAAEA;AAEN,EAAC"}
1
+ {"version":3,"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.scss'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n // TODO: convert to button\n <div\n aria-label=\"Insert Paragraph\"\n className={baseClass}\n onClick={onClick}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}-inside`}>\n <span>+</span>\n </div>\n </div>\n )\n}\n"],"names":["useLexicalComposerContext","$createParagraphNode","$getRoot","React","useEditorConfigContext","baseClass","InsertParagraphAtEndPlugin","editor","editorConfig","admin","hideInsertParagraphAtEnd","onClick","update","paragraphNode","append","select","div","aria-label","className","role","tabIndex","span"],"mappings":"AAAA,wDAAwD,GACxD;;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ,UAAS;AACxD,OAAOC,WAAW,QAAO;AAEzB,OAAO,eAAc;AACrB,SAASC,sBAAsB,QAAQ,8CAA6C;AACpF,MAAMC,YAAY;AAElB,OAAO,MAAMC,6BAAuC;IAClD,MAAM,CAACC,OAAO,GAAGP;IACjB,MAAM,EAAEQ,YAAY,EAAE,GAAGJ;IAEzB,IAAII,cAAcC,OAAOC,0BAA0B;QACjD,OAAO;IACT;IAEA,MAAMC,UAAU;QACdJ,OAAOK,MAAM,CAAC;YACZ,MAAMC,gBAAgBZ;YACtBC,WAAWY,MAAM,CAACD;YAClBA,cAAcE,MAAM;QACtB;IACF;IAEA,OACE,0BAA0B;kBAC1B,QAACC;QACCC,cAAW;QACXC,WAAWb;QACXM,SAASA;QACTQ,MAAK;QACLC,UAAU;kBAEV,cAAA,QAACJ;YAAIE,WAAW,GAAGb,UAAU,OAAO,CAAC;sBACnC,cAAA,QAACgB;0BAAK;;;;;;;;;;;;;;;;AAId,EAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function NodeViewOverridePlugin(): null;
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"names":[],"mappings":"AAOA,wBAAgB,sBAAsB,IAAI,IAAI,CAsB7C"}
@@ -0,0 +1,31 @@
1
+ 'use client';
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
3
+ import { useEffect } from 'react';
4
+ import { useRichTextView } from '../../../field/RichTextViewProvider.js';
5
+ import { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js';
6
+ export function NodeViewOverridePlugin() {
7
+ const [editor] = useLexicalComposerContext();
8
+ const { currentView, views } = useRichTextView();
9
+ useEffect(()=>{
10
+ if (!views) {
11
+ return;
12
+ }
13
+ if (currentView === 'default') {
14
+ if (views.default) {
15
+ registerEditorNodeViews(editor, views.default?.nodes);
16
+ } else {
17
+ clearEditorNodeViews(editor);
18
+ }
19
+ } else if (views[currentView]) {
20
+ clearEditorNodeViews(editor);
21
+ registerEditorNodeViews(editor, views[currentView]?.nodes);
22
+ }
23
+ }, [
24
+ editor,
25
+ views,
26
+ currentView
27
+ ]);
28
+ return null;
29
+ }
30
+
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEffect } from 'react'\n\nimport { useRichTextView } from '../../../field/RichTextViewProvider.js'\nimport { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js'\n\nexport function NodeViewOverridePlugin(): null {\n const [editor] = useLexicalComposerContext()\n const { currentView, views } = useRichTextView()\n\n useEffect(() => {\n if (!views) {\n return\n }\n\n if (currentView === 'default') {\n if (views.default) {\n registerEditorNodeViews(editor, views.default?.nodes)\n } else {\n clearEditorNodeViews(editor)\n }\n } else if (views[currentView]) {\n clearEditorNodeViews(editor)\n registerEditorNodeViews(editor, views[currentView]?.nodes)\n }\n }, [editor, views, currentView])\n\n return null\n}\n"],"names":["useLexicalComposerContext","useEffect","useRichTextView","clearEditorNodeViews","registerEditorNodeViews","NodeViewOverridePlugin","editor","currentView","views","default","nodes"],"mappings":"AAAA;AACA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,SAAS,QAAQ,QAAO;AAEjC,SAASC,eAAe,QAAQ,yCAAwC;AACxE,SAASC,oBAAoB,EAAEC,uBAAuB,QAAQ,uBAAsB;AAEpF,OAAO,SAASC;IACd,MAAM,CAACC,OAAO,GAAGN;IACjB,MAAM,EAAEO,WAAW,EAAEC,KAAK,EAAE,GAAGN;IAE/BD,UAAU;QACR,IAAI,CAACO,OAAO;YACV;QACF;QAEA,IAAID,gBAAgB,WAAW;YAC7B,IAAIC,MAAMC,OAAO,EAAE;gBACjBL,wBAAwBE,QAAQE,MAAMC,OAAO,EAAEC;YACjD,OAAO;gBACLP,qBAAqBG;YACvB;QACF,OAAO,IAAIE,KAAK,CAACD,YAAY,EAAE;YAC7BJ,qBAAqBG;YACrBF,wBAAwBE,QAAQE,KAAK,CAACD,YAAY,EAAEG;QACtD;IACF,GAAG;QAACJ;QAAQE;QAAOD;KAAY;IAE/B,OAAO;AACT"}
@@ -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.js';
3
4
  import { mergeRegister } from '@lexical/utils';
4
5
  import { $getSelection, $isRangeSelection, $isTextNode, COMMAND_PRIORITY_LOW, createCommand, getDOMSelection } from 'lexical';
@@ -170,7 +171,19 @@ export function LexicalTypeaheadMenuPlugin({ anchorClassName, anchorElem, groups
170
171
  closeTypeahead,
171
172
  openTypeahead
172
173
  ]);
173
- return anchorElementRef.current === null || resolution === null || editor === null ? null : <LexicalMenu anchorElementRef={anchorElementRef} close={closeTypeahead} editor={editor} groups={groups} menuRenderFn={menuRenderFn} resolution={resolution} shouldSplitNodeWithQuery/>;
174
+ return anchorElementRef.current === null || resolution === null || editor === null ? null : /*#__PURE__*/ _jsxDEV(LexicalMenu, {
175
+ anchorElementRef: anchorElementRef,
176
+ close: closeTypeahead,
177
+ editor: editor,
178
+ groups: groups,
179
+ menuRenderFn: menuRenderFn,
180
+ resolution: resolution,
181
+ shouldSplitNodeWithQuery: true
182
+ }, void 0, false, {
183
+ fileName: "src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.tsx",
184
+ lineNumber: 235,
185
+ columnNumber: 5
186
+ }, this);
174
187
  }
175
188
 
176
189
  //# sourceMappingURL=index.js.map