reactjs-tiptap-editor 0.3.8 → 0.3.9

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-CqlhqVIW.cjs → ActionMenuButton-D96eTByd.cjs} +1 -1
  2. package/lib/{ActionMenuButton-DXwpQHj4.js → ActionMenuButton-ZOYNohaO.js} +1 -1
  3. package/lib/Attachment.cjs +1 -1
  4. package/lib/Attachment.d.cts +14 -14
  5. package/lib/Attachment.d.ts +14 -14
  6. package/lib/Attachment.js +1 -1
  7. package/lib/Blockquote.cjs +1 -1
  8. package/lib/Blockquote.d.cts +14 -14
  9. package/lib/Blockquote.d.ts +14 -14
  10. package/lib/Blockquote.js +1 -1
  11. package/lib/Bold.cjs +1 -1
  12. package/lib/Bold.d.cts +14 -14
  13. package/lib/Bold.d.ts +14 -14
  14. package/lib/Bold.js +1 -1
  15. package/lib/BulletList.cjs +1 -1
  16. package/lib/BulletList.d.cts +14 -14
  17. package/lib/BulletList.d.ts +14 -14
  18. package/lib/BulletList.js +1 -1
  19. package/lib/Clear.cjs +1 -1
  20. package/lib/Clear.d.cts +14 -14
  21. package/lib/Clear.d.ts +14 -14
  22. package/lib/Clear.js +1 -1
  23. package/lib/Code.cjs +1 -1
  24. package/lib/Code.d.cts +14 -14
  25. package/lib/Code.d.ts +14 -14
  26. package/lib/Code.js +1 -1
  27. package/lib/CodeBlock.cjs +1 -1
  28. package/lib/CodeBlock.d.cts +14 -14
  29. package/lib/CodeBlock.d.ts +14 -14
  30. package/lib/CodeBlock.js +1 -1
  31. package/lib/CodeView.cjs +1 -1
  32. package/lib/CodeView.d.cts +14 -14
  33. package/lib/CodeView.d.ts +14 -14
  34. package/lib/CodeView.js +1 -1
  35. package/lib/Color.cjs +1 -1
  36. package/lib/Color.d.cts +14 -14
  37. package/lib/Color.d.ts +14 -14
  38. package/lib/Color.js +1 -1
  39. package/lib/Document.d.cts +14 -14
  40. package/lib/Document.d.ts +14 -14
  41. package/lib/{Drawer-B6uGc4Ab.js → Drawer-D7VC0bqz.js} +1 -1
  42. package/lib/{Drawer-DBt_aN5x.cjs → Drawer-hzhjTRvj.cjs} +1 -1
  43. package/lib/Drawer.cjs +1 -1
  44. package/lib/Drawer.d.cts +14 -14
  45. package/lib/Drawer.d.ts +14 -14
  46. package/lib/Drawer.js +2 -2
  47. package/lib/Emoji.cjs +1 -1
  48. package/lib/Emoji.d.cts +14 -14
  49. package/lib/Emoji.d.ts +14 -14
  50. package/lib/Emoji.js +1 -1
  51. package/lib/Excalidraw-C3YArGc8.js +278 -0
  52. package/lib/Excalidraw-DkpPLrTk.cjs +1 -0
  53. package/lib/Excalidraw.cjs +1 -1
  54. package/lib/Excalidraw.d.cts +14 -14
  55. package/lib/Excalidraw.d.ts +14 -14
  56. package/lib/Excalidraw.js +1 -1
  57. package/lib/ExportPdf.cjs +1 -1
  58. package/lib/ExportPdf.d.cts +14 -14
  59. package/lib/ExportPdf.d.ts +14 -14
  60. package/lib/ExportPdf.js +1 -1
  61. package/lib/ExportWord.cjs +1 -1
  62. package/lib/ExportWord.d.cts +14 -14
  63. package/lib/ExportWord.d.ts +14 -14
  64. package/lib/ExportWord.js +1 -1
  65. package/lib/FontFamily.cjs +1 -1
  66. package/lib/FontFamily.d.cts +14 -14
  67. package/lib/FontFamily.d.ts +14 -14
  68. package/lib/FontFamily.js +2 -2
  69. package/lib/FontSize.cjs +1 -1
  70. package/lib/FontSize.d.cts +14 -14
  71. package/lib/FontSize.d.ts +14 -14
  72. package/lib/FontSize.js +2 -2
  73. package/lib/FormatPainter.cjs +1 -1
  74. package/lib/FormatPainter.d.cts +14 -14
  75. package/lib/FormatPainter.d.ts +14 -14
  76. package/lib/FormatPainter.js +1 -1
  77. package/lib/Heading.cjs +1 -1
  78. package/lib/Heading.d.cts +14 -14
  79. package/lib/Heading.d.ts +14 -14
  80. package/lib/Heading.js +2 -2
  81. package/lib/Highlight.cjs +1 -1
  82. package/lib/Highlight.d.cts +14 -14
  83. package/lib/Highlight.d.ts +14 -14
  84. package/lib/Highlight.js +1 -1
  85. package/lib/History.cjs +1 -1
  86. package/lib/History.d.cts +14 -14
  87. package/lib/History.d.ts +14 -14
  88. package/lib/History.js +1 -1
  89. package/lib/HorizontalRule.cjs +1 -1
  90. package/lib/HorizontalRule.d.cts +14 -14
  91. package/lib/HorizontalRule.d.ts +14 -14
  92. package/lib/HorizontalRule.js +1 -1
  93. package/lib/Iframe.cjs +1 -1
  94. package/lib/Iframe.d.cts +14 -14
  95. package/lib/Iframe.d.ts +14 -14
  96. package/lib/Iframe.js +1 -1
  97. package/lib/Image.cjs +1 -1
  98. package/lib/Image.d.cts +14 -14
  99. package/lib/Image.d.ts +14 -14
  100. package/lib/Image.js +1 -1
  101. package/lib/ImageGif.cjs +1 -1
  102. package/lib/ImageGif.d.cts +14 -14
  103. package/lib/ImageGif.d.ts +14 -14
  104. package/lib/ImageGif.js +1 -1
  105. package/lib/ImportWord.cjs +1 -1
  106. package/lib/ImportWord.d.cts +14 -14
  107. package/lib/ImportWord.d.ts +14 -14
  108. package/lib/ImportWord.js +1 -1
  109. package/lib/Indent.cjs +1 -1
  110. package/lib/Indent.d.cts +14 -14
  111. package/lib/Indent.d.ts +14 -14
  112. package/lib/Indent.js +1 -1
  113. package/lib/Italic.cjs +1 -1
  114. package/lib/Italic.d.cts +14 -14
  115. package/lib/Italic.d.ts +14 -14
  116. package/lib/Italic.js +1 -1
  117. package/lib/Katex.cjs +1 -1
  118. package/lib/Katex.d.cts +14 -14
  119. package/lib/Katex.d.ts +14 -14
  120. package/lib/Katex.js +2 -2
  121. package/lib/LineHeight.cjs +1 -1
  122. package/lib/LineHeight.d.cts +14 -14
  123. package/lib/LineHeight.d.ts +14 -14
  124. package/lib/LineHeight.js +1 -1
  125. package/lib/Link.cjs +1 -1
  126. package/lib/Link.d.cts +14 -14
  127. package/lib/Link.d.ts +14 -14
  128. package/lib/Link.js +1 -1
  129. package/lib/ListItem.d.cts +14 -14
  130. package/lib/ListItem.d.ts +14 -14
  131. package/lib/Mention.cjs +1 -1
  132. package/lib/Mention.d.cts +14 -14
  133. package/lib/Mention.d.ts +14 -14
  134. package/lib/Mermaid.cjs +1 -1
  135. package/lib/Mermaid.d.cts +14 -14
  136. package/lib/Mermaid.d.ts +14 -14
  137. package/lib/Mermaid.js +2 -2
  138. package/lib/MoreMark.cjs +1 -1
  139. package/lib/MoreMark.d.cts +14 -14
  140. package/lib/MoreMark.d.ts +14 -14
  141. package/lib/MoreMark.js +1 -1
  142. package/lib/MultiColumn.cjs +1 -1
  143. package/lib/MultiColumn.d.cts +14 -14
  144. package/lib/MultiColumn.d.ts +14 -14
  145. package/lib/MultiColumn.js +1 -1
  146. package/lib/OrderedList.cjs +1 -1
  147. package/lib/OrderedList.d.cts +14 -14
  148. package/lib/OrderedList.d.ts +14 -14
  149. package/lib/OrderedList.js +1 -1
  150. package/lib/{RichTextEditor-BfYZYQb9.js → RichTextEditor-CRDKX-F8.js} +11 -11
  151. package/lib/{RichTextEditor-Db6oQoYY.cjs → RichTextEditor-ymQlnG9m.cjs} +1 -1
  152. package/lib/SearchAndReplace.cjs +1 -1
  153. package/lib/SearchAndReplace.d.cts +14 -14
  154. package/lib/SearchAndReplace.d.ts +14 -14
  155. package/lib/SearchAndReplace.js +1 -1
  156. package/lib/Selection.d.cts +14 -14
  157. package/lib/Selection.d.ts +14 -14
  158. package/lib/SlashCommand.cjs +1 -1
  159. package/lib/SlashCommand.d.cts +14 -14
  160. package/lib/SlashCommand.d.ts +14 -14
  161. package/lib/SlashCommand.js +1 -1
  162. package/lib/Strike.cjs +1 -1
  163. package/lib/Strike.d.cts +14 -14
  164. package/lib/Strike.d.ts +14 -14
  165. package/lib/Strike.js +1 -1
  166. package/lib/SubAndSuperScript.cjs +1 -1
  167. package/lib/SubAndSuperScript.d.cts +14 -14
  168. package/lib/SubAndSuperScript.d.ts +14 -14
  169. package/lib/SubAndSuperScript.js +1 -1
  170. package/lib/Table.cjs +1 -1
  171. package/lib/Table.d.cts +14 -14
  172. package/lib/Table.d.ts +14 -14
  173. package/lib/Table.js +1 -1
  174. package/lib/TableOfContent.cjs +1 -1
  175. package/lib/TableOfContent.d.cts +14 -14
  176. package/lib/TableOfContent.d.ts +14 -14
  177. package/lib/TableOfContent.js +1 -1
  178. package/lib/TaskList.cjs +1 -1
  179. package/lib/TaskList.d.cts +14 -14
  180. package/lib/TaskList.d.ts +14 -14
  181. package/lib/TaskList.js +1 -1
  182. package/lib/TextAlign.cjs +1 -1
  183. package/lib/TextAlign.d.cts +14 -14
  184. package/lib/TextAlign.d.ts +14 -14
  185. package/lib/TextAlign.js +1 -1
  186. package/lib/TextBubble.cjs +1 -1
  187. package/lib/TextBubble.d.cts +14 -14
  188. package/lib/TextBubble.d.ts +14 -14
  189. package/lib/TextBubble.js +1 -1
  190. package/lib/TextDirection.cjs +1 -1
  191. package/lib/TextDirection.d.cts +14 -14
  192. package/lib/TextDirection.d.ts +14 -14
  193. package/lib/TextDirection.js +1 -1
  194. package/lib/TextUnderline.cjs +1 -1
  195. package/lib/TextUnderline.d.cts +14 -14
  196. package/lib/TextUnderline.d.ts +14 -14
  197. package/lib/TextUnderline.js +1 -1
  198. package/lib/TrailingNode.d.cts +14 -14
  199. package/lib/TrailingNode.d.ts +14 -14
  200. package/lib/{Twitter-DLO12QnF.cjs → Twitter-CMr6GpHp.cjs} +1 -1
  201. package/lib/{Twitter-CZA9dXpC.js → Twitter-CjAodXzu.js} +1 -1
  202. package/lib/Twitter.cjs +1 -1
  203. package/lib/Twitter.d.cts +14 -14
  204. package/lib/Twitter.d.ts +14 -14
  205. package/lib/Twitter.js +1 -1
  206. package/lib/Video.cjs +1 -1
  207. package/lib/Video.d.cts +14 -14
  208. package/lib/Video.d.ts +14 -14
  209. package/lib/Video.js +1 -1
  210. package/lib/bubble-extra.cjs +1 -1
  211. package/lib/bubble-extra.d.cts +14 -14
  212. package/lib/bubble-extra.d.ts +14 -14
  213. package/lib/bubble-extra.js +5 -5
  214. package/lib/{dom-dataset-DmsCLv1q.cjs → dom-dataset-Cuy-pIfj.cjs} +3 -3
  215. package/lib/index.cjs +1 -1
  216. package/lib/index.d.cts +14 -14
  217. package/lib/index.d.ts +14 -14
  218. package/lib/index.js +2 -2
  219. package/lib/locale-bundle.d.cts +14 -14
  220. package/lib/locale-bundle.d.ts +14 -14
  221. package/lib/{textarea-ILk3QoYy.cjs → textarea-Ci1tHD6V.cjs} +1 -1
  222. package/lib/{textarea-BUlQB7hI.js → textarea-CtL8w6IS.js} +1 -1
  223. package/package.json +1 -2
  224. package/lib/Excalidraw-BmNljVH8.cjs +0 -1
  225. package/lib/Excalidraw-DwD8Qm59.js +0 -651
