@ethberry/mui-lexical 1.0.7

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 (605) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +1 -0
  3. package/dist/common/hooks/index.d.ts +1 -0
  4. package/dist/common/hooks/index.js +18 -0
  5. package/dist/common/hooks/index.js.map +1 -0
  6. package/dist/common/hooks/useModal.d.ts +2 -0
  7. package/dist/common/hooks/useModal.js +28 -0
  8. package/dist/common/hooks/useModal.js.map +1 -0
  9. package/dist/common/index.d.ts +2 -0
  10. package/dist/common/index.js +19 -0
  11. package/dist/common/index.js.map +1 -0
  12. package/dist/common/types/index.d.ts +5 -0
  13. package/dist/common/types/index.js +3 -0
  14. package/dist/common/types/index.js.map +1 -0
  15. package/dist/components/index.d.ts +1 -0
  16. package/dist/components/index.js +18 -0
  17. package/dist/components/index.js.map +1 -0
  18. package/dist/components/ui/Modal/index.d.ts +6 -0
  19. package/dist/components/ui/Modal/index.js +18 -0
  20. package/dist/components/ui/Modal/index.js.map +1 -0
  21. package/dist/components/ui/index.d.ts +1 -0
  22. package/dist/components/ui/index.js +18 -0
  23. package/dist/components/ui/index.js.map +1 -0
  24. package/dist/config/lexicalEditorConfig.d.ts +78 -0
  25. package/dist/config/lexicalEditorConfig.js +33 -0
  26. package/dist/config/lexicalEditorConfig.js.map +1 -0
  27. package/dist/config/lexicalEditorTheme.d.ts +68 -0
  28. package/dist/config/lexicalEditorTheme.js +71 -0
  29. package/dist/config/lexicalEditorTheme.js.map +1 -0
  30. package/dist/display/index.d.ts +6 -0
  31. package/dist/display/index.js +47 -0
  32. package/dist/display/index.js.map +1 -0
  33. package/dist/display/styled.d.ts +1 -0
  34. package/dist/display/styled.js +67 -0
  35. package/dist/display/styled.js.map +1 -0
  36. package/dist/editor/Editor.d.ts +16 -0
  37. package/dist/editor/Editor.js +95 -0
  38. package/dist/editor/Editor.js.map +1 -0
  39. package/dist/editor/Editor.stories.d.ts +13 -0
  40. package/dist/editor/Editor.stories.js +135 -0
  41. package/dist/editor/Editor.stories.js.map +1 -0
  42. package/dist/editor/commands/index.d.ts +4 -0
  43. package/dist/editor/commands/index.js +6 -0
  44. package/dist/editor/commands/index.js.map +1 -0
  45. package/dist/editor/constants/index.d.ts +2 -0
  46. package/dist/editor/constants/index.js +40 -0
  47. package/dist/editor/constants/index.js.map +1 -0
  48. package/dist/editor/context/SharedHistoryContext.d.ts +11 -0
  49. package/dist/editor/context/SharedHistoryContext.js +17 -0
  50. package/dist/editor/context/SharedHistoryContext.js.map +1 -0
  51. package/dist/editor/context/ToolbarContext.d.ts +56 -0
  52. package/dist/editor/context/ToolbarContext.js +67 -0
  53. package/dist/editor/context/ToolbarContext.js.map +1 -0
  54. package/dist/editor/context/index.d.ts +2 -0
  55. package/dist/editor/context/index.js +19 -0
  56. package/dist/editor/context/index.js.map +1 -0
  57. package/dist/editor/editorStyles.d.ts +1 -0
  58. package/dist/editor/editorStyles.js +1273 -0
  59. package/dist/editor/editorStyles.js.map +1 -0
  60. package/dist/editor/hooks/index.d.ts +1 -0
  61. package/dist/editor/hooks/index.js +18 -0
  62. package/dist/editor/hooks/index.js.map +1 -0
  63. package/dist/editor/hooks/useModal.d.ts +2 -0
  64. package/dist/editor/hooks/useModal.js +29 -0
  65. package/dist/editor/hooks/useModal.js.map +1 -0
  66. package/dist/editor/images/icons/3-columns.d.ts +1 -0
  67. package/dist/editor/images/icons/3-columns.js +9 -0
  68. package/dist/editor/images/icons/3-columns.js.map +1 -0
  69. package/dist/editor/images/icons/add-sign.d.ts +1 -0
  70. package/dist/editor/images/icons/add-sign.js +9 -0
  71. package/dist/editor/images/icons/add-sign.js.map +1 -0
  72. package/dist/editor/images/icons/arrow-clockwise.d.ts +1 -0
  73. package/dist/editor/images/icons/arrow-clockwise.js +9 -0
  74. package/dist/editor/images/icons/arrow-clockwise.js.map +1 -0
  75. package/dist/editor/images/icons/arrow-counterclockwise.d.ts +1 -0
  76. package/dist/editor/images/icons/arrow-counterclockwise.js +9 -0
  77. package/dist/editor/images/icons/arrow-counterclockwise.js.map +1 -0
  78. package/dist/editor/images/icons/bg-color.d.ts +1 -0
  79. package/dist/editor/images/icons/bg-color.js +9 -0
  80. package/dist/editor/images/icons/bg-color.js.map +1 -0
  81. package/dist/editor/images/icons/camera.d.ts +1 -0
  82. package/dist/editor/images/icons/camera.js +9 -0
  83. package/dist/editor/images/icons/camera.js.map +1 -0
  84. package/dist/editor/images/icons/card-checklist.d.ts +1 -0
  85. package/dist/editor/images/icons/card-checklist.js +9 -0
  86. package/dist/editor/images/icons/card-checklist.js.map +1 -0
  87. package/dist/editor/images/icons/caret-right-fill.d.ts +1 -0
  88. package/dist/editor/images/icons/caret-right-fill.js +9 -0
  89. package/dist/editor/images/icons/caret-right-fill.js.map +1 -0
  90. package/dist/editor/images/icons/chat-left-text.d.ts +1 -0
  91. package/dist/editor/images/icons/chat-left-text.js +9 -0
  92. package/dist/editor/images/icons/chat-left-text.js.map +1 -0
  93. package/dist/editor/images/icons/chat-right-dots.d.ts +1 -0
  94. package/dist/editor/images/icons/chat-right-dots.js +9 -0
  95. package/dist/editor/images/icons/chat-right-dots.js.map +1 -0
  96. package/dist/editor/images/icons/chat-right-text.d.ts +1 -0
  97. package/dist/editor/images/icons/chat-right-text.js +9 -0
  98. package/dist/editor/images/icons/chat-right-text.js.map +1 -0
  99. package/dist/editor/images/icons/chat-right.d.ts +1 -0
  100. package/dist/editor/images/icons/chat-right.js +9 -0
  101. package/dist/editor/images/icons/chat-right.js.map +1 -0
  102. package/dist/editor/images/icons/chat-square-quote.d.ts +1 -0
  103. package/dist/editor/images/icons/chat-square-quote.js +9 -0
  104. package/dist/editor/images/icons/chat-square-quote.js.map +1 -0
  105. package/dist/editor/images/icons/chevron-down.d.ts +1 -0
  106. package/dist/editor/images/icons/chevron-down.js +9 -0
  107. package/dist/editor/images/icons/chevron-down.js.map +1 -0
  108. package/dist/editor/images/icons/clipboard.d.ts +1 -0
  109. package/dist/editor/images/icons/clipboard.js +9 -0
  110. package/dist/editor/images/icons/clipboard.js.map +1 -0
  111. package/dist/editor/images/icons/close.d.ts +1 -0
  112. package/dist/editor/images/icons/close.js +9 -0
  113. package/dist/editor/images/icons/close.js.map +1 -0
  114. package/dist/editor/images/icons/code.d.ts +1 -0
  115. package/dist/editor/images/icons/code.js +9 -0
  116. package/dist/editor/images/icons/code.js.map +1 -0
  117. package/dist/editor/images/icons/comments.d.ts +1 -0
  118. package/dist/editor/images/icons/comments.js +9 -0
  119. package/dist/editor/images/icons/comments.js.map +1 -0
  120. package/dist/editor/images/icons/copy.d.ts +1 -0
  121. package/dist/editor/images/icons/copy.js +9 -0
  122. package/dist/editor/images/icons/copy.js.map +1 -0
  123. package/dist/editor/images/icons/diagram-2.d.ts +1 -0
  124. package/dist/editor/images/icons/diagram-2.js +9 -0
  125. package/dist/editor/images/icons/diagram-2.js.map +1 -0
  126. package/dist/editor/images/icons/download.d.ts +1 -0
  127. package/dist/editor/images/icons/download.js +9 -0
  128. package/dist/editor/images/icons/download.js.map +1 -0
  129. package/dist/editor/images/icons/draggable-block-menu.d.ts +1 -0
  130. package/dist/editor/images/icons/draggable-block-menu.js +9 -0
  131. package/dist/editor/images/icons/draggable-block-menu.js.map +1 -0
  132. package/dist/editor/images/icons/dropdown-more.d.ts +1 -0
  133. package/dist/editor/images/icons/dropdown-more.js +9 -0
  134. package/dist/editor/images/icons/dropdown-more.js.map +1 -0
  135. package/dist/editor/images/icons/figma.d.ts +1 -0
  136. package/dist/editor/images/icons/figma.js +9 -0
  137. package/dist/editor/images/icons/figma.js.map +1 -0
  138. package/dist/editor/images/icons/file-earmark-text.d.ts +1 -0
  139. package/dist/editor/images/icons/file-earmark-text.js +9 -0
  140. package/dist/editor/images/icons/file-earmark-text.js.map +1 -0
  141. package/dist/editor/images/icons/file-image.d.ts +1 -0
  142. package/dist/editor/images/icons/file-image.js +9 -0
  143. package/dist/editor/images/icons/file-image.js.map +1 -0
  144. package/dist/editor/images/icons/filetype-gif.d.ts +1 -0
  145. package/dist/editor/images/icons/filetype-gif.js +9 -0
  146. package/dist/editor/images/icons/filetype-gif.js.map +1 -0
  147. package/dist/editor/images/icons/font-color.d.ts +1 -0
  148. package/dist/editor/images/icons/font-color.js +9 -0
  149. package/dist/editor/images/icons/font-color.js.map +1 -0
  150. package/dist/editor/images/icons/font-family.d.ts +1 -0
  151. package/dist/editor/images/icons/font-family.js +9 -0
  152. package/dist/editor/images/icons/font-family.js.map +1 -0
  153. package/dist/editor/images/icons/format-clear.d.ts +1 -0
  154. package/dist/editor/images/icons/format-clear.js +9 -0
  155. package/dist/editor/images/icons/format-clear.js.map +1 -0
  156. package/dist/editor/images/icons/highlighter.d.ts +1 -0
  157. package/dist/editor/images/icons/highlighter.js +9 -0
  158. package/dist/editor/images/icons/highlighter.js.map +1 -0
  159. package/dist/editor/images/icons/horizontal-rule.d.ts +1 -0
  160. package/dist/editor/images/icons/horizontal-rule.js +9 -0
  161. package/dist/editor/images/icons/horizontal-rule.js.map +1 -0
  162. package/dist/editor/images/icons/indent.d.ts +1 -0
  163. package/dist/editor/images/icons/indent.js +9 -0
  164. package/dist/editor/images/icons/indent.js.map +1 -0
  165. package/dist/editor/images/icons/index.d.ts +88 -0
  166. package/dist/editor/images/icons/index.js +105 -0
  167. package/dist/editor/images/icons/index.js.map +1 -0
  168. package/dist/editor/images/icons/journal-text.d.ts +1 -0
  169. package/dist/editor/images/icons/journal-text.js +9 -0
  170. package/dist/editor/images/icons/journal-text.js.map +1 -0
  171. package/dist/editor/images/icons/justify.d.ts +1 -0
  172. package/dist/editor/images/icons/justify.js +9 -0
  173. package/dist/editor/images/icons/justify.js.map +1 -0
  174. package/dist/editor/images/icons/link.d.ts +1 -0
  175. package/dist/editor/images/icons/link.js +9 -0
  176. package/dist/editor/images/icons/link.js.map +1 -0
  177. package/dist/editor/images/icons/list-ol.d.ts +1 -0
  178. package/dist/editor/images/icons/list-ol.js +9 -0
  179. package/dist/editor/images/icons/list-ol.js.map +1 -0
  180. package/dist/editor/images/icons/list-ul.d.ts +1 -0
  181. package/dist/editor/images/icons/list-ul.js +9 -0
  182. package/dist/editor/images/icons/list-ul.js.map +1 -0
  183. package/dist/editor/images/icons/lock-fill.d.ts +1 -0
  184. package/dist/editor/images/icons/lock-fill.js +9 -0
  185. package/dist/editor/images/icons/lock-fill.js.map +1 -0
  186. package/dist/editor/images/icons/lock.d.ts +1 -0
  187. package/dist/editor/images/icons/lock.js +9 -0
  188. package/dist/editor/images/icons/lock.js.map +1 -0
  189. package/dist/editor/images/icons/markdown.d.ts +1 -0
  190. package/dist/editor/images/icons/markdown.js +9 -0
  191. package/dist/editor/images/icons/markdown.js.map +1 -0
  192. package/dist/editor/images/icons/mic.d.ts +1 -0
  193. package/dist/editor/images/icons/mic.js +9 -0
  194. package/dist/editor/images/icons/mic.js.map +1 -0
  195. package/dist/editor/images/icons/minus-sign.d.ts +1 -0
  196. package/dist/editor/images/icons/minus-sign.js +9 -0
  197. package/dist/editor/images/icons/minus-sign.js.map +1 -0
  198. package/dist/editor/images/icons/outdent.d.ts +1 -0
  199. package/dist/editor/images/icons/outdent.js +9 -0
  200. package/dist/editor/images/icons/outdent.js.map +1 -0
  201. package/dist/editor/images/icons/paint-bucket.d.ts +1 -0
  202. package/dist/editor/images/icons/paint-bucket.js +9 -0
  203. package/dist/editor/images/icons/paint-bucket.js.map +1 -0
  204. package/dist/editor/images/icons/palette.d.ts +1 -0
  205. package/dist/editor/images/icons/palette.js +9 -0
  206. package/dist/editor/images/icons/palette.js.map +1 -0
  207. package/dist/editor/images/icons/pencil-fill.d.ts +1 -0
  208. package/dist/editor/images/icons/pencil-fill.js +9 -0
  209. package/dist/editor/images/icons/pencil-fill.js.map +1 -0
  210. package/dist/editor/images/icons/plug-fill.d.ts +1 -0
  211. package/dist/editor/images/icons/plug-fill.js +9 -0
  212. package/dist/editor/images/icons/plug-fill.js.map +1 -0
  213. package/dist/editor/images/icons/plug.d.ts +1 -0
  214. package/dist/editor/images/icons/plug.js +9 -0
  215. package/dist/editor/images/icons/plug.js.map +1 -0
  216. package/dist/editor/images/icons/plus-slash-minus.d.ts +1 -0
  217. package/dist/editor/images/icons/plus-slash-minus.js +9 -0
  218. package/dist/editor/images/icons/plus-slash-minus.js.map +1 -0
  219. package/dist/editor/images/icons/plus.d.ts +1 -0
  220. package/dist/editor/images/icons/plus.js +9 -0
  221. package/dist/editor/images/icons/plus.js.map +1 -0
  222. package/dist/editor/images/icons/prettier-error.d.ts +1 -0
  223. package/dist/editor/images/icons/prettier-error.js +9 -0
  224. package/dist/editor/images/icons/prettier-error.js.map +1 -0
  225. package/dist/editor/images/icons/prettier.d.ts +1 -0
  226. package/dist/editor/images/icons/prettier.js +9 -0
  227. package/dist/editor/images/icons/prettier.js.map +1 -0
  228. package/dist/editor/images/icons/scissors.d.ts +1 -0
  229. package/dist/editor/images/icons/scissors.js +9 -0
  230. package/dist/editor/images/icons/scissors.js.map +1 -0
  231. package/dist/editor/images/icons/send.d.ts +1 -0
  232. package/dist/editor/images/icons/send.js +9 -0
  233. package/dist/editor/images/icons/send.js.map +1 -0
  234. package/dist/editor/images/icons/square-check.d.ts +1 -0
  235. package/dist/editor/images/icons/square-check.js +9 -0
  236. package/dist/editor/images/icons/square-check.js.map +1 -0
  237. package/dist/editor/images/icons/sticky.d.ts +1 -0
  238. package/dist/editor/images/icons/sticky.js +9 -0
  239. package/dist/editor/images/icons/sticky.js.map +1 -0
  240. package/dist/editor/images/icons/success-alt.d.ts +1 -0
  241. package/dist/editor/images/icons/success-alt.js +9 -0
  242. package/dist/editor/images/icons/success-alt.js.map +1 -0
  243. package/dist/editor/images/icons/success.d.ts +1 -0
  244. package/dist/editor/images/icons/success.js +9 -0
  245. package/dist/editor/images/icons/success.js.map +1 -0
  246. package/dist/editor/images/icons/table.d.ts +1 -0
  247. package/dist/editor/images/icons/table.js +9 -0
  248. package/dist/editor/images/icons/table.js.map +1 -0
  249. package/dist/editor/images/icons/text-center.d.ts +1 -0
  250. package/dist/editor/images/icons/text-center.js +9 -0
  251. package/dist/editor/images/icons/text-center.js.map +1 -0
  252. package/dist/editor/images/icons/text-left.d.ts +1 -0
  253. package/dist/editor/images/icons/text-left.js +9 -0
  254. package/dist/editor/images/icons/text-left.js.map +1 -0
  255. package/dist/editor/images/icons/text-paragraph.d.ts +1 -0
  256. package/dist/editor/images/icons/text-paragraph.js +9 -0
  257. package/dist/editor/images/icons/text-paragraph.js.map +1 -0
  258. package/dist/editor/images/icons/text-right.d.ts +1 -0
  259. package/dist/editor/images/icons/text-right.js +9 -0
  260. package/dist/editor/images/icons/text-right.js.map +1 -0
  261. package/dist/editor/images/icons/trash.d.ts +1 -0
  262. package/dist/editor/images/icons/trash.js +9 -0
  263. package/dist/editor/images/icons/trash.js.map +1 -0
  264. package/dist/editor/images/icons/trash3.d.ts +1 -0
  265. package/dist/editor/images/icons/trash3.js +9 -0
  266. package/dist/editor/images/icons/trash3.js.map +1 -0
  267. package/dist/editor/images/icons/type-bold.d.ts +1 -0
  268. package/dist/editor/images/icons/type-bold.js +9 -0
  269. package/dist/editor/images/icons/type-bold.js.map +1 -0
  270. package/dist/editor/images/icons/type-capitalize.d.ts +1 -0
  271. package/dist/editor/images/icons/type-capitalize.js +9 -0
  272. package/dist/editor/images/icons/type-capitalize.js.map +1 -0
  273. package/dist/editor/images/icons/type-h1.d.ts +1 -0
  274. package/dist/editor/images/icons/type-h1.js +9 -0
  275. package/dist/editor/images/icons/type-h1.js.map +1 -0
  276. package/dist/editor/images/icons/type-h2.d.ts +1 -0
  277. package/dist/editor/images/icons/type-h2.js +9 -0
  278. package/dist/editor/images/icons/type-h2.js.map +1 -0
  279. package/dist/editor/images/icons/type-h3.d.ts +1 -0
  280. package/dist/editor/images/icons/type-h3.js +9 -0
  281. package/dist/editor/images/icons/type-h3.js.map +1 -0
  282. package/dist/editor/images/icons/type-h4.d.ts +1 -0
  283. package/dist/editor/images/icons/type-h4.js +9 -0
  284. package/dist/editor/images/icons/type-h4.js.map +1 -0
  285. package/dist/editor/images/icons/type-h5.d.ts +1 -0
  286. package/dist/editor/images/icons/type-h5.js +9 -0
  287. package/dist/editor/images/icons/type-h5.js.map +1 -0
  288. package/dist/editor/images/icons/type-h6.d.ts +1 -0
  289. package/dist/editor/images/icons/type-h6.js +9 -0
  290. package/dist/editor/images/icons/type-h6.js.map +1 -0
  291. package/dist/editor/images/icons/type-italic.d.ts +1 -0
  292. package/dist/editor/images/icons/type-italic.js +9 -0
  293. package/dist/editor/images/icons/type-italic.js.map +1 -0
  294. package/dist/editor/images/icons/type-lowercase.d.ts +1 -0
  295. package/dist/editor/images/icons/type-lowercase.js +9 -0
  296. package/dist/editor/images/icons/type-lowercase.js.map +1 -0
  297. package/dist/editor/images/icons/type-strikethrough.d.ts +1 -0
  298. package/dist/editor/images/icons/type-strikethrough.js +9 -0
  299. package/dist/editor/images/icons/type-strikethrough.js.map +1 -0
  300. package/dist/editor/images/icons/type-subscript.d.ts +1 -0
  301. package/dist/editor/images/icons/type-subscript.js +9 -0
  302. package/dist/editor/images/icons/type-subscript.js.map +1 -0
  303. package/dist/editor/images/icons/type-superscript.d.ts +1 -0
  304. package/dist/editor/images/icons/type-superscript.js +9 -0
  305. package/dist/editor/images/icons/type-superscript.js.map +1 -0
  306. package/dist/editor/images/icons/type-underline.d.ts +1 -0
  307. package/dist/editor/images/icons/type-underline.js +9 -0
  308. package/dist/editor/images/icons/type-underline.js.map +1 -0
  309. package/dist/editor/images/icons/type-uppercase.d.ts +1 -0
  310. package/dist/editor/images/icons/type-uppercase.js +9 -0
  311. package/dist/editor/images/icons/type-uppercase.js.map +1 -0
  312. package/dist/editor/images/icons/upload.d.ts +1 -0
  313. package/dist/editor/images/icons/upload.js +9 -0
  314. package/dist/editor/images/icons/upload.js.map +1 -0
  315. package/dist/editor/images/icons/user.d.ts +1 -0
  316. package/dist/editor/images/icons/user.js +9 -0
  317. package/dist/editor/images/icons/user.js.map +1 -0
  318. package/dist/editor/images/icons/vertical-bottom.d.ts +1 -0
  319. package/dist/editor/images/icons/vertical-bottom.js +9 -0
  320. package/dist/editor/images/icons/vertical-bottom.js.map +1 -0
  321. package/dist/editor/images/icons/vertical-middle.d.ts +1 -0
  322. package/dist/editor/images/icons/vertical-middle.js +9 -0
  323. package/dist/editor/images/icons/vertical-middle.js.map +1 -0
  324. package/dist/editor/images/icons/vertical-top.d.ts +1 -0
  325. package/dist/editor/images/icons/vertical-top.js +9 -0
  326. package/dist/editor/images/icons/vertical-top.js.map +1 -0
  327. package/dist/editor/images/icons/x.d.ts +1 -0
  328. package/dist/editor/images/icons/x.js +9 -0
  329. package/dist/editor/images/icons/x.js.map +1 -0
  330. package/dist/editor/images/icons/youtube.d.ts +1 -0
  331. package/dist/editor/images/icons/youtube.js +9 -0
  332. package/dist/editor/images/icons/youtube.js.map +1 -0
  333. package/dist/editor/index.d.ts +1 -0
  334. package/dist/editor/index.js +6 -0
  335. package/dist/editor/index.js.map +1 -0
  336. package/dist/editor/nodes/Image/ImageComponent.d.ts +15 -0
  337. package/dist/editor/nodes/Image/ImageComponent.js +248 -0
  338. package/dist/editor/nodes/Image/ImageComponent.js.map +1 -0
  339. package/dist/editor/nodes/Image/ImageNode.d.ts +50 -0
  340. package/dist/editor/nodes/Image/ImageNode.js +128 -0
  341. package/dist/editor/nodes/Image/ImageNode.js.map +1 -0
  342. package/dist/editor/nodes/Image/imageNodeStyles.d.ts +1 -0
  343. package/dist/editor/nodes/Image/imageNodeStyles.js +41 -0
  344. package/dist/editor/nodes/Image/imageNodeStyles.js.map +1 -0
  345. package/dist/editor/nodes/Image/index.d.ts +3 -0
  346. package/dist/editor/nodes/Image/index.js +10 -0
  347. package/dist/editor/nodes/Image/index.js.map +1 -0
  348. package/dist/editor/nodes/InlineImage/InlineImageComponent.d.ts +18 -0
  349. package/dist/editor/nodes/InlineImage/InlineImageComponent.js +160 -0
  350. package/dist/editor/nodes/InlineImage/InlineImageComponent.js.map +1 -0
  351. package/dist/editor/nodes/InlineImage/InlineImageNode.d.ts +59 -0
  352. package/dist/editor/nodes/InlineImage/InlineImageNode.js +149 -0
  353. package/dist/editor/nodes/InlineImage/InlineImageNode.js.map +1 -0
  354. package/dist/editor/nodes/InlineImage/index.d.ts +3 -0
  355. package/dist/editor/nodes/InlineImage/index.js +10 -0
  356. package/dist/editor/nodes/InlineImage/index.js.map +1 -0
  357. package/dist/editor/nodes/InlineImage/inlineImageNodeStyles.d.ts +1 -0
  358. package/dist/editor/nodes/InlineImage/inlineImageNodeStyles.js +90 -0
  359. package/dist/editor/nodes/InlineImage/inlineImageNodeStyles.js.map +1 -0
  360. package/dist/editor/nodes/PlaygroundNodes.d.ts +2 -0
  361. package/dist/editor/nodes/PlaygroundNodes.js +32 -0
  362. package/dist/editor/nodes/PlaygroundNodes.js.map +1 -0
  363. package/dist/editor/nodes/Video/VideoComponent.d.ts +9 -0
  364. package/dist/editor/nodes/Video/VideoComponent.js +15 -0
  365. package/dist/editor/nodes/Video/VideoComponent.js.map +1 -0
  366. package/dist/editor/nodes/Video/VideoNode.d.ts +34 -0
  367. package/dist/editor/nodes/Video/VideoNode.js +129 -0
  368. package/dist/editor/nodes/Video/VideoNode.js.map +1 -0
  369. package/dist/editor/nodes/Video/index.d.ts +3 -0
  370. package/dist/editor/nodes/Video/index.js +10 -0
  371. package/dist/editor/nodes/Video/index.js.map +1 -0
  372. package/dist/editor/nodes/Video/videoNodeStyles.d.ts +1 -0
  373. package/dist/editor/nodes/Video/videoNodeStyles.js +44 -0
  374. package/dist/editor/nodes/Video/videoNodeStyles.js.map +1 -0
  375. package/dist/editor/nodes/index.d.ts +4 -0
  376. package/dist/editor/nodes/index.js +21 -0
  377. package/dist/editor/nodes/index.js.map +1 -0
  378. package/dist/editor/plugins/CodeActionMenuPlugin/codeActionMenuPluginStyles.d.ts +1 -0
  379. package/dist/editor/plugins/CodeActionMenuPlugin/codeActionMenuPluginStyles.js +68 -0
  380. package/dist/editor/plugins/CodeActionMenuPlugin/codeActionMenuPluginStyles.js.map +1 -0
  381. package/dist/editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +7 -0
  382. package/dist/editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +48 -0
  383. package/dist/editor/plugins/CodeActionMenuPlugin/components/CopyButton/index.js.map +1 -0
  384. package/dist/editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +9 -0
  385. package/dist/editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +136 -0
  386. package/dist/editor/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js.map +1 -0
  387. package/dist/editor/plugins/CodeActionMenuPlugin/components/index.d.ts +2 -0
  388. package/dist/editor/plugins/CodeActionMenuPlugin/components/index.js +19 -0
  389. package/dist/editor/plugins/CodeActionMenuPlugin/components/index.js.map +1 -0
  390. package/dist/editor/plugins/CodeActionMenuPlugin/index.d.ts +12 -0
  391. package/dist/editor/plugins/CodeActionMenuPlugin/index.js +118 -0
  392. package/dist/editor/plugins/CodeActionMenuPlugin/index.js.map +1 -0
  393. package/dist/editor/plugins/CodeActionMenuPlugin/utils.d.ts +1 -0
  394. package/dist/editor/plugins/CodeActionMenuPlugin/utils.js +15 -0
  395. package/dist/editor/plugins/CodeActionMenuPlugin/utils.js.map +1 -0
  396. package/dist/editor/plugins/CodeHighlightPlugin/index.d.ts +2 -0
  397. package/dist/editor/plugins/CodeHighlightPlugin/index.js +15 -0
  398. package/dist/editor/plugins/CodeHighlightPlugin/index.js.map +1 -0
  399. package/dist/editor/plugins/ComponentPickerPlugin/index.d.ts +9 -0
  400. package/dist/editor/plugins/ComponentPickerPlugin/index.js +217 -0
  401. package/dist/editor/plugins/ComponentPickerPlugin/index.js.map +1 -0
  402. package/dist/editor/plugins/ContextMenuPlugin/index.d.ts +18 -0
  403. package/dist/editor/plugins/ContextMenuPlugin/index.js +190 -0
  404. package/dist/editor/plugins/ContextMenuPlugin/index.js.map +1 -0
  405. package/dist/editor/plugins/FloatingLinkEditorPlugin/floatLinkEditorPluginStyles.d.ts +1 -0
  406. package/dist/editor/plugins/FloatingLinkEditorPlugin/floatLinkEditorPluginStyles.js +48 -0
  407. package/dist/editor/plugins/FloatingLinkEditorPlugin/floatLinkEditorPluginStyles.js.map +1 -0
  408. package/dist/editor/plugins/FloatingLinkEditorPlugin/index.d.ts +14 -0
  409. package/dist/editor/plugins/FloatingLinkEditorPlugin/index.js +275 -0
  410. package/dist/editor/plugins/FloatingLinkEditorPlugin/index.js.map +1 -0
  411. package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.d.ts +1 -0
  412. package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.js +141 -0
  413. package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/floatTextFormatToolbarPluginStyles.js.map +1 -0
  414. package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/index.d.ts +15 -0
  415. package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/index.js +214 -0
  416. package/dist/editor/plugins/FloatingTextFormatToolbarPlugin/index.js.map +1 -0
  417. package/dist/editor/plugins/ImagesPlugin/index.d.ts +28 -0
  418. package/dist/editor/plugins/ImagesPlugin/index.js +175 -0
  419. package/dist/editor/plugins/ImagesPlugin/index.js.map +1 -0
  420. package/dist/editor/plugins/LinkPlugin/index.d.ts +9 -0
  421. package/dist/editor/plugins/LinkPlugin/index.js +14 -0
  422. package/dist/editor/plugins/LinkPlugin/index.js.map +1 -0
  423. package/dist/editor/plugins/MarkdownShortcutPlugin/index.d.ts +9 -0
  424. package/dist/editor/plugins/MarkdownShortcutPlugin/index.js +11 -0
  425. package/dist/editor/plugins/MarkdownShortcutPlugin/index.js.map +1 -0
  426. package/dist/editor/plugins/MarkdownTransformers/index.d.ts +5 -0
  427. package/dist/editor/plugins/MarkdownTransformers/index.js +181 -0
  428. package/dist/editor/plugins/MarkdownTransformers/index.js.map +1 -0
  429. package/dist/editor/plugins/MaxLengthPlugin/index.d.ts +10 -0
  430. package/dist/editor/plugins/MaxLengthPlugin/index.js +48 -0
  431. package/dist/editor/plugins/MaxLengthPlugin/index.js.map +1 -0
  432. package/dist/editor/plugins/ShortcutsPlugin/index.d.ts +13 -0
  433. package/dist/editor/plugins/ShortcutsPlugin/index.js +102 -0
  434. package/dist/editor/plugins/ShortcutsPlugin/index.js.map +1 -0
  435. package/dist/editor/plugins/ShortcutsPlugin/shortcuts.d.ts +56 -0
  436. package/dist/editor/plugins/ShortcutsPlugin/shortcuts.js +145 -0
  437. package/dist/editor/plugins/ShortcutsPlugin/shortcuts.js.map +1 -0
  438. package/dist/editor/plugins/TabFocusPlugin/index.d.ts +8 -0
  439. package/dist/editor/plugins/TabFocusPlugin/index.js +46 -0
  440. package/dist/editor/plugins/TabFocusPlugin/index.js.map +1 -0
  441. package/dist/editor/plugins/TableActionMenuPlugin/index.d.ts +12 -0
  442. package/dist/editor/plugins/TableActionMenuPlugin/index.js +371 -0
  443. package/dist/editor/plugins/TableActionMenuPlugin/index.js.map +1 -0
  444. package/dist/editor/plugins/TableCellResizer/index.d.ts +3 -0
  445. package/dist/editor/plugins/TableCellResizer/index.js +301 -0
  446. package/dist/editor/plugins/TableCellResizer/index.js.map +1 -0
  447. package/dist/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.d.ts +1 -0
  448. package/dist/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.js +18 -0
  449. package/dist/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.js.map +1 -0
  450. package/dist/editor/plugins/TableHoverActionsPlugin/index.d.ts +11 -0
  451. package/dist/editor/plugins/TableHoverActionsPlugin/index.js +193 -0
  452. package/dist/editor/plugins/TableHoverActionsPlugin/index.js.map +1 -0
  453. package/dist/editor/plugins/TablePlugin.d.ts +38 -0
  454. package/dist/editor/plugins/TablePlugin.js +77 -0
  455. package/dist/editor/plugins/TablePlugin.js.map +1 -0
  456. package/dist/editor/plugins/ToolbarPlugin/index.d.ts +19 -0
  457. package/dist/editor/plugins/ToolbarPlugin/index.js +199 -0
  458. package/dist/editor/plugins/ToolbarPlugin/index.js.map +1 -0
  459. package/dist/editor/plugins/ToolbarPlugin/utils.d.ts +22 -0
  460. package/dist/editor/plugins/ToolbarPlugin/utils.js +224 -0
  461. package/dist/editor/plugins/ToolbarPlugin/utils.js.map +1 -0
  462. package/dist/editor/plugins/VideoPlugin/index.d.ts +7 -0
  463. package/dist/editor/plugins/VideoPlugin/index.js +61 -0
  464. package/dist/editor/plugins/VideoPlugin/index.js.map +1 -0
  465. package/dist/editor/plugins/index.d.ts +19 -0
  466. package/dist/editor/plugins/index.js +36 -0
  467. package/dist/editor/plugins/index.js.map +1 -0
  468. package/dist/editor/themes/index.d.ts +1 -0
  469. package/dist/editor/themes/index.js +6 -0
  470. package/dist/editor/themes/index.js.map +1 -0
  471. package/dist/editor/themes/playgroundEditorTheme.d.ts +2 -0
  472. package/dist/editor/themes/playgroundEditorTheme.js +116 -0
  473. package/dist/editor/themes/playgroundEditorTheme.js.map +1 -0
  474. package/dist/editor/themes/playgroundEditorThemeStyles.d.ts +1 -0
  475. package/dist/editor/themes/playgroundEditorThemeStyles.js +702 -0
  476. package/dist/editor/themes/playgroundEditorThemeStyles.js.map +1 -0
  477. package/dist/editor/types/index.d.ts +19 -0
  478. package/dist/editor/types/index.js +3 -0
  479. package/dist/editor/types/index.js.map +1 -0
  480. package/dist/editor/ui/BlockFormatDropdown/index.d.ts +18 -0
  481. package/dist/editor/ui/BlockFormatDropdown/index.js +73 -0
  482. package/dist/editor/ui/BlockFormatDropdown/index.js.map +1 -0
  483. package/dist/editor/ui/BoldButton/index.d.ts +7 -0
  484. package/dist/editor/ui/BoldButton/index.js +14 -0
  485. package/dist/editor/ui/BoldButton/index.js.map +1 -0
  486. package/dist/editor/ui/Button.d.ts +12 -0
  487. package/dist/editor/ui/Button.js +38 -0
  488. package/dist/editor/ui/Button.js.map +1 -0
  489. package/dist/editor/ui/CenterAlignButton/index.d.ts +7 -0
  490. package/dist/editor/ui/CenterAlignButton/index.js +14 -0
  491. package/dist/editor/ui/CenterAlignButton/index.js.map +1 -0
  492. package/dist/editor/ui/ClearEditorButton/index.d.ts +7 -0
  493. package/dist/editor/ui/ClearEditorButton/index.js +10 -0
  494. package/dist/editor/ui/ClearEditorButton/index.js.map +1 -0
  495. package/dist/editor/ui/ClearFormattingButton/index.d.ts +7 -0
  496. package/dist/editor/ui/ClearFormattingButton/index.js +10 -0
  497. package/dist/editor/ui/ClearFormattingButton/index.js.map +1 -0
  498. package/dist/editor/ui/CodeButton/index.d.ts +7 -0
  499. package/dist/editor/ui/CodeButton/index.js +14 -0
  500. package/dist/editor/ui/CodeButton/index.js.map +1 -0
  501. package/dist/editor/ui/CodeLanguageDropdown/index.d.ts +10 -0
  502. package/dist/editor/ui/CodeLanguageDropdown/index.js +26 -0
  503. package/dist/editor/ui/CodeLanguageDropdown/index.js.map +1 -0
  504. package/dist/editor/ui/ContentEditable.d.ts +9 -0
  505. package/dist/editor/ui/ContentEditable.js +63 -0
  506. package/dist/editor/ui/ContentEditable.js.map +1 -0
  507. package/dist/editor/ui/Dialog.d.ts +10 -0
  508. package/dist/editor/ui/Dialog.js +33 -0
  509. package/dist/editor/ui/Dialog.js.map +1 -0
  510. package/dist/editor/ui/Divider/index.d.ts +2 -0
  511. package/dist/editor/ui/Divider/index.js +9 -0
  512. package/dist/editor/ui/Divider/index.js.map +1 -0
  513. package/dist/editor/ui/DropDown.d.ts +16 -0
  514. package/dist/editor/ui/DropDown.js +141 -0
  515. package/dist/editor/ui/DropDown.js.map +1 -0
  516. package/dist/editor/ui/FlashMessage.d.ts +6 -0
  517. package/dist/editor/ui/FlashMessage.js +32 -0
  518. package/dist/editor/ui/FlashMessage.js.map +1 -0
  519. package/dist/editor/ui/HorizontalRuleButton/index.d.ts +3 -0
  520. package/dist/editor/ui/HorizontalRuleButton/index.js +13 -0
  521. package/dist/editor/ui/HorizontalRuleButton/index.js.map +1 -0
  522. package/dist/editor/ui/ImageButton/index.d.ts +8 -0
  523. package/dist/editor/ui/ImageButton/index.js +13 -0
  524. package/dist/editor/ui/ImageButton/index.js.map +1 -0
  525. package/dist/editor/ui/ImageResizer.d.ts +17 -0
  526. package/dist/editor/ui/ImageResizer.js +174 -0
  527. package/dist/editor/ui/ImageResizer.js.map +1 -0
  528. package/dist/editor/ui/ItalicButton/index.d.ts +7 -0
  529. package/dist/editor/ui/ItalicButton/index.js +14 -0
  530. package/dist/editor/ui/ItalicButton/index.js.map +1 -0
  531. package/dist/editor/ui/LeftAlignButton/index.d.ts +7 -0
  532. package/dist/editor/ui/LeftAlignButton/index.js +14 -0
  533. package/dist/editor/ui/LeftAlignButton/index.js.map +1 -0
  534. package/dist/editor/ui/LinkButton/index.d.ts +8 -0
  535. package/dist/editor/ui/LinkButton/index.js +11 -0
  536. package/dist/editor/ui/LinkButton/index.js.map +1 -0
  537. package/dist/editor/ui/Modal.d.ts +9 -0
  538. package/dist/editor/ui/Modal.js +110 -0
  539. package/dist/editor/ui/Modal.js.map +1 -0
  540. package/dist/editor/ui/RedoButton/index.d.ts +3 -0
  541. package/dist/editor/ui/RedoButton/index.js +14 -0
  542. package/dist/editor/ui/RedoButton/index.js.map +1 -0
  543. package/dist/editor/ui/RightAlignButton/index.d.ts +7 -0
  544. package/dist/editor/ui/RightAlignButton/index.js +14 -0
  545. package/dist/editor/ui/RightAlignButton/index.js.map +1 -0
  546. package/dist/editor/ui/Select.d.ts +8 -0
  547. package/dist/editor/ui/Select.js +52 -0
  548. package/dist/editor/ui/Select.js.map +1 -0
  549. package/dist/editor/ui/StrikethroughButton/index.d.ts +7 -0
  550. package/dist/editor/ui/StrikethroughButton/index.js +14 -0
  551. package/dist/editor/ui/StrikethroughButton/index.js.map +1 -0
  552. package/dist/editor/ui/TableButton/index.d.ts +8 -0
  553. package/dist/editor/ui/TableButton/index.js +13 -0
  554. package/dist/editor/ui/TableButton/index.js.map +1 -0
  555. package/dist/editor/ui/TextInput.d.ts +13 -0
  556. package/dist/editor/ui/TextInput.js +36 -0
  557. package/dist/editor/ui/TextInput.js.map +1 -0
  558. package/dist/editor/ui/UnderlineButton/index.d.ts +7 -0
  559. package/dist/editor/ui/UnderlineButton/index.js +14 -0
  560. package/dist/editor/ui/UnderlineButton/index.js.map +1 -0
  561. package/dist/editor/ui/UndoButton/index.d.ts +3 -0
  562. package/dist/editor/ui/UndoButton/index.js +14 -0
  563. package/dist/editor/ui/UndoButton/index.js.map +1 -0
  564. package/dist/editor/ui/VideoButton/index.d.ts +8 -0
  565. package/dist/editor/ui/VideoButton/index.js +13 -0
  566. package/dist/editor/ui/VideoButton/index.js.map +1 -0
  567. package/dist/editor/ui/index.d.ts +30 -0
  568. package/dist/editor/ui/index.js +74 -0
  569. package/dist/editor/ui/index.js.map +1 -0
  570. package/dist/editor/utils/dropDownActiveClass.d.ts +1 -0
  571. package/dist/editor/utils/dropDownActiveClass.js +12 -0
  572. package/dist/editor/utils/dropDownActiveClass.js.map +1 -0
  573. package/dist/editor/utils/getDOMRangeRect.d.ts +1 -0
  574. package/dist/editor/utils/getDOMRangeRect.js +19 -0
  575. package/dist/editor/utils/getDOMRangeRect.js.map +1 -0
  576. package/dist/editor/utils/getSelectedNode.d.ts +2 -0
  577. package/dist/editor/utils/getSelectedNode.js +21 -0
  578. package/dist/editor/utils/getSelectedNode.js.map +1 -0
  579. package/dist/editor/utils/getThemeSelector.d.ts +2 -0
  580. package/dist/editor/utils/getThemeSelector.js +15 -0
  581. package/dist/editor/utils/getThemeSelector.js.map +1 -0
  582. package/dist/editor/utils/index.d.ts +9 -0
  583. package/dist/editor/utils/index.js +26 -0
  584. package/dist/editor/utils/index.js.map +1 -0
  585. package/dist/editor/utils/joinClasses.d.ts +1 -0
  586. package/dist/editor/utils/joinClasses.js +8 -0
  587. package/dist/editor/utils/joinClasses.js.map +1 -0
  588. package/dist/editor/utils/parseVideoUrl.d.ts +15 -0
  589. package/dist/editor/utils/parseVideoUrl.js +115 -0
  590. package/dist/editor/utils/parseVideoUrl.js.map +1 -0
  591. package/dist/editor/utils/setFloatingElemPosition.d.ts +1 -0
  592. package/dist/editor/utils/setFloatingElemPosition.js +47 -0
  593. package/dist/editor/utils/setFloatingElemPosition.js.map +1 -0
  594. package/dist/editor/utils/setFloatingElemPositionForLinkEditor.d.ts +1 -0
  595. package/dist/editor/utils/setFloatingElemPositionForLinkEditor.js +29 -0
  596. package/dist/editor/utils/setFloatingElemPositionForLinkEditor.js.map +1 -0
  597. package/dist/editor/utils/url.d.ts +2 -0
  598. package/dist/editor/utils/url.js +25 -0
  599. package/dist/editor/utils/url.js.map +1 -0
  600. package/dist/index.d.ts +3 -0
  601. package/dist/index.js +37 -0
  602. package/dist/index.js.map +1 -0
  603. package/eslint.config.mjs +27 -0
  604. package/package.json +110 -0
  605. package/tsconfig.eslint.json +10 -0
