@payloadcms/richtext-lexical 4.0.0-internal.38b7f1d → 4.0.0-internal.45cfa3d

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 (771) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/cell/rscEntry.d.ts +1 -1
  3. package/dist/cell/rscEntry.d.ts.map +1 -1
  4. package/dist/cell/rscEntry.js +5 -5
  5. package/dist/cell/rscEntry.js.map +1 -1
  6. package/dist/exports/client/Field-XH5C4HFU.js +2 -0
  7. package/dist/exports/client/Field-XH5C4HFU.js.map +7 -0
  8. package/dist/exports/client/{RelationshipComponent-5RONAYJM.js → RelationshipComponent-YCPAKOL7.js} +2 -2
  9. package/dist/exports/client/RelationshipComponent-YCPAKOL7.js.map +7 -0
  10. package/dist/exports/client/bundled.css +1 -1
  11. package/dist/exports/client/chunk-5VIL27GI.js +2 -0
  12. package/dist/exports/client/chunk-5VIL27GI.js.map +7 -0
  13. package/dist/exports/client/chunk-ESITTE3C.js +2 -0
  14. package/dist/exports/client/chunk-ESITTE3C.js.map +7 -0
  15. package/dist/exports/client/{chunk-BZZVLW4U.js → chunk-RJ5MAOKZ.js} +1 -1
  16. package/dist/exports/client/chunk-RJ5MAOKZ.js.map +7 -0
  17. package/dist/exports/client/chunk-UD4DQ4AK.js +2 -0
  18. package/dist/exports/client/chunk-UD4DQ4AK.js.map +7 -0
  19. package/dist/exports/client/chunk-X3D4LZS7.js +2 -0
  20. package/dist/exports/client/chunk-X3D4LZS7.js.map +7 -0
  21. package/dist/exports/client/component-PHZQBOJE.js +2 -0
  22. package/dist/exports/client/component-PHZQBOJE.js.map +7 -0
  23. package/dist/exports/client/componentInline-H24N7GUG.js +2 -0
  24. package/dist/exports/client/index.d.ts +0 -1
  25. package/dist/exports/client/index.d.ts.map +1 -1
  26. package/dist/exports/client/index.js +20 -21
  27. package/dist/exports/client/index.js.map +4 -4
  28. package/dist/exports/react/index.d.ts +1 -1
  29. package/dist/exports/react/index.d.ts.map +1 -1
  30. package/dist/exports/react/index.js.map +1 -1
  31. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  32. package/dist/features/blockquote/client/index.js +2 -2
  33. package/dist/features/blockquote/client/index.js.map +1 -1
  34. package/dist/features/blockquote/server/index.d.ts +1 -4
  35. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  36. package/dist/features/blockquote/server/index.js +4 -2
  37. package/dist/features/blockquote/server/index.js.map +1 -1
  38. package/dist/features/blockquote/server/schema.d.ts +8 -0
  39. package/dist/features/blockquote/server/schema.d.ts.map +1 -0
  40. package/dist/features/blockquote/server/schema.js +15 -0
  41. package/dist/features/blockquote/server/schema.js.map +1 -0
  42. package/dist/features/blocks/client/component/index.css +2 -2
  43. package/dist/features/blocks/client/component/index.d.ts +3 -2
  44. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  45. package/dist/features/blocks/client/component/index.js +18 -10
  46. package/dist/features/blocks/client/component/index.js.map +1 -1
  47. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
  48. package/dist/features/blocks/client/componentInline/index.css +8 -8
  49. package/dist/features/blocks/client/componentInline/index.d.ts +3 -2
  50. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  51. package/dist/features/blocks/client/componentInline/index.js +17 -9
  52. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  53. package/dist/features/blocks/client/index.d.ts.map +1 -1
  54. package/dist/features/blocks/client/index.js +4 -2
  55. package/dist/features/blocks/client/index.js.map +1 -1
  56. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +1 -1
  57. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -1
  58. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +1 -1
  59. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -1
  60. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +1 -1
  61. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -1
  62. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +5 -2
  63. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -1
  64. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +1 -2
  65. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
  66. package/dist/features/blocks/client/markdown/markdownTransformer.js +4 -4
  67. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  68. package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
  69. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  70. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  71. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
  72. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  73. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  74. package/dist/features/blocks/client/plugin/index.d.ts +1 -1
  75. package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
  76. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  77. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  78. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +1 -0
  79. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  80. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +1 -1
  81. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +2 -4
  82. package/dist/features/blocks/premade/CodeBlock/Component/index.css +5 -5
  83. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +1 -2
  84. package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
  85. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  86. package/dist/features/blocks/server/index.d.ts +1 -0
  87. package/dist/features/blocks/server/index.d.ts.map +1 -1
  88. package/dist/features/blocks/server/index.js +24 -72
  89. package/dist/features/blocks/server/index.js.map +1 -1
  90. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +1 -1
  91. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
  92. package/dist/features/blocks/server/markdown/markdownTransformer.js +4 -4
  93. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  94. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -18
  95. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  96. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  97. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -10
  98. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  99. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  100. package/dist/features/blocks/server/schema.d.ts +45 -0
  101. package/dist/features/blocks/server/schema.d.ts.map +1 -0
  102. package/dist/features/blocks/server/schema.js +140 -0
  103. package/dist/features/blocks/server/schema.js.map +1 -0
  104. package/dist/features/blocks/server/validate.d.ts +1 -2
  105. package/dist/features/blocks/server/validate.d.ts.map +1 -1
  106. package/dist/features/blocks/server/validate.js.map +1 -1
  107. package/dist/features/converters/htmlToLexical/index.d.ts +1 -1
  108. package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
  109. package/dist/features/converters/htmlToLexical/index.js.map +1 -1
  110. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts +1 -1
  111. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.d.ts.map +1 -1
  112. package/dist/features/converters/lexicalToHtml/async/converters/blockquote.js.map +1 -1
  113. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts +1 -1
  114. package/dist/features/converters/lexicalToHtml/async/converters/heading.d.ts.map +1 -1
  115. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  116. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts +1 -1
  117. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.d.ts.map +1 -1
  118. package/dist/features/converters/lexicalToHtml/async/converters/horizontalRule.js.map +1 -1
  119. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts +1 -1
  120. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.d.ts.map +1 -1
  121. package/dist/features/converters/lexicalToHtml/async/converters/linebreak.js.map +1 -1
  122. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts +1 -1
  123. package/dist/features/converters/lexicalToHtml/async/converters/link.d.ts.map +1 -1
  124. package/dist/features/converters/lexicalToHtml/async/converters/link.js.map +1 -1
  125. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts +1 -1
  126. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  127. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  128. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts +1 -1
  129. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.d.ts.map +1 -1
  130. package/dist/features/converters/lexicalToHtml/async/converters/paragraph.js.map +1 -1
  131. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts +1 -1
  132. package/dist/features/converters/lexicalToHtml/async/converters/tab.d.ts.map +1 -1
  133. package/dist/features/converters/lexicalToHtml/async/converters/tab.js.map +1 -1
  134. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts +1 -1
  135. package/dist/features/converters/lexicalToHtml/async/converters/table.d.ts.map +1 -1
  136. package/dist/features/converters/lexicalToHtml/async/converters/table.js +1 -1
  137. package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
  138. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts +1 -1
  139. package/dist/features/converters/lexicalToHtml/async/converters/text.d.ts.map +1 -1
  140. package/dist/features/converters/lexicalToHtml/async/converters/text.js.map +1 -1
  141. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts +1 -1
  142. package/dist/features/converters/lexicalToHtml/async/converters/upload.d.ts.map +1 -1
  143. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  144. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts +1 -1
  145. package/dist/features/converters/lexicalToHtml/async/defaultConverters.d.ts.map +1 -1
  146. package/dist/features/converters/lexicalToHtml/async/defaultConverters.js.map +1 -1
  147. package/dist/features/converters/lexicalToHtml/async/types.d.ts +15 -16
  148. package/dist/features/converters/lexicalToHtml/async/types.d.ts.map +1 -1
  149. package/dist/features/converters/lexicalToHtml/async/types.js.map +1 -1
  150. package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
  151. package/dist/features/converters/lexicalToHtml/shared/findConverterForNode.js.map +1 -1
  152. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts +1 -1
  153. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.d.ts.map +1 -1
  154. package/dist/features/converters/lexicalToHtml/sync/converters/blockquote.js.map +1 -1
  155. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts +1 -1
  156. package/dist/features/converters/lexicalToHtml/sync/converters/heading.d.ts.map +1 -1
  157. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  158. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts +1 -1
  159. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.d.ts.map +1 -1
  160. package/dist/features/converters/lexicalToHtml/sync/converters/horizontalRule.js.map +1 -1
  161. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts +1 -1
  162. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.d.ts.map +1 -1
  163. package/dist/features/converters/lexicalToHtml/sync/converters/linebreak.js.map +1 -1
  164. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts +1 -1
  165. package/dist/features/converters/lexicalToHtml/sync/converters/link.d.ts.map +1 -1
  166. package/dist/features/converters/lexicalToHtml/sync/converters/link.js.map +1 -1
  167. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts +1 -1
  168. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  169. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  170. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts +1 -1
  171. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.d.ts.map +1 -1
  172. package/dist/features/converters/lexicalToHtml/sync/converters/paragraph.js.map +1 -1
  173. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts +1 -1
  174. package/dist/features/converters/lexicalToHtml/sync/converters/tab.d.ts.map +1 -1
  175. package/dist/features/converters/lexicalToHtml/sync/converters/tab.js.map +1 -1
  176. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts +1 -1
  177. package/dist/features/converters/lexicalToHtml/sync/converters/table.d.ts.map +1 -1
  178. package/dist/features/converters/lexicalToHtml/sync/converters/table.js +1 -1
  179. package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
  180. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts +1 -1
  181. package/dist/features/converters/lexicalToHtml/sync/converters/text.d.ts.map +1 -1
  182. package/dist/features/converters/lexicalToHtml/sync/converters/text.js.map +1 -1
  183. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts +1 -1
  184. package/dist/features/converters/lexicalToHtml/sync/converters/upload.d.ts.map +1 -1
  185. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  186. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts +1 -1
  187. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.d.ts.map +1 -1
  188. package/dist/features/converters/lexicalToHtml/sync/defaultConverters.js.map +1 -1
  189. package/dist/features/converters/lexicalToHtml/sync/types.d.ts +15 -16
  190. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  191. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  192. package/dist/features/converters/lexicalToJSX/Component/index.d.ts +6 -4
  193. package/dist/features/converters/lexicalToJSX/Component/index.d.ts.map +1 -1
  194. package/dist/features/converters/lexicalToJSX/Component/index.js +5 -4
  195. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  196. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts +1 -1
  197. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.d.ts.map +1 -1
  198. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  199. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts +1 -1
  200. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  201. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  202. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts +1 -1
  203. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.d.ts.map +1 -1
  204. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  205. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts +1 -1
  206. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.d.ts.map +1 -1
  207. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  208. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts +1 -1
  209. package/dist/features/converters/lexicalToJSX/converter/converters/link.d.ts.map +1 -1
  210. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  211. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts +1 -1
  212. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  213. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  214. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts +1 -1
  215. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.d.ts.map +1 -1
  216. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  217. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts +1 -1
  218. package/dist/features/converters/lexicalToJSX/converter/converters/tab.d.ts.map +1 -1
  219. package/dist/features/converters/lexicalToJSX/converter/converters/tab.js.map +1 -1
  220. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts +1 -1
  221. package/dist/features/converters/lexicalToJSX/converter/converters/table.d.ts.map +1 -1
  222. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  223. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts +1 -1
  224. package/dist/features/converters/lexicalToJSX/converter/converters/text.d.ts.map +1 -1
  225. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  226. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts +1 -1
  227. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  228. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  229. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts +1 -1
  230. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.d.ts.map +1 -1
  231. package/dist/features/converters/lexicalToJSX/converter/defaultConverters.js.map +1 -1
  232. package/dist/features/converters/lexicalToJSX/converter/index.d.ts +1 -1
  233. package/dist/features/converters/lexicalToJSX/converter/index.d.ts.map +1 -1
  234. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  235. package/dist/features/converters/lexicalToJSX/converter/types.d.ts +13 -15
  236. package/dist/features/converters/lexicalToJSX/converter/types.d.ts.map +1 -1
  237. package/dist/features/converters/lexicalToJSX/converter/types.js.map +1 -1
  238. package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
  239. package/dist/features/converters/lexicalToMarkdown/index.js +1 -1
  240. package/dist/features/converters/lexicalToMarkdown/index.js.map +1 -1
  241. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +1 -1
  242. package/dist/features/converters/lexicalToPlaintext/shared/findConverterForNode.js.map +1 -1
  243. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts +13 -15
  244. package/dist/features/converters/lexicalToPlaintext/sync/types.d.ts.map +1 -1
  245. package/dist/features/converters/lexicalToPlaintext/sync/types.js.map +1 -1
  246. package/dist/features/converters/markdownToLexical/index.d.ts +1 -1
  247. package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
  248. package/dist/features/converters/markdownToLexical/index.js +5 -2
  249. package/dist/features/converters/markdownToLexical/index.js.map +1 -1
  250. package/dist/features/debug/jsxConverter/client/plugin/style.css +2 -2
  251. package/dist/features/experimental_table/client/index.js +2 -2
  252. package/dist/features/experimental_table/client/index.js.map +1 -1
  253. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.css +4 -4
  254. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.css +1 -1
  255. package/dist/features/experimental_table/markdownTransformer.d.ts +2 -2
  256. package/dist/features/experimental_table/markdownTransformer.d.ts.map +1 -1
  257. package/dist/features/experimental_table/markdownTransformer.js +6 -3
  258. package/dist/features/experimental_table/markdownTransformer.js.map +1 -1
  259. package/dist/features/experimental_table/server/index.d.ts +1 -6
  260. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  261. package/dist/features/experimental_table/server/index.js +6 -2
  262. package/dist/features/experimental_table/server/index.js.map +1 -1
  263. package/dist/features/experimental_table/server/schema.d.ts +27 -0
  264. package/dist/features/experimental_table/server/schema.d.ts.map +1 -0
  265. package/dist/features/experimental_table/server/schema.js +107 -0
  266. package/dist/features/experimental_table/server/schema.js.map +1 -0
  267. package/dist/features/format/bold/feature.client.js +1 -1
  268. package/dist/features/format/bold/feature.client.js.map +1 -1
  269. package/dist/features/format/bold/feature.server.d.ts.map +1 -1
  270. package/dist/features/format/bold/feature.server.js +1 -1
  271. package/dist/features/format/bold/feature.server.js.map +1 -1
  272. package/dist/features/format/inlineCode/feature.client.js +1 -1
  273. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  274. package/dist/features/format/inlineCode/feature.server.d.ts.map +1 -1
  275. package/dist/features/format/inlineCode/feature.server.js +1 -1
  276. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  277. package/dist/features/format/italic/feature.client.js +1 -1
  278. package/dist/features/format/italic/feature.client.js.map +1 -1
  279. package/dist/features/format/italic/feature.server.d.ts.map +1 -1
  280. package/dist/features/format/italic/feature.server.js +1 -1
  281. package/dist/features/format/italic/feature.server.js.map +1 -1
  282. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  283. package/dist/features/format/strikethrough/feature.client.js +1 -1
  284. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  285. package/dist/features/format/strikethrough/feature.server.d.ts.map +1 -1
  286. package/dist/features/format/strikethrough/feature.server.js +1 -1
  287. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  288. package/dist/features/heading/client/index.js +2 -2
  289. package/dist/features/heading/client/index.js.map +1 -1
  290. package/dist/features/heading/markdownTransformer.d.ts +2 -2
  291. package/dist/features/heading/markdownTransformer.d.ts.map +1 -1
  292. package/dist/features/heading/markdownTransformer.js +6 -19
  293. package/dist/features/heading/markdownTransformer.js.map +1 -1
  294. package/dist/features/heading/server/index.d.ts +2 -4
  295. package/dist/features/heading/server/index.d.ts.map +1 -1
  296. package/dist/features/heading/server/index.js +4 -2
  297. package/dist/features/heading/server/index.js.map +1 -1
  298. package/dist/features/heading/server/schema.d.ts +10 -0
  299. package/dist/features/heading/server/schema.d.ts.map +1 -0
  300. package/dist/features/heading/server/schema.js +37 -0
  301. package/dist/features/heading/server/schema.js.map +1 -0
  302. package/dist/features/horizontalRule/client/index.js +2 -2
  303. package/dist/features/horizontalRule/client/index.js.map +1 -1
  304. package/dist/features/horizontalRule/client/markdownTransformer.d.ts +2 -2
  305. package/dist/features/horizontalRule/client/markdownTransformer.d.ts.map +1 -1
  306. package/dist/features/horizontalRule/client/markdownTransformer.js +1 -1
  307. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  308. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +1 -1
  309. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  310. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  311. package/dist/features/horizontalRule/client/plugin/index.css +2 -2
  312. package/dist/features/horizontalRule/server/index.d.ts +1 -0
  313. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  314. package/dist/features/horizontalRule/server/index.js +4 -2
  315. package/dist/features/horizontalRule/server/index.js.map +1 -1
  316. package/dist/features/horizontalRule/server/markdownTransformer.d.ts +2 -2
  317. package/dist/features/horizontalRule/server/markdownTransformer.d.ts.map +1 -1
  318. package/dist/features/horizontalRule/server/markdownTransformer.js +1 -1
  319. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  320. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +1 -5
  321. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  322. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  323. package/dist/features/horizontalRule/server/schema.d.ts +7 -0
  324. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -0
  325. package/dist/features/horizontalRule/server/schema.js +25 -0
  326. package/dist/features/horizontalRule/server/schema.js.map +1 -0
  327. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  328. package/dist/features/link/client/index.d.ts.map +1 -1
  329. package/dist/features/link/client/index.js +2 -2
  330. package/dist/features/link/client/index.js.map +1 -1
  331. package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
  332. package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
  333. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  334. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -3
  335. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  336. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +7 -11
  337. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts +1 -1
  338. package/dist/features/link/client/plugins/floatingLinkEditor/types.d.ts.map +1 -1
  339. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  340. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  341. package/dist/features/link/markdownTransformer.d.ts +5 -5
  342. package/dist/features/link/markdownTransformer.d.ts.map +1 -1
  343. package/dist/features/link/markdownTransformer.js +2 -2
  344. package/dist/features/link/markdownTransformer.js.map +1 -1
  345. package/dist/features/link/markdownTransformer.spec.js +10 -10
  346. package/dist/features/link/markdownTransformer.spec.js.map +1 -1
  347. package/dist/features/link/nodes/AutoLinkNode.d.ts +3 -3
  348. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  349. package/dist/features/link/nodes/AutoLinkNode.js +2 -1
  350. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  351. package/dist/features/link/nodes/LinkNode.d.ts +3 -3
  352. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  353. package/dist/features/link/nodes/LinkNode.js +2 -1
  354. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  355. package/dist/features/link/server/baseFields.d.ts.map +1 -1
  356. package/dist/features/link/server/baseFields.js.map +1 -1
  357. package/dist/features/link/server/graphQLPopulationPromise.d.ts +1 -1
  358. package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
  359. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  360. package/dist/features/link/server/index.d.ts +2 -1
  361. package/dist/features/link/server/index.d.ts.map +1 -1
  362. package/dist/features/link/server/index.js +5 -2
  363. package/dist/features/link/server/index.js.map +1 -1
  364. package/dist/features/link/server/schema.d.ts +32 -0
  365. package/dist/features/link/server/schema.d.ts.map +1 -0
  366. package/dist/features/link/server/schema.js +171 -0
  367. package/dist/features/link/server/schema.js.map +1 -0
  368. package/dist/features/link/server/validate.d.ts +1 -1
  369. package/dist/features/link/server/validate.d.ts.map +1 -1
  370. package/dist/features/link/server/validate.js.map +1 -1
  371. package/dist/features/lists/checklist/client/index.js +1 -1
  372. package/dist/features/lists/checklist/client/index.js.map +1 -1
  373. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  374. package/dist/features/lists/checklist/server/index.js +4 -1
  375. package/dist/features/lists/checklist/server/index.js.map +1 -1
  376. package/dist/features/lists/orderedList/client/index.js +1 -1
  377. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  378. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  379. package/dist/features/lists/orderedList/server/index.js +4 -1
  380. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  381. package/dist/features/lists/plugin/index.d.ts +0 -9
  382. package/dist/features/lists/plugin/index.d.ts.map +1 -1
  383. package/dist/features/lists/plugin/index.js.map +1 -1
  384. package/dist/features/lists/shared/schema.d.ts +18 -0
  385. package/dist/features/lists/shared/schema.d.ts.map +1 -0
  386. package/dist/features/lists/shared/schema.js +62 -0
  387. package/dist/features/lists/shared/schema.js.map +1 -0
  388. package/dist/features/lists/unorderedList/client/index.js +1 -1
  389. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  390. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  391. package/dist/features/lists/unorderedList/server/index.js +4 -1
  392. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  393. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  394. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  395. package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
  396. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  397. package/dist/features/relationship/client/components/index.css +2 -2
  398. package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
  399. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  400. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  401. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  402. package/dist/features/relationship/client/plugins/index.d.ts +1 -1
  403. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  404. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  405. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  406. package/dist/features/relationship/client/utils/useEnabledRelationships.js +9 -40
  407. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  408. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +1 -1
  409. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  410. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  411. package/dist/features/relationship/server/index.d.ts +1 -0
  412. package/dist/features/relationship/server/index.d.ts.map +1 -1
  413. package/dist/features/relationship/server/index.js +2 -0
  414. package/dist/features/relationship/server/index.js.map +1 -1
  415. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -10
  416. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  417. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  418. package/dist/features/relationship/server/schema.d.ts +28 -0
  419. package/dist/features/relationship/server/schema.d.ts.map +1 -0
  420. package/dist/features/relationship/server/schema.js +97 -0
  421. package/dist/features/relationship/server/schema.js.map +1 -0
  422. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +23 -0
  423. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -0
  424. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +34 -0
  425. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -0
  426. package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
  427. package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
  428. package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
  429. package/dist/features/textState/feature.client.js +1 -1
  430. package/dist/features/textState/feature.client.js.map +1 -1
  431. package/dist/features/toolbars/fixed/client/Toolbar/index.css +2 -2
  432. package/dist/features/toolbars/inline/client/Toolbar/index.css +2 -13
  433. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  434. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  435. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
  436. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  437. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +8 -12
  438. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  439. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  440. package/dist/features/toolbars/shared/useToolbarStates.d.ts.map +1 -1
  441. package/dist/features/toolbars/shared/useToolbarStates.js +3 -1
  442. package/dist/features/toolbars/shared/useToolbarStates.js.map +1 -1
  443. package/dist/features/toolbars/types.d.ts +1 -1
  444. package/dist/features/toolbars/types.d.ts.map +1 -1
  445. package/dist/features/toolbars/types.js.map +1 -1
  446. package/dist/features/typesClient.d.ts +2 -2
  447. package/dist/features/typesClient.d.ts.map +1 -1
  448. package/dist/features/typesClient.js.map +1 -1
  449. package/dist/features/typesServer.d.ts +19 -42
  450. package/dist/features/typesServer.d.ts.map +1 -1
  451. package/dist/features/typesServer.js.map +1 -1
  452. package/dist/features/upload/client/component/index.css +22 -26
  453. package/dist/features/upload/client/component/index.d.ts +1 -1
  454. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  455. package/dist/features/upload/client/component/index.js +4 -4
  456. package/dist/features/upload/client/component/index.js.map +1 -1
  457. package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
  458. package/dist/features/upload/client/nodes/UploadNode.d.ts +1 -1
  459. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  460. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  461. package/dist/features/upload/client/plugin/index.d.ts +1 -1
  462. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  463. package/dist/features/upload/client/plugin/index.js +5 -5
  464. package/dist/features/upload/client/plugin/index.js.map +1 -1
  465. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +1 -1
  466. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  467. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  468. package/dist/features/upload/server/index.d.ts +1 -0
  469. package/dist/features/upload/server/index.d.ts.map +1 -1
  470. package/dist/features/upload/server/index.js +5 -4
  471. package/dist/features/upload/server/index.js.map +1 -1
  472. package/dist/features/upload/server/markdownTransformer.d.ts +2 -2
  473. package/dist/features/upload/server/markdownTransformer.d.ts.map +1 -1
  474. package/dist/features/upload/server/markdownTransformer.js +1 -1
  475. package/dist/features/upload/server/markdownTransformer.js.map +1 -1
  476. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -55
  477. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  478. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  479. package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
  480. package/dist/features/upload/server/nodes/conversions.js.map +1 -1
  481. package/dist/features/upload/server/schema.d.ts +52 -0
  482. package/dist/features/upload/server/schema.d.ts.map +1 -0
  483. package/dist/features/upload/server/schema.js +149 -0
  484. package/dist/features/upload/server/schema.js.map +1 -0
  485. package/dist/features/upload/server/validate.d.ts +1 -1
  486. package/dist/features/upload/server/validate.d.ts.map +1 -1
  487. package/dist/features/upload/server/validate.js.map +1 -1
  488. package/dist/field/Diff/converters/link.d.ts +1 -1
  489. package/dist/field/Diff/converters/link.d.ts.map +1 -1
  490. package/dist/field/Diff/converters/link.js.map +1 -1
  491. package/dist/field/Diff/converters/listitem/index.css +44 -8
  492. package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
  493. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  494. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  495. package/dist/field/Diff/converters/relationship/index.css +76 -36
  496. package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
  497. package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
  498. package/dist/field/Diff/converters/relationship/index.js +10 -28
  499. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  500. package/dist/field/Diff/converters/unknown/index.css +1 -1
  501. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  502. package/dist/field/Diff/converters/upload/index.css +106 -43
  503. package/dist/field/Diff/converters/upload/index.d.ts +1 -1
  504. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  505. package/dist/field/Diff/converters/upload/index.js +6 -2
  506. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  507. package/dist/field/Diff/index.css +116 -61
  508. package/dist/field/Diff/index.js.map +1 -1
  509. package/dist/field/Field.d.ts +1 -1
  510. package/dist/field/Field.d.ts.map +1 -1
  511. package/dist/field/Field.js +4 -5
  512. package/dist/field/Field.js.map +1 -1
  513. package/dist/field/RenderLexical/index.d.ts +2 -2
  514. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  515. package/dist/field/RenderLexical/index.js.map +1 -1
  516. package/dist/field/RichTextViewProvider.d.ts +1 -1
  517. package/dist/field/RichTextViewProvider.d.ts.map +1 -1
  518. package/dist/field/RichTextViewProvider.js.map +1 -1
  519. package/dist/field/ViewSelector.css +1 -1
  520. package/dist/field/bundled.css +1 -1
  521. package/dist/field/index.css +5 -5
  522. package/dist/field/index.d.ts +1 -1
  523. package/dist/field/index.d.ts.map +1 -1
  524. package/dist/field/index.js +1 -1
  525. package/dist/field/index.js.map +1 -1
  526. package/dist/field/rscEntry.d.ts +1 -1
  527. package/dist/field/rscEntry.d.ts.map +1 -1
  528. package/dist/field/rscEntry.js +2 -0
  529. package/dist/field/rscEntry.js.map +1 -1
  530. package/dist/hooks.d.ts +6 -0
  531. package/dist/hooks.d.ts.map +1 -0
  532. package/dist/hooks.js +548 -0
  533. package/dist/hooks.js.map +1 -0
  534. package/dist/index.d.ts +13 -10
  535. package/dist/index.d.ts.map +1 -1
  536. package/dist/index.js +12 -621
  537. package/dist/index.js.map +1 -1
  538. package/dist/lexical/LexicalEditor.css +2 -2
  539. package/dist/lexical/LexicalProvider.d.ts +1 -1
  540. package/dist/lexical/LexicalProvider.d.ts.map +1 -1
  541. package/dist/lexical/LexicalProvider.js.map +1 -1
  542. package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
  543. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  544. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  545. package/dist/lexical/config/client/loader.d.ts +1 -1
  546. package/dist/lexical/config/client/loader.d.ts.map +1 -1
  547. package/dist/lexical/config/client/loader.js +5 -1
  548. package/dist/lexical/config/client/loader.js.map +1 -1
  549. package/dist/lexical/config/client/sanitize.d.ts +1 -1
  550. package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
  551. package/dist/lexical/config/client/sanitize.js.map +1 -1
  552. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  553. package/dist/lexical/config/server/sanitize.js +9 -11
  554. package/dist/lexical/config/server/sanitize.js.map +1 -1
  555. package/dist/lexical/config/types.d.ts +1 -1
  556. package/dist/lexical/config/types.d.ts.map +1 -1
  557. package/dist/lexical/config/types.js.map +1 -1
  558. package/dist/lexical/nodes/index.d.ts +1 -1
  559. package/dist/lexical/nodes/index.d.ts.map +1 -1
  560. package/dist/lexical/nodes/index.js.map +1 -1
  561. package/dist/lexical/plugins/DecoratorPlugin/index.css +1 -1
  562. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  563. package/dist/lexical/plugins/MarkdownShortcut/index.d.ts.map +1 -1
  564. package/dist/lexical/plugins/MarkdownShortcut/index.js +1 -1
  565. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  566. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
  567. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
  568. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  569. package/dist/lexical/plugins/SlashMenu/index.css +1 -5
  570. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -1
  571. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  572. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +3 -3
  573. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +1 -1
  574. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  575. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  576. package/dist/lexical/theme/EditorTheme.css +20 -21
  577. package/dist/lexical/ui/ContentEditable.css +5 -5
  578. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts +17 -0
  579. package/dist/lexical/utils/markdown/convertFromMarkdownString.d.ts.map +1 -0
  580. package/dist/lexical/utils/markdown/convertFromMarkdownString.js +27 -0
  581. package/dist/lexical/utils/markdown/convertFromMarkdownString.js.map +1 -0
  582. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +88 -0
  583. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +1 -0
  584. package/dist/lexical/utils/markdown/createBlockNode.d.ts +1 -1
  585. package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
  586. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  587. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts +25 -0
  588. package/dist/lexical/utils/markdown/normalizeMarkdown.d.ts.map +1 -0
  589. package/dist/lexical/utils/markdown/normalizeMarkdown.js +91 -0
  590. package/dist/lexical/utils/markdown/normalizeMarkdown.js.map +1 -0
  591. package/dist/lexical-proxy/@lexical-markdown.d.ts +1 -1
  592. package/dist/lexical-proxy/@lexical-markdown.d.ts.map +1 -1
  593. package/dist/lexical-proxy/@lexical-markdown.js +1 -1
  594. package/dist/lexical-proxy/@lexical-markdown.js.map +1 -1
  595. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
  596. package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
  597. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  598. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
  599. package/dist/types/builtInNodes.d.ts +14 -0
  600. package/dist/types/builtInNodes.d.ts.map +1 -0
  601. package/dist/types/builtInNodes.js +203 -0
  602. package/dist/types/builtInNodes.js.map +1 -0
  603. package/dist/{types.d.ts → types/index.d.ts} +25 -26
  604. package/dist/types/index.d.ts.map +1 -0
  605. package/dist/types/index.js +2 -0
  606. package/dist/types/index.js.map +1 -0
  607. package/dist/types/jsonSchemaHelpers.d.ts +30 -0
  608. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -0
  609. package/dist/types/jsonSchemaHelpers.js +58 -0
  610. package/dist/types/jsonSchemaHelpers.js.map +1 -0
  611. package/dist/types/nodeTypes.d.ts +128 -0
  612. package/dist/types/nodeTypes.d.ts.map +1 -0
  613. package/dist/types/nodeTypes.js +6 -0
  614. package/dist/types/nodeTypes.js.map +1 -0
  615. package/dist/types/schema.d.ts +6 -0
  616. package/dist/types/schema.d.ts.map +1 -0
  617. package/dist/types/schema.js +90 -0
  618. package/dist/types/schema.js.map +1 -0
  619. package/dist/utilities/applyBaseFilterToFields.d.ts.map +1 -1
  620. package/dist/utilities/applyBaseFilterToFields.js +1 -2
  621. package/dist/utilities/applyBaseFilterToFields.js.map +1 -1
  622. package/dist/utilities/buildEditorState.d.ts +18 -4
  623. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  624. package/dist/utilities/buildEditorState.js +8 -0
  625. package/dist/utilities/buildEditorState.js.map +1 -1
  626. package/dist/utilities/buildInitialState.d.ts +2 -1
  627. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  628. package/dist/utilities/buildInitialState.js.map +1 -1
  629. package/dist/utilities/createClientFeature.d.ts +1 -1
  630. package/dist/utilities/createClientFeature.d.ts.map +1 -1
  631. package/dist/utilities/createClientFeature.js.map +1 -1
  632. package/dist/utilities/editorConfigFactory.d.ts +1 -1
  633. package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
  634. package/dist/utilities/editorConfigFactory.js.map +1 -1
  635. package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
  636. package/dist/utilities/fieldsDrawer/Drawer.js +19 -10
  637. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  638. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -1
  639. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  640. package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -7
  641. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  642. package/dist/utilities/fieldsDrawer/index.css +12 -0
  643. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts +29 -0
  644. package/dist/utilities/fieldsDrawer/useDrawerSubmit.d.ts.map +1 -0
  645. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js +97 -0
  646. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -0
  647. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  648. package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
  649. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
  650. package/dist/utilities/generateImportMap.d.ts +1 -1
  651. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  652. package/dist/utilities/generateImportMap.js.map +1 -1
  653. package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
  654. package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
  655. package/dist/utilities/initLexicalFeatures.d.ts +1 -1
  656. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  657. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  658. package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
  659. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
  660. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +1 -1
  661. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  662. package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
  663. package/dist/validate/index.d.ts.map +1 -1
  664. package/package.json +28 -32
  665. package/dist/exports/client/Field-PJW7KUJG.js +0 -2
  666. package/dist/exports/client/Field-PJW7KUJG.js.map +0 -7
  667. package/dist/exports/client/RelationshipComponent-5RONAYJM.js.map +0 -7
  668. package/dist/exports/client/chunk-44G3K3W7.js +0 -2
  669. package/dist/exports/client/chunk-44G3K3W7.js.map +0 -7
  670. package/dist/exports/client/chunk-BZZVLW4U.js.map +0 -7
  671. package/dist/exports/client/chunk-FTT5KJ6W.js +0 -12
  672. package/dist/exports/client/chunk-FTT5KJ6W.js.map +0 -7
  673. package/dist/exports/client/chunk-INBEEENE.js +0 -2
  674. package/dist/exports/client/chunk-INBEEENE.js.map +0 -7
  675. package/dist/exports/client/chunk-QJ5EETIB.js +0 -2
  676. package/dist/exports/client/chunk-QJ5EETIB.js.map +0 -7
  677. package/dist/exports/client/component-53Y3RYR5.js +0 -2
  678. package/dist/exports/client/component-53Y3RYR5.js.map +0 -7
  679. package/dist/exports/client/componentInline-PM4PLNUK.js +0 -2
  680. package/dist/features/blockquote/markdownTransformer.d.ts +0 -3
  681. package/dist/features/blockquote/markdownTransformer.d.ts.map +0 -1
  682. package/dist/features/blockquote/markdownTransformer.js +0 -33
  683. package/dist/features/blockquote/markdownTransformer.js.map +0 -1
  684. package/dist/features/format/bold/markdownTransformers.d.ts +0 -6
  685. package/dist/features/format/bold/markdownTransformers.d.ts.map +0 -1
  686. package/dist/features/format/bold/markdownTransformers.js +0 -23
  687. package/dist/features/format/bold/markdownTransformers.js.map +0 -1
  688. package/dist/features/format/inlineCode/markdownTransformers.d.ts +0 -3
  689. package/dist/features/format/inlineCode/markdownTransformers.d.ts.map +0 -1
  690. package/dist/features/format/inlineCode/markdownTransformers.js +0 -6
  691. package/dist/features/format/inlineCode/markdownTransformers.js.map +0 -1
  692. package/dist/features/format/italic/markdownTransformers.d.ts +0 -4
  693. package/dist/features/format/italic/markdownTransformers.d.ts.map +0 -1
  694. package/dist/features/format/italic/markdownTransformers.js +0 -12
  695. package/dist/features/format/italic/markdownTransformers.js.map +0 -1
  696. package/dist/features/format/strikethrough/markdownTransformers.d.ts +0 -3
  697. package/dist/features/format/strikethrough/markdownTransformers.d.ts.map +0 -1
  698. package/dist/features/format/strikethrough/markdownTransformers.js +0 -6
  699. package/dist/features/format/strikethrough/markdownTransformers.js.map +0 -1
  700. package/dist/features/link/nodes/types.d.ts +0 -27
  701. package/dist/features/link/nodes/types.d.ts.map +0 -1
  702. package/dist/features/link/nodes/types.js +0 -2
  703. package/dist/features/link/nodes/types.js.map +0 -1
  704. package/dist/features/lists/checklist/markdownTransformers.d.ts +0 -3
  705. package/dist/features/lists/checklist/markdownTransformers.d.ts.map +0 -1
  706. package/dist/features/lists/checklist/markdownTransformers.js +0 -12
  707. package/dist/features/lists/checklist/markdownTransformers.js.map +0 -1
  708. package/dist/features/lists/orderedList/markdownTransformer.d.ts +0 -3
  709. package/dist/features/lists/orderedList/markdownTransformer.d.ts.map +0 -1
  710. package/dist/features/lists/orderedList/markdownTransformer.js +0 -12
  711. package/dist/features/lists/orderedList/markdownTransformer.js.map +0 -1
  712. package/dist/features/lists/shared/markdown.d.ts +0 -6
  713. package/dist/features/lists/shared/markdown.d.ts.map +0 -1
  714. package/dist/features/lists/shared/markdown.js +0 -57
  715. package/dist/features/lists/shared/markdown.js.map +0 -1
  716. package/dist/features/lists/unorderedList/markdownTransformer.d.ts +0 -3
  717. package/dist/features/lists/unorderedList/markdownTransformer.d.ts.map +0 -1
  718. package/dist/features/lists/unorderedList/markdownTransformer.js +0 -12
  719. package/dist/features/lists/unorderedList/markdownTransformer.js.map +0 -1
  720. package/dist/lexical/utils/guard.d.ts +0 -5
  721. package/dist/lexical/utils/guard.d.ts.map +0 -1
  722. package/dist/lexical/utils/guard.js +0 -9
  723. package/dist/lexical/utils/guard.js.map +0 -1
  724. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts +0 -2
  725. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.d.ts.map +0 -1
  726. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js +0 -2
  727. package/dist/lexical-proxy/@lexical-react/LexicalContextMenuPlugin.js.map +0 -1
  728. package/dist/nodeTypes.d.ts +0 -74
  729. package/dist/nodeTypes.d.ts.map +0 -1
  730. package/dist/nodeTypes.js +0 -5
  731. package/dist/nodeTypes.js.map +0 -1
  732. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts +0 -14
  733. package/dist/packages/@lexical/markdown/MarkdownExport.d.ts.map +0 -1
  734. package/dist/packages/@lexical/markdown/MarkdownExport.js +0 -213
  735. package/dist/packages/@lexical/markdown/MarkdownExport.js.map +0 -1
  736. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts +0 -19
  737. package/dist/packages/@lexical/markdown/MarkdownImport.d.ts.map +0 -1
  738. package/dist/packages/@lexical/markdown/MarkdownImport.js +0 -198
  739. package/dist/packages/@lexical/markdown/MarkdownImport.js.map +0 -1
  740. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts +0 -11
  741. package/dist/packages/@lexical/markdown/MarkdownShortcuts.d.ts.map +0 -1
  742. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +0 -304
  743. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +0 -1
  744. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts +0 -147
  745. package/dist/packages/@lexical/markdown/MarkdownTransformers.d.ts.map +0 -1
  746. package/dist/packages/@lexical/markdown/MarkdownTransformers.js +0 -268
  747. package/dist/packages/@lexical/markdown/MarkdownTransformers.js.map +0 -1
  748. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts +0 -22
  749. package/dist/packages/@lexical/markdown/importTextFormatTransformer.d.ts.map +0 -1
  750. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +0 -91
  751. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +0 -1
  752. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts +0 -21
  753. package/dist/packages/@lexical/markdown/importTextMatchTransformer.d.ts.map +0 -1
  754. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +0 -54
  755. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +0 -1
  756. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts +0 -18
  757. package/dist/packages/@lexical/markdown/importTextTransformers.d.ts.map +0 -1
  758. package/dist/packages/@lexical/markdown/importTextTransformers.js +0 -54
  759. package/dist/packages/@lexical/markdown/importTextTransformers.js.map +0 -1
  760. package/dist/packages/@lexical/markdown/index.d.ts +0 -29
  761. package/dist/packages/@lexical/markdown/index.d.ts.map +0 -1
  762. package/dist/packages/@lexical/markdown/index.js +0 -39
  763. package/dist/packages/@lexical/markdown/index.js.map +0 -1
  764. package/dist/packages/@lexical/markdown/utils.d.ts +0 -34
  765. package/dist/packages/@lexical/markdown/utils.d.ts.map +0 -1
  766. package/dist/packages/@lexical/markdown/utils.js +0 -267
  767. package/dist/packages/@lexical/markdown/utils.js.map +0 -1
  768. package/dist/types.d.ts.map +0 -1
  769. package/dist/types.js +0 -2
  770. package/dist/types.js.map +0 -1
  771. /package/dist/exports/client/{componentInline-PM4PLNUK.js.map → componentInline-H24N7GUG.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{c as D}from"react/compiler-runtime";import{useForm as _,useTranslation as k}from"@payloadcms/ui";import{useEffect as v,useRef as y}from"react";var G=()=>{let t=D(7),{t:s}=k(),e=y(null),o;t[0]!==s?(o=s("fields:saveChanges"),t[0]=s,t[1]=o):o=t[1];let l;t[2]===Symbol.for("react.memo_cache_sentinel")?(l=()=>e.current?.(),t[2]=l):l=t[2];let n;t[3]!==o?(n=[{label:o,onClick:l,style:"primary"}],t[3]=o,t[4]=n):n=t[4];let r=n,c;return t[5]!==r?(c={headerActions:r,submitRef:e},t[5]=r,t[6]=c):c=t[6],c},H=t=>{let s=D(4),{submitRef:e}=t,{submit:o}=_(),l,n;return s[0]!==o||s[1]!==e?(l=()=>(e.current=()=>{o()},()=>{e.current=null}),n=[o,e],s[0]=o,s[1]=e,s[2]=l,s[3]=n):(l=s[2],n=s[3]),v(l,n),null};import{c as T}from"react/compiler-runtime";import{useLexicalComposerContext as B}from"@lexical/react/LexicalComposerContext";import{useModal as E}from"@payloadcms/ui";import{$getPreviousSelection as F,$getSelection as A,$setSelection as P}from"lexical";import{useEffect as W,useState as R}from"react";var X=(t,s)=>{let e=T(24),[o]=B(),[l,n]=R(null),[r,c]=R(!1),{closeModal:x,modalState:a,toggleModal:$}=E(),f;e[0]!==o?(f=()=>{o.read(()=>{let M=A()??F();n(M)})},e[0]=o,e[1]=f):f=e[1];let w=f,m;e[2]!==o||e[3]!==l?(m=()=>{l&&o.update(()=>{P(l.clone())},{discrete:!0,skipTransforms:!0})},e[2]=o,e[3]=l,e[4]=m):m=e[4];let i=m,u;e[5]!==x||e[6]!==t?(u=()=>{x(t)},e[5]=x,e[6]=t,e[7]=u):u=e[7];let C=u,O=a?.[t]?.isOpen,p;e[8]!==O||e[9]!==i||e[10]!==t||e[11]!==w||e[12]!==$?(p=()=>{O?i():w(),c(!0),$(t)},e[8]=O,e[9]=i,e[10]=t,e[11]=w,e[12]=$,e[13]=p):p=e[13];let h=p,d,S;e[14]!==a||e[15]!==s||e[16]!==i||e[17]!==t||e[18]!==r?(d=()=>{if(!r)return;let M=a[t];M&&!M?.isOpen&&(c(!1),s?setTimeout(()=>{i()},0):i())},S=[a,t,i,r,s],e[14]=a,e[15]=s,e[16]=i,e[17]=t,e[18]=r,e[19]=d,e[20]=S):(d=e[19],S=e[20]),W(d,S);let b;return e[21]!==C||e[22]!==h?(b={closeDrawer:C,toggleDrawer:h},e[21]=C,e[22]=h,e[23]=b):b=e[23],b};export{G as a,H as b,X as c};
2
+ //# sourceMappingURL=chunk-5VIL27GI.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utilities/fieldsDrawer/useDrawerSubmit.ts", "../../../src/utilities/fieldsDrawer/useLexicalDrawer.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { FC } from 'react'\nimport type React from 'react'\n\nimport { useForm, useTranslation } from '@payloadcms/ui'\nimport { useEffect, useMemo, useRef } from 'react'\n\n/**\n * Shared logic for drawers that render their submit button in the drawer header.\n *\n * The header's `onClick` is defined outside the `Form` provider, so it cannot call\n * `useForm().submit()` directly. This hook owns a ref to the form's `submit` function,\n * which is populated from inside the form via `<RegisterFormSubmit submitRef={submitRef} />`.\n *\n * Returns the `headerActions` array to spread onto a `Drawer` and the `submitRef`\n * to pass to `RegisterFormSubmit`.\n */\nexport const useDrawerSubmit = () => {\n const { t } = useTranslation()\n const submitRef = useRef<(() => void) | null>(null)\n\n const headerActions = useMemo(\n () => [\n {\n label: t('fields:saveChanges'),\n onClick: () => submitRef.current?.(),\n style: 'primary' as const,\n },\n ],\n [t],\n )\n\n return { headerActions, submitRef }\n}\n\n/**\n * Mounts inside a `<Form>` to populate `submitRef` (from `useDrawerSubmit`) with the form's\n * `submit` function, allowing drawer header actions rendered outside the form's React tree\n * to trigger submission.\n */\nexport const RegisterFormSubmit: FC<{\n submitRef: React.RefObject<(() => void) | null>\n}> = ({ submitRef }) => {\n const { submit } = useForm()\n\n useEffect(() => {\n submitRef.current = () => void submit()\n return () => {\n submitRef.current = null\n }\n }, [submit, submitRef])\n\n return null\n}\n", "'use client'\nimport type { BaseSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useModal } from '@payloadcms/ui'\nimport { $getPreviousSelection, $getSelection, $setSelection } from 'lexical'\nimport { useCallback, useEffect, useState } from 'react'\n\n/**\n *\n * Wrapper around useModal that restores and saves selection state (cursor position) when opening and closing the drawer.\n * By default, the lexical cursor position may be lost when opening a drawer and clicking somewhere on that drawer.\n */\nexport const useLexicalDrawer = (slug: string, restoreLate?: boolean) => {\n const [editor] = useLexicalComposerContext()\n const [selectionState, setSelectionState] = useState<BaseSelection | null>(null)\n const [wasOpen, setWasOpen] = useState<boolean>(false)\n\n const { closeModal: closeBaseModal, modalState, toggleModal: toggleBaseModal } = useModal()\n\n const storeSelection = useCallback(() => {\n editor.read(() => {\n const selection = $getSelection() ?? $getPreviousSelection()\n setSelectionState(selection)\n })\n }, [editor])\n\n const restoreSelection = useCallback(() => {\n if (selectionState) {\n editor.update(\n () => {\n $setSelection(selectionState.clone())\n },\n { discrete: true, skipTransforms: true },\n )\n }\n }, [editor, selectionState])\n\n const closeDrawer = useCallback(() => {\n //restoreSelection() // Should already be stored by the useEffect below\n closeBaseModal(slug)\n }, [closeBaseModal, slug])\n const isModalOpen = modalState?.[slug]?.isOpen\n\n const toggleDrawer = useCallback(() => {\n if (!isModalOpen) {\n storeSelection()\n } else {\n restoreSelection()\n }\n setWasOpen(true)\n toggleBaseModal(slug)\n }, [slug, storeSelection, toggleBaseModal, restoreSelection, isModalOpen])\n\n // We need to handle drawer closing via a useEffect, as toggleDrawer / closeDrawer will not be triggered if the drawer\n // is closed by clicking outside of the drawer. This useEffect will handle everything.\n useEffect(() => {\n if (!wasOpen) {\n return\n }\n\n const thisModalState = modalState[slug]\n // Exists in modalState (thus has opened at least once before) and is closed\n if (thisModalState && !thisModalState?.isOpen) {\n setWasOpen(false)\n\n if (restoreLate) {\n // restoreLate is used for upload extra field drawers. For some reason, the selection is not restored if we call restoreSelection immediately.\n setTimeout(() => {\n restoreSelection()\n }, 0)\n } else {\n restoreSelection()\n }\n }\n }, [modalState, slug, restoreSelection, wasOpen, restoreLate])\n\n return {\n closeDrawer,\n toggleDraw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AACpB,EAAYV,EAAMsB,EAAkBhB,EAASL,CAAA,EAAYC,EAAA,EAAA,EAAAQ,EAAAR,EAAA,EAAA,EAAAD,EAAAC,EAAA,EAAA,EAAAoB,EAAApB,EAAA,EAAA,EAAAF,EAAAE,EAAA,EAAA,EAAAI,EAAAJ,EAAA,EAAA,EAAA2B,EAAA3B,EAAA,EAAA,EAAA4B,IAAAD,EAAA3B,EAAA,EAAA,EAAA4B,EAAA5B,EAAA,EAAA,GAnB7DL,EAAUgC,EAmBPC,CAA0D,EAAA,IAAAG,EAAA,OAAA/B,EAAA,EAAA,IAAAsB,GAAAtB,EAAA,EAAA,IAAA0B,GAEtDK,EAAA,CAAAT,YAAAA,EAAAI,aAAAA,CAAA,EAGP1B,EAAA,EAAA,EAAAsB,EAAAtB,EAAA,EAAA,EAAA0B,EAAA1B,EAAA,EAAA,EAAA+B,GAAAA,EAAA/B,EAAA,EAAA,EAHO+B,CAGP",
6
+ "names": ["c", "_c", "useForm", "useTranslation", "useEffect", "useRef", "useDrawerSubmit", "$", "t", "submitRef", "t0", "t1", "Symbol", "for", "current", "t2", "label", "onClick", "style", "headerActions", "t3", "RegisterFormSubmit", "submit", "c", "_c", "useLexicalComposerContext", "useModal", "$getPreviousSelection", "$getSelection", "$setSelection", "useEffect", "useState", "useLexicalDrawer", "slug", "restoreLate", "$", "editor", "selectionState", "setSelectionState", "wasOpen", "setWasOpen", "closeModal", "closeBaseModal", "modalState", "toggleModal", "toggleBaseModal", "t0", "read", "selection", "storeSelection", "t1", "update", "clone", "discrete", "skipTransforms", "restoreSelection", "t2", "closeDrawer", "isModalOpen", "isOpen", "t3", "toggleDrawer", "t4", "t5", "thisModalState", "setTimeout", "t6"]
7
+ }
@@ -0,0 +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-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
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 | 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,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AAA,+BAAe3G,GAAA,GAAA,OAAA,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
+ "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
+ }
@@ -1,2 +1,2 @@
1
1
  import{jsx as x}from"react/jsx-runtime";import{useLexicalComposerContext as b}from"@lexical/react/LexicalComposerContext.js";import{useEditDepth as S}from"@payloadcms/ui";import"react";import{createContext as k,use as v,useMemo as j,useRef as g,useState as s}from"react";function B(){return Math.random().toString(36).substring(2,12)+Math.random().toString(36).substring(2,12)}var w=k({editorConfig:null,fieldProps:null,uuid:null}),H=({children:o,editorConfig:c,editorContainerRef:d,fieldProps:a,parentContext:n})=>{let[f]=b(),[l]=s(()=>B()),r=g(new Map),[m,C]=s(null),u=g(new Set),[E,p]=s(),h=S(),M=j(()=>({blurEditor:t=>{u.current.clear()},childrenEditors:r,createdInlineBlock:E,editDepth:h,editor:f,editorConfig:c,editorContainerRef:d,fieldProps:a,focusedEditor:m,focusEditor:t=>{let e=t.uuid;u.current.has(e)||(u.current.add(e),C(t),n?.uuid&&n.focusEditor(t),r.current.forEach(i=>{i.focusEditor(t)}),u.current.clear())},parentEditor:n,registerChild:(t,e)=>{if(!r.current.has(t)){let i=new Map(r.current);i.set(t,e),r.current=i}},setCreatedInlineBlock:p,unregisterChild:t=>{if(r.current.has(t)){let e=new Map(r.current);e.delete(t),r.current=e}},uuid:l}),[E,p,f,r,c,d,h,a,m,n,l]);return x(w,{value:M,children:o})},I=()=>{let o=v(w);if(o===void 0)throw new Error("useEditorConfigContext must be used within an EditorConfigProvider");return o};export{H as a,I as b};
