@payloadcms/richtext-lexical 4.0.0-canary.2 → 4.0.0-canary.21

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 (552) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts.map +1 -1
  3. package/dist/cell/rscEntry.js +5 -5
  4. package/dist/cell/rscEntry.js.map +1 -1
  5. package/dist/exports/client/Field-F22V5L4V.js +2 -0
  6. package/dist/exports/client/Field-F22V5L4V.js.map +7 -0
  7. package/dist/exports/client/bundled.css +1 -1
  8. package/dist/exports/client/chunk-43E5QYAA.js +2 -0
  9. package/dist/exports/client/chunk-43E5QYAA.js.map +7 -0
  10. package/dist/exports/client/{chunk-CUFJGFNW.js → chunk-ESITTE3C.js} +2 -2
  11. package/dist/exports/client/{chunk-CUFJGFNW.js.map → chunk-ESITTE3C.js.map} +2 -2
  12. package/dist/exports/client/chunk-LN6VX25I.js +2 -0
  13. package/dist/exports/client/chunk-LN6VX25I.js.map +7 -0
  14. package/dist/exports/client/component-D5QLYS7W.js +2 -0
  15. package/dist/exports/client/component-D5QLYS7W.js.map +7 -0
  16. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  17. package/dist/exports/client/index.d.ts +1 -2
  18. package/dist/exports/client/index.d.ts.map +1 -1
  19. package/dist/exports/client/index.js +27 -28
  20. package/dist/exports/client/index.js.map +4 -4
  21. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  22. package/dist/features/blockquote/client/index.js +2 -2
  23. package/dist/features/blockquote/client/index.js.map +1 -1
  24. package/dist/features/blockquote/server/index.js +2 -2
  25. package/dist/features/blockquote/server/index.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.css +2 -2
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  29. package/dist/features/blocks/client/componentInline/index.css +8 -8
  30. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  31. package/dist/features/blocks/client/getBlockImageComponent.d.ts +1 -1
  32. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  33. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  34. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  35. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  36. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  37. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  38. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  39. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  40. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  41. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  42. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  43. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  44. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  45. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  46. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  47. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  48. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  49. package/dist/features/blocks/server/index.js +2 -2
  50. package/dist/features/blocks/server/index.js.map +1 -1
  51. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  52. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  53. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  54. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  55. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  56. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  57. package/dist/features/blocks/server/schema.js +3 -2
  58. package/dist/features/blocks/server/schema.js.map +1 -1
  59. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  60. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  61. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  62. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  63. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  64. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  65. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  66. package/dist/features/converters/markdownToLexical/index.js +5 -2
  67. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  68. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  69. package/dist/features/debug/testRecorder/client/plugin/index.css +0 -1
  70. package/dist/features/format/bold/feature.client.js +1 -1
  71. package/dist/features/format/bold/feature.client.js.map +1 -1
  72. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  73. package/dist/features/format/bold/feature.server.js +1 -1
  74. package/dist/features/format/bold/feature.server.js.map +1 -1
  75. package/dist/features/format/inlineCode/feature.client.js +1 -1
  76. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  77. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  78. package/dist/features/format/inlineCode/feature.server.js +1 -1
  79. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  80. package/dist/features/format/italic/feature.client.js +1 -1
  81. package/dist/features/format/italic/feature.client.js.map +1 -1
  82. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  83. package/dist/features/format/italic/feature.server.js +1 -1
  84. package/dist/features/format/italic/feature.server.js.map +1 -1
  85. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  86. package/dist/features/format/strikethrough/feature.client.js +1 -1
  87. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  88. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  89. package/dist/features/format/strikethrough/feature.server.js +1 -1
  90. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  91. package/dist/features/heading/client/index.js +2 -2
  92. package/dist/features/heading/client/index.js.map +1 -1
  93. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  94. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  95. package/dist/features/heading/markdownTransformer.js +6 -19
  96. package/dist/features/heading/markdownTransformer.js.map +1 -1
  97. package/dist/features/heading/server/index.js +2 -2
  98. package/dist/features/heading/server/index.js.map +1 -1
  99. package/dist/features/heading/server/schema.d.ts.map +1 -1
  100. package/dist/features/horizontalRule/client/index.js +2 -2
  101. package/dist/features/horizontalRule/client/index.js.map +1 -1
  102. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  103. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  104. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  105. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  106. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  107. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  108. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +1 -1
  109. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  110. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  111. package/dist/features/horizontalRule/server/index.js +2 -2
  112. package/dist/features/horizontalRule/server/index.js.map +1 -1
  113. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  114. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  115. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  116. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  117. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -1
  118. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  119. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  120. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  121. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  122. package/dist/features/link/client/index.js +2 -2
  123. package/dist/features/link/client/index.js.map +1 -1
  124. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  125. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  126. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  127. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -12
  128. package/dist/features/link/markdownTransformer.d.ts +4 -4
  129. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  130. package/dist/features/link/markdownTransformer.js +2 -2
  131. package/dist/features/link/markdownTransformer.js.map +1 -1
  132. package/dist/features/link/markdownTransformer.spec.js +10 -10
  133. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  134. package/dist/features/link/nodes/AutoLinkNode.d.ts +1 -1
  135. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  136. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  137. package/dist/features/link/nodes/LinkNode.d.ts +1 -1
  138. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  139. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  140. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  141. package/dist/features/link/server/baseFields.js.map +1 -1
  142. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  143. package/dist/features/link/server/index.js +4 -4
  144. package/dist/features/link/server/index.js.map +1 -1
  145. package/dist/features/link/server/schema.d.ts.map +1 -1
  146. package/dist/features/link/server/schema.js +4 -2
  147. package/dist/features/link/server/schema.js.map +1 -1
  148. package/dist/features/link/server/validate.d.ts.map +1 -1
  149. package/dist/features/lists/checklist/client/index.js +1 -1
  150. package/dist/features/lists/checklist/client/index.js.map +1 -1
  151. package/dist/features/lists/checklist/server/index.js +1 -1
  152. package/dist/features/lists/checklist/server/index.js.map +1 -1
  153. package/dist/features/lists/orderedList/client/index.js +1 -1
  154. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  155. package/dist/features/lists/orderedList/server/index.js +1 -1
  156. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  157. package/dist/features/lists/unorderedList/client/index.js +1 -1
  158. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  159. package/dist/features/lists/unorderedList/server/index.js +1 -1
  160. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  161. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  162. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  163. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  164. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  165. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  166. package/dist/features/relationship/server/schema.d.ts +3 -3
  167. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  168. package/dist/features/relationship/server/schema.js +22 -5
  169. package/dist/features/relationship/server/schema.js.map +1 -1
  170. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  171. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  172. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  173. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  174. package/dist/features/table/client/index.d.ts.map +1 -0
  175. package/dist/features/{experimental_table → table}/client/index.js +2 -2
  176. package/dist/features/table/client/index.js.map +1 -0
  177. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -0
  178. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -0
  179. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -0
  180. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -0
  181. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
  182. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  183. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  184. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  185. package/dist/features/table/client/plugins/TablePlugin/index.d.ts.map +1 -0
  186. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -0
  187. package/dist/features/table/client/utils/debounce.d.ts.map +1 -0
  188. package/dist/features/table/client/utils/debounce.js.map +1 -0
  189. package/dist/features/table/client/utils/useDebounce.d.ts.map +1 -0
  190. package/dist/features/table/client/utils/useDebounce.js.map +1 -0
  191. package/dist/features/table/markdownTransformer.d.ts +5 -0
  192. package/dist/features/table/markdownTransformer.d.ts.map +1 -0
  193. package/dist/features/{experimental_table → table}/markdownTransformer.js +6 -3
  194. package/dist/features/table/markdownTransformer.js.map +1 -0
  195. package/dist/features/table/server/index.d.ts +3 -0
  196. package/dist/features/table/server/index.d.ts.map +1 -0
  197. package/dist/features/{experimental_table → table}/server/index.js +6 -6
  198. package/dist/features/table/server/index.js.map +1 -0
  199. package/dist/features/table/server/schema.d.ts.map +1 -0
  200. package/dist/features/table/server/schema.js.map +1 -0
  201. package/dist/features/textState/feature.client.js +1 -1
  202. package/dist/features/textState/feature.client.js.map +1 -1
  203. package/dist/features/toolbars/fixed/client/Toolbar/index.css +4 -6
  204. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -14
  205. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  206. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -14
  207. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  208. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  209. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  210. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  211. package/dist/features/typesClient.d.ts +1 -1
  212. package/dist/features/typesClient.d.ts.map +1 -1
  213. package/dist/features/typesClient.js.map +1 -1
  214. package/dist/features/typesServer.d.ts +3 -3
  215. package/dist/features/typesServer.d.ts.map +1 -1
  216. package/dist/features/typesServer.js.map +1 -1
  217. package/dist/features/upload/client/component/index.css +9 -9
  218. package/dist/features/upload/client/component/index.js +2 -1
  219. package/dist/features/upload/client/component/index.js.map +1 -1
  220. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  221. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  222. package/dist/features/upload/client/plugin/index.js +5 -5
  223. package/dist/features/upload/client/plugin/index.js.map +1 -1
  224. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  225. package/dist/features/upload/server/index.js +4 -4
  226. package/dist/features/upload/server/index.js.map +1 -1
  227. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  228. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  229. package/dist/features/upload/server/markdownTransformer.js +1 -1
  230. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  231. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  232. package/dist/features/upload/server/schema.d.ts +4 -4
  233. package/dist/features/upload/server/schema.d.ts.map +1 -1
  234. package/dist/features/upload/server/schema.js +26 -6
  235. package/dist/features/upload/server/schema.js.map +1 -1
  236. package/dist/features/upload/server/validate.d.ts.map +1 -1
  237. package/dist/field/Diff/converters/unknown/index.css +1 -1
  238. package/dist/field/Field.d.ts.map +1 -1
  239. package/dist/field/Field.js +18 -15
  240. package/dist/field/Field.js.map +1 -1
  241. package/dist/field/ViewSelector.css +1 -1
  242. package/dist/field/bundled.css +1 -1
  243. package/dist/field/index.css +5 -9
  244. package/dist/field/index.js +1 -1
  245. package/dist/field/index.js.map +1 -1
  246. package/dist/field/rscEntry.d.ts.map +1 -1
  247. package/dist/field/rscEntry.js +2 -0
  248. package/dist/field/rscEntry.js.map +1 -1
  249. package/dist/i18n.d.ts.map +1 -1
  250. package/dist/i18n.js +68 -0
  251. package/dist/i18n.js.map +1 -1
  252. package/dist/index.d.ts +3 -3
  253. package/dist/index.d.ts.map +1 -1
  254. package/dist/index.js +7 -7
  255. package/dist/index.js.map +1 -1
  256. package/dist/lexical/LexicalEditor.css +18 -18
  257. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  258. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  259. package/dist/lexical/config/client/loader.js +5 -1
  260. package/dist/lexical/config/client/loader.js.map +1 -1
  261. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  262. package/dist/lexical/config/server/loader.d.ts +1 -1
  263. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  264. package/dist/lexical/config/server/loader.js +2 -2
  265. package/dist/lexical/config/server/loader.js.map +1 -1
  266. package/dist/lexical/config/server/sanitize.d.ts +1 -1
  267. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  268. package/dist/lexical/config/server/sanitize.js +2 -2
  269. package/dist/lexical/config/server/sanitize.js.map +1 -1
  270. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  271. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +16 -24
  272. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  273. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +27 -14
  274. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  275. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  276. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  277. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  278. package/dist/lexical/plugins/NodeViewOverridePlugin/index.d.ts.map +1 -1
  279. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js +21 -0
  280. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  281. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +0 -1
  282. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  283. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -20
  284. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  285. package/dist/lexical/plugins/SlashMenu/index.css +1 -6
  286. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  287. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  288. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +4 -3
  289. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  290. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  291. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  292. package/dist/lexical/theme/EditorTheme.css +18 -19
  293. package/dist/lexical/ui/ContentEditable.css +22 -17
  294. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  295. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  296. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  297. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  298. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  299. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  300. package/dist/lexical/utils/markdown/createBlockNode.d.ts +2 -2
  301. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  302. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  303. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  304. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  305. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  306. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  307. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  308. package/dist/lexical/utils/point.d.ts.map +1 -1
  309. package/dist/lexical/utils/rect.d.ts.map +1 -1
  310. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  311. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  312. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  313. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  314. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts +2 -0
  315. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.d.ts.map +1 -0
  316. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js +2 -0
  317. package/dist/lexical-proxy/@lexical-react/ExtensionComponent.js.map +1 -0
  318. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts +2 -0
  319. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.d.ts.map +1 -0
  320. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js +2 -0
  321. package/dist/lexical-proxy/@lexical-react/LexicalExtensionComposer.js.map +1 -0
  322. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts +2 -0
  323. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.d.ts.map +1 -0
  324. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js +2 -0
  325. package/dist/lexical-proxy/@lexical-react/LexicalExtensionEditorComposer.js.map +1 -0
  326. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts +2 -0
  327. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.d.ts.map +1 -0
  328. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js +2 -0
  329. package/dist/lexical-proxy/@lexical-react/LexicalSelectionAlwaysOnDisplay.js.map +1 -0
  330. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts +2 -0
  331. package/dist/lexical-proxy/@lexical-react/ReactExtension.d.ts.map +1 -0
  332. package/dist/lexical-proxy/@lexical-react/ReactExtension.js +2 -0
  333. package/dist/lexical-proxy/@lexical-react/ReactExtension.js.map +1 -0
  334. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts +2 -0
  335. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.d.ts.map +1 -0
  336. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js +2 -0
  337. package/dist/lexical-proxy/@lexical-react/ReactPluginHostExtension.js.map +1 -0
  338. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts +2 -0
  339. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.d.ts.map +1 -0
  340. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js +2 -0
  341. package/dist/lexical-proxy/@lexical-react/ReactProviderExtension.js.map +1 -0
  342. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts +2 -0
  343. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.d.ts.map +1 -0
  344. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js +2 -0
  345. package/dist/lexical-proxy/@lexical-react/TreeViewExtension.js.map +1 -0
  346. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts +2 -0
  347. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.d.ts.map +1 -0
  348. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js +2 -0
  349. package/dist/lexical-proxy/@lexical-react/useExtensionComponent.js.map +1 -0
  350. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts +2 -0
  351. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.d.ts.map +1 -0
  352. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js +2 -0
  353. package/dist/lexical-proxy/@lexical-react/useExtensionSignalValue.js.map +1 -0
  354. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts +2 -0
  355. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.d.ts.map +1 -0
  356. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js +2 -0
  357. package/dist/lexical-proxy/@lexical-react/useLexicalAriaLiveRegion.js.map +1 -0
  358. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts +2 -0
  359. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.d.ts.map +1 -0
  360. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js +2 -0
  361. package/dist/lexical-proxy/@lexical-react/useLexicalFocusManagerRef.js.map +1 -0
  362. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts +2 -0
  363. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.d.ts.map +1 -0
  364. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js +2 -0
  365. package/dist/lexical-proxy/@lexical-react/useLexicalFocusTrapRef.js.map +1 -0
  366. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts +2 -0
  367. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.d.ts.map +1 -0
  368. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js +2 -0
  369. package/dist/lexical-proxy/@lexical-react/useLexicalRovingTabIndexRef.js.map +1 -0
  370. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts +2 -0
  371. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.d.ts.map +1 -0
  372. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js +2 -0
  373. package/dist/lexical-proxy/@lexical-react/useLexicalSlotRef.js.map +1 -0
  374. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  375. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  376. package/dist/types/index.d.ts +3 -3
  377. package/dist/types/index.d.ts.map +1 -1
  378. package/dist/types/index.js.map +1 -1
  379. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  380. package/dist/types/nodeTypes.d.ts +1 -1
  381. package/dist/types/nodeTypes.d.ts.map +1 -1
  382. package/dist/types/nodeTypes.js.map +1 -1
  383. package/dist/types/schema.d.ts.map +1 -1
  384. package/dist/types/schema.js +12 -5
  385. package/dist/types/schema.js.map +1 -1
  386. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  387. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  388. package/dist/utilities/buildInitialState.d.ts +2 -1
  389. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  390. package/dist/utilities/buildInitialState.js.map +1 -1
  391. package/dist/utilities/createServerFeature.d.ts +1 -1
  392. package/dist/utilities/createServerFeature.d.ts.map +1 -1
  393. package/dist/utilities/createServerFeature.js +2 -2
  394. package/dist/utilities/createServerFeature.js.map +1 -1
  395. package/dist/utilities/editorConfigFactory.d.ts +6 -6
  396. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  397. package/dist/utilities/editorConfigFactory.js +9 -9
  398. package/dist/utilities/editorConfigFactory.js.map +1 -1
  399. package/dist/utilities/fieldsDrawer/index.css +0 -4
  400. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +1 -1
  401. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -1
  402. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  403. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  404. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  405. package/dist/utilities/generateImportMap.d.ts +1 -1
  406. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  407. package/dist/utilities/generateSchemaMap.d.ts +1 -1
  408. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  409. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts +2 -2
  410. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  411. package/dist/utilities/getDefaultSanitizedEditorConfig.js +6 -17
  412. package/dist/utilities/getDefaultSanitizedEditorConfig.js.map +1 -1
  413. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  414. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  415. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  416. package/dist/validate/index.d.ts.map +1 -1
  417. package/package.json +96 -27
  418. package/dist/exports/client/Field-G5Z2HM5Y.js +0 -2
  419. package/dist/exports/client/Field-G5Z2HM5Y.js.map +0 -7
  420. package/dist/exports/client/chunk-LH634DPU.js +0 -12
  421. package/dist/exports/client/chunk-LH634DPU.js.map +0 -7
  422. package/dist/exports/client/chunk-UD4DQ4AK.js +0 -2
  423. package/dist/exports/client/chunk-UD4DQ4AK.js.map +0 -7
  424. package/dist/exports/client/component-PHZQBOJE.js +0 -2
  425. package/dist/exports/client/component-PHZQBOJE.js.map +0 -7
  426. package/dist/exports/client/componentInline-DV4EGOWU.js +0 -2
  427. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  428. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  429. package/dist/features/blockquote/markdownTransformer.js +0 -33
  430. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  431. package/dist/features/experimental_table/client/index.d.ts.map +0 -1
  432. package/dist/features/experimental_table/client/index.js.map +0 -1
  433. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +0 -1
  434. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +0 -1
  435. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +0 -1
  436. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +0 -1
  437. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  438. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +0 -1
  439. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +0 -1
  440. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +0 -1
  441. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +0 -1
  442. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +0 -1
  443. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +0 -1
  444. package/dist/features/experimental_table/client/utils/debounce.js.map +0 -1
  445. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +0 -1
  446. package/dist/features/experimental_table/client/utils/useDebounce.js.map +0 -1
  447. package/dist/features/experimental_table/markdownTransformer.d.ts +0 -5
  448. package/dist/features/experimental_table/markdownTransformer.d.ts.map +0 -1
  449. package/dist/features/experimental_table/markdownTransformer.js.map +0 -1
  450. package/dist/features/experimental_table/server/index.d.ts +0 -3
  451. package/dist/features/experimental_table/server/index.d.ts.map +0 -1
  452. package/dist/features/experimental_table/server/index.js.map +0 -1
  453. package/dist/features/experimental_table/server/schema.d.ts.map +0 -1
  454. package/dist/features/experimental_table/server/schema.js.map +0 -1
  455. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  456. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  457. package/dist/features/format/bold/markdownTransformers.js +0 -23
  458. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  459. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  460. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  461. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  462. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  463. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  464. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  465. package/dist/features/format/italic/markdownTransformers.js +0 -12
  466. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  467. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  468. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  469. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  470. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  471. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  472. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  473. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  474. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  475. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  476. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  477. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  478. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  479. package/dist/features/lists/shared/markdown.d.ts +0 -6
  480. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  481. package/dist/features/lists/shared/markdown.js +0 -57
  482. package/dist/features/lists/shared/markdown.js.map +0 -1
  483. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  484. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  485. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  486. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  487. package/dist/lexical/utils/guard.d.ts +0 -5
  488. package/dist/lexical/utils/guard.d.ts.map +0 -1
  489. package/dist/lexical/utils/guard.js +0 -9
  490. package/dist/lexical/utils/guard.js.map +0 -1
  491. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  492. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  493. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  494. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  495. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  496. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  497. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  498. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  499. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  500. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  501. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  502. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  503. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  504. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  505. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  506. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  507. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  508. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  509. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  510. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  511. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  512. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  513. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  514. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  515. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  516. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  517. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  518. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  519. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  520. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  521. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  522. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  523. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  524. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  525. package/dist/packages/@lexical/markdown/index.js +0 -39
  526. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  527. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  528. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  529. package/dist/packages/@lexical/markdown/utils.js +0 -267
  530. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  531. /package/dist/exports/client/{componentInline-DV4EGOWU.js.map → componentInline-H24N7GUG.js.map} +0 -0
  532. /package/dist/features/{experimental_table → table}/client/index.d.ts +0 -0
  533. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.css +0 -0
  534. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.d.ts +0 -0
  535. /package/dist/features/{experimental_table → table}/client/plugins/TableActionMenuPlugin/index.js +0 -0
  536. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.css +0 -0
  537. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.d.ts +0 -0
  538. /package/dist/features/{experimental_table → table}/client/plugins/TableCellResizerPlugin/index.js +0 -0
  539. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -0
  540. /package/dist/features/{experimental_table → table}/client/plugins/TableHoverActionsPlugin/index.js +0 -0
  541. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.css +0 -0
  542. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.d.ts +0 -0
  543. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/TableGridPopup/index.js +0 -0
  544. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.css +0 -0
  545. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.d.ts +0 -0
  546. /package/dist/features/{experimental_table → table}/client/plugins/TablePlugin/index.js +0 -0
  547. /package/dist/features/{experimental_table → table}/client/utils/debounce.d.ts +0 -0
  548. /package/dist/features/{experimental_table → table}/client/utils/debounce.js +0 -0
  549. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.d.ts +0 -0
  550. /package/dist/features/{experimental_table → table}/client/utils/useDebounce.js +0 -0
  551. /package/dist/features/{experimental_table → table}/server/schema.d.ts +0 -0
  552. /package/dist/features/{experimental_table → table}/server/schema.js +0 -0
