reactjs-tiptap-editor 0.1.14 → 0.1.15
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.
- package/lib/RichTextEditor-BFCJg7ap.cjs +138 -0
- package/lib/RichTextEditor-CqUsKvdf.js +4887 -0
- package/lib/extension-bundle.cjs +15 -0
- package/lib/extension-bundle.d.cts +919 -0
- package/lib/extension-bundle.d.ts +919 -0
- package/lib/extension-bundle.js +8501 -0
- package/lib/{locales--osbCzs-.js → index-BQSRMhtZ.js} +229 -181
- package/lib/index-CHZh3C0I.cjs +1 -0
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +45 -1583
- package/lib/index.d.ts +45 -1583
- package/lib/index.js +12 -67
- package/lib/locale-bundle.cjs +1 -0
- package/lib/locale-bundle.d.cts +1145 -0
- package/lib/locale-bundle.d.ts +1145 -0
- package/lib/locale-bundle.js +9 -0
- package/lib/style.css +1 -1
- package/lib/{tiptap-CibBmg3k.js → tiptap-CB5MO02_.js} +1453 -1401
- package/lib/tiptap-DkTOfBkj.cjs +116 -0
- package/lib/vendor-BH8HYOJ4.cjs +354 -0
- package/lib/{vendor-CDx3V-R7.js → vendor-DiKgVtSS.js} +23737 -23443
- package/package.json +95 -82
- package/lib/bundle-full.cjs +0 -650
- package/lib/bundle-full.js +0 -82900
- package/lib/locales-DNzXvsXe.cjs +0 -1
- package/lib/tiptap-BWShr3Ps.cjs +0 -116
- package/lib/utils-CpXb61kA.cjs +0 -152
- package/lib/utils-DvW-fR8u.js +0 -13374
- package/lib/vendor-DhcRzB9P.cjs +0 -354
|
@@ -0,0 +1,4887 @@
|
|
|
1
|
+
import { jsxs as u, jsx as i, Fragment as _ } from "react/jsx-runtime";
|
|
2
|
+
import * as E from "react";
|
|
3
|
+
import Oe, { useState as w, useCallback as C, useEffect as I, useRef as nt, useMemo as P, Fragment as _e, forwardRef as Si, useImperativeHandle as Ai } from "react";
|
|
4
|
+
import { f as zt, N as dt, m as it, i as Mi, a as ut, R as xt, n as ce, I as He, b as me, c as Li, B as Y, d as Ii, D as Ei, e as Ri, u as zi, E as Oi } from "./tiptap-CB5MO02_.js";
|
|
5
|
+
import { u as V, m as _i, I as Ot, f as _t, g as Pe, C as Hi, h as Z, B as Pi, i as Ht, V as fe, E as Di } from "./index-BQSRMhtZ.js";
|
|
6
|
+
import * as De from "@radix-ui/react-separator";
|
|
7
|
+
import { ap as Bi, aq as Pt, ao as Be, ar as $e, as as Vt, at as Ve, T as bt, N as $i, A as Vi, au as We, av as Wi, aw as ge, ax as wt, ay as ji, az as je, H as Wt, aA as Fi, aB as Gi } from "./vendor-DiKgVtSS.js";
|
|
8
|
+
import * as X from "@radix-ui/react-toast";
|
|
9
|
+
import { ChevronRight as Ui, Check as Ki, Circle as Zi, X as Fe, FlipHorizontal as Xi, FlipVertical as qi, CropIcon as Yi, ChevronUp as Ji, Paperclip as Qi, Eye as tr, Settings as er, ZoomOut as ir, ZoomIn as rr, BookMarked as nr, Sigma as cr, SmilePlusIcon as ar, Replace as pe, SmilePlus as or, Frame as sr, Columns2 as we, PanelRight as lr, PanelLeft as hr, Clipboard as dr, Copy as ur, GripVertical as xr, Plus as Ge, Columns4 as mr, Columns3 as fr, Heading6 as gr, Heading5 as pr, Heading4 as wr, Heading3 as vr, Heading2 as br, Heading1 as yr, ChevronsUpDown as Cr, Trash as Nr, Trash2 as Ue, TableCellsSplit as Tr, TableCellsMerge as kr, BetweenVerticalEnd as Sr, BetweenVerticalStart as Ar, BetweenHorizonalStart as Mr, BetweenHorizonalEnd as Lr, Unlink as Ir, Pencil as Ke, Sparkles as Er, Table as Rr, Minimize as zr, Maximize as Or, Video as _r, ImageUp as Hr, Link as Pr, ListTodo as Dr, ListOrdered as Br, List as $r, IndentDecrease as Vr, IndentIncrease as Wr, Type as jr, CodeXml as Fr, Code as Gr, Superscript as Ur, Subscript as Kr, ChevronDown as Zr, Undo2 as Xr, Redo2 as qr, PaintRoller as Yr, Eraser as Jr, Minus as Qr, Strikethrough as tn, Quote as en, Underline as rn, Italic as nn, LoaderCircle as cn, Bold as an, HelpCircle as Ze } from "lucide-react";
|
|
10
|
+
import * as yt from "@radix-ui/react-tooltip";
|
|
11
|
+
import ae from "katex";
|
|
12
|
+
import { Slot as Xe } from "@radix-ui/react-slot";
|
|
13
|
+
import * as qe from "@radix-ui/react-toggle";
|
|
14
|
+
import { TextAlignRightIcon as on, TextAlignLeftIcon as sn, TextAlignJustifyIcon as ln, TextAlignCenterIcon as hn } from "@radix-ui/react-icons";
|
|
15
|
+
import * as vt from "@radix-ui/react-popover";
|
|
16
|
+
import * as Ye from "@radix-ui/react-label";
|
|
17
|
+
import { Resizable as Je } from "re-resizable";
|
|
18
|
+
import * as q from "@radix-ui/react-dialog";
|
|
19
|
+
import Dt from "mermaid";
|
|
20
|
+
import { flushSync as Bt } from "react-dom";
|
|
21
|
+
import { Tweet as dn } from "react-tweet";
|
|
22
|
+
import { sticky as un } from "tippy.js";
|
|
23
|
+
import { HexColorPicker as xn } from "react-colorful";
|
|
24
|
+
import * as Yt from "@radix-ui/react-switch";
|
|
25
|
+
import * as D from "@radix-ui/react-dropdown-menu";
|
|
26
|
+
let Gt;
|
|
27
|
+
function Ut() {
|
|
28
|
+
return Gt === void 0 && (Gt = navigator.platform.includes("Mac")), Gt;
|
|
29
|
+
}
|
|
30
|
+
function mn(t) {
|
|
31
|
+
return `${t}`.toLowerCase() === "mod" ? Ut() ? "⌘" : "Ctrl" : `${t}`.toLowerCase() === "alt" ? Ut() ? "⌥" : "Alt" : `${t}`.toLowerCase() === "shift" ? Ut() ? "⇧" : "Shift" : t;
|
|
32
|
+
}
|
|
33
|
+
function fn(t) {
|
|
34
|
+
return t.map(mn).join(" ");
|
|
35
|
+
}
|
|
36
|
+
function L(...t) {
|
|
37
|
+
return Bi(Pt(t));
|
|
38
|
+
}
|
|
39
|
+
const v = Oe.forwardRef(
|
|
40
|
+
(t, e) => {
|
|
41
|
+
const {
|
|
42
|
+
icon: r = void 0,
|
|
43
|
+
// title = undefined,
|
|
44
|
+
tooltip: n = void 0,
|
|
45
|
+
disabled: a = !1,
|
|
46
|
+
customClass: c = "",
|
|
47
|
+
// color = undefined,
|
|
48
|
+
loading: o = void 0,
|
|
49
|
+
shortcutKeys: s = void 0,
|
|
50
|
+
tooltipOptions: l = {},
|
|
51
|
+
action: h = void 0,
|
|
52
|
+
isActive: d = void 0,
|
|
53
|
+
children: x,
|
|
54
|
+
asChild: m = !1,
|
|
55
|
+
upload: f = !1,
|
|
56
|
+
...p
|
|
57
|
+
} = t, b = ui[r];
|
|
58
|
+
return /* @__PURE__ */ u(hi, { children: [
|
|
59
|
+
/* @__PURE__ */ i(di, { asChild: !0, children: /* @__PURE__ */ u(
|
|
60
|
+
m ? Xe : li,
|
|
61
|
+
{
|
|
62
|
+
ref: e,
|
|
63
|
+
size: "sm",
|
|
64
|
+
className: L("richtext-w-[32px] richtext-h-[32px]", c),
|
|
65
|
+
disabled: a,
|
|
66
|
+
onClick: h,
|
|
67
|
+
"data-state": d != null && d() ? "on" : "off",
|
|
68
|
+
...p,
|
|
69
|
+
children: [
|
|
70
|
+
b && /* @__PURE__ */ i(b, { className: "richtext-w-4 richtext-h-4" }),
|
|
71
|
+
x
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
) }),
|
|
75
|
+
n && /* @__PURE__ */ i(oe, { ...l, children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col richtext-items-center richtext-text-center richtext-max-w-24", children: [
|
|
76
|
+
/* @__PURE__ */ i("div", { children: n }),
|
|
77
|
+
!!(s != null && s.length) && /* @__PURE__ */ i("span", { children: fn(s) })
|
|
78
|
+
] }) })
|
|
79
|
+
] });
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
function Ct(t, e) {
|
|
83
|
+
const { state: r } = e, n = r.selection.$anchor;
|
|
84
|
+
let a = !1;
|
|
85
|
+
if (n.depth)
|
|
86
|
+
for (let c = n.depth; c > 0; c--)
|
|
87
|
+
n.node(c).type.name === t && (e.dispatchTransaction && e.dispatchTransaction(r.tr.delete(n.before(c), n.after(c)).scrollIntoView()), a = !0);
|
|
88
|
+
else {
|
|
89
|
+
const c = r.selection.node;
|
|
90
|
+
c && c.type.name === t && (e.chain().deleteSelection().run(), a = !0);
|
|
91
|
+
}
|
|
92
|
+
if (!a) {
|
|
93
|
+
const c = n.pos;
|
|
94
|
+
if (c) {
|
|
95
|
+
const o = r.tr.doc.nodeAt(c);
|
|
96
|
+
o && o.type.name === t && (e.dispatchTransaction && e.dispatchTransaction(r.tr.delete(c, c + o.nodeSize)), a = !0);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return a;
|
|
100
|
+
}
|
|
101
|
+
const Qe = Be(!1);
|
|
102
|
+
function gn() {
|
|
103
|
+
return $e(Qe);
|
|
104
|
+
}
|
|
105
|
+
const pn = {
|
|
106
|
+
setDisable: (t) => {
|
|
107
|
+
Qe(t);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
function ti(t, e, r) {
|
|
111
|
+
return t < e ? e : t > r ? r : t;
|
|
112
|
+
}
|
|
113
|
+
const wn = (t) => typeof t == "number", vn = (t) => typeof t == "string", bn = (t) => typeof t == "function";
|
|
114
|
+
function xo(t, e = "px") {
|
|
115
|
+
if (!t)
|
|
116
|
+
return t;
|
|
117
|
+
const r = wn(t) ? String(t) : t, n = Number.parseFloat(r), a = r.match(/[a-z%]+$/i), c = a ? a[0] : e;
|
|
118
|
+
return Number.isNaN(n) ? t : n + c;
|
|
119
|
+
}
|
|
120
|
+
function yn(t, e) {
|
|
121
|
+
if (!t)
|
|
122
|
+
return !1;
|
|
123
|
+
const { extensions: r = [] } = (t == null ? void 0 : t.extensionManager) ?? {};
|
|
124
|
+
return !!r.find((a) => a.name === e);
|
|
125
|
+
}
|
|
126
|
+
function mo(t) {
|
|
127
|
+
return t.map((e) => vn(e) ? { value: e, name: e } : e);
|
|
128
|
+
}
|
|
129
|
+
const Cn = Vt(
|
|
130
|
+
"richtext-inline-flex richtext-items-center richtext-justify-center richtext-whitespace-nowrap richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50",
|
|
131
|
+
{
|
|
132
|
+
variants: {
|
|
133
|
+
variant: {
|
|
134
|
+
default: "!richtext-bg-primary !richtext-text-primary-foreground hover:!richtext-bg-primary/90",
|
|
135
|
+
destructive: "richtext-bg-destructive richtext-text-destructive-foreground hover:richtext-bg-destructive/90",
|
|
136
|
+
outline: "richtext-border richtext-border-input richtext-bg-background hover:richtext-bg-accent hover:richtext-text-accent-foreground",
|
|
137
|
+
secondary: "richtext-bg-secondary richtext-text-secondary-foreground hover:richtext-bg-secondary/80",
|
|
138
|
+
ghost: "hover:richtext-bg-accent hover:richtext-text-accent-foreground",
|
|
139
|
+
link: "richtext-text-primary richtext-underline-offset-4 hover:richtext-underline"
|
|
140
|
+
},
|
|
141
|
+
size: {
|
|
142
|
+
default: "richtext-h-10 richtext-px-4 richtext-py-2",
|
|
143
|
+
sm: "richtext-h-9 richtext-rounded-md richtext-px-3",
|
|
144
|
+
lg: "richtext-h-11 richtext-rounded-md richtext-px-8",
|
|
145
|
+
icon: "richtext-h-10 richtext-w-10"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
defaultVariants: {
|
|
149
|
+
variant: "default",
|
|
150
|
+
size: "default"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
), U = E.forwardRef(
|
|
154
|
+
({ className: t, variant: e, size: r, asChild: n = !1, ...a }, c) => /* @__PURE__ */ i(
|
|
155
|
+
n ? Xe : "button",
|
|
156
|
+
{
|
|
157
|
+
className: L(Cn({ variant: e, size: r, className: t })),
|
|
158
|
+
ref: c,
|
|
159
|
+
...a
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
);
|
|
163
|
+
U.displayName = "Button";
|
|
164
|
+
const Nn = D.Root, Tn = D.Trigger, ve = D.Portal, be = D.Sub, Jt = E.forwardRef(({ className: t, inset: e, children: r, ...n }, a) => /* @__PURE__ */ u(
|
|
165
|
+
D.SubTrigger,
|
|
166
|
+
{
|
|
167
|
+
ref: a,
|
|
168
|
+
className: L(
|
|
169
|
+
"richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none focus:richtext-bg-accent data-[state=open]:richtext-bg-accent",
|
|
170
|
+
e && "richtext-pl-8",
|
|
171
|
+
t
|
|
172
|
+
),
|
|
173
|
+
...n,
|
|
174
|
+
children: [
|
|
175
|
+
r,
|
|
176
|
+
/* @__PURE__ */ i(Ui, { className: "richtext-ml-auto richtext-h-4 richtext-w-4" })
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
));
|
|
180
|
+
Jt.displayName = D.SubTrigger.displayName;
|
|
181
|
+
const Qt = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
182
|
+
D.SubContent,
|
|
183
|
+
{
|
|
184
|
+
ref: r,
|
|
185
|
+
className: L(
|
|
186
|
+
"richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-lg data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
187
|
+
t
|
|
188
|
+
),
|
|
189
|
+
...e
|
|
190
|
+
}
|
|
191
|
+
));
|
|
192
|
+
Qt.displayName = D.SubContent.displayName;
|
|
193
|
+
const ei = E.forwardRef(({ className: t, sideOffset: e = 4, ...r }, n) => /* @__PURE__ */ i(D.Portal, { children: /* @__PURE__ */ i(
|
|
194
|
+
D.Content,
|
|
195
|
+
{
|
|
196
|
+
ref: n,
|
|
197
|
+
sideOffset: e,
|
|
198
|
+
className: L(
|
|
199
|
+
"richtext-z-50 richtext-min-w-[8rem] richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-1 richtext-text-popover-foreground richtext-shadow-md data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
200
|
+
t
|
|
201
|
+
),
|
|
202
|
+
...r
|
|
203
|
+
}
|
|
204
|
+
) }));
|
|
205
|
+
ei.displayName = D.Content.displayName;
|
|
206
|
+
const tt = E.forwardRef(({ className: t, inset: e, ...r }, n) => /* @__PURE__ */ i(
|
|
207
|
+
D.Item,
|
|
208
|
+
{
|
|
209
|
+
ref: n,
|
|
210
|
+
className: L(
|
|
211
|
+
"richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",
|
|
212
|
+
e && "richtext-pl-8",
|
|
213
|
+
t
|
|
214
|
+
),
|
|
215
|
+
...r
|
|
216
|
+
}
|
|
217
|
+
));
|
|
218
|
+
tt.displayName = D.Item.displayName;
|
|
219
|
+
const kn = E.forwardRef(({ className: t, children: e, checked: r, ...n }, a) => /* @__PURE__ */ u(
|
|
220
|
+
D.CheckboxItem,
|
|
221
|
+
{
|
|
222
|
+
ref: a,
|
|
223
|
+
className: L(
|
|
224
|
+
"richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",
|
|
225
|
+
t
|
|
226
|
+
),
|
|
227
|
+
checked: r,
|
|
228
|
+
...n,
|
|
229
|
+
children: [
|
|
230
|
+
/* @__PURE__ */ i("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ i(D.ItemIndicator, { children: /* @__PURE__ */ i(Ki, { className: "richtext-h-4 richtext-w-4" }) }) }),
|
|
231
|
+
e
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
));
|
|
235
|
+
kn.displayName = D.CheckboxItem.displayName;
|
|
236
|
+
const Sn = E.forwardRef(({ className: t, children: e, ...r }, n) => /* @__PURE__ */ u(
|
|
237
|
+
D.RadioItem,
|
|
238
|
+
{
|
|
239
|
+
ref: n,
|
|
240
|
+
className: L(
|
|
241
|
+
"richtext-relative richtext-flex richtext-cursor-default richtext-select-none richtext-items-center richtext-rounded-sm richtext-py-1.5 richtext-pl-8 richtext-pr-2 richtext-text-sm richtext-outline-none richtext-transition-colors focus:richtext-bg-accent focus:richtext-text-accent-foreground data-[disabled]:richtext-pointer-events-none data-[disabled]:richtext-opacity-50",
|
|
242
|
+
t
|
|
243
|
+
),
|
|
244
|
+
...r,
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ i("span", { className: "richtext-absolute richtext-left-2 richtext-flex richtext-h-3.5 richtext-w-3.5 richtext-items-center richtext-justify-center", children: /* @__PURE__ */ i(D.ItemIndicator, { children: /* @__PURE__ */ i(Zi, { className: "richtext-h-2 richtext-w-2 richtext-fill-current" }) }) }),
|
|
247
|
+
e
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
));
|
|
251
|
+
Sn.displayName = D.RadioItem.displayName;
|
|
252
|
+
const An = E.forwardRef(({ className: t, inset: e, ...r }, n) => /* @__PURE__ */ i(
|
|
253
|
+
D.Label,
|
|
254
|
+
{
|
|
255
|
+
ref: n,
|
|
256
|
+
className: L(
|
|
257
|
+
"richtext-px-2 richtext-py-1.5 richtext-text-sm richtext-font-semibold",
|
|
258
|
+
e && "richtext-pl-8",
|
|
259
|
+
t
|
|
260
|
+
),
|
|
261
|
+
...r
|
|
262
|
+
}
|
|
263
|
+
));
|
|
264
|
+
An.displayName = D.Label.displayName;
|
|
265
|
+
const ii = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
266
|
+
D.Separator,
|
|
267
|
+
{
|
|
268
|
+
ref: r,
|
|
269
|
+
className: L("richtext--mx-1 richtext-my-1 richtext-h-px richtext-bg-muted", t),
|
|
270
|
+
...e
|
|
271
|
+
}
|
|
272
|
+
));
|
|
273
|
+
ii.displayName = D.Separator.displayName;
|
|
274
|
+
function Mn({
|
|
275
|
+
className: t,
|
|
276
|
+
...e
|
|
277
|
+
}) {
|
|
278
|
+
return /* @__PURE__ */ i(
|
|
279
|
+
"span",
|
|
280
|
+
{
|
|
281
|
+
className: L("richtext-ml-auto richtext-text-xs richtext-tracking-widest richtext-opacity-60", t),
|
|
282
|
+
...e
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
Mn.displayName = "DropdownMenuShortcut";
|
|
287
|
+
const J = E.forwardRef(
|
|
288
|
+
({ className: t, type: e, ...r }, n) => /* @__PURE__ */ i(
|
|
289
|
+
"input",
|
|
290
|
+
{
|
|
291
|
+
type: e,
|
|
292
|
+
className: L(
|
|
293
|
+
"richtext-flex richtext-h-10 richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background file:richtext-border-0 file:richtext-bg-transparent file:richtext-text-sm file:richtext-font-medium placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",
|
|
294
|
+
t
|
|
295
|
+
),
|
|
296
|
+
ref: n,
|
|
297
|
+
...r
|
|
298
|
+
}
|
|
299
|
+
)
|
|
300
|
+
);
|
|
301
|
+
J.displayName = "Input";
|
|
302
|
+
const Ln = Vt(
|
|
303
|
+
"richtext-text-sm richtext-font-medium richtext-leading-none peer-disabled:richtext-cursor-not-allowed peer-disabled:richtext-opacity-70"
|
|
304
|
+
), et = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
305
|
+
Ye.Root,
|
|
306
|
+
{
|
|
307
|
+
ref: r,
|
|
308
|
+
className: L(Ln(), t),
|
|
309
|
+
...e
|
|
310
|
+
}
|
|
311
|
+
));
|
|
312
|
+
et.displayName = Ye.Root.displayName;
|
|
313
|
+
const mt = vt.Root, ft = vt.Trigger, ct = E.forwardRef(({ className: t, align: e = "center", sideOffset: r = 4, ...n }, a) => /* @__PURE__ */ i(vt.Portal, { children: /* @__PURE__ */ i(
|
|
314
|
+
vt.Content,
|
|
315
|
+
{
|
|
316
|
+
ref: a,
|
|
317
|
+
align: e,
|
|
318
|
+
sideOffset: r,
|
|
319
|
+
className: L(
|
|
320
|
+
"richtext-z-50 richtext-w-72 richtext-rounded-md !richtext-border richtext-bg-popover richtext-p-4 richtext-text-popover-foreground richtext-shadow-md richtext-outline-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
321
|
+
t
|
|
322
|
+
),
|
|
323
|
+
...n
|
|
324
|
+
}
|
|
325
|
+
) }));
|
|
326
|
+
ct.displayName = vt.Content.displayName;
|
|
327
|
+
const Q = E.forwardRef(
|
|
328
|
+
({ className: t, orientation: e = "horizontal", decorative: r = !0, ...n }, a) => /* @__PURE__ */ i(
|
|
329
|
+
De.Root,
|
|
330
|
+
{
|
|
331
|
+
ref: a,
|
|
332
|
+
decorative: r,
|
|
333
|
+
orientation: e,
|
|
334
|
+
className: L(
|
|
335
|
+
"richtext-shrink-0 richtext-bg-border",
|
|
336
|
+
e === "horizontal" ? "richtext-h-[1px] richtext-w-full" : "richtext-h-full richtext-w-[1px]",
|
|
337
|
+
t
|
|
338
|
+
),
|
|
339
|
+
...n
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
);
|
|
343
|
+
Q.displayName = De.Root.displayName;
|
|
344
|
+
const ri = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
345
|
+
Yt.Root,
|
|
346
|
+
{
|
|
347
|
+
className: L(
|
|
348
|
+
"richtext-peer richtext-inline-flex richtext-h-6 richtext-w-11 richtext-shrink-0 richtext-cursor-pointer richtext-items-center richtext-rounded-full richtext-border-2 richtext-border-transparent richtext-transition-colors focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 focus-visible:richtext-ring-offset-background disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50 data-[state=checked]:richtext-bg-primary data-[state=unchecked]:richtext-bg-input",
|
|
349
|
+
t
|
|
350
|
+
),
|
|
351
|
+
...e,
|
|
352
|
+
ref: r,
|
|
353
|
+
children: /* @__PURE__ */ i(
|
|
354
|
+
Yt.Thumb,
|
|
355
|
+
{
|
|
356
|
+
className: L(
|
|
357
|
+
"richtext-pointer-events-none richtext-block richtext-h-5 richtext-w-5 richtext-rounded-full richtext-bg-background richtext-shadow-lg richtext-ring-0 richtext-transition-transform data-[state=checked]:richtext-translate-x-5 data-[state=unchecked]:richtext-translate-x-0"
|
|
358
|
+
)
|
|
359
|
+
}
|
|
360
|
+
)
|
|
361
|
+
}
|
|
362
|
+
));
|
|
363
|
+
ri.displayName = Yt.Root.displayName;
|
|
364
|
+
const In = X.Provider, ni = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
365
|
+
X.Viewport,
|
|
366
|
+
{
|
|
367
|
+
ref: r,
|
|
368
|
+
className: L(
|
|
369
|
+
"richtext-fixed richtext-top-0 richtext-z-[100] richtext-flex richtext-max-h-screen richtext-w-full richtext-flex-col-reverse richtext-p-4 sm:richtext-bottom-0 sm:richtext-right-0 sm:richtext-top-auto sm:richtext-flex-col md:richtext-max-w-[420px]",
|
|
370
|
+
t
|
|
371
|
+
),
|
|
372
|
+
...e
|
|
373
|
+
}
|
|
374
|
+
));
|
|
375
|
+
ni.displayName = X.Viewport.displayName;
|
|
376
|
+
const En = Vt(
|
|
377
|
+
"richtext-group richtext-pointer-events-auto richtext-relative richtext-flex richtext-w-full richtext-items-center richtext-justify-between richtext-space-x-4 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-p-6 richtext-pr-8 richtext-shadow-lg richtext-transition-all data-[swipe=cancel]:richtext-translate-x-0 data-[swipe=end]:richtext-translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:richtext-translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:richtext-transition-none data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[swipe=end]:richtext-animate-out data-[state=closed]:richtext-fade-out-80 data-[state=closed]:richtext-slide-out-to-right-full data-[state=open]:richtext-slide-in-from-top-full data-[state=open]:sm:richtext-slide-in-from-bottom-full",
|
|
378
|
+
{
|
|
379
|
+
variants: {
|
|
380
|
+
variant: {
|
|
381
|
+
default: "richtext-border richtext-bg-background richtext-text-foreground",
|
|
382
|
+
destructive: "richtext-destructive richtext-group richtext-border-destructive richtext-bg-destructive richtext-text-destructive-foreground"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
defaultVariants: {
|
|
386
|
+
variant: "default"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
), ci = E.forwardRef(({ className: t, variant: e, ...r }, n) => /* @__PURE__ */ i(
|
|
390
|
+
X.Root,
|
|
391
|
+
{
|
|
392
|
+
ref: n,
|
|
393
|
+
className: L(En({ variant: e }), t),
|
|
394
|
+
...r
|
|
395
|
+
}
|
|
396
|
+
));
|
|
397
|
+
ci.displayName = X.Root.displayName;
|
|
398
|
+
const Rn = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
399
|
+
X.Action,
|
|
400
|
+
{
|
|
401
|
+
ref: r,
|
|
402
|
+
className: L(
|
|
403
|
+
"richtext-inline-flex richtext-h-8 richtext-shrink-0 richtext-items-center richtext-justify-center richtext-rounded-md !richtext-border richtext-bg-transparent richtext-px-3 richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-secondary focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 group-[.destructive]:richtext-border-muted/40 group-[.destructive]:hover:richtext-border-destructive/30 group-[.destructive]:hover:richtext-bg-destructive group-[.destructive]:hover:richtext-text-destructive-foreground group-[.destructive]:focus:richtext-ring-destructive",
|
|
404
|
+
t
|
|
405
|
+
),
|
|
406
|
+
...e
|
|
407
|
+
}
|
|
408
|
+
));
|
|
409
|
+
Rn.displayName = X.Action.displayName;
|
|
410
|
+
const ai = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
411
|
+
X.Close,
|
|
412
|
+
{
|
|
413
|
+
ref: r,
|
|
414
|
+
className: L(
|
|
415
|
+
"richtext-absolute richtext-right-2 richtext-top-2 richtext-rounded-md richtext-p-1 richtext-text-foreground/50 richtext-opacity-0 richtext-transition-opacity hover:richtext-text-foreground focus:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 group-hover:richtext-opacity-100 group-[.destructive]:richtext-text-red-300 group-[.destructive]:hover:richtext-text-red-50 group-[.destructive]:focus:richtext-ring-red-400 group-[.destructive]:focus:richtext-ring-offset-red-600",
|
|
416
|
+
t
|
|
417
|
+
),
|
|
418
|
+
"toast-close": "",
|
|
419
|
+
...e,
|
|
420
|
+
children: /* @__PURE__ */ i(Fe, { className: "richtext-h-4 richtext-w-4" })
|
|
421
|
+
}
|
|
422
|
+
));
|
|
423
|
+
ai.displayName = X.Close.displayName;
|
|
424
|
+
const oi = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
425
|
+
X.Title,
|
|
426
|
+
{
|
|
427
|
+
ref: r,
|
|
428
|
+
className: L("richtext-text-sm richtext-font-semibold", t),
|
|
429
|
+
...e
|
|
430
|
+
}
|
|
431
|
+
));
|
|
432
|
+
oi.displayName = X.Title.displayName;
|
|
433
|
+
const si = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
434
|
+
X.Description,
|
|
435
|
+
{
|
|
436
|
+
ref: r,
|
|
437
|
+
className: L("richtext-text-sm richtext-opacity-90", t),
|
|
438
|
+
...e
|
|
439
|
+
}
|
|
440
|
+
));
|
|
441
|
+
si.displayName = X.Description.displayName;
|
|
442
|
+
const zn = Vt(
|
|
443
|
+
"richtext-inline-flex richtext-items-center richtext-justify-center richtext-rounded-md richtext-text-sm richtext-font-medium richtext-ring-offset-background richtext-transition-colors hover:richtext-bg-muted hover:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-pointer-events-none disabled:richtext-opacity-50 data-[state=on]:richtext-bg-accent data-[state=on]:richtext-text-accent-foreground",
|
|
444
|
+
{
|
|
445
|
+
variants: {
|
|
446
|
+
variant: {
|
|
447
|
+
default: "richtext-bg-transparent",
|
|
448
|
+
outline: "richtext-border richtext-border-input richtext-bg-transparent hover:richtext-bg-accent hover:richtext-text-accent-foreground"
|
|
449
|
+
},
|
|
450
|
+
size: {
|
|
451
|
+
default: "richtext-h-10 richtext-px-3",
|
|
452
|
+
sm: "richtext-h-9 richtext-px-2",
|
|
453
|
+
lg: "richtext-h-11 richtext-px-5"
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
defaultVariants: {
|
|
457
|
+
variant: "default",
|
|
458
|
+
size: "default"
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
), li = E.forwardRef(({ className: t, variant: e, size: r, ...n }, a) => /* @__PURE__ */ i(
|
|
462
|
+
qe.Root,
|
|
463
|
+
{
|
|
464
|
+
ref: a,
|
|
465
|
+
className: L(zn({ variant: e, size: r, className: t })),
|
|
466
|
+
...n
|
|
467
|
+
}
|
|
468
|
+
));
|
|
469
|
+
li.displayName = qe.Root.displayName;
|
|
470
|
+
const On = yt.Provider, hi = yt.Root, di = yt.Trigger, oe = E.forwardRef(({ className: t, sideOffset: e = 4, ...r }, n) => /* @__PURE__ */ i(
|
|
471
|
+
yt.Content,
|
|
472
|
+
{
|
|
473
|
+
ref: n,
|
|
474
|
+
sideOffset: e,
|
|
475
|
+
className: L(
|
|
476
|
+
"richtext-z-50 richtext-overflow-hidden richtext-rounded-md !richtext-border richtext-bg-popover richtext-px-3 richtext-py-1.5 richtext-text-sm richtext-text-popover-foreground richtext-shadow-md richtext-animate-in richtext-fade-in-0 richtext-zoom-in-95 data-[side=bottom]:richtext-slide-in-from-top-2 data-[side=left]:richtext-slide-in-from-right-2 data-[side=right]:richtext-slide-in-from-left-2 data-[side=top]:richtext-slide-in-from-bottom-2",
|
|
477
|
+
t
|
|
478
|
+
),
|
|
479
|
+
...r
|
|
480
|
+
}
|
|
481
|
+
));
|
|
482
|
+
oe.displayName = yt.Content.displayName;
|
|
483
|
+
const _n = 1, Hn = 1e6;
|
|
484
|
+
let Kt = 0;
|
|
485
|
+
function Pn() {
|
|
486
|
+
return Kt = (Kt + 1) % Number.MAX_SAFE_INTEGER, Kt.toString();
|
|
487
|
+
}
|
|
488
|
+
const Zt = /* @__PURE__ */ new Map();
|
|
489
|
+
function ye(t) {
|
|
490
|
+
if (Zt.has(t))
|
|
491
|
+
return;
|
|
492
|
+
const e = setTimeout(() => {
|
|
493
|
+
Zt.delete(t), pt({
|
|
494
|
+
type: "REMOVE_TOAST",
|
|
495
|
+
toastId: t
|
|
496
|
+
});
|
|
497
|
+
}, Hn);
|
|
498
|
+
Zt.set(t, e);
|
|
499
|
+
}
|
|
500
|
+
function Dn(t, e) {
|
|
501
|
+
switch (e.type) {
|
|
502
|
+
case "ADD_TOAST":
|
|
503
|
+
return {
|
|
504
|
+
...t,
|
|
505
|
+
toasts: [e.toast, ...t.toasts].slice(0, _n)
|
|
506
|
+
};
|
|
507
|
+
case "UPDATE_TOAST":
|
|
508
|
+
return {
|
|
509
|
+
...t,
|
|
510
|
+
toasts: t.toasts.map(
|
|
511
|
+
(r) => r.id === e.toast.id ? { ...r, ...e.toast } : r
|
|
512
|
+
)
|
|
513
|
+
};
|
|
514
|
+
case "DISMISS_TOAST": {
|
|
515
|
+
const { toastId: r } = e;
|
|
516
|
+
return r ? ye(r) : t.toasts.forEach((n) => {
|
|
517
|
+
ye(n.id);
|
|
518
|
+
}), {
|
|
519
|
+
...t,
|
|
520
|
+
toasts: t.toasts.map(
|
|
521
|
+
(n) => n.id === r || r === void 0 ? {
|
|
522
|
+
...n,
|
|
523
|
+
open: !1
|
|
524
|
+
} : n
|
|
525
|
+
)
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
case "REMOVE_TOAST":
|
|
529
|
+
return e.toastId === void 0 ? {
|
|
530
|
+
...t,
|
|
531
|
+
toasts: []
|
|
532
|
+
} : {
|
|
533
|
+
...t,
|
|
534
|
+
toasts: t.toasts.filter((r) => r.id !== e.toastId)
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
const Et = [];
|
|
539
|
+
let Rt = { toasts: [] };
|
|
540
|
+
function pt(t) {
|
|
541
|
+
Rt = Dn(Rt, t), Et.forEach((e) => {
|
|
542
|
+
e(Rt);
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
function Bn({ ...t }) {
|
|
546
|
+
const e = Pn(), r = (a) => pt({
|
|
547
|
+
type: "UPDATE_TOAST",
|
|
548
|
+
toast: { ...a, id: e }
|
|
549
|
+
}), n = () => pt({ type: "DISMISS_TOAST", toastId: e });
|
|
550
|
+
return pt({
|
|
551
|
+
type: "ADD_TOAST",
|
|
552
|
+
toast: {
|
|
553
|
+
...t,
|
|
554
|
+
id: e,
|
|
555
|
+
open: !0,
|
|
556
|
+
onOpenChange: (a) => {
|
|
557
|
+
a || n();
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}), {
|
|
561
|
+
id: e,
|
|
562
|
+
dismiss: n,
|
|
563
|
+
update: r
|
|
564
|
+
};
|
|
565
|
+
}
|
|
566
|
+
function $n() {
|
|
567
|
+
const [t, e] = E.useState(Rt);
|
|
568
|
+
return E.useEffect(() => (Et.push(e), () => {
|
|
569
|
+
const r = Et.indexOf(e);
|
|
570
|
+
r > -1 && Et.splice(r, 1);
|
|
571
|
+
}), [t]), {
|
|
572
|
+
...t,
|
|
573
|
+
toast: Bn,
|
|
574
|
+
dismiss: (r) => pt({ type: "DISMISS_TOAST", toastId: r })
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
function Vn(t) {
|
|
578
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i(
|
|
579
|
+
"path",
|
|
580
|
+
{
|
|
581
|
+
fill: "currentColor",
|
|
582
|
+
d: "M19 12h-2v3h-3v2h5zM7 9h3V7H5v5h2zm14-6H3a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h18a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2m0 16H3V5h18z"
|
|
583
|
+
}
|
|
584
|
+
) });
|
|
585
|
+
}
|
|
586
|
+
function Wn(t) {
|
|
587
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i(
|
|
588
|
+
"path",
|
|
589
|
+
{
|
|
590
|
+
fill: "none",
|
|
591
|
+
stroke: "currentColor",
|
|
592
|
+
strokeLinecap: "round",
|
|
593
|
+
strokeLinejoin: "round",
|
|
594
|
+
strokeWidth: "2",
|
|
595
|
+
d: "M6 15h15m0 4H6m9-8h6m0-4h-6M9 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2M3 9h1a1 1 0 1 1-1 1V7.5a2 2 0 0 1 2-2"
|
|
596
|
+
}
|
|
597
|
+
) });
|
|
598
|
+
}
|
|
599
|
+
function jn() {
|
|
600
|
+
return /* @__PURE__ */ i(
|
|
601
|
+
"svg",
|
|
602
|
+
{
|
|
603
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
604
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
605
|
+
"aria-hidden": "true",
|
|
606
|
+
role: "img",
|
|
607
|
+
className: "richtext-w-4 richtext-h-4",
|
|
608
|
+
width: "1em",
|
|
609
|
+
height: "1em",
|
|
610
|
+
viewBox: "0 0 24 24",
|
|
611
|
+
children: /* @__PURE__ */ i(
|
|
612
|
+
"path",
|
|
613
|
+
{
|
|
614
|
+
fill: "none",
|
|
615
|
+
stroke: "currentColor",
|
|
616
|
+
strokeLinecap: "round",
|
|
617
|
+
strokeLinejoin: "round",
|
|
618
|
+
strokeWidth: "1.5",
|
|
619
|
+
d: "M5.5 3c1.404 0 2.107 0 2.611.38c.219.164.406.375.552.62C9 4.568 9 5.358 9 6.938v10.125c0 1.58 0 2.37-.337 2.937a2.1 2.1 0 0 1-.552.621c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C2 19.432 2 18.642 2 17.062V6.938c0-1.58 0-2.37.337-2.938a2.1 2.1 0 0 1 .552-.62C3.393 3 4.096 3 5.5 3M20 11.938v5.124c0 1.58 0 2.37-.337 2.938a2.1 2.1 0 0 1-.552.62c-.504.38-1.207.38-2.611.38s-2.107 0-2.611-.38a2.1 2.1 0 0 1-.552-.62C13 19.433 13 18.642 13 17.063V6.938c0-1.58 0-2.37.337-2.938M22 9l-6-6m6 0l-6 6",
|
|
620
|
+
color: "currentColor"
|
|
621
|
+
}
|
|
622
|
+
)
|
|
623
|
+
}
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
function Fn() {
|
|
627
|
+
return /* @__PURE__ */ i(
|
|
628
|
+
"svg",
|
|
629
|
+
{
|
|
630
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
631
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
632
|
+
"aria-hidden": "true",
|
|
633
|
+
role: "img",
|
|
634
|
+
className: "richtext-w-4 richtext-h-4",
|
|
635
|
+
width: "1em",
|
|
636
|
+
height: "1em",
|
|
637
|
+
viewBox: "0 0 24 24",
|
|
638
|
+
children: /* @__PURE__ */ i(
|
|
639
|
+
"path",
|
|
640
|
+
{
|
|
641
|
+
fill: "none",
|
|
642
|
+
stroke: "currentColor",
|
|
643
|
+
strokeLinecap: "round",
|
|
644
|
+
strokeLinejoin: "round",
|
|
645
|
+
strokeWidth: "1.5",
|
|
646
|
+
d: "M21 18.5c0 1.404 0 2.107-.38 2.611a2.1 2.1 0 0 1-.62.552c-.567.337-1.358.337-2.937.337H6.938c-1.58 0-2.37 0-2.938-.337a2.1 2.1 0 0 1-.62-.552C3 20.607 3 19.904 3 18.5s0-2.107.38-2.611c.163-.218.374-.406.62-.552C4.567 15 5.357 15 6.938 15h10.125c1.58 0 2.37 0 2.937.337c.246.146.457.334.62.552c.38.504.38 1.207.38 2.611M12.063 4H6.937C5.358 4 4.568 4 4 4.337a2.1 2.1 0 0 0-.62.552C3 5.393 3 6.096 3 7.5s0 2.107.38 2.611c.163.218.374.406.62.552C4.567 11 5.357 11 6.938 11h10.125c1.58 0 2.37 0 2.937-.337M21 8l-6-6m6 0l-6 6",
|
|
647
|
+
color: "currentColor"
|
|
648
|
+
}
|
|
649
|
+
)
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
function Gn(t) {
|
|
654
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i(
|
|
655
|
+
"path",
|
|
656
|
+
{
|
|
657
|
+
fill: "currentColor",
|
|
658
|
+
d: "M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"
|
|
659
|
+
}
|
|
660
|
+
) });
|
|
661
|
+
}
|
|
662
|
+
function G(t) {
|
|
663
|
+
const e = ui[t.name];
|
|
664
|
+
return e ? /* @__PURE__ */ i(e, { onClick: t == null ? void 0 : t.onClick, className: `richtext-w-4 richtext-h-4 ${(t == null ? void 0 : t.className) || ""}` }) : null;
|
|
665
|
+
}
|
|
666
|
+
function Un(t) {
|
|
667
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i(
|
|
668
|
+
"path",
|
|
669
|
+
{
|
|
670
|
+
fill: "currentColor",
|
|
671
|
+
d: "M21 22H3v-2h18zm0-18H3V2h18zm-11 9.7h4l-2-5.4zM11.2 6h1.7l4.7 12h-2l-.9-2.6H9.4L8.5 18h-2z"
|
|
672
|
+
}
|
|
673
|
+
) });
|
|
674
|
+
}
|
|
675
|
+
function Kn(t) {
|
|
676
|
+
return /* @__PURE__ */ i(
|
|
677
|
+
"svg",
|
|
678
|
+
{
|
|
679
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
680
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
681
|
+
"aria-hidden": "true",
|
|
682
|
+
role: "img",
|
|
683
|
+
width: "1em",
|
|
684
|
+
height: "1em",
|
|
685
|
+
viewBox: "0 0 48 48",
|
|
686
|
+
...t,
|
|
687
|
+
children: /* @__PURE__ */ i(
|
|
688
|
+
"path",
|
|
689
|
+
{
|
|
690
|
+
fill: "currentColor",
|
|
691
|
+
stroke: "currentColor",
|
|
692
|
+
strokeLinejoin: "round",
|
|
693
|
+
strokeWidth: 4,
|
|
694
|
+
d: "M36 19L24 31L12 19z"
|
|
695
|
+
}
|
|
696
|
+
)
|
|
697
|
+
}
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
function Zn(t) {
|
|
701
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i("path", { fill: "currentColor", d: "M9 7v10h6v-2h-4V7z" }) });
|
|
702
|
+
}
|
|
703
|
+
function Xn(t) {
|
|
704
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i(
|
|
705
|
+
"path",
|
|
706
|
+
{
|
|
707
|
+
fill: "currentColor",
|
|
708
|
+
d: "M9 7c-1.1 0-2 .9-2 2v8h2V9h2v7h2V9h2v8h2V9a2 2 0 0 0-2-2z"
|
|
709
|
+
}
|
|
710
|
+
) });
|
|
711
|
+
}
|
|
712
|
+
function qn(t) {
|
|
713
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...t, children: /* @__PURE__ */ i(
|
|
714
|
+
"path",
|
|
715
|
+
{
|
|
716
|
+
fill: "currentColor",
|
|
717
|
+
d: "M11 7c-1.1 0-2 .9-2 2v2a2 2 0 0 0 2 2h2v2H9v2h4c1.11 0 2-.89 2-2v-2a2 2 0 0 0-2-2h-2V9h4V7z"
|
|
718
|
+
}
|
|
719
|
+
) });
|
|
720
|
+
}
|
|
721
|
+
function Yn() {
|
|
722
|
+
return /* @__PURE__ */ i(
|
|
723
|
+
"svg",
|
|
724
|
+
{
|
|
725
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
726
|
+
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
727
|
+
"aria-hidden": "true",
|
|
728
|
+
role: "img",
|
|
729
|
+
width: "1em",
|
|
730
|
+
height: "1em",
|
|
731
|
+
viewBox: "0 0 24 24",
|
|
732
|
+
children: /* @__PURE__ */ i(
|
|
733
|
+
"path",
|
|
734
|
+
{
|
|
735
|
+
fill: "currentColor",
|
|
736
|
+
d: "M14 2H6a2 2 0 0 0-2 2v16c0 1.11.89 2 2 2h12c1.11 0 2-.89 2-2V8zm4 18H6V4h7v5h5zm-.65-10l-2.1 9h-1.4l-1.8-6.79l-1.8 6.79h-1.4l-2.2-9h1.5l1.4 6.81l1.8-6.81h1.3l1.8 6.81l1.4-6.81z"
|
|
737
|
+
}
|
|
738
|
+
)
|
|
739
|
+
}
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
function Jn() {
|
|
743
|
+
return /* @__PURE__ */ u("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 32 32", children: [
|
|
744
|
+
/* @__PURE__ */ i("path", { fill: "currentColor", d: "M30 18v-2h-6v10h2v-4h3v-2h-3v-2zm-11 8h-4V16h4a3.003 3.003 0 0 1 3 3v4a3.003 3.003 0 0 1-3 3m-2-2h2a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-2zm-6-8H6v10h2v-3h3a2.003 2.003 0 0 0 2-2v-3a2 2 0 0 0-2-2m-3 5v-3h3l.001 3z" }),
|
|
745
|
+
/* @__PURE__ */ i("path", { fill: "currentColor", d: "M22 14v-4a.91.91 0 0 0-.3-.7l-7-7A.9.9 0 0 0 14 2H4a2.006 2.006 0 0 0-2 2v24a2 2 0 0 0 2 2h16v-2H4V4h8v6a2.006 2.006 0 0 0 2 2h6v2Zm-8-4V4.4l5.6 5.6Z" })
|
|
746
|
+
] });
|
|
747
|
+
}
|
|
748
|
+
function Qn() {
|
|
749
|
+
return /* @__PURE__ */ u(
|
|
750
|
+
"svg",
|
|
751
|
+
{
|
|
752
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
753
|
+
width: "1em",
|
|
754
|
+
height: "1em",
|
|
755
|
+
className: "icon",
|
|
756
|
+
viewBox: "0 0 1024 1024",
|
|
757
|
+
children: [
|
|
758
|
+
/* @__PURE__ */ i(
|
|
759
|
+
"path",
|
|
760
|
+
{
|
|
761
|
+
fill: "currentColor",
|
|
762
|
+
d: "M679.253 402.364 618.77 561.015l-60.348-158.651a30.04 30.04 0 0 0-30.447-18.637 29.76 29.76 0 0 0-30.447 18.637l-60.416 158.651-60.416-158.651a30.515 30.515 0 0 0-38.843-17.272 28.945 28.945 0 0 0-17.954 37.547l88.815 233.267c4.369 11.469 15.7 19.115 28.398 19.115a30.31 30.31 0 0 0 28.468-19.115l62.395-163.908 62.396 163.84c4.437 11.605 15.701 19.183 28.4 19.183a30.31 30.31 0 0 0 28.466-19.115l88.747-233.267a28.945 28.945 0 0 0-17.886-37.547 30.447 30.447 0 0 0-38.912 17.272zm219.478 395.605-51.883-29.218c-28.672-16.18-52.224-3.072-52.224 29.082v.273H643.209a29.833 29.833 0 0 0-30.31 29.354c0 16.18 13.584 29.218 30.31 29.218h151.825c1.092 30.516 24.03 43.077 52.224 27.648l51.063-27.989c29.013-15.906 29.15-42.189.41-58.368"
|
|
763
|
+
}
|
|
764
|
+
),
|
|
765
|
+
/* @__PURE__ */ i(
|
|
766
|
+
"path",
|
|
767
|
+
{
|
|
768
|
+
fill: "currentColor",
|
|
769
|
+
d: "m810.667 913.135-.478.068H201.796c-19.865 0-36.727-11.673-36.727-25.6v-618.36h154.965c51.268 0 92.911-39.39 92.911-87.858v-87.86H810.19c19.797 0 36.522 11.742 36.522 25.669V739.26h61.987V119.262c0-46.421-44.169-84.241-98.51-84.241H328.364l-225.28 194.56v658.09c0 46.285 44.236 84.105 98.713 84.105H810.19c43.759 0 80.554-24.713 93.32-58.573h-92.842zM350.89 94.89v86.562c0 16.11-13.858 29.286-30.925 29.286H216.815L350.959 94.891z"
|
|
770
|
+
}
|
|
771
|
+
)
|
|
772
|
+
]
|
|
773
|
+
}
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
function tc() {
|
|
777
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M14 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m-9 8h4m-2-2v4" }) });
|
|
778
|
+
}
|
|
779
|
+
function ec() {
|
|
780
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1m9 8h4m-2-2v4" }) });
|
|
781
|
+
}
|
|
782
|
+
function ic() {
|
|
783
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { fill: "currentColor", d: "M23.943 19.806a.2.2 0 0 0-.168-.034c-1.26-1.855-2.873-3.61-4.419-5.315l-.252-.284c-.001-.073-.067-.12-.134-.15l-.084-.084c-.05-.1-.169-.167-.286-.1c-.47.234-.907.585-1.327.919c-.554.434-1.109.87-1.63 1.354a5 5 0 0 0-.588.618c-.084.117-.017.217.084.267c-.37.368-.74.736-1.109 1.12a.2.2 0 0 0-.05.134c0 .05.033.1.067.117l.655.502v.016c.924.92 2.554 2.173 4.285 3.527c.251.201.52.402.773.602c.117.134.234.285.335.418c.05.066.169.084.236.033c.033.034.084.067.118.1a.24.24 0 0 0 .1.034a.15.15 0 0 0 .135-.066a.24.24 0 0 0 .033-.1c.017 0 .017.016.034.016a.2.2 0 0 0 .134-.05l3.058-3.327c.12-.116.014-.267 0-.267m-7.628-.134l-1.546-1.17l-.15-.1c-.035-.017-.068-.05-.102-.067l-.117-.1c.66-.66 1.33-1.308 2-1.956c-.488.484-1.463 1.906-1.261 2.373c.002 0 .018.042.067.084zm4.1 3.126l-1.277-.97a27 27 0 0 0-1.58-1.504c.69.518 1.277.97 1.361 1.053c.673.585.638.485 1.093.87l.554.4c-.074.103-.151.148-.151.151m.336.25l-.034-.016a1 1 0 0 0 .152-.117zM.588 3.476c.033.217.084.435.117.636c.201 1.103.403 2.106.772 2.858l.152.568c.05.217.134.485.219.552a67 67 0 0 0 3.578 2.942a.18.18 0 0 0 .219 0s0 .016.016.016a.15.15 0 0 0 .118.05a.2.2 0 0 0 .134-.05c1.798-1.989 3.142-3.627 4.1-4.998c.068-.066.084-.167.084-.25c.067-.067.118-.151.185-.201c.067-.067.067-.184 0-.235l-.017-.016c0-.033-.017-.084-.05-.1c-.42-.401-.722-.685-1.042-.986a94 94 0 0 1-2.352-2.273c-.017-.017-.034-.034-.067-.034c-.336-.117-1.025-.234-1.882-.385c-1.277-.216-3.008-.517-4.57-.986c0 0-.101 0-.118.017l-.05.05C.05.714.022.707 0 .718c.017.1.017.167.05.284c0 .033.068.301.068.334zm7.19 4.78l-.033.034a.036.036 0 0 1 .033-.034M6.553 2.238c.101.1.521.502.622.585c-.437-.2-1.529-.702-2.034-.869c.505.1 1.194.201 1.412.284M.79 1.403c.252.434.454 1.939.655 3.41c-.118-.469-.201-.936-.302-1.372C.992 2.673.84 1.988.638 1.386c.124 0 .152.021.152.017m-.286-.369c0-.016 0-.033-.017-.033c.085 0 .135.017.202.05c0 .006-.145-.017-.185-.017m23.17-.217c.017-.066-.336-.367-.219-.384c.253-.017.253-.401 0-.401c-.335.017-.688.1-1.008.15c-.587.117-1.192.234-1.78.367a80 80 0 0 0-3.949.937c-.403.117-.857.2-1.243.401c-.135.067-.118.2-.05.284c-.034.017-.051.017-.085.034c-.117.017-.218.034-.335.05c-.102.017-.152.1-.135.2c0 .017.017.05.017.067c-.706.936-1.496 1.923-2.353 2.976c-.84.969-1.73 1.989-2.62 3.042c-2.84 3.31-6.05 7.07-9.594 10.38a.16.16 0 0 0 0 .234c.016.016.033.033.05.033c-.05.05-.101.085-.152.134q-.05.05-.05.1a.4.4 0 0 0-.067.084c-.067.067-.067.184.017.234c.067.066.185.066.235-.017c.017-.017.017-.033.033-.033a.265.265 0 0 1 .37 0c.202.217.404.435.588.618l-.42-.35c-.067-.067-.184-.05-.234.016c-.068.066-.051.184.016.234l4.469 3.727c.034.034.067.034.118.034a.15.15 0 0 0 .117-.05l.101-.1c.017.016.05.016.067.016c.05 0 .084-.016.118-.05c6.049-6.05 10.922-10.614 16.5-14.693c.05-.033.067-.1.067-.15c.067 0 .118-.05.15-.117c1.026-3.125 1.228-5.9 1.295-7.27c0-.059.016-.038.016-.068c.017-.033.017-.05.017-.05a.98.98 0 0 0-.067-.619m-10.82 4.915c.268-.301.537-.619.806-.903c-1.73 2.273-4.603 5.767-8.67 9.929c2.773-3.059 5.562-6.218 7.864-9.026M5.14 23.466c-.016-.017-.016-.017 0-.017zm2.504-2.156c.135-.15.27-.284.42-.434c0 0 0 .016.017.016c-.224.198-.433.418-.437.418m.69-.668c.099-.1.14-.173.284-.318c.992-1.02 2.017-2.04 3.059-3.076l.016-.016c.252-.2.555-.418.824-.619a228 228 0 0 0-4.184 4.029M14.852 3.91c-.554.719-1.176 1.671-1.697 2.423c-1.646 2.374-6.94 8.174-7.057 8.274a1190 1190 0 0 1-4.839 4.597l-.1.1c-.085-.1-.085-.25.016-.334C8.652 11.966 13.19 6.133 15.021 3.576c-.05.116-.084.216-.168.334zm2.906 3.427c-.671-.386-.99-.987-.806-1.572l.05-.2a.8.8 0 0 1 .085-.167a1.9 1.9 0 0 1 .756-.703c.016 0 .033 0 .05-.016c-.017-.034-.017-.084-.017-.134c.017-.1.085-.167.202-.167c.202 0 .824.184 1.059.384c.067.05.134.117.202.184c.084.1.218.268.285.401c.034.017.067.184.118.268c.033.134.067.284.05.418c-.017.016 0 .116-.017.116a1.6 1.6 0 0 1-.218.619c-.03.03.006.012-.05.067a1.2 1.2 0 0 1-.32.334a1.49 1.49 0 0 1-1.26.234a2 2 0 0 0-.169-.066m4.37 1.403c0 .017-.017.05 0 .067c-.034 0-.05.017-.085.034a110 110 0 0 0-3.915 3.025c1.11-.986 2.218-1.989 3.378-2.975c.336-.301.571-.686.638-1.12l.168-1.003v-.033c.085-.201.404-.118.353.1c-.004-.001-.173.795-.537 1.905" }) });
|
|
784
|
+
}
|
|
785
|
+
function rc() {
|
|
786
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 21v-4m0-4V9m0-4V3m-2 18h4M8 5v4h11l2-2l-2-2zm6 8v4H6l-2-2l2-2z" }) });
|
|
787
|
+
}
|
|
788
|
+
function nc() {
|
|
789
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 20 20", children: /* @__PURE__ */ i("path", { fill: "currentColor", d: "M6.5 3a.75.75 0 0 1 .697.471l3 7.5a.75.75 0 0 1-1.393.557L7.992 9.5H5.008l-.811 2.028a.75.75 0 0 1-1.393-.556l3-7.5A.75.75 0 0 1 6.5 3m0 2.77L5.608 8h1.784zm8.28-1.55a.75.75 0 1 0-1.06 1.06l.72.72h-3.69a.75.75 0 0 0 0 1.5h3.69l-.72.72a.75.75 0 0 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06zm0 7.5a.75.75 0 1 0-1.06 1.06l.72.72H3.75a.75.75 0 0 0 0 1.5h10.69l-.72.72a.75.75 0 1 0 1.06 1.06l2-2a.75.75 0 0 0 0-1.06z" }) });
|
|
790
|
+
}
|
|
791
|
+
function cc() {
|
|
792
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 20 20", children: /* @__PURE__ */ i("path", { fill: "currentColor", d: "M13.5 3a.75.75 0 0 0-.697.471l-3 7.5a.75.75 0 0 0 1.393.557l.812-2.028h2.984l.811 2.028a.75.75 0 0 0 1.393-.556l-3-7.5A.75.75 0 0 0 13.5 3m0 2.77L14.392 8h-1.784zM5.22 4.22a.75.75 0 0 1 1.06 1.06L5.56 6h3.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 0 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06zm0 7.5a.75.75 0 0 1 1.06 1.06l-.72.72h10.69a.75.75 0 0 1 0 1.5H5.56l.72.72a.75.75 0 1 1-1.06 1.06l-2-2a.75.75 0 0 1 0-1.06z" }) });
|
|
793
|
+
}
|
|
794
|
+
function ac() {
|
|
795
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ u("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", color: "currentColor", children: [
|
|
796
|
+
/* @__PURE__ */ i("path", { d: "M14.86 22h-4.312c-3.291 0-4.937 0-6.08-.798a4.2 4.2 0 0 1-.863-.805c-.855-1.066-.855-2.6-.855-5.67v-2.545c0-2.963 0-4.445.473-5.628c.761-1.903 2.37-3.403 4.41-4.113C8.9 2 10.49 2 13.667 2c1.816 0 2.723 0 3.448.252c1.166.406 2.085 1.263 2.52 2.35c.27.676.27 1.523.27 3.216V10" }),
|
|
797
|
+
/* @__PURE__ */ i("path", { d: "M2.75 12c0-1.84 1.506-3.333 3.364-3.333c.672 0 1.464.116 2.117-.057a1.67 1.67 0 0 0 1.19-1.179c.174-.647.057-1.432.057-2.098C9.478 3.493 10.984 2 12.84 2m.002 16h2.523m-4.949-4.15c-.126-.8-.281-.801-1.61-.85h-1.01c-.557 0-1.009.448-1.009 1v3c0 .552.452 1 1.01 1h1.816c.39 0 .803-.313.803-.7v-1.1c0-.11-.113-.304-.224-.304H9.068M12.842 13h1.261m0 0h1.262m-1.262 0v4.875M21.251 13h-2.523c-.557 0-1.009.448-1.009 1v1.5m0 0V18m0-2.5h2.523" })
|
|
798
|
+
] }) });
|
|
799
|
+
}
|
|
800
|
+
function oc() {
|
|
801
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 48 48", children: /* @__PURE__ */ u("g", { fill: "none", stroke: "currentColor", strokeWidth: "4", children: [
|
|
802
|
+
/* @__PURE__ */ i("circle", { cx: "10", cy: "24", r: "4" }),
|
|
803
|
+
/* @__PURE__ */ i("circle", { cx: "38", cy: "10", r: "4" }),
|
|
804
|
+
/* @__PURE__ */ i("circle", { cx: "38", cy: "24", r: "4" }),
|
|
805
|
+
/* @__PURE__ */ i("circle", { cx: "38", cy: "38", r: "4" }),
|
|
806
|
+
/* @__PURE__ */ i("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M34 38H22V10h12M14 24h20" })
|
|
807
|
+
] }) });
|
|
808
|
+
}
|
|
809
|
+
function sc() {
|
|
810
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.5", d: "m3 21l7.548-7.548M21 3l-7.548 7.548m0 0L8 3H3l7.548 10.452m2.904-2.904L21 21h-5l-5.452-7.548", color: "currentColor" }) });
|
|
811
|
+
}
|
|
812
|
+
const ui = {
|
|
813
|
+
Bold: an,
|
|
814
|
+
LoaderCircle: cn,
|
|
815
|
+
Italic: nn,
|
|
816
|
+
Underline: rn,
|
|
817
|
+
Quote: en,
|
|
818
|
+
TextQuote: Wn,
|
|
819
|
+
Strikethrough: tn,
|
|
820
|
+
Minus: Qr,
|
|
821
|
+
Eraser: Jr,
|
|
822
|
+
PaintRoller: Yr,
|
|
823
|
+
Redo2: qr,
|
|
824
|
+
Undo2: Xr,
|
|
825
|
+
AlignCenter: hn,
|
|
826
|
+
AlignJustify: ln,
|
|
827
|
+
AlignLeft: sn,
|
|
828
|
+
AlignRight: on,
|
|
829
|
+
ChevronDown: Zr,
|
|
830
|
+
Subscript: Kr,
|
|
831
|
+
Superscript: Ur,
|
|
832
|
+
Code: Gr,
|
|
833
|
+
Code2: Fr,
|
|
834
|
+
Type: jr,
|
|
835
|
+
IndentIncrease: Wr,
|
|
836
|
+
IndentDecrease: Vr,
|
|
837
|
+
List: $r,
|
|
838
|
+
ListOrdered: Br,
|
|
839
|
+
ListTodo: Dr,
|
|
840
|
+
Link: Pr,
|
|
841
|
+
ImageUp: Hr,
|
|
842
|
+
Video: _r,
|
|
843
|
+
Maximize: Or,
|
|
844
|
+
Minimize: zr,
|
|
845
|
+
Table: Rr,
|
|
846
|
+
Sparkles: Er,
|
|
847
|
+
Pencil: Ke,
|
|
848
|
+
Unlink: Ir,
|
|
849
|
+
BetweenHorizonalEnd: Lr,
|
|
850
|
+
BetweenHorizonalStart: Mr,
|
|
851
|
+
BetweenVerticalStart: Ar,
|
|
852
|
+
BetweenVerticalEnd: Sr,
|
|
853
|
+
TableCellsMerge: kr,
|
|
854
|
+
TableCellsSplit: Tr,
|
|
855
|
+
Trash2: Ue,
|
|
856
|
+
Trash: Nr,
|
|
857
|
+
Replace: pe,
|
|
858
|
+
ChevronsUpDown: Cr,
|
|
859
|
+
LineHeight: Un,
|
|
860
|
+
Word: Gn,
|
|
861
|
+
Heading1: yr,
|
|
862
|
+
Heading2: br,
|
|
863
|
+
Heading3: vr,
|
|
864
|
+
Heading4: wr,
|
|
865
|
+
Heading5: pr,
|
|
866
|
+
Heading6: gr,
|
|
867
|
+
Columns2: we,
|
|
868
|
+
Columns3: fr,
|
|
869
|
+
Columns4: mr,
|
|
870
|
+
Plus: Ge,
|
|
871
|
+
Grip: xr,
|
|
872
|
+
Copy: ur,
|
|
873
|
+
Clipboard: dr,
|
|
874
|
+
PanelLeft: hr,
|
|
875
|
+
PanelRight: lr,
|
|
876
|
+
Columns: we,
|
|
877
|
+
Iframe: sr,
|
|
878
|
+
MenuDown: Kn,
|
|
879
|
+
SizeS: qn,
|
|
880
|
+
SizeM: Xn,
|
|
881
|
+
SizeL: Zn,
|
|
882
|
+
AspectRatio: Vn,
|
|
883
|
+
Emoji: or,
|
|
884
|
+
DeleteColumn: jn,
|
|
885
|
+
DeleteRow: Fn,
|
|
886
|
+
SearchAndReplace: pe,
|
|
887
|
+
EmojiIcon: ar,
|
|
888
|
+
KatexIcon: cr,
|
|
889
|
+
ExportPdf: Jn,
|
|
890
|
+
ExportWord: Qn,
|
|
891
|
+
ImportWord: Yn,
|
|
892
|
+
ColumnAddLeft: tc,
|
|
893
|
+
ColumnAddRight: ec,
|
|
894
|
+
BookMarked: nr,
|
|
895
|
+
Excalidraw: ic,
|
|
896
|
+
ZoomIn: rr,
|
|
897
|
+
ZoomOut: ir,
|
|
898
|
+
Settings: er,
|
|
899
|
+
Eye: tr,
|
|
900
|
+
TextDirection: rc,
|
|
901
|
+
LeftToRight: nc,
|
|
902
|
+
RightToLeft: cc,
|
|
903
|
+
Attachment: Qi,
|
|
904
|
+
GifIcon: ac,
|
|
905
|
+
ChevronUp: Ji,
|
|
906
|
+
Crop: Yi,
|
|
907
|
+
Mermaid: oc,
|
|
908
|
+
Twitter: sc,
|
|
909
|
+
FlipX: qi,
|
|
910
|
+
FlipY: Xi
|
|
911
|
+
};
|
|
912
|
+
function lc({ fill: t }) {
|
|
913
|
+
return /* @__PURE__ */ i(
|
|
914
|
+
"svg",
|
|
915
|
+
{
|
|
916
|
+
width: "18px",
|
|
917
|
+
height: "18px",
|
|
918
|
+
viewBox: "0 0 256 256",
|
|
919
|
+
version: "1.1",
|
|
920
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
921
|
+
children: /* @__PURE__ */ i("g", { id: "icon/填充色", stroke: "none", strokeWidth: 1, fill: "none", fillRule: "evenodd", children: /* @__PURE__ */ u("g", { id: "icon/背景颜色", children: [
|
|
922
|
+
/* @__PURE__ */ i("g", { id: "编组", fill: "currentColor", children: /* @__PURE__ */ u(
|
|
923
|
+
"g",
|
|
924
|
+
{
|
|
925
|
+
transform: "translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)",
|
|
926
|
+
id: "矩形",
|
|
927
|
+
children: [
|
|
928
|
+
/* @__PURE__ */ i(
|
|
929
|
+
"path",
|
|
930
|
+
{
|
|
931
|
+
d: "M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z",
|
|
932
|
+
fillRule: "nonzero"
|
|
933
|
+
}
|
|
934
|
+
),
|
|
935
|
+
/* @__PURE__ */ i(
|
|
936
|
+
"path",
|
|
937
|
+
{
|
|
938
|
+
d: "M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z",
|
|
939
|
+
fillRule: "evenodd"
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ i(
|
|
943
|
+
"path",
|
|
944
|
+
{
|
|
945
|
+
d: "M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z",
|
|
946
|
+
fillRule: "nonzero"
|
|
947
|
+
}
|
|
948
|
+
)
|
|
949
|
+
]
|
|
950
|
+
}
|
|
951
|
+
) }),
|
|
952
|
+
/* @__PURE__ */ i(
|
|
953
|
+
"path",
|
|
954
|
+
{
|
|
955
|
+
d: "M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",
|
|
956
|
+
id: "矩形",
|
|
957
|
+
fill: t || "#FBDE28"
|
|
958
|
+
}
|
|
959
|
+
)
|
|
960
|
+
] }) })
|
|
961
|
+
}
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
function hc(t) {
|
|
965
|
+
const [e, r] = w(void 0);
|
|
966
|
+
function n(o) {
|
|
967
|
+
var s;
|
|
968
|
+
(s = t.action) == null || s.call(t, o);
|
|
969
|
+
}
|
|
970
|
+
function a() {
|
|
971
|
+
var o;
|
|
972
|
+
(o = t.action) == null || o.call(t, e);
|
|
973
|
+
}
|
|
974
|
+
const c = C(
|
|
975
|
+
Ve((o) => {
|
|
976
|
+
r(o);
|
|
977
|
+
}, 350),
|
|
978
|
+
[]
|
|
979
|
+
);
|
|
980
|
+
return /* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-h-[32px]", children: [
|
|
981
|
+
/* @__PURE__ */ i(
|
|
982
|
+
v,
|
|
983
|
+
{
|
|
984
|
+
tooltip: t == null ? void 0 : t.tooltip,
|
|
985
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
986
|
+
action: a,
|
|
987
|
+
tooltipOptions: t == null ? void 0 : t.tooltipOptions,
|
|
988
|
+
shortcutKeys: t == null ? void 0 : t.shortcutKeys,
|
|
989
|
+
children: /* @__PURE__ */ i("span", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-text-sm", children: /* @__PURE__ */ i(lc, { fill: e }) })
|
|
990
|
+
}
|
|
991
|
+
),
|
|
992
|
+
/* @__PURE__ */ i(
|
|
993
|
+
ua,
|
|
994
|
+
{
|
|
995
|
+
selectedColor: e,
|
|
996
|
+
setSelectedColor: c,
|
|
997
|
+
onChange: n,
|
|
998
|
+
highlight: !0,
|
|
999
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
1000
|
+
children: /* @__PURE__ */ i(U, { variant: "ghost", size: "icon", className: "!richtext-w-3 !richtext-h-[32px]", disabled: t == null ? void 0 : t.disabled, children: /* @__PURE__ */ i(G, { className: "!richtext-w-3 !richtext-h-3 richtext-text-zinc-500", name: "MenuDown" }) })
|
|
1001
|
+
}
|
|
1002
|
+
)
|
|
1003
|
+
] });
|
|
1004
|
+
}
|
|
1005
|
+
function dc(t) {
|
|
1006
|
+
const { t: e } = V(), [r, n] = w({
|
|
1007
|
+
text: "",
|
|
1008
|
+
link: ""
|
|
1009
|
+
}), [a, c] = w(!1);
|
|
1010
|
+
I(() => {
|
|
1011
|
+
var s;
|
|
1012
|
+
if (t != null && t.editor) {
|
|
1013
|
+
const { href: l, target: h } = (s = t.editor) == null ? void 0 : s.getAttributes("link"), { from: d, to: x } = t.editor.state.selection, m = t.editor.state.doc.textBetween(d, x, " ");
|
|
1014
|
+
n({
|
|
1015
|
+
link: l,
|
|
1016
|
+
text: m
|
|
1017
|
+
}), c(h === "_blank");
|
|
1018
|
+
}
|
|
1019
|
+
}, [t == null ? void 0 : t.editor]);
|
|
1020
|
+
function o(s) {
|
|
1021
|
+
s.preventDefault(), s.stopPropagation(), t == null || t.onSetLink(r.link, r.text, a);
|
|
1022
|
+
}
|
|
1023
|
+
return /* @__PURE__ */ i("div", { className: "richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black border-neutral-200 dark:richtext-border-neutral-800", children: /* @__PURE__ */ u("form", { className: "richtext-flex richtext-flex-col richtext-gap-2", onSubmit: o, children: [
|
|
1024
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: e("editor.link.dialog.text") }),
|
|
1025
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[10px]", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
1026
|
+
J,
|
|
1027
|
+
{
|
|
1028
|
+
type: "text",
|
|
1029
|
+
value: r.text,
|
|
1030
|
+
required: !0,
|
|
1031
|
+
className: "richtext-w-80",
|
|
1032
|
+
placeholder: "Text",
|
|
1033
|
+
onChange: (s) => n({ ...r, text: s.target.value })
|
|
1034
|
+
}
|
|
1035
|
+
) }) }),
|
|
1036
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: e("editor.link.dialog.link") }),
|
|
1037
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ u("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: [
|
|
1038
|
+
/* @__PURE__ */ i(
|
|
1039
|
+
J,
|
|
1040
|
+
{
|
|
1041
|
+
type: "url",
|
|
1042
|
+
value: r.link,
|
|
1043
|
+
required: !0,
|
|
1044
|
+
className: "richtext-pl-10",
|
|
1045
|
+
onChange: (s) => n({ ...r, link: s.target.value })
|
|
1046
|
+
}
|
|
1047
|
+
),
|
|
1048
|
+
/* @__PURE__ */ i("span", { className: "richtext-absolute richtext-inset-y-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2 richtext-start-0", children: /* @__PURE__ */ i(G, { className: "richtext-size-5 richtext-text-muted-foreground", name: "Link" }) })
|
|
1049
|
+
] }) }),
|
|
1050
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-space-x-2", children: [
|
|
1051
|
+
/* @__PURE__ */ i(et, { children: e("editor.link.dialog.openInNewTab") }),
|
|
1052
|
+
/* @__PURE__ */ i(
|
|
1053
|
+
ri,
|
|
1054
|
+
{
|
|
1055
|
+
checked: a,
|
|
1056
|
+
onCheckedChange: (s) => {
|
|
1057
|
+
c(s);
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
)
|
|
1061
|
+
] }),
|
|
1062
|
+
/* @__PURE__ */ i(U, { type: "submit", className: "richtext-self-end richtext-mt-2", children: e("editor.link.dialog.button.apply") })
|
|
1063
|
+
] }) });
|
|
1064
|
+
}
|
|
1065
|
+
function uc(t, e, r = null) {
|
|
1066
|
+
return r ? t.createChecked({ index: e }, r) : t.createAndFill({ index: e });
|
|
1067
|
+
}
|
|
1068
|
+
function xc(t) {
|
|
1069
|
+
if (t.cached.columnsNodeTypes)
|
|
1070
|
+
return t.cached.columnsNodeTypes;
|
|
1071
|
+
const e = {
|
|
1072
|
+
columns: t.nodes.columns,
|
|
1073
|
+
column: t.nodes.column
|
|
1074
|
+
};
|
|
1075
|
+
return t.cached.columnsNodeTypes = e, e;
|
|
1076
|
+
}
|
|
1077
|
+
function mc(t, e, r = null) {
|
|
1078
|
+
const n = xc(t), a = [];
|
|
1079
|
+
for (let c = 0; c < e; c += 1) {
|
|
1080
|
+
const o = uc(n.column, c, r);
|
|
1081
|
+
o && a.push(o);
|
|
1082
|
+
}
|
|
1083
|
+
return n.columns.createChecked({ cols: e }, a);
|
|
1084
|
+
}
|
|
1085
|
+
function Xt({
|
|
1086
|
+
state: t,
|
|
1087
|
+
dispatch: e,
|
|
1088
|
+
type: r
|
|
1089
|
+
}) {
|
|
1090
|
+
const n = zt((c) => c.type.name === $t.name)(t.selection), a = zt((c) => c.type.name === xi.name)(t.selection);
|
|
1091
|
+
if (e && n && a) {
|
|
1092
|
+
const c = n.node, o = a.node.attrs.index, s = c.toJSON();
|
|
1093
|
+
let l = o;
|
|
1094
|
+
r === "delete" ? (l = o - 1, s.content.splice(o, 1)) : (l = r === "addBefore" ? o : o + 1, s.content.splice(l, 0, {
|
|
1095
|
+
type: "column",
|
|
1096
|
+
attrs: {
|
|
1097
|
+
index: o
|
|
1098
|
+
},
|
|
1099
|
+
content: [
|
|
1100
|
+
{
|
|
1101
|
+
type: "paragraph"
|
|
1102
|
+
}
|
|
1103
|
+
]
|
|
1104
|
+
})), s.attrs.cols = s.content.length, s.content.forEach((m, f) => {
|
|
1105
|
+
m.attrs.index = f;
|
|
1106
|
+
});
|
|
1107
|
+
const h = $i.fromJSON(t.schema, s);
|
|
1108
|
+
let d = n.pos;
|
|
1109
|
+
h.content.forEach((m, f, p) => {
|
|
1110
|
+
p < l && (d += m.nodeSize);
|
|
1111
|
+
});
|
|
1112
|
+
const x = t.tr.setTime(Date.now());
|
|
1113
|
+
x.replaceWith(n.pos, n.pos + n.node.nodeSize, h).setSelection(
|
|
1114
|
+
bt.near(x.doc.resolve(d))
|
|
1115
|
+
), e(x);
|
|
1116
|
+
}
|
|
1117
|
+
return !0;
|
|
1118
|
+
}
|
|
1119
|
+
function Ce({ state: t, dispatch: e, type: r }) {
|
|
1120
|
+
const n = zt((c) => c.type.name === $t.name)(t.selection), a = zt((c) => c.type.name === xi.name)(t.selection);
|
|
1121
|
+
if (e && n && a) {
|
|
1122
|
+
const c = n.node, o = a.node.attrs.index;
|
|
1123
|
+
let s = 0;
|
|
1124
|
+
r === "before" ? s = (o - 1 + c.attrs.cols) % c.attrs.cols : s = (o + 1) % c.attrs.cols;
|
|
1125
|
+
let l = n.pos;
|
|
1126
|
+
c.content.forEach((d, x, m) => {
|
|
1127
|
+
m < s && (l += d.nodeSize);
|
|
1128
|
+
});
|
|
1129
|
+
const h = t.tr.setTime(Date.now());
|
|
1130
|
+
return h.setSelection(bt.near(h.doc.resolve(l))), e(h), !0;
|
|
1131
|
+
}
|
|
1132
|
+
return !1;
|
|
1133
|
+
}
|
|
1134
|
+
const fc = 200, $t = dt.create({
|
|
1135
|
+
name: "columns",
|
|
1136
|
+
group: "block",
|
|
1137
|
+
defining: !0,
|
|
1138
|
+
isolating: !0,
|
|
1139
|
+
allowGapCursor: !1,
|
|
1140
|
+
content: "column{1,}",
|
|
1141
|
+
priority: fc,
|
|
1142
|
+
addOptions() {
|
|
1143
|
+
return {
|
|
1144
|
+
HTMLAttributes: {
|
|
1145
|
+
class: "columns"
|
|
1146
|
+
}
|
|
1147
|
+
};
|
|
1148
|
+
},
|
|
1149
|
+
addAttributes() {
|
|
1150
|
+
return {
|
|
1151
|
+
cols: {
|
|
1152
|
+
default: 2,
|
|
1153
|
+
parseHTML: (t) => t.getAttribute("cols")
|
|
1154
|
+
}
|
|
1155
|
+
};
|
|
1156
|
+
},
|
|
1157
|
+
parseHTML() {
|
|
1158
|
+
return [
|
|
1159
|
+
{
|
|
1160
|
+
tag: "div[class=grid]"
|
|
1161
|
+
}
|
|
1162
|
+
];
|
|
1163
|
+
},
|
|
1164
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1165
|
+
return ["div", it(this.options.HTMLAttributes, t), 0];
|
|
1166
|
+
},
|
|
1167
|
+
addCommands() {
|
|
1168
|
+
return {
|
|
1169
|
+
insertColumns: (t) => ({ tr: e, dispatch: r, editor: n }) => {
|
|
1170
|
+
const a = mc(n.schema, t && t.cols || 3);
|
|
1171
|
+
if (r) {
|
|
1172
|
+
const c = e.selection.anchor + 1;
|
|
1173
|
+
e.replaceSelectionWith(a).scrollIntoView().setSelection(bt.near(e.doc.resolve(c)));
|
|
1174
|
+
}
|
|
1175
|
+
return !0;
|
|
1176
|
+
},
|
|
1177
|
+
addColBefore: () => ({ dispatch: t, state: e }) => Xt({ dispatch: t, state: e, type: "addBefore" }),
|
|
1178
|
+
addColAfter: () => ({ dispatch: t, state: e }) => Xt({ dispatch: t, state: e, type: "addAfter" }),
|
|
1179
|
+
deleteCol: () => ({ dispatch: t, state: e }) => Xt({ dispatch: t, state: e, type: "delete" })
|
|
1180
|
+
};
|
|
1181
|
+
},
|
|
1182
|
+
addKeyboardShortcuts() {
|
|
1183
|
+
return {
|
|
1184
|
+
"Mod-Alt-G": () => this.editor.commands.insertColumns(),
|
|
1185
|
+
Tab: () => Ce({
|
|
1186
|
+
state: this.editor.state,
|
|
1187
|
+
dispatch: this.editor.view.dispatch,
|
|
1188
|
+
type: "after"
|
|
1189
|
+
}),
|
|
1190
|
+
"Shift-Tab": () => Ce({
|
|
1191
|
+
state: this.editor.state,
|
|
1192
|
+
dispatch: this.editor.view.dispatch,
|
|
1193
|
+
type: "before"
|
|
1194
|
+
})
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
}), xi = dt.create({
|
|
1198
|
+
name: "column",
|
|
1199
|
+
content: "block+",
|
|
1200
|
+
isolating: !0,
|
|
1201
|
+
addOptions() {
|
|
1202
|
+
return {
|
|
1203
|
+
HTMLAttributes: {
|
|
1204
|
+
class: "column"
|
|
1205
|
+
}
|
|
1206
|
+
};
|
|
1207
|
+
},
|
|
1208
|
+
addAttributes() {
|
|
1209
|
+
return {
|
|
1210
|
+
index: {
|
|
1211
|
+
default: 0,
|
|
1212
|
+
parseHTML: (t) => t.getAttribute("index")
|
|
1213
|
+
}
|
|
1214
|
+
};
|
|
1215
|
+
},
|
|
1216
|
+
parseHTML() {
|
|
1217
|
+
return [
|
|
1218
|
+
{
|
|
1219
|
+
tag: "div[class=column]"
|
|
1220
|
+
}
|
|
1221
|
+
];
|
|
1222
|
+
},
|
|
1223
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1224
|
+
return ["div", it(this.options.HTMLAttributes, t), 0];
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
var te = /* @__PURE__ */ ((t) => (t[t.max = 7] = "max", t[t.min = 0] = "min", t[t.more = 1] = "more", t[t.less = -1] = "less", t))(te || {});
|
|
1228
|
+
function gc(t, e, r) {
|
|
1229
|
+
return t < e ? e : t > r ? r : t;
|
|
1230
|
+
}
|
|
1231
|
+
function pc(t, e, r, n) {
|
|
1232
|
+
const { doc: a, selection: c } = t;
|
|
1233
|
+
if (!a || !c || !(c instanceof bt || c instanceof Vi))
|
|
1234
|
+
return t;
|
|
1235
|
+
const { from: o, to: s } = c;
|
|
1236
|
+
return a.nodesBetween(o, s, (l, h) => {
|
|
1237
|
+
const d = l.type;
|
|
1238
|
+
return r.includes(d.name) ? (t = ee(t, h, e), !1) : !Mi(l.type.name, n.extensionManager.extensions);
|
|
1239
|
+
}), t;
|
|
1240
|
+
}
|
|
1241
|
+
function ee(t, e, r) {
|
|
1242
|
+
if (!t.doc)
|
|
1243
|
+
return t;
|
|
1244
|
+
const n = t.doc.nodeAt(e);
|
|
1245
|
+
if (!n)
|
|
1246
|
+
return t;
|
|
1247
|
+
const o = gc((n.attrs.indent || 0) + r, 0, 7);
|
|
1248
|
+
if (o === n.attrs.indent)
|
|
1249
|
+
return t;
|
|
1250
|
+
const s = {
|
|
1251
|
+
...n.attrs,
|
|
1252
|
+
indent: o
|
|
1253
|
+
};
|
|
1254
|
+
return t.setNodeMarkup(e, n.type, s, n.marks);
|
|
1255
|
+
}
|
|
1256
|
+
function fo({ delta: t, types: e }) {
|
|
1257
|
+
return ({ state: r, dispatch: n, editor: a }) => {
|
|
1258
|
+
const { selection: c } = r;
|
|
1259
|
+
let { tr: o } = r;
|
|
1260
|
+
return o = o.setSelection(c), o = pc(o, t, e, a), o.docChanged ? (n && n(o), !0) : !1;
|
|
1261
|
+
};
|
|
1262
|
+
}
|
|
1263
|
+
const jt = q.Root, Ft = q.Trigger, wc = q.Portal, mi = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
1264
|
+
q.Overlay,
|
|
1265
|
+
{
|
|
1266
|
+
ref: r,
|
|
1267
|
+
className: L(
|
|
1268
|
+
"richtext-fixed richtext-inset-0 richtext-z-50 richtext-bg-black/80 richtext- data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0",
|
|
1269
|
+
t
|
|
1270
|
+
),
|
|
1271
|
+
...e
|
|
1272
|
+
}
|
|
1273
|
+
));
|
|
1274
|
+
mi.displayName = q.Overlay.displayName;
|
|
1275
|
+
const Nt = E.forwardRef(({ className: t, children: e, ...r }, n) => /* @__PURE__ */ u(wc, { children: [
|
|
1276
|
+
/* @__PURE__ */ i(mi, {}),
|
|
1277
|
+
/* @__PURE__ */ u(
|
|
1278
|
+
q.Content,
|
|
1279
|
+
{
|
|
1280
|
+
ref: n,
|
|
1281
|
+
className: L(
|
|
1282
|
+
"richtext-dialog-content richtext-fixed richtext-left-[50%] richtext-top-[50%] richtext-z-50 richtext-grid richtext-w-full richtext-max-w-lg richtext-translate-x-[-50%] richtext-translate-y-[-50%] richtext-gap-4 richtext-border richtext-bg-background richtext-p-6 richtext-shadow-lg richtext-duration-200 data-[state=open]:richtext-animate-in data-[state=closed]:richtext-animate-out data-[state=closed]:richtext-fade-out-0 data-[state=open]:richtext-fade-in-0 data-[state=closed]:richtext-zoom-out-95 data-[state=open]:richtext-zoom-in-95 data-[state=closed]:richtext-slide-out-to-left-1/2 data-[state=closed]:richtext-slide-out-to-top-[48%] data-[state=open]:richtext-slide-in-from-left-1/2 data-[state=open]:richtext-slide-in-from-top-[48%] sm:richtext-rounded-lg",
|
|
1283
|
+
t
|
|
1284
|
+
),
|
|
1285
|
+
...r,
|
|
1286
|
+
children: [
|
|
1287
|
+
e,
|
|
1288
|
+
/* @__PURE__ */ u(q.Close, { className: "richtext-absolute richtext-right-4 richtext-top-4 richtext-rounded-sm richtext-opacity-70 richtext-ring-offset-background richtext-transition-opacity hover:richtext-opacity-100 focus:richtext-outline-none focus:richtext-ring-2 focus:richtext-ring-ring focus:richtext-ring-offset-2 disabled:richtext-pointer-events-none data-[state=open]:richtext-bg-accent data-[state=open]:richtext-text-muted-foreground", children: [
|
|
1289
|
+
/* @__PURE__ */ i(Fe, { className: "richtext-h-4 richtext-w-4" }),
|
|
1290
|
+
/* @__PURE__ */ i("span", { className: "richtext-sr-only", children: "Close" })
|
|
1291
|
+
] })
|
|
1292
|
+
]
|
|
1293
|
+
}
|
|
1294
|
+
)
|
|
1295
|
+
] }));
|
|
1296
|
+
Nt.displayName = q.Content.displayName;
|
|
1297
|
+
function fi({
|
|
1298
|
+
className: t,
|
|
1299
|
+
...e
|
|
1300
|
+
}) {
|
|
1301
|
+
return /* @__PURE__ */ i(
|
|
1302
|
+
"div",
|
|
1303
|
+
{
|
|
1304
|
+
className: L(
|
|
1305
|
+
"richtext-flex richtext-flex-col richtext-space-y-1.5 richtext-text-center sm:richtext-text-left",
|
|
1306
|
+
t
|
|
1307
|
+
),
|
|
1308
|
+
...e
|
|
1309
|
+
}
|
|
1310
|
+
);
|
|
1311
|
+
}
|
|
1312
|
+
fi.displayName = "DialogHeader";
|
|
1313
|
+
function Tt({
|
|
1314
|
+
className: t,
|
|
1315
|
+
...e
|
|
1316
|
+
}) {
|
|
1317
|
+
return /* @__PURE__ */ i(
|
|
1318
|
+
"div",
|
|
1319
|
+
{
|
|
1320
|
+
className: L(
|
|
1321
|
+
"richtext-flex richtext-flex-col-reverse sm:richtext-flex-row sm:richtext-justify-end sm:richtext-space-x-2",
|
|
1322
|
+
t
|
|
1323
|
+
),
|
|
1324
|
+
...e
|
|
1325
|
+
}
|
|
1326
|
+
);
|
|
1327
|
+
}
|
|
1328
|
+
Tt.displayName = "DialogFooter";
|
|
1329
|
+
const kt = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
1330
|
+
q.Title,
|
|
1331
|
+
{
|
|
1332
|
+
ref: r,
|
|
1333
|
+
className: L(
|
|
1334
|
+
"richtext-text-lg richtext-font-semibold richtext-leading-none richtext-tracking-tight",
|
|
1335
|
+
t
|
|
1336
|
+
),
|
|
1337
|
+
...e
|
|
1338
|
+
}
|
|
1339
|
+
));
|
|
1340
|
+
kt.displayName = q.Title.displayName;
|
|
1341
|
+
const vc = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
1342
|
+
q.Description,
|
|
1343
|
+
{
|
|
1344
|
+
ref: r,
|
|
1345
|
+
className: L("richtext-text-sm richtext-text-muted-foreground", t),
|
|
1346
|
+
...e
|
|
1347
|
+
}
|
|
1348
|
+
));
|
|
1349
|
+
vc.displayName = q.Description.displayName;
|
|
1350
|
+
function go(t) {
|
|
1351
|
+
return t.replace(/^.*\/|\..+$/g, "");
|
|
1352
|
+
}
|
|
1353
|
+
function po(t) {
|
|
1354
|
+
return t.split(".").pop();
|
|
1355
|
+
}
|
|
1356
|
+
function wo(t) {
|
|
1357
|
+
return t < 1024 ? `${t} Byte` : t < 1024 * 1024 ? `${(t / 1024).toFixed(2)} KB` : `${(t / 1024 / 1024).toFixed(2)} MB`;
|
|
1358
|
+
}
|
|
1359
|
+
function vo(t) {
|
|
1360
|
+
return t ? t === "application/pdf" ? "pdf" : t.startsWith("application/") && [".document", "word"].some((e) => t.includes(e)) ? "word" : t.startsWith("application/") && ["presentation"].some((e) => t.includes(e)) ? "excel" : t.startsWith("application/") && ["sheet"].some((e) => t.includes(e)) ? "ppt" : t.startsWith("image") ? "image" : t.startsWith("audio") ? "audio" : t.startsWith("video") ? "video" : "file" : "file";
|
|
1361
|
+
}
|
|
1362
|
+
function bo(t) {
|
|
1363
|
+
return new Promise((e) => {
|
|
1364
|
+
const r = new FileReader();
|
|
1365
|
+
r.addEventListener(
|
|
1366
|
+
"load",
|
|
1367
|
+
() => {
|
|
1368
|
+
e({
|
|
1369
|
+
alt: t.name,
|
|
1370
|
+
src: r.result
|
|
1371
|
+
});
|
|
1372
|
+
},
|
|
1373
|
+
!1
|
|
1374
|
+
), r.readAsDataURL(t);
|
|
1375
|
+
});
|
|
1376
|
+
}
|
|
1377
|
+
function gi(t, e) {
|
|
1378
|
+
const r = t.split(","), n = r[0].match(/:(.*?);/)[1], a = atob(r[r.length - 1]);
|
|
1379
|
+
let c = a.length;
|
|
1380
|
+
const o = new Uint8Array(c);
|
|
1381
|
+
for (; c--; )
|
|
1382
|
+
o[c] = a.charCodeAt(c);
|
|
1383
|
+
return new File([o], e, { type: n });
|
|
1384
|
+
}
|
|
1385
|
+
function bc(t) {
|
|
1386
|
+
try {
|
|
1387
|
+
return JSON.stringify(t);
|
|
1388
|
+
} catch {
|
|
1389
|
+
return JSON.stringify({});
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
function ht(t, e = !1) {
|
|
1393
|
+
return (r) => {
|
|
1394
|
+
const n = t.startsWith("data-") ? t : `data-${t}`;
|
|
1395
|
+
let a = decodeURIComponent(r.getAttribute(n));
|
|
1396
|
+
if (a == null || typeof a == "string" && a === "null")
|
|
1397
|
+
try {
|
|
1398
|
+
const s = r.outerHTML.match(/([\s\S])+?="([\s\S])+?"/g);
|
|
1399
|
+
s && s.length && (a = (s.map((h) => h.trim()).reduce((h, d) => {
|
|
1400
|
+
const x = d.indexOf("="), m = [d.slice(0, x), d.slice(x + 1).slice(1, -1)];
|
|
1401
|
+
return h[m[0]] = m[1], h;
|
|
1402
|
+
}, {})[t.toLowerCase()] || "").replaceAll(""", '"'));
|
|
1403
|
+
} catch (o) {
|
|
1404
|
+
console.error("Error getDatasetAttribute ", o.message, r);
|
|
1405
|
+
}
|
|
1406
|
+
if (e)
|
|
1407
|
+
try {
|
|
1408
|
+
return JSON.parse(a);
|
|
1409
|
+
} catch {
|
|
1410
|
+
return {};
|
|
1411
|
+
}
|
|
1412
|
+
if (a.includes("%") || a.includes("auto"))
|
|
1413
|
+
return a;
|
|
1414
|
+
const c = Number.parseInt(a);
|
|
1415
|
+
return c !== c ? a : c;
|
|
1416
|
+
};
|
|
1417
|
+
}
|
|
1418
|
+
function yc(t) {
|
|
1419
|
+
const { attrs: e } = t;
|
|
1420
|
+
return Object.keys(e).reduce((r, n) => {
|
|
1421
|
+
const a = e[n];
|
|
1422
|
+
if (a == null)
|
|
1423
|
+
return r;
|
|
1424
|
+
let c = "";
|
|
1425
|
+
return typeof a == "object" ? c = bc(a) : c = a, r[n] = c, r;
|
|
1426
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1427
|
+
}
|
|
1428
|
+
const Cc = "_wrap_5y04w_1", Nc = "_innerWrap_5y04w_15", Ne = {
|
|
1429
|
+
wrap: Cc,
|
|
1430
|
+
innerWrap: Nc
|
|
1431
|
+
};
|
|
1432
|
+
function Tc({ editor: t, node: e, updateAttributes: r }) {
|
|
1433
|
+
const n = gn(), { url: a, width: c, height: o } = e.attrs, [s, l] = w("");
|
|
1434
|
+
function h() {
|
|
1435
|
+
s && t.chain().updateAttributes(ot.name, {
|
|
1436
|
+
url: s
|
|
1437
|
+
}).setNodeSelection(t.state.selection.from).focus().run();
|
|
1438
|
+
}
|
|
1439
|
+
const d = C(
|
|
1440
|
+
(x) => {
|
|
1441
|
+
r({ width: x.width, height: x.height });
|
|
1442
|
+
},
|
|
1443
|
+
[r]
|
|
1444
|
+
);
|
|
1445
|
+
return /* @__PURE__ */ u(ut, { children: [
|
|
1446
|
+
!a && /* @__PURE__ */ u("div", { className: "richtext-max-w-[600px] richtext-mx-[auto] richtext-my-[12px] richtext-flex richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-p-[10px] richtext-border-[1px] richtext-border-solid richtext-border-[#ccc] richtext-rounded-[12px]", children: [
|
|
1447
|
+
/* @__PURE__ */ i(
|
|
1448
|
+
J,
|
|
1449
|
+
{
|
|
1450
|
+
value: s,
|
|
1451
|
+
onInput: (x) => l(x.target.value),
|
|
1452
|
+
type: "url",
|
|
1453
|
+
className: "richtext-flex-1",
|
|
1454
|
+
autoFocus: !0,
|
|
1455
|
+
placeholder: "Enter link"
|
|
1456
|
+
}
|
|
1457
|
+
),
|
|
1458
|
+
/* @__PURE__ */ i(U, { className: "richtext-w-[60px]", onClick: h, children: "OK" })
|
|
1459
|
+
] }),
|
|
1460
|
+
a && /* @__PURE__ */ i(
|
|
1461
|
+
Je,
|
|
1462
|
+
{
|
|
1463
|
+
size: { width: Number.parseInt(c), height: Number.parseInt(o) },
|
|
1464
|
+
onResizeStop: (x, m, f, p) => {
|
|
1465
|
+
d({
|
|
1466
|
+
width: Number.parseInt(c) + p.width,
|
|
1467
|
+
height: Number.parseInt(o) + p.height
|
|
1468
|
+
});
|
|
1469
|
+
},
|
|
1470
|
+
children: /* @__PURE__ */ i("div", { className: Pt(Ne.wrap, "render-wrapper"), children: /* @__PURE__ */ i("div", { className: Ne.innerWrap, style: { pointerEvents: n ? "none" : "auto" }, children: /* @__PURE__ */ i(
|
|
1471
|
+
"iframe",
|
|
1472
|
+
{
|
|
1473
|
+
src: a,
|
|
1474
|
+
className: "richtext-my-[12px] "
|
|
1475
|
+
}
|
|
1476
|
+
) }) })
|
|
1477
|
+
}
|
|
1478
|
+
)
|
|
1479
|
+
] });
|
|
1480
|
+
}
|
|
1481
|
+
const ot = dt.create({
|
|
1482
|
+
name: "iframe",
|
|
1483
|
+
content: "",
|
|
1484
|
+
marks: "",
|
|
1485
|
+
group: "block",
|
|
1486
|
+
selectable: !0,
|
|
1487
|
+
atom: !0,
|
|
1488
|
+
draggable: !0,
|
|
1489
|
+
addOptions() {
|
|
1490
|
+
var t;
|
|
1491
|
+
return {
|
|
1492
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
1493
|
+
HTMLAttributes: {
|
|
1494
|
+
class: "iframe"
|
|
1495
|
+
},
|
|
1496
|
+
button: ({
|
|
1497
|
+
editor: e,
|
|
1498
|
+
extension: r,
|
|
1499
|
+
t: n
|
|
1500
|
+
}) => ({
|
|
1501
|
+
component: v,
|
|
1502
|
+
componentProps: {
|
|
1503
|
+
action: (a) => e.commands.setIframe(a),
|
|
1504
|
+
upload: r.options.upload,
|
|
1505
|
+
disabled: !e.can().setIframe({}),
|
|
1506
|
+
icon: "Iframe",
|
|
1507
|
+
tooltip: n("editor.iframe.tooltip")
|
|
1508
|
+
}
|
|
1509
|
+
})
|
|
1510
|
+
};
|
|
1511
|
+
},
|
|
1512
|
+
addAttributes() {
|
|
1513
|
+
return {
|
|
1514
|
+
width: {
|
|
1515
|
+
default: 600,
|
|
1516
|
+
parseHTML: ht("width")
|
|
1517
|
+
},
|
|
1518
|
+
height: {
|
|
1519
|
+
default: 300,
|
|
1520
|
+
parseHTML: ht("height")
|
|
1521
|
+
},
|
|
1522
|
+
url: {
|
|
1523
|
+
default: null,
|
|
1524
|
+
parseHTML: ht("url")
|
|
1525
|
+
},
|
|
1526
|
+
defaultShowPicker: {
|
|
1527
|
+
default: !1
|
|
1528
|
+
},
|
|
1529
|
+
frameborder: {
|
|
1530
|
+
default: 0
|
|
1531
|
+
},
|
|
1532
|
+
allowfullscreen: {
|
|
1533
|
+
default: this.options.allowFullscreen,
|
|
1534
|
+
parseHTML: () => this.options.allowFullscreen
|
|
1535
|
+
}
|
|
1536
|
+
};
|
|
1537
|
+
},
|
|
1538
|
+
parseHTML() {
|
|
1539
|
+
return [
|
|
1540
|
+
{
|
|
1541
|
+
tag: "iframe"
|
|
1542
|
+
}
|
|
1543
|
+
];
|
|
1544
|
+
},
|
|
1545
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1546
|
+
return ["iframe", it(this.options.HTMLAttributes, t)];
|
|
1547
|
+
},
|
|
1548
|
+
addCommands() {
|
|
1549
|
+
return {
|
|
1550
|
+
setIframe: (t) => ({ tr: e, commands: r, chain: n }) => {
|
|
1551
|
+
var c, o, s;
|
|
1552
|
+
if (((s = (o = (c = e.selection) == null ? void 0 : c.node) == null ? void 0 : o.type) == null ? void 0 : s.name) == this.name)
|
|
1553
|
+
return r.updateAttributes(this.name, t);
|
|
1554
|
+
const a = t || { url: "" };
|
|
1555
|
+
return n().insertContent({
|
|
1556
|
+
type: this.name,
|
|
1557
|
+
attrs: a
|
|
1558
|
+
}).run();
|
|
1559
|
+
}
|
|
1560
|
+
};
|
|
1561
|
+
},
|
|
1562
|
+
addInputRules() {
|
|
1563
|
+
return [
|
|
1564
|
+
ce({
|
|
1565
|
+
find: /^\$iframe\$$/,
|
|
1566
|
+
type: this.type,
|
|
1567
|
+
getAttributes: () => ({ width: "100%" })
|
|
1568
|
+
})
|
|
1569
|
+
];
|
|
1570
|
+
},
|
|
1571
|
+
addNodeView() {
|
|
1572
|
+
return xt(Tc);
|
|
1573
|
+
}
|
|
1574
|
+
}), St = E.forwardRef(
|
|
1575
|
+
({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
1576
|
+
"textarea",
|
|
1577
|
+
{
|
|
1578
|
+
className: L(
|
|
1579
|
+
"richtext-flex richtext-min-h-[80px] richtext-w-full richtext-rounded-md !richtext-border richtext-border-input richtext-bg-background richtext-px-3 richtext-py-2 richtext-text-sm richtext-ring-offset-background placeholder:richtext-text-muted-foreground focus-visible:richtext-outline-none focus-visible:richtext-ring-2 focus-visible:richtext-ring-ring focus-visible:richtext-ring-offset-2 disabled:richtext-cursor-not-allowed disabled:richtext-opacity-50",
|
|
1580
|
+
t
|
|
1581
|
+
),
|
|
1582
|
+
ref: r,
|
|
1583
|
+
...e
|
|
1584
|
+
}
|
|
1585
|
+
)
|
|
1586
|
+
);
|
|
1587
|
+
St.displayName = "Textarea";
|
|
1588
|
+
function kc(t) {
|
|
1589
|
+
return t;
|
|
1590
|
+
}
|
|
1591
|
+
function At(t, e, r, n) {
|
|
1592
|
+
const a = kc, [c, o] = w(a(r)), s = nt(c);
|
|
1593
|
+
return I(() => {
|
|
1594
|
+
const l = () => {
|
|
1595
|
+
const h = { ...r, ...t.getAttributes(e) };
|
|
1596
|
+
Object.keys(h).forEach((x) => {
|
|
1597
|
+
(h[x] === null || h[x] === void 0) && (h[x] = r ? r[x] : null);
|
|
1598
|
+
});
|
|
1599
|
+
const d = a(h);
|
|
1600
|
+
We(s.current, d) || (o(d), s.current = d);
|
|
1601
|
+
};
|
|
1602
|
+
return t.on("selectionUpdate", l), t.on("transaction", l), () => {
|
|
1603
|
+
t.off("selectionUpdate", l), t.off("transaction", l);
|
|
1604
|
+
};
|
|
1605
|
+
}, [t, r, e, a]), c;
|
|
1606
|
+
}
|
|
1607
|
+
function Sc({ editor: t, ...e }) {
|
|
1608
|
+
const { t: r } = V(), n = At(t, lt.name, {
|
|
1609
|
+
text: "",
|
|
1610
|
+
defaultShowPicker: !1
|
|
1611
|
+
}), { text: a, defaultShowPicker: c } = n, [o, s] = w(""), l = C(() => {
|
|
1612
|
+
t.chain().focus().setKatex({ text: o }).run(), s("");
|
|
1613
|
+
}, [t, o]);
|
|
1614
|
+
I(() => {
|
|
1615
|
+
c && t.chain().updateAttributes(lt.name, { defaultShowPicker: !1 }).focus().run();
|
|
1616
|
+
}, [t, c]);
|
|
1617
|
+
const h = P(() => {
|
|
1618
|
+
try {
|
|
1619
|
+
return ae.renderToString(`${o}`);
|
|
1620
|
+
} catch {
|
|
1621
|
+
return o;
|
|
1622
|
+
}
|
|
1623
|
+
}, [o]), d = P(
|
|
1624
|
+
() => `${o}`.trim() ? /* @__PURE__ */ i("span", { contentEditable: !1, dangerouslySetInnerHTML: { __html: h || "" } }) : null,
|
|
1625
|
+
[o, h]
|
|
1626
|
+
);
|
|
1627
|
+
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
1628
|
+
/* @__PURE__ */ i(ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1629
|
+
v,
|
|
1630
|
+
{
|
|
1631
|
+
tooltip: e == null ? void 0 : e.tooltip,
|
|
1632
|
+
icon: e == null ? void 0 : e.icon
|
|
1633
|
+
}
|
|
1634
|
+
) }),
|
|
1635
|
+
/* @__PURE__ */ u(ct, { hideWhenDetached: !0, className: "richtext-w-full richtext-h-full richtext-p-2", align: "start", side: "bottom", children: [
|
|
1636
|
+
/* @__PURE__ */ i(et, { className: "richtext-mb-[6px]", children: r("editor.formula.dialog.text") }),
|
|
1637
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[16px]", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
1638
|
+
St,
|
|
1639
|
+
{
|
|
1640
|
+
value: o,
|
|
1641
|
+
onChange: (x) => s(x.target.value),
|
|
1642
|
+
autoFocus: !0,
|
|
1643
|
+
required: !0,
|
|
1644
|
+
rows: 3,
|
|
1645
|
+
defaultValue: a,
|
|
1646
|
+
className: "richtext-w-full",
|
|
1647
|
+
placeholder: "Text"
|
|
1648
|
+
}
|
|
1649
|
+
) }) }),
|
|
1650
|
+
d && /* @__PURE__ */ i("div", { className: "richtext-my-[10px] richtext-p-[10px] richtext-rounded-[6px] !richtext-border-[1px] richtext-max-w-[286px] richtext-whitespace-nowrap richtext-overflow-auto", children: d }),
|
|
1651
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]", children: [
|
|
1652
|
+
/* @__PURE__ */ i(U, { onClick: l, className: "richtext-flex-1", children: "Submit" }),
|
|
1653
|
+
/* @__PURE__ */ i("a", { href: "https://katex.org/docs/supported", target: "_blank", rel: "noreferrer noopener", children: /* @__PURE__ */ i(Ze, { size: 16 }) })
|
|
1654
|
+
] })
|
|
1655
|
+
] })
|
|
1656
|
+
] });
|
|
1657
|
+
}
|
|
1658
|
+
const pi = Be("light");
|
|
1659
|
+
function Ac() {
|
|
1660
|
+
return $e(pi);
|
|
1661
|
+
}
|
|
1662
|
+
const Mc = {
|
|
1663
|
+
setTheme: (t) => {
|
|
1664
|
+
pi(t);
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
function Lc(t, e = 1) {
|
|
1668
|
+
let r = 0, n = 0, a = 0;
|
|
1669
|
+
if (t.startsWith("rgb")) {
|
|
1670
|
+
const c = t.replace(/\s/g, "").match(/rgb\((.*)\)$/)[1].split(",");
|
|
1671
|
+
r = +c[0], n = +c[1], a = +c[2];
|
|
1672
|
+
} else if (t.startsWith("#")) {
|
|
1673
|
+
let c = t.replace("#", "");
|
|
1674
|
+
c.length === 3 && (c = `${c[0]}${c[0]}${c[1]}${c[1]}${c[2]}${c[2]}`), r = Number.parseInt(c.substring(0, 2), 16), n = Number.parseInt(c.substring(2, 4), 16), a = Number.parseInt(c.substring(4, 6), 16);
|
|
1675
|
+
} else
|
|
1676
|
+
return t;
|
|
1677
|
+
return e > 1 && e <= 100 && (e = e / 100), `rgba(${r},${n},${a},${e})`;
|
|
1678
|
+
}
|
|
1679
|
+
function Ic({ node: t }) {
|
|
1680
|
+
const e = Ac(), { text: r } = t.attrs, n = P(() => {
|
|
1681
|
+
const o = "rgb(254, 242, 237)";
|
|
1682
|
+
return e === "dark" ? Lc(o, 0.75) : o;
|
|
1683
|
+
}, [e]), a = P(() => {
|
|
1684
|
+
try {
|
|
1685
|
+
return ae.renderToString(`${r}`);
|
|
1686
|
+
} catch {
|
|
1687
|
+
return r;
|
|
1688
|
+
}
|
|
1689
|
+
}, [r]), c = P(
|
|
1690
|
+
() => r.trim() ? /* @__PURE__ */ i("span", { contentEditable: !1, dangerouslySetInnerHTML: { __html: a } }) : /* @__PURE__ */ i("span", { contentEditable: !1, children: "Not enter a formula" }),
|
|
1691
|
+
[r, a]
|
|
1692
|
+
);
|
|
1693
|
+
return /* @__PURE__ */ i(
|
|
1694
|
+
ut,
|
|
1695
|
+
{
|
|
1696
|
+
style: {
|
|
1697
|
+
display: "inline-block",
|
|
1698
|
+
backgroundColor: n
|
|
1699
|
+
},
|
|
1700
|
+
as: "span",
|
|
1701
|
+
children: c
|
|
1702
|
+
}
|
|
1703
|
+
);
|
|
1704
|
+
}
|
|
1705
|
+
function Ec(t) {
|
|
1706
|
+
return (e) => e.getAttribute(t);
|
|
1707
|
+
}
|
|
1708
|
+
const lt = dt.create({
|
|
1709
|
+
name: "katex",
|
|
1710
|
+
group: "inline",
|
|
1711
|
+
inline: !0,
|
|
1712
|
+
defining: !0,
|
|
1713
|
+
draggable: !0,
|
|
1714
|
+
selectable: !0,
|
|
1715
|
+
addOptions() {
|
|
1716
|
+
return {
|
|
1717
|
+
HTMLAttributes: {
|
|
1718
|
+
class: "katex"
|
|
1719
|
+
},
|
|
1720
|
+
button: ({ editor: t, t: e }) => ({
|
|
1721
|
+
component: Sc,
|
|
1722
|
+
componentProps: {
|
|
1723
|
+
editor: t,
|
|
1724
|
+
action: () => {
|
|
1725
|
+
},
|
|
1726
|
+
isActive: () => !1,
|
|
1727
|
+
disabled: !1,
|
|
1728
|
+
icon: "KatexIcon",
|
|
1729
|
+
tooltip: e("editor.katex.tooltip")
|
|
1730
|
+
}
|
|
1731
|
+
})
|
|
1732
|
+
};
|
|
1733
|
+
},
|
|
1734
|
+
addAttributes() {
|
|
1735
|
+
return {
|
|
1736
|
+
text: {
|
|
1737
|
+
default: "",
|
|
1738
|
+
parseHTML: Ec("text")
|
|
1739
|
+
},
|
|
1740
|
+
defaultShowPicker: {
|
|
1741
|
+
default: !1
|
|
1742
|
+
}
|
|
1743
|
+
};
|
|
1744
|
+
},
|
|
1745
|
+
parseHTML() {
|
|
1746
|
+
return [{ tag: "span.katex" }];
|
|
1747
|
+
},
|
|
1748
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
1749
|
+
return ["span", it(this.options && this.options.HTMLAttributes || {}, t)];
|
|
1750
|
+
},
|
|
1751
|
+
addCommands() {
|
|
1752
|
+
return {
|
|
1753
|
+
setKatex: (t) => ({ commands: e }) => e.insertContent({
|
|
1754
|
+
type: this.name,
|
|
1755
|
+
attrs: t
|
|
1756
|
+
})
|
|
1757
|
+
};
|
|
1758
|
+
},
|
|
1759
|
+
addInputRules() {
|
|
1760
|
+
return [
|
|
1761
|
+
ce({
|
|
1762
|
+
find: /^\$katex\$$/,
|
|
1763
|
+
type: this.type,
|
|
1764
|
+
getAttributes: () => ({ defaultShowPicker: !0 })
|
|
1765
|
+
})
|
|
1766
|
+
];
|
|
1767
|
+
},
|
|
1768
|
+
addNodeView() {
|
|
1769
|
+
return xt(Ic);
|
|
1770
|
+
}
|
|
1771
|
+
}), Rc = "_wrap_15k3c_1", zc = "_renderWrap_15k3c_7", Oc = "_title_15k3c_14", _c = "_handlerWrap_15k3c_30", gt = {
|
|
1772
|
+
wrap: Rc,
|
|
1773
|
+
renderWrap: zc,
|
|
1774
|
+
title: Oc,
|
|
1775
|
+
handlerWrap: _c
|
|
1776
|
+
}, Hc = 10, Pc = 200, Te = 15, ke = { width: "100%", height: "100%", maxWidth: "100%" };
|
|
1777
|
+
function Dc({ editor: t, node: e, updateAttributes: r }) {
|
|
1778
|
+
const n = nt(null), a = t.isActive(st.name), { data: c, width: o, height: s } = e.attrs, [l, h] = w(null), [d, x] = w(!0), [m, f] = w(null), [p, b] = w(!1), [T, k] = w(100), R = C(
|
|
1779
|
+
(M) => {
|
|
1780
|
+
M && b(!0);
|
|
1781
|
+
},
|
|
1782
|
+
[b]
|
|
1783
|
+
), $ = C((M) => () => {
|
|
1784
|
+
k(
|
|
1785
|
+
(B) => ti(M === "minus" ? B - Te : B + Te, Hc, Pc)
|
|
1786
|
+
);
|
|
1787
|
+
}, []);
|
|
1788
|
+
I(() => {
|
|
1789
|
+
let M = !1;
|
|
1790
|
+
return import("@excalidraw/excalidraw").then((B) => {
|
|
1791
|
+
M || (n.current = B.exportToSvg);
|
|
1792
|
+
}).catch((B) => !M && f(B)).finally(() => !M && x(!1)), () => {
|
|
1793
|
+
M = !0;
|
|
1794
|
+
};
|
|
1795
|
+
}, [x, c]), I(() => {
|
|
1796
|
+
let M = !1;
|
|
1797
|
+
return (async () => {
|
|
1798
|
+
if (M || d || m || !p || !c)
|
|
1799
|
+
return;
|
|
1800
|
+
const W = await n.current(c);
|
|
1801
|
+
M || (W.setAttribute("width", "100%"), W.setAttribute("height", "100%"), W.setAttribute("display", "block"), h(W));
|
|
1802
|
+
})(), () => {
|
|
1803
|
+
M = !0;
|
|
1804
|
+
};
|
|
1805
|
+
}, [c, d, m, p]);
|
|
1806
|
+
const F = (M) => {
|
|
1807
|
+
r({ width: M.width, height: M.height });
|
|
1808
|
+
};
|
|
1809
|
+
return /* @__PURE__ */ i(ut, { className: Pt(gt.wrap, a && gt.isActive), children: /* @__PURE__ */ i(Wi, { onChange: R, children: /* @__PURE__ */ i(
|
|
1810
|
+
Je,
|
|
1811
|
+
{
|
|
1812
|
+
size: { width: Number.parseInt(o), height: Number.parseInt(s) },
|
|
1813
|
+
onResizeStop: (M, B, W, N) => {
|
|
1814
|
+
F({
|
|
1815
|
+
width: Number.parseInt(o) + N.width,
|
|
1816
|
+
height: Number.parseInt(s) + N.height
|
|
1817
|
+
});
|
|
1818
|
+
},
|
|
1819
|
+
children: /* @__PURE__ */ u(
|
|
1820
|
+
"div",
|
|
1821
|
+
{
|
|
1822
|
+
className: Pt(gt.renderWrap, "render-wrapper"),
|
|
1823
|
+
style: { ...ke, overflow: "hidden" },
|
|
1824
|
+
children: [
|
|
1825
|
+
m && /* @__PURE__ */ i("div", { style: ke, children: /* @__PURE__ */ i("p", { children: m.message || m }) }),
|
|
1826
|
+
d && /* @__PURE__ */ i("p", { children: "Loading..." }),
|
|
1827
|
+
!d && !m && p && /* @__PURE__ */ i(
|
|
1828
|
+
"div",
|
|
1829
|
+
{
|
|
1830
|
+
style: {
|
|
1831
|
+
height: "100%",
|
|
1832
|
+
maxHeight: "100%",
|
|
1833
|
+
padding: 24,
|
|
1834
|
+
overflow: "hidden",
|
|
1835
|
+
display: "flex",
|
|
1836
|
+
justifyContent: "center",
|
|
1837
|
+
alignItems: "center",
|
|
1838
|
+
transform: `scale(${T / 100})`,
|
|
1839
|
+
transition: "all ease-in-out .3s"
|
|
1840
|
+
},
|
|
1841
|
+
dangerouslySetInnerHTML: { __html: (l == null ? void 0 : l.outerHTML) ?? "" }
|
|
1842
|
+
}
|
|
1843
|
+
),
|
|
1844
|
+
/* @__PURE__ */ i("div", { className: gt.title }),
|
|
1845
|
+
/* @__PURE__ */ u("div", { className: gt.handlerWrap, children: [
|
|
1846
|
+
/* @__PURE__ */ i(
|
|
1847
|
+
v,
|
|
1848
|
+
{
|
|
1849
|
+
icon: "ZoomOut",
|
|
1850
|
+
action: $("minus"),
|
|
1851
|
+
tooltip: "Zoom Out"
|
|
1852
|
+
}
|
|
1853
|
+
),
|
|
1854
|
+
/* @__PURE__ */ i(
|
|
1855
|
+
v,
|
|
1856
|
+
{
|
|
1857
|
+
icon: "ZoomIn",
|
|
1858
|
+
action: $("plus"),
|
|
1859
|
+
tooltip: "Zoom In"
|
|
1860
|
+
}
|
|
1861
|
+
)
|
|
1862
|
+
] })
|
|
1863
|
+
]
|
|
1864
|
+
}
|
|
1865
|
+
)
|
|
1866
|
+
}
|
|
1867
|
+
) }) });
|
|
1868
|
+
}
|
|
1869
|
+
const Bc = Oe.memo(Dc, (t, e) => !!We(t.node.attrs, e.node.attrs));
|
|
1870
|
+
let qt;
|
|
1871
|
+
function se() {
|
|
1872
|
+
try {
|
|
1873
|
+
return qt || (qt = _i()), qt;
|
|
1874
|
+
} catch {
|
|
1875
|
+
throw new Error("Error EventEmitter");
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
const ie = "OPEN_EXCALIDRAW_SETTING_MODAL";
|
|
1879
|
+
function $c(t, e) {
|
|
1880
|
+
se().on(t, e);
|
|
1881
|
+
}
|
|
1882
|
+
function Vc(t, e) {
|
|
1883
|
+
se().off(t, e);
|
|
1884
|
+
}
|
|
1885
|
+
function Wc(t) {
|
|
1886
|
+
se().emit(ie, t);
|
|
1887
|
+
}
|
|
1888
|
+
const jc = ({ editor: t }) => {
|
|
1889
|
+
const [e, r] = w(null), [n, a] = w({}), [c, o] = w({ elements: [], appState: { isLoading: !1 }, files: null }), [s, l] = w(!1), [h, d] = w(!0), [x, m] = w(null), f = C(
|
|
1890
|
+
(k) => {
|
|
1891
|
+
k && import("@excalidraw/excalidraw").then((R) => {
|
|
1892
|
+
r(R.Excalidraw);
|
|
1893
|
+
}).catch(m).finally(() => d(!1));
|
|
1894
|
+
},
|
|
1895
|
+
[d]
|
|
1896
|
+
), p = C((k) => {
|
|
1897
|
+
setTimeout(() => {
|
|
1898
|
+
k.refresh();
|
|
1899
|
+
});
|
|
1900
|
+
}, []), b = C((k, R, $) => {
|
|
1901
|
+
a({
|
|
1902
|
+
elements: k,
|
|
1903
|
+
appState: { isLoading: !1 },
|
|
1904
|
+
files: $
|
|
1905
|
+
});
|
|
1906
|
+
}, []), T = C(() => {
|
|
1907
|
+
if (!e) {
|
|
1908
|
+
l(!1);
|
|
1909
|
+
return;
|
|
1910
|
+
}
|
|
1911
|
+
t.chain().focus().setExcalidraw({ data: n }).run(), l(!1);
|
|
1912
|
+
}, [e, t, n, l]);
|
|
1913
|
+
return I(() => {
|
|
1914
|
+
const k = (R) => {
|
|
1915
|
+
l(!0), R && o(R.data);
|
|
1916
|
+
};
|
|
1917
|
+
return $c(ie, k), () => {
|
|
1918
|
+
Vc(ie, k);
|
|
1919
|
+
};
|
|
1920
|
+
}, [t, l]), /* @__PURE__ */ u(
|
|
1921
|
+
jt,
|
|
1922
|
+
{
|
|
1923
|
+
open: s,
|
|
1924
|
+
onOpenChange: l,
|
|
1925
|
+
children: [
|
|
1926
|
+
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1927
|
+
v,
|
|
1928
|
+
{
|
|
1929
|
+
icon: "Excalidraw",
|
|
1930
|
+
tooltip: "Excalidraw",
|
|
1931
|
+
action: () => l(!0)
|
|
1932
|
+
}
|
|
1933
|
+
) }),
|
|
1934
|
+
/* @__PURE__ */ u(Nt, { className: "!richtext-max-w-[1300px] richtext-z-[99999]", children: [
|
|
1935
|
+
/* @__PURE__ */ i(kt, { children: "Excalidraw" }),
|
|
1936
|
+
/* @__PURE__ */ u("div", { style: { height: "100%", borderWidth: 1 }, children: [
|
|
1937
|
+
h && /* @__PURE__ */ i("p", { children: "Loading..." }),
|
|
1938
|
+
x && /* @__PURE__ */ i("p", { children: x && x.message || "Error" }),
|
|
1939
|
+
/* @__PURE__ */ i("div", { style: { width: "100%", height: 600 }, ref: f, children: !h && !x && e ? /* @__PURE__ */ i(e, { ref: p, onChange: b, langCode: "en", initialData: c }) : null })
|
|
1940
|
+
] }),
|
|
1941
|
+
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
1942
|
+
U,
|
|
1943
|
+
{
|
|
1944
|
+
type: "button",
|
|
1945
|
+
onClick: T,
|
|
1946
|
+
children: "Save changes"
|
|
1947
|
+
}
|
|
1948
|
+
) })
|
|
1949
|
+
] })
|
|
1950
|
+
]
|
|
1951
|
+
}
|
|
1952
|
+
);
|
|
1953
|
+
}, Se = { elements: [] }, st = dt.create({
|
|
1954
|
+
name: "excalidraw",
|
|
1955
|
+
group: "block",
|
|
1956
|
+
selectable: !0,
|
|
1957
|
+
atom: !0,
|
|
1958
|
+
draggable: !0,
|
|
1959
|
+
inline: !1,
|
|
1960
|
+
addAttributes() {
|
|
1961
|
+
return {
|
|
1962
|
+
defaultShowPicker: {
|
|
1963
|
+
default: !1
|
|
1964
|
+
},
|
|
1965
|
+
createUser: {
|
|
1966
|
+
default: null
|
|
1967
|
+
},
|
|
1968
|
+
width: {
|
|
1969
|
+
default: "100%",
|
|
1970
|
+
parseHTML: ht("width")
|
|
1971
|
+
},
|
|
1972
|
+
height: {
|
|
1973
|
+
default: 240,
|
|
1974
|
+
parseHTML: ht("height")
|
|
1975
|
+
},
|
|
1976
|
+
data: {
|
|
1977
|
+
default: Se,
|
|
1978
|
+
parseHTML: ht("data", !0)
|
|
1979
|
+
}
|
|
1980
|
+
};
|
|
1981
|
+
},
|
|
1982
|
+
addOptions() {
|
|
1983
|
+
var t;
|
|
1984
|
+
return {
|
|
1985
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
1986
|
+
HTMLAttributes: {
|
|
1987
|
+
class: "excalidraw"
|
|
1988
|
+
},
|
|
1989
|
+
button: ({ editor: e }) => ({
|
|
1990
|
+
component: jc,
|
|
1991
|
+
componentProps: {
|
|
1992
|
+
editor: e
|
|
1993
|
+
}
|
|
1994
|
+
})
|
|
1995
|
+
};
|
|
1996
|
+
},
|
|
1997
|
+
parseHTML() {
|
|
1998
|
+
return [
|
|
1999
|
+
{
|
|
2000
|
+
tag: "div[class=excalidraw]"
|
|
2001
|
+
}
|
|
2002
|
+
];
|
|
2003
|
+
},
|
|
2004
|
+
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
2005
|
+
return ["div", it(this.options.HTMLAttributes, t, yc(e))];
|
|
2006
|
+
},
|
|
2007
|
+
addCommands() {
|
|
2008
|
+
return {
|
|
2009
|
+
setExcalidraw: (t) => ({ tr: e, commands: r, chain: n }) => {
|
|
2010
|
+
var a, c, o;
|
|
2011
|
+
return t = t || {}, t.data = t.data || Se, ((o = (c = (a = e.selection) == null ? void 0 : a.node) == null ? void 0 : c.type) == null ? void 0 : o.name) == this.name ? r.updateAttributes(this.name, t) : n().insertContent({
|
|
2012
|
+
type: this.name,
|
|
2013
|
+
attrs: t
|
|
2014
|
+
}).run();
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
},
|
|
2018
|
+
addNodeView() {
|
|
2019
|
+
return xt(Bc);
|
|
2020
|
+
},
|
|
2021
|
+
addInputRules() {
|
|
2022
|
+
return [
|
|
2023
|
+
ce({
|
|
2024
|
+
find: /^\$excalidraw\$$/,
|
|
2025
|
+
type: this.type,
|
|
2026
|
+
getAttributes: () => ({ width: "100%" })
|
|
2027
|
+
})
|
|
2028
|
+
];
|
|
2029
|
+
}
|
|
2030
|
+
}), Lt = {
|
|
2031
|
+
TOP_LEFT: "tl",
|
|
2032
|
+
TOP_RIGHT: "tr",
|
|
2033
|
+
BOTTOM_LEFT: "bl",
|
|
2034
|
+
BOTTOM_RIGHT: "br"
|
|
2035
|
+
};
|
|
2036
|
+
function Fc(t) {
|
|
2037
|
+
var B, W;
|
|
2038
|
+
const [e, r] = w({
|
|
2039
|
+
width: Ot,
|
|
2040
|
+
height: Ot
|
|
2041
|
+
}), [n, a] = w({
|
|
2042
|
+
width: 0,
|
|
2043
|
+
height: 0
|
|
2044
|
+
}), [c] = w([
|
|
2045
|
+
Lt.TOP_LEFT,
|
|
2046
|
+
Lt.TOP_RIGHT,
|
|
2047
|
+
Lt.BOTTOM_LEFT,
|
|
2048
|
+
Lt.BOTTOM_RIGHT
|
|
2049
|
+
]), [o, s] = w(!1), [l, h] = w({
|
|
2050
|
+
x: 0,
|
|
2051
|
+
y: 0,
|
|
2052
|
+
w: 0,
|
|
2053
|
+
h: 0,
|
|
2054
|
+
dir: ""
|
|
2055
|
+
}), { align: d } = (B = t == null ? void 0 : t.node) == null ? void 0 : B.attrs, x = P(() => {
|
|
2056
|
+
var z;
|
|
2057
|
+
const { src: N, alt: H, width: y, height: g } = (z = t == null ? void 0 : t.node) == null ? void 0 : z.attrs, O = ge(y) ? `${y}px` : y, S = ge(g) ? `${g}px` : g;
|
|
2058
|
+
return {
|
|
2059
|
+
src: N || void 0,
|
|
2060
|
+
alt: H || void 0,
|
|
2061
|
+
style: {
|
|
2062
|
+
width: O || void 0,
|
|
2063
|
+
height: S || void 0
|
|
2064
|
+
}
|
|
2065
|
+
};
|
|
2066
|
+
}, [(W = t == null ? void 0 : t.node) == null ? void 0 : W.attrs]), m = P(() => {
|
|
2067
|
+
const {
|
|
2068
|
+
style: { width: N }
|
|
2069
|
+
} = x;
|
|
2070
|
+
return { width: N === "100%" ? N : void 0 };
|
|
2071
|
+
}, [x]);
|
|
2072
|
+
function f(N) {
|
|
2073
|
+
a({
|
|
2074
|
+
width: N.target.width,
|
|
2075
|
+
height: N.target.height
|
|
2076
|
+
});
|
|
2077
|
+
}
|
|
2078
|
+
function p() {
|
|
2079
|
+
const { editor: N, getPos: H } = t;
|
|
2080
|
+
N.commands.setNodeSelection(H());
|
|
2081
|
+
}
|
|
2082
|
+
const b = C(
|
|
2083
|
+
wt(() => {
|
|
2084
|
+
const { editor: N } = t, { width: H } = getComputedStyle(N.view.dom);
|
|
2085
|
+
r((y) => ({
|
|
2086
|
+
...y,
|
|
2087
|
+
width: Number.parseInt(H, 10)
|
|
2088
|
+
}));
|
|
2089
|
+
}, _t),
|
|
2090
|
+
[t == null ? void 0 : t.editor]
|
|
2091
|
+
);
|
|
2092
|
+
function T(N, H) {
|
|
2093
|
+
N.preventDefault(), N.stopPropagation();
|
|
2094
|
+
const y = n.width, g = n.height, O = y / g;
|
|
2095
|
+
let S = Number(t.node.attrs.width), z = Number(t.node.attrs.height);
|
|
2096
|
+
const A = e.width;
|
|
2097
|
+
S && !z ? (S = S > A ? A : S, z = Math.round(S / O)) : z && !S ? (S = Math.round(z * O), S = S > A ? A : S) : !S && !z ? (S = y > A ? A : y, z = Math.round(S / O)) : S = S > A ? A : S, Bt(() => {
|
|
2098
|
+
s(!0), h({
|
|
2099
|
+
x: N.clientX,
|
|
2100
|
+
y: N.clientY,
|
|
2101
|
+
w: S,
|
|
2102
|
+
h: z,
|
|
2103
|
+
dir: H
|
|
2104
|
+
});
|
|
2105
|
+
});
|
|
2106
|
+
}
|
|
2107
|
+
const k = C(
|
|
2108
|
+
wt((N) => {
|
|
2109
|
+
if (N.preventDefault(), N.stopPropagation(), !o)
|
|
2110
|
+
return;
|
|
2111
|
+
const { x: H, w: y, dir: g } = l, O = (N.clientX - H) * (/l/.test(g) ? -1 : 1), S = ji(y + O, Pe, e.width);
|
|
2112
|
+
t.updateAttributes({
|
|
2113
|
+
width: S,
|
|
2114
|
+
height: null
|
|
2115
|
+
});
|
|
2116
|
+
}, _t),
|
|
2117
|
+
[o, l, e, t.updateAttributes]
|
|
2118
|
+
), R = C(
|
|
2119
|
+
(N) => {
|
|
2120
|
+
N.preventDefault(), N.stopPropagation(), o && (Bt(() => {
|
|
2121
|
+
h({
|
|
2122
|
+
x: 0,
|
|
2123
|
+
y: 0,
|
|
2124
|
+
w: 0,
|
|
2125
|
+
h: 0,
|
|
2126
|
+
dir: ""
|
|
2127
|
+
}), s(!1);
|
|
2128
|
+
}), p());
|
|
2129
|
+
},
|
|
2130
|
+
[o, p]
|
|
2131
|
+
), $ = C(() => {
|
|
2132
|
+
document == null || document.addEventListener("mousemove", k, !0), document == null || document.addEventListener("mouseup", R, !0);
|
|
2133
|
+
}, [k, R]), F = C(() => {
|
|
2134
|
+
document == null || document.removeEventListener("mousemove", k, !0), document == null || document.removeEventListener("mouseup", R, !0);
|
|
2135
|
+
}, [k, R]);
|
|
2136
|
+
I(() => (o ? $() : F(), () => {
|
|
2137
|
+
F();
|
|
2138
|
+
}), [o, $, F]);
|
|
2139
|
+
const M = P(() => new ResizeObserver(() => b()), [b]);
|
|
2140
|
+
return I(() => (M.observe(t.editor.view.dom), () => {
|
|
2141
|
+
M.disconnect();
|
|
2142
|
+
}), [t.editor.view.dom, M]), /* @__PURE__ */ i(ut, { className: "image-view", style: { ...m, width: "100%", textAlign: d }, children: /* @__PURE__ */ u(
|
|
2143
|
+
"div",
|
|
2144
|
+
{
|
|
2145
|
+
draggable: "true",
|
|
2146
|
+
"data-drag-handle": !0,
|
|
2147
|
+
className: `image-view__body ${t != null && t.selected ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
|
|
2148
|
+
style: m,
|
|
2149
|
+
children: [
|
|
2150
|
+
/* @__PURE__ */ i(
|
|
2151
|
+
"img",
|
|
2152
|
+
{
|
|
2153
|
+
src: x.src,
|
|
2154
|
+
alt: x.alt,
|
|
2155
|
+
style: x.style,
|
|
2156
|
+
height: "auto",
|
|
2157
|
+
className: "image-view__body__image block",
|
|
2158
|
+
onLoad: f,
|
|
2159
|
+
onClick: p
|
|
2160
|
+
}
|
|
2161
|
+
),
|
|
2162
|
+
(t == null ? void 0 : t.editor.view.editable) && ((t == null ? void 0 : t.selected) || o) && /* @__PURE__ */ i("div", { className: "image-resizer", children: c == null ? void 0 : c.map((N) => /* @__PURE__ */ i(
|
|
2163
|
+
"span",
|
|
2164
|
+
{
|
|
2165
|
+
className: `image-resizer__handler image-resizer__handler--${N}`,
|
|
2166
|
+
onMouseDown: (H) => T(H, N)
|
|
2167
|
+
},
|
|
2168
|
+
`image-dir-${N}`
|
|
2169
|
+
)) })
|
|
2170
|
+
]
|
|
2171
|
+
}
|
|
2172
|
+
) });
|
|
2173
|
+
}
|
|
2174
|
+
function Gc({ selectImage: t, giphyApiKey: e, children: r }) {
|
|
2175
|
+
const [n, a] = w([]), [c] = w(15), o = nt(null), s = (h, d = "search") => {
|
|
2176
|
+
if (!e)
|
|
2177
|
+
return;
|
|
2178
|
+
const m = `${d === "search" ? `https://api.giphy.com/v1/gifs/search?q=${h}` : `https://api.giphy.com/v1/gifs/trending?q=${h}`}&limit=${c}&api_key=${e}`;
|
|
2179
|
+
fetch(m).then((f) => f.json()).then((f) => {
|
|
2180
|
+
a(f.data);
|
|
2181
|
+
}).catch((f) => {
|
|
2182
|
+
console.log(f);
|
|
2183
|
+
});
|
|
2184
|
+
};
|
|
2185
|
+
I(() => {
|
|
2186
|
+
s("", "trend");
|
|
2187
|
+
}, []);
|
|
2188
|
+
const l = C(
|
|
2189
|
+
Ve((h) => {
|
|
2190
|
+
if (!h.target.value) {
|
|
2191
|
+
s("", "trend");
|
|
2192
|
+
return;
|
|
2193
|
+
}
|
|
2194
|
+
s(h.target.value);
|
|
2195
|
+
}, 350),
|
|
2196
|
+
// Adjust the debounce delay as needed
|
|
2197
|
+
[]
|
|
2198
|
+
);
|
|
2199
|
+
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
2200
|
+
/* @__PURE__ */ i(ft, { asChild: !0, children: r }),
|
|
2201
|
+
/* @__PURE__ */ i(ct, { hideWhenDetached: !0, className: "richtext-w-full richtext-h-full richtext-p-2", align: "start", side: "bottom", children: e ? /* @__PURE__ */ u(_, { children: [
|
|
2202
|
+
/* @__PURE__ */ i("div", { className: "richtext-w-full richtext-mb-[10px]", children: /* @__PURE__ */ i(
|
|
2203
|
+
J,
|
|
2204
|
+
{
|
|
2205
|
+
ref: o,
|
|
2206
|
+
type: "text",
|
|
2207
|
+
placeholder: "Search GIF",
|
|
2208
|
+
onChange: l
|
|
2209
|
+
}
|
|
2210
|
+
) }),
|
|
2211
|
+
/* @__PURE__ */ i("div", { className: "richtext-max-h-[280px] richtext-overflow-y-auto", children: /* @__PURE__ */ i("div", { className: "richtext-grid richtext-grid-cols-2 richtext-gap-1 ", children: n != null && n.length ? n == null ? void 0 : n.map((h) => /* @__PURE__ */ i(
|
|
2212
|
+
"img",
|
|
2213
|
+
{
|
|
2214
|
+
alt: "giphy",
|
|
2215
|
+
className: "richtext-text-center richtext-cursor-pointer",
|
|
2216
|
+
onClick: (d) => t(h),
|
|
2217
|
+
height: h.images.fixed_width_downsampled.height,
|
|
2218
|
+
width: h.images.fixed_width_downsampled.width,
|
|
2219
|
+
src: h.images.fixed_width_downsampled.url
|
|
2220
|
+
},
|
|
2221
|
+
`giphy-${h.id}`
|
|
2222
|
+
)) : /* @__PURE__ */ i("p", { children: "No GIFs found" }) }) })
|
|
2223
|
+
] }) : /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("p", { children: "Missing Giphy API Key" }) }) })
|
|
2224
|
+
] });
|
|
2225
|
+
}
|
|
2226
|
+
function Uc({ editor: t, icon: e, giphyApiKey: r, ...n }) {
|
|
2227
|
+
return /* @__PURE__ */ i(
|
|
2228
|
+
Gc,
|
|
2229
|
+
{
|
|
2230
|
+
selectImage: (c) => {
|
|
2231
|
+
const { url: o } = c.images.original;
|
|
2232
|
+
t.chain().focus().setImageGif({ src: o }).run();
|
|
2233
|
+
},
|
|
2234
|
+
giphyApiKey: r,
|
|
2235
|
+
children: /* @__PURE__ */ i(
|
|
2236
|
+
v,
|
|
2237
|
+
{
|
|
2238
|
+
tooltip: n == null ? void 0 : n.tooltip,
|
|
2239
|
+
icon: e
|
|
2240
|
+
}
|
|
2241
|
+
)
|
|
2242
|
+
}
|
|
2243
|
+
);
|
|
2244
|
+
}
|
|
2245
|
+
const wi = He.extend({
|
|
2246
|
+
name: "imageGif",
|
|
2247
|
+
addOptions() {
|
|
2248
|
+
var t;
|
|
2249
|
+
return {
|
|
2250
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
2251
|
+
inline: !1,
|
|
2252
|
+
content: "",
|
|
2253
|
+
marks: "",
|
|
2254
|
+
group: "block",
|
|
2255
|
+
GIPHY_API_KEY: "",
|
|
2256
|
+
draggable: !1,
|
|
2257
|
+
selectable: !0,
|
|
2258
|
+
atom: !0,
|
|
2259
|
+
button: ({ editor: e, extension: r, t: n }) => {
|
|
2260
|
+
var c;
|
|
2261
|
+
const a = ((c = r == null ? void 0 : r.options) == null ? void 0 : c.GIPHY_API_KEY) || "";
|
|
2262
|
+
return {
|
|
2263
|
+
component: Uc,
|
|
2264
|
+
componentProps: {
|
|
2265
|
+
editor: e,
|
|
2266
|
+
action: () => {
|
|
2267
|
+
},
|
|
2268
|
+
isActive: () => !1,
|
|
2269
|
+
disabled: !1,
|
|
2270
|
+
icon: "GifIcon",
|
|
2271
|
+
tooltip: n("editor.imageGif.tooltip"),
|
|
2272
|
+
giphyApiKey: a
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
},
|
|
2278
|
+
addAttributes() {
|
|
2279
|
+
var t;
|
|
2280
|
+
return {
|
|
2281
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
2282
|
+
width: {
|
|
2283
|
+
default: null,
|
|
2284
|
+
parseHTML: (e) => {
|
|
2285
|
+
const r = e.style.width || e.getAttribute("width") || "10";
|
|
2286
|
+
return r === void 0 ? null : Number.parseInt(`${r}`, 10);
|
|
2287
|
+
},
|
|
2288
|
+
renderHTML: (e) => ({
|
|
2289
|
+
width: e.width
|
|
2290
|
+
})
|
|
2291
|
+
},
|
|
2292
|
+
align: {
|
|
2293
|
+
default: "center",
|
|
2294
|
+
parseHTML: (e) => e.getAttribute("align"),
|
|
2295
|
+
renderHTML: (e) => ({
|
|
2296
|
+
align: e.align
|
|
2297
|
+
})
|
|
2298
|
+
}
|
|
2299
|
+
};
|
|
2300
|
+
},
|
|
2301
|
+
addNodeView() {
|
|
2302
|
+
return xt(Fc);
|
|
2303
|
+
},
|
|
2304
|
+
addCommands() {
|
|
2305
|
+
var t;
|
|
2306
|
+
return {
|
|
2307
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
2308
|
+
setImageGif: (e) => ({ commands: r }) => r.insertContent({
|
|
2309
|
+
type: this.name,
|
|
2310
|
+
attrs: e
|
|
2311
|
+
}),
|
|
2312
|
+
updateImageGif: (e) => ({ commands: r }) => r.updateAttributes(this.name, e),
|
|
2313
|
+
setAlignImageGif: (e) => ({ commands: r }) => r.updateAttributes(this.name, { align: e })
|
|
2314
|
+
};
|
|
2315
|
+
},
|
|
2316
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
2317
|
+
const { align: e } = t;
|
|
2318
|
+
return [
|
|
2319
|
+
"div",
|
|
2320
|
+
// Parent element
|
|
2321
|
+
{
|
|
2322
|
+
style: e ? `text-align: ${e};` : "",
|
|
2323
|
+
class: "imageGIf"
|
|
2324
|
+
},
|
|
2325
|
+
[
|
|
2326
|
+
"img",
|
|
2327
|
+
it(
|
|
2328
|
+
// Always render the `height="auto"`
|
|
2329
|
+
{
|
|
2330
|
+
height: "auto"
|
|
2331
|
+
},
|
|
2332
|
+
this.options.HTMLAttributes,
|
|
2333
|
+
t
|
|
2334
|
+
)
|
|
2335
|
+
]
|
|
2336
|
+
];
|
|
2337
|
+
},
|
|
2338
|
+
parseHTML() {
|
|
2339
|
+
return [
|
|
2340
|
+
{
|
|
2341
|
+
tag: "div[class=imageGIf]",
|
|
2342
|
+
getAttrs: (t) => {
|
|
2343
|
+
const e = t.querySelector("img"), r = e == null ? void 0 : e.getAttribute("width");
|
|
2344
|
+
return {
|
|
2345
|
+
src: e == null ? void 0 : e.getAttribute("src"),
|
|
2346
|
+
alt: e == null ? void 0 : e.getAttribute("alt"),
|
|
2347
|
+
title: e == null ? void 0 : e.getAttribute("title"),
|
|
2348
|
+
width: r ? Number.parseInt(r, 10) : null,
|
|
2349
|
+
align: (e == null ? void 0 : e.getAttribute("align")) || t.style.textAlign || null
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
];
|
|
2354
|
+
}
|
|
2355
|
+
});
|
|
2356
|
+
function vi(t = 8) {
|
|
2357
|
+
return Math.random().toString(36).substring(2, t + 2);
|
|
2358
|
+
}
|
|
2359
|
+
const Ae = `graph TB
|
|
2360
|
+
a-->b`, Kc = ({ editor: t, upload: e }) => {
|
|
2361
|
+
const [r, n] = w(Ae), [a, c] = w(""), [o, s] = w(!1), l = nt(null), h = async (m) => {
|
|
2362
|
+
try {
|
|
2363
|
+
const { svg: f } = await Dt.render("mermaid-svg", m);
|
|
2364
|
+
c(f);
|
|
2365
|
+
} catch {
|
|
2366
|
+
c("");
|
|
2367
|
+
}
|
|
2368
|
+
}, d = () => {
|
|
2369
|
+
Dt.initialize({
|
|
2370
|
+
darkMode: !1,
|
|
2371
|
+
startOnLoad: !1,
|
|
2372
|
+
// fontFamily:'',
|
|
2373
|
+
fontSize: 12,
|
|
2374
|
+
theme: "base"
|
|
2375
|
+
}), h(r);
|
|
2376
|
+
};
|
|
2377
|
+
return I(() => {
|
|
2378
|
+
o && d();
|
|
2379
|
+
}, [o]), I(() => {
|
|
2380
|
+
o && h(r);
|
|
2381
|
+
}, [r]), /* @__PURE__ */ u(
|
|
2382
|
+
jt,
|
|
2383
|
+
{
|
|
2384
|
+
open: o,
|
|
2385
|
+
onOpenChange: s,
|
|
2386
|
+
children: [
|
|
2387
|
+
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
2388
|
+
v,
|
|
2389
|
+
{
|
|
2390
|
+
icon: "Mermaid",
|
|
2391
|
+
tooltip: "Mermaid",
|
|
2392
|
+
action: () => s(!0)
|
|
2393
|
+
}
|
|
2394
|
+
) }),
|
|
2395
|
+
/* @__PURE__ */ u(Nt, { className: "!richtext-max-w-[1300px] richtext-z-[99999]", children: [
|
|
2396
|
+
/* @__PURE__ */ i(kt, { children: "Mermaid" }),
|
|
2397
|
+
/* @__PURE__ */ i("div", { style: { height: "100%", borderWidth: 1 }, children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
2398
|
+
/* @__PURE__ */ i(
|
|
2399
|
+
St,
|
|
2400
|
+
{
|
|
2401
|
+
className: "richtext-flex-1",
|
|
2402
|
+
value: r,
|
|
2403
|
+
onChange: (m) => n(m.target.value),
|
|
2404
|
+
autoFocus: !0,
|
|
2405
|
+
required: !0,
|
|
2406
|
+
rows: 10,
|
|
2407
|
+
defaultValue: Ae,
|
|
2408
|
+
placeholder: "Text",
|
|
2409
|
+
style: {
|
|
2410
|
+
color: "hsl(var(--richtext-foreground))"
|
|
2411
|
+
}
|
|
2412
|
+
}
|
|
2413
|
+
),
|
|
2414
|
+
/* @__PURE__ */ i(
|
|
2415
|
+
"div",
|
|
2416
|
+
{
|
|
2417
|
+
className: "richtext-flex-1 richtext-flex richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
2418
|
+
style: { height: "100%", borderWidth: 1, minHeight: 500, background: "#fff" },
|
|
2419
|
+
ref: l,
|
|
2420
|
+
dangerouslySetInnerHTML: { __html: a }
|
|
2421
|
+
}
|
|
2422
|
+
)
|
|
2423
|
+
] }) }),
|
|
2424
|
+
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
2425
|
+
U,
|
|
2426
|
+
{
|
|
2427
|
+
type: "button",
|
|
2428
|
+
onClick: async () => {
|
|
2429
|
+
if (r !== "") {
|
|
2430
|
+
if (r) {
|
|
2431
|
+
const m = l.current.querySelector("svg"), { width: f, height: p } = m.getBoundingClientRect(), b = `mermaid-${vi()}.svg`;
|
|
2432
|
+
let T = je(m.outerHTML);
|
|
2433
|
+
if (e) {
|
|
2434
|
+
const k = gi(T, b);
|
|
2435
|
+
T = await e(k);
|
|
2436
|
+
}
|
|
2437
|
+
t == null || t.chain().focus().setMermaid(
|
|
2438
|
+
{
|
|
2439
|
+
type: "mermaid",
|
|
2440
|
+
src: T,
|
|
2441
|
+
alt: encodeURIComponent(r),
|
|
2442
|
+
width: f,
|
|
2443
|
+
height: p
|
|
2444
|
+
},
|
|
2445
|
+
!!r
|
|
2446
|
+
).run();
|
|
2447
|
+
}
|
|
2448
|
+
s(!1);
|
|
2449
|
+
}
|
|
2450
|
+
},
|
|
2451
|
+
children: "Save changes"
|
|
2452
|
+
}
|
|
2453
|
+
) })
|
|
2454
|
+
] })
|
|
2455
|
+
]
|
|
2456
|
+
}
|
|
2457
|
+
);
|
|
2458
|
+
}, It = {
|
|
2459
|
+
TOP_LEFT: "tl",
|
|
2460
|
+
TOP_RIGHT: "tr",
|
|
2461
|
+
BOTTOM_LEFT: "bl",
|
|
2462
|
+
BOTTOM_RIGHT: "br"
|
|
2463
|
+
};
|
|
2464
|
+
function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a }) {
|
|
2465
|
+
const [c, o] = w({
|
|
2466
|
+
width: Ot,
|
|
2467
|
+
height: Ot
|
|
2468
|
+
}), [s, l] = w({
|
|
2469
|
+
width: 0,
|
|
2470
|
+
height: 0
|
|
2471
|
+
}), [h] = w([
|
|
2472
|
+
It.TOP_LEFT,
|
|
2473
|
+
It.TOP_RIGHT,
|
|
2474
|
+
It.BOTTOM_LEFT,
|
|
2475
|
+
It.BOTTOM_RIGHT
|
|
2476
|
+
]), [d, x] = w(!1), [m, f] = w({
|
|
2477
|
+
x: 0,
|
|
2478
|
+
y: 0,
|
|
2479
|
+
w: 0,
|
|
2480
|
+
h: 0,
|
|
2481
|
+
dir: ""
|
|
2482
|
+
}), { align: p } = e == null ? void 0 : e.attrs, b = P(() => {
|
|
2483
|
+
const { src: y, alt: g, width: O, height: S } = e == null ? void 0 : e.attrs, z = me(O) ? `${O}px` : O, A = me(S) ? `${S}px` : S;
|
|
2484
|
+
return {
|
|
2485
|
+
src: y || void 0,
|
|
2486
|
+
alt: g || void 0,
|
|
2487
|
+
style: {
|
|
2488
|
+
width: z || void 0,
|
|
2489
|
+
height: A || void 0
|
|
2490
|
+
}
|
|
2491
|
+
};
|
|
2492
|
+
}, [e == null ? void 0 : e.attrs]), T = P(() => {
|
|
2493
|
+
const {
|
|
2494
|
+
style: { width: y }
|
|
2495
|
+
} = b;
|
|
2496
|
+
return { width: y === "100%" ? y : void 0 };
|
|
2497
|
+
}, [b]);
|
|
2498
|
+
function k(y) {
|
|
2499
|
+
l({
|
|
2500
|
+
width: y.target.width,
|
|
2501
|
+
height: y.target.height
|
|
2502
|
+
});
|
|
2503
|
+
}
|
|
2504
|
+
function R() {
|
|
2505
|
+
t.commands.setNodeSelection(n());
|
|
2506
|
+
}
|
|
2507
|
+
const $ = C(
|
|
2508
|
+
wt(() => {
|
|
2509
|
+
const { width: y } = getComputedStyle(t.view.dom);
|
|
2510
|
+
o((g) => ({
|
|
2511
|
+
...g,
|
|
2512
|
+
width: Number.parseInt(y, 10)
|
|
2513
|
+
}));
|
|
2514
|
+
}, _t),
|
|
2515
|
+
[t]
|
|
2516
|
+
);
|
|
2517
|
+
function F(y, g) {
|
|
2518
|
+
y.preventDefault(), y.stopPropagation();
|
|
2519
|
+
const O = s.width, S = s.height, z = O / S;
|
|
2520
|
+
let A = Number(e.attrs.width), K = Number(e.attrs.height);
|
|
2521
|
+
const j = c.width;
|
|
2522
|
+
A && !K ? (A = A > j ? j : A, K = Math.round(A / z)) : K && !A ? (A = Math.round(K * z), A = A > j ? j : A) : !A && !K ? (A = O > j ? j : O, K = Math.round(A / z)) : A = A > j ? j : A, Bt(() => {
|
|
2523
|
+
x(!0), f({
|
|
2524
|
+
x: y.clientX,
|
|
2525
|
+
y: y.clientY,
|
|
2526
|
+
w: A,
|
|
2527
|
+
h: K,
|
|
2528
|
+
dir: g
|
|
2529
|
+
});
|
|
2530
|
+
});
|
|
2531
|
+
}
|
|
2532
|
+
const M = C(
|
|
2533
|
+
wt((y) => {
|
|
2534
|
+
if (y.preventDefault(), y.stopPropagation(), !d)
|
|
2535
|
+
return;
|
|
2536
|
+
const { x: g, w: O, dir: S } = m, z = (y.clientX - g) * (/l/.test(S) ? -1 : 1), A = ti(O + z, Pe, c.width);
|
|
2537
|
+
r({
|
|
2538
|
+
width: A,
|
|
2539
|
+
height: null
|
|
2540
|
+
});
|
|
2541
|
+
}, _t),
|
|
2542
|
+
[d, m, c, r]
|
|
2543
|
+
), B = C(
|
|
2544
|
+
(y) => {
|
|
2545
|
+
y.preventDefault(), y.stopPropagation(), d && (Bt(() => {
|
|
2546
|
+
f({
|
|
2547
|
+
x: 0,
|
|
2548
|
+
y: 0,
|
|
2549
|
+
w: 0,
|
|
2550
|
+
h: 0,
|
|
2551
|
+
dir: ""
|
|
2552
|
+
}), x(!1);
|
|
2553
|
+
}), R());
|
|
2554
|
+
},
|
|
2555
|
+
[d, R]
|
|
2556
|
+
), W = C(() => {
|
|
2557
|
+
document == null || document.addEventListener("mousemove", M, !0), document == null || document.addEventListener("mouseup", B, !0);
|
|
2558
|
+
}, [M, B]), N = C(() => {
|
|
2559
|
+
document == null || document.removeEventListener("mousemove", M, !0), document == null || document.removeEventListener("mouseup", B, !0);
|
|
2560
|
+
}, [M, B]);
|
|
2561
|
+
I(() => (d ? W() : N(), () => {
|
|
2562
|
+
N();
|
|
2563
|
+
}), [d, W, N]);
|
|
2564
|
+
const H = P(() => new ResizeObserver(() => $()), [$]);
|
|
2565
|
+
return I(() => (H.observe(t.view.dom), () => {
|
|
2566
|
+
H.disconnect();
|
|
2567
|
+
}), [t.view.dom, H]), /* @__PURE__ */ i(ut, { className: "image-view", style: { ...T, width: "100%", textAlign: p }, children: /* @__PURE__ */ u(
|
|
2568
|
+
"div",
|
|
2569
|
+
{
|
|
2570
|
+
draggable: "true",
|
|
2571
|
+
"data-drag-handle": !0,
|
|
2572
|
+
className: `image-view__body ${a ? "image-view__body--focused" : ""} ${d ? "image-view__body--resizing" : ""}`,
|
|
2573
|
+
style: { ...T, background: "#fff" },
|
|
2574
|
+
children: [
|
|
2575
|
+
/* @__PURE__ */ i(
|
|
2576
|
+
"img",
|
|
2577
|
+
{
|
|
2578
|
+
src: b.src,
|
|
2579
|
+
alt: b.alt,
|
|
2580
|
+
style: b.style,
|
|
2581
|
+
height: "auto",
|
|
2582
|
+
className: "image-view__body__image block",
|
|
2583
|
+
onLoad: k,
|
|
2584
|
+
onClick: R
|
|
2585
|
+
}
|
|
2586
|
+
),
|
|
2587
|
+
t.view.editable && (a || d) && /* @__PURE__ */ i("div", { className: "image-resizer", children: h == null ? void 0 : h.map((y) => /* @__PURE__ */ i(
|
|
2588
|
+
"span",
|
|
2589
|
+
{
|
|
2590
|
+
className: `image-resizer__handler image-resizer__handler--${y}`,
|
|
2591
|
+
onMouseDown: (g) => F(g, y)
|
|
2592
|
+
},
|
|
2593
|
+
`image-dir-${y}`
|
|
2594
|
+
)) })
|
|
2595
|
+
]
|
|
2596
|
+
}
|
|
2597
|
+
) });
|
|
2598
|
+
}
|
|
2599
|
+
const Me = He.extend({
|
|
2600
|
+
name: "mermaid",
|
|
2601
|
+
addOptions() {
|
|
2602
|
+
var t;
|
|
2603
|
+
return {
|
|
2604
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
2605
|
+
inline: !1,
|
|
2606
|
+
content: "",
|
|
2607
|
+
marks: "",
|
|
2608
|
+
group: "block",
|
|
2609
|
+
draggable: !1,
|
|
2610
|
+
selectable: !0,
|
|
2611
|
+
atom: !0,
|
|
2612
|
+
HTMLAttributes: {
|
|
2613
|
+
class: "mermaid"
|
|
2614
|
+
},
|
|
2615
|
+
button: ({ editor: e, t: r, extension: n }) => {
|
|
2616
|
+
var a;
|
|
2617
|
+
return {
|
|
2618
|
+
component: Kc,
|
|
2619
|
+
componentProps: {
|
|
2620
|
+
action: () => {
|
|
2621
|
+
},
|
|
2622
|
+
isActive: () => !1,
|
|
2623
|
+
disabled: !1,
|
|
2624
|
+
editor: e,
|
|
2625
|
+
icon: "Mermaid",
|
|
2626
|
+
tooltip: r("editor.mermaid.tooltip"),
|
|
2627
|
+
upload: (a = n == null ? void 0 : n.options) == null ? void 0 : a.upload
|
|
2628
|
+
}
|
|
2629
|
+
};
|
|
2630
|
+
}
|
|
2631
|
+
};
|
|
2632
|
+
},
|
|
2633
|
+
addAttributes() {
|
|
2634
|
+
var t;
|
|
2635
|
+
return {
|
|
2636
|
+
...(t = this.parent) == null ? void 0 : t.call(this),
|
|
2637
|
+
width: {
|
|
2638
|
+
default: null,
|
|
2639
|
+
parseHTML: (e) => {
|
|
2640
|
+
const r = e.style.width || e.getAttribute("width") || "10";
|
|
2641
|
+
return r === void 0 ? null : Number.parseInt(`${r}`, 10);
|
|
2642
|
+
},
|
|
2643
|
+
renderHTML: (e) => ({
|
|
2644
|
+
width: e.width
|
|
2645
|
+
})
|
|
2646
|
+
},
|
|
2647
|
+
height: {
|
|
2648
|
+
default: null,
|
|
2649
|
+
parseHTML: (e) => {
|
|
2650
|
+
const r = e.style.height || e.getAttribute("height") || "10";
|
|
2651
|
+
return r === void 0 ? null : Number.parseInt(`${r}`, 10);
|
|
2652
|
+
},
|
|
2653
|
+
renderHTML: (e) => ({
|
|
2654
|
+
height: e.height
|
|
2655
|
+
})
|
|
2656
|
+
},
|
|
2657
|
+
align: {
|
|
2658
|
+
default: "center",
|
|
2659
|
+
parseHTML: (e) => e.getAttribute("align"),
|
|
2660
|
+
renderHTML: (e) => ({
|
|
2661
|
+
align: e.align
|
|
2662
|
+
})
|
|
2663
|
+
}
|
|
2664
|
+
};
|
|
2665
|
+
},
|
|
2666
|
+
addNodeView() {
|
|
2667
|
+
return xt(Zc);
|
|
2668
|
+
},
|
|
2669
|
+
// @ts-ignore
|
|
2670
|
+
addCommands() {
|
|
2671
|
+
return {
|
|
2672
|
+
setMermaid: (t, e) => ({ commands: r, editor: n }) => e ? r.insertContent({
|
|
2673
|
+
type: this.name,
|
|
2674
|
+
attrs: t
|
|
2675
|
+
}) : r.insertContentAt(n.state.selection.anchor, {
|
|
2676
|
+
type: this.name,
|
|
2677
|
+
attrs: t
|
|
2678
|
+
}),
|
|
2679
|
+
setAlignImageMermaid: (t) => ({ commands: e }) => e.updateAttributes(this.name, { align: t })
|
|
2680
|
+
};
|
|
2681
|
+
},
|
|
2682
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
2683
|
+
const { align: e } = t;
|
|
2684
|
+
return [
|
|
2685
|
+
"div",
|
|
2686
|
+
// Parent element
|
|
2687
|
+
{
|
|
2688
|
+
style: e ? `text-align: ${e};` : "",
|
|
2689
|
+
class: "imageMermaid"
|
|
2690
|
+
},
|
|
2691
|
+
[
|
|
2692
|
+
"img",
|
|
2693
|
+
it(
|
|
2694
|
+
// @ts-ignore
|
|
2695
|
+
this.options.HTMLAttributes,
|
|
2696
|
+
t
|
|
2697
|
+
)
|
|
2698
|
+
]
|
|
2699
|
+
];
|
|
2700
|
+
},
|
|
2701
|
+
parseHTML() {
|
|
2702
|
+
return [
|
|
2703
|
+
{
|
|
2704
|
+
tag: "div[class=imageMermaid]",
|
|
2705
|
+
getAttrs: (t) => {
|
|
2706
|
+
const e = t.querySelector("img"), r = e == null ? void 0 : e.getAttribute("width"), n = e == null ? void 0 : e.getAttribute("height");
|
|
2707
|
+
return {
|
|
2708
|
+
src: e == null ? void 0 : e.getAttribute("src"),
|
|
2709
|
+
alt: e == null ? void 0 : e.getAttribute("alt"),
|
|
2710
|
+
width: r ? Number.parseInt(r, 10) : null,
|
|
2711
|
+
height: n ? Number.parseInt(n, 10) : null,
|
|
2712
|
+
align: (e == null ? void 0 : e.getAttribute("align")) || t.style.textAlign || null
|
|
2713
|
+
};
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
];
|
|
2717
|
+
}
|
|
2718
|
+
});
|
|
2719
|
+
function Xc({ node: t }) {
|
|
2720
|
+
var n;
|
|
2721
|
+
const e = ((n = t == null ? void 0 : t.attrs) == null ? void 0 : n.src) || "", r = e == null ? void 0 : e.split("/").pop();
|
|
2722
|
+
return r ? /* @__PURE__ */ i(ut, { children: /* @__PURE__ */ i("div", { "data-twitter": "", children: /* @__PURE__ */ i(dn, { id: r }) }) }) : null;
|
|
2723
|
+
}
|
|
2724
|
+
function bi(t) {
|
|
2725
|
+
const { t: e } = V(), [r, n] = w("");
|
|
2726
|
+
I(() => {
|
|
2727
|
+
var c;
|
|
2728
|
+
if (t != null && t.editor) {
|
|
2729
|
+
const { src: o } = (c = t.editor) == null ? void 0 : c.getAttributes(re.name);
|
|
2730
|
+
o && n(o);
|
|
2731
|
+
}
|
|
2732
|
+
}, [t == null ? void 0 : t.editor]);
|
|
2733
|
+
function a(c) {
|
|
2734
|
+
c.preventDefault(), c.stopPropagation(), t == null || t.onSetLink(r);
|
|
2735
|
+
}
|
|
2736
|
+
return /* @__PURE__ */ i("div", { className: "richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black border-neutral-200 dark:richtext-border-neutral-800", children: /* @__PURE__ */ u("form", { className: "richtext-flex richtext-flex-col richtext-gap-2", onSubmit: a, children: [
|
|
2737
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: e("editor.link.dialog.text") }),
|
|
2738
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5 richtext-mb-[10px]", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
2739
|
+
J,
|
|
2740
|
+
{
|
|
2741
|
+
type: "text",
|
|
2742
|
+
value: r,
|
|
2743
|
+
required: !0,
|
|
2744
|
+
className: "richtext-w-80",
|
|
2745
|
+
placeholder: "Text",
|
|
2746
|
+
onChange: (c) => n(c.target.value)
|
|
2747
|
+
}
|
|
2748
|
+
) }) }),
|
|
2749
|
+
/* @__PURE__ */ i(U, { type: "submit", className: "richtext-self-end richtext-mt-2", children: e("editor.link.dialog.button.apply") })
|
|
2750
|
+
] }) });
|
|
2751
|
+
}
|
|
2752
|
+
function qc(t) {
|
|
2753
|
+
function e(r) {
|
|
2754
|
+
t.action && t.action(r);
|
|
2755
|
+
}
|
|
2756
|
+
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
2757
|
+
/* @__PURE__ */ i(ft, { disabled: t == null ? void 0 : t.disabled, asChild: !0, children: /* @__PURE__ */ i(
|
|
2758
|
+
v,
|
|
2759
|
+
{
|
|
2760
|
+
tooltip: t == null ? void 0 : t.tooltip,
|
|
2761
|
+
isActive: t == null ? void 0 : t.isActive,
|
|
2762
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
2763
|
+
children: /* @__PURE__ */ i(G, { name: t == null ? void 0 : t.icon })
|
|
2764
|
+
}
|
|
2765
|
+
) }),
|
|
2766
|
+
/* @__PURE__ */ i(ct, { hideWhenDetached: !0, className: "richtext-w-full", align: "start", side: "bottom", children: /* @__PURE__ */ i(bi, { editor: t.editor, onSetLink: e }) })
|
|
2767
|
+
] });
|
|
2768
|
+
}
|
|
2769
|
+
const Yc = /(https?:\/\/)?(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?/g, Jc = /^https?:\/\/(www\.)?x\.com\/(\w{1,15})(\/status\/(\d+))?(\/\S*)?$/;
|
|
2770
|
+
function Le(t) {
|
|
2771
|
+
return t.match(Jc);
|
|
2772
|
+
}
|
|
2773
|
+
const re = dt.create({
|
|
2774
|
+
name: "twitter",
|
|
2775
|
+
draggable: !0,
|
|
2776
|
+
selectable: !0,
|
|
2777
|
+
addOptions() {
|
|
2778
|
+
return {
|
|
2779
|
+
addPasteHandler: !0,
|
|
2780
|
+
HTMLAttributes: {},
|
|
2781
|
+
inline: !1,
|
|
2782
|
+
origin: "",
|
|
2783
|
+
button: ({ editor: t, t: e }) => ({
|
|
2784
|
+
component: qc,
|
|
2785
|
+
componentProps: {
|
|
2786
|
+
action: (r) => {
|
|
2787
|
+
t.commands.setTweet({ src: r });
|
|
2788
|
+
},
|
|
2789
|
+
isActive: () => !1,
|
|
2790
|
+
disabled: !1,
|
|
2791
|
+
icon: "Twitter",
|
|
2792
|
+
tooltip: e("editor.twitter.tooltip"),
|
|
2793
|
+
editor: t
|
|
2794
|
+
}
|
|
2795
|
+
})
|
|
2796
|
+
};
|
|
2797
|
+
},
|
|
2798
|
+
addNodeView() {
|
|
2799
|
+
return xt(Xc, { attrs: this.options.HTMLAttributes });
|
|
2800
|
+
},
|
|
2801
|
+
inline() {
|
|
2802
|
+
return this.options.inline;
|
|
2803
|
+
},
|
|
2804
|
+
group() {
|
|
2805
|
+
return this.options.inline ? "inline" : "block";
|
|
2806
|
+
},
|
|
2807
|
+
addAttributes() {
|
|
2808
|
+
return {
|
|
2809
|
+
src: {
|
|
2810
|
+
default: null
|
|
2811
|
+
}
|
|
2812
|
+
};
|
|
2813
|
+
},
|
|
2814
|
+
parseHTML() {
|
|
2815
|
+
return [
|
|
2816
|
+
{
|
|
2817
|
+
tag: "div[data-twitter]"
|
|
2818
|
+
}
|
|
2819
|
+
];
|
|
2820
|
+
},
|
|
2821
|
+
addCommands() {
|
|
2822
|
+
return {
|
|
2823
|
+
setTweet: (t) => ({ commands: e }) => Le(t.src) ? e.insertContent({
|
|
2824
|
+
type: this.name,
|
|
2825
|
+
attrs: t
|
|
2826
|
+
}) : !1,
|
|
2827
|
+
updateTweet: (t) => ({ commands: e }) => Le(t.src) ? e.updateAttributes(this.name, { src: t.src }) : !1
|
|
2828
|
+
};
|
|
2829
|
+
},
|
|
2830
|
+
addPasteRules() {
|
|
2831
|
+
return this.options.addPasteHandler ? [
|
|
2832
|
+
Li({
|
|
2833
|
+
find: Yc,
|
|
2834
|
+
type: this.type,
|
|
2835
|
+
getAttributes: (t) => ({ src: t.input })
|
|
2836
|
+
})
|
|
2837
|
+
] : [];
|
|
2838
|
+
},
|
|
2839
|
+
renderHTML({ HTMLAttributes: t }) {
|
|
2840
|
+
return ["div", it({ "data-twitter": "" }, t)];
|
|
2841
|
+
}
|
|
2842
|
+
});
|
|
2843
|
+
function Qc({ editor: t, ...e }) {
|
|
2844
|
+
const r = At(t, lt.name, {
|
|
2845
|
+
text: "",
|
|
2846
|
+
defaultShowPicker: !1
|
|
2847
|
+
}), { text: n, defaultShowPicker: a } = r, [c, o] = w(""), [s, l] = w(!1), h = C(() => t.isActive(lt.name), [t]), d = C(() => Ct(lt.name, t), [t]), x = C(() => {
|
|
2848
|
+
t.chain().focus().setKatex({ text: c }).run(), l(!1);
|
|
2849
|
+
}, [t, c]);
|
|
2850
|
+
I(() => {
|
|
2851
|
+
a && (l(!0), t.chain().updateAttributes(lt.name, { defaultShowPicker: !1 }).focus().run());
|
|
2852
|
+
}, [t, a, l]), I(() => {
|
|
2853
|
+
s && o(n || "");
|
|
2854
|
+
}, [s]);
|
|
2855
|
+
const m = P(() => {
|
|
2856
|
+
try {
|
|
2857
|
+
return ae.renderToString(`${c}`);
|
|
2858
|
+
} catch {
|
|
2859
|
+
return c;
|
|
2860
|
+
}
|
|
2861
|
+
}, [c]), f = P(
|
|
2862
|
+
() => `${c}`.trim() ? /* @__PURE__ */ i("span", { contentEditable: !1, dangerouslySetInnerHTML: { __html: m || "" } }) : null,
|
|
2863
|
+
[c, m]
|
|
2864
|
+
);
|
|
2865
|
+
return /* @__PURE__ */ i(
|
|
2866
|
+
Y,
|
|
2867
|
+
{
|
|
2868
|
+
editor: t,
|
|
2869
|
+
pluginKey: "Katex-bubble-menu",
|
|
2870
|
+
shouldShow: h,
|
|
2871
|
+
tippyOptions: {
|
|
2872
|
+
popperOptions: {
|
|
2873
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
2874
|
+
},
|
|
2875
|
+
placement: "bottom-start",
|
|
2876
|
+
offset: [-2, 16],
|
|
2877
|
+
zIndex: 9999,
|
|
2878
|
+
onHidden: () => {
|
|
2879
|
+
l(!1);
|
|
2880
|
+
}
|
|
2881
|
+
},
|
|
2882
|
+
children: e != null && e.disabled ? /* @__PURE__ */ i(_, {}) : /* @__PURE__ */ i("div", { className: "richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800", children: s ? /* @__PURE__ */ u(_, { children: [
|
|
2883
|
+
/* @__PURE__ */ i(
|
|
2884
|
+
St,
|
|
2885
|
+
{
|
|
2886
|
+
value: c,
|
|
2887
|
+
onChange: (p) => o(p.target.value),
|
|
2888
|
+
autoFocus: !0,
|
|
2889
|
+
placeholder: "Formula text",
|
|
2890
|
+
rows: 3,
|
|
2891
|
+
defaultValue: n,
|
|
2892
|
+
style: { marginBottom: 8 }
|
|
2893
|
+
}
|
|
2894
|
+
),
|
|
2895
|
+
f && /* @__PURE__ */ i("div", { className: "richtext-my-[10px] richtext-p-[10px] richtext-rounded-[6px] !richtext-border-[1px] richtext-whitespace-nowrap richtext-overflow-auto", children: f }),
|
|
2896
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]", children: [
|
|
2897
|
+
/* @__PURE__ */ i(U, { onClick: x, className: "richtext-flex-1", children: "Submit" }),
|
|
2898
|
+
/* @__PURE__ */ i("a", { href: "https://katex.org/docs/supported", target: "_blank", rel: "noreferrer noopener", children: /* @__PURE__ */ i(Ze, { size: 16 }) })
|
|
2899
|
+
] })
|
|
2900
|
+
] }) : /* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-justify-center richtext-gap-[6px]", children: [
|
|
2901
|
+
/* @__PURE__ */ i(v, { tooltip: "Edit", action: () => l(!s), children: /* @__PURE__ */ i(Ke, { size: 16 }) }),
|
|
2902
|
+
/* @__PURE__ */ i(v, { tooltip: "Delete", action: d, children: /* @__PURE__ */ i(Ue, { size: 16 }) })
|
|
2903
|
+
] }) })
|
|
2904
|
+
}
|
|
2905
|
+
);
|
|
2906
|
+
}
|
|
2907
|
+
const ta = { padding: "0 12px 12px" }, yi = ({ width: t, maxWidth: e, height: r, onOk: n, children: a }) => {
|
|
2908
|
+
const { t: c } = V(), [o, s] = w({
|
|
2909
|
+
width: "",
|
|
2910
|
+
height: "",
|
|
2911
|
+
maxWidth: ""
|
|
2912
|
+
});
|
|
2913
|
+
I(() => {
|
|
2914
|
+
s({
|
|
2915
|
+
width: t,
|
|
2916
|
+
height: r,
|
|
2917
|
+
maxWidth: e
|
|
2918
|
+
});
|
|
2919
|
+
}, [r, e, t]);
|
|
2920
|
+
function l(h) {
|
|
2921
|
+
h.preventDefault(), h.stopPropagation(), n(o);
|
|
2922
|
+
}
|
|
2923
|
+
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
2924
|
+
/* @__PURE__ */ i(ft, { asChild: !0, children: a }),
|
|
2925
|
+
/* @__PURE__ */ i(ct, { children: /* @__PURE__ */ i("div", { style: ta, children: /* @__PURE__ */ u("form", { className: "richtext-flex richtext-flex-col richtext-gap-2", onSubmit: l, children: [
|
|
2926
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: "Width" }),
|
|
2927
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
2928
|
+
J,
|
|
2929
|
+
{
|
|
2930
|
+
type: "number",
|
|
2931
|
+
value: o.width,
|
|
2932
|
+
required: !0,
|
|
2933
|
+
onChange: (h) => s({ ...o, width: h.target.value })
|
|
2934
|
+
}
|
|
2935
|
+
) }) }),
|
|
2936
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: "Max Width" }),
|
|
2937
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
2938
|
+
J,
|
|
2939
|
+
{
|
|
2940
|
+
type: "number",
|
|
2941
|
+
value: o.maxWidth,
|
|
2942
|
+
required: !0,
|
|
2943
|
+
onChange: (h) => s({ ...o, maxWidth: h.target.value })
|
|
2944
|
+
}
|
|
2945
|
+
) }) }),
|
|
2946
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: "Height" }),
|
|
2947
|
+
/* @__PURE__ */ i("div", { className: "richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-items-center richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
2948
|
+
J,
|
|
2949
|
+
{
|
|
2950
|
+
type: "number",
|
|
2951
|
+
value: o.height,
|
|
2952
|
+
required: !0,
|
|
2953
|
+
onChange: (h) => s({ ...o, height: h.target.value })
|
|
2954
|
+
}
|
|
2955
|
+
) }) }),
|
|
2956
|
+
/* @__PURE__ */ i(U, { type: "submit", className: "richtext-self-end richtext-mt-2", children: c("editor.link.dialog.button.apply") })
|
|
2957
|
+
] }) }) })
|
|
2958
|
+
] });
|
|
2959
|
+
}, rt = /* @__PURE__ */ new Map();
|
|
2960
|
+
function ea(t) {
|
|
2961
|
+
const e = t.options.element;
|
|
2962
|
+
rt.has("width") || rt.set("width", e.clientWidth), rt.has("width") && rt.get("width") <= 0 && rt.set("width", e.clientWidth);
|
|
2963
|
+
const r = { attributes: !0, childList: !0, subtree: !0 }, n = function() {
|
|
2964
|
+
rt.set("width", e.clientWidth);
|
|
2965
|
+
}, a = new MutationObserver(n);
|
|
2966
|
+
return a.observe(e, r), t.on("destroy", () => {
|
|
2967
|
+
a.disconnect();
|
|
2968
|
+
}), { width: rt.get("width") };
|
|
2969
|
+
}
|
|
2970
|
+
function ia({ editor: t }) {
|
|
2971
|
+
const { t: e } = V(), { width: r } = ea(t), n = At(t, st.name, {
|
|
2972
|
+
defaultShowPicker: !1,
|
|
2973
|
+
createUser: "",
|
|
2974
|
+
width: 0,
|
|
2975
|
+
height: 0
|
|
2976
|
+
}), { defaultShowPicker: a, createUser: c, width: o, height: s } = n, l = C(
|
|
2977
|
+
(m) => {
|
|
2978
|
+
t.chain().updateAttributes(st.name, m).setNodeSelection(t.state.selection.from).focus().run();
|
|
2979
|
+
},
|
|
2980
|
+
[t]
|
|
2981
|
+
), h = C(() => {
|
|
2982
|
+
Wc(n);
|
|
2983
|
+
}, [t, n]), d = C(() => t.isActive(st.name), [t]), x = C(() => Ct(st.name, t), [t]);
|
|
2984
|
+
return I(() => {
|
|
2985
|
+
a && (h(), t.chain().updateAttributes(st.name, { defaultShowPicker: !1 }).focus().run());
|
|
2986
|
+
}, [c, a, t, h]), /* @__PURE__ */ i(
|
|
2987
|
+
Y,
|
|
2988
|
+
{
|
|
2989
|
+
className: "bubble-menu",
|
|
2990
|
+
editor: t,
|
|
2991
|
+
pluginKey: "excalidraw-bubble-menu",
|
|
2992
|
+
shouldShow: d,
|
|
2993
|
+
tippyOptions: {
|
|
2994
|
+
popperOptions: {
|
|
2995
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
2996
|
+
},
|
|
2997
|
+
placement: "bottom-start",
|
|
2998
|
+
offset: [-2, 16],
|
|
2999
|
+
zIndex: 9999
|
|
3000
|
+
// onHidden: () => {
|
|
3001
|
+
// toggleVisible(false)
|
|
3002
|
+
// },
|
|
3003
|
+
},
|
|
3004
|
+
children: /* @__PURE__ */ u("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: [
|
|
3005
|
+
/* @__PURE__ */ i(
|
|
3006
|
+
v,
|
|
3007
|
+
{
|
|
3008
|
+
icon: "Pencil",
|
|
3009
|
+
action: h,
|
|
3010
|
+
tooltip: e("editor.edit")
|
|
3011
|
+
}
|
|
3012
|
+
),
|
|
3013
|
+
/* @__PURE__ */ i(yi, { width: o, maxWidth: r, height: s, onOk: l, children: /* @__PURE__ */ i(
|
|
3014
|
+
v,
|
|
3015
|
+
{
|
|
3016
|
+
icon: "Settings",
|
|
3017
|
+
tooltip: e("editor.settings")
|
|
3018
|
+
}
|
|
3019
|
+
) }),
|
|
3020
|
+
/* @__PURE__ */ i(
|
|
3021
|
+
v,
|
|
3022
|
+
{
|
|
3023
|
+
icon: "Trash2",
|
|
3024
|
+
action: x,
|
|
3025
|
+
tooltip: e("editor.delete")
|
|
3026
|
+
}
|
|
3027
|
+
)
|
|
3028
|
+
] })
|
|
3029
|
+
}
|
|
3030
|
+
);
|
|
3031
|
+
}
|
|
3032
|
+
function ra({ editor: t }) {
|
|
3033
|
+
const { t: e } = V(), { width: r, height: n, url: a } = At(t, ot.name, {
|
|
3034
|
+
width: 0,
|
|
3035
|
+
height: 0,
|
|
3036
|
+
url: "",
|
|
3037
|
+
defaultShowPicker: !1
|
|
3038
|
+
}), [c, o] = w(!1), [s, l] = w(""), h = C(() => {
|
|
3039
|
+
o(!1);
|
|
3040
|
+
}, [o]);
|
|
3041
|
+
I(() => {
|
|
3042
|
+
c && l(a);
|
|
3043
|
+
}, [c, a]);
|
|
3044
|
+
const d = C(() => {
|
|
3045
|
+
t.chain().updateAttributes(ot.name, {
|
|
3046
|
+
url: s
|
|
3047
|
+
}).setNodeSelection(t.state.selection.from).focus().run(), o(!1);
|
|
3048
|
+
}, [t, s, o]), x = C(() => {
|
|
3049
|
+
window.open(a, "_blank");
|
|
3050
|
+
}, [a]), m = C(() => {
|
|
3051
|
+
o(!0);
|
|
3052
|
+
}, [o]), f = C(
|
|
3053
|
+
(T) => {
|
|
3054
|
+
t.chain().updateAttributes(ot.name, T).setNodeSelection(t.state.selection.from).focus().run();
|
|
3055
|
+
},
|
|
3056
|
+
[t]
|
|
3057
|
+
), p = C(() => t.isActive(ot.name) && !a, [t, a]), b = C(() => Ct(ot.name, t), [t]);
|
|
3058
|
+
return /* @__PURE__ */ u(_, { children: [
|
|
3059
|
+
/* @__PURE__ */ i(
|
|
3060
|
+
Y,
|
|
3061
|
+
{
|
|
3062
|
+
className: "bubble-menu",
|
|
3063
|
+
editor: t,
|
|
3064
|
+
pluginKey: "iframe-bubble-menu",
|
|
3065
|
+
shouldShow: p,
|
|
3066
|
+
tippyOptions: {
|
|
3067
|
+
popperOptions: {
|
|
3068
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
3069
|
+
},
|
|
3070
|
+
placement: "bottom-start",
|
|
3071
|
+
offset: [-2, 16],
|
|
3072
|
+
zIndex: 9999
|
|
3073
|
+
// onHidden: () => {
|
|
3074
|
+
// toggleVisible(false)
|
|
3075
|
+
// },
|
|
3076
|
+
},
|
|
3077
|
+
children: /* @__PURE__ */ u("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: [
|
|
3078
|
+
/* @__PURE__ */ i(
|
|
3079
|
+
v,
|
|
3080
|
+
{
|
|
3081
|
+
action: x,
|
|
3082
|
+
icon: "Eye",
|
|
3083
|
+
tooltip: "Visit Link"
|
|
3084
|
+
}
|
|
3085
|
+
),
|
|
3086
|
+
/* @__PURE__ */ i(
|
|
3087
|
+
v,
|
|
3088
|
+
{
|
|
3089
|
+
action: m,
|
|
3090
|
+
icon: "Pencil",
|
|
3091
|
+
tooltip: "Open Edit Link"
|
|
3092
|
+
}
|
|
3093
|
+
),
|
|
3094
|
+
/* @__PURE__ */ i(yi, { width: r, height: n, onOk: f, children: /* @__PURE__ */ i(
|
|
3095
|
+
v,
|
|
3096
|
+
{
|
|
3097
|
+
icon: "Settings",
|
|
3098
|
+
tooltip: e("editor.settings")
|
|
3099
|
+
}
|
|
3100
|
+
) }),
|
|
3101
|
+
/* @__PURE__ */ i(
|
|
3102
|
+
v,
|
|
3103
|
+
{
|
|
3104
|
+
action: b,
|
|
3105
|
+
icon: "Trash2",
|
|
3106
|
+
tooltip: e("editor.delete")
|
|
3107
|
+
}
|
|
3108
|
+
)
|
|
3109
|
+
] })
|
|
3110
|
+
}
|
|
3111
|
+
),
|
|
3112
|
+
/* @__PURE__ */ u(
|
|
3113
|
+
jt,
|
|
3114
|
+
{
|
|
3115
|
+
open: c,
|
|
3116
|
+
onOpenChange: o,
|
|
3117
|
+
children: [
|
|
3118
|
+
/* @__PURE__ */ i(Ft, {}),
|
|
3119
|
+
/* @__PURE__ */ u(Nt, { children: [
|
|
3120
|
+
/* @__PURE__ */ i(fi, { children: /* @__PURE__ */ i(kt, { children: "Edit Link Iframe" }) }),
|
|
3121
|
+
/* @__PURE__ */ i(
|
|
3122
|
+
J,
|
|
3123
|
+
{
|
|
3124
|
+
value: s,
|
|
3125
|
+
onInput: (T) => l(T.target.value),
|
|
3126
|
+
type: "url",
|
|
3127
|
+
autoFocus: !0,
|
|
3128
|
+
placeholder: "Enter link"
|
|
3129
|
+
}
|
|
3130
|
+
),
|
|
3131
|
+
/* @__PURE__ */ u(Tt, { children: [
|
|
3132
|
+
/* @__PURE__ */ i(U, { onClick: h, children: "Cancel" }),
|
|
3133
|
+
/* @__PURE__ */ i(U, { onClick: d, children: "OK" })
|
|
3134
|
+
] })
|
|
3135
|
+
] })
|
|
3136
|
+
]
|
|
3137
|
+
}
|
|
3138
|
+
)
|
|
3139
|
+
] });
|
|
3140
|
+
}
|
|
3141
|
+
const Ie = `graph TB
|
|
3142
|
+
a-->b`, na = ({ editor: t, attrs: e, extension: r }) => {
|
|
3143
|
+
const { alt: n, align: a } = e, [c, o] = w(decodeURIComponent(n ?? Ie)), [s, l] = w(""), [h, d] = w(!1), x = nt(null), m = r == null ? void 0 : r.options.upload, f = async (T) => {
|
|
3144
|
+
try {
|
|
3145
|
+
const { svg: k } = await Dt.render("mermaid-svg", T);
|
|
3146
|
+
l(k);
|
|
3147
|
+
} catch {
|
|
3148
|
+
l("");
|
|
3149
|
+
}
|
|
3150
|
+
}, p = () => {
|
|
3151
|
+
Dt.initialize({
|
|
3152
|
+
darkMode: !1,
|
|
3153
|
+
startOnLoad: !1,
|
|
3154
|
+
// fontFamily:'',
|
|
3155
|
+
fontSize: 12,
|
|
3156
|
+
theme: "base"
|
|
3157
|
+
}), f(c);
|
|
3158
|
+
};
|
|
3159
|
+
return I(() => {
|
|
3160
|
+
h && p();
|
|
3161
|
+
}, [h]), I(() => {
|
|
3162
|
+
h && f(c);
|
|
3163
|
+
}, [c]), /* @__PURE__ */ u(
|
|
3164
|
+
jt,
|
|
3165
|
+
{
|
|
3166
|
+
open: h,
|
|
3167
|
+
onOpenChange: d,
|
|
3168
|
+
children: [
|
|
3169
|
+
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
3170
|
+
v,
|
|
3171
|
+
{
|
|
3172
|
+
icon: "Pencil",
|
|
3173
|
+
tooltip: "Edit Mermaid",
|
|
3174
|
+
action: () => d(!0)
|
|
3175
|
+
}
|
|
3176
|
+
) }),
|
|
3177
|
+
/* @__PURE__ */ u(Nt, { className: "!richtext-max-w-[1300px] richtext-z-[99999]", children: [
|
|
3178
|
+
/* @__PURE__ */ i(kt, { children: "Edit Mermaid" }),
|
|
3179
|
+
/* @__PURE__ */ i("div", { style: { height: "100%", border: "1px solid hsl(var(--border))" }, children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-gap-[10px] richtext-rounded-[10px] richtext-p-[10px]", children: [
|
|
3180
|
+
/* @__PURE__ */ i(
|
|
3181
|
+
St,
|
|
3182
|
+
{
|
|
3183
|
+
className: "richtext-flex-1",
|
|
3184
|
+
value: c,
|
|
3185
|
+
onChange: (T) => o(T.target.value),
|
|
3186
|
+
autoFocus: !0,
|
|
3187
|
+
required: !0,
|
|
3188
|
+
rows: 10,
|
|
3189
|
+
defaultValue: Ie,
|
|
3190
|
+
placeholder: "Text",
|
|
3191
|
+
style: {
|
|
3192
|
+
color: "hsl(var(--richtext-foreground))"
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
),
|
|
3196
|
+
/* @__PURE__ */ i(
|
|
3197
|
+
"div",
|
|
3198
|
+
{
|
|
3199
|
+
className: "richtext-flex-1 richtext-flex richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
3200
|
+
style: { height: "100%", border: "1px solid hsl(var(--border))", minHeight: 500, background: "#fff" },
|
|
3201
|
+
ref: x,
|
|
3202
|
+
dangerouslySetInnerHTML: { __html: s }
|
|
3203
|
+
}
|
|
3204
|
+
)
|
|
3205
|
+
] }) }),
|
|
3206
|
+
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
3207
|
+
U,
|
|
3208
|
+
{
|
|
3209
|
+
type: "button",
|
|
3210
|
+
onClick: async () => {
|
|
3211
|
+
if (c !== "") {
|
|
3212
|
+
if (c) {
|
|
3213
|
+
const T = x.current.querySelector("svg"), { width: k, height: R } = T.getBoundingClientRect(), $ = `mermaid-${vi()}.svg`;
|
|
3214
|
+
let F = je(T.outerHTML);
|
|
3215
|
+
if (m) {
|
|
3216
|
+
const M = gi(F, $);
|
|
3217
|
+
F = await m(M);
|
|
3218
|
+
}
|
|
3219
|
+
t == null || t.chain().focus().setMermaid(
|
|
3220
|
+
{
|
|
3221
|
+
type: "mermaid",
|
|
3222
|
+
src: F,
|
|
3223
|
+
alt: encodeURIComponent(c),
|
|
3224
|
+
width: k,
|
|
3225
|
+
height: R
|
|
3226
|
+
},
|
|
3227
|
+
!!c
|
|
3228
|
+
).run(), t == null || t.commands.setAlignImageMermaid(a);
|
|
3229
|
+
}
|
|
3230
|
+
d(!1);
|
|
3231
|
+
}
|
|
3232
|
+
},
|
|
3233
|
+
children: "Save changes"
|
|
3234
|
+
}
|
|
3235
|
+
) })
|
|
3236
|
+
] })
|
|
3237
|
+
]
|
|
3238
|
+
}
|
|
3239
|
+
);
|
|
3240
|
+
};
|
|
3241
|
+
function ca(t, e) {
|
|
3242
|
+
const [r, n] = w(void 0);
|
|
3243
|
+
return I(() => {
|
|
3244
|
+
const a = () => {
|
|
3245
|
+
const c = t.extensionManager.extensions.find((o) => o.name === e);
|
|
3246
|
+
c && n(c);
|
|
3247
|
+
};
|
|
3248
|
+
return t.on("selectionUpdate", a), t.on("transaction", a), () => {
|
|
3249
|
+
t.off("selectionUpdate", a), t.off("transaction", a);
|
|
3250
|
+
};
|
|
3251
|
+
}, [t, e]), r;
|
|
3252
|
+
}
|
|
3253
|
+
const aa = {
|
|
3254
|
+
maxWidth: "auto",
|
|
3255
|
+
zIndex: 20,
|
|
3256
|
+
appendTo: "parent",
|
|
3257
|
+
moveTransition: "transform 0.1s ease-out"
|
|
3258
|
+
};
|
|
3259
|
+
function oa({ item: t, disabled: e, editor: r }) {
|
|
3260
|
+
var a;
|
|
3261
|
+
const n = t.component;
|
|
3262
|
+
return n ? /* @__PURE__ */ i(_e, { children: t.type === "divider" ? /* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]" }) : /* @__PURE__ */ i(
|
|
3263
|
+
n,
|
|
3264
|
+
{
|
|
3265
|
+
...t.componentProps,
|
|
3266
|
+
editor: r,
|
|
3267
|
+
disabled: e || ((a = t == null ? void 0 : t.componentProps) == null ? void 0 : a.disabled)
|
|
3268
|
+
}
|
|
3269
|
+
) }) : /* @__PURE__ */ i(_, {});
|
|
3270
|
+
}
|
|
3271
|
+
function sa(t) {
|
|
3272
|
+
return t.type.name === "mermaid";
|
|
3273
|
+
}
|
|
3274
|
+
function la(t) {
|
|
3275
|
+
const { lang: e } = V(), r = At(t.editor, Me.name), n = ca(t.editor, Me.name), a = ({ editor: o }) => {
|
|
3276
|
+
const { selection: s } = o.view.state, { $from: l, to: h } = s;
|
|
3277
|
+
let d = !1;
|
|
3278
|
+
return o.view.state.doc.nodesBetween(l.pos, h, (x) => {
|
|
3279
|
+
if (sa(x))
|
|
3280
|
+
return d = !0, !1;
|
|
3281
|
+
}), d;
|
|
3282
|
+
}, c = P(() => t.disabled ? [] : Na(t.editor), [t.disabled, t.editor, e]);
|
|
3283
|
+
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
3284
|
+
Y,
|
|
3285
|
+
{
|
|
3286
|
+
shouldShow: a,
|
|
3287
|
+
editor: t == null ? void 0 : t.editor,
|
|
3288
|
+
tippyOptions: aa,
|
|
3289
|
+
children: c != null && c.length ? /* @__PURE__ */ i("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative", children: c == null ? void 0 : c.map((o, s) => o.type === "edit" && (r != null && r.src) ? /* @__PURE__ */ i(
|
|
3290
|
+
na,
|
|
3291
|
+
{
|
|
3292
|
+
editor: t.editor,
|
|
3293
|
+
attrs: r,
|
|
3294
|
+
extension: n
|
|
3295
|
+
},
|
|
3296
|
+
`bubbleMenu-mermaid-${s}`
|
|
3297
|
+
) : /* @__PURE__ */ i(
|
|
3298
|
+
oa,
|
|
3299
|
+
{
|
|
3300
|
+
item: o,
|
|
3301
|
+
disabled: t.disabled,
|
|
3302
|
+
editor: t.editor
|
|
3303
|
+
},
|
|
3304
|
+
`bubbleMenu-mermaid-${s}`
|
|
3305
|
+
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
3306
|
+
}
|
|
3307
|
+
) });
|
|
3308
|
+
}
|
|
3309
|
+
function ha({ editor: t, disabled: e }) {
|
|
3310
|
+
const [r, n] = w(!1), { t: a } = V(), c = C(({ editor: l }) => l.isActive(re.name), []), o = (l) => {
|
|
3311
|
+
t.commands.updateTweet({ src: l }), n(!1);
|
|
3312
|
+
}, s = C(() => Ct(re.name, t), [t]);
|
|
3313
|
+
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
3314
|
+
Y,
|
|
3315
|
+
{
|
|
3316
|
+
editor: t,
|
|
3317
|
+
shouldShow: c,
|
|
3318
|
+
tippyOptions: {
|
|
3319
|
+
popperOptions: {
|
|
3320
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
3321
|
+
},
|
|
3322
|
+
placement: "bottom-start",
|
|
3323
|
+
offset: [-2, 16],
|
|
3324
|
+
zIndex: 9999,
|
|
3325
|
+
onHidden: () => {
|
|
3326
|
+
n(!1);
|
|
3327
|
+
}
|
|
3328
|
+
},
|
|
3329
|
+
children: e ? /* @__PURE__ */ i(_, {}) : /* @__PURE__ */ i(_, { children: r ? /* @__PURE__ */ i(
|
|
3330
|
+
bi,
|
|
3331
|
+
{
|
|
3332
|
+
onSetLink: o,
|
|
3333
|
+
editor: t
|
|
3334
|
+
}
|
|
3335
|
+
) : /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800", children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-nowrap", children: [
|
|
3336
|
+
/* @__PURE__ */ i(
|
|
3337
|
+
v,
|
|
3338
|
+
{
|
|
3339
|
+
icon: "Pencil",
|
|
3340
|
+
tooltip: a("editor.link.edit.tooltip"),
|
|
3341
|
+
action: () => {
|
|
3342
|
+
n(!0);
|
|
3343
|
+
},
|
|
3344
|
+
tooltipOptions: { sideOffset: 15 }
|
|
3345
|
+
}
|
|
3346
|
+
),
|
|
3347
|
+
/* @__PURE__ */ i(
|
|
3348
|
+
v,
|
|
3349
|
+
{
|
|
3350
|
+
icon: "Trash",
|
|
3351
|
+
tooltip: a("editor.delete"),
|
|
3352
|
+
action: s,
|
|
3353
|
+
tooltipOptions: { sideOffset: 15 }
|
|
3354
|
+
}
|
|
3355
|
+
)
|
|
3356
|
+
] }) }) })
|
|
3357
|
+
}
|
|
3358
|
+
) });
|
|
3359
|
+
}
|
|
3360
|
+
function da({ editor: t, disabled: e, bubbleMenu: r }) {
|
|
3361
|
+
const n = t.extensionManager.extensions.map((c) => c.name), a = () => {
|
|
3362
|
+
var c, o, s, l, h, d, x, m, f, p, b, T, k;
|
|
3363
|
+
return [
|
|
3364
|
+
n.includes("columns") && !((c = r == null ? void 0 : r.columnConfig) != null && c.hidden) ? /* @__PURE__ */ i(Ba, { editor: t }, "columns") : null,
|
|
3365
|
+
n.includes("table") && !((o = r == null ? void 0 : r.tableConfig) != null && o.hidden) ? /* @__PURE__ */ i(Ia, { editor: t }, "table") : null,
|
|
3366
|
+
n.includes("link") && !((s = r == null ? void 0 : r.linkConfig) != null && s.hidden) ? /* @__PURE__ */ i(Ra, { editor: t, disabled: e }, "link") : null,
|
|
3367
|
+
n.includes("image") && !((l = r == null ? void 0 : r.imageConfig) != null && l.hidden) ? /* @__PURE__ */ i(Ha, { editor: t, disabled: e }, "image") : null,
|
|
3368
|
+
n.includes(wi.name) && !((h = r == null ? void 0 : r.imageGifConfig) != null && h.hidden) ? /* @__PURE__ */ i(Pa, { editor: t, disabled: e }, "imageGif") : null,
|
|
3369
|
+
n.includes("video") && !((d = r == null ? void 0 : r.videoConfig) != null && d.hidden) ? /* @__PURE__ */ i(Da, { editor: t, disabled: e }, "video") : null,
|
|
3370
|
+
n.includes("katex") && !((x = r == null ? void 0 : r.katexConfig) != null && x.hidden) ? /* @__PURE__ */ i(Qc, { editor: t, disabled: e }, "katex") : null,
|
|
3371
|
+
n.includes("excalidraw") && !((m = r == null ? void 0 : r.excalidrawConfig) != null && m.hidden) ? /* @__PURE__ */ i(ia, { editor: t, disabled: e }, "excalidraw") : null,
|
|
3372
|
+
n.includes("mermaid") && !((f = r == null ? void 0 : r.mermaidConfig) != null && f.hidden) ? /* @__PURE__ */ i(la, { editor: t, disabled: e }, "mermaid") : null,
|
|
3373
|
+
n.includes("iframe") && !((p = r == null ? void 0 : r.iframeConfig) != null && p.hidden) ? /* @__PURE__ */ i(ra, { editor: t, disabled: e }, "iframe") : null,
|
|
3374
|
+
n.includes("twitter") && !((b = r == null ? void 0 : r.twitterConfig) != null && b.hidden) ? /* @__PURE__ */ i(ha, { editor: t, disabled: e }, "twitter") : null,
|
|
3375
|
+
(T = r == null ? void 0 : r.floatingMenuConfig) != null && T.hidden ? null : /* @__PURE__ */ i(Sa, { editor: t, disabled: e }, "content"),
|
|
3376
|
+
(k = r == null ? void 0 : r.textConfig) != null && k.hidden ? null : /* @__PURE__ */ i(La, { editor: t, disabled: e }, "text")
|
|
3377
|
+
];
|
|
3378
|
+
};
|
|
3379
|
+
return r != null && r.render ? r.render({ editor: t, disabled: e || !1, bubbleMenu: r }, a()) : a().filter(Boolean);
|
|
3380
|
+
}
|
|
3381
|
+
function Ee() {
|
|
3382
|
+
return /* @__PURE__ */ i("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", children: /* @__PURE__ */ i("path", { fill: "currentColor", d: "M18 14c0-4-6-10.8-6-10.8s-1.33 1.51-2.73 3.52l8.59 8.59c.09-.42.14-.86.14-1.31m-.88 3.12L12.5 12.5L5.27 5.27L4 6.55l3.32 3.32C6.55 11.32 6 12.79 6 14c0 3.31 2.69 6 6 6c1.52 0 2.9-.57 3.96-1.5l2.63 2.63l1.27-1.27z" }) });
|
|
3383
|
+
}
|
|
3384
|
+
function ua(t) {
|
|
3385
|
+
const { t: e } = V(), {
|
|
3386
|
+
highlight: r = !1,
|
|
3387
|
+
disabled: n = !1,
|
|
3388
|
+
selectedColor: a,
|
|
3389
|
+
setSelectedColor: c,
|
|
3390
|
+
onChange: o,
|
|
3391
|
+
colors: s = Hi
|
|
3392
|
+
} = t, l = P(() => {
|
|
3393
|
+
const f = s, p = [];
|
|
3394
|
+
for (let b = 0; b < f.length; b += 10)
|
|
3395
|
+
p.push(f.slice(b, b + 10));
|
|
3396
|
+
return p;
|
|
3397
|
+
}, [s]), [h, d] = w([]), x = (f) => {
|
|
3398
|
+
const p = [...h], b = p.indexOf(f);
|
|
3399
|
+
b !== -1 && p.splice(b, 1), p.unshift(f), p.length > 10 && p.pop(), d(p);
|
|
3400
|
+
};
|
|
3401
|
+
function m(f) {
|
|
3402
|
+
if (f === void 0) {
|
|
3403
|
+
c == null || c(f), o == null || o(f);
|
|
3404
|
+
return;
|
|
3405
|
+
}
|
|
3406
|
+
/^#([\da-f]{3}){1,2}$/i.test(f) && (c == null || c(f), o == null || o(f), x(f));
|
|
3407
|
+
}
|
|
3408
|
+
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
3409
|
+
/* @__PURE__ */ i(ft, { className: "!richtext-p-0", disabled: n, asChild: !0, children: t == null ? void 0 : t.children }),
|
|
3410
|
+
/* @__PURE__ */ i(ct, { hideWhenDetached: !0, className: "richtext-w-full richtext-h-full richtext-p-2", align: "start", side: "bottom", children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col", children: [
|
|
3411
|
+
r ? /* @__PURE__ */ u(
|
|
3412
|
+
"div",
|
|
3413
|
+
{
|
|
3414
|
+
className: "richtext-flex richtext-items-center richtext-p-1 richtext-cursor-pointer rd-1 richtext-gap-[4px] hover:richtext-bg-accent",
|
|
3415
|
+
onClick: () => m(void 0),
|
|
3416
|
+
children: [
|
|
3417
|
+
/* @__PURE__ */ i(Ee, {}),
|
|
3418
|
+
/* @__PURE__ */ i("span", { className: "richtext-ml-1 richtext-text-sm", children: e("editor.nofill") })
|
|
3419
|
+
]
|
|
3420
|
+
}
|
|
3421
|
+
) : /* @__PURE__ */ u(
|
|
3422
|
+
"div",
|
|
3423
|
+
{
|
|
3424
|
+
className: "richtext-flex richtext-items-center richtext-p-1 richtext-cursor-pointer rd-1 richtext-gap-[4px] hover:richtext-bg-accent",
|
|
3425
|
+
onClick: () => {
|
|
3426
|
+
m(void 0);
|
|
3427
|
+
},
|
|
3428
|
+
children: [
|
|
3429
|
+
/* @__PURE__ */ i(Ee, {}),
|
|
3430
|
+
/* @__PURE__ */ i("span", { className: "richtext-ml-1 richtext-text-sm", children: e("editor.default") })
|
|
3431
|
+
]
|
|
3432
|
+
}
|
|
3433
|
+
),
|
|
3434
|
+
l.map((f, p) => /* @__PURE__ */ i("span", { className: "richtext-relative richtext-flex richtext-w-full richtext-h-auto richtext-p-0 last:richtext-pb-2", children: f.map((b, T) => /* @__PURE__ */ i(
|
|
3435
|
+
"span",
|
|
3436
|
+
{
|
|
3437
|
+
className: "richtext-w-6 richtext-h-6 richtext-p-0.5 richtext-inline-block richtext-rounded-sm !richtext-border richtext-border-transparent richtext-flex-[0_0_auto] richtext-cursor-pointer hover:richtext-border-border hover:richtext-shadow-sm",
|
|
3438
|
+
onClick: () => m(b),
|
|
3439
|
+
children: /* @__PURE__ */ i(
|
|
3440
|
+
"span",
|
|
3441
|
+
{
|
|
3442
|
+
style: {
|
|
3443
|
+
backgroundColor: b
|
|
3444
|
+
},
|
|
3445
|
+
className: "richtext-relative richtext-w-[18px] richtext-h-[18px] richtext-block richtext-rounded-[2px] richtext-border-transparent",
|
|
3446
|
+
children: b === a ? /* @__PURE__ */ i(
|
|
3447
|
+
"svg",
|
|
3448
|
+
{
|
|
3449
|
+
className: "richtext-absolute richtext-block richtext-top-[-1px] richtext-left-[1px] richtext-w-3 richtext-h-3",
|
|
3450
|
+
viewBox: "0 0 18 18",
|
|
3451
|
+
style: {
|
|
3452
|
+
fill: "rgb(255, 255, 255)"
|
|
3453
|
+
},
|
|
3454
|
+
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3455
|
+
}
|
|
3456
|
+
) : /* @__PURE__ */ i(
|
|
3457
|
+
"svg",
|
|
3458
|
+
{
|
|
3459
|
+
viewBox: "0 0 18 18",
|
|
3460
|
+
style: {
|
|
3461
|
+
fill: "rgb(255, 255, 255)",
|
|
3462
|
+
display: "none"
|
|
3463
|
+
},
|
|
3464
|
+
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3465
|
+
}
|
|
3466
|
+
)
|
|
3467
|
+
}
|
|
3468
|
+
)
|
|
3469
|
+
},
|
|
3470
|
+
`sub-color-${T}`
|
|
3471
|
+
)) }, p)),
|
|
3472
|
+
/* @__PURE__ */ u("div", { children: [
|
|
3473
|
+
/* @__PURE__ */ i("div", { className: "richtext-my-1 richtext-text-sm", children: e("editor.recent") }),
|
|
3474
|
+
/* @__PURE__ */ i("span", { className: "richtext-relative richtext-flex richtext-w-full richtext-h-auto richtext-p-0 last:richtext-pb-2", children: h == null ? void 0 : h.map((f, p) => /* @__PURE__ */ i(
|
|
3475
|
+
"span",
|
|
3476
|
+
{
|
|
3477
|
+
className: "richtext-w-6 richtext-h-6 richtext-p-0.5 richtext-inline-block richtext-rounded-sm !richtext-border richtext-border-transparent richtext-flex-[0_0_auto] richtext-cursor-pointer hover:richtext-border-border hover:richtext-shadow-sm",
|
|
3478
|
+
onClick: () => m(f),
|
|
3479
|
+
children: /* @__PURE__ */ i(
|
|
3480
|
+
"span",
|
|
3481
|
+
{
|
|
3482
|
+
className: "richtext-relative richtext-w-[18px] richtext-h-[18px] richtext-block richtext-rounded-[2px] richtext-border-transparent",
|
|
3483
|
+
style: {
|
|
3484
|
+
backgroundColor: f
|
|
3485
|
+
},
|
|
3486
|
+
children: /* @__PURE__ */ i(
|
|
3487
|
+
"svg",
|
|
3488
|
+
{
|
|
3489
|
+
viewBox: "0 0 18 18",
|
|
3490
|
+
style: {
|
|
3491
|
+
fill: "rgb(255, 255, 255)",
|
|
3492
|
+
display: "none"
|
|
3493
|
+
},
|
|
3494
|
+
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3495
|
+
}
|
|
3496
|
+
)
|
|
3497
|
+
}
|
|
3498
|
+
)
|
|
3499
|
+
},
|
|
3500
|
+
`sub-color-recent-${p}`
|
|
3501
|
+
)) })
|
|
3502
|
+
] }),
|
|
3503
|
+
/* @__PURE__ */ i(xa, { setColor: m })
|
|
3504
|
+
] }) })
|
|
3505
|
+
] });
|
|
3506
|
+
}
|
|
3507
|
+
function xa({ setColor: t }) {
|
|
3508
|
+
const [e, r] = w("#000000"), [n, a] = w(!1), { t: c } = V();
|
|
3509
|
+
return I(() => () => {
|
|
3510
|
+
a(!1);
|
|
3511
|
+
}, []), /* @__PURE__ */ u(mt, { open: n, children: [
|
|
3512
|
+
/* @__PURE__ */ i(ft, { asChild: !0, children: /* @__PURE__ */ u(
|
|
3513
|
+
"div",
|
|
3514
|
+
{
|
|
3515
|
+
onClick: (o) => {
|
|
3516
|
+
o.preventDefault(), a(!0);
|
|
3517
|
+
},
|
|
3518
|
+
className: "richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent richtext-py-1.5 richtext-px-1.5",
|
|
3519
|
+
children: [
|
|
3520
|
+
c("editor.color.more"),
|
|
3521
|
+
"..."
|
|
3522
|
+
]
|
|
3523
|
+
}
|
|
3524
|
+
) }),
|
|
3525
|
+
/* @__PURE__ */ u(ct, { children: [
|
|
3526
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col richtext-items-center richtext-justify-center", children: [
|
|
3527
|
+
/* @__PURE__ */ i(xn, { color: e, onChange: r }),
|
|
3528
|
+
/* @__PURE__ */ i(
|
|
3529
|
+
J,
|
|
3530
|
+
{
|
|
3531
|
+
className: "richtext-mt-[8px] richtext-w-full",
|
|
3532
|
+
type: "text",
|
|
3533
|
+
onChange: (o) => {
|
|
3534
|
+
o.preventDefault(), r(`#${o.target.value}`);
|
|
3535
|
+
},
|
|
3536
|
+
value: e.slice(1)
|
|
3537
|
+
}
|
|
3538
|
+
)
|
|
3539
|
+
] }),
|
|
3540
|
+
/* @__PURE__ */ i(Q, { className: "richtext-my-[10px]" }),
|
|
3541
|
+
/* @__PURE__ */ i(
|
|
3542
|
+
U,
|
|
3543
|
+
{
|
|
3544
|
+
onClick: (o) => {
|
|
3545
|
+
o.preventDefault(), t(e), a(!1);
|
|
3546
|
+
},
|
|
3547
|
+
className: "richtext-w-full",
|
|
3548
|
+
children: /* @__PURE__ */ i(Ge, { size: 16 })
|
|
3549
|
+
}
|
|
3550
|
+
)
|
|
3551
|
+
] })
|
|
3552
|
+
] });
|
|
3553
|
+
}
|
|
3554
|
+
function ma({ editor: t, disabled: e, toolbar: r }) {
|
|
3555
|
+
const { t: n, lang: a } = V(), c = P(() => {
|
|
3556
|
+
const h = [...t.extensionManager.extensions].sort((x, m) => {
|
|
3557
|
+
const f = x.options.sort ?? -1, p = m.options.sort ?? -1;
|
|
3558
|
+
return f - p;
|
|
3559
|
+
});
|
|
3560
|
+
let d = [];
|
|
3561
|
+
for (const x of h) {
|
|
3562
|
+
const {
|
|
3563
|
+
button: m,
|
|
3564
|
+
divider: f = !1,
|
|
3565
|
+
spacer: p = !1,
|
|
3566
|
+
toolbar: b = !0
|
|
3567
|
+
} = x.options;
|
|
3568
|
+
if (!m || !bn(m) || !b)
|
|
3569
|
+
continue;
|
|
3570
|
+
const T = m({
|
|
3571
|
+
editor: t,
|
|
3572
|
+
extension: x,
|
|
3573
|
+
t: n
|
|
3574
|
+
});
|
|
3575
|
+
if (Array.isArray(T)) {
|
|
3576
|
+
const k = T.map((R, $) => ({
|
|
3577
|
+
button: R,
|
|
3578
|
+
divider: $ === T.length - 1 ? f : !1,
|
|
3579
|
+
spacer: $ === 0 ? p : !1,
|
|
3580
|
+
type: x.type,
|
|
3581
|
+
name: x.name
|
|
3582
|
+
}));
|
|
3583
|
+
d = [...d, ...k];
|
|
3584
|
+
continue;
|
|
3585
|
+
}
|
|
3586
|
+
d.push({
|
|
3587
|
+
button: T,
|
|
3588
|
+
divider: f,
|
|
3589
|
+
spacer: p,
|
|
3590
|
+
type: x.type,
|
|
3591
|
+
name: x.name
|
|
3592
|
+
});
|
|
3593
|
+
}
|
|
3594
|
+
return d;
|
|
3595
|
+
}, [t, n, a]), o = (l) => /* @__PURE__ */ i(
|
|
3596
|
+
"div",
|
|
3597
|
+
{
|
|
3598
|
+
className: "richtext-px-1 richtext-py-2 !richtext-border-b",
|
|
3599
|
+
style: {
|
|
3600
|
+
pointerEvents: e ? "none" : "auto",
|
|
3601
|
+
opacity: e ? 0.5 : 1
|
|
3602
|
+
},
|
|
3603
|
+
children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-flex-wrap richtext-h-auto richtext-gap-y-1 richtext-gap-x-1", children: l })
|
|
3604
|
+
}
|
|
3605
|
+
), s = c.map((l, h) => {
|
|
3606
|
+
var x, m;
|
|
3607
|
+
const d = l.button.component;
|
|
3608
|
+
return /* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center", children: [
|
|
3609
|
+
(l == null ? void 0 : l.spacer) && /* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-h-[16px] !richtext-mx-[10px]" }),
|
|
3610
|
+
/* @__PURE__ */ i(
|
|
3611
|
+
d,
|
|
3612
|
+
{
|
|
3613
|
+
...l.button.componentProps,
|
|
3614
|
+
disabled: e || ((m = (x = l == null ? void 0 : l.button) == null ? void 0 : x.componentProps) == null ? void 0 : m.disabled)
|
|
3615
|
+
}
|
|
3616
|
+
),
|
|
3617
|
+
(l == null ? void 0 : l.divider) && /* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-h-auto !richtext-mx-2" })
|
|
3618
|
+
] }, `toolbar-item-${h}`);
|
|
3619
|
+
});
|
|
3620
|
+
return r && (r != null && r.render) ? r.render({ editor: t, disabled: e || !1 }, c, s, o) : o(s);
|
|
3621
|
+
}
|
|
3622
|
+
function fa(t) {
|
|
3623
|
+
const e = ["size-small", "size-medium", "size-large"], r = [
|
|
3624
|
+
"SizeS",
|
|
3625
|
+
"SizeM",
|
|
3626
|
+
"SizeL"
|
|
3627
|
+
];
|
|
3628
|
+
return e.map((n, a) => ({
|
|
3629
|
+
type: `image-${n}`,
|
|
3630
|
+
component: v,
|
|
3631
|
+
componentProps: {
|
|
3632
|
+
tooltip: Z.t(`editor.${n.replace("-", ".")}.tooltip`),
|
|
3633
|
+
icon: r[a],
|
|
3634
|
+
action: () => t.commands.updateImage({ width: Ht[n] }),
|
|
3635
|
+
isActive: () => t.isActive("image", { width: Ht[n] })
|
|
3636
|
+
}
|
|
3637
|
+
}));
|
|
3638
|
+
}
|
|
3639
|
+
function ga(t) {
|
|
3640
|
+
const e = ["size-small", "size-medium", "size-large"], r = [
|
|
3641
|
+
"SizeS",
|
|
3642
|
+
"SizeM",
|
|
3643
|
+
"SizeL"
|
|
3644
|
+
];
|
|
3645
|
+
return e.map((n, a) => ({
|
|
3646
|
+
type: `image-${n}`,
|
|
3647
|
+
component: v,
|
|
3648
|
+
componentProps: {
|
|
3649
|
+
tooltip: Z.t(`editor.${n.replace("-", ".")}.tooltip`),
|
|
3650
|
+
icon: r[a],
|
|
3651
|
+
action: () => t.commands.updateImageGif({ width: Ht[n] }),
|
|
3652
|
+
isActive: () => t.isActive("image", { width: Ht[n] })
|
|
3653
|
+
}
|
|
3654
|
+
}));
|
|
3655
|
+
}
|
|
3656
|
+
function pa(t) {
|
|
3657
|
+
const e = ["left", "center", "right"], r = {
|
|
3658
|
+
left: "AlignLeft",
|
|
3659
|
+
center: "AlignCenter",
|
|
3660
|
+
right: "AlignRight"
|
|
3661
|
+
};
|
|
3662
|
+
return e.map((n) => ({
|
|
3663
|
+
type: `image-${n}`,
|
|
3664
|
+
component: v,
|
|
3665
|
+
componentProps: {
|
|
3666
|
+
tooltip: Z.t(`editor.textalign.${n}.tooltip`),
|
|
3667
|
+
icon: r[n],
|
|
3668
|
+
action: () => {
|
|
3669
|
+
var a, c;
|
|
3670
|
+
return (c = (a = t.commands) == null ? void 0 : a.setAlignImage) == null ? void 0 : c.call(a, n);
|
|
3671
|
+
},
|
|
3672
|
+
isActive: () => t.isActive({ align: n }) || !1,
|
|
3673
|
+
disabled: !1
|
|
3674
|
+
}
|
|
3675
|
+
}));
|
|
3676
|
+
}
|
|
3677
|
+
function wa(t) {
|
|
3678
|
+
const e = ["left", "center", "right"], r = {
|
|
3679
|
+
left: "AlignLeft",
|
|
3680
|
+
center: "AlignCenter",
|
|
3681
|
+
right: "AlignRight"
|
|
3682
|
+
};
|
|
3683
|
+
return e.map((n) => ({
|
|
3684
|
+
type: `image-${n}`,
|
|
3685
|
+
component: v,
|
|
3686
|
+
componentProps: {
|
|
3687
|
+
tooltip: Z.t(`editor.textalign.${n}.tooltip`),
|
|
3688
|
+
icon: r[n],
|
|
3689
|
+
action: () => {
|
|
3690
|
+
var a, c;
|
|
3691
|
+
return (c = (a = t.commands) == null ? void 0 : a.setAlignImageGif) == null ? void 0 : c.call(a, n);
|
|
3692
|
+
},
|
|
3693
|
+
isActive: () => t.isActive({ align: n }) || !1,
|
|
3694
|
+
disabled: !1
|
|
3695
|
+
}
|
|
3696
|
+
}));
|
|
3697
|
+
}
|
|
3698
|
+
function va(t) {
|
|
3699
|
+
const e = ["left", "center", "right"], r = {
|
|
3700
|
+
left: "AlignLeft",
|
|
3701
|
+
center: "AlignCenter",
|
|
3702
|
+
right: "AlignRight"
|
|
3703
|
+
};
|
|
3704
|
+
return e.map((n) => ({
|
|
3705
|
+
type: `image-${n}`,
|
|
3706
|
+
component: v,
|
|
3707
|
+
componentProps: {
|
|
3708
|
+
tooltip: Z.t(`editor.textalign.${n}.tooltip`),
|
|
3709
|
+
icon: r[n],
|
|
3710
|
+
action: () => {
|
|
3711
|
+
var a, c;
|
|
3712
|
+
return (c = (a = t.commands) == null ? void 0 : a.setAlignImageMermaid) == null ? void 0 : c.call(a, n);
|
|
3713
|
+
},
|
|
3714
|
+
isActive: () => t.isActive({ align: n }) || !1,
|
|
3715
|
+
disabled: !1
|
|
3716
|
+
}
|
|
3717
|
+
}));
|
|
3718
|
+
}
|
|
3719
|
+
function ba(t) {
|
|
3720
|
+
const e = ["size-small", "size-medium", "size-large"], r = [
|
|
3721
|
+
"SizeS",
|
|
3722
|
+
"SizeM",
|
|
3723
|
+
"SizeL"
|
|
3724
|
+
];
|
|
3725
|
+
return e.map((n, a) => ({
|
|
3726
|
+
type: `video-${n}`,
|
|
3727
|
+
component: v,
|
|
3728
|
+
componentProps: {
|
|
3729
|
+
tooltip: Z.t(`editor.${n.replace("-", ".")}.tooltip`),
|
|
3730
|
+
icon: r[a],
|
|
3731
|
+
action: () => t.commands.updateVideo({ width: fe[n] }),
|
|
3732
|
+
isActive: () => t.isActive("video", { width: fe[n] })
|
|
3733
|
+
}
|
|
3734
|
+
}));
|
|
3735
|
+
}
|
|
3736
|
+
function ya(t) {
|
|
3737
|
+
return [
|
|
3738
|
+
{
|
|
3739
|
+
type: "flipX",
|
|
3740
|
+
component: v,
|
|
3741
|
+
componentProps: {
|
|
3742
|
+
editor: t,
|
|
3743
|
+
tooltip: Z.t("editor.tooltip.flipX"),
|
|
3744
|
+
icon: "FlipX",
|
|
3745
|
+
action: () => {
|
|
3746
|
+
const e = t.getAttributes("image"), { flipX: r } = e;
|
|
3747
|
+
t.chain().focus(void 0, { scrollIntoView: !1 }).updateImage({
|
|
3748
|
+
flipX: !r
|
|
3749
|
+
}).run();
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
},
|
|
3753
|
+
{
|
|
3754
|
+
type: "flipY",
|
|
3755
|
+
component: v,
|
|
3756
|
+
componentProps: {
|
|
3757
|
+
editor: t,
|
|
3758
|
+
tooltip: Z.t("editor.tooltip.flipY"),
|
|
3759
|
+
icon: "FlipY",
|
|
3760
|
+
action: () => {
|
|
3761
|
+
const e = t.getAttributes("image"), { flipY: r } = e;
|
|
3762
|
+
t.chain().focus(void 0, { scrollIntoView: !1 }).updateImage({
|
|
3763
|
+
flipY: !r
|
|
3764
|
+
}).run();
|
|
3765
|
+
}
|
|
3766
|
+
}
|
|
3767
|
+
},
|
|
3768
|
+
...fa(t),
|
|
3769
|
+
...pa(t),
|
|
3770
|
+
{
|
|
3771
|
+
type: "remove",
|
|
3772
|
+
component: v,
|
|
3773
|
+
componentProps: {
|
|
3774
|
+
editor: t,
|
|
3775
|
+
tooltip: Z.t("editor.remove"),
|
|
3776
|
+
icon: "Trash2",
|
|
3777
|
+
action: () => {
|
|
3778
|
+
const { state: e, dispatch: r } = t.view;
|
|
3779
|
+
Wt(e, r);
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
}
|
|
3783
|
+
];
|
|
3784
|
+
}
|
|
3785
|
+
function Ca(t) {
|
|
3786
|
+
return [
|
|
3787
|
+
...ga(t),
|
|
3788
|
+
...wa(t),
|
|
3789
|
+
{
|
|
3790
|
+
type: "remove",
|
|
3791
|
+
component: v,
|
|
3792
|
+
componentProps: {
|
|
3793
|
+
editor: t,
|
|
3794
|
+
tooltip: Z.t("editor.remove"),
|
|
3795
|
+
icon: "Trash2",
|
|
3796
|
+
action: () => {
|
|
3797
|
+
const { state: e, dispatch: r } = t.view;
|
|
3798
|
+
Wt(e, r);
|
|
3799
|
+
}
|
|
3800
|
+
}
|
|
3801
|
+
}
|
|
3802
|
+
];
|
|
3803
|
+
}
|
|
3804
|
+
function Na(t) {
|
|
3805
|
+
return [
|
|
3806
|
+
...va(t),
|
|
3807
|
+
{
|
|
3808
|
+
type: "edit",
|
|
3809
|
+
component: v,
|
|
3810
|
+
componentProps: {
|
|
3811
|
+
editor: t,
|
|
3812
|
+
tooltip: Z.t("editor.edit"),
|
|
3813
|
+
icon: "Pencil",
|
|
3814
|
+
action: () => {
|
|
3815
|
+
}
|
|
3816
|
+
}
|
|
3817
|
+
},
|
|
3818
|
+
{
|
|
3819
|
+
type: "remove",
|
|
3820
|
+
component: v,
|
|
3821
|
+
componentProps: {
|
|
3822
|
+
editor: t,
|
|
3823
|
+
tooltip: Z.t("editor.remove"),
|
|
3824
|
+
icon: "Trash2",
|
|
3825
|
+
action: () => {
|
|
3826
|
+
const { state: e, dispatch: r } = t.view;
|
|
3827
|
+
Wt(e, r);
|
|
3828
|
+
}
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
];
|
|
3832
|
+
}
|
|
3833
|
+
function Ta(t) {
|
|
3834
|
+
return [
|
|
3835
|
+
...ba(t),
|
|
3836
|
+
{
|
|
3837
|
+
type: "remove",
|
|
3838
|
+
component: v,
|
|
3839
|
+
componentProps: {
|
|
3840
|
+
editor: t,
|
|
3841
|
+
tooltip: Z.t("editor.remove"),
|
|
3842
|
+
icon: "Trash2",
|
|
3843
|
+
action: () => {
|
|
3844
|
+
const { state: e, dispatch: r } = t.view;
|
|
3845
|
+
Wt(e, r);
|
|
3846
|
+
}
|
|
3847
|
+
}
|
|
3848
|
+
}
|
|
3849
|
+
];
|
|
3850
|
+
}
|
|
3851
|
+
function ka(t, e) {
|
|
3852
|
+
return Pi.reduce((r, n) => {
|
|
3853
|
+
if (n === "divider" && r.length > 0)
|
|
3854
|
+
return [...r, {
|
|
3855
|
+
type: "divider",
|
|
3856
|
+
component: void 0,
|
|
3857
|
+
componentProps: {}
|
|
3858
|
+
}];
|
|
3859
|
+
const a = t.extensionManager.extensions.find((c) => c.name === n);
|
|
3860
|
+
return a ? [...r, a.configure().options.button({ editor: t, t: e, extension: a })] : r;
|
|
3861
|
+
}, []);
|
|
3862
|
+
}
|
|
3863
|
+
function Sa(t) {
|
|
3864
|
+
var N, H, y;
|
|
3865
|
+
const { pluginKey: e = Ii } = t, { t: r } = V(), [n, a] = w(null), [c, o] = w(-1), s = nt(null), l = nt(null), [h, d] = w(!1), x = t.editor.extensionManager.extensions.some((g) => g.name === "textAlign"), m = t.editor.extensionManager.extensions.some((g) => g.name === "indent"), f = t.editor.extensionManager.extensions.some((g) => g.name === "clear");
|
|
3866
|
+
I(() => {
|
|
3867
|
+
s.current && !t.editor.isDestroyed && (l.current = Ei({
|
|
3868
|
+
editor: t.editor,
|
|
3869
|
+
element: s.current,
|
|
3870
|
+
pluginKey: "ContentItemMenu",
|
|
3871
|
+
tippyOptions: {
|
|
3872
|
+
offset: [-2, 16],
|
|
3873
|
+
zIndex: 99,
|
|
3874
|
+
moveTransition: "transform 0.15s ease-out"
|
|
3875
|
+
},
|
|
3876
|
+
onNodeChange: M
|
|
3877
|
+
}), t.editor.registerPlugin(l.current));
|
|
3878
|
+
}, [t.editor, s]);
|
|
3879
|
+
function p() {
|
|
3880
|
+
const g = t.editor.chain();
|
|
3881
|
+
g.setNodeSelection(c).unsetAllMarks(), (n == null ? void 0 : n.type.name) !== "paragraph" && g.setParagraph(), g.run();
|
|
3882
|
+
}
|
|
3883
|
+
function b() {
|
|
3884
|
+
t.editor.chain().focus().setNodeSelection(c).run(), document.execCommand("copy");
|
|
3885
|
+
}
|
|
3886
|
+
function T() {
|
|
3887
|
+
t.editor.commands.setNodeSelection(c);
|
|
3888
|
+
const { $anchor: g } = t.editor.state.selection, O = g.node(1) || t.editor.state.selection.node;
|
|
3889
|
+
t.editor.chain().setMeta("hideDragHandle", !0).insertContentAt(c + ((n == null ? void 0 : n.nodeSize) || 0), O.toJSON()).run();
|
|
3890
|
+
}
|
|
3891
|
+
function k(g) {
|
|
3892
|
+
t.editor.commands.setTextAlign(g);
|
|
3893
|
+
}
|
|
3894
|
+
function R() {
|
|
3895
|
+
const g = ee(t.editor.state.tr, c, 1);
|
|
3896
|
+
g.setMeta("hideDragHandle", !0), t.editor.view.dispatch && t.editor.view.dispatch(g);
|
|
3897
|
+
}
|
|
3898
|
+
function $() {
|
|
3899
|
+
const g = ee(t.editor.state.tr, c, -1);
|
|
3900
|
+
t.editor.view.dispatch && t.editor.view.dispatch(g);
|
|
3901
|
+
}
|
|
3902
|
+
function F() {
|
|
3903
|
+
t.editor.chain().setMeta("hideDragHandle", !0).setNodeSelection(c).deleteSelection().run();
|
|
3904
|
+
}
|
|
3905
|
+
function M(g) {
|
|
3906
|
+
g.node && a(g.node), o(g.pos);
|
|
3907
|
+
}
|
|
3908
|
+
function B() {
|
|
3909
|
+
var g;
|
|
3910
|
+
if (c !== -1) {
|
|
3911
|
+
const O = (n == null ? void 0 : n.nodeSize) || 0, S = c + O, z = (n == null ? void 0 : n.type.name) === "paragraph" && ((g = n == null ? void 0 : n.content) == null ? void 0 : g.size) === 0, A = z ? c + 2 : S + 2;
|
|
3912
|
+
t.editor.chain().command(({ dispatch: K, tr: j, state: Mt }) => K ? (z ? j.insertText("/", c, c + 1) : j.insert(
|
|
3913
|
+
S,
|
|
3914
|
+
Mt.schema.nodes.paragraph.create(null, [Mt.schema.text("/")])
|
|
3915
|
+
), K(j)) : !0).focus(A).run();
|
|
3916
|
+
}
|
|
3917
|
+
}
|
|
3918
|
+
I(() => (h ? t.editor.commands.setMeta("lockDragHandle", !0) : t.editor.commands.setMeta("lockDragHandle", !1), () => {
|
|
3919
|
+
t.editor.commands.setMeta("lockDragHandle", !1);
|
|
3920
|
+
}), [h]), I(() => () => {
|
|
3921
|
+
l.current && (t.editor.unregisterPlugin(e), l.current = null);
|
|
3922
|
+
}, []), I(() => {
|
|
3923
|
+
var g;
|
|
3924
|
+
(g = t.editor) != null && g.isDestroyed && l.current && (t.editor.unregisterPlugin(e), l.current = null);
|
|
3925
|
+
}, [(N = t.editor) == null ? void 0 : N.isDestroyed]);
|
|
3926
|
+
const W = (g) => {
|
|
3927
|
+
t != null && t.disabled || d(g);
|
|
3928
|
+
};
|
|
3929
|
+
return /* @__PURE__ */ i(
|
|
3930
|
+
"div",
|
|
3931
|
+
{
|
|
3932
|
+
className: `drag-handle [transition-property:top,_left] richtext-ease-in-out richtext-duration-200 ${t == null ? void 0 : t.className}`,
|
|
3933
|
+
style: {
|
|
3934
|
+
opacity: t != null && t.disabled ? 0 : 1
|
|
3935
|
+
},
|
|
3936
|
+
ref: s,
|
|
3937
|
+
children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-gap-0.5 [transition-property:top,_left] richtext-ease-in-out richtext-duration-200", children: [
|
|
3938
|
+
/* @__PURE__ */ i(
|
|
3939
|
+
U,
|
|
3940
|
+
{
|
|
3941
|
+
variant: "ghost",
|
|
3942
|
+
size: "icon",
|
|
3943
|
+
className: "richtext-w-7 richtext-h-7 richtext-cursor-grab",
|
|
3944
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
3945
|
+
onClick: B,
|
|
3946
|
+
type: "button",
|
|
3947
|
+
children: /* @__PURE__ */ i(G, { name: "Plus", className: "richtext-text-lg richtext-text-neutral-600 dark:richtext-text-neutral-200" })
|
|
3948
|
+
}
|
|
3949
|
+
),
|
|
3950
|
+
/* @__PURE__ */ u(Nn, { open: h, onOpenChange: W, children: [
|
|
3951
|
+
/* @__PURE__ */ u("div", { className: "richtext-relative richtext-flex richtext-flex-col", children: [
|
|
3952
|
+
/* @__PURE__ */ u(hi, { children: [
|
|
3953
|
+
/* @__PURE__ */ i(di, { asChild: !0, disabled: t == null ? void 0 : t.disabled, children: /* @__PURE__ */ i(
|
|
3954
|
+
U,
|
|
3955
|
+
{
|
|
3956
|
+
variant: "ghost",
|
|
3957
|
+
size: "icon",
|
|
3958
|
+
className: "richtext-w-7 richtext-h-7 richtext-cursor-grab richtext-relative richtext-z-[1]",
|
|
3959
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
3960
|
+
onMouseUp: (g) => {
|
|
3961
|
+
g.preventDefault(), !(t != null && t.disabled) && d(!0);
|
|
3962
|
+
},
|
|
3963
|
+
type: "button",
|
|
3964
|
+
children: /* @__PURE__ */ i(G, { name: "Grip", className: "richtext-text-sm dark:richtext-text-neutral-200 richtext-text-neutral-600" })
|
|
3965
|
+
}
|
|
3966
|
+
) }),
|
|
3967
|
+
/* @__PURE__ */ i(oe, { children: r("editor.draghandle.tooltip") })
|
|
3968
|
+
] }),
|
|
3969
|
+
/* @__PURE__ */ i(Tn, { className: "richtext-absolute richtext-top-0 richtext-left-0 richtext-w-[28px] richtext-h-[28px] richtext-z-0" })
|
|
3970
|
+
] }),
|
|
3971
|
+
/* @__PURE__ */ u(ei, { className: "richtext-w-48", align: "start", side: "bottom", sideOffset: 0, children: [
|
|
3972
|
+
/* @__PURE__ */ u(
|
|
3973
|
+
tt,
|
|
3974
|
+
{
|
|
3975
|
+
onClick: F,
|
|
3976
|
+
className: "richtext-flex richtext-gap-3 focus:richtext-text-red-500 focus:richtext-bg-red-400 hover:richtext-bg-red-400 dark:hover:richtext-text-red-500 richtext-bg-opacity-10 hover:richtext-bg-opacity-20 focus:richtext-bg-opacity-30 dark:hover:richtext-bg-opacity-20",
|
|
3977
|
+
children: [
|
|
3978
|
+
/* @__PURE__ */ i(G, { name: "Trash2" }),
|
|
3979
|
+
/* @__PURE__ */ i("span", { children: r("editor.remove") })
|
|
3980
|
+
]
|
|
3981
|
+
}
|
|
3982
|
+
),
|
|
3983
|
+
f ? /* @__PURE__ */ u(tt, { className: "richtext-flex richtext-gap-3", onClick: p, children: [
|
|
3984
|
+
/* @__PURE__ */ i(G, { name: "PaintRoller" }),
|
|
3985
|
+
/* @__PURE__ */ i("span", { children: r("editor.clear.tooltip") })
|
|
3986
|
+
] }) : null,
|
|
3987
|
+
/* @__PURE__ */ u(tt, { className: "richtext-flex richtext-gap-3", onClick: b, children: [
|
|
3988
|
+
/* @__PURE__ */ i(G, { name: "Clipboard" }),
|
|
3989
|
+
/* @__PURE__ */ i("span", { children: r("editor.copyToClipboard") })
|
|
3990
|
+
] }),
|
|
3991
|
+
/* @__PURE__ */ u(tt, { className: "richtext-flex richtext-gap-3", onClick: T, children: [
|
|
3992
|
+
/* @__PURE__ */ i(G, { name: "Copy" }),
|
|
3993
|
+
/* @__PURE__ */ i("span", { children: r("editor.copy") })
|
|
3994
|
+
] }),
|
|
3995
|
+
x || m ? /* @__PURE__ */ i(ii, {}) : null,
|
|
3996
|
+
x ? /* @__PURE__ */ u(be, { children: [
|
|
3997
|
+
/* @__PURE__ */ u(Jt, { className: "richtext-flex richtext-gap-3", children: [
|
|
3998
|
+
/* @__PURE__ */ i(G, { name: "AlignCenter" }),
|
|
3999
|
+
/* @__PURE__ */ i("span", { children: r("editor.textalign.tooltip") })
|
|
4000
|
+
] }),
|
|
4001
|
+
/* @__PURE__ */ i(ve, { children: /* @__PURE__ */ u(Qt, { children: [
|
|
4002
|
+
/* @__PURE__ */ u(tt, { className: "richtext-flex richtext-gap-3", onClick: () => k("left"), children: [
|
|
4003
|
+
/* @__PURE__ */ i(G, { name: "AlignLeft" }),
|
|
4004
|
+
/* @__PURE__ */ i("span", { children: r("editor.textalign.left.tooltip") })
|
|
4005
|
+
] }),
|
|
4006
|
+
/* @__PURE__ */ u(tt, { className: "richtext-flex richtext-gap-3", onClick: () => k("center"), children: [
|
|
4007
|
+
/* @__PURE__ */ i(G, { name: "AlignCenter" }),
|
|
4008
|
+
/* @__PURE__ */ i("span", { children: r("editor.textalign.center.tooltip") })
|
|
4009
|
+
] }),
|
|
4010
|
+
/* @__PURE__ */ u(tt, { className: "richtext-flex richtext-gap-3", onClick: () => k("right"), children: [
|
|
4011
|
+
/* @__PURE__ */ i(G, { name: "AlignRight" }),
|
|
4012
|
+
/* @__PURE__ */ i("span", { children: r("editor.textalign.right.tooltip") })
|
|
4013
|
+
] })
|
|
4014
|
+
] }) })
|
|
4015
|
+
] }) : null,
|
|
4016
|
+
m ? /* @__PURE__ */ u(be, { children: [
|
|
4017
|
+
/* @__PURE__ */ u(Jt, { className: "richtext-flex richtext-gap-3", children: [
|
|
4018
|
+
/* @__PURE__ */ i(G, { name: "IndentIncrease" }),
|
|
4019
|
+
/* @__PURE__ */ i("span", { children: r("editor.indent") })
|
|
4020
|
+
] }),
|
|
4021
|
+
/* @__PURE__ */ i(ve, { children: /* @__PURE__ */ u(Qt, { children: [
|
|
4022
|
+
/* @__PURE__ */ u(
|
|
4023
|
+
tt,
|
|
4024
|
+
{
|
|
4025
|
+
className: "richtext-flex richtext-gap-3",
|
|
4026
|
+
onClick: R,
|
|
4027
|
+
disabled: ((H = n == null ? void 0 : n.attrs) == null ? void 0 : H.indent) >= te.max,
|
|
4028
|
+
children: [
|
|
4029
|
+
/* @__PURE__ */ i(G, { name: "IndentIncrease" }),
|
|
4030
|
+
/* @__PURE__ */ i("span", { children: r("editor.indent.tooltip") })
|
|
4031
|
+
]
|
|
4032
|
+
}
|
|
4033
|
+
),
|
|
4034
|
+
/* @__PURE__ */ u(
|
|
4035
|
+
tt,
|
|
4036
|
+
{
|
|
4037
|
+
className: "richtext-flex richtext-gap-3",
|
|
4038
|
+
onClick: $,
|
|
4039
|
+
disabled: ((y = n == null ? void 0 : n.attrs) == null ? void 0 : y.indent) <= te.min,
|
|
4040
|
+
children: [
|
|
4041
|
+
/* @__PURE__ */ i(G, { name: "IndentDecrease" }),
|
|
4042
|
+
/* @__PURE__ */ i("span", { children: r("editor.outdent.tooltip") })
|
|
4043
|
+
]
|
|
4044
|
+
}
|
|
4045
|
+
)
|
|
4046
|
+
] }) })
|
|
4047
|
+
] }) : null
|
|
4048
|
+
] })
|
|
4049
|
+
] })
|
|
4050
|
+
] })
|
|
4051
|
+
}
|
|
4052
|
+
);
|
|
4053
|
+
}
|
|
4054
|
+
const Aa = {
|
|
4055
|
+
maxWidth: "auto",
|
|
4056
|
+
zIndex: 20,
|
|
4057
|
+
appendTo: "parent",
|
|
4058
|
+
moveTransition: "transform 0.1s ease-out"
|
|
4059
|
+
};
|
|
4060
|
+
function Ma({ item: t, disabled: e, editor: r }) {
|
|
4061
|
+
var a;
|
|
4062
|
+
const n = t.component;
|
|
4063
|
+
return n ? /* @__PURE__ */ i(
|
|
4064
|
+
n,
|
|
4065
|
+
{
|
|
4066
|
+
...t.componentProps,
|
|
4067
|
+
editor: r,
|
|
4068
|
+
disabled: e || ((a = t == null ? void 0 : t.componentProps) == null ? void 0 : a.disabled)
|
|
4069
|
+
}
|
|
4070
|
+
) : /* @__PURE__ */ i(_, {});
|
|
4071
|
+
}
|
|
4072
|
+
function La(t) {
|
|
4073
|
+
const { t: e, lang: r } = V(), n = ({ editor: c }) => {
|
|
4074
|
+
const { selection: o } = c.view.state, { $from: s, to: l } = o;
|
|
4075
|
+
return s.pos === l ? !1 : o instanceof bt;
|
|
4076
|
+
}, a = P(() => t.disabled || !(t != null && t.editor) ? [] : ka(t.editor, e), [t.disabled, t.editor, r, e]);
|
|
4077
|
+
return /* @__PURE__ */ i(Y, { shouldShow: n, editor: t == null ? void 0 : t.editor, tippyOptions: Aa, children: a != null && a.length ? /* @__PURE__ */ i("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-gap-[4px] richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative", children: a == null ? void 0 : a.map((c, o) => (c == null ? void 0 : c.type) === "divider" ? /* @__PURE__ */ i(
|
|
4078
|
+
Q,
|
|
4079
|
+
{
|
|
4080
|
+
orientation: "vertical",
|
|
4081
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"
|
|
4082
|
+
},
|
|
4083
|
+
`bubbleMenu-divider-${o}`
|
|
4084
|
+
) : /* @__PURE__ */ i(
|
|
4085
|
+
Ma,
|
|
4086
|
+
{
|
|
4087
|
+
item: c,
|
|
4088
|
+
disabled: t.disabled,
|
|
4089
|
+
editor: t.editor
|
|
4090
|
+
},
|
|
4091
|
+
`bubbleMenu-text-${o}`
|
|
4092
|
+
)) }) }) : /* @__PURE__ */ i(_, {}) });
|
|
4093
|
+
}
|
|
4094
|
+
function Ia({ editor: t, disabled: e }) {
|
|
4095
|
+
var b, T, k, R, $, F, M, B, W, N, H, y, g, O, S, z, A, K;
|
|
4096
|
+
const r = ({ editor: j }) => Ri(j.view.state, "table"), { t: n } = V();
|
|
4097
|
+
function a() {
|
|
4098
|
+
t.chain().focus().addColumnBefore().run();
|
|
4099
|
+
}
|
|
4100
|
+
function c() {
|
|
4101
|
+
t.chain().focus().addColumnAfter().run();
|
|
4102
|
+
}
|
|
4103
|
+
function o() {
|
|
4104
|
+
t.chain().focus().deleteColumn().run();
|
|
4105
|
+
}
|
|
4106
|
+
function s() {
|
|
4107
|
+
t.chain().focus().addRowBefore().run();
|
|
4108
|
+
}
|
|
4109
|
+
function l() {
|
|
4110
|
+
t.chain().focus().addRowAfter().run();
|
|
4111
|
+
}
|
|
4112
|
+
function h() {
|
|
4113
|
+
t.chain().focus().deleteRow().run();
|
|
4114
|
+
}
|
|
4115
|
+
function d() {
|
|
4116
|
+
t.chain().focus().mergeCells().run();
|
|
4117
|
+
}
|
|
4118
|
+
function x() {
|
|
4119
|
+
t == null || t.chain().focus().splitCell().run();
|
|
4120
|
+
}
|
|
4121
|
+
function m() {
|
|
4122
|
+
t.chain().focus().deleteTable().run();
|
|
4123
|
+
}
|
|
4124
|
+
function f(j) {
|
|
4125
|
+
t.chain().focus().setTableCellBackground(j).run();
|
|
4126
|
+
}
|
|
4127
|
+
return /* @__PURE__ */ i(
|
|
4128
|
+
Y,
|
|
4129
|
+
{
|
|
4130
|
+
editor: t,
|
|
4131
|
+
pluginKey: "table",
|
|
4132
|
+
shouldShow: r,
|
|
4133
|
+
updateDelay: 0,
|
|
4134
|
+
tippyOptions: {
|
|
4135
|
+
offset: [0, 8],
|
|
4136
|
+
popperOptions: {
|
|
4137
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
4138
|
+
},
|
|
4139
|
+
maxWidth: "auto",
|
|
4140
|
+
getReferenceClientRect: () => {
|
|
4141
|
+
var xe;
|
|
4142
|
+
const {
|
|
4143
|
+
view: j,
|
|
4144
|
+
state: {
|
|
4145
|
+
selection: { from: Mt }
|
|
4146
|
+
}
|
|
4147
|
+
} = t, at = j.domAtPos(Mt).node;
|
|
4148
|
+
if (!at)
|
|
4149
|
+
return new DOMRect(-1e3, -1e3, 0, 0);
|
|
4150
|
+
const ue = (xe = at == null ? void 0 : at.closest) == null ? void 0 : xe.call(at, ".tableWrapper");
|
|
4151
|
+
return ue ? ue.getBoundingClientRect() : new DOMRect(-1e3, -1e3, 0, 0);
|
|
4152
|
+
},
|
|
4153
|
+
plugins: [un],
|
|
4154
|
+
sticky: "popper"
|
|
4155
|
+
},
|
|
4156
|
+
children: e ? /* @__PURE__ */ i(_, {}) : /* @__PURE__ */ u("div", { className: "richtext-min-w-32 richtext-flex richtext-flex-row richtext-h-full richtext-items-center richtext-leading-none richtext-gap-0.5 richtext-p-2 richtext-w-full richtext-bg-background richtext-rounded-lg richtext-shadow-sm !richtext-border richtext-border-border", children: [
|
|
4157
|
+
/* @__PURE__ */ i(
|
|
4158
|
+
v,
|
|
4159
|
+
{
|
|
4160
|
+
icon: "BetweenHorizonalEnd",
|
|
4161
|
+
tooltip: n("editor.table.menu.insertColumnBefore"),
|
|
4162
|
+
action: a,
|
|
4163
|
+
"tooltip-options": {
|
|
4164
|
+
sideOffset: 15
|
|
4165
|
+
},
|
|
4166
|
+
disabled: !((T = (b = t == null ? void 0 : t.can()) == null ? void 0 : b.addColumnBefore) != null && T.call(b))
|
|
4167
|
+
}
|
|
4168
|
+
),
|
|
4169
|
+
/* @__PURE__ */ i(
|
|
4170
|
+
v,
|
|
4171
|
+
{
|
|
4172
|
+
icon: "BetweenHorizonalStart",
|
|
4173
|
+
tooltip: n("editor.table.menu.insertColumnAfter"),
|
|
4174
|
+
action: c,
|
|
4175
|
+
"tooltip-options": {
|
|
4176
|
+
sideOffset: 15
|
|
4177
|
+
},
|
|
4178
|
+
disabled: !((R = (k = t == null ? void 0 : t.can()) == null ? void 0 : k.addColumnAfter) != null && R.call(k))
|
|
4179
|
+
}
|
|
4180
|
+
),
|
|
4181
|
+
/* @__PURE__ */ i(
|
|
4182
|
+
v,
|
|
4183
|
+
{
|
|
4184
|
+
icon: "DeleteColumn",
|
|
4185
|
+
action: o,
|
|
4186
|
+
tooltip: n("editor.table.menu.deleteColumn"),
|
|
4187
|
+
"tooltip-options": {
|
|
4188
|
+
sideOffset: 15
|
|
4189
|
+
},
|
|
4190
|
+
disabled: !((F = t == null ? void 0 : ($ = t.can()).deleteColumn) != null && F.call($))
|
|
4191
|
+
}
|
|
4192
|
+
),
|
|
4193
|
+
/* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]" }),
|
|
4194
|
+
/* @__PURE__ */ i(
|
|
4195
|
+
v,
|
|
4196
|
+
{
|
|
4197
|
+
icon: "BetweenVerticalEnd",
|
|
4198
|
+
action: s,
|
|
4199
|
+
tooltip: n("editor.table.menu.insertRowAbove"),
|
|
4200
|
+
"tooltip-options": {
|
|
4201
|
+
sideOffset: 15
|
|
4202
|
+
},
|
|
4203
|
+
disabled: !((B = t == null ? void 0 : (M = t.can()).addRowBefore) != null && B.call(M))
|
|
4204
|
+
}
|
|
4205
|
+
),
|
|
4206
|
+
/* @__PURE__ */ i(
|
|
4207
|
+
v,
|
|
4208
|
+
{
|
|
4209
|
+
icon: "BetweenVerticalStart",
|
|
4210
|
+
action: l,
|
|
4211
|
+
tooltip: n("editor.table.menu.insertRowBelow"),
|
|
4212
|
+
"tooltip-options": {
|
|
4213
|
+
sideOffset: 15
|
|
4214
|
+
},
|
|
4215
|
+
disabled: !((N = (W = t == null ? void 0 : t.can()) == null ? void 0 : W.addRowAfter) != null && N.call(W))
|
|
4216
|
+
}
|
|
4217
|
+
),
|
|
4218
|
+
/* @__PURE__ */ i(
|
|
4219
|
+
v,
|
|
4220
|
+
{
|
|
4221
|
+
icon: "DeleteRow",
|
|
4222
|
+
action: h,
|
|
4223
|
+
tooltip: n("editor.table.menu.deleteRow"),
|
|
4224
|
+
"tooltip-options": {
|
|
4225
|
+
sideOffset: 15
|
|
4226
|
+
},
|
|
4227
|
+
disabled: !((y = (H = t == null ? void 0 : t.can()) == null ? void 0 : H.deleteRow) != null && y.call(H))
|
|
4228
|
+
}
|
|
4229
|
+
),
|
|
4230
|
+
/* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]" }),
|
|
4231
|
+
/* @__PURE__ */ i(
|
|
4232
|
+
v,
|
|
4233
|
+
{
|
|
4234
|
+
icon: "TableCellsMerge",
|
|
4235
|
+
action: d,
|
|
4236
|
+
tooltip: n("editor.table.menu.mergeCells"),
|
|
4237
|
+
"tooltip-options": {
|
|
4238
|
+
sideOffset: 15
|
|
4239
|
+
},
|
|
4240
|
+
disabled: !((O = (g = t == null ? void 0 : t.can()) == null ? void 0 : g.mergeCells) != null && O.call(g))
|
|
4241
|
+
}
|
|
4242
|
+
),
|
|
4243
|
+
/* @__PURE__ */ i(
|
|
4244
|
+
v,
|
|
4245
|
+
{
|
|
4246
|
+
icon: "TableCellsSplit",
|
|
4247
|
+
action: x,
|
|
4248
|
+
tooltip: n("editor.table.menu.splitCells"),
|
|
4249
|
+
"tooltip-options": {
|
|
4250
|
+
sideOffset: 15
|
|
4251
|
+
},
|
|
4252
|
+
disabled: !((z = (S = t == null ? void 0 : t.can()) == null ? void 0 : S.splitCell) != null && z.call(S))
|
|
4253
|
+
}
|
|
4254
|
+
),
|
|
4255
|
+
/* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]" }),
|
|
4256
|
+
/* @__PURE__ */ i(
|
|
4257
|
+
hc,
|
|
4258
|
+
{
|
|
4259
|
+
editor: t,
|
|
4260
|
+
tooltip: n("editor.table.menu.setCellsBgColor"),
|
|
4261
|
+
action: f,
|
|
4262
|
+
tooltipOptions: {
|
|
4263
|
+
sideOffset: 15
|
|
4264
|
+
}
|
|
4265
|
+
}
|
|
4266
|
+
),
|
|
4267
|
+
/* @__PURE__ */ i(
|
|
4268
|
+
v,
|
|
4269
|
+
{
|
|
4270
|
+
icon: "Trash2",
|
|
4271
|
+
tooltip: n("editor.table.menu.deleteTable"),
|
|
4272
|
+
action: m,
|
|
4273
|
+
"tooltip-options": {
|
|
4274
|
+
sideOffset: 15
|
|
4275
|
+
},
|
|
4276
|
+
disabled: !((K = (A = t == null ? void 0 : t.can()) == null ? void 0 : A.deleteTable) != null && K.call(A))
|
|
4277
|
+
}
|
|
4278
|
+
)
|
|
4279
|
+
] })
|
|
4280
|
+
}
|
|
4281
|
+
);
|
|
4282
|
+
}
|
|
4283
|
+
function Ea(t) {
|
|
4284
|
+
const { t: e } = V();
|
|
4285
|
+
return /* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-p-2 richtext-bg-white !richtext-border richtext-rounded-lg richtext-shadow-sm dark:richtext-bg-black richtext-border-neutral-200 dark:richtext-border-neutral-800", children: [
|
|
4286
|
+
/* @__PURE__ */ i(
|
|
4287
|
+
"a",
|
|
4288
|
+
{
|
|
4289
|
+
href: t == null ? void 0 : t.link,
|
|
4290
|
+
target: "_blank",
|
|
4291
|
+
rel: "noopener noreferrer",
|
|
4292
|
+
className: "richtext-text-sm richtext-underline richtext-break-all",
|
|
4293
|
+
children: Fi(t == null ? void 0 : t.link, {
|
|
4294
|
+
length: 50,
|
|
4295
|
+
omission: "…"
|
|
4296
|
+
})
|
|
4297
|
+
}
|
|
4298
|
+
),
|
|
4299
|
+
(t == null ? void 0 : t.link) && /* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-h-4" }),
|
|
4300
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-nowrap", children: [
|
|
4301
|
+
/* @__PURE__ */ i(
|
|
4302
|
+
v,
|
|
4303
|
+
{
|
|
4304
|
+
icon: "Pencil",
|
|
4305
|
+
tooltip: e("editor.link.edit.tooltip"),
|
|
4306
|
+
action: () => {
|
|
4307
|
+
t == null || t.onEdit();
|
|
4308
|
+
},
|
|
4309
|
+
tooltipOptions: { sideOffset: 15 }
|
|
4310
|
+
}
|
|
4311
|
+
),
|
|
4312
|
+
/* @__PURE__ */ i(
|
|
4313
|
+
v,
|
|
4314
|
+
{
|
|
4315
|
+
icon: "Unlink",
|
|
4316
|
+
tooltip: e("editor.link.unlink.tooltip"),
|
|
4317
|
+
action: () => {
|
|
4318
|
+
t == null || t.onClear();
|
|
4319
|
+
},
|
|
4320
|
+
tooltipOptions: { sideOffset: 15 }
|
|
4321
|
+
}
|
|
4322
|
+
)
|
|
4323
|
+
] })
|
|
4324
|
+
] });
|
|
4325
|
+
}
|
|
4326
|
+
function Ra({ editor: t, disabled: e }) {
|
|
4327
|
+
const [r, n] = w(!1), a = P(() => {
|
|
4328
|
+
const { href: l } = t.getAttributes("link");
|
|
4329
|
+
return l;
|
|
4330
|
+
}, [t]), c = C(({ editor: l }) => l.isActive("link"), []), o = (l, h, d) => {
|
|
4331
|
+
t.chain().extendMarkRange("link").insertContent({
|
|
4332
|
+
type: "text",
|
|
4333
|
+
text: h,
|
|
4334
|
+
marks: [
|
|
4335
|
+
{
|
|
4336
|
+
type: "link",
|
|
4337
|
+
attrs: {
|
|
4338
|
+
href: l,
|
|
4339
|
+
target: d ? "_blank" : ""
|
|
4340
|
+
}
|
|
4341
|
+
}
|
|
4342
|
+
]
|
|
4343
|
+
}).setLink({ href: l }).focus().run(), n(!1);
|
|
4344
|
+
}, s = C(() => {
|
|
4345
|
+
t.chain().extendMarkRange("link").unsetLink().focus().run(), n(!1);
|
|
4346
|
+
}, [t]);
|
|
4347
|
+
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4348
|
+
Y,
|
|
4349
|
+
{
|
|
4350
|
+
editor: t,
|
|
4351
|
+
shouldShow: c,
|
|
4352
|
+
tippyOptions: {
|
|
4353
|
+
popperOptions: {
|
|
4354
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
4355
|
+
},
|
|
4356
|
+
placement: "bottom-start",
|
|
4357
|
+
offset: [-2, 16],
|
|
4358
|
+
zIndex: 9999,
|
|
4359
|
+
onHidden: () => {
|
|
4360
|
+
n(!1);
|
|
4361
|
+
}
|
|
4362
|
+
},
|
|
4363
|
+
children: e ? /* @__PURE__ */ i(_, {}) : /* @__PURE__ */ i(_, { children: r ? /* @__PURE__ */ i(dc, { onSetLink: o, editor: t }) : /* @__PURE__ */ i(
|
|
4364
|
+
Ea,
|
|
4365
|
+
{
|
|
4366
|
+
editor: t,
|
|
4367
|
+
onClear: s,
|
|
4368
|
+
onEdit: () => {
|
|
4369
|
+
n(!0);
|
|
4370
|
+
},
|
|
4371
|
+
link: a
|
|
4372
|
+
}
|
|
4373
|
+
) })
|
|
4374
|
+
}
|
|
4375
|
+
) });
|
|
4376
|
+
}
|
|
4377
|
+
const le = {
|
|
4378
|
+
maxWidth: "auto",
|
|
4379
|
+
zIndex: 20,
|
|
4380
|
+
appendTo: "parent",
|
|
4381
|
+
moveTransition: "transform 0.1s ease-out"
|
|
4382
|
+
};
|
|
4383
|
+
function he({ item: t, disabled: e, editor: r }) {
|
|
4384
|
+
var a;
|
|
4385
|
+
const n = t.component;
|
|
4386
|
+
return n ? /* @__PURE__ */ i(_e, { children: t.type === "divider" ? /* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]" }) : /* @__PURE__ */ i(
|
|
4387
|
+
n,
|
|
4388
|
+
{
|
|
4389
|
+
...t.componentProps,
|
|
4390
|
+
editor: r,
|
|
4391
|
+
disabled: e || ((a = t == null ? void 0 : t.componentProps) == null ? void 0 : a.disabled)
|
|
4392
|
+
}
|
|
4393
|
+
) }) : /* @__PURE__ */ i(_, {});
|
|
4394
|
+
}
|
|
4395
|
+
function za(t) {
|
|
4396
|
+
return t.type.name === "image";
|
|
4397
|
+
}
|
|
4398
|
+
function Oa(t) {
|
|
4399
|
+
return t.type.name === wi.name;
|
|
4400
|
+
}
|
|
4401
|
+
function _a(t) {
|
|
4402
|
+
return t.type.name === "video";
|
|
4403
|
+
}
|
|
4404
|
+
function Ha(t) {
|
|
4405
|
+
const { lang: e } = V(), r = ({ editor: a }) => {
|
|
4406
|
+
const { selection: c } = a.view.state, { $from: o, to: s } = c;
|
|
4407
|
+
let l = !1;
|
|
4408
|
+
return a.view.state.doc.nodesBetween(o.pos, s, (h) => {
|
|
4409
|
+
if (za(h))
|
|
4410
|
+
return l = !0, !1;
|
|
4411
|
+
}), l;
|
|
4412
|
+
}, n = P(() => t.disabled ? [] : ya(t.editor), [t.disabled, t.editor, e]);
|
|
4413
|
+
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4414
|
+
Y,
|
|
4415
|
+
{
|
|
4416
|
+
shouldShow: r,
|
|
4417
|
+
editor: t == null ? void 0 : t.editor,
|
|
4418
|
+
tippyOptions: le,
|
|
4419
|
+
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative", children: n == null ? void 0 : n.map((a, c) => /* @__PURE__ */ i(
|
|
4420
|
+
he,
|
|
4421
|
+
{
|
|
4422
|
+
item: a,
|
|
4423
|
+
disabled: t.disabled,
|
|
4424
|
+
editor: t.editor
|
|
4425
|
+
},
|
|
4426
|
+
`bubbleMenu-image-${c}`
|
|
4427
|
+
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
4428
|
+
}
|
|
4429
|
+
) });
|
|
4430
|
+
}
|
|
4431
|
+
function Pa(t) {
|
|
4432
|
+
const { lang: e } = V(), r = ({ editor: a }) => {
|
|
4433
|
+
const { selection: c } = a.view.state, { $from: o, to: s } = c;
|
|
4434
|
+
let l = !1;
|
|
4435
|
+
return a.view.state.doc.nodesBetween(o.pos, s, (h) => {
|
|
4436
|
+
if (Oa(h))
|
|
4437
|
+
return l = !0, !1;
|
|
4438
|
+
}), l;
|
|
4439
|
+
}, n = P(() => t.disabled ? [] : Ca(t.editor), [t.disabled, t.editor, e]);
|
|
4440
|
+
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4441
|
+
Y,
|
|
4442
|
+
{
|
|
4443
|
+
shouldShow: r,
|
|
4444
|
+
editor: t == null ? void 0 : t.editor,
|
|
4445
|
+
tippyOptions: le,
|
|
4446
|
+
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative", children: n == null ? void 0 : n.map((a, c) => /* @__PURE__ */ i(
|
|
4447
|
+
he,
|
|
4448
|
+
{
|
|
4449
|
+
item: a,
|
|
4450
|
+
disabled: t.disabled,
|
|
4451
|
+
editor: t.editor
|
|
4452
|
+
},
|
|
4453
|
+
`bubbleMenu-image-gif-${c}`
|
|
4454
|
+
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
4455
|
+
}
|
|
4456
|
+
) });
|
|
4457
|
+
}
|
|
4458
|
+
function Da(t) {
|
|
4459
|
+
const { lang: e } = V(), r = ({ editor: a }) => {
|
|
4460
|
+
const { selection: c } = a.view.state, { $from: o, to: s } = c;
|
|
4461
|
+
let l = !1;
|
|
4462
|
+
return a.view.state.doc.nodesBetween(o.pos, s, (h) => {
|
|
4463
|
+
if (_a(h))
|
|
4464
|
+
return l = !0, !1;
|
|
4465
|
+
}), l;
|
|
4466
|
+
}, n = P(() => t.disabled ? [] : Ta(t.editor), [t.editor, t.disabled, e]);
|
|
4467
|
+
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4468
|
+
Y,
|
|
4469
|
+
{
|
|
4470
|
+
shouldShow: r,
|
|
4471
|
+
editor: t == null ? void 0 : t.editor,
|
|
4472
|
+
tippyOptions: le,
|
|
4473
|
+
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-flex-nowrap richtext-whitespace-nowrap richtext-h-[26px] richtext-justify-start richtext-relative", children: n == null ? void 0 : n.map((a, c) => /* @__PURE__ */ i(
|
|
4474
|
+
he,
|
|
4475
|
+
{
|
|
4476
|
+
item: a,
|
|
4477
|
+
disabled: t.disabled,
|
|
4478
|
+
editor: t.editor
|
|
4479
|
+
},
|
|
4480
|
+
`bubbleMenu-video-${c}`
|
|
4481
|
+
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
4482
|
+
}
|
|
4483
|
+
) });
|
|
4484
|
+
}
|
|
4485
|
+
function Ba({ editor: t }) {
|
|
4486
|
+
const { t: e } = V(), r = C(() => t.isActive($t.name), [t]), n = C(() => Ct($t.name, t), [t]), a = C(() => t.chain().focus().addColBefore().run(), [t]), c = C(() => t.chain().focus().addColAfter().run(), [t]), o = C(() => t.chain().focus().deleteCol().run(), [t]);
|
|
4487
|
+
return /* @__PURE__ */ i(
|
|
4488
|
+
Y,
|
|
4489
|
+
{
|
|
4490
|
+
pluginKey: "columns-bubble-menu",
|
|
4491
|
+
editor: t,
|
|
4492
|
+
shouldShow: r,
|
|
4493
|
+
tippyOptions: {
|
|
4494
|
+
popperOptions: {
|
|
4495
|
+
modifiers: [{ name: "flip", enabled: !1 }]
|
|
4496
|
+
},
|
|
4497
|
+
placement: "bottom-start",
|
|
4498
|
+
offset: [-2, 16],
|
|
4499
|
+
zIndex: 9999
|
|
4500
|
+
// onHidden: () => {
|
|
4501
|
+
// toggleVisible(false)
|
|
4502
|
+
// },
|
|
4503
|
+
},
|
|
4504
|
+
children: /* @__PURE__ */ u("div", { className: "richtext-w-auto richtext-px-3 richtext-py-2 richtext-transition-all !richtext-border richtext-rounded-sm richtext-shadow-sm richtext-pointer-events-auto richtext-select-none richtext-border-neutral-200 dark:richtext-border-neutral-800 richtext-bg-background", children: [
|
|
4505
|
+
/* @__PURE__ */ i(
|
|
4506
|
+
v,
|
|
4507
|
+
{
|
|
4508
|
+
action: a,
|
|
4509
|
+
icon: "ColumnAddLeft",
|
|
4510
|
+
tooltip: e("editor.table.menu.insertColumnBefore")
|
|
4511
|
+
}
|
|
4512
|
+
),
|
|
4513
|
+
/* @__PURE__ */ i(
|
|
4514
|
+
v,
|
|
4515
|
+
{
|
|
4516
|
+
action: c,
|
|
4517
|
+
icon: "ColumnAddRight",
|
|
4518
|
+
tooltip: e("editor.table.menu.insertColumnAfter")
|
|
4519
|
+
}
|
|
4520
|
+
),
|
|
4521
|
+
/* @__PURE__ */ i(
|
|
4522
|
+
v,
|
|
4523
|
+
{
|
|
4524
|
+
action: o,
|
|
4525
|
+
icon: "DeleteColumn",
|
|
4526
|
+
tooltip: e("editor.table.menu.deleteColumn")
|
|
4527
|
+
}
|
|
4528
|
+
),
|
|
4529
|
+
/* @__PURE__ */ i(
|
|
4530
|
+
v,
|
|
4531
|
+
{
|
|
4532
|
+
action: n,
|
|
4533
|
+
icon: "Trash2",
|
|
4534
|
+
tooltip: e("editor.table.menu.delete_column")
|
|
4535
|
+
}
|
|
4536
|
+
)
|
|
4537
|
+
] })
|
|
4538
|
+
}
|
|
4539
|
+
);
|
|
4540
|
+
}
|
|
4541
|
+
function $a() {
|
|
4542
|
+
const { toasts: t } = $n();
|
|
4543
|
+
return /* @__PURE__ */ u(In, { children: [
|
|
4544
|
+
t.map(({ id: e, title: r, description: n, action: a, ...c }) => /* @__PURE__ */ u(ci, { ...c, children: [
|
|
4545
|
+
/* @__PURE__ */ u("div", { className: "richtext-grid richtext-gap-1", children: [
|
|
4546
|
+
r && /* @__PURE__ */ i(oi, { children: r }),
|
|
4547
|
+
n && /* @__PURE__ */ i(si, { children: n })
|
|
4548
|
+
] }),
|
|
4549
|
+
a,
|
|
4550
|
+
/* @__PURE__ */ i(ai, {})
|
|
4551
|
+
] }, e)),
|
|
4552
|
+
/* @__PURE__ */ i(ni, {})
|
|
4553
|
+
] });
|
|
4554
|
+
}
|
|
4555
|
+
const Va = `
|
|
4556
|
+
.reactjs-tiptap-editor, .richtext-dialog-content {
|
|
4557
|
+
button,
|
|
4558
|
+
input:where([type=button]),
|
|
4559
|
+
input:where([type=reset]),
|
|
4560
|
+
input:where([type=submit]) {
|
|
4561
|
+
-webkit-appearance: button;
|
|
4562
|
+
background-color: transparent;
|
|
4563
|
+
background-image: none
|
|
4564
|
+
}
|
|
4565
|
+
|
|
4566
|
+
input,
|
|
4567
|
+
optgroup,
|
|
4568
|
+
select,
|
|
4569
|
+
textarea {
|
|
4570
|
+
font-family: inherit;
|
|
4571
|
+
font-feature-settings: inherit;
|
|
4572
|
+
font-variation-settings: inherit;
|
|
4573
|
+
font-size: 100%;
|
|
4574
|
+
font-weight: inherit;
|
|
4575
|
+
line-height: inherit;
|
|
4576
|
+
letter-spacing: inherit;
|
|
4577
|
+
color: inherit;
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4580
|
+
button {
|
|
4581
|
+
font-family: inherit;
|
|
4582
|
+
font-feature-settings: inherit;
|
|
4583
|
+
font-variation-settings: inherit;
|
|
4584
|
+
font-size: 100%;
|
|
4585
|
+
font-weight: inherit;
|
|
4586
|
+
line-height: inherit;
|
|
4587
|
+
letter-spacing: inherit;
|
|
4588
|
+
color: inherit;
|
|
4589
|
+
}
|
|
4590
|
+
}
|
|
4591
|
+
|
|
4592
|
+
.reactjs-tiptap-editor,
|
|
4593
|
+
.richtext-dialog-content,
|
|
4594
|
+
div[data-radix-popper-content-wrapper],
|
|
4595
|
+
div[data-tippy-root] {
|
|
4596
|
+
*,
|
|
4597
|
+
:before,
|
|
4598
|
+
:after {
|
|
4599
|
+
box-sizing: border-box;
|
|
4600
|
+
border-width: 0;
|
|
4601
|
+
border-style: solid;
|
|
4602
|
+
border-color: hsl(var(--richtext-border));
|
|
4603
|
+
}
|
|
4604
|
+
|
|
4605
|
+
background-color: hsl(var(--richtext-background));
|
|
4606
|
+
color: hsl(var(--richtext-foreground));
|
|
4607
|
+
|
|
4608
|
+
|
|
4609
|
+
html,
|
|
4610
|
+
:host {
|
|
4611
|
+
line-height: 1.5;
|
|
4612
|
+
-webkit-text-size-adjust: 100%;
|
|
4613
|
+
-moz-tab-size: 4;
|
|
4614
|
+
tab-size: 4;
|
|
4615
|
+
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
|
|
4616
|
+
font-feature-settings: normal;
|
|
4617
|
+
font-variation-settings: normal;
|
|
4618
|
+
-webkit-tap-highlight-color: transparent
|
|
4619
|
+
}
|
|
4620
|
+
|
|
4621
|
+
hr {
|
|
4622
|
+
height: 0;
|
|
4623
|
+
color: inherit;
|
|
4624
|
+
border-top-width: 1px
|
|
4625
|
+
}
|
|
4626
|
+
|
|
4627
|
+
a {
|
|
4628
|
+
color: inherit;
|
|
4629
|
+
text-decoration: inherit
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
b,
|
|
4633
|
+
strong {
|
|
4634
|
+
font-weight: bolder
|
|
4635
|
+
}
|
|
4636
|
+
|
|
4637
|
+
code,
|
|
4638
|
+
kbd,
|
|
4639
|
+
samp,
|
|
4640
|
+
pre {
|
|
4641
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace;
|
|
4642
|
+
font-feature-settings: normal;
|
|
4643
|
+
font-variation-settings: normal;
|
|
4644
|
+
font-size: 1em
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
table {
|
|
4648
|
+
text-indent: 0;
|
|
4649
|
+
border-color: inherit;
|
|
4650
|
+
border-collapse: collapse
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4653
|
+
input, textarea {
|
|
4654
|
+
border-width: 1px;
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
textarea {
|
|
4658
|
+
resize: vertical
|
|
4659
|
+
}
|
|
4660
|
+
|
|
4661
|
+
input::placeholder,
|
|
4662
|
+
textarea::placeholder {
|
|
4663
|
+
opacity: 1;
|
|
4664
|
+
color: #9ca3af
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
button, input, textarea {
|
|
4668
|
+
cursor: pointer;
|
|
4669
|
+
color: inherit;
|
|
4670
|
+
}
|
|
4671
|
+
|
|
4672
|
+
img,
|
|
4673
|
+
svg,
|
|
4674
|
+
video,
|
|
4675
|
+
canvas,
|
|
4676
|
+
audio,
|
|
4677
|
+
iframe,
|
|
4678
|
+
embed,
|
|
4679
|
+
object {
|
|
4680
|
+
display: block;
|
|
4681
|
+
vertical-align: middle
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
img,
|
|
4685
|
+
video {
|
|
4686
|
+
max-width: 100%;
|
|
4687
|
+
height: auto
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
`, Re = "data-rc-order", ze = "data-rc-priority", Wa = "rc-util-key", ne = /* @__PURE__ */ new Map();
|
|
4691
|
+
function ja(t, e) {
|
|
4692
|
+
if (!t)
|
|
4693
|
+
return !1;
|
|
4694
|
+
if (t.contains)
|
|
4695
|
+
return t.contains(e);
|
|
4696
|
+
let r = e;
|
|
4697
|
+
for (; r; ) {
|
|
4698
|
+
if (r === t)
|
|
4699
|
+
return !0;
|
|
4700
|
+
r = r.parentNode;
|
|
4701
|
+
}
|
|
4702
|
+
return !1;
|
|
4703
|
+
}
|
|
4704
|
+
function Ci({ mark: t } = {}) {
|
|
4705
|
+
return t ? t.startsWith("data-") ? t : `data-${t}` : Wa;
|
|
4706
|
+
}
|
|
4707
|
+
function de(t) {
|
|
4708
|
+
return t.attachTo ? t.attachTo : document.querySelector("head") || document.body;
|
|
4709
|
+
}
|
|
4710
|
+
function Fa(t) {
|
|
4711
|
+
return t === "queue" ? "prependQueue" : t ? "prepend" : "append";
|
|
4712
|
+
}
|
|
4713
|
+
function Ni(t) {
|
|
4714
|
+
return [...(ne.get(t) || t).children].filter(
|
|
4715
|
+
(e) => e.tagName === "STYLE"
|
|
4716
|
+
);
|
|
4717
|
+
}
|
|
4718
|
+
function Ti(t, e = {}) {
|
|
4719
|
+
const { csp: r, prepend: n, priority: a = 0 } = e, c = Fa(n), o = c === "prependQueue", s = document.createElement("style");
|
|
4720
|
+
s.setAttribute(Re, c), o && a && s.setAttribute(ze, `${a}`), r != null && r.nonce && (s.nonce = r == null ? void 0 : r.nonce), s.innerHTML = t;
|
|
4721
|
+
const l = de(e), { firstChild: h } = l;
|
|
4722
|
+
if (n) {
|
|
4723
|
+
if (o) {
|
|
4724
|
+
const d = Ni(l).filter((x) => {
|
|
4725
|
+
if (!["prepend", "prependQueue"].includes(x.getAttribute(Re)))
|
|
4726
|
+
return !1;
|
|
4727
|
+
const m = Number(x.getAttribute(ze) || 0);
|
|
4728
|
+
return a >= m;
|
|
4729
|
+
});
|
|
4730
|
+
if (d.length > 0)
|
|
4731
|
+
return l.insertBefore(s, d.at(-1).nextSibling), s;
|
|
4732
|
+
}
|
|
4733
|
+
h.before(s);
|
|
4734
|
+
} else
|
|
4735
|
+
l.append(s);
|
|
4736
|
+
return s;
|
|
4737
|
+
}
|
|
4738
|
+
function ki(t, e = {}) {
|
|
4739
|
+
const r = de(e);
|
|
4740
|
+
return Ni(r).find((n) => n.getAttribute(Ci(e)) === t);
|
|
4741
|
+
}
|
|
4742
|
+
function Ga(t, e = {}) {
|
|
4743
|
+
const r = ki(t, e);
|
|
4744
|
+
r && r.remove();
|
|
4745
|
+
}
|
|
4746
|
+
function Ua(t, e) {
|
|
4747
|
+
const r = ne.get(t);
|
|
4748
|
+
if (!r || !ja(document, r)) {
|
|
4749
|
+
const n = Ti("", e), { parentNode: a } = n;
|
|
4750
|
+
ne.set(t, a), n.remove();
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
function Ka(t, e, r = {}) {
|
|
4754
|
+
var o, s, l;
|
|
4755
|
+
const n = de(r);
|
|
4756
|
+
Ua(n, r);
|
|
4757
|
+
const a = ki(e, r);
|
|
4758
|
+
if (a)
|
|
4759
|
+
return (o = r.csp) != null && o.nonce && a.nonce !== ((s = r.csp) == null ? void 0 : s.nonce) && (a.nonce = (l = r.csp) == null ? void 0 : l.nonce), a.innerHTML !== t && (a.innerHTML = t), a;
|
|
4760
|
+
const c = Ti(t, r);
|
|
4761
|
+
return c.setAttribute(Ci(r), e), c;
|
|
4762
|
+
}
|
|
4763
|
+
function Za({ editor: t, extensions: e }) {
|
|
4764
|
+
const { t: r } = V(), n = P(() => {
|
|
4765
|
+
var a, c, o;
|
|
4766
|
+
return (o = (c = (a = e == null ? void 0 : e.find((s) => s.name === "base-kit")) == null ? void 0 : a.options) == null ? void 0 : c.characterCount) == null ? void 0 : o.limit;
|
|
4767
|
+
}, [e]);
|
|
4768
|
+
return n ? /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-justify-between richtext-p-3 richtext-border-t", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-flex-col", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-justify-end richtext-gap-3 richtext-text-sm", children: /* @__PURE__ */ u("span", { children: [
|
|
4769
|
+
t.storage.characterCount.characters(),
|
|
4770
|
+
"/",
|
|
4771
|
+
n,
|
|
4772
|
+
" ",
|
|
4773
|
+
r("editor.characters")
|
|
4774
|
+
] }) }) }) }) : /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-justify-between richtext-p-3 richtext-border-t", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-flex-col", children: /* @__PURE__ */ i("div", { className: "richtext-flex richtext-justify-end richtext-gap-3 richtext-text-sm", children: /* @__PURE__ */ u("span", { children: [
|
|
4775
|
+
t.storage.characterCount.characters(),
|
|
4776
|
+
" ",
|
|
4777
|
+
r("editor.characters")
|
|
4778
|
+
] }) }) }) });
|
|
4779
|
+
}
|
|
4780
|
+
function Xa(t, e) {
|
|
4781
|
+
const { content: r, extensions: n, useEditorOptions: a = {} } = t, c = P(() => {
|
|
4782
|
+
const d = Gi(n, n, "name");
|
|
4783
|
+
return [...n.map((m) => {
|
|
4784
|
+
const f = n.find((p) => p.name === m.name);
|
|
4785
|
+
return f ? m.configure(f.options) : m;
|
|
4786
|
+
}), ...d].map((m, f) => m.configure({ sort: f }));
|
|
4787
|
+
}, [n]), o = wt((d) => {
|
|
4788
|
+
var m;
|
|
4789
|
+
const x = l(d, t.output);
|
|
4790
|
+
(m = t == null ? void 0 : t.onChangeContent) == null || m.call(t, x);
|
|
4791
|
+
}, Di), s = zi({
|
|
4792
|
+
extensions: c,
|
|
4793
|
+
content: r,
|
|
4794
|
+
onUpdate: ({ editor: d }) => {
|
|
4795
|
+
o && o(d);
|
|
4796
|
+
},
|
|
4797
|
+
...a
|
|
4798
|
+
});
|
|
4799
|
+
Ai(e, () => ({
|
|
4800
|
+
editor: s
|
|
4801
|
+
})), I(() => {
|
|
4802
|
+
document.documentElement.classList.toggle("dark", t.dark), Mc.setTheme(t.dark ? "dark" : "light");
|
|
4803
|
+
}, [t.dark]), I(() => {
|
|
4804
|
+
s == null || s.setEditable(!(t != null && t.disabled)), pn.setDisable(!(t != null && t.disabled));
|
|
4805
|
+
}, [s, t == null ? void 0 : t.disabled]), I(() => ((t == null ? void 0 : t.resetCSS) !== !1 && Ka(Va, "react-tiptap-reset"), () => {
|
|
4806
|
+
Ga("react-tiptap-reset");
|
|
4807
|
+
}), [t == null ? void 0 : t.resetCSS]);
|
|
4808
|
+
function l(d, x) {
|
|
4809
|
+
return t != null && t.removeDefaultWrapper ? x === "html" ? d.isEmpty ? "" : d.getHTML() : x === "json" ? d.isEmpty ? {} : d.getJSON() : x === "text" ? d.isEmpty ? "" : d.getText() : "" : x === "html" ? d.getHTML() : x === "json" ? d.getJSON() : x === "text" ? d.getText() : "";
|
|
4810
|
+
}
|
|
4811
|
+
I(() => () => {
|
|
4812
|
+
var d;
|
|
4813
|
+
(d = s == null ? void 0 : s.destroy) == null || d.call(s);
|
|
4814
|
+
}, []);
|
|
4815
|
+
const h = yn(s, "characterCount");
|
|
4816
|
+
return s ? /* @__PURE__ */ u("div", { className: "reactjs-tiptap-editor", children: [
|
|
4817
|
+
/* @__PURE__ */ i(On, { delayDuration: 0, disableHoverableContent: !0, children: /* @__PURE__ */ i("div", { className: "richtext-rounded-[0.5rem] richtext-bg-background richtext-shadow richtext-overflow-hidden richtext-outline richtext-outline-1", children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col richtext-w-full richtext-max-h-full", children: [
|
|
4818
|
+
!(t != null && t.hideToolbar) && /* @__PURE__ */ i(ma, { editor: s, disabled: !!(t != null && t.disabled), toolbar: t.toolbar }),
|
|
4819
|
+
/* @__PURE__ */ i(Oi, { className: `richtext-relative ${(t == null ? void 0 : t.contentClass) || ""}`, editor: s }),
|
|
4820
|
+
h && /* @__PURE__ */ i(Za, { editor: s, extensions: n }),
|
|
4821
|
+
!(t != null && t.hideBubble) && /* @__PURE__ */ i(da, { bubbleMenu: t == null ? void 0 : t.bubbleMenu, editor: s, disabled: t == null ? void 0 : t.disabled })
|
|
4822
|
+
] }) }) }),
|
|
4823
|
+
/* @__PURE__ */ i($a, {})
|
|
4824
|
+
] }) : /* @__PURE__ */ i(_, {});
|
|
4825
|
+
}
|
|
4826
|
+
const yo = Si(Xa);
|
|
4827
|
+
export {
|
|
4828
|
+
ot as $,
|
|
4829
|
+
v as A,
|
|
4830
|
+
U as B,
|
|
4831
|
+
ua as C,
|
|
4832
|
+
Nn as D,
|
|
4833
|
+
Tt as E,
|
|
4834
|
+
gi as F,
|
|
4835
|
+
bo as G,
|
|
4836
|
+
hc as H,
|
|
4837
|
+
G as I,
|
|
4838
|
+
et as J,
|
|
4839
|
+
J as K,
|
|
4840
|
+
dc as L,
|
|
4841
|
+
$t as M,
|
|
4842
|
+
xo as N,
|
|
4843
|
+
$n as O,
|
|
4844
|
+
mt as P,
|
|
4845
|
+
yn as Q,
|
|
4846
|
+
yo as R,
|
|
4847
|
+
ri as S,
|
|
4848
|
+
hi as T,
|
|
4849
|
+
ht as U,
|
|
4850
|
+
vo as V,
|
|
4851
|
+
Qn as W,
|
|
4852
|
+
Jn as X,
|
|
4853
|
+
po as Y,
|
|
4854
|
+
go as Z,
|
|
4855
|
+
wo as _,
|
|
4856
|
+
di as a,
|
|
4857
|
+
lt as a0,
|
|
4858
|
+
st as a1,
|
|
4859
|
+
wi as a2,
|
|
4860
|
+
Me as a3,
|
|
4861
|
+
re as a4,
|
|
4862
|
+
oe as b,
|
|
4863
|
+
Tn as c,
|
|
4864
|
+
ei as d,
|
|
4865
|
+
tt as e,
|
|
4866
|
+
L as f,
|
|
4867
|
+
fn as g,
|
|
4868
|
+
Ct as h,
|
|
4869
|
+
ui as i,
|
|
4870
|
+
kn as j,
|
|
4871
|
+
ii as k,
|
|
4872
|
+
mo as l,
|
|
4873
|
+
Mn as m,
|
|
4874
|
+
mn as n,
|
|
4875
|
+
ft as o,
|
|
4876
|
+
ct as p,
|
|
4877
|
+
li as q,
|
|
4878
|
+
xi as r,
|
|
4879
|
+
Kn as s,
|
|
4880
|
+
fo as t,
|
|
4881
|
+
gn as u,
|
|
4882
|
+
te as v,
|
|
4883
|
+
jt as w,
|
|
4884
|
+
Ft as x,
|
|
4885
|
+
Nt as y,
|
|
4886
|
+
kt as z
|
|
4887
|
+
};
|