@payloadcms/richtext-lexical 3.68.0-internal-debug.35482da → 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,8 +1,6 @@
1
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
1
  import { getTranslation } from '@payloadcms/translations';
3
2
  import { Link } from '@payloadcms/ui';
4
3
  import { formatAdminURL } from 'payload/shared';
5
- import React from 'react';
6
4
  function recurseEditorState(editorState, textContent, i = 0) {
7
5
  for (const node of editorState){
8
6
  i++;
@@ -10,17 +8,7 @@ function recurseEditorState(editorState, textContent, i = 0) {
10
8
  textContent.push(node.text);
11
9
  } else {
12
10
  if (!('children' in node)) {
13
- textContent.push(/*#__PURE__*/ _jsxDEV("code", {
14
- children: [
15
- " [",
16
- node.type,
17
- "]"
18
- ]
19
- }, i, true, {
20
- fileName: "src/cell/rscEntry.tsx",
21
- lineNumber: 21,
22
- columnNumber: 26
23
- }, this));
11
+ textContent.push(<code key={i}>&#32;[{node.type}]</code>);
24
12
  }
25
13
  }
26
14
  if ('children' in node && node.children) {
@@ -69,14 +57,7 @@ export const RscEntryLexicalCell = (props)=>{
69
57
  })
70
58
  ];
71
59
  }
72
- return /*#__PURE__*/ _jsxDEV(WrapElement, {
73
- ...wrapElementProps,
74
- children: textContent
75
- }, void 0, false, {
76
- fileName: "src/cell/rscEntry.tsx",
77
- lineNumber: 104,
78
- columnNumber: 10
79
- }, this);
60
+ return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>;
80
61
  };
81
62
 
82
63
  //# sourceMappingURL=rscEntry.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cell/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Link } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { LexicalRichTextCellProps } from '../types.js'\n\nfunction recurseEditorState(\n editorState: SerializedLexicalNode[],\n textContent: React.ReactNode[],\n i: number = 0,\n): React.ReactNode[] {\n for (const node of editorState) {\n i++\n if ('text' in node && node.text) {\n textContent.push(node.text as string)\n } else {\n if (!('children' in node)) {\n textContent.push(<code key={i}>&#32;[{node.type}]</code>)\n }\n }\n if ('children' in node && node.children) {\n textContent = recurseEditorState(node.children as SerializedLexicalNode[], textContent, i)\n }\n }\n return textContent\n}\n\nexport const RscEntryLexicalCell: React.FC<LexicalRichTextCellProps> = (props) => {\n const {\n cellData,\n className: classNameFromProps,\n collectionConfig,\n field: { admin },\n field,\n i18n,\n link,\n onClick: onClickFromProps,\n payload,\n rowData,\n } = props\n\n const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined\n\n const className =\n classNameFromProps ||\n (field.admin && 'className' in field.admin ? field.admin.className : null) ||\n classNameFromConfigContext\n const adminRoute = payload.config.routes.admin\n\n const onClick = onClickFromProps\n\n let WrapElement: React.ComponentType<any> | string = 'span'\n\n const wrapElementProps: {\n className?: string\n href?: string\n onClick?: () => void\n prefetch?: false\n type?: 'button'\n } = {\n className,\n }\n\n if (link) {\n wrapElementProps.prefetch = false\n WrapElement = Link\n wrapElementProps.href = collectionConfig?.slug\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionConfig?.slug}/${rowData.id}`,\n })\n : ''\n }\n\n if (typeof onClick === 'function') {\n WrapElement = 'button'\n wrapElementProps.type = 'button'\n wrapElementProps.onClick = () => {\n onClick({\n cellData,\n collectionSlug: collectionConfig?.slug,\n rowData,\n })\n }\n }\n\n let textContent: React.ReactNode[] = []\n\n if (cellData?.root?.children) {\n textContent = recurseEditorState(cellData?.root?.children, textContent)\n }\n\n if (!textContent?.length) {\n textContent = [\n i18n.t('general:noLabel', {\n label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),\n }),\n ]\n }\n\n return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>\n}\n"],"names":["getTranslation","Link","formatAdminURL","React","recurseEditorState","editorState","textContent","i","node","text","push","code","type","children","RscEntryLexicalCell","props","cellData","className","classNameFromProps","collectionConfig","field","admin","i18n","link","onClick","onClickFromProps","payload","rowData","classNameFromConfigContext","undefined","adminRoute","config","routes","WrapElement","wrapElementProps","prefetch","href","slug","path","id","collectionSlug","root","length","t","label"],"mappings":";AAEA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,IAAI,QAAQ,iBAAgB;AACrC,SAASC,cAAc,QAAQ,iBAAgB;AAC/C,OAAOC,WAAW,QAAO;AAIzB,SAASC,mBACPC,WAAoC,EACpCC,WAA8B,EAC9BC,IAAY,CAAC;IAEb,KAA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BAAiBtB,IAAI,GAAG;QACxBsB,iBAAiBV,OAAO,GAAG;YACzBA,QAAQ;gBACNR;gBACAwB,gBAAgBrB,kBAAkBkB;gBAClCV;YACF;QACF;IACF;IAEA,IAAIrB,cAAiC,EAAE;IAEvC,IAAIU,UAAUyB,MAAM5B,UAAU;QAC5BP,cAAcF,mBAAmBY,UAAUyB,MAAM5B,UAAUP;IAC7D;IAEA,IAAI,CAACA,aAAaoC,QAAQ;QACxBpC,cAAc;YACZgB,KAAKqB,CAAC,CAAC,mBAAmB;gBACxBC,OAAO5C,eAAe,AAAC,CAAA,WAAWoB,QAAQA,MAAMwB,KAAK,GAAG,IAAG,KAAM,QAAQtB;YAC3E;SACD;IACH;IAEA,qBAAO,QAACW;QAAa,GAAGC,gBAAgB;kBAAG5B;;;;;;AAC7C,EAAC"}