@@ -0,0 +1,278 @@
1
+ import { N as Z, n as k, m as z } from "./index-CXIIg9Sq.js";
2
+ import { N as j, c as C, R as P, n as V, g as L } from "./dom-dataset-2RXYq9wp.js";
3
+ import { jsxs as E, jsx as n } from "react/jsx-runtime";
4
+ import { useState as o, useCallback as w, useEffect as I, useRef as B } from "react";
5
+ import { w as U, x as $, A as M, y as F, z as X, F as G, B as K, K as Y } from "./RichTextEditor-CRDKX-F8.js";
6
+ import { n as q } from "./index-D-DR0FPY.js";
7
+ import { Resizable as J } from "re-resizable";
8
+ let y;
9
+ function D() {
10
+ try {
11
+ return y || (y = q()), y;
12
+ } catch {
13
+ throw new Error("Error EventEmitter");
14
+ }
15
+ }
16
+ const S = "OPEN_EXCALIDRAW_SETTING_MODAL";
17
+ function Q(e, r) {
18
+ D().on(e, r);
19
+ }
20
+ function ee(e, r) {
21
+ D().off(e, r);
22
+ }
23
+ function fe(e) {
24
+ D().emit(S, e);
25
+ }
26
+ const te = ({ editor: e }) => {
27
+ const [r, u] = o(null), [c, m] = o({}), [l, h] = o({ elements: [], appState: { isLoading: !1 }, files: null }), [x, a] = o(!1), [v, p] = o(!0), [g, d] = o(null), T = w(
28
+ (i) => {
29
+ i && import("@excalidraw/excalidraw").then((t) => {
30
+ u(t.Excalidraw);
31
+ }).catch(d).finally(() => p(!1));
32
+ },
33
+ [p]
34
+ ), _ = w((i) => {
35
+ setTimeout(() => {
36
+ i.refresh();
37
+ });
38
+ }, []), N = w((i, t, s) => {
39
+ m({
40
+ elements: i,
41
+ appState: { isLoading: !1 },
42
+ files: s
43
+ });
44
+ }, []), b = w(() => {
45
+ if (!r) {
46
+ a(!1);
47
+ return;
48
+ }
49
+ e.chain().focus().setExcalidraw({ data: c }).run(), a(!1);
50
+ }, [r, e, c, a]);
51
+ return I(() => {
52
+ const i = (t) => {
53
+ (t == null ? void 0 : t.editor) === e && (a(!0), t && h(t.data));
54
+ };
55
+ return Q(S, i), () => {
56
+ ee(S, i);
57
+ };
58
+ }, [e, a]), /* @__PURE__ */ E(
59
+ U,
60
+ {
61
+ onOpenChange: a,
62
+ open: x,
63
+ children: [
64
+ /* @__PURE__ */ n($, { asChild: !0, children: /* @__PURE__ */ n(
65
+ M,
66
+ {
67
+ action: () => a(!0),
68
+ icon: "Excalidraw",
69
+ tooltip: "Excalidraw"
70
+ }
71
+ ) }),
72
+ /* @__PURE__ */ E(F, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
73
+ /* @__PURE__ */ n(X, { children: "Excalidraw" }),
74
+ /* @__PURE__ */ E("div", { style: { height: "100%", borderWidth: 1 }, children: [
75
+ v && /* @__PURE__ */ n("p", { children: "Loading..." }),
76
+ g && /* @__PURE__ */ n("p", { children: g && g.message || "Error" }),
77
+ /* @__PURE__ */ n(
78
+ "div",
79
+ {
80
+ ref: T,
81
+ style: { width: "100%", height: 600 },
82
+ children: !v && !g && r ? /* @__PURE__ */ n(
83
+ r,
84
+ {
85
+ initialData: l,
86
+ langCode: "en",
87
+ onChange: N,
88
+ ref: _
89
+ }
90
+ ) : null
91
+ }
92
+ )
93
+ ] }),
94
+ /* @__PURE__ */ n(G, { children: /* @__PURE__ */ n(
95
+ K,
96
+ {
97
+ onClick: b,
98
+ type: "button",
99
+ children: "Save changes"
100
+ }
101
+ ) })
102
+ ] })
103
+ ]
104
+ }
105
+ );
106
+ }, re = "_wrap_15k3c_1", ne = "_renderWrap_15k3c_7", ae = "_handlerWrap_15k3c_30", A = {
107
+ wrap: re,
108
+ renderWrap: ne,
109
+ handlerWrap: ae
110
+ }, ie = 10, se = 200, R = 15, W = { width: "100%", height: "100%", maxWidth: "100%" };
111
+ function oe({ editor: e, node: r, updateAttributes: u }) {
112
+ const c = B(null), m = e.isActive(le.name), { data: l, width: h, height: x } = r.attrs, [a, v] = o(null), [p, g] = o(!0), [d, T] = o(null), [_, N] = o(100), b = w((t) => () => {
113
+ N(
114
+ (s) => Y(t === "minus" ? s - R : s + R, ie, se)
115
+ );
116
+ }, []);
117
+ I(() => {
118
+ let t = !1;
119
+ return import("@excalidraw/excalidraw").then((s) => {
120
+ t || (c.current = s.exportToSvg);
121
+ }).catch((s) => !t && T(s)).finally(() => !t && g(!1)), () => {
122
+ t = !0;
123
+ };
124
+ }, [l]), I(() => {
125
+ let t = !1;
126
+ return (async () => {
127
+ if (!c.current || t || p || d || !l)
128
+ return;
129
+ const f = await c.current(l);
130
+ t || (f.setAttribute("width", "100%"), f.setAttribute("height", "100%"), f.setAttribute("display", "block"), v(f));
131
+ })(), () => {
132
+ t = !0;
133
+ };
134
+ }, [l, p, d]);
135
+ const i = (t) => {
136
+ u({ width: t.width, height: t.height });
137
+ };
138
+ return /* @__PURE__ */ n(j, { className: C(A.wrap, m && A.isActive), children: /* @__PURE__ */ n(
139
+ J,
140
+ {
141
+ size: { width: Number.parseInt(h), height: Number.parseInt(x) },
142
+ onResizeStop: (t, s, f, O) => {
143
+ i({
144
+ width: Number.parseInt(h) + O.width,
145
+ height: Number.parseInt(x) + O.height
146
+ });
147
+ },
148
+ children: /* @__PURE__ */ E(
149
+ "div",
150
+ {
151
+ className: C(A.renderWrap, "render-wrapper"),
152
+ style: { ...W, overflow: "hidden" },
153
+ children: [
154
+ d && /* @__PURE__ */ n("div", { style: W, children: /* @__PURE__ */ n("p", { children: d.message || d }) }),
155
+ p && /* @__PURE__ */ n("p", { children: "Loading..." }),
156
+ !p && !d && a && /* @__PURE__ */ n(
157
+ "div",
158
+ {
159
+ dangerouslySetInnerHTML: { __html: (a == null ? void 0 : a.outerHTML) ?? "" },
160
+ style: {
161
+ height: "100%",
162
+ maxHeight: "100%",
163
+ padding: 24,
164
+ overflow: "hidden",
165
+ display: "flex",
166
+ justifyContent: "center",
167
+ alignItems: "center",
168
+ transform: `scale(${_ / 100})`,
169
+ transition: "all ease-in-out .3s"
170
+ }
171
+ }
172
+ ),
173
+ /* @__PURE__ */ E("div", { className: A.handlerWrap, children: [
174
+ /* @__PURE__ */ n(
175
+ M,
176
+ {
177
+ action: b("minus"),
178
+ icon: "ZoomOut",
179
+ tooltip: "Zoom Out"
180
+ }
181
+ ),
182
+ /* @__PURE__ */ n(
183
+ M,
184
+ {
185
+ action: b("plus"),
186
+ icon: "ZoomIn",
187
+ tooltip: "Zoom In"
188
+ }
189
+ )
190
+ ] })
191
+ ]
192
+ }
193
+ )
194
+ }
195
+ ) });
196
+ }
197
+ const H = { elements: [] }, le = /* @__PURE__ */ Z.create({
198
+ name: "excalidraw",
199
+ group: "block",
200
+ selectable: !0,
201
+ atom: !0,
202
+ draggable: !0,
203
+ inline: !1,
204
+ addAttributes() {
205
+ return {
206
+ defaultShowPicker: {
207
+ default: !1
208
+ },
209
+ createUser: {
210
+ default: null
211
+ },
212
+ width: {
213
+ default: "100%",
214
+ parseHTML: L("width")
215
+ },
216
+ height: {
217
+ default: 240,
218
+ parseHTML: L("height")
219
+ },
220
+ data: {
221
+ default: H,
222
+ parseHTML: L("data", !0)
223
+ }
224
+ };
225
+ },
226
+ addOptions() {
227
+ var e;
228
+ return {
229
+ ...(e = this.parent) == null ? void 0 : e.call(this),
230
+ HTMLAttributes: {
231
+ class: "excalidraw"
232
+ },
233
+ button: ({ editor: r }) => ({
234
+ component: te,
235
+ componentProps: {
236
+ editor: r
237
+ }
238
+ })
239
+ };
240
+ },
241
+ parseHTML() {
242
+ return [
243
+ {
244
+ tag: "div[class=excalidraw]"
245
+ }
246
+ ];
247
+ },
248
+ renderHTML({ HTMLAttributes: e, node: r }) {
249
+ return ["div", z(this.options.HTMLAttributes, e, V(r))];
250
+ },
251
+ addCommands() {
252
+ return {
253
+ setExcalidraw: (e) => ({ tr: r, commands: u, chain: c }) => {
254
+ var m, l, h;
255
+ return e = e || {}, e.data = e.data || H, ((h = (l = (m = r.selection) == null ? void 0 : m.node) == null ? void 0 : l.type) == null ? void 0 : h.name) == this.name ? u.updateAttributes(this.name, e) : c().insertContent({
256
+ type: this.name,
257
+ attrs: e
258
+ }).run();
259
+ }
260
+ };
261
+ },
262
+ addNodeView() {
263
+ return P(oe);
264
+ },
265
+ addInputRules() {
266
+ return [
267
+ k({
268
+ find: /^\$excalidraw\$$/,
269
+ type: this.type,
270
+ getAttributes: () => ({ width: "100%" })
271
+ })
272
+ ];
273
+ }
274
+ });
275
+ export {
276
+ le as E,
277
+ fe as t
278
+ };
@@ -0,0 +1 @@
1
+ "use strict";var k=Object.create;var y=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var B=(e,t,s,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Z(t))!z.call(e,i)&&i!==s&&y(e,i,{get:()=>t[i],enumerable:!(l=H(t,i))||l.enumerable});return e};var M=(e,t,s)=>(s=e!=null?k(q(e)):{},B(t||!e||!e.__esModule?y(s,"default",{value:e,enumerable:!0}):s,e));const _=require("./index-CSvnpArE.cjs"),p=require("./dom-dataset-Cuy-pIfj.cjs"),n=require("react/jsx-runtime"),a=require("react"),d=require("./RichTextEditor-ymQlnG9m.cjs"),P=require("./index-Dz3YxLE7.cjs"),V=require("re-resizable");let I;function D(){try{return I||(I=P.mitt()),I}catch{throw new Error("Error EventEmitter")}}const L="OPEN_EXCALIDRAW_SETTING_MODAL";function $(e,t){D().on(e,t)}function U(e,t){D().off(e,t)}function X(e){D().emit(L,e)}const F=({editor:e})=>{const[t,s]=a.useState(null),[l,i]=a.useState({}),[h,x]=a.useState({elements:[],appState:{isLoading:!1},files:null}),[E,o]=a.useState(!1),[b,f]=a.useState(!0),[m,g]=a.useState(null),S=a.useCallback(c=>{c&&import("@excalidraw/excalidraw").then(r=>{s(r.Excalidraw)}).catch(g).finally(()=>f(!1))},[f]),j=a.useCallback(c=>{setTimeout(()=>{c.refresh()})},[]),T=a.useCallback((c,r,u)=>{i({elements:c,appState:{isLoading:!1},files:u})},[]),A=a.useCallback(()=>{if(!t){o(!1);return}e.chain().focus().setExcalidraw({data:l}).run(),o(!1)},[t,e,l,o]);return a.useEffect(()=>{const c=r=>{(r==null?void 0:r.editor)===e&&(o(!0),r&&x(r.data))};return $(L,c),()=>{U(L,c)}},[e,o]),n.jsxs(d.Dialog,{onOpenChange:o,open:E,children:[n.jsx(d.DialogTrigger,{asChild:!0,children:n.jsx(d.ActionButton,{action:()=>o(!0),icon:"Excalidraw",tooltip:"Excalidraw"})}),n.jsxs(d.DialogContent,{className:"richtext-z-[99999] !richtext-max-w-[1300px]",children:[n.jsx(d.DialogTitle,{children:"Excalidraw"}),n.jsxs("div",{style:{height:"100%",borderWidth:1},children:[b&&n.jsx("p",{children:"Loading..."}),m&&n.jsx("p",{children:m&&m.message||"Error"}),n.jsx("div",{ref:S,style:{width:"100%",height:600},children:!b&&!m&&t?n.jsx(t,{initialData:h,langCode:"en",onChange:T,ref:j}):null})]}),n.jsx(d.DialogFooter,{children:n.jsx(d.Button,{onClick:A,type:"button",children:"Save changes"})})]})]})},G="_wrap_15k3c_1",Y="_renderWrap_15k3c_7",J="_handlerWrap_15k3c_30",v={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:s}){const l=a.useRef(null),i=e.isActive(W.name),{data:h,width:x,height:E}=t.attrs,[o,b]=a.useState(null),[f,m]=a.useState(!0),[g,S]=a.useState(null),[j,T]=a.useState(100),A=a.useCallback(r=>()=>{T(u=>d.clamp(r==="minus"?u-C:u+C,K,Q))},[]);a.useEffect(()=>{let r=!1;return import("@excalidraw/excalidraw").then(u=>{r||(l.current=u.exportToSvg)}).catch(u=>!r&&S(u)).finally(()=>!r&&m(!1)),()=>{r=!0}},[h]),a.useEffect(()=>{let r=!1;return(async()=>{if(!l.current||r||f||g||!h)return;const w=await l.current(h);r||(w.setAttribute("width","100%"),w.setAttribute("height","100%"),w.setAttribute("display","block"),b(w))})(),()=>{r=!0}},[h,f,g]);const c=r=>{s({width:r.width,height:r.height})};return n.jsx(p.NodeViewWrapper,{className:p.clsx(v.wrap,i&&v.isActive),children:n.jsx(V.Resizable,{size:{width:Number.parseInt(x),height:Number.parseInt(E)},onResizeStop:(r,u,w,N)=>{c({width:Number.parseInt(x)+N.width,height:Number.parseInt(E)+N.height})},children:n.jsxs("div",{className:p.clsx(v.renderWrap,"render-wrapper"),style:{...O,overflow:"hidden"},children:[g&&n.jsx("div",{style:O,children:n.jsx("p",{children:g.message||g})}),f&&n.jsx("p",{children:"Loading..."}),!f&&!g&&o&&n.jsx("div",{dangerouslySetInnerHTML:{__html:(o==null?void 0:o.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:v.handlerWrap,children:[n.jsx(d.ActionButton,{action:A("minus"),icon:"ZoomOut",tooltip:"Zoom Out"}),n.jsx(d.ActionButton,{action:A("plus"),icon:"ZoomIn",tooltip:"Zoom In"})]})]})})})}const R={elements:[]},W=_.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:p.getDatasetAttribute("width")},height:{default:240,parseHTML:p.getDatasetAttribute("height")},data:{default:R,parseHTML:p.getDatasetAttribute("data",!0)}}},addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),HTMLAttributes:{class:"excalidraw"},button:({editor:t})=>({component:F,componentProps:{editor:t}})}},parseHTML(){return[{tag:"div[class=excalidraw]"}]},renderHTML({HTMLAttributes:e,node:t}){return["div",_.mergeAttributes(this.options.HTMLAttributes,e,p.nodeAttrsToDataset(t))]},addCommands(){return{setExcalidraw:e=>({tr:t,commands:s,chain:l})=>{var i,h,x;return e=e||{},e.data=e.data||R,((x=(h=(i=t.selection)==null?void 0:i.node)==null?void 0:h.type)==null?void 0:x.name)==this.name?s.updateAttributes(this.name,e):l().insertContent({type:this.name,attrs:e}).run()}}},addNodeView(){return p.ReactNodeViewRenderer(ee)},addInputRules(){return[_.nodeInputRule({find:/^\$excalidraw\$$/,type:this.type,getAttributes:()=>({width:"100%"})})]}});exports.Excalidraw=W;exports.triggerOpenExcalidrawSettingModal=X;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CSvnpArE.cjs");require("./dom-dataset-DmsCLv1q.cjs");const e=require("./Excalidraw-BmNljVH8.cjs");exports.Excalidraw=e.Excalidraw;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./index-CSvnpArE.cjs");require("./dom-dataset-Cuy-pIfj.cjs");const e=require("./Excalidraw-DkpPLrTk.cjs");exports.Excalidraw=e.Excalidraw;
@@ -147,19 +147,15 @@ declare module '@tiptap/core' {
147
147
 
148
148
  declare module '@tiptap/core' {
149
149
  interface Commands<ReturnType> {
150
- imageGifUpload: {
151
- /**
152
- * Add an image gif
153
- */
154
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
150
+ indent: {
155
151
  /**
156
- * Update an image gif
152
+ * Set the indent attribute
157
153
  */
158
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
154
+ indent: () => ReturnType;
159
155
  /**
160
- * Set image alignment
156
+ * Set the outdent attribute
161
157
  */
162
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
158
+ outdent: () => ReturnType;
163
159
  };
164
160
  }
165
161
  }
@@ -167,15 +163,19 @@ declare module '@tiptap/core' {
167
163
 
168
164
  declare module '@tiptap/core' {
169
165
  interface Commands<ReturnType> {
170
- indent: {
166
+ imageGifUpload: {
171
167
  /**
172
- * Set the indent attribute
168
+ * Add an image gif
173
169
  */
174
- indent: () => ReturnType;
170
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
175
171
  /**
176
- * Set the outdent attribute
172
+ * Update an image gif
177
173
  */
178
- outdent: () => ReturnType;
174
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
175
+ /**
176
+ * Set image alignment
177
+ */
178
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
179
179
  };
180
180
  }
181
181
  }
@@ -147,19 +147,15 @@ declare module '@tiptap/core' {
147
147
 
148
148
  declare module '@tiptap/core' {
149
149
  interface Commands<ReturnType> {
150
- imageGifUpload: {
151
- /**
152
- * Add an image gif
153
- */
154
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
150
+ indent: {
155
151
  /**
156
- * Update an image gif
152
+ * Set the indent attribute
157
153
  */
158
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
154
+ indent: () => ReturnType;
159
155
  /**
160
- * Set image alignment
156
+ * Set the outdent attribute
161
157
  */
162
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
158
+ outdent: () => ReturnType;
163
159
  };
164
160
  }
165
161
  }
@@ -167,15 +163,19 @@ declare module '@tiptap/core' {
167
163
 
168
164
  declare module '@tiptap/core' {
169
165
  interface Commands<ReturnType> {
170
- indent: {
166
+ imageGifUpload: {
171
167
  /**
172
- * Set the indent attribute
168
+ * Add an image gif
173
169
  */
174
- indent: () => ReturnType;
170
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
175
171
  /**
176
- * Set the outdent attribute
172
+ * Update an image gif
177
173
  */
178
- outdent: () => ReturnType;
174
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
175
+ /**
176
+ * Set image alignment
177
+ */
178
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
179
179
  };
180
180
  }
181
181
  }
package/lib/Excalidraw.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./index-CXIIg9Sq.js";
2
2
  import "./dom-dataset-2RXYq9wp.js";
3
- import { E as m } from "./Excalidraw-DwD8Qm59.js";
3
+ import { E as m } from "./Excalidraw-C3YArGc8.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 c=require("./index-CSvnpArE.cjs"),d=require("./RichTextEditor-Db6oQoYY.cjs");function s(n){const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t),t.textContent=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index-CSvnpArE.cjs"),d=require("./RichTextEditor-ymQlnG9m.cjs");function s(n){const t=document.createElement("iframe");t.setAttribute("style","position: absolute; width: 0; height: 0; top: 0; left: 0;"),document.body.appendChild(t),t.textContent=`
2
2
  <!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
@@ -139,19 +139,15 @@ declare module '@tiptap/core' {
139
139
 
140
140
  declare module '@tiptap/core' {
141
141
  interface Commands<ReturnType> {
142
- imageGifUpload: {
143
- /**
144
- * Add an image gif
145
- */
146
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
142
+ indent: {
147
143
  /**
148
- * Update an image gif
144
+ * Set the indent attribute
149
145
  */
150
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
146
+ indent: () => ReturnType;
151
147
  /**
152
- * Set image alignment
148
+ * Set the outdent attribute
153
149
  */
154
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
150
+ outdent: () => ReturnType;
155
151
  };
156
152
  }
157
153
  }
@@ -159,15 +155,19 @@ declare module '@tiptap/core' {
159
155
 
160
156
  declare module '@tiptap/core' {
161
157
  interface Commands<ReturnType> {
162
- indent: {
158
+ imageGifUpload: {
163
159
  /**
164
- * Set the indent attribute
160
+ * Add an image gif
165
161
  */
166
- indent: () => ReturnType;
162
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
167
163
  /**
168
- * Set the outdent attribute
164
+ * Update an image gif
169
165
  */
170
- outdent: () => ReturnType;
166
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
167
+ /**
168
+ * Set image alignment
169
+ */
170
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
171
171
  };
172
172
  }
173
173
  }
@@ -139,19 +139,15 @@ declare module '@tiptap/core' {
139
139
 
140
140
  declare module '@tiptap/core' {
141
141
  interface Commands<ReturnType> {
142
- imageGifUpload: {
143
- /**
144
- * Add an image gif
145
- */
146
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
142
+ indent: {
147
143
  /**
148
- * Update an image gif
144
+ * Set the indent attribute
149
145
  */
150
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
146
+ indent: () => ReturnType;
151
147
  /**
152
- * Set image alignment
148
+ * Set the outdent attribute
153
149
  */
154
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
150
+ outdent: () => ReturnType;
155
151
  };
156
152
  }
157
153
  }
@@ -159,15 +155,19 @@ declare module '@tiptap/core' {
159
155
 
160
156
  declare module '@tiptap/core' {
161
157
  interface Commands<ReturnType> {
162
- indent: {
158
+ imageGifUpload: {
163
159
  /**
164
- * Set the indent attribute
160
+ * Add an image gif
165
161
  */
166
- indent: () => ReturnType;
162
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
167
163
  /**
168
- * Set the outdent attribute
164
+ * Update an image gif
169
165
  */
170
- outdent: () => ReturnType;
166
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
167
+ /**
168
+ * Set image alignment
169
+ */
170
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
171
171
  };
172
172
  }
173
173
  }
package/lib/ExportPdf.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { E as c } from "./index-CXIIg9Sq.js";
2
- import { A as d } from "./RichTextEditor-BfYZYQb9.js";
2
+ import { A as d } from "./RichTextEditor-CRDKX-F8.js";
3
3
  function s(n) {
4
4
  const t = document.createElement("iframe");
5
5
  t.setAttribute("style", "position: absolute; width: 0; height: 0; top: 0; left: 0;"), document.body.appendChild(t), t.textContent = `
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index-CSvnpArE.cjs"),s=require("docx"),t=require("prosemirror-docx"),i=require("./RichTextEditor-Db6oQoYY.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-CSvnpArE.cjs"),s=require("docx"),t=require("prosemirror-docx"),i=require("./RichTextEditor-ymQlnG9m.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;
@@ -210,19 +210,15 @@ declare module '@tiptap/core' {
210
210
 
211
211
  declare module '@tiptap/core' {
212
212
  interface Commands<ReturnType> {
213
- imageGifUpload: {
214
- /**
215
- * Add an image gif
216
- */
217
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
213
+ indent: {
218
214
  /**
219
- * Update an image gif
215
+ * Set the indent attribute
220
216
  */
221
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
217
+ indent: () => ReturnType;
222
218
  /**
223
- * Set image alignment
219
+ * Set the outdent attribute
224
220
  */
225
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
221
+ outdent: () => ReturnType;
226
222
  };
227
223
  }
228
224
  }
@@ -230,15 +226,19 @@ declare module '@tiptap/core' {
230
226
 
231
227
  declare module '@tiptap/core' {
232
228
  interface Commands<ReturnType> {
233
- indent: {
229
+ imageGifUpload: {
234
230
  /**
235
- * Set the indent attribute
231
+ * Add an image gif
236
232
  */
237
- indent: () => ReturnType;
233
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
238
234
  /**
239
- * Set the outdent attribute
235
+ * Update an image gif
240
236
  */
241
- outdent: () => ReturnType;
237
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
238
+ /**
239
+ * Set image alignment
240
+ */
241
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
242
242
  };
243
243
  }
244
244
  }
@@ -210,19 +210,15 @@ declare module '@tiptap/core' {
210
210
 
211
211
  declare module '@tiptap/core' {
212
212
  interface Commands<ReturnType> {
213
- imageGifUpload: {
214
- /**
215
- * Add an image gif
216
- */
217
- setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
213
+ indent: {
218
214
  /**
219
- * Update an image gif
215
+ * Set the indent attribute
220
216
  */
221
- updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
217
+ indent: () => ReturnType;
222
218
  /**
223
- * Set image alignment
219
+ * Set the outdent attribute
224
220
  */
225
- setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
221
+ outdent: () => ReturnType;
226
222
  };
227
223
  }
228
224
  }
@@ -230,15 +226,19 @@ declare module '@tiptap/core' {
230
226
 
231
227
  declare module '@tiptap/core' {
232
228
  interface Commands<ReturnType> {
233
- indent: {
229
+ imageGifUpload: {
234
230
  /**
235
- * Set the indent attribute
231
+ * Add an image gif
236
232
  */
237
- indent: () => ReturnType;
233
+ setImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
238
234
  /**
239
- * Set the outdent attribute
235
+ * Update an image gif
240
236
  */
241
- outdent: () => ReturnType;
237
+ updateImageGif: (options: Partial<SetImageAttrsOptions>) => ReturnType;
238
+ /**
239
+ * Set image alignment
240
+ */
241
+ setAlignImageGif: (align: 'left' | 'center' | 'right') => ReturnType;
242
242
  };
243
243
  }
244
244
  }
package/lib/ExportWord.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { E as a } from "./index-CXIIg9Sq.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-BfYZYQb9.js";
4
+ import { A as p } from "./RichTextEditor-CRDKX-F8.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-CrxasX7b.cjs");const y=require("./index-CSvnpArE.cjs"),m=require("./index-Dz3YxLE7.cjs"),o=require("react/jsx-runtime"),F=require("react"),h=require("./ActionMenuButton-CqlhqVIW.cjs"),s=require("./RichTextEditor-Db6oQoYY.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-CrxasX7b.cjs");const y=require("./index-CSvnpArE.cjs"),m=require("./index-Dz3YxLE7.cjs"),o=require("react/jsx-runtime"),F=require("react"),h=require("./ActionMenuButton-D96eTByd.cjs"),s=require("./RichTextEditor-ymQlnG9m.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;