reactjs-tiptap-editor 0.4.1 → 1.0.0

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 (338) hide show
  1. package/lib/ActionMenuButton-BKOg7hkq.js +38 -0
  2. package/lib/ActionMenuButton-DLQyd_gx.cjs +1 -0
  3. package/lib/Attachment.cjs +2 -2
  4. package/lib/Attachment.d.cts +43 -55
  5. package/lib/Attachment.d.ts +43 -55
  6. package/lib/Attachment.js +129 -99
  7. package/lib/Blockquote.cjs +3 -3
  8. package/lib/Blockquote.d.cts +43 -55
  9. package/lib/Blockquote.d.ts +43 -55
  10. package/lib/Blockquote.js +50 -22
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +43 -55
  13. package/lib/Bold.d.ts +43 -55
  14. package/lib/Bold.js +48 -20
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +43 -55
  17. package/lib/BulletList.d.ts +43 -55
  18. package/lib/BulletList.js +38 -9
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +43 -55
  21. package/lib/Clear.d.ts +43 -55
  22. package/lib/Clear.js +32 -6
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +43 -55
  25. package/lib/Code.d.ts +43 -55
  26. package/lib/Code.js +53 -25
  27. package/lib/CodeBlock.cjs +35 -35
  28. package/lib/CodeBlock.d.cts +43 -55
  29. package/lib/CodeBlock.d.ts +43 -55
  30. package/lib/CodeBlock.js +605 -590
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +44 -56
  33. package/lib/CodeView.d.ts +44 -56
  34. package/lib/CodeView.js +49 -21
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +47 -55
  37. package/lib/Color.d.ts +47 -55
  38. package/lib/Color.js +123 -79
  39. package/lib/Column.cjs +1 -0
  40. package/lib/{Document.d.cts → Column.d.cts} +49 -58
  41. package/lib/{Document.d.ts → Column.d.ts} +49 -58
  42. package/lib/Column.js +217 -0
  43. package/lib/{Drawer-CaAfmqNo.js → Drawer-DZ5jvmrX.js} +404 -394
  44. package/lib/Drawer-SRhwOc6T.cjs +1 -0
  45. package/lib/Drawer.cjs +1 -1
  46. package/lib/Drawer.d.cts +43 -55
  47. package/lib/Drawer.d.ts +43 -55
  48. package/lib/Drawer.js +6 -5
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +43 -60
  51. package/lib/Emoji.d.ts +43 -60
  52. package/lib/Emoji.js +377 -392
  53. package/lib/Excalidraw-DwBRXEtC.js +345 -0
  54. package/lib/Excalidraw-ZN3DQvDC.cjs +1 -0
  55. package/lib/Excalidraw.cjs +1 -1
  56. package/lib/Excalidraw.d.cts +43 -55
  57. package/lib/Excalidraw.d.ts +43 -55
  58. package/lib/Excalidraw.js +6 -4
  59. package/lib/ExportPdf.cjs +5 -5
  60. package/lib/ExportPdf.d.cts +43 -55
  61. package/lib/ExportPdf.d.ts +43 -55
  62. package/lib/ExportPdf.js +60 -32
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +44 -56
  65. package/lib/ExportWord.d.ts +44 -56
  66. package/lib/ExportWord.js +84 -21
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +57 -58
  69. package/lib/FontFamily.d.ts +57 -58
  70. package/lib/FontFamily.js +72 -74
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +54 -58
  73. package/lib/FontSize.d.ts +54 -58
  74. package/lib/FontSize.js +72 -64
  75. package/lib/Heading.cjs +1 -1
  76. package/lib/Heading.d.cts +57 -55
  77. package/lib/Heading.d.ts +57 -55
  78. package/lib/Heading.js +91 -73
  79. package/lib/Highlight.cjs +1 -1
  80. package/lib/Highlight.d.cts +47 -55
  81. package/lib/Highlight.d.ts +47 -55
  82. package/lib/Highlight.js +152 -21
  83. package/lib/History.cjs +1 -1
  84. package/lib/History.d.cts +45 -55
  85. package/lib/History.d.ts +45 -55
  86. package/lib/History.js +976 -53
  87. package/lib/HorizontalRule.cjs +1 -1
  88. package/lib/HorizontalRule.d.cts +43 -55
  89. package/lib/HorizontalRule.d.ts +43 -55
  90. package/lib/HorizontalRule.js +97 -17
  91. package/lib/Icon-DUpv2cI6.cjs +1 -0
  92. package/lib/Icon-jKs8Hr6p.js +11 -0
  93. package/lib/Iframe-CmXkEqOd.js +431 -0
  94. package/lib/Iframe-Cvca2G7X.cjs +1 -0
  95. package/lib/Iframe.cjs +1 -1
  96. package/lib/Iframe.d.cts +42 -61
  97. package/lib/Iframe.d.ts +42 -61
  98. package/lib/Iframe.js +6 -4
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +43 -56
  101. package/lib/Image.d.ts +43 -56
  102. package/lib/Image.js +848 -5
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +44 -58
  105. package/lib/ImageGif.d.ts +44 -58
  106. package/lib/ImageGif.js +424 -5
  107. package/lib/ImportWord.cjs +48 -48
  108. package/lib/ImportWord.d.cts +44 -56
  109. package/lib/ImportWord.d.ts +44 -56
  110. package/lib/ImportWord.js +2596 -2588
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +43 -55
  113. package/lib/Indent.d.ts +43 -55
  114. package/lib/Indent.js +97 -27
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +43 -55
  117. package/lib/Italic.d.ts +43 -55
  118. package/lib/Italic.js +47 -19
  119. package/lib/Katex-DsYXsjSS.js +2740 -0
  120. package/lib/Katex-XfrNne6U.cjs +4 -0
  121. package/lib/Katex.cjs +1 -1
  122. package/lib/Katex.d.cts +43 -55
  123. package/lib/Katex.d.ts +43 -55
  124. package/lib/Katex.js +5 -196
  125. package/lib/LineHeight.cjs +1 -1
  126. package/lib/LineHeight.d.cts +45 -61
  127. package/lib/LineHeight.d.ts +45 -61
  128. package/lib/LineHeight.js +71 -112
  129. package/lib/Link.cjs +1 -1
  130. package/lib/Link.d.cts +44 -58
  131. package/lib/Link.d.ts +44 -58
  132. package/lib/Link.js +3 -3
  133. package/lib/LinkEditBlock-BZenZq-Z.cjs +5 -0
  134. package/lib/LinkEditBlock-CB8yIffE.js +1241 -0
  135. package/lib/Mention.cjs +1 -1
  136. package/lib/Mention.d.cts +40 -55
  137. package/lib/Mention.d.ts +40 -55
  138. package/lib/Mention.js +114 -130
  139. package/lib/Mermaid.cjs +2 -2
  140. package/lib/Mermaid.d.cts +43 -55
  141. package/lib/Mermaid.d.ts +43 -55
  142. package/lib/Mermaid.js +177 -165
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +58 -57
  145. package/lib/MoreMark.d.ts +58 -57
  146. package/lib/MoreMark.js +125 -55
  147. package/lib/OrderedList.cjs +1 -1
  148. package/lib/OrderedList.d.cts +43 -55
  149. package/lib/OrderedList.d.ts +43 -55
  150. package/lib/OrderedList.js +37 -9
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +43 -58
  153. package/lib/SearchAndReplace.d.ts +43 -58
  154. package/lib/SearchAndReplace.js +221 -197
  155. package/lib/SlashCommand.cjs +1 -1
  156. package/lib/SlashCommand.d.cts +55 -62
  157. package/lib/SlashCommand.d.ts +55 -62
  158. package/lib/SlashCommand.js +235 -249
  159. package/lib/Strike.cjs +1 -1
  160. package/lib/Strike.d.cts +43 -55
  161. package/lib/Strike.d.ts +43 -55
  162. package/lib/Strike.js +39 -11
  163. package/lib/Table-B1j1Ebmh.cjs +9 -0
  164. package/lib/Table-Db8TcQX8.js +1984 -0
  165. package/lib/Table.cjs +1 -9
  166. package/lib/Table.d.cts +44 -58
  167. package/lib/Table.d.ts +44 -58
  168. package/lib/Table.js +3 -558
  169. package/lib/TaskList.cjs +1 -1
  170. package/lib/TaskList.d.cts +43 -55
  171. package/lib/TaskList.d.ts +43 -55
  172. package/lib/TaskList.js +38 -10
  173. package/lib/TextAlign.cjs +1 -1
  174. package/lib/TextAlign.d.cts +56 -55
  175. package/lib/TextAlign.d.ts +56 -55
  176. package/lib/TextAlign.js +108 -101
  177. package/lib/TextDirection.cjs +1 -1
  178. package/lib/TextDirection.d.cts +72 -55
  179. package/lib/TextDirection.d.ts +72 -55
  180. package/lib/TextDirection.js +105 -112
  181. package/lib/TextUnderline.cjs +1 -1
  182. package/lib/TextUnderline.d.cts +43 -55
  183. package/lib/TextUnderline.d.ts +43 -55
  184. package/lib/TextUnderline.js +46 -18
  185. package/lib/{Twitter-BFULyqdR.js → Twitter-CXmmjz9R.js} +536 -498
  186. package/lib/Twitter-CtVTIWJW.cjs +1 -0
  187. package/lib/Twitter.cjs +1 -1
  188. package/lib/Twitter.d.cts +43 -55
  189. package/lib/Twitter.d.ts +43 -55
  190. package/lib/Twitter.js +5 -4
  191. package/lib/Video.cjs +1 -1
  192. package/lib/Video.d.cts +43 -55
  193. package/lib/Video.d.ts +43 -55
  194. package/lib/Video.js +261 -4
  195. package/lib/_commonjsHelpers-BItOPCY9.js +28 -0
  196. package/lib/_commonjsHelpers-BTDuMlIz.cjs +1 -0
  197. package/lib/bubble.cjs +2 -0
  198. package/lib/{bubble-extra.d.cts → bubble.d.cts} +69 -70
  199. package/lib/{bubble-extra.d.ts → bubble.d.ts} +69 -70
  200. package/lib/bubble.js +1925 -0
  201. package/lib/button-B12K7BJ4.cjs +1 -0
  202. package/lib/button-DXMsXUEn.js +43 -0
  203. package/lib/clsx-C11secjj.cjs +1 -0
  204. package/lib/clsx-OuTLNxxd.js +16 -0
  205. package/lib/delete-node-CosiBes5.cjs +1 -0
  206. package/lib/delete-node-IyVmiRbI.js +22 -0
  207. package/lib/dialog-CaCS-W5S.cjs +1 -0
  208. package/lib/dialog-PtQivpHS.js +100 -0
  209. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  210. package/lib/dom-dataset-CIEeltF6.js +47 -0
  211. package/lib/dropdown-menu-BPp2Z_U-.js +136 -0
  212. package/lib/dropdown-menu-CdSm4emp.cjs +1 -0
  213. package/lib/file-BLas99n7.js +43 -0
  214. package/lib/file-i7e4nQY2.cjs +1 -0
  215. package/lib/floating-ui.dom-U1vPFQ5f.js +1151 -0
  216. package/lib/floating-ui.dom-VCrc58uF.cjs +1 -0
  217. package/lib/icons-Cllpys39.js +362 -0
  218. package/lib/icons-CqHjeW5T.cjs +1 -0
  219. package/lib/index-BH4bc3jN.cjs +33 -0
  220. package/lib/index-BPfVXs5_.js +2380 -0
  221. package/lib/index-Bnmd0WvY.js +1631 -0
  222. package/lib/{index-Ch6dBBad.js → index-CBce_TWY.js} +40 -42
  223. package/lib/{index-5iBZLua9.cjs → index-D-5U8dY8.cjs} +8 -8
  224. package/lib/{index-ByurDDMv.js → index-D2TUfKkC.js} +2 -2
  225. package/lib/index-DV5kbgRU.cjs +1 -0
  226. package/lib/{index-LmrOdnen.js → index-DYkucCoF.js} +396 -495
  227. package/lib/index-Dfmm6FTT.cjs +1 -0
  228. package/lib/index-DnWWK9F_.js +6374 -0
  229. package/lib/index-DzcKxutn.js +632 -0
  230. package/lib/index-DzvuNTxo.cjs +4 -0
  231. package/lib/{index-BeCTd5v2.cjs → index-N--9MohJ.cjs} +1 -1
  232. package/lib/index-RfTlOzIr.cjs +22 -0
  233. package/lib/index.cjs +132 -1
  234. package/lib/index.d.cts +45 -296
  235. package/lib/index.d.ts +45 -296
  236. package/lib/index.js +243 -2
  237. package/lib/input-_ECRfn3Y.cjs +1 -0
  238. package/lib/input-wJ9PDEzZ.js +21 -0
  239. package/lib/isNumber-ClPupm7P.cjs +1 -0
  240. package/lib/isNumber-fpLGS0AZ.js +15 -0
  241. package/lib/label-BkgAe7IY.cjs +1 -0
  242. package/lib/label-CGdLYWv7.js +19 -0
  243. package/lib/locale-bundle.cjs +1 -1
  244. package/lib/locale-bundle.d.cts +5421 -73
  245. package/lib/locale-bundle.d.ts +5421 -73
  246. package/lib/locale-bundle.js +9 -7
  247. package/lib/popover-BgmUNMHj.cjs +1 -0
  248. package/lib/popover-CAuEW0Mr.js +23 -0
  249. package/lib/separator-CuBW_w98.js +328 -0
  250. package/lib/separator-DRIrVZ2N.cjs +1 -0
  251. package/lib/store-DX599H5W.js +10 -0
  252. package/lib/store-WStcMOiW.cjs +1 -0
  253. package/lib/style.css +1 -1
  254. package/lib/switch-CnLJ7Y-b.cjs +1 -0
  255. package/lib/switch-Coix_FA1.js +27 -0
  256. package/lib/tabs-B5mVSN1I.js +46 -0
  257. package/lib/tabs-BoLCMcCI.cjs +1 -0
  258. package/lib/textarea-B-6zTKQz.cjs +1 -0
  259. package/lib/{textarea-aPtytkDx.js → textarea-DUUM1jZd.js} +1 -1
  260. package/lib/theme-B7aAsK_T.js +15 -0
  261. package/lib/theme-D8_cxGqB.cjs +1 -0
  262. package/lib/throttle-CdwDrFpn.js +249 -0
  263. package/lib/throttle-qX7Yjtsg.cjs +1 -0
  264. package/lib/toggle-Cdp4IT2U.js +85 -0
  265. package/lib/toggle-D41PzQLJ.cjs +1 -0
  266. package/lib/tooltip-BuEiE96N.cjs +1 -0
  267. package/lib/tooltip-CopwsU8q.js +23 -0
  268. package/lib/updatePosition-8Sdem5jb.cjs +1 -0
  269. package/lib/updatePosition-BPmcE0YD.js +215 -0
  270. package/lib/use-toast-Bz3QCOtE.cjs +1 -0
  271. package/lib/use-toast-Crf7-q5H.js +98 -0
  272. package/lib/useButtonProps-BsEd4zYM.js +141 -0
  273. package/lib/useButtonProps-C6Vpn190.cjs +1 -0
  274. package/package.json +22 -105
  275. package/lib/ActionMenuButton-CYdM1xx5.cjs +0 -1
  276. package/lib/ActionMenuButton-DKRF6oa0.js +0 -33
  277. package/lib/BaseKit.cjs +0 -3
  278. package/lib/BaseKit.d.cts +0 -481
  279. package/lib/BaseKit.d.ts +0 -481
  280. package/lib/BaseKit.js +0 -132
  281. package/lib/Document.cjs +0 -1
  282. package/lib/Document.js +0 -9
  283. package/lib/Drawer-CdvCMSzN.cjs +0 -1
  284. package/lib/Excalidraw-BbMQhNvs.cjs +0 -1
  285. package/lib/Excalidraw-CVWz2Vyn.js +0 -290
  286. package/lib/FormatPainter.cjs +0 -1
  287. package/lib/FormatPainter.d.cts +0 -372
  288. package/lib/FormatPainter.d.ts +0 -372
  289. package/lib/FormatPainter.js +0 -76
  290. package/lib/ListItem.cjs +0 -1
  291. package/lib/ListItem.d.cts +0 -290
  292. package/lib/ListItem.d.ts +0 -290
  293. package/lib/ListItem.js +0 -7
  294. package/lib/MultiColumn.cjs +0 -1
  295. package/lib/MultiColumn.d.cts +0 -294
  296. package/lib/MultiColumn.d.ts +0 -294
  297. package/lib/MultiColumn.js +0 -8
  298. package/lib/RichTextEditor-CxvwGvQG.cjs +0 -142
  299. package/lib/RichTextEditor-DGcKEUGr.js +0 -22166
  300. package/lib/Selection.cjs +0 -1
  301. package/lib/Selection.d.cts +0 -289
  302. package/lib/Selection.d.ts +0 -289
  303. package/lib/Selection.js +0 -25
  304. package/lib/SubAndSuperScript.cjs +0 -1
  305. package/lib/SubAndSuperScript.d.cts +0 -377
  306. package/lib/SubAndSuperScript.d.ts +0 -377
  307. package/lib/SubAndSuperScript.js +0 -43
  308. package/lib/TableOfContent.cjs +0 -1
  309. package/lib/TableOfContent.d.cts +0 -291
  310. package/lib/TableOfContent.d.ts +0 -291
  311. package/lib/TableOfContent.js +0 -185
  312. package/lib/TextBubble.cjs +0 -1
  313. package/lib/TextBubble.d.cts +0 -362
  314. package/lib/TextBubble.d.ts +0 -362
  315. package/lib/TextBubble.js +0 -133
  316. package/lib/TrailingNode.cjs +0 -1
  317. package/lib/TrailingNode.d.cts +0 -297
  318. package/lib/TrailingNode.d.ts +0 -297
  319. package/lib/TrailingNode.js +0 -41
  320. package/lib/Twitter-Cutpkh3h.cjs +0 -1
  321. package/lib/bubble-extra.cjs +0 -2
  322. package/lib/bubble-extra.js +0 -631
  323. package/lib/dom-dataset-_6-diIRQ.cjs +0 -33
  324. package/lib/dom-dataset-lYeH6gfI.js +0 -2361
  325. package/lib/index-6D1J-A-o.cjs +0 -1
  326. package/lib/index-B96Cclrj.cjs +0 -3
  327. package/lib/index-BBz7Nmv9.js +0 -55
  328. package/lib/index-CUogRI7j.cjs +0 -1
  329. package/lib/index-DF2Lp4HZ.cjs +0 -100
  330. package/lib/index-D_L6n8O8.js +0 -76
  331. package/lib/index-Dbvi-Bvh.cjs +0 -1
  332. package/lib/index-DpCrt7xs.cjs +0 -1
  333. package/lib/index-DsAX1Vq8.cjs +0 -1
  334. package/lib/index-Dy4DlW9o.js +0 -12
  335. package/lib/index-J3jHHZ4d.js +0 -200
  336. package/lib/index-VvXaaKe3.js +0 -898
  337. package/lib/index-kbO3iWqL.js +0 -13432
  338. package/lib/textarea-DFo_aXnj.cjs +0 -1
