@remarkablejames/editor 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/README.md +1 -1
  2. package/lib/ActionMenuButton-D9o3Kwmv.cjs +1 -0
  3. package/lib/{ActionMenuButton-DBZjUu-F.js → ActionMenuButton-nxV91Fqo.js} +10 -9
  4. package/lib/Attachment.cjs +19 -1
  5. package/lib/Attachment.js +270 -7
  6. package/lib/Blockquote.cjs +2 -2
  7. package/lib/Blockquote.js +12 -13
  8. package/lib/Bold.cjs +1 -1
  9. package/lib/Bold.js +10 -11
  10. package/lib/BulletList.cjs +1 -1
  11. package/lib/BulletList.js +8 -9
  12. package/lib/Callout.cjs +1 -1
  13. package/lib/Callout.js +45 -41
  14. package/lib/Clear.cjs +1 -1
  15. package/lib/Clear.js +14 -13
  16. package/lib/Code.cjs +1 -1
  17. package/lib/Code.js +5 -6
  18. package/lib/CodeBlock.cjs +1 -1
  19. package/lib/CodeBlock.js +31 -30
  20. package/lib/CodeView.cjs +1 -1
  21. package/lib/CodeView.js +8 -9
  22. package/lib/Color.cjs +1 -1
  23. package/lib/Color.js +19 -18
  24. package/lib/Column.cjs +1 -1
  25. package/lib/Column.js +8 -9
  26. package/lib/Drawer-Bh-y5bs8.cjs +2 -0
  27. package/lib/{Drawer-DTCwtJEs.js → Drawer-CF6Z_IA2.js} +24 -18
  28. package/lib/Drawer.cjs +1 -1
  29. package/lib/Drawer.js +3 -3
  30. package/lib/Emoji.cjs +1 -1
  31. package/lib/Emoji.js +15 -14
  32. package/lib/Excalidraw.cjs +1 -1
  33. package/lib/Excalidraw.js +33 -28
  34. package/lib/ExportPdf.cjs +3 -3
  35. package/lib/ExportPdf.js +13 -14
  36. package/lib/ExportWord.cjs +1 -1
  37. package/lib/ExportWord.js +6 -6
  38. package/lib/FontFamily.cjs +1 -1
  39. package/lib/FontFamily.js +6 -7
  40. package/lib/FontSize.cjs +1 -1
  41. package/lib/FontSize.js +14 -15
  42. package/lib/Heading.cjs +1 -1
  43. package/lib/Heading.js +26 -26
  44. package/lib/Highlight.cjs +1 -1
  45. package/lib/Highlight.js +23 -22
  46. package/lib/History.cjs +1 -1
  47. package/lib/History.js +11 -11
  48. package/lib/HorizontalRule.cjs +1 -1
  49. package/lib/HorizontalRule.js +9 -10
  50. package/lib/Icon-BvGyfX2j.js +15 -0
  51. package/lib/Icon-wjwoRc9F.cjs +1 -0
  52. package/lib/Iframe-BbfZKbPY.cjs +1 -0
  53. package/lib/{Iframe-D-UYBxiv.js → Iframe-Dfd3LI7b.js} +18 -15
  54. package/lib/Iframe.cjs +1 -1
  55. package/lib/Iframe.js +3 -3
  56. package/lib/Image.cjs +1 -1
  57. package/lib/Image.js +5 -4
  58. package/lib/ImageCropper-CY1ETEjC.cjs +10 -0
  59. package/lib/ImageCropper-DrSdjo9x.js +979 -0
  60. package/lib/ImageGif.cjs +1 -1
  61. package/lib/ImageGif.js +80 -77
  62. package/lib/ImportWord.cjs +1 -1
  63. package/lib/ImportWord.js +28 -26
  64. package/lib/{Indent-Bvt-Qwar.js → Indent-CDVF9DWN.js} +30 -31
  65. package/lib/Indent-Q1VuhSM2.cjs +1 -0
  66. package/lib/Indent.cjs +1 -1
  67. package/lib/Indent.js +2 -2
  68. package/lib/Italic.cjs +1 -1
  69. package/lib/Italic.js +11 -12
  70. package/lib/{Katex-CJDtvu-v.js → Katex-DqhWWAA-.js} +22 -19
  71. package/lib/Katex-K1QU2SB2.cjs +4 -0
  72. package/lib/Katex.cjs +1 -1
  73. package/lib/Katex.js +2 -2
  74. package/lib/LineHeight.cjs +1 -1
  75. package/lib/LineHeight.js +20 -19
  76. package/lib/Link.cjs +1 -1
  77. package/lib/Link.js +2 -2
  78. package/lib/LinkEditBlock-CBYGLs3J.cjs +5 -0
  79. package/lib/{LinkEditBlock-Cdqwj_NU.js → LinkEditBlock-xP0pGVhB.js} +24 -19
  80. package/lib/Mention.js +3 -3
  81. package/lib/{Mermaid-CnMYVX1P.js → Mermaid-BJ6ryVdY.js} +48 -45
  82. package/lib/Mermaid-D3_nLeOW.cjs +2 -0
  83. package/lib/Mermaid.cjs +1 -1
  84. package/lib/Mermaid.js +2 -2
  85. package/lib/MoreMark.cjs +1 -1
  86. package/lib/MoreMark.js +28 -26
  87. package/lib/OrderedList.cjs +1 -1
  88. package/lib/OrderedList.js +10 -11
  89. package/lib/PaywallSeparator.cjs +1 -0
  90. package/lib/PaywallSeparator.js +140 -0
  91. package/lib/SearchAndReplace.cjs +1 -1
  92. package/lib/SearchAndReplace.js +42 -37
  93. package/lib/SlashCommand.cjs +1 -1
  94. package/lib/SlashCommand.js +5 -5
  95. package/lib/SlashCommandNodeView-CUJrDQS7.cjs +1 -0
  96. package/lib/{SlashCommandNodeView-DcoLvt_6.js → SlashCommandNodeView-DS9FqMiY.js} +80 -62
  97. package/lib/Strike.cjs +1 -1
  98. package/lib/Strike.js +11 -12
  99. package/lib/Table-CV6pUoVf.cjs +5 -0
  100. package/lib/{Table-Cu12PvQ_.js → Table-CcG-JNtV.js} +46 -46
  101. package/lib/Table.cjs +1 -1
  102. package/lib/Table.js +1 -1
  103. package/lib/TaskList.cjs +1 -1
  104. package/lib/TaskList.js +11 -12
  105. package/lib/TextAlign.cjs +1 -1
  106. package/lib/TextAlign.js +27 -26
  107. package/lib/TextDirection.cjs +1 -1
  108. package/lib/TextDirection.js +19 -18
  109. package/lib/TextUnderline.cjs +1 -1
  110. package/lib/TextUnderline.js +8 -9
  111. package/lib/{Twitter-CrX4XY1j.js → Twitter-BIL3o833.js} +22 -18
  112. package/lib/Twitter-BfSTqPDh.cjs +1 -0
  113. package/lib/Twitter.cjs +1 -1
  114. package/lib/Twitter.js +2 -2
  115. package/lib/Video-DAKr90QL.js +231 -0
  116. package/lib/Video-HAinT0w6.cjs +1 -0
  117. package/lib/Video.cjs +1 -1
  118. package/lib/Video.js +5 -4
  119. package/lib/bubble.cjs +3 -3
  120. package/lib/bubble.js +86 -77
  121. package/lib/button-090-I3tp.js +35 -0
  122. package/lib/button-B4Sz2ZhW.cjs +1 -0
  123. package/lib/checkbox-BCPsu7yR.cjs +1 -0
  124. package/lib/checkbox-DiXWHAI0.js +29 -0
  125. package/lib/{clsx-BUPZHhq3.js → clsx-m_C5j3RU.js} +24 -24
  126. package/lib/components/RichTextProvider.d.ts +1 -1
  127. package/lib/dialog-C8J59d2J.cjs +1 -0
  128. package/lib/dialog-bDkDW-C_.js +95 -0
  129. package/lib/dom-dataset-BqoJhJXt.cjs +1 -0
  130. package/lib/dom-dataset-CIEeltF6.js +47 -0
  131. package/lib/{dropdown-menu-CVwXaR3Z.js → dropdown-menu-DWt_xj4h.js} +1 -1
  132. package/lib/{dropdown-menu-XIrQk3jr.cjs → dropdown-menu-tUP872Zv.cjs} +1 -1
  133. package/lib/events.constant-Bke62qxm.cjs +1 -0
  134. package/lib/events.constant-CSWD3-ho.js +72 -0
  135. package/lib/extensions/PaywallSeparator/PaywallSeparator.d.ts +35 -0
  136. package/lib/extensions/PaywallSeparator/components/PaywallIcon.d.ts +2 -0
  137. package/lib/extensions/PaywallSeparator/components/PaywallSeparatorView.d.ts +17 -0
  138. package/lib/extensions/PaywallSeparator/components/RichTextPaywallSeparator.d.ts +1 -0
  139. package/lib/extensions/PaywallSeparator/components/index.d.ts +2 -0
  140. package/lib/extensions/PaywallSeparator/index.d.ts +1 -0
  141. package/lib/file-i7e4nQY2.cjs +1 -0
  142. package/lib/file-jDdkhyj7.js +43 -0
  143. package/lib/{index-RkKGy5oa.js → index-B3Ijnbxs.js} +1 -1
  144. package/lib/index-BXh8X1ch.cjs +1 -0
  145. package/lib/{index-Dl3OjzmR.js → index-C1KQsOcg.js} +1 -1
  146. package/lib/{index-D4M4hrH4.js → index-C8FjP66D.js} +1 -1
  147. package/lib/index-jMN4V2hr.js +2763 -0
  148. package/lib/{index-DZj2z9_1.js → index-s3l5RdyW.js} +1 -1
  149. package/lib/index.cjs +4 -4
  150. package/lib/index.js +464 -149
  151. package/lib/input-C_J-pfTx.js +21 -0
  152. package/lib/input-DwLo4r7V.cjs +1 -0
  153. package/lib/isNumber-BTYSVlKo.cjs +1 -0
  154. package/lib/isNumber-WaBzl_0s.js +15 -0
  155. package/lib/label-BgIVynq3.cjs +1 -0
  156. package/lib/label-ClsOg9Hr.js +11 -0
  157. package/lib/{popover-DDT8YRht.js → popover-BC7FRr8B.js} +1 -1
  158. package/lib/{popover-0syCfWYi.cjs → popover-C3A6zzNV.cjs} +1 -1
  159. package/lib/{renderNodeView-dj6AaFSX.js → renderNodeView-C_hPIdEs.js} +2 -2
  160. package/lib/{select-DTNz0ZeE.cjs → select-B8HIWDXf.cjs} +1 -1
  161. package/lib/{select-D9wQw2qB.js → select-DSKqhVGR.js} +1 -1
  162. package/lib/{separator-DRGTEiX4.js → separator-BJWSNjvr.js} +13 -12
  163. package/lib/separator-D6ruF682.cjs +1 -0
  164. package/lib/style.css +1 -1
  165. package/lib/tabs-D1J1iB7B.js +46 -0
  166. package/lib/tabs-IEbMQmNX.cjs +1 -0
  167. package/lib/{textarea-DfVzbMr5.js → textarea-Ch5w3PiI.js} +1 -1
  168. package/lib/{textarea-DpkwluT0.cjs → textarea-CtVdqwSM.cjs} +1 -1
  169. package/lib/theme.cjs +1 -1
  170. package/lib/theme.js +18 -18
  171. package/lib/throttle-CRNq0z-O.js +249 -0
  172. package/lib/throttle-gTTvqDTW.cjs +1 -0
  173. package/lib/toggle-C9tcMm1r.cjs +1 -0
  174. package/lib/toggle-CaSwYCk4.js +89 -0
  175. package/lib/types.d.ts +5 -5
  176. package/lib/{updatePosition-C294Pixi.js → updatePosition-DvfTZHcH.js} +2 -2
  177. package/lib/use-toast-C6zPo25l.cjs +1 -0
  178. package/lib/use-toast-CEOqhXfx.js +97 -0
  179. package/lib/useButtonProps-D-ruygH7.js +165 -0
  180. package/lib/useButtonProps-D9ndBdmA.cjs +1 -0
  181. package/package.json +34 -32
  182. package/lib/ActionMenuButton-C6jGtl3k.cjs +0 -1
  183. package/lib/Drawer-B031ezmA.cjs +0 -2
  184. package/lib/Iframe-BUK2pkOL.cjs +0 -1
  185. package/lib/Indent-_y6N8MIQ.cjs +0 -1
  186. package/lib/Katex-bJXkt-VP.cjs +0 -4
  187. package/lib/LinkEditBlock-ewTApx0K.cjs +0 -5
  188. package/lib/Mermaid-Dwz9o-yM.cjs +0 -2
  189. package/lib/SlashCommandNodeView-BMgQJ4xT.cjs +0 -1
  190. package/lib/Table-B8CHl8jK.cjs +0 -5
  191. package/lib/Twitter-6HYP_upt.cjs +0 -1
  192. package/lib/index-B0d-u29p.js +0 -5425
  193. package/lib/index-De9MZVWQ.cjs +0 -28
  194. package/lib/separator-D8lOAf8f.cjs +0 -1
