@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":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","dir","undefined","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.scss'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" dir={rtl ? 'rtl' : undefined} ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,QAAQ;AACrC,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ;AACnC,SAASC,YAAY,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ;AAClE,YAAYC,KAAA,MAAW;AACvB,SAASC,SAAS,EAAEC,QAAQ,QAAQ;AAIpC,SAASC,sBAAsB,QAAQ;AAEvC,SAASC,YAAY,QAAQ;AAC7B,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,oBAAoB,QAAQ;AACrC,SAASC,0BAA0B,QAAQ;AAC3C,SAASC,sBAAsB,QAAQ;AACvC,SAASC,sBAAsB,QAAQ;AACvC,SAASC,wBAAwB,QAAQ;AACzC,SAASC,eAAe,QAAQ;AAChC,SAASC,eAAe,QAAQ;AAChC,SAASC,UAAU,QAAQ;AAC3B,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,MAAMC,aAAA,GAKTC,KAAA;EAAA,MAAAC,CAAA,GAAA7B,EAAA;EACF;IAAA8B,YAAA;IAAAC,kBAAA;IAAAC,oBAAA;IAAAC,QAAA;IAAAC;EAAA,IAAkFN,KAAA;EAClF,MAAAO,mBAAA,GAA4BtB,sBAAA;EAC5B,OAAAuB,MAAA,IAAiBnC,yBAAA;EACjB,MAAAoC,UAAA,GAAmB/B,kBAAA;EAEnB,OAAAgC,kBAAA,EAAAC,qBAAA,IAAoD3B,QAAA,KAAgC;EAAA,IAAA4B,EAAA;E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C,QAAA,KAAoB;IAAA,OACfd,IAAA,CAAA3D,YAAA;MAAA2E,WAAA,EAA2BH,QAAA,CAAAG,WAAA;MAAAH,MAAA,EAA6CA;IAAA,GAApBA,QAAA,CAAAI,GAAU;EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"LexicalEditor.js","names":["c","_c","useLexicalComposerContext","LexicalErrorBoundary","HistoryPlugin","OnChangePlugin","RichTextPlugin","useLexicalEditable","BLUR_COMMAND","COMMAND_PRIORITY_LOW","FOCUS_COMMAND","React","useEffect","useState","useEditorConfigContext","EditorPlugin","ClipboardPlugin","DecoratorPlugin","AddBlockHandlePlugin","DraggableBlockPlugin","InsertParagraphAtEndPlugin","MarkdownShortcutPlugin","NodeViewOverridePlugin","NormalizeSelectionPlugin","SelectAllPlugin","SlashMenuPlugin","TextPlugin","LexicalContentEditable","LexicalEditor","props","$","editorConfig","editorContainerRef","isSmallWidthViewport","onChange","rtl","editorConfigContext","editor","isEditable","floatingAnchorElem","setFloatingAnchorElem","t0","Symbol","for","_floatingAnchorElem","onRef","t1","t2","uuid","console","error","parentEditor","registerChild","handleFocus","focusEditor","handleBlur","blurEditor","unregisterFocus","registerCommand","unregisterBlur","unregisterChild","t3","_jsxs","Fragment","children","features","plugins","map","_temp","className","dir","undefined","ref","_temp2","_jsx","contentEditable","ignoreSelectionChange","editorState","editor_0","tags","has","size","admin","hideDraggableBlockElement","anchorElem","hideAddBlockButton","plugin_1","plugin","position","desktopOnly","clientProps","key","markdownTransformers","length","_temp3","_temp4","_temp5","plugin_0","plugin_2","plugin_3","plugin_4"],"sources":["../../src/lexical/LexicalEditor.tsx"],"sourcesContent":["'use client'\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary.js'\nimport { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin.js'\nimport { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin.js'\nimport { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { BLUR_COMMAND, COMMAND_PRIORITY_LOW, FOCUS_COMMAND } from 'lexical'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\n\nimport type { LexicalProviderProps } from './LexicalProvider.js'\n\nimport { useEditorConfigContext } from './config/client/EditorConfigProvider.js'\nimport './LexicalEditor.css'\nimport { EditorPlugin } from './EditorPlugin.js'\nimport { ClipboardPlugin } from './plugins/ClipboardPlugin/index.js'\nimport { DecoratorPlugin } from './plugins/DecoratorPlugin/index.js'\nimport { AddBlockHandlePlugin } from './plugins/handles/AddBlockHandlePlugin/index.js'\nimport { DraggableBlockPlugin } from './plugins/handles/DraggableBlockPlugin/index.js'\nimport { InsertParagraphAtEndPlugin } from './plugins/InsertParagraphAtEnd/index.js'\nimport { MarkdownShortcutPlugin } from './plugins/MarkdownShortcut/index.js'\nimport { NodeViewOverridePlugin } from './plugins/NodeViewOverridePlugin/index.js'\nimport { NormalizeSelectionPlugin } from './plugins/NormalizeSelection/index.js'\nimport { SelectAllPlugin } from './plugins/SelectAllPlugin/index.js'\nimport { SlashMenuPlugin } from './plugins/SlashMenu/index.js'\nimport { TextPlugin } from './plugins/TextPlugin/index.js'\nimport { LexicalContentEditable } from './ui/ContentEditable.js'\n\nexport const LexicalEditor: React.FC<\n {\n editorContainerRef: React.RefObject<HTMLDivElement | null>\n isSmallWidthViewport: boolean\n } & Pick<LexicalProviderProps, 'editorConfig' | 'onChange' | 'rtl'>\n> = (props) => {\n const { editorConfig, editorContainerRef, isSmallWidthViewport, onChange, rtl } = props\n const editorConfigContext = useEditorConfigContext()\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const [floatingAnchorElem, setFloatingAnchorElem] = useState<HTMLDivElement | null>(null)\n const onRef = (_floatingAnchorElem: HTMLDivElement) => {\n if (_floatingAnchorElem !== null) {\n setFloatingAnchorElem(_floatingAnchorElem)\n }\n }\n\n useEffect(() => {\n if (!editorConfigContext?.uuid) {\n console.error('Lexical Editor must be used within an EditorConfigProvider')\n return\n }\n if (editorConfigContext?.parentEditor?.uuid) {\n editorConfigContext.parentEditor?.registerChild(editorConfigContext.uuid, editorConfigContext)\n }\n\n const handleFocus = () => {\n editorConfigContext.focusEditor(editorConfigContext)\n }\n\n const handleBlur = () => {\n editorConfigContext.blurEditor(editorConfigContext)\n }\n\n const unregisterFocus = editor.registerCommand<MouseEvent>(\n FOCUS_COMMAND,\n () => {\n handleFocus()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n const unregisterBlur = editor.registerCommand<MouseEvent>(\n BLUR_COMMAND,\n () => {\n handleBlur()\n return true\n },\n COMMAND_PRIORITY_LOW,\n )\n\n return () => {\n unregisterFocus()\n unregisterBlur()\n editorConfigContext.parentEditor?.unregisterChild?.(editorConfigContext.uuid)\n }\n }, [editor, editorConfigContext])\n\n return (\n <React.Fragment>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'aboveContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n <div className=\"editor-container\" dir={rtl ? 'rtl' : undefined} ref={editorContainerRef}>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'top') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n <RichTextPlugin\n contentEditable={\n <div className=\"editor-scroller\">\n <div className=\"editor\" ref={onRef}>\n <LexicalContentEditable editorConfig={editorConfig} />\n </div>\n </div>\n }\n ErrorBoundary={LexicalErrorBoundary}\n />\n <NormalizeSelectionPlugin />\n {isEditable && <InsertParagraphAtEndPlugin />}\n <DecoratorPlugin />\n <ClipboardPlugin />\n <TextPlugin features={editorConfig.features} />\n <SelectAllPlugin />\n <NodeViewOverridePlugin />\n {isEditable && (\n <OnChangePlugin\n // Selection changes can be ignored here, reducing the\n // frequency that the FieldComponent and Payload receive updates.\n // Selection changes are only needed if you are saving selection state\n ignoreSelectionChange\n onChange={(editorState, editor, tags) => {\n // Ignore any onChange event triggered by focus only\n if (!tags.has('focus') || tags.size > 1) {\n if (onChange != null) {\n onChange(editorState, editor, tags)\n }\n }\n }}\n />\n )}\n {floatingAnchorElem && (\n <React.Fragment>\n {!isSmallWidthViewport && isEditable && (\n <React.Fragment>\n {editorConfig.admin?.hideDraggableBlockElement ? null : (\n <DraggableBlockPlugin anchorElem={floatingAnchorElem} />\n )}\n {editorConfig.admin?.hideAddBlockButton ? null : (\n <AddBlockHandlePlugin anchorElem={floatingAnchorElem} />\n )}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (\n plugin.position === 'floatingAnchorElem' &&\n !(plugin.desktopOnly === true && isSmallWidthViewport)\n ) {\n return (\n <EditorPlugin\n anchorElem={floatingAnchorElem}\n clientProps={plugin.clientProps}\n key={plugin.key}\n plugin={plugin}\n />\n )\n }\n })}\n {isEditable && (\n <React.Fragment>\n <SlashMenuPlugin anchorElem={floatingAnchorElem} />\n </React.Fragment>\n )}\n </React.Fragment>\n )}\n {isEditable && (\n <React.Fragment>\n <HistoryPlugin />\n {editorConfig?.features?.markdownTransformers?.length > 0 && <MarkdownShortcutPlugin />}\n </React.Fragment>\n )}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'normal') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'bottom') {\n return (\n <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n )\n }\n })}\n </div>\n {editorConfig.features.plugins?.map((plugin) => {\n if (plugin.position === 'belowContainer') {\n return <EditorPlugin clientProps={plugin.clientProps} key={plugin.key} plugin={plugin} />\n }\n })}\n </React.Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,yBAAyB,QA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../../src/lexical/config/server/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,qBAAqB,EAErB,wBAAwB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AA8FrD,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GACnE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAEpD;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,OAAO,CAAC,wBAAwB,CAAC,CA2FpC"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,qBAAqB,EAErB,wBAAwB,EAEzB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AA8FrD,wBAAgB,6BAA6B,CAC3C,gBAAgB,EAAE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,GACnE,qBAAqB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,CAEpD;AAED,wBAAsB,YAAY,CAAC,EACjC,MAAM,EACN,MAAM,EACN,iBAAiB,EACjB,uBAAuB,GACxB,EAAE;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,uBAAuB,EAAE,kBAAkB,CAAA;CAC5C,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAyFpC"}
@@ -63,11 +63,16 @@ export async function loadFeatures({
63
63
  parentIsLocalized,
64
64
  unSanitizedEditorConfig
65
65
  }) {
66
- // First remove all duplicate features. The LAST feature with a given key wins.
67
- unSanitizedEditorConfig.features = unSanitizedEditorConfig.features.reverse().filter((f, i, arr) => {
68
- const firstIndex = arr.findIndex(f2 => f2.key === f.key);
69
- return firstIndex === i;
70
- }).reverse();
66
+ // First remove all duplicate features. The LAST feature with a given key wins,
67
+ // and keeps the position of its last occurrence (matching the prior reverse/filter/reverse semantics).
68
+ const dedupedByKey = new Map();
69
+ for (const f of unSanitizedEditorConfig.features) {
70
+ if (dedupedByKey.has(f.key)) {
71
+ dedupedByKey.delete(f.key);
72
+ }
73
+ dedupedByKey.set(f.key, f);
74
+ }
75
+ unSanitizedEditorConfig.features = Array.from(dedupedByKey.values());
71
76
  unSanitizedEditorConfig.features = sortFeaturesForOptimalLoading(unSanitizedEditorConfig.features);
72
77
  const featureProviderMap = new Map(unSanitizedEditorConfig.features.map(f => [f.key, f]));
73
78
  const resolvedFeatures = new Map();
@@ -79,8 +84,7 @@ export async function loadFeatures({
79
84
  }
80
85
  if (featureProvider.dependencies?.length) {
81
86
  for (const dependencyKey of featureProvider.dependencies) {
82
- const found = unSanitizedEditorConfig.features.find(f => f.key === dependencyKey);
83
- if (!found) {
87
+ if (!featureProviderMap.has(dependencyKey)) {
84
88
  throw new Error(`Feature ${featureProvider.key} has a dependency ${dependencyKey} which does not exist.`);
85
89
  }
86
90
  }
@@ -90,8 +94,7 @@ export async function loadFeatures({
90
94
  // look in the resolved features instead of the editorConfig.features, as a dependency requires the feature to be loaded before it, contrary to a soft-dependency
91
95
  const found = resolvedFeatures.get(priorityDependencyKey);
92
96
  if (!found) {
93
- const existsInEditorConfig = unSanitizedEditorConfig.features.find(f => f.key === priorityDependencyKey);
94
- if (!existsInEditorConfig) {
97
+ if (!featureProviderMap.has(priorityDependencyKey)) {
95
98
  throw new Error(`Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which does not exist.`);
96
99
  } else {
97
100
  throw new Error(`Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which is not loaded before it.`);
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","names":["createDependencyGraph","featureProviders","graph","fp","key","dependencies","dependenciesPriority","dependenciesSoft","featureProvider","topologicallySortFeatures","visited","stack","visit","reverse","currentPath","Error","includes","join","push","dep","pop","sortFeaturesForOptimalLoading","loadFeatures","config","isRoot","parentIsLocalized","unSanitizedEditorConfig","features","filter","f","i","arr","firstIndex","findIndex","f2","featureProviderMap","Map","map","resolvedFeatures","loaded","length","dependencyKey","found","find","priorityDependencyKey","get","existsInEditorConfig","feature","resolvedFeature","order","set"],"sources":["../../../../src/lexical/config/server/loader.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n FeatureProviderServer,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n ServerFeatureProviderMap,\n} from '../../../features/typesServer.js'\nimport type { ServerEditorConfig } from '../types.js'\n\ntype DependencyGraph = {\n [key: string]: {\n dependencies: string[]\n dependenciesPriority: string[]\n dependenciesSoft: string[]\n featureProvider: FeatureProviderServer<unknown, unknown, unknown>\n }\n}\n\nfunction createDependencyGraph(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): DependencyGraph {\n const graph: DependencyGraph = {}\n for (const fp of featureProviders) {\n graph[fp.key] = {\n dependencies: fp.dependencies || [],\n dependenciesPriority: fp.dependenciesPriority || [],\n dependenciesSoft: fp.dependenciesSoft || [],\n featureProvider: fp,\n }\n }\n return graph\n}\n\nfunction topologicallySortFeatures(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n const graph = createDependencyGraph(featureProviders)\n const visited: { [key: string]: boolean } = {}\n const stack: FeatureProviderServer<unknown, unknown, unknown>[] = []\n\n for (const key in graph) {\n if (!visited[key]) {\n visit(graph, key, visited, stack)\n }\n }\n\n return stack.reverse()\n}\n\nfunction visit(\n graph: DependencyGraph,\n key: string,\n visited: { [key: string]: boolean },\n stack: FeatureProviderServer<unknown, unknown, unknown>[],\n currentPath: string[] = [],\n) {\n if (!graph[key]) {\n throw new Error(`Feature key ${key} is not present in the dependency graph.`)\n }\n\n if (currentPath.includes(key)) {\n throw new Error(`Circular dependency detected: ${currentPath.join(' -> ')} -> ${key}`)\n }\n\n if (visited[key]) {\n return\n }\n\n visited[key] = true\n currentPath.push(key)\n\n // First process the hard priority dependencies\n for (const dep of graph[key].dependenciesPriority) {\n if (!visited[dep]) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the normal dependencies, but make sure to not violate hard dependencies\n for (const dep of graph[key].dependencies) {\n if (!visited[dep] && !graph[key].dependenciesPriority.includes(dep)) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the soft dependencies. Make sure to not violate hard and normal dependencies.\n for (const dep of graph[key].dependenciesSoft) {\n if (\n graph[dep] &&\n !visited[dep] &&\n !graph[key].dependenciesPriority.includes(dep) &&\n !graph[key].dependencies.includes(dep)\n ) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n stack.push(graph[key].featureProvider)\n currentPath.pop()\n}\n\nexport function sortFeaturesForOptimalLoading(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n return topologicallySortFeatures(featureProviders)\n}\n\nexport async function loadFeatures({\n config,\n isRoot,\n parentIsLocalized,\n unSanitizedEditorConfig,\n}: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n unSanitizedEditorConfig: ServerEditorConfig\n}): Promise<ResolvedServerFeatureMap> {\n // First remove all duplicate features. The LAST feature with a given key wins.\n unSanitizedEditorConfig.features = unSanitizedEditorConfig.features\n .reverse()\n .filter((f, i, arr) => {\n const firstIndex = arr.findIndex((f2) => f2.key === f.key)\n return firstIndex === i\n })\n .reverse()\n\n unSanitizedEditorConfig.features = sortFeaturesForOptimalLoading(unSanitizedEditorConfig.features)\n\n const featureProviderMap: ServerFeatureProviderMap = new Map(\n unSanitizedEditorConfig.features.map(\n (f) => [f.key, f] as [string, FeatureProviderServer<unknown, unknown, unknown>],\n ),\n )\n\n const resolvedFeatures: ResolvedServerFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (!featureProvider.key) {\n throw new Error(\n `A Feature you've added does not have a key. Please add a key to the feature. This is used to uniquely identify the feature.`,\n )\n }\n if (featureProvider.dependencies?.length) {\n for (const dependencyKey of featureProvider.dependencies) {\n const found = unSanitizedEditorConfig.features.find((f) => f.key === dependencyKey)\n if (!found) {\n throw new Error(\n `Feature ${featureProvider.key} has a dependency ${dependencyKey} which does not exist.`,\n )\n }\n }\n }\n\n if (featureProvider.dependenciesPriority?.length) {\n for (const priorityDependencyKey of featureProvider.dependenciesPriority) {\n // look in the resolved features instead of the editorConfig.features, as a dependency requires the feature to be loaded before it, contrary to a soft-dependency\n const found = resolvedFeatures.get(priorityDependencyKey)\n if (!found) {\n const existsInEditorConfig = unSanitizedEditorConfig.features.find(\n (f) => f.key === priorityDependencyKey,\n )\n if (!existsInEditorConfig) {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which does not exist.`,\n )\n } else {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which is not loaded before it.`,\n )\n }\n }\n }\n }\n\n const feature =\n typeof featureProvider.feature === 'function'\n ? await featureProvider.feature({\n config,\n featureProviderMap,\n isRoot,\n parentIsLocalized,\n resolvedFeatures,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n const resolvedFeature: ResolvedServerFeature<any, any> = feature as ResolvedServerFeature<\n any,\n any\n >\n\n // All these new properties would be added to the feature, as it's mutated. However, this does not cause any damage and allows\n // us to prevent an unnecessary spread operation.\n resolvedFeature.key = featureProvider.key\n resolvedFeature.order = loaded\n resolvedFeature.dependencies = featureProvider.dependencies!\n resolvedFeature.dependenciesPriority = featureProvider.dependenciesPriority!\n resolvedFeature.dependenciesSoft = featureProvider.dependenciesSoft!\n\n resolvedFeatures.set(featureProvider.key, resolvedFeature)\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAmBA,SAASA,sBACPC,gBAAoE;EAEpE,MAAMC,KAAA,GAAyB,CAAC;EAChC,KAAK,MAAMC,EAAA,IAAMF,gBAAA,EAAkB;IACjCC,KAAK,CAACC,EAAA,CAAGC,GAAG,CAAC,GAAG;MACdC,YAAA,EAAcF,EAAA,CAAGE,YAAY,IAAI,EAAE;MACnCC,oBAAA,EAAsBH,EAAA,CAAGG,oBAAoB,IAAI,EAAE;MACnDC,gBAAA,EAAkBJ,EAAA,CAAGI,gBAAgB,IAAI,EAAE;MAC3CC,eAAA,EAAiBL;IACnB;EACF;EACA,OAAOD,KAAA;AACT;AAEA,SAASO,0BACPR,gBAAoE;EAEpE,MAAMC,KAAA,GAAQF,qBAAA,CAAsBC,gBAAA;EACpC,MAAMS,OAAA,GAAsC,CAAC;EAC7C,MAAMC,KAAA,GAA4D,EAAE;EAEpE,KAAK,MAAMP,GAAA,IAAOF,KAAA,EAAO;IACvB,IAAI,CAACQ,OAAO,CAACN,GAAA,CAAI,EAAE;MACjBQ,KAAA,CAAMV,KAAA,EAAOE,GAAA,EAAKM,OAAA,EAASC,KAAA;IAC7B;EACF;EAEA,OAAOA,KAAA,CAAME,OAAO;AACtB;AAEA,SAASD,MACPV,KAAsB,EACtBE,GAAW,EACXM,OAAmC,EACnCC,KAAyD,EACzDG,WAAA,GAAwB,EAAE;EAE1B,IAAI,CAACZ,KAAK,CAACE,GAAA,CAAI,EAAE;IACf,MAAM,IAA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AAoB;IAC3E0C,eAAA,CAAgBzC,gBAAgB,GAAGC,eAAA,CAAgBD,gBAAgB;IAEnE+B,gBAAA,CAAiBY,GAAG,CAAC1C,eAAA,CAAgBJ,GAAG,EAAE4C,eAAA;IAE1CT,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
1
+ {"version":3,"file":"loader.js","names":["createDependencyGraph","featureProviders","graph","fp","key","dependencies","dependenciesPriority","dependenciesSoft","featureProvider","topologicallySortFeatures","visited","stack","visit","reverse","currentPath","Error","includes","join","push","dep","pop","sortFeaturesForOptimalLoading","loadFeatures","config","isRoot","parentIsLocalized","unSanitizedEditorConfig","dedupedByKey","Map","f","features","has","delete","set","Array","from","values","featureProviderMap","map","resolvedFeatures","loaded","length","dependencyKey","priorityDependencyKey","found","get","feature","resolvedFeature","order"],"sources":["../../../../src/lexical/config/server/loader.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n FeatureProviderServer,\n ResolvedServerFeature,\n ResolvedServerFeatureMap,\n ServerFeatureProviderMap,\n} from '../../../features/typesServer.js'\nimport type { ServerEditorConfig } from '../types.js'\n\ntype DependencyGraph = {\n [key: string]: {\n dependencies: string[]\n dependenciesPriority: string[]\n dependenciesSoft: string[]\n featureProvider: FeatureProviderServer<unknown, unknown, unknown>\n }\n}\n\nfunction createDependencyGraph(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): DependencyGraph {\n const graph: DependencyGraph = {}\n for (const fp of featureProviders) {\n graph[fp.key] = {\n dependencies: fp.dependencies || [],\n dependenciesPriority: fp.dependenciesPriority || [],\n dependenciesSoft: fp.dependenciesSoft || [],\n featureProvider: fp,\n }\n }\n return graph\n}\n\nfunction topologicallySortFeatures(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n const graph = createDependencyGraph(featureProviders)\n const visited: { [key: string]: boolean } = {}\n const stack: FeatureProviderServer<unknown, unknown, unknown>[] = []\n\n for (const key in graph) {\n if (!visited[key]) {\n visit(graph, key, visited, stack)\n }\n }\n\n return stack.reverse()\n}\n\nfunction visit(\n graph: DependencyGraph,\n key: string,\n visited: { [key: string]: boolean },\n stack: FeatureProviderServer<unknown, unknown, unknown>[],\n currentPath: string[] = [],\n) {\n if (!graph[key]) {\n throw new Error(`Feature key ${key} is not present in the dependency graph.`)\n }\n\n if (currentPath.includes(key)) {\n throw new Error(`Circular dependency detected: ${currentPath.join(' -> ')} -> ${key}`)\n }\n\n if (visited[key]) {\n return\n }\n\n visited[key] = true\n currentPath.push(key)\n\n // First process the hard priority dependencies\n for (const dep of graph[key].dependenciesPriority) {\n if (!visited[dep]) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the normal dependencies, but make sure to not violate hard dependencies\n for (const dep of graph[key].dependencies) {\n if (!visited[dep] && !graph[key].dependenciesPriority.includes(dep)) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n // Then process the soft dependencies. Make sure to not violate hard and normal dependencies.\n for (const dep of graph[key].dependenciesSoft) {\n if (\n graph[dep] &&\n !visited[dep] &&\n !graph[key].dependenciesPriority.includes(dep) &&\n !graph[key].dependencies.includes(dep)\n ) {\n visit(graph, dep, visited, stack, currentPath)\n }\n }\n\n stack.push(graph[key].featureProvider)\n currentPath.pop()\n}\n\nexport function sortFeaturesForOptimalLoading(\n featureProviders: FeatureProviderServer<unknown, unknown, unknown>[],\n): FeatureProviderServer<unknown, unknown, unknown>[] {\n return topologicallySortFeatures(featureProviders)\n}\n\nexport async function loadFeatures({\n config,\n isRoot,\n parentIsLocalized,\n unSanitizedEditorConfig,\n}: {\n config: SanitizedConfig\n isRoot?: boolean\n parentIsLocalized: boolean\n unSanitizedEditorConfig: ServerEditorConfig\n}): Promise<ResolvedServerFeatureMap> {\n // First remove all duplicate features. The LAST feature with a given key wins,\n // and keeps the position of its last occurrence (matching the prior reverse/filter/reverse semantics).\n const dedupedByKey = new Map<string, FeatureProviderServer<unknown, unknown, unknown>>()\n for (const f of unSanitizedEditorConfig.features) {\n if (dedupedByKey.has(f.key)) {\n dedupedByKey.delete(f.key)\n }\n dedupedByKey.set(f.key, f)\n }\n unSanitizedEditorConfig.features = Array.from(dedupedByKey.values())\n\n unSanitizedEditorConfig.features = sortFeaturesForOptimalLoading(unSanitizedEditorConfig.features)\n\n const featureProviderMap: ServerFeatureProviderMap = new Map(\n unSanitizedEditorConfig.features.map(\n (f) => [f.key, f] as [string, FeatureProviderServer<unknown, unknown, unknown>],\n ),\n )\n\n const resolvedFeatures: ResolvedServerFeatureMap = new Map()\n\n // Make sure all dependencies declared in the respective features exist\n let loaded = 0\n for (const featureProvider of unSanitizedEditorConfig.features) {\n if (!featureProvider.key) {\n throw new Error(\n `A Feature you've added does not have a key. Please add a key to the feature. This is used to uniquely identify the feature.`,\n )\n }\n if (featureProvider.dependencies?.length) {\n for (const dependencyKey of featureProvider.dependencies) {\n if (!featureProviderMap.has(dependencyKey)) {\n throw new Error(\n `Feature ${featureProvider.key} has a dependency ${dependencyKey} which does not exist.`,\n )\n }\n }\n }\n\n if (featureProvider.dependenciesPriority?.length) {\n for (const priorityDependencyKey of featureProvider.dependenciesPriority) {\n // look in the resolved features instead of the editorConfig.features, as a dependency requires the feature to be loaded before it, contrary to a soft-dependency\n const found = resolvedFeatures.get(priorityDependencyKey)\n if (!found) {\n if (!featureProviderMap.has(priorityDependencyKey)) {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which does not exist.`,\n )\n } else {\n throw new Error(\n `Feature ${featureProvider.key} has a priority dependency ${priorityDependencyKey} which is not loaded before it.`,\n )\n }\n }\n }\n }\n\n const feature =\n typeof featureProvider.feature === 'function'\n ? await featureProvider.feature({\n config,\n featureProviderMap,\n isRoot,\n parentIsLocalized,\n resolvedFeatures,\n unSanitizedEditorConfig,\n })\n : featureProvider.feature\n\n const resolvedFeature: ResolvedServerFeature<any, any> = feature as ResolvedServerFeature<\n any,\n any\n >\n\n // All these new properties would be added to the feature, as it's mutated. However, this does not cause any damage and allows\n // us to prevent an unnecessary spread operation.\n resolvedFeature.key = featureProvider.key\n resolvedFeature.order = loaded\n resolvedFeature.dependencies = featureProvider.dependencies!\n resolvedFeature.dependenciesPriority = featureProvider.dependenciesPriority!\n resolvedFeature.dependenciesSoft = featureProvider.dependenciesSoft!\n\n resolvedFeatures.set(featureProvider.key, resolvedFeature)\n\n loaded++\n }\n\n return resolvedFeatures\n}\n"],"mappings":"AAmBA,SAASA,sBACPC,gBAAoE;EAEpE,MAAMC,KAAA,GAAyB,CAAC;EAChC,KAAK,MAAMC,EAAA,IAAMF,gBAAA,EAAkB;IACjCC,KAAK,CAACC,EAAA,CAAGC,GAAG,CAAC,GAAG;MACdC,YAAA,EAAcF,EAAA,CAAGE,YAAY,IAAI,EAAE;MACnCC,oBAAA,EAAsBH,EAAA,CAAGG,oBAAoB,IAAI,EAAE;MACnDC,gBAAA,EAAkBJ,EAAA,CAAGI,gBAAgB,IAAI,EAAE;MAC3CC,eAAA,EAAiBL;IACnB;EACF;EACA,OAAOD,KAAA;AACT;AAEA,SAASO,0BACPR,gBAAoE;EAEpE,MAAMC,KAAA,GAAQF,qBAAA,CAAsBC,gBAAA;EACpC,MAAMS,OAAA,GAAsC,CAAC;EAC7C,MAAMC,KAAA,GAA4D,EAAE;EAEpE,KAAK,MAAMP,GAAA,IAAOF,KAAA,EAAO;IACvB,IAAI,CAACQ,OAAO,CAACN,GAAA,CAAI,EAAE;MACjBQ,KAAA,CAAMV,KAAA,EAAOE,GAAA,EAAKM,OAAA,EAASC,KAAA;IAC7B;EACF;EAEA,OAAOA,KAAA,CAAME,OAAO;AACtB;AAEA,SAASD,MACPV,KAAsB,EACtBE,GAAW,EACXM,OAAmC,EACnCC,KAAyD,EACzDG,WAAA,GAAwB,EAAE;EAE1B,IAAI,CAACZ,KAAK,CAACE,GAAA,CAAI,EAAE;IACf,MAAM,IAAIW,KAAA,CAAM,eAAeX,GAAA,0CAA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AAE2C,eAAA;IAE1CP,MAAA;EACF;EAEA,OAAOD,gBAAA;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,aACvB,wBAAwB,KACjC,uBA+HF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
1
+ {"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../../../../src/lexical/config/server/sanitize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,OAAO,KAAK,EACV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,kCAAkC,CAAA;AACzC,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIlF,eAAO,MAAM,sBAAsB,aACvB,wBAAwB,KACjC,uBAyHF,CAAA;AAED,wBAAsB,0BAA0B,CAC9C,YAAY,EAAE,kBAAkB,EAChC,MAAM,EAAE,eAAe,EACvB,iBAAiB,CAAC,EAAE,OAAO,GAC1B,OAAO,CAAC,2BAA2B,CAAC,CAYtC"}
@@ -1,9 +1,6 @@
1
1
  import { loadFeatures } from './loader.js';
2
2
  export const sanitizeServerFeatures = features => {
3
3
  const sanitized = {
4
- converters: {
5
- html: []
6
- },
7
4
  enabledFeatures: [],
8
5
  generatedTypes: {
9
6
  modifyOutputSchemas: []
@@ -72,9 +69,6 @@ export const sanitizeServerFeatures = features => {
72
69
  if (node?.validations?.length) {
73
70
  sanitized.validations.set(nodeType, node.validations);
74
71
  }
75
- if (node?.converters?.html) {
76
- sanitized.converters.html.push(node.converters.html);
77
- }
78
72
  if (node?.hooks?.afterChange) {
79
73
  sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange);
80
74
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","converters","html","enabledFeatures","generatedTypes","modifyOutputSchemas","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","modifyOutputSchema","push","length","concat","lang","lexical","key","node","nodeType","replace","getType","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n converters: {\n html: [],\n },\n enabledFeatures: [],\n generatedTypes: {\n modifyOutputSchemas: [],\n },\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyOutputSchema) {\n sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema)\n }\n\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n sanitized.nodes.push(node)\n }\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.converters?.html) {\n sanitized.converters.html.push(node.converters.html)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,sBAAA,GACXC,QAAA;EAEA,MAAMC,SAAA,GAAqC;IACzCC,UAAA,EAAY;MACVC,IAAA,EAAM;IACR;IACAC,eAAA,EAAiB,EAAE;IACnBC,cAAA,EAAgB;MACdC,mBAAA,EAAqB;IACvB;IACAC,YAAA,EAAc,IAAIC,GAAA;IAClBC,gBAAA,EAAkB,IAAID,GAAA;IACtBE,yBAAA,EAA2B,IAAIF,GAAA;IAC/BG,KAAA,EAAO;MACLC,WAAA,EAAa,EAAE;MACfC,SAAA,EAAW,EAAE;MACbC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E;QACtD,IAAI,OAAOmB,WAAA,KAAgB,YAAY;UACrCnC,SAAA,CAAUgB,oBAAoB,CAACQ,IAAI,CACjCW,WAAA,CAAY;YACVC,QAAA,EAAUpC,SAAA,CAAUkB,KAAK;YACzBmB,eAAA,EAAiBrC,SAAA,CAAUgB;UAC7B;QAEJ,OAAO;UACLhB,SAAA,CAAUgB,oBAAoB,CAACQ,IAAI,CAACW,WAAA;QACtC;MACF;IACF;IAEAnC,SAAA,CAAUG,eAAe,CAACqB,IAAI,CAACF,OAAA,CAAQO,GAAG;EAC5C;EAEA,OAAO7B,SAAA;AACT;AAEA,OAAO,eAAesC,2BACpBC,YAAgC,EAChCC,MAAuB,EACvBC,iBAA2B;EAE3B,MAAMC,kBAAA,GAAqB,MAAM7C,YAAA,CAAa;IAC5C2C,MAAA;IACAC,iBAAA,EAAmBA,iBAAA;IACnBE,uBAAA,EAAyBJ;EAC3B;EAEA,OAAO;IACLxC,QAAA,EAAUD,sBAAA,CAAuB4C,kBAAA;IACjCd,OAAA,EAASW,YAAA,CAAaX,OAAO;IAC7Bc;EACF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"sanitize.js","names":["loadFeatures","sanitizeServerFeatures","features","sanitized","enabledFeatures","generatedTypes","modifyOutputSchemas","getSubFields","Map","getSubFieldsData","graphQLPopulationPromises","hooks","afterChange","afterRead","beforeChange","beforeValidate","i18n","markdownTransformers","nodeHooks","nodes","validations","size","forEach","feature","modifyOutputSchema","push","length","concat","lang","lexical","key","node","nodeType","replace","getType","set","transformer","allNodes","allTransformers","sanitizeServerEditorConfig","editorConfig","config","parentIsLocalized","resolvedFeatureMap","unSanitizedEditorConfig"],"sources":["../../../../src/lexical/config/server/sanitize.ts"],"sourcesContent":["import type { SanitizedConfig } from 'payload'\n\nimport type {\n ResolvedServerFeatureMap,\n SanitizedServerFeatures,\n} from '../../../features/typesServer.js'\nimport type { SanitizedServerEditorConfig, ServerEditorConfig } from '../types.js'\n\nimport { loadFeatures } from './loader.js'\n\nexport const sanitizeServerFeatures = (\n features: ResolvedServerFeatureMap,\n): SanitizedServerFeatures => {\n const sanitized: SanitizedServerFeatures = {\n enabledFeatures: [],\n generatedTypes: {\n modifyOutputSchemas: [],\n },\n getSubFields: new Map(),\n getSubFieldsData: new Map(),\n graphQLPopulationPromises: new Map(),\n hooks: {\n afterChange: [],\n afterRead: [],\n beforeChange: [],\n beforeValidate: [],\n },\n i18n: {},\n markdownTransformers: [],\n nodeHooks: {\n afterChange: new Map(),\n afterRead: new Map(),\n beforeChange: new Map(),\n beforeValidate: new Map(),\n },\n nodes: [],\n\n validations: new Map(),\n }\n\n if (!features?.size) {\n return sanitized\n }\n\n features.forEach((feature) => {\n if (feature?.generatedTypes?.modifyOutputSchema) {\n sanitized.generatedTypes.modifyOutputSchemas.push(feature.generatedTypes.modifyOutputSchema)\n }\n\n if (feature?.hooks?.beforeValidate?.length) {\n sanitized.hooks.beforeValidate = sanitized.hooks.beforeValidate?.concat(\n feature.hooks.beforeValidate,\n )\n }\n if (feature?.hooks?.beforeChange?.length) {\n sanitized.hooks.beforeChange = sanitized.hooks.beforeChange?.concat(\n feature.hooks.beforeChange,\n )\n }\n if (feature?.hooks?.afterRead?.length) {\n sanitized.hooks.afterRead = sanitized.hooks.afterRead?.concat(feature.hooks.afterRead)\n }\n if (feature?.hooks?.afterChange?.length) {\n sanitized.hooks.afterChange = sanitized.hooks.afterChange?.concat(feature.hooks.afterChange)\n }\n\n if (feature?.i18n) {\n for (const lang in feature.i18n) {\n if (!sanitized.i18n[lang as keyof typeof sanitized.i18n]) {\n sanitized.i18n[lang as keyof typeof sanitized.i18n] = {\n lexical: {},\n }\n }\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n sanitized.i18n[lang].lexical[feature.key] = feature.i18n[lang]\n }\n }\n\n if (feature.nodes?.length) {\n // Do not concat here. We need to keep the object reference of sanitized.nodes so that function markdown transformers of features automatically get the updated nodes\n for (const node of feature.nodes) {\n sanitized.nodes.push(node)\n }\n feature.nodes.forEach((node) => {\n const nodeType = 'with' in node.node ? node.node.replace.getType() : node.node.getType() // TODO: Idk if this works for node replacements\n if (node?.graphQLPopulationPromises?.length) {\n sanitized.graphQLPopulationPromises.set(nodeType, node.graphQLPopulationPromises)\n }\n if (node?.validations?.length) {\n sanitized.validations.set(nodeType, node.validations)\n }\n if (node?.hooks?.afterChange) {\n sanitized.nodeHooks?.afterChange?.set(nodeType, node.hooks.afterChange)\n }\n if (node?.hooks?.afterRead) {\n sanitized.nodeHooks?.afterRead?.set(nodeType, node.hooks.afterRead)\n }\n if (node?.hooks?.beforeChange) {\n sanitized.nodeHooks?.beforeChange?.set(nodeType, node.hooks.beforeChange)\n }\n if (node?.hooks?.beforeValidate) {\n sanitized.nodeHooks?.beforeValidate?.set(nodeType, node.hooks.beforeValidate)\n }\n if (node?.getSubFields) {\n sanitized.getSubFields?.set(nodeType, node.getSubFields)\n }\n if (node?.getSubFieldsData) {\n sanitized.getSubFieldsData?.set(nodeType, node.getSubFieldsData)\n }\n })\n }\n\n if (feature.markdownTransformers?.length) {\n // Do not concat here. We need to keep the object reference of feature.markdownTransformers\n\n for (const transformer of feature.markdownTransformers) {\n if (typeof transformer === 'function') {\n sanitized.markdownTransformers.push(\n transformer({\n allNodes: sanitized.nodes,\n allTransformers: sanitized.markdownTransformers,\n }),\n )\n } else {\n sanitized.markdownTransformers.push(transformer)\n }\n }\n }\n\n sanitized.enabledFeatures.push(feature.key)\n })\n\n return sanitized\n}\n\nexport async function sanitizeServerEditorConfig(\n editorConfig: ServerEditorConfig,\n config: SanitizedConfig,\n parentIsLocalized?: boolean,\n): Promise<SanitizedServerEditorConfig> {\n const resolvedFeatureMap = await loadFeatures({\n config,\n parentIsLocalized: parentIsLocalized!,\n unSanitizedEditorConfig: editorConfig,\n })\n\n return {\n features: sanitizeServerFeatures(resolvedFeatureMap),\n lexical: editorConfig.lexical!,\n resolvedFeatureMap,\n }\n}\n"],"mappings":"AAQA,SAASA,YAAY,QAAQ;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,EAAUD,IAAA,CAAKtB,gBAAgB;QACjE;MACF;IACF;IAEA,IAAIc,OAAA,CAAQN,oBAAoB,EAAES,MAAA,EAAQ;MACxC;MAEA,KAAK,MAAMU,WAAA,IAAeb,OAAA,CAAQN,oBAAoB,EAAE;QACtD,IAAI,OAAOmB,WAAA,KAAgB,YAAY;UACrCjC,SAAA,CAAUc,oBAAoB,CAACQ,IAAI,CACjCW,WAAA,CAAY;YACVC,QAAA,EAAUlC,SAAA,CAAUgB,KAAK;YACzBmB,eAAA,EAAiBnC,SAAA,CAAUc;UAC7B;QAEJ,OAAO;UACLd,SAAA,CAAUc,oBAAoB,CAACQ,IAAI,CAACW,WAAA;QACtC;MACF;IACF;IAEAjC,SAAA,CAAUC,eAAe,CAACqB,IAAI,CAACF,OAAA,CAAQO,GAAG;EAC5C;EAEA,OAAO3B,SAAA;AACT;AAEA,OAAO,eAAeoC,2BACpBC,YAAgC,EAChCC,MAAuB,EACvBC,iBAA2B;EAE3B,MAAMC,kBAAA,GAAqB,MAAM3C,YAAA,CAAa;IAC5CyC,MAAA;IACAC,iBAAA,EAAmBA,iBAAA;IACnBE,uBAAA,EAAyBJ;EAC3B;EAEA,OAAO;IACLtC,QAAA,EAAUD,sBAAA,CAAuB0C,kBAAA;IACjCd,OAAA,EAASW,YAAA,CAAaX,OAAO;IAC7Bc;EACF;AACF","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ @layer payload-default {
2
+ [data-lexical-decorator='true'] {
3
+ width: fit-content;
4
+ border-radius: var(--radius-medium);
5
+ }
6
+
7
+ .decorator-selected {
8
+ box-shadow: 0 0 0 2px var(--color-border-selected) !important;
9
+ outline: none !important;
10
+ }
11
+ }
@@ -1,5 +1,5 @@
1
1
  import type { DecoratorNode, ElementNode, LexicalNode } from 'lexical';
2
- import './index.scss';
2
+ import './index.css';
3
3
  export declare function DecoratorPlugin(): null;
4
4
  /**
5
5
  * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA2BtE,OAAO,cAAc,CAAA;AAIrB,wBAAgB,eAAe,SA6K9B;AAiDD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAgBjG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AA2BtE,OAAO,aAAa,CAAA;AAIpB,wBAAgB,eAAe,SA6K9B;AAiDD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,IAAI,aAAa,CAAC,OAAO,CAAC,GAAG,WAAW,CAgBjG"}
@@ -5,6 +5,7 @@ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext
5
5
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
6
6
  import { $createNodeSelection, $getEditor, $getNearestNodeFromDOMNode, $getSelection, $isDecoratorNode, $isElementNode, $isLineBreakNode, $isNodeSelection, $isRangeSelection, $isRootOrShadowRoot, $isTextNode, $setSelection, CLICK_COMMAND, COMMAND_PRIORITY_LOW, KEY_ARROW_DOWN_COMMAND, KEY_ARROW_UP_COMMAND, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, SELECTION_CHANGE_COMMAND } from 'lexical';
7
7
  import { useEffect } from 'react';
8
+ import './index.css';
8
9
  // TODO: This should ideally be fixed in Lexical. See
9
10
  // https://github.com/facebook/lexical/pull/7072
10
11
  export function DecoratorPlugin() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","mergeRegister","$createNodeSelection","$getEditor","$getNearestNodeFromDOMNode","$getSelection","$isDecoratorNode","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","SELECTION_CHANGE_COMMAND","useEffect","DecoratorPlugin","$","editor","$onDelete","_temp2","t0","t1","registerCommand","_temp3","_temp4","_temp6","_temp8","event_2","selection_1","selection","event","preventDefault","nextSibling","getNodes","getNextSibling","element_0","getElementByKey","getKey","element","$selectDecorator","node","firstDescendant","getFirstDescendant","block_0","INTERNAL_$isBlock","block","selectEnd","lastPoint","isBackward","anchor","focus","lastNode","getNode","lastSelectedBlock","_temp7","nextBlock","findLaterSiblingBlock","nextBlockElement","node_1","event_1","selection_0","prevSibling","getPreviousSibling","lastDescendant","getLastDescendant","selectStart","firstPoint","firstNode","firstSelectedBlock","_temp5","prevBlock","findFirstSiblingBlock","prevBlockElement","node_0","decorator_0","$getSelectedDecorator","document","querySelector","classList","remove","decorator","add","event_0","$getDecoratorByMouseEvent","target","isInteractive","HTMLElement","isContentEditable","closest","forEach","_temp","undefined","nodes","length","scrollIntoView","behavior","isInline","firstChild","getFirstChild","isLeafElement","canBeEmpty","current"],"sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.scss'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n decorator.element?.classList.add('decorator-selected')\n return true\n }\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node)\n ? {\n decorator: node,\n element: $getEditor().getElementByKey(node.getKey()),\n }\n : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,oBAAoB,EACpBC,UAAU,EACVC,0BAA0B,EAC1BC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,SAAS,QAAQ;AAI1B;AACA;AACA,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAAzB,EAAA;EACL,OAAA0B,MAAA,IAAiBzB,yBAAA;EAEjB,MAAA0B,SAAA,GAAAC,MA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,IAAA,KAASpC,mBAAA,CAAoBoC,IAAA,GAAO;IACtD,OAAO;EACT;EAEA,MAAMyD,UAAA,GAAazD,IAAA,CAAK0D,aAAa;EACrC,MAAMC,aAAA,GACJF,UAAA,KAAe,QACfhG,gBAAA,CAAiBgG,UAAA,KACjB5F,WAAA,CAAY4F,UAAA,KACZA,UAAA,CAAWD,QAAQ;EAErB,OAAO,CAACxD,IAAA,CAAKwD,QAAQ,MAAMxD,IAAA,CAAK4D,UAAU,OAAO,SAASD,aAAA;AAC5D;AAEA,SAAS3C,sBAAsBhB,IAAiB;EAC9C,IAAI6D,OAAA,GAAU7D,IAAA,CAAKN,cAAc;EACjC,OAAOmE,OAAA,KAAY,MAAM;IACvB,IAAIzD,iBAAA,CAAkByD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQnE,cAAc;EAClC;EACA,OAAO;AACT;AAEA,SAASqC,sBAAsB/B,IAAiB;EAC9C,IAAI6D,OAAA,GAAU7D,IAAA,CAAKsB,kBAAkB;EACrC,OAAOuC,OAAA,KAAY,MAAM;IACvB,IAAIzD,iBAAA,CAAkByD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQvC,kBAAkB;EACtC;EACA,OAAO;AACT","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$findMatchingParent","mergeRegister","$createNodeSelection","$getEditor","$getNearestNodeFromDOMNode","$getSelection","$isDecoratorNode","$isElementNode","$isLineBreakNode","$isNodeSelection","$isRangeSelection","$isRootOrShadowRoot","$isTextNode","$setSelection","CLICK_COMMAND","COMMAND_PRIORITY_LOW","KEY_ARROW_DOWN_COMMAND","KEY_ARROW_UP_COMMAND","KEY_BACKSPACE_COMMAND","KEY_DELETE_COMMAND","SELECTION_CHANGE_COMMAND","useEffect","DecoratorPlugin","$","editor","$onDelete","_temp2","t0","t1","registerCommand","_temp3","_temp4","_temp6","_temp8","event_2","selection_1","selection","event","preventDefault","nextSibling","getNodes","getNextSibling","element_0","getElementByKey","getKey","element","$selectDecorator","node","firstDescendant","getFirstDescendant","block_0","INTERNAL_$isBlock","block","selectEnd","lastPoint","isBackward","anchor","focus","lastNode","getNode","lastSelectedBlock","_temp7","nextBlock","findLaterSiblingBlock","nextBlockElement","node_1","event_1","selection_0","prevSibling","getPreviousSibling","lastDescendant","getLastDescendant","selectStart","firstPoint","firstNode","firstSelectedBlock","_temp5","prevBlock","findFirstSiblingBlock","prevBlockElement","node_0","decorator_0","$getSelectedDecorator","document","querySelector","classList","remove","decorator","add","event_0","$getDecoratorByMouseEvent","target","isInteractive","HTMLElement","isContentEditable","closest","forEach","_temp","undefined","nodes","length","scrollIntoView","behavior","isInline","firstChild","getFirstChild","isLeafElement","canBeEmpty","current"],"sources":["../../../../src/lexical/plugins/DecoratorPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { DecoratorNode, ElementNode, LexicalNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $createNodeSelection,\n $getEditor,\n $getNearestNodeFromDOMNode,\n $getSelection,\n $isDecoratorNode,\n $isElementNode,\n $isLineBreakNode,\n $isNodeSelection,\n $isRangeSelection,\n $isRootOrShadowRoot,\n $isTextNode,\n $setSelection,\n CLICK_COMMAND,\n COMMAND_PRIORITY_LOW,\n KEY_ARROW_DOWN_COMMAND,\n KEY_ARROW_UP_COMMAND,\n KEY_BACKSPACE_COMMAND,\n KEY_DELETE_COMMAND,\n SELECTION_CHANGE_COMMAND,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport './index.css'\n\n// TODO: This should ideally be fixed in Lexical. See\n// https://github.com/facebook/lexical/pull/7072\nexport function DecoratorPlugin() {\n const [editor] = useLexicalComposerContext()\n\n const $onDelete = (event: KeyboardEvent) => {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return false\n }\n event.preventDefault()\n selection.getNodes().forEach((node) => {\n node.remove()\n })\n return true\n }\n\n useEffect(() => {\n return mergeRegister(\n editor.registerCommand(\n CLICK_COMMAND,\n (event) => {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const decorator = $getDecoratorByMouseEvent(event)\n if (!decorator) {\n return true\n }\n const { target } = event\n const isInteractive =\n !(target instanceof HTMLElement) ||\n target.isContentEditable ||\n target.closest(\n 'button, textarea, input, .react-select, .code-editor, .no-select-decorator, [role=\"button\"]',\n )\n if (isInteractive) {\n $setSelection(null)\n } else {\n $selectDecorator(decorator)\n }\n return true\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(KEY_DELETE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(KEY_BACKSPACE_COMMAND, $onDelete, COMMAND_PRIORITY_LOW),\n editor.registerCommand(\n SELECTION_CHANGE_COMMAND,\n () => {\n const decorator = $getSelectedDecorator()\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n if (decorator) {\n decorator.element?.classList.add('decorator-selected')\n return true\n }\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_UP_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n const prevSibling = selection.getNodes()[0]?.getPreviousSibling()\n if ($isDecoratorNode(prevSibling)) {\n const element = $getEditor().getElementByKey(prevSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: prevSibling })\n event.preventDefault()\n return true\n }\n return false\n }\n if (!$isElementNode(prevSibling)) {\n return false\n }\n const lastDescendant = prevSibling.getLastDescendant() ?? prevSibling\n if (!lastDescendant) {\n return false\n }\n const block = $findMatchingParent(lastDescendant, INTERNAL_$isBlock)\n block?.selectStart()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get first selected block\n const firstPoint = selection.isBackward() ? selection.anchor : selection.focus\n const firstNode = firstPoint.getNode()\n const firstSelectedBlock = $findMatchingParent(firstNode, (node) => {\n return findFirstSiblingBlock(node) !== null\n })\n const prevBlock = firstSelectedBlock?.getPreviousSibling()\n if (!firstSelectedBlock || prevBlock !== findFirstSiblingBlock(firstSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(prevBlock)) {\n const prevBlockElement = $getEditor().getElementByKey(prevBlock.getKey())\n if (prevBlockElement) {\n $selectDecorator({ element: prevBlockElement, node: prevBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n editor.registerCommand(\n KEY_ARROW_DOWN_COMMAND,\n (event) => {\n // CASE 1: Node selection\n const selection = $getSelection()\n if ($isNodeSelection(selection)) {\n event.preventDefault()\n const nextSibling = selection.getNodes()[0]?.getNextSibling()\n if ($isDecoratorNode(nextSibling)) {\n const element = $getEditor().getElementByKey(nextSibling.getKey())\n if (element) {\n $selectDecorator({ element, node: nextSibling })\n }\n return true\n }\n if (!$isElementNode(nextSibling)) {\n return true\n }\n const firstDescendant = nextSibling.getFirstDescendant() ?? nextSibling\n if (!firstDescendant) {\n return true\n }\n const block = $findMatchingParent(firstDescendant, INTERNAL_$isBlock)\n block?.selectEnd()\n event.preventDefault()\n return true\n }\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n // CASE 2: Range selection\n // Get last selected block\n const lastPoint = selection.isBackward() ? selection.anchor : selection.focus\n const lastNode = lastPoint.getNode()\n const lastSelectedBlock = $findMatchingParent(lastNode, (node) => {\n return findLaterSiblingBlock(node) !== null\n })\n const nextBlock = lastSelectedBlock?.getNextSibling()\n if (!lastSelectedBlock || nextBlock !== findLaterSiblingBlock(lastSelectedBlock)) {\n return false\n }\n\n if ($isDecoratorNode(nextBlock)) {\n const nextBlockElement = $getEditor().getElementByKey(nextBlock.getKey())\n if (nextBlockElement) {\n $selectDecorator({ element: nextBlockElement, node: nextBlock })\n event.preventDefault()\n return true\n }\n }\n\n return false\n },\n COMMAND_PRIORITY_LOW,\n ),\n )\n }, [editor])\n\n return null\n}\n\nfunction $getDecoratorByMouseEvent(\n event: MouseEvent,\n): { element: HTMLElement; node: DecoratorNode<unknown> } | undefined {\n if (!(event.target instanceof HTMLElement)) {\n return undefined\n }\n const element = event.target.closest('[data-lexical-decorator=\"true\"]')\n if (!(element instanceof HTMLElement)) {\n return undefined\n }\n const node = $getNearestNodeFromDOMNode(element)\n return $isDecoratorNode(node) ? { element, node } : undefined\n}\n\nfunction $getSelectedDecorator() {\n const selection = $getSelection()\n if (!$isNodeSelection(selection)) {\n return undefined\n }\n const nodes = selection.getNodes()\n if (nodes.length !== 1) {\n return undefined\n }\n const node = nodes[0]\n return $isDecoratorNode(node)\n ? {\n decorator: node,\n element: $getEditor().getElementByKey(node.getKey()),\n }\n : undefined\n}\n\nfunction $selectDecorator({\n element,\n node,\n}: {\n element: HTMLElement\n node: DecoratorNode<unknown>\n}) {\n document.querySelector('.decorator-selected')?.classList.remove('decorator-selected')\n const selection = $createNodeSelection()\n selection.add(node.getKey())\n $setSelection(selection)\n element.scrollIntoView({ behavior: 'smooth', block: 'nearest' })\n element.classList.add('decorator-selected')\n}\n\n/**\n * Copied from https://github.com/facebook/lexical/blob/main/packages/lexical/src/LexicalUtils.ts\n *\n * This function returns true for a DecoratorNode that is not inline OR\n * an ElementNode that is:\n * - not a root or shadow root\n * - not inline\n * - can't be empty\n * - has no children or an inline first child\n */\nexport function INTERNAL_$isBlock(node: LexicalNode): node is DecoratorNode<unknown> | ElementNode {\n if ($isDecoratorNode(node) && !node.isInline()) {\n return true\n }\n if (!$isElementNode(node) || $isRootOrShadowRoot(node)) {\n return false\n }\n\n const firstChild = node.getFirstChild()\n const isLeafElement =\n firstChild === null ||\n $isLineBreakNode(firstChild) ||\n $isTextNode(firstChild) ||\n firstChild.isInline()\n\n return !node.isInline() && node.canBeEmpty() !== false && isLeafElement\n}\n\nfunction findLaterSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getNextSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getNextSibling()\n }\n return null\n}\n\nfunction findFirstSiblingBlock(node: LexicalNode): LexicalNode | null {\n let current = node.getPreviousSibling()\n while (current !== null) {\n if (INTERNAL_$isBlock(current)) {\n return current\n }\n current = current.getPreviousSibling()\n }\n return null\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;AAIA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,mBAAmB,EAAEC,aAAa,QAAQ;AACnD,SACEC,oBAAoB,EACpBC,UAAU,EACVC,0BAA0B,EAC1BC,aAAa,EACbC,gBAAgB,EAChBC,cAAc,EACdC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,aAAa,EACbC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,EACpBC,qBAAqB,EACrBC,kBAAkB,EAClBC,wBAAwB,QACnB;AACP,SAASC,SAAS,QAAQ;AAE1B,OAAO;AAEP;AACA;AACA,OAAO,SAAAC,gBAAA;EAAA,MAAAC,CAAA,GAAAzB,EAAA;EACL,OAAA0B,MAAA,IAAiBzB,yBAAA;EAEjB,MAAA0B,SAAA,GAAAC,MAAA;EAUA,IAAAC,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAEUG,EAAA,GAAAA,CAAA,KACD1B,aAAA,CACLuB,MAAA,CAAAK,eAAA,CAAAf,aAAA,EAAAgB,MAAA,EAAAf,oBAsBE,GAEFS,MAAA,CAAAK,eAAA,CAAAV,kBAAA,EAA2CM,SAAA,EAAAV,oBAAW,GACtDS,MAAA,CAAAK,eAAA,CAAAX,qBAAA,EAA8CO,SAAA,EAAAV,oBAAW,GACzDS,MAAA,CAAAK,eAAA,CAAAT,wBAAA,EAAAW,MAAA,EAAAhB,oBAWE,GAEFS,MAAA,CAAAK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,OAAOmE,OAAA,KAAY,MAAM;IACvB,IAAIzD,iBAAA,CAAkByD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQnE,cAAc;EAClC;EACA,OAAO;AACT;AAEA,SAASqC,sBAAsB/B,IAAiB;EAC9C,IAAI6D,OAAA,GAAU7D,IAAA,CAAKsB,kBAAkB;EACrC,OAAOuC,OAAA,KAAY,MAAM;IACvB,IAAIzD,iBAAA,CAAkByD,OAAA,GAAU;MAC9B,OAAOA,OAAA;IACT;IACAA,OAAA,GAAUA,OAAA,CAAQvC,kBAAkB;EACtC;EACA,OAAO;AACT","ignoreList":[]}
@@ -0,0 +1,52 @@
1
+ @layer payload-default {
2
+ .rich-text-lexical--show-gutter {
3
+ .insert-paragraph-at-end {
4
+ padding: var(--spacer-1) 0 calc(var(--spacer-1) / 2) var(--spacer-6);
5
+ }
6
+ }
7
+ .insert-paragraph-at-end {
8
+ height: var(--spacer-4);
9
+ margin-top: calc(var(--spacer-4) * -1);
10
+ width: 100%;
11
+ z-index: 0;
12
+ position: relative;
13
+ padding: var(--spacer-1) 0 calc(var(--spacer-1) / 2) 0;
14
+
15
+ &:hover {
16
+ cursor: pointer;
17
+
18
+ .insert-paragraph-at-end-inside {
19
+ background-color: var(--color-bg-hover);
20
+
21
+ span {
22
+ display: flex;
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+ .insert-paragraph-at-end-inside {
29
+ width: 100%;
30
+ height: 100%;
31
+ background-color: transparent;
32
+ transition: background-color 0.1s ease-in-out;
33
+ display: flex;
34
+ justify-content: center;
35
+ border-radius: var(--radius-medium);
36
+ color: var(--color-text-secondary);
37
+
38
+ span {
39
+ display: none;
40
+ justify-content: center;
41
+ align-items: center;
42
+ }
43
+ }
44
+
45
+ html[data-theme='dark'] {
46
+ .insert-paragraph-at-end:hover {
47
+ .insert-paragraph-at-end-inside {
48
+ background-color: var(--color-bg-secondary);
49
+ }
50
+ }
51
+ }
52
+ }
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
- import './index.scss';
2
+ import './index.css';
3
3
  export declare const InsertParagraphAtEndPlugin: React.FC;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAIrB,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EA8B9C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,aAAa,CAAA;AAIpB,eAAO,MAAM,0BAA0B,EAAE,KAAK,CAAC,EA8B9C,CAAA"}
@@ -5,6 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
6
6
  import { $createParagraphNode, $getRoot } from 'lexical';
7
7
  import React from 'react';
8
+ import './index.css';
8
9
  import { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js';
9
10
  const baseClass = 'insert-paragraph-at-end';
10
11
  export const InsertParagraphAtEndPlugin = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$createParagraphNode","$getRoot","React","useEditorConfigContext","baseClass","InsertParagraphAtEndPlugin","$","editor","editorConfig","admin","hideInsertParagraphAtEnd","t0","onClick","update","_temp","_jsx","className","role","tabIndex","children","paragraphNode","append","select"],"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.scss'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n // TODO: convert to button\n <div\n aria-label=\"Insert Paragraph\"\n className={baseClass}\n onClick={onClick}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}-inside`}>\n <span>+</span>\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA,0DACA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAC/C,OAAOC,KAAA,MAAW;AAGlB,SAASC,sBAAsB,QAAQ;AACvC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,0BAAA,GAAuCA,CAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAClD,OAAAS,MAAA,IAAiBR,yBAAA;EACjB;IAAAS;EAAA,IAAyBL,sBAAA;EAAA,IAErBK,YAAA,EAAAC,KAAA,EAAAC,wBAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAIJ,MAAAK,OAAA,GAAAA,CAAA;MACEL,MAAA,CAAAM,MAAA,CAAAC,KAIA;IAAA;IAKAH,EAAA,GAAAI,IAAA,CAAC;MAAA,cACY;MAAAC,SAAA,EAAAZ,SAAA;MAAAQ,OAAA;MAAAK,IAAA,EAGN;MAAAC,QAAA;MAAAC,QAAA,EAGLJ,IAAA,CAAC;QAAAC,SAAA,EAAe,GAAAZ,SAAA,SAAqB;QAAAe,QAAA,EACnCJ,IAAA,CAAC;UAAAI,QAAA,EAAK;QAAA,C;;;;;;;;SARVR,E;CAYJ;AA9BoD,SAAAG,MAAA;EAU9C,MAAAM,aAAA,GAAsBpB,oBAAA;EACtBC,QAAA,GAAAoB,MAAA,CAAkBD,aAAA;EAClBA,aAAA,CAAAE,MAAA,CAAoB;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","useLexicalComposerContext","$createParagraphNode","$getRoot","React","useEditorConfigContext","baseClass","InsertParagraphAtEndPlugin","$","editor","editorConfig","admin","hideInsertParagraphAtEnd","t0","onClick","update","_temp","_jsx","className","role","tabIndex","children","paragraphNode","append","select"],"sources":["../../../../src/lexical/plugins/InsertParagraphAtEnd/index.tsx"],"sourcesContent":["/* eslint-disable jsx-a11y/click-events-have-key-events */\n'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { $createParagraphNode, $getRoot } from 'lexical'\nimport React from 'react'\n\nimport './index.css'\nimport { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js'\nconst baseClass = 'insert-paragraph-at-end'\n\nexport const InsertParagraphAtEndPlugin: React.FC = () => {\n const [editor] = useLexicalComposerContext()\n const { editorConfig } = useEditorConfigContext()\n\n if (editorConfig?.admin?.hideInsertParagraphAtEnd) {\n return null\n }\n\n const onClick = () => {\n editor.update(() => {\n const paragraphNode = $createParagraphNode()\n $getRoot().append(paragraphNode)\n paragraphNode.select()\n })\n }\n\n return (\n // TODO: convert to button\n <div\n aria-label=\"Insert Paragraph\"\n className={baseClass}\n onClick={onClick}\n role=\"button\"\n tabIndex={0}\n >\n <div className={`${baseClass}-inside`}>\n <span>+</span>\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA,0DACA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,oBAAoB,EAAEC,QAAQ,QAAQ;AAC/C,OAAOC,KAAA,MAAW;AAElB,OAAO;AACP,SAASC,sBAAsB,QAAQ;AACvC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,0BAAA,GAAuCA,CAAA;EAAA,MAAAC,CAAA,GAAAR,EAAA;EAClD,OAAAS,MAAA,IAAiBR,yBAAA;EACjB;IAAAS;EAAA,IAAyBL,sBAAA;EAAA,IAErBK,YAAA,EAAAC,KAAA,EAAAC,wBAAA;IAAA;EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAL,CAAA,QAAAC,MAAA;IAIJ,MAAAK,OAAA,GAAAA,CAAA;MACEL,MAAA,CAAAM,MAAA,CAAAC,KAIA;IAAA;IAKAH,EAAA,GAAAI,IAAA,CAAC;MAAA,cACY;MAAAC,SAAA,EAAAZ,SAAA;MAAAQ,OAAA;MAAAK,IAAA,EAGN;MAAAC,QAAA;MAAAC,QAAA,EAGLJ,IAAA,CAAC;QAAAC,SAAA,EAAe,GAAAZ,SAAA,SAAqB;QAAAe,QAAA,EACnCJ,IAAA,CAAC;UAAAI,QAAA,EAAK;QAAA,C;;;;;;;;SARVR,E;CAYJ;AA9BoD,SAAAG,MAAA;EAU9C,MAAAM,aAAA,GAAsBpB,oBAAA;EACtBC,QAAA,GAAAoB,MAAA,CAAkBD,aAAA;EAClBA,aAAA,CAAAE,MAAA,CAAoB;AAAA","ignoreList":[]}
@@ -0,0 +1,65 @@
1
+ @layer payload-default {
2
+ .slash-menu-popup {
3
+ --slash-menu-width: 12.5rem;
4
+ --slash-menu-max-height: 18.75rem;
5
+ background: var(--color-bg-elevated);
6
+ color: var(--color-text);
7
+ width: var(--slash-menu-width);
8
+ border-radius: var(--radius-large);
9
+ padding: var(--spacer-2);
10
+ list-style: none;
11
+ font-family: var(--text-body-medium-font-family);
12
+ font-size: var(--text-body-medium-font-size);
13
+ font-weight: var(--text-body-medium-font-weight);
14
+ line-height: var(--text-body-medium-line-height);
15
+ max-height: var(--slash-menu-max-height);
16
+ overflow-y: auto;
17
+ z-index: 10;
18
+ position: absolute;
19
+ box-shadow:
20
+ 0 2px 6px 0 rgba(0, 0, 0, 0.12),
21
+ 0 10px 16px 0 rgba(0, 0, 0, 0.08),
22
+ 0 0 0.5px 0 rgba(0, 0, 0, 0.12),
23
+ 0 0 0 1px rgba(0, 0, 0, 0.04);
24
+ }
25
+
26
+ .slash-menu-popup__group {
27
+ padding-bottom: var(--spacer-1);
28
+ }
29
+
30
+ .slash-menu-popup__group-title {
31
+ padding: 0 var(--spacer-1);
32
+ color: var(--color-text-secondary);
33
+ font-size: var(--text-body-small-font-size);
34
+ line-height: var(--spacer-4);
35
+ }
36
+
37
+ .slash-menu-popup__item {
38
+ all: unset;
39
+ padding: 0 var(--spacer-1);
40
+ box-sizing: border-box;
41
+ color: var(--color-text);
42
+ display: flex;
43
+ align-items: center;
44
+ height: var(--spacer-4);
45
+ width: 100%;
46
+ border-radius: var(--radius-medium);
47
+ cursor: pointer;
48
+ gap: var(--spacer-1);
49
+ transition: background-color 0.15s cubic-bezier(0, 0.2, 0.2, 1);
50
+
51
+ .icon {
52
+ color: var(--color-icon-secondary);
53
+ }
54
+ }
55
+
56
+ .slash-menu-popup__item--selected {
57
+ background-color: var(--color-bg-transparent-pressed);
58
+ }
59
+
60
+ .slash-menu-popup__item-text {
61
+ overflow: hidden;
62
+ white-space: nowrap;
63
+ text-overflow: ellipsis;
64
+ }
65
+ }
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import './index.scss';
2
+ import './index.css';
3
3
  export declare function SlashMenuPlugin({ anchorElem, }: {
4
4
  anchorElem?: HTMLElement;
5
5
  }): React.ReactElement;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/SlashMenu/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,OAAO,cAAc,CAAA;AA+DrB,wBAAgB,eAAe,CAAC,EAC9B,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB,GAAG,KAAK,CAAC,YAAY,CA6KrB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lexical/plugins/SlashMenu/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAW9B,OAAO,aAAa,CAAA;AA+DpB,wBAAgB,eAAe,CAAC,EAC9B,UAA0B,GAC3B,EAAE;IACD,UAAU,CAAC,EAAE,WAAW,CAAA;CACzB,GAAG,KAAK,CAAC,YAAY,CA6KrB"}
@@ -7,6 +7,7 @@ import { useCallback, useMemo, useState } from 'react';
7
7
  import * as React from 'react';
8
8
  import * as ReactDOM from 'react-dom';
9
9
  import { useEditorConfigContext } from '../../config/client/EditorConfigProvider.js';
10
+ import './index.css';
10
11
  import { LexicalTypeaheadMenuPlugin } from './LexicalTypeaheadMenuPlugin/index.js';
11
12
  import { useMenuTriggerMatch } from './useMenuTriggerMatch.js';
12
13
  const baseClass = 'slash-menu-popup';
@@ -171,6 +172,7 @@ export function SlashMenuPlugin({
171
172
  setSelectedItemKey
172
173
  }) => anchorElementRef.current && groups.length ? /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/_jsx("div", {
173
174
  className: baseClass,
175
+ "data-theme": "dark",
174
176
  children: groups.map(group_4 => {
175
177
  let groupTitle = group_4.key;
176
178
  if (group_4.label && featureClientSchemaMap) {