@payloadcms/richtext-lexical 3.68.0-internal-debug.185cc5f → 3.68.0-internal-debug.dafc24d

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 (280) hide show
  1. package/dist/cell/rscEntry.js +13 -5
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/features/blocks/client/component/BlockContent.js +29 -9
  4. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  5. package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -3
  6. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  7. package/dist/features/blocks/client/component/components/BlockEditButton.js +6 -2
  8. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  9. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +6 -2
  10. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  11. package/dist/features/blocks/client/component/index.js +123 -43
  12. package/dist/features/blocks/client/component/index.js.map +1 -1
  13. package/dist/features/blocks/client/component/index.scss +188 -0
  14. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +7 -3
  15. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  16. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +6 -2
  17. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  18. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +6 -2
  19. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  20. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +6 -2
  21. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  22. package/dist/features/blocks/client/componentInline/index.js +117 -37
  23. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  24. package/dist/features/blocks/client/componentInline/index.scss +90 -0
  25. package/dist/features/blocks/client/getBlockImageComponent.js +7 -3
  26. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  27. package/dist/features/blocks/client/nodes/BlocksNode.js +7 -3
  28. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +7 -3
  30. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  31. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +87 -27
  32. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +7 -3
  34. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +12 -4
  36. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  37. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.scss +6 -0
  38. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +18 -6
  39. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  40. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.scss +29 -0
  41. package/dist/features/blocks/premade/CodeBlock/Component/index.scss +97 -0
  42. package/dist/features/converters/lexicalToJSX/Component/index.js +9 -5
  43. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  44. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +7 -3
  45. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  46. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +7 -3
  47. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -2
  49. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -2
  51. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +13 -5
  53. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +38 -14
  55. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +18 -6
  57. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +31 -11
  59. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  60. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +43 -15
  61. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  62. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +31 -11
  63. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  64. package/dist/features/converters/lexicalToJSX/converter/index.js +8 -4
  65. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  66. package/dist/features/debug/jsxConverter/client/plugin/index.js +13 -5
  67. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  68. package/dist/features/debug/jsxConverter/client/plugin/style.scss +12 -0
  69. package/dist/features/debug/testRecorder/client/plugin/index.js +61 -21
  70. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  71. package/dist/features/debug/testRecorder/client/plugin/index.scss +53 -0
  72. package/dist/features/debug/treeView/client/plugin/index.js +7 -3
  73. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  74. package/dist/features/debug/treeView/client/plugin/index.scss +80 -0
  75. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +224 -72
  76. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  77. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.scss +87 -0
  78. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +31 -11
  79. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  80. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.scss +11 -0
  81. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +21 -9
  82. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  83. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +25 -9
  84. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  85. package/dist/features/experimental_table/client/plugins/TablePlugin/index.scss +233 -0
  86. package/dist/features/horizontalRule/client/plugin/index.scss +23 -0
  87. package/dist/features/indent/client/IndentPlugin.js +6 -2
  88. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  89. package/dist/features/link/client/plugins/clickableLink/index.js +6 -2
  90. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  91. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +76 -24
  92. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  93. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +7 -3
  94. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  95. package/dist/features/link/client/plugins/floatingLinkEditor/index.scss +92 -0
  96. package/dist/features/lists/checklist/client/plugin/index.js +6 -2
  97. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  98. package/dist/features/lists/plugin/index.js +6 -2
  99. package/dist/features/lists/plugin/index.js.map +1 -1
  100. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +13 -5
  101. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  102. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +7 -3
  103. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  104. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  105. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +13 -5
  106. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  107. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +7 -3
  108. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  109. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  110. package/dist/features/relationship/client/components/RelationshipComponent.js +55 -19
  111. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  112. package/dist/features/relationship/client/components/index.scss +95 -0
  113. package/dist/features/relationship/client/drawer/index.js +18 -6
  114. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  115. package/dist/features/relationship/client/nodes/RelationshipNode.js +7 -3
  116. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  117. package/dist/features/relationship/client/plugins/index.js +7 -3
  118. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  119. package/dist/features/textState/feature.client.js +18 -6
  120. package/dist/features/textState/feature.client.js.map +1 -1
  121. package/dist/features/toolbars/fixed/client/Toolbar/index.js +71 -23
  122. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  123. package/dist/features/toolbars/fixed/client/Toolbar/index.scss +113 -0
  124. package/dist/features/toolbars/inline/client/Toolbar/index.js +71 -23
  125. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  126. package/dist/features/toolbars/inline/client/Toolbar/index.scss +58 -0
  127. package/dist/features/toolbars/shared/ToolbarButton/index.js +7 -3
  128. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  129. package/dist/features/toolbars/shared/ToolbarButton/index.scss +46 -0
  130. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +60 -20
  131. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  132. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +36 -12
  133. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  134. package/dist/features/toolbars/shared/ToolbarDropdown/index.scss +129 -0
  135. package/dist/features/upload/client/component/index.js +91 -31
  136. package/dist/features/upload/client/component/index.js.map +1 -1
  137. package/dist/features/upload/client/component/index.scss +191 -0
  138. package/dist/features/upload/client/component/pending/index.js +13 -5
  139. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  140. package/dist/features/upload/client/drawer/index.js +18 -6
  141. package/dist/features/upload/client/drawer/index.js.map +1 -1
  142. package/dist/features/upload/client/nodes/UploadNode.js +12 -4
  143. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  144. package/dist/features/upload/client/plugin/index.js +7 -3
  145. package/dist/features/upload/client/plugin/index.js.map +1 -1
  146. package/dist/field/Diff/converters/listitem/index.js +36 -12
  147. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  148. package/dist/field/Diff/converters/listitem/index.scss +47 -0
  149. package/dist/field/Diff/converters/relationship/index.js +36 -12
  150. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  151. package/dist/field/Diff/converters/relationship/index.scss +73 -0
  152. package/dist/field/Diff/converters/unknown/index.js +30 -10
  153. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  154. package/dist/field/Diff/converters/unknown/index.scss +40 -0
  155. package/dist/field/Diff/converters/upload/index.js +59 -19
  156. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  157. package/dist/field/Diff/converters/upload/index.scss +115 -0
  158. package/dist/field/Diff/index.js +7 -3
  159. package/dist/field/Diff/index.js.map +1 -1
  160. package/dist/field/Diff/index.scss +102 -0
  161. package/dist/field/Field.js +79 -27
  162. package/dist/field/Field.js.map +1 -1
  163. package/dist/field/RenderLexical/index.js +36 -12
  164. package/dist/field/RenderLexical/index.js.map +1 -1
  165. package/dist/field/index.js +19 -7
  166. package/dist/field/index.js.map +1 -1
  167. package/dist/field/index.scss +41 -0
  168. package/dist/field/rscEntry.js +7 -3
  169. package/dist/field/rscEntry.js.map +1 -1
  170. package/dist/lexical/EditorPlugin.js +13 -5
  171. package/dist/lexical/EditorPlugin.js.map +1 -1
  172. package/dist/lexical/LexicalEditor.js +162 -50
  173. package/dist/lexical/LexicalEditor.js.map +1 -1
  174. package/dist/lexical/LexicalEditor.scss +54 -0
  175. package/dist/lexical/LexicalProvider.js +49 -17
  176. package/dist/lexical/LexicalProvider.js.map +1 -1
  177. package/dist/lexical/config/client/EditorConfigProvider.js +7 -3
  178. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  179. package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
  180. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +19 -7
  181. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  182. package/dist/lexical/plugins/InsertParagraphAtEnd/index.scss +54 -0
  183. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -3
  184. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  185. package/dist/lexical/plugins/SlashMenu/index.js +48 -16
  186. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  187. package/dist/lexical/plugins/SlashMenu/index.scss +68 -0
  188. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +19 -7
  189. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  190. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +35 -0
  191. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +31 -11
  192. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  193. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.scss +80 -0
  194. package/dist/lexical/theme/EditorTheme.scss +357 -0
  195. package/dist/lexical/ui/ContentEditable.js +13 -5
  196. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  197. package/dist/lexical/ui/ContentEditable.scss +105 -0
  198. package/dist/lexical/ui/icons/AI/index.js +37 -13
  199. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  200. package/dist/lexical/ui/icons/Add/index.js +19 -7
  201. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  202. package/dist/lexical/ui/icons/AlignCenter/index.js +25 -9
  203. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  204. package/dist/lexical/ui/icons/AlignJustify/index.js +25 -9
  205. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  206. package/dist/lexical/ui/icons/AlignLeft/index.js +25 -9
  207. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  208. package/dist/lexical/ui/icons/AlignRight/index.js +25 -9
  209. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  210. package/dist/lexical/ui/icons/Block/index.js +25 -9
  211. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  212. package/dist/lexical/ui/icons/Blockquote/index.js +13 -5
  213. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  214. package/dist/lexical/ui/icons/Bold/index.js +13 -5
  215. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  216. package/dist/lexical/ui/icons/Checklist/index.js +19 -7
  217. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  218. package/dist/lexical/ui/icons/Code/index.js +19 -7
  219. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  220. package/dist/lexical/ui/icons/CodeBlock/index.js +13 -5
  221. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/Collapse/index.js +13 -5
  223. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/H1/index.js +13 -5
  225. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/H2/index.js +13 -5
  227. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/H3/index.js +13 -5
  229. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/H4/index.js +13 -5
  231. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/H5/index.js +13 -5
  233. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/H6/index.js +13 -5
  235. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/HorizontalRule/index.js +13 -5
  237. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/IndentDecrease/index.js +31 -11
  239. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/IndentIncrease/index.js +31 -11
  241. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/InlineBlocks/index.js +13 -5
  243. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  244. package/dist/lexical/ui/icons/Italic/index.js +13 -5
  245. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  246. package/dist/lexical/ui/icons/Link/index.js +13 -5
  247. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  248. package/dist/lexical/ui/icons/Meatballs/index.js +25 -9
  249. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/OrderedList/index.js +37 -13
  251. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  252. package/dist/lexical/ui/icons/Relationship/index.js +37 -13
  253. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/Strikethrough/index.js +19 -7
  255. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/Subscript/index.js +13 -5
  257. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  258. package/dist/lexical/ui/icons/Superscript/index.js +13 -5
  259. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  260. package/dist/lexical/ui/icons/Table/index.js +13 -5
  261. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  262. package/dist/lexical/ui/icons/Text/index.js +13 -5
  263. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  264. package/dist/lexical/ui/icons/TextState/index.js +7 -3
  265. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  266. package/dist/lexical/ui/icons/Underline/index.js +19 -7
  267. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  268. package/dist/lexical/ui/icons/UnorderedList/index.js +43 -15
  269. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  270. package/dist/lexical/ui/icons/Upload/index.js +25 -9
  271. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  272. package/dist/utilities/fieldsDrawer/Drawer.js +19 -7
  273. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  274. package/dist/utilities/fieldsDrawer/DrawerContent.js +19 -7
  275. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  276. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +7 -3
  277. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  278. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +7 -3
  279. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  280. package/package.json +9 -8
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
4
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
5
5
  import { getTranslation } from '@payloadcms/translations';
