reactjs-tiptap-editor 0.4.2 → 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 +32 -44
  5. package/lib/Attachment.d.ts +32 -44
  6. package/lib/Attachment.js +129 -99
  7. package/lib/Blockquote.cjs +3 -3
  8. package/lib/Blockquote.d.cts +32 -44
  9. package/lib/Blockquote.d.ts +32 -44
  10. package/lib/Blockquote.js +50 -22
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +32 -44
  13. package/lib/Bold.d.ts +32 -44
  14. package/lib/Bold.js +48 -20
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +32 -44
  17. package/lib/BulletList.d.ts +32 -44
  18. package/lib/BulletList.js +38 -9
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +32 -44
  21. package/lib/Clear.d.ts +32 -44
  22. package/lib/Clear.js +32 -6
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +32 -44
  25. package/lib/Code.d.ts +32 -44
  26. package/lib/Code.js +53 -25
  27. package/lib/CodeBlock.cjs +35 -35
  28. package/lib/CodeBlock.d.cts +32 -44
  29. package/lib/CodeBlock.d.ts +32 -44
  30. package/lib/CodeBlock.js +605 -590
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +33 -45
  33. package/lib/CodeView.d.ts +33 -45
  34. package/lib/CodeView.js +49 -21
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +36 -44
  37. package/lib/Color.d.ts +36 -44
  38. package/lib/Color.js +123 -79
  39. package/lib/Column.cjs +1 -0
  40. package/lib/{Document.d.cts → Column.d.cts} +38 -47
  41. package/lib/{Document.d.ts → Column.d.ts} +38 -47
  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 +32 -44
  47. package/lib/Drawer.d.ts +32 -44
  48. package/lib/Drawer.js +6 -5
  49. package/lib/Emoji.cjs +1 -1
  50. package/lib/Emoji.d.cts +32 -49
  51. package/lib/Emoji.d.ts +32 -49
  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 +32 -44
  57. package/lib/Excalidraw.d.ts +32 -44
  58. package/lib/Excalidraw.js +6 -4
  59. package/lib/ExportPdf.cjs +5 -5
  60. package/lib/ExportPdf.d.cts +32 -44
  61. package/lib/ExportPdf.d.ts +32 -44
  62. package/lib/ExportPdf.js +60 -32
  63. package/lib/ExportWord.cjs +1 -1
  64. package/lib/ExportWord.d.cts +33 -45
  65. package/lib/ExportWord.d.ts +33 -45
  66. package/lib/ExportWord.js +84 -21
  67. package/lib/FontFamily.cjs +1 -1
  68. package/lib/FontFamily.d.cts +46 -47
  69. package/lib/FontFamily.d.ts +46 -47
  70. package/lib/FontFamily.js +72 -74
  71. package/lib/FontSize.cjs +1 -1
  72. package/lib/FontSize.d.cts +43 -47
  73. package/lib/FontSize.d.ts +43 -47
  74. package/lib/FontSize.js +72 -64
  75. package/lib/Heading.cjs +1 -1
  76. package/lib/Heading.d.cts +46 -44
  77. package/lib/Heading.d.ts +46 -44
  78. package/lib/Heading.js +91 -73
  79. package/lib/Highlight.cjs +1 -1
  80. package/lib/Highlight.d.cts +36 -44
  81. package/lib/Highlight.d.ts +36 -44
  82. package/lib/Highlight.js +152 -21
  83. package/lib/History.cjs +1 -1
  84. package/lib/History.d.cts +34 -44
  85. package/lib/History.d.ts +34 -44
  86. package/lib/History.js +976 -53
  87. package/lib/HorizontalRule.cjs +1 -1
  88. package/lib/HorizontalRule.d.cts +32 -44
  89. package/lib/HorizontalRule.d.ts +32 -44
  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 +31 -50
  97. package/lib/Iframe.d.ts +31 -50
  98. package/lib/Iframe.js +6 -4
  99. package/lib/Image.cjs +1 -1
  100. package/lib/Image.d.cts +32 -45
  101. package/lib/Image.d.ts +32 -45
  102. package/lib/Image.js +848 -5
  103. package/lib/ImageGif.cjs +1 -1
  104. package/lib/ImageGif.d.cts +33 -47
  105. package/lib/ImageGif.d.ts +33 -47
  106. package/lib/ImageGif.js +424 -5
  107. package/lib/ImportWord.cjs +48 -48
  108. package/lib/ImportWord.d.cts +33 -45
  109. package/lib/ImportWord.d.ts +33 -45
  110. package/lib/ImportWord.js +2596 -2588
  111. package/lib/Indent.cjs +1 -1
  112. package/lib/Indent.d.cts +32 -44
  113. package/lib/Indent.d.ts +32 -44
  114. package/lib/Indent.js +97 -27
  115. package/lib/Italic.cjs +1 -1
  116. package/lib/Italic.d.cts +32 -44
  117. package/lib/Italic.d.ts +32 -44
  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 +32 -44
  123. package/lib/Katex.d.ts +32 -44
  124. package/lib/Katex.js +5 -196
  125. package/lib/LineHeight.cjs +1 -1
  126. package/lib/LineHeight.d.cts +34 -50
  127. package/lib/LineHeight.d.ts +34 -50
  128. package/lib/LineHeight.js +71 -112
  129. package/lib/Link.cjs +1 -1
  130. package/lib/Link.d.cts +33 -47
  131. package/lib/Link.d.ts +33 -47
  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 +29 -44
  137. package/lib/Mention.d.ts +29 -44
  138. package/lib/Mention.js +112 -124
  139. package/lib/Mermaid.cjs +2 -2
  140. package/lib/Mermaid.d.cts +32 -44
  141. package/lib/Mermaid.d.ts +32 -44
  142. package/lib/Mermaid.js +177 -165
  143. package/lib/MoreMark.cjs +1 -1
  144. package/lib/MoreMark.d.cts +47 -46
  145. package/lib/MoreMark.d.ts +47 -46
  146. package/lib/MoreMark.js +125 -55
  147. package/lib/OrderedList.cjs +1 -1
  148. package/lib/OrderedList.d.cts +32 -44
  149. package/lib/OrderedList.d.ts +32 -44
  150. package/lib/OrderedList.js +37 -9
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +32 -47
  153. package/lib/SearchAndReplace.d.ts +32 -47
  154. package/lib/SearchAndReplace.js +221 -197
  155. package/lib/SlashCommand.cjs +1 -1
  156. package/lib/SlashCommand.d.cts +44 -51
  157. package/lib/SlashCommand.d.ts +44 -51
  158. package/lib/SlashCommand.js +235 -249
  159. package/lib/Strike.cjs +1 -1
  160. package/lib/Strike.d.cts +32 -44
  161. package/lib/Strike.d.ts +32 -44
  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 +33 -47
  167. package/lib/Table.d.ts +33 -47
  168. package/lib/Table.js +3 -558
  169. package/lib/TaskList.cjs +1 -1
  170. package/lib/TaskList.d.cts +32 -44
  171. package/lib/TaskList.d.ts +32 -44
  172. package/lib/TaskList.js +38 -10
  173. package/lib/TextAlign.cjs +1 -1
  174. package/lib/TextAlign.d.cts +45 -44
  175. package/lib/TextAlign.d.ts +45 -44
  176. package/lib/TextAlign.js +108 -101
  177. package/lib/TextDirection.cjs +1 -1
  178. package/lib/TextDirection.d.cts +61 -44
  179. package/lib/TextDirection.d.ts +61 -44
  180. package/lib/TextDirection.js +105 -112
  181. package/lib/TextUnderline.cjs +1 -1
  182. package/lib/TextUnderline.d.cts +32 -44
  183. package/lib/TextUnderline.d.ts +32 -44
  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 +32 -44
  189. package/lib/Twitter.d.ts +32 -44
  190. package/lib/Twitter.js +5 -4
  191. package/lib/Video.cjs +1 -1
  192. package/lib/Video.d.cts +32 -44
  193. package/lib/Video.d.ts +32 -44
  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} +58 -59
  199. package/lib/{bubble-extra.d.ts → bubble.d.ts} +58 -59
  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 +34 -285
  235. package/lib/index.d.ts +34 -285
  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 +5410 -62
  245. package/lib/locale-bundle.d.ts +5410 -62
  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/BaseKit.d.ts DELETED