@@ -0,0 +1,979 @@
1
+ import { jsx as n, jsxs as v, Fragment as W } from "react/jsx-runtime";
2
+ import X, { useState as k, useMemo as P, useCallback as j, useEffect as Z, useRef as le } from "react";
3
+ import pe from "react-image-crop";
4
+ import { B } from "./button-090-I3tp.js";
5
+ import { D as se, a as oe, b as ce, c as de, d as be } from "./dialog-bDkDW-C_.js";
6
+ import { h as J, m as ye, k as ve } from "./clsx-m_C5j3RU.js";
7
+ import { a as K, c as xe } from "./throttle-CRNq0z-O.js";
8
+ import { I as Q, i as ee, j as Ie, u as ue } from "./index-BGd2HiwP.js";
9
+ import { i as te, c as we } from "./isNumber-WaBzl_0s.js";
10
+ import { A as Te } from "./toggle-CaSwYCk4.js";
11
+ import { f as Ae, u as Ce, c as Le, i as me } from "./useButtonProps-D-ruygH7.js";
12
+ import { d as Me, r as ke } from "./file-jDdkhyj7.js";
13
+ import { I as G } from "./Icon-BvGyfX2j.js";
14
+ import { u as he } from "./use-toast-CEOqhXfx.js";
15
+ import { T as Se, a as Ne, b as ie, c as ne } from "./tabs-D1J1iB7B.js";
16
+ import { C as Ee } from "./checkbox-DiXWHAI0.js";
17
+ import { L as ae } from "./label-ClsOg9Hr.js";
18
+ import { I as re } from "./input-C_J-pfTx.js";
19
+ const $ = {
20
+ TOP_LEFT: "tl",
21
+ TOP_RIGHT: "tr",
22
+ BOTTOM_LEFT: "bl",
23
+ BOTTOM_RIGHT: "br"
24
+ };
25
+ function _e({
26
+ src: e,
27
+ style: t
28
+ }) {
29
+ return /* @__PURE__ */ v(
30
+ "div",
31
+ {
32
+ style: {
33
+ position: "relative",
34
+ display: "inline-block",
35
+ overflow: "hidden",
36
+ borderRadius: 8,
37
+ background: "hsl(var(--muted, 220 14% 96%))",
38
+ minHeight: 120,
39
+ minWidth: 180,
40
+ ...t
41
+ },
42
+ children: [
43
+ e && /* @__PURE__ */ n(
44
+ "img",
45
+ {
46
+ src: e,
47
+ alt: "",
48
+ "aria-hidden": !0,
49
+ style: {
50
+ display: "block",
51
+ width: "100%",
52
+ height: "100%",
53
+ objectFit: "cover",
54
+ filter: "blur(20px) saturate(0.5)",
55
+ transform: "scale(1.1)",
56
+ opacity: 0.5
57
+ }
58
+ }
59
+ ),
60
+ /* @__PURE__ */ n(
61
+ "div",
62
+ {
63
+ style: {
64
+ position: "absolute",
65
+ inset: 0,
66
+ background: "linear-gradient(110deg, transparent 30%, hsl(var(--muted-foreground, 220 9% 46%) / 0.08) 50%, transparent 70%)",
67
+ animation: "richtext-skeleton-shimmer 1.8s ease-in-out infinite"
68
+ }
69
+ }
70
+ ),
71
+ /* @__PURE__ */ v(
72
+ "div",
73
+ {
74
+ style: {
75
+ position: "absolute",
76
+ inset: 0,
77
+ display: "flex",
78
+ flexDirection: "column",
79
+ alignItems: "center",
80
+ justifyContent: "center",
81
+ gap: 8,
82
+ pointerEvents: "none"
83
+ },
84
+ children: [
85
+ /* @__PURE__ */ n(
86
+ "svg",
87
+ {
88
+ width: "28",
89
+ height: "28",
90
+ viewBox: "0 0 24 24",
91
+ fill: "none",
92
+ stroke: "currentColor",
93
+ strokeWidth: "2",
94
+ strokeLinecap: "round",
95
+ strokeLinejoin: "round",
96
+ style: {
97
+ color: "hsl(var(--muted-foreground, 220 9% 46%))",
98
+ animation: "richtext-skeleton-spin 1s linear infinite"
99
+ },
100
+ children: /* @__PURE__ */ n("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
101
+ }
102
+ ),
103
+ /* @__PURE__ */ n(
104
+ "span",
105
+ {
106
+ style: {
107
+ fontSize: 12,
108
+ fontWeight: 500,
109
+ color: "hsl(var(--muted-foreground, 220 9% 46%))",
110
+ userSelect: "none"
111
+ },
112
+ children: "Uploading…"
113
+ }
114
+ )
115
+ ]
116
+ }
117
+ ),
118
+ /* @__PURE__ */ n("style", { children: `
119
+ @keyframes richtext-skeleton-shimmer {
120
+ 0% { transform: translateX(-100%); }
121
+ 100% { transform: translateX(100%); }
122
+ }
123
+ @keyframes richtext-skeleton-spin {
124
+ from { transform: rotate(0deg); }
125
+ to { transform: rotate(360deg); }
126
+ }
127
+ ` })
128
+ ]
129
+ }
130
+ );
131
+ }
132
+ function ze(e) {
133
+ var O, R, F, U;
134
+ const [t, s] = k({
135
+ width: Q,
136
+ height: Q
137
+ }), [a, r] = k({
138
+ width: 0,
139
+ height: 0
140
+ }), [d] = k([
141
+ $.TOP_LEFT,
142
+ $.TOP_RIGHT,
143
+ $.BOTTOM_LEFT,
144
+ $.BOTTOM_RIGHT
145
+ ]), [o, I] = k(!1), [c, p] = k({
146
+ x: 0,
147
+ y: 0,
148
+ w: 0,
149
+ h: 0,
150
+ dir: ""
151
+ }), { align: x, inline: w, uploading: M } = (O = e == null ? void 0 : e.node) == null ? void 0 : O.attrs, h = w && (x === "left" || x === "right"), f = P(() => {
152
+ var q;
153
+ const { src: i, alt: l, width: b, height: A, flipX: L, flipY: m } = (q = e == null ? void 0 : e.node) == null ? void 0 : q.attrs, _ = te(b) ? `${b}px` : b, z = te(A) ? `${A}px` : A, Y = [];
154
+ L && Y.push("rotateX(180deg)"), m && Y.push("rotateY(180deg)");
155
+ const ge = Y.join(" ");
156
+ return {
157
+ src: i || void 0,
158
+ alt: l || void 0,
159
+ style: {
160
+ width: _ || void 0,
161
+ height: z || void 0,
162
+ transform: ge || "none",
163
+ ...h ? { float: x } : {}
164
+ }
165
+ };
166
+ }, [(R = e == null ? void 0 : e.node) == null ? void 0 : R.attrs]), C = P(() => {
167
+ const {
168
+ style: { width: i }
169
+ } = f;
170
+ return { width: i === "100%" ? i : void 0 };
171
+ }, [f]);
172
+ function S(i) {
173
+ r({
174
+ width: i.target.width,
175
+ height: i.target.height
176
+ });
177
+ }
178
+ function T() {
179
+ const { editor: i, getPos: l } = e;
180
+ i.commands.setNodeSelection(l());
181
+ }
182
+ const u = j(
183
+ K(() => {
184
+ const { editor: i } = e, { width: l } = getComputedStyle(i.view.dom);
185
+ s((b) => ({
186
+ ...b,
187
+ width: Number.parseInt(l, 10)
188
+ }));
189
+ }, ee),
190
+ [e == null ? void 0 : e.editor]
191
+ );
192
+ function H(i, l) {
193
+ i.preventDefault(), i.stopPropagation();
194
+ const b = a.width, A = a.height, L = b / A;
195
+ let m = Number(e.node.attrs.width), _ = Number(e.node.attrs.height);
196
+ const z = t.width;
197
+ m && !_ ? (m = m > z ? z : m, _ = Math.round(m / L)) : _ && !m ? (m = Math.round(_ * L), m = m > z ? z : m) : !m && !_ ? (m = b > z ? z : b, _ = Math.round(m / L)) : m = m > z ? z : m, I(!0), p({
198
+ x: i.clientX,
199
+ y: i.clientY,
200
+ w: m,
201
+ h: _,
202
+ dir: l
203
+ });
204
+ }
205
+ const y = j(
206
+ K((i) => {
207
+ if (i.preventDefault(), i.stopPropagation(), !o)
208
+ return;
209
+ const { x: l, w: b, dir: A } = c, L = (i.clientX - l) * (/l/.test(A) ? -1 : 1), m = we(b + L, Ie, t.width);
210
+ e.updateAttributes({
211
+ width: m,
212
+ height: null
213
+ });
214
+ }, ee),
215
+ [o, c, t, e.updateAttributes]
216
+ ), D = j(
217
+ (i) => {
218
+ i.preventDefault(), i.stopPropagation(), o && (p({
219
+ x: 0,
220
+ y: 0,
221
+ w: 0,
222
+ h: 0,
223
+ dir: ""
224
+ }), I(!1), T());
225
+ },
226
+ [o, T]
227
+ ), g = j(() => {
228
+ document == null || document.addEventListener("mousemove", y, !0), document == null || document.addEventListener("mouseup", D, !0);
229
+ }, [y, D]), N = j(() => {
230
+ document == null || document.removeEventListener("mousemove", y, !0), document == null || document.removeEventListener("mouseup", D, !0);
231
+ }, [y, D]);
232
+ Z(() => (o ? g() : N(), () => {
233
+ N();
234
+ }), [o, g, N]);
235
+ const E = P(() => new ResizeObserver(() => u()), [u]);
236
+ return Z(() => (E.observe(e.editor.view.dom), () => {
237
+ E.disconnect();
238
+ }), [e.editor.view.dom, E]), M ? /* @__PURE__ */ n(
239
+ J,
240
+ {
241
+ as: w ? "span" : "div",
242
+ className: "image-view",
243
+ style: {
244
+ float: h ? x : void 0,
245
+ margin: h ? x === "left" ? "1em 1em 1em 0" : "1em 0 1em 1em" : void 0,
246
+ display: w ? "inline" : "block",
247
+ textAlign: h ? void 0 : x,
248
+ width: ((F = f.style) == null ? void 0 : F.width) ?? "auto",
249
+ ...h ? {} : C
250
+ },
251
+ children: /* @__PURE__ */ n("div", { style: C, className: "image-view__body", children: /* @__PURE__ */ n(_e, { src: f.src, style: f.style }) })
252
+ }
253
+ ) : /* @__PURE__ */ n(
254
+ J,
255
+ {
256
+ as: w ? "span" : "div",
257
+ className: "image-view",
258
+ style: {
259
+ float: h ? x : void 0,
260
+ margin: h ? x === "left" ? "1em 1em 1em 0" : "1em 0 1em 1em" : void 0,
261
+ display: w ? "inline" : "block",
262
+ textAlign: h ? void 0 : x,
263
+ width: ((U = f.style) == null ? void 0 : U.width) ?? "auto",
264
+ ...h ? {} : C
265
+ },
266
+ children: /* @__PURE__ */ v(
267
+ "div",
268
+ {
269
+ "data-drag-handle": !0,
270
+ draggable: "true",
271
+ style: C,
272
+ className: `image-view__body ${e != null && e.selected ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
273
+ children: [
274
+ /* @__PURE__ */ n(
275
+ "img",
276
+ {
277
+ alt: f.alt,
278
+ className: "image-view__body__image block",
279
+ height: "auto",
280
+ onClick: T,
281
+ onLoad: S,
282
+ src: f.src,
283
+ style: f.style
284
+ }
285
+ ),
286
+ (e == null ? void 0 : e.editor.view.editable) && ((e == null ? void 0 : e.selected) || o) && /* @__PURE__ */ n("div", { className: "image-resizer", children: d == null ? void 0 : d.map((i) => /* @__PURE__ */ n(
287
+ "span",
288
+ {
289
+ className: `image-resizer__handler image-resizer__handler--${i}`,
290
+ onMouseDown: (l) => H(l, i)
291
+ },
292
+ `image-dir-${i}`
293
+ )) })
294
+ ]
295
+ }
296
+ )
297
+ }
298
+ );
299
+ }
300
+ function Re(e, t) {
301
+ const s = e.type, a = e.name.toLowerCase(), r = a.split(".").pop();
302
+ if (!r) return !1;
303
+ const o = s || {
304
+ heif: "image/heif",
305
+ heic: "image/heic",
306
+ dng: "image/x-adobe-dng",
307
+ cr2: "image/x-canon-cr2",
308
+ nef: "image/x-nikon-nef",
309
+ arw: "image/x-sony-arw",
310
+ raf: "image/x-fuji-raf",
311
+ orf: "image/x-olympus-orf"
312
+ }[r];
313
+ return t.some((I) => {
314
+ if (I.startsWith("."))
315
+ return a.endsWith(I);
316
+ if (I.endsWith("/*")) {
317
+ const c = I.split("/")[0];
318
+ return o == null ? void 0 : o.startsWith(c + "/");
319
+ }
320
+ return o === I;
321
+ });
322
+ }
323
+ function fe(e, t) {
324
+ const { acceptMimes: s, maxSize: a, t: r, toast: d } = t, o = [];
325
+ return (Array.isArray(e) ? e : Object.values(e)).forEach((c) => {
326
+ if (!Re(c, s)) {
327
+ t.onError ? t.onError({
328
+ type: "type",
329
+ message: r("editor.upload.fileTypeNotSupported", {
330
+ fileName: c.name
331
+ }),
332
+ file: c
333
+ }) : d({
334
+ variant: "destructive",
335
+ title: r("editor.upload.fileTypeNotSupported", {
336
+ fileName: c.name
337
+ })
338
+ });
339
+ return;
340
+ }
341
+ if (c.size > a) {
342
+ const p = (a / 1024 / 1024).toFixed(2);
343
+ t.onError ? t.onError({
344
+ type: "size",
345
+ message: r("editor.upload.fileSizeTooBig", {
346
+ fileName: c.name,
347
+ size: p
348
+ }),
349
+ file: c
350
+ }) : d({
351
+ variant: "destructive",
352
+ title: r("editor.upload.fileSizeTooBig", {
353
+ fileName: c.name,
354
+ size: p
355
+ })
356
+ });
357
+ return;
358
+ }
359
+ o.push(c);
360
+ }), o;
361
+ }
362
+ function it() {
363
+ const { t: e } = ue(), { toast: t } = he(), s = Ae(), a = Ce(V.name), { icon: r, tooltip: d } = (a == null ? void 0 : a.componentProps) ?? {}, { editorDisabled: o } = Le(), [I, c] = k(!1), p = me(V.name), [x, w] = k(""), [M, h] = k(""), f = le(null), C = (p == null ? void 0 : p.options.defaultInline) || !1, [S, T] = k(C), u = P(() => p == null ? void 0 : p.options, [p]);
364
+ function H(g) {
365
+ var F;
366
+ const N = (F = g == null ? void 0 : g.target) == null ? void 0 : F.files;
367
+ if (!s || s.isDestroyed || N.length === 0) {
368
+ g.target.value = "";
369
+ return;
370
+ }
371
+ const E = fe(N, {
372
+ acceptMimes: u == null ? void 0 : u.acceptMimes,
373
+ maxSize: u == null ? void 0 : u.maxSize,
374
+ t: e,
375
+ toast: t,
376
+ onError: u.onError
377
+ });
378
+ if (E.length <= 0) {
379
+ g.target.value = "";
380
+ return;
381
+ }
382
+ c(!1);
383
+ const O = M, R = S;
384
+ if (h(""), T(C), u.upload) {
385
+ const U = u != null && u.multiple ? E : [E[0]];
386
+ for (const i of U)
387
+ s.chain().focus().insertImagePlaceholder({
388
+ file: i,
389
+ inline: R,
390
+ alt: O
391
+ }).run();
392
+ } else {
393
+ const U = u != null && u.multiple ? E : [E[0]];
394
+ for (const i of U) {
395
+ const l = URL.createObjectURL(i);
396
+ s.chain().focus().setImageInline({ src: l, inline: R, alt: O }).run();
397
+ }
398
+ }
399
+ g.target.value = "";
400
+ }
401
+ function y(g) {
402
+ g.preventDefault(), g.stopPropagation(), s.chain().focus().setImageInline({ src: x, inline: S, alt: M }).run(), c(!1), T(C), w(""), h("");
403
+ }
404
+ function D(g) {
405
+ var N;
406
+ g.preventDefault(), (N = f.current) == null || N.click();
407
+ }
408
+ return a ? /* @__PURE__ */ v(se, { onOpenChange: c, open: I, children: [
409
+ /* @__PURE__ */ n(oe, { asChild: !0, children: /* @__PURE__ */ n(
410
+ Te,
411
+ {
412
+ disabled: o,
413
+ icon: r,
414
+ tooltip: d,
415
+ action: () => {
416
+ o || c(!0);
417
+ }
418
+ }
419
+ ) }),
420
+ /* @__PURE__ */ v(ce, { children: [
421
+ /* @__PURE__ */ n(de, { children: e("editor.image.dialog.title") }),
422
+ /* @__PURE__ */ v(
423
+ Se,
424
+ {
425
+ activationMode: "manual",
426
+ defaultValue: u.resourceImage === "both" || u.resourceImage === "upload" ? "upload" : "link",
427
+ children: [
428
+ u.resourceImage === "both" && /* @__PURE__ */ v(Ne, { className: "richtext-grid richtext-w-full richtext-grid-cols-2", children: [
429
+ /* @__PURE__ */ n(ie, { value: "upload", children: e("editor.image.dialog.tab.upload") }),
430
+ /* @__PURE__ */ n(ie, { value: "link", children: e("editor.image.dialog.tab.url") })
431
+ ] }),
432
+ /* @__PURE__ */ v("div", { className: "richtext-my-[10px] richtext-flex richtext-items-center richtext-gap-[4px]", children: [
433
+ /* @__PURE__ */ n(
434
+ Ee,
435
+ {
436
+ checked: S,
437
+ onCheckedChange: (g) => {
438
+ T(g);
439
+ }
440
+ }
441
+ ),
442
+ /* @__PURE__ */ n(ae, { children: e("editor.link.dialog.inline") })
443
+ ] }),
444
+ u.enableAlt && /* @__PURE__ */ v("div", { className: "richtext-my-[10px]", children: [
445
+ /* @__PURE__ */ n(ae, { className: "mb-[6px]", children: e("editor.imageUpload.alt") }),
446
+ /* @__PURE__ */ n(
447
+ re,
448
+ {
449
+ onChange: (g) => h(g.target.value),
450
+ required: !0,
451
+ type: "text",
452
+ value: M
453
+ }
454
+ )
455
+ ] }),
456
+ /* @__PURE__ */ v(ne, { value: "upload", children: [
457
+ /* @__PURE__ */ v("div", { className: "richtext-flex richtext-items-center richtext-gap-[10px]", children: [
458
+ /* @__PURE__ */ n(
459
+ B,
460
+ {
461
+ className: "richtext-mt-1 richtext-w-full",
462
+ onClick: D,
463
+ size: "sm",
464
+ children: e("editor.image.dialog.tab.upload")
465
+ }
466
+ ),
467
+ /* @__PURE__ */ n(
468
+ He,
469
+ {
470
+ alt: M,
471
+ disabled: !1,
472
+ editor: s,
473
+ imageInline: S,
474
+ onClose: () => {
475
+ h("");
476
+ }
477
+ }
478
+ )
479
+ ] }),
480
+ /* @__PURE__ */ n(
481
+ "input",
482
+ {
483
+ accept: u.acceptMimes.join(",") || "image/*",
484
+ multiple: u.multiple,
485
+ onChange: H,
486
+ ref: f,
487
+ style: { display: "none" },
488
+ type: "file"
489
+ }
490
+ )
491
+ ] }),
492
+ /* @__PURE__ */ n(ne, { value: "link", children: /* @__PURE__ */ n("form", { onSubmit: y, children: /* @__PURE__ */ v("div", { className: "richtext-flex richtext-items-center richtext-gap-2", children: [
493
+ /* @__PURE__ */ n(
494
+ re,
495
+ {
496
+ autoFocus: !0,
497
+ onChange: (g) => w(g.target.value),
498
+ placeholder: e("editor.image.dialog.placeholder"),
499
+ required: !0,
500
+ type: "url",
501
+ value: x
502
+ }
503
+ ),
504
+ /* @__PURE__ */ n(B, { type: "submit", children: e("editor.image.dialog.button.apply") })
505
+ ] }) }) })
506
+ ]
507
+ }
508
+ )
509
+ ] })
510
+ ] }) : /* @__PURE__ */ n(W, {});
511
+ }
512
+ const Ue = {
513
+ acceptMimes: ["image/jpeg", "image/gif", "image/png", "image/jpg"],
514
+ maxSize: 1024 * 1024 * 5,
515
+ // 5MB
516
+ multiple: !0,
517
+ resourceImage: "both",
518
+ defaultInline: !1,
519
+ enableAlt: !0
520
+ }, V = /* @__PURE__ */ xe.extend({
521
+ group: "inline",
522
+ inline: !0,
523
+ defining: !0,
524
+ draggable: !0,
525
+ selectable: !0,
526
+ addOptions() {
527
+ var e;
528
+ return {
529
+ ...Ue,
530
+ ...(e = this.parent) == null ? void 0 : e.call(this),
531
+ upload: () => Promise.reject("Image Upload Function"),
532
+ button: ({
533
+ editor: t,
534
+ extension: s,
535
+ t: a
536
+ }) => {
537
+ var r, d;
538
+ return {
539
+ componentProps: {
540
+ action: () => !0,
541
+ upload: s.options.upload,
542
+ /* If setImage is not available(when Image Component is not imported), the button is disabled */
543
+ disabled: !((d = (r = t.can()).setImage) != null && d.call(r, {})),
544
+ icon: "ImageUp",
545
+ tooltip: a("editor.image.tooltip")
546
+ }
547
+ };
548
+ }
549
+ };
550
+ },
551
+ addAttributes() {
552
+ var e;
553
+ return {
554
+ ...(e = this.parent) == null ? void 0 : e.call(this),
555
+ uploading: {
556
+ default: !1,
557
+ // Transient attribute — never written to or read from HTML
558
+ parseHTML: () => !1,
559
+ renderHTML: () => ({})
560
+ },
561
+ imageId: {
562
+ default: null,
563
+ parseHTML: (t) => t.getAttribute("data-image-id"),
564
+ renderHTML: (t) => t.imageId ? { "data-image-id": t.imageId } : {}
565
+ },
566
+ flipX: {
567
+ default: !1
568
+ },
569
+ flipY: {
570
+ default: !1
571
+ },
572
+ width: {
573
+ default: null,
574
+ parseHTML: (t) => {
575
+ const s = t.style.width || t.getAttribute("width") || null;
576
+ return s ? Number.parseInt(s, 10) : null;
577
+ },
578
+ renderHTML: (t) => ({
579
+ width: t.width
580
+ })
581
+ },
582
+ align: {
583
+ default: "center",
584
+ parseHTML: (t) => t.getAttribute("align"),
585
+ renderHTML: (t) => ({
586
+ align: t.align
587
+ })
588
+ },
589
+ inline: {
590
+ default: !1,
591
+ parseHTML: (t) => !!t.getAttribute("inline"),
592
+ renderHTML: (t) => ({
593
+ inline: t.inline
594
+ })
595
+ },
596
+ alt: {
597
+ default: "",
598
+ parseHTML: (t) => t.getAttribute("alt"),
599
+ renderHTML: (t) => ({
600
+ alt: t.alt
601
+ })
602
+ }
603
+ };
604
+ },
605
+ addNodeView() {
606
+ return ve(ze);
607
+ },
608
+ addCommands() {
609
+ var s;
610
+ const e = this.name, t = this.options;
611
+ return {
612
+ ...(s = this.parent) == null ? void 0 : s.call(this),
613
+ setImageInline: (a) => ({ commands: r }) => r.insertContent({
614
+ type: e,
615
+ attrs: {
616
+ ...a,
617
+ imageId: a.imageId ?? null,
618
+ inline: a.inline ?? t.defaultInline
619
+ }
620
+ }),
621
+ insertImagePlaceholder: ({
622
+ file: a,
623
+ inline: r,
624
+ alt: d
625
+ }) => ({ editor: o, commands: I }) => {
626
+ const c = URL.createObjectURL(a);
627
+ if (!I.insertContent({
628
+ type: e,
629
+ attrs: {
630
+ src: c,
631
+ alt: d ?? "",
632
+ inline: r ?? t.defaultInline,
633
+ uploading: !0,
634
+ imageId: null
635
+ }
636
+ })) return !1;
637
+ const x = t.upload;
638
+ return x && x(a).then((w) => {
639
+ const { doc: M } = o.state;
640
+ let h = null;
641
+ M.descendants((f, C) => {
642
+ if (f.type.name === e && f.attrs.uploading === !0 && f.attrs.src === c)
643
+ return h = C, !1;
644
+ }), h !== null && o.view.dispatch(
645
+ o.state.tr.setNodeMarkup(h, void 0, {
646
+ ...o.state.doc.nodeAt(h).attrs,
647
+ src: w.cdnUrl,
648
+ imageId: w.imageId,
649
+ uploading: !1
650
+ })
651
+ ), URL.revokeObjectURL(c);
652
+ }).catch((w) => {
653
+ console.error("Image upload failed", w);
654
+ const { doc: M } = o.state;
655
+ let h = null;
656
+ if (M.descendants((f, C) => {
657
+ if (f.type.name === e && f.attrs.uploading === !0 && f.attrs.src === c)
658
+ return h = C, !1;
659
+ }), h !== null) {
660
+ const f = o.state.doc.nodeAt(h);
661
+ f && o.view.dispatch(
662
+ o.state.tr.delete(
663
+ h,
664
+ h + f.nodeSize
665
+ )
666
+ );
667
+ }
668
+ URL.revokeObjectURL(c);
669
+ }), !0;
670
+ },
671
+ updateImage: (a) => ({ commands: r }) => r.updateAttributes(this.name, a),
672
+ setAlignImage: (a) => ({ commands: r }) => r.updateAttributes(this.name, { align: a })
673
+ };
674
+ },
675
+ renderHTML({ HTMLAttributes: e }) {
676
+ const { flipX: t, flipY: s, align: a, inline: r } = e, d = r && (a === "left" || a === "right"), o = t || s ? `transform: rotateX(${t ? "180" : "0"}deg) rotateY(${s ? "180" : "0"}deg);` : "", I = d ? "" : `text-align: ${a};`, x = `${d ? `float: ${a};` : ""}${d ? a === "left" ? "margin: 1em 1em 1em 0;" : "margin: 1em 0 1em 1em;" : ""}${o}`;
677
+ return [
678
+ r ? "span" : "div",
679
+ {
680
+ style: I,
681
+ class: "image"
682
+ },
683
+ [
684
+ "img",
685
+ ye(
686
+ {
687
+ height: "auto",
688
+ style: x
689
+ },
690
+ this.options.HTMLAttributes,
691
+ e
692
+ )
693
+ ]
694
+ ];
695
+ },
696
+ parseHTML() {
697
+ return [
698
+ {
699
+ tag: "span.image img",
700
+ getAttrs: (e) => {
701
+ var d;
702
+ const t = e == null ? void 0 : e.parentElement, s = e == null ? void 0 : e.getAttribute("width"), a = (e == null ? void 0 : e.getAttribute("flipx")) || !1, r = (e == null ? void 0 : e.getAttribute("flipy")) || !1;
703
+ return {
704
+ src: e == null ? void 0 : e.getAttribute("src"),
705
+ alt: e == null ? void 0 : e.getAttribute("alt"),
706
+ caption: e == null ? void 0 : e.getAttribute("caption"),
707
+ width: s ? Number.parseInt(s, 10) : null,
708
+ align: (e == null ? void 0 : e.getAttribute("align")) || ((d = t == null ? void 0 : t.style) == null ? void 0 : d.textAlign) || null,
709
+ inline: (e == null ? void 0 : e.getAttribute("inline")) || !1,
710
+ flipX: a === "true",
711
+ flipY: r === "true"
712
+ };
713
+ }
714
+ },
715
+ {
716
+ tag: "div[class=image]",
717
+ getAttrs: (e) => {
718
+ const t = e.querySelector("img"), s = t == null ? void 0 : t.getAttribute("width"), a = (t == null ? void 0 : t.getAttribute("flipx")) || !1, r = (t == null ? void 0 : t.getAttribute("flipy")) || !1;
719
+ return {
720
+ src: t == null ? void 0 : t.getAttribute("src"),
721
+ alt: t == null ? void 0 : t.getAttribute("alt"),
722
+ caption: t == null ? void 0 : t.getAttribute("caption"),
723
+ width: s ? Number.parseInt(s, 10) : null,
724
+ align: (t == null ? void 0 : t.getAttribute("align")) || e.style.textAlign || null,
725
+ inline: (t == null ? void 0 : t.getAttribute("inline")) || !1,
726
+ flipX: a === "true",
727
+ flipY: r === "true"
728
+ };
729
+ }
730
+ },
731
+ {
732
+ tag: 'img[src]:not([src^="data:"])'
733
+ }
734
+ ];
735
+ }
736
+ // addProseMirrorPlugins() {
737
+ // const validateFile = (file: File): boolean => {
738
+ // // @ts-expect-error
739
+ // if (!this.options.acceptMimes.includes(file.type)) {
740
+ // // toast({ description: t.value('editor.imageUpload.fileTypeNotSupported'), duration: 2000 });
741
+ // return false;
742
+ // }
743
+ // // @ts-expect-error
744
+ // if (file.size > this.options.maxSize) {
745
+ // // toast({
746
+ // // description: `${t.value('editor.imageUpload.fileSizeTooBig')} ${formatFileSize(
747
+ // // this.options.maxSize,
748
+ // // )}.`,
749
+ // // duration: 2000,
750
+ // // });
751
+ // return false;
752
+ // }
753
+ // return true;
754
+ // };
755
+ // const uploadFn = createImageUpload({
756
+ // validateFn: validateFile,
757
+ // onUpload: this.options.upload as any,
758
+ // // postUpload: this.options.postUpload,
759
+ // defaultInline: this.options.defaultInline,
760
+ // });
761
+ // return [
762
+ // UploadImagesPlugin(),
763
+ // new Plugin({
764
+ // key: new PluginKey(`richtextCustomPlugin${this.name}`),
765
+ // props: {
766
+ // handlePaste: (view, event) => {
767
+ // const hasFiles =
768
+ // event.clipboardData &&
769
+ // event.clipboardData.files &&
770
+ // event.clipboardData.files?.length;
771
+ // if (!hasFiles) {
772
+ // return;
773
+ // }
774
+ // const items = [...(event.clipboardData.files || [])];
775
+ // if (items.some(x => x.type === 'text/html')) {
776
+ // return false;
777
+ // }
778
+ // return handleImagePaste(view, event, uploadFn);
779
+ // },
780
+ // handleDrop: (view, event, _, moved) => {
781
+ // if (!(event instanceof DragEvent) || !event.dataTransfer) {
782
+ // return false;
783
+ // }
784
+ // handleImageDrop(view, event, moved, uploadFn);
785
+ // return false;
786
+ // },
787
+ // },
788
+ // }),
789
+ // ];
790
+ // },
791
+ });
792
+ function He({
793
+ editor: e,
794
+ imageInline: t,
795
+ onClose: s,
796
+ disabled: a,
797
+ alt: r
798
+ }) {
799
+ var F, U;
800
+ const { t: d } = ue(), { toast: o } = he(), [I, c] = k(!1), [p, x] = k(!1), w = X.useRef(null), [M, h] = X.useState(), [f, C] = X.useState(""), S = le(null), [T, u] = k({
801
+ src: "",
802
+ file: null
803
+ }), H = me(V.name), y = P(() => (H == null ? void 0 : H.options) ?? {}, [H]);
804
+ function D(i) {
805
+ if (w.current && i.width && i.height) {
806
+ const l = g(w.current, i);
807
+ C(l);
808
+ }
809
+ }
810
+ function g(i, l) {
811
+ const b = document.createElement("canvas"), A = i.naturalWidth / i.width, L = i.naturalHeight / i.height;
812
+ b.width = l.width * A, b.height = l.height * L;
813
+ const m = b.getContext("2d");
814
+ return m && (m.imageSmoothingEnabled = !1, m.drawImage(
815
+ i,
816
+ l.x * A,
817
+ l.y * L,
818
+ l.width * A,
819
+ l.height * L,
820
+ 0,
821
+ 0,
822
+ l.width * A,
823
+ l.height * L
824
+ )), b.toDataURL("image/png", 1);
825
+ }
826
+ const N = X.useCallback(() => {
827
+ var l;
828
+ if (p) return;
829
+ const i = Me(
830
+ f,
831
+ ((l = T == null ? void 0 : T.file) == null ? void 0 : l.name) || "image.png"
832
+ );
833
+ if (c(!1), u({
834
+ src: "",
835
+ file: null
836
+ }), R(), s(), y.upload)
837
+ e.chain().focus().insertImagePlaceholder({
838
+ file: i,
839
+ inline: t,
840
+ alt: r
841
+ }).run();
842
+ else {
843
+ const b = URL.createObjectURL(i);
844
+ e.chain().focus().setImageInline({ src: b, inline: t, alt: r }).run();
845
+ }
846
+ }, [
847
+ f,
848
+ e,
849
+ t,
850
+ p,
851
+ s,
852
+ (F = T == null ? void 0 : T.file) == null ? void 0 : F.name,
853
+ y,
854
+ r
855
+ ]);
856
+ function E(i) {
857
+ var l;
858
+ i.preventDefault(), (l = S.current) == null || l.click();
859
+ }
860
+ const O = async (i) => {
861
+ var m;
862
+ const l = (m = i == null ? void 0 : i.target) == null ? void 0 : m.files;
863
+ if (!e || e.isDestroyed || l.length === 0) {
864
+ i.target.value = "";
865
+ return;
866
+ }
867
+ const b = fe(l, {
868
+ acceptMimes: y == null ? void 0 : y.acceptMimes,
869
+ maxSize: y == null ? void 0 : y.maxSize,
870
+ t: d,
871
+ toast: o,
872
+ onError: y.onError
873
+ });
874
+ if (b.length <= 0) {
875
+ i.target.value = "";
876
+ return;
877
+ }
878
+ const A = b[0], L = await ke(A);
879
+ c(!0), u({
880
+ src: L.src,
881
+ file: A
882
+ });
883
+ }, R = () => {
884
+ S.current && (S.current.value = "");
885
+ };
886
+ return /* @__PURE__ */ v(W, { children: [
887
+ /* @__PURE__ */ n(
888
+ B,
889
+ {
890
+ className: "richtext-mt-1 richtext-w-full",
891
+ disabled: a,
892
+ onClick: E,
893
+ size: "sm",
894
+ children: d("editor.image.dialog.tab.uploadCrop")
895
+ }
896
+ ),
897
+ /* @__PURE__ */ v(
898
+ se,
899
+ {
900
+ open: I,
901
+ onOpenChange: (i) => {
902
+ c(i), i || (u({ src: "", file: null }), R());
903
+ },
904
+ children: [
905
+ /* @__PURE__ */ n(oe, {}),
906
+ /* @__PURE__ */ v(ce, { children: [
907
+ /* @__PURE__ */ n(de, { children: d("editor.image.dialog.tab.uploadCrop") }),
908
+ /* @__PURE__ */ n("div", { children: T.src && /* @__PURE__ */ n(
909
+ pe,
910
+ {
911
+ className: "richtext-w-full",
912
+ crop: M,
913
+ onChange: (i) => h(i),
914
+ onComplete: (i) => D(i),
915
+ children: /* @__PURE__ */ n("img", { alt: "Crop me", ref: w, src: T.src })
916
+ }
917
+ ) }),
918
+ /* @__PURE__ */ v(be, { children: [
919
+ /* @__PURE__ */ v(
920
+ B,
921
+ {
922
+ disabled: p,
923
+ onClick: () => {
924
+ c(!1), u({
925
+ src: "",
926
+ file: null
927
+ }), R();
928
+ },
929
+ children: [
930
+ d("editor.imageUpload.cancel"),
931
+ /* @__PURE__ */ n(G, { className: "richtext-ml-1", name: "Trash2" })
932
+ ]
933
+ }
934
+ ),
935
+ /* @__PURE__ */ n(
936
+ B,
937
+ {
938
+ className: "richtext-w-fit",
939
+ disabled: p || !M,
940
+ onClick: N,
941
+ children: p ? /* @__PURE__ */ v(W, { children: [
942
+ d("editor.imageUpload.uploading"),
943
+ /* @__PURE__ */ n(
944
+ G,
945
+ {
946
+ className: "richtext-ml-1 richtext-animate-spin",
947
+ name: "Loader"
948
+ }
949
+ )
950
+ ] }) : /* @__PURE__ */ v(W, { children: [
951
+ d("editor.imageUpload.crop"),
952
+ /* @__PURE__ */ n(G, { className: "richtext-ml-1", name: "Crop" })
953
+ ] })
954
+ }
955
+ )
956
+ ] })
957
+ ] })
958
+ ]
959
+ }
960
+ ),
961
+ /* @__PURE__ */ n(
962
+ "input",
963
+ {
964
+ accept: ((U = y == null ? void 0 : y.acceptMimes) == null ? void 0 : U.join(",")) || "image/*",
965
+ multiple: !1,
966
+ onChange: O,
967
+ ref: S,
968
+ style: { display: "none" },
969
+ type: "file"
970
+ }
971
+ )
972
+ ] });
973
+ }
974
+ export {
975
+ V as I,
976
+ it as R,
977
+ He as a,
978
+ fe as v
979
+ };