@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/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"names":["ObjectID","$applyNodeReplacement","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","_editor","config","cacheBuster","getCacheBuster","className","theme","inlineBlock","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"mappings":"AAAA;AACA,OAAOA,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAIhB,UAAS;AAChB,OAAOC,WAAyB,QAAO;AAOvC,SAASC,qBAAqB,QAAQ,yCAAwC;AAE9E,MAAMC,uBAAuBF,MAAMG,IAAI,CAAC,IACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAC,CAACC,SAAY,CAAA;YACtDC,SAASD,OAAOH,oBAAoB;QACtC,CAAA;AAGF,OAAO,MAAMK,wBAAwBN;IACnC,OAAgBO,MAAMC,IAA2B,EAAyB;QACxE,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,WAAWC,cAAyC,EAAmB;QACrF,MAAMH,OAAOI,uBAAuBD,eAAeE,MAAM;QACzD,OAAOL;IACT;IAESM,SAASC,OAAsB,EAAEC,MAAoB,EAAe;QAC3E,QACGf,qBACCgB,aAAa,IAAI,CAACC,cAAc,IAChCC,WAAWH,OAAOI,KAAK,CAACC,WAAW,IAAI,mCACvCC,UAAU,IAAI,CAACC,SAAS,IACxBC,SAAS,IAAI,CAACC,MAAM;IAG1B;IAESC,aAAwC;QAC/C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASd,uBAAuBC,MAAwC;IAC7E,OAAOf,sBACL,IAAIQ,gBAAgB;QAClBO,QAAQ;YACN,GAAGA,MAAM;YACTc,IAAId,QAAQc,MAAM,IAAI9B,SAASQ,OAAO,GAAGuB,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdrB,IAAsD;IAEtD,OAAOA,gBAAgBF;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"names":["ObjectID","$applyNodeReplacement","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","_editor","config","cacheBuster","getCacheBuster","className","theme","inlineBlock","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"mappings":"AAAA;;AACA,OAAOA,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAIhB,UAAS;AAChB,OAAOC,WAAyB,QAAO;AAOvC,SAASC,qBAAqB,QAAQ,yCAAwC;AAE9E,MAAMC,qCAAuBF,MAAMG,IAAI,CAAC,IACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAC,CAACC,SAAY,CAAA;YACtDC,SAASD,OAAOH,oBAAoB;QACtC,CAAA;AAGF,OAAO,MAAMK,wBAAwBN;IACnC,OAAgBO,MAAMC,IAA2B,EAAyB;QACxE,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,WAAWC,cAAyC,EAAmB;QACrF,MAAMH,OAAOI,uBAAuBD,eAAeE,MAAM;QACzD,OAAOL;IACT;IAESM,SAASC,OAAsB,EAAEC,MAAoB,EAAe;QAC3E,qBACE,QAACf;YACCgB,aAAa,IAAI,CAACC,cAAc;YAChCC,WAAWH,OAAOI,KAAK,CAACC,WAAW,IAAI;YACvCC,UAAU,IAAI,CAACC,SAAS;YACxBC,SAAS,IAAI,CAACC,MAAM;;;;;;IAG1B;IAESC,aAAwC;QAC/C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASd,uBAAuBC,MAAwC;IAC7E,OAAOf,sBACL,IAAIQ,gBAAgB;QAClBO,QAAQ;YACN,GAAGA,MAAM;YACTc,IAAId,QAAQc,MAAM,IAAI9B,SAASQ,OAAO,GAAGuB,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdrB,IAAsD;IAEtD,OAAOA,gBAAgBF;AACzB"}
@@ -1,4 +1,5 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
3
  import './index.scss';
3
4
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
4
5
  import { ChevronIcon, Combobox, CopyToClipboard, PopupList, RenderFields, useForm, useFormFields, useTranslation } from '@payloadcms/ui';
@@ -34,37 +35,137 @@ export const CodeBlockBlockComponent = (args)=>{
34
35
  const languageEntries = React.useMemo(()=>{
35
36
  return Object.entries(languages).map(([languageCode, languageLabel])=>({
36
37
  name: `${languageCode} ${languageLabel}`,
37
- Component: <PopupList.Button active={false} disabled={false} onClick={()=>{
38
- setSelectedLanguage(languageCode);
39
- }}>
40
- <span className={`${baseClass}__language-code`} data-language={languageCode}>
41
- {languageLabel}
42
- </span>
43
- </PopupList.Button>
38
+ Component: /*#__PURE__*/ _jsxDEV(PopupList.Button, {
39
+ active: false,
40
+ disabled: false,
41
+ onClick: ()=>{
42
+ setSelectedLanguage(languageCode);
43
+ },
44
+ children: /*#__PURE__*/ _jsxDEV("span", {
45
+ className: `${baseClass}__language-code`,
46
+ "data-language": languageCode,
47
+ children: languageLabel
48
+ }, void 0, false, {
49
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
50
+ lineNumber: 70,
51
+ columnNumber: 11
52
+ }, this)
53
+ }, void 0, false, {
54
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
55
+ lineNumber: 63,
56
+ columnNumber: 9
57
+ }, this)
44
58
  }));
45
59
  }, [
46
60
  languages,
47
61
  setSelectedLanguage
48
62
  ]);
49
- return <BlockCollapsible Actions={<div className={`${baseClass}__actions`}>
50
- <Combobox button={<div className={`${baseClass}__language-selector-button`} data-selected-language={selectedLanguageField?.value}>
51
- <span>{selectedLanguageLabel}</span>
52
- <ChevronIcon className={`${baseClass}__chevron`}/>
53
- </div>} buttonType="custom" className={`${baseClass}__language-selector`} disabled={!isEditable} entries={languageEntries} horizontalAlign="right" minEntriesForSearch={8} searchPlaceholder={t('fields:searchForLanguage')} showScrollbar size="large"/>
54
- <CopyToClipboard value={codeField?.value ?? ''}/>
55
-
56
- <Collapse/>
57
-
58
- {isEditable && <RemoveButton/>}
59
- </div>} className={baseClass} collapsibleProps={{
60
- AfterCollapsible: <FloatingCollapse/>,
61
- disableHeaderToggle: true,
62
- disableToggleIndicator: true
63
- }} Pill={<div className={`${baseClass}__pill`}>
64
- <CodeBlockIcon/>
65
- </div>}>
66
- <RenderFields fields={formSchema} forceRender={true} parentIndexPath="" parentPath={''} parentSchemaPath="" permissions={true} readOnly={!isEditable}/>
67
- </BlockCollapsible>;
63
+ return /*#__PURE__*/ _jsxDEV(BlockCollapsible, {
64
+ Actions: /*#__PURE__*/ _jsxDEV("div", {
65
+ className: `${baseClass}__actions`,
66
+ children: [
67
+ /*#__PURE__*/ _jsxDEV(Combobox, {
68
+ button: /*#__PURE__*/ _jsxDEV("div", {
69
+ className: `${baseClass}__language-selector-button`,
70
+ "data-selected-language": selectedLanguageField?.value,
71
+ children: [
72
+ /*#__PURE__*/ _jsxDEV("span", {
73
+ children: selectedLanguageLabel
74
+ }, void 0, false, {
75
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
76
+ lineNumber: 88,
77
+ columnNumber: 17
78
+ }, void 0),
79
+ /*#__PURE__*/ _jsxDEV(ChevronIcon, {
80
+ className: `${baseClass}__chevron`
81
+ }, void 0, false, {
82
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
83
+ lineNumber: 89,
84
+ columnNumber: 17
85
+ }, void 0)
86
+ ]
87
+ }, void 0, true, {
88
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
89
+ lineNumber: 84,
90
+ columnNumber: 15
91
+ }, void 0),
92
+ buttonType: "custom",
93
+ className: `${baseClass}__language-selector`,
94
+ disabled: !isEditable,
95
+ entries: languageEntries,
96
+ horizontalAlign: "right",
97
+ minEntriesForSearch: 8,
98
+ searchPlaceholder: t('fields:searchForLanguage'),
99
+ showScrollbar: true,
100
+ size: "large"
101
+ }, void 0, false, {
102
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
103
+ lineNumber: 82,
104
+ columnNumber: 11
105
+ }, void 0),
106
+ /*#__PURE__*/ _jsxDEV(CopyToClipboard, {
107
+ value: codeField?.value ?? ''
108
+ }, void 0, false, {
109
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
110
+ lineNumber: 102,
111
+ columnNumber: 11
112
+ }, void 0),
113
+ /*#__PURE__*/ _jsxDEV(Collapse, {}, void 0, false, {
114
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
115
+ lineNumber: 104,
116
+ columnNumber: 11
117
+ }, void 0),
118
+ isEditable && /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
119
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
120
+ lineNumber: 106,
121
+ columnNumber: 26
122
+ }, void 0)
123
+ ]
124
+ }, void 0, true, {
125
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
126
+ lineNumber: 81,
127
+ columnNumber: 9
128
+ }, void 0),
129
+ className: baseClass,
130
+ collapsibleProps: {
131
+ AfterCollapsible: /*#__PURE__*/ _jsxDEV(FloatingCollapse, {}, void 0, false, {
132
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
133
+ lineNumber: 111,
134
+ columnNumber: 27
135
+ }, void 0),
136
+ disableHeaderToggle: true,
137
+ disableToggleIndicator: true
138
+ },
139
+ Pill: /*#__PURE__*/ _jsxDEV("div", {
140
+ className: `${baseClass}__pill`,
141
+ children: /*#__PURE__*/ _jsxDEV(CodeBlockIcon, {}, void 0, false, {
142
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
143
+ lineNumber: 117,
144
+ columnNumber: 11
145
+ }, void 0)
146
+ }, void 0, false, {
147
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
148
+ lineNumber: 116,
149
+ columnNumber: 9
150
+ }, void 0),
151
+ children: /*#__PURE__*/ _jsxDEV(RenderFields, {
152
+ fields: formSchema,
153
+ forceRender: true,
154
+ parentIndexPath: "",
155
+ parentPath: '',
156
+ parentSchemaPath: "",
157
+ permissions: true,
158
+ readOnly: !isEditable
159
+ }, void 0, false, {
160
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
161
+ lineNumber: 121,
162
+ columnNumber: 7
163
+ }, this)
164
+ }, void 0, false, {
165
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
166
+ lineNumber: 79,
167
+ columnNumber: 5
168
+ }, this);
68
169
  };
