@payloadcms/richtext-lexical 4.0.0-internal.a1317b2 → 4.0.0-internal.a2d053c

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 (448) hide show
  1. package/dist/exports/client/Field-334JNLRF.js +2 -0
  2. package/dist/exports/client/Field-334JNLRF.js.map +7 -0
  3. package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js → RelationshipComponent-TVK6I4W4.js} +2 -2
  4. package/dist/exports/client/chunk-BEKGION5.js +2 -0
  5. package/dist/exports/client/chunk-BEKGION5.js.map +7 -0
  6. package/dist/exports/client/{chunk-WSAPGI3Z.js → chunk-EA5BHQ2T.js} +1 -1
  7. package/dist/exports/client/{chunk-WSAPGI3Z.js.map → chunk-EA5BHQ2T.js.map} +1 -1
  8. package/dist/exports/client/chunk-FAJJXXCW.js +2 -0
  9. package/dist/exports/client/chunk-FAJJXXCW.js.map +7 -0
  10. package/dist/exports/client/{chunk-5VIL27GI.js → chunk-IYBYNEKX.js} +1 -1
  11. package/dist/exports/client/{chunk-5VIL27GI.js.map → chunk-IYBYNEKX.js.map} +1 -1
  12. package/dist/exports/client/chunk-SE5IITBK.js +2 -0
  13. package/dist/exports/client/chunk-SE5IITBK.js.map +7 -0
  14. package/dist/exports/client/{component-D5QLYS7W.js → component-QENB4QTS.js} +2 -2
  15. package/dist/exports/client/componentInline-AU7IBNY7.js +2 -0
  16. package/dist/exports/client/index.js +28 -28
  17. package/dist/exports/client/index.js.map +4 -4
  18. package/dist/features/align/client/index.js.map +1 -1
  19. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  20. package/dist/features/blocks/client/component/BlockReordering/index.d.ts +11 -0
  21. package/dist/features/blocks/client/component/BlockReordering/index.d.ts.map +1 -0
  22. package/dist/features/blocks/client/component/BlockReordering/index.js +18 -0
  23. package/dist/features/blocks/client/component/BlockReordering/index.js.map +1 -0
  24. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  25. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  26. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  27. package/dist/features/blocks/client/component/index.d.ts +0 -6
  28. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  29. package/dist/features/blocks/client/component/index.js +199 -109
  30. package/dist/features/blocks/client/component/index.js.map +1 -1
  31. package/dist/features/blocks/client/component/useBlockReordering.d.ts +16 -0
  32. package/dist/features/blocks/client/component/useBlockReordering.d.ts.map +1 -0
  33. package/dist/features/blocks/client/component/useBlockReordering.js +178 -0
  34. package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -0
  35. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  36. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  37. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  38. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  39. package/dist/features/blocks/client/componentInline/index.css +0 -1
  40. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  41. package/dist/features/blocks/client/componentInline/index.js +32 -30
  42. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  43. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
  44. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
  45. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
  46. package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
  47. package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
  48. package/dist/features/blocks/client/nodes/BlocksNode.js +0 -10
  49. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  50. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  51. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +121 -78
  52. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  53. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +142 -87
  54. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  55. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  56. package/dist/features/blocks/server/nodes/BlocksNode.js +1 -12
  57. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  58. package/dist/features/blocks/server/nodes/InlineBlocksNode.js +2 -2
  59. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  60. package/dist/features/blocks/server/schema.d.ts +2 -0
  61. package/dist/features/blocks/server/schema.d.ts.map +1 -1
  62. package/dist/features/blocks/server/schema.js +7 -9
  63. package/dist/features/blocks/server/schema.js.map +1 -1
  64. package/dist/features/blocks/server/validate.js +1 -1
  65. package/dist/features/blocks/server/validate.js.map +1 -1
  66. package/dist/features/converters/lexicalToHtml/async/converters/heading.js +1 -1
  67. package/dist/features/converters/lexicalToHtml/async/converters/heading.js.map +1 -1
  68. package/dist/features/converters/lexicalToHtml/async/converters/list.d.ts.map +1 -1
  69. package/dist/features/converters/lexicalToHtml/async/converters/list.js +4 -3
  70. package/dist/features/converters/lexicalToHtml/async/converters/list.js.map +1 -1
  71. package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
  72. package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
  73. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js +1 -1
  74. package/dist/features/converters/lexicalToHtml/sync/converters/heading.js.map +1 -1
  75. package/dist/features/converters/lexicalToHtml/sync/converters/list.d.ts.map +1 -1
  76. package/dist/features/converters/lexicalToHtml/sync/converters/list.js +4 -3
  77. package/dist/features/converters/lexicalToHtml/sync/converters/list.js.map +1 -1
  78. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
  79. package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
  80. package/dist/features/converters/lexicalToHtml/sync/types.d.ts.map +1 -1
  81. package/dist/features/converters/lexicalToHtml/sync/types.js.map +1 -1
  82. package/dist/features/converters/lexicalToJSX/converter/converters/heading.d.ts.map +1 -1
  83. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +2 -1
  84. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  85. package/dist/features/converters/lexicalToJSX/converter/converters/list.d.ts.map +1 -1
  86. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +2 -1
  87. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  88. package/dist/features/converters/lexicalToJSX/converter/converters/upload.d.ts.map +1 -1
  89. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -5
  90. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  91. package/dist/features/converters/utilities/payloadPopulateFn.d.ts.map +1 -1
  92. package/dist/features/converters/utilities/payloadPopulateFn.js +4 -2
  93. package/dist/features/converters/utilities/payloadPopulateFn.js.map +1 -1
  94. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  95. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  96. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  97. package/dist/features/heading/client/index.js.map +1 -1
  98. package/dist/features/heading/constants.d.ts +2 -0
  99. package/dist/features/heading/constants.d.ts.map +1 -0
  100. package/dist/features/heading/constants.js +2 -0
  101. package/dist/features/heading/constants.js.map +1 -0
  102. package/dist/features/heading/server/index.d.ts.map +1 -1
  103. package/dist/features/heading/server/index.js +5 -1
  104. package/dist/features/heading/server/index.js.map +1 -1
  105. package/dist/features/heading/server/validate.d.ts +6 -0
  106. package/dist/features/heading/server/validate.d.ts.map +1 -0
  107. package/dist/features/heading/server/validate.js +15 -0
  108. package/dist/features/heading/server/validate.js.map +1 -0
  109. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts +11 -1
  110. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.d.ts.map +1 -1
  111. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js +17 -0
  112. package/dist/features/horizontalRule/client/nodes/HorizontalRuleNode.js.map +1 -1
  113. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  114. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +2 -2
  115. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  116. package/dist/features/horizontalRule/server/schema.d.ts +1 -0
  117. package/dist/features/horizontalRule/server/schema.d.ts.map +1 -1
  118. package/dist/features/horizontalRule/server/schema.js +6 -5
  119. package/dist/features/horizontalRule/server/schema.js.map +1 -1
  120. package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
  121. package/dist/features/indent/client/IndentPlugin.js +122 -1
  122. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  123. package/dist/features/indent/client/index.d.ts.map +1 -1
  124. package/dist/features/indent/client/index.js +0 -2
  125. package/dist/features/indent/client/index.js.map +1 -1
  126. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  127. package/dist/features/indent/server/i18n.js +74 -37
  128. package/dist/features/indent/server/i18n.js.map +1 -1
  129. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  130. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  131. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +18 -7
  132. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  133. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
  134. package/dist/features/link/client/plugins/link/index.js.map +1 -1
  135. package/dist/features/link/markdownTransformer.js +2 -2
  136. package/dist/features/link/markdownTransformer.js.map +1 -1
  137. package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
  138. package/dist/features/link/nodes/AutoLinkNode.js +2 -10
  139. package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
  140. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  141. package/dist/features/link/nodes/LinkNode.js +2 -15
  142. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  143. package/dist/features/link/server/baseFields.js.map +1 -1
  144. package/dist/features/link/server/validate.js +1 -1
  145. package/dist/features/link/server/validate.js.map +1 -1
  146. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  147. package/dist/features/lists/checklist/server/index.js +5 -2
  148. package/dist/features/lists/checklist/server/index.js.map +1 -1
  149. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  150. package/dist/features/lists/orderedList/server/index.js +5 -2
  151. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  152. package/dist/features/lists/shared/constants.d.ts +2 -0
  153. package/dist/features/lists/shared/constants.d.ts.map +1 -0
  154. package/dist/features/lists/shared/constants.js +2 -0
  155. package/dist/features/lists/shared/constants.js.map +1 -0
  156. package/dist/features/lists/shared/schema.d.ts.map +1 -1
  157. package/dist/features/lists/shared/schema.js.map +1 -1
  158. package/dist/features/lists/shared/validate.d.ts +5 -0
  159. package/dist/features/lists/shared/validate.d.ts.map +1 -0
  160. package/dist/features/lists/shared/validate.js +15 -0
  161. package/dist/features/lists/shared/validate.js.map +1 -0
  162. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  163. package/dist/features/lists/unorderedList/server/index.js +5 -2
  164. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  165. package/dist/features/relationship/client/components/index.css +3 -6
  166. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  167. package/dist/features/relationship/client/index.d.ts +2 -2
  168. package/dist/features/relationship/client/index.d.ts.map +1 -1
  169. package/dist/features/relationship/client/index.js.map +1 -1
  170. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  171. package/dist/features/relationship/client/nodes/RelationshipNode.js +0 -3
  172. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  173. package/dist/features/relationship/client/plugins/index.d.ts +2 -2
  174. package/dist/features/relationship/client/plugins/index.d.ts.map +1 -1
  175. package/dist/features/relationship/client/plugins/index.js +27 -31
  176. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  177. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts +2 -4
  178. package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
  179. package/dist/features/relationship/client/utils/useEnabledRelationships.js +53 -20
  180. package/dist/features/relationship/client/utils/useEnabledRelationships.js.map +1 -1
  181. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts +2 -2
  182. package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
  183. package/dist/features/relationship/server/graphQLPopulationPromise.js +2 -2
  184. package/dist/features/relationship/server/graphQLPopulationPromise.js.map +1 -1
  185. package/dist/features/relationship/server/index.d.ts +8 -1
  186. package/dist/features/relationship/server/index.d.ts.map +1 -1
  187. package/dist/features/relationship/server/index.js +28 -11
  188. package/dist/features/relationship/server/index.js.map +1 -1
  189. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  190. package/dist/features/relationship/server/nodes/RelationshipNode.js +1 -5
  191. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  192. package/dist/features/relationship/server/schema.d.ts +3 -2
  193. package/dist/features/relationship/server/schema.d.ts.map +1 -1
  194. package/dist/features/relationship/server/schema.js +9 -12
  195. package/dist/features/relationship/server/schema.js.map +1 -1
  196. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts +1 -6
  197. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.d.ts.map +1 -1
  198. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js +1 -5
  199. package/dist/features/relationship/shared/filterEnabledRelationshipCollections.js.map +1 -1
  200. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts +8 -0
  201. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.d.ts.map +1 -0
  202. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js +19 -0
  203. package/dist/features/table/client/plugins/TableActionMenuPlugin/computeSelectionCount.js.map +1 -0
  204. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +1 -2
  205. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  206. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js +17 -44
  207. package/dist/features/table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  208. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  209. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js +47 -24
  210. package/dist/features/table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  211. package/dist/features/table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  212. package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
  213. package/dist/features/table/client/plugins/TablePlugin/index.js +54 -18
  214. package/dist/features/table/client/plugins/TablePlugin/index.js.map +1 -1
  215. package/dist/features/table/client/utils/useDebounce.js.map +1 -1
  216. package/dist/features/textState/defaultColors.js +1 -1
  217. package/dist/features/textState/defaultColors.js.map +1 -1
  218. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.js.map +1 -1
  219. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  220. package/dist/features/toolbars/fixed/client/Toolbar/index.js +141 -70
  221. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  222. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  223. package/dist/features/toolbars/inline/client/Toolbar/index.js +84 -37
  224. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  225. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  226. package/dist/features/toolbars/shared/ToolbarButton/index.js +27 -2
  227. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  228. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  229. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +199 -81
  230. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  231. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +16 -12
  232. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  233. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +22 -6
  234. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  235. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts +5 -0
  236. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.d.ts.map +1 -0
  237. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js +109 -0
  238. package/dist/features/toolbars/shared/useToolbarKeyboardNavigation.js.map +1 -0
  239. package/dist/features/typesServer.d.ts +16 -11
  240. package/dist/features/typesServer.d.ts.map +1 -1
  241. package/dist/features/typesServer.js.map +1 -1
  242. package/dist/features/upload/client/component/index.css +0 -2
  243. package/dist/features/upload/client/drawer/index.js.map +1 -1
  244. package/dist/features/upload/client/index.d.ts +3 -2
  245. package/dist/features/upload/client/index.d.ts.map +1 -1
  246. package/dist/features/upload/client/index.js.map +1 -1
  247. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  248. package/dist/features/upload/client/nodes/UploadNode.js +0 -7
  249. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  250. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  251. package/dist/features/upload/client/plugin/index.js +50 -53
  252. package/dist/features/upload/client/plugin/index.js.map +1 -1
  253. package/dist/features/upload/server/graphQLPopulationPromise.d.ts +2 -2
  254. package/dist/features/upload/server/graphQLPopulationPromise.d.ts.map +1 -1
  255. package/dist/features/upload/server/graphQLPopulationPromise.js +1 -1
  256. package/dist/features/upload/server/graphQLPopulationPromise.js.map +1 -1
  257. package/dist/features/upload/server/index.d.ts +7 -3
  258. package/dist/features/upload/server/index.d.ts.map +1 -1
  259. package/dist/features/upload/server/index.js +18 -14
  260. package/dist/features/upload/server/index.js.map +1 -1
  261. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  262. package/dist/features/upload/server/nodes/UploadNode.js +1 -9
  263. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  264. package/dist/features/upload/server/schema.d.ts +4 -16
  265. package/dist/features/upload/server/schema.d.ts.map +1 -1
  266. package/dist/features/upload/server/schema.js +8 -10
  267. package/dist/features/upload/server/schema.js.map +1 -1
  268. package/dist/features/upload/server/validate.d.ts +2 -2
  269. package/dist/features/upload/server/validate.d.ts.map +1 -1
  270. package/dist/features/upload/server/validate.js +4 -1
  271. package/dist/features/upload/server/validate.js.map +1 -1
  272. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  273. package/dist/field/Diff/converters/listitem/index.js +2 -1
  274. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  275. package/dist/field/Diff/converters/relationship/index.css +0 -1
  276. package/dist/field/Diff/converters/unknown/index.css +0 -1
  277. package/dist/field/Diff/converters/upload/index.css +0 -1
  278. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  279. package/dist/field/Diff/index.css +0 -2
  280. package/dist/field/Diff/index.d.ts +3 -2
  281. package/dist/field/Diff/index.d.ts.map +1 -1
  282. package/dist/field/Diff/index.js +3 -2
  283. package/dist/field/Diff/index.js.map +1 -1
  284. package/dist/field/Field.d.ts.map +1 -1
  285. package/dist/field/Field.js +8 -1
  286. package/dist/field/Field.js.map +1 -1
  287. package/dist/field/RenderLexical/index.d.ts +3 -1
  288. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  289. package/dist/field/RenderLexical/index.js +23 -23
  290. package/dist/field/RenderLexical/index.js.map +1 -1
  291. package/dist/field/ViewSelector.d.ts.map +1 -1
  292. package/dist/field/ViewSelector.js +13 -4
  293. package/dist/field/ViewSelector.js.map +1 -1
  294. package/dist/field/bundled.css +1 -1
  295. package/dist/field/index.css +0 -1
  296. package/dist/field/index.js.map +1 -1
  297. package/dist/field/rscEntry.d.ts +2 -2
  298. package/dist/field/rscEntry.d.ts.map +1 -1
  299. package/dist/field/rscEntry.js.map +1 -1
  300. package/dist/i18n.d.ts.map +1 -1
  301. package/dist/i18n.js +44 -0
  302. package/dist/i18n.js.map +1 -1
  303. package/dist/index.d.ts +4 -4
  304. package/dist/index.d.ts.map +1 -1
  305. package/dist/index.js +23 -1
  306. package/dist/index.js.map +1 -1
  307. package/dist/lexical/LexicalEditor.css +21 -10
  308. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  309. package/dist/lexical/LexicalEditor.js +61 -64
  310. package/dist/lexical/LexicalEditor.js.map +1 -1
  311. package/dist/lexical/plugins/ClipboardPlugin/index.js.map +1 -1
  312. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  313. package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
  314. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  315. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
  316. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  317. package/dist/lexical/plugins/MarkdownShortcut/index.js.map +1 -1
  318. package/dist/lexical/plugins/NodeViewOverridePlugin/index.js.map +1 -1
  319. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +235 -88
  320. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  321. package/dist/lexical/plugins/SlashMenu/index.css +0 -1
  322. package/dist/lexical/plugins/SlashMenu/useMenuTriggerMatch.js.map +1 -1
  323. package/dist/lexical/plugins/TextPlugin/index.js.map +1 -1
  324. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
  325. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
  326. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  327. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +17 -0
  328. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  329. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +139 -37
  330. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  331. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts +7 -0
  332. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.d.ts.map +1 -0
  333. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js +15 -0
  334. package/dist/lexical/plugins/handles/DraggableBlockPlugin/moveBlock.js.map +1 -0
  335. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts +7 -0
  336. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.d.ts.map +1 -0
  337. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js +62 -0
  338. package/dist/lexical/plugins/handles/DraggableBlockPlugin/useKeyboardReordering.js.map +1 -0
  339. package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
  340. package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
  341. package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
  342. package/dist/lexical/theme/EditorTheme.css +0 -2
  343. package/dist/lexical/ui/ContentEditable.d.ts +2 -1
  344. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  345. package/dist/lexical/ui/ContentEditable.js +32 -11
  346. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  347. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  348. package/dist/lexical/ui/icons/H3/index.js +13 -6
  349. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  350. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  351. package/dist/lexical/ui/icons/H4/index.js +13 -6
  352. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  353. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  354. package/dist/lexical/ui/icons/H5/index.js +13 -6
  355. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  356. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  357. package/dist/lexical/ui/icons/H6/index.js +13 -6
  358. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  359. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  360. package/dist/lexical/utils/nodeFormat.js +0 -2
  361. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  362. package/dist/lexical/utils/url.d.ts.map +1 -1
  363. package/dist/lexical/utils/url.js +1 -1
  364. package/dist/lexical/utils/url.js.map +1 -1
  365. package/dist/populateGraphQL/populate.js.map +1 -1
  366. package/dist/presets/llmInstructions.d.ts +2 -0
  367. package/dist/presets/llmInstructions.d.ts.map +1 -0
  368. package/dist/presets/llmInstructions.js +13 -0
  369. package/dist/presets/llmInstructions.js.map +1 -0
  370. package/dist/types/builtInNodes.d.ts +1 -1
  371. package/dist/types/builtInNodes.d.ts.map +1 -1
  372. package/dist/types/builtInNodes.js +8 -3
  373. package/dist/types/builtInNodes.js.map +1 -1
  374. package/dist/types/index.d.ts +3 -6
  375. package/dist/types/index.d.ts.map +1 -1
  376. package/dist/types/index.js.map +1 -1
  377. package/dist/types/jsonSchemaHelpers.d.ts +5 -1
  378. package/dist/types/jsonSchemaHelpers.d.ts.map +1 -1
  379. package/dist/types/jsonSchemaHelpers.js +7 -2
  380. package/dist/types/jsonSchemaHelpers.js.map +1 -1
  381. package/dist/types/nodeTypes.d.ts +5 -0
  382. package/dist/types/nodeTypes.d.ts.map +1 -1
  383. package/dist/types/nodeTypes.js.map +1 -1
  384. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  385. package/dist/utilities/buildEditorState.js.map +1 -1
  386. package/dist/utilities/buildInitialState.d.ts +3 -2
  387. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  388. package/dist/utilities/buildInitialState.js +1 -0
  389. package/dist/utilities/buildInitialState.js.map +1 -1
  390. package/dist/utilities/fieldsDrawer/Drawer.js +36 -36
  391. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  392. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  393. package/dist/utilities/fieldsDrawer/DrawerContent.js +6 -9
  394. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  395. package/dist/utilities/fieldsDrawer/useDrawerSubmit.js.map +1 -1
  396. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  397. package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
  398. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  399. package/dist/utilities/generateImportMap.d.ts +2 -2
  400. package/dist/utilities/generateImportMap.d.ts.map +1 -1
  401. package/dist/utilities/generateImportMap.js.map +1 -1
  402. package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
  403. package/dist/utilities/initLexicalFeatures.js +38 -4
  404. package/dist/utilities/initLexicalFeatures.js.map +1 -1
  405. package/dist/utilities/upgradeLexicalData/index.js +6 -3
  406. package/dist/utilities/upgradeLexicalData/index.js.map +1 -1
  407. package/dist/utilities/useLexicalFeature.js +15 -6
  408. package/dist/utilities/useLexicalFeature.js.map +1 -1
  409. package/dist/utilities/useRunDeprioritized.js.map +1 -1
  410. package/dist/validate/hasText.d.ts +2 -2
  411. package/dist/validate/hasText.d.ts.map +1 -1
  412. package/dist/validate/hasText.js.map +1 -1
  413. package/dist/validate/index.d.ts +1 -1
  414. package/dist/validate/index.d.ts.map +1 -1
  415. package/package.json +50 -53
  416. package/dist/dependencyChecker.spec.js +0 -16
  417. package/dist/dependencyChecker.spec.js.map +0 -1
  418. package/dist/exports/client/Field-F22V5L4V.js +0 -2
  419. package/dist/exports/client/Field-F22V5L4V.js.map +0 -7
  420. package/dist/exports/client/bundled.css +0 -1
  421. package/dist/exports/client/chunk-43E5QYAA.js +0 -2
  422. package/dist/exports/client/chunk-43E5QYAA.js.map +0 -7
  423. package/dist/exports/client/chunk-ESITTE3C.js +0 -2
  424. package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
  425. package/dist/exports/client/chunk-LN6VX25I.js +0 -2
  426. package/dist/exports/client/chunk-LN6VX25I.js.map +0 -7
  427. package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
  428. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
  429. package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
  430. package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
  431. package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
  432. package/dist/features/converters/lexicalToHtml/sync/alignment.spec.js +0 -92
  433. package/dist/features/converters/lexicalToHtml/sync/alignment.spec.js.map +0 -1
  434. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js +0 -180
  435. package/dist/features/converters/lexicalToPlaintext/convertLexicalToPlaintext.spec.js.map +0 -1
  436. package/dist/features/link/markdownTransformer.spec.js +0 -195
  437. package/dist/features/link/markdownTransformer.spec.js.map +0 -1
  438. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js +0 -65
  439. package/dist/features/toolbars/fixed/client/Toolbar/horizontalWheelScroll.spec.js.map +0 -1
  440. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js +0 -88
  441. package/dist/lexical/utils/markdown/convertFromMarkdownString.spec.js.map +0 -1
  442. package/dist/lexical/utils/url.spec.js +0 -114
  443. package/dist/lexical/utils/url.spec.js.map +0 -1
  444. package/dist/utilities/jsx/jsx.spec.js +0 -178
  445. package/dist/utilities/jsx/jsx.spec.js.map +0 -1
  446. /package/dist/exports/client/{RelationshipComponent-YCPAKOL7.js.map → RelationshipComponent-TVK6I4W4.js.map} +0 -0
  447. /package/dist/exports/client/{component-D5QLYS7W.js.map → component-QENB4QTS.js.map} +0 -0
  448. /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-AU7IBNY7.js.map} +0 -0