@@ -243,7 +243,7 @@ export const InlineBlockComponent = (props)=>{
243
243
  nodeKey,
244
244
  formData
245
245
  ]);
246
- const RemoveButton = useMemo(()=>()=>/*#__PURE__*/ _jsx(Button, {
246
+ const RemoveButton = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(Button, {
247
247
  buttonStyle: "icon-label",
248
248
  className: `${baseClass}__removeButton`,
249
249
  disabled: !isEditable,
@@ -257,14 +257,18 @@ export const InlineBlockComponent = (props)=>{
257
257
  tooltip: t('lexical:blocks:inlineBlocks:remove', {
258
258
  label: blockDisplayName
259
259
  })
260
- }), [
260
+ }, void 0, false, {
261
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
262
+ lineNumber: 341,
263
+ columnNumber: 7
264
+ }, this), [
261
265
  baseClass,
262
266
  blockDisplayName,
263
267
  isEditable,
264
268
  removeInlineBlock,
265
269
  t
266
270
  ]);
267
- const EditButton = useMemo(()=>()=>/*#__PURE__*/ _jsx(Button, {
271
+ const EditButton = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(Button, {
268
272
  buttonStyle: "icon-label",
269
273
  className: `${baseClass}__editButton`,
270
274
  disabled: !isEditable,
@@ -278,14 +282,18 @@ export const InlineBlockComponent = (props)=>{
278
282
  tooltip: t('lexical:blocks:inlineBlocks:edit', {
279
283
  label: blockDisplayName
280
284
  })
281
- }), [
285
+ }, void 0, false, {
286
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
287
+ lineNumber: 360,
288
+ columnNumber: 7
289
+ }, this), [
282
290
  baseClass,
283
291
  blockDisplayName,
284
292
  isEditable,
285
293
  t,
286
294
  toggleDrawer
287
295
  ]);
288
- const InlineBlockContainer = useMemo(()=>({ children, className })=>/*#__PURE__*/ _jsx("div", {
296
+ const InlineBlockContainer = useMemo(()=>({ children, className })=>/*#__PURE__*/ _jsxDEV("div", {
289
297
  className: [
290
298
  `${baseClass}__container`,
291
299
  baseClass + '-' + formData.blockType,
@@ -293,7 +301,11 @@ export const InlineBlockComponent = (props)=>{
293
301
  ].filter(Boolean).join(' '),
294
302
  ref: inlineBlockElemElemRef,
295
303
  children: children
296
- }), [
304
+ }, void 0, false, {
305
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
306
+ lineNumber: 380,
307
+ columnNumber: 9
308
+ }, this), [
297
309
  baseClass,
298
310
  formData.blockType
299
311
  ]);
@@ -301,9 +313,13 @@ export const InlineBlockComponent = (props)=>{
301
313
  if (CustomLabel) {
302
314
  return ()=>CustomLabel;
303
315
  } else {
304
- return ()=>/*#__PURE__*/ _jsx("div", {
316
+ return ()=>/*#__PURE__*/ _jsxDEV("div", {
305
317
  children: clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''
306
- });
318
+ }, void 0, false, {
319
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
320
+ lineNumber: 397,
321
+ columnNumber: 9
322
+ }, this);
307
323
  }
308
324
  }, [
309
325
  CustomLabel,
@@ -311,24 +327,40 @@ export const InlineBlockComponent = (props)=>{
311
327
  i18n
312
328
  ]);
313
329
  if (!clientBlock) {
314
- return /*#__PURE__*/ _jsxs(InlineBlockContainer, {
330
+ return /*#__PURE__*/ _jsxDEV(InlineBlockContainer, {
315
331
  className: `${baseClass}-not-found`,
316
332
  children: [
317
- /*#__PURE__*/ _jsxs("span", {
333
+ /*#__PURE__*/ _jsxDEV("span", {
318
334
  children: [
319
335
  "Error: Block '",
320
336
  formData.blockType,
321
337
  "' not found"
322
338
  ]
323
- }),
324
- isEditable ? /*#__PURE__*/ _jsx("div", {
339
+ }, void 0, true, {
340
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
341
+ lineNumber: 405,
342
+ columnNumber: 9
343
+ }, this),
344
+ isEditable ? /*#__PURE__*/ _jsxDEV("div", {
325
345
  className: `${baseClass}__actions`,
326
- children: /*#__PURE__*/ _jsx(RemoveButton, {})
327
- }) : null
346
+ children: /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
347
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
348
+ lineNumber: 408,
349
+ columnNumber: 13
350
+ }, this)
351
+ }, void 0, false, {
352
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
353
+ lineNumber: 407,
354
+ columnNumber: 11
355
+ }, this) : null
328
356
  ]
329
- });
357
+ }, void 0, true, {
358
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
359
+ lineNumber: 404,
360
+ columnNumber: 7
361
+ }, this);
330
362
  }
331
- return /*#__PURE__*/ _jsxs(Form, {
363
+ return /*#__PURE__*/ _jsxDEV(Form, {
332
364
  beforeSubmit: [
333
365
  async ({ formState })=>{
334
366
  // This is only called when form is submitted from drawer
@@ -351,16 +383,16 @@ export const InlineBlockComponent = (props)=>{
351
383
  },
352
384
  uuid: uuid(),
353
385
  children: [
354
- /*#__PURE__*/ _jsx(EditDepthProvider, {
355
- children: /*#__PURE__*/ _jsx(Drawer, {
386
+ /*#__PURE__*/ _jsxDEV(EditDepthProvider, {
387
+ children: /*#__PURE__*/ _jsxDEV(Drawer, {
356
388
  className: '',
357
389
  slug: drawerSlug,
358
390
  title: t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {
359
391
  label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label')
360
392
  }),
361
- children: initialState ? /*#__PURE__*/ _jsxs(_Fragment, {
393
+ children: initialState ? /*#__PURE__*/ _jsxDEV(_Fragment, {
362
394
  children: [
363
- /*#__PURE__*/ _jsx(RenderFields, {
395
+ /*#__PURE__*/ _jsxDEV(RenderFields, {
364
396
  fields: clientBlock?.fields,
365
397
  forceRender: true,
366
398
  parentIndexPath: "",
@@ -369,16 +401,32 @@ export const InlineBlockComponent = (props)=>{
369
401
  parentSchemaPath: schemaFieldsPath,
370
402
  permissions: true,
371
403
  readOnly: !isEditable
372
- }),
373
- /*#__PURE__*/ _jsx(FormSubmit, {
404
+ }, void 0, false, {
405
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
406
+ lineNumber: 444,
407
+ columnNumber: 15
408
+ }, this),
409
+ /*#__PURE__*/ _jsxDEV(FormSubmit, {
374
410
  programmaticSubmit: true,
375
411
  children: t('fields:saveChanges')
376
- })
412
+ }, void 0, false, {
413
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
414
+ lineNumber: 453,
415
+ columnNumber: 15
416
+ }, this)
377
417
  ]
378
- }) : null
379
- })
380
- }),
381
- CustomBlock ? /*#__PURE__*/ _jsx(InlineBlockComponentContext, {
418
+ }, void 0, true) : null
419
+ }, void 0, false, {
420
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
421
+ lineNumber: 435,
422
+ columnNumber: 9
423
+ }, this)
424
+ }, void 0, false, {
425
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
426
+ lineNumber: 434,
427
+ columnNumber: 7
428
+ }, this),
429
+ CustomBlock ? /*#__PURE__*/ _jsxDEV(InlineBlockComponentContext, {
382
430
  value: {
383
431
  EditButton,
384
432
  initialState,
@@ -388,23 +436,55 @@ export const InlineBlockComponent = (props)=>{
388
436
  RemoveButton
389
437
  },
390
438
  children: CustomBlock
391
- }) : /*#__PURE__*/ _jsxs(InlineBlockContainer, {
439
+ }, void 0, false, {
440
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
441
+ lineNumber: 459,
442
+ columnNumber: 9
443
+ }, this) : /*#__PURE__*/ _jsxDEV(InlineBlockContainer, {
392
444
  children: [
393
- initialState ? /*#__PURE__*/ _jsx(Label, {}) : /*#__PURE__*/ _jsx(ShimmerEffect, {
445
+ initialState ? /*#__PURE__*/ _jsxDEV(Label, {}, void 0, false, {
446
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
447
+ lineNumber: 473,
448
+ columnNumber: 27
449
+ }, this) : /*#__PURE__*/ _jsxDEV(ShimmerEffect, {
394
450
  height: "15px",
395
451
  width: "40px"
396
- }),
397
- isEditable ? /*#__PURE__*/ _jsxs("div", {
452
+ }, void 0, false, {
453
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
454
+ lineNumber: 473,
455
+ columnNumber: 39
456
+ }, this),
457
+ isEditable ? /*#__PURE__*/ _jsxDEV("div", {
398
458
  className: `${baseClass}__actions`,
399
459
  children: [
400
- /*#__PURE__*/ _jsx(EditButton, {}),
401
- /*#__PURE__*/ _jsx(RemoveButton, {})
460
+ /*#__PURE__*/ _jsxDEV(EditButton, {}, void 0, false, {
461
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
462
+ lineNumber: 476,
463
+ columnNumber: 15
464
+ }, this),
465
+ /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
466
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
467
+ lineNumber: 477,
468
+ columnNumber: 15
469
+ }, this)
402
470
  ]
403
- }) : null
471
+ }, void 0, true, {
472
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
473
+ lineNumber: 475,
474
+ columnNumber: 13
475
+ }, this) : null
404
476
  ]
405
- })
477
+ }, void 0, true, {
478
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
479
+ lineNumber: 472,
480
+ columnNumber: 9
481
+ }, this)
406
482
  ]
407
- });
483
+ }, void 0, true, {
484
+ fileName: "src/features/blocks/client/componentInline/index.tsx",
485
+ lineNumber: 416,
486
+ columnNumber: 5
487
+ }, this);
408
488
  };
409
489
 
410
490
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.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: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\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 return 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\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,\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,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = 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 clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = 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 onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\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 initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\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 && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\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 } = 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 (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\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 removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\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={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? '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 {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","div","filter","Boolean","join","ref","Label","span","beforeSubmit","disableValidationOnSubmit","onSubmit","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT,iBAA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G;qBAED;;;IAGV;IAEA,qBACE,MAACpI;QACC0J,cAAc;YACZ,OAAO,EAAEjG,SAAS,EAAE;gBAClB,yDAAyD;gBACzD,OAAO,MAAMkE,SAAS;oBAAElE;oBAAWoE,QAAQ;gBAAK;YAClD;SACD;QACD8B,yBAAyB;QACzBX,IAAG;QACHhG,QAAQyC,aAAazC;QACrBrB,cAAcA,gBAAgB,CAAC;QAC/BgG,UAAU;YAACA;SAAS;QACpBiC,UAAU,CAACnG,WAAWoD;YACpBsB,aAAa1E,WAAWoD;YACxB9B;QACF;QACAzD,MAAMA;;0BAEN,KAACvB;0BACC,cAAA,KAACD;oBACCmC,WAAW;oBACX4C,MAAMD;oBACNiF,OAAOrH,EAAE,CAAC,4BAA4B,EAAEL,UAAUqB,KAAK,SAAS,UAAU,EAAE;wBAC1EsF,OAAO1C,oBAAoB5D,EAAE;oBAC/B;8BAECb,6BACC;;0CACE,KAACxB;gCACC6C,QAAQyC,aAAazC;gCACrB8G,WAAW;gCACXC,iBAAgB;gCAChBC,YAAW;gCAAG,+DAA+D;gCAC7EC,kBAAkBxD;gCAClByD,aAAa;gCACb9C,UAAU,CAAC9E;;0CAEb,KAACpC;gCAAWiK,oBAAoB;0CAAO3H,EAAE;;;yBAEzC;;;YAGPiC,4BACC,KAAC/C;gBACCuC,OAAO;oBACL8E;oBACApH;oBACAsH;oBACAO;oBACApH;oBACAgG;gBACF;0BAEC3D;+BAGH,MAACwE;;oBACEtH,6BAAe,KAAC6H,2BAAW,KAACpJ;wBAAcgK,QAAO;wBAAOC,OAAM;;oBAC9D/H,2BACC,MAAC6G;wBAAIlH,WAAW,GAAGC,UAAU,SAAS,CAAC;;0CACrC,KAAC6G;0CACD,KAACX;;yBAED;;;;;AAKd,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/componentInline/index.tsx"],"sourcesContent":["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey } from 'lexical'\n\nimport './index.scss'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.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: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, className: baseClass, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\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 return 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\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,\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,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = 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 clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = 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 onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\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 initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\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 && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\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 } = 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 (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\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 removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\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={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? '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 {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","getTranslation","Button","Drawer","EditDepthProvider","Form","formatDrawerSlug","FormSubmit","RenderFields","ShimmerEffect","useConfig","useDocumentForm","useDocumentInfo","useEditDepth","useServerFunctions","useTranslation","abortAndIgnore","$getNodeByKey","deepCopyObjectSimpleWithoutReactComponents","reduceFieldsToValues","React","createContext","useCallback","useEffect","useMemo","useRef","v4","uuid","useEditorConfigContext","useLexicalDrawer","$isInlineBlockNode","InlineBlockComponentContext","initialState","useInlineBlockComponentContext","use","InlineBlockComponent","props","cacheBuster","className","baseClass","formData","nodeKey","editor","isEditable","i18n","t","createdInlineBlock","fieldProps","featureClientSchemaMap","initialLexicalFormState","schemaPath","setCreatedInlineBlock","uuidFromContext","fields","parentDocumentFields","getFormState","editDepth","firstTimeDrawer","setInitialState","useState","cachedFormState","id","formState","Object","fromEntries","entries","map","fieldName","fieldState","initialValue","value","hasMounted","prevCacheBuster","current","CustomLabel","setCustomLabel","customComponents","BlockLabel","CustomBlock","setCustomBlock","Block","drawerSlug","slug","depth","toggleDrawer","inlineBlockElemElemRef","collectionSlug","getDocPreferences","globalSlug","config","componentMapRenderedBlockPath","blockType","clientSchemaMap","blocksField","clientBlock","blockReferences","blocksMap","blocks","clientBlockFields","getKey","length","undefined","removeInlineBlock","update","remove","blockDisplayName","labels","singular","onChangeAbortControllerRef","AbortController","schemaFieldsPath","abortController","awaitInitialState","state","data","docPermissions","docPreferences","documentFormState","initialBlockData","initialBlockFormState","operation","readOnly","renderAllFields","signal","newFormStateData","node","newData","setFields","onChange","prevFormState","submit","controller","isStateOutOfSync","keys","some","key","onFormSubmit","RemoveButton","buttonStyle","disabled","icon","onClick","e","preventDefault","round","size","tooltip","label","EditButton","el","InlineBlockContainer","children","div","filter","Boolean","join","ref","Label","span","beforeSubmit","disableValidationOnSubmit","onSubmit","title","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","programmaticSubmit","height","width"],"mappings":"AAAA;;AAIA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,cAAc,QAAQ,2BAA0B;AACzD,SACEC,MAAM,EACNC,MAAM,EACNC,iBAAiB,EACjBC,IAAI,EACJC,gBAAgB,EAChBC,UAAU,EACVC,YAAY,EACZC,aAAa,EACbC,SAAS,EACTC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,cAAc,QACT,iBAAgB;AACvB,SAASC,cAAc,QAAQ,wBAAuB;AACtD,SAASC,aAAa,QAAQ,UAAS;AAEvC,OAAO,eAAc;AAErB,SAASC,0CAA0C,EAAEC,oBAAoB,QAAQ,iBAAgB;AACjG,OAAOC,SAASC,aAAa,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAO;AACrF,SAASC,MAAMC,IAAI,QAAQ,OAAM;AAIjC,SAASC,sBAAsB,QAAQ,4DAA2D;AAClG,SAASC,gBAAgB,QAAQ,yDAAwD;AACzF,SAASC,kBAAkB,QAAQ,+BAA8B;AAG/D;;;;GAIC,GAgBH,MAAMC,4CAA8BV,cAA+C;IACjFW,cAAc;AAChB;AAEA,OAAO,MAAMC,iCAAiC,IAAMb,MAAMc,GAAG,CAACH,6BAA4B;AAE1F,OAAO,MAAMI,uBAAwC,CAACC;IACpD,MAAM,EAAEC,WAAW,EAAEC,WAAWC,SAAS,EAAEC,QAAQ,EAAEC,OAAO,EAAE,GAAGL;IAEjE,MAAM,CAACM,OAAO,GAAG3C;IACjB,MAAM4C,aAAa3C;IACnB,MAAM,EAAE4C,IAAI,EAAEC,CAAC,EAAE,GAAG9B;IACpB,MAAM,EACJ+B,kBAAkB,EAClBC,YAAY,EAAEC,sBAAsB,EAAEC,uBAAuB,EAAEC,UAAU,EAAE,EAC3EC,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iC,4BACC,QAAC/C;gBACCuC,OAAO;oBACL8E;oBACApH;oBACAsH;oBACAO;oBACApH;oBACAgG;gBACF;0BAEC3D;;;;;qCAGH,QAACwE;;oBACEtH,6BAAe,QAAC6H;;;;6CAAW,QAACpJ;wBAAcgK,QAAO;wBAAOC,OAAM;;;;;;oBAC9D/H,2BACC,QAAC6G;wBAAIlH,WAAW,GAAGC,UAAU,SAAS,CAAC;;0CACrC,QAAC6G;;;;;0CACD,QAACX;;;;;;;;;;+BAED;;;;;;;;;;;;;AAKd,EAAC"}
@@ -0,0 +1,90 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .LexicalEditorTheme__inlineBlock {
5
+ @extend %body;
6
+ @include shadow-sm;
7
+ display: inline-block;
8
+ margin-right: base(0.2);
9
+ margin-left: base(0.2);
10
+ padding: base(0.1);
11
+ padding-inline-start: base(0.4);
12
+ background: var(--theme-input-bg);
13
+ outline: 1px solid var(--theme-elevation-100);
14
+ border-radius: $style-radius-s;
15
+ max-width: calc(var(--base) * 15);
16
+ font-family: var(--font-body);
17
+
18
+ &__container {
19
+ display: flex;
20
+ align-items: center;
21
+ }
22
+
23
+ &-not-found {
24
+ max-width: calc(var(--base) * 20);
25
+ color: var(--theme-error-500);
26
+ }
27
+
28
+ &::selection {
29
+ background: transparent;
30
+ }
31
+
32
+ &:hover {
33
+ outline: 1px solid var(--theme-elevation-150);
34
+ }
35
+
36
+ &__wrap {
37
+ flex-grow: 1;
38
+ overflow: hidden;
39
+ }
40
+
41
+ &__editButton.btn {
42
+ margin: 0;
43
+ }
44
+
45
+ &__editButton {
46
+ &:disabled {
47
+ color: var(--theme-elevation-300);
48
+ pointer-events: none;
49
+ }
50
+ }
51
+
52
+ &__actions {
53
+ display: flex;
54
+ align-items: center;
55
+ flex-shrink: 0;
56
+ margin-left: base(0.4);
57
+
58
+ & > .btn {
59
+ width: base(1);
60
+ height: base(1);
61
+
62
+ &:not(:disabled):hover {
63
+ background: var(--theme-elevation-100);
64
+ }
65
+
66
+ & > * {
67
+ height: 100%;
68
+ }
69
+ }
70
+
71
+ svg {
72
+ width: 16px;
73
+ height: 16px;
74
+ }
75
+ }
76
+
77
+ &__removeButton.btn {
78
+ margin: 0;
79
+
80
+ line {
81
+ stroke-width: base(0.2);
82
+ }
83
+
84
+ &:disabled {
85
+ color: var(--theme-elevation-300);
86
+ pointer-events: none;
87
+ }
88
+ }
89
+ }
90
+ }
@@ -1,11 +1,11 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
2
  import React from 'react';
3
3
  import { BlockIcon } from '../../../lexical/ui/icons/Block/index.js';
4
4
  export function getBlockImageComponent(imageURL, imageAltText) {
5
5
  if (!imageURL) {
6
6
  return BlockIcon;
7
7
  }
8
- return ()=>/*#__PURE__*/ _jsx("img", {
8
+ return ()=>/*#__PURE__*/ _jsxDEV("img", {
9
9
  alt: imageAltText ?? 'Block Image',
10
10
  className: "lexical-block-custom-image",
11
11
  src: imageURL,
@@ -13,7 +13,11 @@ export function getBlockImageComponent(imageURL, imageAltText) {
13
13
  maxHeight: 20,
14
14
  maxWidth: 20
15
15
  }
16
- });
16
+ }, void 0, false, {
17
+ fileName: "src/features/blocks/client/getBlockImageComponent.tsx",
18
+ lineNumber: 11,
19
+ columnNumber: 5
20
+ }, this);
17
21
  }
18
22
 
19
23
  //# sourceMappingURL=getBlockImageComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/features/blocks/client/getBlockImageComponent.tsx"],"sourcesContent":["import React from 'react'\n\nimport { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'\n\nexport function getBlockImageComponent(imageURL?: string, imageAltText?: string) {\n if (!imageURL) {\n return BlockIcon\n }\n\n return () => (\n <img\n alt={imageAltText ?? 'Block Image'}\n className=\"lexical-block-custom-image\"\n src={imageURL}\n style={{ maxHeight: 20, maxWidth: 20 }}\n />\n )\n}\n"],"names":["React","BlockIcon","getBlockImageComponent","imageURL","imageAltText","img","alt","className","src","style","maxHeight","maxWidth"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,SAASC,SAAS,QAAQ,2CAA0C;AAEpE,OAAO,SAASC,uBAAuBC,QAAiB,EAAEC,YAAqB;IAC7E,IAAI,CAACD,UAAU;QACb,OAAOF;IACT;IAEA,OAAO,kBACL,KAACI;YACCC,KAAKF,gBAAgB;YACrBG,WAAU;YACVC,KAAKL;YACLM,OAAO;gBAAEC,WAAW;gBAAIC,UAAU;YAAG;;AAG3C"}
1
+ {"version":3,"sources":["../../../../src/features/blocks/client/getBlockImageComponent.tsx"],"sourcesContent":["import React from 'react'\n\nimport { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'\n\nexport function getBlockImageComponent(imageURL?: string, imageAltText?: string) {\n if (!imageURL) {\n return BlockIcon\n }\n\n return () => (\n <img\n alt={imageAltText ?? 'Block Image'}\n className=\"lexical-block-custom-image\"\n src={imageURL}\n style={{ maxHeight: 20, maxWidth: 20 }}\n />\n )\n}\n"],"names":["React","BlockIcon","getBlockImageComponent","imageURL","imageAltText","img","alt","className","src","style","maxHeight","maxWidth"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,SAASC,SAAS,QAAQ,2CAA0C;AAEpE,OAAO,SAASC,uBAAuBC,QAAiB,EAAEC,YAAqB;IAC7E,IAAI,CAACD,UAAU;QACb,OAAOF;IACT;IAEA,OAAO,kBACL,QAACI;YACCC,KAAKF,gBAAgB;YACrBG,WAAU;YACVC,KAAKL;YACLM,OAAO;gBAAEC,WAAW;gBAAIC,UAAU;YAAG;;;;;;AAG3C"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import ObjectID from 'bson-objectid';
4
4
  import { $applyNodeReplacement } from 'lexical';
5
5
  import React from 'react';
@@ -28,12 +28,16 @@ export class BlockNode extends ServerBlockNode {
28
28
  return node;
29
29
  }
30
30
  decorate(_editor, config) {
31
- return /*#__PURE__*/ _jsx(BlockComponent, {
31
+ return /*#__PURE__*/ _jsxDEV(BlockComponent, {
32
32
  cacheBuster: this.getCacheBuster(),
33
33
  className: config.theme.block ?? 'LexicalEditorTheme__block',
34
34
  formData: this.getFields(),
35
35
  nodeKey: this.getKey()
36
- });
36
+ }, void 0, false, {
37
+ fileName: "src/features/blocks/client/nodes/BlocksNode.tsx",
38
+ lineNumber: 43,
39
+ columnNumber: 7
40
+ }, this);
37
41
  }
38
42
  exportJSON() {
39
43
  return super.exportJSON();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.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 { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js'\n\nimport { ServerBlockNode } from '../../server/nodes/BlocksNode.js'\nimport { BlockComponent } from '../component/index.js'\n\nexport class BlockNode extends ServerBlockNode {\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <BlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.block ?? 'LexicalEditorTheme__block'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode {\n return $applyNodeReplacement(\n new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"names":["ObjectID","$applyNodeReplacement","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","version","fields","data","$createBlockNode","setFormat","format","decorate","_editor","config","cacheBuster","getCacheBuster","className","theme","block","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"mappings":"AAAA;;AACA,OAAOA,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAIhB,UAAS;AAChB,OAAOC,WAAyB,QAAO;AAIvC,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,cAAc,QAAQ,wBAAuB;AAEtD,OAAO,MAAMC,kBAAkBF;IAC7B,OAAgBG,MAAMC,IAAqB,EAAmB;QAC5D,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,WAAWC,cAAmC,EAAa;QACzE,IAAIA,eAAeC,OAAO,KAAK,GAAG;YAChC,mFAAmF;YACnFD,iBAAiB;gBACf,GAAGA,cAAc;gBACjBE,QAAQ;oBACN,GAAG,AAACF,eAAuBE,MAAM,CAACC,IAAI;gBACxC;gBACAF,SAAS;YACX;QACF;QACA,MAAMJ,OAAOO,iBAAiBJ,eAAeE,MAAM;QACnDL,KAAKQ,SAAS,CAACL,eAAeM,MAAM;QACpC,OAAOT;IACT;IAESU,SAASC,OAAsB,EAAEC,MAAoB,EAAe;QAC3E,qBACE,KAACf;YACCgB,aAAa,IAAI,CAACC,cAAc;YAChCC,WAAWH,OAAOI,KAAK,CAACC,KAAK,IAAI;YACjCC,UAAU,IAAI,CAACC,SAAS;YACxBC,SAAS,IAAI,CAACC,MAAM;;IAG1B;IAESC,aAAkC;QACzC,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASf,iBAAiBF,MAA6B;IAC5D,OAAOX,sBACL,IAAII,UAAU;QACZO,QAAQ;YACN,GAAGA,MAAM;YACTkB,IAAIlB,QAAQkB,MAAM,IAAI9B,SAAS+B,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,aAAa1B,IAAgD;IAC3E,OAAOA,gBAAgBF;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/nodes/BlocksNode.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 { BlockFieldsOptionalID, SerializedBlockNode } from '../../server/nodes/BlocksNode.js'\n\nimport { ServerBlockNode } from '../../server/nodes/BlocksNode.js'\nimport { BlockComponent } from '../component/index.js'\n\nexport class BlockNode extends ServerBlockNode {\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): BlockNode {\n if (serializedNode.version === 1) {\n // Convert (version 1 had the fields wrapped in another, unnecessary data property)\n serializedNode = {\n ...serializedNode,\n fields: {\n ...(serializedNode as any).fields.data,\n },\n version: 2,\n }\n }\n const node = $createBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <BlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.block ?? 'LexicalEditorTheme__block'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createBlockNode(fields: BlockFieldsOptionalID): BlockNode {\n return $applyNodeReplacement(\n new BlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isBlockNode(node: BlockNode | LexicalNode | null | undefined): node is BlockNode {\n return node instanceof BlockNode\n}\n"],"names":["ObjectID","$applyNodeReplacement","React","ServerBlockNode","BlockComponent","BlockNode","clone","node","getType","importJSON","serializedNode","version","fields","data","$createBlockNode","setFormat","format","decorate","_editor","config","cacheBuster","getCacheBuster","className","theme","block","formData","getFields","nodeKey","getKey","exportJSON","id","default","toHexString","$isBlockNode"],"mappings":"AAAA;;AACA,OAAOA,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAIhB,UAAS;AAChB,OAAOC,WAAyB,QAAO;AAIvC,SAASC,eAAe,QAAQ,mCAAkC;AAClE,SAASC,cAAc,QAAQ,wBAAuB;AAEtD,OAAO,MAAMC,kBAAkBF;IAC7B,OAAgBG,MAAMC,IAAqB,EAAmB;QAC5D,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,WAAWC,cAAmC,EAAa;QACzE,IAAIA,eAAeC,OAAO,KAAK,GAAG;YAChC,mFAAmF;YACnFD,iBAAiB;gBACf,GAAGA,cAAc;gBACjBE,QAAQ;oBACN,GAAG,AAACF,eAAuBE,MAAM,CAACC,IAAI;gBACxC;gBACAF,SAAS;YACX;QACF;QACA,MAAMJ,OAAOO,iBAAiBJ,eAAeE,MAAM;QACnDL,KAAKQ,SAAS,CAACL,eAAeM,MAAM;QACpC,OAAOT;IACT;IAESU,SAASC,OAAsB,EAAEC,MAAoB,EAAe;QAC3E,qBACE,QAACf;YACCgB,aAAa,IAAI,CAACC,cAAc;YAChCC,WAAWH,OAAOI,KAAK,CAACC,KAAK,IAAI;YACjCC,UAAU,IAAI,CAACC,SAAS;YACxBC,SAAS,IAAI,CAACC,MAAM;;;;;;IAG1B;IAESC,aAAkC;QACzC,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASf,iBAAiBF,MAA6B;IAC5D,OAAOX,sBACL,IAAII,UAAU;QACZO,QAAQ;YACN,GAAGA,MAAM;YACTkB,IAAIlB,QAAQkB,MAAM,IAAI9B,SAAS+B,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,aAAa1B,IAAgD;IAC3E,OAAOA,gBAAgBF;AACzB"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import ObjectID from 'bson-objectid';
4
4
  import { $applyNodeReplacement } from 'lexical';
5
5
  import React from 'react';
@@ -19,12 +19,16 @@ export class InlineBlockNode extends ServerInlineBlockNode {
19
19
  return node;
20
20
  }
21
21
  decorate(_editor, config) {
22
- return /*#__PURE__*/ _jsx(InlineBlockComponent, {
22
+ return /*#__PURE__*/ _jsxDEV(InlineBlockComponent, {
23
23
  cacheBuster: this.getCacheBuster(),
24
24
  className: config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock',
25
25
  formData: this.getFields(),
26
26
  nodeKey: this.getKey()
27
- });
27
+ }, void 0, false, {
28
+ fileName: "src/features/blocks/client/nodes/InlineBlocksNode.tsx",
29
+ lineNumber: 40,
30
+ columnNumber: 7
31
+ }, this);
28
32
  }
29
33
  exportJSON() {
30
34
  return super.exportJSON();
@@ -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,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,KAACf;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
+ {"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"}