69
170
 
70
171
  //# sourceMappingURL=Block.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type { ComboboxEntry } from '@payloadcms/ui'\nimport type {} from 'payload'\n\nimport './index.scss'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n ChevronIcon,\n Combobox,\n CopyToClipboard,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n useTranslation,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { defaultLanguages } from './defaultLanguages.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<Pick<AdditionalCodeComponentProps, 'languages'>> = (\n args,\n) => {\n const { languages: languagesFromProps } = args\n const languages = languagesFromProps || defaultLanguages\n\n const { BlockCollapsible, formSchema, RemoveButton } = useBlockComponentContext()\n const { setModified } = useForm()\n const { t } = useTranslation()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n const isEditable = useLexicalEditable()\n\n const languageEntries = React.useMemo<ComboboxEntry[]>(() => {\n return Object.entries(languages).map(([languageCode, languageLabel]) => ({\n name: `${languageCode} ${languageLabel}`,\n Component: (\n <PopupList.Button\n active={false}\n disabled={false}\n onClick={() => {\n setSelectedLanguage(languageCode)\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n ),\n }))\n }, [languages, setSelectedLanguage])\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Combobox\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n buttonType=\"custom\"\n className={`${baseClass}__language-selector`}\n disabled={!isEditable}\n entries={languageEntries}\n horizontalAlign=\"right\"\n minEntriesForSearch={8}\n searchPlaceholder={t('fields:searchForLanguage')}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n\n {isEditable && <RemoveButton />}\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </BlockCollapsible>\n )\n}\n"],"names":["useLexicalEditable","ChevronIcon","Combobox","CopyToClipboard","PopupList","RenderFields","useForm","useFormFields","useTranslation","React","CodeBlockIcon","useBlockComponentContext","Collapse","defaultLanguages","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","languages","languagesFromProps","BlockCollapsible","formSchema","RemoveButton","setModified","t","codeField","fields","code","selectedLanguageField","setSelectedLanguage","dispatch","language","type","path","value","selectedLanguageLabel","isEditable","languageEntries","useMemo","Object","entries","map","languageCode","languageLabel","name","Component","Button","active","disabled","onClick","span","className","data-language","Actions","div","button","data-selected-language","buttonType","horizontalAlign","minEntriesForSearch","searchPlaceholder","showScrollbar","size","collapsibleProps","AfterCollapsible","disableHeaderToggle","disableToggleIndicator","Pill","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"mappings":"AAAA;AAIA,OAAO,eAAc;AAErB,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,WAAW,EACXC,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,aAAa,EACbC,cAAc,QACT,iBAAgB;AACvB,OAAOC,WAAW,QAAO;AAIzB,SAASC,aAAa,QAAQ,qDAAoD;AAClF,SAASC,wBAAwB,QAAQ,4CAA2C;AACpF,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,gBAAgB,QAAQ,8BAA6B;AAE9D,MAAMC,YAAY;AAClB,OAAO,MAAMC,0BAAqF,CAChGC;IAEA,MAAM,EAAEC,WAAWC,kBAAkB,EAAE,GAAGF;IAC1C,MAAMC,YAAYC,sBAAsBN;IAExC,MAAM,EAAEO,gBAAgB,EAAEC,UAAU,EAAEC,YAAY,EAAE,GAAGX;IACvD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cACrD,EAAEuC,MAEJG,WAAW,SACXN,WAAW,GAAGpC,UAAU,mBAAmB,CAAC,EAC5CiC,UAAU,CAACZ,YACXI,SAASH,iBACTqB,gBAAgB,QAChBC,qBAAqB,GACrBC,mBAAmBpC,EAAE,6BACrBqC,cACAC,KAAK,SACL;UACF,CAAC3D,gBAAgB+B,OAAO,AAACT,WAAWS,SAAoB,KAAM;;UAE9D,CAACtB,UAAW;;UAEZ,CAACwB,eAAed,eAAgB;QAClC,EAAEgC,MAEJH,WAAWpC,WACXgD,kBAAkB;QAChBC,mBAAmBlD;QACnBmD,qBAAqB;QACrBC,wBAAwB;IAC1B,GACAC,OACGb,IAAIH,WAAW,GAAGpC,UAAU,MAAM,CAAC,EAAE;UACpC,CAACL,eAAgB;QACnB,EAAE4C,MAEL;MACC,CAACjD,aACCqB,QAAQL,YACR+C,aAAa,MACbC,gBAAgB,GAChBC,YAAY,IACZC,iBAAiB,GACjBC,aAAa,MACbC,UAAU,CAACrC,aACX;IACJ,EAAEhB;AAEN,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type { ComboboxEntry } from '@payloadcms/ui'\nimport type {} from 'payload'\n\nimport './index.scss'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n ChevronIcon,\n Combobox,\n CopyToClipboard,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n useTranslation,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { defaultLanguages } from './defaultLanguages.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<Pick<AdditionalCodeComponentProps, 'languages'>> = (\n args,\n) => {\n const { languages: languagesFromProps } = args\n const languages = languagesFromProps || defaultLanguages\n\n const { BlockCollapsible, formSchema, RemoveButton } = useBlockComponentContext()\n const { setModified } = useForm()\n const { t } = useTranslation()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n const isEditable = useLexicalEditable()\n\n const languageEntries = React.useMemo<ComboboxEntry[]>(() => {\n return Object.entries(languages).map(([languageCode, languageLabel]) => ({\n name: `${languageCode} ${languageLabel}`,\n Component: (\n <PopupList.Button\n active={false}\n disabled={false}\n onClick={() => {\n setSelectedLanguage(languageCode)\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n ),\n }))\n }, [languages, setSelectedLanguage])\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Combobox\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n buttonType=\"custom\"\n className={`${baseClass}__language-selector`}\n disabled={!isEditable}\n entries={languageEntries}\n horizontalAlign=\"right\"\n minEntriesForSearch={8}\n searchPlaceholder={t('fields:searchForLanguage')}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n\n {isEditable && <RemoveButton />}\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </BlockCollapsible>\n )\n}\n"],"names":["useLexicalEditable","ChevronIcon","Combobox","CopyToClipboard","PopupList","RenderFields","useForm","useFormFields","useTranslation","React","CodeBlockIcon","useBlockComponentContext","Collapse","defaultLanguages","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","languages","languagesFromProps","BlockCollapsible","formSchema","RemoveButton","setModified","t","codeField","fields","code","selectedLanguageField","setSelectedLanguage","dispatch","language","type","path","value","selectedLanguageLabel","isEditable","languageEntries","useMemo","Object","entries","map","languageCode","languageLabel","name","Component","Button","active","disabled","onClick","span","className","data-language","Actions","div","button","data-selected-language","buttonType","horizontalAlign","minEntriesForSearch","searchPlaceholder","showScrollbar","size","collapsibleProps","AfterCollapsible","disableHeaderToggle","disableToggleIndicator","Pill","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"mappings":"AAAA;;AAIA,OAAO,eAAc;AAErB,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,WAAW,EACXC,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,aAAa,EACbC,cAAc,QACT,iBAAgB;AACvB,OAAOC,WAAW,QAAO;AAIzB,SAASC,aAAa,QAAQ,qDAAoD;AAClF,SAASC,wBAAwB,QAAQ,4CAA2C;AACpF,SAASC,QAAQ,QAAQ,sBAAqB;AAC9C,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,gBAAgB,QAAQ,8BAA6B;AAE9D,MAAMC,YAAY;AAClB,OAAO,MAAMC,0BAAqF,CAChGC;IAEA,MAAM,EAAEC,WAAWC,kBAAkB,EAAE,GAAGF;IAC1C,MAAMC,YAAYC,sBAAsBN;IAExC,MAAM,EAAEO,gBAAgB,EAAEC,UAAU,EAAE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C;;;;;;;;;;;;oBAGnD0C,YAAW;oBACXN,WAAW,GAAGpC,UAAU,mBAAmB,CAAC;oBAC5CiC,UAAU,CAACZ;oBACXI,SAASH;oBACTqB,iBAAgB;oBAChBC,qBAAqB;oBACrBC,mBAAmBpC,EAAE;oBACrBqC,aAAa;oBACbC,MAAK;;;;;;8BAEP,QAAC3D;oBAAgB+B,OAAO,AAACT,WAAWS,SAAoB;;;;;;8BAExD,QAACtB;;;;;gBAEAwB,4BAAc,QAACd;;;;;;;;;;;QAGpB6B,WAAWpC;QACXgD,kBAAkB;YAChBC,gCAAkB,QAAClD;;;;;YACnBmD,qBAAqB;YACrBC,wBAAwB;QAC1B;QACAC,oBACE,QAACb;YAAIH,WAAW,GAAGpC,UAAU,MAAM,CAAC;sBAClC,cAAA,QAACL;;;;;;;;;;kBAIL,cAAA,QAACL;YACCqB,QAAQL;YACR+C,aAAa;YACbC,iBAAgB;YAChBC,YAAY;YACZC,kBAAiB;YACjBC,aAAa;YACbC,UAAU,CAACrC;;;;;;;;;;;AAInB,EAAC"}