@@ -3,7 +3,7 @@
3
3
  import { c as _c } from "react/compiler-runtime";
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
5
5
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
6
- import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
6
+ import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $onUpdate, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
7
7
  import { useEffect } from 'react';
8
8
  import './index.css';
9
9
  // TODO: This should ideally be fixed in Lexical. See
@@ -15,7 +15,22 @@ export function DecoratorPlugin() {
15
15
  let t0;
16
16
  let t1;
17
17
  if ($[0] !== editor) {
18
- t0 = () => mergeRegister(editor.registerCommand(CLICK_COMMAND, _temp3, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(SELECTION_CHANGE_COMMAND, _temp4, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, _temp6, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, _temp8, COMMAND_PRIORITY_LOW));
18
+ t0 = () => mergeRegister(editor.registerCommand(CLICK_COMMAND, _temp3, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW), editor.registerCommand(SELECTION_CHANGE_COMMAND, (_, activeEditor) => {
19
+ if (activeEditor !== editor) {
20
+ return false;
21
+ }
22
+ const hasSelectedDecorator = Boolean($getSelectedDecorator());
23
+ $onUpdate(() => {
24
+ activeEditor.read("latest", () => {
25
+ const decorator_0 = $getSelectedDecorator();
26
+ document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
27
+ if (decorator_0) {
28
+ activeEditor.getElementByKey(decorator_0.getKey())?.classList.add("decorator-selected");
29
+ }
30
+ });
31
+ });
32
+ return hasSelectedDecorator;
33
+ }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_UP_COMMAND, _temp5, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_ARROW_DOWN_COMMAND, _temp7, COMMAND_PRIORITY_LOW));
19
34
  t1 = [editor];
20
35
  $[0] = editor;
21
36
  $[1] = t0;
@@ -27,7 +42,7 @@ export function DecoratorPlugin() {
27
42
  useEffect(t0, t1);
28
43
  return null;
29
44
  }
30
- function _temp8(event_2) {
45
+ function _temp7(event_2) {
31
46
  const selection_1 = $getSelection();
32
47
  if ($isNodeSelection(selection_1)) {
33
48
  event_2.preventDefault();
@@ -59,7 +74,7 @@ function _temp8(event_2) {
59
74
  }
60
75
  const lastPoint = selection_1.isBackward() ? selection_1.anchor : selection_1.focus;
61
76
  const lastNode = lastPoint.getNode();
62
- const lastSelectedBlock = $findMatchingParent(lastNode, _temp7);
77
+ const lastSelectedBlock = $findMatchingParent(lastNode, _temp6);
63
78
  const nextBlock = lastSelectedBlock?.getNextSibling();
64
79
  if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {
65
80
  return false;
@@ -77,10 +92,10 @@ function _temp8(event_2) {
77
92
  }
78
93
  return false;
79
94
  }
80
- function _temp7(node_1) {
95
+ function _temp6(node_1) {
81
96
  return findLaterSiblingBlock(node_1) !== null;
82
97
  }
83
- function _temp6(event_1) {
98
+ function _temp5(event_1) {
84
99
  const selection_0 = $getSelection();
85
100
  if ($isNodeSelection(selection_0)) {
86
101
  const prevSibling = selection_0.getNodes()[0]?.getPreviousSibling();
@@ -113,7 +128,7 @@ function _temp6(event_1) {
113
128
  }
114
129
  const firstPoint = selection_0.isBackward() ? selection_0.anchor : selection_0.focus;
115
130
  const firstNode = firstPoint.getNode();
116
- const firstSelectedBlock = $findMatchingParent(firstNode, _temp5);
131
+ const firstSelectedBlock = $findMatchingParent(firstNode, _temp4);
117
132
  const prevBlock = firstSelectedBlock?.getPreviousSibling();
118
133
  if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {
119
134
  return false;
@@ -131,18 +146,9 @@ function _temp6(event_1) {
131
146
  }
132
147
  return false;
133
148
  }
134
- function _temp5(node_0) {
149
+ function _temp4(node_0) {
135
150
  return findFirstSiblingBlock(node_0) !== null;
136
151
  }
137
- function _temp4() {
138
- const decorator_0 = $getSelectedDecorator();
139
- document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
140
- if (decorator_0) {
141
- decorator_0.element?.classList.add("decorator-selected");
142
- return true;
143
- }
144
- return false;
145
- }
146
152
  function _temp3(event_0) {
147
153
  document.querySelector(".decorator-selected")?.classList.remove("decorator-selected");
148
154
  const decorator = $getDecoratorByMouseEvent(event_0);
@@ -196,10 +202,7 @@ function $getSelectedDecorator() {
196
202
  return undefined;
197
203
  }
198
204
  const node = nodes[0];
199
- return $isDecoratorNode(node) ? {
200
- decorator: node,
201
- element: $getEditor().getElementByKey(node.getKey())
202
- } : undefined;
205
+ return $isDecoratorNode(node) ? node : undefined;
203
206
  }
204
207
  function $selectDecorator({
205
208
  element,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","mergeRegister","$createNodeSelection","$getEditor","$getNearestNodeFromDOMNode","$getSelection","$isDecoratorNode","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","SELECTION_CHANGE_COMMAND","useEffect","DecoratorPlugin","$","editor","$onDelete","_temp2","t0","t1","registerCommand","_temp3","_temp4","_temp6","_temp8","event_2","selection_1","selection","event","preventDefault","nextSibling","getNodes","getNextSibling","element_0","getElementByKey","getKey","element","$selectDecorator","firstDescendant","getFirstDescendant","block_0","INTERNAL_$isBlock","block","selectEnd","lastPoint","isBackward","anchor","focus","lastNode","getNode","lastSelectedBlock","_temp7","nextBlock","findLaterSiblingBlock","nextBlockElement","node","node_1","event_1","selection_0","prevSibling","getPreviousSibling","lastDescendant","getLastDescendant","selectStart","firstPoint","firstNode","firstSelectedBlock","_temp5","prevBlock","findFirstSiblingBlock","prevBlockElement","node_0","decorator_0","$getSelectedDecorator","document","querySelector","classList","remove","decorator","add","event_0","$getDecoratorByMouseEvent","target","isInteractive","HTMLElement","isContentEditable","closest","forEach","_temp","undefined","nodes","length","scrollIntoView","behavior","isInline","firstChild","getFirstChild","isLeafElement","canBeEmpty","current"],"sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.css'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n 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 editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n decorator.element?.classList.add('decorator-selected')\n return true\n }\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node)\n ? {\n decorator: node,\n element: $getEditor().getElementByKey(node.getKey()),\n }\n : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,oBAAoB,EACpBC,UAAU,EACVC,0BAA0B,EAC1BC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,SAAS,QAAQ;AAE1B,OAAO;AAEP;AACA;AACA,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAAzB,EAAA;EACL,OAAA0B,MAAA,IAAiBzB,yBAAA;EAEjB,MAAA0B,SAAA,GAAAC,MAAA;EAUA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAE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MwC,UAAA,GAAaxC,IAAA,CAAKyC,aAAa;EACrC,MAAMC,aAAA,GACJF,UAAA,KAAe,QACfhG,gBAAA,CAAiBgG,UAAA,KACjB5F,WAAA,CAAY4F,UAAA,KACZA,UAAA,CAAWD,QAAQ;EAErB,OAAO,CAACvC,IAAA,CAAKuC,QAAQ,MAAMvC,IAAA,CAAK2C,UAAU,OAAO,SAASD,aAAA;AAC5D;AAEA,SAAS5C,sBAAsBE,IAAiB;EAC9C,IAAI4C,OAAA,GAAU5C,IAAA,CAAKvB,cAAc;EACjC,OAAOmE,OAAA,KAAY,MAAM;IACvB,IAAI1D,iBAAA,CAAkB0D,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQnE,cAAc;EAClC;EACA,OAAO;AACT;AAEA,SAASqC,sBAAsBd,IAAiB;EAC9C,IAAI4C,OAAA,GAAU5C,IAAA,CAAKK,kBAAkB;EACrC,OAAOuC,OAAA,KAAY,MAAM;IACvB,IAAI1D,iBAAA,CAAkB0D,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQvC,kBAAkB;EACtC;EACA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","mergeRegister","$createNodeSelection","$getEditor","$getNearestNodeFromDOMNode","$getSelection","$isDecoratorNode","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$onUpdate","$setSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","SELECTION_CHANGE_COMMAND","useEffect","DecoratorPlugin","$","editor","$onDelete","_temp2","t0","t1","registerCommand","_temp3","_","activeEditor","hasSelectedDecorator","Boolean","$getSelectedDecorator","read","decorator_0","document","querySelector","classList","remove","decorator","getElementByKey","getKey","add","_temp5","_temp7","event_2","selection_1","selection","event","preventDefault","nextSibling","getNodes","getNextSibling","element_0","element","$selectDecorator","firstDescendant","getFirstDescendant","block_0","INTERNAL_$isBlock","block","selectEnd","lastPoint","isBackward","anchor","focus","lastNode","getNode","lastSelectedBlock","_temp6","nextBlock","findLaterSiblingBlock","nextBlockElement","node","node_1","event_1","selection_0","prevSibling","getPreviousSibling","lastDescendant","getLastDescendant","selectStart","firstPoint","firstNode","firstSelectedBlock","_temp4","prevBlock","findFirstSiblingBlock","prevBlockElement","node_0","event_0","$getDecoratorByMouseEvent","target","isInteractive","HTMLElement","isContentEditable","closest","forEach","_temp","undefined","nodes","length","scrollIntoView","behavior","isInline","firstChild","getFirstChild","isLeafElement","canBeEmpty","current"],"sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $onUpdate,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.css'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n 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 editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n (_, activeEditor) => {\n // Nested editors reconcile independently and update their own highlight.\n if (activeEditor !== editor) {\n return false\n }\n const hasSelectedDecorator = Boolean($getSelectedDecorator())\n $onUpdate(() => {\n activeEditor.read('latest', () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n activeEditor\n .getElementByKey(decorator.getKey())\n ?.classList.add('decorator-selected')\n }\n })\n })\n return hasSelectedDecorator\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node) ? node : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,oBAAoB,EACpBC,UAAU,EACVC,0BAA0B,EAC1BC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,SAAS,EACTC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,SAAS,QAAQ;AAE1B,OAAO;AAEP;AACA;AACA,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAA1B,EAAA;EACL,OAAA2B,MAAA,IAAiB1B,yBAAA;EAEjB,MAAA2B,SAAA,GAAkBC,MAUlB;EAAA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAEUG,EAAA,GAAAA,CAAA,KACD3B,aAAA,CACLwB,MAAA,CAAAK,eAAsB,CACpBf,aAAA,EACAgB,MAmBA,EACAf,oBAAA,GAEFS,MAAA,CAAAK,eAAsB,CAACV,kBAAA,EAAoBM,SAAA,EAAWV,oBAAA,GACtDS,MAAA,CAAAK,eAAsB,CAACX,qBAAA,EAAuB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Aa;EACrC,MAAMC,aAAA,GACJF,UAAA,KAAe,QACfrG,gBAAA,CAAiBqG,UAAA,KACjBjG,WAAA,CAAYiG,UAAA,KACZA,UAAA,CAAWD,QAAQ;EAErB,OAAO,CAAC/B,IAAA,CAAK+B,QAAQ,MAAM/B,IAAA,CAAKmC,UAAU,OAAO,SAASD,aAAA;AAC5D;AAEA,SAASpC,sBAAsBE,IAAiB;EAC9C,IAAIoC,OAAA,GAAUpC,IAAA,CAAKrB,cAAc;EACjC,OAAOyD,OAAA,KAAY,MAAM;IACvB,IAAIlD,iBAAA,CAAkBkD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQzD,cAAc;EAClC;EACA,OAAO;AACT;AAEA,SAASmC,sBAAsBd,IAAiB;EAC9C,IAAIoC,OAAA,GAAUpC,IAAA,CAAKK,kBAAkB;EACrC,OAAO+B,OAAA,KAAY,MAAM;IACvB,IAAIlD,iBAAA,CAAkBkD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQ/B,kBAAkB;EACtC;EACA,OAAO;AACT","ignoreList":[]}
@@ -13,7 +13,8 @@
13
13
  position: relative;
14
14
  padding: var(--spacer-1) var(--spacer-2) var(--spacer-1) 0;
15
15
 
16
- &:hover {
16
+ &:hover,
17
+ &:focus-visible {
17
18
  cursor: pointer;
18
19
 
19
20
  .insert-paragraph-at-end-inside {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useTranslation","$createParagraphNode","$getRoot","React","useEditorConfigContext","AddIcon","baseClass","InsertParagraphAtEndPlugin","$","editor","editorConfig","t","admin","hideInsertParagraphAtEnd","t0","update","_temp","onClick","t1","_jsx","className","type","children","size","paragraphNode","append","select"],"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.css'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport { AddIcon } from '../../ui/icons/Add/index.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n const { t } = useTranslation<{}, string>()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n <button\n aria-label={t('lexical:general:insertParagraph')}\n className={baseClass}\n onClick={onClick}\n type=\"button\"\n >\n <span className={`${baseClass}-inside`}>\n <AddIcon size={16} />\n </span>\n </button>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAC/C,OAAOC,KAAA,MAAW;AAElB,OAAO;AACP,SAASC,sBAAsB,QAAQ;AACvC,SAASC,OAAO,QAAQ;AACxB,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,0BAAA,GAAuCA,CAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAClD,OAAAW,MAAA,IAAiBV,yBAAA;EACjB;IAAAW;EAAA,IAAyBN,sBAAA;EACzB;IAAAO;EAAA,IAAcX,cAAA;EAAA,IAEVU,YAAA,EAAAE,KAAA,EAAAC,wBAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAN,CAAA,QAAAC,MAAA;IAIYK,EAAA,GAAAA,CAAA;MACdL,MAAA,CAAAM,MAAA,CAAAC,KAIA;IAAA;IACFR,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EANA,MAAAS,OAAA,GAAgBH,EAMhB;EAAA,IAAAI,EAAA;EAAA,IAAAV,CAAA,QAAAS,OAAA,IAAAT,CAAA,QAAAG,CAAA;IAGEO,EAAA,GAAAC,IAAA,CAAC;MAAA,cACaR,CAAA,CAAE;MAAAS,SAAA,EAAAd,SAAA;MAAAW,OAAA;MAAAI,IAAA,EAGT;MAAAC,QAAA,EAELH,IAAA,CAAC;QAAAC,SAAA,EAAgB,GAAAd,SAAA,SAAqB;QAAAgB,QAAA,EACpCH,IAAA,CAAAd,OAAA;UAAAkB,IAAA;QAAA,C;;;;;;;;;SAPJL,E;CAWJ;AA7BoD,SAAAF,MAAA;EAW9C,MAAAQ,aAAA,GAAsBvB,oBAAA;EACtBC,QAAA,GAAAuB,MAAA,CAAkBD,aAAA;EAClBA,aAAA,CAAAE,MAAA,CAAoB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useTranslation","$createParagraphNode","$getRoot","React","useEditorConfigContext","AddIcon","baseClass","InsertParagraphAtEndPlugin","$","editor","editorConfig","t","admin","hideInsertParagraphAtEnd","t0","update","_temp","onClick","t1","_jsx","className","type","children","size","paragraphNode","append","select"],"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useTranslation } from '@payloadcms/ui'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.css'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nimport { AddIcon } from '../../ui/icons/Add/index.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n const { t } = useTranslation<{}, string>()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n <button\n aria-label={t('lexical:general:insertParagraph')}\n className={baseClass}\n onClick={onClick}\n type=\"button\"\n >\n <span className={`${baseClass}-inside`}>\n <AddIcon size={16} />\n </span>\n </button>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,cAAc,QAAQ;AAC/B,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAC/C,OAAOC,KAAA,MAAW;AAElB,OAAO;AACP,SAASC,sBAAsB,QAAQ;AACvC,SAASC,OAAO,QAAQ;AACxB,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,0BAAA,GAAuCA,CAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAClD,OAAAW,MAAA,IAAiBV,yBAAA;EACjB;IAAAW;EAAA,IAAyBN,sBAAA;EACzB;IAAAO;EAAA,IAAcX,cAAA;EAEd,IAAIU,YAAA,EAAAE,KAAqB,EAAAC,wBAAA;IAAA,OAChB;EAAA;EACT,IAAAC,EAAA;EAAA,IAAAN,CAAA,QAAAC,MAAA;IAEgBK,EAAA,GAAAA,CAAA;MACdL,MAAA,CAAAM,MAAa,CAACC,KAId;IAAA,CACF;IAAAR,CAAA,MAAAC,MAAA;IAAAD,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EANA,MAAAS,OAAA,GAAgBH,EAMhB;EAAA,IAAAI,EAAA;EAAA,IAAAV,CAAA,QAAAS,OAAA,IAAAT,CAAA,QAAAG,CAAA;IAGEO,EAAA,GAAAC,IAAA,CAAC;MAAA,cACaR,CAAA,CAAE;MAAAS,SAAA,EACHd,SAAA;MAAAW,OAAA;MAAAI,IAAA,EAEN;MAAAC,QAAA,EAELH,IAAA,CAAC;QAAAC,SAAA,EAAgB,GAAGd,SAAA,SAAkB;QAAAgB,QAAA,EACpCH,IAAA,CAACd,OAAA;UAAAkB,IAAA,EAAc;;;;;;;;;;SAPnBL,E;CAWJ;AA7BoD,SAAAF,MAAA;EAW9C,MAAAQ,aAAA,GAAsBvB,oBAAA;EACtBC,QAAA,GAAAuB,MAAiB,CAACD,aAAA;EAClBA,aAAA,CAAAE,MAAoB;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","registerMarkdownShortcuts","useLexicalComposerContext","React","useEditorConfigContext","MarkdownShortcutPlugin","$","editorConfig","editor","t0","t1","features","markdownTransformers","useEffect"],"sources":["../../../../src/lexical/plugins/MarkdownShortcut/index.tsx"],"sourcesContent":["'use client'\n\nimport { registerMarkdownShortcuts } from '@lexical/markdown'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,yBAAyB,QAAQ;AAC1C,YAAYC,KAAA,MAAW;AAEvB,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,sBAAA,GAAmCA,CAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAC9C;IAAAO;EAAA,IAAyBH,sBAAA;EACzB,OAAAI,MAAA,IAAiBN,yBAAA;EAAA,IAAAO,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAJ,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAEDH,EAAA,GAAAA,CAAA,KACPR,yBAAA,CAA0BO,MAAA,EAAQD,YAAA,CAAAI,QAAA,CAAAC,oBAAA,MAAgD;IACxFF,EAAA,IAACF,MAAA,EAAQD,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAA2CN,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAAAN,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAD,EAAA,GAAAH,CAAA;IAAAI,EAAA,GAAAJ,CAAA;EAAA;EAFvDH,KAAA,CAAAU,SAAA,CAAgBJ,EAEhB,EAAGC,EAAoD;EAAA;AAAA,CAGzD","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","registerMarkdownShortcuts","useLexicalComposerContext","React","useEditorConfigContext","MarkdownShortcutPlugin","$","editorConfig","editor","t0","t1","features","markdownTransformers","useEffect"],"sources":["../../../../src/lexical/plugins/MarkdownShortcut/index.tsx"],"sourcesContent":["'use client'\n\nimport { registerMarkdownShortcuts } from '@lexical/markdown'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport * as React from 'react'\n\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\n\nexport const MarkdownShortcutPlugin: React.FC = () => {\n const { editorConfig } = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n\n React.useEffect(() => {\n return registerMarkdownShortcuts(editor, editorConfig.features.markdownTransformers ?? [])\n }, [editor, editorConfig.features.markdownTransformers])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,yBAAyB,QAAQ;AAC1C,YAAYC,KAAA,MAAW;AAEvB,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,sBAAA,GAAmCA,CAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAC9C;IAAAO;EAAA,IAAyBH,sBAAA;EACzB,OAAAI,MAAA,IAAiBN,yBAAA;EAAA,IAAAO,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAJ,CAAA,QAAAE,MAAA,IAAAF,CAAA,QAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAEDH,EAAA,GAAAA,CAAA,KACPR,yBAAA,CAA0BO,MAAA,EAAQD,YAAA,CAAAI,QAAqB,CAAAC,oBAA2B,IAAhD,EAAgD,CAC3F;IAAGF,EAAA,IAACF,MAAA,EAAQD,YAAA,CAAAI,QAAqB,CAAAC,oBAAqB,CAAC;IAAAN,CAAA,MAAAE,MAAA;IAAAF,CAAA,MAAAC,YAAA,CAAAI,QAAA,CAAAC,oBAAA;IAAAN,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAD,EAAA,GAAAH,CAAA;IAAAI,EAAA,GAAAJ,CAAA;EAAA;EAFvDH,KAAA,CAAAU,SAAe,CAACJ,EAEhB,EAAGC,EAAoD;EAAA,OAEhD;AAAA,CACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$getRoot","useEffect","useRichTextView","clearEditorNodeViews","registerEditorNodeViews","refreshBlockDecorators","editor","update","walk","node","type","getType","markDirty","getChildren","child","NodeViewOverridePlugin","$","currentView","views","t0","t1","default","nodes"],"sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $getRoot, type LexicalNode } from 'lexical'\nimport { useEffect } from 'react'\n\nimport { useRichTextView } from '../../../field/RichTextViewProvider.js'\nimport { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js'\n\n// `LexicalComposer` re-mounts with a new `editor` whenever `currentView` changes,\n// so decorator nodes run their initial `decorate()` before this effect registers the view's overrides.\n// Mark existing block decorators dirty after registering so they re-decorate with the resolved custom `Block` component.\nfunction refreshBlockDecorators(editor: ReturnType<typeof useLexicalComposerContext>[0]): void {\n editor.update(() => {\n const walk = (node: LexicalNode): void => {\n const type = node.getType()\n if (type === 'block' || type === 'inlineBlock') {\n node.markDirty()\n }\n if ('getChildren' in node && typeof node.getChildren === 'function') {\n for (const child of node.getChildren() as LexicalNode[]) {\n walk(child)\n }\n }\n }\n walk($getRoot())\n })\n}\n\nexport function NodeViewOverridePlugin(): null {\n const [editor] = useLexicalComposerContext()\n const { currentView, views } = useRichTextView()\n\n useEffect(() => {\n if (!views) {\n return\n }\n\n if (currentView === 'default') {\n if (views.default) {\n registerEditorNodeViews(editor, views.default?.nodes)\n } else {\n clearEditorNodeViews(editor)\n }\n } else if (views[currentView]) {\n clearEditorNodeViews(editor)\n registerEditorNodeViews(editor, views[currentView]?.nodes)\n }\n\n refreshBlockDecorators(editor)\n }, [editor, views, currentView])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,QAA0B;AAC3C,SAASC,SAAS,QAAQ;AAE1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,EAAEC,uBAAuB,QAAQ;AAE9D;AACA;AACA;AACA,SAASC,uBAAuBC,MAAuD;EACrFA,MAAA,CAAOC,MAAM,CAAC;IACZ,MAAMC,IAAA,GAAQC,IAAA;MACZ,MAAMC,IAAA,GAAOD,IAAA,CAAKE,OAAO;MACzB,IAAID,IAAA,KAAS,WAAWA,IAAA,KAAS,eAAe;QAC9CD,IAAA,CAAKG,SAAS;MAChB;MACA,IAAI,iBAAiBH,IAAA,IAAQ,OAAOA,IAAA,CAAKI,WAAW,KAAK,YAAY;QACnE,KAAK,MAAMC,KAAA,IAASL,IAAA,CAAKI,WAAW,IAAqB;UACvDL,IAAA,CAAKM,KAAA;QACP;MACF;IACF;IACAN,IAAA,CAAKR,QAAA;EACP;AACF;AAEA,OAAO,SAAAe,uBAAA;EAAA,MAAAC,CAAA,GAAAlB,EAAA;EACL,OAAAQ,MAAA,IAAiBP,yBAAA;EACjB;IAAAkB,WAAA;IAAAC;EAAA,IAA+BhB,eAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAJ,CAAA,QAAAC,WAAA,IAAAD,CAAA,QAAAV,MAAA,IAAAU,CAAA,QAAAE,KAAA;IAErBC,EAAA,GAAAA,CAAA;MAAA,KACHD,KAAA;QAAA;MAAA;MAAA,IAIDD,WAAA,KAAgB;QAAA,IACdC,KAAA,CAAAG,OAAA;UACFjB,uBAAA,CAAwBE,MAAA,EAAQY,KAAA,CAAAG,OAAA,EAAAC,KAAe;QAAA;UAE/CnB,oBAAA,CAAqBG,MAAA;QAAA;MAAA;QAAA,IAEdY,KAAK,CAACD,WAAA;UACfd,oBAAA,CAAqBG,MAAA;UACrBF,uBAAA,CAAwBE,MAAA,EAAQY,KAAK,CAACD,WAAA,GAAAK,KAAc;QAAA;MAAA;MAGtDjB,sBAAA,CAAuBC,MAAA;IAAA;IACtBc,EAAA,IAACd,MAAA,EAAQY,KAAA,EAAOD,WAAA;IAAYD,CAAA,MAAAC,WAAA;IAAAD,CAAA,MAAAV,MAAA;IAAAU,CAAA,MAAAE,KAAA;IAAAF,CAAA,MAAAG,EAAA;IAAAH,CAAA,MAAAI,EAAA;EAAA;IAAAD,EAAA,GAAAH,CAAA;IAAAI,EAAA,GAAAJ,CAAA;EAAA;EAjB/Bf,SAAA,CAAUkB,EAiBV,EAAGC,EAA4B;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$getRoot","useEffect","useRichTextView","clearEditorNodeViews","registerEditorNodeViews","refreshBlockDecorators","editor","update","walk","node","type","getType","markDirty","getChildren","child","NodeViewOverridePlugin","$","currentView","views","t0","t1","default","nodes"],"sources":["../../../../src/lexical/plugins/NodeViewOverridePlugin/index.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $getRoot, type LexicalNode } from 'lexical'\nimport { useEffect } from 'react'\n\nimport { useRichTextView } from '../../../field/RichTextViewProvider.js'\nimport { clearEditorNodeViews, registerEditorNodeViews } from '../../nodes/index.js'\n\n// `LexicalComposer` re-mounts with a new `editor` whenever `currentView` changes,\n// so decorator nodes run their initial `decorate()` before this effect registers the view's overrides.\n// Mark existing block decorators dirty after registering so they re-decorate with the resolved custom `Block` component.\nfunction refreshBlockDecorators(editor: ReturnType<typeof useLexicalComposerContext>[0]): void {\n editor.update(() => {\n const walk = (node: LexicalNode): void => {\n const type = node.getType()\n if (type === 'block' || type === 'inlineBlock') {\n node.markDirty()\n }\n if ('getChildren' in node && typeof node.getChildren === 'function') {\n for (const child of node.getChildren() as LexicalNode[]) {\n walk(child)\n }\n }\n }\n walk($getRoot())\n })\n}\n\nexport function NodeViewOverridePlugin(): null {\n const [editor] = useLexicalComposerContext()\n const { currentView, views } = useRichTextView()\n\n useEffect(() => {\n if (!views) {\n return\n }\n\n if (currentView === 'default') {\n if (views.default) {\n registerEditorNodeViews(editor, views.default?.nodes)\n } else {\n clearEditorNodeViews(editor)\n }\n } else if (views[currentView]) {\n clearEditorNodeViews(editor)\n registerEditorNodeViews(editor, views[currentView]?.nodes)\n }\n\n refreshBlockDecorators(editor)\n }, [editor, views, currentView])\n\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,QAAQ,QAA0B;AAC3C,SAASC,SAAS,QAAQ;AAE1B,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,EAAEC,uBAAuB,QAAQ;AAE9D;AACA;AACA;AACA,SAASC,uBAAuBC,MAAuD;EACrFA,MAAA,CAAOC,MAAM,CAAC;IACZ,MAAMC,IAAA,GAAQC,IAAA;MACZ,MAAMC,IAAA,GAAOD,IAAA,CAAKE,OAAO;MACzB,IAAID,IAAA,KAAS,WAAW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AA,CAAUkB,EAiBV,EAAGC,EAA4B;EAAA,OAExB;AAAA","ignoreList":[]}
@@ -137,95 +137,182 @@ export function useDynamicPositioning(resolution, targetElementRef, onReposition
137
137
  useEffect(t0, t1);
138
138
  }
139
139
  export const SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND = createCommand('SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND');
140
- export function LexicalMenu({
141
- anchorElementRef,
142
- close,
143
- editor,
144
- // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.
145
- groups,
146
- menuRenderFn,
147
- resolution,
148
- shouldSplitNodeWithQuery = false
149
- }) {
140
+ export function LexicalMenu(t0) {
141
+ const $ = _c(50);
142
+ const {
143
+ anchorElementRef,
144
+ close,
145
+ editor,
146
+ groups,
147
+ menuRenderFn,
148
+ resolution,
149
+ shouldSplitNodeWithQuery: t1
150
+ } = t0;
151
+ const shouldSplitNodeWithQuery = t1 === undefined ? false : t1;
150
152
  const [selectedItemKey, setSelectedItemKey] = useState(null);
151
- const matchingString = resolution.match && resolution.match.matchingString || '';
152
- const updateSelectedItem = useCallback(item => {
153
- const rootElem = editor.getRootElement();
154
- if (rootElem !== null) {
155
- rootElem.setAttribute('aria-activedescendant', `${baseClass}__item-${item.key}`);
156
- setSelectedItemKey(item.key);
157
- }
158
- }, [editor]);
159
- const setSelectedItemKeyToFirstMatchingItem = useCallback(() => {
160
- // set selected item to the first of the matching ones
161
- if (groups !== null && matchingString != null) {
162
- // groups filtering is already handled in SlashMenu/index.tsx. Thus, groups always contains the matching items.
163
- const allItems = groups.flatMap(group => group.items);
164
- if (allItems.length) {
165
- const firstMatchingItem = allItems[0];
166
- updateSelectedItem(firstMatchingItem);
153
+ const matchingString = resolution.match && resolution.match.matchingString || "";
154
+ let t2;
155
+ if ($[0] !== editor) {
156
+ t2 = item => {
157
+ const rootElem = editor.getRootElement();
158
+ if (rootElem !== null) {
159
+ rootElem.setAttribute("aria-activedescendant", `${baseClass}__item-${item.key}`);
160
+ setSelectedItemKey(item.key);
167
161
  }
168
- }
169
- }, [groups, updateSelectedItem, matchingString]);
170
- useEffect(() => {
171
- setSelectedItemKeyToFirstMatchingItem();
172
- }, [matchingString, setSelectedItemKeyToFirstMatchingItem]);
173
- const selectItemAndCleanUp = useCallback(selectedItem => {
174
- close();
175
- editor.update(() => {
176
- const textNodeContainingQuery = resolution.match != null && shouldSplitNodeWithQuery ? $splitNodeContainingQuery(resolution.match) : null;
177
- if (textNodeContainingQuery) {
178
- textNodeContainingQuery.remove();
162
+ };
163
+ $[0] = editor;
164
+ $[1] = t2;
165
+ } else {
166
+ t2 = $[1];
167
+ }
168
+ const updateSelectedItem = t2;
169
+ let t3;
170
+ if ($[2] !== groups || $[3] !== matchingString || $[4] !== updateSelectedItem) {
171
+ t3 = () => {
172
+ if (groups !== null && matchingString != null) {
173
+ const allItems = groups.flatMap(_temp);
174
+ if (allItems.length) {
175
+ const firstMatchingItem = allItems[0];
176
+ updateSelectedItem(firstMatchingItem);
177
+ }
179
178
  }
180
- });
181
- setTimeout(() => {
182
- // Needed in Firefox. See https://github.com/payloadcms/payload/issues/10724
183
- let selection;
184
- editor.read(() => {
185
- selection = $getSelection()?.clone();
186
- });
179
+ };
180
+ $[2] = groups;
181
+ $[3] = matchingString;
182
+ $[4] = updateSelectedItem;
183
+ $[5] = t3;
184
+ } else {
185
+ t3 = $[5];
186
+ }
187
+ const setSelectedItemKeyToFirstMatchingItem = t3;
188
+ let t4;
189
+ if ($[6] !== setSelectedItemKeyToFirstMatchingItem) {
190
+ t4 = () => {
191
+ setSelectedItemKeyToFirstMatchingItem();
192
+ };
193
+ $[6] = setSelectedItemKeyToFirstMatchingItem;
194
+ $[7] = t4;
195
+ } else {
196
+ t4 = $[7];
197
+ }
198
+ let t5;
199
+ if ($[8] !== matchingString || $[9] !== setSelectedItemKeyToFirstMatchingItem) {
200
+ t5 = [matchingString, setSelectedItemKeyToFirstMatchingItem];
201
+ $[8] = matchingString;
202
+ $[9] = setSelectedItemKeyToFirstMatchingItem;
203
+ $[10] = t5;
204
+ } else {
205
+ t5 = $[10];
206
+ }
207
+ useEffect(t4, t5);
208
+ let t6;
209
+ if ($[11] !== close || $[12] !== editor || $[13] !== resolution.match || $[14] !== shouldSplitNodeWithQuery) {
210
+ t6 = selectedItem => {
211
+ close();
187
212
  editor.update(() => {
188
- if (selection) {
189
- $setSelection(selection);
213
+ const textNodeContainingQuery = resolution.match != null && shouldSplitNodeWithQuery ? $splitNodeContainingQuery(resolution.match) : null;
214
+ if (textNodeContainingQuery) {
215
+ textNodeContainingQuery.remove();
190
216
  }
191
217
  });
192
- selectedItem.onSelect({
193
- editor,
194
- queryString: resolution.match ? resolution.match.matchingString : ''
195
- });
196
- }, 0);
197
- }, [editor, shouldSplitNodeWithQuery, resolution.match, close]);
198
- useEffect(() => {
199
- return () => {
218
+ setTimeout(() => {
219
+ let selection;
220
+ editor.read(() => {
221
+ selection = $getSelection()?.clone();
222
+ });
223
+ editor.update(() => {
224
+ if (selection) {
225
+ $setSelection(selection);
226
+ }
227
+ });
228
+ selectedItem.onSelect({
229
+ editor,
230
+ queryString: resolution.match ? resolution.match.matchingString : ""
231
+ });
232
+ }, 0);
233
+ };
234
+ $[11] = close;
235
+ $[12] = editor;
236
+ $[13] = resolution.match;
237
+ $[14] = shouldSplitNodeWithQuery;
238
+ $[15] = t6;
239
+ } else {
240
+ t6 = $[15];
241
+ }
242
+ const selectItemAndCleanUp = t6;
243
+ let t7;
244
+ let t8;
245
+ if ($[16] !== editor) {
246
+ t7 = () => () => {
200
247
  const rootElem_0 = editor.getRootElement();
201
248
  if (rootElem_0 !== null) {
202
- rootElem_0.removeAttribute('aria-activedescendant');
249
+ rootElem_0.removeAttribute("aria-activedescendant");
203
250
  }
204
251
  };
205
- }, [editor]);
206
- useLayoutEffect(() => {
207
- if (groups === null) {
208
- setSelectedItemKey(null);
209
- } else if (selectedItemKey === null) {
210
- setSelectedItemKeyToFirstMatchingItem();
211
- }
212
- }, [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem]);
213
- useEffect(() => {
214
- return mergeRegister(editor.registerCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, ({
215
- item: item_0
216
- }) => {
217
- if (item_0.ref && item_0.ref.current != null) {
218
- scrollIntoViewIfNeeded(item_0.ref.current);
219
- return true;
252
+ t8 = [editor];
253
+ $[16] = editor;
254
+ $[17] = t7;
255
+ $[18] = t8;
256
+ } else {
257
+ t7 = $[17];
258
+ t8 = $[18];
259
+ }
260
+ useEffect(t7, t8);
261
+ let t9;
262
+ if ($[19] !== groups || $[20] !== selectedItemKey || $[21] !== setSelectedItemKeyToFirstMatchingItem) {
263
+ t9 = () => {
264
+ if (groups === null) {
265
+ setSelectedItemKey(null);
266
+ } else {
267
+ if (selectedItemKey === null) {
268
+ setSelectedItemKeyToFirstMatchingItem();
269
+ }
220
270
  }
221
- return false;
222
- }, COMMAND_PRIORITY_LOW));
223
- }, [editor, updateSelectedItem]);
224
- useEffect(() => {
225
- return mergeRegister(editor.registerCommand(KEY_ARROW_DOWN_COMMAND, payload => {
271
+ };
272
+ $[19] = groups;
273
+ $[20] = selectedItemKey;
274
+ $[21] = setSelectedItemKeyToFirstMatchingItem;
275
+ $[22] = t9;
276
+ } else {
277
+ t9 = $[22];
278
+ }
279
+ let t10;
280
+ if ($[23] !== groups || $[24] !== selectedItemKey || $[25] !== setSelectedItemKeyToFirstMatchingItem || $[26] !== updateSelectedItem) {
281
+ t10 = [groups, selectedItemKey, updateSelectedItem, setSelectedItemKeyToFirstMatchingItem];
282
+ $[23] = groups;
283
+ $[24] = selectedItemKey;
284
+ $[25] = setSelectedItemKeyToFirstMatchingItem;
285
+ $[26] = updateSelectedItem;
286
+ $[27] = t10;
287
+ } else {
288
+ t10 = $[27];
289
+ }
290
+ useLayoutEffect(t9, t10);
291
+ let t11;
292
+ if ($[28] !== editor) {
293
+ t11 = () => mergeRegister(editor.registerCommand(SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, _temp2, COMMAND_PRIORITY_LOW));
294
+ $[28] = editor;
295
+ $[29] = t11;
296
+ } else {
297
+ t11 = $[29];
298
+ }
299
+ let t12;
300
+ if ($[30] !== editor || $[31] !== updateSelectedItem) {
301
+ t12 = [editor, updateSelectedItem];
302
+ $[30] = editor;
303
+ $[31] = updateSelectedItem;
304
+ $[32] = t12;
305
+ } else {
306
+ t12 = $[32];
307
+ }
308
+ useEffect(t11, t12);
309
+ let t13;
310
+ let t14;
311
+ if ($[33] !== close || $[34] !== editor || $[35] !== groups || $[36] !== selectItemAndCleanUp || $[37] !== selectedItemKey || $[38] !== updateSelectedItem) {
312
+ t13 = () => mergeRegister(editor.registerCommand(KEY_ARROW_DOWN_COMMAND, payload => {
226
313
  const event = payload;
227
314
  if (groups !== null && groups.length && selectedItemKey !== null) {
228
- const allItems_0 = groups.flatMap(group_0 => group_0.items);
315
+ const allItems_0 = groups.flatMap(_temp3);
229
316
  const selectedIndex = allItems_0.findIndex(item_1 => item_1.key === selectedItemKey);
230
317
  const newSelectedIndex = selectedIndex !== allItems_0.length - 1 ? selectedIndex + 1 : 0;
231
318
  const newSelectedItem = allItems_0[newSelectedIndex];
@@ -246,7 +333,7 @@ export function LexicalMenu({
246
333
  }, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_ARROW_UP_COMMAND, payload_0 => {
247
334
  const event_0 = payload_0;
248
335
  if (groups !== null && groups.length && selectedItemKey !== null) {
249
- const allItems_1 = groups.flatMap(group_1 => group_1.items);
336
+ const allItems_1 = groups.flatMap(_temp4);
250
337
  const selectedIndex_0 = allItems_1.findIndex(item_2 => item_2.key === selectedItemKey);
251
338
  const newSelectedIndex_0 = selectedIndex_0 !== 0 ? selectedIndex_0 - 1 : allItems_1.length - 1;
252
339
  const newSelectedItem_0 = allItems_1[newSelectedIndex_0];
@@ -267,12 +354,12 @@ export function LexicalMenu({
267
354
  event_1.stopImmediatePropagation();
268
355
  close();
269
356
  return true;
270
- }, COMMAND_PRIORITY_LOW), editor.registerCommand(KEY_TAB_COMMAND, payload_2 => {
357
+ }, COMMAND_PRIORITY_NORMAL), editor.registerCommand(KEY_TAB_COMMAND, payload_2 => {
271
358
  const event_2 = payload_2;
272
359
  if (groups === null || selectedItemKey === null) {
273
360
  return false;
274
361
  }
275
- const allItems_2 = groups.flatMap(group_2 => group_2.items);
362
+ const allItems_2 = groups.flatMap(_temp5);
276
363
  const selectedItem_0 = allItems_2.find(item_3 => item_3.key === selectedItemKey);
277
364
  if (!selectedItem_0) {
278
365
  return false;
@@ -285,7 +372,7 @@ export function LexicalMenu({
285
372
  if (groups === null || selectedItemKey === null) {
286
373
  return false;
287
374
  }
288
- const allItems_3 = groups.flatMap(group_3 => group_3.items);
375
+ const allItems_3 = groups.flatMap(_temp6);
289
376
  const selectedItem_1 = allItems_3.find(item_4 => item_4.key === selectedItemKey);
290
377
  if (!selectedItem_1) {
291
378
  return false;
@@ -297,14 +384,74 @@ export function LexicalMenu({
297
384
  selectItemAndCleanUp(selectedItem_1);
298
385
  return true;
299
386
  }, COMMAND_PRIORITY_NORMAL));
300
- }, [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem]);
301
- const listItemProps = useMemo(() => ({
302
- groups,
303
- selectedItemKey,
304
- selectItemAndCleanUp,
305
- setSelectedItemKey
306
- }), [selectItemAndCleanUp, selectedItemKey, groups]);
307
- return menuRenderFn(anchorElementRef, listItemProps, resolution.match ? resolution.match.matchingString : '');
387
+ t14 = [selectItemAndCleanUp, close, editor, groups, selectedItemKey, updateSelectedItem];
388
+ $[33] = close;
389
+ $[34] = editor;
390
+ $[35] = groups;
391
+ $[36] = selectItemAndCleanUp;
392
+ $[37] = selectedItemKey;
393
+ $[38] = updateSelectedItem;
394
+ $[39] = t13;
395
+ $[40] = t14;
396
+ } else {
397
+ t13 = $[39];
398
+ t14 = $[40];
399
+ }
400
+ useEffect(t13, t14);
401
+ let t15;
402
+ if ($[41] !== groups || $[42] !== selectItemAndCleanUp || $[43] !== selectedItemKey) {
403
+ t15 = {
404
+ groups,
405
+ selectedItemKey,
406
+ selectItemAndCleanUp,
407
+ setSelectedItemKey
408
+ };
409
+ $[41] = groups;
410
+ $[42] = selectItemAndCleanUp;
411
+ $[43] = selectedItemKey;
412
+ $[44] = t15;
413
+ } else {
414
+ t15 = $[44];
415
+ }
416
+ const listItemProps = t15;
417
+ const t16 = resolution.match ? resolution.match.matchingString : "";
418
+ let t17;
419
+ if ($[45] !== anchorElementRef || $[46] !== listItemProps || $[47] !== menuRenderFn || $[48] !== t16) {
420
+ t17 = menuRenderFn(anchorElementRef, listItemProps, t16);
421
+ $[45] = anchorElementRef;
422
+ $[46] = listItemProps;
423
+ $[47] = menuRenderFn;
424
+ $[48] = t16;
425
+ $[49] = t17;
426
+ } else {
427
+ t17 = $[49];
428
+ }
429
+ return t17;
430
+ }
431
+ function _temp6(group_3) {
432
+ return group_3.items;
433
+ }
434
+ function _temp5(group_2) {
435
+ return group_2.items;
436
+ }
437
+ function _temp4(group_1) {
438
+ return group_1.items;
439
+ }
440
+ function _temp3(group_0) {
441
+ return group_0.items;
442
+ }
443
+ function _temp2(t0) {
444
+ const {
445
+ item: item_0
446
+ } = t0;
447
+ if (item_0.ref && item_0.ref.current != null) {
448
+ scrollIntoViewIfNeeded(item_0.ref.current);
449
+ return true;
450
+ }
451
+ return false;
452
+ }
453
+ function _temp(group) {
454
+ return group.items;
308
455
  }
309
456
  function setContainerDivAttributes(containerDiv, className) {
310
457
  if (className != null) {