@@ -0,0 +1,301 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableCellResizerPluginStyles = exports.TableCellResizerPlugin = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const table_1 = require("@lexical/table");
6
+ const lexical_1 = require("lexical");
7
+ const react_1 = require("react");
8
+ const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
9
+ const useLexicalEditable_1 = require("@lexical/react/useLexicalEditable");
10
+ const utils_1 = require("@lexical/utils");
11
+ const react_dom_1 = require("react-dom");
12
+ const MIN_ROW_HEIGHT = 33;
13
+ const MIN_COLUMN_WIDTH = 92;
14
+ function TableCellResizer({ editor }) {
15
+ const targetRef = (0, react_1.useRef)(null);
16
+ const resizerRef = (0, react_1.useRef)(null);
17
+ const tableRectRef = (0, react_1.useRef)(null);
18
+ const [hasTable, setHasTable] = (0, react_1.useState)(false);
19
+ const pointerStartPosRef = (0, react_1.useRef)(null);
20
+ const [pointerCurrentPos, updatePointerCurrentPos] = (0, react_1.useState)(null);
21
+ const [activeCell, updateActiveCell] = (0, react_1.useState)(null);
22
+ const [draggingDirection, updateDraggingDirection] = (0, react_1.useState)(null);
23
+ const resetState = (0, react_1.useCallback)(() => {
24
+ updateActiveCell(null);
25
+ targetRef.current = null;
26
+ updateDraggingDirection(null);
27
+ pointerStartPosRef.current = null;
28
+ tableRectRef.current = null;
29
+ }, []);
30
+ (0, react_1.useEffect)(() => {
31
+ const tableKeys = new Set();
32
+ return (0, utils_1.mergeRegister)(editor.registerMutationListener(table_1.TableNode, nodeMutations => {
33
+ for (const [nodeKey, mutation] of nodeMutations) {
34
+ if (mutation === "destroyed") {
35
+ tableKeys.delete(nodeKey);
36
+ }
37
+ else {
38
+ tableKeys.add(nodeKey);
39
+ }
40
+ }
41
+ setHasTable(tableKeys.size > 0);
42
+ }), editor.registerNodeTransform(table_1.TableNode, tableNode => {
43
+ if (tableNode.getColWidths()) {
44
+ return tableNode;
45
+ }
46
+ const numColumns = tableNode.getColumnCount();
47
+ const columnWidth = MIN_COLUMN_WIDTH;
48
+ tableNode.setColWidths(Array(numColumns).fill(columnWidth));
49
+ return tableNode;
50
+ }));
51
+ }, [editor]);
52
+ (0, react_1.useEffect)(() => {
53
+ if (!hasTable) {
54
+ return;
55
+ }
56
+ const onPointerMove = (event) => {
57
+ var _a;
58
+ const target = event.target;
59
+ if (!(0, lexical_1.isHTMLElement)(target)) {
60
+ return;
61
+ }
62
+ if (draggingDirection) {
63
+ event.preventDefault();
64
+ event.stopPropagation();
65
+ updatePointerCurrentPos({
66
+ x: event.clientX,
67
+ y: event.clientY,
68
+ });
69
+ return;
70
+ }
71
+ if ((_a = resizerRef.current) === null || _a === void 0 ? void 0 : _a.contains(target)) {
72
+ return;
73
+ }
74
+ if (targetRef.current !== target) {
75
+ targetRef.current = target;
76
+ const cell = (0, table_1.getDOMCellFromTarget)(target);
77
+ if (cell && activeCell !== cell) {
78
+ editor.getEditorState().read(() => {
79
+ const tableCellNode = (0, lexical_1.$getNearestNodeFromDOMNode)(cell.elem);
80
+ if (!tableCellNode) {
81
+ throw new Error("TableCellResizer: Table cell node not found.");
82
+ }
83
+ const tableNode = (0, table_1.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
84
+ const tableElement = (0, table_1.getTableElement)(tableNode, editor.getElementByKey(tableNode.getKey()));
85
+ if (!tableElement) {
86
+ throw new Error("TableCellResizer: Table element not found.");
87
+ }
88
+ targetRef.current = target;
89
+ tableRectRef.current = tableElement.getBoundingClientRect();
90
+ updateActiveCell(cell);
91
+ }, { editor });
92
+ }
93
+ else if (cell == null) {
94
+ resetState();
95
+ }
96
+ }
97
+ };
98
+ const onPointerDown = (event) => {
99
+ const isTouchEvent = event.pointerType === "touch";
100
+ if (isTouchEvent) {
101
+ onPointerMove(event);
102
+ }
103
+ };
104
+ const resizerContainer = resizerRef.current;
105
+ resizerContainer === null || resizerContainer === void 0 ? void 0 : resizerContainer.addEventListener("pointermove", onPointerMove, {
106
+ capture: true,
107
+ });
108
+ const removeRootListener = editor.registerRootListener((rootElement, prevRootElement) => {
109
+ prevRootElement === null || prevRootElement === void 0 ? void 0 : prevRootElement.removeEventListener("pointermove", onPointerMove);
110
+ prevRootElement === null || prevRootElement === void 0 ? void 0 : prevRootElement.removeEventListener("pointerdown", onPointerDown);
111
+ rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener("pointermove", onPointerMove);
112
+ rootElement === null || rootElement === void 0 ? void 0 : rootElement.addEventListener("pointerdown", onPointerDown);
113
+ });
114
+ return () => {
115
+ removeRootListener();
116
+ resizerContainer === null || resizerContainer === void 0 ? void 0 : resizerContainer.removeEventListener("pointermove", onPointerMove);
117
+ };
118
+ }, [activeCell, draggingDirection, editor, resetState, hasTable]);
119
+ const isHeightChanging = (direction) => {
120
+ if (direction === "bottom") {
121
+ return true;
122
+ }
123
+ return false;
124
+ };
125
+ const updateRowHeight = (0, react_1.useCallback)((heightChange) => {
126
+ if (!activeCell) {
127
+ throw new Error("TableCellResizer: Expected active cell.");
128
+ }
129
+ editor.update(() => {
130
+ const tableCellNode = (0, lexical_1.$getNearestNodeFromDOMNode)(activeCell.elem);
131
+ if (!(0, table_1.$isTableCellNode)(tableCellNode)) {
132
+ throw new Error("TableCellResizer: Table cell node not found.");
133
+ }
134
+ const tableNode = (0, table_1.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
135
+ const baseRowIndex = (0, table_1.$getTableRowIndexFromTableCellNode)(tableCellNode);
136
+ const tableRows = tableNode.getChildren();
137
+ // Determine if this is a full row merge by checking colspan
138
+ const isFullRowMerge = tableCellNode.getColSpan() === tableNode.getColumnCount();
139
+ // For full row merges, apply to first row. For partial merges, apply to last row
140
+ const tableRowIndex = isFullRowMerge ? baseRowIndex : baseRowIndex + tableCellNode.getRowSpan() - 1;
141
+ if (tableRowIndex >= tableRows.length || tableRowIndex < 0) {
142
+ throw new Error("Expected table cell to be inside of table row.");
143
+ }
144
+ const tableRow = tableRows[tableRowIndex];
145
+ if (!(0, table_1.$isTableRowNode)(tableRow)) {
146
+ throw new Error("Expected table row");
147
+ }
148
+ let height = tableRow.getHeight();
149
+ if (height === undefined) {
150
+ const rowCells = tableRow.getChildren();
151
+ height = Math.min(...rowCells.map(cell => { var _a; return (_a = getCellNodeHeight(cell, editor)) !== null && _a !== void 0 ? _a : Infinity; }));
152
+ }
153
+ const newHeight = Math.max(height + heightChange, MIN_ROW_HEIGHT);
154
+ tableRow.setHeight(newHeight);
155
+ }, { tag: "skip-scroll-into-view" });
156
+ }, [activeCell, editor]);
157
+ const getCellNodeHeight = (cell, activeEditor) => {
158
+ const domCellNode = activeEditor.getElementByKey(cell.getKey());
159
+ return domCellNode === null || domCellNode === void 0 ? void 0 : domCellNode.clientHeight;
160
+ };
161
+ const getCellColumnIndex = (tableCellNode, tableMap) => {
162
+ for (const item of tableMap) {
163
+ for (let column = 0; column < item.length; column++) {
164
+ if (item[column].cell === tableCellNode) {
165
+ return column;
166
+ }
167
+ }
168
+ }
169
+ return;
170
+ };
171
+ const updateColumnWidth = (0, react_1.useCallback)((widthChange) => {
172
+ if (!activeCell) {
173
+ throw new Error("TableCellResizer: Expected active cell.");
174
+ }
175
+ editor.update(() => {
176
+ const tableCellNode = (0, lexical_1.$getNearestNodeFromDOMNode)(activeCell.elem);
177
+ if (!(0, table_1.$isTableCellNode)(tableCellNode)) {
178
+ throw new Error("TableCellResizer: Table cell node not found.");
179
+ }
180
+ const tableNode = (0, table_1.$getTableNodeFromLexicalNodeOrThrow)(tableCellNode);
181
+ const [tableMap] = (0, table_1.$computeTableMapSkipCellCheck)(tableNode, null, null);
182
+ const columnIndex = getCellColumnIndex(tableCellNode, tableMap);
183
+ if (columnIndex === undefined) {
184
+ throw new Error("TableCellResizer: Table column not found.");
185
+ }
186
+ const colWidths = tableNode.getColWidths();
187
+ if (!colWidths) {
188
+ return;
189
+ }
190
+ const width = colWidths[columnIndex];
191
+ if (width === undefined) {
192
+ return;
193
+ }
194
+ const newColWidths = [...colWidths];
195
+ const newWidth = Math.max(width + widthChange, MIN_COLUMN_WIDTH);
196
+ newColWidths[columnIndex] = newWidth;
197
+ tableNode.setColWidths(newColWidths);
198
+ }, { tag: "skip-scroll-into-view" });
199
+ }, [activeCell, editor]);
200
+ const pointerUpHandler = (0, react_1.useCallback)((direction) => {
201
+ const handler = (event) => {
202
+ event.preventDefault();
203
+ event.stopPropagation();
204
+ if (!activeCell) {
205
+ throw new Error("TableCellResizer: Expected active cell.");
206
+ }
207
+ if (pointerStartPosRef.current) {
208
+ const { x, y } = pointerStartPosRef.current;
209
+ if (activeCell === null) {
210
+ return;
211
+ }
212
+ const zoom = (0, utils_1.calculateZoomLevel)(event.target);
213
+ if (isHeightChanging(direction)) {
214
+ const heightChange = (event.clientY - y) / zoom;
215
+ updateRowHeight(heightChange);
216
+ }
217
+ else {
218
+ const widthChange = (event.clientX - x) / zoom;
219
+ updateColumnWidth(widthChange);
220
+ }
221
+ resetState();
222
+ document.removeEventListener("pointerup", handler);
223
+ }
224
+ };
225
+ return handler;
226
+ }, [activeCell, resetState, updateColumnWidth, updateRowHeight]);
227
+ const toggleResize = (0, react_1.useCallback)((direction) => event => {
228
+ event.preventDefault();
229
+ event.stopPropagation();
230
+ if (!activeCell) {
231
+ throw new Error("TableCellResizer: Expected active cell.");
232
+ }
233
+ pointerStartPosRef.current = {
234
+ x: event.clientX,
235
+ y: event.clientY,
236
+ };
237
+ updatePointerCurrentPos(pointerStartPosRef.current);
238
+ updateDraggingDirection(direction);
239
+ document.addEventListener("pointerup", pointerUpHandler(direction));
240
+ }, [activeCell, pointerUpHandler]);
241
+ const getResizers = (0, react_1.useCallback)(() => {
242
+ if (activeCell) {
243
+ const { height, width, top, left } = activeCell.elem.getBoundingClientRect();
244
+ const zoom = (0, utils_1.calculateZoomLevel)(activeCell.elem);
245
+ const zoneWidth = 16; // Pixel width of the zone where you can drag the edge
246
+ const styles = {
247
+ bottom: {
248
+ backgroundColor: "none",
249
+ cursor: "row-resize",
250
+ height: `${zoneWidth}px`,
251
+ left: `${window.scrollX + left}px`,
252
+ top: `${window.scrollY + top + height - zoneWidth / 2}px`,
253
+ width: `${width}px`,
254
+ },
255
+ right: {
256
+ backgroundColor: "none",
257
+ cursor: "col-resize",
258
+ height: `${height}px`,
259
+ left: `${window.scrollX + left + width - zoneWidth / 2}px`,
260
+ top: `${window.scrollY + top}px`,
261
+ width: `${zoneWidth}px`,
262
+ },
263
+ };
264
+ const tableRect = tableRectRef.current;
265
+ if (draggingDirection && pointerCurrentPos && tableRect) {
266
+ if (isHeightChanging(draggingDirection)) {
267
+ styles[draggingDirection].left = `${window.scrollX + tableRect.left}px`;
268
+ styles[draggingDirection].top = `${window.scrollY + pointerCurrentPos.y / zoom}px`;
269
+ styles[draggingDirection].height = "3px";
270
+ styles[draggingDirection].width = `${tableRect.width}px`;
271
+ }
272
+ else {
273
+ styles[draggingDirection].top = `${window.scrollY + tableRect.top}px`;
274
+ styles[draggingDirection].left = `${window.scrollX + pointerCurrentPos.x / zoom}px`;
275
+ styles[draggingDirection].width = "3px";
276
+ styles[draggingDirection].height = `${tableRect.height}px`;
277
+ }
278
+ styles[draggingDirection].backgroundColor = "#adf";
279
+ styles[draggingDirection].mixBlendMode = "unset";
280
+ }
281
+ return styles;
282
+ }
283
+ return {
284
+ bottom: null,
285
+ left: null,
286
+ right: null,
287
+ top: null,
288
+ };
289
+ }, [activeCell, draggingDirection, pointerCurrentPos]);
290
+ const resizerStyles = getResizers();
291
+ return ((0, jsx_runtime_1.jsx)("div", { ref: resizerRef, children: activeCell != null && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: "TableCellResizer__resizer TableCellResizer__ui", style: resizerStyles.right || undefined, onPointerDown: toggleResize("right") }), (0, jsx_runtime_1.jsx)("div", { className: "TableCellResizer__resizer TableCellResizer__ui", style: resizerStyles.bottom || undefined, onPointerDown: toggleResize("bottom") })] })) }));
292
+ }
293
+ const TableCellResizerPlugin = () => {
294
+ const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
295
+ const isEditable = (0, useLexicalEditable_1.useLexicalEditable)();
296
+ return (0, react_1.useMemo)(() => (isEditable ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(TableCellResizer, { editor: editor }), document.body) : null), [editor, isEditable]);
297
+ };
298
+ exports.TableCellResizerPlugin = TableCellResizerPlugin;
299
+ var tableCellResizerPluginStyles_1 = require("./tableCellResizerPluginStyles");
300
+ Object.defineProperty(exports, "tableCellResizerPluginStyles", { enumerable: true, get: function () { return tableCellResizerPluginStyles_1.tableCellResizerPluginStyles; } });
301
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/editor/plugins/TableCellResizer/index.tsx"],"names":[],"mappings":";;;;AAQA,0CASwB;AAExB,qCAAoE;AAEpE,iCASe;AACf,kFAAkF;AAClF,0EAAuE;AACvE,0CAAmE;AACnE,yCAAyC;AASzC,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B,SAAS,gBAAg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ARW,QAAA,sBAAsB,0BAQjC;AAEF,+EAA8E;AAArE,4IAAA,4BAA4B,OAAA"}
@@ -0,0 +1 @@
1
+ export declare const tableCellResizerPluginStyles: import("@emotion/utils").SerializedStyles;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableCellResizerPluginStyles = void 0;
4
+ const material_1 = require("@mui/material");
5
+ exports.tableCellResizerPluginStyles = (0, material_1.css) `
6
+ .TableCellResizer__resizer {
7
+ position: absolute;
8
+ touch-action: none;
9
+ }
10
+
11
+ @media (pointer: coarse) {
12
+ .TableCellResizer__resizer {
13
+ background-color: #adf;
14
+ mix-blend-mode: color;
15
+ }
16
+ }
17
+ `;
18
+ //# sourceMappingURL=tableCellResizerPluginStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tableCellResizerPluginStyles.js","sourceRoot":"","sources":["../../../../src/editor/plugins/TableCellResizer/tableCellResizerPluginStyles.ts"],"names":[],"mappings":";;;AAAA,4CAAoC;AAEvB,QAAA,4BAA4B,GAAG,IAAA,cAAG,EAAA;;;;;;;;;;;;CAY9C,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { ReactPortal } from "react";
9
+ export declare const TableHoverActionsPlugin: ({ anchorElem, }: {
10
+ anchorElem?: HTMLElement;
11
+ }) => ReactPortal | null;
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TableHoverActionsPlugin = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /**
6
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
7
+ *
8
+ * This source code is licensed under the MIT license found in the
9
+ * LICENSE file in the root directory of this source tree.
10
+ *
11
+ */
12
+ const react_1 = require("react");
13
+ const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
14
+ const useLexicalEditable_1 = require("@lexical/react/useLexicalEditable");
15
+ const table_1 = require("@lexical/table");
16
+ const utils_1 = require("@lexical/utils");
17
+ const lexical_1 = require("lexical");
18
+ const react_dom_1 = require("react-dom");
19
+ const getThemeSelector_1 = require("../../utils/getThemeSelector");
20
+ const utils_2 = require("../CodeActionMenuPlugin/utils");
21
+ const BUTTON_WIDTH_PX = 20;
22
+ function TableHoverActionsContainer({ anchorElem }) {
23
+ var _a, _b;
24
+ const [editor, { getTheme }] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
25
+ const isEditable = (0, useLexicalEditable_1.useLexicalEditable)();
26
+ const [isShownRow, setShownRow] = (0, react_1.useState)(false);
27
+ const [isShownColumn, setShownColumn] = (0, react_1.useState)(false);
28
+ const [shouldListenMouseMove, setShouldListenMouseMove] = (0, react_1.useState)(false);
29
+ const [position, setPosition] = (0, react_1.useState)({});
30
+ const tableSetRef = (0, react_1.useRef)(new Set());
31
+ const tableCellDOMNodeRef = (0, react_1.useRef)(null);
32
+ const debouncedOnMouseMove = (0, utils_2.useDebounce)((event) => {
33
+ const { isOutside, tableDOMNode } = getMouseInfo(event, getTheme);
34
+ if (isOutside) {
35
+ setShownRow(false);
36
+ setShownColumn(false);
37
+ return;
38
+ }
39
+ if (!tableDOMNode) {
40
+ return;
41
+ }
42
+ tableCellDOMNodeRef.current = tableDOMNode;
43
+ let hoveredRowNode = null;
44
+ let hoveredColumnNode = null;
45
+ let tableDOMElement = null;
46
+ editor.getEditorState().read(() => {
47
+ const maybeTableCell = (0, lexical_1.$getNearestNodeFromDOMNode)(tableDOMNode);
48
+ if ((0, table_1.$isTableCellNode)(maybeTableCell)) {
49
+ const table = (0, utils_1.$findMatchingParent)(maybeTableCell, node => (0, table_1.$isTableNode)(node));
50
+ if (!(0, table_1.$isTableNode)(table)) {
51
+ return;
52
+ }
53
+ tableDOMElement = (0, table_1.getTableElement)(table, editor.getElementByKey(table.getKey()));
54
+ if (tableDOMElement) {
55
+ const rowCount = table.getChildrenSize();
56
+ const firstRow = table.getFirstChild();
57
+ const colCount = (0, table_1.$isTableRowNode)(firstRow) ? firstRow.getChildrenSize() : 0;
58
+ const rowIndex = (0, table_1.$getTableRowIndexFromTableCellNode)(maybeTableCell);
59
+ const colIndex = (0, table_1.$getTableColumnIndexFromTableCellNode)(maybeTableCell);
60
+ if (rowIndex === rowCount - 1) {
61
+ hoveredRowNode = maybeTableCell;
62
+ }
63
+ else if (colIndex === colCount - 1) {
64
+ hoveredColumnNode = maybeTableCell;
65
+ }
66
+ }
67
+ }
68
+ }, { editor });
69
+ if (tableDOMElement) {
70
+ const { width: tableElemWidth, y: tableElemY, right: tableElemRight, left: tableElemLeft, bottom: tableElemBottom, height: tableElemHeight, } = tableDOMElement.getBoundingClientRect();
71
+ // Adjust for using the scrollable table container
72
+ const parentElement = tableDOMElement.parentElement;
73
+ let tableHasScroll = false;
74
+ if (parentElement === null || parentElement === void 0 ? void 0 : parentElement.classList.contains("PlaygroundEditorTheme__tableScrollableWrapper")) {
75
+ tableHasScroll = parentElement.scrollWidth > parentElement.clientWidth;
76
+ }
77
+ const { y: editorElemY, left: editorElemLeft } = anchorElem.getBoundingClientRect();
78
+ if (hoveredRowNode) {
79
+ setShownColumn(false);
80
+ setShownRow(true);
81
+ setPosition({
82
+ height: BUTTON_WIDTH_PX,
83
+ left: tableHasScroll && parentElement ? parentElement.offsetLeft : tableElemLeft - editorElemLeft,
84
+ top: tableElemBottom - editorElemY + 5,
85
+ width: tableHasScroll && parentElement ? parentElement.offsetWidth : tableElemWidth,
86
+ });
87
+ }
88
+ else if (hoveredColumnNode) {
89
+ setShownColumn(true);
90
+ setShownRow(false);
91
+ setPosition({
92
+ height: tableElemHeight,
93
+ left: tableElemRight - editorElemLeft + 5,
94
+ top: tableElemY - editorElemY,
95
+ width: BUTTON_WIDTH_PX,
96
+ });
97
+ }
98
+ }
99
+ }, 50, 250);
100
+ // Hide the buttons on any table dimensions change to prevent last row cells
101
+ // overlap behind the 'Add Row' button when text entry changes cell height
102
+ const tableResizeObserver = (0, react_1.useMemo)(() => {
103
+ return new ResizeObserver(() => {
104
+ setShownRow(false);
105
+ setShownColumn(false);
106
+ });
107
+ }, []);
108
+ (0, react_1.useEffect)(() => {
109
+ if (!shouldListenMouseMove) {
110
+ return;
111
+ }
112
+ document.addEventListener("mousemove", debouncedOnMouseMove);
113
+ return () => {
114
+ setShownRow(false);
115
+ setShownColumn(false);
116
+ debouncedOnMouseMove.cancel();
117
+ document.removeEventListener("mousemove", debouncedOnMouseMove);
118
+ };
119
+ }, [shouldListenMouseMove, debouncedOnMouseMove]);
120
+ (0, react_1.useEffect)(() => {
121
+ return (0, utils_1.mergeRegister)(editor.registerMutationListener(table_1.TableNode, mutations => {
122
+ editor.getEditorState().read(() => {
123
+ let resetObserver = false;
124
+ for (const [key, type] of mutations) {
125
+ switch (type) {
126
+ case "created": {
127
+ tableSetRef.current.add(key);
128
+ resetObserver = true;
129
+ break;
130
+ }
131
+ case "destroyed": {
132
+ tableSetRef.current.delete(key);
133
+ resetObserver = true;
134
+ break;
135
+ }
136
+ default:
137
+ break;
138
+ }
139
+ }
140
+ if (resetObserver) {
141
+ // Reset resize observers
142
+ tableResizeObserver.disconnect();
143
+ for (const tableKey of tableSetRef.current) {
144
+ const { tableElement } = (0, table_1.$getTableAndElementByKey)(tableKey);
145
+ tableResizeObserver.observe(tableElement);
146
+ }
147
+ setShouldListenMouseMove(tableSetRef.current.size > 0);
148
+ }
149
+ }, { editor });
150
+ }, { skipInitialization: false }));
151
+ }, [editor, tableResizeObserver]);
152
+ const insertAction = (insertRow) => {
153
+ editor.update(() => {
154
+ if (tableCellDOMNodeRef.current) {
155
+ const maybeTableNode = (0, lexical_1.$getNearestNodeFromDOMNode)(tableCellDOMNodeRef.current);
156
+ maybeTableNode === null || maybeTableNode === void 0 ? void 0 : maybeTableNode.selectEnd();
157
+ if (insertRow) {
158
+ (0, table_1.$insertTableRowAtSelection)();
159
+ setShownRow(false);
160
+ }
161
+ else {
162
+ (0, table_1.$insertTableColumnAtSelection)();
163
+ setShownColumn(false);
164
+ }
165
+ }
166
+ });
167
+ };
168
+ if (!isEditable) {
169
+ return null;
170
+ }
171
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [isShownRow && ((0, jsx_runtime_1.jsx)("button", { className: `${(_a = getTheme()) === null || _a === void 0 ? void 0 : _a.tableAddRows}`, style: Object.assign({}, position), onClick: () => insertAction(true) })), isShownColumn && ((0, jsx_runtime_1.jsx)("button", { className: `${(_b = getTheme()) === null || _b === void 0 ? void 0 : _b.tableAddColumns}`, style: Object.assign({}, position), onClick: () => insertAction(false) }))] }));
172
+ }
173
+ function getMouseInfo(event, getTheme) {
174
+ const target = event.target;
175
+ const tableCellClass = (0, getThemeSelector_1.getThemeSelector)(getTheme, "tableCell");
176
+ if ((0, lexical_1.isHTMLElement)(target)) {
177
+ const tableDOMNode = target.closest(`td${tableCellClass}, th${tableCellClass}`);
178
+ const isOutside = !(tableDOMNode ||
179
+ target.closest(`button${(0, getThemeSelector_1.getThemeSelector)(getTheme, "tableAddRows")}`) ||
180
+ target.closest(`button${(0, getThemeSelector_1.getThemeSelector)(getTheme, "tableAddColumns")}`) ||
181
+ target.closest("div.TableCellResizer__resizer"));
182
+ return { isOutside, tableDOMNode };
183
+ }
184
+ else {
185
+ return { isOutside: true, tableDOMNode: null };
186
+ }
187
+ }
188
+ const TableHoverActionsPlugin = ({ anchorElem = document.body, }) => {
189
+ const isEditable = (0, useLexicalEditable_1.useLexicalEditable)();
190
+ return isEditable ? (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(TableHoverActionsContainer, { anchorElem: anchorElem }), anchorElem) : null;
191
+ };
192
+ exports.TableHoverActionsPlugin = TableHoverActionsPlugin;
193
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src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S,IAAA,mCAAgB,EAAC,QAAQ,EAAE,cAAc,CAAC,EAAE,CAAC;YAClF,MAAM,CAAC,OAAO,CAAc,SAAS,IAAA,mCAAgB,EAAC,QAAQ,EAAE,iBAAiB,CAAC,EAAE,CAAC;YACrF,MAAM,CAAC,OAAO,CAAc,+BAA+B,CAAC,CAC7D,CAAC;QAEF,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;IACrC,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;IACjD,CAAC;AACH,CAAC;AAEM,MAAM,uBAAuB,GAAG,CAAC,EACtC,UAAU,GAAG,QAAQ,CAAC,IAAI,GAG3B,EAAsB,EAAE;IACvB,MAAM,UAAU,GAAG,IAAA,uCAAkB,GAAE,CAAC;IAExC,OAAO,UAAU,CAAC,CAAC,CAAC,IAAA,wBAAY,EAAC,uBAAC,0BAA0B,IAAC,UAAU,EAAE,UAAU,GAAI,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC9G,CAAC,CAAC;AARW,QAAA,uBAAuB,2BAQlC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import { JSX } from "react";
9
+ import { EditorThemeClasses, Klass, LexicalEditor, LexicalNode } from "lexical";
10
+ export type InsertTableCommandPayload = Readonly<{
11
+ columns: string;
12
+ rows: string;
13
+ includeHeaders?: boolean;
14
+ }>;
15
+ export interface ICellContextShape {
16
+ cellEditorConfig: null | CellEditorConfig;
17
+ cellEditorPlugins: null | JSX.Element | Array<JSX.Element>;
18
+ set: (cellEditorConfig: null | CellEditorConfig, cellEditorPlugins: null | JSX.Element | Array<JSX.Element>) => void;
19
+ }
20
+ export type CellEditorConfig = Readonly<{
21
+ namespace: string;
22
+ nodes?: ReadonlyArray<Klass<LexicalNode>>;
23
+ onError: (error: Error, editor: LexicalEditor) => void;
24
+ readOnly?: boolean;
25
+ theme?: EditorThemeClasses;
26
+ }>;
27
+ export declare const CellContext: import("react").Context<ICellContextShape>;
28
+ export declare function TableContext({ children }: {
29
+ children: JSX.Element;
30
+ }): import("react/jsx-runtime").JSX.Element;
31
+ export declare function InsertTableDialog({ activeEditor, onClose, }: {
32
+ activeEditor: LexicalEditor;
33
+ onClose: () => void;
34
+ }): JSX.Element;
35
+ export declare const TablePlugin: ({ cellEditorConfig, children, }: {
36
+ cellEditorConfig: CellEditorConfig;
37
+ children: JSX.Element | Array<JSX.Element>;
38
+ }) => JSX.Element | null;