package/lib/Table.js CHANGED
@@ -1,560 +1,5 @@
1
- import { N as R, m as H, B as U, C as Z, T as q, E as j, H as X } from "./index-kbO3iWqL.js";
2
- import { a2 as J, a3 as Q, a4 as W, a5 as Y, a6 as N, a7 as ee, a8 as _, a9 as B, aa as te, ab as $, ac as re, ad as le, ae as ne, af as oe, ag as ae, ah as ie, ai as se, P as ce, o as de, p as ue, A as he } from "./RichTextEditor-DGcKEUGr.js";
3
- import { jsxs as S, jsx as T } from "react/jsx-runtime";
4
- import { useState as k } from "react";
5
- import { T as y, p as A, q as M } from "./index-LmrOdnen.js";
6
- var G = R.create({
7
- name: "tableCell",
8
- addOptions() {
9
- return {
10
- HTMLAttributes: {}
11
- };
12
- },
13
- content: "block+",
14
- addAttributes() {
15
- return {
16
- colspan: {
17
- default: 1
18
- },
19
- rowspan: {
20
- default: 1
21
- },
22
- colwidth: {
23
- default: null,
24
- parseHTML: (e) => {
25
- var t, l;
26
- const r = e.getAttribute("colwidth"), o = r ? r.split(",").map((n) => parseInt(n, 10)) : null;
27
- if (!o) {
28
- const n = (t = e.closest("table")) == null ? void 0 : t.querySelectorAll("colgroup > col"), a = Array.from(((l = e.parentElement) == null ? void 0 : l.children) || []).indexOf(e);
29
- if (a && a > -1 && n && n[a]) {
30
- const i = n[a].getAttribute("width");
31
- return i ? [parseInt(i, 10)] : null;
32
- }
33
- }
34
- return o;
35
- }
36
- }
37
- };
38
- },
39
- tableRole: "cell",
40
- isolating: !0,
41
- parseHTML() {
42
- return [{ tag: "td" }];
43
- },
44
- renderHTML({ HTMLAttributes: e }) {
45
- return ["td", H(this.options.HTMLAttributes, e), 0];
46
- }
47
- }), V = R.create({
48
- name: "tableHeader",
49
- addOptions() {
50
- return {
51
- HTMLAttributes: {}
52
- };
53
- },
54
- content: "block+",
55
- addAttributes() {
56
- return {
57
- colspan: {
58
- default: 1
59
- },
60
- rowspan: {
61
- default: 1
62
- },
63
- colwidth: {
64
- default: null,
65
- parseHTML: (e) => {
66
- const t = e.getAttribute("colwidth");
67
- return t ? t.split(",").map((r) => parseInt(r, 10)) : null;
68
- }
69
- }
70
- };
71
- },
72
- tableRole: "header_cell",
73
- isolating: !0,
74
- parseHTML() {
75
- return [{ tag: "th" }];
76
- },
77
- renderHTML({ HTMLAttributes: e }) {
78
- return ["th", H(this.options.HTMLAttributes, e), 0];
79
- }
80
- }), F = R.create({
81
- name: "tableRow",
82
- addOptions() {
83
- return {
84
- HTMLAttributes: {}
85
- };
86
- },
87
- content: "(tableCell | tableHeader)*",
88
- tableRole: "row",
89
- parseHTML() {
90
- return [{ tag: "tr" }];
91
- },
92
- renderHTML({ HTMLAttributes: e }) {
93
- return ["tr", H(this.options.HTMLAttributes, e), 0];
94
- }
95
- });
96
- function L(e, t) {
97
- return t ? ["width", `${Math.max(t, e)}px`] : ["min-width", `${e}px`];
98
- }
99
- function I(e, t, l, r, o, n) {
100
- var a;
101
- let i = 0, g = !0, c = t.firstChild;
102
- const p = e.firstChild;
103
- if (p !== null)
104
- for (let f = 0, b = 0; f < p.childCount; f += 1) {
105
- const { colspan: u, colwidth: h } = p.child(f).attrs;
106
- for (let s = 0; s < u; s += 1, b += 1) {
107
- const m = o === b ? n : h && h[s], C = m ? `${m}px` : "";
108
- if (i += m || r, m || (g = !1), c) {
109
- if (c.style.width !== C) {
110
- const [w, x] = L(r, m);
111
- c.style.setProperty(w, x);
112
- }
113
- c = c.nextSibling;
114
- } else {
115
- const w = document.createElement("col"), [x, E] = L(r, m);
116
- w.style.setProperty(x, E), t.appendChild(w);
117
- }
118
- }
119
- }
120
- for (; c; ) {
121
- const f = c.nextSibling;
122
- (a = c.parentNode) == null || a.removeChild(c), c = f;
123
- }
124
- const d = e.attrs.style && typeof e.attrs.style == "string" && /\bwidth\s*:/i.test(e.attrs.style);
125
- g && !d ? (l.style.width = `${i}px`, l.style.minWidth = "") : (l.style.width = "", l.style.minWidth = `${i}px`);
126
- }
127
- var fe = class {
128
- constructor(e, t) {
129
- this.node = e, this.cellMinWidth = t, this.dom = document.createElement("div"), this.dom.className = "tableWrapper", this.table = this.dom.appendChild(document.createElement("table")), e.attrs.style && (this.table.style.cssText = e.attrs.style), this.colgroup = this.table.appendChild(document.createElement("colgroup")), I(e, this.colgroup, this.table, t), this.contentDOM = this.table.appendChild(document.createElement("tbody"));
130
- }
131
- update(e) {
132
- return e.type !== this.node.type ? !1 : (this.node = e, I(e, this.colgroup, this.table, this.cellMinWidth), !0);
133
- }
134
- ignoreMutation(e) {
135
- const t = e.target, l = this.dom.contains(t), r = this.contentDOM.contains(t);
136
- return !!(l && !r && (e.type === "attributes" || e.type === "childList" || e.type === "characterData"));
137
- }
138
- };
139
- function be(e, t, l, r) {
140
- let o = 0, n = !0;
141
- const a = [], i = e.firstChild;
142
- if (!i)
143
- return {};
144
- for (let d = 0, f = 0; d < i.childCount; d += 1) {
145
- const { colspan: b, colwidth: u } = i.child(d).attrs;
146
- for (let h = 0; h < b; h += 1, f += 1) {
147
- const s = l === f ? r : u && u[h];
148
- o += s || t, s || (n = !1);
149
- const [m, C] = L(t, s);
150
- a.push(["col", { style: `${m}: ${C}` }]);
151
- }
152
- }
153
- const g = n ? `${o}px` : "", c = n ? "" : `${o}px`;
154
- return { colgroup: ["colgroup", {}, ...a], tableWidth: g, tableMinWidth: c };
155
- }
156
- function O(e, t) {
157
- return e.createAndFill();
158
- }
159
- function pe(e) {
160
- if (e.cached.tableNodeTypes)
161
- return e.cached.tableNodeTypes;
162
- const t = {};
163
- return Object.keys(e.nodes).forEach((l) => {
164
- const r = e.nodes[l];
165
- r.spec.tableRole && (t[r.spec.tableRole] = r);
166
- }), e.cached.tableNodeTypes = t, t;
167
- }
168
- function me(e, t, l, r, o) {
169
- const n = pe(e), a = [], i = [];
170
- for (let c = 0; c < l; c += 1) {
171
- const p = O(n.cell);
172
- if (p && i.push(p), r) {
173
- const d = O(n.header_cell);
174
- d && a.push(d);
175
- }
176
- }
177
- const g = [];
178
- for (let c = 0; c < t; c += 1)
179
- g.push(n.row.createChecked(null, r && c === 0 ? a : i));
180
- return n.table.createChecked(null, g);
181
- }
182
- function ge(e) {
183
- return e instanceof W;
184
- }
185
- var v = ({ editor: e }) => {
186
- const { selection: t } = e.state;
187
- if (!ge(t))
188
- return !1;
189
- let l = 0;
190
- const r = X(t.ranges[0].$from, (n) => n.type.name === "table");
191
- return r == null || r.node.descendants((n) => {
192
- if (n.type.name === "table")
193
- return !1;
194
- ["tableCell", "tableHeader"].includes(n.type.name) && (l += 1);
195
- }), l === t.ranges.length ? (e.commands.deleteTable(), !0) : !1;
196
- }, Ce = "";
197
- function Te(e) {
198
- return (e || "").replace(/\s+/g, " ").trim();
199
- }
200
- function we(e, t, l = {}) {
201
- var r;
202
- const o = (r = l.cellLineSeparator) != null ? r : Ce;
203
- if (!e || !e.content || e.content.length === 0)
204
- return "";
205
- const n = [];
206
- e.content.forEach((u) => {
207
- const h = [];
208
- u.content && u.content.forEach((s) => {
209
- let m = "";
210
- s.content && Array.isArray(s.content) && s.content.length > 1 ? m = s.content.map((E) => t.renderChildren(E)).join(o) : m = s.content ? t.renderChildren(s.content) : "";
211
- const C = Te(m), w = s.type === "tableHeader";
212
- h.push({ text: C, isHeader: w });
213
- }), n.push(h);
214
- });
215
- const a = n.reduce((u, h) => Math.max(u, h.length), 0);
216
- if (a === 0)
217
- return "";
218
- const i = new Array(a).fill(0);
219
- n.forEach((u) => {
220
- var h;
221
- for (let s = 0; s < a; s += 1) {
222
- const C = (((h = u[s]) == null ? void 0 : h.text) || "").length;
223
- C > i[s] && (i[s] = C), i[s] < 3 && (i[s] = 3);
224
- }
225
- });
226
- const g = (u, h) => u + " ".repeat(Math.max(0, h - u.length)), c = n[0], p = c.some((u) => u.isHeader);
227
- let d = `
228
- `;
229
- const f = new Array(a).fill(0).map((u, h) => p && c[h] && c[h].text || "");
230
- return d += `| ${f.map((u, h) => g(u, i[h])).join(" | ")} |
231
- `, d += `| ${i.map((u) => "-".repeat(Math.max(3, u))).join(" | ")} |
232
- `, (p ? n.slice(1) : n).forEach((u) => {
233
- d += `| ${new Array(a).fill(0).map((h, s) => g(u[s] && u[s].text || "", i[s])).join(" | ")} |
234
- `;
235
- }), d;
236
- }
237
- var xe = we, K = R.create({
238
- name: "table",
239
- // @ts-ignore
240
- addOptions() {
241
- return {
242
- HTMLAttributes: {},
243
- resizable: !1,
244
- renderWrapper: !1,
245
- handleWidth: 5,
246
- cellMinWidth: 25,
247
- // TODO: fix
248
- View: fe,
249
- lastColumnResizable: !0,
250
- allowTableNodeSelection: !1
251
- };
252
- },
253
- content: "tableRow+",
254
- tableRole: "table",
255
- isolating: !0,
256
- group: "block",
257
- parseHTML() {
258
- return [{ tag: "table" }];
259
- },
260
- renderHTML({ node: e, HTMLAttributes: t }) {
261
- const { colgroup: l, tableWidth: r, tableMinWidth: o } = be(e, this.options.cellMinWidth), n = t.style;
262
- function a() {
263
- return n || (r ? `width: ${r}` : `min-width: ${o}`);
264
- }
265
- const i = [
266
- "table",
267
- H(this.options.HTMLAttributes, t, {
268
- style: a()
269
- }),
270
- l,
271
- ["tbody", 0]
272
- ];
273
- return this.options.renderWrapper ? ["div", { class: "tableWrapper" }, i] : i;
274
- },
275
- parseMarkdown: (e, t) => {
276
- const l = [];
277
- if (e.header) {
278
- const r = [];
279
- e.header.forEach((o) => {
280
- r.push(t.createNode("tableHeader", {}, [{ type: "paragraph", content: t.parseInline(o.tokens) }]));
281
- }), l.push(t.createNode("tableRow", {}, r));
282
- }
283
- return e.rows && e.rows.forEach((r) => {
284
- const o = [];
285
- r.forEach((n) => {
286
- o.push(t.createNode("tableCell", {}, [{ type: "paragraph", content: t.parseInline(n.tokens) }]));
287
- }), l.push(t.createNode("tableRow", {}, o));
288
- }), t.createNode("table", void 0, l);
289
- },
290
- renderMarkdown: (e, t) => xe(e, t),
291
- addCommands() {
292
- return {
293
- insertTable: ({ rows: e = 3, cols: t = 3, withHeaderRow: l = !0 } = {}) => ({ tr: r, dispatch: o, editor: n }) => {
294
- const a = me(n.schema, e, t, l);
295
- if (o) {
296
- const i = r.selection.from + 1;
297
- r.replaceSelectionWith(a).scrollIntoView().setSelection(q.near(r.doc.resolve(i)));
298
- }
299
- return !0;
300
- },
301
- addColumnBefore: () => ({ state: e, dispatch: t }) => se(e, t),
302
- addColumnAfter: () => ({ state: e, dispatch: t }) => ie(e, t),
303
- deleteColumn: () => ({ state: e, dispatch: t }) => ae(e, t),
304
- addRowBefore: () => ({ state: e, dispatch: t }) => oe(e, t),
305
- addRowAfter: () => ({ state: e, dispatch: t }) => ne(e, t),
306
- deleteRow: () => ({ state: e, dispatch: t }) => le(e, t),
307
- deleteTable: () => ({ state: e, dispatch: t }) => re(e, t),
308
- mergeCells: () => ({ state: e, dispatch: t }) => _(e, t),
309
- splitCell: () => ({ state: e, dispatch: t }) => B(e, t),
310
- toggleHeaderColumn: () => ({ state: e, dispatch: t }) => $("column")(e, t),
311
- toggleHeaderRow: () => ({ state: e, dispatch: t }) => $("row")(e, t),
312
- toggleHeaderCell: () => ({ state: e, dispatch: t }) => te(e, t),
313
- mergeOrSplit: () => ({ state: e, dispatch: t }) => _(e, t) ? !0 : B(e, t),
314
- setCellAttribute: (e, t) => ({ state: l, dispatch: r }) => ee(e, t)(l, r),
315
- goToNextCell: () => ({ state: e, dispatch: t }) => N(1)(e, t),
316
- goToPreviousCell: () => ({ state: e, dispatch: t }) => N(-1)(e, t),
317
- fixTables: () => ({ state: e, dispatch: t }) => (t && Y(e), !0),
318
- setCellSelection: (e) => ({ tr: t, dispatch: l }) => {
319
- if (l) {
320
- const r = W.create(t.doc, e.anchorCell, e.headCell);
321
- t.setSelection(r);
322
- }
323
- return !0;
324
- }
325
- };
326
- },
327
- addKeyboardShortcuts() {
328
- return {
329
- Tab: () => this.editor.commands.goToNextCell() ? !0 : this.editor.can().addRowAfter() ? this.editor.chain().addRowAfter().goToNextCell().run() : !1,
330
- "Shift-Tab": () => this.editor.commands.goToPreviousCell(),
331
- Backspace: v,
332
- "Mod-Backspace": v,
333
- Delete: v,
334
- "Mod-Delete": v
335
- };
336
- },
337
- addProseMirrorPlugins() {
338
- return [
339
- ...this.options.resizable && this.editor.isEditable ? [
340
- J({
341
- handleWidth: this.options.handleWidth,
342
- cellMinWidth: this.options.cellMinWidth,
343
- defaultCellMinWidth: this.options.cellMinWidth,
344
- View: this.options.View,
345
- lastColumnResizable: this.options.lastColumnResizable
346
- })
347
- ] : [],
348
- Q({
349
- allowTableNodeSelection: this.options.allowTableNodeSelection
350
- })
351
- ];
352
- },
353
- extendNodeSchema(e) {
354
- const t = {
355
- name: e.name,
356
- options: e.options,
357
- storage: e.storage
358
- };
359
- return {
360
- tableRole: U(Z(e, "tableRole", t))
361
- };
362
- }
363
- });
364
- j.create({
365
- name: "tableKit",
366
- addExtensions() {
367
- const e = [];
368
- return this.options.table !== !1 && e.push(K.configure(this.options.table)), this.options.tableCell !== !1 && e.push(G.configure(this.options.tableCell)), this.options.tableHeader !== !1 && e.push(V.configure(this.options.tableHeader)), this.options.tableRow !== !1 && e.push(F.configure(this.options.tableRow)), e;
369
- }
370
- });
371
- const ye = /(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i, Ae = /CrOS/, Me = /android|ipad|playbook|silk/i;
372
- function z(e = {}) {
373
- let t = e.ua || typeof navigator < "u" && navigator.userAgent;
374
- return t && typeof t == "object" && t.headers && typeof t.headers["user-agent"] == "string" && (t = t.headers["user-agent"]), typeof t != "string" ? !1 : !!(ye.test(t) && !Ae.test(t) || e.tablet && Me.test(t) || e.tablet && e.featureDetect && navigator && navigator.maxTouchPoints > 1 && t.includes("Macintosh") && t.includes("Safari"));
375
- }
376
- const D = (e) => Array.from({ length: e }).map((t, l) => l + 1);
377
- function ve(e) {
378
- var p;
379
- const [t, l] = k(!0), [r, o] = k({
380
- rows: z() ? y : A,
381
- cols: z() ? y : A
382
- }), [n, a] = k({
383
- rows: M,
384
- cols: M
385
- });
386
- function i(d, f) {
387
- d === r.rows && o((b) => ({
388
- ...b,
389
- rows: Math.min(d + 1, y)
390
- })), f === r.cols && o((b) => ({
391
- ...b,
392
- cols: Math.min(f + 1, y)
393
- })), a({
394
- rows: d,
395
- cols: f
396
- });
397
- }
398
- function g(d, f) {
399
- e == null || e.createTable({ rows: d, cols: f, withHeaderRow: t }), c();
400
- }
401
- function c() {
402
- l(!1), o({
403
- rows: A,
404
- cols: A
405
- }), a({
406
- rows: M,
407
- cols: M
408
- });
409
- }
410
- return /* @__PURE__ */ S(ce, { modal: !0, children: [
411
- /* @__PURE__ */ T(de, { asChild: !0, children: e == null ? void 0 : e.children }),
412
- /* @__PURE__ */ T(
413
- ue,
414
- {
415
- align: "start",
416
- className: "richtext-w-full !richtext-p-2",
417
- side: "bottom",
418
- children: /* @__PURE__ */ S("div", { className: "table-grid-size-editor richtext-p-0", children: [
419
- /* @__PURE__ */ T("div", { className: "richtext-flex richtext-flex-col richtext-flex-wrap richtext-justify-between richtext-gap-1", children: (p = D(r == null ? void 0 : r.rows)) == null ? void 0 : p.map((d) => {
420
- var f;
421
- return /* @__PURE__ */ T(
422
- "div",
423
- {
424
- className: "richtext-flex richtext-gap-1",
425
- children: (f = D(r == null ? void 0 : r.cols)) == null ? void 0 : f.map((b) => /* @__PURE__ */ T(
426
- "div",
427
- {
428
- onMouseDown: () => g(d, b),
429
- onMouseOver: () => i(d, b),
430
- className: `richtext-cursor-pointer richtext-border-border ${b <= n.cols && d <= n.rows && "tableCellActive !richtext-bg-foreground"}`,
431
- children: /* @__PURE__ */ T("div", { className: "richtext-box-border richtext-size-4 richtext-rounded-[2px] !richtext-border richtext-border-solid !richtext-border-border richtext-p-1" })
432
- },
433
- `c-${b}`
434
- ))
435
- },
436
- `r-${d}`
437
- );
438
- }) }),
439
- /* @__PURE__ */ S("div", { className: "richtext-mt-2 richtext-text-center richtext-text-sm richtext-text-zinc-600", children: [
440
- n.rows,
441
- " ",
442
- "x",
443
- n.cols
444
- ] })
445
- ] })
446
- }
447
- )
448
- ] });
449
- }
450
- function Re(e) {
451
- function t(l) {
452
- e.disabled || e.editor.chain().focus().insertTable({ ...l, withHeaderRow: !1 }).run();
453
- }
454
- return /* @__PURE__ */ T(ve, { createTable: t, children: /* @__PURE__ */ T(
455
- he,
456
- {
457
- icon: e == null ? void 0 : e.icon,
458
- tooltip: e == null ? void 0 : e.tooltip,
459
- tooltipOptions: e == null ? void 0 : e.tooltipOptions,
460
- disabled: e == null ? void 0 : e.disabled,
461
- color: e == null ? void 0 : e.color,
462
- action: e == null ? void 0 : e.action,
463
- isActive: e == null ? void 0 : e.isActive
464
- }
465
- ) });
466
- }
467
- function He(e, t, l) {
468
- if (!e.doc)
469
- return e;
470
- const r = e.doc.nodeAt(t);
471
- if (!r || l === r.attrs.backgroundColor)
472
- return e;
473
- const o = {
474
- ...r.attrs,
475
- backgroundColor: l
476
- };
477
- return e.setNodeMarkup(t, r.type, o, r.marks);
478
- }
479
- function Ee(e, t, l) {
480
- const { doc: r, selection: o } = e;
481
- return !r || !o || !(o instanceof W) || o.forEachCell((n, a) => {
482
- e = He(e, a, l);
483
- }), e;
484
- }
485
- function P(e, t) {
486
- return ({ tr: l, state: r, dispatch: o }) => {
487
- const { selection: n } = r;
488
- return l = l.setSelection(n), l = Ee(l, t, e), l.docChanged ? (o == null || o(l), !0) : !1;
489
- };
490
- }
491
- const Se = j.create({
492
- name: "tableCellBackground",
493
- addOptions() {
494
- return {
495
- types: ["tableCell"],
496
- HTMLAttributes: {}
497
- };
498
- },
499
- addGlobalAttributes() {
500
- return [
501
- {
502
- types: this.options.types,
503
- attributes: {
504
- backgroundColor: {
505
- parseHTML: (e) => e.style.backgroundColor || "",
506
- renderHTML: (e) => !e.backgroundColor || e.backgroundColor === "" ? {} : {
507
- style: `background-color: ${e.backgroundColor}`
508
- }
509
- }
510
- }
511
- }
512
- ];
513
- },
514
- addCommands() {
515
- return {
516
- setTableCellBackground: (e) => P(e, this.options),
517
- unsetTableCellBackground: () => P("", this.options)
518
- };
519
- }
520
- }), Be = /* @__PURE__ */ K.extend({
521
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
522
- //@ts-expect-error
523
- addOptions() {
524
- var e;
525
- return {
526
- ...(e = this.parent) == null ? void 0 : e.call(this),
527
- HTMLAttributes: {
528
- style: `
529
- border: 1px solid #000;
530
- border-collapse: collapse;
531
- width: 100%;
532
- `
533
- },
534
- resizable: !0,
535
- lastColumnResizable: !0,
536
- allowTableNodeSelection: !1,
537
- button: ({ editor: t, t: l }) => ({
538
- component: Re,
539
- componentProps: {
540
- disabled: t.isActive("table") || !1,
541
- icon: "Table",
542
- tooltip: l("editor.table.tooltip"),
543
- editor: t
544
- }
545
- })
546
- };
547
- },
548
- addExtensions() {
549
- return [
550
- F.configure(this.options.tableRow),
551
- V.configure(this.options.tableHeader),
552
- G.configure(this.options.tableCell),
553
- Se.configure(this.options.tableCellBackground)
554
- ];
555
- }
556
- });
1
+ import { R as T, T as b } from "./Table-Db8TcQX8.js";
557
2
  export {
558
- Be as Table,
559
- Be as default
3
+ T as RichTextTable,
4
+ b as Table
560
5
  };
package/lib/TaskList.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-5iBZLua9.cjs"),n=require("./RichTextEditor-CxvwGvQG.cjs"),a=i.TaskList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:s,t:e,extension:o})=>({component:n.ActionButton,componentProps:{action:()=>s.commands.toggleTaskList(),isActive:()=>s.isActive("taskList")||!1,disabled:!1,icon:"ListTodo",shortcutKeys:o.options.shortcutKeys??["shift","mod","9"],tooltip:e("editor.tasklist.tooltip")}})}},addExtensions(){return[i.TaskItem.configure(this.options.taskItem)]}});exports.TaskList=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-D-5U8dY8.cjs"),e=require("react/jsx-runtime"),m=require("./toggle-D41PzQLJ.cjs");require("react");require("./index-DV5kbgRU.cjs");const a=require("./useButtonProps-C6Vpn190.cjs");function g(){const t=a.useButtonProps(u.name),{icon:s=void 0,tooltip:i=void 0,shortcutKeys:o=void 0,tooltipOptions:d={},action:n=void 0,isActive:l=void 0}=(t==null?void 0:t.componentProps)??{},{dataState:p,disabled:r,update:T}=a.useToggleActive(l),k=()=>{r||n&&(n(),T())};return t?e.jsx(m.ActionButton,{action:k,dataState:p,disabled:r,icon:s,shortcutKeys:o,tooltip:i,tooltipOptions:d}):e.jsx(e.Fragment,{})}const u=c.TaskList.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),HTMLAttributes:{class:"task-list"},taskItem:{HTMLAttributes:{class:"task-list-item"}},button:({editor:s,t:i,extension:o})=>({componentProps:{action:()=>s.commands.toggleTaskList(),isActive:()=>s.isActive("taskList"),disabled:!1,icon:"ListTodo",shortcutKeys:o.options.shortcutKeys??["shift","mod","9"],tooltip:i("editor.tasklist.tooltip")}})}},addExtensions(){return[c.TaskItem.configure(this.options.taskItem)]}});exports.RichTextTaskList=g;exports.TaskList=u;