@payloadcms/richtext-lexical 3.68.0-internal-debug.591ab42 → 3.68.0-internal-debug.e9b66ee

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 (254) hide show
  1. package/dist/cell/rscEntry.js +2 -21
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/features/blocks/client/component/BlockContent.js +13 -48
  4. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  5. package/dist/features/blocks/client/component/components/BlockCollapsible.js +1 -10
  6. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  7. package/dist/features/blocks/client/component/components/BlockEditButton.js +1 -7
  8. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  9. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +1 -7
  10. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  11. package/dist/features/blocks/client/component/index.js +81 -247
  12. package/dist/features/blocks/client/component/index.js.map +1 -1
  13. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +1 -9
  14. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  15. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +1 -7
  16. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  17. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +1 -7
  18. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  19. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +1 -7
  20. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  21. package/dist/features/blocks/client/componentInline/index.js +68 -217
  22. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  23. package/dist/features/blocks/client/getBlockImageComponent.js +4 -15
  24. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  25. package/dist/features/blocks/client/nodes/BlocksNode.js +1 -12
  26. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  27. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +2 -12
  28. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  29. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +26 -127
  30. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  31. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +49 -65
  32. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +3 -16
  34. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +4 -25
  36. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  37. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  38. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  39. package/dist/features/converters/lexicalToJSX/Component/index.js +2 -13
  40. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  41. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +1 -8
  42. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  43. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +1 -8
  44. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  45. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +1 -6
  46. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  47. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +1 -6
  48. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  49. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +10 -19
  50. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  51. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +16 -63
  52. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  53. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +4 -19
  54. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  55. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +12 -45
  56. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  57. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +11 -57
  58. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  59. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +7 -46
  60. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  61. package/dist/features/converters/lexicalToJSX/converter/index.js +5 -12
  62. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  63. package/dist/features/debug/jsxConverter/client/plugin/index.js +3 -16
  64. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  65. package/dist/features/debug/testRecorder/client/plugin/index.js +38 -113
  66. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  67. package/dist/features/debug/treeView/client/plugin/index.js +1 -15
  68. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  69. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +79 -357
  70. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  71. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +7 -41
  72. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  73. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +9 -39
  74. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  75. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +28 -59
  76. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  77. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +0 -1
  78. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  79. package/dist/features/indent/client/IndentPlugin.js +1 -6
  80. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  81. package/dist/features/link/client/plugins/clickableLink/index.js +1 -7
  82. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  83. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +59 -151
  84. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  85. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -9
  86. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  87. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  88. package/dist/features/lists/checklist/client/plugin/index.js +1 -7
  89. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  90. package/dist/features/lists/plugin/index.js +1 -7
  91. package/dist/features/lists/plugin/index.js.map +1 -1
  92. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +3 -18
  93. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  94. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +2 -9
  95. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  96. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +3 -18
  97. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  98. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +2 -9
  99. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  100. package/dist/features/relationship/client/components/RelationshipComponent.js +31 -100
  101. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  102. package/dist/features/relationship/client/drawer/index.js +4 -21
  103. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  104. package/dist/features/relationship/client/nodes/RelationshipNode.js +2 -12
  105. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  106. package/dist/features/relationship/client/plugins/index.js +1 -8
  107. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  108. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  109. package/dist/features/textState/feature.client.js +5 -22
  110. package/dist/features/textState/feature.client.js.map +1 -1
  111. package/dist/features/toolbars/fixed/client/Toolbar/index.js +27 -123
  112. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  113. package/dist/features/toolbars/inline/client/Toolbar/index.js +18 -111
  114. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  115. package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -14
  116. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  117. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +56 -135
  118. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  119. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +16 -70
  120. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  121. package/dist/features/upload/client/component/index.js +43 -167
  122. package/dist/features/upload/client/component/index.js.map +1 -1
  123. package/dist/features/upload/client/component/pending/index.js +3 -16
  124. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  125. package/dist/features/upload/client/drawer/index.js +4 -21
  126. package/dist/features/upload/client/drawer/index.js.map +1 -1
  127. package/dist/features/upload/client/nodes/UploadNode.js +3 -17
  128. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  129. package/dist/features/upload/client/plugin/index.js +2 -9
  130. package/dist/features/upload/client/plugin/index.js.map +1 -1
  131. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  132. package/dist/field/Diff/converters/listitem/index.js +11 -54
  133. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  134. package/dist/field/Diff/converters/relationship/index.js +18 -60
  135. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  136. package/dist/field/Diff/converters/unknown/index.js +7 -42
  137. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  138. package/dist/field/Diff/converters/upload/index.js +21 -91
  139. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  140. package/dist/field/Diff/index.js +4 -17
  141. package/dist/field/Diff/index.js.map +1 -1
  142. package/dist/field/Field.js +25 -124
  143. package/dist/field/Field.js.map +1 -1
  144. package/dist/field/RenderLexical/index.js +15 -47
  145. package/dist/field/RenderLexical/index.js.map +1 -1
  146. package/dist/field/index.js +5 -24
  147. package/dist/field/index.js.map +1 -1
  148. package/dist/field/rscEntry.js +1 -9
  149. package/dist/field/rscEntry.js.map +1 -1
  150. package/dist/lexical/EditorPlugin.js +2 -17
  151. package/dist/lexical/EditorPlugin.js.map +1 -1
  152. package/dist/lexical/LexicalEditor.js +69 -232
  153. package/dist/lexical/LexicalEditor.js.map +1 -1
  154. package/dist/lexical/LexicalProvider.js +13 -64
  155. package/dist/lexical/LexicalProvider.js.map +1 -1
  156. package/dist/lexical/config/client/EditorConfigProvider.js +2 -11
  157. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  158. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +5 -28
  159. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  160. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +1 -14
  161. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  162. package/dist/lexical/plugins/SlashMenu/index.js +31 -98
  163. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  164. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +7 -27
  165. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  166. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +7 -45
  167. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  168. package/dist/lexical/ui/ContentEditable.js +3 -18
  169. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  170. package/dist/lexical/ui/icons/AI/index.js +10 -58
  171. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  172. package/dist/lexical/ui/icons/Add/index.js +4 -31
  173. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  174. package/dist/lexical/ui/icons/AlignCenter/index.js +5 -45
  175. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  176. package/dist/lexical/ui/icons/AlignJustify/index.js +5 -45
  177. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  178. package/dist/lexical/ui/icons/AlignLeft/index.js +5 -45
  179. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  180. package/dist/lexical/ui/icons/AlignRight/index.js +5 -45
  181. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  182. package/dist/lexical/ui/icons/Block/index.js +5 -54
  183. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  184. package/dist/lexical/ui/icons/Blockquote/index.js +3 -24
  185. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  186. package/dist/lexical/ui/icons/Bold/index.js +3 -24
  187. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  188. package/dist/lexical/ui/icons/Checklist/index.js +4 -39
  189. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  190. package/dist/lexical/ui/icons/Code/index.js +4 -34
  191. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  192. package/dist/lexical/ui/icons/CodeBlock/index.js +3 -22
  193. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  194. package/dist/lexical/ui/icons/Collapse/index.js +3 -23
  195. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  196. package/dist/lexical/ui/icons/H1/index.js +3 -24
  197. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  198. package/dist/lexical/ui/icons/H2/index.js +3 -24
  199. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  200. package/dist/lexical/ui/icons/H3/index.js +3 -24
  201. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  202. package/dist/lexical/ui/icons/H4/index.js +3 -24
  203. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  204. package/dist/lexical/ui/icons/H5/index.js +3 -24
  205. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  206. package/dist/lexical/ui/icons/H6/index.js +3 -24
  207. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  208. package/dist/lexical/ui/icons/HorizontalRule/index.js +3 -27
  209. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  210. package/dist/lexical/ui/icons/IndentDecrease/index.js +6 -53
  211. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  212. package/dist/lexical/ui/icons/IndentIncrease/index.js +6 -53
  213. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  214. package/dist/lexical/ui/icons/InlineBlocks/index.js +3 -26
  215. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  216. package/dist/lexical/ui/icons/Italic/index.js +3 -24
  217. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  218. package/dist/lexical/ui/icons/Link/index.js +3 -25
  219. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  220. package/dist/lexical/ui/icons/Meatballs/index.js +5 -39
  221. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/OrderedList/index.js +7 -61
  223. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/Relationship/index.js +10 -58
  225. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/Strikethrough/index.js +4 -34
  227. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/Subscript/index.js +3 -24
  229. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/Superscript/index.js +3 -24
  231. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/Table/index.js +3 -24
  233. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/Text/index.js +3 -24
  235. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/TextState/index.js +12 -18
  237. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/Underline/index.js +4 -34
  239. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/UnorderedList/index.js +8 -81
  241. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/Upload/index.js +5 -48
  243. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  244. package/dist/lexical/utils/point.js.map +1 -1
  245. package/dist/lexical/utils/rect.js.map +1 -1
  246. package/dist/utilities/fieldsDrawer/Drawer.js +16 -41
  247. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  248. package/dist/utilities/fieldsDrawer/DrawerContent.js +10 -42
  249. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  250. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +1 -9
  251. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  252. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +3 -11
  253. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  254. package/package.json +7 -7