1
+ {"version":3,"sources":["../../src/cell/rscEntry.tsx"],"sourcesContent":["import type { SerializedLexicalNode } from 'lexical'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { Link } from '@payloadcms/ui'\nimport { formatAdminURL } from 'payload/shared'\nimport React from 'react'\n\nimport type { LexicalRichTextCellProps } from '../types.js'\n\nfunction recurseEditorState(\n editorState: SerializedLexicalNode[],\n textContent: React.ReactNode[],\n i: number = 0,\n): React.ReactNode[] {\n for (const node of editorState) {\n i++\n if ('text' in node && node.text) {\n textContent.push(node.text as string)\n } else {\n if (!('children' in node)) {\n textContent.push(<code key={i}>&#32;[{node.type}]</code>)\n }\n }\n if ('children' in node && node.children) {\n textContent = recurseEditorState(node.children as SerializedLexicalNode[], textContent, i)\n }\n }\n return textContent\n}\n\nexport const RscEntryLexicalCell: React.FC<LexicalRichTextCellProps> = (props) => {\n const {\n cellData,\n className: classNameFromProps,\n collectionConfig,\n field: { admin },\n field,\n i18n,\n link,\n onClick: onClickFromProps,\n payload,\n rowData,\n } = props\n\n const classNameFromConfigContext = admin && 'className' in admin ? admin.className : undefined\n\n const className =\n classNameFromProps ||\n (field.admin && 'className' in field.admin ? field.admin.className : null) ||\n classNameFromConfigContext\n const adminRoute = payload.config.routes.admin\n\n const onClick = onClickFromProps\n\n let WrapElement: React.ComponentType<any> | string = 'span'\n\n const wrapElementProps: {\n className?: string\n href?: string\n onClick?: () => void\n prefetch?: false\n type?: 'button'\n } = {\n className,\n }\n\n if (link) {\n wrapElementProps.prefetch = false\n WrapElement = Link\n wrapElementProps.href = collectionConfig?.slug\n ? formatAdminURL({\n adminRoute,\n path: `/collections/${collectionConfig?.slug}/${rowData.id}`,\n })\n : ''\n }\n\n if (typeof onClick === 'function') {\n WrapElement = 'button'\n wrapElementProps.type = 'button'\n wrapElementProps.onClick = () => {\n onClick({\n cellData,\n collectionSlug: collectionConfig?.slug,\n rowData,\n })\n }\n }\n\n let textContent: React.ReactNode[] = []\n\n if (cellData?.root?.children) {\n textContent = recurseEditorState(cellData?.root?.children, textContent)\n }\n\n if (!textContent?.length) {\n textContent = [\n i18n.t('general:noLabel', {\n label: getTranslation(('label' in field ? field.label : null) || 'data', i18n),\n }),\n ]\n }\n\n return <WrapElement {...wrapElementProps}>{textContent}</WrapElement>\n}\n"],"names":["getTranslation","Link","formatAdminURL","recurseEditorState","editorState","textContent","i","node","text","push","code","key","type","children","RscEntryLexicalCell","props","cellData","className","classNameFromProps","collectionConfig","field","admin","i18n","link","onClick","onClickFromProps","payload","rowData","classNameFromConfigContext","undefined","adminRoute","config","routes","WrapElement","wrapElementProps","prefetch","href","slug","path","id","collectionSlug","root","length","t","label"],"mappings":"AAEA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SAASC,IAAI,QAAQ,iBAAgB;AACrC,SAASC,cAAc,QAAQ,iBAAgB;AAK/C,SAASC,mBACPC,WAAoC,EACpCC,WAA8B,EAC9BC,IAAY,CAAC;IAEb,KAAK,MAAMC,QAAQH,YAAa;QAC9BE;QACA,IAAI,UAAUC,QAAQA,KAAKC,IAAI,EAAE;YAC/BH,YAAYI,IAAI,CAACF,KAAKC,IAAI;QAC5B,OAAO;YACL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AEA,IAAItB,cAAiC,EAAE;IAEvC,IAAIW,UAAUyB,MAAM5B,UAAU;QAC5BR,cAAcF,mBAAmBa,UAAUyB,MAAM5B,UAAUR;IAC7D;IAEA,IAAI,CAACA,aAAaqC,QAAQ;QACxBrC,cAAc;YACZiB,KAAKqB,CAAC,CAAC,mBAAmB;gBACxBC,OAAO5C,eAAe,AAAC,CAAA,WAAWoB,QAAQA,MAAMwB,KAAK,GAAG,IAAG,KAAM,QAAQtB;YAC3E;SACD;IACH;IAEA,QAAQW,aAAa,GAAGC,gBAAgB,GAAG7B,cAAc4B;AAC3D,EAAC"}
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
4
3
  import { RenderFields, useFormSubmitted } from '@payloadcms/ui';
