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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/dist/cell/rscEntry.js +13 -5
  2. package/dist/cell/rscEntry.js.map +1 -1
  3. package/dist/features/blocks/client/component/BlockContent.js +29 -9
  4. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  5. package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -3
  6. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  7. package/dist/features/blocks/client/component/components/BlockEditButton.js +6 -2
  8. package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -1
  9. package/dist/features/blocks/client/component/components/BlockRemoveButton.js +6 -2
  10. package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -1
  11. package/dist/features/blocks/client/component/index.js +124 -43
  12. package/dist/features/blocks/client/component/index.js.map +1 -1
  13. package/dist/features/blocks/client/component/index.scss +188 -0
  14. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +7 -3
  15. package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -1
  16. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +6 -2
  17. package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -1
  18. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +6 -2
  19. package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -1
  20. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +6 -2
  21. package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -1
  22. package/dist/features/blocks/client/componentInline/index.js +118 -37
  23. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  24. package/dist/features/blocks/client/componentInline/index.scss +90 -0
  25. package/dist/features/blocks/client/getBlockImageComponent.js +7 -3
  26. package/dist/features/blocks/client/getBlockImageComponent.js.map +1 -1
  27. package/dist/features/blocks/client/markdown/markdownTransformer.js +1 -0
  28. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -1
  29. package/dist/features/blocks/client/nodes/BlocksNode.js +7 -3
  30. package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
  31. package/dist/features/blocks/client/nodes/InlineBlocksNode.js +7 -3
  32. package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
  33. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +88 -27
  34. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -1
  35. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +7 -3
  36. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -1
  37. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +13 -4
  38. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -1
  39. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.scss +6 -0
  40. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +19 -6
  41. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -1
  42. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.scss +29 -0
  43. package/dist/features/blocks/premade/CodeBlock/Component/index.scss +97 -0
  44. package/dist/features/blocks/server/markdown/markdownTransformer.js +1 -0
  45. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -1
  46. package/dist/features/converters/lexicalToJSX/Component/index.js +9 -5
  47. package/dist/features/converters/lexicalToJSX/Component/index.js.map +1 -1
  48. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js +7 -3
  49. package/dist/features/converters/lexicalToJSX/converter/converters/blockquote.js.map +1 -1
  50. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js +7 -3
  51. package/dist/features/converters/lexicalToJSX/converter/converters/heading.js.map +1 -1
  52. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js +6 -2
  53. package/dist/features/converters/lexicalToJSX/converter/converters/horizontalRule.js.map +1 -1
  54. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js +6 -2
  55. package/dist/features/converters/lexicalToJSX/converter/converters/linebreak.js.map +1 -1
  56. package/dist/features/converters/lexicalToJSX/converter/converters/link.js +13 -5
  57. package/dist/features/converters/lexicalToJSX/converter/converters/link.js.map +1 -1
  58. package/dist/features/converters/lexicalToJSX/converter/converters/list.js +38 -14
  59. package/dist/features/converters/lexicalToJSX/converter/converters/list.js.map +1 -1
  60. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js +18 -6
  61. package/dist/features/converters/lexicalToJSX/converter/converters/paragraph.js.map +1 -1
  62. package/dist/features/converters/lexicalToJSX/converter/converters/table.js +31 -11
  63. package/dist/features/converters/lexicalToJSX/converter/converters/table.js.map +1 -1
  64. package/dist/features/converters/lexicalToJSX/converter/converters/text.js +43 -15
  65. package/dist/features/converters/lexicalToJSX/converter/converters/text.js.map +1 -1
  66. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +31 -11
  67. package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
  68. package/dist/features/converters/lexicalToJSX/converter/index.js +8 -4
  69. package/dist/features/converters/lexicalToJSX/converter/index.js.map +1 -1
  70. package/dist/features/debug/jsxConverter/client/plugin/index.js +14 -5
  71. package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -1
  72. package/dist/features/debug/jsxConverter/client/plugin/style.scss +12 -0
  73. package/dist/features/debug/testRecorder/client/plugin/index.js +62 -21
  74. package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
  75. package/dist/features/debug/testRecorder/client/plugin/index.scss +53 -0
  76. package/dist/features/debug/treeView/client/plugin/index.js +8 -3
  77. package/dist/features/debug/treeView/client/plugin/index.js.map +1 -1
  78. package/dist/features/debug/treeView/client/plugin/index.scss +80 -0
  79. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +225 -72
  80. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  81. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.scss +87 -0
  82. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +32 -11
  83. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  84. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.scss +11 -0
  85. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +21 -9
  86. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  87. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +26 -9
  88. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  89. package/dist/features/experimental_table/client/plugins/TablePlugin/index.scss +233 -0
  90. package/dist/features/horizontalRule/client/plugin/index.js +1 -0
  91. package/dist/features/horizontalRule/client/plugin/index.js.map +1 -1
  92. package/dist/features/horizontalRule/client/plugin/index.scss +23 -0
  93. package/dist/features/indent/client/IndentPlugin.js +6 -2
  94. package/dist/features/indent/client/IndentPlugin.js.map +1 -1
  95. package/dist/features/link/client/plugins/autoLink/index.js +3 -0
  96. package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
  97. package/dist/features/link/client/plugins/clickableLink/index.js +6 -2
  98. package/dist/features/link/client/plugins/clickableLink/index.js.map +1 -1
  99. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +76 -24
  100. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  101. package/dist/features/link/client/plugins/floatingLinkEditor/index.js +8 -3
  102. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  103. package/dist/features/link/client/plugins/floatingLinkEditor/index.scss +92 -0
  104. package/dist/features/link/server/baseFields.js +1 -0
  105. package/dist/features/link/server/baseFields.js.map +1 -1
  106. package/dist/features/lists/checklist/client/plugin/index.js +6 -2
  107. package/dist/features/lists/checklist/client/plugin/index.js.map +1 -1
  108. package/dist/features/lists/plugin/index.js +6 -2
  109. package/dist/features/lists/plugin/index.js.map +1 -1
  110. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +14 -5
  111. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  112. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +7 -3
  113. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  114. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  115. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +14 -5
  116. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +1 -1
  117. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +7 -3
  118. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
  119. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.scss +16 -0
  120. package/dist/features/relationship/client/components/RelationshipComponent.js +56 -19
  121. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  122. package/dist/features/relationship/client/components/index.scss +95 -0
  123. package/dist/features/relationship/client/drawer/index.js +18 -6
  124. package/dist/features/relationship/client/drawer/index.js.map +1 -1
  125. package/dist/features/relationship/client/nodes/RelationshipNode.js +7 -3
  126. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  127. package/dist/features/relationship/client/plugins/index.js +7 -3
  128. package/dist/features/relationship/client/plugins/index.js.map +1 -1
  129. package/dist/features/textState/feature.client.js +18 -6
  130. package/dist/features/textState/feature.client.js.map +1 -1
  131. package/dist/features/toolbars/fixed/client/Toolbar/index.js +72 -23
  132. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  133. package/dist/features/toolbars/fixed/client/Toolbar/index.scss +113 -0
  134. package/dist/features/toolbars/inline/client/Toolbar/index.js +72 -23
  135. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  136. package/dist/features/toolbars/inline/client/Toolbar/index.scss +58 -0
  137. package/dist/features/toolbars/shared/ToolbarButton/index.js +8 -3
  138. package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
  139. package/dist/features/toolbars/shared/ToolbarButton/index.scss +46 -0
  140. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +60 -20
  141. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  142. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +37 -12
  143. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  144. package/dist/features/toolbars/shared/ToolbarDropdown/index.scss +129 -0
  145. package/dist/features/upload/client/component/index.js +92 -31
  146. package/dist/features/upload/client/component/index.js.map +1 -1
  147. package/dist/features/upload/client/component/index.scss +191 -0
  148. package/dist/features/upload/client/component/pending/index.js +14 -5
  149. package/dist/features/upload/client/component/pending/index.js.map +1 -1
  150. package/dist/features/upload/client/drawer/index.js +18 -6
  151. package/dist/features/upload/client/drawer/index.js.map +1 -1
  152. package/dist/features/upload/client/nodes/UploadNode.js +12 -4
  153. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  154. package/dist/features/upload/client/plugin/index.js +7 -3
  155. package/dist/features/upload/client/plugin/index.js.map +1 -1
  156. package/dist/field/Diff/converters/listitem/index.js +37 -12
  157. package/dist/field/Diff/converters/listitem/index.js.map +1 -1
  158. package/dist/field/Diff/converters/listitem/index.scss +47 -0
  159. package/dist/field/Diff/converters/relationship/index.js +37 -12
  160. package/dist/field/Diff/converters/relationship/index.js.map +1 -1
  161. package/dist/field/Diff/converters/relationship/index.scss +73 -0
  162. package/dist/field/Diff/converters/unknown/index.js +31 -10
  163. package/dist/field/Diff/converters/unknown/index.js.map +1 -1
  164. package/dist/field/Diff/converters/unknown/index.scss +40 -0
  165. package/dist/field/Diff/converters/upload/index.js +60 -19
  166. package/dist/field/Diff/converters/upload/index.js.map +1 -1
  167. package/dist/field/Diff/converters/upload/index.scss +115 -0
  168. package/dist/field/Diff/index.js +8 -3
  169. package/dist/field/Diff/index.js.map +1 -1
  170. package/dist/field/Diff/index.scss +102 -0
  171. package/dist/field/Field.js +81 -27
  172. package/dist/field/Field.js.map +1 -1
  173. package/dist/field/RenderLexical/index.js +36 -12
  174. package/dist/field/RenderLexical/index.js.map +1 -1
  175. package/dist/field/index.js +19 -7
  176. package/dist/field/index.js.map +1 -1
  177. package/dist/field/index.scss +41 -0
  178. package/dist/field/rscEntry.js +7 -3
  179. package/dist/field/rscEntry.js.map +1 -1
  180. package/dist/index.js +2 -0
  181. package/dist/index.js.map +1 -1
  182. package/dist/lexical/EditorPlugin.js +13 -5
  183. package/dist/lexical/EditorPlugin.js.map +1 -1
  184. package/dist/lexical/LexicalEditor.js +163 -50
  185. package/dist/lexical/LexicalEditor.js.map +1 -1
  186. package/dist/lexical/LexicalEditor.scss +54 -0
  187. package/dist/lexical/LexicalProvider.js +49 -17
  188. package/dist/lexical/LexicalProvider.js.map +1 -1
  189. package/dist/lexical/config/client/EditorConfigProvider.js +7 -3
  190. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  191. package/dist/lexical/plugins/DecoratorPlugin/index.js +1 -0
  192. package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
  193. package/dist/lexical/plugins/DecoratorPlugin/index.scss +13 -0
  194. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +20 -7
  195. package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
  196. package/dist/lexical/plugins/InsertParagraphAtEnd/index.scss +54 -0
  197. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -0
  198. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  199. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +7 -3
  200. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  201. package/dist/lexical/plugins/SlashMenu/index.js +50 -16
  202. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  203. package/dist/lexical/plugins/SlashMenu/index.scss +68 -0
  204. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +20 -7
  205. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
  206. package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.scss +35 -0
  207. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +32 -11
  208. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  209. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.scss +80 -0
  210. package/dist/lexical/theme/EditorTheme.scss +357 -0
  211. package/dist/lexical/ui/ContentEditable.js +14 -5
  212. package/dist/lexical/ui/ContentEditable.js.map +1 -1
  213. package/dist/lexical/ui/ContentEditable.scss +105 -0
  214. package/dist/lexical/ui/icons/AI/index.js +37 -13
  215. package/dist/lexical/ui/icons/AI/index.js.map +1 -1
  216. package/dist/lexical/ui/icons/Add/index.js +19 -7
  217. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  218. package/dist/lexical/ui/icons/AlignCenter/index.js +25 -9
  219. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  220. package/dist/lexical/ui/icons/AlignJustify/index.js +25 -9
  221. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  222. package/dist/lexical/ui/icons/AlignLeft/index.js +25 -9
  223. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  224. package/dist/lexical/ui/icons/AlignRight/index.js +25 -9
  225. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  226. package/dist/lexical/ui/icons/Block/index.js +25 -9
  227. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  228. package/dist/lexical/ui/icons/Blockquote/index.js +13 -5
  229. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  230. package/dist/lexical/ui/icons/Bold/index.js +13 -5
  231. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  232. package/dist/lexical/ui/icons/Checklist/index.js +19 -7
  233. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  234. package/dist/lexical/ui/icons/Code/index.js +19 -7
  235. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  236. package/dist/lexical/ui/icons/CodeBlock/index.js +13 -5
  237. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  238. package/dist/lexical/ui/icons/Collapse/index.js +13 -5
  239. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  240. package/dist/lexical/ui/icons/H1/index.js +13 -5
  241. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  242. package/dist/lexical/ui/icons/H2/index.js +13 -5
  243. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  244. package/dist/lexical/ui/icons/H3/index.js +13 -5
  245. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  246. package/dist/lexical/ui/icons/H4/index.js +13 -5
  247. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  248. package/dist/lexical/ui/icons/H5/index.js +13 -5
  249. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  250. package/dist/lexical/ui/icons/H6/index.js +13 -5
  251. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  252. package/dist/lexical/ui/icons/HorizontalRule/index.js +13 -5
  253. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  254. package/dist/lexical/ui/icons/IndentDecrease/index.js +31 -11
  255. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  256. package/dist/lexical/ui/icons/IndentIncrease/index.js +31 -11
  257. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  258. package/dist/lexical/ui/icons/InlineBlocks/index.js +13 -5
  259. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  260. package/dist/lexical/ui/icons/Italic/index.js +13 -5
  261. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  262. package/dist/lexical/ui/icons/Link/index.js +13 -5
  263. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  264. package/dist/lexical/ui/icons/Meatballs/index.js +25 -9
  265. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  266. package/dist/lexical/ui/icons/OrderedList/index.js +37 -13
  267. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  268. package/dist/lexical/ui/icons/Relationship/index.js +37 -13
  269. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  270. package/dist/lexical/ui/icons/Strikethrough/index.js +19 -7
  271. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  272. package/dist/lexical/ui/icons/Subscript/index.js +13 -5
  273. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  274. package/dist/lexical/ui/icons/Superscript/index.js +13 -5
  275. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  276. package/dist/lexical/ui/icons/Table/index.js +13 -5
  277. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  278. package/dist/lexical/ui/icons/Text/index.js +13 -5
  279. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  280. package/dist/lexical/ui/icons/TextState/index.js +7 -3
  281. package/dist/lexical/ui/icons/TextState/index.js.map +1 -1
  282. package/dist/lexical/ui/icons/Underline/index.js +19 -7
  283. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  284. package/dist/lexical/ui/icons/UnorderedList/index.js +43 -15
  285. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  286. package/dist/lexical/ui/icons/Upload/index.js +25 -9
  287. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  288. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js +2 -0
  289. package/dist/packages/@lexical/markdown/MarkdownShortcuts.js.map +1 -1
  290. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js +2 -0
  291. package/dist/packages/@lexical/markdown/importTextFormatTransformer.js.map +1 -1
  292. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js +2 -0
  293. package/dist/packages/@lexical/markdown/importTextMatchTransformer.js.map +1 -1
  294. package/dist/utilities/fieldsDrawer/Drawer.js +19 -7
  295. package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
  296. package/dist/utilities/fieldsDrawer/DrawerContent.js +19 -7
  297. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  298. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js +7 -3
  299. package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.js.map +1 -1
  300. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js +7 -3
  301. package/dist/utilities/fieldsDrawer/useLexicalListDrawer.js.map +1 -1
  302. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +2 -0
  303. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
  304. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +2 -0
  305. package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
  306. package/package.json +8 -7
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableRowNode } from '@lexical/table'\nimport type { EditorConfig, NodeKey } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $getTableAndElementByKey,\n $getTableColumnIndexFromTableCellNode,\n $getTableRowIndexFromTableCellNode,\n $insertTableColumnAtSelection,\n $insertTableRowAtSelection,\n $isTableCellNode,\n $isTableNode,\n getTableElement,\n TableNode,\n} from '@lexical/table'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useDebounce } from '../../utils/useDebounce.js'\n\nconst BUTTON_WIDTH_PX = 20\n\nfunction TableHoverActionsContainer({\n anchorElem,\n}: {\n anchorElem: HTMLElement\n}): JSX.Element | null {\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const editorConfig = useEditorConfigContext()\n const [isShownRow, setShownRow] = useState<boolean>(false)\n const [isShownColumn, setShownColumn] = useState<boolean>(false)\n const [shouldListenMouseMove, setShouldListenMouseMove] = useState<boolean>(false)\n const [position, setPosition] = useState({})\n const tableSetRef = useRef<Set<NodeKey>>(new Set())\n const tableCellDOMNodeRef = useRef<HTMLElement | null>(null)\n\n const debouncedOnMouseMove = useDebounce(\n (event: MouseEvent) => {\n const { isOutside, tableDOMNode } = getMouseInfo(event, editorConfig.editorConfig?.lexical)\n\n if (isOutside) {\n setShownRow(false)\n setShownColumn(false)\n return\n }\n\n if (!tableDOMNode) {\n return\n }\n\n tableCellDOMNodeRef.current = tableDOMNode\n\n let hoveredRowNode: null | TableCellNode = null\n let hoveredColumnNode: null | TableCellNode = null\n let tableDOMElement: HTMLElement | null = null\n\n editor.getEditorState().read(\n () => {\n const maybeTableCell = $getNearestNodeFromDOMNode(tableDOMNode)\n\n if ($isTableCellNode(maybeTableCell)) {\n const table = $findMatchingParent(maybeTableCell, (node) => $isTableNode(node))\n if (!$isTableNode(table)) {\n return\n }\n\n tableDOMElement = getTableElement(table, editor.getElementByKey(table.getKey()))\n\n if (tableDOMElement) {\n const rowCount = table.getChildrenSize()\n const colCount = (table.getChildAtIndex(0) as TableRowNode)?.getChildrenSize()\n\n const rowIndex = $getTableRowIndexFromTableCellNode(maybeTableCell)\n const colIndex = $getTableColumnIndexFromTableCellNode(maybeTableCell)\n\n if (rowIndex === rowCount - 1) {\n hoveredRowNode = maybeTableCell\n } else if (colIndex === colCount - 1) {\n hoveredColumnNode = maybeTableCell\n }\n }\n }\n },\n { editor },\n )\n\n if (!tableDOMElement) {\n return\n }\n\n // this is the scrollable div container of the table (in case of overflow)\n const tableContainerElement = (tableDOMElement as HTMLTableElement).parentElement\n\n if (!tableContainerElement) {\n return\n }\n\n const {\n bottom: tableElemBottom,\n height: tableElemHeight,\n left: tableElemLeft,\n right: tableElemRight,\n width: tableElemWidth,\n y: tableElemY,\n } = (tableDOMElement as HTMLTableElement).getBoundingClientRect()\n\n let tableHasScroll = false\n if (\n tableContainerElement &&\n tableContainerElement.classList.contains('LexicalEditorTheme__tableScrollableWrapper')\n ) {\n tableHasScroll = tableContainerElement.scrollWidth > tableContainerElement.clientWidth\n }\n\n const { left: editorElemLeft, y: editorElemY } = anchorElem.getBoundingClientRect()\n\n if (hoveredRowNode) {\n setShownColumn(false)\n setShownRow(true)\n setPosition({\n height: BUTTON_WIDTH_PX,\n left:\n tableHasScroll && tableContainerElement\n ? tableContainerElement.offsetLeft\n : tableElemLeft - editorElemLeft,\n top: tableElemBottom - editorElemY + 5,\n width:\n tableHasScroll && tableContainerElement\n ? tableContainerElement.offsetWidth\n : tableElemWidth,\n })\n } else if (hoveredColumnNode) {\n setShownColumn(true)\n setShownRow(false)\n setPosition({\n height: tableElemHeight,\n left: tableElemRight - editorElemLeft + 5,\n top: tableElemY - editorElemY,\n width: BUTTON_WIDTH_PX,\n })\n }\n },\n 50,\n 250,\n )\n\n // Hide the buttons on any table dimensions change to prevent last row cells\n // overlap behind the 'Add Row' button when text entry changes cell height\n const tableResizeObserver = useMemo(() => {\n return new ResizeObserver(() => {\n setShownRow(false)\n setShownColumn(false)\n })\n }, [])\n\n useEffect(() => {\n if (!shouldListenMouseMove) {\n return\n }\n\n document.addEventListener('mousemove', debouncedOnMouseMove)\n\n return () => {\n setShownRow(false)\n setShownColumn(false)\n\n document.removeEventListener('mousemove', debouncedOnMouseMove)\n }\n }, [shouldListenMouseMove, debouncedOnMouseMove])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerMutationListener(\n TableNode,\n (mutations) => {\n editor.getEditorState().read(\n () => {\n let resetObserver = false\n for (const [key, type] of mutations) {\n switch (type) {\n case 'created': {\n tableSetRef.current.add(key)\n resetObserver = true\n break\n }\n case 'destroyed': {\n tableSetRef.current.delete(key)\n resetObserver = true\n break\n }\n default:\n break\n }\n }\n if (resetObserver) {\n // Reset resize observers\n tableResizeObserver.disconnect()\n for (const tableKey of tableSetRef.current) {\n const { tableElement } = $getTableAndElementByKey(tableKey)\n tableResizeObserver.observe(tableElement)\n }\n setShouldListenMouseMove(tableSetRef.current.size > 0)\n }\n },\n { editor },\n )\n },\n { skipInitialization: false },\n ),\n )\n }, [editor, tableResizeObserver])\n\n const insertAction = (insertRow: boolean) => {\n editor.update(() => {\n if (tableCellDOMNodeRef.current) {\n const maybeTableNode = $getNearestNodeFromDOMNode(tableCellDOMNodeRef.current)\n maybeTableNode?.selectEnd()\n if (insertRow) {\n $insertTableRowAtSelection()\n setShownRow(false)\n } else {\n $insertTableColumnAtSelection()\n setShownColumn(false)\n }\n }\n })\n }\n\n if (!isEditable) {\n return null\n }\n\n return (\n <>\n {isShownRow && (\n <button\n aria-label=\"Add Row\"\n className={editorConfig.editorConfig.lexical.theme.tableAddRows}\n onClick={() => insertAction(true)}\n style={{ ...position }}\n type=\"button\"\n />\n )}\n {isShownColumn && (\n <button\n aria-label=\"Add Column\"\n className={editorConfig.editorConfig.lexical.theme.tableAddColumns}\n onClick={() => insertAction(false)}\n style={{ ...position }}\n type=\"button\"\n />\n )}\n </>\n )\n}\n\nfunction getMouseInfo(\n event: MouseEvent,\n editorConfig: EditorConfig,\n): {\n isOutside: boolean\n tableDOMNode: HTMLElement | null\n} {\n const target = event.target\n\n if (isHTMLElement(target)) {\n const tableDOMNode = target.closest<HTMLElement>(\n `td.${editorConfig.theme.tableCell}, th.${editorConfig.theme.tableCell}`,\n )\n\n const isOutside = !(\n tableDOMNode ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddRows}`) ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddColumns}`) ||\n target.closest<HTMLElement>(`div.${editorConfig.theme.tableCellResizer}`)\n )\n\n return { isOutside, tableDOMNode }\n } else {\n return { isOutside: true, tableDOMNode: null }\n }\n}\n\nexport function TableHoverActionsPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): null | React.ReactPortal {\n const isEditable = useLexicalEditable()\n\n if (!isEditable) {\n return null\n }\n\n return createPortal(<TableHoverActionsContainer anchorElem={anchorElem} />, anchorElem)\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$getTableAndElementByKey","$getTableColumnIndexFromTableCellNode","$getTableRowIndexFromTableCellNode","$insertTableColumnAtSelection","$insertTableRowAtSelection","$isTableCellNode","$isTableNode","getTableElement","TableNode","$findMatchingParent","mergeRegister","$getNearestNodeFromDOMNode","isHTMLElement","useEffect","useMemo","useRef","useState","React","createPortal","useEditorConfigContext","useDebounce","BUTTON_WIDTH_PX","TableHoverActionsContainer","anchorElem","editor","isEditable","editorConfig","isShownRow","setShownRow","isShownColumn","setShownColumn","shouldListenMouseMove","setShouldListenMouseMove","position","setPosition","tableSetRef","Set","tableCellDOMNodeRef","debouncedOnMouseMove","event","isOutside","tableDOMNode","getMouseInfo","lexical","current","hoveredRowNode","hoveredColumnNode","tableDOMElement","getEditorState","read","maybeTableCell","table","node","getElementByKey","getKey","rowCount","getChildrenSize","colCount","getChildAtIndex","rowIndex","colIndex","tableContainerElement","parentElement","bottom","tableElemBottom","height","tableElemHeight","left","tableElemLeft","right","tableElemRight","width","tableElemWidth","y","tableElemY","getBoundingClientRect","tableHasScroll","classList","contains","scrollWidth","clientWidth","editorElemLeft","editorElemY","offsetLeft","top","offsetWidth","tableResizeObserver","ResizeObserver","document","addEventListener","removeEventListener","registerMutationListener","mutations","resetObserver","key","type","add","delete","disconnect","tableKey","tableElement","observe","size","skipInitialization","insertAction","insertRow","update","maybeTableNode","selectEnd","button","aria-label","className","theme","tableAddRows","onClick","style","tableAddColumns","target","closest","tableCell","tableCellResizer","TableHoverActionsPlugin","body"],"mappings":"AAAA;;AAMA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,wBAAwB,EACxBC,qCAAqC,EACrCC,kCAAkC,EAClCC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,SAAS,QACJ,iBAAgB;AACvB,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SAASC,0BAA0B,EAAEC,aAAa,QAAQ,UAAS;AACnE,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAC5D,YAAYC,WAAW,QAAO;AAC9B,SAASC,YAAY,QAAQ,YAAW;AAExC,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,WAAW,QAAQ,6BAA4B;AAExD,MAAMC,kBAAkB;AAExB,SAASC,2BAA2B,EAClCC,UAAU,EAGX;IACC,MAAM,CAACC,OAAO,GAAG1B;IACjB,MAAM2B,aAAa1B;IAEnB,MAAM2B,eAAeP;IACrB,MAAM,CAACQ,YAAYC,YAAY,GAAGZ,SAAkB;IACpD,MAAM,CAACa,eAAeC,eAAe,GAAGd,SAAkB;IAC1D,MAAM,CAACe,uBAAuBC,yBAAyB,GAAGhB,SAAkB;IAC5E,MAAM,CAACiB,UAAUC,YAAY,GAAGlB,SAAS,CAAC;IAC1C,MAAMmB,cAAcpB,OAAqB,IAAIqB;IAC7C,MAAMC,sBAAsBtB,OAA2B;IAEvD,MAAMuB,uBAAuBlB,YAC3B,CAACmB;QACC,MAAM,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGC,aAAaH,OAAOb,aAAaA,YAAY,EAAEiB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zG,cAAcyG,SAAS;QACzB,MAAM5E,eAAe4E,OAAOC,OAAO,CACjC,CAAC,GAAG,EAAE5F,aAAasF,KAAK,CAACO,SAAS,CAAC,KAAK,EAAE7F,aAAasF,KAAK,CAACO,SAAS,EAAE;QAG1E,MAAM/E,YAAY,CAChBC,CAAAA,gBACA4E,OAAOC,OAAO,CAAc,CAAC,OAAO,EAAE5F,aAAasF,KAAK,CAACC,YAAY,EAAE,KACvEI,OAAOC,OAAO,CAAc,CAAC,OAAO,EAAE5F,aAAasF,KAAK,CAACI,eAAe,EAAE,KAC1EC,OAAOC,OAAO,CAAc,CAAC,IAAI,EAAE5F,aAAasF,KAAK,CAACQ,gBAAgB,EAAE,CAAA;QAG1E,OAAO;YAAEhF;YAAWC;QAAa;IACnC,OAAO;QACL,OAAO;YAAED,WAAW;YAAMC,cAAc;QAAK;IAC/C;AACF;AAEA,OAAO,SAASgF,wBAAwB,EACtClG,aAAaiE,SAASkC,IAAI,EAG3B;IACC,MAAMjG,aAAa1B;IAEnB,IAAI,CAAC0B,YAAY;QACf,OAAO;IACT;IAEA,qBAAOP,2BAAa,KAACI;QAA2BC,YAAYA;QAAgBA;AAC9E"}
1
+ {"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type { TableCellNode, TableRowNode } from '@lexical/table'\nimport type { EditorConfig, NodeKey } from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n $getTableAndElementByKey,\n $getTableColumnIndexFromTableCellNode,\n $getTableRowIndexFromTableCellNode,\n $insertTableColumnAtSelection,\n $insertTableRowAtSelection,\n $isTableCellNode,\n $isTableNode,\n getTableElement,\n TableNode,\n} from '@lexical/table'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport { $getNearestNodeFromDOMNode, isHTMLElement } from 'lexical'\nimport { useEffect, useMemo, useRef, useState } from 'react'\nimport * as React from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useDebounce } from '../../utils/useDebounce.js'\n\nconst BUTTON_WIDTH_PX = 20\n\nfunction TableHoverActionsContainer({\n anchorElem,\n}: {\n anchorElem: HTMLElement\n}): JSX.Element | null {\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n\n const editorConfig = useEditorConfigContext()\n const [isShownRow, setShownRow] = useState<boolean>(false)\n const [isShownColumn, setShownColumn] = useState<boolean>(false)\n const [shouldListenMouseMove, setShouldListenMouseMove] = useState<boolean>(false)\n const [position, setPosition] = useState({})\n const tableSetRef = useRef<Set<NodeKey>>(new Set())\n const tableCellDOMNodeRef = useRef<HTMLElement | null>(null)\n\n const debouncedOnMouseMove = useDebounce(\n (event: MouseEvent) => {\n const { isOutside, tableDOMNode } = getMouseInfo(event, editorConfig.editorConfig?.lexical)\n\n if (isOutside) {\n setShownRow(false)\n setShownColumn(false)\n return\n }\n\n if (!tableDOMNode) {\n return\n }\n\n tableCellDOMNodeRef.current = tableDOMNode\n\n let hoveredRowNode: null | TableCellNode = null\n let hoveredColumnNode: null | TableCellNode = null\n let tableDOMElement: HTMLElement | null = null\n\n editor.getEditorState().read(\n () => {\n const maybeTableCell = $getNearestNodeFromDOMNode(tableDOMNode)\n\n if ($isTableCellNode(maybeTableCell)) {\n const table = $findMatchingParent(maybeTableCell, (node) => $isTableNode(node))\n if (!$isTableNode(table)) {\n return\n }\n\n tableDOMElement = getTableElement(table, editor.getElementByKey(table.getKey()))\n\n if (tableDOMElement) {\n const rowCount = table.getChildrenSize()\n const colCount = (table.getChildAtIndex(0) as TableRowNode)?.getChildrenSize()\n\n const rowIndex = $getTableRowIndexFromTableCellNode(maybeTableCell)\n const colIndex = $getTableColumnIndexFromTableCellNode(maybeTableCell)\n\n if (rowIndex === rowCount - 1) {\n hoveredRowNode = maybeTableCell\n } else if (colIndex === colCount - 1) {\n hoveredColumnNode = maybeTableCell\n }\n }\n }\n },\n { editor },\n )\n\n if (!tableDOMElement) {\n return\n }\n\n // this is the scrollable div container of the table (in case of overflow)\n const tableContainerElement = (tableDOMElement as HTMLTableElement).parentElement\n\n if (!tableContainerElement) {\n return\n }\n\n const {\n bottom: tableElemBottom,\n height: tableElemHeight,\n left: tableElemLeft,\n right: tableElemRight,\n width: tableElemWidth,\n y: tableElemY,\n } = (tableDOMElement as HTMLTableElement).getBoundingClientRect()\n\n let tableHasScroll = false\n if (\n tableContainerElement &&\n tableContainerElement.classList.contains('LexicalEditorTheme__tableScrollableWrapper')\n ) {\n tableHasScroll = tableContainerElement.scrollWidth > tableContainerElement.clientWidth\n }\n\n const { left: editorElemLeft, y: editorElemY } = anchorElem.getBoundingClientRect()\n\n if (hoveredRowNode) {\n setShownColumn(false)\n setShownRow(true)\n setPosition({\n height: BUTTON_WIDTH_PX,\n left:\n tableHasScroll && tableContainerElement\n ? tableContainerElement.offsetLeft\n : tableElemLeft - editorElemLeft,\n top: tableElemBottom - editorElemY + 5,\n width:\n tableHasScroll && tableContainerElement\n ? tableContainerElement.offsetWidth\n : tableElemWidth,\n })\n } else if (hoveredColumnNode) {\n setShownColumn(true)\n setShownRow(false)\n setPosition({\n height: tableElemHeight,\n left: tableElemRight - editorElemLeft + 5,\n top: tableElemY - editorElemY,\n width: BUTTON_WIDTH_PX,\n })\n }\n },\n 50,\n 250,\n )\n\n // Hide the buttons on any table dimensions change to prevent last row cells\n // overlap behind the 'Add Row' button when text entry changes cell height\n const tableResizeObserver = useMemo(() => {\n return new ResizeObserver(() => {\n setShownRow(false)\n setShownColumn(false)\n })\n }, [])\n\n useEffect(() => {\n if (!shouldListenMouseMove) {\n return\n }\n\n document.addEventListener('mousemove', debouncedOnMouseMove)\n\n return () => {\n setShownRow(false)\n setShownColumn(false)\n\n document.removeEventListener('mousemove', debouncedOnMouseMove)\n }\n }, [shouldListenMouseMove, debouncedOnMouseMove])\n\n useEffect(() => {\n return mergeRegister(\n editor.registerMutationListener(\n TableNode,\n (mutations) => {\n editor.getEditorState().read(\n () => {\n let resetObserver = false\n for (const [key, type] of mutations) {\n switch (type) {\n case 'created': {\n tableSetRef.current.add(key)\n resetObserver = true\n break\n }\n case 'destroyed': {\n tableSetRef.current.delete(key)\n resetObserver = true\n break\n }\n default:\n break\n }\n }\n if (resetObserver) {\n // Reset resize observers\n tableResizeObserver.disconnect()\n for (const tableKey of tableSetRef.current) {\n const { tableElement } = $getTableAndElementByKey(tableKey)\n tableResizeObserver.observe(tableElement)\n }\n setShouldListenMouseMove(tableSetRef.current.size > 0)\n }\n },\n { editor },\n )\n },\n { skipInitialization: false },\n ),\n )\n }, [editor, tableResizeObserver])\n\n const insertAction = (insertRow: boolean) => {\n editor.update(() => {\n if (tableCellDOMNodeRef.current) {\n const maybeTableNode = $getNearestNodeFromDOMNode(tableCellDOMNodeRef.current)\n maybeTableNode?.selectEnd()\n if (insertRow) {\n $insertTableRowAtSelection()\n setShownRow(false)\n } else {\n $insertTableColumnAtSelection()\n setShownColumn(false)\n }\n }\n })\n }\n\n if (!isEditable) {\n return null\n }\n\n return (\n <>\n {isShownRow && (\n <button\n aria-label=\"Add Row\"\n className={editorConfig.editorConfig.lexical.theme.tableAddRows}\n onClick={() => insertAction(true)}\n style={{ ...position }}\n type=\"button\"\n />\n )}\n {isShownColumn && (\n <button\n aria-label=\"Add Column\"\n className={editorConfig.editorConfig.lexical.theme.tableAddColumns}\n onClick={() => insertAction(false)}\n style={{ ...position }}\n type=\"button\"\n />\n )}\n </>\n )\n}\n\nfunction getMouseInfo(\n event: MouseEvent,\n editorConfig: EditorConfig,\n): {\n isOutside: boolean\n tableDOMNode: HTMLElement | null\n} {\n const target = event.target\n\n if (isHTMLElement(target)) {\n const tableDOMNode = target.closest<HTMLElement>(\n `td.${editorConfig.theme.tableCell}, th.${editorConfig.theme.tableCell}`,\n )\n\n const isOutside = !(\n tableDOMNode ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddRows}`) ||\n target.closest<HTMLElement>(`button.${editorConfig.theme.tableAddColumns}`) ||\n target.closest<HTMLElement>(`div.${editorConfig.theme.tableCellResizer}`)\n )\n\n return { isOutside, tableDOMNode }\n } else {\n return { isOutside: true, tableDOMNode: null }\n }\n}\n\nexport function TableHoverActionsPlugin({\n anchorElem = document.body,\n}: {\n anchorElem?: HTMLElement\n}): null | React.ReactPortal {\n const isEditable = useLexicalEditable()\n\n if (!isEditable) {\n return null\n }\n\n return createPortal(<TableHoverActionsContainer anchorElem={anchorElem} />, anchorElem)\n}\n"],"names":["useLexicalComposerContext","useLexicalEditable","$getTableAndElementByKey","$getTableColumnIndexFromTableCellNode","$getTableRowIndexFromTableCellNode","$insertTableColumnAtSelection","$insertTableRowAtSelection","$isTableCellNode","$isTableNode","getTableElement","TableNode","$findMatchingParent","mergeRegister","$getNearestNodeFromDOMNode","isHTMLElement","useEffect","useMemo","useRef","useState","React","createPortal","useEditorConfigContext","useDebounce","BUTTON_WIDTH_PX","TableHoverActionsContainer","anchorElem","editor","isEditable","editorConfig","isShownRow","setShownRow","isShownColumn","setShownColumn","shouldListenMouseMove","setShouldListenMouseMove","position","setPosition","tableSetRef","Set","tableCellDOMNodeRef","debouncedOnMouseMove","event","isOutside","tableDOMNode","getMouseInfo","lexical","current","hoveredRowNode","hoveredColumnNode","tableDOMElement","getEditorState","read","maybeTableCell","table","node","getElementByKey","getKey","rowCount","getChildrenSize","colCount","getChildAtIndex","rowIndex","colIndex","tableContainerElement","parentElement","bottom","tableElemBottom","height","tableElemHeight","left","tableElemLeft","right","tableElemRight","width","tableElemWidth","y","tableElemY","getBoundingClientRect","tableHasScroll","classList","contains","scrollWidth","clientWidth","editorElemLeft","editorElemY","offsetLeft","top","offsetWidth","tableResizeObserver","ResizeObserver","document","addEventListener","removeEventListener","registerMutationListener","mutations","resetObserver","key","type","add","delete","disconnect","tableKey","tableElement","observe","size","skipInitialization","insertAction","insertRow","update","maybeTableNode","selectEnd","button","aria-label","className","theme","tableAddRows","onClick","style","tableAddColumns","target","closest","tableCell","tableCellResizer","TableHoverActionsPlugin","body"],"mappings":"AAAA;;AAMA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,kBAAkB,QAAQ,oCAAmC;AACtE,SACEC,wBAAwB,EACxBC,qCAAqC,EACrCC,kCAAkC,EAClCC,6BAA6B,EAC7BC,0BAA0B,EAC1BC,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,SAAS,QACJ,iBAAgB;AACvB,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SAASC,0BAA0B,EAAEC,aAAa,QAAQ,UAAS;AACnE,SAASC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAO;AAC5D,YAAYC,WAAW,QAAO;AAC9B,SAASC,YAAY,QAAQ,YAAW;AAExC,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,WAAW,QAAQ,6BAA4B;AAExD,MAAMC,kBAAkB;AAExB,SAASC,2BAA2B,EAClCC,UAAU,EAGX;IACC,MAAM,CAACC,OAAO,GAAG1B;IACjB,MAAM2B,aAAa1B;IAEnB,MAAM2B,eAAeP;IACrB,MAAM,CAACQ,YAAYC,YAAY,GAAGZ,SAAkB;IACpD,MAAM,CAACa,eAAeC,eAAe,GAAGd,SAAkB;IAC1D,MAAM,CAACe,uBAAuBC,yBAAyB,GAAGhB,SAAkB;IAC5E,MAAM,CAACiB,UAAUC,YAAY,GAAGlB,SAAS,CAAC;IAC1C,MAAMmB,cAAcpB,OAAqB,IAAIqB;IAC7C,MAAMC,sBAAsBtB,OAA2B;IAEvD,MAAMuB,uBAAuBlB,YAC3B,CAACmB;QACC,MAAM,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGC,aAAaH,OAAOb,aAAaA,YAAY,EAAEiB;QAEnF,IAAIH,WAAW;YACbZ,YAAY;YACZE,eAAe;YACf;Q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AOC,OAAO,CACjC,CAAC,GAAG,EAAE5F,aAAasF,KAAK,CAACO,SAAS,CAAC,KAAK,EAAE7F,aAAasF,KAAK,CAACO,SAAS,EAAE;QAG1E,MAAM/E,YAAY,CAChBC,CAAAA,gBACA4E,OAAOC,OAAO,CAAc,CAAC,OAAO,EAAE5F,aAAasF,KAAK,CAACC,YAAY,EAAE,KACvEI,OAAOC,OAAO,CAAc,CAAC,OAAO,EAAE5F,aAAasF,KAAK,CAACI,eAAe,EAAE,KAC1EC,OAAOC,OAAO,CAAc,CAAC,IAAI,EAAE5F,aAAasF,KAAK,CAACQ,gBAAgB,EAAE,CAAA;QAG1E,OAAO;YAAEhF;YAAWC;QAAa;IACnC,OAAO;QACL,OAAO;YAAED,WAAW;YAAMC,cAAc;QAAK;IAC/C;AACF;AAEA,OAAO,SAASgF,wBAAwB,EACtClG,aAAaiE,SAASkC,IAAI,EAG3B;IACC,MAAMjG,aAAa1B;IAEnB,IAAI,CAAC0B,YAAY;QACf,OAAO;IACT;IAEA,qBAAOP,2BAAa,QAACI;QAA2BC,YAAYA;;;;;cAAgBA;AAC9E"}
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
3
3
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
4
  import { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin';
5
5
  import { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table';
@@ -11,6 +11,7 @@ import * as React from 'react';
11
11
  import { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js';
12
12
  import { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js';
13
13
  import { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js';
14
+ import './index.scss';
14
15
  export const OPEN_TABLE_DRAWER_COMMAND = createCommand('OPEN_EMBED_DRAWER_COMMAND');
15
16
  export const CellContext = /*#__PURE__*/ createContext({
16
17
  cellEditorConfig: null,
@@ -23,7 +24,7 @@ export function TableContext({ children }) {
23
24
  cellEditorConfig: null,
24
25
  cellEditorPlugins: null
25
26
  });
26
- return /*#__PURE__*/ _jsx(CellContext, {
27
+ return /*#__PURE__*/ _jsxDEV(CellContext, {
27
28
  value: useMemo(()=>({
28
29
  cellEditorConfig: contextValue.cellEditorConfig,
29
30
  cellEditorPlugins: contextValue.cellEditorPlugins,
@@ -38,7 +39,11 @@ export function TableContext({ children }) {
38
39
  contextValue.cellEditorPlugins
39
40
  ]),
40
41
  children: children
41
- });
42
+ }, void 0, false, {
43
+ fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
44
+ lineNumber: 67,
45
+ columnNumber: 5
46
+ }, this);
42
47
  }
43
48
  export const TablePlugin = ()=>{
44
49
  const [editor] = useLexicalComposerContext();
@@ -76,9 +81,9 @@ export const TablePlugin = ()=>{
76
81
  editor,
77
82
  toggleDrawer
78
83
  ]);
79
- return /*#__PURE__*/ _jsxs(React.Fragment, {
84
+ return /*#__PURE__*/ _jsxDEV(React.Fragment, {
80
85
  children: [
81
- /*#__PURE__*/ _jsx(FieldsDrawer, {
86
+ /*#__PURE__*/ _jsxDEV(FieldsDrawer, {
82
87
  drawerSlug: drawerSlug,
83
88
  drawerTitle: "Create Table",
84
89
  featureKey: "experimental_table",
@@ -93,14 +98,26 @@ export const TablePlugin = ()=>{
93
98
  },
94
99
  schemaPath: schemaPath,
95
100
  schemaPathSuffix: "fields"
96
- }),
97
- /*#__PURE__*/ _jsx(LexicalReactTablePlugin, {
101
+ }, void 0, false, {
102
+ fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
103
+ lineNumber: 131,
104
+ columnNumber: 7
105
+ }, this),
106
+ /*#__PURE__*/ _jsxDEV(LexicalReactTablePlugin, {
98
107
  hasCellBackgroundColor: false,
99
108
  hasCellMerge: true,
100
109
  hasHorizontalScroll: true
101
- })
110
+ }, void 0, false, {
111
+ fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
112
+ lineNumber: 148,
113
+ columnNumber: 7
114
+ }, this)
102
115
  ]
103
- });
116
+ }, void 0, true, {
117
+ fileName: "src/features/experimental_table/client/plugins/TablePlugin/index.tsx",
118
+ lineNumber: 130,
119
+ columnNumber: 5
120
+ }, this);
104
121
  };
105
122
 
106
123
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TablePlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n EditorThemeClasses,\n Klass,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n RangeSelection,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin'\nimport { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { mergeRegister } from '@lexical/utils'\nimport { formatDrawerSlug, useEditDepth } from '@payloadcms/ui'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport { createContext, use, useEffect, useMemo, useState } from 'react'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport './index.scss'\n\nexport type CellContextShape = {\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n set: (\n cellEditorConfig: CellEditorConfig | null,\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null,\n ) => void\n}\n\nexport type CellEditorConfig = Readonly<{\n namespace: string\n nodes?: ReadonlyArray<Klass<LexicalNode>>\n onError: (error: Error, editor: LexicalEditor) => void\n readOnly?: boolean\n theme?: EditorThemeClasses\n}>\n\nexport const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}> = createCommand(\n 'OPEN_EMBED_DRAWER_COMMAND',\n)\n\nexport const CellContext = createContext<CellContextShape>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n set: () => {\n // Empty\n },\n})\n\nexport function TableContext({ children }: { children: JSX.Element }) {\n const [contextValue, setContextValue] = useState<{\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n }>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n })\n return (\n <CellContext\n value={useMemo(\n () => ({\n cellEditorConfig: contextValue.cellEditorConfig,\n cellEditorPlugins: contextValue.cellEditorPlugins,\n set: (cellEditorConfig, cellEditorPlugins) => {\n setContextValue({ cellEditorConfig, cellEditorPlugins })\n },\n }),\n [contextValue.cellEditorConfig, contextValue.cellEditorPlugins],\n )}\n >\n {children}\n </CellContext>\n )\n}\n\nexport const TablePlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const cellContext = use(CellContext)\n const editDepth = useEditDepth()\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n\n const drawerSlug = formatDrawerSlug({\n slug: 'lexical-table-create-' + uuid,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n useEffect(() => {\n if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {\n throw new Error(\n 'TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor',\n )\n }\n\n return mergeRegister(\n editor.registerCommand(\n OPEN_TABLE_DRAWER_COMMAND,\n () => {\n let rangeSelection: null | RangeSelection = null\n\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n rangeSelection = selection\n }\n })\n\n if (rangeSelection) {\n toggleDrawer()\n }\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [cellContext, editor, toggleDrawer])\n\n return (\n <React.Fragment>\n <FieldsDrawer\n drawerSlug={drawerSlug}\n drawerTitle=\"Create Table\"\n featureKey=\"experimental_table\"\n handleDrawerSubmit={(_fields, data) => {\n if (!data.columns || !data.rows) {\n return\n }\n\n editor.dispatchCommand(INSERT_TABLE_COMMAND, {\n columns: String(data.columns),\n rows: String(data.rows),\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n <LexicalReactTablePlugin\n hasCellBackgroundColor={false}\n hasCellMerge\n hasHorizontalScroll={true}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","TablePlugin","LexicalReactTablePlugin","INSERT_TABLE_COMMAND","TableCellNode","TableNode","TableRowNode","mergeRegister","formatDrawerSlug","useEditDepth","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","createContext","use","useEffect","useMemo","useState","React","useEditorConfigContext","FieldsDrawer","useLexicalDrawer","OPEN_TABLE_DRAWER_COMMAND","CellContext","cellEditorConfig","cellEditorPlugins","set","TableContext","children","contextValue","setContextValue","value","editor","cellContext","editDepth","fieldProps","schemaPath","uuid","drawerSlug","slug","depth","toggleDrawer","hasNodes","Error","registerCommand","rangeSelection","getEditorState","read","selection","Fragment","drawerTitle","featureKey","handleDrawerSubmit","_fields","data","columns","rows","dispatchCommand","String","schemaPathSuffix","hasCellBackgroundColor","hasCellMerge","hasHorizontalScroll"],"mappings":"AAAA;;AAYA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,eAAeC,uBAAuB,QAAQ,oCAAmC;AAC1F,SAASC,oBAAoB,EAAEC,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AAC7F,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,iBAAgB;AAC/D,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,u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MAAM,IAAIwC,MACR;QAEJ;QAEA,OAAOrC,cACL0B,OAAOY,eAAe,CACpBtB,2BACA;YACE,IAAIuB,iBAAwC;YAE5Cb,OAAOc,cAAc,GAAGC,IAAI,CAAC;gBAC3B,MAAMC,YAAYvC;gBAClB,IAAIC,kBAAkBsC,YAAY;oBAChCH,iBAAiBG;gBACnB;YACF;YAEA,IAAIH,gBAAgB;gBAClBJ;YACF;YACA,OAAO;QACT,GACA9B;IAGN,GAAG;QAACsB;QAAaD;QAAQS;KAAa;IAEtC,qBACE,MAACvB,MAAM+B,QAAQ;;0BACb,KAAC7B;gBACCkB,YAAYA;gBACZY,aAAY;gBACZC,YAAW;gBACXC,oBAAoB,CAACC,SAASC;oBAC5B,IAAI,CAACA,KAAKC,OAAO,IAAI,CAACD,KAAKE,IAAI,EAAE;wBAC/B;oBACF;oBAEAxB,OAAOyB,eAAe,CAACvD,sBAAsB;wBAC3CqD,SAASG,OAAOJ,KAAKC,OAAO;wBAC5BC,MAAME,OAAOJ,KAAKE,IAAI;oBACxB;gBACF;gBACApB,YAAYA;gBACZuB,kBAAiB;;0BAEnB,KAAC1D;gBACC2D,wBAAwB;gBACxBC,YAAY;gBACZC,qBAAqB;;;;AAI7B,EAAC"}
1
+ {"version":3,"sources":["../../../../../../src/features/experimental_table/client/plugins/TablePlugin/index.tsx"],"sourcesContent":["'use client'\n\nimport type {\n EditorThemeClasses,\n Klass,\n LexicalCommand,\n LexicalEditor,\n LexicalNode,\n RangeSelection,\n} from 'lexical'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TablePlugin as LexicalReactTablePlugin } from '@lexical/react/LexicalTablePlugin'\nimport { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode } from '@lexical/table'\nimport { mergeRegister } from '@lexical/utils'\nimport { formatDrawerSlug, useEditDepth } from '@payloadcms/ui'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR, createCommand } from 'lexical'\nimport { createContext, use, useEffect, useMemo, useState } from 'react'\nimport * as React from 'react'\n\nimport type { PluginComponent } from '../../../../typesClient.js'\n\nimport { useEditorConfigContext } from '../../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDrawer } from '../../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport './index.scss'\n\nexport type CellContextShape = {\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n set: (\n cellEditorConfig: CellEditorConfig | null,\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null,\n ) => void\n}\n\nexport type CellEditorConfig = Readonly<{\n namespace: string\n nodes?: ReadonlyArray<Klass<LexicalNode>>\n onError: (error: Error, editor: LexicalEditor) => void\n readOnly?: boolean\n theme?: EditorThemeClasses\n}>\n\nexport const OPEN_TABLE_DRAWER_COMMAND: LexicalCommand<{}> = createCommand(\n 'OPEN_EMBED_DRAWER_COMMAND',\n)\n\nexport const CellContext = createContext<CellContextShape>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n set: () => {\n // Empty\n },\n})\n\nexport function TableContext({ children }: { children: JSX.Element }) {\n const [contextValue, setContextValue] = useState<{\n cellEditorConfig: CellEditorConfig | null\n cellEditorPlugins: Array<JSX.Element> | JSX.Element | null\n }>({\n cellEditorConfig: null,\n cellEditorPlugins: null,\n })\n return (\n <CellContext\n value={useMemo(\n () => ({\n cellEditorConfig: contextValue.cellEditorConfig,\n cellEditorPlugins: contextValue.cellEditorPlugins,\n set: (cellEditorConfig, cellEditorPlugins) => {\n setContextValue({ cellEditorConfig, cellEditorPlugins })\n },\n }),\n [contextValue.cellEditorConfig, contextValue.cellEditorPlugins],\n )}\n >\n {children}\n </CellContext>\n )\n}\n\nexport const TablePlugin: PluginComponent = () => {\n const [editor] = useLexicalComposerContext()\n const cellContext = use(CellContext)\n const editDepth = useEditDepth()\n const {\n fieldProps: { schemaPath },\n uuid,\n } = useEditorConfigContext()\n\n const drawerSlug = formatDrawerSlug({\n slug: 'lexical-table-create-' + uuid,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n useEffect(() => {\n if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {\n throw new Error(\n 'TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor',\n )\n }\n\n return mergeRegister(\n editor.registerCommand(\n OPEN_TABLE_DRAWER_COMMAND,\n () => {\n let rangeSelection: null | RangeSelection = null\n\n editor.getEditorState().read(() => {\n const selection = $getSelection()\n if ($isRangeSelection(selection)) {\n rangeSelection = selection\n }\n })\n\n if (rangeSelection) {\n toggleDrawer()\n }\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n ),\n )\n }, [cellContext, editor, toggleDrawer])\n\n return (\n <React.Fragment>\n <FieldsDrawer\n drawerSlug={drawerSlug}\n drawerTitle=\"Create Table\"\n featureKey=\"experimental_table\"\n handleDrawerSubmit={(_fields, data) => {\n if (!data.columns || !data.rows) {\n return\n }\n\n editor.dispatchCommand(INSERT_TABLE_COMMAND, {\n columns: String(data.columns),\n rows: String(data.rows),\n })\n }}\n schemaPath={schemaPath}\n schemaPathSuffix=\"fields\"\n />\n <LexicalReactTablePlugin\n hasCellBackgroundColor={false}\n hasCellMerge\n hasHorizontalScroll={true}\n />\n </React.Fragment>\n )\n}\n"],"names":["useLexicalComposerContext","TablePlugin","LexicalReactTablePlugin","INSERT_TABLE_COMMAND","TableCellNode","TableNode","TableRowNode","mergeRegister","formatDrawerSlug","useEditDepth","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","createCommand","createContext","use","useEffect","useMemo","useState","React","useEditorConfigContext","FieldsDrawer","useLexicalDrawer","OPEN_TABLE_DRAWER_COMMAND","CellContext","cellEditorConfig","cellEditorPlugins","set","TableContext","children","contextValue","setContextValue","value","editor","cellContext","editDepth","fieldProps","schemaPath","uuid","drawerSlug","slug","depth","toggleDrawer","hasNodes","Error","registerCommand","rangeSelection","getEditorState","read","selection","Fragment","drawerTitle","featureKey","handleDrawerSubmit","_fields","data","columns","rows","dispatchCommand","String","schemaPathSuffix","hasCellBackgroundColor","hasCellMerge","hasHorizontalScroll"],"mappings":"AAAA;;AAYA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,eAAeC,uBAAuB,QAAQ,oCAAmC;AAC1F,SAASC,oBAAoB,EAAEC,aAAa,EAAEC,SAAS,EAAEC,YAAY,QAAQ,iBAAgB;AAC7F,SAASC,aAAa,QAAQ,iBAAgB;AAC9C,SAASC,gBAAgB,EAAEC,YAAY,QAAQ,iBAAgB;AAC/D,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,uBAAuB,EAAEC,aAAa,QAAQ,UAAS;AAClG,SAASC,aAAa,EAAEC,GAAG,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAO;AACxE,YAAYC,WAAW,QAAO;AAI9B,SAASC,sBAAsB,QAAQ,+DAA8D;AACrG,SAASC,YAAY,QAAQ,kDAAiD;AAC9E,SAASC,gBAAgB,QAAQ,4DAA2D;AAC5F,OAAO,eAAc;AAmBrB,OAAO,MAAMC,4BAAgDV,cAC3D,6BACD;AAED,OAAO,MAAMW,4BAAcV,cAAgC;IACzDW,kBAAkB;IAClBC,mBAAmB;IACnBC,KAAK,KAEL;AACF,GAAE;AAFE,QAAQ;AAIZ,OAAO,SAASC,aAAa,EAAEC,QAAQ,EAA6B;IAClE,MAAM,CAACC,cAAcC,gBAAgB,GAAGb,SAGrC;QACDO,kBAAkB;QAClBC,mBAAmB;IACrB;IACA,qBACE,QAACF;QACCQ,OAAOf,QACL,IAAO,CAAA;gBACLQ,kBAAkBK,aAAaL,gBAAgB;gBAC/CC,mBAAmBI,aAAaJ,iBAAiB;gBACjDC,KAAK,CAACF,kBAAkBC;oBACtBK,gBAAgB;wBAAEN;wBAAkBC;oBAAkB;gBACxD;YACF,CAAA,GACA;Y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BAAqB;;;;;;;;;;;;AAI7B,EAAC"}
@@ -0,0 +1,233 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .LexicalEditorTheme {
5
+ &__tableScrollableWrapper {
6
+ overflow-x: auto;
7
+ margin: 0px 25px 30px 0px;
8
+ }
9
+ &__tableScrollableWrapper > .LexicalEditorTheme__table {
10
+ /* Remove the table's vertical margin and put it on the wrapper */
11
+ margin-top: 0;
12
+ margin-bottom: 0;
13
+ }
14
+
15
+ &__tableAlignmentCenter {
16
+ margin-left: auto;
17
+ margin-right: auto;
18
+ }
19
+ &__tableAlignmentRight {
20
+ margin-left: auto;
21
+ }
22
+
23
+ &__tableSelection *::selection {
24
+ background-color: transparent;
25
+ }
26
+
27
+ &__table {
28
+ border-collapse: collapse;
29
+ max-width: 100%;
30
+ border-spacing: 0;
31
+ overflow-y: scroll;
32
+ overflow-x: scroll;
33
+ table-layout: fixed;
34
+ width: fit-content;
35
+ margin-top: 25px;
36
+ margin-bottom: 30px;
37
+
38
+ ::selection {
39
+ background: rgba(172, 206, 247);
40
+ }
41
+
42
+ br::selection {
43
+ background: unset;
44
+ }
45
+ }
46
+
47
+ &__tableFrozenColumn tr > td:first-child {
48
+ background-color: var(--theme-bg);
49
+ position: sticky;
50
+ z-index: 2;
51
+ left: 0;
52
+ }
53
+ &__tableFrozenColumn tr > th:first-child {
54
+ background-color: var(--theme-elevation-50);
55
+ position: sticky;
56
+ z-index: 2;
57
+ left: 0;
58
+ }
59
+ &__tableFrozenColumn tr > :first-child::after {
60
+ content: '';
61
+ position: absolute;
62
+ left: 0;
63
+ top: 0;
64
+ right: 0;
65
+ height: 100%;
66
+ border-right: 1px solid var(--theme-elevation-400);
67
+ }
68
+
69
+ &__tableRowStriping tr:nth-child(even) {
70
+ background-color: var(--theme-elevation-100);
71
+ }
72
+
73
+ &__tableSelected {
74
+ outline: 2px solid rgb(60, 132, 244);
75
+ }
76
+
77
+ &__tableCell {
78
+ border: 1px solid var(--theme-elevation-200);
79
+ vertical-align: top;
80
+ text-align: start;
81
+ padding: 6px 8px;
82
+ position: relative;
83
+ cursor: default;
84
+ outline: none;
85
+ }
86
+
87
+ /*
88
+ * A firefox workaround to allow scrolling of overflowing table cell
89
+ * ref: https://bugzilla.mozilla.org/show_bug.cgi?id=1904159
90
+ */
91
+ &__tableCell > * {
92
+ overflow: inherit;
93
+ }
94
+
95
+ &__tableCellResizer {
96
+ position: absolute;
97
+ right: -4px;
98
+ height: 100%;
99
+ width: 8px;
100
+ cursor: ew-resize;
101
+ z-index: 10;
102
+ top: 0;
103
+ }
104
+
105
+ &__tableCellHeader {
106
+ background-color: #f2f3f5;
107
+ text-align: start;
108
+ }
109
+
110
+ &__tableCellSelected {
111
+ caret-color: transparent;
112
+ }
113
+
114
+ &__tableCellSelected::after {
115
+ position: absolute;
116
+ left: 0;
117
+ right: 0;
118
+ bottom: 0;
119
+ top: 0;
120
+ background-color: var(--color-success-250);
121
+ mix-blend-mode: multiply;
122
+ content: '';
123
+ pointer-events: none;
124
+ }
125
+
126
+ &__tableAddColumns {
127
+ height: 100%;
128
+ }
129
+
130
+ &__tableAddColumns,
131
+ &__tableAddRows {
132
+ position: absolute;
133
+ background-color: var(--theme-elevation-100);
134
+ animation: table-controls 0.2s ease;
135
+ border: 0;
136
+ cursor: pointer;
137
+ min-width: 24px;
138
+ min-height: 24px;
139
+ }
140
+
141
+ &__tableAddColumns:after,
142
+ &__tableAddRows:after {
143
+ display: flex;
144
+ content: '+';
145
+ font-size: 1.4rem;
146
+ border-radius: $style-radius-s;
147
+ justify-content: center;
148
+ align-items: center;
149
+ position: absolute;
150
+ top: 0;
151
+ left: 0;
152
+ width: 100%;
153
+ height: 100%;
154
+ color: var(--theme-elevation-500);
155
+ }
156
+
157
+ &__tableAddColumns:hover,
158
+ &__tableAddRows:hover {
159
+ background-color: var(--theme-elevation-150);
160
+ }
161
+
162
+ &__tableAddRows {
163
+ width: calc(100% - 25px);
164
+ }
165
+
166
+ @keyframes table-controls {
167
+ 0% {
168
+ opacity: 0;
169
+ }
170
+
171
+ 100% {
172
+ opacity: 1;
173
+ }
174
+ }
175
+
176
+ &__tableCellResizeRuler {
177
+ display: block;
178
+ position: absolute;
179
+ width: 1px;
180
+ background-color: rgb(60, 132, 244);
181
+ height: 100%;
182
+ top: 0;
183
+ }
184
+
185
+ &__tableCellActionButtonContainer {
186
+ display: block;
187
+ right: 5px;
188
+ top: 6px;
189
+ position: absolute;
190
+ z-index: 4;
191
+ width: 20px;
192
+ height: 20px;
193
+ }
194
+
195
+ &__tableCellActionButton {
196
+ background-color: #eee;
197
+ display: block;
198
+ border: 0;
199
+ border-radius: 20px;
200
+ width: 20px;
201
+ height: 20px;
202
+ color: #222;
203
+ cursor: pointer;
204
+ }
205
+
206
+ &__tableCellActionButton:hover {
207
+ background-color: #ddd;
208
+ }
209
+ }
210
+
211
+ html[data-theme='dark'] {
212
+ .LexicalEditorTheme {
213
+ &__tableCellHeader {
214
+ background-color: var(--theme-elevation-50);
215
+ }
216
+
217
+ &__tableCellSelected::after {
218
+ background-color: var(--color-success-700);
219
+ mix-blend-mode: screen;
220
+ }
221
+
222
+ &__tableAddColumns,
223
+ &__tableAddRows {
224
+ background-color: var(--theme-elevation-50);
225
+ }
226
+
227
+ &__tableAddColumns:hover,
228
+ &__tableAddRows:hover {
229
+ background-color: var(--theme-elevation-100);
230
+ }
231
+ }
232
+ }
233
+ }
@@ -5,6 +5,7 @@ import { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR } from 'lexic
5
5
  import { useEffect } from 'react';
6
6
  import { INSERT_HORIZONTAL_RULE_COMMAND } from '../../server/nodes/HorizontalRuleNode.js';
7
7
  import { $createHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js';
8
+ import './index.scss';
8
9
  /**
9
10
  * Registers the INSERT_HORIZONTAL_RULE_COMMAND lexical command and defines the behavior for when it is called.
10
11
  */ export const HorizontalRulePlugin = ()=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/features/horizontalRule/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR } from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\n\nimport { INSERT_HORIZONTAL_RULE_COMMAND } from '../../server/nodes/HorizontalRuleNode.js'\nimport { $createHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js'\nimport './index.scss'\n\n/**\n * Registers the INSERT_HORIZONTAL_RULE_COMMAND lexical command and defines the behavior for when it is called.\n */\nexport const HorizontalRulePlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerCommand(\n INSERT_HORIZONTAL_RULE_COMMAND,\n (type) => {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const focusNode = selection.focus.getNode()\n\n if (focusNode !== null) {\n const horizontalRuleNode = $createHorizontalRuleNode()\n $insertNodeToNearestRoot(horizontalRuleNode)\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return null\n}\n"],"names":["useLexicalComposerContext","$insertNodeToNearestRoot","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","useEffect","INSERT_HORIZONTAL_RULE_COMMAND","$createHorizontalRuleNode","HorizontalRulePlugin","editor","registerCommand","type","selection","focusNode","focus","getNode","horizontalRuleNode"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,wBAAwB,QAAQ,iBAAgB;AACzD,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,uBAAuB,QAAQ,UAAS;AACnF,SAASC,SAAS,QAAQ,QAAO;AAIjC,SAASC,8BAA8B,QAAQ,2CAA0C;AACzF,SAASC,yBAAyB,QAAQ,iCAAgC;AAG1E;;CAEC,GACD,OAAO,MAAMC,uBAAmD;IAC9D,MAAM,CAACC,OAAO,GAAGT;IAEjBK,UAAU;QACR,OAAOI,OAAOC,eAAe,CAC3BJ,gCACA,CAACK;YACC,MAAMC,YAAYV;YAElB,IAAI,CAACC,kBAAkBS,YAAY;gBACjC,OAAO;YACT;YAEA,MAAMC,YAAYD,UAAUE,KAAK,CAACC,OAAO;YAEzC,IAAIF,cAAc,MAAM;gBACtB,MAAMG,qBAAqBT;gBAC3BN,yBAAyBe;YAC3B;YAEA,OAAO;QACT,GACAZ;IAEJ,GAAG;QAACK;KAAO;IAEX,OAAO;AACT,EAAC"}
1
+ {"version":3,"sources":["../../../../../src/features/horizontalRule/client/plugin/index.tsx"],"sourcesContent":["'use client'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { $insertNodeToNearestRoot } from '@lexical/utils'\nimport { $getSelection, $isRangeSelection, COMMAND_PRIORITY_EDITOR } from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../../typesClient.js'\n\nimport { INSERT_HORIZONTAL_RULE_COMMAND } from '../../server/nodes/HorizontalRuleNode.js'\nimport { $createHorizontalRuleNode } from '../nodes/HorizontalRuleNode.js'\nimport './index.scss'\n\n/**\n * Registers the INSERT_HORIZONTAL_RULE_COMMAND lexical command and defines the behavior for when it is called.\n */\nexport const HorizontalRulePlugin: PluginComponent<undefined> = () => {\n const [editor] = useLexicalComposerContext()\n\n useEffect(() => {\n return editor.registerCommand(\n INSERT_HORIZONTAL_RULE_COMMAND,\n (type) => {\n const selection = $getSelection()\n\n if (!$isRangeSelection(selection)) {\n return false\n }\n\n const focusNode = selection.focus.getNode()\n\n if (focusNode !== null) {\n const horizontalRuleNode = $createHorizontalRuleNode()\n $insertNodeToNearestRoot(horizontalRuleNode)\n }\n\n return true\n },\n COMMAND_PRIORITY_EDITOR,\n )\n }, [editor])\n\n return null\n}\n"],"names":["useLexicalComposerContext","$insertNodeToNearestRoot","$getSelection","$isRangeSelection","COMMAND_PRIORITY_EDITOR","useEffect","INSERT_HORIZONTAL_RULE_COMMAND","$createHorizontalRuleNode","HorizontalRulePlugin","editor","registerCommand","type","selection","focusNode","focus","getNode","horizontalRuleNode"],"mappings":"AAAA;AAEA,SAASA,yBAAyB,QAAQ,2CAA0C;AACpF,SAASC,wBAAwB,QAAQ,iBAAgB;AACzD,SAASC,aAAa,EAAEC,iBAAiB,EAAEC,uBAAuB,QAAQ,UAAS;AACnF,SAASC,SAAS,QAAQ,QAAO;AAIjC,SAASC,8BAA8B,QAAQ,2CAA0C;AACzF,SAASC,yBAAyB,QAAQ,iCAAgC;AAC1E,OAAO,eAAc;AAErB;;CAEC,GACD,OAAO,MAAMC,uBAAmD;IAC9D,MAAM,CAACC,OAAO,GAAGT;IAEjBK,UAAU;QACR,OAAOI,OAAOC,eAAe,CAC3BJ,gCACA,CAACK;YACC,MAAMC,YAAYV;YAElB,IAAI,CAACC,kBAAkBS,YAAY;gBACjC,OAAO;YACT;YAEA,MAAMC,YAAYD,UAAUE,KAAK,CAACC,OAAO;YAEzC,IAAIF,cAAc,MAAM;gBACtB,MAAMG,qBAAqBT;gBAC3BN,yBAAyBe;YAC3B;YAEA,OAAO;QACT,GACAZ;IAEJ,GAAG;QAACK;KAAO;IAEX,OAAO;AACT,EAAC"}
@@ -0,0 +1,23 @@
1
+ @import '~@payloadcms/ui/scss';
2
+
3
+ @layer payload-default {
4
+ .LexicalEditorTheme__hr {
5
+ width: auto !important;
6
+ padding: 2px 2px;
7
+ border: none;
8
+ margin: 1rem 0;
9
+ cursor: pointer;
10
+ }
11
+
12
+ .LexicalEditorTheme__hr:after {
13
+ content: '';
14
+ display: block;
15
+ height: 2px;
16
+ background-color: var(--theme-elevation-250);
17
+ }
18
+
19
+ .LexicalEditorTheme__hr.LexicalEditorTheme__hrSelected {
20
+ outline: 2px solid var(--theme-success-250);
21
+ user-select: none;
22
+ }
23
+ }
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime";
2
2
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
3
  import { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin';
4
4
  import { $findMatchingParent, mergeRegister } from '@lexical/utils';
@@ -56,7 +56,11 @@ export const IndentPlugin = ({ clientProps })=>{
56
56
  editor,
57
57
  disableTabNode
58
58
  ]);
59
- return /*#__PURE__*/ _jsx(TabIndentationPlugin, {});
59
+ return /*#__PURE__*/ _jsxDEV(TabIndentationPlugin, {}, void 0, false, {
60
+ fileName: "src/features/indent/client/IndentPlugin.tsx",
61
+ lineNumber: 87,
62
+ columnNumber: 10
63
+ }, this);
60
64
  };
61
65
  function $handleIndentAndOutdent(indentOrOutdent) {
62
66
  const selection = $getSelection();
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n KEY_TAB_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n TabNode,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes, disableTabNode } = clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n // If we disable indenting for certain nodes, we need to ensure that these are not indented,\n // if they get transformed from an indented state (e.g. an indented list node gets transformed into a\n // paragraph node for which indenting is disabled).\n editor.registerUpdateListener(({ dirtyElements, editorState }) => {\n editor.update(() => {\n for (const [nodeKey] of dirtyElements) {\n const node = editorState._nodeMap.get(nodeKey)\n if ($isElementNode(node) && disabledNodes.includes(node.getType())) {\n const currentIndent = node.getIndent()\n if (currentIndent > 0) {\n node.setIndent(0)\n }\n }\n }\n })\n }),\n )\n }, [editor, disabledNodes])\n\n useEffect(() => {\n if (!editor || !disableTabNode) {\n return\n }\n return mergeRegister(\n // This is so that when you press Tab in the middle of a paragraph,\n // it indents the paragraph, instead of inserting a TabNode.\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault()\n return editor.dispatchCommand(\n event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND,\n undefined,\n )\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Tab isn't the only way to insert a TabNode. We have to make sure\n // it doesn't happen, for example, when pasting from the clipboard.\n editor.registerNodeTransform(TabNode, (node) => {\n node.remove()\n }),\n )\n }, [editor, disableTabNode])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","KEY_TAB_COMMAND","OUTDENT_CONTENT_COMMAND","TabNode","useEffect","IndentPlugin","clientProps","editor","disabledNodes","disableTabNode","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","registerUpdateListener","dirtyElements","editorState","update","nodeKey","node","_nodeMap","get","currentIndent","event","preventDefault","dispatchCommand","shiftKey","undefined","registerNodeTransform","remove","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"mappings":";AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,QAAQ,6CAA4C;AACjF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,eAAe,EACfC,uBAAuB,EACvBC,OAAO,QACF,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAKjC,OAAO,MAAMC,eAAoD,CAAC,EAAEC,WAAW,EAAE;IAC/E,MAAM,CAACC,OAAO,GAAGf;IACjB,MAAM,EAAEgB,aAAa,EAAEC,cAAc,EAAE,GAAGH;IAE1CF,UAAU;QACR,IAAI,CAACG,UAAU,CAACC,eAAeE,QAAQ;YACrC;QACF;QACA,OAAOf,cACLY,OAAOI,eAAe,CACpBX,wBACA;YACE,OAAOY,wBAAwB,CAACC;gBAC9B,IAAI,CAACL,cAAcM,QAAQ,CAACD,MAAME,OAAO,KAAK;oBAC5C,MAAMC,SAASH,MAAMI,SAAS;oBAC9BJ,MAAMK,SAAS,CAACF,SAAS;gBAC3B;YACF;QACF,GACAjB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eO,GAAG,CAACF,MAAM;YAC3B;QACF;QACA,MAAMG,cAAcnD,oBAClB8B,MACA,CAACsB,aACCjD,eAAeiD,eAAe,CAACA,WAAWC,QAAQ;QAEtD,IAAIF,gBAAgB,MAAM;YACxB;QACF;QACA,MAAMG,YAAYH,YAAYF,MAAM;QACpC,IAAIE,YAAYI,SAAS,MAAM,CAACZ,eAAeO,GAAG,CAACI,YAAY;YAC7DX,eAAea,GAAG,CAACF;YACnBb,gBAAgBU;QAClB;IACF;IACA,OAAOR,eAAec,IAAI,GAAG;AAC/B"}
1
+ {"version":3,"sources":["../../../../src/features/indent/client/IndentPlugin.tsx"],"sourcesContent":["import type { ElementNode } from 'lexical'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { TabIndentationPlugin } from '@lexical/react/LexicalTabIndentationPlugin'\nimport { $findMatchingParent, mergeRegister } from '@lexical/utils'\nimport {\n $getSelection,\n $isElementNode,\n $isRangeSelection,\n COMMAND_PRIORITY_LOW,\n INDENT_CONTENT_COMMAND,\n KEY_TAB_COMMAND,\n OUTDENT_CONTENT_COMMAND,\n TabNode,\n} from 'lexical'\nimport { useEffect } from 'react'\n\nimport type { PluginComponent } from '../../typesClient.js'\nimport type { IndentFeatureProps } from '../server/index.js'\n\nexport const IndentPlugin: PluginComponent<IndentFeatureProps> = ({ clientProps }) => {\n const [editor] = useLexicalComposerContext()\n const { disabledNodes, disableTabNode } = clientProps\n\n useEffect(() => {\n if (!editor || !disabledNodes?.length) {\n return\n }\n return mergeRegister(\n editor.registerCommand(\n INDENT_CONTENT_COMMAND,\n () => {\n return $handleIndentAndOutdent((block) => {\n if (!disabledNodes.includes(block.getType())) {\n const indent = block.getIndent()\n block.setIndent(indent + 1)\n }\n })\n },\n COMMAND_PRIORITY_LOW,\n ),\n // If we disable indenting for certain nodes, we need to ensure that these are not indented,\n // if they get transformed from an indented state (e.g. an indented list node gets transformed into a\n // paragraph node for which indenting is disabled).\n editor.registerUpdateListener(({ dirtyElements, editorState }) => {\n editor.update(() => {\n for (const [nodeKey] of dirtyElements) {\n const node = editorState._nodeMap.get(nodeKey)\n if ($isElementNode(node) && disabledNodes.includes(node.getType())) {\n const currentIndent = node.getIndent()\n if (currentIndent > 0) {\n node.setIndent(0)\n }\n }\n }\n })\n }),\n )\n }, [editor, disabledNodes])\n\n useEffect(() => {\n if (!editor || !disableTabNode) {\n return\n }\n return mergeRegister(\n // This is so that when you press Tab in the middle of a paragraph,\n // it indents the paragraph, instead of inserting a TabNode.\n editor.registerCommand<KeyboardEvent>(\n KEY_TAB_COMMAND,\n (event) => {\n event.preventDefault()\n return editor.dispatchCommand(\n event.shiftKey ? OUTDENT_CONTENT_COMMAND : INDENT_CONTENT_COMMAND,\n undefined,\n )\n },\n COMMAND_PRIORITY_LOW,\n ),\n // Tab isn't the only way to insert a TabNode. We have to make sure\n // it doesn't happen, for example, when pasting from the clipboard.\n editor.registerNodeTransform(TabNode, (node) => {\n node.remove()\n }),\n )\n }, [editor, disableTabNode])\n\n return <TabIndentationPlugin />\n}\n\nfunction $handleIndentAndOutdent(indentOrOutdent: (block: ElementNode) => void): boolean {\n const selection = $getSelection()\n if (!$isRangeSelection(selection)) {\n return false\n }\n const alreadyHandled = new Set()\n const nodes = selection.getNodes()\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i]!\n const key = node.getKey()\n if (alreadyHandled.has(key)) {\n continue\n }\n const parentBlock = $findMatchingParent(\n node,\n (parentNode): parentNode is ElementNode =>\n $isElementNode(parentNode) && !parentNode.isInline(),\n )\n if (parentBlock === null) {\n continue\n }\n const parentKey = parentBlock.getKey()\n if (parentBlock.canIndent() && !alreadyHandled.has(parentKey)) {\n alreadyHandled.add(parentKey)\n indentOrOutdent(parentBlock)\n }\n }\n return alreadyHandled.size > 0\n}\n"],"names":["useLexicalComposerContext","TabIndentationPlugin","$findMatchingParent","mergeRegister","$getSelection","$isElementNode","$isRangeSelection","COMMAND_PRIORITY_LOW","INDENT_CONTENT_COMMAND","KEY_TAB_COMMAND","OUTDENT_CONTENT_COMMAND","TabNode","useEffect","IndentPlugin","clientProps","editor","disabledNodes","disableTabNode","length","registerCommand","$handleIndentAndOutdent","block","includes","getType","indent","getIndent","setIndent","registerUpdateListener","dirtyElements","editorState","update","nodeKey","node","_nodeMap","get","currentIndent","event","preventDefault","dispatchCommand","shiftKey","undefined","registerNodeTransform","remove","indentOrOutdent","selection","alreadyHandled","Set","nodes","getNodes","i","key","getKey","has","parentBlock","parentNode","isInline","parentKey","canIndent","add","size"],"mappings":";AAEA,SAASA,yBAAyB,QAAQ,wCAAuC;AACjF,SAASC,oBAAoB,QAAQ,6CAA4C;AACjF,SAASC,mBAAmB,EAAEC,aAAa,QAAQ,iBAAgB;AACnE,SACEC,aAAa,EACbC,cAAc,EACdC,iBAAiB,EACjBC,oBAAoB,EACpBC,sBAAsB,EACtBC,eAAe,EACfC,uBAAuB,EACvBC,OAAO,QACF,UAAS;AAChB,SAASC,SAAS,QAAQ,QAAO;AAKjC,OAAO,MAAMC,eAAoD,CAAC,EAAEC,WAAW,EAAE;IAC/E,MAAM,CAACC,OAAO,GAAGf;IACjB,MAAM,EAAEgB,aAAa,EAAEC,cAAc,EAAE,GAAGH;IAE1CF,UAAU;QACR,IAAI,CAACG,UAAU,CAACC,eAAeE,QAAQ;YACrC;QACF;QACA,OAAOf,cACLY,OAAOI,eAAe,CACpBX,wBACA;YACE,OAAOY,wBAAwB,CAACC;gBAC9B,IAAI,CAACL,cAAcM,QAAQ,CAACD,MAAME,OAAO,KAAK;oBAC5C,MAAMC,SAASH,MAAMI,SAAS;oBAC9BJ,MAAMK,SAAS,CAACF,SAAS;gBAC3B;YACF;QACF,GACAjB,uBAEF,4FAA4F;QAC5F,qGAAqG;QACrG,mDAAmD;QACnDQ,OAAOY,sBAAsB,CAAC,CAAC,EAAEC,aAAa,EAAEC,WAAW,EAAE;YAC3Dd,OAAOe,MAAM,CAAC;gBACZ,KAAK,MAAM,CAACC,QAAQ,IAAIH,cA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F,MAAM;QACpC,IAAIE,YAAYI,SAAS,MAAM,CAACZ,eAAeO,GAAG,CAACI,YAAY;YAC7DX,eAAea,GAAG,CAACF;YACnBb,gBAAgBU;QAClB;IACF;IACA,OAAOR,eAAec,IAAI,GAAG;AAC/B"}
@@ -119,8 +119,10 @@ function $createAutoLinkNode_(nodes, startIndex, endIndex, match) {
119
119
  const remainingTextNode = nodes[0];
120
120
  let linkTextNode;
121
121
  if (startIndex === 0) {
122
+ ;
122
123
  [linkTextNode] = remainingTextNode.splitText(endIndex);
123
124
  } else {
125
+ ;
124
126
  [, linkTextNode] = remainingTextNode.splitText(startIndex, endIndex);
125
127
  }
126
128
  if (linkTextNode) {
@@ -139,6 +141,7 @@ function $createAutoLinkNode_(nodes, startIndex, endIndex, match) {
139
141
  if (startIndex === 0) {
140
142
  firstLinkTextNode = firstTextNode;
141
143
  } else {
144
+ ;
142
145
  [, firstLinkTextNode] = firstTextNode.splitText(startIndex);
143
146
  }
144
147
  const linkNodes = [];