@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,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/field/Field.tsx", "../../../src/lexical/LexicalProvider.tsx", "../../../src/lexical/LexicalEditor.tsx", "../../../src/lexical/EditorPlugin.tsx", "../../../src/lexical/plugins/MarkdownShortcut/index.tsx", "../../../src/lexical/plugins/SlashMenu/index.tsx", "../../../src/lexical/plugins/SlashMenu/useMenuTriggerMatch.ts", "../../../src/lexical/plugins/handles/AddBlockHandlePlugin/index.tsx", "../../../src/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.ts", "../../../src/lexical/plugins/handles/utils/getNodeCloseToPoint.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.ts", "../../../src/lexical/plugins/handles/utils/getCollapsedMargins.ts", "../../../src/lexical/plugins/handles/utils/getTopLevelNodeKeys.ts", "../../../src/lexical/plugins/handles/utils/isOnHandleElement.ts", "../../../src/lexical/plugins/handles/utils/doesLineHeightAffectElement.ts", "../../../src/lexical/plugins/handles/utils/setHandlePosition.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/index.tsx", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/highlightElemOriginalPosition.ts", "../../../src/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.ts", "../../../src/lexical/ui/ContentEditable.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { SerializedEditorState } from 'lexical'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n useField,\n useFieldProps,\n withCondition,\n} from '@payloadcms/ui'\nimport React, { useCallback } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport './bundled.css'\nimport './index.scss'\nimport '../lexical/theme/EditorTheme.scss'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n descriptionProps,\n editorConfig,\n errorProps,\n field: {\n name,\n _path: pathFromProps,\n admin: {\n className,\n components: { Description, Error, Label },\n readOnly: readOnlyFromAdmin,\n style,\n width,\n } = {},\n label,\n required,\n },\n field,\n labelProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const memoizedValidate = useCallback(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n return validate(value, { ...validationOptions, props, required })\n }\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n const { path: pathFromContext, readOnly: readOnlyFromContext } = useFieldProps()\n\n const fieldType = useField<SerializedEditorState>({\n path: pathFromContext ?? pathFromProps ?? name,\n validate: memoizedValidate,\n })\n\n const { formInitializing, formProcessing, initialValue, path, setValue, showError, value } =\n fieldType\n\n const disabled = readOnlyFromProps || readOnlyFromContext || formProcessing || formInitializing\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true ? `${baseClass}--show-gutter` : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n return (\n <div\n className={classes}\n key={path}\n style={{\n ...style,\n width,\n }}\n >\n <FieldError CustomError={Error} path={path} {...(errorProps || {})} alignCaret=\"left\" />\n <FieldLabel Label={Label} label={label} required={required} {...(labelProps || {})} />\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n <LexicalProvider\n editorConfig={editorConfig}\n field={field}\n key={JSON.stringify({ initialValue, path })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={(editorState) => {\n let serializedEditorState = editorState.toJSON()\n\n // Transform state through save hooks\n if (editorConfig?.features?.hooks?.save?.length) {\n editorConfig.features.hooks.save.forEach((hook) => {\n serializedEditorState = hook({ incomingEditorState: serializedEditorState })\n })\n }\n\n setValue(serializedEditorState)\n }}\n path={path}\n readOnly={disabled}\n value={value}\n />\n </ErrorBoundary>\n <FieldDescription Description={Description} {...(descriptionProps || {})} />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }): React.ReactElement {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = withCondition(RichTextComponent)\n", "'use client'\nimport type { InitialConfigType } from '@lexical/react/LexicalComposer.js'\nimport type { EditorState, LexicalEditor, SerializedEditorState } from 'lexical'\n\nimport { LexicalComposer } from '@lexical/react/LexicalComposer.js'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\nimport type { SanitizedClientEditorConfig } from './config/types.js'\n\nimport { LexicalEditor as LexicalEditorComponent } from './LexicalEditor.js'\nimport {\n EditorConfigProvider,\n useEditorConfigContext,\n} from './config/client/EditorConfigProvider.js'\nimport { getEnabledNodes } from './nodes/index.js'\n\nexport type LexicalProviderProps = {\n editorConfig: SanitizedClientEditorConfig\n field: LexicalRichTextFieldProps['field']\n onChange: (editorState: EditorState, editor: LexicalEditor, tags: Set<string>) => void\n path: string\n readOnly: boolean\n value: SerializedEditorState\n}\n\nconst NestProviders = ({ children, providers }) => {\n if (!providers?.length) {\n return children\n }\n const Component = providers[0]\n if (providers.length > 1) {\n return (\n <Component>\n <NestProviders providers={providers.slice(1)}>{children}</NestProviders>\n </Component>\n )\n }\n return <Component>{children}</Component>\n}\n\nexport const LexicalProvider: React.FC<LexicalProviderProps> = (props) => {\n const { editorConfig, field, onChange, path, readOnly, value } = props\n\n const parentContext = useEditorConfigContext()\n\n const editorContainerRef = React.useRef<HTMLDivElement>(null)\n\n const processedValue = useMemo(() => {\n let processed = value\n if (editorConfig?.features?.hooks?.load?.length) {\n editorConfig.features.hooks.load.forEach((hook) => {\n processed = hook({ incomingEditorState: processed })\n })\n }\n return processed\n }, [editorConfig, value])\n\n // useMemo for the initialConfig that depends on readOnly and processedValue\n const initialConfig = useMemo<InitialConfigType>(() => {\n if (processedValue && typeof processedValue !== 'object') {\n throw new Error(\n 'The value passed to the Lexical editor is not an object. This is not supported. Please remove the data from the field and start again. This is the value that was passed in: ' +\n JSON.stringify(processedValue),\n )\n }\n\n if (processedValue && Array.isArray(processedValue) && !('root' in processedValue)) {\n throw new Error(\n 'You have tried to pass in data from the old Slate editor to the new Lexical editor. The data structure is different, thus you will have to migrate your data. We offer a one-line migration script which migrates all your rich text fields: https://payloadcms.com/docs/beta/lexical/migration#migration-via-migration-script-recommended',\n )\n }\n\n if (processedValue && 'jsonContent' in processedValue) {\n throw new Error(\n 'You have tried to pass in data from payload-plugin-lexical. The data structure is different, thus you will have to migrate your data. Migration guide: https://payloadcms.com/docs/beta/lexical/migration#migrating-from-payload-plugin-lexical',\n )\n }\n\n return {\n editable: readOnly !== true,\n editorState: processedValue != null ? JSON.stringify(processedValue) : undefined,\n namespace: editorConfig.lexical.namespace,\n nodes: [...getEnabledNodes({ editorConfig })],\n onError: (error: Error) => {\n throw error\n },\n theme: editorConfig.lexical.theme,\n }\n }, [editorConfig, processedValue, readOnly])\n\n if (!initialConfig) {\n return <p>Loading...</p>\n }\n\n return (\n <LexicalComposer initialConfig={initialConfig} key={path}>\n <EditorConfigProvider\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n field={field}\n parentContext={parentContext}\n >\n <NestProviders providers={editorConfig.features.providers}>\n <LexicalEditorComponent\n editorConfig={editorConfig}\n editorContainerRef={editorContainerRef}\n onChange={onChange}\n />\n </NestProviders>\n </EditorConfigProvider>\n </LexicalComposer>\n )\n}\n", "'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin.js'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { EditorPlugin } from './EditorPlugin.js'\nimport './LexicalEditor.scss'\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement>\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange'>\n> = (props) => {\n const { editorConfig, editorContainerRef, onChange } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" ref={editorContainerRef}>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n ErrorBoundary={LexicalErrorBoundary}\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable />\n </div>\n </div>\n }\n />\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) onChange(editorState, editor, tags)\n }\n }}\n />\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && editor.isEditable() && (\n <React.Fragment>\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n {editorConfig.features.plugins.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {editor.isEditable() && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {editor.isEditable() && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n\n <TabIndentationPlugin />\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n", "'use client'\nimport React from 'react'\n\nimport type { SanitizedPlugin } from '../features/typesClient.js'\n\nexport const EditorPlugin: React.FC<{\n anchorElem?: HTMLDivElement\n clientProps: unknown\n plugin: SanitizedPlugin\n}> = ({ anchorElem, clientProps, plugin }) => {\n if (plugin.position === 'floatingAnchorElem') {\n return (\n plugin.Component && <plugin.Component anchorElem={anchorElem} clientProps={clientProps} />\n )\n }\n\n return plugin.Component && <plugin.Component clientProps={clientProps} />\n}\n", "'use client'\n\nimport { MarkdownShortcutPlugin as LexicalMarkdownShortcutPlugin } from '@lexical/react/LexicalMarkdownShortcutPlugin.js'\nimport * as React from 'react'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n\n return <LexicalMarkdownShortcutPlugin transformers={editorConfig.features.markdownTransformers} />\n}\n", "'use client'\nimport type { TextNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useFieldProps, useTranslation } from '@payloadcms/ui'\nimport { useCallback, useMemo, useState } from 'react'\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\n\nimport type {\n SlashMenuGroup,\n SlashMenuGroupInternal,\n SlashMenuItemInternal,\n SlashMenuItem as SlashMenuItemType,\n} from './LexicalTypeaheadMenuPlugin/types.js'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js'\nimport './index.scss'\nimport { useMenuTriggerMatch } from './useMenuTriggerMatch.js'\n\nconst baseClass = 'slash-menu-popup'\n\nfunction SlashMenuItem({\n isSelected,\n item,\n onClick,\n onMouseEnter,\n}: {\n index: number\n isSelected: boolean\n item: SlashMenuItemInternal\n onClick: () => void\n onMouseEnter: () => void\n}) {\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n const { schemaPath } = useFieldProps()\n\n const { i18n } = useTranslation()\n\n let className = `${baseClass}__item ${baseClass}__item-${item.key}`\n if (isSelected) {\n className += ` ${baseClass}__item--selected`\n }\n\n let title = item.key\n if (item.label) {\n title =\n typeof item.label === 'function'\n ? item.label({ i18n, richTextComponentMap, schemaPath })\n : item.label\n }\n // Crop title to max. 25 characters\n if (title.length > 25) {\n title = title.substring(0, 25) + '...'\n }\n\n return (\n <button\n aria-selected={isSelected}\n className={className}\n id={baseClass + '__item-' + item.key}\n key={item.key}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n ref={(element) => {\n item.ref = { current: element }\n }}\n role=\"option\"\n tabIndex={-1}\n type=\"button\"\n >\n {item?.Icon && <item.Icon />}\n\n <span className={`${baseClass}__item-text`}>{title}</span>\n </button>\n )\n}\n\nexport function SlashMenuPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n const [queryString, setQueryString] = useState<null | string>(null)\n const { editorConfig } = useEditorConfigContext()\n const { i18n } = useTranslation()\n const {\n field: { richTextComponentMap },\n } = useEditorConfigContext()\n const { schemaPath } = useFieldProps()\n\n const checkForTriggerMatch = useMenuTriggerMatch('/', {\n minLength: 0,\n })\n\n const getDynamicItems = useCallback(() => {\n let groupWithItems: Array<SlashMenuGroup> = []\n\n for (const dynamicItem of editorConfig.features.slashMenu.dynamicGroups) {\n const dynamicGroupWithItems = dynamicItem({\n editor,\n queryString,\n })\n groupWithItems = groupWithItems.concat(dynamicGroupWithItems)\n }\n\n return groupWithItems\n }, [editor, queryString, editorConfig?.features])\n\n const groups: SlashMenuGroup[] = useMemo(() => {\n let groupsWithItems: SlashMenuGroup[] = []\n for (const groupWithItem of editorConfig?.features.slashMenu.groups ?? []) {\n groupsWithItems.push(groupWithItem)\n }\n\n if (queryString) {\n // Filter current groups first\n groupsWithItems = groupsWithItems.map((group) => {\n const filteredItems = group.items.filter((item) => {\n let itemTitle = item.key\n if (item.label) {\n itemTitle =\n typeof item.label === 'function'\n ? item.label({ i18n, richTextComponentMap, schemaPath })\n : item.label\n }\n\n if (new RegExp(queryString, 'gi').exec(itemTitle)) {\n return true\n }\n if (item.keywords != null) {\n return item.keywords.some((keyword) => new RegExp(queryString, 'gi').exec(keyword))\n }\n return false\n })\n if (filteredItems.length) {\n return {\n ...group,\n items: filteredItems,\n }\n }\n return null\n })\n\n groupsWithItems = groupsWithItems.filter((group) => group != null)\n\n // Now add dynamic groups\n const dynamicItemGroups = getDynamicItems()\n\n // merge dynamic items into groups\n for (const dynamicGroup of dynamicItemGroups) {\n // 1. find the group with the same name or create new one\n let group = groupsWithItems.find((group) => group.key === dynamicGroup.key)\n if (!group) {\n group = {\n ...dynamicGroup,\n items: [],\n }\n } else {\n groupsWithItems = groupsWithItems.filter((group) => group.key !== dynamicGroup.key)\n }\n\n // 2. Add items to group items array and add to sanitized.slashMenu.groupsWithItems\n if (group?.items?.length) {\n group.items = group.items.concat(group.items)\n }\n groupsWithItems.push(group)\n }\n }\n\n return groupsWithItems\n }, [getDynamicItems, queryString, editorConfig?.features, i18n])\n\n const onSelectItem = useCallback(\n (\n selectedItem: SlashMenuItemType,\n nodeToRemove: TextNode | null,\n closeMenu: () => void,\n matchingString: string,\n ) => {\n if (nodeToRemove) {\n editor.update(() => {\n nodeToRemove.remove()\n })\n }\n selectedItem.onSelect({ editor, queryString: matchingString })\n\n closeMenu()\n },\n [editor],\n )\n\n return (\n <LexicalTypeaheadMenuPlugin\n anchorElem={anchorElem}\n groups={groups as SlashMenuGroupInternal[]}\n menuRenderFn={(\n anchorElementRef,\n { selectItemAndCleanUp, selectedItemKey, setSelectedItemKey },\n ) =>\n anchorElementRef.current && groups.length\n ? ReactDOM.createPortal(\n <div className={baseClass}>\n {groups.map((group) => {\n let groupTitle = group.key\n if (group.label) {\n groupTitle =\n typeof group.label === 'function'\n ? group.label({ i18n, richTextComponentMap, schemaPath })\n : group.label\n }\n\n return (\n <div\n className={`${baseClass}__group ${baseClass}__group-${group.key}`}\n key={group.key}\n >\n <div className={`${baseClass}__group-title`}>{groupTitle}</div>\n {group.items.map((item, oi: number) => (\n <SlashMenuItem\n index={oi}\n isSelected={selectedItemKey === item.key}\n item={item as SlashMenuItemInternal}\n key={item.key}\n onClick={() => {\n setSelectedItemKey(item.key)\n selectItemAndCleanUp(item)\n }}\n onMouseEnter={() => {\n setSelectedItemKey(item.key)\n }}\n />\n ))}\n </div>\n )\n })}\n </div>,\n anchorElementRef.current,\n )\n : null\n }\n onQueryChange={setQueryString}\n onSelectItem={onSelectItem}\n triggerFn={checkForTriggerMatch}\n />\n )\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useCallback } from 'react'\n\nimport { PUNCTUATION } from './LexicalTypeaheadMenuPlugin/index.js'\n\nexport type TriggerFn = ({\n editor,\n query,\n}: {\n editor: LexicalEditor\n /** The query string is the POTENTIAL trigger AND the text after the trigger text. */\n query: string\n}) => MenuTextMatch | null\n\nexport type MenuTextMatch = {\n leadOffset: number\n matchingString: string\n replaceableString: string\n}\n\n/**\n * Returns a function which checks if the trigger (e.g. '/') is present in the query and, if so, returns the matching string (text after the trigger)\n */\nexport function useMenuTriggerMatch(\n /**\n * Text which triggers the menu. Everything after this text will be used as the query.\n */\n trigger: string,\n { maxLength = 75, minLength = 1 }: { maxLength?: number; minLength?: number },\n): TriggerFn {\n return useCallback(\n ({ query }) => {\n const validChars = '[^' + trigger + PUNCTUATION + '\\\\s]'\n const TypeaheadTriggerRegex = new RegExp(\n '(^|\\\\s|\\\\()(' +\n '[' +\n trigger +\n ']' +\n '((?:' +\n validChars +\n '){0,' +\n maxLength +\n '})' +\n ')$',\n )\n const match = TypeaheadTriggerRegex.exec(query)\n if (match !== null) {\n const maybeLeadingWhitespace = match[1]\n\n /**\n * matchingString is only the text AFTER the trigger text. (So everything after the /)\n */\n const matchingString = match[3]\n\n if (matchingString.length >= minLength) {\n return {\n leadOffset: match.index + maybeLeadingWhitespace.length,\n matchingString,\n replaceableString: match[2], // replaceableString is the trigger text + the matching string\n }\n }\n }\n return null\n },\n [maxLength, minLength, trigger],\n )\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode, ParagraphNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $createParagraphNode } from 'lexical'\nimport * as React from 'react'\nimport { type JSX, useCallback, useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { isHTMLElement } from '../../../utils/guard.js'\nimport { Point } from '../../../utils/point.js'\nimport { ENABLE_SLASH_MENU_COMMAND } from '../../SlashMenu/LexicalTypeaheadMenuPlugin/index.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport './index.scss'\n\nconst ADD_BLOCK_MENU_CLASSNAME = 'add-block-menu'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction useAddBlockHandle(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const { editorConfig } = useEditorConfigContext()\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -24 : 12\n\n const menuRef = useRef<HTMLButtonElement>(null)\n const [hoveredElement, setHoveredElement] = useState<{\n elem: HTMLElement\n node: LexicalNode\n } | null>(null)\n\n useEffect(() => {\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n\n if (distanceFromScrollerElem === -1) {\n setHoveredElement(null)\n return\n }\n\n if (isOnHandleElement(target, ADD_BLOCK_MENU_CLASSNAME)) {\n return\n }\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _emptyBlockElem,\n blockNode,\n foundAtIndex,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n returnEmptyParagraphs: true,\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n })\n\n prevIndex = foundAtIndex\n\n if (!_emptyBlockElem) {\n return\n }\n if (hoveredElement?.node !== blockNode || hoveredElement?.elem !== _emptyBlockElem) {\n setHoveredElement({\n elem: _emptyBlockElem,\n node: blockNode,\n })\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, hoveredElement])\n\n useEffect(() => {\n if (menuRef.current && hoveredElement?.node) {\n setHandlePosition(\n hoveredElement?.elem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, hoveredElement, blockHandleHorizontalOffset])\n\n const handleAddClick = useCallback(\n (event) => {\n let hoveredElementToUse = hoveredElement\n if (!hoveredElementToUse?.node) {\n return\n }\n\n // 1. Update hoveredElement.node to a new paragraph node if the hoveredElement.node is not a paragraph node\n editor.update(() => {\n // Check if blockNode is an empty text node\n let isEmptyParagraph = true\n if (\n hoveredElementToUse.node.getType() !== 'paragraph' ||\n hoveredElementToUse.node.getTextContent() !== ''\n ) {\n isEmptyParagraph = false\n }\n\n if (!isEmptyParagraph) {\n const newParagraph = $createParagraphNode()\n hoveredElementToUse.node.insertAfter(newParagraph)\n\n setTimeout(() => {\n hoveredElementToUse = {\n elem: editor.getElementByKey(newParagraph.getKey()),\n node: newParagraph,\n }\n setHoveredElement(hoveredElementToUse)\n }, 0)\n }\n })\n\n // 2. Focus on the new paragraph node\n setTimeout(() => {\n editor.update(() => {\n editor.focus()\n\n if (\n hoveredElementToUse.node &&\n 'select' in hoveredElementToUse.node &&\n typeof hoveredElementToUse.node.select === 'function'\n ) {\n hoveredElementToUse.node.select()\n }\n })\n }, 1)\n\n // Make sure this is called AFTER the focusing has been processed by the browser\n // Otherwise, this won't work\n setTimeout(() => {\n editor.dispatchCommand(ENABLE_SLASH_MENU_COMMAND, {\n node: hoveredElementToUse.node as ParagraphNode,\n })\n }, 2)\n\n event.stopPropagation()\n event.preventDefault()\n },\n [editor, hoveredElement],\n )\n\n return createPortal(\n <React.Fragment>\n <button\n className=\"icon add-block-menu\"\n onClick={(event) => {\n handleAddClick(event)\n }}\n ref={menuRef}\n type=\"button\"\n >\n <div className={isEditable ? 'icon' : ''} />\n </button>\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function AddBlockHandlePlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useAddBlockHandle(editor, anchorElem, editor._editable)\n}\n", "'use client'\n/**\n * Calculate distance between scrollerElem and target if target is not in scrollerElem\n */\nexport const calculateDistanceFromScrollerElem = (\n scrollerElem: HTMLElement | null,\n pageX: number,\n pageY: number,\n target: HTMLElement,\n horizontalBuffer: number = 50,\n verticalBuffer: number = 25,\n): number => {\n let distanceFromScrollerElem = 0\n if (scrollerElem && !scrollerElem.contains(target)) {\n const { bottom, left, right, top } = scrollerElem.getBoundingClientRect()\n\n const adjustedTop = top + window.scrollY\n const adjustedBottom = bottom + window.scrollY\n\n if (\n pageY < adjustedTop - verticalBuffer ||\n pageY > adjustedBottom + verticalBuffer ||\n pageX < left - horizontalBuffer ||\n pageX > right + horizontalBuffer\n ) {\n return -1\n }\n\n // This is used to allow the _draggableBlockElem to be found when the mouse is in the\n // buffer zone around the scrollerElem.\n if (pageX < left || pageX > right) {\n distanceFromScrollerElem = pageX < left ? pageX - left : pageX - right\n }\n }\n return distanceFromScrollerElem\n}\n", "'use client'\nimport type { LexicalEditor, LexicalNode } from 'lexical'\n\nimport { $getNodeByKey } from 'lexical'\n\nimport { Point } from '../../../utils/point.js'\nimport { Rect } from '../../../utils/rect.js'\nimport { getBoundingClientRectWithoutTransform } from '../DraggableBlockPlugin/getBoundingRectWithoutTransform.js'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\n\n// Directions\nconst Downward = 1\nconst Upward = -1\nconst Indeterminate = 0\n\ntype Props = {\n anchorElem: HTMLElement\n cache_threshold?: number\n editor: LexicalEditor\n /** fuzzy makes the search not exact. If no exact match found, find the closes node instead of returning null */\n fuzzy?: boolean\n horizontalOffset?: number\n point: Point\n /**\n * By default, empty paragraphs are not returned. Set this to true to return empty paragraphs. @default false\n */\n returnEmptyParagraphs?: boolean\n /**\n * The index to start searching from. It can be a considerable performance optimization to start searching from the index of the\n * previously found node, as the node is likely to be close to the next node.\n */\n startIndex?: number\n useEdgeAsDefault?: boolean\n verbose?: boolean\n}\n\ntype Output = {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n}\n\nconst cache = {\n props: null as Props | null,\n result: null as Output | null,\n}\n\nfunction isPointClose(previous: Point, current: Point, threshold: number = 20): boolean {\n const dx = previous.x - current.x\n const dy = previous.y - current.y\n return dx * dx + dy * dy <= threshold * threshold\n}\n\nexport function getNodeCloseToPoint(props: Props): Output {\n const {\n anchorElem,\n cache_threshold = 20,\n editor,\n fuzzy = false,\n horizontalOffset = 0,\n point: { x, y },\n startIndex = 0,\n useEdgeAsDefault = false,\n verbose = false,\n } = props\n\n // Use cache\n if (\n cache_threshold > 0 &&\n cache.props &&\n cache.result &&\n cache.props.fuzzy === props.fuzzy &&\n cache.props.horizontalOffset === props.horizontalOffset &&\n cache.props.useEdgeAsDefault === props.useEdgeAsDefault &&\n isPointClose(cache.props.point, props.point, cache_threshold)\n ) {\n return cache.result\n }\n\n const anchorElementRect = anchorElem.getBoundingClientRect()\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const closestBlockElem: {\n blockElem: HTMLElement | null\n blockNode: LexicalNode | null\n distance: number\n foundAtIndex: number\n isFoundNodeEmptyParagraph: boolean\n } = {\n blockElem: null,\n blockNode: null,\n distance: Infinity,\n foundAtIndex: -1,\n isFoundNodeEmptyParagraph: false,\n }\n\n // Return null if matching block element is the first or last node\n editor.getEditorState().read(() => {\n if (useEdgeAsDefault) {\n const [firstNode, lastNode] = [\n editor.getElementByKey(topLevelNodeKeys[0]),\n editor.getElementByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1]),\n ]\n\n const [firstNodeRect, lastNodeRect] = [\n getBoundingClientRectWithoutTransform(firstNode),\n getBoundingClientRectWithoutTransform(lastNode),\n ]\n\n if (firstNodeRect && lastNodeRect) {\n if (y < firstNodeRect.top) {\n closestBlockElem.blockElem = firstNode\n closestBlockElem.distance = firstNodeRect.top - y\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[0])\n closestBlockElem.foundAtIndex = 0\n } else if (y > lastNodeRect.bottom) {\n closestBlockElem.distance = y - lastNodeRect.bottom\n closestBlockElem.blockNode = $getNodeByKey(topLevelNodeKeys[topLevelNodeKeys.length - 1])\n closestBlockElem.blockElem = lastNode\n closestBlockElem.foundAtIndex = topLevelNodeKeys.length - 1\n }\n\n if (closestBlockElem?.blockElem) {\n return {\n blockElem: null,\n isFoundNodeEmptyParagraph: false,\n } as Output\n }\n }\n }\n\n // Find matching block element\n let index = startIndex\n let direction = Indeterminate\n\n while (index >= 0 && index < topLevelNodeKeys.length) {\n const key = topLevelNodeKeys[index]\n const elem = editor.getElementByKey(key)\n if (elem === null) {\n break\n }\n const point = new Point(x + horizontalOffset, y)\n //const domRect = Rect.fromDOM(elem)\n // Do not consider transform of blocks when calculating distance\n const domRect = Rect.fromDOMRect(getBoundingClientRectWithoutTransform(elem))\n\n const { marginBottom, marginTop } = getCollapsedMargins(elem)\n\n const rect = domRect.generateNewRect({\n bottom: domRect.bottom + marginBottom,\n left: anchorElementRect.left,\n right: anchorElementRect.right,\n top: domRect.top - marginTop,\n })\n\n const { distance, isOnBottomSide, isOnTopSide } = rect.distanceFromPoint(point)\n\n if (distance === 0) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.foundAtIndex = index\n closestBlockElem.distance = distance\n\n // Check if blockNode is an empty text node\n if (\n closestBlockElem.blockNode &&\n closestBlockElem.blockNode.getType() === 'paragraph' &&\n closestBlockElem.blockNode.getTextContent() === ''\n ) {\n if (!fuzzy && !props.returnEmptyParagraphs) {\n closestBlockElem.blockElem = null\n closestBlockElem.blockNode = null\n }\n\n closestBlockElem.isFoundNodeEmptyParagraph = true\n }\n break\n } else if (fuzzy) {\n if (distance < closestBlockElem.distance) {\n closestBlockElem.blockElem = elem\n closestBlockElem.blockNode = $getNodeByKey(key)\n closestBlockElem.distance = distance\n closestBlockElem.foundAtIndex = index\n }\n }\n\n if (direction === Indeterminate) {\n if (isOnTopSide) {\n direction = Upward\n } else if (isOnBottomSide) {\n direction = Downward\n } else {\n // stop search block element\n direction = Infinity\n }\n }\n\n index += direction\n }\n })\n\n // Store in cache before returning\n cache.props = props\n cache.result = {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n\n return {\n blockElem: closestBlockElem.blockElem,\n blockNode: closestBlockElem.blockNode,\n foundAtIndex: closestBlockElem.foundAtIndex,\n isFoundNodeEmptyParagraph: closestBlockElem.isFoundNodeEmptyParagraph,\n }\n}\n", "'use client'\nexport function getBoundingClientRectWithoutTransform(elem: HTMLElement): DOMRect {\n const rect = elem.getBoundingClientRect()\n\n // Extract the translation value from the transform style\n const transformValue = getComputedStyle(elem).getPropertyValue('transform')\n if (!transformValue || transformValue === 'none') {\n return rect\n }\n\n const lastNumberOfTransformValue = transformValue.split(',').pop()\n rect.y = rect.y - Number(lastNumberOfTransformValue.replace(')', ''))\n\n // Return the original bounding rect if no translation is applied\n return rect\n}\n", "'use client'\nexport function getCollapsedMargins(elem: HTMLElement): {\n marginBottom: number\n marginTop: number\n} {\n const getMargin = (element: Element | null, margin: 'marginBottom' | 'marginTop'): number =>\n element ? parseFloat(window.getComputedStyle(element)[margin]) : 0\n\n const { marginBottom, marginTop } = window.getComputedStyle(elem)\n const prevElemSiblingMarginBottom = getMargin(elem.previousElementSibling, 'marginBottom')\n const nextElemSiblingMarginTop = getMargin(elem.nextElementSibling, 'marginTop')\n const collapsedTopMargin = Math.max(parseFloat(marginTop), prevElemSiblingMarginBottom)\n const collapsedBottomMargin = Math.max(parseFloat(marginBottom), nextElemSiblingMarginTop)\n\n return { marginBottom: collapsedBottomMargin, marginTop: collapsedTopMargin }\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { $getRoot } from 'lexical'\n\nexport function getTopLevelNodeKeys(editor: LexicalEditor): string[] {\n return editor.getEditorState().read(() => $getRoot().getChildrenKeys())\n}\n", "'use client'\nexport function isOnHandleElement(element: HTMLElement, handleElementClassName: string): boolean {\n return !!element.closest(`.${handleElementClassName}`)\n}\n", "'use client'\nconst replacedElements = [\n 'IMG',\n 'INPUT',\n 'TEXTAREA',\n 'SELECT',\n 'BUTTON',\n 'VIDEO',\n 'OBJECT',\n 'EMBED',\n 'IFRAME',\n 'HR',\n]\n\n/**\n * From ChatGPT, only that verified it works for HR elements.\n *\n * HTML Elements can have CSS lineHeight applied to them, but it doesn't always affect the visual layout.\n * This function checks if the line-height property has an effect on the element's layout.\n * @param htmlElem\n */\nexport function doesLineHeightAffectElement(htmlElem: HTMLElement) {\n if (!htmlElem) return false\n\n // Check for replaced elements, elements that typically don't support line-height adjustments,\n // and elements without visible content\n\n if (\n replacedElements.includes(htmlElem.tagName) ||\n htmlElem.offsetHeight === 0 ||\n htmlElem.offsetWidth === 0\n ) {\n return false\n }\n\n // Check for specific CSS properties that negate line-height's visual effects\n const style = window.getComputedStyle(htmlElem)\n if (\n style.display === 'table-cell' ||\n style.position === 'absolute' ||\n style.visibility === 'hidden' ||\n style.opacity === '0'\n ) {\n return false\n }\n\n // This is a basic check, and there can be more complex scenarios where line-height doesn't have an effect.\n return true\n}\n", "'use client'\nimport { doesLineHeightAffectElement } from './doesLineHeightAffectElement.js'\n\nexport function setHandlePosition(\n targetElem: HTMLElement | null,\n handleElem: HTMLElement,\n anchorElem: HTMLElement,\n leftOffset: number = 0, // SPACE\n) {\n if (!targetElem) {\n handleElem.style.opacity = '0'\n handleElem.style.transform = 'translate(-10000px, -10000px)'\n return\n }\n\n const targetRect = targetElem.getBoundingClientRect()\n const targetStyle = window.getComputedStyle(targetElem)\n const floatingElemRect = handleElem.getBoundingClientRect()\n const anchorElementRect = anchorElem.getBoundingClientRect()\n\n let top: number\n\n const shouldDisplayHandleInCenter = targetRect.height < 60\n\n if (!shouldDisplayHandleInCenter) {\n // No need to let line height affect the re-positioning of the floating element if line height has no\n // visual effect on the element. Otherwise, the floating element will be positioned incorrectly.\n const actualLineHeight = doesLineHeightAffectElement(targetElem)\n ? parseInt(targetStyle.lineHeight, 10)\n : 0\n\n top =\n targetRect.top + (actualLineHeight - floatingElemRect.height) / 2 - anchorElementRect.top - 1 // 1px inaccuracy\n } else {\n top =\n targetRect.top -\n floatingElemRect.height / 2 -\n anchorElementRect.top +\n targetRect.height / 2 -\n 1 // 1px inaccuracy\n }\n\n const left = leftOffset\n\n handleElem.style.opacity = '1'\n handleElem.style.transform = `translate(${left}px, ${top}px)`\n}\n", "'use client'\nimport type { LexicalEditor } from 'lexical'\nimport type { DragEvent as ReactDragEvent } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { eventFiles } from '@lexical/rich-text'\nimport { $getNearestNodeFromDOMNode, $getNodeByKey } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../config/client/EditorConfigProvider.js'\nimport { isHTMLElement } from '../../../utils/guard.js'\nimport { Point } from '../../../utils/point.js'\nimport { calculateDistanceFromScrollerElem } from '../utils/calculateDistanceFromScrollerElem.js'\nimport { getNodeCloseToPoint } from '../utils/getNodeCloseToPoint.js'\nimport { getTopLevelNodeKeys } from '../utils/getTopLevelNodeKeys.js'\nimport { isOnHandleElement } from '../utils/isOnHandleElement.js'\nimport { setHandlePosition } from '../utils/setHandlePosition.js'\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\nimport './index.scss'\nimport { setTargetLine } from './setTargetLine.js'\n\nconst DRAGGABLE_BLOCK_MENU_CLASSNAME = 'draggable-block-menu'\nconst DRAG_DATA_FORMAT = 'application/x-lexical-drag-block'\n\nlet prevIndex = Infinity\n\nfunction getCurrentIndex(keysLength: number): number {\n if (keysLength === 0) {\n return Infinity\n }\n if (prevIndex >= 0 && prevIndex < keysLength) {\n return prevIndex\n }\n\n return Math.floor(keysLength / 2)\n}\n\nfunction setDragImage(dataTransfer: DataTransfer, draggableBlockElem: HTMLElement) {\n const { transform } = draggableBlockElem.style\n\n // Remove dragImage borders\n dataTransfer.setDragImage(draggableBlockElem, 0, 0)\n\n setTimeout(() => {\n draggableBlockElem.style.transform = transform\n })\n}\n\nfunction hideTargetLine(\n targetLineElem: HTMLElement | null,\n lastTargetBlockElem: HTMLElement | null,\n) {\n if (targetLineElem) {\n targetLineElem.style.opacity = '0'\n }\n if (lastTargetBlockElem) {\n lastTargetBlockElem.style.opacity = ''\n // Delete marginBottom and marginTop values we set\n lastTargetBlockElem.style.marginBottom = ''\n lastTargetBlockElem.style.marginTop = ''\n //lastTargetBlock.style.border = 'none'\n }\n}\n\nfunction useDraggableBlockMenu(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n isEditable: boolean,\n): React.ReactElement {\n const scrollerElem = anchorElem.parentElement\n\n const menuRef = useRef<HTMLDivElement>(null)\n const targetLineRef = useRef<HTMLDivElement>(null)\n const debugHighlightRef = useRef<HTMLDivElement>(null)\n const isDraggingBlockRef = useRef<boolean>(false)\n const [draggableBlockElem, setDraggableBlockElem] = useState<HTMLElement | null>(null)\n const [lastTargetBlock, setLastTargetBlock] = useState<{\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n }>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const blockHandleHorizontalOffset = editorConfig?.admin?.hideGutter ? -44 : -8\n\n useEffect(() => {\n /**\n * Handles positioning of the drag handle\n */\n function onDocumentMouseMove(event: MouseEvent) {\n const target = event.target\n if (!isHTMLElement(target)) {\n return\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n )\n if (distanceFromScrollerElem === -1) {\n setDraggableBlockElem(null)\n return\n }\n\n if (isOnHandleElement(target, DRAGGABLE_BLOCK_MENU_CLASSNAME)) {\n return\n }\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: _draggableBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n cache_threshold: 0,\n editor,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: false,\n verbose: false,\n })\n\n prevIndex = foundAtIndex\n\n //if (DEBUG && _draggableBlockElem) {\n //targetBlockElem.style.border = '3px solid red'\n // highlightElemOriginalPosition(debugHighlightRef, _draggableBlockElem, anchorElem)\n //}\n\n if (!_draggableBlockElem && !isFoundNodeEmptyParagraph) {\n return\n }\n\n if (draggableBlockElem !== _draggableBlockElem) {\n setDraggableBlockElem(_draggableBlockElem)\n }\n }\n\n // Since the draggableBlockElem is outside the actual editor, we need to listen to the document\n // to be able to detect when the mouse is outside the editor and respect a buffer around\n // the scrollerElem to avoid the draggableBlockElem disappearing too early.\n document?.addEventListener('mousemove', onDocumentMouseMove)\n\n return () => {\n document?.removeEventListener('mousemove', onDocumentMouseMove)\n }\n }, [scrollerElem, anchorElem, editor, draggableBlockElem])\n\n useEffect(() => {\n if (menuRef.current) {\n setHandlePosition(\n draggableBlockElem,\n menuRef.current,\n anchorElem,\n blockHandleHorizontalOffset,\n )\n }\n }, [anchorElem, draggableBlockElem, blockHandleHorizontalOffset])\n\n useEffect(() => {\n function onDragover(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n\n const { pageY, target } = event\n if (!isHTMLElement(target)) {\n return false\n }\n\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const topLevelNodeKeys = getTopLevelNodeKeys(editor)\n\n const {\n blockElem: targetBlockElem,\n foundAtIndex,\n isFoundNodeEmptyParagraph,\n } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n startIndex: getCurrentIndex(topLevelNodeKeys.length),\n useEdgeAsDefault: true,\n verbose: true,\n })\n\n prevIndex = foundAtIndex\n\n const targetLineElem = targetLineRef.current\n // targetBlockElem === null shouldn't happen\n if (targetBlockElem === null || targetLineElem === null) {\n return false\n }\n\n if (draggableBlockElem !== targetBlockElem) {\n const { isBelow, willStayInSamePosition } = setTargetLine(\n editorConfig?.admin?.hideGutter ? '0px' : '3rem',\n blockHandleHorizontalOffset +\n (editorConfig?.admin?.hideGutter\n ? menuRef?.current?.getBoundingClientRect()?.width ?? 0\n : -(menuRef?.current?.getBoundingClientRect()?.width ?? 0)),\n targetLineElem,\n targetBlockElem,\n lastTargetBlock,\n pageY,\n anchorElem,\n event,\n debugHighlightRef,\n isFoundNodeEmptyParagraph,\n )\n\n // Prevent default event to be able to trigger onDrop events\n // Calling preventDefault() adds the green plus icon to the cursor,\n // indicating that the drop is allowed.\n event.preventDefault()\n\n if (!willStayInSamePosition) {\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow,\n })\n }\n } else {\n hideTargetLine(targetLineElem, lastTargetBlock?.elem)\n setLastTargetBlock({\n boundingBox: targetBlockElem.getBoundingClientRect(),\n elem: targetBlockElem,\n isBelow: false,\n })\n }\n\n return true\n }\n\n function onDrop(event: DragEvent): boolean {\n if (!isDraggingBlockRef.current) {\n return false\n }\n const [isFileTransfer] = eventFiles(event)\n if (isFileTransfer) {\n return false\n }\n const { dataTransfer, pageY, target } = event\n const dragData = dataTransfer?.getData(DRAG_DATA_FORMAT) || ''\n\n editor.update(() => {\n const draggedNode = $getNodeByKey(dragData)\n if (!draggedNode) {\n return false\n }\n if (!isHTMLElement(target)) {\n return false\n }\n const distanceFromScrollerElem = calculateDistanceFromScrollerElem(\n scrollerElem,\n event.pageX,\n event.pageY,\n target,\n 100,\n 50,\n )\n\n const { blockElem: targetBlockElem, isFoundNodeEmptyParagraph } = getNodeCloseToPoint({\n anchorElem,\n editor,\n fuzzy: true,\n horizontalOffset: -distanceFromScrollerElem,\n point: new Point(event.x, event.y),\n useEdgeAsDefault: true,\n })\n\n if (!targetBlockElem) {\n return false\n }\n const targetNode = $getNearestNodeFromDOMNode(targetBlockElem)\n if (!targetNode) {\n return false\n }\n if (targetNode === draggedNode) {\n return true\n }\n\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n getBoundingClientRectWithoutTransform(targetBlockElem)\n\n const mouseY = pageY\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n targetNode.insertAfter(draggedNode)\n } else {\n // above targetBlockElem\n targetNode.insertBefore(draggedNode)\n }\n } else {\n //\n targetNode.insertBefore(draggedNode)\n targetNode.remove()\n }\n\n /*\n if (pageY >= targetBlockElemTop + targetBlockElemHeight / 2) {\n targetNode.insertAfter(draggedNode)\n } else {\n targetNode.insertBefore(draggedNode)\n }*/\n if (draggableBlockElem !== null) {\n setDraggableBlockElem(null)\n }\n\n // find all previous elements with lexical-block-highlighter class and remove them\n const allPrevHighlighters = document.querySelectorAll('.lexical-block-highlighter')\n allPrevHighlighters.forEach((highlighter) => {\n highlighter.remove()\n })\n\n const newInsertedElem = editor.getElementByKey(draggedNode.getKey())\n setTimeout(() => {\n // add new temp html element to newInsertedElem with the same height and width and the class block-selected\n // to highlight the new inserted element\n const newInsertedElemRect = newInsertedElem.getBoundingClientRect()\n\n const highlightElem = document.createElement('div')\n highlightElem.className = 'lexical-block-highlighter'\n\n // if html data-theme is dark, set the highlighter color to white\n if (document.documentElement.getAttribute('data-theme') === 'dark') {\n highlightElem.style.backgroundColor = 'white'\n } else {\n highlightElem.style.backgroundColor = 'black'\n }\n\n highlightElem.style.transition = 'opacity 0.1s ease-in-out'\n highlightElem.style.zIndex = '1'\n highlightElem.style.pointerEvents = 'none'\n highlightElem.style.boxSizing = 'border-box'\n highlightElem.style.borderRadius = '4px'\n highlightElem.style.position = 'absolute'\n document.body.appendChild(highlightElem)\n\n highlightElem.style.opacity = '0.1'\n\n highlightElem.style.height = `${newInsertedElemRect.height + 8}px`\n highlightElem.style.width = `${newInsertedElemRect.width + 8}px`\n highlightElem.style.top = `${newInsertedElemRect.top + window.scrollY - 4}px`\n highlightElem.style.left = `${newInsertedElemRect.left - 4}px`\n\n setTimeout(() => {\n highlightElem.style.opacity = '0'\n setTimeout(() => {\n highlightElem.remove()\n }, 1000)\n }, 3000)\n }, 120)\n })\n\n return true\n }\n\n // register onDragover event listeners:\n document.addEventListener('dragover', onDragover)\n // register onDrop event listeners:\n document.addEventListener('drop', onDrop)\n\n return () => {\n document.removeEventListener('dragover', onDragover)\n document.removeEventListener('drop', onDrop)\n }\n }, [\n scrollerElem,\n blockHandleHorizontalOffset,\n anchorElem,\n editor,\n lastTargetBlock,\n draggableBlockElem,\n editorConfig?.admin?.hideGutter,\n ])\n\n function onDragStart(event: ReactDragEvent<HTMLDivElement>): void {\n const dataTransfer = event.dataTransfer\n if (!dataTransfer || !draggableBlockElem) {\n return\n }\n setDragImage(dataTransfer, draggableBlockElem)\n let nodeKey = ''\n editor.update(() => {\n const node = $getNearestNodeFromDOMNode(draggableBlockElem)\n if (node) {\n nodeKey = node.getKey()\n }\n })\n isDraggingBlockRef.current = true\n dataTransfer.setData(DRAG_DATA_FORMAT, nodeKey)\n }\n\n function onDragEnd(): void {\n isDraggingBlockRef.current = false\n hideTargetLine(targetLineRef.current, lastTargetBlock?.elem)\n }\n\n return createPortal(\n <React.Fragment>\n <div\n className=\"icon draggable-block-menu\"\n draggable\n onDragEnd={onDragEnd}\n onDragStart={onDragStart}\n ref={menuRef}\n >\n <div className={isEditable ? 'icon' : ''} />\n </div>\n <div className=\"draggable-block-target-line\" ref={targetLineRef} />\n <div className=\"debug-highlight\" ref={debugHighlightRef} />\n </React.Fragment>,\n anchorElem,\n )\n}\n\nexport function DraggableBlockPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): React.ReactElement {\n const [editor] = useLexicalComposerContext()\n return useDraggableBlockMenu(editor, anchorElem, editor._editable)\n}\n", "'use client'\nimport type React from 'react'\n\nimport { getBoundingClientRectWithoutTransform } from './getBoundingRectWithoutTransform.js'\n\nexport function highlightElemOriginalPosition(\n debugHighlightRef: React.RefObject<HTMLDivElement | null>,\n htmlElem: HTMLElement,\n anchorElem: HTMLElement,\n) {\n if (!debugHighlightRef.current) {\n // If the ref doesn't point to an existing element, we can't set styles\n return\n }\n\n const { left: anchorLeft, top: anchorTop } = anchorElem.getBoundingClientRect()\n\n // Get computed styles of the given element\n const boundingRect = getBoundingClientRectWithoutTransform(htmlElem)\n\n // Extract necessary styles (ignoring transform)\n const width = boundingRect.width\n const height = boundingRect.height\n const top = boundingRect.top - anchorTop\n const left = boundingRect.left - anchorLeft\n\n debugHighlightRef.current.style.border = '2px solid green'\n debugHighlightRef.current.style.boxSizing = 'border-box'\n debugHighlightRef.current.style.height = height + 'px'\n debugHighlightRef.current.style.pointerEvents = 'none'\n debugHighlightRef.current.style.position = 'absolute'\n debugHighlightRef.current.style.top = top + 'px'\n debugHighlightRef.current.style.left = left + 'px'\n debugHighlightRef.current.style.width = width + 'px'\n debugHighlightRef.current.style.zIndex = '1000'\n debugHighlightRef.current.style.opacity = '0.5'\n}\n", "'use client'\nimport { getCollapsedMargins } from '../utils/getCollapsedMargins.js'\nimport { highlightElemOriginalPosition } from './highlightElemOriginalPosition.js'\nconst TARGET_LINE_HALF_HEIGHT = 25\nconst TEXT_BOX_HORIZONTAL_PADDING = -24\nconst DEBUG = false\n\nlet animationTimer = 0\n\nexport function setTargetLine(\n offsetWidth: string,\n offsetLeft: number,\n targetLineElem: HTMLElement,\n targetBlockElem: HTMLElement,\n lastTargetBlock: {\n boundingBox?: DOMRect\n elem: HTMLElement | null\n isBelow: boolean\n },\n mouseY: number,\n anchorElem: HTMLElement,\n event: DragEvent,\n debugHighlightRef: React.RefObject<HTMLDivElement | null>,\n isFoundNodeEmptyParagraph: boolean = false,\n) {\n const { height: targetBlockElemHeight, top: targetBlockElemTop } =\n targetBlockElem.getBoundingClientRect() // used to be getBoundingClientRectWithoutTransform. Not sure what's better, but the normal getBoundingClientRect seems to work fine\n const { top: anchorTop, width: anchorWidth } = anchorElem.getBoundingClientRect()\n\n const { marginBottom, marginTop } = getCollapsedMargins(targetBlockElem)\n let lineTop = targetBlockElemTop\n\n const isBelow = mouseY >= targetBlockElemTop + targetBlockElemHeight / 2 + window.scrollY\n\n let willStayInSamePosition = false\n\n /**\n * Do not run any transform or changes if the actual new line position would be the same (even if it's now inserted BEFORE rather than AFTER - position would still be the same)\n * This prevents unnecessary flickering.\n *\n * We still need to let it run even if the position (IGNORING the transform) would not change, as the transform animation is not finished yet. This is what animationTimer does. Otherwise, the positioning will be inaccurate\n */\n if (lastTargetBlock?.elem) {\n if (targetBlockElem !== lastTargetBlock?.elem) {\n if (\n isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.nextElementSibling\n ) {\n animationTimer++\n\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n } else if (\n !isBelow &&\n lastTargetBlock?.elem &&\n lastTargetBlock?.elem === targetBlockElem.previousElementSibling\n ) {\n animationTimer++\n if (animationTimer < 200) {\n willStayInSamePosition = true\n }\n }\n } else {\n animationTimer++\n\n const lastBoundingBoxPosition = lastTargetBlock?.boundingBox?.y\n const currentBoundingBoxPosition = targetBlockElem.getBoundingClientRect().y\n\n if (\n (isBelow === lastTargetBlock?.isBelow &&\n lastBoundingBoxPosition === currentBoundingBoxPosition) ||\n animationTimer < 200\n ) {\n willStayInSamePosition = false\n }\n }\n }\n if (willStayInSamePosition) {\n return {\n isBelow,\n willStayInSamePosition,\n }\n }\n\n /**\n * Paragraphs need no isBelow/above handling,\n */\n if (!isFoundNodeEmptyParagraph) {\n //if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n // below targetBlockElem\n lineTop += targetBlockElemHeight + marginBottom / 2\n } else {\n // above targetBlockElem\n lineTop -= marginTop / 2\n }\n } else {\n lineTop += targetBlockElemHeight / 2\n }\n\n let targetElemTranslate2 = 0\n\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n targetElemTranslate2 = -TARGET_LINE_HALF_HEIGHT\n } else {\n targetElemTranslate2 = TARGET_LINE_HALF_HEIGHT\n }\n }\n\n const top = lineTop - anchorTop + targetElemTranslate2\n\n const left = TEXT_BOX_HORIZONTAL_PADDING - offsetLeft\n\n targetLineElem.style.width = `calc(${anchorWidth}px - ${offsetWidth})`\n targetLineElem.style.opacity = '.4'\n\n /**\n * Move around element below or above the line (= the target / targetBlockElem). Creates \"space\" for the targetLineElem\n *\n * Not needed for empty paragraphs, as an empty paragraph is enough space for the targetLineElem anyways.\n */\n //targetBlockElem.style.opacity = '0.4'\n const buffer = 12 // creates more spacing/padding so target line is not directly next to the targetBlockElem\n if (!isFoundNodeEmptyParagraph) {\n if (isBelow) {\n targetBlockElem.style.marginBottom = TARGET_LINE_HALF_HEIGHT * 2 + buffer + 'px'\n targetLineElem.style.transform = `translate(${left}px, calc(${top}px - ${'0px'}))`\n } else {\n targetBlockElem.style.marginTop = TARGET_LINE_HALF_HEIGHT * 2 + buffer + 'px'\n targetLineElem.style.transform = `translate(${left}px, calc(${top - TARGET_LINE_HALF_HEIGHT * 2}px - ${'0px'}))`\n }\n } else {\n targetLineElem.style.transform = `translate(${left}px, ${top - TARGET_LINE_HALF_HEIGHT}px)`\n }\n\n if (DEBUG) {\n //targetBlockElem.style.border = '3px solid red'\n highlightElemOriginalPosition(debugHighlightRef, targetBlockElem, anchorElem)\n }\n\n /**\n * Properly reset previous targetBlockElem styles\n */\n lastTargetBlock.elem.style.opacity = ''\n\n if (lastTargetBlock?.elem === targetBlockElem) {\n if (isBelow) {\n lastTargetBlock.elem.style.marginTop = ''\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n }\n } else {\n lastTargetBlock.elem.style.marginBottom = ''\n lastTargetBlock.elem.style.marginTop = ''\n }\n animationTimer = 0\n return {\n isBelow,\n willStayInSamePosition,\n }\n}\n", "'use client'\nimport type { JSX } from 'react'\n\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\n\nimport './ContentEditable.scss'\n\nexport function LexicalContentEditable({ className }: { className?: string }): JSX.Element {\n const { t } = useTranslation<{}, string>()\n\n return (\n <ContentEditable\n aria-placeholder={t('lexical:general:placeholder')}\n className={className ?? 'ContentEditable__root'}\n placeholder={<p className=\"editor-placeholder\">{t('lexical:general:placeholder')}</p>}\n />\n )\n}\n"],
5
+ "mappings": "uMAGA,OACEA,oBAAAA,GACAC,cAAAA,GACAC,cAAAA,GACAC,YAAAA,GACAC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ACF,YAEA6B,EAACC,GAAA,CAAWC,YAAapC,EAAOgB,KAAMA,EAAO,GAAIzB,GAAc,CAAC,EAAI8C,WAAW,SAC/EH,EAACI,GAAA,CAAWrC,MAAOA,EAAOK,MAAOA,EAAOC,SAAUA,EAAW,GAAIC,GAAc,CAAC,IAChFyB,GAAC,MAAA,CAAIpC,UAAW,GAAGX,EAAA,mBACjBgD,EAACK,GAAA,CAAcC,eAAgBA,GAAgBC,QAASA,IAAA,CAAO,WAC7DP,EAACQ,GAAA,CACCpD,aAAcA,EACdE,MAAOA,EAEPmD,SAAWC,GAAA,CACT,IAAIC,EAAwBD,EAAYE,OAAM,EAG1CxD,GAAcyD,UAAUC,OAAOC,MAAMC,QACvC5D,EAAayD,SAASC,MAAMC,KAAKE,QAASC,GAAA,CACxCP,EAAwBO,EAAK,CAAEC,oBAAqBR,CAAsB,CAAA,CAC5E,CAAA,EAGFpB,EAASoB,CAAA,CACX,EACA7B,KAAMA,EACNd,SAAUyB,EACVb,MAAOA,GAfFwC,KAAKC,UAAU,CAAE/B,aAAAA,EAAcR,KAAAA,CAAK,CAAA,CAAA,IAkB7CkB,EAACsB,GAAA,CAAiBzD,YAAaA,EAAc,GAAIV,GAAoB,CAAC,SA/BnE2B,CAAA,CAmCX,EAEA,SAASwB,GAAe,CAAEiB,MAAAA,CAAK,EAAE,CAG/B,OACExB,GAAC,MAAA,CAAIpC,UAAU,gBAAgB6D,KAAK,kBAClCxB,EAAC,IAAA,UAAE,0BACHA,EAAC,MAAA,CAAI9B,MAAO,CAAEuD,MAAO,KAAM,WAAIF,EAAMG,YAG3C,CAEO,IAAMC,GAAqCC,GAAc3E,EAAA",
6
+ "names": ["FieldDescription", "FieldError", "FieldLabel", "useField", "useFieldProps", "withCondition", "useCallback", "ErrorBoundary", "LexicalComposer", "React", "useMemo", "c", "_c", "useLexicalComposerContext", "LexicalErrorBoundary", "HistoryPlugin", "OnChangePlugin", "RichTextPlugin", "TabIndentationPlugin", "BLUR_COMMAND", "COMMAND_PRIORITY_LOW", "FOCUS_COMMAND", "React", "useEffect", "useState", "EditorPlugin", "anchorElem", "clientProps", "plugin", "position", "Component", "_jsx", "c", "_c", "MarkdownShortcutPlugin", "LexicalMarkdownShortcutPlugin", "MarkdownShortcutPlugin", "$", "_c", "editorConfig", "useEditorConfigContext", "t0", "features", "markdownTransformers", "_jsx", "LexicalMarkdownShortcutPlugin", "transformers", "useLexicalComposerContext", "useFieldProps", "useTranslation", "useCallback", "useMemo", "useState", "ReactDOM", "c", "_c", "useMenuTriggerMatch", "trigger", "t0", "$", "_c", "maxLength", "t1", "minLength", "t2", "undefined", "t3", "t4", "query", "validChars", "PUNCTUATION", "match", "RegExp", "exec", "maybeLeadingWhitespace", "matchingString", "length", "leadOffset", "index", "replaceableString", "baseClass", "SlashMenuItem", "isSelected", "item", "onClick", "onMouseEnter", "field", "richTextComponentMap", "useEditorConfigContext", "schemaPath", "useFieldProps", "i18n", "useTranslation", "className", "key", "title", "label", "length", "substring", "_jsxs", "id", "ref", "element", "current", "role", "tabIndex", "type", "Icon", "_jsx", "SlashMenuPlugin", "anchorElem", "document", "body", "editor", "useLexicalComposerContext", "queryString", "setQueryString", "useState", "editorConfig", "checkForTriggerMatch", "useMenuTriggerMatch", "minLength", "getDynamicItems", "useCallback", "groupWithItems", "dynamicItem", "features", "slashMenu", "dynamicGroups", "dynamicGroupWithItems", "concat", "groups", "useMemo", "groupsWithItems", "groupWithItem", "push", "map", "group", "filteredItems", "items", "filter", "itemTitle", "RegExp", "exec", "keywords", "some", "keyword", "dynamicItemGroups", "dynamicGroup", "find", "onSelectItem", "selectedItem", "nodeToRemove", "closeMenu", "matchingString", "update", "remove", "onSelect", "LexicalTypeaheadMenuPlugin", "menuRenderFn", "anchorElementRef", "selectItemAndCleanUp", "selectedItemKey", "setSelectedItemKey", "createPortal", "groupTitle", "oi", "index", "onQueryChange", "triggerFn", "c", "_c", "useLexicalComposerContext", "$createParagraphNode", "React", "useEffect", "useRef", "useState", "createPortal", "calculateDistanceFromScrollerElem", "scrollerElem", "pageX", "pageY", "target", "horizontalBuffer", "verticalBuffer", "distanceFromScrollerElem", "contains", "bottom", "left", "right", "top", "getBoundingClientRect", "adjustedTop", "window", "scrollY", "adjustedBottom", "$getNodeByKey", "getBoundingClientRectWithoutTransform", "elem", "rect", "getBoundingClientRect", "transformValue", "getComputedStyle", "getPropertyValue", "lastNumberOfTransformValue", "split", "pop", "y", "Number", "replace", "getCollapsedMargins", "elem", "getMargin", "element", "margin", "parseFloat", "window", "getComputedStyle", "marginBottom", "marginTop", "prevElemSiblingMarginBottom", "previousElementSibling", "nextElemSiblingMarginTop", "nextElementSibling", "collapsedTopMargin", "Math", "max", "$getRoot", "getTopLevelNodeKeys", "editor", "getEditorState", "read", "getChildrenKeys", "Downward", "Upward", "Indeterminate", "cache", "props", "result", "isPointClose", "previous", "current", "threshold", "dx", "x", "dy", "y", "getNodeCloseToPoint", "anchorElem", "cache_threshold", "editor", "fuzzy", "horizontalOffset", "point", "startIndex", "useEdgeAsDefault", "verbose", "anchorElementRect", "getBoundingClientRect", "topLevelNodeKeys", "getTopLevelNodeKeys", "closestBlockElem", "blockElem", "blockNode", "distance", "Infinity", "foundAtIndex", "isFoundNodeEmptyParagraph", "getEditorState", "read", "firstNode", "lastNode", "getElementByKey", "length", "firstNodeRect", "lastNodeRect", "getBoundingClientRectWithoutTransform", "top", "$getNodeByKey", "bottom", "index", "direction", "key", "elem", "Point", "domRect", "Rect", "fromDOMRect", "marginBottom", "marginTop", "getCollapsedMargins", "rect", "generateNewRect", "left", "right", "isOnBottomSide", "isOnTopSide", "distanceFromPoint", "getType", "getTextContent", "returnEmptyParagraphs", "isOnHandleElement", "element", "handleElementClassName", "closest", "replacedElements", "doesLineHeightAffectElement", "htmlElem", "includes", "tagName", "offsetHeight", "offsetWidth", "style", "window", "getComputedStyle", "display", "position", "visibility", "opacity", "setHandlePosition", "targetElem", "handleElem", "anchorElem", "leftOffset", "style", "opacity", "transform", "targetRect", "getBoundingClientRect", "targetStyle", "window", "getComputedStyle", "floatingElemRect", "anchorElementRect", "top", "height", "actualLineHeight", "doesLineHeightAffectElement", "parseInt", "lineHeight", "left", "ADD_BLOCK_MENU_CLASSNAME", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "useAddBlockHandle", "editor", "anchorElem", "isEditable", "$", "_c", "scrollerElem", "parentElement", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "menuRef", "useRef", "hoveredElement", "setHoveredElement", "useState", "t0", "t1", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_emptyBlockElem", "blockNode", "foundAtIndex", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "returnEmptyParagraphs", "startIndex", "length", "useEdgeAsDefault", "node", "elem", "document", "addEventListener", "removeEventListener", "useEffect", "t2", "current", "setHandlePosition", "t3", "event_0", "hoveredElementToUse", "update", "isEmptyParagraph", "getType", "getTextContent", "newParagraph", "$createParagraphNode", "insertAfter", "setTimeout", "getElementByKey", "getKey", "focus", "select", "dispatchCommand", "ENABLE_SLASH_MENU_COMMAND", "stopPropagation", "preventDefault", "handleAddClick", "t4", "event_1", "createPortal", "_jsx", "Fragment", "children", "className", "onClick", "ref", "type", "AddBlockHandlePlugin", "undefined", "body", "useLexicalComposerContext", "_editable", "c", "_c", "useLexicalComposerContext", "eventFiles", "$getNearestNodeFromDOMNode", "$getNodeByKey", "React", "useEffect", "useRef", "useState", "createPortal", "highlightElemOriginalPosition", "debugHighlightRef", "htmlElem", "anchorElem", "current", "left", "anchorLeft", "top", "anchorTop", "getBoundingClientRect", "boundingRect", "getBoundingClientRectWithoutTransform", "width", "height", "style", "border", "boxSizing", "pointerEvents", "position", "zIndex", "opacity", "TARGET_LINE_HALF_HEIGHT", "TEXT_BOX_HORIZONTAL_PADDING", "DEBUG", "animationTimer", "setTargetLine", "offsetWidth", "offsetLeft", "targetLineElem", "targetBlockElem", "lastTargetBlock", "mouseY", "anchorElem", "event", "debugHighlightRef", "isFoundNodeEmptyParagraph", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRect", "anchorTop", "width", "anchorWidth", "marginBottom", "marginTop", "getCollapsedMargins", "lineTop", "isBelow", "window", "scrollY", "willStayInSamePosition", "elem", "nextElementSibling", "previousElementSibling", "lastBoundingBoxPosition", "boundingBox", "y", "currentBoundingBoxPosition", "targetElemTranslate2", "left", "style", "opacity", "buffer", "transform", "highlightElemOriginalPosition", "DRAGGABLE_BLOCK_MENU_CLASSNAME", "DRAG_DATA_FORMAT", "prevIndex", "Infinity", "getCurrentIndex", "keysLength", "Math", "floor", "setDragImage", "dataTransfer", "draggableBlockElem", "transform", "style", "setTimeout", "hideTargetLine", "targetLineElem", "lastTargetBlockElem", "opacity", "marginBottom", "marginTop", "useDraggableBlockMenu", "editor", "anchorElem", "isEditable", "$", "_c", "scrollerElem", "parentElement", "menuRef", "useRef", "targetLineRef", "debugHighlightRef", "isDraggingBlockRef", "setDraggableBlockElem", "useState", "lastTargetBlock", "setLastTargetBlock", "editorConfig", "useEditorConfigContext", "blockHandleHorizontalOffset", "admin", "hideGutter", "t0", "t1", "onDocumentMouseMove", "event", "target", "isHTMLElement", "distanceFromScrollerElem", "calculateDistanceFromScrollerElem", "pageX", "pageY", "isOnHandleElement", "topLevelNodeKeys", "getTopLevelNodeKeys", "blockElem", "_draggableBlockElem", "foundAtIndex", "isFoundNodeEmptyParagraph", "getNodeCloseToPoint", "cache_threshold", "horizontalOffset", "point", "Point", "x", "y", "startIndex", "length", "useEdgeAsDefault", "verbose", "document", "addEventListener", "removeEventListener", "useEffect", "t2", "t3", "current", "setHandlePosition", "t4", "t5", "onDragover", "event_0", "isFileTransfer", "eventFiles", "target_0", "distanceFromScrollerElem_0", "topLevelNodeKeys_0", "targetBlockElem", "foundAtIndex_0", "isFoundNodeEmptyParagraph_0", "fuzzy", "isBelow", "willStayInSamePosition", "setTargetLine", "getBoundingClientRect", "width", "preventDefault", "boundingBox", "elem", "onDrop", "event_1", "isFileTransfer_0", "pageY_0", "target_1", "dragData", "getData", "update", "draggedNode", "$getNodeByKey", "distanceFromScrollerElem_1", "targetBlockElem_0", "isFoundNodeEmptyParagraph_1", "targetNode", "$getNearestNodeFromDOMNode", "height", "targetBlockElemHeight", "top", "targetBlockElemTop", "getBoundingClientRectWithoutTransform", "isBelow_0", "window", "scrollY", "insertBefore", "remove", "insertAfter", "querySelectorAll", "forEach", "highlighter", "newInsertedElem", "getElementByKey", "getKey", "newInsertedElemRect", "highlightElem", "createElement", "className", "documentElement", "getAttribute", "backgroundColor", "transition", "zIndex", "pointerEvents", "boxSizing", "borderRadius", "position", "body", "appendChild", "left", "createPortal", "_jsxs", "Fragment", "children", "_jsx", "draggable", "onDragEnd", "onDragStart", "event_2", "dataTransfer_0", "nodeKey", "node", "setData", "ref", "DraggableBlockPlugin", "undefined", "useLexicalComposerContext", "_editable", "c", "_c", "ContentEditable", "useTranslation", "LexicalContentEditable", "t0", "$", "className", "t", "t1", "_jsx", "placeholder", "children", "LexicalEditor", "props", "$", "_c", "editorConfig", "editorContainerRef", "onChange", "editorConfigContext", "useEditorConfigContext", "editor", "useLexicalComposerContext", "floatingAnchorElem", "setFloatingAnchorElem", "useState", "t0", "Symbol", "for", "_floatingAnchorElem", "onRef", "t1", "t2", "uuid", "console", "error", "parentEditor", "registerChild", "handleFocus", "focusEditor", "handleBlur", "blurEditor", "unregisterFocus", "registerCommand", "FOCUS_COMMAND", "COMMAND_PRIORITY_LOW", "unregisterBlur", "BLUR_COMMAND", "unregisterChild", "useEffect", "isSmallWidthViewport", "setIsSmallWidthViewport", "t3", "t4", "updateViewPortWidth", "isNextSmallWidthViewport", "window", "matchMedia", "matches", "addEventListener", "removeEventListener", "t5", "features", "t6", "editorState", "editor_0", "tags", "has", "size", "t7", "_jsxs", "Fragment", "children", "isEditable", "_jsx", "DraggableBlockPlugin", "anchorElem", "AddBlockHandlePlugin", "plugins", "map", "plugin_1", "plugin", "position", "desktopOnly", "EditorPlugin", "clientProps", "key", "SlashMenuPlugin", "_temp", "className", "ref", "_temp2", "RichTextPlugin", "ErrorBoundary", "LexicalErrorBoundary", "contentEditable", "LexicalContentEditable", "OnChangePlugin", "ignoreSelectionChange", "HistoryPlugin", "markdownTransformers", "length", "MarkdownShortcutPlugin", "TabIndentationPlugin", "_temp3", "_temp4", "_temp5", "plugin_0", "plugin_2", "plugin_3", "plugin_4", "NestProviders", "children", "providers", "length", "Component", "_jsx", "slice", "LexicalProvider", "props", "editorConfig", "field", "onChange", "path", "readOnly", "value", "parentContext", "useEditorConfigContext", "editorContainerRef", "useRef", "processedValue", "useMemo", "processed", "features", "hooks", "load", "forEach", "hook", "incomingEditorState", "initialConfig", "Error", "JSON", "stringify", "Array", "isArray", "editable", "editorState", "undefined", "namespace", "lexical", "nodes", "getEnabledNodes", "onError", "error", "theme", "LexicalComposer", "EditorConfigProvider", "LexicalEditorComponent", "baseClass", "RichTextComponent", "props", "descriptionProps", "editorConfig", "errorProps", "field", "name", "_path", "pathFromProps", "admin", "className", "components", "Description", "Error", "Label", "readOnly", "readOnlyFromAdmin", "style", "width", "label", "required", "labelProps", "readOnlyFromTopLevelProps", "validate", "readOnlyFromProps", "memoizedValidate", "useCallback", "value", "validationOptions", "path", "pathFromContext", "readOnlyFromContext", "useFieldProps", "fieldType", "useField", "formInitializing", "formProcessing", "initialValue", "setValue", "showError", "disabled", "classes", "hideGutter", "filter", "Boolean", "join", "_jsxs", "_jsx", "FieldError", "CustomError", "alignCaret", "FieldLabel", "ErrorBoundary", "fallbackRender", "onReset", "LexicalProvider", "onChange", "editorState", "serializedEditorState", "toJSON", "features", "hooks", "save", "length", "forEach", "hook", "incomingEditorState", "JSON", "stringify", "FieldDescription", "error", "role", "color", "message", "RichText", "withCondition"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a as S,d as x}from"./chunk-LGUXX2QH.js";import{b as E}from"./chunk-NI6Z4GBD.js";import{jsx as i,jsxs as C}from"react/jsx-runtime";import{useLexicalComposerContext as W}from"@lexical/react/LexicalComposerContext.js";import{useLexicalNodeSelection as Y}from"@lexical/react/useLexicalNodeSelection.js";import{mergeRegister as H}from"@lexical/utils";import{getTranslation as U}from"@payloadcms/translations";import{Button as A,useConfig as q,useDocumentDrawer as z,usePayloadAPI as F,useTranslation as G}from"@payloadcms/ui";import{$getNodeByKey as M,$getSelection as J,$isNodeSelection as Q,CLICK_COMMAND as V,COMMAND_PRIORITY_LOW as _,KEY_BACKSPACE_COMMAND as X,KEY_DELETE_COMMAND as Z}from"lexical";import ee,{useCallback as g,useEffect as te,useReducer as oe,useRef as se,useState as ne}from"react";var t="lexical-relationship",O={depth:0},ie=d=>{let{data:{relationTo:T,value:l},nodeKey:s}=d,m=se(null),[o]=W(),[n,a,u]=Y(s),{field:h}=E(),{config:{collections:w,routes:{api:y},serverURL:B}}=q(),[r,le]=ne(()=>w.find(e=>e.slug===T)),{i18n:I,t:p}=G(),[R,K]=oe(e=>e+1,0),[{data:N},{setParams:v}]=F(`${B}${y}/${r.slug}/${l}`,{initialParams:O}),[L,P,{closeDrawer:D}]=z({id:l,collectionSlug:r.slug}),j=g(()=>{o.update(()=>{M(s).remove()})},[o,s]),k=ee.useCallback(({doc:e})=>{v({...O,cacheBust:R}),D(),K()},[R,v,D]),f=g(e=>{if(n&&Q(J())){e.preventDefault();let b=M(s);if(x(b))return b.remove(),!0}return!1},[n,s]),$=g(e=>{let c=e;return c.target===m.current||m.current?.contains(c.target)?(c.shiftKey?a(!n):n||(u(),a(!0)),!0):!1},[n,a,u]);return te(()=>H(o.registerCommand(V,$,_),o.registerCommand(Z,f,_),o.registerCommand(X,f,_)),[u,o,n,s,f,a,$]),C("div",{className:[t,n&&`${t}--selected`].filter(Boolean).join(" "),contentEditable:!1,ref:m,children:[C("div",{className:`${t}__wrap`,children:[i("p",{className:`${t}__label`,children:p("fields:labelRelationship",{label:U(r.labels.singular,I)})}),i(P,{className:`${t}__doc-drawer-toggler`,children:i("p",{className:`${t}__title`,children:N?N[r?.admin?.useAsTitle||"id"]:l})})]}),o.isEditable()&&C("div",{className:`${t}__actions`,children:[i(A,{buttonStyle:"icon-label",className:`${t}__swapButton`,disabled:h?.admin?.readOnly,el:"div",icon:"swap",onClick:()=>{o.dispatchCommand(S,{replace:{nodeKey:s}})},round:!0,tooltip:p("fields:swapRelationship")}),i(A,{buttonStyle:"icon-label",className:`${t}__removeButton`,disabled:h?.admin?.readOnly,icon:"x",onClick:e=>{e.preventDefault(),j()},round:!0,tooltip:p("fields:removeRelationship")})]}),l&&i(L,{onSave:k})]})},he=d=>i(ie,{...d});export{he as RelationshipComponent};
2
+ //# sourceMappingURL=RelationshipComponent-3QWBV4GT.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/relationship/client/components/RelationshipComponent.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ElementFormatType } from 'lexical'\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 { Button, useConfig, useDocumentDrawer, usePayloadAPI, useTranslation } 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, useReducer, useRef, useState } from 'react'\n\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport { $isRelationshipNode } from '../nodes/RelationshipNode.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-relationship'\n\nconst initialParams = {\n depth: 0,\n}\n\ntype Props = {\n className?: string\n data: RelationshipData\n format?: ElementFormatType\n nodeKey?: string\n}\n\nconst Component: React.FC<Props> = (props) => {\n const {\n data: { relationTo, value: id },\n nodeKey,\n } = props\n\n const relationshipElemRef = useRef<HTMLDivElement | null>(null)\n\n const [editor] = useLexicalComposerContext()\n const [isSelected, setSelected, clearSelection] = useLexicalNodeSelection(nodeKey)\n const { field } = useEditorConfigContext()\n const {\n config: {\n collections,\n routes: { api },\n serverURL,\n },\n } = useConfig()\n\n const [relatedCollection, setRelatedCollection] = useState(() =>\n collections.find((coll) => coll.slug === relationTo),\n )\n\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${id}`,\n { initialParams },\n )\n\n const [DocumentDrawer, DocumentDrawerToggler, { closeDrawer }] = useDocumentDrawer({\n id,\n collectionSlug: relatedCollection.slug,\n })\n\n const removeRelationship = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey).remove()\n })\n }, [editor, nodeKey])\n\n const updateRelationship = React.useCallback(\n ({ doc }) => {\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 closeDrawer()\n dispatchCacheBust()\n },\n [cacheBust, setParams, closeDrawer],\n )\n\n const $onDelete = useCallback(\n (payload: KeyboardEvent) => {\n if (isSelected && $isNodeSelection($getSelection())) {\n const event: KeyboardEvent = payload\n event.preventDefault()\n const node = $getNodeByKey(nodeKey)\n if ($isRelationshipNode(node)) {\n node.remove()\n return true\n }\n }\n return false\n },\n [isSelected, nodeKey],\n )\n const onClick = useCallback(\n (payload: MouseEvent) => {\n const event = payload\n // Check if relationshipElemRef.target or anything WITHIN relationshipElemRef.target was clicked\n if (\n event.target === relationshipElemRef.current ||\n relationshipElemRef.current?.contains(event.target as Node)\n ) {\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 return (\n <div\n className={[baseClass, isSelected && `${baseClass}--selected`].filter(Boolean).join(' ')}\n contentEditable={false}\n ref={relationshipElemRef}\n >\n <div className={`${baseClass}__wrap`}>\n <p className={`${baseClass}__label`}>\n {t('fields:labelRelationship', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n </p>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <p className={`${baseClass}__title`}>\n {data ? data[relatedCollection?.admin?.useAsTitle || 'id'] : id}\n </p>\n </DocumentDrawerToggler>\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swapButton`}\n disabled={field?.admin?.readOnly}\n el=\"div\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapRelationship')}\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 removeRelationship()\n }}\n round\n tooltip={t('fields:removeRelationship')}\n />\n </div>\n )}\n\n {id && <DocumentDrawer onSave={updateRelationship} />}\n </div>\n )\n}\n\nexport const RelationshipComponent = (props: Props): React.ReactNode => {\n return <Component {...props} />\n}\n"],
5
+ "mappings": "sJAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,2BAAAA,MAA+B,4CACxC,OAASC,iBAAAA,MAAqB,iBAC9B,OAASC,kBAAAA,MAAsB,2BAC/B,OAASC,UAAAA,EAAQC,aAAAA,EAAWC,qBAAAA,EAAmBC,iBAAAA,EAAeC,kBAAAA,MAAsB,iBACpF,OACEC,iBAAAA,EACAC,iBAAAA,EACAC,oBAAAA,EACAC,iBAAAA,EACAC,wBAAAA,EACAC,yBAAAA,EACAC,sBAAAA,MACK,UACP,OAAOC,IAASC,eAAAA,EAAaC,aAAAA,GAAWC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,OAAgB,QAS5E,IAAMC,EAAY,uBAEZC,EAAgB,CACpBC,MAAO,CACT,EASMC,GAA8BC,GAAA,CAClC,GAAM,CACJC,KAAM,CAAEC,WAAAA,EAAYC,MAAOC,CAAE,EAC7BC,QAAAA,CAAO,EACLL,EAEEM,EAAsBC,GAA8B,IAAA,EAEpD,CAACC,CAAA,EAAUC,EAAA,EACX,CAACC,EAAYC,EAAaC,CAAA,EAAkBC,EAAwBR,CAAA,EACpE,CAAES,MAAAA,CAAK,EAAKC,EAAA,EACZ,CACJC,OAAQ,CACNC,YAAAA,EACAC,OAAQ,CAAEC,IAAAA,CAAG,EACbC,UAAAA,CAAS,CACV,EACCC,EAAA,EAEE,CAACC,EAAmBC,EAAA,EAAwBC,GAAS,IACzDP,EAAYQ,KAAMC,GAASA,EAAKC,OAASzB,CAAA,CAAA,EAGrC,CAAE0B,KAAAA,EAAMC,EAAAA,CAAC,EAAKC,EAAA,EACd,CAACC,EAAWC,CAAA,EAAqBC,GAAYC,GAAUA,EAAQ,EAAG,CAAA,EAClE,CAAC,CAAEjC,KAAAA,CAAI,EAAI,CAAEkC,UAAAA,CAAS,CAAE,EAAIC,EAChC,GAAGhB,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LexicalComposerContext", "useLexicalNodeSelection", "mergeRegister", "getTranslation", "Button", "useConfig", "useDocumentDrawer", "usePayloadAPI", "useTranslation", "$getNodeByKey", "$getSelection", "$isNodeSelection", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_BACKSPACE_COMMAND", "KEY_DELETE_COMMAND", "React", "useCallback", "useEffect", "useReducer", "useRef", "useState", "baseClass", "initialParams", "depth", "Component", "props", "data", "relationTo", "value", "id", "nodeKey", "relationshipElemRef", "useRef", "editor", "useLexicalComposerContext", "isSelected", "setSelected", "clearSelection", "useLexicalNodeSelection", "field", "useEditorConfigContext", "config", "collections", "routes", "api", "serverURL", "useConfig", "relatedCollection", "setRelatedCollection", "useState", "find", "coll", "slug", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "setParams", "usePayloadAPI", "DocumentDrawer", "DocumentDrawerToggler", "closeDrawer", "useDocumentDrawer", "collectionSlug", "removeRelationship", "useCallback", "update", "$getNodeByKey", "remove", "updateRelationship", "React", "doc", "$onDelete", "payload", "$isNodeSelection", "$getSelection", "preventDefault", "node", "$isRelationshipNode", "onClick", "event", "target", "current", "contains", "shiftKey", "useEffect", "mergeRegister", "registerCommand", "CLICK_COMMAND", "COMMAND_PRIORITY_LOW", "KEY_DELETE_COMMAND", "KEY_BACKSPACE_COMMAND", "_jsxs", "className", "filter", "Boolean", "join", "contentEditable", "ref", "_jsx", "label", "getTranslation", "labels", "singular", "admin", "useAsTitle", "isEditable", "Button", "buttonStyle", "disabled", "readOnly", "el", "icon", "dispatchCommand", "INSERT_RELATIONSHIP_WITH_DRAWER_COMMAND", "replace", "round", "tooltip", "e", "onSave", "RelationshipComponent"]
7
+ }