@@ -1,14 +1,8 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
- import React from 'react';
4
2
  import { useInlineBlockComponentContext } from '../index.js';
5
3
  export const InlineBlockRemoveButton = ()=>{
6
4
  const { RemoveButton } = useInlineBlockComponentContext();
7
- return RemoveButton ? /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
8
- fileName: "src/features/blocks/client/componentInline/components/InlineBlockRemoveButton.tsx",
9
- lineNumber: 9,
10
- columnNumber: 25
11
- }, this) : null;
5
+ return RemoveButton ? <RemoveButton/> : null;
12
6
  };
13
7
 
14
8
  //# sourceMappingURL=InlineBlockRemoveButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockRemoveButton = () => {\n const { RemoveButton } = useInlineBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"names":["React","useInlineBlockComponentContext","InlineBlockRemoveButton","RemoveButton"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,0BAA0B;IACrC,MAAM,EAAEC,YAAY,EAAE,GAAGF;IAEzB,OAAOE,6BAAe,QAACA;;;;eAAkB;AAC3C,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/componentInline/components/InlineBlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useInlineBlockComponentContext } from '../index.js'\n\nexport const InlineBlockRemoveButton = () => {\n const { RemoveButton } = useInlineBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"names":["useInlineBlockComponentContext","InlineBlockRemoveButton","RemoveButton"],"mappings":"AAAA;AAGA,SAASA,8BAA8B,QAAQ,cAAa;AAE5D,OAAO,MAAMC,0BAA0B;IACrC,MAAM,EAAEC,YAAY,EAAE,GAAGF;IAEzB,OAAOE,gBAAgBA,iBAAkB;AAC3C,EAAC"}
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
3
2
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
3
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
5
4
  import { getTranslation } from '@payloadcms/translations';
