@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 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"names":["ObjectID","$applyNodeReplacement","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","_editor","config","cacheBuster","getCacheBuster","className","theme","inlineBlock","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"mappings":"AAAA;;AACA,OAAOA,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAIhB,UAAS;AAChB,OAAOC,WAAyB,QAAO;AAOvC,SAASC,qBAAqB,QAAQ,yCAAwC;AAE9E,MAAMC,qCAAuBF,MAAMG,IAAI,CAAC,IACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAC,CAACC,SAAY,CAAA;YACtDC,SAASD,OAAOH,oBAAoB;QACtC,CAAA;AAGF,OAAO,MAAMK,wBAAwBN;IACnC,OAAgBO,MAAMC,IAA2B,EAAyB;QACxE,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,WAAWC,cAAyC,EAAmB;QACrF,MAAMH,OAAOI,uBAAuBD,eAAeE,MAAM;QACzD,OAAOL;IACT;IAESM,SAASC,OAAsB,EAAEC,MAAoB,EAAe;QAC3E,qBACE,QAACf;YACCgB,aAAa,IAAI,CAACC,cAAc;YAChCC,WAAWH,OAAOI,KAAK,CAACC,WAAW,IAAI;YACvCC,UAAU,IAAI,CAACC,SAAS;YACxBC,SAAS,IAAI,CAACC,MAAM;;;;;;IAG1B;IAESC,aAAwC;QAC/C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASd,uBAAuBC,MAAwC;IAC7E,OAAOf,sBACL,IAAIQ,gBAAgB;QAClBO,QAAQ;YACN,GAAGA,MAAM;YACTc,IAAId,QAAQc,MAAM,IAAI9B,SAASQ,OAAO,GAAGuB,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdrB,IAAsD;IAEtD,OAAOA,gBAAgBF;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx"],"sourcesContent":["'use client'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(_editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return $applyNodeReplacement(\n new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n"],"names":["ObjectID","$applyNodeReplacement","React","ServerInlineBlockNode","InlineBlockComponent","lazy","then","module","default","InlineBlockNode","clone","node","getType","importJSON","serializedNode","$createInlineBlockNode","fields","decorate","_editor","config","cacheBuster","getCacheBuster","className","theme","inlineBlock","formData","getFields","nodeKey","getKey","exportJSON","id","toHexString","$isInlineBlockNode"],"mappings":"AAAA;AACA,OAAOA,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAIhB,UAAS;AAChB,OAAOC,WAAyB,QAAO;AAOvC,SAASC,qBAAqB,QAAQ,yCAAwC;AAE9E,MAAMC,uBAAuBF,MAAMG,IAAI,CAAC,IACtC,MAAM,CAAC,+BAA+BC,IAAI,CAAC,CAACC,SAAY,CAAA;YACtDC,SAASD,OAAOH,oBAAoB;QACtC,CAAA;AAGF,OAAO,MAAMK,wBAAwBN;IACnC,OAAgBO,MAAMC,IAA2B,EAAyB;QACxE,OAAO,KAAK,CAACD,MAAMC;IACrB;IAEA,OAAgBC,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,WAAWC,cAAyC,EAAmB;QACrF,MAAMH,OAAOI,uBAAuBD,eAAeE,MAAM;QACzD,OAAOL;IACT;IAESM,SAASC,OAAsB,EAAEC,MAAoB,EAAe;QAC3E,QACGf,qBACCgB,aAAa,IAAI,CAACC,cAAc,IAChCC,WAAWH,OAAOI,KAAK,CAACC,WAAW,IAAI,mCACvCC,UAAU,IAAI,CAACC,SAAS,IACxBC,SAAS,IAAI,CAACC,MAAM;IAG1B;IAESC,aAAwC;QAC/C,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAASd,uBAAuBC,MAAwC;IAC7E,OAAOf,sBACL,IAAIQ,gBAAgB;QAClBO,QAAQ;YACN,GAAGA,MAAM;YACTc,IAAId,QAAQc,MAAM,IAAI9B,SAASQ,OAAO,GAAGuB,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdrB,IAAsD;IAEtD,OAAOA,gBAAgBF;AACzB"}
@@ -1,5 +1,4 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import './index.scss';
4
3
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
5
4
  import { ChevronIcon, Combobox, CopyToClipboard, PopupList, RenderFields, useForm, useFormFields, useTranslation } from '@payloadcms/ui';
@@ -35,137 +34,37 @@ export const CodeBlockBlockComponent = (args)=>{
35
34
  const languageEntries = React.useMemo(()=>{
36
35
  return Object.entries(languages).map(([languageCode, languageLabel])=>({
37
36
  name: `${languageCode} ${languageLabel}`,
38
- Component: /*#__PURE__*/ _jsxDEV(PopupList.Button, {
39
- active: false,
40
- disabled: false,
41
- onClick: ()=>{
42
- setSelectedLanguage(languageCode);
43
- },
44
- children: /*#__PURE__*/ _jsxDEV("span", {
45
- className: `${baseClass}__language-code`,
46
- "data-language": languageCode,
47
- children: languageLabel
48
- }, void 0, false, {
49
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
50
- lineNumber: 70,
51
- columnNumber: 11
52
- }, this)
53
- }, void 0, false, {
54
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
55
- lineNumber: 63,
56
- columnNumber: 9
57
- }, this)
37
+ Component: <PopupList.Button active={false} disabled={false} onClick={()=>{
38
+ setSelectedLanguage(languageCode);
39
+ }}>
40
+ <span className={`${baseClass}__language-code`} data-language={languageCode}>
41
+ {languageLabel}
42
+ </span>
43
+ </PopupList.Button>
58
44
  }));
59
45
  }, [
60
46
  languages,
61
47
  setSelectedLanguage
62
48
  ]);
63
- return /*#__PURE__*/ _jsxDEV(BlockCollapsible, {
64
- Actions: /*#__PURE__*/ _jsxDEV("div", {
65
- className: `${baseClass}__actions`,
66
- children: [
67
- /*#__PURE__*/ _jsxDEV(Combobox, {
68
- button: /*#__PURE__*/ _jsxDEV("div", {
69
- className: `${baseClass}__language-selector-button`,
70
- "data-selected-language": selectedLanguageField?.value,
71
- children: [
72
- /*#__PURE__*/ _jsxDEV("span", {
73
- children: selectedLanguageLabel
74
- }, void 0, false, {
75
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
76
- lineNumber: 88,
77
- columnNumber: 17
78
- }, void 0),
79
- /*#__PURE__*/ _jsxDEV(ChevronIcon, {
80
- className: `${baseClass}__chevron`
81
- }, void 0, false, {
82
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
83
- lineNumber: 89,
84
- columnNumber: 17
85
- }, void 0)
86
- ]
87
- }, void 0, true, {
88
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
89
- lineNumber: 84,
90
- columnNumber: 15
91
- }, void 0),
92
- buttonType: "custom",
93
- className: `${baseClass}__language-selector`,
94
- disabled: !isEditable,
95
- entries: languageEntries,
96
- horizontalAlign: "right",
97
- minEntriesForSearch: 8,
98
- searchPlaceholder: t('fields:searchForLanguage'),
99
- showScrollbar: true,
100
- size: "large"
101
- }, void 0, false, {
102
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
103
- lineNumber: 82,
104
- columnNumber: 11
105
- }, void 0),
106
- /*#__PURE__*/ _jsxDEV(CopyToClipboard, {
107
- value: codeField?.value ?? ''
108
- }, void 0, false, {
109
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
110
- lineNumber: 102,
111
- columnNumber: 11
112
- }, void 0),
113
- /*#__PURE__*/ _jsxDEV(Collapse, {}, void 0, false, {
114
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
115
- lineNumber: 104,
116
- columnNumber: 11
117
- }, void 0),
118
- isEditable && /*#__PURE__*/ _jsxDEV(RemoveButton, {}, void 0, false, {
119
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
120
- lineNumber: 106,
121
- columnNumber: 26
122
- }, void 0)
123
- ]
124
- }, void 0, true, {
125
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
126
- lineNumber: 81,
127
- columnNumber: 9
128
- }, void 0),
129
- className: baseClass,
130
- collapsibleProps: {
131
- AfterCollapsible: /*#__PURE__*/ _jsxDEV(FloatingCollapse, {}, void 0, false, {
132
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
133
- lineNumber: 111,
134
- columnNumber: 27
135
- }, void 0),
136
- disableHeaderToggle: true,
137
- disableToggleIndicator: true
138
- },
139
- Pill: /*#__PURE__*/ _jsxDEV("div", {
140
- className: `${baseClass}__pill`,
141
- children: /*#__PURE__*/ _jsxDEV(CodeBlockIcon, {}, void 0, false, {
142
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
143
- lineNumber: 117,
144
- columnNumber: 11
145
- }, void 0)
146
- }, void 0, false, {
147
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
148
- lineNumber: 116,
149
- columnNumber: 9
150
- }, void 0),
151
- children: /*#__PURE__*/ _jsxDEV(RenderFields, {
152
- fields: formSchema,
153
- forceRender: true,
154
- parentIndexPath: "",
155
- parentPath: '',
156
- parentSchemaPath: "",
157
- permissions: true,
158
- readOnly: !isEditable
159
- }, void 0, false, {
160
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
161
- lineNumber: 121,
162
- columnNumber: 7
163
- }, this)
164
- }, void 0, false, {
165
- fileName: "src/features/blocks/premade/CodeBlock/Component/Block.tsx",
166
- lineNumber: 79,
167
- columnNumber: 5
168
- }, this);
49
+ return <BlockCollapsible Actions={<div className={`${baseClass}__actions`}>
50
+ <Combobox button={<div className={`${baseClass}__language-selector-button`} data-selected-language={selectedLanguageField?.value}>
51
+ <span>{selectedLanguageLabel}</span>
52
+ <ChevronIcon className={`${baseClass}__chevron`}/>
53
+ </div>} buttonType="custom" className={`${baseClass}__language-selector`} disabled={!isEditable} entries={languageEntries} horizontalAlign="right" minEntriesForSearch={8} searchPlaceholder={t('fields:searchForLanguage')} showScrollbar size="large"/>
54
+ <CopyToClipboard value={codeField?.value ?? ''}/>
55
+
56
+ <Collapse/>
57
+
58
+ {isEditable && <RemoveButton/>}
59
+ </div>} className={baseClass} collapsibleProps={{
60
+ AfterCollapsible: <FloatingCollapse/>,
61
+ disableHeaderToggle: true,
62
+ disableToggleIndicator: true
63
+ }} Pill={<div className={`${baseClass}__pill`}>
64
+ <CodeBlockIcon/>
65
+ </div>}>
66
+ <RenderFields fields={formSchema} forceRender={true} parentIndexPath="" parentPath={''} parentSchemaPath="" permissions={true} readOnly={!isEditable}/>
67
+ </BlockCollapsible>;
169
68
  };
170
69
 
171
70
  //# sourceMappingURL=Block.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type { ComboboxEntry } from '@payloadcms/ui'\nimport type {} from 'payload'\n\nimport './index.scss'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n ChevronIcon,\n Combobox,\n CopyToClipboard,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n useTranslation,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { defaultLanguages } from './defaultLanguages.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<Pick<AdditionalCodeComponentProps, 'languages'>> = (\n args,\n) => {\n const { languages: languagesFromProps } = args\n const languages = languagesFromProps || defaultLanguages\n\n const { BlockCollapsible, formSchema, RemoveButton } = useBlockComponentContext()\n const { setModified } = useForm()\n const { t } = useTranslation()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n const isEditable = useLexicalEditable()\n\n const languageEntries = React.useMemo<ComboboxEntry[]>(() => {\n return Object.entries(languages).map(([languageCode, languageLabel]) => ({\n name: `${languageCode} ${languageLabel}`,\n Component: (\n <PopupList.Button\n active={false}\n disabled={false}\n onClick={() => {\n setSelectedLanguage(languageCode)\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n ),\n }))\n }, [languages, setSelectedLanguage])\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Combobox\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n buttonType=\"custom\"\n className={`${baseClass}__language-selector`}\n disabled={!isEditable}\n entries={languageEntries}\n horizontalAlign=\"right\"\n minEntriesForSearch={8}\n searchPlaceholder={t('fields:searchForLanguage')}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n\n {isEditable && <RemoveButton />}\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </BlockCollapsible>\n )\n}\n"],"names":["useLexicalEditable","ChevronIcon","Combobox","CopyToClipboard","PopupList","RenderFields","useForm","useFormFields","useTranslation","React","CodeBlockIcon","useBlockComponentContext","Collapse","defaultLanguages","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","languages","languagesFromProps","BlockCollapsible","formSchema","RemoveButton","setModified","t","codeField","fields","code","selectedLanguageField","setSelectedLanguage","dispatch","language","type","path","value","selectedLanguageLabel","isEditable","languageEntries","useMemo","Object","entries","map","languageCode","languageLabel","name","Component","Button","active","disabled","onClick","span","className","data-language","Actions","div","button","data-selected-language","buttonType","horizontalAlign","minEntriesForSearch","searchPlaceholder","showScrollbar","size","collapsibleProps","AfterCollapsible","disableHeaderToggle","disableToggleIndicator","Pill","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"mappings":"AAAA;;AAIA,OAAO,eAAc;AAErB,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,WAAW,EACXC,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,aAAa,EACbC,cAAc,QACT,iBAAgB;AACvB,OA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GpC,UAAU,eAAe,CAAC;wBAAEqC,iBAAeV;kCAC5DC;;;;;;;;;;;YAIT,CAAA;IACF,GAAG;QAACzB;QAAWW;KAAoB;IAEnC,qBACE,QAACT;QACCiC,uBACE,QAACC;YAAIH,WAAW,GAAGpC,UAAU,SAAS,CAAC;;8BACrC,QAACb;oBACCqD,sBACE,QAACD;wBACCH,WAAW,GAAGpC,UAAU,0BAA0B,CAAC;wBACnDyC,0BAAwB5B,uBAAuBM;;0CAE/C,QAACgB;0CAAMf;;;;;;0CACP,QAAClC;gCAAYkD,WAAW,GAAGpC,UAAU,SAAS,CAAC;;;;;;;;;;;;oBAGnD0C,YAAW;oBACXN,WAAW,GAAGpC,UAAU,mBAAmB,CAAC;oBAC5CiC,UAAU,CAACZ;oBACXI,SAASH;oBACTqB,iBAAgB;oBAChBC,qBAAqB;oBACrBC,mBAAmBpC,EAAE;oBACrBqC,aAAa;oBACbC,MAAK;;;;;;8BAEP,QAAC3D;oBAAgB+B,OAAO,AAACT,WAAWS,SAAoB;;;;;;8BAExD,QAACtB;;;;;gBAEAwB,4BAAc,QAACd;;;;;;;;;;;QAGpB6B,WAAWpC;QACXgD,kBAAkB;YAChBC,gCAAkB,QAAClD;;;;;YACnBmD,qBAAqB;YACrBC,wBAAwB;QAC1B;QACAC,oBACE,QAACb;YAAIH,WAAW,GAAGpC,UAAU,MAAM,CAAC;sBAClC,cAAA,QAACL;;;;;;;;;;kBAIL,cAAA,QAACL;YACCqB,QAAQL;YACR+C,aAAa;YACbC,iBAAgB;YAChBC,YAAY;YACZC,kBAAiB;YACjBC,aAAa;YACbC,UAAU,CAACrC;;;;;;;;;;;AAInB,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Block.tsx"],"sourcesContent":["'use client'\nimport type { ComboboxEntry } from '@payloadcms/ui'\nimport type {} from 'payload'\n\nimport './index.scss'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n ChevronIcon,\n Combobox,\n CopyToClipboard,\n PopupList,\n RenderFields,\n useForm,\n useFormFields,\n useTranslation,\n} from '@payloadcms/ui'\nimport React from 'react'\n\nimport type { AdditionalCodeComponentProps } from './Code.js'\n\nimport { CodeBlockIcon } from '../../../../../lexical/ui/icons/CodeBlock/index.js'\nimport { useBlockComponentContext } from '../../../client/component/BlockContent.js'\nimport { Collapse } from './Collapse/index.js'\nimport { defaultLanguages } from './defaultLanguages.js'\nimport { FloatingCollapse } from './FloatingCollapse/index.js'\n\nconst baseClass = 'payload-richtext-code-block'\nexport const CodeBlockBlockComponent: React.FC<Pick<AdditionalCodeComponentProps, 'languages'>> = (\n args,\n) => {\n const { languages: languagesFromProps } = args\n const languages = languagesFromProps || defaultLanguages\n\n const { BlockCollapsible, formSchema, RemoveButton } = useBlockComponentContext()\n const { setModified } = useForm()\n const { t } = useTranslation()\n\n const { codeField } = useFormFields(([fields]) => ({\n codeField: fields?.code,\n }))\n\n const { selectedLanguageField, setSelectedLanguage } = useFormFields(([fields, dispatch]) => ({\n selectedLanguageField: fields?.language,\n setSelectedLanguage: (language: string) => {\n dispatch({\n type: 'UPDATE',\n path: 'language',\n value: language,\n })\n setModified(true)\n },\n }))\n\n const selectedLanguageLabel = languages[selectedLanguageField?.value as keyof typeof languages]\n\n const isEditable = useLexicalEditable()\n\n const languageEntries = React.useMemo<ComboboxEntry[]>(() => {\n return Object.entries(languages).map(([languageCode, languageLabel]) => ({\n name: `${languageCode} ${languageLabel}`,\n Component: (\n <PopupList.Button\n active={false}\n disabled={false}\n onClick={() => {\n setSelectedLanguage(languageCode)\n }}\n >\n <span className={`${baseClass}__language-code`} data-language={languageCode}>\n {languageLabel}\n </span>\n </PopupList.Button>\n ),\n }))\n }, [languages, setSelectedLanguage])\n\n return (\n <BlockCollapsible\n Actions={\n <div className={`${baseClass}__actions`}>\n <Combobox\n button={\n <div\n className={`${baseClass}__language-selector-button`}\n data-selected-language={selectedLanguageField?.value}\n >\n <span>{selectedLanguageLabel}</span>\n <ChevronIcon className={`${baseClass}__chevron`} />\n </div>\n }\n buttonType=\"custom\"\n className={`${baseClass}__language-selector`}\n disabled={!isEditable}\n entries={languageEntries}\n horizontalAlign=\"right\"\n minEntriesForSearch={8}\n searchPlaceholder={t('fields:searchForLanguage')}\n showScrollbar\n size=\"large\"\n />\n <CopyToClipboard value={(codeField?.value as string) ?? ''} />\n\n <Collapse />\n\n {isEditable && <RemoveButton />}\n </div>\n }\n className={baseClass}\n collapsibleProps={{\n AfterCollapsible: <FloatingCollapse />,\n disableHeaderToggle: true,\n disableToggleIndicator: true,\n }}\n Pill={\n <div className={`${baseClass}__pill`}>\n <CodeBlockIcon />\n </div>\n }\n >\n <RenderFields\n fields={formSchema}\n forceRender={true}\n parentIndexPath=\"\"\n parentPath={''}\n parentSchemaPath=\"\"\n permissions={true}\n readOnly={!isEditable}\n />\n </BlockCollapsible>\n )\n}\n"],"names":["useLexicalEditable","ChevronIcon","Combobox","CopyToClipboard","PopupList","RenderFields","useForm","useFormFields","useTranslation","React","CodeBlockIcon","useBlockComponentContext","Collapse","defaultLanguages","FloatingCollapse","baseClass","CodeBlockBlockComponent","args","languages","languagesFromProps","BlockCollapsible","formSchema","RemoveButton","setModified","t","codeField","fields","code","selectedLanguageField","setSelectedLanguage","dispatch","language","type","path","value","selectedLanguageLabel","isEditable","languageEntries","useMemo","Object","entries","map","languageCode","languageLabel","name","Component","Button","active","disabled","onClick","span","className","data-language","Actions","div","button","data-selected-language","buttonType","horizontalAlign","minEntriesForSearch","searchPlaceholder","showScrollbar","size","collapsibleProps","AfterCollapsible","disableHeaderToggle","disableToggleIndicator","Pill","forceRender","parentIndexPath","parentPath","parentSchemaPath","permissions","readOnly"],"mappings":"AAAA;AAIA,OAAO,eAAc;AAErB,SAASA,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,WAAW,EACXC,QAAQ,EACRC,eAAe,EACfC,SAAS,EACTC,YAAY,EACZC,OAAO,EACPC,aAAa,EACbC,cAAc,QACT,iBAA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U,eAAe,CAAC,EAAEqC,eAAeV,cAAc;YAC3E,CAACC,cAAc;UACjB,EAAEO,KAAK;QACT,EAAE9C,UAAU0C;YAEhB,CAAA;IACF,GAAG;QAAC5B;QAAWW;KAAoB;IAEnC,QACGT,iBACCiC,UACGC,IAAIH,WAAW,GAAGpC,UAAU,SAAS,CAAC,EAAE;UACvC,CAACb,SACCqD,SACGD,IACCH,WAAW,GAAGpC,UAAU,0BAA0B,CAAC,EACnDyC,wBAAwB5B,uBAAuBM,OAChD;gBACC,CAACgB,MAAMf,wBAAwBe,KAAK;gBACpC,CAACjD,YAAYkD,WAAW,GAAGpC,UAAU,SAAS,CAAC,GAAI;cACrD,EAAEuC,MAEJG,WAAW,SACXN,WAAW,GAAGpC,UAAU,mBAAmB,CAAC,EAC5CiC,UAAU,CAACZ,YACXI,SAASH,iBACTqB,gBAAgB,QAChBC,qBAAqB,GACrBC,mBAAmBpC,EAAE,6BACrBqC,cACAC,KAAK,SACL;UACF,CAAC3D,gBAAgB+B,OAAO,AAACT,WAAWS,SAAoB,KAAM;;UAE9D,CAACtB,UAAW;;UAEZ,CAACwB,eAAed,eAAgB;QAClC,EAAEgC,MAEJH,WAAWpC,WACXgD,kBAAkB;QAChBC,mBAAmBlD;QACnBmD,qBAAqB;QACrBC,wBAAwB;IAC1B,GACAC,OACGb,IAAIH,WAAW,GAAGpC,UAAU,MAAM,CAAC,EAAE;UACpC,CAACL,eAAgB;QACnB,EAAE4C,MAEL;MACC,CAACjD,aACCqB,QAAQL,YACR+C,aAAa,MACbC,gBAAgB,GAChBC,YAAY,IACZC,iBAAiB,GACjBC,aAAa,MACbC,UAAU,CAACrC,aACX;IACJ,EAAEhB;AAEN,EAAC"}
@@ -1,7 +1,6 @@
1
1
  'use client';
2
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
2
  import { CodeField, useFormFields } from '@payloadcms/ui';
4
- import React, { useId, useMemo } from 'react';
3
+ import { useId, useMemo } from 'react';
5
4
  import { defaultLanguages } from './defaultLanguages.js';
6
5
  /**
7
6
  * @default first key of the `languages` prop
@@ -58,69 +57,54 @@ import { defaultLanguages } from './defaultLanguages.js';
58
57
  instanceId
59
58
  ]);
60
59
  const key = `${field.name}-${language}-${label}`;
61
- return props && /*#__PURE__*/ _jsxDEV(CodeField, {
62
- autoComplete: autoComplete,
63
- field: props,
64
- forceRender: forceRender,
65
- onMount: (_editor, monaco)=>{
66
- monaco.editor.defineTheme('vs-dark', {
67
- base: 'vs-dark',
68
- colors: {
69
- 'editor.background': '#222222'
70
- },
71
- inherit: true,
72
- rules: []
73
- });
74
- monaco.editor.defineTheme('vs', {
75
- base: 'vs',
76
- colors: {
77
- 'editor.background': '#f5f5f5'
78
- },
79
- inherit: true,
80
- rules: []
81
- });
82
- monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
83
- allowNonTsExtensions: true,
84
- // Set module resolution to NodeJs to enable autocompletion
85
- allowJs: true,
86
- allowSyntheticDefaultImports: true,
87
- esModuleInterop: true,
88
- jsx: monaco.languages.typescript.JsxEmit.React,
89
- moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
90
- noEmit: true,
91
- paths: typescript?.paths,
92
- reactNamespace: 'React',
93
- target: monaco.languages.typescript.ScriptTarget[typescript?.target ?? 'ESNext'],
94
- typeRoots: typescript?.typeRoots ?? [
95
- 'node_modules/@types'
96
- ]
97
- });
98
- monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
99
- noSemanticValidation: typescript?.enableSemanticValidation ? false : true,
100
- noSyntaxValidation: false
101
- });
102
- const run = async ()=>{
103
- if (typescript?.fetchTypes && Array.isArray(typescript.fetchTypes) && typescript.fetchTypes.length > 0) {
104
- await Promise.all(typescript.fetchTypes.map(async (type)=>{
105
- const types = await fetch(type.url);
106
- const typesText = await types.text();
107
- monaco.languages.typescript.typescriptDefaults.addExtraLib(typesText, type.filePath);
108
- }));
109
- }
110
- };
111
- void run();
112
- },
113
- path: path,
114
- permissions: permissions,
115
- readOnly: readOnly,
116
- renderedBlocks: renderedBlocks,
117
- schemaPath: schemaPath,
118
- validate: validate
119
- }, key, false, {
120
- fileName: "src/features/blocks/premade/CodeBlock/Component/Code.tsx",
121
- lineNumber: 110,
122
- columnNumber: 7
123
- }, this);
60
+ return props && <CodeField autoComplete={autoComplete} field={props} forceRender={forceRender} key={key} onMount={(_editor, monaco)=>{
61
+ monaco.editor.defineTheme('vs-dark', {
62
+ base: 'vs-dark',
63
+ colors: {
64
+ 'editor.background': '#222222'
65
+ },
66
+ inherit: true,
67
+ rules: []
68
+ });
69
+ monaco.editor.defineTheme('vs', {
70
+ base: 'vs',
71
+ colors: {
72
+ 'editor.background': '#f5f5f5'
73
+ },
74
+ inherit: true,
75
+ rules: []
76
+ });
77
+ monaco.languages.typescript.typescriptDefaults.setCompilerOptions({
78
+ allowNonTsExtensions: true,
79
+ // Set module resolution to NodeJs to enable autocompletion
80
+ allowJs: true,
81
+ allowSyntheticDefaultImports: true,
82
+ esModuleInterop: true,
83
+ jsx: monaco.languages.typescript.JsxEmit.React,
84
+ moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,
85
+ noEmit: true,
86
+ paths: typescript?.paths,
87
+ reactNamespace: 'React',
88
+ target: monaco.languages.typescript.ScriptTarget[typescript?.target ?? 'ESNext'],
89
+ typeRoots: typescript?.typeRoots ?? [
90
+ 'node_modules/@types'
91
+ ]
92
+ });
93
+ monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({
94
+ noSemanticValidation: typescript?.enableSemanticValidation ? false : true,
95
+ noSyntaxValidation: false
96
+ });
97
+ const run = async ()=>{
98
+ if (typescript?.fetchTypes && Array.isArray(typescript.fetchTypes) && typescript.fetchTypes.length > 0) {
99
+ await Promise.all(typescript.fetchTypes.map(async (type)=>{
100
+ const types = await fetch(type.url);
101
+ const typesText = await types.text();
102
+ monaco.languages.typescript.typescriptDefaults.addExtraLib(typesText, type.filePath);
103
+ }));
104
+ }
105
+ };
106
+ void run();
107
+ }} path={path} permissions={permissions} readOnly={readOnly} renderedBlocks={renderedBlocks} schemaPath={schemaPath} validate={validate}/>;
124
108
  };
