reactjs-tiptap-editor 0.3.30 → 0.3.31

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 (224) hide show
  1. package/lib/{ActionMenuButton-wiDnIxE2.cjs → ActionMenuButton-BCgqJsST.cjs} +1 -1
  2. package/lib/{ActionMenuButton-B6fitGKu.js → ActionMenuButton-D97K0UWT.js} +5 -5
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +15 -15
  5. package/lib/Attachment.d.ts +15 -15
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +15 -15
  9. package/lib/Blockquote.d.ts +15 -15
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +15 -15
  13. package/lib/Bold.d.ts +15 -15
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +15 -15
  17. package/lib/BulletList.d.ts +15 -15
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +15 -15
  21. package/lib/Clear.d.ts +15 -15
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +15 -15
  25. package/lib/Code.d.ts +15 -15
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +15 -15
  29. package/lib/CodeBlock.d.ts +15 -15
  30. package/lib/CodeBlock.js +3 -2
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +15 -15
  33. package/lib/CodeView.d.ts +15 -15
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +15 -15
  37. package/lib/Color.d.ts +15 -15
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +15 -15
  40. package/lib/Document.d.ts +15 -15
  41. package/lib/Drawer-5Q_-WRhc.cjs +1 -0
  42. package/lib/{Drawer-BKTU9CpU.js → Drawer-BHkje8ys.js} +250 -249
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +15 -15
  45. package/lib/Drawer.d.ts +15 -15
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +15 -15
  49. package/lib/Emoji.d.ts +15 -15
  50. package/lib/Emoji.js +22 -21
  51. package/lib/Excalidraw-CG498239.js +290 -0
  52. package/lib/Excalidraw-GUVW-IqC.cjs +1 -0
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +15 -15
  55. package/lib/Excalidraw.d.ts +15 -15
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +15 -15
  59. package/lib/ExportPdf.d.ts +15 -15
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +15 -15
  63. package/lib/ExportWord.d.ts +15 -15
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +15 -15
  67. package/lib/FontFamily.d.ts +15 -15
  68. package/lib/FontFamily.js +11 -10
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +15 -15
  71. package/lib/FontSize.d.ts +15 -15
  72. package/lib/FontSize.js +6 -5
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +15 -15
  75. package/lib/FormatPainter.d.ts +15 -15
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +15 -15
  79. package/lib/Heading.d.ts +15 -15
  80. package/lib/Heading.js +32 -31
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +15 -15
  83. package/lib/Highlight.d.ts +15 -15
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +15 -15
  87. package/lib/History.d.ts +15 -15
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +15 -15
  91. package/lib/HorizontalRule.d.ts +15 -15
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +15 -15
  95. package/lib/Iframe.d.ts +15 -15
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +15 -15
  99. package/lib/Image.d.ts +15 -15
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +15 -15
  103. package/lib/ImageGif.d.ts +15 -15
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +2 -2
  106. package/lib/ImportWord.d.cts +15 -15
  107. package/lib/ImportWord.d.ts +15 -15
  108. package/lib/ImportWord.js +3 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +15 -15
  111. package/lib/Indent.d.ts +15 -15
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +15 -15
  115. package/lib/Italic.d.ts +15 -15
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +15 -15
  119. package/lib/Katex.d.ts +15 -15
  120. package/lib/Katex.js +41 -40
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +15 -15
  123. package/lib/LineHeight.d.ts +15 -15
  124. package/lib/LineHeight.js +17 -16
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +15 -15
  127. package/lib/Link.d.ts +15 -15
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +15 -15
  130. package/lib/ListItem.d.ts +15 -15
  131. package/lib/Mention.d.cts +15 -15
  132. package/lib/Mention.d.ts +15 -15
  133. package/lib/Mermaid.cjs +2 -2
  134. package/lib/Mermaid.d.cts +15 -15
  135. package/lib/Mermaid.d.ts +15 -15
  136. package/lib/Mermaid.js +138 -137
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +15 -15
  139. package/lib/MoreMark.d.ts +15 -15
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +15 -15
  143. package/lib/MultiColumn.d.ts +15 -15
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +15 -15
  147. package/lib/OrderedList.d.ts +15 -15
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-C8Sm1E6J.cjs → RichTextEditor-DWlLqTl9.cjs} +4 -4
  150. package/lib/{RichTextEditor-BQN2eLD_.js → RichTextEditor-KP2Rgcqe.js} +15 -39
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +15 -15
  153. package/lib/SearchAndReplace.d.ts +15 -15
  154. package/lib/SearchAndReplace.js +68 -67
  155. package/lib/Selection.d.cts +15 -15
  156. package/lib/Selection.d.ts +15 -15
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +15 -15
  159. package/lib/SlashCommand.d.ts +15 -15
  160. package/lib/SlashCommand.js +1 -1
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +15 -15
  163. package/lib/Strike.d.ts +15 -15
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +15 -15
  167. package/lib/SubAndSuperScript.d.ts +15 -15
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +15 -15
  171. package/lib/Table.d.ts +15 -15
  172. package/lib/Table.js +2 -1
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +15 -15
  175. package/lib/TableOfContent.d.ts +15 -15
  176. package/lib/TableOfContent.js +50 -49
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +15 -15
  179. package/lib/TaskList.d.ts +15 -15
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +15 -15
  183. package/lib/TextAlign.d.ts +15 -15
  184. package/lib/TextAlign.js +8 -7
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +15 -15
  187. package/lib/TextBubble.d.ts +15 -15
  188. package/lib/TextBubble.js +1 -1
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +15 -15
  191. package/lib/TextDirection.d.ts +15 -15
  192. package/lib/TextDirection.js +14 -13
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +15 -15
  195. package/lib/TextUnderline.d.ts +15 -15
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +15 -15
  198. package/lib/TrailingNode.d.ts +15 -15
  199. package/lib/{Twitter-Dg6WWauX.js → Twitter-99ivY5qv.js} +62 -61
  200. package/lib/{Twitter-CL2pu4QM.cjs → Twitter-BvfvUtNT.cjs} +2 -2
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +15 -15
  203. package/lib/Twitter.d.ts +15 -15
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +15 -15
  207. package/lib/Video.d.ts +15 -15
  208. package/lib/Video.js +1 -1
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +15 -15
  211. package/lib/bubble-extra.d.ts +15 -15
  212. package/lib/bubble-extra.js +5 -5
  213. package/lib/index.cjs +1 -1
  214. package/lib/index.d.cts +16 -15
  215. package/lib/index.d.ts +16 -15
  216. package/lib/index.js +2 -2
  217. package/lib/locale-bundle.d.cts +15 -15
  218. package/lib/locale-bundle.d.ts +15 -15
  219. package/lib/{textarea-BglwYF6b.js → textarea-CktfkXNe.js} +1 -1
  220. package/lib/{textarea-D5WVZMgt.cjs → textarea-DdH64g04.cjs} +1 -1
  221. package/package.json +1 -1
  222. package/lib/Drawer-CmoEF-Zg.cjs +0 -1
  223. package/lib/Excalidraw-CM74U5tG.js +0 -289
  224. package/lib/Excalidraw-DAPP9qgY.cjs +0 -1