@@ -0,0 +1,2 @@
1
+ import{a as P,b as T}from"./chunk-5VIL27GI.js";import{b as I}from"./chunk-RJ5MAOKZ.js";import{c as rt}from"react/compiler-runtime";import{jsx as R}from"react/jsx-runtime";import{Drawer as nt,EditDepthProvider as ot,useModal as at}from"@payloadcms/ui";import"react";import{jsx as F,jsxs as G}from"react/jsx-runtime";import{useLexicalEditable as V}from"@lexical/react/useLexicalEditable";import{Form as q,RenderFields as Q,useDocumentForm as X,useDocumentInfo as Y,useServerFunctions as Z}from"@payloadcms/ui";import{abortAndIgnore as y}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as j}from"payload/shared";import{useCallback as N,useEffect as M,useRef as z,useState as tt}from"react";import{v4 as et}from"uuid";var U=({data:r,featureKey:t,fieldMapOverride:e,handleDrawerSubmit:n,schemaFieldsPathOverride:o,schemaPath:D,schemaPathSuffix:f,submitRef:b})=>{let{id:i,collectionSlug:s,getDocPreferences:l,globalSlug:c}=Y(),{fields:u}=X(),a=V(),d=z(new AbortController),[g,m]=tt(!1),{fieldProps:{featureClientSchemaMap:x}}=I(),{getFormState:h}=Z(),p=o??`${D}.lexical_internal_feature.${t}${f?`.${f}`:""}`,v=e??x[t]?.[p];M(()=>{let S=new AbortController;return(async()=>{let{state:w}=await h({id:i,collectionSlug:s,data:r??{},docPermissions:{fields:!0},docPreferences:await l(),documentFormState:j(u,{excludeFiles:!0}),globalSlug:c,initialBlockData:r,operation:"update",readOnly:!a,renderAllFields:!0,schemaPath:p,signal:S.signal});m(w)})(),()=>{y(S)}},[p,i,r,h,s,a,c,l,u]);let E=N(async({formState:S})=>{y(d.current);let C=new AbortController;d.current=C;let{state:w}=await h({id:i,collectionSlug:s,docPermissions:{fields:!0},docPreferences:await l(),documentFormState:j(u,{excludeFiles:!0}),formState:S,globalSlug:c,initialBlockFormState:S,operation:"update",readOnly:!a,schemaPath:p,signal:C.signal});return w||S},[h,i,a,s,l,u,c,p]);return M(()=>()=>{y(d.current)},[]),g===!1?null:G(q,{beforeSubmit:[E],className:"fields-drawer",disableValidationOnSubmit:!0,fields:Array.isArray(v)?v:[],initialState:g,onChange:[E],onSubmit:n,uuid:et(),children:[F(Q,{fields:Array.isArray(v)?v:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:p,permissions:!0,readOnly:!a}),F(T,{submitRef:b})]})};var Tt=r=>{let t=rt(17),{className:e,data:n,drawerSlug:o,drawerTitle:D,featureKey:f,fieldMapOverride:b,handleDrawerSubmit:i,schemaFieldsPathOverride:s,schemaPath:l,schemaPathSuffix:c}=r,{closeModal:u}=at(),{headerActions:a,submitRef:d}=P(),g=D??"",m;t[0]!==u||t[1]!==o||t[2]!==i?(m=(h,p)=>{u(o),setTimeout(()=>{i(h,p)},1)},t[0]=u,t[1]=o,t[2]=i,t[3]=m):m=t[3];let x;return t[4]!==e||t[5]!==n||t[6]!==o||t[7]!==f||t[8]!==b||t[9]!==a||t[10]!==s||t[11]!==l||t[12]!==c||t[13]!==d||t[14]!==g||t[15]!==m?(x=R(ot,{children:R(nt,{className:e,headerActions:a,slug:o,title:g,children:R(U,{data:n,featureKey:f,fieldMapOverride:b,handleDrawerSubmit:m,schemaFieldsPathOverride:s,schemaPath:l,schemaPathSuffix:c,submitRef:d})})}),t[4]=e,t[5]=n,t[6]=o,t[7]=f,t[8]=b,t[9]=a,t[10]=s,t[11]=l,t[12]=c,t[13]=d,t[14]=g,t[15]=m,t[16]=x):x=t[16],x};import{createCommand as it}from"lexical";var Mt=it("INSERT_UPLOAD_WITH_DRAWER_COMMAND");import{jsx as L}from"react/jsx-runtime";import B from"bson-objectid";import{$applyNodeReplacement as pt}from"lexical";import*as K from"react";import st from"bson-objectid";function A(r,t){if(r.hasAttribute("data-lexical-pending-upload-form-id")){let n=r.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:t({data:{pending:{formID:n,src:r.getAttribute("src")||""}}})}}if(r.hasAttribute("data-lexical-upload-relation-to")&&r.hasAttribute("data-lexical-upload-id")){let n=r.getAttribute("data-lexical-upload-id"),o=r.getAttribute("data-lexical-upload-relation-to");if(n!=null&&o!=null)return{node:t({data:{fields:{},relationTo:o,value:n}})}}return{node:t({data:{pending:{formID:new st.default().toHexString(),src:r.getAttribute("src")||""}}})}}import{DecoratorBlockNode as lt}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as ct}from"@lexical/utils";import k from"bson-objectid";import{$applyNodeReplacement as ut}from"lexical";var _=class extends lt{__data;constructor({data:t,format:e,key:n}){super(e,n),this.__data=t}static clone(t){return new this({data:t.__data,format:t.__format,key:t.__key})}static getType(){return"upload"}static importDOM(){return{img:t=>({conversion:e=>A(e,$),priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new k.default().toHexString(),t.version=3);let e={id:t.id,fields:t.fields,pending:t.pending,relationTo:t.relationTo,value:t.value},n=$({data:e});return n.setFormat(t.format),n}static isInline(){return!1}createDOM(t){let e=document.createElement("div");return ct(e,t?.theme?.upload),e}decorate(){return null}exportDOM(){let t=document.createElement("img"),e=this.__data;return e.pending?(t.setAttribute("data-lexical-pending-upload-form-id",String(e?.pending?.formID)),t.setAttribute("src",e?.pending?.src||"")):(t.setAttribute("data-lexical-upload-id",String(e?.value)),t.setAttribute("data-lexical-upload-relation-to",e?.relationTo)),{element:t}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(t){let e=this.getWritable();e.__data=t}updateDOM(){return!1}};function $({data:r}){return r?.id||(r.id=new k.default().toHexString()),ut(new _({data:r}))}import{jsx as H}from"react/jsx-runtime";import{ShimmerEffect as mt}from"@payloadcms/ui";var J=()=>H("div",{className:"lexical-upload",children:H(mt,{height:"95px",width:"203px"})});var dt=K.lazy(()=>import("./component-D5QLYS7W.js").then(r=>({default:r.UploadComponent}))),O=class extends _{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{img:t=>({conversion:e=>A(e,W),priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new B.default().toHexString(),t.version=3);let e={id:t.id,fields:t.fields,pending:t.pending,relationTo:t.relationTo,value:t.value},n=W({data:e});return n.setFormat(t.format),n}decorate(t,e){return this.__data.pending?L(J,{}):L(dt,{className:e?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function W({data:r}){return r?.id||(r.id=new B.default().toHexString()),pt(new O({data:r}))}function te(r){return r instanceof O}export{Tt as a,Mt as b,O as c,W as d,te as e};
2
+ //# sourceMappingURL=chunk-43E5QYAA.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/upload/client/drawer/commands.ts", "../../../src/features/upload/client/nodes/UploadNode.tsx", "../../../src/features/upload/server/nodes/conversions.ts", "../../../src/features/upload/server/nodes/UploadNode.tsx", "../../../src/features/upload/client/component/pending/index.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\nimport { useDrawerSubmit } from './useDrawerSubmit.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n const { headerActions, submitRef } = useDrawerSubmit()\n\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer\n className={className}\n headerActions={headerActions}\n slug={drawerSlug}\n title={drawerTitle ?? ''}\n >\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n submitRef={submitRef}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\nimport { RegisterFormSubmit } from './useDrawerSubmit.js'\nimport './index.css'\n\nexport const DrawerContent: React.FC<\n {\n submitRef: React.RefObject<(() => void) | null>\n } & Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>\n> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n submitRef,\n}) => {\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n className=\"fields-drawer\"\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <RegisterFormSubmit submitRef={submitRef} />\n </Form>\n )\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n", "'use client'\nimport type { DOMConversionMap, EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { Internal_UploadData, SerializedUploadNode, UploadData } from '../../server/schema.js'\n\nimport { $convertUploadElement } from '../../server/nodes/conversions.js'\nimport { UploadServerNode } from '../../server/nodes/UploadNode.js'\nimport { PendingUploadComponent } from '../component/pending/index.js'\n\nconst RawUploadComponent = React.lazy(() =>\n import('../../client/component/index.js').then((module) => ({ default: module.UploadComponent })),\n)\n\nexport class UploadNode extends UploadServerNode {\n static override clone(node: UploadServerNode): UploadServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: (domNode) => $convertUploadElement(domNode, $createUploadNode),\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedUploadNode): UploadNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: Internal_UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n pending: (serializedNode as Internal_UploadData).pending,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n override decorate(editor?: LexicalEditor, config?: EditorConfig): JSX.Element {\n if ((this.__data as Internal_UploadData).pending) {\n return <PendingUploadComponent />\n }\n return (\n <RawUploadComponent\n className={config?.theme?.upload ?? 'LexicalEditorTheme__upload'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedUploadNode {\n return super.exportJSON()\n }\n}\n\nexport function $createUploadNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n\n return $applyNodeReplacement(new UploadNode({ data: data as UploadData }))\n}\n\nexport function $isUploadNode(node: LexicalNode | null | undefined): node is UploadNode {\n return node instanceof UploadNode\n}\n", "// This file contains functions used to convert dom elements to upload or pending upload lexical nodes. It requires the actual node\n// creation functions to be passed in to stay compatible with both client and server code.\nimport type { DOMConversionOutput } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\n\nimport type { $createUploadNode } from '../../client/nodes/UploadNode.js'\nimport type { Internal_UploadData } from '../schema.js'\nimport type { $createUploadServerNode } from './UploadNode.js'\n\nexport function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nexport function $convertUploadElement(\n domNode: HTMLImageElement,\n $createNode: typeof $createUploadNode | typeof $createUploadServerNode,\n): DOMConversionOutput | null {\n if (domNode.hasAttribute('data-lexical-pending-upload-form-id')) {\n const formID = domNode.getAttribute('data-lexical-pending-upload-form-id')\n\n if (formID != null) {\n const node = $createNode({\n data: {\n pending: {\n formID,\n src: domNode.getAttribute('src') || '',\n },\n } as Internal_UploadData,\n })\n return { node }\n }\n }\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n\n // Create pending UploadNode. Auto-Upload functionality will then be handled by the node transform\n const node = $createNode({\n data: {\n pending: {\n formID: new ObjectID.default().toHexString(),\n src: domNode.getAttribute('src') || '',\n },\n } as Internal_UploadData,\n })\n\n return { node }\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport { addClassNamesToElement } from '@lexical/utils'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\n\nimport type { Internal_UploadData, SerializedUploadNode, UploadData } from '../schema.js'\n\nimport { $convertUploadElement } from './conversions.js'\n\nexport class UploadServerNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static override clone(node: UploadServerNode): UploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'upload'\n }\n\n static override importDOM(): DOMConversionMap<HTMLImageElement> {\n return {\n img: (node) => ({\n conversion: (domNode) => $convertUploadElement(domNode, $createUploadServerNode),\n priority: 0,\n }),\n }\n }\n\n static override importJSON(serializedNode: SerializedUploadNode): UploadServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: Internal_UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n pending: (serializedNode as Internal_UploadData).pending,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\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?.upload)\n return element\n }\n\n override decorate(): JSX.Element {\n return null as unknown as JSX.Element\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n const data = this.__data as Internal_UploadData\n if (data.pending) {\n element.setAttribute('data-lexical-pending-upload-form-id', String(data?.pending?.formID))\n element.setAttribute('src', data?.pending?.src || '')\n } else {\n element.setAttribute('data-lexical-upload-id', String(data?.value))\n element.setAttribute('data-lexical-upload-relation-to', data?.relationTo)\n }\n\n return { element }\n }\n\n override exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'upload',\n version: 3,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n override updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadServerNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadServerNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadServerNode({ data: data as UploadData }))\n}\n\nexport function $isUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is UploadServerNode {\n return node instanceof UploadServerNode\n}\n", "'use client'\n\nimport { ShimmerEffect } from '@payloadcms/ui'\n\nexport const PendingUploadComponent = (): React.ReactNode => {\n return (\n <div className={'lexical-upload'}>\n <ShimmerEffect height={'95px'} width={'203px'} />\n </div>\n )\n}\n"],
5
+ "mappings": "uFAAA,OAAAA,KAAAC,OAAA,iEAGA,OAASC,UAAAA,GAAQC,qBAAAA,GAAmBC,YAAAA,OAAgB,iBACpD,MAAkB,0DCDlB,OAASC,sBAAAA,MAA0B,oCACnC,OACEC,QAAAA,EACAC,gBAAAA,EACAC,mBAAAA,EACAC,mBAAAA,EACAC,sBAAAA,MACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAAS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AQP,EAAeO,OACvBC,QAASR,EAAwCQ,QACjDC,WAAYT,EAAeS,WAC3BP,MAAOF,EAAeE,KACxB,EAEMZ,EAAOO,EAAkB,CAAEa,KAAMJ,CAAa,CAAA,EACpDhB,OAAAA,EAAKqB,UAAUX,EAAeY,MAAM,EAE7BtB,CACT,CAESuB,SAASC,EAAwBC,EAAoC,CAC5E,OAAI,KAAMC,OAA+BR,QAChCS,EAACC,EAAA,CAAA,CAAA,EAGRD,EAACpC,GAAA,CACCsC,UAAWJ,GAAQK,OAAOC,QAAU,6BACpCX,KAAM,KAAKM,OACXJ,OAAQ,KAAKU,SACbC,QAAS,KAAKC,OAAM,GAG1B,CAESC,YAAmC,CAC1C,OAAO,MAAMA,WAAA,CACf,CACF,EAEO,SAAS5B,EAAkB,CAChCa,KAAAA,CAAI,EAGL,CACC,OAAKA,GAAMP,KACTO,EAAKP,GAAK,IAAIC,EAASnB,QAAO,EAAGoB,YAAW,GAGvCqB,GAAsB,IAAIvC,EAAW,CAAEuB,KAAMA,CAAmB,CAAA,CAAA,CACzE,CAEO,SAASiB,GAAcrC,EAAoC,CAChE,OAAOA,aAAgBH,CACzB",
6
+ "names": ["c", "_c", "Drawer", "EditDepthProvider", "useModal", "useLexicalEditable", "Form", "RenderFields", "useDocumentForm", "useDocumentInfo", "useServerFunctions", "abortAndIgnore", "deepCopyObjectSimpleWithoutReactComponents", "useCallback", "useEffect", "useRef", "useState", "v4", "uuid", "DrawerContent", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "submitRef", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "parentDocumentFields", "fields", "useDocumentForm", "useLexicalEditable", "isEditable", "onChangeAbortControllerRef", "useRef", "AbortController", "fieldProps", "useEditorConfigContext", "getFormState", "useServerFunctions", "schemaFieldsPath", "useEffect", "awaitInitialState", "state", "docPermissions", "docPreferences", "deepCopyObjectSimpleWithoutReactComponents", "documentFormState", "initialBlockData", "operation", "readOnly", "renderAllFields", "setInitialState", "abortAndIgnore", "controller", "onChange", "formState", "state_0", "prevFormState", "initialBlockFormState", "initialState", "_jsxs", "Form", "beforeSubmit", "className", "disableValidationOnSubmit", "isArray", "onSubmit", "uuid", "_jsx", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FieldsDrawer", "t0", "$", "_c", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "closeModal", "useModal", "headerActions", "submitRef", "useDrawerSubmit", "t1", "t2", "args", "args2", "setTimeout", "t3", "_jsx", "EditDepthProvider", "children", "Drawer", "slug", "title", "DrawerContent", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "ObjectID", "$applyNodeReplacement", "React", "ObjectID", "$convertUploadElement", "domNode", "$createNode", "hasAttribute", "formID", "getAttribute", "node", "data", "pending", "src", "id", "relationTo", "fields", "value", "ObjectID", "default", "toHexString", "DecoratorBlockNode", "addClassNamesToElement", "ObjectID", "$applyNodeReplacement", "UploadServerNode", "DecoratorBlockNode", "__data", "constructor", "data", "format", "key", "clone", "node", "__format", "__key", "getType", "importDOM", "img", "conversion", "domNode", "$convertUploadElement", "$createUploadServerNode", "priority", "importJSON", "serializedNode", "version", "value", "id", "ObjectID", "default", "toHexString", "importedData", "fields", "pending", "relationTo", "setFormat", "isInline", "createDOM", "config", "element", "document", "createElement", "addClassNamesToElement", "theme", "upload", "decorate", "exportDOM", "setAttribute", "String", "formID", "src", "exportJSON", "getData", "type", "getLatest", "setData", "writable", "getWritable", "updateDOM", "$applyNodeReplacement", "ShimmerEffect", "PendingUploadComponent", "_jsx", "className", "height", "width", "RawUploadComponent", "lazy", "then", "module", "default", "UploadComponent", "UploadNode", "UploadServerNode", "clone", "node", "getType", "importDOM", "img", "conversion", "domNode", "$convertUploadElement", "$createUploadNode", "priority", "importJSON", "serializedNode", "version", "value", "id", "ObjectID", "toHexString", "importedData", "fields", "pending", "relationTo", "data", "setFormat", "format", "decorate", "editor", "config", "__data", "_jsx", "PendingUploadComponent", "className", "theme", "upload", "__format", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "$isUploadNode"]
7
+ }
@@ -1,2 +1,2 @@
1
- import{a as ue,b as me,c as de}from"./chunk-5VIL27GI.js";import{b as ae}from"./chunk-RJ5MAOKZ.js";import{jsx as l,jsxs as S}from"react/jsx-runtime";import{useLexicalComposerContext as Ke}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Je}from"@lexical/react/useLexicalEditable";import{getTranslation as fe}from"@payloadcms/translations";import{Button as pe,Drawer as ze,EditDepthProvider as Ve,Form as He,formatDrawerSlug as We,RenderFields as Xe,ShimmerEffect as Ge,useConfig as Ue,useDocumentForm as qe,useDocumentInfo as Qe,useEditDepth as Ye,useServerFunctions as Ze,useTranslation as et}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as z,SKIP_DOM_SELECTION_TAG as be}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as V,reduceFieldsToValues as tt}from"payload/shared";import y,{createContext as ot,useCallback as H,useEffect as T,useMemo as B,useRef as _}from"react";import{v4 as nt}from"uuid";import{jsx as Le}from"react/jsx-runtime";import Pe from"bson-objectid";import{$applyNodeReplacement as Re}from"lexical";import je from"react";import{addClassNamesToElement as Ne}from"@lexical/utils";import Oe from"bson-objectid";import{$applyNodeReplacement as Te,DecoratorNode as Ee}from"lexical";var x=class extends Ee{__cacheBuster;__fields;constructor({cacheBuster:t,fields:e,key:i}){super(i),this.__fields=e,this.__cacheBuster=t||0}static clone(t){return new this({cacheBuster:t.__cacheBuster,fields:t.__fields,key:t.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(t){return $e(t.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(t){let e=document.createElement("span");return Ne(e,t?.theme?.inlineBlock),e}decorate(t,e){return null}exportDOM(){let t=document.createElement("span");t.classList.add("inline-block-container");let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(t,e){let i=this.getWritable();i.__fields=t,e||i.__cacheBuster++}updateDOM(){return!1}};function $e(c){return Te(new x({fields:{...c,id:c?.id||new Oe.default().toHexString()}}))}var Me=je.lazy(()=>import("./componentInline-DV4EGOWU.js").then(c=>({default:c.InlineBlockComponent}))),O=class extends x{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importJSON(t){return Ae(t.fields)}decorate(...[t,e,i,f]){return Le(Me,{cacheBuster:this.getCacheBuster(),className:e.theme.inlineBlock??"LexicalEditorTheme__inlineBlock",CustomBlock:i,CustomLabel:f,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(c){return Re(new O({fields:{...c,id:c?.id||new Pe.default().toHexString()}}))}function K(c){return c instanceof O}var he=ot({initialState:!1}),ke=()=>y.use(he),Nt=c=>{let{cacheBuster:t,className:e,CustomBlock:i,CustomLabel:f,formData:o,nodeKey:a}=c,[k]=Ke(),u=Je(),{i18n:E,t:h}=et(),{createdInlineBlock:W,fieldProps:{featureClientSchemaMap:Be,initialLexicalFormState:Ce,schemaPath:X},setCreatedInlineBlock:G,uuid:ge}=ae(),{fields:F}=qe(),{getFormState:D}=Ze(),xe=Ye(),U=_(!1),[m,$]=y.useState(()=>{let r=Ce?.[o.id]?.formState;return r?Object.fromEntries(Object.entries(r).map(([s,n])=>[s,s in o?{...n,initialValue:o[s],value:o[s]}:n])):!1}),q=_(!1),Q=_(t);T(()=>{q.current?(Q.current!==t&&$(!1),Q.current=t):q.current=!0},[t]);let[Se]=y.useState(()=>nt()),[Y,Z]=y.useState(()=>{if(!f)return m?._components?.customComponents?.BlockLabel??void 0}),[ee,te]=y.useState(()=>{if(!i)return m?._components?.customComponents?.Block??void 0}),oe=B(()=>i?l(i,{className:e,formData:o,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:ke}):ee,[i,e,o,a,ee]),L=B(()=>f?l(f,{className:e,formData:o,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:ke}):Y,[f,e,o,a,Y]),ne=We({slug:`lexical-inlineBlocks-create-${ge}-${o.id}`,depth:xe}),{toggleDrawer:b}=de(ne,!0),_e=_(null),{id:I,collectionSlug:w,getDocPreferences:v,globalSlug:N}=Qe(),{config:ye}=Ue(),Fe=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${o.blockType}`,P=Be.blocks?.[Fe]?.[0]?.blocks?.[0],d=typeof P=="string"?ye.blocksMap[P]:P,re=d?.fields??[];T(()=>{!U.current&&W?.getKey()===a&&(re.length>2&&b(),G?.(void 0),U.current=!0)},[re.length,W,a,G,b]);let se=H(()=>{k.update(()=>{z(a)?.remove()})},[k,a]),C=d?.labels?.singular?fe(d?.labels.singular,E):d?.slug,R=_(new AbortController),g=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${d?.slug}.fields`;T(()=>{let r=new AbortController;return o&&!m&&(async()=>{let{state:n}=await D({id:I,collectionSlug:w,data:o,docPermissions:{fields:!0},docPreferences:await v(),documentFormState:V(F,{excludeFiles:!0}),globalSlug:N,initialBlockData:o,initialBlockFormState:o,operation:"update",readOnly:!u,renderAllFields:!0,schemaPath:g,signal:r.signal});if(n){let p=tt(V(n,{excludeFiles:!0}),!0);k.update(()=>{let A=z(a);if(A&&K(A)){let ce=p;ce.blockType=o.blockType,A.setFields(ce,!0)}},{tag:be}),$(n),f||Z(n._components?.customComponents?.BlockLabel),i||te(n._components?.customComponents?.Block)}})(),()=>{J(r)}},[D,k,a,u,f,i,g,I,o,m,w,N,v,F]);let le=H(async({formState:r,submit:s})=>{J(R.current);let n=new AbortController;R.current=n;let{state:p}=await D({id:I,collectionSlug:w,docPermissions:{fields:!0},docPreferences:await v(),documentFormState:V(F,{excludeFiles:!0}),formState:r,globalSlug:N,initialBlockFormState:r,operation:"update",readOnly:!u,renderAllFields:!!s,schemaPath:g,signal:n.signal});return p?(s&&(f||Z(p._components?.customComponents?.BlockLabel),i||te(p._components?.customComponents?.Block)),p):r},[D,I,w,v,F,N,u,g,i,f]);T(()=>{let r=(s,n)=>Object.keys(n).some(p=>n[p]&&s[p]!==n[p].value);return()=>{m&&r(o,m)&&$(!1),J(R.current)}},[o,m]);let De=H((r,s)=>{s.blockType=o.blockType,k.update(()=>{let n=z(a);n&&K(n)&&n.setFields(s,!0)},{tag:be})},[k,a,o]),{headerActions:Ie,submitRef:we}=ue(),j=B(()=>()=>l(pe,{buttonStyle:"ghost",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:r=>{r.preventDefault(),r.stopPropagation(),se()},round:!0,size:"medium",tooltip:h("lexical:blocks:inlineBlocks:remove",{label:C})}),[e,C,u,se,h]),ve=B(()=>()=>l(pe,{buttonStyle:"ghost",className:`${e}__editButton`,disabled:!u,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"medium",tooltip:h("lexical:blocks:inlineBlocks:edit",{label:C})}),[e,C,u,h,b]),M=B(()=>({children:r,className:s})=>l("div",{className:[`${e}__container`,e+"-"+o.blockType,s].filter(Boolean).join(" "),...u?{onClick:()=>b(),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),b())},role:"button",tabIndex:0}:{},ref:_e,children:r}),[e,o.blockType,u,b]),ie=B(()=>L?()=>L:()=>l("div",{children:d?.labels?fe(d?.labels.singular,E):""}),[L,d?.labels,E]);return d?S(He,{beforeSubmit:[async({formState:r})=>await le({formState:r,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:d?.fields,initialState:m||{},onChange:[le],onSubmit:(r,s)=>{De(r,s),b()},uuid:Se,children:[l(Ve,{children:l(ze,{className:"",headerActions:Ie,slug:ne,title:h(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:C??h("lexical:blocks:inlineBlocks:label")}),children:m?S("div",{className:"fields-drawer",children:[l(Xe,{fields:d?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:g,permissions:!0,readOnly:!u}),l(me,{submitRef:we})]}):null})}),oe?l(he,{value:{EditButton:ve,initialState:m,InlineBlockContainer:M,Label:ie,nodeKey:a,RemoveButton:j},children:oe}):S(M,{children:[m?l(ie,{}):l(Ge,{height:"15px",width:"40px"}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})]}):S(M,{className:`${e}-not-found`,children:[S("span",{children:["Error: Block '",o.blockType,"' not found"]}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})};export{ke as a,Nt as b,O as c,Ae as d,K as e};
2
- //# sourceMappingURL=chunk-CUFJGFNW.js.map
1
+ import{a as ue,b as me,c as de}from"./chunk-5VIL27GI.js";import{b as ae}from"./chunk-RJ5MAOKZ.js";import{jsx as l,jsxs as S}from"react/jsx-runtime";import{useLexicalComposerContext as Ke}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Je}from"@lexical/react/useLexicalEditable";import{getTranslation as fe}from"@payloadcms/translations";import{Button as pe,Drawer as ze,EditDepthProvider as Ve,Form as He,formatDrawerSlug as We,RenderFields as Xe,ShimmerEffect as Ge,useConfig as Ue,useDocumentForm as qe,useDocumentInfo as Qe,useEditDepth as Ye,useServerFunctions as Ze,useTranslation as et}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as z,SKIP_DOM_SELECTION_TAG as be}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as V,reduceFieldsToValues as tt}from"payload/shared";import y,{createContext as ot,useCallback as H,useEffect as T,useMemo as B,useRef as _}from"react";import{v4 as nt}from"uuid";import{jsx as Le}from"react/jsx-runtime";import Pe from"bson-objectid";import{$applyNodeReplacement as Re}from"lexical";import je from"react";import{addClassNamesToElement as Ne}from"@lexical/utils";import Oe from"bson-objectid";import{$applyNodeReplacement as Te,DecoratorNode as Ee}from"lexical";var x=class extends Ee{__cacheBuster;__fields;constructor({cacheBuster:t,fields:e,key:i}){super(i),this.__fields=e,this.__cacheBuster=t||0}static clone(t){return new this({cacheBuster:t.__cacheBuster,fields:t.__fields,key:t.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(t){return $e(t.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(t){let e=document.createElement("span");return Ne(e,t?.theme?.inlineBlock),e}decorate(t,e){return null}exportDOM(){let t=document.createElement("span");t.classList.add("inline-block-container");let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(t,e){let i=this.getWritable();i.__fields=t,e||i.__cacheBuster++}updateDOM(){return!1}};function $e(c){return Te(new x({fields:{...c,id:c?.id||new Oe.default().toHexString()}}))}var Me=je.lazy(()=>import("./componentInline-H24N7GUG.js").then(c=>({default:c.InlineBlockComponent}))),O=class extends x{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importJSON(t){return Ae(t.fields)}decorate(...[t,e,i,f]){return Le(Me,{cacheBuster:this.getCacheBuster(),className:e.theme.inlineBlock??"LexicalEditorTheme__inlineBlock",CustomBlock:i,CustomLabel:f,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(c){return Re(new O({fields:{...c,id:c?.id||new Pe.default().toHexString()}}))}function K(c){return c instanceof O}var he=ot({initialState:!1}),ke=()=>y.use(he),Nt=c=>{let{cacheBuster:t,className:e,CustomBlock:i,CustomLabel:f,formData:o,nodeKey:a}=c,[k]=Ke(),u=Je(),{i18n:E,t:h}=et(),{createdInlineBlock:W,fieldProps:{featureClientSchemaMap:Be,initialLexicalFormState:Ce,schemaPath:X},setCreatedInlineBlock:G,uuid:ge}=ae(),{fields:F}=qe(),{getFormState:D}=Ze(),xe=Ye(),U=_(!1),[m,$]=y.useState(()=>{let r=Ce?.[o.id]?.formState;return r?Object.fromEntries(Object.entries(r).map(([s,n])=>[s,s in o?{...n,initialValue:o[s],value:o[s]}:n])):!1}),q=_(!1),Q=_(t);T(()=>{q.current?(Q.current!==t&&$(!1),Q.current=t):q.current=!0},[t]);let[Se]=y.useState(()=>nt()),[Y,Z]=y.useState(()=>{if(!f)return m?._components?.customComponents?.BlockLabel??void 0}),[ee,te]=y.useState(()=>{if(!i)return m?._components?.customComponents?.Block??void 0}),oe=B(()=>i?l(i,{className:e,formData:o,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:ke}):ee,[i,e,o,a,ee]),L=B(()=>f?l(f,{className:e,formData:o,isEditor:!0,isJSXConverter:!1,nodeKey:a,useInlineBlockComponentContext:ke}):Y,[f,e,o,a,Y]),ne=We({slug:`lexical-inlineBlocks-create-${ge}-${o.id}`,depth:xe}),{toggleDrawer:b}=de(ne,!0),_e=_(null),{id:I,collectionSlug:w,getDocPreferences:v,globalSlug:N}=Qe(),{config:ye}=Ue(),Fe=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${o.blockType}`,P=Be.blocks?.[Fe]?.[0]?.blocks?.[0],d=typeof P=="string"?ye.blocksMap[P]:P,re=d?.fields??[];T(()=>{!U.current&&W?.getKey()===a&&(re.length>2&&b(),G?.(void 0),U.current=!0)},[re.length,W,a,G,b]);let se=H(()=>{k.update(()=>{z(a)?.remove()})},[k,a]),C=d?.labels?.singular?fe(d?.labels.singular,E):d?.slug,R=_(new AbortController),g=`${X}.lexical_internal_feature.blocks.lexical_inline_blocks.${d?.slug}.fields`;T(()=>{let r=new AbortController;return o&&!m&&(async()=>{let{state:n}=await D({id:I,collectionSlug:w,data:o,docPermissions:{fields:!0},docPreferences:await v(),documentFormState:V(F,{excludeFiles:!0}),globalSlug:N,initialBlockData:o,initialBlockFormState:o,operation:"update",readOnly:!u,renderAllFields:!0,schemaPath:g,signal:r.signal});if(n){let p=tt(V(n,{excludeFiles:!0}),!0);k.update(()=>{let A=z(a);if(A&&K(A)){let ce=p;ce.blockType=o.blockType,A.setFields(ce,!0)}},{tag:be}),$(n),f||Z(n._components?.customComponents?.BlockLabel),i||te(n._components?.customComponents?.Block)}})(),()=>{J(r)}},[D,k,a,u,f,i,g,I,o,m,w,N,v,F]);let le=H(async({formState:r,submit:s})=>{J(R.current);let n=new AbortController;R.current=n;let{state:p}=await D({id:I,collectionSlug:w,docPermissions:{fields:!0},docPreferences:await v(),documentFormState:V(F,{excludeFiles:!0}),formState:r,globalSlug:N,initialBlockFormState:r,operation:"update",readOnly:!u,renderAllFields:!!s,schemaPath:g,signal:n.signal});return p?(s&&(f||Z(p._components?.customComponents?.BlockLabel),i||te(p._components?.customComponents?.Block)),p):r},[D,I,w,v,F,N,u,g,i,f]);T(()=>{let r=(s,n)=>Object.keys(n).some(p=>n[p]&&s[p]!==n[p].value);return()=>{m&&r(o,m)&&$(!1),J(R.current)}},[o,m]);let De=H((r,s)=>{s.blockType=o.blockType,k.update(()=>{let n=z(a);n&&K(n)&&n.setFields(s,!0)},{tag:be})},[k,a,o]),{headerActions:Ie,submitRef:we}=ue(),j=B(()=>()=>l(pe,{buttonStyle:"ghost",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:r=>{r.preventDefault(),r.stopPropagation(),se()},round:!0,size:"medium",tooltip:h("lexical:blocks:inlineBlocks:remove",{label:C})}),[e,C,u,se,h]),ve=B(()=>()=>l(pe,{buttonStyle:"ghost",className:`${e}__editButton`,disabled:!u,el:"button",icon:"edit",onClick:()=>{b()},round:!0,size:"medium",tooltip:h("lexical:blocks:inlineBlocks:edit",{label:C})}),[e,C,u,h,b]),M=B(()=>({children:r,className:s})=>l("div",{className:[`${e}__container`,e+"-"+o.blockType,s].filter(Boolean).join(" "),...u?{onClick:()=>b(),onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),b())},role:"button",tabIndex:0}:{},ref:_e,children:r}),[e,o.blockType,u,b]),ie=B(()=>L?()=>L:()=>l("div",{children:d?.labels?fe(d?.labels.singular,E):""}),[L,d?.labels,E]);return d?S(He,{beforeSubmit:[async({formState:r})=>await le({formState:r,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:d?.fields,initialState:m||{},onChange:[le],onSubmit:(r,s)=>{De(r,s),b()},uuid:Se,children:[l(Ve,{children:l(ze,{className:"",headerActions:Ie,slug:ne,title:h(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:C??h("lexical:blocks:inlineBlocks:label")}),children:m?S("div",{className:"fields-drawer",children:[l(Xe,{fields:d?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:g,permissions:!0,readOnly:!u}),l(me,{submitRef:we})]}):null})}),oe?l(he,{value:{EditButton:ve,initialState:m,InlineBlockContainer:M,Label:ie,nodeKey:a,RemoveButton:j},children:oe}):S(M,{children:[m?l(ie,{}):l(Ge,{height:"15px",width:"40px"}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})]}):S(M,{className:`${e}-not-found`,children:[S("span",{children:["Error: Block '",o.blockType,"' not found"]}),u?l("div",{className:`${e}__actions`,children:l(j,{})}):null]})};export{ke as a,Nt as b,O as c,Ae as d,K as e};
2
+ //# sourceMappingURL=chunk-ESITTE3C.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/schema.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'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 { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields, SerializedInlineBlockNode } from '../../server/schema.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 type InlineBlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>,\n) => JSX.Element\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(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<InlineBlockDecorateFunction>\n ): ReturnType<InlineBlockDecorateFunction> {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\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", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n} from 'lexical'\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 { InlineBlockFields, SerializedInlineBlockNode } from '../schema.js'\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"],
5
- "mappings": "oJAIA,OAASA,6BAAAA,OAAiC,wCAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,iBAAAA,EAAeC,0BAAAA,OAA8B,UAEtD,OAAO,8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AAO8B,UAAM,GAAA5J,CAAA,qBAC9D8H,EACCA,EAAC,CAAA,CAAA,IAAI5H,IAAAA,OA5EX2C,EAAqBuB,EAAqB,CAE1C,UAACA,GAAapE,CAAA,aAChB,SAAA,CACGiI,EAAAA,OAAAA,CAAqB/H,SAAW,CAAA,iBAAGG,EAAqB,UAAA,aAAA,MACtDyH,EAAA,MAAA,WAAK,GAAA9H,CAAA,qBACL8H,EACCA,EAAC,CAAA,CAAA,IAAI5H,IAAAA",
4
+ "sourcesContent": ["'use client'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { $getNodeByKey, SKIP_DOM_SELECTION_TAG } from 'lexical'\n\nimport './index.css'\nimport '../../../../utilities/fieldsDrawer/index.css'\n\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields } from '../../server/schema.js'\nimport type { BlockComponentProps } from '../component/index.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport {\n RegisterFormSubmit,\n useDrawerSubmit,\n} from '../../../../utilities/fieldsDrawer/useDrawerSubmit.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\nexport type InlineBlockComponentProps<\n TFormData extends Record<string, unknown> = InlineBlockFields,\n> = {\n readonly CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>\n readonly CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>\n} & Pick<BlockComponentProps<TFormData>, 'cacheBuster' | 'className' | 'formData' | 'nodeKey'>\n\nexport type InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<InlineBlockComponentProps<InlineBlockFields>> = (\n props,\n) => {\n const {\n cacheBuster,\n className: baseClass,\n CustomBlock: CustomBlockFromProps,\n CustomLabel: CustomLabelFromProps,\n formData,\n nodeKey,\n } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(() => {\n // Initial form state that was calculated server-side. May have stale values\n const cachedFormState = initialLexicalFormState?.[formData.id]?.formState\n if (!cachedFormState) {\n return false\n }\n\n // Merge current formData values into the cached form state\n // This ensures that when the component remounts (e.g., due to view changes), we don't lose user edits\n return Object.fromEntries(\n Object.entries(cachedFormState).map(([fieldName, fieldState]) => [\n fieldName,\n fieldName in formData\n ? {\n ...fieldState,\n initialValue: formData[fieldName],\n value: formData[fieldName],\n }\n : fieldState,\n ]),\n )\n })\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [formUuid] = React.useState(() => uuid())\n\n // Server-rendered custom components (from admin.components, NOT viewMap).\n // When viewMap components exist, we render them directly with formData instead.\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomLabelFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.BlockLabel ?? undefined\n })\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(() => {\n if (CustomBlockFromProps) {\n return undefined\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return initialState?.['_components']?.customComponents?.Block ?? undefined\n })\n\n const resolvedCustomBlock = useMemo(() => {\n if (CustomBlockFromProps) {\n return (\n <CustomBlockFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomBlock\n }, [CustomBlockFromProps, baseClass, formData, nodeKey, CustomBlock])\n\n const resolvedCustomLabel = useMemo(() => {\n if (CustomLabelFromProps) {\n return (\n <CustomLabelFromProps\n className={baseClass}\n formData={formData}\n isEditor={true}\n isJSXConverter={false}\n nodeKey={nodeKey}\n // eslint-disable-next-line react-compiler/react-compiler -- intentionally passed as a prop for custom block components to call\n useInlineBlockComponentContext={useInlineBlockComponentContext}\n />\n )\n }\n return CustomLabel\n }, [CustomLabelFromProps, baseClass, formData, nodeKey, CustomLabel])\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient | undefined = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient | undefined\n\n const blockOrSlug = blocksField?.blocks?.[0]\n const clientBlock: ClientBlock | undefined =\n typeof blockOrSlug === 'string' ? config.blocksMap[blockOrSlug] : blockOrSlug\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state, { excludeFiles: true }),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n\n setInitialState(state)\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n CustomLabelFromProps,\n CustomBlockFromProps,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields, {\n excludeFiles: true,\n }),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n if (!CustomLabelFromProps) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n }\n if (!CustomBlockFromProps) {\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n CustomBlockFromProps,\n CustomLabelFromProps,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(\n () => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n },\n // Without this, the outer editor's reconciler resets DOM selection\n // back into its own root, kicking focus out of any nested richText.\n { tag: SKIP_DOM_SELECTION_TAG },\n )\n },\n [editor, nodeKey, formData],\n )\n\n const { headerActions, submitRef } = useDrawerSubmit()\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n e.stopPropagation()\n removeInlineBlock()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"medium\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [baseClass, blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[`${baseClass}__container`, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n {...(isEditable\n ? {\n onClick: () => toggleDrawer(),\n onKeyDown: (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n toggleDrawer()\n }\n },\n role: 'button',\n tabIndex: 0,\n }\n : {})}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [baseClass, formData.blockType, isEditable, toggleDrawer],\n )\n\n const Label = useMemo(() => {\n if (resolvedCustomLabel) {\n return () => resolvedCustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [resolvedCustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={formUuid}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n headerActions={headerActions}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <div className=\"fields-drawer\">\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <RegisterFormSubmit submitRef={submitRef} />\n </div>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {resolvedCustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {resolvedCustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'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 { ViewMapInlineBlockComponentProps } from '../../../../types/index.js'\nimport type { InlineBlockFields, SerializedInlineBlockNode } from '../../server/schema.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 type InlineBlockDecorateFunction = (\n editor: LexicalEditor,\n config: EditorConfig,\n CustomBlock?: React.FC<ViewMapInlineBlockComponentProps>,\n CustomLabel?: React.FC<ViewMapInlineBlockComponentProps>,\n) => JSX.Element\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(\n ...[_editor, config, CustomBlock, CustomLabel]: Parameters<InlineBlockDecorateFunction>\n ): ReturnType<InlineBlockDecorateFunction> {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n className={config.theme.inlineBlock ?? 'LexicalEditorTheme__inlineBlock'}\n CustomBlock={CustomBlock}\n CustomLabel={CustomLabel}\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", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n} from 'lexical'\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 { InlineBlockFields, SerializedInlineBlockNode } from '../schema.js'\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"],
5
+ "mappings": "oJAIA,OAASA,6BAAAA,OAAiC,wCAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,iBAAAA,EAAeC,0BAAAA,OAA8B,UAEtD,OAAO,8CAAAC,EAAA,wBAAAC,OAAA,iBACP,OAAOC,GAAA,iBAAAC,GAAA,eAAAC,EAAA,aAAAC,EAAA,WAAAC,EAAA,UAAAC,MAAA,QAEP,OAASP,MAAAA,OAAAA,gDC3BT,OAAOQ,OAAc,gBACrB,OACEC,yBAAAA,OAIK,UACP,OAAOC,OAAyB,QCGhC,OAASC,0BAAAA,OAA8B,iBACvC,OAAOC,OAAc,gBACrB,OAASC,yBAAAA,GAAuBC,iBAAAA,OAAqB,UAI9C,IAAMC,EAAN,cAAoCD,EAAA,CACzCE,cACAC,SAEAC,YAAY,CACVC,YAAAA,EACAC,OAAAA,EACAC,IAAAA,CAAG,EAKF,CACD,MAAMA,CAAA,EACN,KAAKJ,SAAWG,EAChB,KAAKJ,cAAgBG,GAAe,CACtC,CAEA,OAAgBG,MAAMC,EAAoD,CACxE,OAAO,IAAI,KAAK,CACdJ,YAAaI,EAAKP,cAClBI,OAAQG,EAAKN,SACbI,IAAKE,EAAKC,KACZ,CAAA,CACF,CAEA,OAAgBC,SAAkB,CAChC,MAAO,aACT,CAEA,OAAgBC,WAAqD,CACnE,M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AA,QAAA,GAAA,CACf2I,MAAMlG,GAAArC,EAAA,mCAAA,CACNwI,CAAAA,WACS9E,EAAsB+E,EAAA,MAAA,CAC/B,UAAA,yBAECvJ,CAAAmI,EAAAqB,GACE,CAAIjJ,OAAAkE,GAAU,sBAEXnD,gBAAQmD,GACRgF,WAAW,GACXC,iBAAgB7E,EAChB8E,YAAW,GACXC,SAAAA,CAAAA,IACazB,EAAA0B,GAAA,CACbpE,UAAWC,QAEO4B,YAEpBa,EAAAtI,GAAA,QAGPiD,WAAAA,GAEGgH,aAAAA,EACE5B,qBAAAA,EACAlI,MAAAA,GACAsI,QAAAA,EACAyB,aAAAA,YAEAvC,KACF+B,EAAAjB,EAAA,UAECxF,CAAAA,EAAAA,EAAAA,GAAAA,CAAAA,CAAAA,EAAAA,EAAAA,GAAAA,8BAI0CkH,EAAO7B,EAAA,MAAA,CAAO8B,UAAM,GAAA5J,CAAA,qBAC9D8H,EACCA,EAAC,CAAA,CAAA,IAAI5H,IAAAA,OA5EX2C,EAAqBuB,EAAqB,CAE1C,UAACA,GAAapE,CAAA,aAChB,SAAA,CACGiI,EAAAA,OAAAA,CAAqB/H,SAAW,CAAA,iBAAGG,EAAqB,UAAA,aAAA,MACtDyH,EAAA,MAAA,WAAK,GAAA9H,CAAA,qBACL8H,EACCA,EAAC,CAAA,CAAA,IAAI5H,IAAAA",
6
6
  "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "SKIP_DOM_SELECTION_TAG", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "ObjectID", "$applyNodeReplacement", "React", "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", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "_editor", "config", "CustomBlock", "CustomLabel", "_jsx", "cacheBuster", "getCacheBuster", "className", "theme", "inlineBlock", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "InlineBlockComponentContext", "createContext", "$isInlineBlockNode", "initialState", "React", "InlineBlockComponent", "props", "cacheBuster", "baseClass", "CustomBlockFromProps", "className", "CustomBlock", "CustomLabel", "formData", "nodeKey", "useLexicalEditable", "i18n", "t", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "uuidFromContext", "setCreatedInlineBlock", "useEditorConfigContext", "useDocumentForm", "fields", "getFormState", "useServerFunctions", "useRef", "editDepth", "useEditDepth", "setInitialState", "useState", "cachedFormState", "fieldName", "fieldState", "fromEntries", "entries", "initialValue", "prevCacheBuster", "useEffect", "hasMounted", "current", "formUuid", "uuid", "setCustomLabel", "CustomLabelFromProps", "customComponents", "BlockLabel", "resolvedCustomBlock", "useMemo", "isEditor", "useInlineBlockComponentContext", "resolvedCustomLabel", "drawerSlug", "depth", "toggleDrawer", "useLexicalDrawer", "id", "collectionSlug", "getDocPreferences", "globalSlug", "config", "useConfig", "clientSchemaMap", "componentMapRenderedBlockPath", "blocksField", "blockOrSlug", "clientBlockFields", "firstTimeDrawer", "removeInlineBlock", "useCallback", "editor", "length", "$getNodeByKey", "blockDisplayName", "clientBlock", "getTranslation", "labels", "singular", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "deepCopyObjectSimpleWithoutReactComponents", "parentDocumentFields", "docPreferences", "documentFormState", "initialBlockData", "initialBlockFormState", "operation", "readOnly", "isEditable", "renderAllFields", "signal", "newFormStateData", "reduceFieldsToValues", "node", "newData", "SKIP_DOM_SELECTION_TAG", "setCustomBlock", "awaitInitialState", "abortAndIgnore", "submit", "formState", "controller", "onChangeAbortControllerRef", "excludeFiles", "prevFormState", "state_0", "isStateOutOfSync", "formData_0", "initialState_0", "key", "Object", "onFormSubmit", "blockType", "node_0", "tag", "headerActions", "submitRef", "useDrawerSubmit", "RemoveButton", "buttonStyle", "disabled", "e", "icon", "onClick", "round", "size", "tooltip", "label", "EditButton", "_jsx", "Button", "el", "InlineBlockContainer", "e_0", "onKeyDown", "role", "tabIndex", "children", "ref", "inlineBlockElemElemRef", "formState_0", "beforeSubmit", "onChange", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "slug", "title", "_jsxs", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "RegisterFormSubmit", "value", "Label", "height", "width"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ var P=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as le}from"react/compiler-runtime";import{useRef as ae}from"react";function Ze(o){let e=le(2),n=o===void 0?500:o,i=ae(void 0),t;return e[0]!==n?(t=c=>new Promise(a=>{let s=()=>{c(),a()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&i.current!==void 0&&cancelIdleCallback(i.current),i.current=requestIdleCallback(s,{timeout:n})):ue().then(s)}),e[0]=n,e[1]=t):t=e[1],t}function ue(){return new Promise(o=>{setTimeout(o,100),requestAnimationFrame(()=>{setTimeout(o,0)})})}import{jsx as fe}from"react/jsx-runtime";import{useControllableState as de}from"@payloadcms/ui";import{createContext as he,use as me,useMemo as pe}from"react";var V=he({currentView:"default",inheritable:!1,setCurrentView:()=>{}}),rt=o=>{let e=ge(),n=o.currentView!==void 0,i=e.inheritable&&(!!e.views||!!e.hasExplicitCurrentView),t=n||e.inheritable&&!!e.hasExplicitCurrentView,{children:r,currentView:c,inheritable:a,views:s}={children:o.children,currentView:i?e.currentView:o.currentView,inheritable:e.inheritable||o.inheritable,views:i&&e.views?e.views:o.views},[f,d]=de(c,"default"),h=s&&f!=="default"&&!s[f]?"default":f,m=pe(()=>{let y=s?s[h]:void 0;return{currentView:h,currentViewMap:y,hasExplicitCurrentView:t,inheritable:a,isControlledByParent:i,setCurrentView:d,views:s}},[h,a,t,i,d,s]);return fe(V,{value:m,children:r})};function ge(){return me(V)}var T=class{_x;_y;constructor(e,n){this._x=e,this._y=n}calcDeltaXTo({x:e}){return this.x-e}calcDeltaYTo({y:e}){return this.y-e}calcDistanceTo(e){return Math.sqrt(Math.pow(this.calcDeltaXTo(e),2)+Math.pow(this.calcDeltaYTo(e),2))}calcHorizontalDistanceTo(e){return Math.abs(this.calcDeltaXTo(e))}calcVerticalDistance(e){return Math.abs(this.calcDeltaYTo(e))}equals({x:e,y:n}){return this.x===e&&this.y===n}get x(){return this._x}get y(){return this._y}};function $(o){return o instanceof T}import{jsx as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Be}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Pe}from"@lexical/utils";import{$getSelection as I,$isRangeSelection as N,$isTextNode as Ve,COMMAND_PRIORITY_LOW as $e,createCommand as Ye,getDOMSelection as We}from"lexical";import{useCallback as J,useEffect as G,useState as je}from"react";import*as E from"react";import{c as q}from"react/compiler-runtime";import{useLexicalComposerContext as U}from"@lexical/react/LexicalComposerContext.js";import{getScrollParent as _e,mergeRegister as Y}from"@lexical/utils";import{$getSelection as F,$isRangeSelection as we,$setSelection as ye,COMMAND_PRIORITY_LOW as W,COMMAND_PRIORITY_NORMAL as C,createCommand as Oe,KEY_ARROW_DOWN_COMMAND as xe,KEY_ARROW_UP_COMMAND as be,KEY_ENTER_COMMAND as Ce,KEY_ESCAPE_COMMAND as Me,KEY_TAB_COMMAND as Se}from"lexical";import{useCallback as v,useEffect as x,useLayoutEffect as Re,useMemo as De,useRef as Te,useState as ve}from"react";var Ee="slash-menu-popup",j=o=>{let e=document.getElementById("slash-menu");if(!e)return;let n=e.getBoundingClientRect();n.top+n.height>window.innerHeight&&e.scrollIntoView({block:"center"}),n.top<0&&e.scrollIntoView({block:"center"}),o.scrollIntoView({block:"nearest"})};function Ie(o,e,n){let i=n;for(let t=i;t<=e.length;t++)o.substring(o.length-t)===e.substring(0,t)&&(i=t);return i}function Ne(o){let e=F();if(!we(e)||!e.isCollapsed())return;let n=e.anchor;if(n.type!=="text")return;let i=n.getNode();if(!i.isSimpleText())return;let t=n.offset,r=i.getTextContent().slice(0,t),c=o.replaceableString.length,a=Ie(r,o.matchingString,c),s=t-a;if(s<0)return;let f;return s===0?[f]=i.splitText(t):[,f]=i.splitText(s,t),f}function H(o,e){let n=o.getBoundingClientRect(),i=e.getBoundingClientRect();return n.top>i.top&&n.top<i.bottom}function ke(o,e,n,i){let t=q(7),[r]=U(),c,a;t[0]!==r||t[1]!==n||t[2]!==i||t[3]!==o||t[4]!==e?(c=()=>{let s=e.current;if(s!=null&&o!=null){let f=r.getRootElement(),d=f!=null?_e(f,!1):document.body,h=!1,m=H(s,d),y=function(){h||(window.requestAnimationFrame(function(){n(),h=!1}),h=!0);let l=H(s,d);l!==m&&(m=l,i?.(l))},u=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",y,{capture:!0,passive:!0}),u.observe(s),()=>{u.disconnect(),window.removeEventListener("resize",n),document.removeEventListener("scroll",y,!0)}}},a=[r,i,n,o,e],t[0]=r,t[1]=n,t[2]=i,t[3]=o,t[4]=e,t[5]=c,t[6]=a):(c=t[5],a=t[6]),x(c,a)}var X=Oe("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function K({anchorElementRef:o,close:e,editor:n,groups:i,menuRenderFn:t,resolution:r,shouldSplitNodeWithQuery:c=!1}){let[a,s]=ve(null),f=r.match&&r.match.matchingString||"",d=v(u=>{let l=n.getRootElement();l!==null&&(l.setAttribute("aria-activedescendant",`${Ee}__item-${u.key}`),s(u.key))},[n]),h=v(()=>{if(i!==null&&f!=null){let u=i.flatMap(l=>l.items);if(u.length){let l=u[0];d(l)}}},[i,d,f]);x(()=>{h()},[f,h]);let m=v(u=>{e(),n.update(()=>{let l=r.match!=null&&c?Ne(r.match):null;l&&l.remove()}),setTimeout(()=>{let l;n.read(()=>{l=F()?.clone()}),n.update(()=>{l&&ye(l)}),u.onSelect({editor:n,queryString:r.match?r.match.matchingString:""})},0)},[n,c,r.match,e]);x(()=>()=>{let u=n.getRootElement();u!==null&&u.removeAttribute("aria-activedescendant")},[n]),Re(()=>{i===null?s(null):a===null&&h()},[i,a,d,h]),x(()=>Y(n.registerCommand(X,({item:u})=>u.ref&&u.ref.current!=null?(j(u.ref.current),!0):!1,W)),[n,d]),x(()=>Y(n.registerCommand(xe,u=>{let l=u;if(i!==null&&i.length&&a!==null){let g=i.flatMap(_=>_.items),p=g.findIndex(_=>_.key===a),O=p!==g.length-1?p+1:0,w=g[O];if(!w)return!1;d(w),w.ref!=null&&w.ref.current&&n.dispatchCommand(X,{index:O,item:w}),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),n.registerCommand(be,u=>{let l=u;if(i!==null&&i.length&&a!==null){let g=i.flatMap(_=>_.items),p=g.findIndex(_=>_.key===a),O=p!==0?p-1:g.length-1,w=g[O];if(!w)return!1;d(w),w.ref!=null&&w.ref.current&&j(w.ref.current),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),n.registerCommand(Me,u=>{let l=u;return l.preventDefault(),l.stopImmediatePropagation(),e(),!0},W),n.registerCommand(Se,u=>{let l=u;if(i===null||a===null)return!1;let p=i.flatMap(O=>O.items).find(O=>O.key===a);return p?(l.preventDefault(),l.stopImmediatePropagation(),m(p),!0):!1},C),n.registerCommand(Ce,u=>{if(i===null||a===null)return!1;let g=i.flatMap(p=>p.items).find(p=>p.key===a);return g?(u!==null&&(u.preventDefault(),u.stopImmediatePropagation()),m(g),!0):!1},C)),[m,e,n,i,a,d]);let y=De(()=>({groups:i,selectedItemKey:a,selectItemAndCleanUp:m,setSelectedItemKey:s}),[m,a,i]);return t(o,y,r.match?r.match.matchingString:"")}function Ae(o,e){e!=null&&(o.className=e),o.setAttribute("aria-label","Slash menu"),o.setAttribute("role","listbox"),o.style.display="block",o.style.position="absolute"}function z(o,e,n,i){let t=q(14),[r]=U(),c;t[0]===Symbol.for("react.memo_cache_sentinel")?(c=P?document.createElement("div"):null,t[0]=c):c=t[0];let a=Te(c),s;t[1]!==o||t[2]!==i||t[3]!==r||t[4]!==e?(s=()=>{if(a.current===null||parent===void 0)return;let u=r.getRootElement(),l=a.current,g=l.firstChild;if(u!==null&&e!==null){let{height:p,width:O}=e.getRect(),{left:w,top:_}=e.getRect(),M=_;if(_=_-(o.getBoundingClientRect().top+window.scrollY),w=w-(o.getBoundingClientRect().left+window.scrollX),l.style.left=`${w+window.scrollX}px`,l.style.height=`${p}px`,l.style.width=`${O}px`,g!==null){let S=g.getBoundingClientRect(),A=S.height,R=S.width,D=u.getBoundingClientRect(),L=document.dir==="rtl"||document.documentElement.dir==="rtl",oe=o.getBoundingClientRect(),B=Math.max(0,D.left);if(!L&&w+R>D.right)l.style.left=`${D.right-R+window.scrollX}px`;else if(L&&S.left<B){let ce=B+R-oe.left;l.style.left=`${ce+window.scrollX}px`}let re=M+A+32>window.innerHeight,se=M<0;re&&!se?l.style.top=`${_+32-A+window.scrollY-(p+24)}px`:l.style.top=`${_+window.scrollY+32}px`}l.isConnected||(Ae(l,i),o.append(l)),l.setAttribute("id","slash-menu"),a.current=l,u.setAttribute("aria-controls","slash-menu")}},t[1]=o,t[2]=i,t[3]=r,t[4]=e,t[5]=s):s=t[5];let f=s,d,h;t[6]!==r||t[7]!==f||t[8]!==e?(d=()=>{let u=r.getRootElement();if(e!==null)return f(),()=>{u!==null&&u.removeAttribute("aria-controls");let l=a.current;l!==null&&l.isConnected&&(l.remove(),l.removeAttribute("id"))}},h=[r,f,e],t[6]=r,t[7]=f,t[8]=e,t[9]=d,t[10]=h):(d=t[9],h=t[10]),x(d,h);let m;return t[11]!==e||t[12]!==n?(m=u=>{e!==null&&(u||n(null))},t[11]=e,t[12]=n,t[13]=m):m=t[13],ke(e,a,f,m),a}var xt=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function He(o){let e=o.anchor;if(e.type!=="text")return null;let n=e.getNode();if(!n.isSimpleText())return null;let i=e.offset;return n.getTextContent().slice(0,i)}function Q(o,e,n){let i=We(n);if(i===null||!i.isCollapsed)return!1;let t=i.anchorNode,r=o,c=i.anchorOffset;if(t==null||c==null)return!1;try{e.setStart(t,r),e.setEnd(t,c>1?c:1)}catch{return!1}return!0}function Xe(o){let e;return o.getEditorState().read(()=>{let n=I();N(n)&&(e=He(n))}),e}function Z(o,e){return e!==0?!1:o.getEditorState().read(()=>{let n=I();if(N(n)){let r=n.anchor.getNode().getPreviousSibling();return Ve(r)&&r.isTextEntity()}return!1})}function ee(o){E.startTransition?E.startTransition(o):o()}var qe=Ye("ENABLE_SLASH_MENU_COMMAND");function bt({anchorClassName:o,anchorElem:e,groups:n,menuRenderFn:i,onClose:t,onOpen:r,onQueryChange:c,triggerFn:a}){let[s]=Be(),[f,d]=je(null),h=z(e,f,d,o),m=J(()=>{d(null),t!=null&&f!==null&&t()},[t,f]),y=J(u=>{d(u),r!=null&&f===null&&r(u)},[r,f]);return G(()=>Pe(s.registerCommand(qe,({node:u})=>(s.getEditorState().read(()=>{let l={leadOffset:0,matchingString:"",replaceableString:""};if(!Z(s,l.leadOffset)&&u!==null){let g=s._window??window,p=g.document.createRange();Q(l.leadOffset,p,g)!==null&&ee(()=>y({getRect:()=>p.getBoundingClientRect(),match:l}));return}}),!0),$e)),[s,y]),G(()=>{let u=()=>{s.getEditorState().read(()=>{let g=s._window??window,p=g.document.createRange(),O=I(),w=Xe(s);if(!N(O)||!O.isCollapsed()||w===void 0||p===null){m();return}let _=a({editor:s,query:w});if(c(_?_.matchingString:null),_!==null&&!Z(s,_.leadOffset)&&Q(_.leadOffset,p,g)!==null){ee(()=>y({getRect:()=>p.getBoundingClientRect(),match:_}));return}m()})},l=s.registerUpdateListener(u);return()=>{l()}},[s,a,c,f,m,y]),h.current===null||f===null||s===null?null:Le(K,{anchorElementRef:h,close:m,editor:s,groups:n,menuRenderFn:i,resolution:f,shouldSplitNodeWithQuery:!0})}var te=class o{_bottom;_left;_right;_top;constructor(e,n,i,t){let[r,c]=n<=t?[n,t]:[t,n],[a,s]=e<=i?[e,i]:[i,e];this._top=r,this._right=s,this._left=a,this._bottom=c}static fromDOM(e){let{height:n,left:i,top:t,width:r}=e.getBoundingClientRect();return o.fromLWTH(i,r,t,n)}static fromDOMRect(e){let{height:n,left:i,top:t,width:r}=e;return o.fromLWTH(i,r,t,n)}static fromLTRB(e,n,i,t){return new o(e,n,i,t)}static fromLWTH(e,n,i,t){return new o(e,i,e+n,i+t)}static fromPoints(e,n){let{x:i,y:t}=e,{x:r,y:c}=n;return o.fromLTRB(i,t,r,c)}contains(e){if($(e)){let{x:c,y:a}=e,s=a<this._top,f=a>this._bottom,d=c<this._left,h=c>this._right;return{reason:{isOnBottomSide:f,isOnLeftSide:d,isOnRightSide:h,isOnTopSide:s},result:!s&&!f&&!d&&!h}}let{bottom:n,left:i,right:t,top:r}=e;return r>=this._top&&r<=this._bottom&&n>=this._top&&n<=this._bottom&&i>=this._left&&i<=this._right&&t>=this._left&&t<=this._right}distanceFromPoint(e){let n=this.contains(e);if(n.result)return{distance:0,isOnBottomSide:n.reason.isOnBottomSide,isOnLeftSide:n.reason.isOnLeftSide,isOnRightSide:n.reason.isOnRightSide,isOnTopSide:n.reason.isOnTopSide};let i=0,t=0;return e.x<this._left?i=this._left-e.x:e.x>this._right&&(i=e.x-this._right),e.y<this._top?t=this._top-e.y:e.y>this._bottom&&(t=e.y-this._bottom),{distance:Math.sqrt(i*i+t*t),isOnBottomSide:e.y>this._bottom,isOnLeftSide:e.x<this._left,isOnRightSide:e.x>this._right,isOnTopSide:e.y<this._top}}equals({bottom:e,left:n,right:i,top:t}){return t===this._top&&e===this._bottom&&n===this._left&&i===this._right}generateNewRect({bottom:e=this.bottom,left:n=this.left,right:i=this.right,top:t=this.top}){return new o(n,t,i,e)}intersectsWith(e){let{height:n,left:i,top:t,width:r}=e,{height:c,left:a,top:s,width:f}=this,d=i+r>=a+f?i+r:a+f,h=t+n>=s+c?t+n:s+c,m=i<=a?i:a,y=t<=s?t:s;return d-m<=r+f&&h-y<=n+c}get bottom(){return this._bottom}get height(){return Math.abs(this._bottom-this._top)}get left(){return this._left}get right(){return this._right}get top(){return this._top}get width(){return Math.abs(this._left-this._right)}};import k from"react";var b=new WeakMap;function Dt(o,e){b.has(o)||b.set(o,new Map);let n=b.get(o);for(let[i,t]of Object.entries(e))if(!(!t||typeof t!="object")){if(i==="blocks"){for(let[r,c]of Object.entries(t))n.set(`block:${r}`,c);continue}if(i==="inlineBlocks"){for(let[r,c]of Object.entries(t))n.set(`inlineBlock:${r}`,c);continue}n.set(i,t)}}function Tt(o){b.delete(o)}function ne(o,e,n){let i=b.get(o);if(e==="block"&&n?.__fields?.blockType){let t=n.__fields.blockType;return i?.get(`block:${t}`)}if(e==="inlineBlock"&&n?.__fields?.blockType){let t=n.__fields.blockType;return i?.get(`inlineBlock:${t}`)}return i?.get(e)}function Ue({node:o,nodeType:e}){if(!("getType"in o)||o.getType()!==e)return;let n=o;if(n.prototype._originalDecorate||(n.prototype._originalDecorate=n.prototype.decorate),n.prototype._originalCreateDOM||(n.prototype._originalCreateDOM=n.prototype.createDOM),n.prototype.decorate&&!n.prototype._decorateOverridden){n.prototype._decorateOverridden=!0;let i=!!n.prototype.createDOM;n.prototype.decorate=function(t,r){let c=ne(t,e,this);if(c){if(c.Component)return c.Component({config:r,editor:t,isEditor:!0,isJSXConverter:!1,node:this});if(c.createDOM&&c.html){let s=typeof c.html=="function"?c.html({config:r,editor:t,isEditor:!0,isJSXConverter:!1,node:this}):c.html;return k.createElement("span",{dangerouslySetInnerHTML:{__html:s}})}if(c.html&&i&&!c.createDOM)return k.createElement(k.Fragment);if(e==="block"){let s=c;if(s.Block||s.Label)return n.prototype._originalDecorate.call(this,t,r,s.Block,s.Label)}else if(e==="inlineBlock"){let s=c;if(s.Block||s.Label)return n.prototype._originalDecorate.call(this,t,r,s.Block,s.Label)}}return n.prototype._originalDecorate.call(this,t,r)}}n.prototype.createDOM&&!n.prototype._createDOMOverridden&&(n.prototype._createDOMOverridden=!0,n.prototype.createDOM=function(i,t){let r=ne(t,e,this);if(r){if(r.createDOM)return r.createDOM({config:i,editor:t,node:this});if(r.html){let c=typeof r.html=="function"?r.html({config:i,editor:t,isEditor:!0,isJSXConverter:!1,node:this}):r.html,a=document.createElement("div");return a.innerHTML=c,a.firstElementChild||a}}return n.prototype._originalCreateDOM.call(this,i,t)})}function vt({editorConfig:o,nodeViews:e}){let n=Fe({nodes:o.features.nodes});if(e){let i=new Set;for(let[t,r]of Object.entries(e))!r||typeof r!="object"||(t==="blocks"&&Object.keys(r).length>0?i.add("block"):t==="inlineBlocks"&&Object.keys(r).length>0?i.add("inlineBlock"):i.add(t));for(let t of n)if("getType"in t){let r=t.getType();i.has(r)&&Ue({node:t,nodeType:r})}}return n}function Fe({nodes:o}){return o.map(e=>"node"in e?e.node:e)}import{jsx as ie}from"react/jsx-runtime";import"react";var Ke={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},At=({className:o,size:e=24})=>ie("svg",{className:o,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ie("path",{clipRule:"evenodd",d:Ke[e],fill:"currentColor",fillRule:"evenodd"})});export{P as a,At as b,Ze as c,rt as d,ge as e,T as f,$ as g,xt as h,qe as i,bt as j,te as k,Dt as l,Tt as m,vt as n};
2
+ //# sourceMappingURL=chunk-LN6VX25I.js.map