125
109
 
126
110
  //# sourceMappingURL=Code.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useId, useMemo } from 'react'\n\nimport { defaultLanguages } from './defaultLanguages.js'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default all languages supported by Monaco Editor\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * By default, the editor will not perform semantic validation. This means that\n * while syntax errors will be highlighted, other issues like missing imports or incorrect\n * types will not be.\n *\n * @default false\n */\n enableSemanticValidation?: boolean\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = defaultLanguages,\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n // unique id per component instance to ensure Monaco creates a distinct model\n // for each TypeScript code block. Using React's useId is SSR-safe and builtin.\n const instanceId = useId()\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n editorProps: {\n // If typescript is set, @monaco-editor/react needs to set the URI to a .ts or .tsx file when it calls createModel().\n // Provide a unique defaultPath per instance so Monaco doesn't reuse the same model\n // across multiple code block instances. We use field.name + instanceId for debugability.\n defaultPath: language === 'ts' ? `file-${field.name}-${instanceId}.tsx` : undefined,\n },\n language,\n },\n }),\n [field, language, instanceId],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n allowJs: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n jsx: monaco.languages.typescript.JsxEmit.React,\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n noEmit: true,\n paths: typescript?.paths,\n reactNamespace: 'React',\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n\n monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: typescript?.enableSemanticValidation ? false : true,\n noSyntaxValidation: false,\n })\n\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"names":["CodeField","useFormFields","React","useId","useMemo","defaultLanguages","CodeComponent","autoComplete","field","forceRender","languages","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","instanceId","label","props","type","admin","editorOptions","editorProps","defaultPath","name","undefined","key","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","allowJs","allowSyntheticDefaultImports","esModuleInterop","jsx","JsxEmit","moduleResolution","ModuleResolutionKind","NodeJs","noEmit","paths","reactNamespace","target","ScriptTarget","typeRoots","setDiagnosticsOptions","noSemanticValidation","enableSemanticValidation","noSyntaxValidation","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"mappings":"AAAA;;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ,iBAAgB;AACzD,OAAOC,SAASC,KAAK,EAAEC,OAAO,QAAQ,QAAO;AAE7C,SAASC,gBAAgB,QAAQ,wBAAuB;AAGtD;;GAEC,GAED;;GAEC,GAED;;;;GAIC,GAED;;GAEC,GAEC;;;;;;KAMC,GAED;;;;;;KAMC,GAKD;;KAEC,GAED;;KAEC,GAED;;KAEC,GAKL,OAAO,MAAMC,gBAA+E,CAAC,EAC3FC,YAAY,EACZC,KAAK,EACLC,WAAW,EACXC,YAAYL,gBAAgB,EAC5BM,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,cAAc,EACdC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACT;IACC,MAAMC,gBAAgBjB,cAAc,CAAC,CAACkB,OAAO,GAAKA,MAAM,CAAC,WAAW;IAEpE,MAAMC,WACJ,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C,MAAM;gBACzEC,QAAQ;gBACRC,OAAOvC,YAAYuC;gBACnBC,gBAAgB;gBAChBC,QAAQrB,OAAO1B,SAAS,CAACM,UAAU,CAAC0C,YAAY,CAC9C1C,YAAYyC,UAAW,SACxB;gBACDE,WAAW3C,YAAY2C,aAAa;oBAAC;iBAAsB;YAC7D;YAEAvB,OAAO1B,SAAS,CAACM,UAAU,CAAC2B,kBAAkB,CAACiB,qBAAqB,CAAC;gBACnEC,sBAAsB7C,YAAY8C,2BAA2B,QAAQ;gBACrEC,oBAAoB;YACtB;YAEA,MAAMC,MAAM;gBACV,IACEhD,YAAYiD,cACZC,MAAMC,OAAO,CAACnD,WAAWiD,UAAU,KACnCjD,WAAWiD,UAAU,CAACG,MAAM,GAAG,GAC/B;oBACA,MAAMC,QAAQC,GAAG,CACftD,WAAWiD,UAAU,CAACM,GAAG,CAAC,OAAO7C;wBAC/B,MAAM8C,QAAQ,MAAMC,MAAM/C,KAAKgD,GAAG;wBAClC,MAAMC,YAAY,MAAMH,MAAMI,IAAI;wBAClCxC,OAAO1B,SAAS,CAACM,UAAU,CAAC2B,kBAAkB,CAACkC,WAAW,CACxDF,WACAjD,KAAKoD,QAAQ;oBAEjB;gBAEJ;YACF;YACA,KAAKd;QACP;QACArD,MAAMA;QACNC,aAAaA;QACbC,UAAUA;QACVC,gBAAgBA;QAChBC,YAAYA;QACZE,UAAUA;OAlELgB;;;;;AAsEb,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/blocks/premade/CodeBlock/Component/Code.tsx"],"sourcesContent":["'use client'\n\nimport type { CodeFieldClient, CodeFieldClientProps } from 'payload'\n\nimport { CodeField, useFormFields } from '@payloadcms/ui'\nimport React, { useId, useMemo } from 'react'\n\nimport { defaultLanguages } from './defaultLanguages.js'\n\nexport type AdditionalCodeComponentProps = {\n /**\n * @default first key of the `languages` prop\n */\n defaultLanguage?: string\n /**\n * @default all languages supported by Monaco Editor\n */\n languages?: Record<string, string>\n /**\n * Override the name of the block.\n *\n * @default 'Code'\n */\n slug?: string\n /**\n * Configure typescript settings for the editor\n */\n typescript?: {\n /**\n * By default, the editor will not perform semantic validation. This means that\n * while syntax errors will be highlighted, other issues like missing imports or incorrect\n * types will not be.\n *\n * @default false\n */\n enableSemanticValidation?: boolean\n /**\n * Additional types to fetch and include in the editor for autocompletion.\n *\n * For example, to include types for payload, you would set this to\n *\n * [{ url: 'https://unpkg.com/payload@latest/dist/index.d.ts', filePath: 'file:///node_modules/payload/index.d.ts' }]\n */\n fetchTypes?: Array<{\n filePath: string\n url: string\n }>\n /**\n * @default undefined\n */\n paths?: Record<string, string[]>\n /**\n * @default \"ESNext\"\n */\n target?: string\n /**\n * @default ['node_modules/@types']\n */\n typeRoots?: string[]\n }\n}\n\nexport const CodeComponent: React.FC<AdditionalCodeComponentProps & CodeFieldClientProps> = ({\n autoComplete,\n field,\n forceRender,\n languages = defaultLanguages,\n path,\n permissions,\n readOnly,\n renderedBlocks,\n schemaPath,\n typescript,\n validate,\n}) => {\n const languageField = useFormFields(([fields]) => fields['language'])\n\n const language: string =\n (languageField?.value as string) || (languageField?.initialValue as string) || 'typescript'\n\n // unique id per component instance to ensure Monaco creates a distinct model\n // for each TypeScript code block. Using React's useId is SSR-safe and builtin.\n const instanceId = useId()\n\n const label = languages[language]\n\n const props: CodeFieldClient = useMemo<CodeFieldClient>(\n () => ({\n ...field,\n type: 'code',\n admin: {\n ...field.admin,\n editorOptions: {},\n editorProps: {\n // If typescript is set, @monaco-editor/react needs to set the URI to a .ts or .tsx file when it calls createModel().\n // Provide a unique defaultPath per instance so Monaco doesn't reuse the same model\n // across multiple code block instances. We use field.name + instanceId for debugability.\n defaultPath: language === 'ts' ? `file-${field.name}-${instanceId}.tsx` : undefined,\n },\n language,\n },\n }),\n [field, language, instanceId],\n )\n\n const key = `${field.name}-${language}-${label}`\n\n return (\n props && (\n <CodeField\n autoComplete={autoComplete}\n field={props}\n forceRender={forceRender}\n key={key}\n onMount={(_editor, monaco) => {\n monaco.editor.defineTheme('vs-dark', {\n base: 'vs-dark',\n colors: {\n 'editor.background': '#222222',\n },\n inherit: true,\n rules: [],\n })\n\n monaco.editor.defineTheme('vs', {\n base: 'vs',\n colors: {\n 'editor.background': '#f5f5f5',\n },\n inherit: true,\n rules: [],\n })\n monaco.languages.typescript.typescriptDefaults.setCompilerOptions({\n allowNonTsExtensions: true,\n // Set module resolution to NodeJs to enable autocompletion\n allowJs: true,\n allowSyntheticDefaultImports: true,\n esModuleInterop: true,\n jsx: monaco.languages.typescript.JsxEmit.React,\n moduleResolution: monaco.languages.typescript.ModuleResolutionKind.NodeJs,\n noEmit: true,\n paths: typescript?.paths,\n reactNamespace: 'React',\n target: monaco.languages.typescript.ScriptTarget[\n typescript?.target ?? ('ESNext' as any)\n ] as any,\n typeRoots: typescript?.typeRoots ?? ['node_modules/@types'],\n })\n\n monaco.languages.typescript.typescriptDefaults.setDiagnosticsOptions({\n noSemanticValidation: typescript?.enableSemanticValidation ? false : true,\n noSyntaxValidation: false,\n })\n\n const run = async () => {\n if (\n typescript?.fetchTypes &&\n Array.isArray(typescript.fetchTypes) &&\n typescript.fetchTypes.length > 0\n ) {\n await Promise.all(\n typescript.fetchTypes.map(async (type) => {\n const types = await fetch(type.url)\n const typesText = await types.text()\n monaco.languages.typescript.typescriptDefaults.addExtraLib(\n typesText,\n type.filePath,\n )\n }),\n )\n }\n }\n void run()\n }}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n renderedBlocks={renderedBlocks}\n schemaPath={schemaPath}\n validate={validate}\n />\n )\n )\n}\n"],"names":["CodeField","useFormFields","useId","useMemo","defaultLanguages","CodeComponent","autoComplete","field","forceRender","languages","path","permissions","readOnly","renderedBlocks","schemaPath","typescript","validate","languageField","fields","language","value","initialValue","instanceId","label","props","type","admin","editorOptions","editorProps","defaultPath","name","undefined","key","onMount","_editor","monaco","editor","defineTheme","base","colors","inherit","rules","typescriptDefaults","setCompilerOptions","allowNonTsExtensions","allowJs","allowSyntheticDefaultImports","esModuleInterop","jsx","JsxEmit","React","moduleResolution","ModuleResolutionKind","NodeJs","noEmit","paths","reactNamespace","target","ScriptTarget","typeRoots","setDiagnosticsOptions","noSemanticValidation","enableSemanticValidation","noSyntaxValidation","run","fetchTypes","Array","isArray","length","Promise","all","map","types","fetch","url","typesText","text","addExtraLib","filePath"],"mappings":"AAAA;AAIA,SAASA,SAAS,EAAEC,aAAa,QAAQ,iBAAgB;AACzD,SAAgBC,KAAK,EAAEC,OAAO,QAAQ,QAAO;AAE7C,SAASC,gBAAgB,QAAQ,wBAAuB;AAGtD;;GAEC,GAED;;GAEC,GAED;;;;GAIC,GAED;;GAEC,GAEC;;;;;;KAMC,GAED;;;;;;KAMC,GAKD;;KAEC,GAED;;KAEC,GAED;;KAEC,GAKL,OAAO,MAAMC,gBAA+E,CAAC,EAC3FC,YAAY,EACZC,KAAK,EACLC,WAAW,EACXC,YAAYL,gBAAgB,EAC5BM,IAAI,EACJC,WAAW,EACXC,QAAQ,EACRC,cAAc,EACdC,UAAU,EACVC,UAAU,EACVC,QAAQ,EACT;IACC,MAAMC,gBAAgBhB,cAAc,CAAC,CAACiB,OAAO,GAAKA,MAAM,CAAC,WAAW;IAEpE,MAAMC,WACJ,AAACF,eAAeG,SAAqBH,eAAeI,gBAA2B;IAEjF,6EAA6E;IAC7E,+EAA+E;IAC/E,MAAMC,aAAapB;IAEnB,MAAMqB,QAAQd,SAAS,CAACU,SAAS;IAEjC,MAAMK,QAAyBrB,QAC7B,IAAO,CAAA;YACL,GAAGI,KAAK;YACRkB,MAAM;YACNC,OAAO;gBACL,GAAGnB,MAAMmB,KAAK;gBACdC,eAAe,CAAC;gBAChBC,aAAa;oBACX,qHAAqH;oBACrH,mFAAmF;oBACnF,yFAAyF;oBACzFC,aAAaV,aAAa,OAAO,CAAC,KAAK,EAAEZ,MAAMuB,IAAI,CAAC,CAAC,EAAER,WAAW,IAAI,CAAC,GAAGS;gBAC5E;gBACAZ;YACF;QACF,CAAA,GACA;QAACZ;Q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vD,WAAWkD,UAAU,CAACM,GAAG,CAAC,OAAO9C;oBAC/B,MAAM+C,QAAQ,MAAMC,MAAMhD,KAAKiD,GAAG;oBAClC,MAAMC,YAAY,MAAMH,MAAMI,IAAI;oBAClCzC,OAAO1B,SAAS,CAACM,UAAU,CAAC2B,kBAAkB,CAACmC,WAAW,CACxDF,WACAlD,KAAKqD,QAAQ;gBAEjB;YAEJ;QACF;QACA,KAAKd;IACP,GACAtD,MAAMA,MACNC,aAAaA,aACbC,UAAUA,UACVC,gBAAgBA,gBAChBC,YAAYA,YACZE,UAAUA;AAIlB,EAAC"}