2
- //# sourceMappingURL=chunk-BZZVLW4U.js.map
2
+ //# sourceMappingURL=chunk-RJ5MAOKZ.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lexical/config/client/EditorConfigProvider.tsx"],
4
+ "sourcesContent": ["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { MarkRequired } from 'ts-essentials'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useEditDepth } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { createContext, use, useMemo, useRef, useState } from 'react'\n\nimport type { InlineBlockNode } from '../../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { LexicalRichTextFieldProps } from '../../../types/index.js'\nimport type { SanitizedClientEditorConfig } from '../types.js'\n\n// Should always produce a 20 character pseudo-random string\nfunction generateQuickGuid(): string {\n return Math.random().toString(36).substring(2, 12) + Math.random().toString(36).substring(2, 12)\n}\n\nexport interface EditorConfigContextType {\n // Editor focus handling\n blurEditor: (editorContext: EditorConfigContextType) => void\n childrenEditors: React.RefObject<Map<string, EditorConfigContextType>>\n createdInlineBlock?: InlineBlockNode\n editDepth: number\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n fieldProps: MarkRequired<LexicalRichTextFieldProps, 'path' | 'schemaPath'>\n focusedEditor: EditorConfigContextType | null\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n setCreatedInlineBlock?: React.Dispatch<React.SetStateAction<InlineBlockNode | undefined>>\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\n// @ts-expect-error: TODO: Fix this\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n fieldProps: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n fieldProps,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n\n fieldProps: LexicalRichTextFieldProps\n parentContext?: EditorConfigContextType\n}): React.ReactNode => {\n const [editor] = useLexicalComposerContext()\n // State to store the UUID\n const [uuid] = useState(() => generateQuickGuid())\n\n const childrenEditors = useRef<Map<string, EditorConfigContextType>>(new Map())\n const [focusedEditor, setFocusedEditor] = useState<EditorConfigContextType | null>(null)\n const focusHistory = useRef<Set<string>>(new Set())\n const [createdInlineBlock, setCreatedInlineBlock] = useState<InlineBlockNode>()\n\n const editDepth = useEditDepth()\n\n const editorContext = useMemo(\n () =>\n ({\n blurEditor: (editorContext: EditorConfigContextType) => {\n //setFocusedEditor(null) // Clear focused editor\n focusHistory.current.clear() // Reset focus history when focus is lost\n },\n childrenEditors,\n createdInlineBlock,\n editDepth,\n editor,\n editorConfig,\n editorContainerRef,\n fieldProps,\n focusedEditor,\n focusEditor: (editorContext: EditorConfigContextType) => {\n const editorUUID = editorContext.uuid\n\n // Avoid recursion by checking if this editor is already focused in this cycle\n if (focusHistory.current.has(editorUUID)) {\n return\n }\n\n // Add this editor to the history to prevent future recursions in this cycle\n focusHistory.current.add(editorUUID)\n setFocusedEditor(editorContext)\n\n // Propagate focus event to parent and children, ensuring they do not refocus this editor\n if (parentContext?.uuid) {\n parentContext.focusEditor(editorContext)\n }\n childrenEditors.current.forEach((childEditor) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n parentEditor: parentContext,\n registerChild: (childUUID, childEditorContext) => {\n if (!childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.set(childUUID, childEditorContext)\n childrenEditors.current = newMap\n }\n },\n setCreatedInlineBlock,\n unregisterChild: (childUUID) => {\n if (childrenEditors.current.has(childUUID)) {\n const newMap = new Map(childrenEditors.current)\n newMap.delete(childUUID)\n childrenEditors.current = newMap\n }\n },\n\n uuid,\n }) as EditorConfigContextType,\n [\n createdInlineBlock,\n setCreatedInlineBlock,\n editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n editDepth,\n fieldProps,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context value={editorContext}>{children}</Context>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = use(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],
5
+ "mappings": "wCAKA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,gBAAAA,MAAoB,iBAC7B,MAAuB,QACvB,OAASC,iBAAAA,EAAeC,OAAAA,EAAKC,WAAAA,EAASC,UAAAA,EAAQC,YAAAA,MAAgB,QAO9D,SAASC,GAAA,CACP,OAAOC,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,UAAU,EAAG,EAAA,EAAMH,KAAKC,OAAM,EAAGC,SAAS,EAAA,EAAIC,UAAU,EAAG,EAAA,CAC/F,CAuBA,IAAMC,EAAkDV,EAAc,CACpEW,aAAc,KACdC,WAAY,KACZC,KAAM,IACR,CAAA,EAEaC,EAAuBA,CAAC,CACnCC,SAAAA,EACAJ,aAAAA,EACAK,mBAAAA,EACAJ,WAAAA,EACAK,cAAAA,CAAa,IAQd,CACC,GAAM,CAACC,CAAA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AK,EACAW,EACAf,EACAS,EACAJ,EACAJ,CAAA,CACD,EAGH,OAAOiC,EAACpC,EAAA,CAAQqC,MAAOnB,WAAgBb,GACzC,EAEaiC,EAAyBA,IAAA,CACpC,IAAMC,EAAUhD,EAAIS,CAAA,EACpB,GAAIuC,IAAYC,OACd,MAAM,IAAIC,MAAM,oEAAA,EAElB,OAAOF,CACT",
6
+ "names": ["useLexicalComposerContext", "useEditDepth", "createContext", "use", "useMemo", "useRef", "useState", "generateQuickGuid", "Math", "random", "toString", "substring", "Context", "editorConfig", "fieldProps", "uuid", "EditorConfigProvider", "children", "editorContainerRef", "parentContext", "editor", "childrenEditors", "Map", "focusedEditor", "setFocusedEditor", "focusHistory", "Set", "createdInlineBlock", "setCreatedInlineBlock", "editDepth", "editorContext", "blurEditor", "current", "clear", "focusEditor", "editorUUID", "has", "add", "forEach", "childEditor", "parentEditor", "registerChild", "childUUID", "childEditorContext", "newMap", "set", "unregisterChild", "delete", "_jsx", "value", "useEditorConfigContext", "context", "undefined", "Error"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{a as O,b as y}from"./chunk-5VIL27GI.js";import{b as F}from"./chunk-RJ5MAOKZ.js";import{c as q}from"react/compiler-runtime";import{jsx as _}from"react/jsx-runtime";import{Drawer as z,EditDepthProvider as G,useModal as J}from"@payloadcms/ui";import"react";import{jsx as I,jsxs as N}from"react/jsx-runtime";import{useLexicalEditable as T}from"@lexical/react/useLexicalEditable";import{Form as W,RenderFields as $,useDocumentForm as v,useDocumentInfo as k,useServerFunctions as L}from"@payloadcms/ui";import{abortAndIgnore as R}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as E}from"payload/shared";import{useCallback as B,useEffect as M,useRef as H,useState as U}from"react";import{v4 as V}from"uuid";var j=({data:S,featureKey:e,fieldMapOverride:b,handleDrawerSubmit:w,schemaFieldsPathOverride:r,schemaPath:A,schemaPathSuffix:u,submitRef:D})=>{let{id:o,collectionSlug:a,getDocPreferences:i,globalSlug:n}=k(),{fields:s}=v(),t=T(),m=H(new AbortController),[d,l]=U(!1),{fieldProps:{featureClientSchemaMap:f}}=F(),{getFormState:p}=L(),c=r??`${A}.lexical_internal_feature.${e}${u?`.${u}`:""}`,C=b??f[e]?.[c];M(()=>{let h=new AbortController;return(async()=>{let{state:g}=await p({id:o,collectionSlug:a,data:S??{},docPermissions:{fields:!0},docPreferences:await i(),documentFormState:E(s,{excludeFiles:!0}),globalSlug:n,initialBlockData:S,operation:"update",readOnly:!t,renderAllFields:!0,schemaPath:c,signal:h.signal});l(g)})(),()=>{R(h)}},[c,o,S,p,a,t,n,i,s]);let x=B(async({formState:h})=>{R(m.current);let P=new AbortController;m.current=P;let{state:g}=await p({id:o,collectionSlug:a,docPermissions:{fields:!0},docPreferences:await i(),documentFormState:E(s,{excludeFiles:!0}),formState:h,globalSlug:n,initialBlockFormState:h,operation:"update",readOnly:!t,schemaPath:c,signal:P.signal});return g||h},[p,o,t,a,i,s,n,c]);return M(()=>()=>{R(m.current)},[]),d===!1?null:N(W,{beforeSubmit:[x],className:"fields-drawer",disableValidationOnSubmit:!0,fields:Array.isArray(C)?C:[],initialState:d,onChange:[x],onSubmit:w,uuid:V(),children:[I($,{fields:Array.isArray(C)?C:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:c,permissions:!0,readOnly:!t}),I(y,{submitRef:D})]})};var pe=S=>{let e=q(17),{className:b,data:w,drawerSlug:r,drawerTitle:A,featureKey:u,fieldMapOverride:D,handleDrawerSubmit:o,schemaFieldsPathOverride:a,schemaPath:i,schemaPathSuffix:n}=S,{closeModal:s}=J(),{headerActions:t,submitRef:m}=O(),d=A??"",l;e[0]!==s||e[1]!==r||e[2]!==o?(l=(p,c)=>{s(r),setTimeout(()=>{o(p,c)},1)},e[0]=s,e[1]=r,e[2]=o,e[3]=l):l=e[3];let f;return e[4]!==b||e[5]!==w||e[6]!==r||e[7]!==u||e[8]!==D||e[9]!==t||e[10]!==a||e[11]!==i||e[12]!==n||e[13]!==m||e[14]!==d||e[15]!==l?(f=_(G,{children:_(z,{className:b,headerActions:t,slug:r,title:d,children:_(j,{data:w,featureKey:u,fieldMapOverride:D,handleDrawerSubmit:l,schemaFieldsPathOverride:a,schemaPath:i,schemaPathSuffix:n,submitRef:m})})}),e[4]=b,e[5]=w,e[6]=r,e[7]=u,e[8]=D,e[9]=t,e[10]=a,e[11]=i,e[12]=n,e[13]=m,e[14]=d,e[15]=l,e[16]=f):f=e[16],f};import{createCommand as K}from"lexical";var be=K("INSERT_UPLOAD_WITH_DRAWER_COMMAND");export{pe as a,be as b};
2
+ //# sourceMappingURL=chunk-UD4DQ4AK.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"],
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"],
5
+ "mappings": "uFAAA,OAAAA,KAAAC,MAAA,iEAGA,OAASC,UAAAA,EAAQC,qBAAAA,EAAmBC,YAAAA,MAAgB,iBACpD,MAAkB,0DCDlB,OAASC,sBAAAA,MAA0B,oCACnC,OACEC,QAAAA,EACAC,gBAAAA,EACAC,mBAAAA,EACAC,mBAAAA,EACAC,sBAAAA,MACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,8CAAAA,MAAkD,iBAC3D,OAAgBC,eAAAA,EAAaC,aAAAA,EAAWC,UAAAA,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o", "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"]
7
+ }
@@ -0,0 +1,2 @@
1
+ var P=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";import{c as ct}from"react/compiler-runtime";import{useRef as lt}from"react";function Gt(i){let t=ct(2),e=i===void 0?500:i,o=lt(void 0),n;return t[0]!==e?(n=c=>new Promise(a=>{let s=()=>{c(),a()};"requestIdleCallback"in window?("cancelIdleCallback"in window&&o.current!==void 0&&cancelIdleCallback(o.current),o.current=requestIdleCallback(s,{timeout:e})):at().then(s)}),t[0]=e,t[1]=n):n=t[1],n}function at(){return new Promise(i=>{setTimeout(i,100),requestAnimationFrame(()=>{setTimeout(i,0)})})}import{jsx as ut}from"react/jsx-runtime";import{useControllableState as ft}from"@payloadcms/ui";import{createContext as dt,use as mt,useMemo as ht}from"react";var V=dt({currentView:"default",inheritable:!1,setCurrentView:()=>{}}),oe=i=>{let t=pt(),e=i.currentView!==void 0,o=t.inheritable&&(!!t.views||!!t.hasExplicitCurrentView),n=e||t.inheritable&&!!t.hasExplicitCurrentView,{children:r,currentView:c,inheritable:a,views:s}={children:i.children,currentView:o?t.currentView:i.currentView,inheritable:t.inheritable||i.inheritable,views:o&&t.views?t.views:i.views},[f,d]=ft(c,"default"),m=s&&f!=="default"&&!s[f]?"default":f,h=ht(()=>{let y=s?s[m]:void 0;return{currentView:m,currentViewMap:y,hasExplicitCurrentView:n,inheritable:a,isControlledByParent:o,setCurrentView:d,views:s}},[m,a,n,o,d,s]);return ut(V,{value:h,children:r})};function pt(){return mt(V)}var T=class{_x;_y;constructor(t,e){this._x=t,this._y=e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}equals({x:t,y:e}){return this.x===t&&this.y===e}get x(){return this._x}get y(){return this._y}};function $(i){return i instanceof T}import{jsx as At}from"react/jsx-runtime";import{useLexicalComposerContext as Lt}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Bt}from"@lexical/utils";import{$getSelection as I,$isRangeSelection as N,$isTextNode as Pt,COMMAND_PRIORITY_LOW as Vt,createCommand as $t,getDOMSelection as Yt}from"lexical";import{useCallback as J,useEffect as G,useState as Wt}from"react";import*as v from"react";import{c as q}from"react/compiler-runtime";import{useLexicalComposerContext as U}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Y}from"@lexical/utils";import{$getSelection as F,$isRangeSelection as gt,$setSelection as _t,COMMAND_PRIORITY_LOW as W,COMMAND_PRIORITY_NORMAL as C,createCommand as wt,KEY_ARROW_DOWN_COMMAND as yt,KEY_ARROW_UP_COMMAND as Ot,KEY_ENTER_COMMAND as xt,KEY_ESCAPE_COMMAND as bt,KEY_TAB_COMMAND as Ct}from"lexical";import{useCallback as E,useEffect as x,useLayoutEffect as St,useMemo as Mt,useRef as Rt,useState as Dt}from"react";var Tt="slash-menu-popup",H=i=>{let t=document.getElementById("slash-menu");if(!t)return;let e=t.getBoundingClientRect();e.top+e.height>window.innerHeight&&t.scrollIntoView({block:"center"}),e.top<0&&t.scrollIntoView({block:"center"}),i.scrollIntoView({block:"nearest"})};function Et(i,t,e){let o=e;for(let n=o;n<=t.length;n++)i.substring(i.length-n)===t.substring(0,n)&&(o=n);return o}function vt(i){let t=F();if(!gt(t)||!t.isCollapsed())return;let e=t.anchor;if(e.type!=="text")return;let o=e.getNode();if(!o.isSimpleText())return;let n=e.offset,r=o.getTextContent().slice(0,n),c=i.replaceableString.length,a=Et(r,i.matchingString,c),s=n-a;if(s<0)return;let f;return s===0?[f]=o.splitText(n):[,f]=o.splitText(s,n),f}function It(i,t){let e=getComputedStyle(i),o=e.position==="absolute",n=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(e.position==="fixed")return document.body;for(let r=i;r=r.parentElement;)if(e=getComputedStyle(r),!(o&&e.position==="static")&&n.test(e.overflow+e.overflowY+e.overflowX))return r;return document.body}function X(i,t){let e=i.getBoundingClientRect(),o=t.getBoundingClientRect();return e.top>o.top&&e.top<o.bottom}function Nt(i,t,e,o){let n=q(7),[r]=U(),c,a;n[0]!==r||n[1]!==e||n[2]!==o||n[3]!==i||n[4]!==t?(c=()=>{let s=t.current;if(s!=null&&i!=null){let f=r.getRootElement(),d=f!=null?It(f,!1):document.body,m=!1,h=X(s,d),y=function(){m||(window.requestAnimationFrame(function(){e(),m=!1}),m=!0);let l=X(s,d);l!==h&&(h=l,o?.(l))},u=new ResizeObserver(e);return window.addEventListener("resize",e),document.addEventListener("scroll",y,{capture:!0,passive:!0}),u.observe(s),()=>{u.disconnect(),window.removeEventListener("resize",e),document.removeEventListener("scroll",y,!0)}}},a=[r,o,e,i,t],n[0]=r,n[1]=e,n[2]=o,n[3]=i,n[4]=t,n[5]=c,n[6]=a):(c=n[5],a=n[6]),x(c,a)}var j=wt("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function z({anchorElementRef:i,close:t,editor:e,groups:o,menuRenderFn:n,resolution:r,shouldSplitNodeWithQuery:c=!1}){let[a,s]=Dt(null),f=r.match&&r.match.matchingString||"",d=E(u=>{let l=e.getRootElement();l!==null&&(l.setAttribute("aria-activedescendant",`${Tt}__item-${u.key}`),s(u.key))},[e]),m=E(()=>{if(o!==null&&f!=null){let u=o.flatMap(l=>l.items);if(u.length){let l=u[0];d(l)}}},[o,d,f]);x(()=>{m()},[f,m]);let h=E(u=>{t(),e.update(()=>{let l=r.match!=null&&c?vt(r.match):null;l&&l.remove()}),setTimeout(()=>{let l;e.read(()=>{l=F()?.clone()}),e.update(()=>{l&&_t(l)}),u.onSelect({editor:e,queryString:r.match?r.match.matchingString:""})},0)},[e,c,r.match,t]);x(()=>()=>{let u=e.getRootElement();u!==null&&u.removeAttribute("aria-activedescendant")},[e]),St(()=>{o===null?s(null):a===null&&m()},[o,a,d,m]),x(()=>Y(e.registerCommand(j,({item:u})=>u.ref&&u.ref.current!=null?(H(u.ref.current),!0):!1,W)),[e,d]),x(()=>Y(e.registerCommand(yt,u=>{let l=u;if(o!==null&&o.length&&a!==null){let g=o.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&&e.dispatchCommand(j,{index:O,item:w}),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),e.registerCommand(Ot,u=>{let l=u;if(o!==null&&o.length&&a!==null){let g=o.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&&H(w.ref.current),l.preventDefault(),l.stopImmediatePropagation()}return!0},C),e.registerCommand(bt,u=>{let l=u;return l.preventDefault(),l.stopImmediatePropagation(),t(),!0},W),e.registerCommand(Ct,u=>{let l=u;if(o===null||a===null)return!1;let p=o.flatMap(O=>O.items).find(O=>O.key===a);return p?(l.preventDefault(),l.stopImmediatePropagation(),h(p),!0):!1},C),e.registerCommand(xt,u=>{if(o===null||a===null)return!1;let g=o.flatMap(p=>p.items).find(p=>p.key===a);return g?(u!==null&&(u.preventDefault(),u.stopImmediatePropagation()),h(g),!0):!1},C)),[h,t,e,o,a,d]);let y=Mt(()=>({groups:o,selectedItemKey:a,selectItemAndCleanUp:h,setSelectedItemKey:s}),[h,a,o]);return n(i,y,r.match?r.match.matchingString:"")}function kt(i,t){t!=null&&(i.className=t),i.setAttribute("aria-label","Slash menu"),i.setAttribute("role","listbox"),i.style.display="block",i.style.position="absolute"}function K(i,t,e,o){let n=q(14),[r]=U(),c;n[0]===Symbol.for("react.memo_cache_sentinel")?(c=P?document.createElement("div"):null,n[0]=c):c=n[0];let a=Rt(c),s;n[1]!==i||n[2]!==o||n[3]!==r||n[4]!==t?(s=()=>{if(a.current===null||parent===void 0)return;let u=r.getRootElement(),l=a.current,g=l.firstChild;if(u!==null&&t!==null){let{height:p,width:O}=t.getRect(),{left:w,top:_}=t.getRect(),S=_;if(_=_-(i.getBoundingClientRect().top+window.scrollY),w=w-(i.getBoundingClientRect().left+window.scrollX),l.style.left=`${w+window.scrollX}px`,l.style.height=`${p}px`,l.style.width=`${O}px`,g!==null){let M=g.getBoundingClientRect(),A=M.height,R=M.width,D=u.getBoundingClientRect(),L=document.dir==="rtl"||document.documentElement.dir==="rtl",ot=i.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&&M.left<B){let st=B+R-ot.left;l.style.left=`${st+window.scrollX}px`}let it=S+A+32>window.innerHeight,rt=S<0;it&&!rt?l.style.top=`${_+32-A+window.scrollY-(p+24)}px`:l.style.top=`${_+window.scrollY+32}px`}l.isConnected||(kt(l,o),i.append(l)),l.setAttribute("id","slash-menu"),a.current=l,u.setAttribute("aria-controls","slash-menu")}},n[1]=i,n[2]=o,n[3]=r,n[4]=t,n[5]=s):s=n[5];let f=s,d,m;n[6]!==r||n[7]!==f||n[8]!==t?(d=()=>{let u=r.getRootElement();if(t!==null)return f(),()=>{u!==null&&u.removeAttribute("aria-controls");let l=a.current;l!==null&&l.isConnected&&(l.remove(),l.removeAttribute("id"))}},m=[r,f,t],n[6]=r,n[7]=f,n[8]=t,n[9]=d,n[10]=m):(d=n[9],m=n[10]),x(d,m);let h;return n[11]!==t||n[12]!==e?(h=u=>{t!==null&&(u||e(null))},n[11]=t,n[12]=e,n[13]=h):h=n[13],Nt(t,a,f,h),a}var ye=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function Ht(i){let t=i.anchor;if(t.type!=="text")return null;let e=t.getNode();if(!e.isSimpleText())return null;let o=t.offset;return e.getTextContent().slice(0,o)}function Q(i,t,e){let o=Yt(e);if(o===null||!o.isCollapsed)return!1;let n=o.anchorNode,r=i,c=o.anchorOffset;if(n==null||c==null)return!1;try{t.setStart(n,r),t.setEnd(n,c>1?c:1)}catch{return!1}return!0}function Xt(i){let t;return i.getEditorState().read(()=>{let e=I();N(e)&&(t=Ht(e))}),t}function Z(i,t){return t!==0?!1:i.getEditorState().read(()=>{let e=I();if(N(e)){let r=e.anchor.getNode().getPreviousSibling();return Pt(r)&&r.isTextEntity()}return!1})}function tt(i){v.startTransition?v.startTransition(i):i()}var jt=$t("ENABLE_SLASH_MENU_COMMAND");function Oe({anchorClassName:i,anchorElem:t,groups:e,menuRenderFn:o,onClose:n,onOpen:r,onQueryChange:c,triggerFn:a}){let[s]=Lt(),[f,d]=Wt(null),m=K(t,f,d,i),h=J(()=>{d(null),n!=null&&f!==null&&n()},[n,f]),y=J(u=>{d(u),r!=null&&f===null&&r(u)},[r,f]);return G(()=>Bt(s.registerCommand(jt,({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&&tt(()=>y({getRect:()=>p.getBoundingClientRect(),match:l}));return}}),!0),Vt)),[s,y]),G(()=>{let u=()=>{s.getEditorState().read(()=>{let g=s._window??window,p=g.document.createRange(),O=I(),w=Xt(s);if(!N(O)||!O.isCollapsed()||w===void 0||p===null){h();return}let _=a({editor:s,query:w});if(c(_?_.matchingString:null),_!==null&&!Z(s,_.leadOffset)&&Q(_.leadOffset,p,g)!==null){tt(()=>y({getRect:()=>p.getBoundingClientRect(),match:_}));return}h()})},l=s.registerUpdateListener(u);return()=>{l()}},[s,a,c,f,h,y]),m.current===null||f===null||s===null?null:At(z,{anchorElementRef:m,close:h,editor:s,groups:e,menuRenderFn:o,resolution:f,shouldSplitNodeWithQuery:!0})}var et=class i{_bottom;_left;_right;_top;constructor(t,e,o,n){let[r,c]=e<=n?[e,n]:[n,e],[a,s]=t<=o?[t,o]:[o,t];this._top=r,this._right=s,this._left=a,this._bottom=c}static fromDOM(t){let{height:e,left:o,top:n,width:r}=t.getBoundingClientRect();return i.fromLWTH(o,r,n,e)}static fromDOMRect(t){let{height:e,left:o,top:n,width:r}=t;return i.fromLWTH(o,r,n,e)}static fromLTRB(t,e,o,n){return new i(t,e,o,n)}static fromLWTH(t,e,o,n){return new i(t,o,t+e,o+n)}static fromPoints(t,e){let{x:o,y:n}=t,{x:r,y:c}=e;return i.fromLTRB(o,n,r,c)}contains(t){if($(t)){let{x:c,y:a}=t,s=a<this._top,f=a>this._bottom,d=c<this._left,m=c>this._right;return{reason:{isOnBottomSide:f,isOnLeftSide:d,isOnRightSide:m,isOnTopSide:s},result:!s&&!f&&!d&&!m}}let{bottom:e,left:o,right:n,top:r}=t;return r>=this._top&&r<=this._bottom&&e>=this._top&&e<=this._bottom&&o>=this._left&&o<=this._right&&n>=this._left&&n<=this._right}distanceFromPoint(t){let e=this.contains(t);if(e.result)return{distance:0,isOnBottomSide:e.reason.isOnBottomSide,isOnLeftSide:e.reason.isOnLeftSide,isOnRightSide:e.reason.isOnRightSide,isOnTopSide:e.reason.isOnTopSide};let o=0,n=0;return t.x<this._left?o=this._left-t.x:t.x>this._right&&(o=t.x-this._right),t.y<this._top?n=this._top-t.y:t.y>this._bottom&&(n=t.y-this._bottom),{distance:Math.sqrt(o*o+n*n),isOnBottomSide:t.y>this._bottom,isOnLeftSide:t.x<this._left,isOnRightSide:t.x>this._right,isOnTopSide:t.y<this._top}}equals({bottom:t,left:e,right:o,top:n}){return n===this._top&&t===this._bottom&&e===this._left&&o===this._right}generateNewRect({bottom:t=this.bottom,left:e=this.left,right:o=this.right,top:n=this.top}){return new i(e,n,o,t)}intersectsWith(t){let{height:e,left:o,top:n,width:r}=t,{height:c,left:a,top:s,width:f}=this,d=o+r>=a+f?o+r:a+f,m=n+e>=s+c?n+e:s+c,h=o<=a?o:a,y=n<=s?n:s;return d-h<=r+f&&m-y<=e+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 Me(i,t){b.has(i)||b.set(i,new Map);let e=b.get(i);for(let[o,n]of Object.entries(t))if(!(!n||typeof n!="object")){if(o==="blocks"){for(let[r,c]of Object.entries(n))e.set(`block:${r}`,c);continue}if(o==="inlineBlocks"){for(let[r,c]of Object.entries(n))e.set(`inlineBlock:${r}`,c);continue}e.set(o,n)}}function Re(i){b.delete(i)}function nt(i,t,e){let o=b.get(i);if(t==="block"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`block:${n}`)}if(t==="inlineBlock"&&e?.__fields?.blockType){let n=e.__fields.blockType;return o?.get(`inlineBlock:${n}`)}return o?.get(t)}function qt({node:i,nodeType:t}){if(!("getType"in i)||i.getType()!==t)return;let e=i;if(e.prototype._originalDecorate||(e.prototype._originalDecorate=e.prototype.decorate),e.prototype._originalCreateDOM||(e.prototype._originalCreateDOM=e.prototype.createDOM),e.prototype.decorate&&!e.prototype._decorateOverridden){e.prototype._decorateOverridden=!0;let o=!!e.prototype.createDOM;e.prototype.decorate=function(n,r){let c=nt(n,t,this);if(c){if(c.Component)return c.Component({config:r,editor:n,isEditor:!0,isJSXConverter:!1,node:this});if(c.createDOM&&c.html){let s=typeof c.html=="function"?c.html({config:r,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):c.html;return k.createElement("span",{dangerouslySetInnerHTML:{__html:s}})}if(c.html&&o&&!c.createDOM)return k.createElement(k.Fragment);if(t==="block"){let s=c;if(s.Block||s.Label)return e.prototype._originalDecorate.call(this,n,r,s.Block,s.Label)}else if(t==="inlineBlock"){let s=c;if(s.Block||s.Label)return e.prototype._originalDecorate.call(this,n,r,s.Block,s.Label)}}return e.prototype._originalDecorate.call(this,n,r)}}e.prototype.createDOM&&!e.prototype._createDOMOverridden&&(e.prototype._createDOMOverridden=!0,e.prototype.createDOM=function(o,n){let r=nt(n,t,this);if(r){if(r.createDOM)return r.createDOM({config:o,editor:n,node:this});if(r.html){let c=typeof r.html=="function"?r.html({config:o,editor:n,isEditor:!0,isJSXConverter:!1,node:this}):r.html,a=document.createElement("div");return a.innerHTML=c,a.firstElementChild||a}}return e.prototype._originalCreateDOM.call(this,o,n)})}function De({editorConfig:i,nodeViews:t}){let e=Ut({nodes:i.features.nodes});if(t){let o=new Set;for(let[n,r]of Object.entries(t))!r||typeof r!="object"||(n==="blocks"&&Object.keys(r).length>0?o.add("block"):n==="inlineBlocks"&&Object.keys(r).length>0?o.add("inlineBlock"):o.add(n));for(let n of e)if("getType"in n){let r=n.getType();o.has(r)&&qt({node:n,nodeType:r})}}return e}function Ut({nodes:i}){return i.map(t=>"node"in t?t.node:t)}export{P as a,Gt as b,oe as c,pt as d,T as e,$ as f,ye as g,jt as h,Oe as i,et as j,Me as k,Re as l,De as m};
2
+ //# sourceMappingURL=chunk-X3D4LZS7.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lexical/utils/canUseDOM.ts", "../../../src/utilities/useRunDeprioritized.ts", "../../../src/field/RichTextViewProvider.tsx", "../../../src/lexical/utils/point.ts", "../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.tsx", "../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx", "../../../src/lexical/utils/rect.ts", "../../../src/lexical/nodes/index.ts"],
4
+ "sourcesContent": ["'use client'\nexport const CAN_USE_DOM: boolean =\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined'\n", "'use client'\nimport { useCallback, useRef } from 'react'\n\n/**\n * Simple hook that lets you run any callback once the main thread is idle\n * (via `requestIdleCallback`) or when that API is missing (Safari) - after the\n * next animation frame (`interactionResponse`).\n *\n * This will help you to avoid blocking the main thread with heavy work.\n *\n * The latest invocation wins: if a new run is queued before the previous one\n * executes, the previous task is cancelled.\n *\n * Usage:\n * ```ts\n * const runDeprioritized = useRunDeprioritized();\n *\n * const onEditorChange = (state: EditorState) => {\n * runDeprioritized(() => {\n * // heavy work here …\n * });\n * };\n * ```\n *\n * @param timeout Optional timeout (ms) for `requestIdleCallback`; defaults to 500 ms.\n * @returns A `runDeprioritized(fn)` helper.\n */\n\nexport function useRunDeprioritized(timeout = 500) {\n const idleHandleRef = useRef<number>(undefined)\n\n /**\n * Schedule `fn` and resolve when it has executed.\n */\n const runDeprioritized = useCallback(\n (fn: () => void): Promise<void> => {\n return new Promise<void>((resolve) => {\n const exec = () => {\n fn()\n resolve()\n }\n\n if ('requestIdleCallback' in window) {\n // Cancel any previously queued task so only the latest runs.\n if ('cancelIdleCallback' in window && idleHandleRef.current !== undefined) {\n // Cancel earlier scheduled value updates,\n // so that a CPU-limited event loop isn't flooded with n callbacks for n keystrokes into the rich text field,\n // but that there's only ever the latest one state update\n // dispatch task, to be executed with the next idle time,\n // or the deadline of 500ms.\n cancelIdleCallback(idleHandleRef.current)\n }\n // Schedule the state update to happen the next time the browser has sufficient resources,\n // or the latest after 500ms.\n idleHandleRef.current = requestIdleCallback(exec, { timeout })\n } else {\n // Safari fallback: rAF + setTimeout shim.\n void interactionResponse().then(exec)\n }\n })\n },\n [timeout],\n )\n\n return runDeprioritized\n}\n\nfunction interactionResponse(): Promise<unknown> {\n // Taken from https://github.com/vercel-labs/await-interaction-response/tree/main/packages/await-interaction-response/src\n\n return new Promise((resolve) => {\n setTimeout(resolve, 100) // Fallback for the case where the animation frame never fires.\n requestAnimationFrame(() => {\n setTimeout(resolve, 0)\n })\n })\n}\n", "'use client'\nimport { useControllableState } from '@payloadcms/ui'\nimport React, { createContext, use, useMemo } from 'react'\n\nimport type { LexicalEditorNodeMap, LexicalEditorViewMap } from '../types/index.js'\n\n/**\n * Context for managing richtext editor view state and inheritance.\n */\ntype RichTextViewContextType = {\n /**\n * The currently active view name (e.g., 'default', 'frontend', 'debug').\n */\n currentView: string\n /**\n * The resolved node map for the current view, containing rendering overrides for each node type.\n */\n currentViewMap?: LexicalEditorNodeMap\n /**\n * True if the current view was explicitly set (via prop) by this provider or an ancestor.\n * Used to distinguish intentional view settings from automatic defaults.\n */\n hasExplicitCurrentView?: boolean\n /**\n * If true, nested richtext editors will inherit this provider's currentView and views.\n */\n inheritable?: boolean\n /**\n * True if this provider's view is controlled by an ancestor provider — either because the\n * ancestor has a views map (view-map inheritance) or an explicit `currentView` prop.\n * When true, the ViewSelector is hidden.\n */\n isControlledByParent?: boolean\n /**\n * Function to programmatically change the current view.\n */\n setCurrentView: (view: string) => void\n /**\n * Map of all available views for this editor. Each key is a view name, each value contains\n * admin config, node overrides, and lexical config for that view.\n */\n views?: LexicalEditorViewMap\n}\n\nconst RichTextViewContext = createContext<RichTextViewContextType>({\n currentView: 'default',\n inheritable: false,\n setCurrentView: () => {},\n})\n\n/**\n * Provider for managing richtext editor view state and its inheritance.\n *\n * Handles two key scenarios:\n * 1. **Explicit view setting**: Wrap with `currentView` and `inheritable={true}` to force nested editors to a specific view\n * 2. **View map inheritance**: Nested editors inherit `views` from parents, allowing view switching across the hierarchy\n *\n * When a nested editor inherits from a parent, its ViewSelector is hidden because the view is controlled by an ancestor.\n *\n * @example\n * Force all nested richtext editors to use \"frontend\" view:\n * ```tsx\n * <RichTextViewProvider currentView=\"frontend\" inheritable={true}>\n * <MyForm /> {/* All richtext fields inside will use \"frontend\" view }\n * </RichTextViewProvider>\n * ```\n */\nexport const RichTextViewProvider: React.FC<{\n children: React.ReactNode\n currentView?: string\n inheritable?: boolean\n views?: LexicalEditorViewMap\n}> = (args) => {\n const parentContext = useRichTextView()\n\n // Track if this provider explicitly sets currentView (not just using the default)\n const hasOwnExplicitView = args.currentView !== undefined\n\n const isControlledByParent =\n parentContext.inheritable &&\n (Boolean(parentContext.views) || Boolean(parentContext.hasExplicitCurrentView))\n\n // This provider has explicit currentView if it sets one OR inherits one from parent\n const hasExplicitCurrentView =\n hasOwnExplicitView ||\n (parentContext.inheritable && Boolean(parentContext.hasExplicitCurrentView))\n\n const {\n children,\n currentView: currentViewFromProps,\n inheritable,\n views,\n } = {\n children: args.children,\n currentView: isControlledByParent ? parentContext.currentView : args.currentView,\n // Propagate inheritable flag through the hierarchy\n inheritable: parentContext.inheritable || args.inheritable,\n // Only inherit views if parent has a views map\n views: isControlledByParent && parentContext.views ? parentContext.views : args.views,\n }\n\n const [currentViewRaw, setCurrentView] = useControllableState(currentViewFromProps, 'default')\n\n // Normalize currentView: if the requested view doesn't exist in this editor's\n // views map, fall back to 'default'. This ensures all consumers of useRichTextView()\n // see a consistent currentView that actually exists\n const currentView =\n views && currentViewRaw !== 'default' && !views[currentViewRaw] ? 'default' : currentViewRaw\n\n const value = useMemo(() => {\n const currentViewMap = views ? views[currentView] : undefined\n return {\n currentView,\n currentViewMap,\n hasExplicitCurrentView,\n inheritable,\n isControlledByParent,\n setCurrentView,\n views,\n }\n }, [\n currentView,\n inheritable,\n hasExplicitCurrentView,\n isControlledByParent,\n setCurrentView,\n views,\n ])\n\n return <RichTextViewContext value={value}>{children}</RichTextViewContext>\n}\n\n/**\n * Access the current richtext editor view context.\n *\n * Returns the active view name, node overrides, inheritance state, and a function to switch views.\n *\n * @example\n * ```tsx\n * function MyComponent() {\n * const { currentView, currentViewMap, isControlledByParent, setCurrentView } = useRichTextView()\n *\n * return (\n * <div>\n * <p>Active view: {currentView}</p>\n * {isControlledByParent && <p>View controlled by parent</p>}\n * {currentViewMap?.heading && <p>Custom heading renderer active</p>}\n * <button onClick={() => setCurrentView('frontend')}>Switch to frontend</button>\n * </div>\n * )\n * }\n * ```\n */\nexport function useRichTextView(): RichTextViewContextType {\n return use(RichTextViewContext)\n}\n", "'use client'\nexport class Point {\n private readonly _x: number\n\n private readonly _y: number\n\n constructor(x: number, y: number) {\n this._x = x\n this._y = y\n }\n\n public calcDeltaXTo({ x }: Point): number {\n return this.x - x\n }\n\n public calcDeltaYTo({ y }: Point): number {\n return this.y - y\n }\n\n public calcDistanceTo(point: Point): number {\n return Math.sqrt(Math.pow(this.calcDeltaXTo(point), 2) + Math.pow(this.calcDeltaYTo(point), 2))\n }\n\n public calcHorizontalDistanceTo(point: Point): number {\n return Math.abs(this.calcDeltaXTo(point))\n }\n\n public calcVerticalDistance(point: Point): number {\n return Math.abs(this.calcDeltaYTo(point))\n }\n\n public equals({ x, y }: Point): boolean {\n return this.x === x && this.y === y\n }\n\n get x(): number {\n return this._x\n }\n\n get y(): number {\n return this._y\n }\n}\n\nexport function isPoint(x: unknown): x is Point {\n return x instanceof Point\n}\n", "'use client'\nimport type { LexicalCommand, LexicalEditor, ParagraphNode, RangeSelection } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n createCommand,\n getDOMSelection,\n} from 'lexical'\nimport { type JSX, useCallback, useEffect, useState } from 'react'\nimport * as React from 'react'\n\nimport type { MenuTextMatch, TriggerFn } from '../useMenuTriggerMatch.js'\nimport type { MenuRenderFn, MenuResolution } from './LexicalMenu.js'\nimport type { SlashMenuGroupInternal } from './types.js'\n\nimport { LexicalMenu, useMenuAnchorRef } from './LexicalMenu.js'\n\nexport const PUNCTUATION = '\\\\.,\\\\+\\\\*\\\\?\\\\$\\\\@\\\\|#{}\\\\(\\\\)\\\\^\\\\-\\\\[\\\\]\\\\\\\\/!%\\'\"~=<>_:;'\n\nfunction getTextUpToAnchor(selection: RangeSelection): null | string {\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return null\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return null\n }\n const anchorOffset = anchor.offset\n return anchorNode.getTextContent().slice(0, anchorOffset)\n}\n\nfunction tryToPositionRange(leadOffset: number, range: Range, editorWindow: Window): boolean {\n const domSelection = getDOMSelection(editorWindow)\n if (domSelection === null || !domSelection.isCollapsed) {\n return false\n }\n\n const anchorNode = domSelection.anchorNode\n const startOffset = leadOffset\n const endOffset = domSelection.anchorOffset\n\n if (anchorNode == null || endOffset == null) {\n return false\n }\n\n try {\n range.setStart(anchorNode, startOffset)\n // if endOffset is 0, positioning the range for when you click the plus button to open the slash menu will fial\n range.setEnd(anchorNode, endOffset > 1 ? endOffset : 1)\n } catch (error) {\n return false\n }\n\n return true\n}\n\nfunction getQueryTextForSearch(editor: LexicalEditor): string | undefined {\n let text\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return\n }\n text = getTextUpToAnchor(selection)\n })\n return text\n}\n\nfunction isSelectionOnEntityBoundary(editor: LexicalEditor, offset: number): boolean {\n if (offset !== 0) {\n return false\n }\n return editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n const anchor = selection.anchor\n const anchorNode = anchor.getNode()\n const prevSibling = anchorNode.getPreviousSibling()\n return $isTextNode(prevSibling) && prevSibling.isTextEntity()\n }\n return false\n })\n}\n\nfunction startTransition(callback: () => void) {\n if (React.startTransition) {\n React.startTransition(callback)\n } else {\n callback()\n }\n}\n\nexport { useDynamicPositioning } from './LexicalMenu.js'\n\nexport type TypeaheadMenuPluginProps = {\n anchorClassName?: string\n anchorElem: HTMLElement\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onClose?: () => void\n onOpen?: (resolution: MenuResolution) => void\n onQueryChange: (matchingString: null | string) => void\n triggerFn: TriggerFn\n}\n\nexport const ENABLE_SLASH_MENU_COMMAND: LexicalCommand<{\n node: ParagraphNode\n}> = createCommand('ENABLE_SLASH_MENU_COMMAND')\n\nexport function LexicalTypeaheadMenuPlugin({\n anchorClassName,\n anchorElem,\n groups,\n menuRenderFn,\n onClose,\n onOpen,\n onQueryChange,\n triggerFn,\n}: TypeaheadMenuPluginProps): JSX.Element | null {\n const [editor] = useLexicalComposerContext()\n const [resolution, setResolution] = useState<MenuResolution | null>(null)\n const anchorElementRef = useMenuAnchorRef(anchorElem, resolution, setResolution, anchorClassName)\n\n const closeTypeahead = useCallback(() => {\n setResolution(null)\n if (onClose != null && resolution !== null) {\n onClose()\n }\n }, [onClose, resolution])\n\n const openTypeahead = useCallback(\n (res: MenuResolution) => {\n setResolution(res)\n if (onOpen != null && resolution === null) {\n onOpen(res)\n }\n },\n [onOpen, resolution],\n )\n\n // This is mainly used for the AddBlockHandlePlugin, so that the slash menu can be opened from there\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n ENABLE_SLASH_MENU_COMMAND,\n ({ node }) => {\n editor.getEditorState().read(() => {\n const match: MenuTextMatch = {\n leadOffset: 0,\n matchingString: '',\n replaceableString: '',\n }\n if (!isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n if (node !== null) {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n }\n\n return\n }\n }\n })\n\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, openTypeahead])\n\n useEffect(() => {\n const updateListener = () => {\n editor.getEditorState().read(() => {\n const editorWindow = editor._window ?? window\n const range = editorWindow.document.createRange()\n const selection = $getSelection()\n const text = getQueryTextForSearch(editor)\n\n if (\n !$isRangeSelection(selection) ||\n !selection.isCollapsed() ||\n text === undefined ||\n range === null\n ) {\n closeTypeahead()\n return\n }\n\n const match = triggerFn({ editor, query: text })\n onQueryChange(match ? match.matchingString : null)\n\n if (match !== null && !isSelectionOnEntityBoundary(editor, match.leadOffset)) {\n const isRangePositioned = tryToPositionRange(match.leadOffset, range, editorWindow)\n if (isRangePositioned !== null) {\n startTransition(() =>\n openTypeahead({\n getRect: () => {\n return range.getBoundingClientRect()\n },\n match,\n }),\n )\n return\n }\n }\n closeTypeahead()\n })\n }\n\n const removeUpdateListener = editor.registerUpdateListener(updateListener)\n\n return () => {\n removeUpdateListener()\n }\n }, [editor, triggerFn, onQueryChange, resolution, closeTypeahead, openTypeahead])\n\n return anchorElementRef.current === null || resolution === null || editor === null ? null : (\n <LexicalMenu\n anchorElementRef={anchorElementRef}\n close={closeTypeahead}\n editor={editor}\n groups={groups}\n menuRenderFn={menuRenderFn}\n resolution={resolution}\n shouldSplitNodeWithQuery\n />\n )\n}\n\nexport type { MenuRenderFn, MenuResolution, MenuTextMatch, TriggerFn }\n", "'use client'\nimport type { BaseSelection, LexicalCommand, LexicalEditor, TextNode } from 'lexical'\nimport type { JSX, ReactPortal, RefObject } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $setSelection,\n COMMAND_PRIORITY_LOW,\n COMMAND_PRIORITY_NORMAL,\n createCommand,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'\n\nimport type { MenuTextMatch } from '../useMenuTriggerMatch.js'\nimport type { SlashMenuGroupInternal, SlashMenuItem, SlashMenuItemInternal } from './types.js'\n\nimport { CAN_USE_DOM } from '../../../utils/canUseDOM.js'\n\nexport type MenuResolution = {\n getRect: () => DOMRect\n match?: MenuTextMatch\n}\n\nconst baseClass = 'slash-menu-popup'\n\nexport type MenuRenderFn = (\n anchorElementRef: RefObject<HTMLElement | null>,\n itemProps: {\n groups: Array<SlashMenuGroupInternal>\n selectedItemKey: null | string\n selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | null | ReactPortal\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) {\n return\n }\n\n const typeaheadRect = typeaheadContainerNode.getBoundingClientRect()\n\n if (typeaheadRect.top + typeaheadRect.height > window.innerHeight) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n if (typeaheadRect.top < 0) {\n typeaheadContainerNode.scrollIntoView({\n block: 'center',\n })\n }\n\n target.scrollIntoView({ block: 'nearest' })\n}\n\n/**\n * Walk backwards along user input and forward through entity title to try\n * and replace more of the user's text with entity.\n */\nfunction getFullMatchOffset(documentText: string, entryText: string, offset: number) {\n let triggerOffset = offset\n for (let i = triggerOffset; i <= entryText.length; i++) {\n if (documentText.substring(documentText.length - i) === entryText.substring(0, i)) {\n triggerOffset = i\n }\n }\n return triggerOffset\n}\n\n/**\n * Split Lexical TextNode and return a new TextNode only containing matched text.\n * Common use cases include: removing the node, replacing with a new node.\n */\nfunction $splitNodeContainingQuery(match: MenuTextMatch): TextNode | undefined {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return\n }\n const anchor = selection.anchor\n if (anchor.type !== 'text') {\n return\n }\n const anchorNode = anchor.getNode()\n if (!anchorNode.isSimpleText()) {\n return\n }\n const selectionOffset = anchor.offset\n const textContent = anchorNode.getTextContent().slice(0, selectionOffset)\n const characterOffset = match.replaceableString.length\n const queryOffset = getFullMatchOffset(textContent, match.matchingString, characterOffset)\n const startOffset = selectionOffset - queryOffset\n if (startOffset < 0) {\n return\n }\n let newNode\n if (startOffset === 0) {\n ;[newNode] = anchorNode.splitText(selectionOffset)\n } else {\n ;[, newNode] = anchorNode.splitText(startOffset, selectionOffset)\n }\n\n return newNode\n}\n\n// Got from https://stackoverflow.com/a/42543908/2013580\nexport function getScrollParent(\n element: HTMLElement,\n includeHidden: boolean,\n): HTMLBodyElement | HTMLElement {\n let style = getComputedStyle(element)\n const excludeStaticParent = style.position === 'absolute'\n const overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/\n if (style.position === 'fixed') {\n return document.body\n }\n for (let parent: HTMLElement | null = element; (parent = parent.parentElement); ) {\n style = getComputedStyle(parent)\n if (excludeStaticParent && style.position === 'static') {\n continue\n }\n if (overflowRegex.test(style.overflow + style.overflowY + style.overflowX)) {\n return parent\n }\n }\n return document.body\n}\n\nfunction isTriggerVisibleInNearestScrollContainer(\n targetElement: HTMLElement,\n containerElement: HTMLElement,\n): boolean {\n const tRect = targetElement.getBoundingClientRect()\n const cRect = containerElement.getBoundingClientRect()\n return tRect.top > cRect.top && tRect.top < cRect.bottom\n}\n\n// Reposition the menu on scroll, window resize, and element resize.\nexport function useDynamicPositioning(\n resolution: MenuResolution | null,\n targetElementRef: RefObject<HTMLElement | null>,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\n const targetElement = targetElementRef.current\n if (targetElement != null && resolution != null) {\n const rootElement = editor.getRootElement()\n const rootScrollParent =\n rootElement != null ? getScrollParent(rootElement, false) : document.body\n let ticking = false\n let previousIsInView = isTriggerVisibleInNearestScrollContainer(\n targetElement,\n rootScrollParent,\n )\n const handleScroll = function () {\n if (!ticking) {\n window.requestAnimationFrame(function () {\n onReposition()\n ticking = false\n })\n ticking = true\n }\n const isInView = isTriggerVisibleInNearestScrollContainer(targetElement, rootScrollParent)\n if (isInView !== previousIsInView) {\n previousIsInView = isInView\n if (onVisibilityChange != null) {\n onVisibilityChange(isInView)\n }\n }\n }\n const resizeObserver = new ResizeObserver(onReposition)\n window.addEventListener('resize', onReposition)\n document.addEventListener('scroll', handleScroll, {\n capture: true,\n passive: true,\n })\n resizeObserver.observe(targetElement)\n return () => {\n resizeObserver.disconnect()\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [editor, onVisibilityChange, onReposition, resolution, targetElementRef])\n}\n\nexport const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND: LexicalCommand<{\n index: number\n item: SlashMenuItemInternal\n}> = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND')\n\nexport function LexicalMenu({\n anchorElementRef,\n close,\n editor,\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n groups,\n menuRenderFn,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement | null>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n resolution: MenuResolution\n shouldSplitNodeWithQuery?: boolean\n}): JSX.Element | null {\n const [selectedItemKey, setSelectedItemKey] = useState<null | string>(null)\n\n const matchingString = (resolution.match && resolution.match.matchingString) || ''\n\n const updateSelectedItem = useCallback(\n (item: SlashMenuItem) => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`)\n setSelectedItemKey(item.key)\n }\n },\n [editor],\n )\n\n const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {\n // set selected item to the first of the matching ones\n if (groups !== null && matchingString != null) {\n // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.\n const allItems = groups.flatMap((group) => group.items)\n\n if (allItems.length) {\n const firstMatchingItem = allItems[0]!\n updateSelectedItem(firstMatchingItem)\n }\n }\n }, [groups, updateSelectedItem, matchingString])\n\n useEffect(() => {\n setSelectedItemKeyToFirstMatchingItem()\n }, [matchingString, setSelectedItemKeyToFirstMatchingItem])\n\n const selectItemAndCleanUp = useCallback(\n (selectedItem: SlashMenuItem) => {\n close()\n\n editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n if (textNodeContainingQuery) {\n textNodeContainingQuery.remove()\n }\n })\n\n setTimeout(() => {\n // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724\n let selection: BaseSelection | undefined\n editor.read(() => {\n selection = $getSelection()?.clone()\n })\n editor.update(() => {\n if (selection) {\n $setSelection(selection)\n }\n })\n\n selectedItem.onSelect({\n editor,\n queryString: resolution.match ? resolution.match.matchingString : '',\n })\n }, 0)\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, close],\n )\n\n useEffect(() => {\n return () => {\n const rootElem = editor.getRootElement()\n if (rootElem !== null) {\n rootElem.removeAttribute('aria-activedescendant')\n }\n }\n }, [editor])\n\n useLayoutEffect(() => {\n if (groups === null) {\n setSelectedItemKey(null)\n } else if (selectedItemKey === null) {\n setSelectedItemKeyToFirstMatchingItem()\n }\n }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND,\n ({ item }) => {\n if (item.ref && item.ref.current != null) {\n scrollIntoViewIfNeeded(item.ref.current)\n return true\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, updateSelectedItem])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_DOWN_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== allItems.length - 1 ? selectedIndex + 1 : 0\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n editor.dispatchCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, {\n index: newSelectedIndex,\n item: newSelectedItem,\n })\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ARROW_UP_COMMAND,\n (payload) => {\n const event = payload\n if (groups !== null && groups.length && selectedItemKey !== null) {\n const allItems = groups.flatMap((group) => group.items)\n const selectedIndex = allItems.findIndex((item) => item.key === selectedItemKey)\n\n const newSelectedIndex = selectedIndex !== 0 ? selectedIndex - 1 : allItems.length - 1\n\n const newSelectedItem = allItems[newSelectedIndex]\n if (!newSelectedItem) {\n return false\n }\n\n updateSelectedItem(newSelectedItem)\n if (newSelectedItem.ref != null && newSelectedItem.ref.current) {\n scrollIntoViewIfNeeded(newSelectedItem.ref.current)\n }\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_ESCAPE_COMMAND,\n (payload) => {\n const event = payload\n event.preventDefault()\n event.stopImmediatePropagation()\n close()\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (payload) => {\n const event = payload\n\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n event.preventDefault()\n event.stopImmediatePropagation()\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n editor.registerCommand(\n KEY_ENTER_COMMAND,\n (event: KeyboardEvent | null) => {\n if (groups === null || selectedItemKey === null) {\n return false\n }\n const allItems = groups.flatMap((group) => group.items)\n const selectedItem = allItems.find((item) => item.key === selectedItemKey)\n if (!selectedItem) {\n return false\n }\n\n if (event !== null) {\n event.preventDefault()\n event.stopImmediatePropagation()\n }\n selectItemAndCleanUp(selectedItem)\n return true\n },\n COMMAND_PRIORITY_NORMAL,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectedItemKey,\n selectItemAndCleanUp,\n setSelectedItemKey,\n }),\n [selectItemAndCleanUp, selectedItemKey, groups],\n )\n\n return menuRenderFn(\n anchorElementRef,\n listItemProps,\n resolution.match ? resolution.match.matchingString : '',\n )\n}\n\nfunction setContainerDivAttributes(containerDiv: HTMLElement, className?: string) {\n if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n}\n\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement | null> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement | null>(\n CAN_USE_DOM ? document.createElement('div') : null,\n )\n const positionMenu = useCallback(() => {\n if (anchorElementRef.current === null || parent === undefined) {\n return\n }\n const rootElement = editor.getRootElement()\n const containerDiv = anchorElementRef.current\n\n const VERTICAL_OFFSET = 32\n\n const menuEle = containerDiv.firstChild as Element\n if (rootElement !== null && resolution !== null) {\n const { height, width } = resolution.getRect()\n let { left, top } = resolution.getRect()\n\n const rawTop = top\n top -= anchorElem.getBoundingClientRect().top + window.scrollY\n left -= anchorElem.getBoundingClientRect().left + window.scrollX\n containerDiv.style.left = `${left + window.scrollX}px`\n containerDiv.style.height = `${height}px`\n containerDiv.style.width = `${width}px`\n if (menuEle !== null) {\n const menuRect = menuEle.getBoundingClientRect()\n const menuHeight = menuRect.height\n const menuWidth = menuRect.width\n\n const rootElementRect = rootElement.getBoundingClientRect()\n\n const isRTL = document.dir === 'rtl' || document.documentElement.dir === 'rtl'\n const anchorRect = anchorElem.getBoundingClientRect()\n const leftBoundary = Math.max(0, rootElementRect.left)\n\n if (!isRTL && left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + window.scrollX}px`\n } else if (isRTL && menuRect.left < leftBoundary) {\n const newLeft = leftBoundary + menuWidth - anchorRect.left\n containerDiv.style.left = `${newLeft + window.scrollX}px`\n }\n\n const wouldGoOffBottomOfScreen = rawTop + menuHeight + VERTICAL_OFFSET > window.innerHeight\n //const wouldGoOffBottomOfContainer = top + menuHeight > rootElementRect.bottom\n const wouldGoOffTopOfScreen = rawTop < 0\n\n // Position slash menu above the cursor instead of below (default) if it would otherwise go off the bottom of the screen.\n if (wouldGoOffBottomOfScreen && !wouldGoOffTopOfScreen) {\n const margin = 24\n containerDiv.style.top = `${\n top + VERTICAL_OFFSET - menuHeight + window.scrollY - (height + margin)\n }px`\n } else {\n containerDiv.style.top = `${top + window.scrollY + VERTICAL_OFFSET}px`\n }\n }\n\n if (!containerDiv.isConnected) {\n setContainerDivAttributes(containerDiv, className)\n anchorElem.append(containerDiv)\n }\n containerDiv.setAttribute('id', 'slash-menu')\n anchorElementRef.current = containerDiv\n rootElement.setAttribute('aria-controls', 'slash-menu')\n }\n }, [editor, resolution, className, anchorElem])\n\n useEffect(() => {\n const rootElement = editor.getRootElement()\n if (resolution !== null) {\n positionMenu()\n return () => {\n if (rootElement !== null) {\n rootElement.removeAttribute('aria-controls')\n }\n\n const containerDiv = anchorElementRef.current\n if (containerDiv !== null && containerDiv.isConnected) {\n containerDiv.remove()\n containerDiv.removeAttribute('id')\n }\n }\n }\n }, [editor, positionMenu, resolution])\n\n const onVisibilityChange = useCallback(\n (isInView: boolean) => {\n if (resolution !== null) {\n if (!isInView) {\n setResolution(null)\n }\n }\n },\n [resolution, setResolution],\n )\n\n useDynamicPositioning(resolution, anchorElementRef, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n", "'use client'\nimport { isPoint, type Point } from './point.js'\n\ninterface ContainsPointReturn {\n reason: {\n isOnBottomSide: boolean\n isOnLeftSide: boolean\n isOnRightSide: boolean\n isOnTopSide: boolean\n }\n result: boolean\n}\n\nexport class Rect {\n private readonly _bottom: number\n\n private readonly _left: number\n\n private readonly _right: number\n\n private readonly _top: number\n\n constructor(left: number, top: number, right: number, bottom: number) {\n const [physicTop, physicBottom] = top <= bottom ? [top, bottom] : [bottom, top]\n\n const [physicLeft, physicRight] = left <= right ? [left, right] : [right, left]\n\n this._top = physicTop\n this._right = physicRight\n this._left = physicLeft\n this._bottom = physicBottom\n }\n\n static fromDOM(dom: HTMLElement): Rect {\n const { height, left, top, width } = dom.getBoundingClientRect()\n return Rect.fromLWTH(left, width, top, height)\n }\n\n static fromDOMRect(domRect: DOMRect): Rect {\n const { height, left, top, width } = domRect\n return Rect.fromLWTH(left, width, top, height)\n }\n\n static fromLTRB(left: number, top: number, right: number, bottom: number): Rect {\n return new Rect(left, top, right, bottom)\n }\n\n static fromLWTH(left: number, width: number, top: number, height: number): Rect {\n return new Rect(left, top, left + width, top + height)\n }\n\n static fromPoints(startPoint: Point, endPoint: Point): Rect {\n const { x: left, y: top } = startPoint\n const { x: right, y: bottom } = endPoint\n return Rect.fromLTRB(left, top, right, bottom)\n }\n\n public contains({ x, y }: Point): ContainsPointReturn\n\n public contains({ bottom, left, right, top }: Rect): boolean\n\n public contains(target: Point | Rect): boolean | ContainsPointReturn {\n if (isPoint(target)) {\n const { x, y } = target\n\n const isOnTopSide = y < this._top\n const isOnBottomSide = y > this._bottom\n const isOnLeftSide = x < this._left\n const isOnRightSide = x > this._right\n\n const result = !isOnTopSide && !isOnBottomSide && !isOnLeftSide && !isOnRightSide\n\n return {\n reason: {\n isOnBottomSide,\n isOnLeftSide,\n isOnRightSide,\n isOnTopSide,\n },\n result,\n }\n }\n const { bottom, left, right, top } = target\n\n return (\n top >= this._top &&\n top <= this._bottom &&\n bottom >= this._top &&\n bottom <= this._bottom &&\n left >= this._left &&\n left <= this._right &&\n right >= this._left &&\n right <= this._right\n )\n }\n\n public distanceFromPoint(point: Point): {\n distance: number\n isOnBottomSide: boolean\n isOnLeftSide: boolean\n isOnRightSide: boolean\n isOnTopSide: boolean\n } {\n const containsResult = this.contains(point)\n if (containsResult.result) {\n return {\n distance: 0,\n isOnBottomSide: containsResult.reason.isOnBottomSide,\n isOnLeftSide: containsResult.reason.isOnLeftSide,\n isOnRightSide: containsResult.reason.isOnRightSide,\n isOnTopSide: containsResult.reason.isOnTopSide,\n }\n }\n\n let dx = 0 // Horizontal distance to the closest edge\n let dy = 0 // Vertical distance to the closest edge\n\n // If the point is to the left of the rectangle\n if (point.x < this._left) {\n dx = this._left - point.x\n }\n // If the point is to the right of the rectangle\n else if (point.x > this._right) {\n dx = point.x - this._right\n }\n\n // If the point is above the rectangle\n if (point.y < this._top) {\n dy = this._top - point.y\n }\n // If the point is below the rectangle\n else if (point.y > this._bottom) {\n dy = point.y - this._bottom\n }\n\n // Use the Pythagorean theorem to calculate the distance\n return {\n distance: Math.sqrt(dx * dx + dy * dy),\n isOnBottomSide: point.y > this._bottom,\n isOnLeftSide: point.x < this._left,\n isOnRightSide: point.x > this._right,\n isOnTopSide: point.y < this._top,\n }\n }\n\n public equals({ bottom, left, right, top }: Rect): boolean {\n return (\n top === this._top && bottom === this._bottom && left === this._left && right === this._right\n )\n }\n\n public generateNewRect({\n bottom = this.bottom,\n left = this.left,\n right = this.right,\n top = this.top,\n }): Rect {\n return new Rect(left, top, right, bottom)\n }\n\n public intersectsWith(rect: Rect): boolean {\n const { height: h1, left: x1, top: y1, width: w1 } = rect\n const { height: h2, left: x2, top: y2, width: w2 } = this\n const maxX = x1 + w1 >= x2 + w2 ? x1 + w1 : x2 + w2\n const maxY = y1 + h1 >= y2 + h2 ? y1 + h1 : y2 + h2\n const minX = x1 <= x2 ? x1 : x2\n const minY = y1 <= y2 ? y1 : y2\n return maxX - minX <= w1 + w2 && maxY - minY <= h1 + h2\n }\n\n get bottom(): number {\n return this._bottom\n }\n\n get height(): number {\n return Math.abs(this._bottom - this._top)\n }\n\n get left(): number {\n return this._left\n }\n\n get right(): number {\n return this._right\n }\n\n get top(): number {\n return this._top\n }\n\n get width(): number {\n return Math.abs(this._left - this._right)\n }\n}\n", "import type {\n EditorConfig,\n Klass,\n LexicalEditor,\n LexicalNode,\n LexicalNodeReplacement,\n} from 'lexical'\n\nimport React from 'react'\n\nimport type { BlockDecorateFunction } from '../../features/blocks/client/nodes/BlocksNode.js'\nimport type { InlineBlockDecorateFunction } from '../../features/blocks/client/nodes/InlineBlocksNode.js'\nimport type { NodeWithHooks } from '../../features/typesServer.js'\nimport type {\n LexicalEditorNodeMap,\n NodeMapBlockValue,\n NodeMapInlineBlockValue,\n NodeMapValue,\n} from '../../types/index.js'\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\n// Store view definitions for each editor and node type\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst editorNodeViews = new WeakMap<LexicalEditor, Map<string, NodeMapValue<any>>>()\n\n/**\n * Register view definitions for an editor\n */\nexport function registerEditorNodeViews(\n editor: LexicalEditor,\n nodeViews: LexicalEditorNodeMap,\n): void {\n if (!editorNodeViews.has(editor)) {\n editorNodeViews.set(editor, new Map())\n }\n const editorViews = editorNodeViews.get(editor)!\n\n // Register each node type's view\n for (const [nodeType, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // Handle blocks specially - store each block type with key 'block:blockType'\n if (nodeType === 'blocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`block:${blockType}`, viewDef)\n }\n continue\n }\n\n // Handle inlineBlocks specially - store each block type with key 'inlineBlock:blockType'\n if (nodeType === 'inlineBlocks') {\n for (const [blockType, viewDef] of Object.entries(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value as Record<string, NodeMapValue<any>>,\n )) {\n editorViews.set(`inlineBlock:${blockType}`, viewDef)\n }\n continue\n }\n\n // Regular node types\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n editorViews.set(nodeType, value as NodeMapValue<any>)\n }\n}\n\n/**\n * Clear all view overrides for an editor (restores default rendering)\n */\nexport function clearEditorNodeViews(editor: LexicalEditor): void {\n editorNodeViews.delete(editor)\n}\n\n/**\n * Get the view definition for a specific editor and node\n */\nfunction getEditorNodeView(\n editor: LexicalEditor,\n nodeType: string,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n node?: any,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n): NodeMapValue<any> | undefined {\n const editorViews = editorNodeViews.get(editor)\n\n // For block nodes, look up by blockType\n if (nodeType === 'block' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`block:${blockType}`)\n }\n\n // For inlineBlock nodes, look up by blockType\n if (nodeType === 'inlineBlock' && node?.['__fields']?.blockType) {\n const blockType = node['__fields'].blockType\n return editorViews?.get(`inlineBlock:${blockType}`)\n }\n\n // Regular node types\n return editorViews?.get(nodeType)\n}\n\n/**\n * Apply view overrides to a specific node type by modifying its prototype\n * Uses WeakMap to check per-editor at runtime\n */\nfunction applyNodeOverride({\n node,\n nodeType,\n}: {\n node: Klass<LexicalNode>\n nodeType: string\n}): void {\n if (!('getType' in node) || node.getType() !== nodeType) {\n return\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const NodeClass = node as any\n\n // Store original methods if not already stored\n if (!NodeClass.prototype._originalDecorate) {\n NodeClass.prototype._originalDecorate = NodeClass.prototype.decorate\n }\n if (!NodeClass.prototype._originalCreateDOM) {\n NodeClass.prototype._originalCreateDOM = NodeClass.prototype.createDOM\n }\n\n // Override decorate method (for DecoratorNodes)\n if (NodeClass.prototype.decorate && !NodeClass.prototype._decorateOverridden) {\n NodeClass.prototype._decorateOverridden = true\n const hasCreateDOM = !!NodeClass.prototype.createDOM\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n NodeClass.prototype.decorate = function (editor: LexicalEditor, config: EditorConfig): any {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // Priority 1: If Component is provided, use it\n if (viewDef.Component) {\n return viewDef.Component({\n config,\n editor,\n isEditor: true,\n isJSXConverter: false,\n node: this,\n })\n }\n\n // Priority 2: If custom createDOM is provided, use html in decorate\n if (viewDef.createDOM && viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n return React.createElement('span', {\n dangerouslySetInnerHTML: { __html: htmlContent },\n })\n }\n\n // Priority 3: If only html is provided (no custom createDOM),\n // createDOM will handle it, so decorate returns empty fragment\n if (viewDef.html && hasCreateDOM && !viewDef.createDOM) {\n return React.createElement(React.Fragment)\n }\n\n if (nodeType === 'block') {\n const blockViewDef: NodeMapBlockValue = viewDef as NodeMapBlockValue\n if (blockViewDef.Block || blockViewDef.Label) {\n const originalDecorate: BlockDecorateFunction = NodeClass.prototype._originalDecorate\n\n // Pass Block FC to BlockContent for rendering\n // BlockContent will render with useBlockComponentContext hook (client-only)\n return originalDecorate.call(\n this,\n editor,\n config,\n blockViewDef.Block,\n blockViewDef.Label,\n )\n }\n } else if (nodeType === 'inlineBlock') {\n const blockViewDef: NodeMapInlineBlockValue = viewDef as NodeMapInlineBlockValue\n if (blockViewDef.Block || blockViewDef.Label) {\n const originalDecorate: InlineBlockDecorateFunction =\n NodeClass.prototype._originalDecorate\n\n // Pass Block FC to BlockContent for rendering\n // BlockContent will render with useBlockComponentContext hook (client-only)\n return originalDecorate.call(\n this,\n editor,\n config,\n blockViewDef.Block,\n blockViewDef.Label,\n )\n }\n }\n }\n\n const originalDecorate: BlockDecorateFunction | InlineBlockDecorateFunction =\n NodeClass.prototype._originalDecorate\n\n // Otherwise use original\n return originalDecorate.call(this, editor, config)\n }\n }\n\n // Override createDOM method (for ElementNodes)\n if (NodeClass.prototype.createDOM && !NodeClass.prototype._createDOMOverridden) {\n NodeClass.prototype._createDOMOverridden = true\n NodeClass.prototype.createDOM = function (\n config: EditorConfig,\n editor: LexicalEditor,\n ): HTMLElement {\n const viewDef = getEditorNodeView(editor, nodeType, this)\n\n if (viewDef) {\n // If createDOM is provided, use it\n if (viewDef.createDOM) {\n return viewDef.createDOM({ config, editor, node: this })\n }\n\n // If html is provided (as a function or string), create element from it\n if (viewDef.html) {\n const htmlContent =\n typeof viewDef.html === 'function'\n ? viewDef.html({ config, editor, isEditor: true, isJSXConverter: false, node: this })\n : viewDef.html\n const tempDiv = document.createElement('div')\n tempDiv.innerHTML = htmlContent\n return (tempDiv.firstElementChild as HTMLElement) || tempDiv\n }\n }\n\n // Otherwise use original\n return NodeClass.prototype._originalCreateDOM.call(this, config, editor)\n }\n }\n}\n\nexport function getEnabledNodes({\n editorConfig,\n nodeViews,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n nodeViews?: LexicalEditorNodeMap\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n const nodes = getEnabledNodesFromServerNodes({\n nodes: editorConfig.features.nodes,\n })\n\n if (nodeViews) {\n // Apply node overrides by modifying prototypes (once globally)\n // The overrides check per-editor at runtime using WeakMap\n const nodeTypesToOverride = new Set<string>()\n\n for (const [key, value] of Object.entries(nodeViews)) {\n if (!value || typeof value !== 'object') {\n continue\n }\n\n // If 'blocks' key exists with content, we need to override 'block' nodes\n if (key === 'blocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('block')\n }\n // If 'inlineBlocks' key exists with content, we need to override 'inlineBlock' nodes\n else if (key === 'inlineBlocks' && Object.keys(value).length > 0) {\n nodeTypesToOverride.add('inlineBlock')\n }\n // Regular node types\n else {\n nodeTypesToOverride.add(key)\n }\n }\n\n for (const node of nodes) {\n if ('getType' in node) {\n const nodeType = node.getType()\n\n if (nodeTypesToOverride.has(nodeType)) {\n applyNodeOverride({ node, nodeType })\n }\n }\n }\n }\n\n return nodes\n}\n\nexport function getEnabledNodesFromServerNodes({\n nodes,\n}: {\n nodes: Array<Klass<LexicalNode> | LexicalNodeReplacement> | Array<NodeWithHooks>\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n"],
5
+ "mappings": "AACO,IAAMA,EACX,OAAOC,OAAW,KAClB,OAAOA,OAAOC,SAAa,KAC3B,OAAOD,OAAOC,SAASC,cAAkB,ICJ3C,OAAAC,KAAAC,OAAA,yBACA,OAAsBC,UAAAA,OAAc,QA2B7B,SAAAC,GAAAC,EAAA,CAAA,IAAAC,EAAAJ,GAAA,CAAA,EAA6BK,EAAAF,IAAaG,OAAA,IAAbH,EAClCI,EAAsBN,GAAAK,MAAe,EAAAE,EAAA,OAAAJ,EAAA,CAAA,IAAAC,GAMnCG,EAAAC,GAAA,IAAAC,QAAAC,GAAA,CAEI,IAAA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EhC,OAAW,CAACC,EAAK7C,CAAA,IAAUC,OAAOC,QAAQT,CAAA,EACpC,CAACO,GAAS,OAAOA,GAAU,WAK3B6C,IAAQ,UAAY5C,OAAO6C,KAAK9C,CAAA,EAAO+C,OAAS,EAClDJ,EAAoBK,IAAI,OAAA,EAGjBH,IAAQ,gBAAkB5C,OAAO6C,KAAK9C,CAAA,EAAO+C,OAAS,EAC7DJ,EAAoBK,IAAI,aAAA,EAIxBL,EAAoBK,IAAIH,CAAA,GAI5B,QAAWrC,KAAQgC,EACjB,GAAI,YAAahC,EAAM,CACrB,IAAMT,EAAWS,EAAKE,QAAO,EAEzBiC,EAAoBjD,IAAIK,CAAA,GAC1BU,GAAkB,CAAED,KAAAA,EAAMT,SAAAA,CAAS,CAAA,CAEvC,CAEJ,CAEA,OAAOyC,CACT,CAEO,SAASC,GAA+B,CAC7CD,MAAAA,CAAK,EAGN,CACC,OAAOA,EAAMS,IAAKzC,GACZ,SAAUA,EACLA,EAAKA,KAEPA,CACT,CACF",
6
+ "names": ["CAN_USE_DOM", "window", "document", "createElement", "c", "_c", "useRef", "useRunDeprioritized", "t0", "$", "timeout", "undefined", "idleHandleRef", "t1", "fn", "Promise", "resolve", "exec", "window", "current", "cancelIdleCallback", "requestIdleCallback", "interactionResponse", "then", "setTimeout", "requestAnimationFrame", "useControllableState", "createContext", "use", "useMemo", "RichTextViewContext", "currentView", "inheritable", "setCurrentView", "RichTextViewProvider", "args", "parentContext", "useRichTextView", "hasOwnExplicitView", "undefined", "isControlledByParent", "Boolean", "views", "hasExplicitCurrentView", "children", "currentViewFromProps", "currentViewRaw", "value", "currentViewMap", "_jsx", "Point", "_x", "_y", "constructor", "x", "y", "calcDeltaXTo", "calcDeltaYTo", "calcDistanceTo", "point", "Math", "sqrt", "pow", "calcHorizontalDistanceTo", "abs", "calcVerticalDistance", "equals", "isPoint", "useLexicalComposerContext", "mergeRegister", "$getSelection", "$isRangeSelection", "$isTextNode", "COMMAND_PRIORITY_LOW", "createCommand", "getDOMSelection", "useCallback", "useEffect", "useState", "React", "c", "_c", "useLexicalComposerContext", "mergeRegister", "$getSelection", "$isRangeSelection", "$setSelection", "COMMAND_PRIORITY_LOW", "COMMAND_PRIORITY_NORMAL", "createCommand", "KEY_ARROW_DOWN_COMMAND", "KEY_ARROW_UP_COMMAND", "KEY_ENTER_COMMAND", "KEY_ESCAPE_COMMAND", "KEY_TAB_COMMAND", "useCallback", "useEffect", "useLayoutEffect", "useMemo", "useRef", "useState", "baseClass", "scrollIntoViewIfNeeded", "target", "typeaheadContainerNode", "document", "getElementById", "typeaheadRect", "getBoundingClientRect", "top", "height", "window", "innerHeight", "scrollIntoView", "block", "getFullMatchOffset", "documentText", "entryText", "offset", "triggerOffset", "i", "length", "substring", "$splitNodeContainingQuery", "match", "selection", "$getSelection", "$isRangeSelection", "isCollapsed", "anchor", "type", "anchorNode", "getNode", "isSimpleText", "selectionOffset", "textContent", "getTextContent", "slice", "characterOffset", "replaceableString", "queryOffset", "matchingString", "startOffset", "newNode", "splitText", "getScrollParent", "element", "includeHidden", "style", "getComputedStyle", "excludeStaticParent", "position", "overflowRegex", "body", "parent1", "parentElement", "test", "overflow", "overflowY", "overflowX", "isTriggerVisibleInNearestScrollContainer", "targetElement", "containerElement", "tRect", "cRect", "bottom", "useDynamicPositioning", "resolution", "targetElementRef", "onReposition", "onVisibilityChange", "$", "_c", "editor", "useLexicalComposerContext", "t0", "t1", "current", "rootElement", "getRootElement", "rootScrollParent", "ticking", "previousIsInView", "handleScroll", "requestAnimationFrame", "isInView", "resizeObserver", "ResizeObserver", "addEventListener", "capture", "passive", "observe", "disconnect", "removeEventListener", "useEffect", "SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND", "createCommand", "LexicalMenu", "anchorElementRef", "close", "groups", "menuRenderFn", "shouldSplitNodeWithQuery", "selectedItemKey", "setSelectedItemKey", "useState", "updateSelectedItem", "useCallback", "item", "rootElem", "setAttribute", "key", "setSelectedItemKeyToFirstMatchingItem", "allItems", "flatMap", "group", "items", "firstMatchingItem", "selectItemAndCleanUp", "selectedItem", "update", "textNodeContainingQuery", "remove", "setTimeout", "read", "clone", "$setSelection", "onSelect", "queryString", "removeAttribute", "useLayoutEffect", "mergeRegister", "registerCommand", "ref", "COMMAND_PRIORITY_LOW", "KEY_ARROW_DOWN_COMMAND", "payload", "event", "selectedIndex", "findIndex", "newSelectedIndex", "newSelectedItem", "dispatchCommand", "index", "preventDefault", "stopImmediatePropagation", "COMMAND_PRIORITY_NORMAL", "KEY_ARROW_UP_COMMAND", "KEY_ESCAPE_COMMAND", "KEY_TAB_COMMAND", "find", "KEY_ENTER_COMMAND", "listItemProps", "useMemo", "setContainerDivAttributes", "containerDiv", "className", "display", "useMenuAnchorRef", "anchorElem", "setResolution", "Symbol", "for", "CAN_USE_DOM", "createElement", "useRef", "parent", "undefined", "menuEle", "firstChild", "width", "getRect", "left", "rawTop", "scrollY", "scrollX", "menuRect", "menuHeight", "menuWidth", "rootElementRect", "isRTL", "dir", "documentElement", "anchorRect", "leftBoundary", "Math", "max", "right", "newLeft", "wouldGoOffBottomOfScreen", "wouldGoOffTopOfScreen", "isConnected", "append", "positionMenu", "t2", "t3", "rootElement_0", "containerDiv_0", "t4", "PUNCTUATION", "getTextUpToAnchor", "selection", "anchor", "type", "anchorNode", "getNode", "isSimpleText", "anchorOffset", "offset", "getTextContent", "slice", "tryToPositionRange", "leadOffset", "range", "editorWindow", "domSelection", "getDOMSelection", "isCollapsed", "startOffset", "endOffset", "setStart", "setEnd", "getQueryTextForSearch", "editor", "text", "getEditorState", "read", "$getSelection", "$isRangeSelection", "isSelectionOnEntityBoundary", "prevSibling", "getPreviousSibling", "$isTextNode", "isTextEntity", "startTransition", "callback", "ENABLE_SLASH_MENU_COMMAND", "createCommand", "LexicalTypeaheadMenuPlugin", "anchorClassName", "anchorElem", "groups", "menuRenderFn", "onClose", "onOpen", "onQueryChange", "triggerFn", "useLexicalComposerContext", "resolution", "setResolution", "useState", "anchorElementRef", "useMenuAnchorRef", "closeTypeahead", "useCallback", "openTypeahead", "res", "useEffect", "mergeRegister", "registerCommand", "node", "match", "matchingString", "replaceableString", "_window", "window", "document", "createRange", "getRect", "getBoundingClientRect", "COMMAND_PRIORITY_LOW", "updateListener", "undefined", "query", "removeUpdateListener", "registerUpdateListener", "current", "_jsx", "LexicalMenu", "close", "shouldSplitNodeWithQuery", "Rect", "_bottom", "_left", "_right", "_top", "constructor", "left", "top", "right", "bottom", "physicTop", "physicBottom", "physicLeft", "physicRight", "fromDOM", "dom", "height", "width", "getBoundingClientRect", "fromLWTH", "fromDOMRect", "domRect", "fromLTRB", "fromPoints", "startPoint", "endPoint", "x", "y", "contains", "target", "isPoint", "isOnTopSide", "isOnBottomSide", "isOnLeftSide", "isOnRightSide", "reason", "result", "distanceFromPoint", "point", "containsResult", "distance", "dx", "dy", "Math", "sqrt", "equals", "generateNewRect", "intersectsWith", "rect", "h1", "x1", "y1", "w1", "h2", "x2", "y2", "w2", "maxX", "maxY", "minX", "minY", "abs", "React", "editorNodeViews", "WeakMap", "registerEditorNodeViews", "editor", "nodeViews", "has", "set", "Map", "editorViews", "get", "nodeType", "value", "Object", "entries", "blockType", "viewDef", "clearEditorNodeViews", "delete", "getEditorNodeView", "node", "applyNodeOverride", "getType", "NodeClass", "prototype", "_originalDecorate", "decorate", "_originalCreateDOM", "createDOM", "_decorateOverridden", "hasCreateDOM", "config", "Component", "isEditor", "isJSXConverter", "html", "htmlContent", "createElement", "dangerouslySetInnerHTML", "__html", "Fragment", "blockViewDef", "Block", "Label", "call", "_createDOMOverridden", "tempDiv", "document", "innerHTML", "firstElementChild", "getEnabledNodes", "editorConfig", "nodes", "getEnabledNodesFromServerNodes", "features", "nodeTypesToOverride", "Set", "key", "keys", "length", "add", "map"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a as E,b as U}from"./chunk-UD4DQ4AK.js";import{c as y}from"./chunk-5VIL27GI.js";import{a as L}from"./chunk-WSAPGI3Z.js";import{b as g}from"./chunk-RJ5MAOKZ.js";import{jsx as a,jsxs as f}from"react/jsx-runtime";import{useLexicalComposerContext as ae}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as oe}from"@lexical/react/useLexicalEditable";import{getTranslation as P}from"@payloadcms/translations";import{Button as h,formatDrawerSlug as le,Pill as se,Thumbnail as ie,useConfig as re,useEditDepth as ne,usePayloadAPI as de,useTranslation as ce}from"@payloadcms/ui";import{$getNodeByKey as T,$getSelection as ue,$isNodeSelection as me,$isRangeSelection as pe}from"lexical";import{formatAdminURL as ge,isImage as fe}from"payload/shared";import{useCallback as _,useEffect as F,useId as he,useReducer as _e,useRef as we,useState as I}from"react";var j={depth:0},Te=k=>{let{className:e,data:{fields:z,relationTo:w,value:c},format:A,nodeKey:l}=k;if(typeof c=="object")throw new Error("Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.");let{config:{routes:{api:B},serverURL:K},getEntityConfig:M}=re(),b=we(null),{uuid:O}=g(),W=ne(),[s]=ae(),{editorConfig:H,fieldProps:{schemaPath:q}}=g(),u=oe(),{i18n:D,t:n}=ce(),[S,m]=I(!1),[$,G]=_e(o=>o+1,0),[i]=I(()=>M({collectionSlug:w})),J=he(),x=le({slug:"lexical-upload-drawer-"+O+J,depth:W}),{toggleDrawer:Q}=y(x,!0),{closeDocumentDrawer:C,DocumentDrawer:V,DocumentDrawerToggler:X}=L({id:c,collectionSlug:i.slug}),[{data:t},{setParams:v}]=de(ge({apiRoute:B,path:`/${i.slug}/${c}`,serverURL:K}),{initialParams:j}),N=t?.thumbnailURL||t?.url;F(()=>s.registerUpdateListener(({editorState:o})=>{o.read(()=>{let r=ue();if(me(r))m(r.has(l));else if(pe(r)){let d=r.getNodes();m(d.some(p=>p.getKey()===l))}else m(!1)})}),[s,l]),F(()=>{let o=b.current?.closest(`.${e}`);o&&o.classList.toggle(`${e}--selected`,S)},[S,e]);let Y=_(()=>{s.update(()=>{T(l)?.remove()})},[s,l]),Z=_(o=>{v({...j,cacheBust:$}),G(),C()},[v,$,C]),R=H?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[i.slug]?.hasExtraFields,ee=_((o,r)=>{s.update(()=>{let d=T(l);if(d){let p={...d.getData(),fields:r};d.setData(p)}})},[s,l]),te=N&&t?.width&&t?.height?t.width>t.height?"landscape":"portrait":"landscape";return f("div",{className:`${e}__contents ${e}__contents--${te}`,"data-align":A||void 0,"data-filename":t?.filename,ref:b,children:[a("div",{className:`${e}__card`,children:f("div",{className:`${e}__media`,children:[a(ie,{collectionSlug:w,fileSrc:fe(t?.mimeType)?N:null,height:t?.height,size:"none",width:t?.width}),u&&f("div",{className:`${e}__floater`,"data-theme":"dark",children:[a(se,{className:`${e}__collectionLabel`,pillStyle:"dark",size:"small",children:P(i.labels.singular,D)}),a(X,{className:`${e}__doc-drawer-toggler`,children:a("span",{className:`${e}__filename`,children:t?.filename||n("general:untitled")})}),R?a(h,{buttonStyle:"ghost",className:`${e}__upload-drawer-toggler`,disabled:!u,el:"button",icon:"write",onClick:Q,round:!0,size:"medium",tooltip:n("fields:editRelationship")}):null,a("div",{className:`${e}__divider`}),a(h,{buttonStyle:"ghost",className:`${e}__swap-drawer-toggler`,disabled:!u,el:"button",icon:"swap",onClick:()=>{s.dispatchCommand(U,{replace:{nodeKey:l}})},round:!0,size:"medium",tooltip:n("fields:swapUpload")}),a(h,{buttonStyle:"ghost",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:o=>{o.preventDefault(),Y()},round:!0,size:"medium",tooltip:n("fields:removeUpload")})]})]})}),c?a(V,{onSave:Z}):null,R?a(E,{data:z,drawerSlug:x,drawerTitle:n("general:editLabel",{label:P(i.labels.singular,D)}),featureKey:"upload",handleDrawerSubmit:ee,schemaPath:q,schemaPathSuffix:i.slug}):null]})};export{Te as UploadComponent};
2
+ //# sourceMappingURL=component-PHZQBOJE.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/upload/client/component/index.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Pill,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n $isRangeSelection,\n type ElementFormatType,\n} from 'lexical'\nimport { formatAdminURL, isImage } from 'payload/shared'\nimport React, { useCallback, useEffect, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/schema.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.css'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n className: string\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nexport const UploadComponent: React.FC<ElementProps> = (props) => {\n const {\n className: baseClass,\n data: { fields, relationTo, value },\n format,\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { schemaPath },\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation()\n const [isSelected, setIsSelected] = useState(false)\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n formatAdminURL({ apiRoute: api, path: `/${relatedCollection.slug}/${value}`, serverURL }),\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n useEffect(() => {\n return editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n const selection = $getSelection()\n\n if ($isNodeSelection(selection)) {\n setIsSelected(selection.has(nodeKey))\n } else if ($isRangeSelection(selection)) {\n const nodes = selection.getNodes()\n setIsSelected(nodes.some((node) => node.getKey() === nodeKey))\n } else {\n setIsSelected(false)\n }\n })\n })\n }, [editor, nodeKey])\n\n useEffect(() => {\n const outerEl = uploadRef.current?.closest(`.${baseClass}`)\n\n if (outerEl) {\n outerEl.classList.toggle(`${baseClass}--selected`, isSelected)\n }\n }, [isSelected, baseClass])\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (_data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass}__contents ${baseClass}__contents--${aspectRatio}`}\n data-align={format || undefined}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {isEditable && (\n <div className={`${baseClass}__floater`} data-theme=\"dark\">\n <Pill className={`${baseClass}__collectionLabel`} pillStyle=\"dark\" size=\"small\">\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </Pill>\n\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <span className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </span>\n </DocumentDrawerToggler>\n\n {hasExtraFields ? (\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"write\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <div className={`${baseClass}__divider`} />\n\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"ghost\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n"],
5
+ "mappings": "sOAGA,OAASA,6BAAAA,OAAiC,2CAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,oBAAAA,GACAC,QAAAA,GACAC,aAAAA,GACAC,aAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,kBAAAA,OACK,iBACP,OACEC,iBAAAA,EACAC,iBAAAA,GACAC,oBAAAA,GACAC,qBAAAA,OAEK,UACP,OAASC,kBAAAA,GAAgBC,WAAAA,OAAe,iBACxC,OAAgBC,eAAAA,EAAaC,aAAAA,EAAWC,SAAAA,GAAOC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,MAAgB,QAYnF,IAAAC,EAAO,CAEP,MAAMA,GAENC,GAAAC,G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,KAAK,SACLX,QAAK1D,EAAA,qBAAA,GACLsE,uBAOT3B,IAAwBkC,KAAQlC,EAAAA,EAAAA,EAAAA,MAAmB/D,EAGhDD,WAAMmC,EACNgE,YAAYhE,EAAAA,oBAAA,CACZiE,MAAAA,EAAetE,EAAqB,OAAA,SAAAV,CAAA,IAEpC,WAAA,SACAiF,mBAAWC,GACXC,WAAAA,EACAC,iBAAYA,EAAA,OACZC,IAAAA",
6
+ "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "formatDrawerSlug", "Pill", "Thumbnail", "useConfig", "useEditDepth", "usePayloadAPI", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "$isRangeSelection", "formatAdminURL", "isImage", "useCallback", "useEffect", "useId", "useReducer", "useRef", "useState", "initialParams", "UploadComponent", "props", "baseClass", "className", "data", "fields", "relationTo", "format", "nodeKey", "value", "config", "routes", "serverURL", "getEntityConfig", "useConfig", "useRef", "uploadRef", "uuid", "useEditorConfigContext", "editDepth", "useLexicalComposerContext", "editorConfig", "fieldProps", "isEditable", "i18n", "t", "useTranslation", "setIsSelected", "useState", "isSelected", "dispatchCacheBust", "state", "cacheBust", "useReducer", "relatedCollection", "collectionSlug", "componentID", "useId", "formatDrawerSlug", "extraFieldsDrawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "setParams", "usePayloadAPI", "apiRoute", "api", "path", "thumbnailSRC", "useEffect", "editor", "editorState", "$getSelection", "$isNodeSelection", "selection", "nodes", "$isRangeSelection", "getNodes", "node", "outerEl", "removeUpload", "useCallback", "_data", "updateUpload", "hasExtraFields", "resolvedFeatureMap", "update", "$getNodeByKey", "uploadNode", "newData", "aspectRatio", "ref", "_jsx", "_jsxs", "Thumbnail", "fileSrc", "isImage", "height", "size", "width", "Pill", "pillStyle", "getTranslation", "labels", "buttonStyle", "disabled", "el", "icon", "onClick", "round", "tooltip", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "dispatchCommand", "replace", "Button", "e", "preventDefault", "onSave", "drawerSlug", "drawerTitle", "featureKey", "onExtraFieldsDrawerSubmit", "handleDrawerSubmit", "schemaPath", "schemaPathSuffix"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a,b}from"./chunk-ESITTE3C.js";import"./chunk-5VIL27GI.js";import"./chunk-RJ5MAOKZ.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
+ //# sourceMappingURL=componentInline-H24N7GUG.js.map