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

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 (619) hide show
  1. package/dist/exports/client/Field-PJW7KUJG.js +2 -0
  2. package/dist/exports/client/Field-PJW7KUJG.js.map +7 -0
  3. package/dist/exports/client/RelationshipComponent-5RONAYJM.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-5RONAYJM.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/chunk-44G3K3W7.js +2 -0
  7. package/dist/exports/client/chunk-44G3K3W7.js.map +7 -0
  8. package/dist/exports/client/chunk-WSAPGI3Z.js +2 -0
  9. package/dist/exports/client/chunk-WSAPGI3Z.js.map +7 -0
  10. package/dist/exports/client/component-53Y3RYR5.js +2 -0
  11. package/dist/exports/client/component-53Y3RYR5.js.map +7 -0
  12. package/dist/exports/client/componentInline-PM4PLNUK.js +2 -0
  13. package/dist/exports/client/index.d.ts +0 -2
  14. package/dist/exports/client/index.d.ts.map +1 -1
  15. package/dist/exports/client/index.js +30 -30
  16. package/dist/exports/client/index.js.map +4 -4
  17. package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
  18. package/dist/features/align/client/toolbarAlignGroup.js +1 -0
  19. package/dist/features/align/client/toolbarAlignGroup.js.map +1 -1
  20. package/dist/features/blockquote/server/index.d.ts.map +1 -1
  21. package/dist/features/blockquote/server/index.js +0 -39
  22. package/dist/features/blockquote/server/index.js.map +1 -1
  23. package/dist/features/blocks/client/component/BlockContent.d.ts +10 -0
  24. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  25. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.css +178 -0
  27. package/dist/features/blocks/client/component/index.d.ts +1 -1
  28. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  29. package/dist/features/blocks/client/component/index.js +88 -16
  30. package/dist/features/blocks/client/component/index.js.map +1 -1
  31. package/dist/features/blocks/client/componentInline/index.css +85 -0
  32. package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
  33. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  34. package/dist/features/blocks/client/componentInline/index.js +29 -6
  35. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  36. package/dist/features/blocks/client/index.d.ts.map +1 -1
  37. package/dist/features/blocks/client/index.js +0 -2
  38. package/dist/features/blocks/client/index.js.map +1 -1
  39. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +1 -1
  40. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -1
  41. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +3 -0
  42. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  43. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.css +26 -0
  44. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +1 -1
  45. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +1 -1
  46. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +4 -1
  47. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  48. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.css +40 -0
  49. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +1 -1
  50. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +1 -1
  51. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +7 -8
  52. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  53. package/dist/features/blocks/premade/CodeBlock/Component/index.css +171 -0
  54. package/dist/features/debug/jsxConverter/client/plugin/index.d.ts +1 -1
  55. package/dist/features/debug/jsxConverter/client/plugin/index.d.ts.map +1 -1
  56. package/dist/features/debug/jsxConverter/client/plugin/index.js +1 -0
  57. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  58. package/dist/features/debug/jsxConverter/client/plugin/style.css +9 -0
  59. package/dist/features/debug/testRecorder/client/plugin/index.css +51 -0
  60. package/dist/features/debug/testRecorder/client/plugin/index.d.ts +1 -1
  61. package/dist/features/debug/testRecorder/client/plugin/index.d.ts.map +1 -1
  62. package/dist/features/debug/testRecorder/client/plugin/index.js +1 -0
  63. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  64. package/dist/features/debug/treeView/client/plugin/index.css +81 -0
  65. package/dist/features/debug/treeView/client/plugin/index.d.ts +1 -1
  66. package/dist/features/debug/treeView/client/plugin/index.d.ts.map +1 -1
  67. package/dist/features/debug/treeView/client/plugin/index.js +1 -0
  68. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  69. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.css +91 -0
  70. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts +1 -1
  71. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
  72. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +3 -2
  73. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  74. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.css +11 -0
  75. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts +1 -1
  76. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
  77. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +1 -0
  78. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  79. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +1 -1
  80. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  81. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.css +166 -0
  82. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts +17 -0
  83. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.d.ts.map +1 -0
  84. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js +219 -0
  85. package/dist/features/experimental_table/client/plugins/TablePlugin/TableGridPopup/index.js.map +1 -0
  86. package/dist/features/experimental_table/client/plugins/TablePlugin/index.css +235 -0
  87. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts +1 -1
  88. package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
  89. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +95 -104
  90. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  91. package/dist/features/experimental_table/server/index.d.ts.map +1 -1
  92. package/dist/features/experimental_table/server/index.js +0 -102
  93. package/dist/features/experimental_table/server/index.js.map +1 -1
  94. package/dist/features/heading/server/index.d.ts.map +1 -1
  95. package/dist/features/heading/server/index.js +0 -39
  96. package/dist/features/heading/server/index.js.map +1 -1
  97. package/dist/features/horizontalRule/client/plugin/index.css +25 -0
  98. package/dist/features/horizontalRule/client/plugin/index.d.ts +1 -1
  99. package/dist/features/horizontalRule/client/plugin/index.d.ts.map +1 -1
  100. package/dist/features/horizontalRule/client/plugin/index.js +73 -4
  101. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  102. package/dist/features/horizontalRule/server/index.d.ts.map +1 -1
  103. package/dist/features/horizontalRule/server/index.js +0 -8
  104. package/dist/features/horizontalRule/server/index.js.map +1 -1
  105. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  106. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +28 -8
  107. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  108. package/dist/features/link/client/plugins/floatingLinkEditor/index.css +112 -0
  109. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts +1 -1
  110. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  111. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +1 -0
  112. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  113. package/dist/features/link/server/index.d.ts.map +1 -1
  114. package/dist/features/link/server/index.js +0 -71
  115. package/dist/features/link/server/index.js.map +1 -1
  116. package/dist/features/lists/checklist/server/index.d.ts.map +1 -1
  117. package/dist/features/lists/checklist/server/index.js +0 -7
  118. package/dist/features/lists/checklist/server/index.js.map +1 -1
  119. package/dist/features/lists/orderedList/server/index.d.ts.map +1 -1
  120. package/dist/features/lists/orderedList/server/index.js +0 -7
  121. package/dist/features/lists/orderedList/server/index.js.map +1 -1
  122. package/dist/features/lists/unorderedList/server/index.d.ts.map +1 -1
  123. package/dist/features/lists/unorderedList/server/index.js +0 -7
  124. package/dist/features/lists/unorderedList/server/index.js.map +1 -1
  125. package/dist/features/relationship/client/components/RelationshipComponent.d.ts +1 -1
  126. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  127. package/dist/features/relationship/client/components/RelationshipComponent.js +27 -2
  128. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  129. package/dist/features/relationship/client/components/index.css +112 -0
  130. package/dist/features/toolbars/fixed/client/Toolbar/index.css +87 -0
  131. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts +1 -1
  132. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  133. package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -0
  134. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  135. package/dist/features/toolbars/inline/client/Toolbar/index.css +43 -0
  136. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts +1 -1
  137. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  138. package/dist/features/toolbars/inline/client/Toolbar/index.js +1 -0
  139. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  140. package/dist/features/toolbars/shared/ToolbarButton/index.css +57 -0
  141. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts +1 -1
  142. package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
  143. package/dist/features/toolbars/shared/ToolbarButton/index.js +80 -74
  144. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  145. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  146. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +4 -0
  147. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  148. package/dist/features/toolbars/shared/ToolbarDropdown/index.css +214 -0
  149. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +1 -1
  150. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  151. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +11 -7
  152. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  153. package/dist/features/toolbars/types.d.ts +4 -0
  154. package/dist/features/toolbars/types.d.ts.map +1 -1
  155. package/dist/features/toolbars/types.js.map +1 -1
  156. package/dist/features/typesServer.d.ts +0 -17
  157. package/dist/features/typesServer.d.ts.map +1 -1
  158. package/dist/features/typesServer.js.map +1 -1
  159. package/dist/features/upload/client/component/index.css +218 -0
  160. package/dist/features/upload/client/component/index.d.ts +1 -1
  161. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  162. package/dist/features/upload/client/component/index.js +86 -63
  163. package/dist/features/upload/client/component/index.js.map +1 -1
  164. package/dist/features/upload/client/component/pending/index.d.ts +0 -1
  165. package/dist/features/upload/client/component/pending/index.d.ts.map +1 -1
  166. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  167. package/dist/features/upload/server/index.d.ts.map +1 -1
  168. package/dist/features/upload/server/index.js +0 -78
  169. package/dist/features/upload/server/index.js.map +1 -1
  170. package/dist/field/Diff/converters/listitem/index.css +44 -0
  171. package/dist/field/Diff/converters/listitem/index.d.ts +1 -1
  172. package/dist/field/Diff/converters/listitem/index.d.ts.map +1 -1
  173. package/dist/field/Diff/converters/listitem/index.js +1 -0
  174. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  175. package/dist/field/Diff/converters/relationship/index.css +68 -0
  176. package/dist/field/Diff/converters/relationship/index.d.ts +1 -1
  177. package/dist/field/Diff/converters/relationship/index.d.ts.map +1 -1
  178. package/dist/field/Diff/converters/relationship/index.js +1 -0
  179. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  180. package/dist/field/Diff/converters/unknown/index.css +37 -0
  181. package/dist/field/Diff/converters/unknown/index.d.ts +1 -1
  182. package/dist/field/Diff/converters/unknown/index.d.ts.map +1 -1
  183. package/dist/field/Diff/converters/unknown/index.js +1 -0
  184. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  185. package/dist/field/Diff/converters/upload/index.css +112 -0
  186. package/dist/field/Diff/converters/upload/index.d.ts +1 -1
  187. package/dist/field/Diff/converters/upload/index.d.ts.map +1 -1
  188. package/dist/field/Diff/converters/upload/index.js +1 -0
  189. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  190. package/dist/field/Diff/index.css +101 -0
  191. package/dist/field/Diff/index.d.ts +1 -1
  192. package/dist/field/Diff/index.d.ts.map +1 -1
  193. package/dist/field/Diff/index.js +1 -0
  194. package/dist/field/Diff/index.js.map +1 -1
  195. package/dist/field/Field.d.ts +2 -2
  196. package/dist/field/Field.d.ts.map +1 -1
  197. package/dist/field/Field.js +11 -9
  198. package/dist/field/Field.js.map +1 -1
  199. package/dist/field/ViewSelector.css +32 -0
  200. package/dist/field/ViewSelector.d.ts +1 -1
  201. package/dist/field/ViewSelector.d.ts.map +1 -1
  202. package/dist/field/ViewSelector.js +1 -0
  203. package/dist/field/ViewSelector.js.map +1 -1
  204. package/dist/field/bundled.css +1 -1
  205. package/dist/field/index.css +60 -0
  206. package/dist/index.d.ts +0 -10
  207. package/dist/index.d.ts.map +1 -1
  208. package/dist/index.js +11 -10
  209. package/dist/index.js.map +1 -1
  210. package/dist/lexical/LexicalEditor.css +50 -0
  211. package/dist/lexical/LexicalEditor.d.ts +1 -1
  212. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  213. package/dist/lexical/LexicalEditor.js +1 -0
  214. package/dist/lexical/LexicalEditor.js.map +1 -1
  215. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  216. package/dist/lexical/config/server/loader.js +12 -9
  217. package/dist/lexical/config/server/loader.js.map +1 -1
  218. package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
  219. package/dist/lexical/config/server/sanitize.js +0 -6
  220. package/dist/lexical/config/server/sanitize.js.map +1 -1
  221. package/dist/lexical/plugins/DecoratorPlugin/index.css +11 -0
  222. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts +1 -1
  223. package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
  224. package/dist/lexical/plugins/DecoratorPlugin/index.js +1 -0
  225. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  226. package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +52 -0
  227. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts +1 -1
  228. package/dist/lexical/plugins/InsertParagraphAtEnd/index.d.ts.map +1 -1
  229. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +1 -0
  230. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  231. package/dist/lexical/plugins/SlashMenu/index.css +65 -0
  232. package/dist/lexical/plugins/SlashMenu/index.d.ts +1 -1
  233. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  234. package/dist/lexical/plugins/SlashMenu/index.js +2 -0
  235. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  236. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +40 -0
  237. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts +1 -1
  238. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
  239. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +1 -0
  240. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  241. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +84 -0
  242. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts +1 -1
  243. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
  244. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +15 -8
  245. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  246. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js +1 -1
  247. package/dist/lexical/plugins/handles/DraggableBlockPlugin/setTargetLine.js.map +1 -1
  248. package/dist/lexical/theme/EditorTheme.css +359 -0
  249. package/dist/lexical/theme/EditorTheme.d.ts.map +1 -1
  250. package/dist/lexical/theme/EditorTheme.js +1 -0
  251. package/dist/lexical/theme/EditorTheme.js.map +1 -1
  252. package/dist/lexical/ui/ContentEditable.css +95 -0
  253. package/dist/lexical/ui/ContentEditable.d.ts +1 -1
  254. package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
  255. package/dist/lexical/ui/ContentEditable.js +1 -0
  256. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  257. package/dist/lexical/ui/icons/Add/index.d.ts +4 -1
  258. package/dist/lexical/ui/icons/Add/index.d.ts.map +1 -1
  259. package/dist/lexical/ui/icons/Add/index.js +19 -12
  260. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  261. package/dist/lexical/ui/icons/Add/index.svg +2 -3
  262. package/dist/lexical/ui/icons/Add/light.svg +2 -3
  263. package/dist/lexical/ui/icons/AlignCenter/index.d.ts +3 -1
  264. package/dist/lexical/ui/icons/AlignCenter/index.d.ts.map +1 -1
  265. package/dist/lexical/ui/icons/AlignCenter/index.js +15 -19
  266. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  267. package/dist/lexical/ui/icons/AlignJustify/index.d.ts +3 -1
  268. package/dist/lexical/ui/icons/AlignJustify/index.d.ts.map +1 -1
  269. package/dist/lexical/ui/icons/AlignJustify/index.js +15 -19
  270. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  271. package/dist/lexical/ui/icons/AlignLeft/index.d.ts +3 -1
  272. package/dist/lexical/ui/icons/AlignLeft/index.d.ts.map +1 -1
  273. package/dist/lexical/ui/icons/AlignLeft/index.js +15 -19
  274. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  275. package/dist/lexical/ui/icons/AlignRight/index.d.ts +3 -1
  276. package/dist/lexical/ui/icons/AlignRight/index.d.ts.map +1 -1
  277. package/dist/lexical/ui/icons/AlignRight/index.js +15 -19
  278. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  279. package/dist/lexical/ui/icons/Block/index.d.ts +3 -1
  280. package/dist/lexical/ui/icons/Block/index.d.ts.map +1 -1
  281. package/dist/lexical/ui/icons/Block/index.js +13 -28
  282. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  283. package/dist/lexical/ui/icons/Blockquote/index.d.ts +3 -1
  284. package/dist/lexical/ui/icons/Blockquote/index.d.ts.map +1 -1
  285. package/dist/lexical/ui/icons/Blockquote/index.js +9 -6
  286. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  287. package/dist/lexical/ui/icons/Bold/index.d.ts +3 -1
  288. package/dist/lexical/ui/icons/Bold/index.d.ts.map +1 -1
  289. package/dist/lexical/ui/icons/Bold/index.js +13 -8
  290. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  291. package/dist/lexical/ui/icons/Checklist/index.d.ts +4 -1
  292. package/dist/lexical/ui/icons/Checklist/index.d.ts.map +1 -1
  293. package/dist/lexical/ui/icons/Checklist/index.js +17 -18
  294. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  295. package/dist/lexical/ui/icons/Code/index.d.ts +3 -1
  296. package/dist/lexical/ui/icons/Code/index.d.ts.map +1 -1
  297. package/dist/lexical/ui/icons/Code/index.js +15 -13
  298. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  299. package/dist/lexical/ui/icons/CodeBlock/index.d.ts +4 -1
  300. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  301. package/dist/lexical/ui/icons/CodeBlock/index.js +18 -7
  302. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  303. package/dist/lexical/ui/icons/Collapse/index.d.ts +3 -1
  304. package/dist/lexical/ui/icons/Collapse/index.d.ts.map +1 -1
  305. package/dist/lexical/ui/icons/Collapse/index.js +10 -8
  306. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  307. package/dist/lexical/ui/icons/DraggableBlock/index.svg +7 -7
  308. package/dist/lexical/ui/icons/DraggableBlock/light.svg +7 -7
  309. package/dist/lexical/ui/icons/Expand/index.d.ts +5 -0
  310. package/dist/lexical/ui/icons/Expand/index.d.ts.map +1 -0
  311. package/dist/lexical/ui/icons/Expand/index.js +22 -0
  312. package/dist/lexical/ui/icons/Expand/index.js.map +1 -0
  313. package/dist/lexical/ui/icons/H1/index.d.ts +3 -1
  314. package/dist/lexical/ui/icons/H1/index.d.ts.map +1 -1
  315. package/dist/lexical/ui/icons/H1/index.js +9 -6
  316. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  317. package/dist/lexical/ui/icons/H2/index.d.ts +3 -1
  318. package/dist/lexical/ui/icons/H2/index.d.ts.map +1 -1
  319. package/dist/lexical/ui/icons/H2/index.js +9 -6
  320. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  321. package/dist/lexical/ui/icons/H3/index.d.ts +3 -1
  322. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  323. package/dist/lexical/ui/icons/H3/index.js +9 -6
  324. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  325. package/dist/lexical/ui/icons/H4/index.d.ts +3 -1
  326. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  327. package/dist/lexical/ui/icons/H4/index.js +9 -6
  328. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  329. package/dist/lexical/ui/icons/H5/index.d.ts +3 -1
  330. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  331. package/dist/lexical/ui/icons/H5/index.js +9 -6
  332. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  333. package/dist/lexical/ui/icons/H6/index.d.ts +3 -1
  334. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  335. package/dist/lexical/ui/icons/H6/index.js +9 -6
  336. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  337. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts +3 -1
  338. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -1
  339. package/dist/lexical/ui/icons/HorizontalRule/index.js +11 -11
  340. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  341. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts +3 -1
  342. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts.map +1 -1
  343. package/dist/lexical/ui/icons/IndentDecrease/index.js +18 -22
  344. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  345. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts +3 -1
  346. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts.map +1 -1
  347. package/dist/lexical/ui/icons/IndentIncrease/index.js +15 -22
  348. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  349. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts +3 -1
  350. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -1
  351. package/dist/lexical/ui/icons/InlineBlocks/index.js +9 -6
  352. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  353. package/dist/lexical/ui/icons/Italic/index.d.ts +3 -1
  354. package/dist/lexical/ui/icons/Italic/index.d.ts.map +1 -1
  355. package/dist/lexical/ui/icons/Italic/index.js +13 -8
  356. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  357. package/dist/lexical/ui/icons/Link/index.d.ts +4 -1
  358. package/dist/lexical/ui/icons/Link/index.d.ts.map +1 -1
  359. package/dist/lexical/ui/icons/Link/index.js +14 -9
  360. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  361. package/dist/lexical/ui/icons/Meatballs/index.d.ts +4 -1
  362. package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -1
  363. package/dist/lexical/ui/icons/Meatballs/index.js +19 -15
  364. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  365. package/dist/lexical/ui/icons/OrderedList/index.d.ts +4 -1
  366. package/dist/lexical/ui/icons/OrderedList/index.d.ts.map +1 -1
  367. package/dist/lexical/ui/icons/OrderedList/index.js +19 -25
  368. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  369. package/dist/lexical/ui/icons/Page/index.d.ts +5 -0
  370. package/dist/lexical/ui/icons/Page/index.d.ts.map +1 -0
  371. package/dist/lexical/ui/icons/Page/index.js +21 -0
  372. package/dist/lexical/ui/icons/Page/index.js.map +1 -0
  373. package/dist/lexical/ui/icons/Relationship/index.d.ts +3 -1
  374. package/dist/lexical/ui/icons/Relationship/index.d.ts.map +1 -1
  375. package/dist/lexical/ui/icons/Relationship/index.js +13 -25
  376. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  377. package/dist/lexical/ui/icons/Strikethrough/index.d.ts +3 -1
  378. package/dist/lexical/ui/icons/Strikethrough/index.d.ts.map +1 -1
  379. package/dist/lexical/ui/icons/Strikethrough/index.js +13 -13
  380. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  381. package/dist/lexical/ui/icons/Subscript/index.d.ts +3 -1
  382. package/dist/lexical/ui/icons/Subscript/index.d.ts.map +1 -1
  383. package/dist/lexical/ui/icons/Subscript/index.js +10 -7
  384. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  385. package/dist/lexical/ui/icons/Superscript/index.d.ts +3 -1
  386. package/dist/lexical/ui/icons/Superscript/index.d.ts.map +1 -1
  387. package/dist/lexical/ui/icons/Superscript/index.js +10 -7
  388. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  389. package/dist/lexical/ui/icons/Table/index.d.ts +4 -1
  390. package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
  391. package/dist/lexical/ui/icons/Table/index.js +20 -15
  392. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  393. package/dist/lexical/ui/icons/Text/index.d.ts +4 -1
  394. package/dist/lexical/ui/icons/Text/index.d.ts.map +1 -1
  395. package/dist/lexical/ui/icons/Text/index.js +17 -8
  396. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  397. package/dist/lexical/ui/icons/Trash/index.d.ts +10 -0
  398. package/dist/lexical/ui/icons/Trash/index.d.ts.map +1 -0
  399. package/dist/lexical/ui/icons/Trash/index.js +29 -0
  400. package/dist/lexical/ui/icons/Trash/index.js.map +1 -0
  401. package/dist/lexical/ui/icons/Underline/index.d.ts +3 -1
  402. package/dist/lexical/ui/icons/Underline/index.d.ts.map +1 -1
  403. package/dist/lexical/ui/icons/Underline/index.js +16 -14
  404. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  405. package/dist/lexical/ui/icons/UnorderedList/index.d.ts +3 -1
  406. package/dist/lexical/ui/icons/UnorderedList/index.d.ts.map +1 -1
  407. package/dist/lexical/ui/icons/UnorderedList/index.js +13 -40
  408. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  409. package/dist/lexical/ui/icons/Upload/index.d.ts +3 -1
  410. package/dist/lexical/ui/icons/Upload/index.d.ts.map +1 -1
  411. package/dist/lexical/ui/icons/Upload/index.js +15 -22
  412. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  413. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  414. package/dist/utilities/buildEditorState.js +13 -0
  415. package/dist/utilities/buildEditorState.js.map +1 -1
  416. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts +1 -0
  417. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
  418. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +34 -18
  419. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  420. package/package.json +11 -16
  421. package/dist/exports/client/Component-DOSSWC76.js +0 -2
  422. package/dist/exports/client/Component-DOSSWC76.js.map +0 -7
  423. package/dist/exports/client/Component-MBLHTKDK.js +0 -2
  424. package/dist/exports/client/Component-MBLHTKDK.js.map +0 -7
  425. package/dist/exports/client/Field-4UEGQMIN.js +0 -2
  426. package/dist/exports/client/Field-4UEGQMIN.js.map +0 -7
  427. package/dist/exports/client/RelationshipComponent-BG3DPV3T.js +0 -2
  428. package/dist/exports/client/RelationshipComponent-BG3DPV3T.js.map +0 -7
  429. package/dist/exports/client/chunk-F26IQ5RE.js +0 -2
  430. package/dist/exports/client/chunk-F26IQ5RE.js.map +0 -7
  431. package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
  432. package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
  433. package/dist/exports/client/component-XIHC3W6W.js +0 -2
  434. package/dist/exports/client/component-XIHC3W6W.js.map +0 -7
  435. package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
  436. package/dist/exports/server/migrate.d.ts +0 -16
  437. package/dist/exports/server/migrate.d.ts.map +0 -1
  438. package/dist/exports/server/migrate.js +0 -16
  439. package/dist/exports/server/migrate.js.map +0 -1
  440. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.d.ts +0 -4
  441. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.d.ts.map +0 -1
  442. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.js +0 -7
  443. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/linebreak.js.map +0 -1
  444. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts +0 -4
  445. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.d.ts.map +0 -1
  446. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js +0 -38
  447. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/paragraph.js.map +0 -1
  448. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.d.ts +0 -4
  449. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.d.ts.map +0 -1
  450. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.js +0 -9
  451. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/tab.js.map +0 -1
  452. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.d.ts +0 -4
  453. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.d.ts.map +0 -1
  454. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.js +0 -33
  455. package/dist/features/converters/lexicalToHtml_deprecated/converter/converters/text.js.map +0 -1
  456. package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.d.ts +0 -6
  457. package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.d.ts.map +0 -1
  458. package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.js +0 -9
  459. package/dist/features/converters/lexicalToHtml_deprecated/converter/defaultConverters.js.map +0 -1
  460. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts +0 -70
  461. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.d.ts.map +0 -1
  462. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js +0 -104
  463. package/dist/features/converters/lexicalToHtml_deprecated/converter/index.js.map +0 -1
  464. package/dist/features/converters/lexicalToHtml_deprecated/converter/types.d.ts +0 -27
  465. package/dist/features/converters/lexicalToHtml_deprecated/converter/types.d.ts.map +0 -1
  466. package/dist/features/converters/lexicalToHtml_deprecated/converter/types.js +0 -2
  467. package/dist/features/converters/lexicalToHtml_deprecated/converter/types.js.map +0 -1
  468. package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts +0 -39
  469. package/dist/features/converters/lexicalToHtml_deprecated/field/index.d.ts.map +0 -1
  470. package/dist/features/converters/lexicalToHtml_deprecated/field/index.js +0 -122
  471. package/dist/features/converters/lexicalToHtml_deprecated/field/index.js.map +0 -1
  472. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts +0 -12
  473. package/dist/features/converters/lexicalToHtml_deprecated/index.d.ts.map +0 -1
  474. package/dist/features/converters/lexicalToHtml_deprecated/index.js +0 -11
  475. package/dist/features/converters/lexicalToHtml_deprecated/index.js.map +0 -1
  476. package/dist/features/lists/htmlConverter.d.ts +0 -5
  477. package/dist/features/lists/htmlConverter.d.ts.map +0 -1
  478. package/dist/features/lists/htmlConverter.js +0 -81
  479. package/dist/features/lists/htmlConverter.js.map +0 -1
  480. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts +0 -3
  481. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts.map +0 -1
  482. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js +0 -22
  483. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +0 -1
  484. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts +0 -3
  485. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts.map +0 -1
  486. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js +0 -33
  487. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +0 -1
  488. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts +0 -3
  489. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts.map +0 -1
  490. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js +0 -24
  491. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +0 -1
  492. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts +0 -3
  493. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
  494. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js +0 -25
  495. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +0 -1
  496. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts +0 -3
  497. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts.map +0 -1
  498. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js +0 -22
  499. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +0 -1
  500. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts +0 -3
  501. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
  502. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js +0 -28
  503. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +0 -1
  504. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts +0 -3
  505. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +0 -1
  506. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +0 -22
  507. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +0 -1
  508. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts +0 -3
  509. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts.map +0 -1
  510. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js +0 -9
  511. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +0 -1
  512. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts +0 -19
  513. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +0 -1
  514. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +0 -78
  515. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +0 -1
  516. package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts +0 -23
  517. package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts.map +0 -1
  518. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js +0 -2
  519. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +0 -1
  520. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +0 -2
  521. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +0 -1
  522. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +0 -10
  523. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +0 -1
  524. package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts +0 -10
  525. package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +0 -1
  526. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +0 -49
  527. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +0 -1
  528. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
  529. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
  530. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +0 -15
  531. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
  532. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
  533. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
  534. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +0 -74
  535. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
  536. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts +0 -3
  537. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts.map +0 -1
  538. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js +0 -23
  539. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +0 -1
  540. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts +0 -3
  541. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts.map +0 -1
  542. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js +0 -24
  543. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +0 -1
  544. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts +0 -3
  545. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts.map +0 -1
  546. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js +0 -33
  547. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +0 -1
  548. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts +0 -3
  549. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts.map +0 -1
  550. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +0 -30
  551. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +0 -1
  552. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts +0 -3
  553. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
  554. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js +0 -26
  555. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +0 -1
  556. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts +0 -3
  557. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts.map +0 -1
  558. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js +0 -26
  559. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +0 -1
  560. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts +0 -3
  561. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +0 -1
  562. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js +0 -15
  563. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +0 -1
  564. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts +0 -3
  565. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
  566. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js +0 -27
  567. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +0 -1
  568. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts +0 -3
  569. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts.map +0 -1
  570. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js +0 -26
  571. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +0 -1
  572. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts +0 -3
  573. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +0 -1
  574. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js +0 -18
  575. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +0 -1
  576. package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts +0 -3
  577. package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts.map +0 -1
  578. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js +0 -12
  579. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +0 -1
  580. package/dist/features/migrations/slateToLexical/converter/index.d.ts +0 -19
  581. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +0 -1
  582. package/dist/features/migrations/slateToLexical/converter/index.js +0 -130
  583. package/dist/features/migrations/slateToLexical/converter/index.js.map +0 -1
  584. package/dist/features/migrations/slateToLexical/converter/types.d.ts +0 -16
  585. package/dist/features/migrations/slateToLexical/converter/types.d.ts.map +0 -1
  586. package/dist/features/migrations/slateToLexical/converter/types.js +0 -2
  587. package/dist/features/migrations/slateToLexical/converter/types.js.map +0 -1
  588. package/dist/features/migrations/slateToLexical/feature.client.d.ts +0 -2
  589. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +0 -1
  590. package/dist/features/migrations/slateToLexical/feature.client.js +0 -10
  591. package/dist/features/migrations/slateToLexical/feature.client.js.map +0 -1
  592. package/dist/features/migrations/slateToLexical/feature.server.d.ts +0 -40
  593. package/dist/features/migrations/slateToLexical/feature.server.d.ts.map +0 -1
  594. package/dist/features/migrations/slateToLexical/feature.server.js +0 -68
  595. package/dist/features/migrations/slateToLexical/feature.server.js.map +0 -1
  596. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
  597. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
  598. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +0 -15
  599. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
  600. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
  601. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
  602. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +0 -74
  603. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
  604. package/dist/lexical/ui/icons/AI/index.d.ts +0 -3
  605. package/dist/lexical/ui/icons/AI/index.d.ts.map +0 -1
  606. package/dist/lexical/ui/icons/AI/index.js +0 -34
  607. package/dist/lexical/ui/icons/AI/index.js.map +0 -1
  608. package/dist/lexical/ui/icons/Caret/index.svg +0 -3
  609. package/dist/lexical/ui/icons/Edit/index.svg +0 -10
  610. package/dist/lexical/ui/icons/Remove/index.svg +0 -4
  611. package/dist/utilities/migrateSlateToLexical/index.d.ts +0 -15
  612. package/dist/utilities/migrateSlateToLexical/index.d.ts.map +0 -1
  613. package/dist/utilities/migrateSlateToLexical/index.js +0 -152
  614. package/dist/utilities/migrateSlateToLexical/index.js.map +0 -1
  615. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +0 -10
  616. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +0 -1
  617. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +0 -85
  618. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +0 -1
  619. /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-PM4PLNUK.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useLexicalEditable","useScrollInfo","useThrottledEffect","useTranslation","React","useMemo","useEditorConfigContext","ToolbarButton","ToolbarDropdown","useToolbarStates","ButtonGroupItem","active","anchorElem","editor","enabled","item","Component","_jsx","key","ChildComponent","ToolbarGroupComponent","editorConfig","group","index","toolbarStates","i18n","fieldProps","featureClientSchemaMap","schemaPath","groupState","groupStates","get","DropdownIcon","type","undefined","activeItem","activeItems","dropdownLabel","length","t","count","label","substring","_jsxs","className","items","Icon","itemsContainerClassNames","map","itemState","itemStates","features","toolbarFixed","groups","FixedToolbar","clientProps","parentWithFixedToolbar","currentToolbarRef","useRef","isEditable","y","parentToolbarElem","disableIfParentHasFixedToolbar","parentEditorElem","editorContainerRef","current","sibling","previousElementSibling","classList","contains","currentToolbarElem","currentRect","getBoundingClientRect","parentRect","overlapping","bottom","top","remove","add","onFocus","event","stopPropagation","ref","Fragment","i","getParentEditorWithFixedToolbar","editorConfigContext","parentEditor","resolvedFeatureMap","has","FixedToolbarPlugin","t0","$","currentEditor","currentEditorConfig","applyToFocusedEditor","focusedEditor","t1","t2","Symbol","for","bb0","document","body"],"sources":["../../../../../../src/features/toolbars/fixed/client/Toolbar/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { useScrollInfo, useThrottledEffect, useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { EditorConfigContextType } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport type { SanitizedClientEditorConfig } from '../../../../../lexical/config/types.js'\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { ToolbarStates } from '../../../shared/useToolbarStates.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../../types.js'\nimport type { FixedToolbarFeatureProps } from '../../server/index.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { ToolbarButton } from '../../../shared/ToolbarButton/index.js'\nimport { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js'\nimport { useToolbarStates } from '../../../shared/useToolbarStates.js'\nimport './index.scss'\n\nfunction ButtonGroupItem({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled: boolean\n item: ToolbarGroupItem\n}): React.ReactNode {\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component anchorElem={anchorElem} editor={editor} item={item} key={item.key} />\n )\n )\n }\n\n if (!item.ChildComponent) {\n return null\n }\n\n return (\n <ToolbarButton active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n <item.ChildComponent />\n </ToolbarButton>\n )\n}\n\nfunction ToolbarGroupComponent({\n anchorElem,\n editor,\n editorConfig,\n group,\n index,\n toolbarStates,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n group: ToolbarGroup\n index: number\n toolbarStates: ToolbarStates\n}): React.ReactNode {\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const groupState = toolbarStates.groupStates.get(group.key)\n\n const DropdownIcon = useMemo(() => {\n if (group.type !== 'dropdown') {\n return undefined\n }\n const activeItem = groupState?.activeItems?.[0]\n if (activeItem) {\n return activeItem.ChildComponent\n }\n return group.ChildComponent\n }, [group, groupState?.activeItems])\n\n const dropdownLabel = useMemo(() => {\n if (group.type !== 'dropdown') {\n return undefined\n }\n const activeItems = groupState?.activeItems\n if (!activeItems?.length) {\n return undefined\n }\n if (activeItems.length > 1) {\n return i18n.t('lexical:general:toolbarItemsActive', { count: activeItems.length })\n }\n const item = activeItems[0]!\n let label = item.key\n if (item.label) {\n label =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n if (label.length > 25) {\n label = label.substring(0, 25) + '...'\n }\n return label\n }, [group, groupState?.activeItems, i18n, featureClientSchemaMap, schemaPath])\n\n return (\n <div\n className={`fixed-toolbar__group fixed-toolbar__group-${group.key}`}\n data-toolbar-group-key={group.key}\n key={group.key}\n >\n {group.type === 'dropdown' && group.items.length && groupState ? (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n groupState={groupState}\n Icon={DropdownIcon}\n itemsContainerClassNames={['fixed-toolbar__dropdown-items']}\n label={dropdownLabel}\n />\n ) : null}\n {group.type === 'buttons' && group.items.length\n ? group.items.map((item) => {\n const itemState = toolbarStates.itemStates.get(item.key)\n return (\n <ButtonGroupItem\n active={itemState?.active ?? false}\n anchorElem={anchorElem}\n editor={editor}\n enabled={itemState?.enabled ?? true}\n item={item}\n key={item.key}\n />\n )\n })\n : null}\n {index < editorConfig.features.toolbarFixed?.groups.length - 1 && <div className=\"divider\" />}\n </div>\n )\n}\n\nfunction FixedToolbar({\n anchorElem,\n clientProps,\n editor,\n editorConfig,\n parentWithFixedToolbar,\n}: {\n anchorElem: HTMLElement\n clientProps?: FixedToolbarFeatureProps\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n parentWithFixedToolbar: EditorConfigContextType | false\n}): React.ReactNode {\n const currentToolbarRef = React.useRef<HTMLDivElement>(null)\n const isEditable = useLexicalEditable()\n\n const { y } = useScrollInfo()\n\n const toolbarStates = useToolbarStates(editor, editorConfig?.features?.toolbarFixed?.groups)\n\n // Memoize the parent toolbar element\n const parentToolbarElem = useMemo(() => {\n if (!parentWithFixedToolbar || clientProps?.disableIfParentHasFixedToolbar) {\n return null\n }\n\n const parentEditorElem = parentWithFixedToolbar.editorContainerRef.current\n let sibling = parentEditorElem.previousElementSibling\n while (sibling) {\n if (sibling.classList.contains('fixed-toolbar')) {\n return sibling\n }\n sibling = sibling.previousElementSibling\n }\n return null\n }, [clientProps?.disableIfParentHasFixedToolbar, parentWithFixedToolbar])\n\n useThrottledEffect(\n () => {\n if (!parentToolbarElem) {\n // this also checks for clientProps?.disableIfParentHasFixedToolbar indirectly, see the parentToolbarElem useMemo\n return\n }\n const currentToolbarElem = currentToolbarRef.current\n if (!currentToolbarElem) {\n return\n }\n\n const currentRect = currentToolbarElem.getBoundingClientRect()\n const parentRect = parentToolbarElem.getBoundingClientRect()\n\n // we only need to check for vertical overlap\n const overlapping = !(\n currentRect.bottom < parentRect.top || currentRect.top > parentRect.bottom\n )\n\n if (overlapping) {\n currentToolbarElem.classList.remove('fixed-toolbar')\n currentToolbarElem.classList.add('fixed-toolbar', 'fixed-toolbar--overlapping')\n parentToolbarElem.classList.remove('fixed-toolbar')\n parentToolbarElem.classList.add('fixed-toolbar', 'fixed-toolbar--hide')\n } else {\n if (!currentToolbarElem.classList.contains('fixed-toolbar--overlapping')) {\n return\n }\n currentToolbarElem.classList.remove('fixed-toolbar--overlapping')\n currentToolbarElem.classList.add('fixed-toolbar')\n parentToolbarElem.classList.remove('fixed-toolbar--hide')\n parentToolbarElem.classList.add('fixed-toolbar')\n }\n },\n 50,\n [currentToolbarRef, parentToolbarElem, y],\n )\n\n return (\n <div\n className=\"fixed-toolbar\"\n onFocus={(event) => {\n // Prevent other focus events being triggered. Otherwise, if this was to be clicked while in a child editor,\n // the parent editor will be focused, and the child editor will lose focus.\n event.stopPropagation()\n }}\n ref={currentToolbarRef}\n >\n {isEditable && (\n <React.Fragment>\n {editorConfig?.features &&\n editorConfig.features?.toolbarFixed?.groups.map((group, i) => {\n return (\n <ToolbarGroupComponent\n anchorElem={anchorElem}\n editor={editor}\n editorConfig={editorConfig}\n group={group}\n index={i}\n key={group.key}\n toolbarStates={toolbarStates}\n />\n )\n })}\n </React.Fragment>\n )}\n </div>\n )\n}\n\nconst getParentEditorWithFixedToolbar = (\n editorConfigContext: EditorConfigContextType,\n): EditorConfigContextType | false => {\n if (editorConfigContext.parentEditor?.editorConfig) {\n if (editorConfigContext.parentEditor?.editorConfig.resolvedFeatureMap.has('toolbarFixed')) {\n return editorConfigContext.parentEditor\n } else {\n if (editorConfigContext.parentEditor) {\n return getParentEditorWithFixedToolbar(editorConfigContext.parentEditor)\n }\n }\n }\n return false\n}\n\nexport const FixedToolbarPlugin: PluginComponent<FixedToolbarFeatureProps> = ({ clientProps }) => {\n const [currentEditor] = useLexicalComposerContext()\n const editorConfigContext = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n if (!isEditable) {\n return null\n }\n\n const { editorConfig: currentEditorConfig } = editorConfigContext\n\n const editor = clientProps.applyToFocusedEditor\n ? editorConfigContext.focusedEditor?.editor || currentEditor\n : currentEditor\n\n const editorConfig = clientProps.applyToFocusedEditor\n ? editorConfigContext.focusedEditor?.editorConfig || currentEditorConfig\n : currentEditorConfig\n\n const parentWithFixedToolbar = getParentEditorWithFixedToolbar(editorConfigContext)\n\n if (clientProps?.disableIfParentHasFixedToolbar) {\n if (parentWithFixedToolbar) {\n return null\n }\n }\n\n if (!editorConfig?.features?.toolbarFixed?.groups?.length) {\n return null\n }\n\n return (\n <FixedToolbar\n anchorElem={document.body}\n clientProps={clientProps}\n editor={editor}\n editorConfig={editorConfig}\n parentWithFixedToolbar={parentWithFixedToolbar}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,y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alEditable","useScrollInfo","useThrottledEffect","useTranslation","React","useMemo","useEditorConfigContext","ToolbarButton","ToolbarDropdown","useToolbarStates","ButtonGroupItem","active","anchorElem","editor","enabled","item","Component","_jsx","key","ChildComponent","ToolbarGroupComponent","editorConfig","group","index","toolbarStates","i18n","fieldProps","featureClientSchemaMap","schemaPath","groupState","groupStates","get","DropdownIcon","type","undefined","activeItem","activeItems","dropdownLabel","length","t","count","label","substring","_jsxs","className","items","Icon","itemsContainerClassNames","map","itemState","itemStates","features","toolbarFixed","groups","FixedToolbar","clientProps","parentWithFixedToolbar","currentToolbarRef","useRef","isEditable","y","parentToolbarElem","disableIfParentHasFixedToolbar","parentEditorElem","editorContainerRef","current","sibling","previousElementSibling","classList","contains","currentToolbarElem","currentRect","getBoundingClientRect","parentRect","overlapping","bottom","top","remove","add","onFocus","event","stopPropagation","ref","Fragment","i","getParentEditorWithFixedToolbar","editorConfigContext","parentEditor","resolvedFeatureMap","has","FixedToolbarPlugin","t0","$","currentEditor","currentEditorConfig","applyToFocusedEditor","focusedEditor","t1","t2","Symbol","for","bb0","document","body"],"sources":["../../../../../../src/features/toolbars/fixed/client/Toolbar/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { useScrollInfo, useThrottledEffect, useTranslation } from '@payloadcms/ui'\nimport * as React from 'react'\nimport { useMemo } from 'react'\n\nimport type { EditorConfigContextType } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport type { SanitizedClientEditorConfig } from '../../../../../lexical/config/types.js'\nimport type { PluginComponent } from '../../../../typesClient.js'\nimport type { ToolbarStates } from '../../../shared/useToolbarStates.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../../types.js'\nimport type { FixedToolbarFeatureProps } from '../../server/index.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { ToolbarButton } from '../../../shared/ToolbarButton/index.js'\nimport { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js'\nimport { useToolbarStates } from '../../../shared/useToolbarStates.js'\nimport './index.css'\n\nfunction ButtonGroupItem({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled: boolean\n item: ToolbarGroupItem\n}): React.ReactNode {\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component anchorElem={anchorElem} editor={editor} item={item} key={item.key} />\n )\n )\n }\n\n if (!item.ChildComponent) {\n return null\n }\n\n return (\n <ToolbarButton active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n <item.ChildComponent />\n </ToolbarButton>\n )\n}\n\nfunction ToolbarGroupComponent({\n anchorElem,\n editor,\n editorConfig,\n group,\n index,\n toolbarStates,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n group: ToolbarGroup\n index: number\n toolbarStates: ToolbarStates\n}): React.ReactNode {\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const groupState = toolbarStates.groupStates.get(group.key)\n\n const DropdownIcon = useMemo(() => {\n if (group.type !== 'dropdown') {\n return undefined\n }\n const activeItem = groupState?.activeItems?.[0]\n if (activeItem) {\n return activeItem.ChildComponent\n }\n return group.ChildComponent\n }, [group, groupState?.activeItems])\n\n const dropdownLabel = useMemo(() => {\n if (group.type !== 'dropdown') {\n return undefined\n }\n const activeItems = groupState?.activeItems\n if (!activeItems?.length) {\n return undefined\n }\n if (activeItems.length > 1) {\n return i18n.t('lexical:general:toolbarItemsActive', { count: activeItems.length })\n }\n const item = activeItems[0]!\n let label = item.key\n if (item.label) {\n label =\n typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n if (label.length > 25) {\n label = label.substring(0, 25) + '...'\n }\n return label\n }, [group, groupState?.activeItems, i18n, featureClientSchemaMap, schemaPath])\n\n return (\n <div\n className={`fixed-toolbar__group fixed-toolbar__group-${group.key}`}\n data-toolbar-group-key={group.key}\n key={group.key}\n >\n {group.type === 'dropdown' && group.items.length && groupState ? (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n groupState={groupState}\n Icon={DropdownIcon}\n itemsContainerClassNames={['fixed-toolbar__dropdown-items']}\n label={dropdownLabel}\n />\n ) : null}\n {group.type === 'buttons' && group.items.length\n ? group.items.map((item) => {\n const itemState = toolbarStates.itemStates.get(item.key)\n return (\n <ButtonGroupItem\n active={itemState?.active ?? false}\n anchorElem={anchorElem}\n editor={editor}\n enabled={itemState?.enabled ?? true}\n item={item}\n key={item.key}\n />\n )\n })\n : null}\n {index < editorConfig.features.toolbarFixed?.groups.length - 1 && <div className=\"divider\" />}\n </div>\n )\n}\n\nfunction FixedToolbar({\n anchorElem,\n clientProps,\n editor,\n editorConfig,\n parentWithFixedToolbar,\n}: {\n anchorElem: HTMLElement\n clientProps?: FixedToolbarFeatureProps\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n parentWithFixedToolbar: EditorConfigContextType | false\n}): React.ReactNode {\n const currentToolbarRef = React.useRef<HTMLDivElement>(null)\n const isEditable = useLexicalEditable()\n\n const { y } = useScrollInfo()\n\n const toolbarStates = useToolbarStates(editor, editorConfig?.features?.toolbarFixed?.groups)\n\n // Memoize the parent toolbar element\n const parentToolbarElem = useMemo(() => {\n if (!parentWithFixedToolbar || clientProps?.disableIfParentHasFixedToolbar) {\n return null\n }\n\n const parentEditorElem = parentWithFixedToolbar.editorContainerRef.current\n let sibling = parentEditorElem.previousElementSibling\n while (sibling) {\n if (sibling.classList.contains('fixed-toolbar')) {\n return sibling\n }\n sibling = sibling.previousElementSibling\n }\n return null\n }, [clientProps?.disableIfParentHasFixedToolbar, parentWithFixedToolbar])\n\n useThrottledEffect(\n () => {\n if (!parentToolbarElem) {\n // this also checks for clientProps?.disableIfParentHasFixedToolbar indirectly, see the parentToolbarElem useMemo\n return\n }\n const currentToolbarElem = currentToolbarRef.current\n if (!currentToolbarElem) {\n return\n }\n\n const currentRect = currentToolbarElem.getBoundingClientRect()\n const parentRect = parentToolbarElem.getBoundingClientRect()\n\n // we only need to check for vertical overlap\n const overlapping = !(\n currentRect.bottom < parentRect.top || currentRect.top > parentRect.bottom\n )\n\n if (overlapping) {\n currentToolbarElem.classList.remove('fixed-toolbar')\n currentToolbarElem.classList.add('fixed-toolbar', 'fixed-toolbar--overlapping')\n parentToolbarElem.classList.remove('fixed-toolbar')\n parentToolbarElem.classList.add('fixed-toolbar', 'fixed-toolbar--hide')\n } else {\n if (!currentToolbarElem.classList.contains('fixed-toolbar--overlapping')) {\n return\n }\n currentToolbarElem.classList.remove('fixed-toolbar--overlapping')\n currentToolbarElem.classList.add('fixed-toolbar')\n parentToolbarElem.classList.remove('fixed-toolbar--hide')\n parentToolbarElem.classList.add('fixed-toolbar')\n }\n },\n 50,\n [currentToolbarRef, parentToolbarElem, y],\n )\n\n return (\n <div\n className=\"fixed-toolbar\"\n onFocus={(event) => {\n // Prevent other focus events being triggered. Otherwise, if this was to be clicked while in a child editor,\n // the parent editor will be focused, and the child editor will lose focus.\n event.stopPropagation()\n }}\n ref={currentToolbarRef}\n >\n {isEditable && (\n <React.Fragment>\n {editorConfig?.features &&\n editorConfig.features?.toolbarFixed?.groups.map((group, i) => {\n return (\n <ToolbarGroupComponent\n anchorElem={anchorElem}\n editor={editor}\n editorConfig={editorConfig}\n group={group}\n index={i}\n key={group.key}\n toolbarStates={toolbarStates}\n />\n )\n })}\n </React.Fragment>\n )}\n </div>\n )\n}\n\nconst getParentEditorWithFixedToolbar = (\n editorConfigContext: EditorConfigContextType,\n): EditorConfigContextType | false => {\n if (editorConfigContext.parentEditor?.editorConfig) {\n if (editorConfigContext.parentEditor?.editorConfig.resolvedFeatureMap.has('toolbarFixed')) {\n return editorConfigContext.parentEditor\n } else {\n if (editorConfigContext.parentEditor) {\n return getParentEditorWithFixedToolbar(editorConfigContext.parentEditor)\n }\n }\n }\n return false\n}\n\nexport const FixedToolbarPlugin: PluginComponent<FixedToolbarFeatureProps> = ({ clientProps }) => {\n const [currentEditor] = useLexicalComposerContext()\n const editorConfigContext = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n if (!isEditable) {\n return null\n }\n\n const { editorConfig: currentEditorConfig } = editorConfigContext\n\n const editor = clientProps.applyToFocusedEditor\n ? editorConfigContext.focusedEditor?.editor || currentEditor\n : currentEditor\n\n const editorConfig = clientProps.applyToFocusedEditor\n ? editorConfigContext.focusedEditor?.editorConfig || currentEditorConfig\n : currentEditorConfig\n\n const parentWithFixedToolbar = getParentEditorWithFixedToolbar(editorConfigContext)\n\n if (clientProps?.disableIfParentHasFixedToolbar) {\n if (parentWithFixedToolbar) {\n return null\n }\n }\n\n if (!editorConfig?.features?.toolbarFixed?.groups?.length) {\n return null\n }\n\n return (\n <FixedToolbar\n anchorElem={document.body}\n clientProps={clientProps}\n editor={editor}\n editorConfig={editorConfig}\n parentWithFixedToolbar={parentWithFixedToolbar}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,cAAc,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,OAAO,QAAQ;AASxB,SAASC,sBAAsB,QAAQ;AACvC,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AAEP,SAASC,gBAAgB;EACvBC,MAAM;EACNC,UAAU;EACVC,MAAM;EACNC,OAAO;EACPC;AAAI,CAOL;EACC,IAAIA,IAAA,CAAKC,SAAS,EAAE;IAClB,OACED,IAAA,EAAMC,SAAA,iBACJC,IAAA,CAACF,IAAA,CAAKC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jBT,mBAAA,CAAAU,aAAA,EAAA3E,YAAA,IAAmDyE,mBAAA,GACnDA,mBAAA;EAAA,IAAAG,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAN,CAAA,QAAArC,WAAA,IAAAqC,CAAA,QAAA/E,MAAA,IAAA+E,CAAA,QAAAvE,YAAA,IAAAuE,CAAA,QAAAN,mBAAA;IAMOY,EAAA,GAAAC,MAAA,CAAAC,GAAA;IAAAC,GAAA;MAJX,MAAA7C,sBAAA,GAA+B6B,+BAAA,CAAgCC,mBAAA;MAAA,IAE3D/B,WAAA,EAAAO,8BAAA;QAAA,IACEN,sBAAA;UACK0C,EAAA;UAAA,MAAAG,GAAA;QAAA;MAAA;MAAA,KAINhF,YAAA,EAAA8B,QAAA,EAAAC,YAAA,EAAAC,MAAA,EAAAf,MAAA;QACI4D,EAAA;QAAA,MAAAG,GAAA;MAAA;MAIPJ,EAAA,GAAAhF,IAAA,CAAAqC,YAAA;QAAA1C,UAAA,EAAA0F,QAAA,CAAAC,IAAA;QAAAhD,WAAA;QAAA1C,MAAA;QAAAQ,YAAA;QAAAmC;MAAA,C;;;;;;;;;;;;;;;SAAAyC,E;CAQJ","ignoreList":[]}
@@ -0,0 +1,43 @@
1
+ @layer payload-default {
2
+ .inline-toolbar-popup {
3
+ display: flex;
4
+ align-items: center;
5
+ background: var(--color-bg);
6
+ padding: 0 var(--spacer-1);
7
+ gap: var(--spacer-1);
8
+ vertical-align: middle;
9
+ position: absolute;
10
+ top: 0;
11
+ left: 0;
12
+ z-index: 2;
13
+ opacity: 0;
14
+ border-radius: var(--radius-medium);
15
+ transition: opacity 0.2s;
16
+ will-change: transform;
17
+ box-shadow:
18
+ 0px 1px 2px 1px rgba(0, 0, 0, 0.1),
19
+ 0px 4px 16px 0px rgba(0, 0, 0, 0.2),
20
+ 0px -4px 8px 0px rgba(0, 0, 0, 0.1);
21
+ }
22
+
23
+ .inline-toolbar-popup__group {
24
+ display: flex;
25
+ align-items: center;
26
+ gap: var(--spacer-1);
27
+ height: var(--spacer-5);
28
+
29
+ .divider {
30
+ width: var(--stroke-width-small);
31
+ align-self: stretch;
32
+ background-color: var(--lexical-border-color);
33
+ }
34
+ }
35
+
36
+ html[data-theme='light'] {
37
+ .inline-toolbar-popup {
38
+ box-shadow:
39
+ 0px 1px 2px 1px rgba(0, 0, 0, 0.05),
40
+ 0px 4px 8px 0px rgba(0, 0, 0, 0.1);
41
+ }
42
+ }
43
+ }
@@ -1,4 +1,4 @@
1
1
  import type { PluginComponentWithAnchor } from '../../../../typesClient.js';
2
- import './index.scss';
2
+ import './index.css';
3
3
  export declare const InlineToolbarPlugin: PluginComponentWithAnchor<undefined>;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/toolbars/inline/client/Toolbar/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAU3E,OAAO,cAAc,CAAA;AA6WrB,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,SAAS,CAIpE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/features/toolbars/inline/client/Toolbar/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAA;AAU3E,OAAO,aAAa,CAAA;AA6WpB,eAAO,MAAM,mBAAmB,EAAE,yBAAyB,CAAC,SAAS,CAIpE,CAAA"}
@@ -15,6 +15,7 @@ import { setFloatingElemPosition } from '../../../../../lexical/utils/setFloatin
15
15
  import { ToolbarButton } from '../../../shared/ToolbarButton/index.js';
16
16
  import { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js';
17
17
  import { useToolbarStates } from '../../../shared/useToolbarStates.js';
18
+ import './index.css';
18
19
  function ButtonGroupItem({
19
20
  active,
20
21
  anchorElem,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useLexicalEditable","mergeRegister","$getSelection","$isRangeSelection","$isTextNode","COMMAND_PRIORITY_LOW","getDOMSelection","SELECTION_CHANGE_COMMAND","useCallback","useEffect","useMemo","useRef","useState","React","createPortal","useEditorConfigContext","getDOMRangeRect","setFloatingElemPosition","ToolbarButton","ToolbarDropdown","useToolbarStates","ButtonGroupItem","active","anchorElem","editor","enabled","item","Component","_jsx","key","ChildComponent","ToolbarGroupComponent","group","index","toolbarStates","editorConfig","groupState","groupStates","get","DropdownIcon","type","undefined","activeItem","activeItems","_jsxs","className","items","length","Icon","map","itemState","itemStates","features","toolbarInline","groups","InlineToolbar","floatingToolbarRef","caretRef","closeFloatingToolbar","current","isOpacityZero","style","opacity","isPointerEventsNone","pointerEvents","mouseMoveListener","e","buttons","x","clientX","y","clientY","elementUnderMouse","document","elementFromPoint","contains","mouseUpListener","addEventListener","removeEventListener","$updateTextFormatFloatingToolbar","selection","nativeSelection","_window","possibleLinkEditor","querySelector","isLinkEditorVisible","rootElement","getRootElement","isCollapsed","anchorNode","rangeRect","offsetIfFlipped","alwaysDisplayOnTop","floatingElem","horizontalPosition","targetRect","anchorFlippedOffset","horizontalOffset","specialHandlingForCaret","verticalGap","scrollerElem","parentElement","update","getEditorState","read","window","registerUpdateListener","editorState","registerCommand","ref","i","useInlineToolbar","$","isText","setIsText","isEditable","t0","isComposing","getTextContent","nodes","getNodes","foundNodeWithText","node","rawTextContent","replace","updatePopup","t1","t2","t3","t4","registerRootListener","t5","InlineToolbarPlugin"],"sources":["../../../../../../src/features/toolbars/inline/client/Toolbar/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n getDOMSelection,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../../typesClient.js'\nimport type { ToolbarStates } from '../../../shared/useToolbarStates.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../../types.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getDOMRangeRect } from '../../../../../lexical/utils/getDOMRangeRect.js'\nimport { setFloatingElemPosition } from '../../../../../lexical/utils/setFloatingElemPosition.js'\nimport { ToolbarButton } from '../../../shared/ToolbarButton/index.js'\nimport { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js'\nimport { useToolbarStates } from '../../../shared/useToolbarStates.js'\nimport './index.scss'\n\nfunction ButtonGroupItem({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled: boolean\n item: ToolbarGroupItem\n}): React.ReactNode {\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component anchorElem={anchorElem} editor={editor} item={item} key={item.key} />\n )\n )\n }\n if (!item.ChildComponent) {\n return null\n }\n\n return (\n <ToolbarButton active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n <item.ChildComponent />\n </ToolbarButton>\n )\n}\n\nfunction ToolbarGroupComponent({\n anchorElem,\n editor,\n group,\n index,\n toolbarStates,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n group: ToolbarGroup\n index: number\n toolbarStates: ToolbarStates\n}): React.ReactNode {\n const { editorConfig } = useEditorConfigContext()\n\n const groupState = toolbarStates.groupStates.get(group.key)\n\n const DropdownIcon = useMemo(() => {\n if (group.type !== 'dropdown') {\n return undefined\n }\n const activeItem = groupState?.activeItems?.[0]\n return activeItem?.ChildComponent ?? group.ChildComponent\n }, [group, groupState?.activeItems])\n\n return (\n <div\n className={`inline-toolbar-popup__group inline-toolbar-popup__group-${group.key}`}\n data-toolbar-group-key={group.key}\n key={group.key}\n >\n {group.type === 'dropdown' && group.items.length && groupState ? (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n groupState={groupState}\n Icon={DropdownIcon}\n />\n ) : null}\n {group.type === 'buttons' && group.items.length\n ? group.items.map((item) => {\n const itemState = toolbarStates.itemStates.get(item.key)\n return (\n <ButtonGroupItem\n active={itemState?.active ?? false}\n anchorElem={anchorElem}\n editor={editor}\n enabled={itemState?.enabled ?? true}\n item={item}\n key={item.key}\n />\n )\n })\n : null}\n {index < editorConfig.features.toolbarInline?.groups.length - 1 && (\n <div className=\"divider\" />\n )}\n </div>\n )\n}\n\nfunction InlineToolbar({\n anchorElem,\n editor,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n}): React.ReactNode {\n const floatingToolbarRef = useRef<HTMLDivElement | null>(null)\n const caretRef = useRef<HTMLDivElement | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const toolbarStates = useToolbarStates(editor, editorConfig?.features?.toolbarInline?.groups)\n\n const closeFloatingToolbar = useCallback(() => {\n if (floatingToolbarRef?.current) {\n const isOpacityZero = floatingToolbarRef.current.style.opacity === '0'\n const isPointerEventsNone = floatingToolbarRef.current.style.pointerEvents === 'none'\n\n if (!isOpacityZero) {\n floatingToolbarRef.current.style.opacity = '0'\n }\n if (!isPointerEventsNone) {\n floatingToolbarRef.current.style.pointerEvents = 'none'\n }\n }\n }, [floatingToolbarRef])\n\n const mouseMoveListener = useCallback(\n (e: MouseEvent) => {\n if (floatingToolbarRef?.current && (e.buttons === 1 || e.buttons === 3)) {\n const isOpacityZero = floatingToolbarRef.current.style.opacity === '0'\n const isPointerEventsNone = floatingToolbarRef.current.style.pointerEvents === 'none'\n if (!isOpacityZero || !isPointerEventsNone) {\n // Check if the mouse is not over the popup\n const x = e.clientX\n const y = e.clientY\n const elementUnderMouse = document.elementFromPoint(x, y)\n if (!floatingToolbarRef.current.contains(elementUnderMouse)) {\n // Mouse is not over the target element => not a normal click, but probably a drag\n closeFloatingToolbar()\n }\n }\n }\n },\n [closeFloatingToolbar],\n )\n\n const mouseUpListener = useCallback(() => {\n if (floatingToolbarRef?.current) {\n if (floatingToolbarRef.current.style.opacity !== '1') {\n floatingToolbarRef.current.style.opacity = '1'\n }\n if (floatingToolbarRef.current.style.pointerEvents !== 'auto') {\n floatingToolbarRef.current.style.pointerEvents = 'auto'\n }\n }\n }, [])\n\n useEffect(() => {\n document.addEventListener('mousemove', mouseMoveListener)\n document.addEventListener('mouseup', mouseUpListener)\n\n return () => {\n document.removeEventListener('mousemove', mouseMoveListener)\n document.removeEventListener('mouseup', mouseUpListener)\n }\n }, [floatingToolbarRef, mouseMoveListener, mouseUpListener])\n\n const $updateTextFormatFloatingToolbar = useCallback(() => {\n const selection = $getSelection()\n\n const nativeSelection = getDOMSelection(editor._window)\n\n if (floatingToolbarRef.current === null) {\n return\n }\n\n const possibleLinkEditor = anchorElem.querySelector(':scope > .link-editor')\n const isLinkEditorVisible =\n possibleLinkEditor !== null &&\n 'style' in possibleLinkEditor &&\n possibleLinkEditor?.style?.['opacity' as keyof typeof possibleLinkEditor.style] === '1'\n\n const rootElement = editor.getRootElement()\n if (\n selection !== null &&\n nativeSelection !== null &&\n !nativeSelection.isCollapsed &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n const rangeRect = getDOMRangeRect(nativeSelection, rootElement)\n\n // Position floating toolbar\n const offsetIfFlipped = setFloatingElemPosition({\n alwaysDisplayOnTop: isLinkEditorVisible,\n anchorElem,\n floatingElem: floatingToolbarRef.current,\n horizontalPosition: 'center',\n targetRect: rangeRect,\n })\n\n // Position caret\n if (caretRef.current) {\n setFloatingElemPosition({\n anchorElem: floatingToolbarRef.current,\n anchorFlippedOffset: offsetIfFlipped,\n floatingElem: caretRef.current,\n horizontalOffset: 5,\n horizontalPosition: 'center',\n specialHandlingForCaret: true,\n targetRect: rangeRect,\n verticalGap: 8,\n })\n }\n } else {\n closeFloatingToolbar()\n }\n }, [editor, closeFloatingToolbar, anchorElem])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = () => {\n editor.getEditorState().read(() => {\n $updateTextFormatFloatingToolbar()\n })\n }\n\n window.addEventListener('resize', update)\n if (scrollerElem) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n if (scrollerElem) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [editor, $updateTextFormatFloatingToolbar, anchorElem])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n $updateTextFormatFloatingToolbar()\n })\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n $updateTextFormatFloatingToolbar()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n $updateTextFormatFloatingToolbar()\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateTextFormatFloatingToolbar])\n\n return (\n <div className=\"inline-toolbar-popup\" ref={floatingToolbarRef}>\n <div className=\"caret\" ref={caretRef} />\n {editorConfig?.features &&\n editorConfig.features?.toolbarInline?.groups.map((group, i) => {\n return (\n <ToolbarGroupComponent\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n index={i}\n key={group.key}\n toolbarStates={toolbarStates}\n />\n )\n })}\n </div>\n )\n}\n\nfunction useInlineToolbar(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n): null | React.ReactElement {\n const [isText, setIsText] = useState(false)\n const isEditable = useLexicalEditable()\n\n const updatePopup = useCallback(() => {\n editor.getEditorState().read(() => {\n // Should not to pop up the floating toolbar when using IME input\n if (editor.isComposing()) {\n return\n }\n const selection = $getSelection()\n const nativeSelection = getDOMSelection(editor._window)\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n (!$isRangeSelection(selection) ||\n rootElement === null ||\n !rootElement.contains(nativeSelection.anchorNode))\n ) {\n setIsText(false)\n return\n }\n\n if (!$isRangeSelection(selection)) {\n return\n }\n\n if (selection.getTextContent() !== '') {\n const nodes = selection.getNodes()\n let foundNodeWithText = false\n for (const node of nodes) {\n if ($isTextNode(node)) {\n setIsText(true)\n foundNodeWithText = true\n break\n }\n }\n if (!foundNodeWithText) {\n setIsText(false)\n }\n } else {\n setIsText(false)\n }\n\n const rawTextContent = selection.getTextContent().replace(/\\n/g, '')\n if (!selection.isCollapsed() && rawTextContent === '') {\n setIsText(false)\n return\n }\n })\n }, [editor])\n\n useEffect(() => {\n document.addEventListener('selectionchange', updatePopup)\n document.addEventListener('mouseup', updatePopup)\n return () => {\n document.removeEventListener('selectionchange', updatePopup)\n document.removeEventListener('mouseup', updatePopup)\n }\n }, [updatePopup])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updatePopup()\n }),\n editor.registerRootListener(() => {\n if (editor.getRootElement() === null) {\n setIsText(false)\n }\n }),\n )\n }, [editor, updatePopup])\n\n if (!isText || !isEditable) {\n return null\n }\n\n return createPortal(<InlineToolbar anchorElem={anchorElem} editor={editor} />, anchorElem)\n}\n\nexport const InlineToolbarPlugin: PluginComponentWithAnchor<undefined> = ({ anchorElem }) => {\n const [editor] = useLexicalComposerContext()\n\n return useInlineToolbar(editor, anchorElem)\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,WAAW,EACXC,oBAAoB,EACpBC,eAAe,EACfC,wBAAwB,QACnB;AACP,SAASC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,YAAY,QAAQ;AAM7B,SAASC,sBAAsB,QAAQ;AACvC,SAASC,eAAe,QAAQ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F;EAAA,IAAA6F,EAAc;EACtF,OAAA5F,MAAA,IAAiBzB,yBAAA;EAAA,OAEVgH,gBAAA,CAAiBvF,MAAA,EAAQD,UAAA;AAAA,CAClC","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","useLexicalEditable","mergeRegister","$getSelection","$isRangeSelection","$isTextNode","COMMAND_PRIORITY_LOW","getDOMSelection","SELECTION_CHANGE_COMMAND","useCallback","useEffect","useMemo","useRef","useState","React","createPortal","useEditorConfigContext","getDOMRangeRect","setFloatingElemPosition","ToolbarButton","ToolbarDropdown","useToolbarStates","ButtonGroupItem","active","anchorElem","editor","enabled","item","Component","_jsx","key","ChildComponent","ToolbarGroupComponent","group","index","toolbarStates","editorConfig","groupState","groupStates","get","DropdownIcon","type","undefined","activeItem","activeItems","_jsxs","className","items","length","Icon","map","itemState","itemStates","features","toolbarInline","groups","InlineToolbar","floatingToolbarRef","caretRef","closeFloatingToolbar","current","isOpacityZero","style","opacity","isPointerEventsNone","pointerEvents","mouseMoveListener","e","buttons","x","clientX","y","clientY","elementUnderMouse","document","elementFromPoint","contains","mouseUpListener","addEventListener","removeEventListener","$updateTextFormatFloatingToolbar","selection","nativeSelection","_window","possibleLinkEditor","querySelector","isLinkEditorVisible","rootElement","getRootElement","isCollapsed","anchorNode","rangeRect","offsetIfFlipped","alwaysDisplayOnTop","floatingElem","horizontalPosition","targetRect","anchorFlippedOffset","horizontalOffset","specialHandlingForCaret","verticalGap","scrollerElem","parentElement","update","getEditorState","read","window","registerUpdateListener","editorState","registerCommand","ref","i","useInlineToolbar","$","isText","setIsText","isEditable","t0","isComposing","getTextContent","nodes","getNodes","foundNodeWithText","node","rawTextContent","replace","updatePopup","t1","t2","t3","t4","registerRootListener","t5","InlineToolbarPlugin"],"sources":["../../../../../../src/features/toolbars/inline/client/Toolbar/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isRangeSelection,\n $isTextNode,\n COMMAND_PRIORITY_LOW,\n getDOMSelection,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport type { PluginComponentWithAnchor } from '../../../../typesClient.js'\nimport type { ToolbarStates } from '../../../shared/useToolbarStates.js'\nimport type { ToolbarGroup, ToolbarGroupItem } from '../../../types.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { getDOMRangeRect } from '../../../../../lexical/utils/getDOMRangeRect.js'\nimport { setFloatingElemPosition } from '../../../../../lexical/utils/setFloatingElemPosition.js'\nimport { ToolbarButton } from '../../../shared/ToolbarButton/index.js'\nimport { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js'\nimport { useToolbarStates } from '../../../shared/useToolbarStates.js'\nimport './index.css'\n\nfunction ButtonGroupItem({\n active,\n anchorElem,\n editor,\n enabled,\n item,\n}: {\n active: boolean\n anchorElem: HTMLElement\n editor: LexicalEditor\n enabled: boolean\n item: ToolbarGroupItem\n}): React.ReactNode {\n if (item.Component) {\n return (\n item?.Component && (\n <item.Component anchorElem={anchorElem} editor={editor} item={item} key={item.key} />\n )\n )\n }\n if (!item.ChildComponent) {\n return null\n }\n\n return (\n <ToolbarButton active={active} editor={editor} enabled={enabled} item={item} key={item.key}>\n <item.ChildComponent />\n </ToolbarButton>\n )\n}\n\nfunction ToolbarGroupComponent({\n anchorElem,\n editor,\n group,\n index,\n toolbarStates,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n group: ToolbarGroup\n index: number\n toolbarStates: ToolbarStates\n}): React.ReactNode {\n const { editorConfig } = useEditorConfigContext()\n\n const groupState = toolbarStates.groupStates.get(group.key)\n\n const DropdownIcon = useMemo(() => {\n if (group.type !== 'dropdown') {\n return undefined\n }\n const activeItem = groupState?.activeItems?.[0]\n return activeItem?.ChildComponent ?? group.ChildComponent\n }, [group, groupState?.activeItems])\n\n return (\n <div\n className={`inline-toolbar-popup__group inline-toolbar-popup__group-${group.key}`}\n data-toolbar-group-key={group.key}\n key={group.key}\n >\n {group.type === 'dropdown' && group.items.length && groupState ? (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n groupState={groupState}\n Icon={DropdownIcon}\n />\n ) : null}\n {group.type === 'buttons' && group.items.length\n ? group.items.map((item) => {\n const itemState = toolbarStates.itemStates.get(item.key)\n return (\n <ButtonGroupItem\n active={itemState?.active ?? false}\n anchorElem={anchorElem}\n editor={editor}\n enabled={itemState?.enabled ?? true}\n item={item}\n key={item.key}\n />\n )\n })\n : null}\n {index < editorConfig.features.toolbarInline?.groups.length - 1 && (\n <div className=\"divider\" />\n )}\n </div>\n )\n}\n\nfunction InlineToolbar({\n anchorElem,\n editor,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n}): React.ReactNode {\n const floatingToolbarRef = useRef<HTMLDivElement | null>(null)\n const caretRef = useRef<HTMLDivElement | null>(null)\n\n const { editorConfig } = useEditorConfigContext()\n\n const toolbarStates = useToolbarStates(editor, editorConfig?.features?.toolbarInline?.groups)\n\n const closeFloatingToolbar = useCallback(() => {\n if (floatingToolbarRef?.current) {\n const isOpacityZero = floatingToolbarRef.current.style.opacity === '0'\n const isPointerEventsNone = floatingToolbarRef.current.style.pointerEvents === 'none'\n\n if (!isOpacityZero) {\n floatingToolbarRef.current.style.opacity = '0'\n }\n if (!isPointerEventsNone) {\n floatingToolbarRef.current.style.pointerEvents = 'none'\n }\n }\n }, [floatingToolbarRef])\n\n const mouseMoveListener = useCallback(\n (e: MouseEvent) => {\n if (floatingToolbarRef?.current && (e.buttons === 1 || e.buttons === 3)) {\n const isOpacityZero = floatingToolbarRef.current.style.opacity === '0'\n const isPointerEventsNone = floatingToolbarRef.current.style.pointerEvents === 'none'\n if (!isOpacityZero || !isPointerEventsNone) {\n // Check if the mouse is not over the popup\n const x = e.clientX\n const y = e.clientY\n const elementUnderMouse = document.elementFromPoint(x, y)\n if (!floatingToolbarRef.current.contains(elementUnderMouse)) {\n // Mouse is not over the target element => not a normal click, but probably a drag\n closeFloatingToolbar()\n }\n }\n }\n },\n [closeFloatingToolbar],\n )\n\n const mouseUpListener = useCallback(() => {\n if (floatingToolbarRef?.current) {\n if (floatingToolbarRef.current.style.opacity !== '1') {\n floatingToolbarRef.current.style.opacity = '1'\n }\n if (floatingToolbarRef.current.style.pointerEvents !== 'auto') {\n floatingToolbarRef.current.style.pointerEvents = 'auto'\n }\n }\n }, [])\n\n useEffect(() => {\n document.addEventListener('mousemove', mouseMoveListener)\n document.addEventListener('mouseup', mouseUpListener)\n\n return () => {\n document.removeEventListener('mousemove', mouseMoveListener)\n document.removeEventListener('mouseup', mouseUpListener)\n }\n }, [floatingToolbarRef, mouseMoveListener, mouseUpListener])\n\n const $updateTextFormatFloatingToolbar = useCallback(() => {\n const selection = $getSelection()\n\n const nativeSelection = getDOMSelection(editor._window)\n\n if (floatingToolbarRef.current === null) {\n return\n }\n\n const possibleLinkEditor = anchorElem.querySelector(':scope > .link-editor')\n const isLinkEditorVisible =\n possibleLinkEditor !== null &&\n 'style' in possibleLinkEditor &&\n possibleLinkEditor?.style?.['opacity' as keyof typeof possibleLinkEditor.style] === '1'\n\n const rootElement = editor.getRootElement()\n if (\n selection !== null &&\n nativeSelection !== null &&\n !nativeSelection.isCollapsed &&\n rootElement !== null &&\n rootElement.contains(nativeSelection.anchorNode)\n ) {\n const rangeRect = getDOMRangeRect(nativeSelection, rootElement)\n\n // Position floating toolbar\n const offsetIfFlipped = setFloatingElemPosition({\n alwaysDisplayOnTop: isLinkEditorVisible,\n anchorElem,\n floatingElem: floatingToolbarRef.current,\n horizontalPosition: 'center',\n targetRect: rangeRect,\n })\n\n // Position caret\n if (caretRef.current) {\n setFloatingElemPosition({\n anchorElem: floatingToolbarRef.current,\n anchorFlippedOffset: offsetIfFlipped,\n floatingElem: caretRef.current,\n horizontalOffset: 5,\n horizontalPosition: 'center',\n specialHandlingForCaret: true,\n targetRect: rangeRect,\n verticalGap: 8,\n })\n }\n } else {\n closeFloatingToolbar()\n }\n }, [editor, closeFloatingToolbar, anchorElem])\n\n useEffect(() => {\n const scrollerElem = anchorElem.parentElement\n\n const update = () => {\n editor.getEditorState().read(() => {\n $updateTextFormatFloatingToolbar()\n })\n }\n\n window.addEventListener('resize', update)\n if (scrollerElem) {\n scrollerElem.addEventListener('scroll', update)\n }\n\n return () => {\n window.removeEventListener('resize', update)\n if (scrollerElem) {\n scrollerElem.removeEventListener('scroll', update)\n }\n }\n }, [editor, $updateTextFormatFloatingToolbar, anchorElem])\n\n useEffect(() => {\n editor.getEditorState().read(() => {\n $updateTextFormatFloatingToolbar()\n })\n return mergeRegister(\n editor.registerUpdateListener(({ editorState }) => {\n editorState.read(() => {\n $updateTextFormatFloatingToolbar()\n })\n }),\n\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n $updateTextFormatFloatingToolbar()\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor, $updateTextFormatFloatingToolbar])\n\n return (\n <div className=\"inline-toolbar-popup\" ref={floatingToolbarRef}>\n <div className=\"caret\" ref={caretRef} />\n {editorConfig?.features &&\n editorConfig.features?.toolbarInline?.groups.map((group, i) => {\n return (\n <ToolbarGroupComponent\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n index={i}\n key={group.key}\n toolbarStates={toolbarStates}\n />\n )\n })}\n </div>\n )\n}\n\nfunction useInlineToolbar(\n editor: LexicalEditor,\n anchorElem: HTMLElement,\n): null | React.ReactElement {\n const [isText, setIsText] = useState(false)\n const isEditable = useLexicalEditable()\n\n const updatePopup = useCallback(() => {\n editor.getEditorState().read(() => {\n // Should not to pop up the floating toolbar when using IME input\n if (editor.isComposing()) {\n return\n }\n const selection = $getSelection()\n const nativeSelection = getDOMSelection(editor._window)\n const rootElement = editor.getRootElement()\n\n if (\n nativeSelection !== null &&\n (!$isRangeSelection(selection) ||\n rootElement === null ||\n !rootElement.contains(nativeSelection.anchorNode))\n ) {\n setIsText(false)\n return\n }\n\n if (!$isRangeSelection(selection)) {\n return\n }\n\n if (selection.getTextContent() !== '') {\n const nodes = selection.getNodes()\n let foundNodeWithText = false\n for (const node of nodes) {\n if ($isTextNode(node)) {\n setIsText(true)\n foundNodeWithText = true\n break\n }\n }\n if (!foundNodeWithText) {\n setIsText(false)\n }\n } else {\n setIsText(false)\n }\n\n const rawTextContent = selection.getTextContent().replace(/\\n/g, '')\n if (!selection.isCollapsed() && rawTextContent === '') {\n setIsText(false)\n return\n }\n })\n }, [editor])\n\n useEffect(() => {\n document.addEventListener('selectionchange', updatePopup)\n document.addEventListener('mouseup', updatePopup)\n return () => {\n document.removeEventListener('selectionchange', updatePopup)\n document.removeEventListener('mouseup', updatePopup)\n }\n }, [updatePopup])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerUpdateListener(() => {\n updatePopup()\n }),\n editor.registerRootListener(() => {\n if (editor.getRootElement() === null) {\n setIsText(false)\n }\n }),\n )\n }, [editor, updatePopup])\n\n if (!isText || !isEditable) {\n return null\n }\n\n return createPortal(<InlineToolbar anchorElem={anchorElem} editor={editor} />, anchorElem)\n}\n\nexport const InlineToolbarPlugin: PluginComponentWithAnchor<undefined> = ({ anchorElem }) => {\n const [editor] = useLexicalComposerContext()\n\n return useInlineToolbar(editor, anchorElem)\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,kBAAkB,QAAQ;AACnC,SAASC,aAAa,QAAQ;AAC9B,SACEC,aAAa,EACbC,iBAAiB,EACjBC,WAAW,EACXC,oBAAoB,EACpBC,eAAe,EACfC,wBAAwB,QACnB;AACP,SAASC,WAAW,EAAEC,SAAS,EAAEC,O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;IAAAwF,CAAA,OAAAmB,EAAA;EAAA;IAAAA,EAAA,GAAAnB,CAAA;EAAA;EAAA,OAAxEmB,EAAwE;AAAA;AAGjF,OAAO,MAAMC,mBAAA,GAA4DhB,EAAA;EAAC;IAAA7F;EAAA,IAAA6F,EAAc;EACtF,OAAA5F,MAAA,IAAiBzB,yBAAA;EAAA,OAEVgH,gBAAA,CAAiBvF,MAAA,EAAQD,UAAA;AAAA,CAClC","ignoreList":[]}
@@ -0,0 +1,57 @@
1
+ @layer payload-default {
2
+ .toolbar-popup__button {
3
+ position: relative;
4
+ display: flex;
5
+ align-items: center;
6
+ vertical-align: middle;
7
+ justify-content: center;
8
+ height: var(--spacer-4);
9
+ width: var(--spacer-4);
10
+ border: 0;
11
+ background: none;
12
+ border-radius: var(--radius-medium);
13
+ cursor: pointer;
14
+ padding: 0;
15
+
16
+ &:hover:not(.active):not([data-pressing]) {
17
+ background-color: var(--color-bg-transparent-hover);
18
+ }
19
+
20
+ &:active:not(.active),
21
+ &[data-pressing]:not(.active) {
22
+ background-color: var(--color-bg-transparent-pressed);
23
+ }
24
+
25
+ &.active {
26
+ background-color: var(--color-bg-selected);
27
+
28
+ &:hover {
29
+ background-color: var(--color-bg-selected-hover);
30
+ }
31
+
32
+ &:active {
33
+ background-color: var(--color-bg-selected-pressed);
34
+ }
35
+
36
+ svg {
37
+ color: var(--color-icon-selected);
38
+ }
39
+
40
+ .icon {
41
+ opacity: 1;
42
+ }
43
+ }
44
+
45
+ &.disabled {
46
+ cursor: not-allowed;
47
+
48
+ &:hover {
49
+ background: none;
50
+ }
51
+
52
+ .icon {
53
+ opacity: 0.2;
54
+ }
55
+ }
56
+ }
57
+ }
@@ -1,7 +1,7 @@
1
1
  import type { LexicalEditor } from 'lexical';
2
2
  import React from 'react';
3
3
  import type { ToolbarGroupItem } from '../../types.js';
4
- import './index.scss';
4
+ import './index.css';
5
5
  export declare const ToolbarButton: ({ active, children, editor, enabled, item, }: {
6
6
  active?: boolean;
7
7
  children: React.JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/shared/ToolbarButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C,OAAO,KAA+B,MAAM,OAAO,CAAA;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,aAAa,iDAMvB;IACD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;IAC3B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,gBAAgB,CAAA;CACvB,sBA+CA,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/shared/ToolbarButton/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAI5C,OAAO,KAA4D,MAAM,OAAO,CAAA;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAGtD,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,aAAa,iDAMvB;IACD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,OAAO,CAAA;IAC3B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,gBAAgB,CAAA;CACvB,sBAmFA,CAAA"}
@@ -1,83 +1,89 @@
1
1
  'use client';
2
2
 
3
- import { c as _c } from "react/compiler-runtime";
4
- import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ import { Tooltip, useTranslation } from '@payloadcms/ui';
5
5
  import { $addUpdateTag } from 'lexical';
6
- import React, { useCallback, useMemo } from 'react';
6
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
7
+ import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
8
+ import './index.css';
7
9
  const baseClass = 'toolbar-popup__button';
8
- export const ToolbarButton = t0 => {
9
- const $ = _c(14);
10
+ export const ToolbarButton = ({
11
+ active = false,
12
+ children,
13
+ editor,
14
+ enabled = true,
15
+ item
16
+ }) => {
10
17
  const {
11
- active: t1,
12
- children,
13
- editor,
14
- enabled: t2,
15
- item
16
- } = t0;
17
- const active = t1 === undefined ? false : t1;
18
- const enabled = t2 === undefined ? true : t2;
19
- const t3 = !enabled ? "disabled" : "";
20
- const t4 = active ? "active" : "";
21
- const t5 = item.key ? `${baseClass}-${item.key}` : "";
22
- let t6;
23
- if ($[0] !== t3 || $[1] !== t4 || $[2] !== t5) {
24
- t6 = [baseClass, t3, t4, t5].filter(Boolean);
25
- $[0] = t3;
26
- $[1] = t4;
27
- $[2] = t5;
28
- $[3] = t6;
29
- } else {
30
- t6 = $[3];
31
- }
32
- const className = t6.join(" ");
33
- let t7;
34
- if ($[4] !== active || $[5] !== editor || $[6] !== enabled || $[7] !== item) {
35
- t7 = () => {
36
- if (!enabled) {
37
- return;
38
- }
39
- editor.focus(() => {
40
- editor.update(_temp);
41
- item.onSelect?.({
42
- editor,
43
- isActive: active
44
- });
18
+ i18n
19
+ } = useTranslation();
20
+ const {
21
+ fieldProps: {
22
+ featureClientSchemaMap,
23
+ schemaPath
24
+ }
25
+ } = useEditorConfigContext();
26
+ const [showTooltip, setShowTooltip] = useState(false);
27
+ const buttonRef = useRef(null);
28
+ // Clear pressing state when active prop changes (React has re-rendered)
29
+ useEffect(() => {
30
+ buttonRef.current?.removeAttribute('data-pressing');
31
+ }, [active]);
32
+ const tooltipLabel = useMemo(() => {
33
+ if (item.label) {
34
+ return typeof item.label === 'function' ? item.label({
35
+ featureClientSchemaMap,
36
+ i18n,
37
+ schemaPath
38
+ }) : item.label;
39
+ }
40
+ // Convert camelCase key to Title Case (e.g. "inlineCode" -> "Inline Code")
41
+ return item.key.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, c => c.toUpperCase());
42
+ }, [featureClientSchemaMap, i18n, schemaPath, item]);
43
+ const className = useMemo(() => {
44
+ return [baseClass, !enabled ? 'disabled' : '', active ? 'active' : '', item.key ? `${baseClass}-${item.key}` : ''].filter(Boolean).join(' ');
45
+ }, [active, enabled, item.key]);
46
+ const handleClick = useCallback(() => {
47
+ if (!enabled) {
48
+ return;
49
+ }
50
+ editor.focus(() => {
51
+ editor.update(() => {
52
+ $addUpdateTag('toolbar');
53
+ });
54
+ // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called.
55
+ item.onSelect?.({
56
+ editor,
57
+ isActive: active
45
58
  });
46
- };
47
- $[4] = active;
48
- $[5] = editor;
49
- $[6] = enabled;
50
- $[7] = item;
51
- $[8] = t7;
52
- } else {
53
- t7 = $[8];
54
- }
55
- const handleClick = t7;
56
- const handleMouseDown = _temp2;
57
- let t8;
58
- if ($[9] !== children || $[10] !== className || $[11] !== handleClick || $[12] !== item.key) {
59
- t8 = _jsx("button", {
60
- className,
61
- "data-button-key": item.key,
62
- onClick: handleClick,
63
- onMouseDown: handleMouseDown,
64
- type: "button",
65
- children
66
59
  });
67
- $[9] = children;
68
- $[10] = className;
69
- $[11] = handleClick;
70
- $[12] = item.key;
71
- $[13] = t8;
72
- } else {
73
- t8 = $[13];
74
- }
75
- return t8;
60
+ }, [editor, item, active, enabled]);
61
+ const handleMouseDown = useCallback(e => {
62
+ // This fixes a bug where you are unable to click the button if you are in a NESTED editor (editor in blocks field in editor).
63
+ // Thus only happens if you click on the SVG of the button. Clicking on the outside works. Related issue: https://github.com/payloadcms/payload/issues/4025
64
+ // TODO: Find out why exactly it happens and why e.preventDefault() on the mouseDown fixes it. Write that down here, or potentially fix a root cause, if there is any.
65
+ e.preventDefault();
66
+ e.currentTarget.setAttribute('data-pressing', '');
67
+ }, []);
68
+ return /*#__PURE__*/_jsxs("button", {
69
+ "aria-label": tooltipLabel,
70
+ className: className,
71
+ "data-button-key": item.key,
72
+ disabled: !enabled,
73
+ onClick: handleClick,
74
+ onMouseDown: handleMouseDown,
75
+ onPointerEnter: () => setShowTooltip(true),
76
+ onPointerLeave: () => {
77
+ setShowTooltip(false);
78
+ buttonRef.current?.removeAttribute('data-pressing');
79
+ },
80
+ ref: buttonRef,
81
+ type: "button",
82
+ children: [/*#__PURE__*/_jsx(Tooltip, {
83
+ className: `${baseClass}__tooltip`,
84
+ show: showTooltip,
85
+ children: tooltipLabel
86
+ }), children]
87
+ });
76
88
  };
77
- function _temp() {
78
- $addUpdateTag("toolbar");
79
- }
80
- function _temp2(e) {
81
- e.preventDefault();
82
- }
83
89
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","$addUpdateTag","React","useCallback","useMemo","baseClass","ToolbarButton","t0","$","active","t1","children","editor","enabled","t2","item","undefined","t3","t4","t5","key","t6","filter","Boolean","className","join","t7","focus","update","_temp","onSelect","isActive","handleClick","handleMouseDown","_temp2","t8","_jsx","onClick","onMouseDown","type","e","preventDefault"],"sources":["../../../../../src/features/toolbars/shared/ToolbarButton/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { $addUpdateTag } from 'lexical'\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { ToolbarGroupItem } from '../../types.js'\n\nimport './index.scss'\n\nconst baseClass = 'toolbar-popup__button'\n\nexport const ToolbarButton = ({\n active = false,\n children,\n editor,\n enabled = true,\n item,\n}: {\n active?: boolean\n children: React.JSX.Element\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n}) => {\n const className = useMemo(() => {\n return [\n baseClass,\n !enabled ? 'disabled' : '',\n active ? 'active' : '',\n item.key ? `${baseClass}-${item.key}` : '',\n ]\n .filter(Boolean)\n .join(' ')\n }, [active, enabled, item.key])\n\n const handleClick = useCallback(() => {\n if (!enabled) {\n return\n }\n\n editor.focus(() => {\n editor.update(() => {\n $addUpdateTag('toolbar')\n })\n // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called.\n item.onSelect?.({\n editor,\n isActive: active,\n })\n })\n }, [editor, item, active, enabled])\n\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n // This fixes a bug where you are unable to click the button if you are in a NESTED editor (editor in blocks field in editor).\n // Thus only happens if you click on the SVG of the button. Clicking on the outside works. Related issue: https://github.com/payloadcms/payload/issues/4025\n // TODO: Find out why exactly it happens and why e.preventDefault() on the mouseDown fixes it. Write that down here, or potentially fix a root cause, if there is any.\n e.preventDefault()\n }, [])\n\n return (\n <button\n className={className}\n data-button-key={item.key}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n type=\"button\"\n >\n {children}\n </button>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,aAAa,QAAQ;AAC9B,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAM5C,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,aAAA,GAAgBC,EAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAAC;IAAAS,MAAA,EAAAC,EAAA;IAAAC,QAAA;IAAAC,MAAA;IAAAC,OAAA,EAAAC,EAAA;IAAAC;EAAA,IAAAR,EAY7B;EAXC,MAAAE,MAAA,GAAAC,EAAc,KAAAM,SAAA,WAAdN,EAAc;EAGd,MAAAG,OAAA,GAAAC,EAAc,KAAAE,SAAA,UAAdF,EAAc;EAYV,MAAAG,EAAA,IAACJ,OAAA,GAAU,aAAa;EACxB,MAAAK,EAAA,GAAAT,MAAA,GAAS,WAAW;EACpB,MAAAU,EAAA,GAAAJ,IAAA,CAAAK,GAAA,GAAW,GAAAf,SAAA,IAAgBU,IAAA,CAAAK,GAAA,EAAU,GAA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EACRL,WAAA;MAAAM,WAAA,EACIL,eAAA;MAAAM,IAAA,EACR;MAAA5B;IAAA,C;;;;;;;;;SALPwB,E;CAUJ;AA3D6B,SAAAN,MAAA;EA+BrB5B,aAAA,CAAc;AAAA;AA/BO,SAAAiC,OAAAM,CAAA;EA6CzBA,CAAA,CAAAC,cAAA,CAAgB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Tooltip","useTranslation","$addUpdateTag","React","useCallback","useEffect","useMemo","useRef","useState","useEditorConfigContext","baseClass","ToolbarButton","active","children","editor","enabled","item","i18n","fieldProps","featureClientSchemaMap","schemaPath","showTooltip","setShowTooltip","buttonRef","current","removeAttribute","tooltipLabel","label","key","replace","c","toUpperCase","className","filter","Boolean","join","handleClick","focus","update","onSelect","isActive","handleMouseDown","e","preventDefault","currentTarget","setAttribute","_jsxs","disabled","onClick","onMouseDown","onPointerEnter","onPointerLeave","ref","type","_jsx","show"],"sources":["../../../../../src/features/toolbars/shared/ToolbarButton/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalEditor } from 'lexical'\n\nimport { Tooltip, useTranslation } from '@payloadcms/ui'\nimport { $addUpdateTag } from 'lexical'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport type { ToolbarGroupItem } from '../../types.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport './index.css'\n\nconst baseClass = 'toolbar-popup__button'\n\nexport const ToolbarButton = ({\n active = false,\n children,\n editor,\n enabled = true,\n item,\n}: {\n active?: boolean\n children: React.JSX.Element\n editor: LexicalEditor\n enabled?: boolean\n item: ToolbarGroupItem\n}) => {\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const [showTooltip, setShowTooltip] = useState(false)\n const buttonRef = useRef<HTMLButtonElement>(null)\n\n // Clear pressing state when active prop changes (React has re-rendered)\n useEffect(() => {\n buttonRef.current?.removeAttribute('data-pressing')\n }, [active])\n\n const tooltipLabel = useMemo(() => {\n if (item.label) {\n return typeof item.label === 'function'\n ? item.label({ featureClientSchemaMap, i18n, schemaPath })\n : item.label\n }\n // Convert camelCase key to Title Case (e.g. \"inlineCode\" -> \"Inline Code\")\n return item.key.replace(/([a-z])([A-Z])/g, '$1 $2').replace(/^./, (c) => c.toUpperCase())\n }, [featureClientSchemaMap, i18n, schemaPath, item])\n\n const className = useMemo(() => {\n return [\n baseClass,\n !enabled ? 'disabled' : '',\n active ? 'active' : '',\n item.key ? `${baseClass}-${item.key}` : '',\n ]\n .filter(Boolean)\n .join(' ')\n }, [active, enabled, item.key])\n\n const handleClick = useCallback(() => {\n if (!enabled) {\n return\n }\n\n editor.focus(() => {\n editor.update(() => {\n $addUpdateTag('toolbar')\n })\n // We need to wrap the onSelect in the callback, so the editor is properly focused before the onSelect is called.\n item.onSelect?.({\n editor,\n isActive: active,\n })\n })\n }, [editor, item, active, enabled])\n\n const handleMouseDown = useCallback((e: React.MouseEvent) => {\n // This fixes a bug where you are unable to click the button if you are in a NESTED editor (editor in blocks field in editor).\n // Thus only happens if you click on the SVG of the button. Clicking on the outside works. Related issue: https://github.com/payloadcms/payload/issues/4025\n // TODO: Find out why exactly it happens and why e.preventDefault() on the mouseDown fixes it. Write that down here, or potentially fix a root cause, if there is any.\n e.preventDefault()\n // Suppress hover flash between mouseup and React adding .active class\n ;(e.currentTarget as HTMLElement).setAttribute('data-pressing', '')\n }, [])\n\n return (\n <button\n aria-label={tooltipLabel}\n className={className}\n data-button-key={item.key}\n disabled={!enabled}\n onClick={handleClick}\n onMouseDown={handleMouseDown}\n onPointerEnter={() => setShowTooltip(true)}\n onPointerLeave={() => {\n setShowTooltip(false)\n buttonRef.current?.removeAttribute('data-pressing')\n }}\n ref={buttonRef}\n type=\"button\"\n >\n <Tooltip className={`${baseClass}__tooltip`} show={showTooltip}>\n {tooltipLabel}\n </Tooltip>\n {children}\n </button>\n )\n}\n"],"mappings":"AAAA;;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@ -1 +1 @@
1
- {"version":3,"file":"DropDown.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AACtE,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAA;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAUtD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,KAAK,CAAC,SAAS,CAkElB;AAqFD,wBAAgB,QAAQ,CAAC,EACvB,eAAe,EACf,eAAe,EACf,QAAQ,EACR,QAAgB,EAChB,WAAW,EACX,IAAI,EACJ,wBAAwB,EACxB,KAAK,EACL,oBAAoB,GACrB,EAAE;IACD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,SAAS,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACf,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,GAAG,KAAK,CAAC,SAAS,CAyFlB"}
1
+ {"version":3,"file":"DropDown.d.ts","sourceRoot":"","sources":["../../../../../src/features/toolbars/shared/ToolbarDropdown/DropDown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA4B,KAAK,aAAa,EAAE,MAAM,SAAS,CAAA;AACtE,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAqD,MAAM,OAAO,CAAA;AAGhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAUtD,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,OAAO,EACP,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,IAAI,EAAE,gBAAgB,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,KAAK,CAAC,SAAS,CAkElB;AAyFD,wBAAgB,QAAQ,CAAC,EACvB,eAAe,EACf,eAAe,EACf,QAAQ,EACR,QAAgB,EAChB,WAAW,EACX,IAAI,EACJ,wBAAwB,EACxB,KAAK,EACL,oBAAoB,GACrB,EAAE;IACD,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,SAAS,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;IACf,wBAAwB,CAAC,EAAE,MAAM,EAAE,CAAA;IACnC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,oBAAoB,CAAC,EAAE,OAAO,CAAA;CAC/B,GAAG,KAAK,CAAC,SAAS,CA0FlB"}
@@ -71,6 +71,7 @@ export function DropDownItem({
71
71
  }
72
72
  function DropDownItems({
73
73
  children,
74
+ dropdownKey,
74
75
  dropDownRef,
75
76
  itemsContainerClassNames,
76
77
  onClose
@@ -124,6 +125,8 @@ function DropDownItems({
124
125
  value: contextValue,
125
126
  children: /*#__PURE__*/_jsx("div", {
126
127
  className: (itemsContainerClassNames ?? ['toolbar-popup__dropdown-items']).join(' '),
128
+ "data-dropdown-key": dropdownKey,
129
+ "data-theme": "dark",
127
130
  onKeyDown: handleKeyDown,
128
131
  ref: dropDownRef,
129
132
  children: children
@@ -187,6 +190,7 @@ export function DropDown({
187
190
  }
188
191
  }, [dropDownRef, buttonRef, showDropDown, stopCloseOnClickSelf]);
189
192
  const portal = /*#__PURE__*/createPortal(/*#__PURE__*/_jsx(DropDownItems, {
193
+ dropdownKey: dropdownKey,
190
194
  dropDownRef: dropDownRef,
191
195
  itemsContainerClassNames: itemsContainerClassNames,
192
196
  onClose: handleClose,