@@ -1,25 +1,12 @@
1
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
- import React from 'react';
3
1
  import './index.scss';
4
2
  const baseClass = 'code-block-collapse-button';
5
3
  import { useCollapsible } from '@payloadcms/ui';
6
4
  import { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js';
7
5
  export const Collapse = ()=>{
8
6
  const { toggle } = useCollapsible();
9
- return /*#__PURE__*/ _jsxDEV("button", {
10
- className: baseClass,
11
- onClick: toggle,
12
- type: "button",
13
- children: /*#__PURE__*/ _jsxDEV(CollapseIcon, {}, void 0, false, {
14
- fileName: "src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx",
15
- lineNumber: 14,
16
- columnNumber: 7
17
- }, this)
18
- }, void 0, false, {
19
- fileName: "src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx",
20
- lineNumber: 13,
21
- columnNumber: 5
22
- }, this);
7
+ return <button className={baseClass} onClick={toggle} type="button">
8
+ <CollapseIcon/>
9
+ </button>;
23
10
  };
24
11
 
25
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-collapse-button'\nimport { useCollapsible } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const Collapse: React.FC = () => {\n const { toggle } = useCollapsible()\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["React","baseClass","useCollapsible","CollapseIcon","Collapse","toggle","button","className","onClick","type"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,eAAc;AAErB,MAAMC,YAAY;AAClB,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,WAAqB;IAChC,MAAM,EAAEC,MAAM,EAAE,GAAGH;IACnB,qBACE,QAACI;QAAOC,WAAWN;QAAWO,SAASH;QAAQI,MAAK;kBAClD,cAAA,QAACN;;;;;;;;;;AAGP,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/Collapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-collapse-button'\nimport { useCollapsible } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const Collapse: React.FC = () => {\n const { toggle } = useCollapsible()\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["baseClass","useCollapsible","CollapseIcon","Collapse","toggle","button","className","onClick","type"],"mappings":"AAEA,OAAO,eAAc;AAErB,MAAMA,YAAY;AAClB,SAASC,cAAc,QAAQ,iBAAgB;AAE/C,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,WAAqB;IAChC,MAAM,EAAEC,MAAM,EAAE,GAAGH;IACnB,QACGI,OAAOC,WAAWN,WAAWO,SAASH,QAAQI,KAAK,SAAS;MAC3D,CAACN,cAAe;IAClB,EAAEG;AAEN,EAAC"}
@@ -1,5 +1,3 @@
1
- import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
- import React from 'react';
3
1
  import './index.scss';
4
2
  const baseClass = 'code-block-floating-collapse-button';
5
3
  import { useCollapsible, useTranslation } from '@payloadcms/ui';
@@ -10,29 +8,10 @@ export const FloatingCollapse = ()=>{
10
8
  if (!isCollapsed) {
11
9
  return null;
12
10
  }
13
- return /*#__PURE__*/ _jsxDEV("button", {
14
- className: baseClass,
15
- onClick: toggle,
16
- type: "button",
17
- children: [
18
- /*#__PURE__*/ _jsxDEV("span", {
19
- children: t('general:collapse')
20
- }, void 0, false, {
21
- fileName: "src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx",
22
- lineNumber: 20,
23
- columnNumber: 7
24
- }, this),
25
- /*#__PURE__*/ _jsxDEV(CollapseIcon, {}, void 0, false, {
26
- fileName: "src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx",
27
- lineNumber: 21,
28
- columnNumber: 7
29
- }, this)
30
- ]
31
- }, void 0, true, {
32
- fileName: "src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx",
33
- lineNumber: 19,
34
- columnNumber: 5
35
- }, this);
11
+ return <button className={baseClass} onClick={toggle} type="button">
12
+ <span>{t('general:collapse')}</span>
13
+ <CollapseIcon/>
14
+ </button>;
36
15
  };
37
16
 
38
17
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-floating-collapse-button'\nimport { useCollapsible, useTranslation } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const FloatingCollapse: React.FC = () => {\n const { isCollapsed, toggle } = useCollapsible()\n const { t } = useTranslation()\n\n if (!isCollapsed) {\n return null\n }\n\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <span>{t('general:collapse')}</span>\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["React","baseClass","useCollapsible","useTranslation","CollapseIcon","FloatingCollapse","isCollapsed","toggle","t","button","className","onClick","type","span"],"mappings":";AAAA,OAAOA,WAAW,QAAO;AAEzB,OAAO,eAAc;AAErB,MAAMC,YAAY;AAClB,SAASC,cAAc,EAAEC,cAAc,QAAQ,iBAAgB;AAE/D,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGL;IAChC,MAAM,EAAEM,CAAC,EAAE,GAAGL;IAEd,IAAI,CAACG,aAAa;QAChB,OAAO;IACT;IAEA,qBACE,QAACG;QAAOC,WAAWT;QAAWU,SAASJ;QAAQK,MAAK;;0BAClD,QAACC;0BAAML,EAAE;;;;;;0BACT,QAACJ;;;;;;;;;;;AAGP,EAAC"}
1
+ {"version":3,"sources":["../../../../../../../src/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.tsx"],"sourcesContent":["import React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'code-block-floating-collapse-button'\nimport { useCollapsible, useTranslation } from '@payloadcms/ui'\n\nimport { CollapseIcon } from '../../../../../../lexical/ui/icons/Collapse/index.js'\n\nexport const FloatingCollapse: React.FC = () => {\n const { isCollapsed, toggle } = useCollapsible()\n const { t } = useTranslation()\n\n if (!isCollapsed) {\n return null\n }\n\n return (\n <button className={baseClass} onClick={toggle} type=\"button\">\n <span>{t('general:collapse')}</span>\n <CollapseIcon />\n </button>\n )\n}\n"],"names":["baseClass","useCollapsible","useTranslation","CollapseIcon","FloatingCollapse","isCollapsed","toggle","t","button","className","onClick","type","span"],"mappings":"AAEA,OAAO,eAAc;AAErB,MAAMA,YAAY;AAClB,SAASC,cAAc,EAAEC,cAAc,QAAQ,iBAAgB;AAE/D,SAASC,YAAY,QAAQ,uDAAsD;AAEnF,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAEC,MAAM,EAAE,GAAGL;IAChC,MAAM,EAAEM,CAAC,EAAE,GAAGL;IAEd,IAAI,CAACG,aAAa;QAChB,OAAO;IACT;IAEA,QACGG,OAAOC,WAAWT,WAAWU,SAASJ,QAAQK,KAAK,SAAS;MAC3D,CAACC,MAAML,EAAE,sBAAsBK,KAAK;MACpC,CAACT,cAAe;IAClB,EAAEK;AAEN,EAAC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\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 = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.block)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return $applyNodeReplacement(\n new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"names":["DecoratorBlockNode","addClassNamesToElement","ObjectID","$applyNodeReplacement","ServerBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","createDOM","config","element","document","createElement","theme","block","decorate","editor","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"mappings":"AAIA,SAASA,kBAAkB,QAAQ,8CAA6C;AAChF,SAASC,sBAAsB,QAAQ,iBAAgB;AACvD,OAAOC,cAAc,gBAAe;AACpC,SACEC,qBAAqB,QAQhB,UAAS;AAKd,oBAAoB,GAiBtB,OAAO,MAAMC,wBAAwBJ;IACnCK,cAAqB;IACrBC,SAAqB;IAErBC,YAAY,EACVC,WAAW,EACXC,MAAM,EACNC,MAAM,EACNC,GAAG,EAMJ,CAAE;QACD,KAAK,CAACD,QAAQC;QACd,IAAI,CAACL,QAAQ,GAAGG;QAChB,IAAI,CAACJ,aAAa,GAAGG,eAAe;IACtC;IAEA,OAAgBI,MAAMC,IAAqB,EAAmB;QAC5D,OAAO,IAAI,IAAI,CAAC;YACdL,aAAaK,KAAKR,aAAa;YAC/BI,QAAQI,KAAKP,QAAQ;YACrBI,QAAQG,KAAKC,QAAQ;YACrBH,KAAKE,KAAKE,KAAK;QACjB;IACF;IAEA,OAAgBC,UAAkB;QAChC,OAAO;IACT;IAEA,OAAgBC,YAAqD;QACnE,OAAO,CAAC;IACV;IAEA,OAAgBC,WAAWC,cAAmC,EAAmB;QAC/E,IAAIA,eAAeC,OAAO,KAAK,GAAG;YAChC,mFAAmF;YACnFD,iBAAiB;gBACf,GAAGA,cAAc;gBACjBV,QAAQ;oBACN,GAAG,AAACU,eAAuBV,MAAM,CAACY,IAAI;gBACxC;gBACAD,SAAS;YACX;QACF;QACA,MAAMP,OAAOS,uBAAuBH,eAAeV,MAAM;QACzDI,KAAKU,SAAS,CAACJ,eAAeT,MAAM;QACpC,OAAOG;IACT;IAEA,OAAOW,WAAkB;QACvB,OAAO;IACT;IAESC,UAAUC,MAAqB,EAAe;QACrD,MAAMC,UAAUC,SAASC,aAAa,CAAC;QACvC5B,uBAAuB0B,SAASD,QAAQI,OAAOC;QAC/C,OAAOJ;IACT;IAESK,SAASC,MAAqB,EAAEP,MAAoB,EAAe;QAC1E,OAAO;IACT;IAESQ,YAA6B;QACpC,MAAMP,UAAUC,SAASC,aAAa,CAAC;QAEvC,MAAMM,OAAOP,SAASQ,cAAc,CAAC,IAAI,CAACC,cAAc;QACxDV,QAAQW,MAAM,CAACH;QACf,OAAO;YAAER;QAAQ;IACnB;IAESY,aAAkC;QACzC,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrBC,MAAM;YACN/B,QAAQ,IAAI,CAACgC,SAAS;YACtBrB,SAAS;QACX;IACF;IAEAsB,iBAAyB;QACvB,OAAO,IAAI,CAACC,SAAS,GAAGtC,aAAa;IACvC;IAEAoC,YAAyB;QACvB,OAAO,IAAI,CAACE,SAAS,GAAGrC,QAAQ;IAClC;IAES+B,iBAAyB;QAChC,OAAO,CAAC,WAAW,CAAC;IACtB;IAEAO,UAAUnC,MAAmB,EAAEoC,sBAAgC,EAAQ;QACrE,MAAMC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAASxC,QAAQ,GAAGG;QACpB,IAAI,CAACoC,wBAAwB;YAC3BC,SAASzC,aAAa;QACxB;IACF;AACF;AAEA,OAAO,SAASiB,uBAAuBb,MAA6B;IAClE,OAAON,sBACL,IAAIC,gBAAgB;QAClBK,QAAQ;YACN,GAAGA,MAAM;YACTuC,IAAIvC,QAAQuC,MAAM,IAAI9C,SAAS+C,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdtC,IAAsD;IAEtD,OAAOA,gBAAgBT;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/server/nodes/BlocksNode.tsx"],"sourcesContent":["import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMExportOutput,\n type EditorConfig,\n type ElementFormatType,\n type LexicalEditor,\n type LexicalNode,\n type NodeKey,\n} from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\ntype BaseBlockFields<TBlockFields extends JsonObject = JsonObject> = {\n /** Block form data */\n blockName: string\n blockType: string\n} & TBlockFields\n\nexport type BlockFields<TBlockFields extends JsonObject = JsonObject> = {\n id: string\n} & BaseBlockFields<TBlockFields>\n\nexport type BlockFieldsOptionalID<TBlockFields extends JsonObject = JsonObject> = {\n id?: string\n} & BaseBlockFields<TBlockFields>\n\nexport type SerializedBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: BlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedDecoratorBlockNode, 'block'>\n\nexport class ServerBlockNode extends DecoratorBlockNode {\n __cacheBuster: number\n __fields: BlockFields\n\n constructor({\n cacheBuster,\n fields,\n format,\n key,\n }: {\n cacheBuster?: number\n fields: BlockFields\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerBlockNode): ServerBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'block'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedBlockNode): ServerBlockNode {\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 = $createServerBlockNode(serializedNode.fields)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('div')\n addClassNamesToElement(element, config?.theme?.block)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedBlockNode {\n return {\n ...super.exportJSON(),\n type: 'block',\n fields: this.getFields(),\n version: 2,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): BlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n setFields(fields: BlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n}\n\nexport function $createServerBlockNode(fields: BlockFieldsOptionalID): ServerBlockNode {\n return $applyNodeReplacement(\n new ServerBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerBlockNode(\n node: LexicalNode | null | ServerBlockNode | undefined,\n): node is ServerBlockNode {\n return node instanceof ServerBlockNode\n}\n"],"names":["DecoratorBlockNode","addClassNamesToElement","ObjectID","$applyNodeReplacement","ServerBlockNode","__cacheBuster","__fields","cacheBuster","fields","format","key","clone","node","__format","__key","getType","importDOM","importJSON","serializedNode","version","data","$createServerBlockNode","setFormat","isInline","createDOM","config","element","document","createElement","theme","block","decorate","editor","exportDOM","text","createTextNode","getTextContent","append","exportJSON","type","getFields","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","id","default","toHexString","$isServerBlockNode"],"mappings":"AAIA,SA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AC;QAEvC,MAAMM,OAAOP,SAASQ,cAAc,CAAC,IAAI,CAACC,cAAc;QACxDV,QAAQW,MAAM,CAACH;QACf,OAAO;YAAER;QAAQ;IACnB;IAESY,aAAkC;QACzC,OAAO;YACL,GAAG,KAAK,CAACA,YAAY;YACrBC,MAAM;YACN/B,QAAQ,IAAI,CAACgC,SAAS;YACtBrB,SAAS;QACX;IACF;IAEAsB,iBAAyB;QACvB,OAAO,IAAI,CAACC,SAAS,GAAGrC,aAAa;IACvC;IAEAmC,YAAyB;QACvB,OAAO,IAAI,CAACE,SAAS,GAAGpC,QAAQ;IAClC;IAES8B,iBAAyB;QAChC,OAAO,CAAC,WAAW,CAAC;IACtB;IAEAO,UAAUnC,MAAmB,EAAEoC,sBAAgC,EAAQ;QACrE,MAAMC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAASvC,QAAQ,GAAGE;QACpB,IAAI,CAACoC,wBAAwB;YAC3BC,SAASxC,aAAa;QACxB;IACF;AACF;AAEA,OAAO,SAASgB,uBAAuBb,MAA6B;IAClE,OAAOL,sBACL,IAAIC,gBAAgB;QAClBI,QAAQ;YACN,GAAGA,MAAM;YACTuC,IAAIvC,QAAQuC,MAAM,IAAI7C,SAAS8C,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,mBACdtC,IAAsD;IAEtD,OAAOA,gBAAgBR;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],"names":["addClassNamesToElement","ObjectID","$applyNodeReplacement","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","constructor","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","config","element","document","createElement","theme","inlineBlock","decorate","editor","exportDOM","classList","add","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlockNode"],"mappings":"AAaA,SAASA,sBAAsB,QAAQ,iBAAgB;AACvD,OAAOC,cAAc,gBAAe;AACpC,SAASC,qBAAqB,EAAEC,aAAa,QAAQ,UAAS;AAa9D,OAAO,MAAMC,8BAA8BD;IACzCE,cAAqB;IACrBC,SAA2B;IAE3BC,YAAY,EACVC,WAAW,EACXC,MAAM,EACNC,GAAG,EAKJ,CAAE;QACD,KAAK,CAACA;QACN,IAAI,CAACJ,QAAQ,GAAGG;QAChB,IAAI,CAACJ,aAAa,GAAGG,eAAe;IACtC;IAEA,OAAgBG,MAAMC,IAA2B,EAAyB;QACxE,OAAO,IAAI,IAAI,CAAC;YACdJ,aAAaI,KAAKP,aAAa;YAC/BI,QAAQG,KAAKN,QAAQ;YACrBI,KAAKE,KAAKC,KAAK;QACjB;IACF;IAEA,OAAgBC,UAA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YACN,GAAGA,MAAM;YACTuC,IAAIvC,QAAQuC,MAAM,IAAI/C,SAASgD,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,yBACdvC,IAA4D;IAE5D,OAAOA,gBAAgBR;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],"sourcesContent":["import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement, DecoratorNode } from 'lexical'\n\nimport type { StronglyTypedLeafNode } from '../../../../nodeTypes.js'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = {\n fields: InlineBlockFields<TBlockFields>\n} & StronglyTypedLeafNode<SerializedLexicalNode, 'inlineBlock'>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n\n override createDOM(config?: EditorConfig): HTMLElement {\n const element = document.createElement('span')\n addClassNamesToElement(element, config?.theme?.inlineBlock)\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return $applyNodeReplacement(\n new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n }),\n )\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],"names":["addClassNamesToElement","ObjectID","$applyNodeReplacement","DecoratorNode","ServerInlineBlockNode","__cacheBuster","__fields","cacheBuster","fields","key","clone","node","__key","getType","importDOM","importJSON","serializedNode","$createServerInlineBlockNode","isInline","canIndent","createDOM","config","element","document","createElement","theme","inlineBlock","decorate","editor","exportDOM","classList","add","text","createTextNode","getTextContent","append","exportJSON","type","getFields","version","getCacheBuster","getLatest","setFields","preventFormStateUpdate","writable","getWritable","updateDOM","id","default","toHexString","$isServerInlineBlock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;IAEAC,iBAAyB;QACvB,OAAO,IAAI,CAACC,SAAS,GAAGpC,aAAa;IACvC;IAEAiC,YAA+B;QAC7B,OAAO,IAAI,CAACG,SAAS,GAAGnC,QAAQ;IAClC;IAES4B,iBAAyB;QAChC,OAAO,CAAC,WAAW,CAAC;IACtB;IAEShB,WAAW;QAClB,OAAO;IACT;IAEAwB,UAAUlC,MAAyB,EAAEmC,sBAAgC,EAAQ;QAC3E,MAAMC,WAAW,IAAI,CAACC,WAAW;QACjCD,SAAStC,QAAQ,GAAGE;QACpB,IAAI,CAACmC,wBAAwB;YAC3BC,SAASvC,aAAa;QACxB;IACF;IAESyC,YAAqB;QAC5B,OAAO;IACT;AACF;AAEA,OAAO,SAAS7B,6BACdT,MAAwC;IAExC,OAAON,sBACL,IAAIE,sBAAsB;QACxBI,QAAQ;YACN,GAAGA,MAAM;YACTuC,IAAIvC,QAAQuC,MAAM,IAAI9C,SAAS+C,OAAO,GAAGC,WAAW;QACtD;IACF;AAEJ;AAEA,OAAO,SAASC,yBACdvC,IAA4D;IAE5D,OAAOA,gBAAgBP;AACzB"}
@@ -1,5 +1,3 @@
1
- import { jsxDEV as _jsxDEV, Fragment as _Fragment } from "react/jsx-dev-runtime";
2
- import React from 'react';
3
1
  import { defaultJSXConverters } from '../converter/defaultConverters.js';
4
2
  import { convertLexicalToJSX } from '../converter/index.js';
5
3
  /**
@@ -37,18 +35,9 @@ import { convertLexicalToJSX } from '../converter/index.js';
37
35
  disableTextAlign
38
36
  });
39
37
  if (disableContainer) {
40
- return /*#__PURE__*/ _jsxDEV(_Fragment, {
41
- children: content
42
- }, void 0, false);
38
+ return <>{content}</>;
43
39
  }
44
- return /*#__PURE__*/ _jsxDEV("div", {
45
- className: className ?? 'payload-richtext',
46
- children: content
47
- }, void 0, false, {
48
- fileName: "src/features/converters/lexicalToJSX/Component/index.tsx",
49
- lineNumber: 88,
50
- columnNumber: 10
51
- }, this);
40
+ return <div className={className ?? 'payload-richtext'}>{content}</div>;
52
41
  };
53
42
 
54
43
  //# sourceMappingURL=index.js.map