@@ -17,7 +16,7 @@ import { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js';
17
16
  * Can be modified by the node in order to trigger the re-fetch of the initial state based on the
18
17
  * formData. This is useful when node.setFields() is explicitly called from outside of the form - in
19
18
  * this case, the new field state is likely not reflected in the form state, so we need to re-fetch
20
- */ const InlineBlockComponentContext = /*#__PURE__*/ createContext({
19
+ */ const InlineBlockComponentContext = createContext({
21
20
  initialState: false
22
21
  });
23
22
  export const useInlineBlockComponentContext = ()=>React.use(InlineBlockComponentContext);
@@ -243,69 +242,36 @@ export const InlineBlockComponent = (props)=>{
243
242
  nodeKey,
244
243
  formData
245
244
  ]);
246
- const RemoveButton = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(Button, {
247
- buttonStyle: "icon-label",
248
- className: `${baseClass}__removeButton`,
249
- disabled: !isEditable,
250
- icon: "x",
251
- onClick: (e)=>{
252
- e.preventDefault();
253
- removeInlineBlock();
254
- },
255
- round: true,
256
- size: "small",
257
- tooltip: t('lexical:blocks:inlineBlocks:remove', {
258
- label: blockDisplayName
259
- })
260
- }, void 0, false, {
261
- fileName: "src/features/blocks/client/componentInline/index.tsx",
262
- lineNumber: 341,
263
- columnNumber: 7
264
- }, this), [
245
+ const RemoveButton = useMemo(()=>()=><Button buttonStyle="icon-label" className={`${baseClass}__removeButton`} disabled={!isEditable} icon="x" onClick={(e)=>{
246
+ e.preventDefault();
247
+ removeInlineBlock();
248
+ }} round size="small" tooltip={t('lexical:blocks:inlineBlocks:remove', {
249
+ label: blockDisplayName
250
+ })}/>, [
265
251
  baseClass,
266
252
  blockDisplayName,
267
253
  isEditable,
268
254
  removeInlineBlock,
269
255
  t
270
256
  ]);
271
- const EditButton = useMemo(()=>()=>/*#__PURE__*/ _jsxDEV(Button, {
272
- buttonStyle: "icon-label",
273
- className: `${baseClass}__editButton`,
274
- disabled: !isEditable,
275
- el: "button",
276
- icon: "edit",
277
- onClick: ()=>{
278
- toggleDrawer();
279
- },
280
- round: true,
281
- size: "small",
282
- tooltip: t('lexical:blocks:inlineBlocks:edit', {
283
- label: blockDisplayName
284
- })
285
- }, void 0, false, {
286
- fileName: "src/features/blocks/client/componentInline/index.tsx",
287
- lineNumber: 360,
288
- columnNumber: 7
289
- }, this), [
257
+ const EditButton = useMemo(()=>()=><Button buttonStyle="icon-label" className={`${baseClass}__editButton`} disabled={!isEditable} el="button" icon="edit" onClick={()=>{
258
+ toggleDrawer();
259
+ }} round size="small" tooltip={t('lexical:blocks:inlineBlocks:edit', {
260
+ label: blockDisplayName
261
+ })}/>, [
290
262
  baseClass,
291
263
  blockDisplayName,
292
264
  isEditable,
293
265
  t,
294
266
  toggleDrawer
295
267
  ]);
296
- const InlineBlockContainer = useMemo(()=>({ children, className })=>/*#__PURE__*/ _jsxDEV("div", {
297
- className: [
298
- `${baseClass}__container`,
299
- baseClass + '-' + formData.blockType,
300
- className
301
- ].filter(Boolean).join(' '),
302
- ref: inlineBlockElemElemRef,
303
- children: children
304
- }, void 0, false, {
305
- fileName: "src/features/blocks/client/componentInline/index.tsx",
306
- lineNumber: 380,
307
- columnNumber: 9
308
- }, this), [
268
+ const InlineBlockContainer = useMemo(()=>({ children, className })=><div className={[
269
+ `${baseClass}__container`,
270
+ baseClass + '-' + formData.blockType,
271
+ className
272
+ ].filter(Boolean).join(' ')} ref={inlineBlockElemElemRef}>
273
+ {children}
274
+ </div>, [
309
275
  baseClass,
310
276
  formData.blockType
311
277
  ]);
@@ -313,13 +279,7 @@ export const InlineBlockComponent = (props)=>{
313
279
  if (CustomLabel) {
314
280
  return ()=>CustomLabel;
315
281
  } else {
316
- return ()=>/*#__PURE__*/ _jsxDEV("div", {
317
- children: clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''
318
- }, void 0, false, {
319
- fileName: "src/features/blocks/client/componentInline/index.tsx",
320
- lineNumber: 397,
321
- columnNumber: 9
322
- }, this);
282
+ return ()=><div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>;
323
283
  }
324
284
  }, [
325
285
  CustomLabel,
@@ -327,164 +287,55 @@ export const InlineBlockComponent = (props)=>{
327
287
  i18n
328
288
  ]);
329
289
  if (!clientBlock) {
330
- return /*#__PURE__*/ _jsxDEV(InlineBlockContainer, {
331
- className: `${baseClass}-not-found`,
332
- children: [
333
- /*#__PURE__*/ _jsxDEV("span", {
334
- children: [
335
- "Error: Block '",
336
- formData.blockType,
337
- "' not found"
338
- ]
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", {
345
- className: `${baseClass}__actions`,
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
356
- ]
357
- }, void 0, true, {
358
- fileName: "src/features/blocks/client/componentInline/index.tsx",
359
- lineNumber: 404,
360
- columnNumber: 7
361
- }, this);
290
+ return <InlineBlockContainer className={`${baseClass}-not-found`}>
291
+ <span>Error: Block '{formData.blockType}' not found</span>
292
+ {isEditable ? <div className={`${baseClass}__actions`}>
293
+ <RemoveButton/>
294
+ </div> : null}
295
+ </InlineBlockContainer>;
362
296
  }
363
- return /*#__PURE__*/ _jsxDEV(Form, {
364
- beforeSubmit: [
365
- async ({ formState })=>{
366
- // This is only called when form is submitted from drawer
367
- return await onChange({
368
- formState,
369
- submit: true
370
- });
371
- }
372
- ],
373
- disableValidationOnSubmit: true,
374
- el: "div",
375
- fields: clientBlock?.fields,
376
- initialState: initialState || {},
377
- onChange: [
378
- onChange
379
- ],
380
- onSubmit: (formState, data)=>{
381
- onFormSubmit(formState, data);
382
- toggleDrawer();
383
- },
384
- uuid: uuid(),
385
- children: [
386
- /*#__PURE__*/ _jsxDEV(EditDepthProvider, {
387
- children: /*#__PURE__*/ _jsxDEV(Drawer, {
388
- className: '',
389
- slug: drawerSlug,
390
- title: t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {
391
- label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label')
392
- }),
393
- children: initialState ? /*#__PURE__*/ _jsxDEV(_Fragment, {
394
- children: [
395
- /*#__PURE__*/ _jsxDEV(RenderFields, {
396
- fields: clientBlock?.fields,
397
- forceRender: true,
398
- parentIndexPath: "",
399
- parentPath: "",
400
- // See Blocks feature path for details as for why this is empty
401
- parentSchemaPath: schemaFieldsPath,
402
- permissions: true,
403
- readOnly: !isEditable
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, {
410
- programmaticSubmit: true,
411
- children: t('fields:saveChanges')
412
- }, void 0, false, {
413
- fileName: "src/features/blocks/client/componentInline/index.tsx",
414
- lineNumber: 453,
415
- columnNumber: 15
416
- }, this)
417
- ]
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, {
430
- value: {
431
- EditButton,
432
- initialState,
433
- InlineBlockContainer,
434
- Label,
435
- nodeKey,
436
- RemoveButton
437
- },
438
- children: CustomBlock
439
- }, void 0, false, {
440
- fileName: "src/features/blocks/client/componentInline/index.tsx",
441
- lineNumber: 459,
442
- columnNumber: 9
443
- }, this) : /*#__PURE__*/ _jsxDEV(InlineBlockContainer, {
444
- children: [
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, {
450
- height: "15px",
451
- width: "40px"
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", {
458
- className: `${baseClass}__actions`,
459
- children: [
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)
470
- ]
471
- }, void 0, true, {
472
- fileName: "src/features/blocks/client/componentInline/index.tsx",
473
- lineNumber: 475,
474
- columnNumber: 13
475
- }, this) : null
476
- ]
477
- }, void 0, true, {
478
- fileName: "src/features/blocks/client/componentInline/index.tsx",
479
- lineNumber: 472,
480
- columnNumber: 9
481
- }, this)
482
- ]
483
- }, void 0, true, {
484
- fileName: "src/features/blocks/client/componentInline/index.tsx",
485
- lineNumber: 416,
486
- columnNumber: 5
487
- }, this);
297
+ return <Form beforeSubmit={[
298
+ async ({ formState })=>{
299
+ // This is only called when form is submitted from drawer
300
+ return await onChange({
301
+ formState,
302
+ submit: true
303
+ });
304
+ }
305
+ ]} disableValidationOnSubmit el="div" fields={clientBlock?.fields} initialState={initialState || {}} onChange={[
306
+ onChange
307
+ ]} onSubmit={(formState, data)=>{
308
+ onFormSubmit(formState, data);
309
+ toggleDrawer();
310
+ }} uuid={uuid()}>
311
+ <EditDepthProvider>
312
+ <Drawer className={''} slug={drawerSlug} title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {
313
+ label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label')
314
+ })}>
315
+ {initialState ? <>
316
+ <RenderFields fields={clientBlock?.fields} forceRender parentIndexPath="" parentPath=// See Blocks feature path for details as for why this is empty
317
+ "" parentSchemaPath={schemaFieldsPath} permissions={true} readOnly={!isEditable}/>
318
+ <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>
319
+ </> : null}
320
+ </Drawer>
321
+ </EditDepthProvider>
322
+ {CustomBlock ? <InlineBlockComponentContext value={{
323
+ EditButton,
324
+ initialState,
325
+ InlineBlockContainer,
326
+ Label,
327
+ nodeKey,
328
+ RemoveButton
329
+ }}>
330
+ {CustomBlock}
331
+ </InlineBlockComponentContext> : <InlineBlockContainer>
332
+ {initialState ? <Label/> : <ShimmerEffect height="15px" width="40px"/>}
333
+ {isEditable ? <div className={`${baseClass}__actions`}>
334
+ <EditButton/>
335
+ <RemoveButton/>
336
+ </div> : null}
337
+ </InlineBlockContainer>}
338
+ </Form>;
488
339
  };
489
340
 
490
341
  //# 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,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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,8BAA8BV,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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oBAAoB,OAAO3H,EAAE,wBAAwBtC,WAAW;YAC9E,MACE,KAAK;QACX,EAAEJ,OAAO;MACX,EAAEC,kBAAkB;MACpB,CAAC0E,eACE/C,4BACCuC,OAAO;QACL8E;QACApH;QACAsH;QACAO;QACApH;QACAgG;IACF,GACD;UACC,CAAC3D,YAAY;QACf,EAAE/C,gCAEDuH,qBAAqB;UACpB,CAACtH,gBAAgB6H,WAAYpJ,cAAcgK,OAAO,OAAOC,MAAM,SAAU;UACzE,CAAC/H,cACE6G,IAAIlH,WAAW,GAAGC,UAAU,SAAS,CAAC,EAAE;cACvC,CAAC6G,YAAa;cACd,CAACX,cAAe;YAClB,EAAEe,OACA,KAAK;QACX,EAAEF,sBACF;IACJ,EAAEjJ;AAEN,EAAC"}
@@ -1,23 +1,12 @@
1
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
- import React from 'react';
3
1
  import { BlockIcon } from '../../../lexical/ui/icons/Block/index.js';
4
2
  export function getBlockImageComponent(imageURL, imageAltText) {
5
3
  if (!imageURL) {
6
4
  return BlockIcon;
7
5
  }
8
- return ()=>/*#__PURE__*/ _jsxDEV("img", {
9
- alt: imageAltText ?? 'Block Image',
10
- className: "lexical-block-custom-image",
11
- src: imageURL,
12
- style: {
13
- maxHeight: 20,
14
- maxWidth: 20
15
- }
16
- }, void 0, false, {
17
- fileName: "src/features/blocks/client/getBlockImageComponent.tsx",
18
- lineNumber: 11,
19
- columnNumber: 5
20
- }, this);
6
+ return ()=><img alt={imageAltText ?? 'Block Image'} className="lexical-block-custom-image" src={imageURL} style={{
7
+ maxHeight: 20,
8
+ maxWidth: 20
9
+ }}/>;
21
10
  }
22
11
 
23
12
  //# 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,QAACI;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":["BlockIcon","getBlockImageComponent","imageURL","imageAltText","img","alt","className","src","style","maxHeight","maxWidth"],"mappings":"AAEA,SAASA,SAAS,QAAQ,2CAA0C;AAEpE,OAAO,SAASC,uBAAuBC,QAAiB,EAAEC,YAAqB;IAC7E,IAAI,CAACD,UAAU;QACb,OAAOF;IACT;IAEA,OAAO,KACJI,IACCC,KAAKF,gBAAgB,eACrBG,UAAU,6BACVC,KAAKL,UACLM,OAAO;YAAEC,WAAW;YAAIC,UAAU;QAAG;AAG3C"}
@@ -1,8 +1,6 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import ObjectID from 'bson-objectid';
4
3
  import { $applyNodeReplacement } from 'lexical';
5
- import React from 'react';
6
4
  import { ServerBlockNode } from '../../server/nodes/BlocksNode.js';
7
5
  import { BlockComponent } from '../component/index.js';
8
6
  export class BlockNode extends ServerBlockNode {
@@ -28,16 +26,7 @@ export class BlockNode extends ServerBlockNode {
28
26
  return node;
29
27
  }
30
28
  decorate(_editor, config) {
31
- return /*#__PURE__*/ _jsxDEV(BlockComponent, {
32
- cacheBuster: this.getCacheBuster(),
33
- className: config.theme.block ?? 'LexicalEditorTheme__block',
34
- formData: this.getFields(),
35
- nodeKey: this.getKey()
36
- }, void 0, false, {
37
- fileName: "src/features/blocks/client/nodes/BlocksNode.tsx",
38
- lineNumber: 43,
39
- columnNumber: 7
40
- }, this);
29
+ return <BlockComponent cacheBuster={this.getCacheBuster()} className={config.theme.block ?? 'LexicalEditorTheme__block'} formData={this.getFields()} nodeKey={this.getKey()}/>;
41
30
  }
42
31
  exportJSON() {
43
32
  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,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
+ {"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","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;AAKhB,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,QACGf,eACCgB,aAAa,IAAI,CAACC,cAAc,IAChCC,WAAWH,OAAOI,KAAK,CAACC,KAAK,IAAI,6BACjCC,UAAU,IAAI,CAACC,SAAS,IACxBC,SAAS,IAAI,CAACC,MAAM;IAG1B;IAESC,aAAkC;QACzC,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASf,iBAAiBF,MAA6B;IAC5D,OAAOV,sBACL,IAAIG,UAAU;QACZO,QAAQ;YACN,GAAGA,MAAM;YACTkB,IAAIlB,QAAQkB,MAAM,IAAI7B,SAAS8B,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,aAAa1B,IAAgD;IAC3E,OAAOA,gBAAgBF;AACzB"}
@@ -1,10 +1,9 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import ObjectID from 'bson-objectid';
4
3
  import { $applyNodeReplacement } from 'lexical';
5
4
  import React from 'react';
6
5
  import { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js';
7
- const InlineBlockComponent = /*#__PURE__*/ React.lazy(()=>import('../componentInline/index.js').then((module)=>({
6
+ const InlineBlockComponent = React.lazy(()=>import('../componentInline/index.js').then((module)=>({
8
7
  default: module.InlineBlockComponent
9
8
  })));
10
9
  export class InlineBlockNode extends ServerInlineBlockNode {
@@ -19,16 +18,7 @@ export class InlineBlockNode extends ServerInlineBlockNode {
19
18
  return node;
20
19
  }
21
20
  decorate(_editor, config) {
22
- return /*#__PURE__*/ _jsxDEV(InlineBlockComponent, {
23
- cacheBuster: this.getCacheBuster(),
24
- className: config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock',
25
- formData: this.getFields(),
26
- nodeKey: this.getKey()
27
- }, void 0, false, {
28
- fileName: "src/features/blocks/client/nodes/InlineBlocksNode.tsx",
29
- lineNumber: 40,
30
- columnNumber: 7
31
- }, this);
21
+ return <InlineBlockComponent cacheBuster={this.getCacheBuster()} className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'} formData={this.getFields()} nodeKey={this.getKey()}/>;
32
22
  }
33
23
  exportJSON() {
34
24
  return super.exportJSON();