@@ -1,481 +0,0 @@
1
- import { CharacterCountOptions } from '@tiptap/extensions';
2
- import { DropcursorOptions } from '@tiptap/extensions';
3
- import { Editor } from '@tiptap/react';
4
- import { Extension } from '@tiptap/core';
5
- import { FocusOptions as FocusOptions_2 } from '@tiptap/extensions';
6
- import { HardBreakOptions } from '@tiptap/extension-hard-break';
7
- import { HorizontalRuleOptions } from '@tiptap/extension-horizontal-rule';
8
- import { ListItemOptions } from '@tiptap/extension-list';
9
- import { ListKeymapOptions } from '@tiptap/extension-list';
10
- import { OrderedListOptions } from '@tiptap/extension-list';
11
- import { ParagraphOptions } from '@tiptap/extension-paragraph';
12
- import { PlaceholderOptions } from '@tiptap/extensions';
13
- import { StrikeOptions } from '@tiptap/extension-strike';
14
- import { TextStyleOptions } from '@tiptap/extension-text-style';
15
- import { TrailingNodeOptions } from '@tiptap/extensions';
16
-
17
- export declare const BaseKit: Extension<BaseKitOptions, any>;
18
-
19
- /**
20
- * Represents the interface for options in the base toolkit.
21
- */
22
- export declare interface BaseKitOptions {
23
- /**
24
- * Whether to enable the document option
25
- *
26
- * @default false
27
- */
28
- multiColumn?: boolean;
29
- /**
30
- * character count options or false, indicating whether to enable character count
31
- *
32
- * @default true
33
- */
34
- characterCount: Partial<CharacterCountOptions> | false;
35
- /**
36
- * selection options or false, indicating whether to enable the selection
37
- *
38
- * @default true
39
- */
40
- selection: any | false;
41
- /**
42
- * Focus options or false, indicating whether to enable focus functionality
43
- *
44
- * @default true
45
- */
46
- focus: Partial<FocusOptions_2> | false;
47
- /**
48
- * Placeholder options or false, indicating whether to enable placeholders
49
- *
50
- * @default true
51
- */
52
- placeholder: Partial<PlaceholderOptions> | false;
53
- /**
54
- * textBubble options or false, indicating whether to enable the textBubble
55
- *
56
- * @default true
57
- */
58
- textBubble: Partial<TextBubbleOptions> | false;
59
- /**
60
- * Text Style options or false, indicating whether to enable text style functionality
61
- *
62
- * @default true
63
- */
64
- textStyle: Partial<TextStyleOptions> | false;
65
- /**
66
- * If set to false, the document extension will not be registered
67
- * @example document: false
68
- */
69
- document: false;
70
- /**
71
- * If set to false, the dropcursor extension will not be registered
72
- * @example dropcursor: false
73
- */
74
- dropcursor: Partial<DropcursorOptions> | false;
75
- /**
76
- * If set to false, the gapcursor extension will not be registered
77
- * @example gapcursor: false
78
- */
79
- gapcursor: false;
80
- /**
81
- * If set to false, the hardBreak extension will not be registered
82
- * @example hardBreak: false
83
- */
84
- hardBreak: Partial<HardBreakOptions> | false;
85
- /**
86
- * If set to false, the horizontalRule extension will not be registered
87
- * @example horizontalRule: false
88
- */
89
- horizontalRule: Partial<HorizontalRuleOptions> | false;
90
- /**
91
- * If set to false, the listItem extension will not be registered
92
- * @example listItem: false
93
- */
94
- listItem: Partial<ListItemOptions> | false;
95
- /**
96
- * If set to false, the listItemKeymap extension will not be registered
97
- * @example listKeymap: false
98
- */
99
- listKeymap: Partial<ListKeymapOptions> | false;
100
- /**
101
- * If set to false, the orderedList extension will not be registered
102
- * @example orderedList: false
103
- */
104
- orderedList: Partial<OrderedListOptions> | false;
105
- /**
106
- * If set to false, the paragraph extension will not be registered
107
- * @example paragraph: false
108
- */
109
- paragraph: Partial<ParagraphOptions> | false;
110
- /**
111
- * If set to false, the strike extension will not be registered
112
- * @example strike: false
113
- */
114
- strike: Partial<StrikeOptions> | false;
115
- /**
116
- * If set to false, the text extension will not be registered
117
- * @example text: false
118
- */
119
- text: false;
120
- /**
121
- * If set to false, the trailingNode extension will not be registered
122
- * @example trailingNode: false
123
- */
124
- trailingNode: Partial<TrailingNodeOptions> | false;
125
- }
126
-
127
- /**
128
- * Represents the ButtonView function.
129
- */
130
- declare type ButtonView<T = any> = (options: ButtonViewParams<T>) => ButtonViewReturn | ButtonViewReturn[];
131
-
132
- /**
133
- * Represents the parameters for the ButtonView function.
134
- */
135
- declare interface ButtonViewParams<T = any> {
136
- /** Editor object */
137
- editor: Editor;
138
- /** Extension object */
139
- extension: Extension<T>;
140
- /** Translation function */
141
- t: (path: string) => string;
142
- }
143
-
144
- /**
145
- * Represents the return value for the ButtonView component.
146
- */
147
- declare interface ButtonViewReturn {
148
- /** Component */
149
- component: unknown;
150
- /** Component props */
151
- componentProps: ButtonViewReturnComponentProps;
152
- /** Component slots */
153
- componentSlots?: ButtonViewReturnComponentSlots;
154
- }
155
-
156
- /**
157
- * Represents the props for the ButtonView component.
158
- */
159
- declare interface ButtonViewReturnComponentProps {
160
- /** Method triggered when action is performed */
161
- action?: (value?: any) => void;
162
- /** Whether it is in the active state */
163
- isActive?: () => boolean;
164
- /** Button icon */
165
- icon?: any;
166
- /** Text displayed on hover */
167
- tooltip?: string;
168
- [x: string]: any;
169
- }
170
-
171
- /**
172
- * Represents the slots for the ButtonView component.
173
- */
174
- declare interface ButtonViewReturnComponentSlots {
175
- /** Dialog slot */
176
- dialog: () => any;
177
- [x: string]: () => any;
178
- }
179
-
180
- /**
181
- * Represents the general options for Tiptap extensions.
182
- */
183
- declare interface GeneralOptions<T> {
184
- /** Enabled divider */
185
- divider: boolean;
186
- /** Enabled spacer */
187
- spacer: boolean;
188
- /** Button view function */
189
- button: ButtonView<T>;
190
- /** Show on Toolbar */
191
- toolbar?: boolean;
192
- /** Shortcut keys override */
193
- shortcutKeys?: string[] | string[][];
194
- }
195
-
196
- declare interface TextBubbleOptions extends GeneralOptions<TextBubbleOptions> {
197
- }
198
-
199
- export { }
200
-
201
-
202
- declare module '@tiptap/core' {
203
- interface Commands<ReturnType> {
204
- attachment: {
205
- setAttachment: (attrs?: unknown) => ReturnType;
206
- };
207
- }
208
- }
209
-
210
-
211
- declare module '@tiptap/core' {
212
- interface Commands<ReturnType> {
213
- setCodeBlock: {
214
- setCodeBlock: (options?: any) => ReturnType;
215
- };
216
- }
217
- }
218
-
219
-
220
- declare module '@tiptap/core' {
221
- interface Commands<ReturnType> {
222
- codeView: {
223
- /**
224
- * Toggle code view mode
225
- */
226
- toggleCodeView: () => ReturnType;
227
- };
228
- }
229
- }
230
-
231
-
232
- declare module '@tiptap/core' {
233
- interface Commands<ReturnType> {
234
- drawer: {
235
- setDrawer: (options: any, replace?: any) => ReturnType;
236
- setAlignImageDrawer: (align: 'left' | 'center' | 'right') => ReturnType;
237
- };
238
- }
239
- }
240
-
241
-
242
- declare module '@tiptap/core' {
243
- interface Commands<ReturnType> {
244
- excalidraw: {
245
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
246
- };
247
- }
248
- }
249
-
250
-
251
- declare module '@tiptap/core' {
252
- interface Commands<ReturnType> {
253
- exportPdf: {
254
- exportToPdf: () => ReturnType;
255
- };
256
- }
257
- }
258
-
259
-
260
- declare module '@tiptap/core' {
261
- interface Commands<ReturnType> {
262
- exportWord: {
263
- exportToWord: () => ReturnType;
264
- };
265
- }
266
- }
267
-
268
-
269
- declare module '@tiptap/core' {
270
- interface Commands<ReturnType> {
271
- fontSize: {
272
- /**
273
- * Set the text font size. ex: "12px", "2em", or "small". Must be a valid
274
- * CSS font-size
275
- * (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size).
276
- */
277
- setFontSize: (fontSize: string) => ReturnType;
278
- /**
279
- * Unset the font size
280
- */
281
- unsetFontSize: () => ReturnType;
282
- };
283
- }
284
- }
285
-
286
-
287
- declare module '@tiptap/core' {
288
- interface Commands<ReturnType> {
289
- painter: {
290
- setPainter: (marks: Mark[]) => ReturnType;
291
- };
292
- }
293
- }
294
-
295
-
296
- declare module '@tiptap/core' {
297
- interface Commands<ReturnType> {
298
- iframe: {
299
- /**
300
- * Add an iframe
301
- */
302
- setIframe: (options: {
303
- src: string;
304
- service: string;
305
- }) => ReturnType;
306
- };
307
- }
308
- }
309
-
310
-
311
- declare module '@tiptap/core' {
312
- interface Commands<ReturnType> {
313
- imageUpload: {
314
- /**
315
- * Add an image
316
- */
317
- setImageInline: (options: Partial<SetImageAttrsOptions>) => ReturnType;
318
- /**
319
- * Update an image
320
- */
321
- updateImage: (options: Partial<SetImageAttrsOptions>) => ReturnType;
322
- /**
323
- * Set image alignment
324
- */
325
- setAlignImage: (align: 'left' | 'center' | 'right') => ReturnType;
326
- };
327
- }
328
- }
329
-
330
-
331
- declare module '@tiptap/core' {
332
- interface Commands<ReturnType> {
333
- imageGifUpload: {
334
- /**
335
- * Add an image gif
336
- */
337
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
338
- /**
339
- * Update an image gif
340
- */
341
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
342
- /**
343
- * Set image alignment
344
- */
345
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
346
- };
347
- }
348
- }
349
-
350
-
351
- declare module '@tiptap/core' {
352
- interface Commands<ReturnType> {
353
- indent: {
354
- /**
355
- * Set the indent attribute
356
- */
357
- indent: () => ReturnType;
358
- /**
359
- * Set the outdent attribute
360
- */
361
- outdent: () => ReturnType;
362
- };
363
- }
364
- }
365
-
366
-
367
- declare module '@tiptap/core' {
368
- interface Commands<ReturnType> {
369
- katex: {
370
- setKatex: (arg?: IKatexAttrs) => ReturnType;
371
- };
372
- }
373
- }
374
-
375
-
376
- declare module '@tiptap/core' {
377
- interface Commands<ReturnType> {
378
- lineHeight: {
379
- setLineHeight: (lineHeight: string) => ReturnType;
380
- unsetLineHeight: () => ReturnType;
381
- };
382
- }
383
- }
384
-
385
-
386
- declare module '@tiptap/core' {
387
- interface Commands<ReturnType> {
388
- mermaid: {
389
- setMermaid: (options: any, replace?: any) => ReturnType;
390
- setAlignImageMermaid: (align: 'left' | 'center' | 'right') => ReturnType;
391
- };
392
- }
393
- }
394
-
395
-
396
- declare module '@tiptap/core' {
397
- interface Commands<ReturnType> {
398
- columns: {
399
- insertColumns: (attrs?: {
400
- cols: number;
401
- }) => ReturnType;
402
- addColBefore: () => ReturnType;
403
- addColAfter: () => ReturnType;
404
- deleteCol: () => ReturnType;
405
- };
406
- }
407
- }
408
-
409
-
410
- declare module '@tiptap/core' {
411
- interface Commands<ReturnType> {
412
- search: {
413
- setSearchTerm: (searchTerm: string) => ReturnType;
414
- setReplaceTerm: (replaceTerm: string) => ReturnType;
415
- setCaseSensitive: (caseSensitive: boolean) => ReturnType;
416
- resetIndex: () => ReturnType;
417
- nextSearchResult: () => ReturnType;
418
- previousSearchResult: () => ReturnType;
419
- replace: () => ReturnType;
420
- replaceAll: () => ReturnType;
421
- };
422
- }
423
- }
424
-
425
-
426
- declare module '@tiptap/core' {
427
- interface Storage {
428
- searchAndReplace: SearchAndReplaceStorage;
429
- }
430
- }
431
-
432
-
433
- declare module '@tiptap/core' {
434
- interface Commands<ReturnType> {
435
- tableOfContents: {
436
- setTableOfContents: () => ReturnType;
437
- removeTableOfContents: () => ReturnType;
438
- };
439
- }
440
- }
441
-
442
-
443
- declare module '@tiptap/core' {
444
- interface Commands<ReturnType> {
445
- twitter: {
446
- /**
447
- * Insert a tweet
448
- * @param options The tweet attributes
449
- * @example editor.commands.setTweet({ src: 'https://x.com/seanpk/status/1800145949580517852' })
450
- */
451
- setTweet: (options: SetTweetOptions) => ReturnType;
452
- updateTweet: (options: SetTweetOptions) => ReturnType;
453
- };
454
- }
455
- }
456
-
457
-
458
- declare module '@tiptap/core' {
459
- interface Commands<ReturnType> {
460
- video: {
461
- /**
462
- * Add an video
463
- */
464
- setVideo: (options: Partial<SetVideoOptions>) => ReturnType;
465
- /**
466
- * Update an video
467
- */
468
- updateVideo: (options: Partial<SetVideoOptions>) => ReturnType;
469
- };
470
- }
471
- }
472
-
473
-
474
- declare module '@tiptap/core' {
475
- interface Commands<ReturnType> {
476
- tableCellBackground: {
477
- setTableCellBackground: (color: string) => ReturnType;
478
- unsetTableCellBackground: () => ReturnType;
479
- };
480
- }
481
- }
package/lib/BaseKit.js DELETED
@@ -1,132 +0,0 @@
1
- import { N as c, m, E as g } from "./index-kbO3iWqL.js";
2
- import { D as k } from "./index-Dy4DlW9o.js";
3
- import { H as M } from "./index-BBz7Nmv9.js";
4
- import { L as x, b } from "./index-Ch6dBBad.js";
5
- import { T as y } from "./index-ByurDDMv.js";
6
- import { P as T, F as C, C as H, S as B, D as L, G as A, T as N } from "./index-VvXaaKe3.js";
7
- import { G as S, J as w } from "./RichTextEditor-DGcKEUGr.js";
8
- import { TextBubble as K } from "./TextBubble.js";
9
- import { n as h } from "./index-LmrOdnen.js";
10
- var v = c.create({
11
- name: "hardBreak",
12
- markdownTokenName: "br",
13
- addOptions() {
14
- return {
15
- keepMarks: !0,
16
- HTMLAttributes: {}
17
- };
18
- },
19
- inline: !0,
20
- group: "inline",
21
- selectable: !1,
22
- linebreakReplacement: !0,
23
- parseHTML() {
24
- return [{ tag: "br" }];
25
- },
26
- renderHTML({ HTMLAttributes: t }) {
27
- return ["br", m(this.options.HTMLAttributes, t)];
28
- },
29
- renderText() {
30
- return `
31
- `;
32
- },
33
- renderMarkdown: () => `
34
- `,
35
- parseMarkdown: () => ({
36
- type: "hardBreak"
37
- }),
38
- addCommands() {
39
- return {
40
- setHardBreak: () => ({ commands: t, chain: r, state: s, editor: e }) => t.first([
41
- () => t.exitCode(),
42
- () => t.command(() => {
43
- const { selection: i, storedMarks: l } = s;
44
- if (i.$from.parent.type.spec.isolating)
45
- return !1;
46
- const { keepMarks: a } = this.options, { splittableMarks: n } = e.extensionManager, o = l || i.$to.parentOffset && i.$from.marks();
47
- return r().insertContent({ type: this.name }).command(({ tr: p, dispatch: u }) => {
48
- if (u && o && a) {
49
- const f = o.filter((d) => n.includes(d.type.name));
50
- p.ensureMarks(f);
51
- }
52
- return !0;
53
- }).run();
54
- })
55
- ])
56
- };
57
- },
58
- addKeyboardShortcuts() {
59
- return {
60
- "Mod-Enter": () => this.editor.commands.setHardBreak(),
61
- "Shift-Enter": () => this.editor.commands.setHardBreak()
62
- };
63
- }
64
- }), E = c.create({
65
- name: "paragraph",
66
- priority: 1e3,
67
- addOptions() {
68
- return {
69
- HTMLAttributes: {}
70
- };
71
- },
72
- group: "block",
73
- content: "inline*",
74
- parseHTML() {
75
- return [{ tag: "p" }];
76
- },
77
- renderHTML({ HTMLAttributes: t }) {
78
- return ["p", m(this.options.HTMLAttributes, t), 0];
79
- },
80
- parseMarkdown: (t, r) => {
81
- const s = t.tokens || [];
82
- return s.length === 1 && s[0].type === "image" ? r.parseChildren([s[0]]) : r.createNode(
83
- "paragraph",
84
- void 0,
85
- // no attributes for paragraph
86
- r.parseInline(s)
87
- );
88
- },
89
- renderMarkdown: (t, r) => !t || !Array.isArray(t.content) ? "" : r.renderChildren(t.content),
90
- addCommands() {
91
- return {
92
- setParagraph: () => ({ commands: t }) => t.setNode(this.name)
93
- };
94
- },
95
- addKeyboardShortcuts() {
96
- return {
97
- "Mod-Alt-0": () => this.editor.commands.setParagraph()
98
- };
99
- }
100
- }), P = c.create({
101
- name: "text",
102
- group: "inline",
103
- parseMarkdown: (t) => ({
104
- type: "text",
105
- text: t.text || ""
106
- }),
107
- renderMarkdown: (t) => t.text || ""
108
- });
109
- const j = /* @__PURE__ */ g.create({
110
- name: "base-kit",
111
- addExtensions() {
112
- var r, s;
113
- const t = [];
114
- return this.options.placeholder !== !1 && t.push(
115
- T.configure({
116
- placeholder: ({ node: e, pos: i, editor: l }) => {
117
- var a, n, o, p, u;
118
- return ((a = e == null ? void 0 : e.type) == null ? void 0 : a.name) === "columns" || ((n = e == null ? void 0 : e.content) == null ? void 0 : n.size) !== 0 ? "" : ((o = e == null ? void 0 : e.type) == null ? void 0 : o.name) === "heading" ? `${h.t(`editor.heading.h${e.attrs.level}.tooltip`)}` : ((p = e == null ? void 0 : e.type) == null ? void 0 : p.name) === "codeBlock" || ((u = e == null ? void 0 : e.type) == null ? void 0 : u.name) === "table" ? "" : l.extensionManager.extensions.some((f) => f.name === "slashCommand") ? h.t("editor.slash") : i === 0 ? h.t("editor.content") : h.t("editor.content");
119
- },
120
- ...this.options.placeholder
121
- })
122
- ), this.options.focus !== !1 && t.push(
123
- C.configure({
124
- className: "focus",
125
- ...this.options.focus
126
- })
127
- ), this.options.textBubble !== !1 && t.push(K.configure()), this.options.characterCount !== !1 && t.push(H.configure(this.options.characterCount)), this.options.textStyle !== !1 && t.push(y.configure(this.options.textStyle)), this.options.selection !== !1 && t.push(B), this.options.multiColumn !== !1 && t.push(S, w), this.options.document !== !1 && t.push(k.configure(this.options.document)), this.options.dropcursor !== !1 && t.push(L.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && t.push(A.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && t.push(v.configure(this.options.hardBreak)), this.options.horizontalRule !== !1 && t.push(M.configure(this.options.horizontalRule)), this.options.listItem !== !1 && t.push(x.configure(this.options.listItem)), this.options.listKeymap !== !1 && t.push(b.configure((r = this.options) == null ? void 0 : r.listKeymap)), this.options.paragraph !== !1 && t.push(E.configure(this.options.paragraph)), this.options.text !== !1 && t.push(P.configure(this.options.text)), this.options.trailingNode !== !1 && t.push(N.configure((s = this.options) == null ? void 0 : s.trailingNode)), t;
128
- }
129
- });
130
- export {
131
- j as BaseKit
132
- };
package/lib/Document.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./index-B96Cclrj.cjs"),e=t.Document.extend({content:"(block|columns)+"});exports.Document=e;exports.default=e;
package/lib/Document.js DELETED
@@ -1,9 +0,0 @@
1
- import { D as o } from "./index-Dy4DlW9o.js";
2
- const e = /* @__PURE__ */ o.extend({
3
- content: "(block|columns)+"
4
- // echo editor is a block editor
5
- });
6
- export {
7
- e as Document,
8
- e as default
9
- };
@@ -1 +0,0 @@
1
- "use strict";const F=require("./index-DF2Lp4HZ.cjs"),i=require("./RichTextEditor-CxvwGvQG.cjs"),U=require("./dom-dataset-_6-diIRQ.cjs"),e=require("react/jsx-runtime"),m=require("react"),d=require("easydrawer"),G=require("./shortId-Bfj8TyNr.cjs"),q=require("./index-6D1J-A-o.cjs"),K="_wrapper_rraz2_1",Q="_tool_rraz2_17",Y="_active_rraz2_37",J="_pen_rraz2_41",ee="_line_rraz2_48",te="_options_rraz2_56",oe="_colorWrap_rraz2_66",re="_color_rraz2_66",le="_colorActive_rraz2_83",l={wrapper:K,tool:Q,active:Y,pen:J,line:ee,options:te,colorWrap:oe,color:re,colorActive:le};function ne(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{color:"currentColor",d:"M2 9.2v3.6M12.8 2H9.2M7.5 20H9M20 7.5V9M2.133 4.699c.155-.727.415-1.274.854-1.712c.426-.426.954-.684 1.652-.84m15.228 2.552c-.155-.727-.415-1.274-.854-1.712c-.417-.417-.932-.673-1.608-.83M4.64 19.853c-.698-.156-1.226-.414-1.652-.84c-.43-.43-.69-.965-.845-1.673m11.638 3.626c-1.812.125-3.607-8.326-2.374-9.559s9.684.561 9.559 2.373c-.087 1.187-2.095 1.656-2.037 2.711c.018.309.408.59 1.188 1.154c.543.39 1.096.77 1.629 1.175a.66.66 0 0 1 .234.687a3.35 3.35 0 0 1-2.472 2.473a.66.66 0 0 1-.688-.235c-.404-.533-.784-1.086-1.175-1.628c-.563-.78-.844-1.17-1.153-1.188c-1.055-.059-1.524 1.95-2.71 2.037",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5"})})}function se(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M20.06 18a4 4 0 0 1-.2-.89c-.67.7-1.48 1.05-2.41 1.05c-.83 0-1.52-.24-2.05-.71c-.53-.45-.8-1.06-.8-1.79c0-.88.33-1.56 1-2.05s1.61-.73 2.83-.73h1.4v-.64q0-.735-.45-1.17c-.3-.29-.75-.43-1.33-.43c-.52 0-.95.12-1.3.36c-.35.25-.52.54-.52.89h-1.46c0-.43.15-.84.45-1.24c.28-.4.71-.71 1.22-.94c.51-.21 1.06-.35 1.69-.35c.98 0 1.74.24 2.29.73s.84 1.16.86 2.02V16c0 .8.1 1.42.3 1.88V18zm-2.4-1.12c.45 0 .88-.11 1.29-.32c.4-.21.7-.49.88-.83v-1.57H18.7c-1.77 0-2.66.47-2.66 1.41c0 .43.15.73.46.96c.3.23.68.35 1.16.35m-12.2-3.17h4.07L7.5 8.29zM6.64 6h1.72l4.71 12h-1.93l-.97-2.57H4.82L3.86 18H1.93z",fill:"currentColor"})})}function ie(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z",fill:"currentColor"})})}function ae(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M253.66 106.34a8 8 0 0 0-11.32 0L192 156.69L107.31 72l50.35-50.34a8 8 0 1 0-11.32-11.32L96 60.69a16 16 0 0 0-2.82 18.81L72 100.69a16 16 0 0 0 0 22.62l4.69 4.69l-58.35 58.34a8 8 0 0 0 3.13 13.25l72 24A7.9 7.9 0 0 0 96 224a8 8 0 0 0 5.66-2.34L136 187.31l4.69 4.69a16 16 0 0 0 22.62 0l21.19-21.18a16 16 0 0 0 18.81-2.82l50.35-50.34a8 8 0 0 0 0-11.32M93.84 206.85l-55-18.35L88 139.31L124.69 176ZM152 180.69L83.31 112L104 91.31L172.69 160Z",fill:"currentColor"})})}function ce(t){return e.jsxs("svg",{height:"1em",viewBox:"0 0 16 16",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:[e.jsx("path",{d:"m2.648 9.937l7.29-7.288a2.21 2.21 0 0 1 3.124 0l2.29 2.288a2.21 2.21 0 0 1 0 3.126L10.413 13H12.5a.5.5 0 0 1 0 1H4.501a2.2 2.2 0 0 1-1.563-.647l.707-.707c.227.226.535.354.856.354h4.005a1.2 1.2 0 0 0 .848-.354l1.292-1.293l-4-4l-3.29 3.291a1.21 1.21 0 0 0 0 1.712l.29.29l-.708.707l-.29-.29a2.21 2.21 0 0 1 0-3.126M8 6h6.89a1.2 1.2 0 0 0-.246-.356L14 5H9zm2-2h3l-.645-.644a1.21 1.21 0 0 0-1.71 0zm4.89 3H7.708l1 1H14l.644-.644A1.2 1.2 0 0 0 14.891 7zM9.708 9l1.646 1.646L13 9z",fill:"currentColor"}),e.jsx("path",{d:"M14 11.5a.5.5 0 1 1-1 0a.5.5 0 0 1 1 0m1.5-.5a.5.5 0 1 0 0-1a.5.5 0 0 0 0 1m-1 2a.5.5 0 0 0 0 1h1a.5.5 0 0 0 0-1z",fill:"currentColor"})]})}function he(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M3 3h18v18H3zm2 2v14h14V5z",fill:"currentColor"})})}function ue(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M2 20V4h20v16zm2-2h16V6H4zm0 0V6z",fill:"currentColor"})})}function de(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 22q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22m0-2q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4T6.325 6.325T4 12t2.325 5.675T12 20m0-8",fill:"currentColor"})})}function ge(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M10.363 3.591L2.257 17.125a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87L13.637 3.59a1.914 1.914 0 0 0-3.274 0z",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2"})})}function me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m6.8 21l-5.2-9l5.2-9h10.4l5.2 9l-5.2 9zm1.15-2h8.1l4.025-7l-4.025-7h-8.1L3.9 12zM12 12",fill:"currentColor"})})}function xe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsxs("g",{fill:"none",fillRule:"evenodd",children:[e.jsx("path",{d:"m12.594 23.258l-.012.002l-.071.035l-.02.004l-.014-.004l-.071-.036q-.016-.004-.024.006l-.004.01l-.017.428l.005.02l.01.013l.104.074l.015.004l.012-.004l.104-.074l.012-.016l.004-.017l-.017-.427q-.004-.016-.016-.018m.264-.113l-.014.002l-.184.093l-.01.01l-.003.011l.018.43l.005.012l.008.008l.201.092q.019.005.029-.008l.004-.014l-.034-.614q-.005-.019-.02-.022m-.715.002a.02.02 0 0 0-.027.006l-.006.014l-.034.614q.001.018.017.024l.015-.002l.201-.093l.01-.008l.003-.011l.018-.43l-.003-.012l-.01-.01z"}),e.jsx("path",{d:"M10.586 2.807a2 2 0 0 1 2.828 0l7.778 7.779a2 2 0 0 1 0 2.828l-7.778 7.778a2 2 0 0 1-2.828 0l-7.778-7.778a2 2 0 0 1 0-2.828zM12 4.222L4.222 12L12 19.778L19.778 12z",fill:"currentColor"})]})})}function pe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M16.01 11H4v2h12.01v3L20 12l-3.99-4z",fill:"currentColor"})})}function we(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M7.53 3.47a.75.75 0 0 1 0 1.06L5.81 6.25H15a5.75 5.75 0 0 1 0 11.5H8a.75.75 0 0 1 0-1.5h7a4.25 4.25 0 0 0 0-8.5H5.81l1.72 1.72a.75.75 0 1 1-1.06 1.06l-3-3a.75.75 0 0 1 0-1.06l3-3a.75.75 0 0 1 1.06 0",fill:"currentColor",fillRule:"evenodd"})})}function ve(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{clipRule:"evenodd",d:"M16.47 3.47a.75.75 0 0 1 1.06 0l3 3a.75.75 0 0 1 0 1.06l-3 3a.75.75 0 1 1-1.06-1.06l1.72-1.72H9a4.25 4.25 0 0 0 0 8.5h7a.75.75 0 0 1 0 1.5H9a5.75 5.75 0 0 1 0-11.5h9.19l-1.72-1.72a.75.75 0 0 1 0-1.06",fill:"currentColor",fillRule:"evenodd"})})}function Ce(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M7 21q-.825 0-1.412-.587T5 19V6H4V4h5V3h6v1h5v2h-1v13q0 .825-.587 1.413T17 21zm2-4h2V8H9zm4 0h2V8h-2z",fill:"currentColor"})})}function fe(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 256 256",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M211.81 83.79a28 28 0 0 1-33.12 4.83l-90.07 90.07a28 28 0 1 1-44.43-6.48a28 28 0 0 1 33.12-4.83l90.07-90.07a28 28 0 1 1 44.43 6.48",fill:"currentColor"})})}function Te(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12 20.325q-.35 0-.712-.125t-.638-.4l-1.725-1.575q-2.65-2.425-4.788-4.812T2 8.15Q2 5.8 3.575 4.225T7.5 2.65q1.325 0 2.5.562t2 1.538q.825-.975 2-1.537t2.5-.563q2.35 0 3.925 1.575T22 8.15q0 2.875-2.125 5.275T15.05 18.25l-1.7 1.55q-.275.275-.637.4t-.713.125M11.05 6.75q-.725-1.025-1.55-1.563t-2-.537q-1.5 0-2.5 1t-1 2.5q0 1.3.925 2.763t2.213 2.837t2.65 2.575T12 18.3q.85-.775 2.213-1.975t2.65-2.575t2.212-2.837T20 8.15q0-1.5-1-2.5t-2.5-1q-1.175 0-2 .538T12.95 6.75q-.175.25-.425.375T12 7.25t-.525-.125t-.425-.375m.95 4.725",fill:"currentColor"})})}function je(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"m7.625 6.4l2.8-3.625q.3-.4.713-.587T12 2t.863.188t.712.587l2.8 3.625l4.25 1.425q.65.2 1.025.738t.375 1.187q0 .3-.088.6t-.287.575l-2.75 3.9l.1 4.1q.025.875-.575 1.475t-1.4.6q-.05 0-.55-.075L12 19.675l-4.475 1.25q-.125.05-.275.063T6.975 21q-.8 0-1.4-.6T5 18.925l.1-4.125l-2.725-3.875q-.2-.275-.288-.575T2 9.75q0-.625.363-1.162t1.012-.763zM8.85 8.125L4 9.725L7.1 14.2L7 18.975l5-1.375l5 1.4l-.1-4.8L20 9.775l-4.85-1.65L12 4zM12 11.5",fill:"currentColor"})})}function be(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M12.01 6c2.61 0 4.89 1.86 5.4 4.43l.3 1.5l1.52.11c1.56.11 2.78 1.41 2.78 2.96c0 1.65-1.35 3-3 3h-13c-2.21 0-4-1.79-4-4c0-2.05 1.53-3.76 3.56-3.97l1.07-.11l.5-.95A5.46 5.46 0 0 1 12.01 6m0-2C9.12 4 6.6 5.64 5.35 8.04C2.35 8.36.01 10.91.01 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5c0-2.64-2.05-4.78-4.64-4.96C18.68 6.59 15.65 4 12.01 4",fill:"currentColor"})})}function Me(t){return e.jsx("svg",{height:"1em",viewBox:"0 0 24 24",width:"1em",xmlns:"http://www.w3.org/2000/svg",...t,children:e.jsx("path",{d:"M5.586 6.45A2 2 0 0 1 7.509 5h11.84a2 2 0 0 1 1.923 2.55l-2.858 10A2 2 0 0 1 16.491 19H4.651a2 2 0 0 1-1.923-2.55z",fill:"none",stroke:"currentColor",strokeWidth:"2"})})}const ye=[d.Color4.blackHighlight,d.Color4.ofRGBA(166/255,81/255,167/255,.3),d.Color4.ofRGBA(247/255,78/255,158/255,.3),d.Color4.ofRGBA(166/255,83/255,88/255,.3),d.Color4.ofRGBA(246/255,130/255,28/255,.3),d.Color4.ofRGBA(166/255,198/255,0,.3),d.Color4.ofRGBA(98/255,186/255,70/255,.3)],$=[d.Color4.black,d.Color4.fromHex("#007AFF"),d.Color4.fromHex("#A651A7"),d.Color4.fromHex("#F74E9E"),d.Color4.fromHex("#FF5358"),d.Color4.fromHex("#F6821C"),d.Color4.fromHex("#FFC600"),d.Color4.fromHex("#62BA46"),d.Color4.fromHex("#E6BFE8"),d.Color4.fromHex("#FEA3D2"),d.Color4.fromHex("#FFA0A3"),d.Color4.fromHex("#FBC276"),d.Color4.fromHex("#FFFB85"),d.Color4.fromHex("#AADC99")];function Se({onChange:t}){const[o,r]=m.useState(d.Color4.blackHighlight);return e.jsx("div",{className:l.colorWrap,children:ye.map((s,x)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},x))})}function O({onChange:t}){const[o,r]=m.useState(d.Color4.black);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:l.colorWrap,children:$.slice(0,7).map((s,x)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},x))}),e.jsx("div",{className:l.colorWrap,children:$.slice(7).map((s,x)=>e.jsx("button",{style:{backgroundColor:s.toHexString()},className:i.cn(l.color,{[l.colorActive]:o.toHexString()===s.toHexString()}),onClick:()=>{r(s),t(s)}},x))})]})}function Ee({setColorPen:t,setThicknessPen:o}){const[r,s]=m.useState(2);return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(O,{onChange:x=>t(x)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{max:10,min:1,step:.1,type:"range",value:r,onChange:x=>{o(Number.parseFloat(x.target.value)),s(Number.parseFloat(x.target.value))}})})]})}function He({setColorHighlight:t}){return e.jsx("div",{className:l.options,children:e.jsx(Se,{onChange:o=>t(o)})})}function Le({changeColorShape:t,changeBorderColorShape:o,onThicknessChange:r}){return e.jsxs("div",{className:l.options,children:[e.jsx("div",{children:e.jsx(O,{onChange:s=>t(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx(O,{onChange:s=>o(s)})}),e.jsx("div",{className:l.line}),e.jsx("div",{children:e.jsx("input",{defaultValue:0,max:20,min:0,step:1,type:"range",onChange:s=>{r(Number.parseFloat(s.target.value))}})})]})}function Z(t){const{setColorPen:o,refEditor:r,setThicknessPen:s,setColorHighlight:x,changeBorderColorShape:p,onUndo:j,changeColorShape:z,changeShape:f,onThicknessChange:L,onRedo:b,onClear:_}=t,[a,h]=m.useState(null),[T,v]=m.useState(0);return e.jsx(e.Fragment,{children:e.jsxs("div",{className:l.wrapper,children:[e.jsxs("div",{className:l.pen,children:[e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="select"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="select"){h(null),n[0].setEnabled(!1);return}h("select"),n[0].setEnabled(!0)},children:e.jsx(ne,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="text"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(r.current.toolController.setToolEnabled(n[1]),a==="text"){n[1].setEnabled(!1),h(null);return}h("text"),n[1].setEnabled(!0)},children:e.jsx(se,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="pencil"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="pencil"){h(null),n[2].setEnabled(!1);return}h("pencil"),n[2].setEnabled(!0)},children:e.jsx(ie,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="highlighter"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="highlighter"){h(null),n[3].setEnabled(!1);return}h("highlighter"),n[3].setEnabled(!0)},children:e.jsx(ae,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="eraser"}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();if(a==="eraser"){h(null),n[4].setEnabled(!1);return}h("eraser"),n[4].setEnabled(!0)},children:e.jsx(ce,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===0}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(0),v(0)},children:e.jsx(he,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===1}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(1),v(1)},children:e.jsx(ue,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===2}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(2),v(2)},children:e.jsx(de,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===3}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(3),v(3)},children:e.jsx(ge,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===4}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(4),v(4)},children:e.jsx(me,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===5}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(5),v(5)},children:e.jsx(xe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===6}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(6),v(6)},children:e.jsx(pe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===7}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(7),v(7)},children:e.jsx(fe,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===8}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(8),v(8)},children:e.jsx(Te,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===9}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(9),v(9)},children:e.jsx(je,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===10}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(10),v(10)},children:e.jsx(be,{})}),e.jsx("button",{className:i.cn(l.tool,{[l.active]:a==="shapes"&&T===11}),onClick:()=>{const n=r.current.toolController.getPrimaryTools();r.current.toolController.setToolEnabled(n[5]),h("shapes"),n[5].setEnabled(!0),f(11),v(11)},children:e.jsx(Me,{})}),e.jsx("div",{className:l.line}),e.jsx("button",{className:i.cn(l.tool),onClick:j,children:e.jsx(we,{})}),e.jsx("button",{className:i.cn(l.tool),onClick:b,children:e.jsx(ve,{})}),e.jsx("button",{className:i.cn(l.tool),onClick:_,children:e.jsx(Ce,{})})]}),e.jsxs("div",{className:l.optionsWrap,children:[a==="pencil"&&e.jsx(Ee,{setColorPen:o,setThicknessPen:s}),a==="highlighter"&&e.jsx(He,{setColorHighlight:x}),a==="shapes"&&e.jsx(Le,{changeBorderColorShape:p,changeColorShape:z,changeShape:f,onThicknessChange:L})]})]})})}let B=!1;const ke=({editor:t,upload:o,tooltipOptions:r})=>{const[s,x]=m.useState(!1),p=m.useRef(null),j=m.useRef(null),z=()=>{(async()=>{const c=document.querySelector("#easydrawer");c&&(p.current=new d.Editor(c,{wheelEventsEnabled:!1,disableZoom:!0}),j.current=d.makeDropdownToolbar(p.current),j.current.addDefaultToolWidgets())})()};m.useEffect(()=>{s&&setTimeout(()=>{z()},200)},[s]);const f=async()=>{if(p.current){const C=p.current.toSVG(),c=C.outerHTML,g=`drawer-${G.shortId()}.svg`;let H=G.i(C.outerHTML);if(o){const P=i.dataURLtoFile(H,g);H=await o(P)}t==null||t.chain().focus().setDrawer({type:"drawer",src:H,alt:encodeURIComponent(c),width:426,height:212},!!c).run()}x(!1)},L=C=>{const c=p.current.toolController.getPrimaryTools()[2],g=j.current.getWidgetById("pen-1");c&&g&&(c.setColor(C),g.serializeState())},b=C=>{const c=p.current.toolController.getPrimaryTools()[2],g=j.current.getWidgetById("pen-1");c&&g&&(c.setThickness(C),g.serializeState())},_=C=>{const c=p.current.toolController.getPrimaryTools()[3],g=j.current.getWidgetById("pen-2");c&&g&&(c.setColor(C),g.serializeState())},a=C=>{const c=j.current.getWidgetById("shape");c&&c.setShapeType(C)},h=C=>{const c=p.current.toolController.getPrimaryTools()[5],g=j.current.getWidgetById("shape");c&&g&&(c.setColor(C),g.serializeState())},T=C=>{const c=p.current.toolController.getPrimaryTools()[5],g=j.current.getWidgetById("shape");c&&g&&(c.setThickness(C),g.serializeState())},v=C=>{const c=p.current.toolController.getPrimaryTools()[5],g=j.current.getWidgetById("shape");c&&g&&(c.setBorderColor(C),g.serializeState())},n=()=>{if(B){for(;p.current.history.redoStackSize>0;)p.current.history.redo();B=!1;return}p.current.history.undo()},R=()=>{B||p.current.history.redo()},A=()=>{if(!B){for(;p.current.history.undoStackSize>0;)n();B=!0}};return e.jsxs(i.Dialog,{onOpenChange:x,open:s,children:[e.jsx(i.DialogTrigger,{asChild:!0,children:e.jsx(i.ActionButton,{action:()=>x(!0),icon:"PencilRuler",tooltip:"Drawer",tooltipOptions:r})}),e.jsxs(i.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[e.jsx(i.DialogTitle,{children:"Drawer"}),e.jsxs("div",{style:{height:"600px",width:"100%",borderWidth:1,background:"white",position:"relative"},children:[e.jsx("div",{className:"richtext-size-full",id:"easydrawer"}),e.jsx(Z,{changeBorderColorShape:v,changeColorShape:h,changeShape:a,onClear:A,onRedo:R,onThicknessChange:T,onUndo:n,refEditor:p,setColorHighlight:_,setColorPen:L,setThicknessPen:b})]}),e.jsx(i.DialogFooter,{children:e.jsx(i.Button,{onClick:f,type:"button",children:"Save changes"})})]})]})},I={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"};function Ne({editor:t,node:o,updateAttributes:r,getPos:s,selected:x}){const[p,j]=m.useState({width:q.IMAGE_MAX_SIZE,height:q.IMAGE_MAX_SIZE}),[z,f]=m.useState({width:0,height:0}),[L]=m.useState([I.TOP_LEFT,I.TOP_RIGHT,I.BOTTOM_LEFT,I.BOTTOM_RIGHT]),[b,_]=m.useState(!1),[a,h]=m.useState({x:0,y:0,w:0,h:0,dir:""}),{align:T}=o==null?void 0:o.attrs,v=m.useMemo(()=>{const{src:u,alt:y,width:S,height:k}=o==null?void 0:o.attrs,N=F.isNumber(S)?`${S}px`:S,w=F.isNumber(k)?`${k}px`:k;return{src:u||void 0,alt:y||void 0,style:{width:N||void 0,height:w||void 0}}},[o==null?void 0:o.attrs]),n=m.useMemo(()=>{const{style:{width:u}}=v;return{width:u==="100%"?u:void 0}},[v]);function R(u){f({width:u.target.width,height:u.target.height})}function A(){t.commands.setNodeSelection(s())}const C=m.useCallback(i.throttle(()=>{const{width:u}=getComputedStyle(t.view.dom);j(y=>({...y,width:Number.parseInt(u,10)}))},q.IMAGE_THROTTLE_WAIT_TIME),[t]);function c(u,y){u.preventDefault(),u.stopPropagation();const S=z.width,k=z.height,N=S/k;let w=Number(o.attrs.width),E=Number(o.attrs.height);const M=p.width;w&&!E?(w=w>M?M:w,E=Math.round(w/N)):E&&!w?(w=Math.round(E*N),w=w>M?M:w):!w&&!E?(w=S>M?M:S,E=Math.round(w/N)):w=w>M?M:w,_(!0),h({x:u.clientX,y:u.clientY,w,h:E,dir:y})}const g=m.useCallback(i.throttle(u=>{if(u.preventDefault(),u.stopPropagation(),!b)return;const{x:y,w:S,dir:k}=a,N=(u.clientX-y)*(/l/.test(k)?-1:1),{width:w,height:E}=o==null?void 0:o.attrs,M=w/E,V=i.clamp(S+N,q.IMAGE_MIN_SIZE,p.width),X=Math.round(V/M);r({width:V,height:X})},q.IMAGE_THROTTLE_WAIT_TIME),[b,a,p,r,o==null?void 0:o.attrs]),H=m.useCallback(u=>{u.preventDefault(),u.stopPropagation(),b&&(h({x:0,y:0,w:0,h:0,dir:""}),_(!1),A())},[b,A]),P=m.useCallback(()=>{document==null||document.addEventListener("mousemove",g,!0),document==null||document.addEventListener("mouseup",H,!0)},[g,H]),W=m.useCallback(()=>{document==null||document.removeEventListener("mousemove",g,!0),document==null||document.removeEventListener("mouseup",H,!0)},[g,H]);m.useEffect(()=>(b?P():W(),()=>{W()}),[b,P,W]);const D=m.useMemo(()=>new ResizeObserver(()=>C()),[C]);return m.useEffect(()=>(D.observe(t.view.dom),()=>{D.disconnect()}),[t.view.dom,D]),e.jsx(U.NodeViewWrapper,{className:"image-view",style:{...n,width:"100%",textAlign:T},children:e.jsxs("div",{"data-drag-handle":!0,draggable:"true",style:{...n,background:"#fff"},className:`image-view__body ${x?"image-view__body--focused":""} ${b?"image-view__body--resizing":""}`,children:[e.jsx("img",{alt:v.alt,className:"image-view__body__image block",height:"auto",onClick:A,onLoad:R,src:v.src,style:v.style}),t.view.editable&&(x||b)&&e.jsx("div",{className:"image-resizer",children:L==null?void 0:L.map(u=>e.jsx("span",{className:`image-resizer__handler image-resizer__handler--${u}`,onMouseDown:y=>c(y,u)},`image-dir-${u}`))})]})})}const ze=i.index_default.extend({name:"drawer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),inline:!1,content:"",marks:"",group:"block",draggable:!1,selectable:!0,atom:!0,HTMLAttributes:{class:"drawer"},button:({editor:o,t:r,extension:s})=>{var x;return{component:ke,componentProps:{action:()=>!0,isActive:()=>!1,disabled:!1,editor:o,icon:"PencilRuler",tooltip:r("editor.drawer.tooltip"),upload:(x=s==null?void 0:s.options)==null?void 0:x.upload}}}}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),width:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("width");return s?Number.parseInt(s,10):320},renderHTML:o=>({width:o.width})},height:{default:null,parseHTML:o=>{const r=o.querySelector("img"),s=r==null?void 0:r.getAttribute("height");return s?Number.parseInt(s,10):212},renderHTML:o=>({height:o.height})},align:{default:"center",parseHTML:o=>o.getAttribute("align"),renderHTML:o=>({align:o.align})}}},addNodeView(){return U.ReactNodeViewRenderer(Ne)},addCommands(){return{setDrawer:(t,o)=>({commands:r,editor:s})=>o?r.insertContent({type:this.name,attrs:t}):r.insertContentAt(s.state.selection.anchor,{type:this.name,attrs:t}),setAlignImageDrawer:t=>({commands:o})=>o.updateAttributes(this.name,{align:t})}},renderHTML({HTMLAttributes:t}){const{align:o}=t;return["div",{style:o?`text-align: ${o};`:"",class:"imageDrawer"},["img",F.mergeAttributes(this.options.HTMLAttributes,t)]]},parseHTML(){return[{tag:"div[class=imageDrawer]",getAttrs:t=>{const o=t.querySelector("img"),r=o==null?void 0:o.getAttribute("width"),s=o==null?void 0:o.getAttribute("height");return{src:o==null?void 0:o.getAttribute("src"),alt:o==null?void 0:o.getAttribute("alt"),width:r?Number.parseInt(r,10):null,height:s?Number.parseInt(s,10):null,align:(o==null?void 0:o.getAttribute("align"))||t.style.textAlign||null}}}]}});exports.ControlDrawer=Z;exports.Drawer=ze;