reactjs-tiptap-editor 0.3.29 → 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 (225) hide show
  1. package/lib/{ActionMenuButton-5Y8QcYxD.cjs → ActionMenuButton-BCgqJsST.cjs} +1 -1
  2. package/lib/{ActionMenuButton-Cs9DM_16.js → ActionMenuButton-D97K0UWT.js} +5 -5
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +4 -4
  5. package/lib/Attachment.d.ts +4 -4
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +4 -4
  9. package/lib/Blockquote.d.ts +4 -4
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +4 -4
  13. package/lib/Bold.d.ts +4 -4
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +4 -4
  17. package/lib/BulletList.d.ts +4 -4
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +4 -4
  21. package/lib/Clear.d.ts +4 -4
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +4 -4
  25. package/lib/Code.d.ts +4 -4
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +4 -4
  29. package/lib/CodeBlock.d.ts +4 -4
  30. package/lib/CodeBlock.js +3 -2
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +4 -4
  33. package/lib/CodeView.d.ts +4 -4
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +4 -4
  37. package/lib/Color.d.ts +4 -4
  38. package/lib/Color.js +2 -2
  39. package/lib/Document.d.cts +4 -4
  40. package/lib/Document.d.ts +4 -4
  41. package/lib/Drawer-5Q_-WRhc.cjs +1 -0
  42. package/lib/{Drawer-BCmNLh31.js → Drawer-BHkje8ys.js} +250 -249
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +4 -4
  45. package/lib/Drawer.d.ts +4 -4
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +4 -4
  49. package/lib/Emoji.d.ts +4 -4
  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 +4 -4
  55. package/lib/Excalidraw.d.ts +4 -4
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +4 -4
  59. package/lib/ExportPdf.d.ts +4 -4
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +4 -4
  63. package/lib/ExportWord.d.ts +4 -4
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +4 -4
  67. package/lib/FontFamily.d.ts +4 -4
  68. package/lib/FontFamily.js +11 -10
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +4 -4
  71. package/lib/FontSize.d.ts +4 -4
  72. package/lib/FontSize.js +6 -5
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +4 -4
  75. package/lib/FormatPainter.d.ts +4 -4
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +4 -4
  79. package/lib/Heading.d.ts +4 -4
  80. package/lib/Heading.js +32 -31
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +4 -4
  83. package/lib/Highlight.d.ts +4 -4
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +4 -4
  87. package/lib/History.d.ts +4 -4
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +4 -4
  91. package/lib/HorizontalRule.d.ts +4 -4
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +4 -4
  95. package/lib/Iframe.d.ts +4 -4
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +4 -4
  99. package/lib/Image.d.ts +4 -4
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +4 -4
  103. package/lib/ImageGif.d.ts +4 -4
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +2 -2
  106. package/lib/ImportWord.d.cts +4 -4
  107. package/lib/ImportWord.d.ts +4 -4
  108. package/lib/ImportWord.js +3 -2
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +4 -4
  111. package/lib/Indent.d.ts +4 -4
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +4 -4
  115. package/lib/Italic.d.ts +4 -4
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +4 -4
  119. package/lib/Katex.d.ts +4 -4
  120. package/lib/Katex.js +41 -40
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +4 -4
  123. package/lib/LineHeight.d.ts +4 -4
  124. package/lib/LineHeight.js +17 -16
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +4 -4
  127. package/lib/Link.d.ts +4 -4
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +4 -4
  130. package/lib/ListItem.d.ts +4 -4
  131. package/lib/Mention.d.cts +4 -4
  132. package/lib/Mention.d.ts +4 -4
  133. package/lib/Mermaid.cjs +2 -2
  134. package/lib/Mermaid.d.cts +4 -4
  135. package/lib/Mermaid.d.ts +4 -4
  136. package/lib/Mermaid.js +138 -137
  137. package/lib/MoreMark.cjs +1 -1
  138. package/lib/MoreMark.d.cts +4 -4
  139. package/lib/MoreMark.d.ts +4 -4
  140. package/lib/MoreMark.js +1 -1
  141. package/lib/MultiColumn.cjs +1 -1
  142. package/lib/MultiColumn.d.cts +4 -4
  143. package/lib/MultiColumn.d.ts +4 -4
  144. package/lib/MultiColumn.js +1 -1
  145. package/lib/OrderedList.cjs +1 -1
  146. package/lib/OrderedList.d.cts +4 -4
  147. package/lib/OrderedList.d.ts +4 -4
  148. package/lib/OrderedList.js +1 -1
  149. package/lib/{RichTextEditor-DsUcQSbm.cjs → RichTextEditor-DWlLqTl9.cjs} +4 -4
  150. package/lib/{RichTextEditor-e6q30rbV.js → RichTextEditor-KP2Rgcqe.js} +18 -44
  151. package/lib/SearchAndReplace.cjs +1 -1
  152. package/lib/SearchAndReplace.d.cts +4 -4
  153. package/lib/SearchAndReplace.d.ts +4 -4
  154. package/lib/SearchAndReplace.js +68 -67
  155. package/lib/Selection.d.cts +4 -4
  156. package/lib/Selection.d.ts +4 -4
  157. package/lib/SlashCommand.cjs +1 -1
  158. package/lib/SlashCommand.d.cts +4 -4
  159. package/lib/SlashCommand.d.ts +4 -4
  160. package/lib/SlashCommand.js +1 -1
  161. package/lib/Strike.cjs +1 -1
  162. package/lib/Strike.d.cts +4 -4
  163. package/lib/Strike.d.ts +4 -4
  164. package/lib/Strike.js +1 -1
  165. package/lib/SubAndSuperScript.cjs +1 -1
  166. package/lib/SubAndSuperScript.d.cts +4 -4
  167. package/lib/SubAndSuperScript.d.ts +4 -4
  168. package/lib/SubAndSuperScript.js +1 -1
  169. package/lib/Table.cjs +1 -1
  170. package/lib/Table.d.cts +4 -4
  171. package/lib/Table.d.ts +4 -4
  172. package/lib/Table.js +2 -1
  173. package/lib/TableOfContent.cjs +1 -1
  174. package/lib/TableOfContent.d.cts +4 -4
  175. package/lib/TableOfContent.d.ts +4 -4
  176. package/lib/TableOfContent.js +50 -49
  177. package/lib/TaskList.cjs +1 -1
  178. package/lib/TaskList.d.cts +4 -4
  179. package/lib/TaskList.d.ts +4 -4
  180. package/lib/TaskList.js +1 -1
  181. package/lib/TextAlign.cjs +1 -1
  182. package/lib/TextAlign.d.cts +4 -4
  183. package/lib/TextAlign.d.ts +4 -4
  184. package/lib/TextAlign.js +8 -7
  185. package/lib/TextBubble.cjs +1 -1
  186. package/lib/TextBubble.d.cts +4 -4
  187. package/lib/TextBubble.d.ts +4 -4
  188. package/lib/TextBubble.js +1 -1
  189. package/lib/TextDirection.cjs +1 -1
  190. package/lib/TextDirection.d.cts +4 -4
  191. package/lib/TextDirection.d.ts +4 -4
  192. package/lib/TextDirection.js +14 -13
  193. package/lib/TextUnderline.cjs +1 -1
  194. package/lib/TextUnderline.d.cts +4 -4
  195. package/lib/TextUnderline.d.ts +4 -4
  196. package/lib/TextUnderline.js +1 -1
  197. package/lib/TrailingNode.d.cts +4 -4
  198. package/lib/TrailingNode.d.ts +4 -4
  199. package/lib/{Twitter-Wb7cD3M-.js → Twitter-99ivY5qv.js} +62 -61
  200. package/lib/{Twitter-D2Osj8qP.cjs → Twitter-BvfvUtNT.cjs} +2 -2
  201. package/lib/Twitter.cjs +1 -1
  202. package/lib/Twitter.d.cts +4 -4
  203. package/lib/Twitter.d.ts +4 -4
  204. package/lib/Twitter.js +1 -1
  205. package/lib/Video.cjs +1 -1
  206. package/lib/Video.d.cts +4 -4
  207. package/lib/Video.d.ts +4 -4
  208. package/lib/Video.js +1 -1
  209. package/lib/bubble-extra.cjs +1 -1
  210. package/lib/bubble-extra.d.cts +4 -4
  211. package/lib/bubble-extra.d.ts +4 -4
  212. package/lib/bubble-extra.js +5 -5
  213. package/lib/index.cjs +1 -1
  214. package/lib/index.d.cts +5 -4
  215. package/lib/index.d.ts +5 -4
  216. package/lib/index.js +2 -2
  217. package/lib/locale-bundle.d.cts +4 -4
  218. package/lib/locale-bundle.d.ts +4 -4
  219. package/lib/style.css +1 -1
  220. package/lib/{textarea-Csmx5x-_.js → textarea-CktfkXNe.js} +1 -1
  221. package/lib/{textarea-BVbzd9-k.cjs → textarea-DdH64g04.cjs} +1 -1
  222. package/package.json +1 -1
  223. package/lib/Drawer-DCAp7eZF.cjs +0 -1
  224. package/lib/Excalidraw-BI50RQL-.cjs +0 -1
  225. package/lib/Excalidraw-CYPcjYZB.js +0 -289
