@payloadcms/richtext-lexical 3.0.0-beta.85 → 3.0.0-beta.86

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 (754) hide show
  1. package/dist/cell/index.js +117 -127
  2. package/dist/cell/index.js.map +1 -1
  3. package/dist/exports/client/Component-DOSSWC76.js +2 -0
  4. package/dist/exports/client/Component-DOSSWC76.js.map +7 -0
  5. package/dist/exports/client/Component-MBLHTKDK.js +2 -0
  6. package/dist/exports/client/Component-MBLHTKDK.js.map +7 -0
  7. package/dist/exports/client/Field-KUSPHC7Q.js +2 -0
  8. package/dist/exports/client/Field-KUSPHC7Q.js.map +7 -0
  9. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js +2 -0
  10. package/dist/exports/client/RelationshipComponent-3QWBV4GT.js.map +7 -0
  11. package/dist/exports/client/bundled.css +1 -1
  12. package/dist/exports/client/chunk-G5DTIOPI.js +2 -0
  13. package/dist/exports/client/chunk-G5DTIOPI.js.map +7 -0
  14. package/dist/exports/client/chunk-LGUXX2QH.js +2 -0
  15. package/dist/exports/client/chunk-LGUXX2QH.js.map +7 -0
  16. package/dist/exports/client/chunk-NI6Z4GBD.js +2 -0
  17. package/dist/exports/client/{chunk-SQHN3N6E.js.map → chunk-NI6Z4GBD.js.map} +2 -2
  18. package/dist/exports/client/chunk-OKMIHD2R.js +2 -0
  19. package/dist/exports/client/chunk-OKMIHD2R.js.map +7 -0
  20. package/dist/exports/client/chunk-TO2W7Q2G.js +2 -0
  21. package/dist/exports/client/chunk-TO2W7Q2G.js.map +7 -0
  22. package/dist/exports/client/chunk-V2LKLT2F.js +3 -0
  23. package/dist/exports/client/chunk-V2LKLT2F.js.map +7 -0
  24. package/dist/exports/client/component-3OFD6Q4Z.js +2 -0
  25. package/dist/exports/client/component-3OFD6Q4Z.js.map +7 -0
  26. package/dist/exports/client/component-LCAAX56T.js +2 -0
  27. package/dist/exports/client/component-LCAAX56T.js.map +7 -0
  28. package/dist/exports/client/component-LLWMZU6K.js +2 -0
  29. package/dist/exports/client/component-LLWMZU6K.js.map +7 -0
  30. package/dist/exports/client/componentInline-72VZAAHP.js +2 -0
  31. package/dist/exports/client/componentInline-72VZAAHP.js.map +7 -0
  32. package/dist/exports/client/index.js +9 -9
  33. package/dist/exports/client/index.js.map +3 -3
  34. package/dist/exports/server/migrate.js +0 -1
  35. package/dist/exports/server/migrate.js.map +1 -1
  36. package/dist/features/align/client/index.js +151 -134
  37. package/dist/features/align/client/index.js.map +1 -1
  38. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  39. package/dist/features/align/client/toolbarAlignGroup.js +10 -9
  40. package/dist/features/align/client/toolbarAlignGroup.js.map +1 -1
  41. package/dist/features/align/server/i18n.js +192 -193
  42. package/dist/features/align/server/i18n.js.map +1 -1
  43. package/dist/features/align/server/index.js +5 -6
  44. package/dist/features/align/server/index.js.map +1 -1
  45. package/dist/features/blockquote/client/index.js +60 -65
  46. package/dist/features/blockquote/client/index.js.map +1 -1
  47. package/dist/features/blockquote/markdownTransformer.js +28 -34
  48. package/dist/features/blockquote/markdownTransformer.js.map +1 -1
  49. package/dist/features/blockquote/server/i18n.js +96 -97
  50. package/dist/features/blockquote/server/i18n.js.map +1 -1
  51. package/dist/features/blockquote/server/index.js +38 -37
  52. package/dist/features/blockquote/server/index.js.map +1 -1
  53. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  54. package/dist/features/blocks/client/component/BlockContent.js +166 -172
  55. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  56. package/dist/features/blocks/client/component/FormSavePlugin.d.ts.map +1 -1
  57. package/dist/features/blocks/client/component/FormSavePlugin.js +46 -22
  58. package/dist/features/blocks/client/component/FormSavePlugin.js.map +1 -1
  59. package/dist/features/blocks/client/component/index.js +130 -142
  60. package/dist/features/blocks/client/component/index.js.map +1 -1
  61. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +1 -1
  62. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +12 -8
  63. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +1 -1
  64. package/dist/features/blocks/client/componentInline/index.js +106 -122
  65. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  66. package/dist/features/blocks/client/index.js +149 -142
  67. package/dist/features/blocks/client/index.js.map +1 -1
  68. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  69. package/dist/features/blocks/client/nodes/BlocksNode.js +41 -40
  70. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  71. package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
  72. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +31 -30
  73. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  74. package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
  75. package/dist/features/blocks/client/plugin/commands.js +2 -1
  76. package/dist/features/blocks/client/plugin/commands.js.map +1 -1
  77. package/dist/features/blocks/client/plugin/index.js +179 -106
  78. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  79. package/dist/features/blocks/server/graphQLPopulationPromise.js +41 -28
  80. package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
  81. package/dist/features/blocks/server/i18n.js +288 -289
  82. package/dist/features/blocks/server/i18n.js.map +1 -1
  83. package/dist/features/blocks/server/index.js +149 -151
  84. package/dist/features/blocks/server/index.js.map +1 -1
  85. package/dist/features/blocks/server/nodes/BlocksNode.js +76 -73
  86. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  87. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +78 -76
  88. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  89. package/dist/features/blocks/server/validate.js +45 -34
  90. package/dist/features/blocks/server/validate.js.map +1 -1
  91. package/dist/features/converters/html/converter/converters/linebreak.js +4 -7
  92. package/dist/features/converters/html/converter/converters/linebreak.js.map +1 -1
  93. package/dist/features/converters/html/converter/converters/paragraph.js +24 -19
  94. package/dist/features/converters/html/converter/converters/paragraph.js.map +1 -1
  95. package/dist/features/converters/html/converter/converters/text.js +28 -29
  96. package/dist/features/converters/html/converter/converters/text.js.map +1 -1
  97. package/dist/features/converters/html/converter/defaultConverters.js +1 -6
  98. package/dist/features/converters/html/converter/defaultConverters.js.map +1 -1
  99. package/dist/features/converters/html/converter/index.js +66 -51
  100. package/dist/features/converters/html/converter/index.js.map +1 -1
  101. package/dist/features/converters/html/converter/types.js +1 -2
  102. package/dist/features/converters/html/converter/types.js.map +1 -1
  103. package/dist/features/converters/html/field/index.js +134 -139
  104. package/dist/features/converters/html/field/index.js.map +1 -1
  105. package/dist/features/converters/html/index.js +2 -3
  106. package/dist/features/converters/html/index.js.map +1 -1
  107. package/dist/features/createClientComponent.js +7 -6
  108. package/dist/features/createClientComponent.js.map +1 -1
  109. package/dist/features/createFeaturePropComponent.js +14 -13
  110. package/dist/features/createFeaturePropComponent.js.map +1 -1
  111. package/dist/features/debug/testRecorder/client/index.js +5 -7
  112. package/dist/features/debug/testRecorder/client/index.js.map +1 -1
  113. package/dist/features/debug/testRecorder/client/plugin/index.js +518 -402
  114. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  115. package/dist/features/debug/testRecorder/server/index.js +4 -5
  116. package/dist/features/debug/testRecorder/server/index.js.map +1 -1
  117. package/dist/features/debug/treeView/client/index.js +5 -7
  118. package/dist/features/debug/treeView/client/index.js.map +1 -1
  119. package/dist/features/debug/treeView/client/plugin/index.js +21 -11
  120. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  121. package/dist/features/debug/treeView/server/index.js +4 -5
  122. package/dist/features/debug/treeView/server/index.js.map +1 -1
  123. package/dist/features/experimental_table/client/index.js +41 -58
  124. package/dist/features/experimental_table/client/index.js.map +1 -1
  125. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +714 -560
  126. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  127. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +295 -301
  128. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  129. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +0 -7
  130. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  131. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +228 -159
  132. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  133. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts +1 -1
  134. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  135. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +129 -82
  136. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  137. package/dist/features/experimental_table/client/utils/debounce.d.ts.map +1 -1
  138. package/dist/features/experimental_table/client/utils/debounce.js +108 -89
  139. package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
  140. package/dist/features/experimental_table/client/utils/useDebounce.d.ts.map +1 -1
  141. package/dist/features/experimental_table/client/utils/useDebounce.js +11 -13
  142. package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
  143. package/dist/features/experimental_table/server/index.js +127 -114
  144. package/dist/features/experimental_table/server/index.js.map +1 -1
  145. package/dist/features/format/bold/feature.client.js +34 -35
  146. package/dist/features/format/bold/feature.client.js.map +1 -1
  147. package/dist/features/format/bold/feature.server.js +14 -18
  148. package/dist/features/format/bold/feature.server.js.map +1 -1
  149. package/dist/features/format/bold/markdownTransformers.js +14 -25
  150. package/dist/features/format/bold/markdownTransformers.js.map +1 -1
  151. package/dist/features/format/inlineCode/feature.client.js +26 -28
  152. package/dist/features/format/inlineCode/feature.client.js.map +1 -1
  153. package/dist/features/format/inlineCode/feature.server.js +5 -8
  154. package/dist/features/format/inlineCode/feature.server.js.map +1 -1
  155. package/dist/features/format/inlineCode/markdownTransformers.js +3 -6
  156. package/dist/features/format/inlineCode/markdownTransformers.js.map +1 -1
  157. package/dist/features/format/italic/feature.client.js +26 -29
  158. package/dist/features/format/italic/feature.client.js.map +1 -1
  159. package/dist/features/format/italic/feature.server.js +5 -9
  160. package/dist/features/format/italic/feature.server.js.map +1 -1
  161. package/dist/features/format/italic/markdownTransformers.js +7 -12
  162. package/dist/features/format/italic/markdownTransformers.js.map +1 -1
  163. package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
  164. package/dist/features/format/shared/toolbarFormatGroup.js +9 -8
  165. package/dist/features/format/shared/toolbarFormatGroup.js.map +1 -1
  166. package/dist/features/format/strikethrough/feature.client.js +26 -28
  167. package/dist/features/format/strikethrough/feature.client.js.map +1 -1
  168. package/dist/features/format/strikethrough/feature.server.js +5 -8
  169. package/dist/features/format/strikethrough/feature.server.js.map +1 -1
  170. package/dist/features/format/strikethrough/markdownTransformers.js +3 -6
  171. package/dist/features/format/strikethrough/markdownTransformers.js.map +1 -1
  172. package/dist/features/format/subscript/feature.client.js +25 -25
  173. package/dist/features/format/subscript/feature.client.js.map +1 -1
  174. package/dist/features/format/subscript/feature.server.js +4 -5
  175. package/dist/features/format/subscript/feature.server.js.map +1 -1
  176. package/dist/features/format/superscript/feature.client.js +25 -25
  177. package/dist/features/format/superscript/feature.client.js.map +1 -1
  178. package/dist/features/format/superscript/feature.server.js +4 -5
  179. package/dist/features/format/superscript/feature.server.js.map +1 -1
  180. package/dist/features/format/underline/feature.client.js +25 -25
  181. package/dist/features/format/underline/feature.client.js.map +1 -1
  182. package/dist/features/format/underline/feature.server.js +4 -5
  183. package/dist/features/format/underline/feature.server.js.map +1 -1
  184. package/dist/features/heading/client/index.js +86 -90
  185. package/dist/features/heading/client/index.js.map +1 -1
  186. package/dist/features/heading/markdownTransformer.js +22 -25
  187. package/dist/features/heading/markdownTransformer.js.map +1 -1
  188. package/dist/features/heading/server/i18n.js +96 -97
  189. package/dist/features/heading/server/i18n.js.map +1 -1
  190. package/dist/features/heading/server/index.js +49 -51
  191. package/dist/features/heading/server/index.js.map +1 -1
  192. package/dist/features/horizontalRule/client/component/index.js +81 -51
  193. package/dist/features/horizontalRule/client/component/index.js.map +1 -1
  194. package/dist/features/horizontalRule/client/index.js +48 -57
  195. package/dist/features/horizontalRule/client/index.js.map +1 -1
  196. package/dist/features/horizontalRule/client/markdownTransformer.js +15 -18
  197. package/dist/features/horizontalRule/client/markdownTransformer.js.map +1 -1
  198. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  199. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +33 -30
  200. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  201. package/dist/features/horizontalRule/client/plugin/index.js +31 -20
  202. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  203. package/dist/features/horizontalRule/server/i18n.js +96 -97
  204. package/dist/features/horizontalRule/server/i18n.js.map +1 -1
  205. package/dist/features/horizontalRule/server/index.js +17 -24
  206. package/dist/features/horizontalRule/server/index.js.map +1 -1
  207. package/dist/features/horizontalRule/server/markdownTransformer.js +15 -18
  208. package/dist/features/horizontalRule/server/markdownTransformer.js.map +1 -1
  209. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +71 -66
  210. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  211. package/dist/features/indent/client/index.js +52 -47
  212. package/dist/features/indent/client/index.js.map +1 -1
  213. package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
  214. package/dist/features/indent/client/toolbarIndentGroup.js +9 -8
  215. package/dist/features/indent/client/toolbarIndentGroup.js.map +1 -1
  216. package/dist/features/indent/server/i18n.js +128 -129
  217. package/dist/features/indent/server/i18n.js.map +1 -1
  218. package/dist/features/indent/server/index.js +5 -6
  219. package/dist/features/indent/server/index.js.map +1 -1
  220. package/dist/features/link/client/index.js +78 -83
  221. package/dist/features/link/client/index.js.map +1 -1
  222. package/dist/features/link/client/plugins/autoLink/index.js +267 -271
  223. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  224. package/dist/features/link/client/plugins/clickableLink/index.js +3 -3
  225. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  226. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/commands.d.ts.map +1 -1
  227. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/commands.js +2 -1
  228. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/commands.js.map +1 -1
  229. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +254 -276
  230. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  231. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +8 -6
  232. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  233. package/dist/features/link/client/plugins/floatingLinkEditor/types.js +1 -2
  234. package/dist/features/link/client/plugins/floatingLinkEditor/types.js.map +1 -1
  235. package/dist/features/link/client/plugins/link/index.js +50 -41
  236. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  237. package/dist/features/link/markdownTransformer.js +38 -39
  238. package/dist/features/link/markdownTransformer.js.map +1 -1
  239. package/dist/features/link/nodes/AutoLinkNode.js +57 -56
  240. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  241. package/dist/features/link/nodes/LinkNode.js +277 -276
  242. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  243. package/dist/features/link/nodes/types.js +1 -2
  244. package/dist/features/link/nodes/types.js.map +1 -1
  245. package/dist/features/link/server/baseFields.js +118 -88
  246. package/dist/features/link/server/baseFields.js.map +1 -1
  247. package/dist/features/link/server/graphQLPopulationPromise.js +42 -28
  248. package/dist/features/link/server/graphQLPopulationPromise.js.map +1 -1
  249. package/dist/features/link/server/i18n.js +96 -97
  250. package/dist/features/link/server/i18n.js.map +1 -1
  251. package/dist/features/link/server/index.js +120 -114
  252. package/dist/features/link/server/index.js.map +1 -1
  253. package/dist/features/link/server/transformExtraFields.js +15 -15
  254. package/dist/features/link/server/transformExtraFields.js.map +1 -1
  255. package/dist/features/link/server/validate.js +37 -26
  256. package/dist/features/link/server/validate.js.map +1 -1
  257. package/dist/features/lists/checklist/client/index.js +77 -85
  258. package/dist/features/lists/checklist/client/index.js.map +1 -1
  259. package/dist/features/lists/checklist/client/plugin/index.js +3 -3
  260. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  261. package/dist/features/lists/checklist/markdownTransformers.js +7 -11
  262. package/dist/features/lists/checklist/markdownTransformers.js.map +1 -1
  263. package/dist/features/lists/checklist/server/i18n.js +96 -97
  264. package/dist/features/lists/checklist/server/i18n.js.map +1 -1
  265. package/dist/features/lists/checklist/server/index.js +21 -25
  266. package/dist/features/lists/checklist/server/index.js.map +1 -1
  267. package/dist/features/lists/htmlConverter.js +54 -43
  268. package/dist/features/lists/htmlConverter.js.map +1 -1
  269. package/dist/features/lists/orderedList/client/index.js +71 -77
  270. package/dist/features/lists/orderedList/client/index.js.map +1 -1
  271. package/dist/features/lists/orderedList/markdownTransformer.js +7 -11
  272. package/dist/features/lists/orderedList/markdownTransformer.js.map +1 -1
  273. package/dist/features/lists/orderedList/server/i18n.js +96 -97
  274. package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
  275. package/dist/features/lists/orderedList/server/index.js +21 -25
  276. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  277. package/dist/features/lists/plugin/index.js +3 -3
  278. package/dist/features/lists/plugin/index.js.map +1 -1
  279. package/dist/features/lists/shared/markdown.js +48 -49
  280. package/dist/features/lists/shared/markdown.js.map +1 -1
  281. package/dist/features/lists/shared/slashMenuListGroup.js +9 -8
  282. package/dist/features/lists/shared/slashMenuListGroup.js.map +1 -1
  283. package/dist/features/lists/unorderedList/client/index.js +68 -76
  284. package/dist/features/lists/unorderedList/client/index.js.map +1 -1
  285. package/dist/features/lists/unorderedList/markdownTransformer.js +7 -11
  286. package/dist/features/lists/unorderedList/markdownTransformer.js.map +1 -1
  287. package/dist/features/lists/unorderedList/server/i18n.js +96 -97
  288. package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
  289. package/dist/features/lists/unorderedList/server/index.js +17 -23
  290. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  291. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js +18 -17
  292. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +1 -1
  293. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js +30 -29
  294. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +1 -1
  295. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js +21 -20
  296. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +1 -1
  297. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js +21 -19
  298. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +1 -1
  299. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js +18 -17
  300. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +1 -1
  301. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js +24 -23
  302. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +1 -1
  303. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +20 -21
  304. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +1 -1
  305. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js +1 -10
  306. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +1 -1
  307. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +69 -61
  308. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
  309. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js +1 -2
  310. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +1 -1
  311. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +5 -7
  312. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +1 -1
  313. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +42 -43
  314. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +1 -1
  315. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +1 -1
  316. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +11 -11
  317. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  318. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +64 -59
  319. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  320. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js +19 -19
  321. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
  322. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js +20 -25
  323. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
  324. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js +28 -30
  325. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +1 -1
  326. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +26 -26
  327. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +1 -1
  328. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js +22 -21
  329. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
  330. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js +22 -22
  331. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
  332. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js +12 -13
  333. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +1 -1
  334. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js +23 -23
  335. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
  336. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js +22 -22
  337. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
  338. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js +15 -16
  339. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +1 -1
  340. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js +1 -13
  341. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +1 -1
  342. package/dist/features/migrations/slateToLexical/converter/index.js +105 -98
  343. package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
  344. package/dist/features/migrations/slateToLexical/converter/types.js +1 -2
  345. package/dist/features/migrations/slateToLexical/converter/types.js.map +1 -1
  346. package/dist/features/migrations/slateToLexical/feature.client.js +7 -7
  347. package/dist/features/migrations/slateToLexical/feature.client.js.map +1 -1
  348. package/dist/features/migrations/slateToLexical/feature.server.js +43 -44
  349. package/dist/features/migrations/slateToLexical/feature.server.js.map +1 -1
  350. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +1 -1
  351. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +11 -11
  352. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  353. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +64 -59
  354. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  355. package/dist/features/paragraph/client/index.js +58 -61
  356. package/dist/features/paragraph/client/index.js.map +1 -1
  357. package/dist/features/paragraph/server/i18n.js +128 -129
  358. package/dist/features/paragraph/server/i18n.js.map +1 -1
  359. package/dist/features/paragraph/server/index.js +6 -7
  360. package/dist/features/paragraph/server/index.js.map +1 -1
  361. package/dist/features/relationship/client/components/RelationshipComponent.js +141 -149
  362. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  363. package/dist/features/relationship/client/drawer/commands.js +0 -1
  364. package/dist/features/relationship/client/drawer/commands.js.map +1 -1
  365. package/dist/features/relationship/client/drawer/index.js +138 -67
  366. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  367. package/dist/features/relationship/client/index.js +53 -59
  368. package/dist/features/relationship/client/index.js.map +1 -1
  369. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  370. package/dist/features/relationship/client/nodes/RelationshipNode.js +60 -59
  371. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  372. package/dist/features/relationship/client/plugins/index.js +90 -35
  373. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  374. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.d.ts.map +1 -1
  375. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +97 -26
  376. package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
  377. package/dist/features/relationship/server/graphQLPopulationPromise.js +34 -26
  378. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  379. package/dist/features/relationship/server/i18n.js +96 -97
  380. package/dist/features/relationship/server/i18n.js.map +1 -1
  381. package/dist/features/relationship/server/index.js +48 -44
  382. package/dist/features/relationship/server/index.js.map +1 -1
  383. package/dist/features/relationship/server/nodes/RelationshipNode.js +90 -87
  384. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  385. package/dist/features/shared/slashMenu/basicGroup.js +9 -8
  386. package/dist/features/shared/slashMenu/basicGroup.js.map +1 -1
  387. package/dist/features/shared/toolbar/addDropdownGroup.js +8 -9
  388. package/dist/features/shared/toolbar/addDropdownGroup.js.map +1 -1
  389. package/dist/features/shared/toolbar/featureButtonsGroup.js +7 -8
  390. package/dist/features/shared/toolbar/featureButtonsGroup.js.map +1 -1
  391. package/dist/features/shared/toolbar/textDropdownGroup.js +8 -9
  392. package/dist/features/shared/toolbar/textDropdownGroup.js.map +1 -1
  393. package/dist/features/toolbars/fixed/client/Toolbar/index.js +264 -187
  394. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  395. package/dist/features/toolbars/fixed/client/index.js +5 -7
  396. package/dist/features/toolbars/fixed/client/index.js.map +1 -1
  397. package/dist/features/toolbars/fixed/server/index.js +14 -13
  398. package/dist/features/toolbars/fixed/server/index.js.map +1 -1
  399. package/dist/features/toolbars/inline/client/Toolbar/index.js +374 -286
  400. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  401. package/dist/features/toolbars/inline/client/index.js +5 -7
  402. package/dist/features/toolbars/inline/client/index.js.map +1 -1
  403. package/dist/features/toolbars/inline/server/index.js +4 -5
  404. package/dist/features/toolbars/inline/server/index.js.map +1 -1
  405. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts +1 -1
  406. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  407. package/dist/features/toolbars/shared/ToolbarButton/index.js +75 -97
  408. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  409. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +190 -211
  410. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  411. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +1 -1
  412. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  413. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +289 -124
  414. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  415. package/dist/features/toolbars/types.js +1 -2
  416. package/dist/features/toolbars/types.js.map +1 -1
  417. package/dist/features/typeUtilities.js +2 -3
  418. package/dist/features/typeUtilities.js.map +1 -1
  419. package/dist/features/typesClient.js +1 -2
  420. package/dist/features/typesClient.js.map +1 -1
  421. package/dist/features/typesServer.js +1 -2
  422. package/dist/features/typesServer.js.map +1 -1
  423. package/dist/features/upload/client/component/index.js +208 -224
  424. package/dist/features/upload/client/component/index.js.map +1 -1
  425. package/dist/features/upload/client/drawer/commands.js +1 -1
  426. package/dist/features/upload/client/drawer/commands.js.map +1 -1
  427. package/dist/features/upload/client/drawer/index.js +107 -58
  428. package/dist/features/upload/client/drawer/index.js.map +1 -1
  429. package/dist/features/upload/client/feature.client.js +51 -61
  430. package/dist/features/upload/client/feature.client.js.map +1 -1
  431. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  432. package/dist/features/upload/client/nodes/UploadNode.js +76 -73
  433. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  434. package/dist/features/upload/client/plugin/index.js +67 -39
  435. package/dist/features/upload/client/plugin/index.js.map +1 -1
  436. package/dist/features/upload/server/feature.server.js +190 -171
  437. package/dist/features/upload/server/feature.server.js.map +1 -1
  438. package/dist/features/upload/server/graphQLPopulationPromise.js +60 -47
  439. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  440. package/dist/features/upload/server/i18n.js +96 -97
  441. package/dist/features/upload/server/i18n.js.map +1 -1
  442. package/dist/features/upload/server/nodes/UploadNode.js +113 -108
  443. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  444. package/dist/features/upload/server/validate.js +53 -40
  445. package/dist/features/upload/server/validate.js.map +1 -1
  446. package/dist/field/Field.js +124 -105
  447. package/dist/field/Field.js.map +1 -1
  448. package/dist/field/bundled.css +1 -0
  449. package/dist/field/index.js +92 -36
  450. package/dist/field/index.js.map +1 -1
  451. package/dist/i18n.js +160 -161
  452. package/dist/i18n.js.map +1 -1
  453. package/dist/index.js +670 -623
  454. package/dist/index.js.map +1 -1
  455. package/dist/lexical/EditorPlugin.d.ts.map +1 -1
  456. package/dist/lexical/EditorPlugin.js +15 -10
  457. package/dist/lexical/EditorPlugin.js.map +1 -1
  458. package/dist/lexical/LexicalEditor.js +206 -161
  459. package/dist/lexical/LexicalEditor.js.map +1 -1
  460. package/dist/lexical/LexicalProvider.js +83 -82
  461. package/dist/lexical/LexicalProvider.js.map +1 -1
  462. package/dist/lexical/config/client/EditorConfigProvider.js +76 -79
  463. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  464. package/dist/lexical/config/client/default.js +3 -3
  465. package/dist/lexical/config/client/default.js.map +1 -1
  466. package/dist/lexical/config/client/loader.js +42 -39
  467. package/dist/lexical/config/client/loader.js.map +1 -1
  468. package/dist/lexical/config/client/sanitize.js +165 -165
  469. package/dist/lexical/config/client/sanitize.js.map +1 -1
  470. package/dist/lexical/config/server/default.js +5 -27
  471. package/dist/lexical/config/server/default.js.map +1 -1
  472. package/dist/lexical/config/server/loader.js +103 -103
  473. package/dist/lexical/config/server/loader.js.map +1 -1
  474. package/dist/lexical/config/server/sanitize.js +98 -99
  475. package/dist/lexical/config/server/sanitize.js.map +1 -1
  476. package/dist/lexical/config/types.js +1 -2
  477. package/dist/lexical/config/types.js.map +1 -1
  478. package/dist/lexical/nodes/index.js +9 -8
  479. package/dist/lexical/nodes/index.js.map +1 -1
  480. package/dist/lexical/plugins/MarkdownShortcut/index.js +17 -5
  481. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  482. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +384 -361
  483. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  484. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +223 -160
  485. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  486. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js +1 -2
  487. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
  488. package/dist/lexical/plugins/SlashMenu/index.js +191 -179
  489. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  490. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.d.ts.map +1 -1
  491. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js +41 -26
  492. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
  493. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +164 -129
  494. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  495. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
  496. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +11 -10
  497. package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
  498. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.d.ts.map +1 -1
  499. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +11 -10
  500. package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
  501. package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.d.ts.map +1 -1
  502. package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js +27 -23
  503. package/dist/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.js.map +1 -1
  504. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +331 -300
  505. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  506. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +110 -97
  507. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  508. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
  509. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js +23 -16
  510. package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.js.map +1 -1
  511. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.d.ts.map +1 -1
  512. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js +18 -27
  513. package/dist/lexical/plugins/handles/utils/doesLineHeightAffectElement.js.map +1 -1
  514. package/dist/lexical/plugins/handles/utils/getCollapsedMargins.d.ts.map +1 -1
  515. package/dist/lexical/plugins/handles/utils/getCollapsedMargins.js +15 -11
  516. package/dist/lexical/plugins/handles/utils/getCollapsedMargins.js.map +1 -1
  517. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
  518. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +133 -118
  519. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
  520. package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.d.ts.map +1 -1
  521. package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.js +3 -2
  522. package/dist/lexical/plugins/handles/utils/getTopLevelNodeKeys.js.map +1 -1
  523. package/dist/lexical/plugins/handles/utils/isOnHandleElement.d.ts.map +1 -1
  524. package/dist/lexical/plugins/handles/utils/isOnHandleElement.js +3 -2
  525. package/dist/lexical/plugins/handles/utils/isOnHandleElement.js.map +1 -1
  526. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  527. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +26 -25
  528. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  529. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  530. package/dist/lexical/theme/EditorTheme.js +97 -102
  531. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  532. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  533. package/dist/lexical/ui/ContentEditable.js +27 -10
  534. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  535. package/dist/lexical/ui/icons/AI/index.d.ts.map +1 -1
  536. package/dist/lexical/ui/icons/AI/index.js +31 -33
  537. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  538. package/dist/lexical/ui/icons/Add/index.d.ts.map +1 -1
  539. package/dist/lexical/ui/icons/Add/index.js +16 -18
  540. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  541. package/dist/lexical/ui/icons/AlignCenter/index.d.ts.map +1 -1
  542. package/dist/lexical/ui/icons/AlignCenter/index.js +25 -28
  543. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  544. package/dist/lexical/ui/icons/AlignJustify/index.d.ts.map +1 -1
  545. package/dist/lexical/ui/icons/AlignJustify/index.js +25 -28
  546. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  547. package/dist/lexical/ui/icons/AlignLeft/index.d.ts.map +1 -1
  548. package/dist/lexical/ui/icons/AlignLeft/index.js +25 -28
  549. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  550. package/dist/lexical/ui/icons/AlignRight/index.d.ts.map +1 -1
  551. package/dist/lexical/ui/icons/AlignRight/index.js +25 -28
  552. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  553. package/dist/lexical/ui/icons/Block/index.d.ts.map +1 -1
  554. package/dist/lexical/ui/icons/Block/index.js +34 -37
  555. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  556. package/dist/lexical/ui/icons/Blockquote/index.d.ts.map +1 -1
  557. package/dist/lexical/ui/icons/Blockquote/index.js +16 -15
  558. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  559. package/dist/lexical/ui/icons/Bold/index.d.ts.map +1 -1
  560. package/dist/lexical/ui/icons/Bold/index.js +16 -15
  561. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  562. package/dist/lexical/ui/icons/Checklist/index.d.ts.map +1 -1
  563. package/dist/lexical/ui/icons/Checklist/index.js +24 -26
  564. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  565. package/dist/lexical/ui/icons/Code/index.d.ts.map +1 -1
  566. package/dist/lexical/ui/icons/Code/index.js +19 -21
  567. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  568. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  569. package/dist/lexical/ui/icons/CodeBlock/index.js +19 -21
  570. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  571. package/dist/lexical/ui/icons/H1/index.d.ts.map +1 -1
  572. package/dist/lexical/ui/icons/H1/index.js +16 -15
  573. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  574. package/dist/lexical/ui/icons/H2/index.d.ts.map +1 -1
  575. package/dist/lexical/ui/icons/H2/index.js +16 -15
  576. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  577. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  578. package/dist/lexical/ui/icons/H3/index.js +16 -15
  579. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  580. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  581. package/dist/lexical/ui/icons/H4/index.js +16 -15
  582. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  583. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  584. package/dist/lexical/ui/icons/H5/index.js +16 -15
  585. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  586. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  587. package/dist/lexical/ui/icons/H6/index.js +16 -15
  588. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  589. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -1
  590. package/dist/lexical/ui/icons/HorizontalRule/index.js +19 -18
  591. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  592. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts.map +1 -1
  593. package/dist/lexical/ui/icons/IndentDecrease/index.js +28 -32
  594. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  595. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts.map +1 -1
  596. package/dist/lexical/ui/icons/IndentIncrease/index.js +28 -32
  597. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  598. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -1
  599. package/dist/lexical/ui/icons/InlineBlocks/index.js +18 -17
  600. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  601. package/dist/lexical/ui/icons/Italic/index.d.ts.map +1 -1
  602. package/dist/lexical/ui/icons/Italic/index.js +16 -15
  603. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  604. package/dist/lexical/ui/icons/Link/index.d.ts.map +1 -1
  605. package/dist/lexical/ui/icons/Link/index.js +17 -16
  606. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  607. package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -1
  608. package/dist/lexical/ui/icons/Meatballs/index.js +19 -22
  609. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  610. package/dist/lexical/ui/icons/OrderedList/index.d.ts.map +1 -1
  611. package/dist/lexical/ui/icons/OrderedList/index.js +31 -36
  612. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  613. package/dist/lexical/ui/icons/Relationship/index.d.ts.map +1 -1
  614. package/dist/lexical/ui/icons/Relationship/index.js +31 -33
  615. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  616. package/dist/lexical/ui/icons/Strikethrough/index.d.ts.map +1 -1
  617. package/dist/lexical/ui/icons/Strikethrough/index.js +19 -21
  618. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  619. package/dist/lexical/ui/icons/Subscript/index.d.ts.map +1 -1
  620. package/dist/lexical/ui/icons/Subscript/index.js +16 -15
  621. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  622. package/dist/lexical/ui/icons/Superscript/index.d.ts.map +1 -1
  623. package/dist/lexical/ui/icons/Superscript/index.js +16 -15
  624. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  625. package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
  626. package/dist/lexical/ui/icons/Table/index.js +17 -16
  627. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  628. package/dist/lexical/ui/icons/Text/index.d.ts.map +1 -1
  629. package/dist/lexical/ui/icons/Text/index.js +16 -15
  630. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  631. package/dist/lexical/ui/icons/Underline/index.d.ts.map +1 -1
  632. package/dist/lexical/ui/icons/Underline/index.js +19 -21
  633. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  634. package/dist/lexical/ui/icons/UnorderedList/index.d.ts.map +1 -1
  635. package/dist/lexical/ui/icons/UnorderedList/index.js +46 -52
  636. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  637. package/dist/lexical/ui/icons/Upload/index.d.ts.map +1 -1
  638. package/dist/lexical/ui/icons/Upload/index.js +28 -31
  639. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  640. package/dist/lexical/utils/canUseDOM.d.ts.map +1 -1
  641. package/dist/lexical/utils/canUseDOM.js +2 -1
  642. package/dist/lexical/utils/canUseDOM.js.map +1 -1
  643. package/dist/lexical/utils/environment.d.ts.map +1 -1
  644. package/dist/lexical/utils/environment.js +2 -1
  645. package/dist/lexical/utils/environment.js.map +1 -1
  646. package/dist/lexical/utils/getDOMRangeRect.d.ts.map +1 -1
  647. package/dist/lexical/utils/getDOMRangeRect.js +13 -12
  648. package/dist/lexical/utils/getDOMRangeRect.js.map +1 -1
  649. package/dist/lexical/utils/getSelectedNode.d.ts.map +1 -1
  650. package/dist/lexical/utils/getSelectedNode.js +18 -13
  651. package/dist/lexical/utils/getSelectedNode.js.map +1 -1
  652. package/dist/lexical/utils/guard.d.ts.map +1 -1
  653. package/dist/lexical/utils/guard.js +3 -2
  654. package/dist/lexical/utils/guard.js.map +1 -1
  655. package/dist/lexical/utils/joinClasses.d.ts.map +1 -1
  656. package/dist/lexical/utils/joinClasses.js +3 -2
  657. package/dist/lexical/utils/joinClasses.js.map +1 -1
  658. package/dist/lexical/utils/markdown/createBlockNode.js +9 -10
  659. package/dist/lexical/utils/markdown/createBlockNode.js.map +1 -1
  660. package/dist/lexical/utils/nodeFormat.js +58 -59
  661. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  662. package/dist/lexical/utils/point.d.ts.map +1 -1
  663. package/dist/lexical/utils/point.js +40 -32
  664. package/dist/lexical/utils/point.js.map +1 -1
  665. package/dist/lexical/utils/rect.d.ts.map +1 -1
  666. package/dist/lexical/utils/rect.js +167 -134
  667. package/dist/lexical/utils/rect.js.map +1 -1
  668. package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
  669. package/dist/lexical/utils/setFloatingElemPosition.js +56 -45
  670. package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
  671. package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.d.ts.map +1 -1
  672. package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.js +23 -22
  673. package/dist/lexical/utils/setFloatingElemPositionForLinkEditor.js.map +1 -1
  674. package/dist/lexical/utils/swipe.d.ts.map +1 -1
  675. package/dist/lexical/utils/swipe.js +82 -83
  676. package/dist/lexical/utils/swipe.js.map +1 -1
  677. package/dist/lexical/utils/url.js +23 -22
  678. package/dist/lexical/utils/url.js.map +1 -1
  679. package/dist/nodeTypes.js +1 -2
  680. package/dist/nodeTypes.js.map +1 -1
  681. package/dist/populateGraphQL/defaultValue.js +24 -29
  682. package/dist/populateGraphQL/defaultValue.js.map +1 -1
  683. package/dist/populateGraphQL/populate.js +35 -25
  684. package/dist/populateGraphQL/populate.js.map +1 -1
  685. package/dist/populateGraphQL/populateLexicalPopulationPromises.js +47 -32
  686. package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
  687. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js +39 -25
  688. package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
  689. package/dist/types.js +1 -2
  690. package/dist/types.js.map +1 -1
  691. package/dist/utilities/createClientFeature.js +40 -36
  692. package/dist/utilities/createClientFeature.js.map +1 -1
  693. package/dist/utilities/createServerFeature.js +46 -35
  694. package/dist/utilities/createServerFeature.js.map +1 -1
  695. package/dist/utilities/fieldsDrawer/Drawer.js +28 -17
  696. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  697. package/dist/utilities/fieldsDrawer/DrawerContent.js +149 -78
  698. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  699. package/dist/utilities/forEachNodeRecursively.js +24 -19
  700. package/dist/utilities/forEachNodeRecursively.js.map +1 -1
  701. package/dist/utilities/generateComponentMap.js +90 -82
  702. package/dist/utilities/generateComponentMap.js.map +1 -1
  703. package/dist/utilities/generateImportMap.js +53 -47
  704. package/dist/utilities/generateImportMap.js.map +1 -1
  705. package/dist/utilities/generateSchemaMap.js +35 -30
  706. package/dist/utilities/generateSchemaMap.js.map +1 -1
  707. package/dist/utilities/migrateSlateToLexical/index.js +99 -86
  708. package/dist/utilities/migrateSlateToLexical/index.js.map +1 -1
  709. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +73 -66
  710. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  711. package/dist/utilities/recurseNodeTree.js +25 -22
  712. package/dist/utilities/recurseNodeTree.js.map +1 -1
  713. package/dist/utilities/upgradeLexicalData/index.js +99 -86
  714. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  715. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +71 -66
  716. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  717. package/dist/utilities/useLexicalFeature.js +9 -8
  718. package/dist/utilities/useLexicalFeature.js.map +1 -1
  719. package/dist/validate/index.js +32 -26
  720. package/dist/validate/index.js.map +1 -1
  721. package/dist/validate/validateNodes.js +31 -28
  722. package/dist/validate/validateNodes.js.map +1 -1
  723. package/package.json +22 -11
  724. package/dist/exports/client/Component-7HS6FEJS.js +0 -2
  725. package/dist/exports/client/Component-7HS6FEJS.js.map +0 -7
  726. package/dist/exports/client/Component-LAKSCIDX.js +0 -2
  727. package/dist/exports/client/Component-LAKSCIDX.js.map +0 -7
  728. package/dist/exports/client/Field-BYB3WX7J.js +0 -2
  729. package/dist/exports/client/Field-BYB3WX7J.js.map +0 -7
  730. package/dist/exports/client/RelationshipComponent-GYUTPDNG.js +0 -2
  731. package/dist/exports/client/RelationshipComponent-GYUTPDNG.js.map +0 -7
  732. package/dist/exports/client/chunk-4EX7W4UX.js +0 -2
  733. package/dist/exports/client/chunk-4EX7W4UX.js.map +0 -7
  734. package/dist/exports/client/chunk-E4HH5PS6.js +0 -2
  735. package/dist/exports/client/chunk-E4HH5PS6.js.map +0 -7
  736. package/dist/exports/client/chunk-EBB2CEB6.js +0 -2
  737. package/dist/exports/client/chunk-EBB2CEB6.js.map +0 -7
  738. package/dist/exports/client/chunk-LTR7V74A.js +0 -2
  739. package/dist/exports/client/chunk-LTR7V74A.js.map +0 -7
  740. package/dist/exports/client/chunk-SQHN3N6E.js +0 -2
  741. package/dist/exports/client/chunk-VMCQSR3T.js +0 -3
  742. package/dist/exports/client/chunk-VMCQSR3T.js.map +0 -7
  743. package/dist/exports/client/component-6C5JERGA.js +0 -2
  744. package/dist/exports/client/component-6C5JERGA.js.map +0 -7
  745. package/dist/exports/client/component-GUWIGB77.js +0 -2
  746. package/dist/exports/client/component-GUWIGB77.js.map +0 -7
  747. package/dist/exports/client/component-UQ2BKD5X.js +0 -2
  748. package/dist/exports/client/component-UQ2BKD5X.js.map +0 -7
  749. package/dist/exports/client/componentInline-C2XIK5VZ.js +0 -2
  750. package/dist/exports/client/componentInline-C2XIK5VZ.js.map +0 -7
  751. package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts +0 -12
  752. package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts.map +0 -1
  753. package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js +0 -181
  754. package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{b as E}from"./chunk-NI6Z4GBD.js";import{jsx as L}from"react/jsx-runtime";import{Drawer as z}from"@payloadcms/ui";import"react";import{c as H}from"react/compiler-runtime";import{jsx as T,jsxs as J}from"react/jsx-runtime";import{Form as K,FormSubmit as B,RenderFields as G,useConfig as V,useDocumentInfo as q,useFieldProps as Q,useTranslation as X}from"@payloadcms/ui";import{getFormState as I}from"@payloadcms/ui/shared";import{useEffect as Y,useState as Z}from"react";import{v4 as N}from"uuid";var F=e=>{let t=H(27),{data:a,featureKey:r,fieldMapOverride:o,handleDrawerSubmit:c,schemaFieldsPathOverride:v,schemaPathSuffix:s}=e,{t:f}=X(),{id:i}=q(),{schemaPath:x}=Q(),{config:n}=V(),[p,m]=Z(!1),{field:O}=E(),{richTextComponentMap:w}=O,U=`lexical_internal_feature.${r}.fields${s?`.${s}`:""}`,l=v??`${x}.lexical_internal_feature.${r}${s?`.${s}`:""}`,g;t[0]!==o||t[1]!==w||t[2]!==U?(g=o??w.get(U),t[0]=o,t[1]=w,t[2]=U,t[3]=g):g=t[3];let u=g,S,b;t[4]!==n.routes.api||t[5]!==n.serverURL||t[6]!==i||t[7]!==a||t[8]!==l?(S=()=>{(async()=>{let d=await I({apiRoute:n.routes.api,body:{id:i,data:a??{},operation:"update",schemaPath:l},serverURL:n.serverURL});m(d)})()},b=[n.routes.api,n.serverURL,l,i,a],t[4]=n.routes.api,t[5]=n.serverURL,t[6]=i,t[7]=a,t[8]=l,t[9]=S,t[10]=b):(S=t[9],b=t[10]),Y(S,b);let R;t[11]!==n.routes.api||t[12]!==n.serverURL||t[13]!==i||t[14]!==l?(R=async h=>{let{formState:d}=h;return await I({apiRoute:n.routes.api,body:{id:i,formState:d,operation:"update",schemaPath:l},serverURL:n.serverURL})},t[11]=n.routes.api,t[12]=n.serverURL,t[13]=i,t[14]=l,t[15]=R):R=t[15];let y=R;if(p===!1)return null;let D;if(t[16]!==y||t[17]!==u||t[18]!==l||t[19]!==f||t[20]!==p||t[21]!==c){let h;t[23]!==u?(h=Array.isArray(u)?u:[],t[23]=u,t[24]=h):h=t[24];let d;t[25]!==u?(d=Array.isArray(u)?u:[],t[25]=u,t[26]=d):d=t[26],D=J(K,{beforeSubmit:[y],disableValidationOnSubmit:!0,fields:h,initialState:p,onChange:[y],onSubmit:c,uuid:N(),children:[T(G,{fields:d,forceRender:!0,path:"",readOnly:!1,schemaPath:l}),T(B,{children:f("fields:saveChanges")})]}),t[16]=y,t[17]=u,t[18]=l,t[19]=f,t[20]=p,t[21]=c,t[22]=D}else D=t[22];return D};var Ut=({className:e,data:t,drawerSlug:a,drawerTitle:r,featureKey:o,fieldMapOverride:c,handleDrawerSubmit:v,schemaFieldsPathOverride:s,schemaPathSuffix:f})=>L(z,{className:e,slug:a,title:r??"",children:L(F,{data:t,featureKey:o,fieldMapOverride:c,handleDrawerSubmit:v,schemaFieldsPathOverride:s,schemaPathSuffix:f})});import{c as tt}from"react/compiler-runtime";import{useAuth as et,useConfig as rt,useEntityVisibility as at}from"@payloadcms/ui";import*as A from"react";var nt=(e,t)=>e.filter(({slug:a,admin:{enableRichTextRelationship:r},upload:o})=>t.visibleEntities.collections.includes(a)?t?.uploads?r&&!!o:o?!1:r:!1),It=e=>{let t=tt(16),a,r,o;t[0]!==e?({children:o,uploads:a,...r}=e,t[0]=e,t[1]=a,t[2]=r,t[3]=o):(a=t[1],r=t[2],o=t[3]);let c=a===void 0?!1:a,{config:v}=rt(),{collections:s}=v,{user:f}=et(),{visibleEntities:i}=at(),x;t[4]!==s||t[5]!==c||t[6]!==f||t[7]!==i?(x=()=>nt(s,{uploads:c,user:f,visibleEntities:i}).map(m=>{let{slug:O}=m;return O}),t[4]=s,t[5]=c,t[6]=f,t[7]=i,t[8]=x):x=t[8];let[n]=A.useState(x);if(!n.length)return null;let p;if(t[9]!==r||t[10]!==n||t[11]!==o){let m;t[13]!==r||t[14]!==n?(m={...r,enabledCollectionSlugs:n},t[13]=r,t[14]=n,t[15]=m):m=t[15],p=A.cloneElement(o,m),t[9]=r,t[10]=n,t[11]=o,t[12]=p}else p=t[12];return p};import{createCommand as ot}from"lexical";var Pt=ot("INSERT_UPLOAD_WITH_DRAWER_COMMAND");import{jsx as ct}from"react/jsx-runtime";import M from"bson-objectid";import{$applyNodeReplacement as ft}from"lexical";import*as k from"react";import{jsx as it}from"react/jsx-runtime";import{DecoratorBlockNode as st}from"@lexical/react/LexicalDecoratorBlockNode.js";import P from"bson-objectid";import{$applyNodeReplacement as lt}from"lexical";import"react";function $(e){return e.parentElement!=null&&e.parentElement.tagName==="LI"&&e.previousSibling===null&&e.getAttribute("aria-roledescription")==="checkbox"}function ut(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let a=e.getAttribute("data-lexical-upload-id"),r=e.getAttribute("data-lexical-upload-relation-to");if(a!=null&&r!=null)return{node:j({data:{fields:{},relationTo:r,value:a}})}}let t=e;return t.src.startsWith("file:///")||$(t),null}var _=class extends st{__data;constructor({data:t,format:a,key:r}){super(a,r),this.__data=t}static clone(t){return new this({data:t.__data,format:t.__format,key:t.__key})}static getType(){return"upload"}static importDOM(){return{img:t=>({conversion:ut,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new P.default().toHexString(),t.version=3);let a={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},r=j({data:a});return r.setFormat(t.format),r}static isInline(){return!1}decorate(){return it(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("img");return t.setAttribute("data-lexical-upload-id",String(this.__data?.value)),t.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:t}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(t){let a=this.getWritable();a.__data=t}updateDOM(){return!1}};function j({data:e}){return e?.id||(e.id=new P.default().toHexString()),lt(new _({data:e}))}var pt=k.lazy(()=>import("./component-3OFD6Q4Z.js").then(e=>({default:e.UploadComponent})));function mt(e){if(e.hasAttribute("data-lexical-upload-relation-to")&&e.hasAttribute("data-lexical-upload-id")){let a=e.getAttribute("data-lexical-upload-id"),r=e.getAttribute("data-lexical-upload-relation-to");if(a!=null&&r!=null)return{node:W({data:{fields:{},relationTo:r,value:a}})}}let t=e;return t.src.startsWith("file:///")||$(t),null}var C=class extends _{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{img:t=>({conversion:mt,priority:0})}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id),t.version===2&&!t?.id&&(t.id=new M.default().toHexString(),t.version=3);let a={id:t.id,fields:t.fields,relationTo:t.relationTo,value:t.value},r=W({data:a});return r.setFormat(t.format),r}decorate(){return ct(pt,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function W({data:e}){return e?.id||(e.id=new M.default().toHexString()),ft(new C({data:e}))}function Qt(e){return e instanceof C}export{Ut as a,It as b,Pt as c,C as d,W as e,Qt as f};
2
+ //# sourceMappingURL=chunk-G5DTIOPI.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/relationship/client/utils/EnabledRelationshipsCondition.tsx", "../../../src/features/upload/client/drawer/commands.ts", "../../../src/features/upload/client/nodes/UploadNode.tsx", "../../../src/features/upload/server/nodes/UploadNode.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.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 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 schemaPathSuffix,\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 <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={handleDrawerSubmit}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n )\n}\n", "'use client'\nimport type { FormProps } from '@payloadcms/ui'\nimport type { ClientField, FormState } from 'payload'\n\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useConfig,\n useDocumentInfo,\n useFieldProps,\n useTranslation,\n} from '@payloadcms/ui'\nimport { getFormState } from '@payloadcms/ui/shared'\nimport React, { useCallback, useEffect, 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'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id } = useDocumentInfo()\n const { schemaPath } = useFieldProps()\n const { config } = useConfig()\n const [initialState, setInitialState] = useState<FormState | false>(false)\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n\n const componentMapRenderedFieldsPath = `lexical_internal_feature.${featureKey}.fields${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any =\n fieldMapOverride ?? (richTextComponentMap.get(componentMapRenderedFieldsPath) as ClientField[]) // Field Schema\n\n useEffect(() => {\n const awaitInitialState = async () => {\n const state = await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n data: data ?? {},\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n }) // Form State\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n }, [config.routes.api, config.serverURL, schemaFieldsPath, id, data])\n\n const onChange: FormProps['onChange'][0] = useCallback(\n async ({ formState: prevFormState }) => {\n return await getFormState({\n apiRoute: config.routes.api,\n body: {\n id,\n formState: prevFormState,\n operation: 'update',\n schemaPath: schemaFieldsPath,\n },\n serverURL: config.serverURL,\n })\n },\n\n [config.routes.api, config.serverURL, schemaFieldsPath, id],\n )\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\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 path=\"\" // See Blocks feature path for details as for why this is empty\n readOnly={false}\n schemaPath={schemaFieldsPath}\n />\n\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { ClientCollectionConfig, ClientUser, VisibleEntities } from 'payload'\n\nimport { useAuth, useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype Options = {\n uploads: boolean\n user: ClientUser\n visibleEntities: VisibleEntities\n}\n\ntype FilteredCollectionsT = (\n collections: ClientCollectionConfig[],\n options?: Options,\n) => ClientCollectionConfig[]\n\nconst filterRichTextCollections: FilteredCollectionsT = (collections, options) => {\n return collections.filter(({ slug, admin: { enableRichTextRelationship }, upload }) => {\n if (!options.visibleEntities.collections.includes(slug)) {\n return false\n }\n\n if (options?.uploads) {\n return enableRichTextRelationship && Boolean(upload) === true\n }\n\n return upload ? false : enableRichTextRelationship\n })\n}\n\nexport const EnabledRelationshipsCondition: React.FC<any> = (props) => {\n const { children, uploads = false, ...rest } = props\n const {\n config: { collections },\n } = useConfig()\n const { user } = useAuth()\n const { visibleEntities } = useEntityVisibility()\n\n const [enabledCollectionSlugs] = React.useState(() =>\n filterRichTextCollections(collections, { uploads, user, visibleEntities }).map(\n ({ slug }) => slug,\n ),\n )\n\n if (!enabledCollectionSlugs.length) {\n return null\n }\n\n return React.cloneElement(children, { ...rest, enabledCollectionSlugs })\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n", "'use client'\nimport type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type { DOMConversionMap, DOMConversionOutput, LexicalNode, Spread } from 'lexical'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\n\nimport { UploadServerNode, isGoogleDocCheckboxImg } from '../../server/nodes/UploadNode.js'\n\nconst RawUploadComponent = React.lazy(() =>\n import('../../client/component/index.js').then((module) => ({ default: module.UploadComponent })),\n)\n\nfunction $convertUploadElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadNode extends UploadServerNode {\n static clone(node: UploadServerNode): UploadServerNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n img: (node: HTMLImageElement) => ({\n conversion: $convertUploadElement,\n priority: 0,\n }),\n }\n }\n\n static importJSON(serializedNode: SerializedUploadNode): UploadNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n decorate(): JSX.Element {\n return <RawUploadComponent data={this.__data} nodeKey={this.getKey()} />\n }\n\n exportJSON(): SerializedUploadNode {\n return super.exportJSON()\n }\n}\n\nexport function $createUploadNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadNode({ data: data as UploadData }))\n}\n\nexport function $isUploadNode(node: LexicalNode | null | undefined): node is UploadNode {\n return node instanceof UploadNode\n}\n", "import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n ElementFormatType,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug, JsonObject } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport ObjectID from 'bson-objectid'\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nexport type UploadData = {\n fields: JsonObject\n id: string\n relationTo: CollectionSlug\n value: number | string\n}\n\nexport function isGoogleDocCheckboxImg(img: HTMLImageElement): boolean {\n return (\n img.parentElement != null &&\n img.parentElement.tagName === 'LI' &&\n img.previousSibling === null &&\n img.getAttribute('aria-roledescription') === 'checkbox'\n )\n}\n\nfunction $convertUploadServerElement(domNode: HTMLImageElement): DOMConversionOutput | null {\n if (\n domNode.hasAttribute('data-lexical-upload-relation-to') &&\n domNode.hasAttribute('data-lexical-upload-id')\n ) {\n const id = domNode.getAttribute('data-lexical-upload-id')\n const relationTo = domNode.getAttribute('data-lexical-upload-relation-to')\n\n if (id != null && relationTo != null) {\n const node = $createUploadServerNode({\n data: {\n fields: {},\n relationTo,\n value: id,\n },\n })\n return { node }\n }\n }\n const img = domNode\n if (img.src.startsWith('file:///') || isGoogleDocCheckboxImg(img)) {\n return null\n }\n // TODO: Auto-upload functionality here!\n //}\n return null\n}\n\nexport type SerializedUploadNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'upload'\n} & Spread<UploadData, SerializedDecoratorBlockNode>\n\nexport class UploadServerNode extends DecoratorBlockNode {\n __data: UploadData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: UploadData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: UploadServerNode): UploadServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'upload'\n }\n\n static importDOM(): DOMConversionMap | null {\n return {\n img: (node: HTMLImageElement) => ({\n conversion: $convertUploadServerElement,\n priority: 0,\n }),\n }\n }\n\n static importJSON(serializedNode: SerializedUploadNode): UploadServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n if (serializedNode.version === 2 && !serializedNode?.id) {\n serializedNode.id = new ObjectID.default().toHexString()\n serializedNode.version = 3\n }\n\n const importedData: UploadData = {\n id: serializedNode.id,\n fields: serializedNode.fields,\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n\n const node = $createUploadServerNode({ data: importedData })\n node.setFormat(serializedNode.format)\n\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(): JSX.Element {\n // @ts-expect-error\n return <RawUploadComponent data={this.__data} format={this.__format} nodeKey={this.getKey()} />\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('img')\n element.setAttribute('data-lexical-upload-id', String(this.__data?.value))\n element.setAttribute('data-lexical-upload-relation-to', this.__data?.relationTo)\n\n return { element }\n }\n\n exportJSON(): SerializedUploadNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'upload',\n version: 3,\n }\n }\n\n getData(): UploadData {\n return this.getLatest().__data\n }\n\n setData(data: UploadData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n\n updateDOM(): false {\n return false\n }\n}\n\nexport function $createUploadServerNode({\n data,\n}: {\n data: Omit<UploadData, 'id'> & Partial<Pick<UploadData, 'id'>>\n}): UploadServerNode {\n if (!data?.id) {\n data.id = new ObjectID.default().toHexString()\n }\n return $applyNodeReplacement(new UploadServerNode({ data: data as UploadData }))\n}\n\nexport function $isUploadServerNode(\n node: LexicalNode | null | undefined,\n): node is UploadServerNode {\n return node instanceof UploadServerNode\n}\n"],
5
+ "mappings": "gFAGA,OAASA,UAAAA,MAAc,iBACvB,MAAkB,QCJlB,OAAAC,KAAAC,MAAA,2EAIA,OACEC,QAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,aAAA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form", "FormSubmit", "RenderFields", "useConfig", "useDocumentInfo", "useFieldProps", "useTranslation", "getFormState", "useEffect", "useState", "v4", "uuid", "DrawerContent", "t0", "$", "_c", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPathSuffix", "t", "useTranslation", "id", "useDocumentInfo", "schemaPath", "useFieldProps", "config", "useConfig", "initialState", "setInitialState", "useState", "field", "t1", "useEditorConfigContext", "richTextComponentMap", "componentMapRenderedFieldsPath", "schemaFieldsPath", "t2", "get", "fields", "t3", "state", "getFormState", "apiRoute", "routes", "api", "body", "operation", "serverURL", "t4", "useEffect", "t5", "t6", "formState", "prevFormState", "onChange", "t7", "Array", "isArray", "t8", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "onSubmit", "uuid", "children", "_jsx", "RenderFields", "forceRender", "path", "readOnly", "FormSubmit", "FieldsDrawer", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPathSuffix", "_jsx", "Drawer", "slug", "title", "DrawerContent", "c", "_c", "useAuth", "useConfig", "useEntityVisibility", "React", "filterRichTextCollections", "collections", "options", "filter", "slug", "admin", "enableRichTextRelationship", "upload", "visibleEntities", "includes", "uploads", "Boolean", "EnabledRelationshipsCondition", "props", "$", "t0", "rest", "children", "undefined", "config", "t1", "user", "t2", "map", "t3", "enabledCollectionSlugs", "useState", "length", "t4", "cloneElement", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "ObjectID", "$applyNodeReplacement", "React", "DecoratorBlockNode", "ObjectID", "$applyNodeReplacement", "isGoogleDocCheckboxImg", "img", "parentElement", "tagName", "previousSibling", "getAttribute", "$convertUploadServerElement", "domNode", "hasAttribute", "id", "relationTo", "node", "$createUploadServerNode", "data", "fields", "value", "src", "startsWith", "UploadServerNode", "__data", "constructor", "format", "key", "clone", "__format", "__key", "getType", "importDOM", "conversion", "priority", "importJSON", "serializedNode", "version", "default", "toHexString", "importedData", "setFormat", "isInline", "decorate", "_jsx", "RawUploadComponent", "nodeKey", "getKey", "exportDOM", "element", "document", "createElement", "setAttribute", "String", "exportJSON", "getData", "type", "getLatest", "setData", "writable", "getWritable", "updateDOM", "RawUploadComponent", "lazy", "then", "module", "default", "UploadComponent", "$convertUploadElement", "domNode", "hasAttribute", "id", "getAttribute", "relationTo", "node", "$createUploadNode", "data", "fields", "value", "img", "src", "startsWith", "isGoogleDocCheckboxImg", "UploadNode", "UploadServerNode", "clone", "getType", "importDOM", "conversion", "priority", "importJSON", "serializedNode", "version", "ObjectID", "toHexString", "importedData", "setFormat", "format", "decorate", "_jsx", "__data", "nodeKey", "getKey", "exportJSON", "$applyNodeReplacement", "$isUploadNode"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{createCommand as u}from"lexical";var d=u("INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND");import{jsx as h}from"react/jsx-runtime";import*as l from"react";import{DecoratorBlockNode as c}from"@lexical/react/LexicalDecoratorBlockNode.js";function p(r){let t=r.getAttribute("data-lexical-relationship-id"),e=r.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node:o({relationTo:e,value:t})}:null}var n=class extends c{__data;constructor({data:t,format:e,key:a}){super(e,a),this.__data=t}static clone(t){return new this({data:t.__data,format:t.__format,key:t.__key})}static getType(){return"relationship"}static importDOM(){return{div:t=>!t.hasAttribute("data-lexical-relationship-relationTo")||!t.hasAttribute("data-lexical-relationship-id")?null:{conversion:p,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},a=o(e);return a.setFormat(t.format),a}static isInline(){return!1}decorate(t,e){return null}exportDOM(){let t=document.createElement("div");t.setAttribute("data-lexical-relationship-id",String(this.__data?.value)),t.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let e=document.createTextNode(this.getTextContent());return t.append(e),{element:t}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${this.__data?.value}`}setData(t){let e=this.getWritable();e.__data=t}};function o(r){return new n({data:r})}var _=l.lazy(()=>import("./RelationshipComponent-3QWBV4GT.js").then(r=>({default:r.RelationshipComponent})));function m(r){let t=r.getAttribute("data-lexical-relationship-id"),e=r.getAttribute("data-lexical-relationship-relationTo");return t!=null&&e!=null?{node:s({relationTo:e,value:t})}:null}var i=class extends n{static clone(t){return super.clone(t)}static getType(){return super.getType()}static importDOM(){return{div:t=>!t.hasAttribute("data-lexical-relationship-relationTo")||!t.hasAttribute("data-lexical-relationship-id")?null:{conversion:m,priority:2}}}static importJSON(t){t.version===1&&t?.value?.id&&(t.value=t.value.id);let e={relationTo:t.relationTo,value:t.value},a=s(e);return a.setFormat(t.format),a}decorate(t,e){return h(_,{className:e.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function s(r){return new i({data:r})}function R(r){return r instanceof i}export{d as a,i as b,s as c,R as d};
2
+ //# sourceMappingURL=chunk-LGUXX2QH.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/relationship/client/drawer/commands.ts", "../../../src/features/relationship/client/nodes/RelationshipNode.tsx", "../../../src/features/relationship/server/nodes/RelationshipNode.tsx"],
4
+ "sourcesContent": ["import type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND')\n", "'use client'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport * as React from 'react'\n\nimport type {\n RelationshipData,\n SerializedRelationshipNode,\n} from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipServerNode } from '../../server/nodes/RelationshipNode.js'\n\nconst RelationshipComponent = React.lazy(() =>\n import('../components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nfunction $relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends RelationshipServerNode {\n static clone(node: RelationshipServerNode): RelationshipServerNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n exportJSON(): SerializedRelationshipNode {\n return super.exportJSON()\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return new RelationshipNode({\n data,\n })\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | RelationshipNode | null | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n", "import type { SerializedDecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\nimport type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n ElementFormatType,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n Spread,\n} from 'lexical'\nimport type { CollectionSlug } from 'payload'\nimport type { JSX } from 'react'\n\nimport { DecoratorBlockNode } from '@lexical/react/LexicalDecoratorBlockNode.js'\n\nexport type RelationshipData = {\n relationTo: CollectionSlug\n value: number | string\n}\n\nexport type SerializedRelationshipNode = {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'relationship'\n} & Spread<RelationshipData, SerializedDecoratorBlockNode>\n\nfunction $relationshipElementToServerNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createServerRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipServerNode extends DecoratorBlockNode {\n __data: RelationshipData\n\n constructor({\n data,\n format,\n key,\n }: {\n data: RelationshipData\n format?: ElementFormatType\n key?: NodeKey\n }) {\n super(format, key)\n this.__data = data\n }\n\n static clone(node: RelationshipServerNode): RelationshipServerNode {\n return new this({\n data: node.__data,\n format: node.__format,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'relationship'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToServerNode,\n priority: 2,\n }\n },\n }\n }\n\n static importJSON(serializedNode: SerializedRelationshipNode): RelationshipServerNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createServerRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null\n }\n\n exportDOM(): DOMExportOutput {\n const element = document.createElement('div')\n element.setAttribute('data-lexical-relationship-id', String(this.__data?.value))\n element.setAttribute('data-lexical-relationship-relationTo', this.__data?.relationTo)\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n exportJSON(): SerializedRelationshipNode {\n return {\n ...super.exportJSON(),\n ...this.getData(),\n type: 'relationship',\n version: 2,\n }\n }\n\n getData(): RelationshipData {\n return this.getLatest().__data\n }\n\n getTextContent(): string {\n return `${this.__data?.relationTo} relation to ${this.__data?.value}`\n }\n\n setData(data: RelationshipData): void {\n const writable = this.getWritable()\n writable.__data = data\n }\n}\n\nexport function $createServerRelationshipNode(data: RelationshipData): RelationshipServerNode {\n return new RelationshipServerNode({\n data,\n })\n}\n\nexport function $isServerRelationshipNode(\n node: LexicalNode | RelationshipServerNode | null | undefined,\n): node is RelationshipServerNode {\n return node instanceof RelationshipServerNode\n}\n"],
5
+ "mappings": "AAEA,OAASA,iBAAAA,MAAqB,UAEvB,IAAMC,EAERD,EAAc,yCAAA,0CCInB,UAAYE,MAAW,QCKvB,OAASC,sBAAAA,MAA0B,8CAYnC,SAASC,EAAiCC,EAAuB,CAC/D,IAAMC,EAAKD,EAAQE,aAAa,8BAAA,EAC1BC,EAAaH,EAAQE,aAAa,sCAAA,EAExC,OAAID,GAAM,MAAQE,GAAc,KAKvB,CAAEC,KAJIC,EAA8B,CACzCF,WAAAA,EACAG,MAAOL,CACT,CAAA,CACc,EAET,IACT,CAEO,IAAMM,EAAN,cAAqCT,CAAA,CAC1CU,OAEAC,YAAY,CACVC,KAAAA,EACAC,OAAAA,EACAC,IAAAA,CAAG,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ACCgC,UAAWF,EAAOG,MAAMC,cAAgB,mCACxCC,KAAM,KAAKC,OACXT,OAAQ,KAAKU,SACbC,QAAS,KAAKC,OAAM,GAG1B,CAEAC,YAAyC,CACvC,OAAO,MAAMA,WAAA,CACf,CACF,EAEO,SAAS7B,EAAwBwB,EAAsB,CAC5D,OAAO,IAAItB,EAAiB,CAC1BsB,KAAAA,CACF,CAAA,CACF,CAEO,SAASM,EACd/B,EAAuD,CAEvD,OAAOA,aAAgBG,CACzB",
6
+ "names": ["createCommand", "INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND", "React", "DecoratorBlockNode", "$relationshipElementToServerNode", "domNode", "id", "getAttribute", "relationTo", "node", "$createServerRelationshipNode", "value", "RelationshipServerNode", "__data", "constructor", "data", "format", "key", "clone", "__format", "__key", "getType", "importDOM", "div", "hasAttribute", "conversion", "priority", "importJSON", "serializedNode", "version", "importedData", "setFormat", "isInline", "decorate", "editor", "config", "exportDOM", "element", "document", "createElement", "setAttribute", "String", "text", "createTextNode", "getTextContent", "append", "exportJSON", "getData", "type", "getLatest", "setData", "writable", "getWritable", "RelationshipComponent", "lazy", "then", "module", "default", "$relationshipElementToNode", "domNode", "id", "getAttribute", "relationTo", "node", "$createRelationshipNode", "value", "RelationshipNode", "RelationshipServerNode", "clone", "getType", "importDOM", "div", "hasAttribute", "conversion", "priority", "importJSON", "serializedNode", "version", "importedData", "setFormat", "format", "decorate", "editor", "config", "_jsx", "className", "theme", "relationship", "data", "__data", "__format", "nodeKey", "getKey", "exportJSON", "$isRelationshipNode"]
7
+ }
@@ -0,0 +1,2 @@
1
+ import{jsx as w}from"react/jsx-runtime";import{useLexicalComposerContext as x}from"@lexical/react/LexicalComposerContext.js";import"react";import{createContext as C,useContext as M,useMemo as b,useRef as E,useState as m}from"react";function v(){return Math.random().toString(36).substring(2,12)+Math.random().toString(36).substring(2,12)}var g=C({editorConfig:null,field:null,uuid:null}),F=({children:o,editorConfig:s,editorContainerRef:c,field:d,parentContext:n})=>{let[a]=x(),[f]=m(v()),t=E(new Map),[l,h]=m(null),u=E(new Set),p=b(()=>({blurEditor:r=>{u.current.clear()},childrenEditors:t,editor:a,editorConfig:s,editorContainerRef:c,field:d,focusEditor:r=>{let e=r.uuid;u.current.has(e)||(u.current.add(e),h(r),n?.uuid&&n.focusEditor(r),t.current.forEach((i,S)=>{i.focusEditor(r)}),u.current.clear())},focusedEditor:l,parentEditor:n,registerChild:(r,e)=>{if(!t.current.has(r)){let i=new Map(t.current);i.set(r,e),t.current=i}},unregisterChild:r=>{if(t.current.has(r)){let e=new Map(t.current);e.delete(r),t.current=e}},uuid:f}),[a,t,s,c,d,l,n,f]);return w(g.Provider,{value:p,children:o})},G=()=>{let o=M(g);if(o===void 0)throw new Error("useEditorConfigContext must be used within an EditorConfigProvider");return o};export{F as a,G as b};
2
+ //# sourceMappingURL=chunk-NI6Z4GBD.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lexical/config/client/EditorConfigProvider.tsx"],
4
4
  "sourcesContent": ["'use client'\n\nimport type { LexicalEditor } from 'lexical'\nimport type { RichTextFieldClient } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport * as React from 'react'\nimport { createContext, useContext, useMemo, useRef, useState } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../../../types.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 editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n field: LexicalRichTextFieldProps['field']\n // Editor focus handling\n focusEditor: (editorContext: EditorConfigContextType) => void\n focusedEditor: EditorConfigContextType | null\n parentEditor: EditorConfigContextType\n registerChild: (uuid: string, editorContext: EditorConfigContextType) => void\n unregisterChild?: (uuid: string) => void\n uuid: string\n}\n\nconst Context: React.Context<EditorConfigContextType> = createContext({\n editorConfig: null,\n field: null,\n uuid: null,\n})\n\nexport const EditorConfigProvider = ({\n children,\n editorConfig,\n editorContainerRef,\n field,\n parentContext,\n}: {\n children: React.ReactNode\n editorConfig: SanitizedClientEditorConfig\n editorContainerRef: React.RefObject<HTMLDivElement>\n field: LexicalRichTextFieldProps['field']\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\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 editor,\n editorConfig,\n editorContainerRef,\n field,\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, childUUID) => {\n childEditor.focusEditor(editorContext)\n })\n\n focusHistory.current.clear()\n },\n focusedEditor,\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 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 editor,\n childrenEditors,\n editorConfig,\n editorContainerRef,\n field,\n focusedEditor,\n parentContext,\n uuid,\n ],\n )\n\n return <Context.Provider value={editorContext}>{children}</Context.Provider>\n}\n\nexport const useEditorConfigContext = (): EditorConfigContextType => {\n const context = useContext(Context)\n if (context === undefined) {\n throw new Error('useEditorConfigContext must be used within an EditorConfigProvider')\n }\n return context\n}\n"],
5
- "mappings": "AAKA,OAAS,6BAAAA,MAAiC,2CAE1C,OAAS,iBAAAC,EAAe,cAAAC,EAAY,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAuH5D,cAAAC,MAAA,oBAjHT,SAASC,GAA4B,CACnC,OAAO,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,EAAG,EAAE,EAAI,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,UAAU,EAAG,EAAE,CACjG,CAmBA,IAAMC,EAAkDP,EAAc,CACpE,aAAc,KACd,MAAO,KACP,KAAM,IACR,CAAC,EAEYQ,EAAuB,CAAC,CACnC,SAAAC,EACA,aAAAC,EACA,mBAAAC,EACA,MAAAC,EACA,cAAAC,CACF,IAMuB,CACrB,GAAM,CAACC,CAAM,EAAIf,EAA0B,EAErC,CAACgB,CAAI,EAAIX,EAASE,EAAkB,CAAC,EAErCU,EAAkBb,EAA6C,IAAI,GAAK,EACxE,CAACc,EAAeC,CAAgB,EAAId,EAAyC,IAAI,EACjFe,EAAehB,EAAoB,IAAI,GAAK,EAE5CiB,EAAgBlB,EACpB,KACG,CACC,WAAakB,GAA2C,CAEtDD,EAAa,QAAQ,MAAM,CAC7B,EACA,gBAAAH,EACA,OAAAF,EACA,aAAAJ,EACA,mBAAAC,EACA,MAAAC,EACA,YAAcQ,GAA2C,CACvD,IAAMC,EAAaD,EAAc,KAG7BD,EAAa,QAAQ,IAAIE,CAAU,IAKvCF,EAAa,QAAQ,IAAIE,CAAU,EACnCH,EAAiBE,CAAa,EAG1BP,GAAe,MACjBA,EAAc,YAAYO,CAAa,EAEzCJ,EAAgB,QAAQ,QAAQ,CAACM,EAAaC,IAAc,CAC1DD,EAAY,YAAYF,CAAa,CACvC,CAAC,EAEDD,EAAa,QAAQ,MAAM,EAC7B,EACA,cAAAF,EACA,aAAcJ,EACd,cAAe,CAACU,EAAWC,IAAuB,CAChD,GAAI,CAACR,EAAgB,QAAQ,IAAIO,CAAS,EAAG,CAC3C,IAAME,EAAS,IAAI,IAAIT,EAAgB,OAAO,EAC9CS,EAAO,IAAIF,EAAWC,CAAkB,EACxCR,EAAgB,QAAUS,CAC5B,CACF,EACA,gBAAkBF,GAAc,CAC9B,GAAIP,EAAgB,QAAQ,IAAIO,CAAS,EAAG,CAC1C,IAAME,EAAS,IAAI,IAAIT,EAAgB,OAAO,EAC9CS,EAAO,OAAOF,CAAS,EACvBP,EAAgB,QAAUS,CAC5B,CACF,EAEA,KAAAV,CACF,GACF,CACED,EACAE,EACAN,EACAC,EACAC,EACAK,EACAJ,EACAE,CACF,CACF,EAEA,OAAOV,EAACE,EAAQ,SAAR,CAAiB,MAAOa,EAAgB,SAAAX,EAAS,CAC3D,EAEaiB,EAAyB,IAA+B,CACnE,IAAMC,EAAU1B,EAAWM,CAAO,EAClC,GAAIoB,IAAY,OACd,MAAM,IAAI,MAAM,oEAAoE,EAEtF,OAAOA,CACT",
6
- "names": ["useLexicalComposerContext", "createContext", "useContext", "useMemo", "useRef", "useState", "jsx", "generateQuickGuid", "Context", "EditorConfigProvider", "children", "editorConfig", "editorContainerRef", "field", "parentContext", "editor", "uuid", "childrenEditors", "focusedEditor", "setFocusedEditor", "focusHistory", "editorContext", "editorUUID", "childEditor", "childUUID", "childEditorContext", "newMap", "useEditorConfigContext", "context"]
5
+ "mappings": "wCAKA,OAASA,6BAAAA,MAAiC,2CAC1C,MAAuB,Q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,EAAS,IAAInB,IAAID,EAAgBQ,OAAO,EAC9CY,EAAOC,IAAIL,EAAWG,CAAA,EACtBnB,EAAgBQ,QAAUY,CAC5B,CACF,EACAE,gBAAkBN,GAAA,CAChB,GAAIhB,EAAgBQ,QAAQI,IAAII,CAAA,EAAY,CAC1C,IAAMI,EAAS,IAAInB,IAAID,EAAgBQ,OAAO,EAC9CY,EAAOG,OAAOP,CAAA,EACdhB,EAAgBQ,QAAUY,CAC5B,CACF,EAEA1B,KAAAA,CACF,GACF,CACEK,EACAC,EACAR,EACAK,EACAJ,EACAS,EACAJ,EACAJ,CAAA,CACD,EAGH,OAAO8B,EAACjC,EAAQkC,SAAQ,CAACC,MAAOpB,WAAgBV,GAClD,EAEa+B,EAAyBA,IAAA,CACpC,IAAAC,EAAgB9C,EAAAS,CAAW,EAAA,GACvBqC,IAAAC,OAAY,MAAA,IAAAC,MACE,oEAAA,EAAA,OAEXF,CAAA",
6
+ "names": ["useLexicalComposerContext", "createContext", "useContext", "useMemo", "useRef", "useState", "generateQuickGuid", "Math", "random", "toString", "substring", "Context", "editorConfig", "field", "uuid", "EditorConfigProvider", "children", "editorContainerRef", "parentContext", "editor", "childrenEditors", "Map", "focusedEditor", "setFocusedEditor", "focusHistory", "Set", "editorContext", "blurEditor", "current", "clear", "focusEditor", "editorUUID", "has", "add", "forEach", "childEditor", "childUUID", "parentEditor", "registerChild", "childEditorContext", "newMap", "set", "unregisterChild", "delete", "_jsx", "Provider", "value", "useEditorConfigContext", "context", "undefined", "Error"]
7
7
  }
@@ -0,0 +1,2 @@
1
+ import{createCommand as i}from"lexical";var O=i("INSERT_BLOCK_COMMAND"),x=i("INSERT_INLINE_BLOCK_COMMAND"),I=i("OPEN_INLINE_BLOCK_DRAWER_COMMAND");import{jsx as p}from"react/jsx-runtime";import u from"bson-objectid";import m from"react";import c from"bson-objectid";import{DecoratorNode as l}from"lexical";import{deepCopyObjectSimple as d}from"payload/shared";var r=class extends l{__fields;constructor({fields:e,key:n}){super(n),this.__fields=e}static clone(e){return new this({fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return a(e.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(){let e=document.createElement("span");return e.classList.add("inline-block-container"),e}decorate(e,n){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let n=document.createTextNode(this.getTextContent());return e.append(n),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e){let n=d(e),s=this.getWritable();s.__fields=n}updateDOM(){return!1}};function a(t){return new r({fields:{...t,id:t?.id||new c.default().toHexString()}})}var f=m.lazy(()=>import("./componentInline-72VZAAHP.js").then(t=>({default:t.InlineBlockComponent}))),o=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return _(e.fields)}decorate(e,n){return p(f,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function _(t){return new o({fields:{...t,id:t?.id||new u.default().toHexString()}})}function y(t){return t instanceof o}export{O as a,x as b,I as c,o as d,_ as e,y as f};
2
+ //# sourceMappingURL=chunk-OKMIHD2R.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/blocks/client/plugin/commands.ts", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nimport type { InsertBlockPayload } from './index.js'\n\nexport const INSERT_BLOCK_COMMAND: LexicalCommand<InsertBlockPayload> =\n createCommand('INSERT_BLOCK_COMMAND')\n\nexport const INSERT_INLINE_BLOCK_COMMAND: LexicalCommand<Partial<InsertBlockPayload>> =\n createCommand('INSERT_INLINE_BLOCK_COMMAND')\n\nexport const OPEN_INLINE_BLOCK_DRAWER_COMMAND: LexicalCommand<{\n fields: Partial<InsertBlockPayload>\n nodeKey?: string\n}> = createCommand('OPEN_INLINE_BLOCK_DRAWER_COMMAND')\n", "'use client'\nimport type {\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type { SerializedServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nexport type InlineBlockFields = {\n /** Block form data */\n [key: string]: any\n //blockName: string\n blockType: string\n id: string\n}\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport type SerializedInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n static importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return <InlineBlockComponent formData={this.getFields()} nodeKey={this.getKey()} />\n }\n\n exportJSON(): SerializedServerInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\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 SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\nimport { deepCopyObjectSimple } from 'payload/shared'\n\nexport type InlineBlockFields = {\n /** Block form data */\n [key: string]: any\n //blockName: string\n blockType: string\n id: string\n}\n\nexport type SerializedServerInlineBlockNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<React.ReactElement> {\n __fields: InlineBlockFields\n\n constructor({ fields, key }: { fields: InlineBlockFields; key?: NodeKey }) {\n super(key)\n this.__fields = fields\n }\n\n static clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static getType(): string {\n return 'inlineBlock'\n }\n\n static importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static importJSON(serializedNode: SerializedServerInlineBlockNode): 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 createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return null\n }\n\n 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 exportJSON(): SerializedServerInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n getTextContent(): string {\n return `Block Field`\n }\n\n isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields): void {\n const fieldsCopy = deepCopyObjectSimple(fields)\n\n const writable = this.getWritable()\n writable.__fields = fieldsCopy\n }\n\n updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | ServerInlineBlockNode | null | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],
5
+ "mappings": "AAGA,OAASA,iBAAAA,MAAqB,UAIvB,IAAMC,EACXD,EAAc,sBAAA,EAEHE,EACXF,EAAc,6BAAA,EAEHG,EAGRH,EAAc,kCAAA,0CCPnB,OAAOI,MAAc,gBACrB,OAAOC,MAAyB,QCGhC,OAAOC,MAAc,gBACrB,OAASC,iBAAAA,MAAqB,UAC9B,OAASC,wBAAAA,MAA4B,iBAmB9B,IAAMC,EAAN,cAAoCF,CAAA,CACzCG,SAEAC,YAAY,CAAEC,OAAAA,EAAQC,IAAAA,CAAG,EAAkD,CACzE,MAAMA,CAAA,EACN,KAAKH,SAAWE,CAClB,CAEA,OAAOE,MAAMC,EAAoD,CAC/D,OAAO,IAAI,KAAK,CACdH,OAAQG,EAAKL,SACbG,IAAKE,EAAKC,KACZ,CAAA,CACF,CAEA,OAAOC,SAAkB,CACvB,MAAO,aACT,CAEA,OAAOC,WAAqD,CAC1D,MAAO,CAAC,CACV,CAEA,OAAOC,WAAWC,EAAwE,CAExF,OADaC,EAA6BD,EAAeR,MAAM,CAEjE,CAEA,OAAOU,UAAkB,CACvB,MAAO,EACT,CAEAC,WAAY,CACV,MAAO,EACT,CACAC,WAAY,CACV,IAAMC,EAAUC,SAASC,cAAc,MAAA,EACvCF,OAAAA,EAAQG,UAAUC,IAAI,wBAAA,EAEfJ,CACT,CAEAK,SAASC,EAAuBC,EAAmC,CACjE,OAAO,IACT,CAEAC,WAA6B,CAC3B,IAAMR,EAAUC,SAASC,cA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,OAAO,IAAIR,EAAgB,CACzBQ,OAAQ,CACN,GAAGA,EACHU,GAAIV,GAAQU,IAAM,IAAIC,EAASpB,QAAO,EAAGqB,YAAW,CACtD,CACF,CAAA,CACF,CAEO,SAASC,EACdlB,EAAsD,CAEtD,OAAOA,aAAgBH,CACzB",
6
+ "names": ["createCommand", "INSERT_BLOCK_COMMAND", "INSERT_INLINE_BLOCK_COMMAND", "OPEN_INLINE_BLOCK_DRAWER_COMMAND", "ObjectID", "React", "ObjectID", "DecoratorNode", "deepCopyObjectSimple", "ServerInlineBlockNode", "__fields", "constructor", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "element", "document", "createElement", "classList", "add", "decorate", "editor", "config", "exportDOM", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getLatest", "setFields", "fieldsCopy", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "editor", "config", "_jsx", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode"]
7
+ }
@@ -0,0 +1,2 @@
1
+ function Mt({editorConfig:i}){return i.features.nodes.map(t=>"node"in t?t.node:t)}import{c as gt}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{useLexicalComposerContext as _t}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as xt}from"@lexical/utils";import{$getSelection as P,$isRangeSelection as B,$isTextNode as St,COMMAND_PRIORITY_LOW as Ot,createCommand as wt}from"lexical";import{useEffect as F,useState as yt}from"react";import*as D from"react";import{c as U}from"react/compiler-runtime";import{useLexicalComposerContext as X}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as $}from"@lexical/utils";import{$getSelection as J,$isRangeSelection as Z,COMMAND_PRIORITY_LOW as E,KEY_ARROW_DOWN_COMMAND as tt,KEY_ARROW_UP_COMMAND as et,KEY_ENTER_COMMAND as nt,KEY_ESCAPE_COMMAND as ot,KEY_TAB_COMMAND as it,createCommand as st}from"lexical";import{useCallback as v,useEffect as N,useLayoutEffect as rt,useMemo as lt,useRef as ct,useState as at}from"react";var ut="slash-menu-popup",W=i=>{let t=document.getElementById("slash-menu");if(!t)return;let n=t.getBoundingClientRect();n.top+n.height>window.innerHeight&&t.scrollIntoView({block:"center"}),n.top<0&&t.scrollIntoView({block:"center"}),i.scrollIntoView({block:"nearest"})};function ft(i,t,n){let o=n;for(let e=o;e<=t.length;e++)i.substring(i.length-e)===t.substring(0,e)&&(o=e);return o}function ht(i){let t=J();if(!Z(t)||!t.isCollapsed())return null;let n=t.anchor;if(n.type!=="text")return null;let o=n.getNode();if(!o.isSimpleText())return null;let e=n.offset,r=o.getTextContent().slice(0,e),a=i.replaceableString.length,f=ft(r,i.matchingString,a),c=e-f;if(c<0)return null;let m;return c===0?[m]=o.splitText(e):[,m]=o.splitText(c,e),m}function mt(i,t){let n=getComputedStyle(i),o=n.position==="absolute",e=t?/(auto|scroll|hidden)/:/(auto|scroll)/;if(n.position==="fixed")return document.body;for(let r=i;r=r.parentElement;)if(n=getComputedStyle(r),!(o&&n.position==="static")&&e.test(n.overflow+n.overflowY+n.overflowX))return r;return document.body}function H(i,t){let n=i.getBoundingClientRect(),o=t.getBoundingClientRect();return n.top>o.top&&n.top<o.bottom}function dt(i,t,n,o){let e=U(7),[r]=X(),a,f;e[0]!==t||e[1]!==i||e[2]!==r||e[3]!==n||e[4]!==o?(a=()=>{if(t!=null&&i!=null){let c=r.getRootElement(),m=c!=null?mt(c,!1):document.body,d;d=!1;let l;l=H(t,m);let h=function(){d||(window.requestAnimationFrame(function(){n(),d=!1}),d=!0);let x=H(t,m);x!==l&&(l=x,o?.(x))},O=new ResizeObserver(n);return window.addEventListener("resize",n),document.addEventListener("scroll",h,{capture:!0,passive:!0}),O.observe(t),()=>{O.unobserve(t),window.removeEventListener("resize",n),document.removeEventListener("scroll",h,!0)}}},f=[t,r,o,n,i],e[0]=t,e[1]=i,e[2]=r,e[3]=n,e[4]=o,e[5]=a,e[6]=f):(a=e[5],f=e[6]),N(a,f)}var k=st("SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND");function K({anchorElementRef:i,close:t,editor:n,groups:o,menuRenderFn:e,onSelectItem:r,resolution:a,shouldSplitNodeWithQuery:f=!1}){let[c,m]=at(null),d=a.match&&a.match.matchingString||"",l=v(s=>{let u=n.getRootElement();u!==null&&(u.setAttribute("aria-activedescendant",`${ut}__item-${s.key}`),m(s.key))},[n]),h=v(()=>{if(o!==null&&d!=null){let s=o.flatMap(u=>u.items);if(s.length){let u=s[0];l(u)}}},[o,l,d]);N(()=>{h()},[d,h]);let O=v(s=>{n.update(()=>{let u=a.match!=null&&f?ht(a.match):null;r(s,u,t,a.match?a.match.matchingString:"")})},[n,f,a.match,r,t]);N(()=>()=>{let s=n.getRootElement();s!==null&&s.removeAttribute("aria-activedescendant")},[n]),rt(()=>{o===null?m(null):c===null&&h()},[o,c,l,h]),N(()=>$(n.registerCommand(k,({item:s})=>s.ref&&s.ref.current!=null?(W(s.ref.current),!0):!1,E)),[n,l]),N(()=>$(n.registerCommand(tt,s=>{let u=s;if(o!==null&&o.length&&c!==null){let _=o.flatMap(w=>w.items),g=_.findIndex(w=>w.key===c),S=g!==_.length-1?g+1:0,p=_[S];l(p),p.ref!=null&&p.ref.current&&n.dispatchCommand(k,{index:S,item:p}),u.preventDefault(),u.stopImmediatePropagation()}return!0},E),n.registerCommand(et,s=>{let u=s;if(o!==null&&o.length&&c!==null){let _=o.flatMap(w=>w.items),g=_.findIndex(w=>w.key===c),S=g!==0?g-1:_.length-1,p=_[S];l(p),p.ref!=null&&p.ref.current&&W(p.ref.current),u.preventDefault(),u.stopImmediatePropagation()}return!0},E),n.registerCommand(ot,s=>{let u=s;return u.preventDefault(),u.stopImmediatePropagation(),t(),!0},E),n.registerCommand(it,s=>{let u=s;if(o===null||c===null)return!1;let g=o.flatMap(S=>S.items).find(S=>S.key===c);return g?(u.preventDefault(),u.stopImmediatePropagation(),O(g),!0):!1},E),n.registerCommand(nt,s=>{if(o===null||c===null)return!1;let _=o.flatMap(g=>g.items).find(g=>g.key===c);return _?(s!==null&&(s.preventDefault(),s.stopImmediatePropagation()),O(_),!0):!1},E)),[O,t,n,o,c,l]);let x=lt(()=>({groups:o,selectItemAndCleanUp:O,selectedItemKey:c,setSelectedItemKey:m}),[O,c,o]);return e(i,x,a.match?a.match.matchingString:"")}function q(i,t,n,o){let e=U(14),[r]=X(),a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=document.createElement("div"),e[0]=a):a=e[0];let f=ct(a),c;e[1]!==r||e[2]!==t||e[3]!==i||e[4]!==o?(c=()=>{let x=r.getRootElement(),s=f.current,u=s.firstChild;if(x!==null&&t!==null){let{height:_,width:g}=t.getRect(),{left:S,top:p}=t.getRect(),w=p;if(p=p-(i.getBoundingClientRect().top+window.scrollY),S=S-(i.getBoundingClientRect().left+window.scrollX),s.style.left=`${S+window.scrollX}px`,s.style.height=`${_}px`,s.style.width=`${g}px`,u!==null){let T=u.getBoundingClientRect(),I=T.height,y=T.width,M=x.getBoundingClientRect();S+y>M.right&&(s.style.left=`${M.right-y+window.scrollX}px`);let R=w+I+32>window.innerHeight,C=w<0;R&&!C?s.style.top=`${p+32-I+window.scrollY-(_+24)}px`:s.style.top=`${p+window.scrollY+32}px`}s.isConnected||(o!=null&&(s.className=o),s.setAttribute("aria-label","Slash menu"),s.setAttribute("id","slash-menu"),s.setAttribute("role","listbox"),s.style.display="block",s.style.position="absolute",i.append(s)),f.current=s,x.setAttribute("aria-controls","slash-menu")}},e[1]=r,e[2]=t,e[3]=i,e[4]=o,e[5]=c):c=e[5];let m=c,d,l;e[6]!==r||e[7]!==t||e[8]!==m?(d=()=>{let x=r.getRootElement();if(t!==null)return m(),()=>{x!==null&&x.removeAttribute("aria-controls");let s=f.current;s!==null&&s.isConnected&&s.remove()}},l=[r,m,t],e[6]=r,e[7]=t,e[8]=m,e[9]=d,e[10]=l):(d=e[9],l=e[10]),N(d,l);let h;e[11]!==t||e[12]!==n?(h=x=>{t!==null&&(x||n(null))},e[11]=t,e[12]=n,e[13]=h):h=e[13];let O=h;return dt(t,f.current,m,O),f}var Xt=`\\.,\\+\\*\\?\\$\\@\\|#{}\\(\\)\\^\\-\\[\\]\\\\/!%'"~=<>_:;`;function Rt(i){let t=i.anchor;if(t.type!=="text")return null;let n=t.getNode();if(!n.isSimpleText())return null;let o=t.offset;return n.getTextContent().slice(0,o)}function V(i,t,n){let o=n.getSelection();if(o===null||!o.isCollapsed)return!1;let e=o.anchorNode,r=i,a=o.anchorOffset;if(e==null||a==null)return!1;try{t.setStart(e,r),t.setEnd(e,a>1?a:1)}catch{return!1}return!0}function Ct(i){let t=null;return i.getEditorState().read(()=>{let n=P();B(n)&&(t=Rt(n))}),t}function z(i,t){return t!==0?!1:i.getEditorState().read(()=>{let n=P();if(B(n)){let r=n.anchor.getNode().getPreviousSibling();return St(r)&&r.isTextEntity()}return!1})}function Q(i){D.startTransition?D.startTransition(i):i()}var Tt=wt("ENABLE_SLASH_MENU_COMMAND");function Kt(i){let t=gt(31),{anchorClassName:n,anchorElem:o,groups:e,menuRenderFn:r,onClose:a,onOpen:f,onQueryChange:c,onSelectItem:m,triggerFn:d}=i,[l]=_t(),[h,O]=yt(null),x=q(o,h,O,n),s;t[0]!==a||t[1]!==h?(s=()=>{O(null),a!=null&&h!==null&&a()},t[0]=a,t[1]=h,t[2]=s):s=t[2];let u=s,_;t[3]!==f||t[4]!==h?(_=y=>{O(y),f!=null&&h===null&&f(y)},t[3]=f,t[4]=h,t[5]=_):_=t[5];let g=_,S,p;t[6]!==l||t[7]!==g?(S=()=>xt(l.registerCommand(Tt,y=>{let{node:M}=y;return l.getEditorState().read(()=>{let R={leadOffset:0,matchingString:"",replaceableString:""};if(!z(l,R.leadOffset)&&M!==null){let C=l._window??window,A=C.document.createRange();V(R.leadOffset,A,C)!==null&&Q(()=>g({getRect:()=>A.getBoundingClientRect(),match:R}));return}}),!0},Ot)),p=[l,g],t[6]=l,t[7]=g,t[8]=S,t[9]=p):(S=t[8],p=t[9]),F(S,p);let w;t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==c||t[14]!==g?(w=()=>{let y=()=>{l.getEditorState().read(()=>{let R=l._window??window,C=R.document.createRange(),A=P(),L=Ct(l);if(!B(A)||!A.isCollapsed()||L===null||C===null){u();return}let b=d({editor:l,query:L});if(c(b?b.matchingString:null),b!==null&&!z(l,b.leadOffset)&&V(b.leadOffset,C,R)!==null){Q(()=>g({getRect:()=>C.getBoundingClientRect(),match:b}));return}u()})},M=l.registerUpdateListener(y);return()=>{M()}},t[10]=l,t[11]=u,t[12]=d,t[13]=c,t[14]=g,t[15]=w):w=t[15];let T;t[16]!==l||t[17]!==d||t[18]!==c||t[19]!==h||t[20]!==u||t[21]!==g?(T=[l,d,c,h,u,g],t[16]=l,t[17]=d,t[18]=c,t[19]=h,t[20]=u,t[21]=g,t[22]=T):T=t[22],F(w,T);let I;return t[23]!==h||t[24]!==l||t[25]!==x||t[26]!==u||t[27]!==e||t[28]!==r||t[29]!==m?(I=h===null||l===null?null:pt(K,{anchorElementRef:x,close:u,editor:l,groups:e,menuRenderFn:r,onSelectItem:m,resolution:h,shouldSplitNodeWithQuery:!0}),t[23]=h,t[24]=l,t[25]=x,t[26]=u,t[27]=e,t[28]=r,t[29]=m,t[30]=I):I=t[30],I}function Ft(i){return i instanceof HTMLElement}var Y=class{_x;_y;constructor(t,n){this._x=t,this._y=n}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:n}){return this.x===t&&this.y===n}get x(){return this._x}get y(){return this._y}};function j(i){return i instanceof Y}var G=class i{_bottom;_left;_right;_top;constructor(t,n,o,e){let[r,a]=n<=e?[n,e]:[e,n],[f,c]=t<=o?[t,o]:[o,t];this._top=r,this._right=c,this._left=f,this._bottom=a}static fromDOM(t){let{height:n,left:o,top:e,width:r}=t.getBoundingClientRect();return i.fromLWTH(o,r,e,n)}static fromDOMRect(t){let{height:n,left:o,top:e,width:r}=t;return i.fromLWTH(o,r,e,n)}static fromLTRB(t,n,o,e){return new i(t,n,o,e)}static fromLWTH(t,n,o,e){return new i(t,o,t+n,o+e)}static fromPoints(t,n){let{x:o,y:e}=t,{x:r,y:a}=n;return i.fromLTRB(o,e,r,a)}contains(t){if(j(t)){let{x:a,y:f}=t,c=f<this._top,m=f>this._bottom,d=a<this._left,l=a>this._right;return{reason:{isOnBottomSide:m,isOnLeftSide:d,isOnRightSide:l,isOnTopSide:c},result:!c&&!m&&!d&&!l}}let{bottom:n,left:o,right:e,top:r}=t;return r>=this._top&&r<=this._bottom&&n>=this._top&&n<=this._bottom&&o>=this._left&&o<=this._right&&e>=this._left&&e<=this._right}distanceFromPoint(t){let n=this.contains(t);if(n.result)return{distance:0,isOnBottomSide:n.reason.isOnBottomSide,isOnLeftSide:n.reason.isOnLeftSide,isOnRightSide:n.reason.isOnRightSide,isOnTopSide:n.reason.isOnTopSide};let o=0,e=0;return t.x<this._left?o=this._left-t.x:t.x>this._right&&(o=t.x-this._right),t.y<this._top?e=this._top-t.y:t.y>this._bottom&&(e=t.y-this._bottom),{distance:Math.sqrt(o*o+e*e),isOnBottomSide:t.y>this._bottom,isOnLeftSide:t.x<this._left,isOnRightSide:t.x>this._right,isOnTopSide:t.y<this._top}}equals({bottom:t,left:n,right:o,top:e}){return e===this._top&&t===this._bottom&&n===this._left&&o===this._right}generateNewRect({bottom:t=this.bottom,left:n=this.left,right:o=this.right,top:e=this.top}){return new i(n,e,o,t)}intersectsWith(t){let{height:n,left:o,top:e,width:r}=t,{height:a,left:f,top:c,width:m}=this,d=o+r>=f+m?o+r:f+m,l=e+n>=c+a?e+n:c+a,h=o<=f?o:f,O=e<=c?e:c;return d-h<=r+m&&l-O<=n+a}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)}};export{Mt as a,Xt as b,Tt as c,Kt as d,Ft as e,Y as f,j as g,G as h};
2
+ //# sourceMappingURL=chunk-TO2W7Q2G.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lexical/nodes/index.ts", "../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.tsx", "../../../src/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.tsx", "../../../src/lexical/utils/guard.ts", "../../../src/lexical/utils/point.ts", "../../../src/lexical/utils/rect.ts"],
4
+ "sourcesContent": ["import type { Klass, LexicalNode, LexicalNodeReplacement } from 'lexical'\n\nimport type { SanitizedClientEditorConfig, SanitizedServerEditorConfig } from '../config/types.js'\n\nexport function getEnabledNodes({\n editorConfig,\n}: {\n editorConfig: SanitizedClientEditorConfig | SanitizedServerEditorConfig\n}): Array<Klass<LexicalNode> | LexicalNodeReplacement> {\n return editorConfig.features.nodes.map((node) => {\n if ('node' in node) {\n return node.node\n }\n return node\n })\n}\n", "'use client'\nimport type {\n LexicalCommand,\n LexicalEditor,\n ParagraphNode,\n RangeSelection,\n TextNode,\n} 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} 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, SlashMenuItem } 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 = editorWindow.getSelection()\n if (domSelection === null || !domSelection.isCollapsed) {\n return false\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): null | string {\n let text = null\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 onSelectItem: (\n item: SlashMenuItem,\n textNodeContainingQuery: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => 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 onSelectItem,\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 === null ||\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 resolution === null || editor === null ? null : (\n <LexicalMenu\n anchorElementRef={anchorElementRef}\n close={closeTypeahead}\n editor={editor}\n groups={groups}\n menuRenderFn={menuRenderFn}\n onSelectItem={onSelectItem}\n resolution={resolution}\n shouldSplitNodeWithQuery\n />\n )\n}\n\nexport type { MenuRenderFn, MenuResolution, MenuTextMatch, TriggerFn }\n", "'use client'\nimport type { 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 COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_ENTER_COMMAND,\n KEY_ESCAPE_COMMAND,\n KEY_TAB_COMMAND,\n createCommand,\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\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 selectItemAndCleanUp: (selectedItem: SlashMenuItem) => void\n selectedItemKey: null | string\n setSelectedItemKey: (itemKey: string) => void\n },\n matchingString: null | string,\n) => JSX.Element | ReactPortal | null\n\nconst scrollIntoViewIfNeeded = (target: HTMLElement) => {\n const typeaheadContainerNode = document.getElementById('slash-menu')\n if (!typeaheadContainerNode) return\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 | null {\n const selection = $getSelection()\n if (!$isRangeSelection(selection) || !selection.isCollapsed()) {\n return null\n }\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 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 null\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 targetElement: HTMLElement | null,\n onReposition: () => void,\n onVisibilityChange?: (isInView: boolean) => void,\n) {\n const [editor] = useLexicalComposerContext()\n useEffect(() => {\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.unobserve(targetElement)\n window.removeEventListener('resize', onReposition)\n document.removeEventListener('scroll', handleScroll, true)\n }\n }\n }, [targetElement, editor, onVisibilityChange, onReposition, resolution])\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 onSelectItem,\n resolution,\n shouldSplitNodeWithQuery = false,\n}: {\n anchorElementRef: RefObject<HTMLElement>\n close: () => void\n editor: LexicalEditor\n groups: Array<SlashMenuGroupInternal>\n menuRenderFn: MenuRenderFn\n onSelectItem: (\n item: SlashMenuItem,\n textNodeContainingQuery: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => void\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 editor.update(() => {\n const textNodeContainingQuery =\n resolution.match != null && shouldSplitNodeWithQuery\n ? $splitNodeContainingQuery(resolution.match)\n : null\n\n onSelectItem(\n selectedItem,\n textNodeContainingQuery,\n close,\n resolution.match ? resolution.match.matchingString : '',\n )\n })\n },\n [editor, shouldSplitNodeWithQuery, resolution.match, onSelectItem, 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\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_LOW,\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\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_LOW,\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_LOW,\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_LOW,\n ),\n )\n }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem])\n\n const listItemProps = useMemo(\n () => ({\n groups,\n selectItemAndCleanUp,\n selectedItemKey,\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\nexport function useMenuAnchorRef(\n anchorElem: HTMLElement,\n resolution: MenuResolution | null,\n setResolution: (r: MenuResolution | null) => void,\n className?: string,\n): RefObject<HTMLElement> {\n const [editor] = useLexicalComposerContext()\n const anchorElementRef = useRef<HTMLElement>(document.createElement('div'))\n const positionMenu = useCallback(() => {\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 if (left + menuWidth > rootElementRect.right) {\n containerDiv.style.left = `${rootElementRect.right - menuWidth + 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 if (className != null) {\n containerDiv.className = className\n }\n containerDiv.setAttribute('aria-label', 'Slash menu')\n containerDiv.setAttribute('id', 'slash-menu')\n containerDiv.setAttribute('role', 'listbox')\n containerDiv.style.display = 'block'\n containerDiv.style.position = 'absolute'\n anchorElem.append(containerDiv)\n }\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 }\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.current, positionMenu, onVisibilityChange)\n\n return anchorElementRef\n}\n", "'use client'\nexport function isHTMLElement(x: unknown): x is HTMLElement {\n return x instanceof HTMLElement\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 Point, isPoint } 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): ContainsPointReturn | boolean {\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"],
5
+ "mappings": "AAIO,SAASA,GAAgB,CAC9BC,aAAAA,CAAY,EAGb,CACC,OAAOA,EAAaC,SAASC,MAAMC,IAAKC,GAClC,SAAUA,EACLA,EAAKA,KAEPA,CACT,CACF,CCfA,OAAAC,KAAAC,OAAA,kEASA,OAASC,6BAAAA,OAAiC,2CAC1C,OAASC,iBAAAA,OAAqB,iBAC9B,OACEC,iBAAAA,EACAC,qBAAAA,EACAC,eAAAA,GACAC,wBAAAA,GACAC,iBAAAA,OACK,UACP,OAAgCC,aAAAA,EAAWC,YAAAA,OAAgB,QAC3D,UAAYC,MAAW,QCnBvB,OAAAC,KAAAC,MAAA,yBAIA,OAASC,6BAAAA,MAAiC,2CAC1C,OAASC,iBAAAA,MAAqB,iBAC9B,OACEC,iBAAAA,EACAC,qBAAAA,EACAC,wBAAAA,EACAC,0BAAAA,GACAC,wBAAAA,GACAC,qBAAAA,GACAC,sBAAAA,GACAC,mBAAAA,GACAC,iBAAAA,OACK,UACP,OAASC,eAAAA,EAAaC,aAAAA,EAAWC,mBAAAA,GAAiBC,WAAAA,GAAS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AAKR,OACd,CAEA,IAAIe,QAAiB,CACnB,OAAO2B,KAAKkB,IAAI,KAAK5D,QAAU,KAAKG,IAAI,CAC1C,CAEA,IAAIE,MAAe,CACjB,OAAO,KAAKJ,KACd,CAEA,IAAIM,OAAgB,CAClB,OAAO,KAAKL,MACd,CAEA,IAAII,KAAc,CAChB,OAAO,KAAKH,IACd,CAEA,IAAIa,OAAgB,CAClB,OAAO0B,KAAKkB,IAAI,KAAK3D,MAAQ,KAAKC,MAAM,CAC1C,CACF",
6
+ "names": ["getEnabledNodes", "editorConfig", "features", "nodes", "map", "node", "c", "_c", "useLexicalComposerContext", "mergeRegister", "$getSelection", "$isRangeSelection", "$isTextNode", "COMMAND_PRIORITY_LOW", "createCommand", "useEffect", "useState", "React", "c", "_c", "useLexicalComposerContext", "mergeRegister", "$getSelection", "$isRangeSelection", "COMMAND_PRIORITY_LOW", "KEY_ARROW_DOWN_COMMAND", "KEY_ARROW_UP_COMMAND", "KEY_ENTER_COMMAND", "KEY_ESCAPE_COMMAND", "KEY_TAB_COMMAND", "createCommand", "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", "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", "parent", "parentElement", "test", "overflow", "overflowY", "overflowX", "isTriggerVisibleInNearestScrollContainer", "targetElement", "containerElement", "tRect", "cRect", "bottom", "useDynamicPositioning", "resolution", "onReposition", "onVisibilityChange", "$", "editor", "t0", "t1", "rootElement", "getRootElement", "rootScrollParent", "ticking", "previousIsInView", "handleScroll", "requestAnimationFrame", "isInView", "resizeObserver", "ResizeObserver", "addEventListener", "capture", "passive", "observe", "unobserve", "removeEventListener", "SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND", "LexicalMenu", "anchorElementRef", "close", "groups", "menuRenderFn", "onSelectItem", "shouldSplitNodeWithQuery", "selectedItemKey", "setSelectedItemKey", "updateSelectedItem", "item", "rootElem", "setAttribute", "key", "setSelectedItemKeyToFirstMatchingItem", "allItems", "flatMap", "group", "items", "firstMatchingItem", "selectItemAndCleanUp", "selectedItem", "update", "textNodeContainingQuery", "removeAttribute", "registerCommand", "ref", "current", "payload", "event", "selectedIndex", "findIndex", "newSelectedIndex", "newSelectedItem", "dispatchCommand", "index", "preventDefault", "stopImmediatePropagation", "find", "listItemProps", "useMenuAnchorRef", "anchorElem", "setResolution", "className", "Symbol", "for", "createElement", "containerDiv", "menuEle", "firstChild", "width", "getRect", "left", "rawTop", "scrollY", "scrollX", "menuRect", "menuHeight", "menuWidth", "rootElementRect", "right", "wouldGoOffBottomOfScreen", "wouldGoOffTopOfScreen", "isConnected", "display", "append", "positionMenu", "t2", "t3", "rootElement_0", "containerDiv_0", "remove", "t4", "PUNCTUATION", "getTextUpToAnchor", "selection", "anchor", "type", "anchorNode", "getNode", "isSimpleText", "anchorOffset", "offset", "getTextContent", "slice", "tryToPositionRange", "leadOffset", "range", "editorWindow", "domSelection", "getSelection", "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", "t0", "$", "_c", "anchorClassName", "anchorElem", "groups", "menuRenderFn", "onClose", "onOpen", "onQueryChange", "onSelectItem", "triggerFn", "useLexicalComposerContext", "resolution", "setResolution", "useState", "anchorElementRef", "useMenuAnchorRef", "t1", "closeTypeahead", "t2", "res", "openTypeahead", "t3", "t4", "mergeRegister", "registerCommand", "t5", "node", "match", "matchingString", "replaceableString", "_window", "window", "document", "createRange", "getRect", "getBoundingClientRect", "COMMAND_PRIORITY_LOW", "useEffect", "updateListener", "editorWindow_0", "range_0", "match_0", "query", "removeUpdateListener", "registerUpdateListener", "t6", "t7", "_jsx", "LexicalMenu", "close", "shouldSplitNodeWithQuery", "isHTMLElement", "x", "HTMLElement", "Point", "_x", "_y", "constructor", "x", "y", "calcDeltaXTo", "calcDeltaYTo", "calcDistanceTo", "point", "Math", "sqrt", "pow", "calcHorizontalDistanceTo", "abs", "calcVerticalDistance", "equals", "isPoint", "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"]
7
+ }
@@ -0,0 +1,3 @@
1
+ import{jsx as m}from"react/jsx-runtime";import{$applyNodeReplacement as d}from"lexical";import*as a from"react";import{addClassNamesToElement as u}from"@lexical/utils";import{$applyNodeReplacement as l,DecoratorNode as c,createCommand as s}from"lexical";var O=s("INSERT_HORIZONTAL_RULE_COMMAND"),r=class extends c{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:p,priority:0})}}static importJSON(e){return i()}createDOM(e){let o=document.createElement("hr");return u(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
2
+ `}isInline(){return!1}updateDOM(){return!1}};function p(){return{node:i()}}function i(){return l(new r)}var N=a.lazy(()=>import("./component-LLWMZU6K.js").then(t=>({default:t.HorizontalRuleComponent}))),n=class extends r{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return f()}decorate(){return m(N,{nodeKey:this.__key})}exportJSON(){return super.exportJSON()}};function f(){return d(new n)}function E(t){return t instanceof n}export{O as a,n as b,f as c,E as d};
3
+ //# sourceMappingURL=chunk-V2LKLT2F.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/horizontalRule/client/nodes/HorizontalRuleNode.tsx", "../../../src/features/horizontalRule/server/nodes/HorizontalRuleNode.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { DOMConversionOutput, LexicalNode, SerializedLexicalNode } from 'lexical'\n\nimport { $applyNodeReplacement } from 'lexical'\nimport * as React from 'react'\n\nimport type { SerializedHorizontalRuleNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nimport { HorizontalRuleServerNode } from '../../server/nodes/HorizontalRuleNode.js'\n\nconst HorizontalRuleComponent = React.lazy(() =>\n import('../../client/component/index.js').then((module) => ({\n default: module.HorizontalRuleComponent,\n })),\n)\n\nexport class HorizontalRuleNode extends HorizontalRuleServerNode {\n static clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return super.clone(node)\n }\n\n static getType(): string {\n return super.getType()\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleNode {\n return $createHorizontalRuleNode()\n }\n\n /**\n * Allows you to render a React component within whatever createDOM returns.\n */\n decorate(): React.ReactElement {\n return <HorizontalRuleComponent nodeKey={this.__key} />\n }\n\n exportJSON(): SerializedLexicalNode {\n return super.exportJSON()\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleNode() }\n}\n\nexport function $createHorizontalRuleNode(): HorizontalRuleNode {\n return $applyNodeReplacement(new HorizontalRuleNode())\n}\n\nexport function $isHorizontalRuleNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleNode {\n return node instanceof HorizontalRuleNode\n}\n", "import type {\n DOMConversionMap,\n DOMConversionOutput,\n DOMExportOutput,\n EditorConfig,\n LexicalCommand,\n LexicalNode,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type * as React from 'react'\n\nimport { addClassNamesToElement } from '@lexical/utils'\nimport { $applyNodeReplacement, DecoratorNode, createCommand } from 'lexical'\n\n/**\n * Serialized representation of a horizontal rule node. Serialized = converted to JSON. This is what is stored in the database / in the lexical editor state.\n */\nexport type SerializedHorizontalRuleNode = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n type: 'horizontalrule'\n },\n SerializedLexicalNode\n>\n\nexport const INSERT_HORIZONTAL_RULE_COMMAND: LexicalCommand<void> = createCommand(\n 'INSERT_HORIZONTAL_RULE_COMMAND',\n)\n\n/**\n * This node is a DecoratorNode. DecoratorNodes allow you to render React components in the editor.\n *\n * They need both createDom and decorate functions. createDom => outside of the html. decorate => React Component inside of the html.\n *\n * If we used DecoratorBlockNode instead, we would only need a decorate method\n */\nexport class HorizontalRuleServerNode extends DecoratorNode<React.ReactElement> {\n static clone(node: HorizontalRuleServerNode): HorizontalRuleServerNode {\n return new this(node.__key)\n }\n\n static getType(): string {\n return 'horizontalrule'\n }\n\n /**\n * Defines what happens if you copy an hr element from another page and paste it into the lexical editor\n *\n * This also determines the behavior of lexical's internal HTML -> Lexical converter\n */\n static importDOM(): DOMConversionMap | null {\n return {\n hr: () => ({\n conversion: $convertHorizontalRuleElement,\n priority: 0,\n }),\n }\n }\n\n /**\n * The data for this node is stored serialized as JSON. This is the \"load function\" of that node: it takes the saved data and converts it into a node.\n */\n static importJSON(serializedNode: SerializedHorizontalRuleNode): HorizontalRuleServerNode {\n return $createHorizontalRuleServerNode()\n }\n\n /**\n * Determines how the hr element is rendered in the lexical editor. This is only the \"initial\" / \"outer\" HTML element.\n */\n createDOM(config: EditorConfig): HTMLElement {\n const element = document.createElement('hr')\n addClassNamesToElement(element, config.theme.hr)\n return element\n }\n\n decorate() {\n return null\n }\n\n /**\n * Opposite of importDOM, this function defines what happens when you copy an hr element from the lexical editor and paste it into another page.\n *\n * This also determines the behavior of lexical's internal Lexical -> HTML converter\n */\n exportDOM(): DOMExportOutput {\n return { element: document.createElement('hr') }\n }\n /**\n * Opposite of importJSON. This determines what data is saved in the database / in the lexical editor state.\n */\n exportJSON(): SerializedLexicalNode {\n return {\n type: 'horizontalrule',\n version: 1,\n }\n }\n\n getTextContent(): string {\n return '\\n'\n }\n\n isInline(): false {\n return false\n }\n\n updateDOM(): boolean {\n return false\n }\n}\n\nfunction $convertHorizontalRuleElement(): DOMConversionOutput {\n return { node: $createHorizontalRuleServerNode() }\n}\n\nexport function $createHorizontalRuleServerNode(): HorizontalRuleServerNode {\n return $applyNodeReplacement(new HorizontalRuleServerNode())\n}\n\nexport function $isHorizontalRuleServerNode(\n node: LexicalNode | null | undefined,\n): node is HorizontalRuleServerNode {\n return node instanceof HorizontalRuleServerNode\n}\n"],
5
+ "mappings": "wCAGA,OAASA,yBAAAA,MAA6B,UACtC,UAAYC,MAAW,QCQvB,OAASC,0BAAAA,MAA8B,iBACvC,OAASC,yBAAAA,EAAuBC,iBAAAA,EAAeC,iBAAAA,MAAqB,UAa7D,IAAMC,EAAuDD,EAClE,gCAAA,EAUWE,EAAN,cAAuCH,CAAA,CAC5C,OAAOI,MAAMC,EAA0D,CACrE,OAAO,IAAI,KAAKA,EAAKC,KAAK,CAC5B,CAEA,OAAOC,SAAkB,CACvB,MAAO,gBACT,CAOA,OAAOC,WAAqC,CAC1C,MAAO,CACLC,GAAIA,KAAO,CACTC,WAAYC,EACZC,SAAU,CACZ,EACF,CACF,CAKA,OAAOC,WAAWC,EAAwE,CACxF,OAAOC,EAAA,CACT,CAKAC,UAAUC,EAAmC,CAC3C,IAAMC,EAAUC,SAASC,cAAc,IAAA,EACvCtB,OAAAA,EAAuBoB,EAASD,EAAOI,MAAMZ,EAAE,EACxCS,CACT,CAEAI,UAAW,CACT,OAAO,IACT,CAOAC,WAA6B,CAC3B,MAAO,CAAEL,QAASC,SAASC,cAAc,IAAA,CAAM,CACjD,CAIAI,YAAoC,CAClC,MAAO,CACLC,KAAM,iBACNC,QAAS,CACX,CACF,CAEAC,gBAAyB,CACvB,MAAO;CACT,CAEAC,UAAkB,CAChB,MAAO,EACT,CAEAC,WAAqB,CACnB,MAAO,EACT,CACF,EAEA,SAASlB,GAAA,CACP,MAAO,CAAEN,KAAMU,EAAA,CAAkC,CACnD,CAEO,SAASA,GAAA,CACd,OAAOhB,EAAsB,IAAII,CAAA,CACnC,CD3GA,IAAM2B,EAAgCC,OAAK,IACzC,OAAO,yBAAA,EAAmCC,KAAMC,IAAY,CAC1DC,QAASD,EAAOH,uBAClB,EAAA,CAAA,EAGWK,EAAN,cAAiCC,CAAA,CACtC,OAAOC,MAAMC,EAA0D,CACrE,OAAO,MAAMD,MAAMC,CAAA,CACrB,CAEA,OAAOC,SAAkB,CACvB,OAAO,MAAMA,QAAA,CACf,CAKA,OAAOC,WAAWC,EAAkE,CAClF,OAAOC,EAAA,CACT,CAKAC,UAA+B,CAC7B,OAAOC,EAACd,EAAA,CAAwBe,QAAS,KAAKC,OAChD,CAEAC,YAAoC,CAClC,OAAO,MAAMA,WAAA,CACf,CACF,EAMO,SAASC,GAAA,CACd,OAAOC,EAAsB,IAAIC,CAAA,CACnC,CAEO,SAASC,EACdC,EAAoC,CAEpC,OAAOA,aAAgBF,CACzB",
6
+ "names": ["$applyNodeReplacement", "React", "addClassNamesToElement", "$applyNodeReplacement", "DecoratorNode", "createCommand", "INSERT_HORIZONTAL_RULE_COMMAND", "HorizontalRuleServerNode", "clone", "node", "__key", "getType", "importDOM", "hr", "conversion", "$convertHorizontalRuleElement", "priority", "importJSON", "serializedNode", "$createHorizontalRuleServerNode", "createDOM", "config", "element", "document", "createElement", "theme", "decorate", "exportDOM", "exportJSON", "type", "version", "getTextContent", "isInline", "updateDOM", "HorizontalRuleComponent", "lazy", "then", "module", "default", "HorizontalRuleNode", "HorizontalRuleServerNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createHorizontalRuleNode", "decorate", "_jsx", "nodeKey", "__key", "exportJSON", "$createHorizontalRuleNode", "$applyNodeReplacement", "HorizontalRuleNode", "$isHorizontalRuleNode", "node"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a as P,b as T,c as U,f as I}from"./chunk-G5DTIOPI.js";import{b as N}from"./chunk-NI6Z4GBD.js";import{jsx as t,jsxs as s}from"react/jsx-runtime";import{useLexicalComposerContext as te}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as oe}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as le}from"@lexical/utils";import{getTranslation as K}from"@payloadcms/translations";import{Button as w,DrawerToggler as ae,File as re,formatDrawerSlug as ie,useConfig as se,useDocumentDrawer as ne,useEditDepth as de,useModal as ce,usePayloadAPI as ue,useTranslation as me}from"@payloadcms/ui";import{$getNodeByKey as S,$getSelection as pe,$isNodeSelection as fe,CLICK_COMMAND as ge,COMMAND_PRIORITY_LOW as v,KEY_BACKSPACE_COMMAND as _e,KEY_DELETE_COMMAND as he}from"lexical";import{useCallback as n,useEffect as Ce,useId as De,useReducer as be,useRef as Ne,useState as we}from"react";var o="lexical-upload",B={depth:0},Se=d=>{let{data:{fields:F,relationTo:$,value:c},nodeKey:a}=d,{config:{collections:j,routes:{api:k},serverURL:W}}=se(),_=Ne(null),{closeModal:R}=ce(),{uuid:Y}=N(),z=de(),[l]=te(),[r,u,h]=oe(a),{editorConfig:H,field:C}=N(),{i18n:x,t:m}=me(),[E,q]=be(e=>e+1,0),[i]=we(()=>j.find(e=>e.slug===$)),G=De(),p=ie({slug:"lexical-upload-drawer-"+Y+G,depth:z}),[J,Q,{closeDrawer:M}]=ne({id:c,collectionSlug:i.slug}),[{data:f},{setParams:y}]=ue(`${W}${k}/${i.slug}/${c}`,{initialParams:B}),O=f?.thumbnailURL||f?.url,V=n(()=>{l.update(()=>{S(a).remove()})},[l,a]),X=n(e=>{y({...B,cacheBust:E}),q(),M()},[y,E,M]),D=n(e=>{if(r&&fe(pe())){e.preventDefault();let g=S(a);if(I(g))return g.remove(),!0}return!1},[r,a]),A=n(e=>e.target===_.current||_.current?.contains(e.target)?(e.shiftKey?u(!r):r||(h(),u(!0)),!0):!1,[r,u,h]);Ce(()=>le(l.registerCommand(ge,A,v),l.registerCommand(he,D,v),l.registerCommand(_e,D,v)),[h,l,r,a,D,u,A]);let L=H?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[i.slug]?.hasExtraFields,Z=n((e,g)=>{l.update(()=>{let b=S(a);if(b){let ee={...b.getData(),fields:g};b.setData(ee)}}),R(p)},[R,l,p,a]);return s("div",{className:[o,r&&`${o}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:_,children:[s("div",{className:`${o}__card`,children:[s("div",{className:`${o}__topRow`,children:[t("div",{className:`${o}__thumbnail`,children:O?t("img",{alt:f?.filename,"data-lexical-upload-id":c,"data-lexical-upload-relation-to":$,src:O}):t(re,{})}),s("div",{className:`${o}__topRowRightPanel`,children:[t("div",{className:`${o}__collectionLabel`,children:K(i.labels.singular,x)}),l.isEditable()&&s("div",{className:`${o}__actions`,children:[L?t(ae,{className:`${o}__upload-drawer-toggler`,disabled:C?.admin?.readOnly,slug:p,children:t(w,{buttonStyle:"icon-label",el:"div",icon:"edit",onClick:e=>{e.preventDefault()},round:!0,tooltip:m("fields:editRelationship")})}):null,t(w,{buttonStyle:"icon-label",disabled:C?.admin?.readOnly,el:"div",icon:"swap",onClick:()=>{l.dispatchCommand(U,{replace:{nodeKey:a}})},round:!0,tooltip:m("fields:swapUpload")}),t(w,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:C?.admin?.readOnly,icon:"x",onClick:e=>{e.preventDefault(),V()},round:!0,tooltip:m("fields:removeUpload")})]})]})]}),t("div",{className:`${o}__bottomRow`,children:t(Q,{className:`${o}__doc-drawer-toggler`,children:t("strong",{children:f?.filename})})})]}),c&&t(J,{onSave:X}),L?t(P,{data:F,drawerSlug:p,drawerTitle:m("general:editLabel",{label:K(i.labels.singular,x)}),featureKey:"upload",handleDrawerSubmit:Z,schemaPathSuffix:i.slug}):null]})},Ke=d=>t(T,{...d,uploads:!0,children:t(Se,{...d})});export{Ke as UploadComponent};
2
+ //# sourceMappingURL=component-3OFD6Q4Z.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 } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalNodeSelection } from '@lexical/react/useLexicalNodeSelection.js'\nimport { mergeRegister } from '@lexical/utils'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n DrawerToggler,\n File,\n formatDrawerSlug,\n useConfig,\n useDocumentDrawer,\n useEditDepth,\n useModal,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport {\n $getNodeByKey,\n $getSelection,\n $isNodeSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n} from 'lexical'\nimport React, { useCallback, useEffect, useId, useReducer, useRef, useState } from 'react'\n\nimport type { ClientComponentProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../feature.client.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 { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport { $isUploadNode } from '../nodes/UploadNode.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n nodeKey: string\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n const {\n config: {\n collections,\n routes: { api },\n serverURL,\n },\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { closeModal } = useModal()\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n\n const { editorConfig, field } = useEditorConfigContext()\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const componentID = useId()\n\n const drawerSlug = 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 const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\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 closeDrawer()\n },\n [setParams, cacheBust, closeDrawer],\n )\n\n const $onDelete = useCallback(\n (event: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isUploadNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n const onClick = useCallback(\n (event: MouseEvent) => {\n // Check if uploadRef.target or anything WITHIN uploadRef.target was clicked\n if (event.target === uploadRef.current || uploadRef.current?.contains(event.target as Node)) {\n if (event.shiftKey) {\n setSelected(!isSelected)\n } else {\n if (!isSelected) {\n clearSelection()\n setSelected(true)\n }\n }\n return true\n }\n\n return false\n },\n [isSelected, setSelected, clearSelection],\n )\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand<MouseEvent>(CLICK_COMMAND, onClick, COMMAND_PRIORITY_LOW),\n\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n )\n }, [clearSelection, editor, isSelected, nodeKey, $onDelete, setSelected, onClick])\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as ClientComponentProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_, data) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: UploadNode | null = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n\n closeModal(drawerSlug)\n },\n [closeModal, editor, drawerSlug, nodeKey],\n )\n\n return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n {/* TODO: migrate to use @payloadcms/ui/elements/Thumbnail component */}\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC ? (\n <img\n alt={data?.filename}\n data-lexical-upload-id={value}\n data-lexical-upload-relation-to={relationTo}\n src={thumbnailSRC}\n />\n ) : (\n <File />\n )}\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <DrawerToggler\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={field?.admin?.readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n el=\"div\"\n icon=\"edit\"\n onClick={(e) => {\n e.preventDefault()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n </DrawerToggler>\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n disabled={field?.admin?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={field?.admin?.readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\n {value && <DocumentDrawer onSave={updateUpload} />}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={drawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],
5
+ "mappings": "oKAGA,OAASA,6BAAAA,OAAiC,2CAC1C,OAASC,2BAAAA,OAA+B,4CACxC,OAASC,iBAAAA,OAAqB,iBAC9B,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,iBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,aAAAA,GACAC,qBAAAA,GACAC,gBAAAA,GACAC,YAAAA,GACAC,iBAAAA,GACAC,kBAAAA,OACK,iBACP,OACEC,iBAAAA,EACAC,iBAAAA,GACAC,oBAAAA,GACAC,iBAAAA,GACAC,wBAAAA,EACAC,yBAAAA,GACAC,sBAAAA,OACK,UACP,OAAgBC,eAAAA,EAAaC,aAAAA,GAAWC,SAAAA,GAAOC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,OAAgB,QAcnF,IAAMC,EAAY,iBAEZC,EAAgB,CACpBC,MAAO,CACT,EAOMC,GAAqCC,GAAA,CACzC,GAAM,CACJC,KAAM,CAAEC,OAAAA,EAAQC,WAAAA,EAAYC,MAAAA,CAAK,EACjCC,QAAAA,CAAO,EACLL,EAEE,CACJM,OAAQ,CACNC,YAAAA,EACAC,OAAQ,CAAEC,IAAAA,CAAG,EACbC,UAAAA,CAAS,CACV,EACCC,GAAA,EACEC,EAAYC,GAA8B,IAAA,EAC1C,CAAEC,WAAAA,CAAU,EAAKC,GAAA,EACjB,CAAEC,KAAAA,CAAI,EAAKC,EAAA,EACXC,EAAYC,GAAA,EACZ,CAACC,CAAA,EAAUC,GAAA,EACX,CAACC,EAAYC,EAAaC,CAAA,EAAkBC,GAAwBpB,CAAA,EAEpE,CAAEqB,aAAAA,EAAcC,MAAA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AMC,EACNwC,WAAYA,EACZgF,YAAa7F,EAAE,oBAAqB,CAClC8F,MAAOrB,EAAenE,EAAkBoE,OAAOC,SAAU5E,CAAA,CAC3D,CAAA,EACAgG,WAAW,SACXC,mBAAoBzC,EACpB0C,iBAAkB3F,EAAkBI,OAEpC,IAAA,GAGV,EAEawF,GAAmB/H,GAE5BiG,EAAC+B,EAAA,CAA+B,GAAGhI,EAAOiI,QAAO,YAC/ChC,EAAClG,GAAA,CAAW,GAAGC",
6
+ "names": ["useLexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "DrawerToggler", "File", "formatDrawerSlug", "useConfig", "useDocumentDrawer", "useEditDepth", "useModal", "usePayloadAPI", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "useCallback", "useEffect", "useId", "useReducer", "useRef", "useState", "baseClass", "initialParams", "depth", "Component", "props", "data", "fields", "relationTo", "value", "nodeKey", "config", "collections", "routes", "api", "serverURL", "useConfig", "uploadRef", "useRef", "closeModal", "useModal", "uuid", "useEditorConfigContext", "editDepth", "useEditDepth", "editor", "useLexicalComposerContext", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "editorConfig", "field", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "relatedCollection", "useState", "find", "coll", "slug", "componentID", "useId", "drawerSlug", "formatDrawerSlug", "DocumentDrawer", "DocumentDrawerToggler", "closeDrawer", "useDocumentDrawer", "id", "collectionSlug", "setParams", "usePayloadAPI", "thumbnailSRC", "thumbnailURL", "url", "removeUpload", "useCallback", "update", "$getNodeByKey", "remove", "updateUpload", "$onDelete", "event", "$isNodeSelection", "$getSelection", "preventDefault", "node", "$isUploadNode", "onClick", "target", "current", "contains", "shiftKey", "useEffect", "mergeRegister", "registerCommand", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_DELETE_COMMAND", "KEY_BACKSPACE_COMMAND", "hasExtraFields", "resolvedFeatureMap", "get", "sanitizedClientFeatureProps", "onExtraFieldsDrawerSubmit", "_", "uploadNode", "newData", "getData", "setData", "_jsxs", "className", "filter", "Boolean", "join", "contentEditable", "ref", "_jsx", "alt", "filename", "src", "File", "getTranslation", "labels", "singular", "isEditable", "DrawerToggler", "disabled", "admin", "readOnly", "Button", "buttonStyle", "el", "icon", "e", "round", "tooltip", "dispatchCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "replace", "onSave", "FieldsDrawer", "drawerTitle", "label", "featureKey", "handleDrawerSubmit", "schemaPathSuffix", "UploadComponent", "EnabledRelationshipsCondition", "uploads"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{b as T}from"./chunk-NI6Z4GBD.js";import{jsx as f,jsxs as le}from"react/jsx-runtime";import{Collapsible as se,Form as ie,Pill as ne,RenderComponent as ae,SectionTitle as re,ShimmerEffect as ce,useConfig as de,useDocumentInfo as me,useFieldProps as ue,useFormSubmitted as fe,useTranslation as pe}from"@payloadcms/ui";import{useCallback as be,useEffect as he,useMemo as ke,useState as ye}from"react";import{getTranslation as _e}from"@payloadcms/translations";import{getFormState as I}from"@payloadcms/ui/shared";import{v4 as Ce}from"uuid";import{jsx as k,jsxs as B}from"react/jsx-runtime";import{useLexicalComposerContext as q}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as H}from"@payloadcms/translations";import{Button as W,Collapsible as z,ErrorPill as G,Pill as J,RenderComponent as Q,RenderFields as X,SectionTitle as Y,useDocumentInfo as Z,useFormSubmitted as ee,useTranslation as oe}from"@payloadcms/ui";import{dequal as te}from"dequal/lite";import{$getNodeByKey as O}from"lexical";import A,{useCallback as E}from"react";import{c as K}from"react/compiler-runtime";import{useAllFormFields as V}from"@payloadcms/ui";import{reduceFieldsToValues as D}from"payload/shared";import{useEffect as M}from"react";function w({fields:i}){for(let e in i){let o=i[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return i}var j=i=>{let e=K(8),{onChange:o}=i,[l]=V(),d,s;e[0]!==l?(s=w({fields:l}),d=D(s,!0),e[0]=l,e[1]=d,e[2]=s):(d=e[1],s=e[2]);let m=d,t,a;return e[3]!==o||e[4]!==s||e[5]!==m?(t=()=>{o&&o({fullFieldsWithValues:s,newFormData:m})},a=[m,o,s],e[3]=o,e[4]=s,e[5]=m,e[6]=t,e[7]=a):(t=e[6],a=e[7]),M(t,a),null};function L(i){for(let e in i){let o=i[e];Array.isArray(o)&&!o?.length?delete i[e]:o&&typeof o=="object"?L(o):o==null&&delete i[e]}}var U=i=>{let{baseClass:e,clientBlock:o,field:l,formSchema:d,nodeKey:s,schemaPath:m}=i,{formData:t}=i,{i18n:a}=oe(),[u]=q(),{getDocPreferences:x,setDocFieldPreferences:P}=Z(),[p,N]=A.useState(()=>{let r=!1;return x().then(c=>{let h=c?.fields[l.name]?.collapsed;h&&h.includes(t.id)&&(r=!0,N(!0))}),r}),F=ee(),[n,S]=A.useState(0),C=F&&n>0,$=[`${e}__row`,C?`${e}__row--has-errors`:`${e}__row--no-errors`].filter(Boolean).join(" "),R=E(({fullFieldsWithValues:r,newFormData:c})=>{if(c.id=t.id,c.blockType=t.blockType,L(c),L(t),te(t,c)||setTimeout(()=>{u.update(()=>{let _=O(s);_&&(t=c,_.setFields(c))})},0),F){let _=0;for(let h of Object.values(r))h?.valid===!1&&_++;S(_)}},[u,s,F,t]),v=E(r=>{x().then(c=>{let h=c?.fields[l.name]?.collapsed,g=h&&h?.length?h:[];r?g.includes(t.id)||g.push(t.id):g.includes(t.id)&&g.splice(g.indexOf(t.id),1),P(l.name,{collapsed:g,hello:"hi"})})},[x,l.name,P,t.id]),b=E(()=>{u.update(()=>{O(s).remove()})},[u,s]);return B(A.Fragment,{children:[k(z,{className:$,collapsibleStyle:C?"error":"default",header:o?.admin?.components?.Label?k(Q,{clientProps:{blockKind:"lexicalBlock",formData:t},mappedComponent:o.admin.components.Label}):B("div",{className:`${e}__block-header`,children:[B("div",{children:[k(J,{className:`${e}__block-pill ${e}__block-pill-${t?.blockType}`,pillStyle:"white",children:typeof o?.labels.singular=="string"?H(o?.labels.singular,a):o.slug}),k(Y,{path:"blockName",readOnly:l?.admin?.readOnly}),C&&k(G,{count:n,i18n:a,withMessage:!0})]}),u.isEditable()&&k(W,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:l?.admin?.readOnly,icon:"x",onClick:r=>{r.preventDefault(),b()},round:!0,tooltip:"Remove Block"})]}),isCollapsed:p,onToggle:r=>{v(r),N(r)},children:k(X,{className:`${e}__fields`,fields:d,forceRender:!0,margins:"small",path:"",readOnly:!1,schemaPath:m})},0),k(j,{onChange:R})]})};var y="lexical-block",We=i=>{let{formData:e,nodeKey:o}=i,{config:l}=de(),d=fe(),{id:s}=me(),{path:m,schemaPath:t}=ue(),{field:a}=T(),[u,x]=ye(!1),{field:{richTextComponentMap:P}}=T(),p=`${t}.lexical_internal_feature.blocks.lexical_blocks.lexical_blocks.${e.blockType}`,n=P.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(v=>v.slug===e.blockType);he(()=>{e&&(async()=>{let b=await I({apiRoute:l.routes.api,body:{id:s,data:e,operation:"update",schemaPath:p},serverURL:l.serverURL});b&&(b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},x(b))})()},[l.routes.api,l.serverURL,p,s]);let S=be(async({formState:v})=>{let b=await I({apiRoute:l.routes.api,body:{id:s,formState:v,operation:"update",schemaPath:p},serverURL:l.serverURL});return b.blockName={initialValue:"",passesCondition:!0,valid:!0,value:e.blockName},b},[l.routes.api,l.serverURL,s,p,e.blockName]),{i18n:C}=pe(),$=[`${y}__row`,`${y}__row--no-errors`].filter(Boolean).join(" "),R=ke(()=>n&&u!==!1?f(ie,{beforeSubmit:[S],fields:n.fields,initialState:u,onChange:[S],submitted:d,uuid:Ce(),children:f(U,{baseClass:y,clientBlock:n,field:a,formData:e,formSchema:n.fields,nodeKey:o,path:`${m}.lexical_internal_feature.blocks.${e.blockType}`,schemaPath:p})}):f(se,{className:$,collapsibleStyle:"default",header:n?.admin?.components?.Label?f(ae,{clientProps:{blockKind:"lexicalBlock",formData:e},mappedComponent:n.admin.components.Label}):f("div",{className:`${y}__block-header`,children:le("div",{children:[f(ne,{className:`${y}__block-pill ${y}__block-pill-${e?.blockType}`,pillStyle:"white",children:n&&typeof n.labels.singular=="string"?_e(n.labels.singular,C):n.slug}),f(re,{path:"blockName",readOnly:a?.admin?.readOnly})]})}),children:f(ce,{height:"35vh"})},0),[n,u,S,d,a,o,m,p,$,C]);return f("div",{className:y+" "+y+"-"+e.blockType,children:R})};export{We as BlockComponent};
2
+ //# sourceMappingURL=component-LCAAX56T.js.map