@payloadcms/richtext-lexical 3.68.0-internal-debug.2eb12b9 → 3.68.0-internal-debug.dafc24d

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 (306) hide show
  1. package/dist/cell/rscEntry.js +13 -5
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/features/blocks/client/component/BlockContent.js +29 -9
  4. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  5. package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -3
  6. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  7. package/dist/features/blocks/client/component/components/BlockEditButton.js +6 -2
  8. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  9. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +6 -2
  10. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  11. package/dist/features/blocks/client/component/index.js +124 -43
  12. package/dist/features/blocks/client/component/index.js.map +1 -1
  13. package/dist/features/blocks/client/component/index.scss +188 -0
  14. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +7 -3
  15. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  16. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +6 -2
  17. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  18. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +6 -2
  19. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  20. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +6 -2
  21. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  22. package/dist/features/blocks/client/componentInline/index.js +118 -37
  23. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  24. package/dist/features/blocks/client/componentInline/index.scss +90 -0
  25. package/dist/features/blocks/client/getBlockImageComponent.js +7 -3
  26. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  27. package/dist/features/blocks/client/markdown/markdownTransformer.js +1 -0
  28. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/BlocksNode.js +7 -3
  30. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  31. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +7 -3
  32. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +88 -27
  34. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +7 -3
  36. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  37. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +13 -4
  38. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  39. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.scss +6 -0
  40. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +19 -6
  41. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  42. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.scss +29 -0
  43. package/dist/features/blocks/premade/CodeBlock/Component/index.scss +97 -0
  44. package/dist/features/blocks/server/markdown/markdownTransformer.js +1 -0
  45. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  46. package/dist/features/converters/lexicalToJSX/Component/index.js +9 -5
  47. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +7 -3
  49. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +7 -3
  51. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -2
  53. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -2
  55. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +13 -5
  57. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +38 -14
  59. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  60. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +18 -6
  61. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  62. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +31 -11
  63. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  64. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +43 -15
  65. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  66. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +31 -11
  67. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  68. package/dist/features/converters/lexicalToJSX/converter/index.js +8 -4
  69. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  70. package/dist/features/debug/jsxConverter/client/plugin/index.js +14 -5
  71. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  72. package/dist/features/debug/jsxConverter/client/plugin/style.scss +12 -0
  73. package/dist/features/debug/testRecorder/client/plugin/index.js +62 -21
  74. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  75. package/dist/features/debug/testRecorder/client/plugin/index.scss +53 -0
  76. package/dist/features/debug/treeView/client/plugin/index.js +8 -3
  77. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  78. package/dist/features/debug/treeView/client/plugin/index.scss +80 -0
  79. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +225 -72
  80. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  81. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.scss +87 -0
  82. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +32 -11
  83. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  84. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.scss +11 -0
  85. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +21 -9
  86. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  87. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +26 -9
  88. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  89. package/dist/features/experimental_table/client/plugins/TablePlugin/index.scss +233 -0
  90. package/dist/features/horizontalRule/client/plugin/index.js +1 -0
  91. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  92. package/dist/features/horizontalRule/client/plugin/index.scss +23 -0
  93. package/dist/features/indent/client/IndentPlugin.js +6 -2
  94. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  95. package/dist/features/link/client/plugins/autoLink/index.js +3 -0
  96. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  97. package/dist/features/link/client/plugins/clickableLink/index.js +6 -2
  98. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  99. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +76 -24
  100. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  101. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +8 -3
  102. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  103. package/dist/features/link/client/plugins/floatingLinkEditor/index.scss +92 -0
  104. package/dist/features/link/server/baseFields.js +1 -0
  105. package/dist/features/link/server/baseFields.js.map +1 -1
  106. package/dist/features/lists/checklist/client/plugin/index.js +6 -2
  107. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  108. package/dist/features/lists/plugin/index.js +6 -2
  109. package/dist/features/lists/plugin/index.js.map +1 -1
  110. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +14 -5
  111. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  112. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +7 -3
  113. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  114. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  115. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +14 -5
  116. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  117. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +7 -3
  118. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  119. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  120. package/dist/features/relationship/client/components/RelationshipComponent.js +56 -19
  121. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  122. package/dist/features/relationship/client/components/index.scss +95 -0
  123. package/dist/features/relationship/client/drawer/index.js +18 -6
  124. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  125. package/dist/features/relationship/client/nodes/RelationshipNode.js +7 -3
  126. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  127. package/dist/features/relationship/client/plugins/index.js +7 -3
  128. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  129. package/dist/features/textState/feature.client.js +18 -6
  130. package/dist/features/textState/feature.client.js.map +1 -1
  131. package/dist/features/toolbars/fixed/client/Toolbar/index.js +72 -23
  132. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  133. package/dist/features/toolbars/fixed/client/Toolbar/index.scss +113 -0
  134. package/dist/features/toolbars/inline/client/Toolbar/index.js +72 -23
  135. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  136. package/dist/features/toolbars/inline/client/Toolbar/index.scss +58 -0
  137. package/dist/features/toolbars/shared/ToolbarButton/index.js +8 -3
  138. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  139. package/dist/features/toolbars/shared/ToolbarButton/index.scss +46 -0
  140. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +60 -20
  141. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  142. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +37 -12
  143. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  144. package/dist/features/toolbars/shared/ToolbarDropdown/index.scss +129 -0
  145. package/dist/features/upload/client/component/index.js +92 -31
  146. package/dist/features/upload/client/component/index.js.map +1 -1
  147. package/dist/features/upload/client/component/index.scss +191 -0
  148. package/dist/features/upload/client/component/pending/index.js +14 -5
  149. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  150. package/dist/features/upload/client/drawer/index.js +18 -6
  151. package/dist/features/upload/client/drawer/index.js.map +1 -1
  152. package/dist/features/upload/client/nodes/UploadNode.js +12 -4
  153. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  154. package/dist/features/upload/client/plugin/index.js +7 -3
  155. package/dist/features/upload/client/plugin/index.js.map +1 -1
  156. package/dist/field/Diff/converters/listitem/index.js +37 -12
  157. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  158. package/dist/field/Diff/converters/listitem/index.scss +47 -0
  159. package/dist/field/Diff/converters/relationship/index.js +37 -12
  160. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  161. package/dist/field/Diff/converters/relationship/index.scss +73 -0
  162. package/dist/field/Diff/converters/unknown/index.js +31 -10
  163. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  164. package/dist/field/Diff/converters/unknown/index.scss +40 -0
  165. package/dist/field/Diff/converters/upload/index.js +60 -19
  166. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  167. package/dist/field/Diff/converters/upload/index.scss +115 -0
  168. package/dist/field/Diff/index.js +8 -3
  169. package/dist/field/Diff/index.js.map +1 -1
  170. package/dist/field/Diff/index.scss +102 -0
  171. package/dist/field/Field.js +81 -27
  172. package/dist/field/Field.js.map +1 -1
  173. package/dist/field/RenderLexical/index.js +36 -12
  174. package/dist/field/RenderLexical/index.js.map +1 -1
  175. package/dist/field/index.js +19 -7
  176. package/dist/field/index.js.map +1 -1
  177. package/dist/field/index.scss +41 -0
  178. package/dist/field/rscEntry.js +7 -3
  179. package/dist/field/rscEntry.js.map +1 -1
  180. package/dist/index.js +2 -0
  181. package/dist/index.js.map +1 -1
  182. package/dist/lexical/EditorPlugin.js +13 -5
  183. package/dist/lexical/EditorPlugin.js.map +1 -1
  184. package/dist/lexical/LexicalEditor.js +163 -50
  185. package/dist/lexical/LexicalEditor.js.map +1 -1
  186. package/dist/lexical/LexicalEditor.scss +54 -0
  187. package/dist/lexical/LexicalProvider.js +49 -17
  188. package/dist/lexical/LexicalProvider.js.map +1 -1
  189. package/dist/lexical/config/client/EditorConfigProvider.js +7 -3
  190. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  191. package/dist/lexical/plugins/DecoratorPlugin/index.js +1 -0
  192. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  193. package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
  194. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +20 -7
  195. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  196. package/dist/lexical/plugins/InsertParagraphAtEnd/index.scss +54 -0
  197. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -0
  198. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  199. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -3
  200. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  201. package/dist/lexical/plugins/SlashMenu/index.js +50 -16
  202. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  203. package/dist/lexical/plugins/SlashMenu/index.scss +68 -0
  204. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +20 -7
  205. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  206. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +35 -0
  207. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +32 -11
  208. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  209. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.scss +80 -0
  210. package/dist/lexical/theme/EditorTheme.scss +357 -0
  211. package/dist/lexical/ui/ContentEditable.js +14 -5
  212. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  213. package/dist/lexical/ui/ContentEditable.scss +105 -0
  214. package/dist/lexical/ui/icons/AI/index.js +37 -13
  215. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  216. package/dist/lexical/ui/icons/Add/index.js +19 -7
  217. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  218. package/dist/lexical/ui/icons/AlignCenter/index.js +25 -9
  219. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  220. package/dist/lexical/ui/icons/AlignJustify/index.js +25 -9
  221. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/AlignLeft/index.js +25 -9
  223. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/AlignRight/index.js +25 -9
  225. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/Block/index.js +25 -9
  227. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/Blockquote/index.js +13 -5
  229. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/Bold/index.js +13 -5
  231. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/Checklist/index.js +19 -7
  233. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/Code/index.js +19 -7
  235. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/CodeBlock/index.js +13 -5
  237. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/Collapse/index.js +13 -5
  239. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/H1/index.js +13 -5
  241. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/H2/index.js +13 -5
  243. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  244. package/dist/lexical/ui/icons/H3/index.js +13 -5
  245. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  246. package/dist/lexical/ui/icons/H4/index.js +13 -5
  247. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  248. package/dist/lexical/ui/icons/H5/index.js +13 -5
  249. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/H6/index.js +13 -5
  251. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  252. package/dist/lexical/ui/icons/HorizontalRule/index.js +13 -5
  253. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/IndentDecrease/index.js +31 -11
  255. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/IndentIncrease/index.js +31 -11
  257. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  258. package/dist/lexical/ui/icons/InlineBlocks/index.js +13 -5
  259. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  260. package/dist/lexical/ui/icons/Italic/index.js +13 -5
  261. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  262. package/dist/lexical/ui/icons/Link/index.js +13 -5
  263. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  264. package/dist/lexical/ui/icons/Meatballs/index.js +25 -9
  265. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  266. package/dist/lexical/ui/icons/OrderedList/index.js +37 -13
  267. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  268. package/dist/lexical/ui/icons/Relationship/index.js +37 -13
  269. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  270. package/dist/lexical/ui/icons/Strikethrough/index.js +19 -7
  271. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  272. package/dist/lexical/ui/icons/Subscript/index.js +13 -5
  273. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  274. package/dist/lexical/ui/icons/Superscript/index.js +13 -5
  275. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  276. package/dist/lexical/ui/icons/Table/index.js +13 -5
  277. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  278. package/dist/lexical/ui/icons/Text/index.js +13 -5
  279. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  280. package/dist/lexical/ui/icons/TextState/index.js +7 -3
  281. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  282. package/dist/lexical/ui/icons/Underline/index.js +19 -7
  283. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  284. package/dist/lexical/ui/icons/UnorderedList/index.js +43 -15
  285. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  286. package/dist/lexical/ui/icons/Upload/index.js +25 -9
  287. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  288. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +2 -0
  289. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +1 -1
  290. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +2 -0
  291. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +1 -1
  292. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +2 -0
  293. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +1 -1
  294. package/dist/utilities/fieldsDrawer/Drawer.js +19 -7
  295. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  296. package/dist/utilities/fieldsDrawer/DrawerContent.js +19 -7
  297. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  298. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +7 -3
  299. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  300. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +7 -3
  301. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  302. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +2 -0
  303. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  304. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +2 -0
  305. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  306. package/package.json +8 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/relationship/client/nodes/RelationshipNode.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMConversionOutput,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport * as React from 'react'\n\nimport type {\n RelationshipData,\n SerializedRelationshipNode,\n} from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipServerNode } from '../../server/nodes/RelationshipNode.js'\n\nconst RelationshipComponent = React.lazy(() =>\n import('../components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nfunction $relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends RelationshipServerNode {\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return super.exportJSON()\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return $applyNodeReplacement(\n new RelationshipNode({\n data,\n }),\n )\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | null | RelationshipNode | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n"],"names":["$applyNodeReplacement","React","RelationshipServerNode","RelationshipComponent","lazy","then","module","default","$relationshipElementToNode","domNode","id","getAttribute","relationTo","node","$createRelationshipNode","value","RelationshipNode","clone","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","format","decorate","editor","config","className","theme","relationship","data","__data","__format","nodeKey","getKey","exportJSON","$isRelationshipNode"],"mappings":"AAAA;;AAGA,SACEA,qBAAqB,QAMhB,UAAS;AAChB,YAAYC,WAAW,QAAO;AAO9B,SAASC,sBAAsB,QAAQ,yCAAwC;AAE/E,MAAMC,sCAAwBF,MAAMG,IAAI,CAAC,IACvC,MAAM,CAAC,0CAA0CC,IAAI,CAAC,CAACC,SAAY,CAAA;YACjEC,SAASD,OAAOH,qBAAqB;QACvC,CAAA;AAGF,SAASK,2BAA2BC,OAAuB;IACzD,MAAMC,KAAKD,QAAQE,YAAY,CAAC;IAChC,MAAMC,aAAaH,QAAQE,YAAY,CAAC;IAExC,IAAID,MAAM,QAAQE,cAAc,MAAM;QACpC,MAAMC,OAAOC,wBAAwB;YACnCF;YACAG,OAAOL;QACT;QACA,OAAO;YAAEG;QAAK;IAChB;IACA,OAAO;AACT;AAEA,OAAO,MAAMG,yBAAyBd;IACpC,OAAgBe,MAAMJ,IAA4B,EAA0B;QAC1E,OAAO,KAAK,CAACI,MAAMJ;IACrB;IAEA,OAAgBK,UAAkB;QAChC,OAAO,KAAK,CAACA;IACf;IAEA,OAAgBC,YAAqD;QACnE,OAAO;YACLC,KAAK,CAACX;gBACJ,IACE,CAACA,QAAQY,YAAY,CAAC,2CACtB,CAACZ,QAAQY,YAAY,CAAC,iCACtB;oBACA,OAAO;gBACT;gBACA,OAAO;oBACLC,YAAYd;oBACZe,UAAU;gBACZ;YACF;QACF;IACF;IAEA,OAAgBC,WAAWC,cAA0C,EAAoB;QACvF,IAAIA,eAAeC,OAAO,KAAK,KAAMD,gBAAgBV,OAAqCL,IAAI;YAC5Fe,eAAeV,KAAK,GAAG,AAACU,eAAeV,KAAK,CAA+BL,EAAE;QAC/E;QAEA,MAAMiB,eAAiC;YACrCf,YAAYa,eAAeb,UAAU;YACrCG,OAAOU,eAAeV,KAAK;QAC7B;QACA,MAAMF,OAAOC,wBAAwBa;QACrCd,KAAKe,SAAS,CAACH,eAAeI,MAAM;QACpC,OAAOhB;IACT;IAESiB,SAASC,MAAqB,EAAEC,MAAoB,EAAe;QAC1E,qBACE,KAAC7B;YACC8B,WAAWD,OAAOE,KAAK,CAACC,YAAY,IAAI;YACxCC,MAAM,IAAI,CAACC,MAAM;YACjBR,QAAQ,IAAI,CAACS,QAAQ;YACrBC,SAAS,IAAI,CAACC,MAAM;;IAG1B;IAESC,aAAyC;QAChD,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAAS3B,wBAAwBsB,IAAsB;IAC5D,OAAOpC,sBACL,IAAIgB,iBAAiB;QACnBoB;IACF;AAEJ;AAEA,OAAO,SAASM,oBACd7B,IAAuD;IAEvD,OAAOA,gBAAgBG;AACzB"}
1
+ {"version":3,"sources":["../../../../../src/features/relationship/client/nodes/RelationshipNode.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport {\n $applyNodeReplacement,\n type DOMConversionMap,\n type DOMConversionOutput,\n type EditorConfig,\n type LexicalEditor,\n type LexicalNode,\n} from 'lexical'\nimport * as React from 'react'\n\nimport type {\n RelationshipData,\n SerializedRelationshipNode,\n} from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipServerNode } from '../../server/nodes/RelationshipNode.js'\n\nconst RelationshipComponent = React.lazy(() =>\n import('../components/RelationshipComponent.js').then((module) => ({\n default: module.RelationshipComponent,\n })),\n)\n\nfunction $relationshipElementToNode(domNode: HTMLDivElement): DOMConversionOutput | null {\n const id = domNode.getAttribute('data-lexical-relationship-id')\n const relationTo = domNode.getAttribute('data-lexical-relationship-relationTo')\n\n if (id != null && relationTo != null) {\n const node = $createRelationshipNode({\n relationTo,\n value: id,\n })\n return { node }\n }\n return null\n}\n\nexport class RelationshipNode extends RelationshipServerNode {\n static override clone(node: RelationshipServerNode): RelationshipServerNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {\n div: (domNode: HTMLDivElement) => {\n if (\n !domNode.hasAttribute('data-lexical-relationship-relationTo') ||\n !domNode.hasAttribute('data-lexical-relationship-id')\n ) {\n return null\n }\n return {\n conversion: $relationshipElementToNode,\n priority: 2,\n }\n },\n }\n }\n\n static override importJSON(serializedNode: SerializedRelationshipNode): RelationshipNode {\n if (serializedNode.version === 1 && (serializedNode?.value as unknown as { id: string })?.id) {\n serializedNode.value = (serializedNode.value as unknown as { id: string }).id\n }\n\n const importedData: RelationshipData = {\n relationTo: serializedNode.relationTo,\n value: serializedNode.value,\n }\n const node = $createRelationshipNode(importedData)\n node.setFormat(serializedNode.format)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <RelationshipComponent\n className={config.theme.relationship ?? 'LexicalEditorTheme__relationship'}\n data={this.__data}\n format={this.__format}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedRelationshipNode {\n return super.exportJSON()\n }\n}\n\nexport function $createRelationshipNode(data: RelationshipData): RelationshipNode {\n return $applyNodeReplacement(\n new RelationshipNode({\n data,\n }),\n )\n}\n\nexport function $isRelationshipNode(\n node: LexicalNode | null | RelationshipNode | undefined,\n): node is RelationshipNode {\n return node instanceof RelationshipNode\n}\n"],"names":["$applyNodeReplacement","React","RelationshipServerNode","RelationshipComponent","lazy","then","module","default","$relationshipElementToNode","domNode","id","getAttribute","relationTo","node","$createRelationshipNode","value","RelationshipNode","clone","getType","importDOM","div","hasAttribute","conversion","priority","importJSON","serializedNode","version","importedData","setFormat","format","decorate","editor","config","className","theme","relationship","data","__data","__format","nodeKey","getKey","exportJSON","$isRelationshipNode"],"mappings":"AAAA;;AAGA,SACEA,qBAAqB,QAMhB,UAAS;AAChB,YAAYC,WAAW,QAAO;AAO9B,SAASC,sBAAsB,QAAQ,yCAAwC;AAE/E,MAAMC,sCAAwBF,MAAMG,IAAI,CAAC,IACvC,MAAM,CAAC,0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AAM;;;;;;IAG1B;IAESC,aAAyC;QAChD,OAAO,KAAK,CAACA;IACf;AACF;AAEA,OAAO,SAAS3B,wBAAwBsB,IAAsB;IAC5D,OAAOpC,sBACL,IAAIgB,iBAAiB;QACnBoB;IACF;AAEJ;AAEA,OAAO,SAASM,oBACd7B,IAAuD;IAEvD,OAAOA,gBAAgBG;AACzB"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
4
  import { $insertNodeToNearestRoot } from '@lexical/utils';
5
5
  import { $getPreviousSelection, $getSelection, $isParagraphNode, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical';
@@ -39,9 +39,13 @@ export const RelationshipPlugin = ({ clientProps })=>{
39
39
  }, [
40
40
  editor
41
41
  ]);
42
- return /*#__PURE__*/ _jsx(RelationshipDrawer, {
42
+ return /*#__PURE__*/ _jsxDEV(RelationshipDrawer, {
43
43
  enabledCollectionSlugs: enabledCollectionSlugs
44
- });
44
+ }, void 0, false, {
45
+ fileName: "src/features/relationship/client/plugins/index.tsx",
46
+ lineNumber: 66,
47
+ columnNumber: 10
48
+ }, this);
45
49
  };
46
50
 
47
51
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n collectionSlugsBlacklist: clientProps?.disabledCollections,\n collectionSlugsWhitelist: clientProps?.enabledCollections,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"names":["useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","clientProps","editor","enabledCollectionSlugs","collectionSlugsBlacklist","disabledCollections","collectionSlugsWhitelist","enabledCollections","hasNodes","Error","registerCommand","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,wBAAwB,QAAQ,iBAAgB;AACzD,SACEC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,aAAa,QACR,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAMjC,SAASC,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,+BAA8B;AACxF,SAASC,uBAAuB,QAAQ,sCAAqC;AAE7E,OAAO,MAAMC,8BAAgEN,cAC3E,+BACD;AAED,OAAO,MAAMO,qBAAgE,CAAC,EAAEC,WAAW,EAAE;IAC3F,MAAM,CAACC,OAAO,GAAGhB;IAEjB,MAAM,EAAEiB,sBAAsB,EAAE,GAAGL,wBAAwB;QACzDM,0BAA0BH,aAAaI;QACvCC,0BAA0BL,aAAaM;IACzC;IAEAb,UAAU;QACR,IAAI,CAACQ,OAAOM,QAAQ,CAAC;YAACX;SAAiB,GAAG;YACxC,MAAM,IAAIY,MAAM;QAClB;QAEA,OAAOP,OAAOQ,eAAe,CAC3BX,6BACA,CAACY;YACC,MAAMC,YAAYvB,mBAAmBD;YAErC,IAAIG,kBAAkBqB,YAAY;gBAChC,MAAMC,mBAAmBjB,wBAAwBe;gBACjD,uHAAuH;gBACvH,MAAM,EAAEG,KAAK,EAAE,GAAGF;gBAClB,MAAMG,YAAYD,MAAME,OAAO;gBAC/B,oIAAoI;gBACpI7B,yBAAyB0B;gBAEzB,6CAA6C;gBAC7C,IAAIvB,iBAAiByB,cAAc,CAACA,UAAUE,OAAO,EAAE;oBACrDF,UAAUG,MAAM;gBAClB;YACF;YAEA,OAAO;QACT,GACA1B;IAEJ,GAAG;QAACU;KAAO;IAEX,qBAAO,KAACP;QAAmBQ,wBAAwBA;;AACrD,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/features/relationship/client/plugins/index.tsx"],"sourcesContent":["'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport {\n $getPreviousSelection,\n $getSelection,\n $isParagraphNode,\n $isRangeSelection,\n COMMAND_PRIORITY_EDITOR,\n createCommand,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\nimport type { RelationshipFeatureProps } from '../../server/index.js'\nimport type { RelationshipData } from '../../server/nodes/RelationshipNode.js'\n\nimport { RelationshipDrawer } from '../drawer/index.js'\nimport { $createRelationshipNode, RelationshipNode } from '../nodes/RelationshipNode.js'\nimport { useEnabledRelationships } from '../utils/useEnabledRelationships.js'\n\nexport const INSERT_RELATIONSHIP_COMMAND: LexicalCommand<RelationshipData> = createCommand(\n 'INSERT_RELATIONSHIP_COMMAND',\n)\n\nexport const RelationshipPlugin: PluginComponent<RelationshipFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n\n const { enabledCollectionSlugs } = useEnabledRelationships({\n collectionSlugsBlacklist: clientProps?.disabledCollections,\n collectionSlugsWhitelist: clientProps?.enabledCollections,\n })\n\n useEffect(() => {\n if (!editor.hasNodes([RelationshipNode])) {\n throw new Error('RelationshipPlugin: RelationshipNode not registered on editor')\n }\n\n return editor.registerCommand<RelationshipData>(\n INSERT_RELATIONSHIP_COMMAND,\n (payload) => {\n const selection = $getSelection() || $getPreviousSelection()\n\n if ($isRangeSelection(selection)) {\n const relationshipNode = $createRelationshipNode(payload)\n // we need to get the focus node before inserting the block node, as $insertNodeToNearestRoot can change the focus node\n const { focus } = selection\n const focusNode = focus.getNode()\n // Insert relationship node BEFORE potentially removing focusNode, as $insertNodeToNearestRoot errors if the focusNode doesn't exist\n $insertNodeToNearestRoot(relationshipNode)\n\n // Delete the node it it's an empty paragraph\n if ($isParagraphNode(focusNode) && !focusNode.__first) {\n focusNode.remove()\n }\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return <RelationshipDrawer enabledCollectionSlugs={enabledCollectionSlugs} />\n}\n"],"names":["useLexicalComposerContext","$insertNodeToNearestRoot","$getPreviousSelection","$getSelection","$isParagraphNode","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","useEffect","RelationshipDrawer","$createRelationshipNode","RelationshipNode","useEnabledRelationships","INSERT_RELATIONSHIP_COMMAND","RelationshipPlugin","clientProps","editor","enabledCollectionSlugs","collectionSlugsBlacklist","disabledCollections","collectionSlugsWhitelist","enabledCollections","hasNodes","Error","registerCommand","payload","selection","relationshipNode","focus","focusNode","getNode","__first","remove"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,wBAAwB,QAAQ,iBAAgB;AACzD,SACEC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChBC,iBAAiB,EACjBC,uBAAuB,EACvBC,aAAa,QACR,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAMjC,SAASC,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,uBAAuB,EAAEC,gBAAgB,QAAQ,+BAA8B;AACxF,SAASC,uBAAuB,QAAQ,sCAAqC;AAE7E,OAAO,MAAMC,8BAAgEN,cAC3E,+BACD;AAED,OAAO,MAAMO,qBAAgE,CAAC,EAAEC,WAAW,EAAE;IAC3F,MAAM,CAACC,OAAO,GAAGhB;IAEjB,MAAM,EAAEiB,sBAAsB,EAAE,GAAGL,wBAAwB;QACzDM,0BAA0BH,aAAaI;QACvCC,0BAA0BL,aAAaM;IACzC;IAEAb,UAAU;QACR,IAAI,CAACQ,OAAOM,QAAQ,CAAC;YAACX;SAAiB,GAAG;YACxC,MAAM,IAAIY,MAAM;QAClB;QAEA,OAAOP,OAAOQ,eAAe,CAC3BX,6BACA,CAACY;YACC,MAAMC,YAAYvB,mBAAmBD;YAErC,IAAIG,kBAAkBqB,YAAY;gBAChC,MAAMC,mBAAmBjB,wBAAwBe;gBACjD,uHAAuH;gBACvH,MAAM,EAAEG,KAAK,EAAE,GAAGF;gBAClB,MAAMG,YAAYD,MAAME,OAAO;gBAC/B,oIAAoI;gBACpI7B,yBAAyB0B;gBAEzB,6CAA6C;gBAC7C,IAAIvB,iBAAiByB,cAAc,CAACA,UAAUE,OAAO,EAAE;oBACrDF,UAAUG,MAAM;gBAClB;YACF;YAEA,OAAO;QACT,GACA1B;IAEJ,GAAG;QAACU;KAAO;IAEX,qBAAO,QAACP;QAAmBQ,wBAAwBA;;;;;;AACrD,EAAC"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { TextStateIcon } from '../../lexical/ui/icons/TextState/index.js';
4
4
  import { createClientFeature } from '../../utilities/createClientFeature.js';
5
5
  import { registerTextStates, setTextState, StatePlugin } from './textState.js';
@@ -10,9 +10,13 @@ const toolbarGroups = (props, stateMap)=>{
10
10
  for(const stateValue in key){
11
11
  const meta = key[stateValue];
12
12
  items.push({
13
- ChildComponent: ()=>/*#__PURE__*/ _jsx(TextStateIcon, {
13
+ ChildComponent: ()=>/*#__PURE__*/ _jsxDEV(TextStateIcon, {
14
14
  css: meta.css
15
- }),
15
+ }, void 0, false, {
16
+ fileName: "src/features/textState/feature.client.tsx",
17
+ lineNumber: 18,
18
+ columnNumber: 31
19
+ }, this),
16
20
  key: stateValue,
17
21
  label: meta.label,
18
22
  onSelect: ({ editor })=>{
@@ -23,7 +27,11 @@ const toolbarGroups = (props, stateMap)=>{
23
27
  }
24
28
  const clearStyle = [
25
29
  {
26
- ChildComponent: ()=>/*#__PURE__*/ _jsx(TextStateIcon, {}),
30
+ ChildComponent: ()=>/*#__PURE__*/ _jsxDEV(TextStateIcon, {}, void 0, false, {
31
+ fileName: "src/features/textState/feature.client.tsx",
32
+ lineNumber: 30,
33
+ columnNumber: 29
34
+ }, this),
27
35
  key: `clear-style`,
28
36
  label: ({ i18n })=>i18n.t('lexical:textState:defaultStyle'),
29
37
  onSelect: ({ editor })=>{
@@ -37,11 +45,15 @@ const toolbarGroups = (props, stateMap)=>{
37
45
  return [
38
46
  {
39
47
  type: 'dropdown',
40
- ChildComponent: ()=>/*#__PURE__*/ _jsx(TextStateIcon, {
48
+ ChildComponent: ()=>/*#__PURE__*/ _jsxDEV(TextStateIcon, {
41
49
  css: {
42
50
  color: 'var(--theme-elevation-600)'
43
51
  }
44
- }),
52
+ }, void 0, false, {
53
+ fileName: "src/features/textState/feature.client.tsx",
54
+ lineNumber: 45,
55
+ columnNumber: 29
56
+ }, this),
45
57
  items: [
46
58
  ...clearStyle,
47
59
  ...items
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/features/textState/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ToolbarDropdownGroup, ToolbarGroup } from '../toolbars/types.js'\nimport type { TextStateFeatureProps } from './feature.server.js'\n\nimport { TextStateIcon } from '../../lexical/ui/icons/TextState/index.js'\nimport { createClientFeature } from '../../utilities/createClientFeature.js'\nimport { registerTextStates, setTextState, type StateMap, StatePlugin } from './textState.js'\n\nconst toolbarGroups = (props: TextStateFeatureProps, stateMap: StateMap): ToolbarGroup[] => {\n const items: ToolbarDropdownGroup['items'] = []\n\n for (const stateKey in props.state) {\n const key = props.state[stateKey]!\n for (const stateValue in key) {\n const meta = key[stateValue]!\n items.push({\n ChildComponent: () => <TextStateIcon css={meta.css} />,\n key: stateValue,\n label: meta.label,\n onSelect: ({ editor }) => {\n setTextState(editor, stateMap, stateKey, stateValue)\n },\n })\n }\n }\n\n const clearStyle: ToolbarDropdownGroup['items'] = [\n {\n ChildComponent: () => <TextStateIcon />,\n key: `clear-style`,\n label: ({ i18n }) => i18n.t('lexical:textState:defaultStyle'),\n onSelect: ({ editor }) => {\n for (const stateKey in props.state) {\n setTextState(editor, stateMap, stateKey, undefined)\n }\n },\n order: 1,\n },\n ]\n\n return [\n {\n type: 'dropdown',\n ChildComponent: () => <TextStateIcon css={{ color: 'var(--theme-elevation-600)' }} />,\n items: [...clearStyle, ...items],\n key: 'textState',\n order: 30,\n },\n ]\n}\n\nexport const TextStateFeatureClient = createClientFeature<TextStateFeatureProps>(({ props }) => {\n const stateMap = registerTextStates(props.state)\n return {\n plugins: [\n {\n Component: () => StatePlugin({ stateMap }),\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups(props, stateMap),\n },\n toolbarInline: {\n groups: toolbarGroups(props, stateMap),\n },\n }\n})\n"],"names":["TextStateIcon","createClientFeature","registerTextStates","setTextState","StatePlugin","toolbarGroups","props","stateMap","items","stateKey","state","key","stateValue","meta","push","ChildComponent","css","label","onSelect","editor","clearStyle","i18n","t","undefined","order","type","color","TextStateFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline"],"mappings":"AAAA;;AAKA,SAASA,aAAa,QAAQ,4CAA2C;AACzE,SAASC,mBAAmB,QAAQ,yCAAwC;AAC5E,SAASC,kBAAkB,EAAEC,YAAY,EAAiBC,WAAW,QAAQ,iBAAgB;AAE7F,MAAMC,gBAAgB,CAACC,OAA8BC;IACnD,MAAMC,QAAuC,EAAE;IAE/C,IAAK,MAAMC,YAAYH,MAAMI,KAAK,CAAE;QAClC,MAAMC,MAAML,MAAMI,KAAK,CAACD,SAAS;QACjC,IAAK,MAAMG,cAAcD,IAAK;YAC5B,MAAME,OAAOF,GAAG,CAACC,WAAW;YAC5BJ,MAAMM,IAAI,CAAC;gBACTC,gBAAgB,kBAAM,KAACf;wBAAcgB,KAAKH,KAAKG,GAAG;;gBAClDL,KAAKC;gBACLK,OAAOJ,KAAKI,KAAK;gBACjBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oBACnBhB,aAAagB,QAAQZ,UAAUE,UAAUG;gBAC3C;YACF;QACF;IACF;IAEA,MAAMQ,aAA4C;QAChD;YACEL,gBAAgB,kBAAM,KAACf;YACvBW,KAAK,CAAC,WAAW,CAAC;YAClBM,OAAO,CAAC,EAAEI,IAAI,EAAE,GAAKA,KAAKC,CAAC,CAAC;YAC5BJ,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnB,IAAK,MAAMV,YAAYH,MAAMI,KAAK,CAAE;oBAClCP,aAAagB,QAAQZ,UAAUE,UAAUc;gBAC3C;YACF;YACAC,OAAO;QACT;KACD;IAED,OAAO;QACL;YACEC,MAAM;YACNV,gBAAgB,kBAAM,KAACf;oBAAcgB,KAAK;wBAAEU,OAAO;oBAA6B;;YAChFlB,OAAO;mBAAIY;mBAAeZ;aAAM;YAChCG,KAAK;YACLa,OAAO;QACT;KACD;AACH;AAEA,OAAO,MAAMG,yBAAyB1B,oBAA2C,CAAC,EAAEK,KAAK,EAAE;IACzF,MAAMC,WAAWL,mBAAmBI,MAAMI,KAAK;IAC/C,OAAO;QACLkB,SAAS;YACP;gBACEC,WAAW,IAAMzB,YAAY;wBAAEG;oBAAS;gBACxCuB,UAAU;YACZ;SACD;QACDC,cAAc;YACZC,QAAQ3B,cAAcC,OAAOC;QAC/B;QACA0B,eAAe;YACbD,QAAQ3B,cAAcC,OAAOC;QAC/B;IACF;AACF,GAAE"}
1
+ {"version":3,"sources":["../../../src/features/textState/feature.client.tsx"],"sourcesContent":["'use client'\n\nimport type { ToolbarDropdownGroup, ToolbarGroup } from '../toolbars/types.js'\nimport type { TextStateFeatureProps } from './feature.server.js'\n\nimport { TextStateIcon } from '../../lexical/ui/icons/TextState/index.js'\nimport { createClientFeature } from '../../utilities/createClientFeature.js'\nimport { registerTextStates, setTextState, type StateMap, StatePlugin } from './textState.js'\n\nconst toolbarGroups = (props: TextStateFeatureProps, stateMap: StateMap): ToolbarGroup[] => {\n const items: ToolbarDropdownGroup['items'] = []\n\n for (const stateKey in props.state) {\n const key = props.state[stateKey]!\n for (const stateValue in key) {\n const meta = key[stateValue]!\n items.push({\n ChildComponent: () => <TextStateIcon css={meta.css} />,\n key: stateValue,\n label: meta.label,\n onSelect: ({ editor }) => {\n setTextState(editor, stateMap, stateKey, stateValue)\n },\n })\n }\n }\n\n const clearStyle: ToolbarDropdownGroup['items'] = [\n {\n ChildComponent: () => <TextStateIcon />,\n key: `clear-style`,\n label: ({ i18n }) => i18n.t('lexical:textState:defaultStyle'),\n onSelect: ({ editor }) => {\n for (const stateKey in props.state) {\n setTextState(editor, stateMap, stateKey, undefined)\n }\n },\n order: 1,\n },\n ]\n\n return [\n {\n type: 'dropdown',\n ChildComponent: () => <TextStateIcon css={{ color: 'var(--theme-elevation-600)' }} />,\n items: [...clearStyle, ...items],\n key: 'textState',\n order: 30,\n },\n ]\n}\n\nexport const TextStateFeatureClient = createClientFeature<TextStateFeatureProps>(({ props }) => {\n const stateMap = registerTextStates(props.state)\n return {\n plugins: [\n {\n Component: () => StatePlugin({ stateMap }),\n position: 'normal',\n },\n ],\n toolbarFixed: {\n groups: toolbarGroups(props, stateMap),\n },\n toolbarInline: {\n groups: toolbarGroups(props, stateMap),\n },\n }\n})\n"],"names":["TextStateIcon","createClientFeature","registerTextStates","setTextState","StatePlugin","toolbarGroups","props","stateMap","items","stateKey","state","key","stateValue","meta","push","ChildComponent","css","label","onSelect","editor","clearStyle","i18n","t","undefined","order","type","color","TextStateFeatureClient","plugins","Component","position","toolbarFixed","groups","toolbarInline"],"mappings":"AAAA;;AAKA,SAASA,aAAa,QAAQ,4CAA2C;AACzE,SAASC,mBAAmB,QAAQ,yCAAwC;AAC5E,SAASC,kBAAkB,EAAEC,YAAY,EAAiBC,WAAW,QAAQ,iBAAgB;AAE7F,MAAMC,gBAAgB,CAACC,OAA8BC;IACnD,MAAMC,QAAuC,EAAE;IAE/C,IAAK,MAAMC,YAAYH,MAAMI,KAAK,CAAE;QAClC,MAAMC,MAAML,MAAMI,KAAK,CAACD,SAAS;QACjC,IAAK,MAAMG,cAAcD,IAAK;YAC5B,MAAME,OAAOF,GAAG,CAACC,WAAW;YAC5BJ,MAAMM,IAAI,CAAC;gBACTC,gBAAgB,kBAAM,QAACf;wBAAcgB,KAAKH,KAAKG,GAAG;;;;;;gBAClDL,KAAKC;gBACLK,OAAOJ,KAAKI,KAAK;gBACjBC,UAAU,CAAC,EAAEC,MAAM,EAAE;oBACnBhB,aAAagB,QAAQZ,UAAUE,UAAUG;gBAC3C;YACF;QACF;IACF;IAEA,MAAMQ,aAA4C;QAChD;YACEL,gBAAgB,kBAAM,QAACf;;;;;YACvBW,KAAK,CAAC,WAAW,CAAC;YAClBM,OAAO,CAAC,EAAEI,IAAI,EAAE,GAAKA,KAAKC,CAAC,CAAC;YAC5BJ,UAAU,CAAC,EAAEC,MAAM,EAAE;gBACnB,IAAK,MAAMV,YAAYH,MAAMI,KAAK,CAAE;oBAClCP,aAAagB,QAAQZ,UAAUE,UAAUc;gBAC3C;YACF;YACAC,OAAO;QACT;KACD;IAED,OAAO;QACL;YACEC,MAAM;YACNV,gBAAgB,kBAAM,QAACf;oBAAcgB,KAAK;wBAAEU,OAAO;oBAA6B;;;;;;YAChFlB,OAAO;mBAAIY;mBAAeZ;aAAM;YAChCG,KAAK;YACLa,OAAO;QACT;KACD;AACH;AAEA,OAAO,MAAMG,yBAAyB1B,oBAA2C,CAAC,EAAEK,KAAK,EAAE;IACzF,MAAMC,WAAWL,mBAAmBI,MAAMI,KAAK;IAC/C,OAAO;QACLkB,SAAS;YACP;gBACEC,WAAW,IAAMzB,YAAY;wBAAEG;oBAAS;gBACxCuB,UAAU;YACZ;SACD;QACDC,cAAc;YACZC,QAAQ3B,cAAcC,OAAOC;QAC/B;QACA0B,eAAe;YACbD,QAAQ3B,cAAcC,OAAOC;QAC/B;IACF;AACF,GAAE"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
4
4
  import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
5
5
  import { useScrollInfo, useThrottledEffect, useTranslation } from '@payloadcms/ui';
@@ -7,23 +7,36 @@ import * as React from 'react';
7
7
  import { useMemo } from 'react';
8
8
  import { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js';
9
9
  import { ToolbarButton } from '../../../shared/ToolbarButton/index.js';
10
+ import './index.scss';
10
11
  import { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js';
11
12
  function ButtonGroupItem({ anchorElem, editor, item }) {
12
13
  if (item.Component) {
13
- return item?.Component && /*#__PURE__*/ _jsx(item.Component, {
14
+ return item?.Component && /*#__PURE__*/ _jsxDEV(item.Component, {
14
15
  anchorElem: anchorElem,
15
16
  editor: editor,
16
17
  item: item
17
- }, item.key);
18
+ }, item.key, false, {
19
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
20
+ lineNumber: 33,
21
+ columnNumber: 9
22
+ }, this);
18
23
  }
19
24
  if (!item.ChildComponent) {
20
25
  return null;
21
26
  }
22
- return /*#__PURE__*/ _jsx(ToolbarButton, {
27
+ return /*#__PURE__*/ _jsxDEV(ToolbarButton, {
23
28
  editor: editor,
24
29
  item: item,
25
- children: /*#__PURE__*/ _jsx(item.ChildComponent, {})
26
- }, item.key);
30
+ children: /*#__PURE__*/ _jsxDEV(item.ChildComponent, {}, void 0, false, {
31
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
32
+ lineNumber: 44,
33
+ columnNumber: 7
34
+ }, this)
35
+ }, item.key, false, {
36
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
37
+ lineNumber: 43,
38
+ columnNumber: 5
39
+ }, this);
27
40
  }
28
41
  function ToolbarGroupComponent({ anchorElem, editor, editorConfig, group, index }) {
29
42
  const { i18n } = useTranslation();
@@ -82,11 +95,11 @@ function ToolbarGroupComponent({ anchorElem, editor, editorConfig, group, index
82
95
  featureClientSchemaMap,
83
96
  schemaPath
84
97
  ]);
85
- return /*#__PURE__*/ _jsxs("div", {
98
+ return /*#__PURE__*/ _jsxDEV("div", {
86
99
  className: `fixed-toolbar__group fixed-toolbar__group-${group.key}`,
87
100
  "data-toolbar-group-key": group.key,
88
101
  children: [
89
- group.type === 'dropdown' && group.items.length ? DropdownIcon ? /*#__PURE__*/ _jsx(ToolbarDropdown, {
102
+ group.type === 'dropdown' && group.items.length ? DropdownIcon ? /*#__PURE__*/ _jsxDEV(ToolbarDropdown, {
90
103
  anchorElem: anchorElem,
91
104
  editor: editor,
92
105
  group: group,
@@ -97,7 +110,11 @@ function ToolbarGroupComponent({ anchorElem, editor, editorConfig, group, index
97
110
  label: dropdownLabel,
98
111
  maxActiveItems: group.maxActiveItems ?? 1,
99
112
  onActiveChange: onActiveChange
100
- }) : /*#__PURE__*/ _jsx(ToolbarDropdown, {
113
+ }, void 0, false, {
114
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
115
+ lineNumber: 128,
116
+ columnNumber: 11
117
+ }, this) : /*#__PURE__*/ _jsxDEV(ToolbarDropdown, {
101
118
  anchorElem: anchorElem,
102
119
  editor: editor,
103
120
  group: group,
@@ -107,19 +124,35 @@ function ToolbarGroupComponent({ anchorElem, editor, editorConfig, group, index
107
124
  label: dropdownLabel,
108
125
  maxActiveItems: group.maxActiveItems ?? 1,
109
126
  onActiveChange: onActiveChange
110
- }) : null,
127
+ }, void 0, false, {
128
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
129
+ lineNumber: 139,
130
+ columnNumber: 11
131
+ }, this) : null,
111
132
  group.type === 'buttons' && group.items.length ? group.items.map((item)=>{
112
- return /*#__PURE__*/ _jsx(ButtonGroupItem, {
133
+ return /*#__PURE__*/ _jsxDEV(ButtonGroupItem, {
113
134
  anchorElem: anchorElem,
114
135
  editor: editor,
115
136
  item: item
116
- }, item.key);
137
+ }, item.key, false, {
138
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
139
+ lineNumber: 153,
140
+ columnNumber: 15
141
+ }, this);
117
142
  }) : null,
118
- index < editorConfig.features.toolbarFixed?.groups.length - 1 && /*#__PURE__*/ _jsx("div", {
143
+ index < editorConfig.features.toolbarFixed?.groups.length - 1 && /*#__PURE__*/ _jsxDEV("div", {
119
144
  className: "divider"
120
- })
145
+ }, void 0, false, {
146
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
147
+ lineNumber: 157,
148
+ columnNumber: 73
149
+ }, this)
121
150
  ]
122
- }, group.key);
151
+ }, group.key, true, {
152
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
153
+ lineNumber: 121,
154
+ columnNumber: 5
155
+ }, this);
123
156
  }
124
157
  function FixedToolbar({ anchorElem, clientProps, editor, editorConfig, parentWithFixedToolbar }) {
125
158
  const currentToolbarRef = React.useRef(null);
@@ -175,7 +208,7 @@ function FixedToolbar({ anchorElem, clientProps, editor, editorConfig, parentWit
175
208
  parentToolbarElem,
176
209
  y
177
210
  ]);
178
- return /*#__PURE__*/ _jsx("div", {
211
+ return /*#__PURE__*/ _jsxDEV("div", {
179
212
  className: "fixed-toolbar",
180
213
  onFocus: (event)=>{
181
214
  // Prevent other focus events being triggered. Otherwise, if this was to be clicked while in a child editor,
@@ -183,18 +216,30 @@ function FixedToolbar({ anchorElem, clientProps, editor, editorConfig, parentWit
183
216
  event.stopPropagation();
184
217
  },
185
218
  ref: currentToolbarRef,
186
- children: isEditable && /*#__PURE__*/ _jsx(React.Fragment, {
219
+ children: isEditable && /*#__PURE__*/ _jsxDEV(React.Fragment, {
187
220
  children: editorConfig?.features && editorConfig.features?.toolbarFixed?.groups.map((group, i)=>{
188
- return /*#__PURE__*/ _jsx(ToolbarGroupComponent, {
221
+ return /*#__PURE__*/ _jsxDEV(ToolbarGroupComponent, {
189
222
  anchorElem: anchorElem,
190
223
  editor: editor,
191
224
  editorConfig: editorConfig,
192
225
  group: group,
193
226
  index: i
194
- }, group.key);
227
+ }, group.key, false, {
228
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
229
+ lineNumber: 250,
230
+ columnNumber: 17
231
+ }, this);
195
232
  })
196
- })
197
- });
233
+ }, void 0, false, {
234
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
235
+ lineNumber: 246,
236
+ columnNumber: 9
237
+ }, this)
238
+ }, void 0, false, {
239
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
240
+ lineNumber: 236,
241
+ columnNumber: 5
242
+ }, this);
198
243
  }
199
244
  const getParentEditorWithFixedToolbar = (editorConfigContext)=>{
200
245
  if (editorConfigContext.parentEditor?.editorConfig) {
@@ -227,12 +272,16 @@ export const FixedToolbarPlugin = ({ clientProps })=>{
227
272
  if (!editorConfig?.features?.toolbarFixed?.groups?.length) {
228
273
  return null;
229
274
  }
230
- return /*#__PURE__*/ _jsx(FixedToolbar, {
275
+ return /*#__PURE__*/ _jsxDEV(FixedToolbar, {
231
276
  anchorElem: document.body,
232
277
  editor: editor,
233
278
  editorConfig: editorConfig,
234
279
  parentWithFixedToolbar: parentWithFixedToolbar
235
- });
280
+ }, void 0, false, {
281
+ fileName: "src/features/toolbars/fixed/client/Toolbar/index.tsx",
282
+ lineNumber: 312,
283
+ columnNumber: 5
284
+ }, this);
236
285
  };
237
286
 
238
287
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"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 { 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 './index.scss'\nimport { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js'\n\nfunction ButtonGroupItem({\n anchorElem,\n editor,\n item,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\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 editor={editor} 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}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n group: ToolbarGroup\n index: number\n}): React.ReactNode {\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const [dropdownLabel, setDropdownLabel] = React.useState<string | undefined>(undefined)\n const [DropdownIcon, setDropdownIcon] = React.useState<React.FC | undefined>(undefined)\n\n React.useEffect(() => {\n if (group?.type === 'dropdown' && group.items.length && group.ChildComponent) {\n setDropdownIcon(() => group.ChildComponent!)\n } else {\n setDropdownIcon(undefined)\n }\n }, [group])\n\n const onActiveChange = React.useCallback(\n ({ activeItems }: { activeItems: ToolbarGroupItem[] }) => {\n if (!activeItems.length) {\n if (group?.type === 'dropdown' && group.items.length && group.ChildComponent) {\n setDropdownIcon(() => group.ChildComponent!)\n setDropdownLabel(undefined)\n } else {\n setDropdownIcon(undefined)\n setDropdownLabel(undefined)\n }\n return\n }\n const item = activeItems[0]!\n\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 // Crop title to max. 25 characters\n if (label.length > 25) {\n label = label.substring(0, 25) + '...'\n }\n if (activeItems.length === 1) {\n setDropdownLabel(label)\n setDropdownIcon(() => item.ChildComponent)\n } else {\n setDropdownLabel(\n i18n.t('lexical:general:toolbarItemsActive', { count: activeItems.length }),\n )\n if (group?.type === 'dropdown' && group.items.length && group.ChildComponent) {\n setDropdownIcon(() => group.ChildComponent!)\n } else {\n setDropdownIcon(undefined)\n }\n }\n },\n [group, i18n, featureClientSchemaMap, schemaPath],\n )\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 ? (\n DropdownIcon ? (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n Icon={DropdownIcon}\n itemsContainerClassNames={['fixed-toolbar__dropdown-items']}\n label={dropdownLabel}\n maxActiveItems={group.maxActiveItems ?? 1}\n onActiveChange={onActiveChange}\n />\n ) : (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n itemsContainerClassNames={['fixed-toolbar__dropdown-items']}\n label={dropdownLabel}\n maxActiveItems={group.maxActiveItems ?? 1}\n onActiveChange={onActiveChange}\n />\n )\n ) : null}\n {group.type === 'buttons' && group.items.length\n ? group.items.map((item) => {\n return (\n <ButtonGroupItem anchorElem={anchorElem} editor={editor} item={item} key={item.key} />\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 // 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 />\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 editor={editor}\n editorConfig={editorConfig}\n parentWithFixedToolbar={parentWithFixedToolbar}\n />\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","useScrollInfo","useThrottledEffect","useTranslation","React","useMemo","useEditorConfigContext","ToolbarButton","ToolbarDropdown","ButtonGroupItem","anchorElem","editor","item","Component","key","ChildComponent","ToolbarGroupComponent","editorConfig","group","index","i18n","fieldProps","featureClientSchemaMap","schemaPath","dropdownLabel","setDropdownLabel","useState","undefined","DropdownIcon","setDropdownIcon","useEffect","type","items","length","onActiveChange","useCallback","activeItems","label","substring","t","count","div","className","data-toolbar-group-key","Icon","itemsContainerClassNames","maxActiveItems","map","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","currentEditor","currentEditorConfig","applyToFocusedEditor","focusedEditor","document","body"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,cAAc,QAAQ,iBAAgB;AAClF,YAAYC,WAAW,QAAO;AAC9B,SAASC,OAAO,QAAQ,QAAO;AAQ/B,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,aAAa,QAAQ,yCAAwC;AAEtE,SAASC,eAAe,QAAQ,2CAA0C;AAE1E,SAASC,gBAAgB,EACvBC,UAAU,EACVC,MAAM,EACNC,IAAI,EAKL;IACC,IAAIA,KAAKC,SAAS,EAAE;QAClB,OACED,MAAMC,2BACJ,KAACD,KAAKC,SAAS;YAACH,YAAYA;YAAYC,QAAQA;YAAQC,MAAMA;WAAWA,KAAKE,GAAG;IAGvF;IAEA,IAAI,CAACF,KAAKG,cAAc,EAAE;QACxB,OAAO;IACT;IAEA,qBACE,KAACR;QAAcI,QAAQA;QAAQC,MAAMA;kBACnC,cAAA,KAACA,KAAKG,cAAc;OAD0BH,KAAKE,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AAemC,YAAYsC,oBAAoB,GACjDP,oBAAoBQ,aAAa,EAAE1E,gBAAgBwE,sBACnDA;IAEJ,MAAMpC,yBAAyB6B,gCAAgCC;IAE/D,IAAI/B,aAAaO,gCAAgC;QAC/C,IAAIN,wBAAwB;YAC1B,OAAO;QACT;IACF;IAEA,IAAI,CAACpC,cAAc+B,UAAUC,cAAcC,QAAQjB,QAAQ;QACzD,OAAO;IACT;IAEA,qBACE,KAACkB;QACCzC,YAAYkF,SAASC,IAAI;QACzBlF,QAAQA;QACRM,cAAcA;QACdoC,wBAAwBA;;AAG9B,EAAC"}
1
+ {"version":3,"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 { 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 './index.scss'\nimport { ToolbarDropdown } from '../../../shared/ToolbarDropdown/index.js'\n\nfunction ButtonGroupItem({\n anchorElem,\n editor,\n item,\n}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\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 editor={editor} 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}: {\n anchorElem: HTMLElement\n editor: LexicalEditor\n editorConfig: SanitizedClientEditorConfig\n group: ToolbarGroup\n index: number\n}): React.ReactNode {\n const { i18n } = useTranslation<{}, string>()\n const {\n fieldProps: { featureClientSchemaMap, schemaPath },\n } = useEditorConfigContext()\n\n const [dropdownLabel, setDropdownLabel] = React.useState<string | undefined>(undefined)\n const [DropdownIcon, setDropdownIcon] = React.useState<React.FC | undefined>(undefined)\n\n React.useEffect(() => {\n if (group?.type === 'dropdown' && group.items.length && group.ChildComponent) {\n setDropdownIcon(() => group.ChildComponent!)\n } else {\n setDropdownIcon(undefined)\n }\n }, [group])\n\n const onActiveChange = React.useCallback(\n ({ activeItems }: { activeItems: ToolbarGroupItem[] }) => {\n if (!activeItems.length) {\n if (group?.type === 'dropdown' && group.items.length && group.ChildComponent) {\n setDropdownIcon(() => group.ChildComponent!)\n setDropdownLabel(undefined)\n } else {\n setDropdownIcon(undefined)\n setDropdownLabel(undefined)\n }\n return\n }\n const item = activeItems[0]!\n\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 // Crop title to max. 25 characters\n if (label.length > 25) {\n label = label.substring(0, 25) + '...'\n }\n if (activeItems.length === 1) {\n setDropdownLabel(label)\n setDropdownIcon(() => item.ChildComponent)\n } else {\n setDropdownLabel(\n i18n.t('lexical:general:toolbarItemsActive', { count: activeItems.length }),\n )\n if (group?.type === 'dropdown' && group.items.length && group.ChildComponent) {\n setDropdownIcon(() => group.ChildComponent!)\n } else {\n setDropdownIcon(undefined)\n }\n }\n },\n [group, i18n, featureClientSchemaMap, schemaPath],\n )\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 ? (\n DropdownIcon ? (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n Icon={DropdownIcon}\n itemsContainerClassNames={['fixed-toolbar__dropdown-items']}\n label={dropdownLabel}\n maxActiveItems={group.maxActiveItems ?? 1}\n onActiveChange={onActiveChange}\n />\n ) : (\n <ToolbarDropdown\n anchorElem={anchorElem}\n editor={editor}\n group={group}\n itemsContainerClassNames={['fixed-toolbar__dropdown-items']}\n label={dropdownLabel}\n maxActiveItems={group.maxActiveItems ?? 1}\n onActiveChange={onActiveChange}\n />\n )\n ) : null}\n {group.type === 'buttons' && group.items.length\n ? group.items.map((item) => {\n return (\n <ButtonGroupItem anchorElem={anchorElem} editor={editor} item={item} key={item.key} />\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 // 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 />\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 editor={editor}\n editorConfig={editorConfig}\n parentWithFixedToolbar={parentWithFixedToolbar}\n />\n )\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","useScrollInfo","useThrottledEffect","useTranslation","React","useMemo","useEditorConfigContext","ToolbarButton","ToolbarDropdown","ButtonGroupItem","anchorElem","editor","item","Component","key","ChildComponent","ToolbarGroupComponent","editorConfig","group","index","i18n","fieldProps","featureClientSchemaMap","schemaPath","dropdownLabel","setDropdownLabel","useState","undefined","DropdownIcon","setDropdownIcon","useEffect","type","items","length","onActiveChange","useCallback","activeItems","label","substring","t","count","div","className","data-toolbar-group-key","Icon","itemsContainerClassNames","maxActiveItems","map","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","currentEditor","currentEditorConfig","applyToFocusedEditor","focusedEditor","document","body"],"mappings":"AAAA;;AAGA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SAASC,aAAa,EAAEC,kBAAkB,EAAEC,cAAc,QAAQ,iBAAgB;AAClF,YAAYC,WAAW,QAAO;AAC9B,SAASC,OAAO,QAAQ,QAAO;AAQ/B,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,aAAa,QAAQ,yCAAwC;AACtE,OAAO,eAAc;AACrB,SAASC,eAAe,QAAQ,2CAA0C;AAE1E,SAASC,gBAAgB,EACvBC,UAAU,EACVC,MAAM,EACNC,IAAI,EAKL;IACC,IAAIA,KAAKC,SAAS,EAAE;QAClB,OACED,MAAMC,2BACJ,QAACD,KAAKC,SAAS;YAACH,YAAYA;YAAYC,QAAQA;YAAQC,MAAMA;WAAWA,KAAKE,GAAG;;;;;IAGvF;IAEA,IAAI,CAACF,KAAKG,cAAc,EAAE;QACxB,OAAO;IACT;IAEA,qBACE,QAACR;QAAcI,QAAQA;QAAQC,MAAMA;kBACnC,cAAA,QAACA,KAAKG,cAAc;;;;;OAD0BH,KAAKE,GAAG;;;;;AAI5D;AAEA,SAASE,sBAAsB,EAC7BN,UAAU,EACVC,MAAM,EACNM,YAAY,EACZC,KAAK,EACLC,KAAK,EAON;IACC,MAAM,EAAEC,IAAI,EAAE,GAAGjB;IACjB,MAAM,EACJkB,YAAY,EAAEC,sBAAsB,EAAEC,UAAU,EAAE,EACnD,GAAGjB;IAEJ,MAAM,CAACkB,eAAeC,iBAAiB,GAAGrB,MAAMsB,QAAQ,CAAqBC;IAC7E,MAAM,CAACC,cAAcC,gBAAgB,GAAGzB,MAAMsB,QAAQ,CAAuBC;IAE7EvB,MAAM0B,SAAS,CAAC;QACd,IAAIZ,OAAOa,SAAS,cAAcb,MAAMc,KAAK,CAACC,MAAM,IAAIf,MAAMH,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ui/scss';
2
+
3
+ @layer payload-default {
4
+ html[data-theme='dark'] {
5
+ .fixed-toolbar {
6
+ &__dropdown-items {
7
+ background: var(--theme-elevation-0);
8
+ transition: background 0.2s cubic-bezier(0, 0.2, 0.2, 1);
9
+
10
+ .toolbar-popup__dropdown-item {
11
+ color: var(--theme-elevation-900);
12
+
13
+ &:hover:not([disabled]),
14
+ &.active {
15
+ background: var(--theme-elevation-100);
16
+ }
17
+
18
+ .icon {
19
+ color: var(--theme-elevation-600);
20
+ }
21
+ }
22
+ }
23
+
24
+ .toolbar-popup {
25
+ &__dropdown {
26
+ transition: background-color 0.15s cubic-bezier(0, 0.2, 0.2, 1);
27
+
28
+ &:hover:not([disabled]) {
29
+ background: var(--theme-elevation-100);
30
+ }
31
+
32
+ &-caret:after {
33
+ filter: invert(1);
34
+ }
35
+
36
+ &-label {
37
+ color: var(--theme-elevation-750);
38
+ }
39
+ }
40
+ }
41
+ }
42
+ }
43
+
44
+ .fixed-toolbar.fixed-toolbar--hide {
45
+ visibility: hidden; // Still needs to take up space so content does not jump, thus we cannot use display: none
46
+ // make sure you cant interact with it
47
+ pointer-events: none;
48
+ user-select: none;
49
+ }
50
+
51
+ .fixed-toolbar {
52
+ @include blur-bg(var(--theme-elevation-0));
53
+ display: flex;
54
+ flex-wrap: wrap;
55
+ align-items: center;
56
+ padding: calc(var(--base) / 4);
57
+ vertical-align: middle;
58
+ position: sticky;
59
+ z-index: 2;
60
+ top: var(--doc-controls-height);
61
+ border: $style-stroke-width-s solid var(--theme-elevation-150);
62
+ // Make it so border itself is round too and not cut off at the corners
63
+ border-collapse: unset;
64
+ transform: translateY(1px); // aligns with top bar pixel line when stuck
65
+ min-height: 40px; // Reduces shift when saving document if toolbar items did not load yet
66
+
67
+ &__group {
68
+ display: flex;
69
+ flex-wrap: wrap;
70
+ align-items: center;
71
+ gap: 2px;
72
+ z-index: 1;
73
+
74
+ .icon {
75
+ min-width: 20px;
76
+ height: 20px;
77
+ color: var(--theme-elevation-600);
78
+ }
79
+
80
+ .divider {
81
+ width: 1px;
82
+ height: 15px;
83
+ background-color: var(--theme-elevation-100);
84
+ margin: 0 6.25px 0 4.25px; // substract 2px from the gap
85
+ }
86
+ }
87
+
88
+ + .editor-container {
89
+ > .editor-scroller > .editor {
90
+ > .ContentEditable__root {
91
+ padding-top: calc(var(--base) * 1.25);
92
+ }
93
+ }
94
+
95
+ > .editor-scroller > .editor > div > .LexicalEditorTheme__placeholder {
96
+ top: calc(var(--base) * 1.25);
97
+ }
98
+ }
99
+ }
100
+
101
+ .rich-text-lexical--show-gutter {
102
+ .fixed-toolbar {
103
+ + .editor-container {
104
+ > .editor-scroller > .editor {
105
+ > .ContentEditable__root::before {
106
+ top: calc(var(--base) * 1.25) !important;
107
+ height: calc(100% - calc(var(--base) * 1.25) - 8px) !important;
108
+ }
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }