@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,4 +1,5 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
2
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
4
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
4
5
  import { getTranslation } from '@payloadcms/translations';
@@ -263,61 +264,152 @@ import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
263
264
  setDocFieldPreferences,
264
265
  formData.id
265
266
  ]);
266
- const EditButton = useMemo(()=>()=><Button buttonStyle="icon-label" className={`${baseClass}__editButton`} disabled={!isEditable} el="button" icon="edit" onClick={(e)=>{
267
- e.preventDefault();
268
- e.stopPropagation();
269
- toggleDrawer();
270
- return false;
271
- }} onMouseDown={(e)=>{
272
- // Needed to preserve lexical selection for toggleDrawer lexical selection restore.
273
- // I believe this is needed due to this button (usually) being inside of a collapsible.
274
- e.preventDefault();
275
- }} round size="small" tooltip={t('lexical:blocks:inlineBlocks:edit', {
276
- label: blockDisplayName
277
- })}/>, [
267
+ const EditButton = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(Button, {
268
+ buttonStyle: "icon-label",
269
+ className: `${baseClass}__editButton`,
270
+ disabled: !isEditable,
271
+ el: "button",
272
+ icon: "edit",
273
+ onClick: (e)=>{
274
+ e.preventDefault();
275
+ e.stopPropagation();
276
+ toggleDrawer();
277
+ return false;
278
+ },
279
+ onMouseDown: (e)=>{
280
+ // Needed to preserve lexical selection for toggleDrawer lexical selection restore.
281
+ // I believe this is needed due to this button (usually) being inside of a collapsible.
282
+ e.preventDefault();
283
+ },
284
+ round: true,
285
+ size: "small",
286
+ tooltip: t('lexical:blocks:inlineBlocks:edit', {
287
+ label: blockDisplayName
288
+ })
289
+ }, void 0, false, {
290
+ fileName: "src/features/blocks/client/component/index.tsx",
291
+ lineNumber: 383,
292
+ columnNumber: 7
293
+ }, this), [
278
294
  baseClass,
279
295
  isEditable,
280
296
  t,
281
297
  blockDisplayName,
282
298
  toggleDrawer
283
299
  ]);
284
- const RemoveButton = useMemo(()=>()=><Button buttonStyle="icon-label" className={`${baseClass}__removeButton`} disabled={!isEditable} icon="x" onClick={(e)=>{
285
- e.preventDefault();
286
- removeBlock();
287
- }} round tooltip="Remove Block"/>, [
300
+ const RemoveButton = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(Button, {
301
+ buttonStyle: "icon-label",
302
+ className: `${baseClass}__removeButton`,
303
+ disabled: !isEditable,
304
+ icon: "x",
305
+ onClick: (e)=>{
306
+ e.preventDefault();
307
+ removeBlock();
308
+ },
309
+ round: true,
310
+ tooltip: "Remove Block"
311
+ }, void 0, false, {
312
+ fileName: "src/features/blocks/client/component/index.tsx",
313
+ lineNumber: 410,
314
+ columnNumber: 7
315
+ }, this), [
288
316
  baseClass,
289
317
  isEditable,
290
318
  removeBlock
291
319
  ]);
292
320
  const BlockCollapsible = useMemo(()=>({ Actions, children, className, collapsibleProps, disableBlockName, editButton, errorCount, fieldHasErrors, Label, Pill: CustomPill, removeButton })=>{
293
- return <div className={`${baseClass}__container ${baseClass}-${blockType}`}>
294
- <Collapsible className={[
295
- `${baseClass}__row`,
296
- fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,
297
- className
298
- ].filter(Boolean).join(' ')} collapsibleStyle={fieldHasErrors ? 'error' : 'default'} header={<div className={`${baseClass}__block-header`}>
299
- {typeof Label !== 'undefined' ? Label : typeof CustomLabel !== 'undefined' ? CustomLabel : <div className={`${baseClass}__block-label`}>
300
- {typeof CustomPill !== 'undefined' ? CustomPill : <Pill className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`} pillStyle="white" size="small">
301
- {blockDisplayName ?? blockType}
302
- </Pill>}
303
- {!disableBlockName && !clientBlock?.admin?.disableBlockName && <SectionTitle path="blockName" readOnly={!isEditable}/>}
304
-
305
- {fieldHasErrors && <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage/>}
306
- </div>}
307
-
308
- <div className={`${baseClass}__block-actions`}>
309
- {typeof Actions !== 'undefined' ? Actions : <>
310
- {CustomBlock && editButton !== false || !CustomBlock && editButton ? <EditButton/> : null}
311
- {removeButton !== false && isEditable ? <RemoveButton/> : null}
312
- </>}
313
- </div>
314
- </div>} isCollapsed={isCollapsed} key={0} onToggle={(incomingCollapsedState)=>{
315
- onCollapsedChange(incomingCollapsedState);
316
- setIsCollapsed(incomingCollapsedState);
317
- }} {...collapsibleProps || {}}>
318
- {children}
319
- </Collapsible>
320
- </div>;
321
+ return /*#__PURE__*/ _jsxDEV("div", {
322
+ className: `${baseClass}__container ${baseClass}-${blockType}`,
323
+ children: /*#__PURE__*/ _jsxDEV(Collapsible, {
324
+ className: [
325
+ `${baseClass}__row`,
326
+ fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,
327
+ className
328
+ ].filter(Boolean).join(' '),
329
+ collapsibleStyle: fieldHasErrors ? 'error' : 'default',
330
+ header: /*#__PURE__*/ _jsxDEV("div", {
331
+ className: `${baseClass}__block-header`,
332
+ children: [
333
+ typeof Label !== 'undefined' ? Label : typeof CustomLabel !== 'undefined' ? CustomLabel : /*#__PURE__*/ _jsxDEV("div", {
334
+ className: `${baseClass}__block-label`,
335
+ children: [
336
+ typeof CustomPill !== 'undefined' ? CustomPill : /*#__PURE__*/ _jsxDEV(Pill, {
337
+ className: `${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`,
338
+ pillStyle: "white",
339
+ size: "small",
340
+ children: blockDisplayName ?? blockType
341
+ }, void 0, false, {
342
+ fileName: "src/features/blocks/client/component/index.tsx",
343
+ lineNumber: 463,
344
+ columnNumber: 25
345
+ }, void 0),
346
+ !disableBlockName && !clientBlock?.admin?.disableBlockName && /*#__PURE__*/ _jsxDEV(SectionTitle, {
347
+ path: "blockName",
348
+ readOnly: !isEditable
349
+ }, void 0, false, {
350
+ fileName: "src/features/blocks/client/component/index.tsx",
351
+ lineNumber: 472,
352
+ columnNumber: 25
353
+ }, void 0),
354
+ fieldHasErrors && /*#__PURE__*/ _jsxDEV(ErrorPill, {
355
+ count: errorCount ?? 0,
356
+ i18n: i18n,
357
+ withMessage: true
358
+ }, void 0, false, {
359
+ fileName: "src/features/blocks/client/component/index.tsx",
360
+ lineNumber: 476,
361
+ columnNumber: 25
362
+ }, void 0)
363
+ ]
364
+ }, void 0, true, {
365
+ fileName: "src/features/blocks/client/component/index.tsx",
366
+ lineNumber: 459,
367
+ columnNumber: 21
368
+ }, void 0),
369
+ /*#__PURE__*/ _jsxDEV("div", {
370
+ className: `${baseClass}__block-actions`,
371
+ children: typeof Actions !== 'undefined' ? Actions : /*#__PURE__*/ _jsxDEV(_Fragment, {
372
+ children: [
373
+ CustomBlock && editButton !== false || !CustomBlock && editButton ? /*#__PURE__*/ _jsxDEV(EditButton, {}, void 0, false, {
374
+ fileName: "src/features/blocks/client/component/index.tsx",
375
+ lineNumber: 487,
376
+ columnNumber: 27
377
+ }, void 0) : null,
378
+ removeButton !== false && isEditable ? /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
379
+ fileName: "src/features/blocks/client/component/index.tsx",
380
+ lineNumber: 489,
381
+ columnNumber: 65
382
+ }, void 0) : null
383
+ ]
384
+ }, void 0, true)
385
+ }, void 0, false, {
386
+ fileName: "src/features/blocks/client/component/index.tsx",
387
+ lineNumber: 481,
388
+ columnNumber: 19
389
+ }, void 0)
390
+ ]
391
+ }, void 0, true, {
392
+ fileName: "src/features/blocks/client/component/index.tsx",
393
+ lineNumber: 453,
394
+ columnNumber: 17
395
+ }, void 0),
396
+ isCollapsed: isCollapsed,
397
+ onToggle: (incomingCollapsedState)=>{
398
+ onCollapsedChange(incomingCollapsedState);
399
+ setIsCollapsed(incomingCollapsedState);
400
+ },
401
+ ...collapsibleProps || {},
402
+ children: children
403
+ }, 0, false, {
404
+ fileName: "src/features/blocks/client/component/index.tsx",
405
+ lineNumber: 443,
406
+ columnNumber: 13
407
+ }, this)
408
+ }, void 0, false, {
409
+ fileName: "src/features/blocks/client/component/index.tsx",
410
+ lineNumber: 442,
411
+ columnNumber: 11
412
+ }, this);
321
413
  }, [
322
414
  CustomBlock,
323
415
  CustomLabel,
@@ -333,17 +425,49 @@ import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
333
425
  isEditable
334
426
  ]);
335
427
  const blockID = formData?.id;
336
- const BlockDrawer = useMemo(()=>()=><EditDepthProvider>
337
- <Drawer className={''} slug={drawerSlug} title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {
338
- label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label')
339
- })}>
340
- {initialState ? <>
341
- <RenderFields fields={clientBlock?.fields ?? []} forceRender parentIndexPath="" parentPath=// See Blocks feature path for details as for why this is empty
342
- "" parentSchemaPath={schemaFieldsPath} permissions={true} readOnly={!isEditable}/>
343
- <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>
344
- </> : null}
345
- </Drawer>
346
- </EditDepthProvider>, [
428
+ const BlockDrawer = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(EditDepthProvider, {
429
+ children: /*#__PURE__*/ _jsxDEV(Drawer, {
430
+ className: '',
431
+ slug: drawerSlug,
432
+ title: t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {
433
+ label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label')
434
+ }),
435
+ children: initialState ? /*#__PURE__*/ _jsxDEV(_Fragment, {
436
+ children: [
437
+ /*#__PURE__*/ _jsxDEV(RenderFields, {
438
+ fields: clientBlock?.fields ?? [],
439
+ forceRender: true,
440
+ parentIndexPath: "",
441
+ parentPath: // See Blocks feature path for details as for why this is empty
442
+ "",
443
+ parentSchemaPath: schemaFieldsPath,
444
+ permissions: true,
445
+ readOnly: !isEditable
446
+ }, void 0, false, {
447
+ fileName: "src/features/blocks/client/component/index.tsx",
448
+ lineNumber: 538,
449
+ columnNumber: 15
450
+ }, this),
451
+ /*#__PURE__*/ _jsxDEV(FormSubmit, {
452
+ programmaticSubmit: true,
453
+ children: t('fields:saveChanges')
454
+ }, void 0, false, {
455
+ fileName: "src/features/blocks/client/component/index.tsx",
456
+ lineNumber: 547,
457
+ columnNumber: 15
458
+ }, this)
459
+ ]
460
+ }, void 0, true) : null
461
+ }, void 0, false, {
462
+ fileName: "src/features/blocks/client/component/index.tsx",
463
+ lineNumber: 529,
464
+ columnNumber: 9
465
+ }, this)
466
+ }, void 0, false, {
467
+ fileName: "src/features/blocks/client/component/index.tsx",
468
+ lineNumber: 528,
469
+ columnNumber: 7
470
+ }, this), [
347
471
  initialState,
348
472
  drawerSlug,
349
473
  blockID,
@@ -359,29 +483,56 @@ import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
359
483
  if (!initialState) {
360
484
  return null;
361
485
  }
362
- return <Form beforeSubmit={[
363
- async ({ formState })=>{
486
+ return /*#__PURE__*/ _jsxDEV(Form, {
487
+ beforeSubmit: [
488
+ async ({ formState })=>{
489
+ // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
490
+ return await onChange({
491
+ formState,
492
+ submit: true
493
+ });
494
+ }
495
+ ],
496
+ el: "div",
497
+ fields: clientBlock?.fields ?? [],
498
+ initialState: initialState,
499
+ onChange: [
500
+ onChange
501
+ ],
502
+ onSubmit: (formState, newData)=>{
364
503
  // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
365
- return await onChange({
366
- formState,
367
- submit: true
504
+ newData.blockType = blockType;
505
+ editor.update(()=>{
506
+ const node = $getNodeByKey(nodeKey);
507
+ if (node && $isBlockNode(node)) {
508
+ node.setFields(newData, true);
509
+ }
368
510
  });
369
- }
370
- ]} el="div" fields={clientBlock?.fields ?? []} initialState={initialState} onChange={[
371
- onChange
372
- ]} onSubmit={(formState, newData)=>{
373
- // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component
374
- newData.blockType = blockType;
375
- editor.update(()=>{
376
- const node = $getNodeByKey(nodeKey);
377
- if (node && $isBlockNode(node)) {
378
- node.setFields(newData, true);
379
- }
380
- });
381
- toggleDrawer();
382
- }} submitted={submitted} uuid={uuid()}>
383
- <BlockContent baseClass={baseClass} BlockDrawer={BlockDrawer} Collapsible={BlockCollapsible} CustomBlock={CustomBlock} EditButton={EditButton} errorCount={errorCount} formSchema={clientBlock?.fields ?? []} initialState={initialState} nodeKey={nodeKey} RemoveButton={RemoveButton}/>
384
- </Form>;
511
+ toggleDrawer();
512
+ },
513
+ submitted: submitted,
514
+ uuid: uuid(),
515
+ children: /*#__PURE__*/ _jsxDEV(BlockContent, {
516
+ baseClass: baseClass,
517
+ BlockDrawer: BlockDrawer,
518
+ Collapsible: BlockCollapsible,
519
+ CustomBlock: CustomBlock,
520
+ EditButton: EditButton,
521
+ errorCount: errorCount,
522
+ formSchema: clientBlock?.fields ?? [],
523
+ initialState: initialState,
524
+ nodeKey: nodeKey,
525
+ RemoveButton: RemoveButton
526
+ }, void 0, false, {
527
+ fileName: "src/features/blocks/client/component/index.tsx",
528
+ lineNumber: 597,
529
+ columnNumber: 9
530
+ }, this)
531
+ }, void 0, false, {
532
+ fileName: "src/features/blocks/client/component/index.tsx",
533
+ lineNumber: 572,
534
+ columnNumber: 7
535
+ }, this);
385
536
  }, [
386
537
  BlockCollapsible,
387
538
  BlockDrawer,
@@ -401,11 +552,26 @@ import { removeEmptyArrayValues } from './removeEmptyArrayValues.js';
401
552
  submitted
402
553
  ]);
403
554
  if (!clientBlock) {
404
- return <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>
405
- <div className={`${baseClass}-not-found`}>
406
- Error: Block '{blockType}' not found in the config but exists in the lexical data
407
- </div>
408
- </BlockCollapsible>;
555
+ return /*#__PURE__*/ _jsxDEV(BlockCollapsible, {
556
+ disableBlockName: true,
557
+ fieldHasErrors: true,
558
+ children: /*#__PURE__*/ _jsxDEV("div", {
559
+ className: `${baseClass}-not-found`,
560
+ children: [
561
+ "Error: Block '",
562
+ blockType,
563
+ "' not found in the config but exists in the lexical data"
564
+ ]
565
+ }, void 0, true, {
566
+ fileName: "src/features/blocks/client/component/index.tsx",
567
+ lineNumber: 633,
568
+ columnNumber: 9
569
+ }, this)
570
+ }, void 0, false, {
571
+ fileName: "src/features/blocks/client/component/index.tsx",
572
+ lineNumber: 632,
573
+ columnNumber: 7
574
+ }, this);
409
575
  }
410
576
  return Block;
411
577
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n FormSubmit,\n Pill,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport { type BlockCollapsibleWithErrorProps, BlockContent } from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: BlockFields\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n const mergedState = Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n\n // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel ?? undefined,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block ?? undefined,\n )\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as BlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const { i18n, t } = useTranslation<object, string>()\n\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n node.setFields(newData, true)\n }\n })\n }, 0)\n\n if (submit) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof CustomLabel !== 'undefined' ? (\n CustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n\n <div className={`${baseClass}__block-actions`}>\n {typeof Actions !== 'undefined' ? (\n Actions\n ) : (\n <>\n {(CustomBlock && editButton !== false) || (!CustomBlock && editButton) ? (\n <EditButton />\n ) : null}\n {removeButton !== false && isEditable ? <RemoveButton /> : null}\n </>\n )}\n </div>\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n CustomBlock,\n CustomLabel,\n EditButton,\n RemoveButton,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n ],\n )\n\n const blockID = formData?.id\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields ?? []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, true)\n }\n })\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={CustomBlock}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n CustomBlock,\n blockType,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","FormSubmit","Pill","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isBlockNode","BlockContent","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","undefined","CustomBlock","setCustomBlock","Block","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","children","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","div","filter","Boolean","join","collapsibleStyle","header","pillStyle","admin","path","count","withMessage","key","onToggle","incomingCollapsedState","blockID","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","beforeSubmit","onSubmit","formSchema"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,aAAa,QAAQ,UAAS;AAOvC,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ,iBAAgB;AACjG,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACtE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,OAAO,eAAc;AACrB,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAA8CC,Y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AAWA,WACXb,MAAMA,QACP;QACC,CAACI,aACCM,WAAWA,WACXgK,aAAaA,aACbrM,aAAa4K,kBACb7E,aAAaA,aACb8D,YAAYA,YACZrG,YAAYA,YACZuJ,YAAYrF,aAAavE,UAAU,EAAE,EACrCoB,cAAcA,cACdhC,SAASA,SACToI,cAAcA,eACd;MACJ,EAAEvK;IAEN,GAAG;QACDwK;QACAyB;QACAtG;QACA3B;QACAuG;QACAd;QACAxH;QACA6B;QACAV;QACAO;QACA2D,aAAavE;QACb,kGAAkG;QAClGoB;QACAhC;QACAyF;QACAxF;KACD;IAED,IAAI,CAACkF,aAAa;QAChB,QACGkD,iBAAiBI,kBAAkB,MAAME,gBAAgB,MAAM;QAC9D,CAACI,IAAIlJ,WAAW,GAAGC,UAAU,UAAU,CAAC,EAAE;wBAC1B,CAAC+B,UAAU;QAC3B,EAAEkH,IAAI;MACR,EAAEV;IAEN;IAEA,OAAO3E;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/component/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Collapsible,\n Drawer,\n EditDepthProvider,\n ErrorPill,\n Form,\n formatDrawerSlug,\n FormSubmit,\n Pill,\n RenderFields,\n SectionTitle,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useFormSubmitted,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\nimport {\n type BlocksFieldClient,\n type ClientBlock,\n type CollapsedPreferences,\n type FormState,\n} from 'payload'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { BlockFields } from '../../server/nodes/BlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.scss'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isBlockNode } from '../nodes/BlocksNode.js'\nimport { type BlockCollapsibleWithErrorProps, BlockContent } from './BlockContent.js'\nimport { removeEmptyArrayValues } from './removeEmptyArrayValues.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly className: string\n readonly formData: BlockFields\n readonly nodeKey: string\n}\n\nexport const BlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n const submitted = useFormSubmitted()\n const { id, collectionSlug, globalSlug } = useDocumentInfo()\n const {\n fieldProps: {\n featureClientSchemaMap,\n field: parentLexicalRichTextField,\n initialLexicalFormState,\n schemaPath,\n },\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n\n const { fields: parentDocumentFields } = useDocumentForm()\n const onChangeAbortControllerRef = useRef(new AbortController())\n const editDepth = useEditDepth()\n const [errorCount, setErrorCount] = React.useState(0)\n\n const { config } = useConfig()\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-blocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug)\n\n // Used for saving collapsed to preferences (and gettin' it from there again)\n // Remember, these preferences are scoped to the whole document, not just this form. This\n // is important to consider for the data path used in setDocFieldPreferences\n const { getDocPreferences, setDocFieldPreferences } = useDocumentInfo()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const blockType = formData.blockType\n\n const { getFormState } = useServerFunctions()\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}.fields`\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n const mergedState = Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n\n // Manually add blockName, as it's not part of cachedFormState\n mergedState.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n return mergedState\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel ?? undefined,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block ?? undefined,\n )\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n state.blockName = {\n initialValue: formData.blockName,\n passesCondition: true,\n valid: true,\n value: formData.blockName,\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as BlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(state._components?.customComponents?.Block ?? undefined)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n schemaFieldsPath,\n isEditable,\n id,\n formData,\n editor,\n nodeKey,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n blockType,\n ])\n\n const [isCollapsed, setIsCollapsed] = React.useState<boolean>(\n initialLexicalFormState?.[formData.id]?.collapsed ?? false,\n )\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_blocks.${blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const { i18n, t } = useTranslation<object, string>()\n\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state: newFormState } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!newFormState) {\n return prevFormState\n }\n\n if (prevFormState.blockName) {\n newFormState.blockName = prevFormState.blockName\n }\n\n const newFormStateData: BlockFields = reduceFieldsToValues(\n removeEmptyArrayValues({\n fields: deepCopyObjectSimpleWithoutReactComponents(newFormState),\n }),\n true,\n ) as BlockFields\n\n setTimeout(() => {\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = blockType\n node.setFields(newData, true)\n }\n })\n }, 0)\n\n if (submit) {\n setCustomLabel(newFormState._components?.customComponents?.BlockLabel ?? undefined)\n setCustomBlock(newFormState._components?.customComponents?.Block ?? undefined)\n\n let rowErrorCount = 0\n for (const formField of Object.values(newFormState)) {\n if (formField?.valid === false) {\n rowErrorCount++\n }\n }\n setErrorCount(rowErrorCount)\n }\n\n return newFormState\n },\n\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n globalSlug,\n schemaFieldsPath,\n blockType,\n parentDocumentFields,\n isEditable,\n editor,\n nodeKey,\n ],\n )\n\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n const removeBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock.labels.singular, i18n)\n : clientBlock?.slug\n\n const onCollapsedChange = useCallback(\n (changedCollapsed: boolean) => {\n void getDocPreferences().then((currentDocPreferences) => {\n const currentFieldPreferences =\n currentDocPreferences?.fields?.[parentLexicalRichTextField.name]\n\n const collapsedArray = currentFieldPreferences?.collapsed\n\n const newCollapsed: CollapsedPreferences =\n collapsedArray && collapsedArray?.length ? collapsedArray : []\n\n if (changedCollapsed) {\n if (!newCollapsed.includes(formData.id)) {\n newCollapsed.push(formData.id)\n }\n } else {\n if (newCollapsed.includes(formData.id)) {\n newCollapsed.splice(newCollapsed.indexOf(formData.id), 1)\n }\n }\n\n setDocFieldPreferences(parentLexicalRichTextField.name, {\n collapsed: newCollapsed,\n hello: 'hi',\n })\n })\n },\n [getDocPreferences, parentLexicalRichTextField.name, setDocFieldPreferences, formData.id],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n toggleDrawer()\n return false\n }}\n onMouseDown={(e) => {\n // Needed to preserve lexical selection for toggleDrawer lexical selection restore.\n // I believe this is needed due to this button (usually) being inside of a collapsible.\n e.preventDefault()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, isEditable, t, blockDisplayName, toggleDrawer],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeBlock()\n }}\n round\n tooltip=\"Remove Block\"\n />\n ),\n [baseClass, isEditable, removeBlock],\n )\n\n const BlockCollapsible = useMemo(\n () =>\n ({\n Actions,\n children,\n className,\n collapsibleProps,\n disableBlockName,\n editButton,\n errorCount,\n fieldHasErrors,\n Label,\n Pill: CustomPill,\n removeButton,\n }: BlockCollapsibleWithErrorProps) => {\n return (\n <div className={`${baseClass}__container ${baseClass}-${blockType}`}>\n <Collapsible\n className={[\n `${baseClass}__row`,\n fieldHasErrors ? `${baseClass}__row--has-errors` : `${baseClass}__row--no-errors`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__block-header`}>\n {typeof Label !== 'undefined' ? (\n Label\n ) : typeof CustomLabel !== 'undefined' ? (\n CustomLabel\n ) : (\n <div className={`${baseClass}__block-label`}>\n {typeof CustomPill !== 'undefined' ? (\n CustomPill\n ) : (\n <Pill\n className={`${baseClass}__block-pill ${baseClass}__block-pill-${blockType}`}\n pillStyle=\"white\"\n size=\"small\"\n >\n {blockDisplayName ?? blockType}\n </Pill>\n )}\n {!disableBlockName && !clientBlock?.admin?.disableBlockName && (\n <SectionTitle path=\"blockName\" readOnly={!isEditable} />\n )}\n\n {fieldHasErrors && (\n <ErrorPill count={errorCount ?? 0} i18n={i18n} withMessage />\n )}\n </div>\n )}\n\n <div className={`${baseClass}__block-actions`}>\n {typeof Actions !== 'undefined' ? (\n Actions\n ) : (\n <>\n {(CustomBlock && editButton !== false) || (!CustomBlock && editButton) ? (\n <EditButton />\n ) : null}\n {removeButton !== false && isEditable ? <RemoveButton /> : null}\n </>\n )}\n </div>\n </div>\n }\n isCollapsed={isCollapsed}\n key={0}\n onToggle={(incomingCollapsedState) => {\n onCollapsedChange(incomingCollapsedState)\n setIsCollapsed(incomingCollapsedState)\n }}\n {...(collapsibleProps || {})}\n >\n {children}\n </Collapsible>\n </div>\n )\n },\n [\n CustomBlock,\n CustomLabel,\n EditButton,\n RemoveButton,\n blockDisplayName,\n baseClass,\n clientBlock?.admin?.disableBlockName,\n blockType,\n i18n,\n isCollapsed,\n onCollapsedChange,\n isEditable,\n ],\n )\n\n const blockID = formData?.id\n\n const BlockDrawer = useMemo(\n () => () => (\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${blockID ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields ?? []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n ),\n [\n initialState,\n drawerSlug,\n blockID,\n blockDisplayName,\n t,\n isEditable,\n clientBlock?.fields,\n schemaFieldsPath,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n ],\n )\n\n // Memoized Form JSX\n const Block = useMemo(() => {\n if (!initialState) {\n return null\n }\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n return await onChange({ formState, submit: true })\n },\n ]}\n el=\"div\"\n fields={clientBlock?.fields ?? []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={(formState, newData) => {\n // This is only called when form is submitted from drawer - usually only the case if the block has a custom Block component\n newData.blockType = blockType\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isBlockNode(node)) {\n node.setFields(newData as BlockFields, true)\n }\n })\n toggleDrawer()\n }}\n submitted={submitted}\n uuid={uuid()}\n >\n <BlockContent\n baseClass={baseClass}\n BlockDrawer={BlockDrawer}\n Collapsible={BlockCollapsible}\n CustomBlock={CustomBlock}\n EditButton={EditButton}\n errorCount={errorCount}\n formSchema={clientBlock?.fields ?? []}\n initialState={initialState}\n nodeKey={nodeKey}\n RemoveButton={RemoveButton}\n />\n </Form>\n )\n }, [\n BlockCollapsible,\n BlockDrawer,\n CustomBlock,\n blockType,\n RemoveButton,\n EditButton,\n baseClass,\n editor,\n errorCount,\n toggleDrawer,\n clientBlock?.fields,\n // DO NOT ADD FORMDATA HERE! Adding formData will kick you out of sub block editors while writing.\n initialState,\n nodeKey,\n onChange,\n submitted,\n ])\n\n if (!clientBlock) {\n return (\n <BlockCollapsible disableBlockName={true} fieldHasErrors={true}>\n <div className={`${baseClass}-not-found`}>\n Error: Block '{blockType}' not found in the config but exists in the lexical data\n </div>\n </BlockCollapsible>\n )\n }\n\n return Block\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Collapsible","Drawer","EditDepthProvider","ErrorPill","Form","formatDrawerSlug","FormSubmit","Pill","RenderFields","SectionTitle","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useFormSubmitted","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isBlockNode","BlockContent","removeEmptyArrayValues","BlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","submitted","id","collectionSlug","globalSlug","fieldProps","featureClientSchemaMap","field","parentLexicalRichTextField","initialLexicalFormState","schemaPath","uuidFromContext","fields","parentDocumentFields","onChangeAbortControllerRef","AbortController","editDepth","errorCount","setErrorCount","useState","config","drawerSlug","slug","depth","toggleDrawer","getDocPreferences","setDocFieldPreferences","editor","isEditable","blockType","getFormState","schemaFieldsPath","initialState","setInitialState","cachedFormState","formState","mergedState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","blockName","passesCondition","valid","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","undefined","CustomBlock","setCustomBlock","Block","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","operation","readOnly","renderAllFields","signal","newFormStateData","update","node","newData","setFields","_components","isCollapsed","setIsCollapsed","collapsed","componentMapRenderedBlockPath","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","i18n","t","onChange","prevFormState","submit","controller","newFormState","initialBlockFormState","setTimeout","rowErrorCount","formField","values","removeBlock","remove","blockDisplayName","labels","singular","onCollapsedChange","changedCollapsed","then","currentDocPreferences","currentFieldPreferences","name","collapsedArray","newCollapsed","length","includes","push","splice","indexOf","hello","EditButton","buttonStyle","disabled","el","icon","onClick","e","preventDefault","stopPropagation","onMouseDown","round","size","tooltip","label","RemoveButton","BlockCollapsible","Actions","children","collapsibleProps","disableBlockName","editButton","fieldHasErrors","Label","CustomPill","removeButton","div","filter","Boolean","join","collapsibleStyle","header","pillStyle","admin","path","count","withMessage","onToggle","incomingCollapsedState","blockID","BlockDrawer","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","beforeSubmit","onSubmit","formSchema"],"mappings":"AAAA;;AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,WAAW,EACXC,MAAM,EACNC,iBAAiB,EACjBC,SAAS,EACTC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,IAAI,EACJC,YAAY,EACZC,YAAY,EACZC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,EAChBC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,aAAa,QAAQ,UAAS;AAOvC,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ,iBAAgB;AACjG,OAAOC,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACtE,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,OAAO,eAAc;AACrB,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,YAAY,QAAQ,yBAAwB;AACrD,SAA8CC,YAAY,QAAQ,oBAAmB;AACrF,SAASC,sBAAsB,QAAQ,8BAA6B;AAGlE;;;;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b8D,YAAYA;gBACZrG,YAAYA;gBACZsJ,YAAYpF,aAAavE,UAAU,EAAE;gBACrCoB,cAAcA;gBACdhC,SAASA;gBACToI,cAAcA;;;;;;;;;;;IAItB,GAAG;QACDC;QACAwB;QACArG;QACA3B;QACAuG;QACAd;QACAxH;QACA6B;QACAV;QACAO;QACA2D,aAAavE;QACb,kGAAkG;QAClGoB;QACAhC;QACAyF;QACAxF;KACD;IAED,IAAI,CAACkF,aAAa;QAChB,qBACE,QAACkD;YAAiBI,kBAAkB;YAAME,gBAAgB;sBACxD,cAAA,QAACI;gBAAIlJ,WAAW,GAAGC,UAAU,UAAU,CAAC;;oBAAE;oBACzB+B;oBAAU;;;;;;;;;;;;IAIjC;IAEA,OAAO6B;AACT,EAAC"}
@@ -1,8 +1,16 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
+ import React from 'react';
2
4
  import { useInlineBlockComponentContext } from '../index.js';
3
5
  export const InlineBlockContainer = ({ children })=>{
4
6
  const { InlineBlockContainer } = useInlineBlockComponentContext();
5
- return InlineBlockContainer ? <InlineBlockContainer>{children}</InlineBlockContainer> : null;
7
+ return InlineBlockContainer ? /*#__PURE__*/ _jsxDEV(InlineBlockContainer, {
8
+ children: children
9
+ }, void 0, false, {
10
+ fileName: "src/features/blocks/client/componentInline/components/InlineBlockContainer.tsx",
11
+ lineNumber: 9,
12
+ columnNumber: 33
13
+ }, this) : null;
6
14
  };
7
15
 
8
16
  //# sourceMappingURL=InlineBlockContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockContainer.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockContainer = ({ children }: { children: React.ReactNode }) => {\n const { InlineBlockContainer } = useInlineBlockComponentContext()\n\n return InlineBlockContainer ? <InlineBlockContainer>{children}</InlineBlockContainer> : null\n}\n"],"names":["useInlineBlockComponentContext","InlineBlockContainer","children"],"mappings":"AAAA;AAGA,SAASA,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,uBAAuB,CAAC,EAAEC,QAAQ,EAAiC;IAC9E,MAAM,EAAED,oBAAoB,EAAE,GAAGD;IAEjC,OAAOC,wBAAwBA,sBAAsBC,WAAWD,wBAAwB;AAC1F,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockContainer.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockContainer = ({ children }: { children: React.ReactNode }) => {\n const { InlineBlockContainer } = useInlineBlockComponentContext()\n\n return InlineBlockContainer ? <InlineBlockContainer>{children}</InlineBlockContainer> : null\n}\n"],"names":["React","useInlineBlockComponentContext","InlineBlockContainer","children"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,uBAAuB,CAAC,EAAEC,QAAQ,EAAiC;IAC9E,MAAM,EAAED,oBAAoB,EAAE,GAAGD;IAEjC,OAAOC,qCAAuB,QAACA;kBAAsBC;;;;;eAAmC;AAC1F,EAAC"}
@@ -1,8 +1,14 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
+ import React from 'react';
2
4
  import { useInlineBlockComponentContext } from '../index.js';
3
5
  export const InlineBlockEditButton = ()=>{
4
6
  const { EditButton } = useInlineBlockComponentContext();
5
- return EditButton ? <EditButton/> : null;
7
+ return EditButton ? /*#__PURE__*/ _jsxDEV(EditButton, {}, void 0, false, {
8
+ fileName: "src/features/blocks/client/componentInline/components/InlineBlockEditButton.tsx",
9
+ lineNumber: 9,
10
+ columnNumber: 23
11
+ }, this) : null;
6
12
  };
7
13
 
8
14
  //# sourceMappingURL=InlineBlockEditButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockEditButton = () => {\n const { EditButton } = useInlineBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"names":["useInlineBlockComponentContext","InlineBlockEditButton","EditButton"],"mappings":"AAAA;AAGA,SAASA,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,wBAAwB;IACnC,MAAM,EAAEC,UAAU,EAAE,GAAGF;IAEvB,OAAOE,cAAcA,eAAgB;AACvC,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockEditButton = () => {\n const { EditButton } = useInlineBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"names":["React","useInlineBlockComponentContext","InlineBlockEditButton","EditButton"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,wBAAwB;IACnC,MAAM,EAAEC,UAAU,EAAE,GAAGF;IAEvB,OAAOE,2BAAa,QAACA;;;;eAAgB;AACvC,EAAC"}
@@ -1,8 +1,14 @@
1
1
  'use client';
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
+ import React from 'react';
2
4
  import { useInlineBlockComponentContext } from '../index.js';
3
5
  export const InlineBlockLabel = ()=>{
4
6
  const { Label } = useInlineBlockComponentContext();
5
- return Label ? <Label/> : null;
7
+ return Label ? /*#__PURE__*/ _jsxDEV(Label, {}, void 0, false, {
8
+ fileName: "src/features/blocks/client/componentInline/components/InlineBlockLabel.tsx",
9
+ lineNumber: 9,
10
+ columnNumber: 18
11
+ }, this) : null;
6
12
  };
7
13
 
8
14
  //# sourceMappingURL=InlineBlockLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockLabel.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockLabel = () => {\n const { Label } = useInlineBlockComponentContext()\n\n return Label ? <Label /> : null\n}\n"],"names":["useInlineBlockComponentContext","InlineBlockLabel","Label"],"mappings":"AAAA;AAGA,SAASA,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,mBAAmB;IAC9B,MAAM,EAAEC,KAAK,EAAE,GAAGF;IAElB,OAAOE,SAASA,UAAW;AAC7B,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockLabel.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockLabel = () => {\n const { Label } = useInlineBlockComponentContext()\n\n return Label ? <Label /> : null\n}\n"],"names":["React","useInlineBlockComponentContext","InlineBlockLabel","Label"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,mBAAmB;IAC9B,MAAM,EAAEC,KAAK,EAAE,GAAGF;IAElB,OAAOE,sBAAQ,QAACA;;;;eAAW;AAC7B,EAAC"}