@@ -1,6 +1,7 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
3
  import { CodeField, useFormFields } from '@payloadcms/ui';
3
- import { useId, useMemo } from 'react';
4
+ import React, { useId, useMemo } from 'react';
4
5
  import { defaultLanguages } from './defaultLanguages.js';
5
6
  /**
6
7
  * @default first key of the `languages` prop
@@ -57,54 +58,69 @@ import { defaultLanguages } from './defaultLanguages.js';
57
58
  instanceId
58
59
  ]);
59
60
  const key = `${field.name}-${language}-${label}`;
60
- return props && <CodeField autoComplete={autoComplete} field={props} forceRender={forceRender} key={key} onMount={(_editor, monaco)=>{
61
- monaco.editor.defineTheme('vs-dark', {
62
- base: 'vs-dark',
63
- colors: {
64
- 'editor.background': '#222222'
65
- },
66
- inherit: true,
67
- rules: []
68
- });
69
- monaco.editor.defineTheme('vs', {
70
- base: 'vs',
71
- colors: {
72
- 'editor.background': '#f5f5f5'
73
- },
74
- inherit: true,
75
- rules: []
76
- });
77
- monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
78
- allowNonTsExtensions: true,
79
- // Set module resolution to NodeJs to enable autocompletion
80
- allowJs: true,
81
- allowSyntheticDefaultImports: true,
82
- esModuleInterop: true,
83
- jsx: monaco.languages.typescript.JsxEmit.React,
84
- moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
85
- noEmit: true,
86
- paths: typescript?.paths,
87
- reactNamespace: 'React',
88
- target: monaco.languages.typescript.ScriptTarget[typescript?.target ?? 'ESNext'],
89
- typeRoots: typescript?.typeRoots ?? [
90
- 'node_modules/@types'
91
- ]
92
- });
93
- monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
94
- noSemanticValidation: typescript?.enableSemanticValidation ? false : true,
95
- noSyntaxValidation: false
96
- });
97
- const run = async ()=>{
98
- if (typescript?.fetchTypes && Array.isArray(typescript.fetchTypes) && typescript.fetchTypes.length > 0) {
99
- await Promise.all(typescript.fetchTypes.map(async (type)=>{
100
- const types = await fetch(type.url);
101
- const typesText = await types.text();
102
- monaco.languages.typescript.typescriptDefaults.addExtraLib(typesText, type.filePath);
103
- }));
104
- }
105
- };
106
- void run();
107
- }} path={path} permissions={permissions} readOnly={readOnly} renderedBlocks={renderedBlocks} schemaPath={schemaPath} validate={validate}/>;
61
+ return props && /*#__PURE__*/ _jsxDEV(CodeField, {
62
+ autoComplete: autoComplete,
63
+ field: props,
64
+ forceRender: forceRender,
65
+ onMount: (_editor, monaco)=>{
66
+ monaco.editor.defineTheme('vs-dark', {
67
+ base: 'vs-dark',
68
+ colors: {
69
+ 'editor.background': '#222222'
70
+ },
71
+ inherit: true,
72
+ rules: []
73
+ });
74
+ monaco.editor.defineTheme('vs', {
75
+ base: 'vs',
76
+ colors: {
77
+ 'editor.background': '#f5f5f5'
78
+ },
79
+ inherit: true,
80
+ rules: []
81
+ });
82
+ monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
83
+ allowNonTsExtensions: true,
84
+ // Set module resolution to NodeJs to enable autocompletion
85
+ allowJs: true,
86
+ allowSyntheticDefaultImports: true,
87
+ esModuleInterop: true,
88
+ jsx: monaco.languages.typescript.JsxEmit.React,
89
+ moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
90
+ noEmit: true,
91
+ paths: typescript?.paths,
92
+ reactNamespace: 'React',
93
+ target: monaco.languages.typescript.ScriptTarget[typescript?.target ?? 'ESNext'],
94
+ typeRoots: typescript?.typeRoots ?? [
95
+ 'node_modules/@types'
96
+ ]
97
+ });
98
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
99
+ noSemanticValidation: typescript?.enableSemanticValidation ? false : true,
100
+ noSyntaxValidation: false
101
+ });
102
+ const run = async ()=>{
103
+ if (typescript?.fetchTypes && Array.isArray(typescript.fetchTypes) && typescript.fetchTypes.length > 0) {
104
+ await Promise.all(typescript.fetchTypes.map(async (type)=>{
105
+ const types = await fetch(type.url);
106
+ const typesText = await types.text();
107
+ monaco.languages.typescript.typescriptDefaults.addExtraLib(typesText, type.filePath);
108
+ }));
109
+ }
110
+ };
111
+ void run();
112
+ },
113
+ path: path,
114
+ permissions: permissions,
115
+ readOnly: readOnly,
116
+ renderedBlocks: renderedBlocks,
117
+ schemaPath: schemaPath,
118
+ validate: validate
119
+ }, key, false, {
120
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Code.tsx",
121
+ lineNumber: 110,
122
+ columnNumber: 7
123
+ }, this);
108
124
  };