@@ -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-BI50RQL-.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;
@@ -67,8 +67,8 @@ declare module '@tiptap/core' {
67
67
 
68
68
  declare module '@tiptap/core' {
69
69
  interface Commands<ReturnType> {
70
- exportPdf: {
71
- exportToPdf: () => ReturnType;
70
+ excalidraw: {
71
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
72
72
  };
73
73
  }
74
74
  }
@@ -76,8 +76,8 @@ declare module '@tiptap/core' {
76
76
 
77
77
  declare module '@tiptap/core' {
78
78
  interface Commands<ReturnType> {
79
- excalidraw: {
80
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
79
+ exportPdf: {
80
+ exportToPdf: () => ReturnType;
81
81
  };
82
82
  }
83
83
  }
@@ -67,8 +67,8 @@ declare module '@tiptap/core' {
67
67
 
68
68
  declare module '@tiptap/core' {
69
69
  interface Commands<ReturnType> {
70
- exportPdf: {
71
- exportToPdf: () => ReturnType;
70
+ excalidraw: {
71
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
72
72
  };
73
73
  }
74
74
  }
@@ -76,8 +76,8 @@ declare module '@tiptap/core' {
76
76
 
77
77
  declare module '@tiptap/core' {
78
78
  interface Commands<ReturnType> {
79
- excalidraw: {
80
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
79
+ exportPdf: {
80
+ exportToPdf: () => ReturnType;
81
81
  };
82
82
  }
83
83
  }
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-CYPcjYZB.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-DsUcQSbm.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>
@@ -144,8 +144,8 @@ declare module '@tiptap/core' {
144
144
 
145
145
  declare module '@tiptap/core' {
146
146
  interface Commands<ReturnType> {
147
- exportPdf: {
148
- exportToPdf: () => ReturnType;
147
+ excalidraw: {
148
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
149
149
  };
150
150
  }
151
151
  }
@@ -153,8 +153,8 @@ declare module '@tiptap/core' {
153
153
 
154
154
  declare module '@tiptap/core' {
155
155
  interface Commands<ReturnType> {
156
- excalidraw: {
157
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
156
+ exportPdf: {
157
+ exportToPdf: () => ReturnType;
158
158
  };
159
159
  }
160
160
  }
@@ -144,8 +144,8 @@ declare module '@tiptap/core' {
144
144
 
145
145
  declare module '@tiptap/core' {
146
146
  interface Commands<ReturnType> {
147
- exportPdf: {
148
- exportToPdf: () => ReturnType;
147
+ excalidraw: {
148
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
149
149
  };
150
150
  }
151
151
  }
@@ -153,8 +153,8 @@ declare module '@tiptap/core' {
153
153
 
154
154
  declare module '@tiptap/core' {
155
155
  interface Commands<ReturnType> {
156
- excalidraw: {
157
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
156
+ exportPdf: {
157
+ exportToPdf: () => ReturnType;
158
158
  };
159
159
  }
160
160
  }
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-e6q30rbV.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-DsUcQSbm.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;
@@ -132,8 +132,8 @@ declare module '@tiptap/core' {
132
132
 
133
133
  declare module '@tiptap/core' {
134
134
  interface Commands<ReturnType> {
135
- exportPdf: {
136
- exportToPdf: () => ReturnType;
135
+ excalidraw: {
136
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
137
137
  };
138
138
  }
139
139
  }
@@ -141,8 +141,8 @@ declare module '@tiptap/core' {
141
141
 
142
142
  declare module '@tiptap/core' {
143
143
  interface Commands<ReturnType> {
144
- excalidraw: {
145
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
144
+ exportPdf: {
145
+ exportToPdf: () => ReturnType;
146
146
  };
147
147
  }
148
148
  }
@@ -132,8 +132,8 @@ declare module '@tiptap/core' {
132
132
 
133
133
  declare module '@tiptap/core' {
134
134
  interface Commands<ReturnType> {
135
- exportPdf: {
136
- exportToPdf: () => ReturnType;
135
+ excalidraw: {
136
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
137
137
  };
138
138
  }
139
139
  }
@@ -141,8 +141,8 @@ declare module '@tiptap/core' {
141
141
 
142
142
  declare module '@tiptap/core' {
143
143
  interface Commands<ReturnType> {
144
- excalidraw: {
145
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
144
+ exportPdf: {
145
+ exportToPdf: () => ReturnType;
146
146
  };
147
147
  }
148
148
  }
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-e6q30rbV.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-5Y8QcYxD.cjs"),s=require("./RichTextEditor-DsUcQSbm.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;
@@ -145,8 +145,8 @@ declare module '@tiptap/core' {
145
145
 
146
146
  declare module '@tiptap/core' {
147
147
  interface Commands<ReturnType> {
148
- exportPdf: {
149
- exportToPdf: () => ReturnType;
148
+ excalidraw: {
149
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
150
150
  };
151
151
  }
152
152
  }
@@ -154,8 +154,8 @@ declare module '@tiptap/core' {
154
154
 
155
155
  declare module '@tiptap/core' {
156
156
  interface Commands<ReturnType> {
157
- excalidraw: {
158
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
157
+ exportPdf: {
158
+ exportToPdf: () => ReturnType;
159
159
  };
160
160
  }
161
161
  }
@@ -145,8 +145,8 @@ declare module '@tiptap/core' {
145
145
 
146
146
  declare module '@tiptap/core' {
147
147
  interface Commands<ReturnType> {
148
- exportPdf: {
149
- exportToPdf: () => ReturnType;
148
+ excalidraw: {
149
+ setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
150
150
  };
151
151
  }
152
152
  }
@@ -154,8 +154,8 @@ declare module '@tiptap/core' {
154
154
 
155
155
  declare module '@tiptap/core' {
156
156
  interface Commands<ReturnType> {
157
- excalidraw: {
158
- setExcalidraw: (attrs?: IExcalidrawAttrs) => ReturnType;
157
+ exportPdf: {
158
+ exportToPdf: () => ReturnType;
159
159
  };
160
160
  }
161
161
  }
package/lib/FontFamily.js CHANGED
@@ -3,8 +3,8 @@ import { E as c } from "./index-DI9T3iLd.js";
3
3
  import { u as y, h as F } from "./index-CsK90iVd.js";
4
4
  import { jsxs as r, jsx as a } from "react/jsx-runtime";
5
5
  import { useMemo as h, Fragment as b } from "react";
6
- import { A as x } from "./ActionMenuButton-Cs9DM_16.js";
7
- import { D as M, e as A, f as L, h as g, u as D, j as S } from "./RichTextEditor-e6q30rbV.js";
6
+ import { A as x } from "./ActionMenuButton-D97K0UWT.js";
7
+ import { D as M, e as A, f as L, h as g, u as D, j as S } from "./RichTextEditor-KP2Rgcqe.js";
8
8
  const w = c.create({
9
9
  name: "fontFamily",
10
10
  addOptions() {
@@ -36,8 +36,8 @@ const w = c.create({
36
36
  }
37
37
  });
38
38
  function T(t) {
39
- var m, u, f;
40
- const { t: i, lang: s } = y(), n = h(() => {
39
+ var m, u, s;
40
+ const { t: i, lang: f } = y(), n = h(() => {
41
41
  var o;
42
42
  const e = (o = t == null ? void 0 : t.items) == null ? void 0 : o.find((l) => l.isActive());
43
43
  return e && !e.default ? {
@@ -49,7 +49,7 @@ function T(t) {
49
49
  disabled: !1,
50
50
  action: () => t.editor.chain().focus().unsetFontFamily().run()
51
51
  };
52
- }, [i, s, t]);
52
+ }, [i, f, t]);
53
53
  return /* @__PURE__ */ r(M, { children: [
54
54
  /* @__PURE__ */ a(
55
55
  A,
@@ -62,12 +62,13 @@ function T(t) {
62
62
  disabled: t == null ? void 0 : t.disabled,
63
63
  icon: "MenuDown",
64
64
  title: ((m = n == null ? void 0 : n.font) == null ? void 0 : m.length) > 7 ? `${(u = n == null ? void 0 : n.font) == null ? void 0 : u.slice(0, 6)}...` : n == null ? void 0 : n.font,
65
- tooltip: t == null ? void 0 : t.tooltip
65
+ tooltip: t == null ? void 0 : t.tooltip,
66
+ tooltipOptions: t == null ? void 0 : t.tooltipOptions
66
67
  }
67
68
  )
68
69
  }
69
70
  ),
70
- /* @__PURE__ */ a(L, { className: "richtext-w-full", children: (f = t == null ? void 0 : t.items) == null ? void 0 : f.map((e, d) => {
71
+ /* @__PURE__ */ a(L, { className: "richtext-w-full", children: (s = t == null ? void 0 : t.items) == null ? void 0 : s.map((e, d) => {
71
72
  const o = e.font === i("editor.fontFamily.default.tooltip") ? {} : { fontFamily: e.font };
72
73
  return /* @__PURE__ */ r(b, { children: [
73
74
  /* @__PURE__ */ a(
@@ -96,9 +97,9 @@ const j = /* @__PURE__ */ w.extend({
96
97
  return {
97
98
  ...(t = this.parent) == null ? void 0 : t.call(this),
98
99
  fontFamilyList: F,
99
- button({ editor: i, extension: s, t: n }) {
100
+ button({ editor: i, extension: f, t: n }) {
100
101
  var o;
101
- const { extensions: m = [] } = i.extensionManager ?? [], u = S(((o = s == null ? void 0 : s.options) == null ? void 0 : o.fontFamilyList) || []), f = m.find(
102
+ const { extensions: m = [] } = i.extensionManager ?? [], u = S(((o = f == null ? void 0 : f.options) == null ? void 0 : o.fontFamilyList) || []), s = m.find(
102
103
  (l) => l.name === "base-kit"
103
104
  ), e = u.map((l) => ({
104
105
  action: () => {
@@ -109,7 +110,7 @@ const j = /* @__PURE__ */ w.extend({
109
110
  title: l.name,
110
111
  font: l.value
111
112
  }));
112
- f && f.options.textStyle !== !1 && e.unshift({
113
+ s && s.options.textStyle !== !1 && e.unshift({
113
114
  action: () => i.chain().focus().unsetFontFamily().run(),
114
115
  isActive: () => !1,
115
116
  disabled: !1,
package/lib/FontSize.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-ByRfqzMr.cjs"),r=require("./index-D_A0TBRA.cjs"),s=require("./RichTextEditor-DsUcQSbm.cjs"),u=require("react/jsx-runtime"),m=require("react"),z=require("./ActionMenuButton-5Y8QcYxD.cjs");function x(e){var a;const{t}=r.useLocale(),l=m.useMemo(()=>{const i=(e.items||[]).find(c=>c.isActive());return i||{title:t("editor.fontSize.default.tooltip"),isActive:()=>!1}},[e]);return u.jsxs(s.DropdownMenu,{children:[u.jsx(s.DropdownMenuTrigger,{asChild:!0,disabled:e==null?void 0:e.disabled,children:u.jsx(z.ActionMenuButton,{disabled:e==null?void 0:e.disabled,icon:"MenuDown",title:l==null?void 0:l.title,tooltip:`${e==null?void 0:e.tooltip}`})}),u.jsx(s.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:(a=e==null?void 0:e.items)==null?void 0:a.map((i,o)=>u.jsx(s.DropdownMenuCheckboxItem,{checked:l.title===i.title,onClick:i.action,children:u.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})},`font-size-${o}`))})]})}const v=f.Extension.create({name:"fontSize",addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),types:["textStyle"],fontSizes:[...r.DEFAULT_FONT_SIZE_LIST],button({editor:t,extension:l,t:a}){var d;const i=s.ensureNameValueOptions(((d=l.options)==null?void 0:d.fontSizes)||r.DEFAULT_FONT_SIZE_VALUE),o=s.ensureNameValueOptions([r.DEFAULT_FONT_SIZE_VALUE])[0],c=i.map(n=>({title:n.value===o.value?a("editor.fontSize.default.tooltip"):String(n.name),isActive:()=>{const{fontSize:S}=t.getAttributes("textStyle");return n.value===o.value&&S===void 0?!0:t.isActive({fontSize:String(n.value)})||!1},action:()=>{if(n.value===o.value){t.commands.unsetFontSize();return}t.commands.setFontSize(String(n.value))},disabled:!t.can().setFontSize(String(n.value)),divider:n.value===o.value||!1,default:n.value===o.value||!1}));return{component:x,componentProps:{editor:t,tooltip:a("editor.fontSize.tooltip"),disabled:!1,items:c,maxHeight:280}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replaceAll(/["']+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.DEFAULT_FONT_SIZE_LIST=r.DEFAULT_FONT_SIZE_LIST;exports.FontSize=v;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./index-ByRfqzMr.cjs"),r=require("./index-D_A0TBRA.cjs"),a=require("./RichTextEditor-DWlLqTl9.cjs"),u=require("react/jsx-runtime"),m=require("react"),z=require("./ActionMenuButton-BCgqJsST.cjs");function x(t){var s;const{t:e}=r.useLocale(),l=m.useMemo(()=>{const i=(t.items||[]).find(c=>c.isActive());return i||{title:e("editor.fontSize.default.tooltip"),isActive:()=>!1}},[t]);return u.jsxs(a.DropdownMenu,{children:[u.jsx(a.DropdownMenuTrigger,{asChild:!0,disabled:t==null?void 0:t.disabled,children:u.jsx(z.ActionMenuButton,{disabled:t==null?void 0:t.disabled,icon:"MenuDown",title:l==null?void 0:l.title,tooltip:`${t==null?void 0:t.tooltip}`,tooltipOptions:t==null?void 0:t.tooltipOptions})}),u.jsx(a.DropdownMenuContent,{className:"richtext-max-h-96 richtext-w-32 richtext-overflow-y-auto",children:(s=t==null?void 0:t.items)==null?void 0:s.map((i,o)=>u.jsx(a.DropdownMenuCheckboxItem,{checked:l.title===i.title,onClick:i.action,children:u.jsx("div",{className:"richtext-ml-1 richtext-h-full",children:i.title})},`font-size-${o}`))})]})}const v=f.Extension.create({name:"fontSize",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontSizes:[...r.DEFAULT_FONT_SIZE_LIST],button({editor:e,extension:l,t:s}){var d;const i=a.ensureNameValueOptions(((d=l.options)==null?void 0:d.fontSizes)||r.DEFAULT_FONT_SIZE_VALUE),o=a.ensureNameValueOptions([r.DEFAULT_FONT_SIZE_VALUE])[0],c=i.map(n=>({title:n.value===o.value?s("editor.fontSize.default.tooltip"):String(n.name),isActive:()=>{const{fontSize:S}=e.getAttributes("textStyle");return n.value===o.value&&S===void 0?!0:e.isActive({fontSize:String(n.value)})||!1},action:()=>{if(n.value===o.value){e.commands.unsetFontSize();return}e.commands.setFontSize(String(n.value))},disabled:!e.can().setFontSize(String(n.value)),divider:n.value===o.value||!1,default:n.value===o.value||!1}));return{component:x,componentProps:{editor:e,tooltip:s("editor.fontSize.tooltip"),disabled:!1,items:c,maxHeight:280}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:t=>t.style.fontSize.replaceAll(/["']+/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});exports.DEFAULT_FONT_SIZE_LIST=r.DEFAULT_FONT_SIZE_LIST;exports.FontSize=v;