5
4
  import React, { createContext, useMemo } from 'react';
@@ -26,7 +25,7 @@ import React, { createContext, useMemo } from 'react';
26
25
  * Whether to show the Remove button
27
26
  * If `Actions` is provided, this property is ignored.
28
27
  * @default true
29
- */ const BlockComponentContext = /*#__PURE__*/ createContext({
28
+ */ const BlockComponentContext = createContext({
30
29
  baseClass: 'LexicalEditorTheme__block',
31
30
  BlockCollapsible: ()=>null,
32
31
  BlockDrawer: ()=>null,
@@ -51,57 +50,23 @@ export const useBlockComponentContext = ()=>React.use(BlockComponentContext);
51
50
  const isEditable = useLexicalEditable();
52
51
  const CollapsibleWithErrorProps = useMemo(()=>(props)=>{
53
52
  const { children, ...rest } = props;
54
- return /*#__PURE__*/ _jsxDEV(Collapsible, {
55
- errorCount: errorCount,
56
- fieldHasErrors: fieldHasErrors,
57
- ...rest,
58
- children: children
59
- }, void 0, false, {
60
- fileName: "src/features/blocks/client/component/BlockContent.tsx",
61
- lineNumber: 109,
62
- columnNumber: 9
63
- }, this);
53
+ return <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>
54
+ {children}
55
+ </Collapsible>;
64
56
  }, [
65
57
  Collapsible,
66
58
  fieldHasErrors,
67
59
  errorCount
68
60
  ]);
69
- return CustomBlock ? /*#__PURE__*/ _jsxDEV(BlockComponentContext, {
70
- value: {
71
- ...contextProps,
72
- BlockCollapsible: CollapsibleWithErrorProps
73
- },
74
- children: [
75
- CustomBlock,
76
- /*#__PURE__*/ _jsxDEV(BlockDrawer, {}, void 0, false, {
77
- fileName: "src/features/blocks/client/component/BlockContent.tsx",
78
- lineNumber: 125,
79
- columnNumber: 7
80
- }, this)
81
- ]
82
- }, void 0, true, {
83
- fileName: "src/features/blocks/client/component/BlockContent.tsx",
84
- lineNumber: 118,
85
- columnNumber: 5
86
- }, this) : /*#__PURE__*/ _jsxDEV(CollapsibleWithErrorProps, {
87
- children: /*#__PURE__*/ _jsxDEV(RenderFields, {
88
- fields: formSchema,
89
- forceRender: true,
90
- parentIndexPath: "",
91
- parentPath: '',
92
- parentSchemaPath: "",
93
- permissions: true,
94
- readOnly: !isEditable
95
- }, void 0, false, {
96
- fileName: "src/features/blocks/client/component/BlockContent.tsx",
97
- lineNumber: 129,
98
- columnNumber: 7
99
- }, this)
100
- }, void 0, false, {
101
- fileName: "src/features/blocks/client/component/BlockContent.tsx",
102
- lineNumber: 128,
103
- columnNumber: 5
104
- }, this);
61
+ return CustomBlock ? <BlockComponentContext value={{
62
+ ...contextProps,
63
+ BlockCollapsible: CollapsibleWithErrorProps
64
+ }}>
65
+ {CustomBlock}
66
+ <BlockDrawer/>
67
+ </BlockComponentContext> : <CollapsibleWithErrorProps>
68
+ <RenderFields fields={formSchema} forceRender={true} parentIndexPath="" parentPath={''} parentSchemaPath="" permissions={true} readOnly={!isEditable}/>
69
+ </CollapsibleWithErrorProps>;
105
70
  };
106
71
 
107
72
  //# sourceMappingURL=BlockContent.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n CustomBlock: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\ntype BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n CustomBlock: null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, ...contextProps } = props\n\n const { BlockDrawer, CustomBlock, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (props: BlockCollapsibleProps) => {\n const { children, ...rest } = props\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n return CustomBlock ? (\n <BlockComponentContext\n value={{\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }}\n >\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"names":["useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","CustomBlock","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","Collapsible","contextProps","hasSubmitted","fieldHasErrors","isEditable","CollapsibleWithErrorProps","children","rest","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"mappings":"AAAA;;AAIA,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,iBAAgB;AAC/D,OAAOC,SAASC,aAAa,EAAEC,OAAO,QAAQ,QAAO;AAGnD;;;GAGC,GAGD;;GAEC,GAED;;GAEC,GAED;;;GAGC,GAED;;;;GAIC,GAED;;GAEC,GAED;;;GAGC,GAED;;;;GAIC,GA2BH,MAAMC,sCAAwBF,cAAyC;IACrEG,WAAW;IACXC,kBAAkB,IAAM;IACxBC,aAAa,IAAM;IACnBC,aAAa;IACbC,YAAY,IAAM;IAClBC,YAAY;IACZC,YAAY,EAAE;IACdC,cAAc;IACdC,SAAS;IACTC,cAAc,IAAM;AACtB;AAEA,OAAO,MAAMC,2BAA2B,IAAMd,MAAMe,GAAG,CAACZ,uBAAsB;AAE9E;;;;CAIC,GACD,OAAO,MAAMa,eAA4C,CAACC;IACxD,MAAM,EAAEC,WAAW,EAAE,GAAGC,cAAc,GAAGF;IAEzC,MAAM,EAAEX,WAAW,EAAEC,WAAW,EAAEE,UAAU,EAAEC,UAAU,EAAE,GAAGS;IAE7D,MAAMC,eAAerB;IAErB,MAAMsB,iBAAiBD,gBAAgBX,aAAa;IACpD,MAAMa,aAAazB;IAEnB,MAAM0B,4BAA4BrB,QAChC,IAAM,CAACe;YACL,MAAM,EAAEO,QAAQ,EAAE,GAAGC,MAAM,GAAGR;YAC9B,qBACE,QAACC;gBAAYT,YAAYA;gBAAYY,gBAAgBA;gBAAiB,GAAGI,IAAI;0BAC1ED;;;;;;QAGP,GACA;QAACN;QAAaG;QAAgBZ;KAAW;IAG3C,OAAOF,4BACL,QAACJ;QACCuB,OAAO;YACL,GAAGP,YAAY;YACfd,kBAAkBkB;QACpB;;YAEChB;0BACD,QAACD;;;;;;;;;;6BAGH,QAACiB;kBACC,cAAA,QAACzB;YACC6B,QAAQjB;YACRkB,aAAa;YACbC,iBAAgB;YAChBC,YAAY;YACZC,kBAAiB;YACjBC,aAAa;YACbC,UAAU,CAACX;;;;;;;;;;;AAInB,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/component/BlockContent.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleProps } from '@payloadcms/ui/elements/Collapsible'\nimport type { ClientField, FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { RenderFields, useFormSubmitted } from '@payloadcms/ui'\nimport React, { createContext, useMemo } from 'react'\n\nexport type BlockCollapsibleProps = {\n /**\n * Replace the top-right portion of the header that renders the Edit and Remove buttons with custom content.\n * If this property is provided, the `removeButton` and `editButton` properties are ignored.\n */\n Actions?: React.ReactNode\n children?: React.ReactNode\n /**\n * Additional className to the collapsible wrapper\n */\n className?: string\n /**\n * Props to pass to the underlying Collapsible component. You could use this to override the `Header` entirely, for example.\n */\n collapsibleProps?: Partial<CollapsibleProps>\n /**\n * Whether to disable rendering the block name field in the header Label\n * @default false\n */\n disableBlockName?: boolean\n /**\n * Whether to show the Edit button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n editButton?: boolean\n /**\n * Replace the default Label component with a custom Label\n */\n Label?: React.ReactNode\n /**\n * Replace the default Pill component component that's rendered within the default Label component with a custom Pill.\n * This property has no effect if you provide a custom Label component via the `Label` property.\n */\n Pill?: React.ReactNode\n /**\n * Whether to show the Remove button\n * If `Actions` is provided, this property is ignored.\n * @default true\n */\n removeButton?: boolean\n}\n\nexport type BlockCollapsibleWithErrorProps = {\n errorCount?: number\n fieldHasErrors?: boolean\n} & BlockCollapsibleProps\n\nexport type BlockContentProps = {\n baseClass: string\n BlockDrawer: React.FC\n Collapsible: React.FC<BlockCollapsibleWithErrorProps>\n CustomBlock: React.ReactNode\n EditButton: React.FC\n errorCount: number\n formSchema: ClientField[]\n initialState: false | FormState | undefined\n\n nodeKey: string\n RemoveButton: React.FC\n}\n\ntype BlockComponentContextType = {\n BlockCollapsible: React.FC<BlockCollapsibleProps>\n} & Omit<BlockContentProps, 'Collapsible'>\n\nconst BlockComponentContext = createContext<BlockComponentContextType>({\n baseClass: 'LexicalEditorTheme__block',\n BlockCollapsible: () => null,\n BlockDrawer: () => null,\n CustomBlock: null,\n EditButton: () => null,\n errorCount: 0,\n formSchema: [],\n initialState: false,\n nodeKey: '',\n RemoveButton: () => null,\n})\n\nexport const useBlockComponentContext = () => React.use(BlockComponentContext)\n\n/**\n * The actual content of the Block. This should be INSIDE a Form component,\n * scoped to the block. All format operations in here are thus scoped to the block's form, and\n * not the whole document.\n */\nexport const BlockContent: React.FC<BlockContentProps> = (props) => {\n const { Collapsible, ...contextProps } = props\n\n const { BlockDrawer, CustomBlock, errorCount, formSchema } = contextProps\n\n const hasSubmitted = useFormSubmitted()\n\n const fieldHasErrors = hasSubmitted && errorCount > 0\n const isEditable = useLexicalEditable()\n\n const CollapsibleWithErrorProps = useMemo(\n () => (props: BlockCollapsibleProps) => {\n const { children, ...rest } = props\n return (\n <Collapsible errorCount={errorCount} fieldHasErrors={fieldHasErrors} {...rest}>\n {children}\n </Collapsible>\n )\n },\n [Collapsible, fieldHasErrors, errorCount],\n )\n\n return CustomBlock ? (\n <BlockComponentContext\n value={{\n ...contextProps,\n BlockCollapsible: CollapsibleWithErrorProps,\n }}\n >\n {CustomBlock}\n <BlockDrawer />\n </BlockComponentContext>\n ) : (\n <CollapsibleWithErrorProps>\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </CollapsibleWithErrorProps>\n )\n}\n"],"names":["useLexicalEditable","RenderFields","useFormSubmitted","React","createContext","useMemo","BlockComponentContext","baseClass","BlockCollapsible","BlockDrawer","CustomBlock","EditButton","errorCount","formSchema","initialState","nodeKey","RemoveButton","useBlockComponentContext","use","BlockContent","props","Collapsible","contextProps","hasSubmitted","fieldHasErrors","isEditable","CollapsibleWithErrorProps","children","rest","value","fields","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"mappings":"AAAA;AAIA,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,YAAY,EAAEC,gBAAgB,QAAQ,iBAAgB;AAC/D,OAAOC,SAASC,aAAa,EAAEC,O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xDEV } from "react/jsx-dev-runtime";
3
- import React from 'react';
4
2
  import { useBlockComponentContext } from '../BlockContent.js';
5
3
  export const BlockCollapsible = (props)=>{
6
4
  const { children, ...rest } = props;
7
5
  const { BlockCollapsible } = useBlockComponentContext();
8
- return BlockCollapsible ? /*#__PURE__*/ _jsxDEV(BlockCollapsible, {
9
- ...rest,
10
- children: children
11
- }, void 0, false, {
12
- fileName: "src/features/blocks/client/component/components/BlockCollapsible.tsx",
13
- lineNumber: 10,
14
- columnNumber: 29
15
- }, this) : null;
6
+ return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null;
16
7
  };
17
8
 
18
9
  //# sourceMappingURL=BlockCollapsible.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/component/components/BlockCollapsible.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { type BlockCollapsibleProps, useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockCollapsible: React.FC<BlockCollapsibleProps> = (props) => {\n const { children, ...rest } = props\n const { BlockCollapsible } = useBlockComponentContext()\n\n return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null\n}\n"],"names":["React","useBlockComponentContext","BlockCollapsible","props","children","rest"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAAqCC,wBAAwB,QAAQ,qBAAoB;AAEzF,OAAO,MAAMC,mBAAoD,CAACC;IAChE,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGF;IAC9B,MAAM,EAAED,gBAAgB,EAAE,GAAGD;IAE7B,OAAOC,iCAAmB,QAACA;QAAkB,GAAGG,IAAI;kBAAGD;;;;;eAA+B;AACxF,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/component/components/BlockCollapsible.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { type BlockCollapsibleProps, useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockCollapsible: React.FC<BlockCollapsibleProps> = (props) => {\n const { children, ...rest } = props\n const { BlockCollapsible } = useBlockComponentContext()\n\n return BlockCollapsible ? <BlockCollapsible {...rest}>{children}</BlockCollapsible> : null\n}\n"],"names":["useBlockComponentContext","BlockCollapsible","props","children","rest"],"mappings":"AAAA;AAGA,SAAqCA,wBAAwB,QAAQ,qBAAoB;AAEzF,OAAO,MAAMC,mBAAoD,CAACC;IAChE,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGF;IAC9B,MAAM,EAAED,gBAAgB,EAAE,GAAGD;IAE7B,OAAOC,oBAAoBA,kBAAkB,GAAGG,IAAI,GAAGD,WAAWF,oBAAoB;AACxF,EAAC"}
@@ -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 { useBlockComponentContext } from '../BlockContent.js';
5
3
  export const BlockEditButton = ()=>{
6
4
  const { EditButton } = useBlockComponentContext();
7
- return EditButton ? /*#__PURE__*/ _jsxDEV(EditButton, {}, void 0, false, {
8
- fileName: "src/features/blocks/client/component/components/BlockEditButton.tsx",
9
- lineNumber: 9,
10
- columnNumber: 23
11
- }, this) : null;
5
+ return EditButton ? <EditButton/> : null;
12
6
  };
13
7
 
14
8
  //# sourceMappingURL=BlockEditButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/component/components/BlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockEditButton = () => {\n const { EditButton } = useBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"names":["React","useBlockComponentContext","BlockEditButton","EditButton"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,wBAAwB,QAAQ,qBAAoB;AAE7D,OAAO,MAAMC,kBAAkB;IAC7B,MAAM,EAAEC,UAAU,EAAE,GAAGF;IAEvB,OAAOE,2BAAa,QAACA;;;;eAAgB;AACvC,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/component/components/BlockEditButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockEditButton = () => {\n const { EditButton } = useBlockComponentContext()\n\n return EditButton ? <EditButton /> : null\n}\n"],"names":["useBlockComponentContext","BlockEditButton","EditButton"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,QAAQ,qBAAoB;AAE7D,OAAO,MAAMC,kBAAkB;IAC7B,MAAM,EAAEC,UAAU,EAAE,GAAGF;IAEvB,OAAOE,cAAcA,eAAgB;AACvC,EAAC"}
@@ -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 { useBlockComponentContext } from '../BlockContent.js';
5
3
  export const BlockRemoveButton = ()=>{
6
4
  const { RemoveButton } = useBlockComponentContext();
7
- return RemoveButton ? /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
8
- fileName: "src/features/blocks/client/component/components/BlockRemoveButton.tsx",
9
- lineNumber: 9,
10
- columnNumber: 25
11
- }, this) : null;
5
+ return RemoveButton ? <RemoveButton/> : null;
12
6
  };
13
7
 
14
8
  //# sourceMappingURL=BlockRemoveButton.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/client/component/components/BlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockRemoveButton = () => {\n const { RemoveButton } = useBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"names":["React","useBlockComponentContext","BlockRemoveButton","RemoveButton"],"mappings":"AAAA;;AACA,OAAOA,WAAW,QAAO;AAEzB,SAASC,wBAAwB,QAAQ,qBAAoB;AAE7D,OAAO,MAAMC,oBAAoB;IAC/B,MAAM,EAAEC,YAAY,EAAE,GAAGF;IAEzB,OAAOE,6BAAe,QAACA;;;;eAAkB;AAC3C,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/client/component/components/BlockRemoveButton.tsx"],"sourcesContent":["'use client'\nimport React from 'react'\n\nimport { useBlockComponentContext } from '../BlockContent.js'\n\nexport const BlockRemoveButton = () => {\n const { RemoveButton } = useBlockComponentContext()\n\n return RemoveButton ? <RemoveButton /> : null\n}\n"],"names":["useBlockComponentContext","BlockRemoveButton","RemoveButton"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,QAAQ,qBAAoB;AAE7D,OAAO,MAAMC,oBAAoB;IAC/B,MAAM,EAAEC,YAAY,EAAE,GAAGF;IAEzB,OAAOE,gBAAgBA,iBAAkB;AAC3C,EAAC"}