109
125
 
110
126
  //# sourceMappingURL=Code.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useId, useMemo } from 'react'\n\nimport { defaultLanguages } from './defaultLanguages.js'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default all languages supported by Monaco Editor\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * By default, the editor will not perform semantic validation. This means that\n * while syntax errors will be highlighted, other issues like missing imports or incorrect\n * types will not be.\n *\n * @default false\n */\n enableSemanticValidation?: boolean\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = defaultLanguages,\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n // unique id per component instance to ensure Monaco creates a distinct model\n // for each TypeScript code block. Using React's useId is SSR-safe and builtin.\n const instanceId = useId()\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n editorProps: {\n // If typescript is set, @monaco-editor/react needs to set the URI to a .ts or .tsx file when it calls createModel().\n // Provide a unique defaultPath per instance so Monaco doesn't reuse the same model\n // across multiple code block instances. We use field.name + instanceId for debugability.\n defaultPath: language === 'ts' ? `file-${field.name}-${instanceId}.tsx` : undefined,\n },\n language,\n },\n }),\n [field, language, instanceId],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n allowJs: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n jsx: monaco.languages.typescript.JsxEmit.React,\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n noEmit: true,\n paths: typescript?.paths,\n reactNamespace: 'React',\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n\n monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: typescript?.enableSemanticValidation ? false : true,\n noSyntaxValidation: false,\n })\n\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"names":["CodeField","useFormFields","useId","useMemo","defaultLanguages","CodeComponent","autoComplete","field","forceRender","languages","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","instanceId","label","props","type","admin","editorOptions","editorProps","defaultPath","name","undefined","key","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","allowJs","allowSyntheticDefaultImports","esModuleInterop","jsx","JsxEmit","React","moduleResolution","ModuleResolutionKind","NodeJs","noEmit","paths","reactNamespace","target","ScriptTarget","typeRoots","setDiagnosticsOptions","noSemanticValidation","enableSemanticValidation","noSyntaxValidation","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"mappings":"AAAA;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ,iBAAgB;AACzD,SAAgBC,KAAK,EAAEC,OAAO,QAAQ,QAAO;AAE7C,SAASC,gBAAgB,QAAQ,wBAAuB;AAGtD;;GAEC,GAED;;GAEC,GAED;;;;GAIC,GAED;;GAEC,GAEC;;;;;;KAMC,GAED;;;;;;KAMC,GAKD;;KAEC,GAED;;KAEC,GAED;;KAEC,GAKL,OAAO,MAAMC,gBAA+E,CAAC,EAC3FC,YAAY,EACZC,KAAK,EACLC,WAAW,EACXC,YAAYL,gBAAgB,EAC5BM,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,cAAc,EACdC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACT;IACC,MAAMC,gBAAgBhB,cAAc,CAAC,CAACiB,OAAO,GAAKA,MAAM,CAAC,WAAW;IAEpE,MAAMC,WACJ,AAACF,eAAeG,SAAqBH,eAAeI,gBAA2B;IAEjF,6EAA6E;IAC7E,+EAA+E;IAC/E,MAAMC,aAAapB;IAEnB,MAAMqB,QAAQd,SAAS,CAACU,SAAS;IAEjC,MAAMK,QAAyBrB,QAC7B,IAAO,CAAA;YACL,GAAGI,KAAK;YACRkB,MAAM;YACNC,OAAO;gBACL,GAAGnB,MAAMmB,KAAK;gBACdC,eAAe,CAAC;gBAChBC,aAAa;oBACX,qHAAqH;oBACrH,mFAAmF;oBACnF,yFAAyF;oBACzFC,aAAaV,aAAa,OAAO,CAAC,KAAK,EAAEZ,MAAMuB,IAAI,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AWkD,UAAU,KACnClD,WAAWkD,UAAU,CAACG,MAAM,GAAG,GAC/B;gBACA,MAAMC,QAAQC,GAAG,CACfvD,WAAWkD,UAAU,CAACM,GAAG,CAAC,OAAO9C;oBAC/B,MAAM+C,QAAQ,MAAMC,MAAMhD,KAAKiD,GAAG;oBAClC,MAAMC,YAAY,MAAMH,MAAMI,IAAI;oBAClCzC,OAAO1B,SAAS,CAACM,UAAU,CAAC2B,kBAAkB,CAACmC,WAAW,CACxDF,WACAlD,KAAKqD,QAAQ;gBAEjB;YAEJ;QACF;QACA,KAAKd;IACP,GACAtD,MAAMA,MACNC,aAAaA,aACbC,UAAUA,UACVC,gBAAgBA,gBAChBC,YAAYA,YACZE,UAAUA;AAIlB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useId, useMemo } from 'react'\n\nimport { defaultLanguages } from './defaultLanguages.js'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default all languages supported by Monaco Editor\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * By default, the editor will not perform semantic validation. This means that\n * while syntax errors will be highlighted, other issues like missing imports or incorrect\n * types will not be.\n *\n * @default false\n */\n enableSemanticValidation?: boolean\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = defaultLanguages,\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n // unique id per component instance to ensure Monaco creates a distinct model\n // for each TypeScript code block. Using React's useId is SSR-safe and builtin.\n const instanceId = useId()\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n editorProps: {\n // If typescript is set, @monaco-editor/react needs to set the URI to a .ts or .tsx file when it calls createModel().\n // Provide a unique defaultPath per instance so Monaco doesn't reuse the same model\n // across multiple code block instances. We use field.name + instanceId for debugability.\n defaultPath: language === 'ts' ? `file-${field.name}-${instanceId}.tsx` : undefined,\n },\n language,\n },\n }),\n [field, language, instanceId],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n allowJs: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n jsx: monaco.languages.typescript.JsxEmit.React,\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n noEmit: true,\n paths: typescript?.paths,\n reactNamespace: 'React',\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n\n monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: typescript?.enableSemanticValidation ? false : true,\n noSyntaxValidation: false,\n })\n\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"names":["CodeField","useFormFields","React","useId","useMemo","defaultLanguages","CodeComponent","autoComplete","field","forceRender","languages","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","instanceId","label","props","type","admin","editorOptions","editorProps","defaultPath","name","undefined","key","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","allowJs","allowSyntheticDefaultImports","esModuleInterop","jsx","JsxEmit","moduleResolution","ModuleResolutionKind","NodeJs","noEmit","paths","reactNamespace","target","ScriptTarget","typeRoots","setDiagnosticsOptions","noSemanticValidation","enableSemanticValidation","noSyntaxValidation","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"mappings":"AAAA;;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ,iBAAgB;AACzD,OAAOC,SAASC,KAAK,EAAEC,OAAO,QAAQ,QAAO;AAE7C,SAASC,gBAAgB,QAAQ,wBAAuB;AAGtD;;GAEC,GAED;;GAEC,GAED;;;;GAIC,GAED;;GAEC,GAEC;;;;;;KAMC,GA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 +1,25 @@