@@ -0,0 +1,290 @@
1
+ import { N as Z, n as k, m as z } from "./index-DI9T3iLd.js";
2
+ import { N as P, c as C, R as j, n as V, g as I } from "./dom-dataset-Di3tIRrR.js";
3
+ import { jsxs as x, jsx as r } from "react/jsx-runtime";
4
+ import { useMemo as B, useState as c, useCallback as E, useEffect as _, useRef as U } from "react";
5
+ import { w as $, x as F, A as S, y as X, z as G, F as K, B as Y, K as q } from "./RichTextEditor-KP2Rgcqe.js";
6
+ import { o as J } from "./index-CsK90iVd.js";
7
+ import { Resizable as Q } from "re-resizable";
8
+ let M;
9
+ function O() {
10
+ try {
11
+ return M || (M = J()), M;
12
+ } catch {
13
+ throw new Error("Error EventEmitter");
14
+ }
15
+ }
16
+ const D = "OPEN_EXCALIDRAW_SETTING_MODAL";
17
+ function ee(e, i) {
18
+ O().on(e, i);
19
+ }
20
+ function te(e, i) {
21
+ O().off(e, i);
22
+ }
23
+ function we(e) {
24
+ O().emit(D, e);
25
+ }
26
+ const re = ({ editor: e, tooltipOptions: i }) => {
27
+ const u = B(() => {
28
+ var t;
29
+ return ((t = e.extensionManager.extensions.find(
30
+ (a) => a.name === "excalidraw"
31
+ )) == null ? void 0 : t.options) || {};
32
+ }, [e]), [s, p] = c(null), [l, h] = c({}), [v, m] = c({ elements: [], appState: { isLoading: !1 }, files: null }), [w, o] = c(!1), [g, d] = c(!0), [f, N] = c(null), L = E(
33
+ (t) => {
34
+ t && import("@excalidraw/excalidraw").then((a) => {
35
+ p(a.Excalidraw);
36
+ }).catch(N).finally(() => d(!1));
37
+ },
38
+ [d]
39
+ ), b = E((t) => {
40
+ setTimeout(() => {
41
+ t.refresh();
42
+ });
43
+ }, []), y = E((t, a, A) => {
44
+ h({
45
+ elements: t,
46
+ appState: { isLoading: !1 },
47
+ files: A
48
+ });
49
+ }, []), n = E(() => {
50
+ if (!s) {
51
+ o(!1);
52
+ return;
53
+ }
54
+ e.chain().focus().setExcalidraw({ data: l }).run(), o(!1);
55
+ }, [s, e, l, o]);
56
+ return _(() => {
57
+ const t = (a) => {
58
+ (a == null ? void 0 : a.editor) === e && (o(!0), a && m(a.data));
59
+ };
60
+ return ee(D, t), () => {
61
+ te(D, t);
62
+ };
63
+ }, [e, o]), _(() => {
64
+ !g && s && w && setTimeout(() => {
65
+ window.dispatchEvent(new Event("resize"));
66
+ }, 400);
67
+ }, [g, s, w]), /* @__PURE__ */ x(
68
+ $,
69
+ {
70
+ onOpenChange: o,
71
+ open: w,
72
+ children: [
73
+ /* @__PURE__ */ r(F, { asChild: !0, children: /* @__PURE__ */ r(
74
+ S,
75
+ {
76
+ action: () => o(!0),
77
+ icon: "Excalidraw",
78
+ tooltip: "Excalidraw",
79
+ tooltipOptions: i
80
+ }
81
+ ) }),
82
+ /* @__PURE__ */ x(X, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
83
+ /* @__PURE__ */ r(G, { children: "Excalidraw" }),
84
+ /* @__PURE__ */ x("div", { style: { height: "100%", borderWidth: 1 }, children: [
85
+ g && /* @__PURE__ */ r("p", { children: "Loading..." }),
86
+ f && /* @__PURE__ */ r("p", { children: f && f.message || "Error" }),
87
+ /* @__PURE__ */ r(
88
+ "div",
89
+ {
90
+ ref: L,
91
+ style: { width: "100%", height: 600 },
92
+ children: !g && !f && s ? /* @__PURE__ */ r(
93
+ s,
94
+ {
95
+ initialData: v,
96
+ langCode: "en",
97
+ onChange: y,
98
+ ref: b,
99
+ ...u.excalidrawProps
100
+ }
101
+ ) : null
102
+ }
103
+ )
104
+ ] }),
105
+ /* @__PURE__ */ r(K, { children: /* @__PURE__ */ r(
106
+ Y,
107
+ {
108
+ onClick: n,
109
+ type: "button",
110
+ children: "Save changes"
111
+ }
112
+ ) })
113
+ ] })
114
+ ]
115
+ }
116
+ );
117
+ }, ne = "_wrap_15k3c_1", ae = "_renderWrap_15k3c_7", ie = "_handlerWrap_15k3c_30", T = {
118
+ wrap: ne,
119
+ renderWrap: ae,
120
+ handlerWrap: ie
121
+ }, se = 10, oe = 200, R = 15, W = { width: "100%", height: "100%", maxWidth: "100%" };
122
+ function le({ editor: e, node: i, updateAttributes: u }) {
123
+ const s = U(null), p = e.isActive(ce.name), { data: l, width: h, height: v } = i.attrs, [m, w] = c(null), [o, g] = c(!0), [d, f] = c(null), [N, L] = c(100), b = E((n) => () => {
124
+ L(
125
+ (t) => q(n === "minus" ? t - R : t + R, se, oe)
126
+ );
127
+ }, []);
128
+ _(() => {
129
+ let n = !1;
130
+ return import("@excalidraw/excalidraw").then((t) => {
131
+ n || (s.current = t.exportToSvg);
132
+ }).catch((t) => !n && f(t)).finally(() => !n && g(!1)), () => {
133
+ n = !0;
134
+ };
135
+ }, [l]), _(() => {
136
+ let n = !1;
137
+ return (async () => {
138
+ if (!s.current || n || o || d || !l)
139
+ return;
140
+ const a = await s.current(l);
141
+ n || (a.setAttribute("width", "100%"), a.setAttribute("height", "100%"), a.setAttribute("display", "block"), w(a));
142
+ })(), () => {
143
+ n = !0;
144
+ };
145
+ }, [l, o, d]);
146
+ const y = (n) => {
147
+ u({ width: n.width, height: n.height });
148
+ };
149
+ return /* @__PURE__ */ r(P, { className: C(T.wrap, p && T.isActive), children: /* @__PURE__ */ r(
150
+ Q,
151
+ {
152
+ size: { width: Number.parseInt(h), height: Number.parseInt(v) },
153
+ onResizeStop: (n, t, a, A) => {
154
+ y({
155
+ width: Number.parseInt(h) + A.width,
156
+ height: Number.parseInt(v) + A.height
157
+ });
158
+ },
159
+ children: /* @__PURE__ */ x(
160
+ "div",
161
+ {
162
+ className: C(T.renderWrap, "render-wrapper"),
163
+ style: { ...W, overflow: "hidden" },
164
+ children: [
165
+ d && /* @__PURE__ */ r("div", { style: W, children: /* @__PURE__ */ r("p", { children: d.message || d }) }),
166
+ o && /* @__PURE__ */ r("p", { children: "Loading..." }),
167
+ !o && !d && m && /* @__PURE__ */ r(
168
+ "div",
169
+ {
170
+ dangerouslySetInnerHTML: { __html: (m == null ? void 0 : m.outerHTML) ?? "" },
171
+ style: {
172
+ height: "100%",
173
+ maxHeight: "100%",
174
+ padding: 24,
175
+ overflow: "hidden",
176
+ display: "flex",
177
+ justifyContent: "center",
178
+ alignItems: "center",
179
+ transform: `scale(${N / 100})`,
180
+ transition: "all ease-in-out .3s"
181
+ }
182
+ }
183
+ ),
184
+ /* @__PURE__ */ x("div", { className: T.handlerWrap, children: [
185
+ /* @__PURE__ */ r(
186
+ S,
187
+ {
188
+ action: b("minus"),
189
+ icon: "ZoomOut",
190
+ tooltip: "Zoom Out"
191
+ }
192
+ ),
193
+ /* @__PURE__ */ r(
194
+ S,
195
+ {
196
+ action: b("plus"),
197
+ icon: "ZoomIn",
198
+ tooltip: "Zoom In"
199
+ }
200
+ )
201
+ ] })
202
+ ]
203
+ }
204
+ )
205
+ }
206
+ ) });
207
+ }
208
+ const H = { elements: [] }, ce = /* @__PURE__ */ Z.create({
209
+ name: "excalidraw",
210
+ group: "block",
211
+ selectable: !0,
212
+ atom: !0,
213
+ draggable: !0,
214
+ inline: !1,
215
+ addAttributes() {
216
+ return {
217
+ defaultShowPicker: {
218
+ default: !1
219
+ },
220
+ createUser: {
221
+ default: null
222
+ },
223
+ width: {
224
+ default: "100%",
225
+ parseHTML: I("width")
226
+ },
227
+ height: {
228
+ default: 240,
229
+ parseHTML: I("height")
230
+ },
231
+ data: {
232
+ default: H,
233
+ parseHTML: I("data", !0)
234
+ }
235
+ };
236
+ },
237
+ addOptions() {
238
+ var e;
239
+ return {
240
+ ...(e = this.parent) == null ? void 0 : e.call(this),
241
+ HTMLAttributes: {
242
+ class: "excalidraw"
243
+ },
244
+ excalidrawProps: {},
245
+ button: ({ editor: i }) => ({
246
+ component: re,
247
+ componentProps: {
248
+ editor: i
249
+ }
250
+ })
251
+ };
252
+ },
253
+ parseHTML() {
254
+ return [
255
+ {
256
+ tag: "div[class=excalidraw]"
257
+ }
258
+ ];
259
+ },
260
+ renderHTML({ HTMLAttributes: e, node: i }) {
261
+ return ["div", z(this.options.HTMLAttributes, e, V(i))];
262
+ },
263
+ addCommands() {
264
+ return {
265
+ setExcalidraw: (e) => ({ tr: i, commands: u, chain: s }) => {
266
+ var p, l, h;
267
+ return e = e || {}, e.data = e.data || H, ((h = (l = (p = i.selection) == null ? void 0 : p.node) == null ? void 0 : l.type) == null ? void 0 : h.name) == this.name ? u.updateAttributes(this.name, e) : s().insertContent({
268
+ type: this.name,
269
+ attrs: e
270
+ }).run();
271
+ }
272
+ };
273
+ },
274
+ addNodeView() {
275
+ return j(le);
276
+ },
277
+ addInputRules() {
278
+ return [
279
+ k({
280
+ find: /^\$excalidraw\$$/,
281
+ type: this.type,
282
+ getAttributes: () => ({ width: "100%" })
283
+ })
284
+ ];
285
+ }
286
+ });
287
+ export {
288
+ ce as E,
289
+ we as t
290
+ };
@@ -0,0 +1 @@
1
+ "use strict";var W=Object.create;var N=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var P=(e,t,c,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Z(t))!z.call(e,l)&&l!==c&&N(e,l,{get:()=>t[l],enumerable:!(o=H(t,l))||o.enumerable});return e};var y=(e,t,c)=>(c=e!=null?W(q(e)):{},P(t||!e||!e.__esModule?N(c,"default",{value:e,enumerable:!0}):c,e));const L=require("./index-ByRfqzMr.cjs"),g=require("./dom-dataset-Byuf1YmW.cjs"),n=require("react/jsx-runtime"),r=require("react"),h=require("./RichTextEditor-DWlLqTl9.cjs"),B=require("./index-D_A0TBRA.cjs"),V=require("re-resizable");let M;function I(){try{return M||(M=B.mitt()),M}catch{throw new Error("Error EventEmitter")}}const D="OPEN_EXCALIDRAW_SETTING_MODAL";function $(e,t){I().on(e,t)}function U(e,t){I().off(e,t)}function X(e){I().emit(D,e)}const F=({editor:e,tooltipOptions:t})=>{const c=r.useMemo(()=>{var a;return((a=e.extensionManager.extensions.find(i=>i.name==="excalidraw"))==null?void 0:a.options)||{}},[e]),[o,l]=r.useState(null),[d,x]=r.useState({}),[b,f]=r.useState({elements:[],appState:{isLoading:!1},files:null}),[E,u]=r.useState(!1),[w,p]=r.useState(!0),[m,j]=r.useState(null),T=r.useCallback(a=>{a&&import("@excalidraw/excalidraw").then(i=>{l(i.Excalidraw)}).catch(j).finally(()=>p(!1))},[p]),v=r.useCallback(a=>{setTimeout(()=>{a.refresh()})},[]),_=r.useCallback((a,i,A)=>{x({elements:a,appState:{isLoading:!1},files:A})},[]),s=r.useCallback(()=>{if(!o){u(!1);return}e.chain().focus().setExcalidraw({data:d}).run(),u(!1)},[o,e,d,u]);return r.useEffect(()=>{const a=i=>{(i==null?void 0:i.editor)===e&&(u(!0),i&&f(i.data))};return $(D,a),()=>{U(D,a)}},[e,u]),r.useEffect(()=>{!w&&o&&E&&setTimeout(()=>{window.dispatchEvent(new Event("resize"))},400)},[w,o,E]),n.jsxs(h.Dialog,{onOpenChange:u,open:E,children:[n.jsx(h.DialogTrigger,{asChild:!0,children:n.jsx(h.ActionButton,{action:()=>u(!0),icon:"Excalidraw",tooltip:"Excalidraw",tooltipOptions:t})}),n.jsxs(h.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[n.jsx(h.DialogTitle,{children:"Excalidraw"}),n.jsxs("div",{style:{height:"100%",borderWidth:1},children:[w&&n.jsx("p",{children:"Loading..."}),m&&n.jsx("p",{children:m&&m.message||"Error"}),n.jsx("div",{ref:T,style:{width:"100%",height:600},children:!w&&!m&&o?n.jsx(o,{initialData:b,langCode:"en",onChange:_,ref:v,...c.excalidrawProps}):null})]}),n.jsx(h.DialogFooter,{children:n.jsx(h.Button,{onClick:s,type:"button",children:"Save changes"})})]})]})},G="_wrap_15k3c_1",Y="_renderWrap_15k3c_7",J="_handlerWrap_15k3c_30",S={wrap:G,renderWrap:Y,handlerWrap:J},K=10,Q=200,C=15,O={width:"100%",height:"100%",maxWidth:"100%"};function ee({editor:e,node:t,updateAttributes:c}){const o=r.useRef(null),l=e.isActive(k.name),{data:d,width:x,height:b}=t.attrs,[f,E]=r.useState(null),[u,w]=r.useState(!0),[p,m]=r.useState(null),[j,T]=r.useState(100),v=r.useCallback(s=>()=>{T(a=>h.clamp(s==="minus"?a-C:a+C,K,Q))},[]);r.useEffect(()=>{let s=!1;return import("@excalidraw/excalidraw").then(a=>{s||(o.current=a.exportToSvg)}).catch(a=>!s&&m(a)).finally(()=>!s&&w(!1)),()=>{s=!0}},[d]),r.useEffect(()=>{let s=!1;return(async()=>{if(!o.current||s||u||p||!d)return;const i=await o.current(d);s||(i.setAttribute("width","100%"),i.setAttribute("height","100%"),i.setAttribute("display","block"),E(i))})(),()=>{s=!0}},[d,u,p]);const _=s=>{c({width:s.width,height:s.height})};return n.jsx(g.NodeViewWrapper,{className:g.clsx(S.wrap,l&&S.isActive),children:n.jsx(V.Resizable,{size:{width:Number.parseInt(x),height:Number.parseInt(b)},onResizeStop:(s,a,i,A)=>{_({width:Number.parseInt(x)+A.width,height:Number.parseInt(b)+A.height})},children:n.jsxs("div",{className:g.clsx(S.renderWrap,"render-wrapper"),style:{...O,overflow:"hidden"},children:[p&&n.jsx("div",{style:O,children:n.jsx("p",{children:p.message||p})}),u&&n.jsx("p",{children:"Loading..."}),!u&&!p&&f&&n.jsx("div",{dangerouslySetInnerHTML:{__html:(f==null?void 0:f.outerHTML)??""},style:{height:"100%",maxHeight:"100%",padding:24,overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",transform:`scale(${j/100})`,transition:"all ease-in-out .3s"}}),n.jsxs("div",{className:S.handlerWrap,children:[n.jsx(h.ActionButton,{action:v("minus"),icon:"ZoomOut",tooltip:"Zoom Out"}),n.jsx(h.ActionButton,{action:v("plus"),icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}const R={elements:[]},k=L.Node.create({name:"excalidraw",group:"block",selectable:!0,atom:!0,draggable:!0,inline:!1,addAttributes(){return{defaultShowPicker:{default:!1},createUser:{default:null},width:{default:"100%",parseHTML:g.getDatasetAttribute("width")},height:{default:240,parseHTML:g.getDatasetAttribute("height")},data:{default:R,parseHTML:g.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},excalidrawProps:{},button:({editor:t})=>({component:F,componentProps:{editor:t}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",L.mergeAttributes(this.options.HTMLAttributes,e,g.nodeAttrsToDataset(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:c,chain:o})=>{var l,d,x;return e=e||{},e.data=e.data||R,((x=(d=(l=t.selection)==null?void 0:l.node)==null?void 0:d.type)==null?void 0:x.name)==this.name?c.updateAttributes(this.name,e):o().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return g.ReactNodeViewRenderer(ee)},addInputRules(){return[L.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=k;exports.triggerOpenExcalidrawSettingModal=X;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./dom-dataset-Byuf1YmW.cjs");const e=require("./Excalidraw-DAPP9qgY.cjs");exports.Excalidraw=e.Excalidraw;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-ByRfqzMr.cjs");require("./dom-dataset-Byuf1YmW.cjs");const e=require("./Excalidraw-GUVW-IqC.cjs");exports.Excalidraw=e.Excalidraw;
@@ -119,6 +119,21 @@ declare module '@tiptap/core' {
119
119
  }
120
120
 
121
121
 
122
+ declare module '@tiptap/core' {
123
+ interface Commands<ReturnType> {
124
+ iframe: {
125
+ /**
126
+ * Add an iframe
127
+ */
128
+ setIframe: (options: {
129
+ src: string;
130
+ service: string;
131
+ }) => ReturnType;
132
+ };
133
+ }
134
+ }
135
+
136
+
122
137
  declare module '@tiptap/core' {
123
138
  interface Commands<ReturnType> {
124
139
  imageUpload: {
@@ -139,21 +154,6 @@ declare module '@tiptap/core' {
139
154
  }
140
155
 
141
156
 
142
- declare module '@tiptap/core' {
143
- interface Commands<ReturnType> {
144
- iframe: {
145
- /**
146
- * Add an iframe
147
- */
148
- setIframe: (options: {
149
- src: string;
150
- service: string;
151
- }) => ReturnType;
152
- };
153
- }
154
- }
155
-
156
-
157
157
  declare module '@tiptap/core' {
158
158
  interface Commands<ReturnType> {
159
159
  imageGifUpload: {
@@ -119,6 +119,21 @@ declare module '@tiptap/core' {
119
119
  }
120
120
 
121
121
 
122
+ declare module '@tiptap/core' {
123
+ interface Commands<ReturnType> {
124
+ iframe: {
125
+ /**
126
+ * Add an iframe
127
+ */
128
+ setIframe: (options: {
129
+ src: string;
130
+ service: string;
131
+ }) => ReturnType;
132
+ };
133
+ }
134
+ }
135
+
136
+
122
137
  declare module '@tiptap/core' {
123
138
  interface Commands<ReturnType> {
124
139
  imageUpload: {
@@ -139,21 +154,6 @@ declare module '@tiptap/core' {
139
154
  }
140
155
 
141
156
 
142
- declare module '@tiptap/core' {
143
- interface Commands<ReturnType> {
144
- iframe: {
145
- /**
146
- * Add an iframe
147
- */
148
- setIframe: (options: {
149
- src: string;
150
- service: string;
151
- }) => ReturnType;
152
- };
153
- }
154
- }
155
-
156
-
157
157
  declare module '@tiptap/core' {
158
158
  interface Commands<ReturnType> {
159
159
  imageGifUpload: {
package/lib/Excalidraw.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./index-DI9T3iLd.js";
2
2
  import "./dom-dataset-Di3tIRrR.js";
3
- import { E as m } from "./Excalidraw-CM74U5tG.js";
3
+ import { E as m } from "./Excalidraw-CG498239.js";
4
4
  export {
5
5
  m as Excalidraw
6
6
  };
package/lib/ExportPdf.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-ByRfqzMr.cjs"),b=require("./RichTextEditor-C8Sm1E6J.cjs");function y(e,o){var i;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const n=t.contentDocument||((i=t.contentWindow)==null?void 0:i.document);if(!n)return;const{paperSize:a,title:c="Echo Editor",margins:{top:l,right:p,bottom:m,left:h}}=o,u=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index-ByRfqzMr.cjs"),b=require("./RichTextEditor-DWlLqTl9.cjs");function y(e,o){var i;const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t);const n=t.contentDocument||((i=t.contentWindow)==null?void 0:i.document);if(!n)return;const{paperSize:a,title:c="Echo Editor",margins:{top:l,right:p,bottom:m,left:h}}=o,u=`
2
2
  <!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
@@ -196,6 +196,21 @@ declare module '@tiptap/core' {
196
196
  }
197
197
 
198
198
 
199
+ declare module '@tiptap/core' {
200
+ interface Commands<ReturnType> {
201
+ iframe: {
202
+ /**
203
+ * Add an iframe
204
+ */
205
+ setIframe: (options: {
206
+ src: string;
207
+ service: string;
208
+ }) => ReturnType;
209
+ };
210
+ }
211
+ }
212
+
213
+
199
214
  declare module '@tiptap/core' {
200
215
  interface Commands<ReturnType> {
201
216
  imageUpload: {
@@ -216,21 +231,6 @@ declare module '@tiptap/core' {
216
231
  }
217
232
 
218
233
 
219
- declare module '@tiptap/core' {
220
- interface Commands<ReturnType> {
221
- iframe: {
222
- /**
223
- * Add an iframe
224
- */
225
- setIframe: (options: {
226
- src: string;
227
- service: string;
228
- }) => ReturnType;
229
- };
230
- }
231
- }
232
-
233
-
234
234
  declare module '@tiptap/core' {
235
235
  interface Commands<ReturnType> {
236
236
  imageGifUpload: {
@@ -196,6 +196,21 @@ declare module '@tiptap/core' {
196
196
  }
197
197
 
198
198
 
199
+ declare module '@tiptap/core' {
200
+ interface Commands<ReturnType> {
201
+ iframe: {
202
+ /**
203
+ * Add an iframe
204
+ */
205
+ setIframe: (options: {
206
+ src: string;
207
+ service: string;
208
+ }) => ReturnType;
209
+ };
210
+ }
211
+ }
212
+
213
+
199
214
  declare module '@tiptap/core' {
200
215
  interface Commands<ReturnType> {
201
216
  imageUpload: {
@@ -216,21 +231,6 @@ declare module '@tiptap/core' {
216
231
  }
217
232
 
218
233
 
219
- declare module '@tiptap/core' {
220
- interface Commands<ReturnType> {
221
- iframe: {
222
- /**
223
- * Add an iframe
224
- */
225
- setIframe: (options: {
226
- src: string;
227
- service: string;
228
- }) => ReturnType;
229
- };
230
- }
231
- }
232
-
233
-
234
234
  declare module '@tiptap/core' {
235
235
  interface Commands<ReturnType> {
236
236
  imageGifUpload: {
package/lib/ExportPdf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { E as g } from "./index-DI9T3iLd.js";
2
- import { A as b } from "./RichTextEditor-BQN2eLD_.js";
2
+ import { A as b } from "./RichTextEditor-KP2Rgcqe.js";
3
3
  function y(e, n) {
4
4
  var i;
5
5
  const t = document.createElement("iframe");
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-ByRfqzMr.cjs"),s=require("docx"),t=require("prosemirror-docx"),i=require("./RichTextEditor-C8Sm1E6J.cjs"),l=typeof window<"u";function c(o,e){if(l){const n=window.URL.createObjectURL(o),r=document.createElement("a");return r.href=n,r.download=e,r.click(),window.URL.revokeObjectURL(n),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}const u={...t.defaultNodes,hardBreak:t.defaultNodes.hard_break,codeBlock:t.defaultNodes.code_block,orderedList:t.defaultNodes.ordered_list,listItem:t.defaultNodes.list_item,bulletList:t.defaultNodes.bullet_list,horizontalRule:t.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:s.WidthType.PERCENTAGE}}})}},p=new t.DocxSerializer(u,t.defaultMarks),f=a.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:n})=>({component:i.ActionButton,componentProps:{icon:"ExportWord",action:()=>{e==null||e.commands.exportToWord()},tooltip:n("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:()=>async({editor:o})=>{const e={getImageBuffer:async r=>{const d=await(await fetch(r)).arrayBuffer();return new Uint8Array(d)}},n=p.serialize(o.state.doc,e);return s.Packer.toBlob(n).then(r=>c(new Blob([r]),"export-document.docx")),!0}}}});exports.ExportWord=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-ByRfqzMr.cjs"),s=require("docx"),t=require("prosemirror-docx"),i=require("./RichTextEditor-DWlLqTl9.cjs"),l=typeof window<"u";function c(o,e){if(l){const n=window.URL.createObjectURL(o),r=document.createElement("a");return r.href=n,r.download=e,r.click(),window.URL.revokeObjectURL(n),Promise.resolve()}return console.error("Download is not supported in Node.js"),Promise.resolve()}const u={...t.defaultNodes,hardBreak:t.defaultNodes.hard_break,codeBlock:t.defaultNodes.code_block,orderedList:t.defaultNodes.ordered_list,listItem:t.defaultNodes.list_item,bulletList:t.defaultNodes.bullet_list,horizontalRule:t.defaultNodes.horizontal_rule,image(o,e){o.renderInline(e),o.closeBlock(e)},table(o,e){o.table(e,{tableOptions:{width:{size:100,type:s.WidthType.PERCENTAGE}}})}},p=new t.DocxSerializer(u,t.defaultMarks),f=a.Extension.create({name:"exportWord",addOptions(){var o;return{...(o=this.parent)==null?void 0:o.call(this),button:({editor:e,t:n})=>({component:i.ActionButton,componentProps:{icon:"ExportWord",action:()=>{e==null||e.commands.exportToWord()},tooltip:n("editor.exportWord.tooltip"),isActive:()=>!1,disabled:!1}})}},addCommands(){return{exportToWord:()=>async({editor:o})=>{const e={getImageBuffer:async r=>{const d=await(await fetch(r)).arrayBuffer();return new Uint8Array(d)}},n=p.serialize(o.state.doc,e);return s.Packer.toBlob(n).then(r=>c(new Blob([r]),"export-document.docx")),!0}}}});exports.ExportWord=f;
@@ -184,6 +184,21 @@ declare module '@tiptap/core' {
184
184
  }
185
185
 
186
186
 
187
+ declare module '@tiptap/core' {
188
+ interface Commands<ReturnType> {
189
+ iframe: {
190
+ /**
191
+ * Add an iframe
192
+ */
193
+ setIframe: (options: {
194
+ src: string;
195
+ service: string;
196
+ }) => ReturnType;
197
+ };
198
+ }
199
+ }
200
+
201
+
187
202
  declare module '@tiptap/core' {
188
203
  interface Commands<ReturnType> {
189
204
  imageUpload: {
@@ -204,21 +219,6 @@ declare module '@tiptap/core' {
204
219
  }
205
220
 
206
221
 
207
- declare module '@tiptap/core' {
208
- interface Commands<ReturnType> {
209
- iframe: {
210
- /**
211
- * Add an iframe
212
- */
213
- setIframe: (options: {
214
- src: string;
215
- service: string;
216
- }) => ReturnType;
217
- };
218
- }
219
- }
220
-
221
-
222
222
  declare module '@tiptap/core' {
223
223
  interface Commands<ReturnType> {
224
224
  imageGifUpload: {
@@ -184,6 +184,21 @@ declare module '@tiptap/core' {
184
184
  }
185
185
 
186
186
 
187
+ declare module '@tiptap/core' {
188
+ interface Commands<ReturnType> {
189
+ iframe: {
190
+ /**
191
+ * Add an iframe
192
+ */
193
+ setIframe: (options: {
194
+ src: string;
195
+ service: string;
196
+ }) => ReturnType;
197
+ };
198
+ }
199
+ }
200
+
201
+
187
202
  declare module '@tiptap/core' {
188
203
  interface Commands<ReturnType> {
189
204
  imageUpload: {
@@ -204,21 +219,6 @@ declare module '@tiptap/core' {
204
219
  }
205
220
 
206
221
 
207
- declare module '@tiptap/core' {
208
- interface Commands<ReturnType> {
209
- iframe: {
210
- /**
211
- * Add an iframe
212
- */
213
- setIframe: (options: {
214
- src: string;
215
- service: string;
216
- }) => ReturnType;
217
- };
218
- }
219
- }
220
-
221
-
222
222
  declare module '@tiptap/core' {
223
223
  interface Commands<ReturnType> {
224
224
  imageGifUpload: {
package/lib/ExportWord.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { E as a } from "./index-DI9T3iLd.js";
2
2
  import { Packer as i, WidthType as c } from "docx";
3
3
  import { defaultNodes as t, DocxSerializer as d, defaultMarks as l } from "prosemirror-docx";
4
- import { A as p } from "./RichTextEditor-BQN2eLD_.js";
4
+ import { A as p } from "./RichTextEditor-KP2Rgcqe.js";
5
5
  const m = typeof window < "u";
6
6
  function u(e, o) {
7
7
  if (m) {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DclQSrIx.cjs");const y=require("./index-ByRfqzMr.cjs"),m=require("./index-D_A0TBRA.cjs"),o=require("react/jsx-runtime"),F=require("react"),h=require("./ActionMenuButton-wiDnIxE2.cjs"),s=require("./RichTextEditor-C8Sm1E6J.cjs"),x=y.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:i})=>i().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}});function M(t){var r,f,d;const{t:i,lang:u}=m.useLocale(),e=F.useMemo(()=>{var a;const n=(a=t==null?void 0:t.items)==null?void 0:a.find(l=>l.isActive());return n&&!n.default?{...n}:{title:t.tooltip,font:i("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1,action:()=>t.editor.chain().focus().unsetFontFamily().run()}},[i,u,t]);return o.jsxs(s.DropdownMenu,{children:[o.jsx(s.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:o.jsx(h.ActionMenuButton,{disabled:t==null?void 0:t.disabled,icon:"MenuDown",title:((r=e==null?void 0:e.font)==null?void 0:r.length)>7?`${(f=e==null?void 0:e.font)==null?void 0:f.slice(0,6)}...`:e==null?void 0:e.font,tooltip:t==null?void 0:t.tooltip})}),o.jsx(s.DropdownMenuContent,{className:"richtext-w-full",children:(d=t==null?void 0:t.items)==null?void 0:d.map((n,c)=>{const a=n.font===i("editor.fontFamily.default.tooltip")?{}:{fontFamily:n.font};return o.jsxs(F.Fragment,{children:[o.jsx(s.DropdownMenuCheckboxItem,{checked:(e==null?void 0:e.font)===n.font,onClick:n.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:a,children:n.font})}),n.font===i("editor.fontFamily.default.tooltip")&&o.jsx(s.DropdownMenuSeparator,{})]},`font-family-${c}`)})})]})}const b=x.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),fontFamilyList:m.DEFAULT_FONT_FAMILY_LIST,button({editor:i,extension:u,t:e}){var a;const{extensions:r=[]}=i.extensionManager??[],f=s.ensureNameValueOptions(((a=u==null?void 0:u.options)==null?void 0:a.fontFamilyList)||[]),d=r.find(l=>l.name==="base-kit"),n=f.map(l=>({action:()=>{i.chain().focus().setFontFamily(l.value).run()},isActive:()=>i.isActive("textStyle",{fontFamily:l.value})||!1,disabled:!i.can().setFontFamily(l.value),title:l.name,font:l.value}));d&&d.options.textStyle!==!1&&n.unshift({action:()=>i.chain().focus().unsetFontFamily().run(),isActive:()=>!1,disabled:!1,font:e("editor.fontFamily.default.tooltip"),title:e("editor.fontFamily.tooltip")});const c=n.filter(l=>l.disabled).length===n.length;return{component:M,componentProps:{tooltip:e("editor.fontFamily.tooltip"),disabled:c,items:n,editor:i}}}}}});exports.DEFAULT_FONT_FAMILY_LIST=m.DEFAULT_FONT_FAMILY_LIST;exports.FontFamily=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-DclQSrIx.cjs");const y=require("./index-ByRfqzMr.cjs"),m=require("./index-D_A0TBRA.cjs"),o=require("react/jsx-runtime"),F=require("react"),h=require("./ActionMenuButton-BCgqJsST.cjs"),u=require("./RichTextEditor-DWlLqTl9.cjs"),x=y.Extension.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:i})=>i().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}});function M(t){var f,c,d;const{t:i,lang:s}=m.useLocale(),n=F.useMemo(()=>{var a;const e=(a=t==null?void 0:t.items)==null?void 0:a.find(l=>l.isActive());return e&&!e.default?{...e}:{title:t.tooltip,font:i("editor.fontFamily.default.tooltip"),isActive:()=>!1,disabled:!1,action:()=>t.editor.chain().focus().unsetFontFamily().run()}},[i,s,t]);return o.jsxs(u.DropdownMenu,{children:[o.jsx(u.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:o.jsx(h.ActionMenuButton,{disabled:t==null?void 0:t.disabled,icon:"MenuDown",title:((f=n==null?void 0:n.font)==null?void 0:f.length)>7?`${(c=n==null?void 0:n.font)==null?void 0:c.slice(0,6)}...`:n==null?void 0:n.font,tooltip:t==null?void 0:t.tooltip,tooltipOptions:t==null?void 0:t.tooltipOptions})}),o.jsx(u.DropdownMenuContent,{className:"richtext-w-full",children:(d=t==null?void 0:t.items)==null?void 0:d.map((e,r)=>{const a=e.font===i("editor.fontFamily.default.tooltip")?{}:{fontFamily:e.font};return o.jsxs(F.Fragment,{children:[o.jsx(u.DropdownMenuCheckboxItem,{checked:(n==null?void 0:n.font)===e.font,onClick:e.action,children:o.jsx("div",{className:"richtext-ml-1 richtext-h-full",style:a,children:e.font})}),e.font===i("editor.fontFamily.default.tooltip")&&o.jsx(u.DropdownMenuSeparator,{})]},`font-family-${r}`)})})]})}const b=x.extend({addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),fontFamilyList:m.DEFAULT_FONT_FAMILY_LIST,button({editor:i,extension:s,t:n}){var a;const{extensions:f=[]}=i.extensionManager??[],c=u.ensureNameValueOptions(((a=s==null?void 0:s.options)==null?void 0:a.fontFamilyList)||[]),d=f.find(l=>l.name==="base-kit"),e=c.map(l=>({action:()=>{i.chain().focus().setFontFamily(l.value).run()},isActive:()=>i.isActive("textStyle",{fontFamily:l.value})||!1,disabled:!i.can().setFontFamily(l.value),title:l.name,font:l.value}));d&&d.options.textStyle!==!1&&e.unshift({action:()=>i.chain().focus().unsetFontFamily().run(),isActive:()=>!1,disabled:!1,font:n("editor.fontFamily.default.tooltip"),title:n("editor.fontFamily.tooltip")});const r=e.filter(l=>l.disabled).length===e.length;return{component:M,componentProps:{tooltip:n("editor.fontFamily.tooltip"),disabled:r,items:e,editor:i}}}}}});exports.DEFAULT_FONT_FAMILY_LIST=m.DEFAULT_FONT_FAMILY_LIST;exports.FontFamily=b;
@@ -197,6 +197,21 @@ declare module '@tiptap/core' {
197
197
  }
198
198
 
199
199
 
200
+ declare module '@tiptap/core' {
201
+ interface Commands<ReturnType> {
202
+ iframe: {
203
+ /**
204
+ * Add an iframe
205
+ */
206
+ setIframe: (options: {
207
+ src: string;
208
+ service: string;
209
+ }) => ReturnType;
210
+ };
211
+ }
212
+ }
213
+
214
+
200
215
  declare module '@tiptap/core' {
201
216
  interface Commands<ReturnType> {
202
217
  imageUpload: {
@@ -217,21 +232,6 @@ declare module '@tiptap/core' {
217
232
  }
218
233
 
219
234
 
220
- declare module '@tiptap/core' {
221
- interface Commands<ReturnType> {
222
- iframe: {
223
- /**
224
- * Add an iframe
225
- */
226
- setIframe: (options: {
227
- src: string;
228
- service: string;
229
- }) => ReturnType;
230
- };
231
- }
232
- }
233
-
234
-
235
235
  declare module '@tiptap/core' {
236
236
  interface Commands<ReturnType> {
237
237
  imageGifUpload: {