1
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
+ import React from 'react';
1
3
  import './index.scss';
2
4
  const baseClass = 'code-block-collapse-button';
3
5
  import { useCollapsible } from '@payloadcms/ui';
4
6
  import { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js';
5
7
  export const Collapse = ()=>{
6
8
  const { toggle } = useCollapsible();
7
- return <button className={baseClass} onClick={toggle} type="button">
8
- <CollapseIcon/>
9
- </button>;
9
+ return /*#__PURE__*/ _jsxDEV("button", {
10
+ className: baseClass,
11
+ onClick: toggle,
12
+ type: "button",
13
+ children: /*#__PURE__*/ _jsxDEV(CollapseIcon, {}, void 0, false, {
14
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx",
15
+ lineNumber: 14,
16
+ columnNumber: 7
17
+ }, this)
18
+ }, void 0, false, {
19
+ fileName: "src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx",
20
+ lineNumber: 13,
21
+ columnNumber: 5
22
+ }, this);
10
23
  };
11
24
 
12
25
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-collapse-button'\nimport { useCollapsible } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const Collapse: React.FC = () => {\n const { toggle } = useCollapsible()\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["baseClass","useCollapsible","CollapseIcon","Collapse","toggle","button","className","onClick","type"],"mappings":"AAEA,OAAO,eAAc;AAErB,MAAMA,YAAY;AAClB,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,WAAqB;IAChC,MAAM,EAAEC,MAAM,EAAE,GAAGH;IACnB,QACGI,OAAOC,WAAWN,WAAWO,SAASH,QAAQI,KAAK,SAAS;MAC3D,CAACN,cAAe;IAClB,EAAEG;AAEN,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-collapse-button'\nimport { useCollapsible } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const Collapse: React.FC = () => {\n const { toggle } = useCollapsible()\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["React","baseClass","useCollapsible","CollapseIcon","Collapse","toggle","button","className","onClick","type"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,eAAc;AAErB,MAAMC,YAAY;AAClB,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,WAAqB;IAChC,MAAM,EAAEC,MAAM,EAAE,GAAGH;IACnB,qBACE,QAACI;QAAOC,WAAWN;QAAWO,SAASH;QAAQI,MAAK;kBAClD,cAAA,QAACN;;;;;;;;;;AAGP,EAAC"}
@@ -1,3 +1,5 @@
1
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
+ import React from 'react';
1
3
  import './index.scss';
2
4
  const baseClass = 'code-block-floating-collapse-button';
3
5
  import { useCollapsible, useTranslation } from '@payloadcms/ui';
@@ -8,10 +10,29 @@ export const FloatingCollapse = ()=>{
8
10
  if (!isCollapsed) {
9
11
  return null;
10
12
  }
11
- return <button className={baseClass} onClick={toggle} type="button">
12
- <span>{t('general:collapse')}</span>
13
- <CollapseIcon/>
14
- </button>;
13
+ return /*#__PURE__*/ _jsxDEV("button", {
14
+ className: baseClass,
15
+ onClick: toggle,
16
+ type: "button",
17
+ children: [
18
+ /*#__PURE__*/ _jsxDEV("span", {
19
+ children: t('general:collapse')
20
+ }, void 0, false, {
21
+ fileName: "src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx",
22
+ lineNumber: 20,
23
+ columnNumber: 7
24
+ }, this),
25
+ /*#__PURE__*/ _jsxDEV(CollapseIcon, {}, void 0, false, {
26
+ fileName: "src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx",
27
+ lineNumber: 21,
28
+ columnNumber: 7
29
+ }, this)
30
+ ]
31
+ }, void 0, true, {
32
+ fileName: "src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx",
33
+ lineNumber: 19,
34
+ columnNumber: 5
35
+ }, this);
15
36
  };
16
37
 
17
38
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-floating-collapse-button'\nimport { useCollapsible, useTranslation } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const FloatingCollapse: React.FC = () => {\n const { isCollapsed, toggle } = useCollapsible()\n const { t } = useTranslation()\n\n if (!isCollapsed) {\n return null\n }\n\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <span>{t('general:collapse')}</span>\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["baseClass","useCollapsible","useTranslation","CollapseIcon","FloatingCollapse","isCollapsed","toggle","t","button","className","onClick","type","span"],"mappings":"AAEA,OAAO,eAAc;AAErB,MAAMA,YAAY;AAClB,SAASC,cAAc,EAAEC,cAAc,QAAQ,iBAAgB;AAE/D,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGL;IAChC,MAAM,EAAEM,CAAC,EAAE,GAAGL;IAEd,IAAI,CAACG,aAAa;QAChB,OAAO;IACT;IAEA,QACGG,OAAOC,WAAWT,WAAWU,SAASJ,QAAQK,KAAK,SAAS;MAC3D,CAACC,MAAML,EAAE,sBAAsBK,KAAK;MACpC,CAACT,cAAe;IAClB,EAAEK;AAEN,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-floating-collapse-button'\nimport { useCollapsible, useTranslation } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const FloatingCollapse: React.FC = () => {\n const { isCollapsed, toggle } = useCollapsible()\n const { t } = useTranslation()\n\n if (!isCollapsed) {\n return null\n }\n\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <span>{t('general:collapse')}</span>\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["React","baseClass","useCollapsible","useTranslation","CollapseIcon","FloatingCollapse","isCollapsed","toggle","t","button","className","onClick","type","span"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,eAAc;AAErB,MAAMC,YAAY;AAClB,SAASC,cAAc,EAAEC,cAAc,QAAQ,iBAAgB;AAE/D,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGL;IAChC,MAAM,EAAEM,CAAC,EAAE,GAAGL;IAEd,IAAI,CAACG,aAAa;QAChB,OAAO;IACT;IAEA,qBACE,QAACG;QAAOC,WAAWT;QAAWU,SAASJ;QAAQK,MAAK;;0BAClD,QAACC;0BAAML,EAAE;;;;;;0BACT,QAACJ;;;;;;;;;;;AAGP,EAAC"}
@@ -1,7 +1,7 @@
1
- import type { SerializedEditorState } from 'lexical';
2
1
  import React from 'react';
3
2
  import type { DefaultNodeTypes, SerializedBlockNode, SerializedInlineBlockNode } from '../../../../nodeTypes.js';
4
3
  import type { JSXConverters } from '../converter/types.js';
4
+ import { type ConvertLexicalToJSXArgs } from '../converter/index.js';
5
5
  export type JSXConvertersFunction<T extends {
6
6
  [key: string]: any;
7
7
  type?: string;
@@ -21,23 +21,11 @@ type RichTextProps = {
21
21
  * Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.
22
22
  */
23
23
  converters?: JSXConverters | JSXConvertersFunction;
24
- /**
25
- * Serialized editor state to render.
26
- */
27
- data: SerializedEditorState;
28
24
  /**
29
25
  * If true, removes the container div wrapper.
30
26
  */
31
27
  disableContainer?: boolean;
32
- /**
33
- * If true, disables indentation globally. If an array, disables for specific node `type` values.
34
- */
35
- disableIndent?: boolean | string[];
36
- /**
37
- * If true, disables text alignment globally. If an array, disables for specific node `type` values.
38
- */
39
- disableTextAlign?: boolean | string[];
40
- };
28
+ } & Pick<ConvertLexicalToJSXArgs, 'data' | 'disableIndent' | 'disableTextAlign' | 'nodeMap'>;
41
29
  export declare const RichText: React.FC<RichTextProps>;
42
30
  export {};
43
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAK1D,MAAM,MAAM,qBAAqB,CAC/B,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,CAAA;CAAE,CAAC,GAClD,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC,IAC1D,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAAE,KAAK,aAAa,CAAC,CAAC,CAAC,CAAA;AAEtF,KAAK,aAAa,GAAG;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,qBAAqB,CAAA;IAClD;;OAEG;IACH,IAAI,EAAE,qBAAqB,CAAA;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;IAClC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAwC5C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/converters/lexicalToJSX/Component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EACV,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAG1D,OAAO,EAAuB,KAAK,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAEzF,MAAM,MAAM,qBAAqB,CAC/B,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,CAAA;CAAE,CAAC,GAClD,yBAAyB,CAAC;IAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,CAAC,IAC1D,CAAC,IAAI,EAAE;IAAE,iBAAiB,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAA;CAAE,KAAK,aAAa,CAAC,CAAC,CAAC,CAAA;AAEtF,KAAK,aAAa,GAAG;IACnB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,GAAG,qBAAqB,CAAA;IAElD;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC3B,GAAG,IAAI,CAAC,uBAAuB,EAAE,MAAM,GAAG,eAAe,GAAG,kBAAkB,GAAG,SAAS,CAAC,CAAA;AAE5F,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA0C5C,CAAA"}
@@ -1,3 +1,5 @@
1
+ import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
2
+ import React from 'react';
1
3
  import { defaultJSXConverters } from '../converter/defaultConverters.js';
2
4
  import { convertLexicalToJSX } from '../converter/index.js';
3
5
  /**
@@ -5,14 +7,8 @@ import { convertLexicalToJSX } from '../converter/index.js';
5
7
  */ /**
6
8
  * Custom converters to transform your nodes to JSX. Can be an object or a function that receives the default converters.
7
9
  */ /**
8
- * Serialized editor state to render.
9
- */ /**
10
10
  * If true, removes the container div wrapper.
11
- */ /**
12
- * If true, disables indentation globally. If an array, disables for specific node `type` values.
13
- */ /**
14
- * If true, disables text alignment globally. If an array, disables for specific node `type` values.
15
- */ export const RichText = ({ className, converters, data: editorState, disableContainer, disableIndent, disableTextAlign })=>{
11
+ */ export const RichText = ({ className, converters, data: editorState, disableContainer, disableIndent, disableTextAlign, nodeMap })=>{
16
12
  if (!editorState) {
17
13
  return null;
18
14
  }
@@ -32,12 +28,22 @@ import { convertLexicalToJSX } from '../converter/index.js';
32
28
  converters: finalConverters,
33
29
  data: editorState,
34
30
  disableIndent,
35
- disableTextAlign
31
+ disableTextAlign,
32
+ nodeMap
36
33
  });
37
34
  if (disableContainer) {
38
- return <>{content}</>;
35
+ return /*#__PURE__*/ _jsxDEV(_Fragment, {
36
+ children: content
37
+ }, void 0, false);
39
38
  }
40
- return <div className={className ?? 'payload-richtext'}>{content}</div>;
39
+ return /*#__PURE__*/ _jsxDEV("div", {
40
+ className: className ?? 'payload-richtext',
41
+ children: content
42
+ }, void 0, false, {
43
+ fileName: "src/features/converters/lexicalToJSX/Component/index.tsx",
44
+ lineNumber: 77,
45
+ columnNumber: 10
46
+ }, this);
41
47
  };
42
48
 
43
49
  //# sourceMappingURL=index.js.map