reactjs-tiptap-editor 0.1.16 → 0.2.1
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-BkhQvEYE.js → RichTextEditor-CC602P8F.js} +860 -657
- package/lib/RichTextEditor-abeFC8IX.cjs +138 -0
- package/lib/extension-bundle.cjs +2 -2
- package/lib/extension-bundle.d.cts +51 -53
- package/lib/extension-bundle.d.ts +51 -53
- package/lib/extension-bundle.js +4780 -4562
- package/lib/{index-ss0v5xR4.js → index-C0LiugNd.js} +3 -1
- package/lib/{index-jhhV09no.cjs → index-D9RG-bm0.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.d.cts +51 -51
- package/lib/index.d.ts +51 -51
- package/lib/index.js +2 -2
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.d.cts +50 -50
- package/lib/locale-bundle.d.ts +50 -50
- package/lib/locale-bundle.js +1 -1
- package/lib/style.css +1 -1
- package/lib/{tiptap-OmOggkHK.js → tiptap-BAutNX9u.js} +727 -726
- package/lib/{tiptap-CTEGMe7x.cjs → tiptap-ktk3za0X.cjs} +12 -12
- package/lib/vendor-CFOlvngC.js +60442 -0
- package/lib/vendor-CY5IU8Xa.cjs +457 -0
- package/package.json +57 -59
- package/lib/RichTextEditor-Da_h65eW.cjs +0 -138
- package/lib/vendor-C9AD9FTJ.js +0 -50660
- package/lib/vendor-CEvER8Ns.cjs +0 -370
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as u, jsx as i, Fragment as _ } from "react/jsx-runtime";
|
|
2
2
|
import * as E from "react";
|
|
3
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
|
|
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-
|
|
4
|
+
import { f as Rt, 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 zi, u as Ri, E as Oi } from "./tiptap-BAutNX9u.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-C0LiugNd.js";
|
|
6
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, aA as Fi, H as Wt, aB as Gi, aC as Ui } from "./vendor-
|
|
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, aA as Fi, H as Wt, aB as Gi, aC as Ui } from "./vendor-CFOlvngC.js";
|
|
8
8
|
import * as X from "@radix-ui/react-toast";
|
|
9
|
-
import { ChevronRight as Ki, Check as Zi, Circle as Xi, X as Fe, FlipHorizontal as qi, FlipVertical as Yi, CropIcon as Ji, ChevronUp as Qi, Paperclip as tr, Eye as er, Settings as ir, ZoomOut as rr, ZoomIn as nr, BookMarked as cr, Sigma as ar, SmilePlusIcon as or, Replace as pe, SmilePlus as sr, Frame as lr, Columns2 as we, PanelRight as hr, PanelLeft as dr, Clipboard as ur, Copy as xr, GripVertical as mr, Plus as Ge, Columns4 as fr, Columns3 as gr, Heading6 as pr, Heading5 as wr, Heading4 as vr, Heading3 as br, Heading2 as yr, Heading1 as Cr, ChevronsUpDown as Nr, Trash as Tr, Trash2 as Ue, TableCellsSplit as kr, TableCellsMerge as Sr, BetweenVerticalEnd as Ar, BetweenVerticalStart as Mr, BetweenHorizonalStart as Lr, BetweenHorizonalEnd as Ir, Unlink as Er, Pencil as Ke, Sparkles as
|
|
9
|
+
import { ChevronRight as Ki, Check as Zi, Circle as Xi, X as Fe, FlipHorizontal as qi, FlipVertical as Yi, CropIcon as Ji, ChevronUp as Qi, Paperclip as tr, Eye as er, Settings as ir, ZoomOut as rr, ZoomIn as nr, BookMarked as cr, Sigma as ar, SmilePlusIcon as or, Replace as pe, SmilePlus as sr, Frame as lr, Columns2 as we, PanelRight as hr, PanelLeft as dr, Clipboard as ur, Copy as xr, GripVertical as mr, Plus as Ge, Columns4 as fr, Columns3 as gr, Heading6 as pr, Heading5 as wr, Heading4 as vr, Heading3 as br, Heading2 as yr, Heading1 as Cr, ChevronsUpDown as Nr, Trash as Tr, Trash2 as Ue, TableCellsSplit as kr, TableCellsMerge as Sr, BetweenVerticalEnd as Ar, BetweenVerticalStart as Mr, BetweenHorizonalStart as Lr, BetweenHorizonalEnd as Ir, Unlink as Er, Pencil as Ke, Sparkles as zr, Table as Rr, Minimize as Or, Maximize as _r, Video as Hr, ImageUp as Pr, Link as Dr, ListTodo as Br, ListOrdered as $r, List as Vr, IndentDecrease as Wr, IndentIncrease as jr, Type as Fr, CodeXml as Gr, Code as Ur, Superscript as Kr, Subscript as Zr, ChevronDown as Xr, Undo2 as qr, Redo2 as Yr, PaintRoller as Jr, Eraser as Qr, Minus as tn, Strikethrough as en, Quote as rn, Underline as nn, Italic as cn, LoaderCircle as an, Bold as on, HelpCircle as Ze } from "lucide-react";
|
|
10
10
|
import * as yt from "@radix-ui/react-tooltip";
|
|
11
11
|
import ae from "katex";
|
|
12
12
|
import { Slot as Xe } from "@radix-ui/react-slot";
|
|
@@ -14,14 +14,17 @@ import * as qe from "@radix-ui/react-toggle";
|
|
|
14
14
|
import { TextAlignRightIcon as sn, TextAlignLeftIcon as ln, TextAlignJustifyIcon as hn, TextAlignCenterIcon as dn } from "@radix-ui/react-icons";
|
|
15
15
|
import * as vt from "@radix-ui/react-popover";
|
|
16
16
|
import * as Ye from "@radix-ui/react-label";
|
|
17
|
-
import { Resizable as Je } from "re-resizable";
|
|
18
17
|
import * as q from "@radix-ui/react-dialog";
|
|
18
|
+
import { Resizable as Je } from "re-resizable";
|
|
19
19
|
import Dt from "mermaid";
|
|
20
20
|
import { flushSync as Bt } from "react-dom";
|
|
21
21
|
import { sticky as un } from "tippy.js";
|
|
22
22
|
import { HexColorPicker as xn } from "react-colorful";
|
|
23
23
|
import * as Yt from "@radix-ui/react-switch";
|
|
24
24
|
import * as D from "@radix-ui/react-dropdown-menu";
|
|
25
|
+
function L(...t) {
|
|
26
|
+
return Bi(Pt(t));
|
|
27
|
+
}
|
|
25
28
|
let Gt;
|
|
26
29
|
function Ut() {
|
|
27
30
|
return Gt === void 0 && (Gt = navigator.platform.includes("Mac")), Gt;
|
|
@@ -32,9 +35,6 @@ function mn(t) {
|
|
|
32
35
|
function fn(t) {
|
|
33
36
|
return t.map(mn).join(" ");
|
|
34
37
|
}
|
|
35
|
-
function L(...t) {
|
|
36
|
-
return Bi(Pt(t));
|
|
37
|
-
}
|
|
38
38
|
const v = Oe.forwardRef(
|
|
39
39
|
(t, e) => {
|
|
40
40
|
const {
|
|
@@ -58,26 +58,34 @@ const v = Oe.forwardRef(
|
|
|
58
58
|
/* @__PURE__ */ i(di, { asChild: !0, children: /* @__PURE__ */ u(
|
|
59
59
|
m ? Xe : li,
|
|
60
60
|
{
|
|
61
|
+
"data-state": d != null && d() ? "on" : "off",
|
|
62
|
+
onClick: h,
|
|
61
63
|
ref: e,
|
|
62
64
|
size: "sm",
|
|
63
65
|
className: L("richtext-w-[32px] richtext-h-[32px]", c),
|
|
64
66
|
disabled: a,
|
|
65
|
-
onClick: h,
|
|
66
|
-
"data-state": d != null && d() ? "on" : "off",
|
|
67
67
|
...p,
|
|
68
68
|
children: [
|
|
69
|
-
b && /* @__PURE__ */ i(b, { className: "richtext-
|
|
69
|
+
b && /* @__PURE__ */ i(b, { className: "richtext-size-4" }),
|
|
70
70
|
x
|
|
71
71
|
]
|
|
72
72
|
}
|
|
73
73
|
) }),
|
|
74
|
-
n && /* @__PURE__ */ i(oe, { ...l, children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col richtext-items-center richtext-text-center
|
|
74
|
+
n && /* @__PURE__ */ i(oe, { ...l, children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-max-w-24 richtext-flex-col richtext-items-center richtext-text-center", children: [
|
|
75
75
|
/* @__PURE__ */ i("div", { children: n }),
|
|
76
76
|
!!(s != null && s.length) && /* @__PURE__ */ i("span", { children: fn(s) })
|
|
77
77
|
] }) })
|
|
78
78
|
] });
|
|
79
79
|
}
|
|
80
|
-
);
|
|
80
|
+
), Qe = Be(!1);
|
|
81
|
+
function gn() {
|
|
82
|
+
return $e(Qe);
|
|
83
|
+
}
|
|
84
|
+
const pn = {
|
|
85
|
+
setDisable: (t) => {
|
|
86
|
+
Qe(t);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
81
89
|
function Ct(t, e) {
|
|
82
90
|
const { state: r } = e, n = r.selection.$anchor;
|
|
83
91
|
let a = !1;
|
|
@@ -97,15 +105,6 @@ function Ct(t, e) {
|
|
|
97
105
|
}
|
|
98
106
|
return a;
|
|
99
107
|
}
|
|
100
|
-
const Qe = Be(!1);
|
|
101
|
-
function gn() {
|
|
102
|
-
return $e(Qe);
|
|
103
|
-
}
|
|
104
|
-
const pn = {
|
|
105
|
-
setDisable: (t) => {
|
|
106
|
-
Qe(t);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
108
|
function ti(t, e, r) {
|
|
110
109
|
return t < e ? e : t > r ? r : t;
|
|
111
110
|
}
|
|
@@ -113,7 +112,7 @@ const wn = (t) => typeof t == "number", vn = (t) => typeof t == "string", bn = (
|
|
|
113
112
|
function uo(t, e = "px") {
|
|
114
113
|
if (!t)
|
|
115
114
|
return t;
|
|
116
|
-
const r = wn(t) ? String(t) : t, n = Number.parseFloat(r), a = r.match(/[a-z
|
|
115
|
+
const r = wn(t) ? String(t) : t, n = Number.parseFloat(r), a = r.match(/[%a-z]+$/i), c = a ? a[0] : e;
|
|
117
116
|
return Number.isNaN(n) ? t : n + c;
|
|
118
117
|
}
|
|
119
118
|
function yn(t, e) {
|
|
@@ -394,7 +393,7 @@ const En = Vt(
|
|
|
394
393
|
}
|
|
395
394
|
));
|
|
396
395
|
ci.displayName = X.Root.displayName;
|
|
397
|
-
const
|
|
396
|
+
const zn = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
398
397
|
X.Action,
|
|
399
398
|
{
|
|
400
399
|
ref: r,
|
|
@@ -405,7 +404,7 @@ const Rn = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
|
405
404
|
...e
|
|
406
405
|
}
|
|
407
406
|
));
|
|
408
|
-
|
|
407
|
+
zn.displayName = X.Action.displayName;
|
|
409
408
|
const ai = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
410
409
|
X.Close,
|
|
411
410
|
{
|
|
@@ -438,7 +437,7 @@ const si = E.forwardRef(({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
|
438
437
|
}
|
|
439
438
|
));
|
|
440
439
|
si.displayName = X.Description.displayName;
|
|
441
|
-
const
|
|
440
|
+
const Rn = Vt(
|
|
442
441
|
"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",
|
|
443
442
|
{
|
|
444
443
|
variants: {
|
|
@@ -461,7 +460,7 @@ const zn = Vt(
|
|
|
461
460
|
qe.Root,
|
|
462
461
|
{
|
|
463
462
|
ref: a,
|
|
464
|
-
className: L(
|
|
463
|
+
className: L(Rn({ variant: e, size: r, className: t })),
|
|
465
464
|
...n
|
|
466
465
|
}
|
|
467
466
|
));
|
|
@@ -535,10 +534,10 @@ function Dn(t, e) {
|
|
|
535
534
|
}
|
|
536
535
|
}
|
|
537
536
|
const Et = [];
|
|
538
|
-
let
|
|
537
|
+
let zt = { toasts: [] };
|
|
539
538
|
function pt(t) {
|
|
540
|
-
|
|
541
|
-
e(
|
|
539
|
+
zt = Dn(zt, t), Et.forEach((e) => {
|
|
540
|
+
e(zt);
|
|
542
541
|
});
|
|
543
542
|
}
|
|
544
543
|
function Bn({ ...t }) {
|
|
@@ -563,7 +562,7 @@ function Bn({ ...t }) {
|
|
|
563
562
|
};
|
|
564
563
|
}
|
|
565
564
|
function $n() {
|
|
566
|
-
const [t, e] = E.useState(
|
|
565
|
+
const [t, e] = E.useState(zt);
|
|
567
566
|
return E.useEffect(() => (Et.push(e), () => {
|
|
568
567
|
const r = Et.indexOf(e);
|
|
569
568
|
r > -1 && Et.splice(r, 1);
|
|
@@ -841,8 +840,8 @@ const ui = {
|
|
|
841
840
|
Video: Hr,
|
|
842
841
|
Maximize: _r,
|
|
843
842
|
Minimize: Or,
|
|
844
|
-
Table:
|
|
845
|
-
Sparkles:
|
|
843
|
+
Table: Rr,
|
|
844
|
+
Sparkles: zr,
|
|
846
845
|
Pencil: Ke,
|
|
847
846
|
Unlink: Er,
|
|
848
847
|
BetweenHorizonalEnd: Ir,
|
|
@@ -1019,47 +1018,67 @@ function dc(t) {
|
|
|
1019
1018
|
function o(s) {
|
|
1020
1019
|
s.preventDefault(), s.stopPropagation(), t == null || t.onSetLink(r.link, r.text, a);
|
|
1021
1020
|
}
|
|
1022
|
-
return /* @__PURE__ */ i("div", { className: "
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
J,
|
|
1039
|
-
{
|
|
1040
|
-
type: "url",
|
|
1041
|
-
value: r.link,
|
|
1042
|
-
required: !0,
|
|
1043
|
-
className: "richtext-pl-10",
|
|
1044
|
-
onChange: (s) => n({ ...r, link: s.target.value })
|
|
1045
|
-
}
|
|
1046
|
-
),
|
|
1047
|
-
/* @__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" }) })
|
|
1048
|
-
] }) }),
|
|
1049
|
-
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-space-x-2", children: [
|
|
1050
|
-
/* @__PURE__ */ i(et, { children: e("editor.link.dialog.openInNewTab") }),
|
|
1051
|
-
/* @__PURE__ */ i(
|
|
1052
|
-
ri,
|
|
1053
|
-
{
|
|
1054
|
-
checked: a,
|
|
1055
|
-
onCheckedChange: (s) => {
|
|
1056
|
-
c(s);
|
|
1021
|
+
return /* @__PURE__ */ i("div", { className: "border-neutral-200 richtext-rounded-lg !richtext-border richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black", children: /* @__PURE__ */ u(
|
|
1022
|
+
"form",
|
|
1023
|
+
{
|
|
1024
|
+
className: "richtext-flex richtext-flex-col richtext-gap-2",
|
|
1025
|
+
onSubmit: o,
|
|
1026
|
+
children: [
|
|
1027
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: e("editor.link.dialog.text") }),
|
|
1028
|
+
/* @__PURE__ */ i("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ i(
|
|
1029
|
+
J,
|
|
1030
|
+
{
|
|
1031
|
+
className: "richtext-w-80",
|
|
1032
|
+
onChange: (s) => n({ ...r, text: s.target.value }),
|
|
1033
|
+
placeholder: "Text",
|
|
1034
|
+
required: !0,
|
|
1035
|
+
type: "text",
|
|
1036
|
+
value: r.text
|
|
1057
1037
|
}
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1038
|
+
) }) }),
|
|
1039
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: e("editor.link.dialog.link") }),
|
|
1040
|
+
/* @__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-w-full richtext-max-w-sm richtext-items-center", children: [
|
|
1041
|
+
/* @__PURE__ */ i(
|
|
1042
|
+
J,
|
|
1043
|
+
{
|
|
1044
|
+
className: "richtext-pl-10",
|
|
1045
|
+
onChange: (s) => n({ ...r, link: s.target.value }),
|
|
1046
|
+
required: !0,
|
|
1047
|
+
type: "url",
|
|
1048
|
+
value: r.link
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ i("span", { className: "richtext-absolute richtext-inset-y-0 richtext-start-0 richtext-flex richtext-items-center richtext-justify-center richtext-px-2", children: /* @__PURE__ */ i(
|
|
1052
|
+
G,
|
|
1053
|
+
{
|
|
1054
|
+
className: "richtext-size-5 richtext-text-muted-foreground",
|
|
1055
|
+
name: "Link"
|
|
1056
|
+
}
|
|
1057
|
+
) })
|
|
1058
|
+
] }) }),
|
|
1059
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-space-x-2", children: [
|
|
1060
|
+
/* @__PURE__ */ i(et, { children: e("editor.link.dialog.openInNewTab") }),
|
|
1061
|
+
/* @__PURE__ */ i(
|
|
1062
|
+
ri,
|
|
1063
|
+
{
|
|
1064
|
+
checked: a,
|
|
1065
|
+
onCheckedChange: (s) => {
|
|
1066
|
+
c(s);
|
|
1067
|
+
}
|
|
1068
|
+
}
|
|
1069
|
+
)
|
|
1070
|
+
] }),
|
|
1071
|
+
/* @__PURE__ */ i(
|
|
1072
|
+
U,
|
|
1073
|
+
{
|
|
1074
|
+
className: "richtext-mt-2 richtext-self-end",
|
|
1075
|
+
type: "submit",
|
|
1076
|
+
children: e("editor.link.dialog.button.apply")
|
|
1077
|
+
}
|
|
1078
|
+
)
|
|
1079
|
+
]
|
|
1080
|
+
}
|
|
1081
|
+
) });
|
|
1063
1082
|
}
|
|
1064
1083
|
function uc(t, e, r = null) {
|
|
1065
1084
|
return r ? t.createChecked({ index: e }, r) : t.createAndFill({ index: e });
|
|
@@ -1086,7 +1105,7 @@ function Xt({
|
|
|
1086
1105
|
dispatch: e,
|
|
1087
1106
|
type: r
|
|
1088
1107
|
}) {
|
|
1089
|
-
const n =
|
|
1108
|
+
const n = Rt((c) => c.type.name === $t.name)(t.selection), a = Rt((c) => c.type.name === xi.name)(t.selection);
|
|
1090
1109
|
if (e && n && a) {
|
|
1091
1110
|
const c = n.node, o = a.node.attrs.index, s = c.toJSON();
|
|
1092
1111
|
let l = o;
|
|
@@ -1116,7 +1135,7 @@ function Xt({
|
|
|
1116
1135
|
return !0;
|
|
1117
1136
|
}
|
|
1118
1137
|
function Ce({ state: t, dispatch: e, type: r }) {
|
|
1119
|
-
const n =
|
|
1138
|
+
const n = Rt((c) => c.type.name === $t.name)(t.selection), a = Rt((c) => c.type.name === xi.name)(t.selection);
|
|
1120
1139
|
if (e && n && a) {
|
|
1121
1140
|
const c = n.node, o = a.node.attrs.index;
|
|
1122
1141
|
let s = 0;
|
|
@@ -1381,54 +1400,11 @@ function gi(t, e) {
|
|
|
1381
1400
|
o[c] = a.charCodeAt(c);
|
|
1382
1401
|
return new File([o], e, { type: n });
|
|
1383
1402
|
}
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
} catch {
|
|
1388
|
-
return JSON.stringify({});
|
|
1389
|
-
}
|
|
1390
|
-
}
|
|
1391
|
-
function ht(t, e = !1) {
|
|
1392
|
-
return (r) => {
|
|
1393
|
-
const n = t.startsWith("data-") ? t : `data-${t}`;
|
|
1394
|
-
let a = decodeURIComponent(r.getAttribute(n));
|
|
1395
|
-
if (a == null || typeof a == "string" && a === "null")
|
|
1396
|
-
try {
|
|
1397
|
-
const s = r.outerHTML.match(/([\s\S])+?="([\s\S])+?"/g);
|
|
1398
|
-
s && s.length && (a = (s.map((h) => h.trim()).reduce((h, d) => {
|
|
1399
|
-
const x = d.indexOf("="), m = [d.slice(0, x), d.slice(x + 1).slice(1, -1)];
|
|
1400
|
-
return h[m[0]] = m[1], h;
|
|
1401
|
-
}, {})[t.toLowerCase()] || "").replaceAll(""", '"'));
|
|
1402
|
-
} catch (o) {
|
|
1403
|
-
console.error("Error getDatasetAttribute ", o.message, r);
|
|
1404
|
-
}
|
|
1405
|
-
if (e)
|
|
1406
|
-
try {
|
|
1407
|
-
return JSON.parse(a);
|
|
1408
|
-
} catch {
|
|
1409
|
-
return {};
|
|
1410
|
-
}
|
|
1411
|
-
if (a.includes("%") || a.includes("auto"))
|
|
1412
|
-
return a;
|
|
1413
|
-
const c = Number.parseInt(a);
|
|
1414
|
-
return c !== c ? a : c;
|
|
1415
|
-
};
|
|
1416
|
-
}
|
|
1417
|
-
function yc(t) {
|
|
1418
|
-
const { attrs: e } = t;
|
|
1419
|
-
return Object.keys(e).reduce((r, n) => {
|
|
1420
|
-
const a = e[n];
|
|
1421
|
-
if (a == null)
|
|
1422
|
-
return r;
|
|
1423
|
-
let c = "";
|
|
1424
|
-
return typeof a == "object" ? c = bc(a) : c = a, r[n] = c, r;
|
|
1425
|
-
}, /* @__PURE__ */ Object.create(null));
|
|
1426
|
-
}
|
|
1427
|
-
const Cc = "_wrap_5y04w_1", Nc = "_innerWrap_5y04w_15", Ne = {
|
|
1428
|
-
wrap: Cc,
|
|
1429
|
-
innerWrap: Nc
|
|
1403
|
+
const bc = "_wrap_5y04w_1", yc = "_innerWrap_5y04w_15", Ne = {
|
|
1404
|
+
wrap: bc,
|
|
1405
|
+
innerWrap: yc
|
|
1430
1406
|
};
|
|
1431
|
-
function
|
|
1407
|
+
function Cc({ editor: t, node: e, updateAttributes: r }) {
|
|
1432
1408
|
const n = gn(), { url: a, width: c, height: o } = e.attrs, [s, l] = w("");
|
|
1433
1409
|
function h() {
|
|
1434
1410
|
s && t.chain().updateAttributes(ot.name, {
|
|
@@ -1442,19 +1418,26 @@ function Tc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1442
1418
|
[r]
|
|
1443
1419
|
);
|
|
1444
1420
|
return /* @__PURE__ */ u(ut, { children: [
|
|
1445
|
-
!a && /* @__PURE__ */ u("div", { className: "richtext-
|
|
1421
|
+
!a && /* @__PURE__ */ u("div", { className: "richtext-mx-auto richtext-my-[12px] richtext-flex richtext-max-w-[600px] richtext-items-center richtext-justify-center richtext-gap-[10px] richtext-rounded-[12px] richtext-border richtext-border-solid richtext-border-[#ccc] richtext-p-[10px]", children: [
|
|
1446
1422
|
/* @__PURE__ */ i(
|
|
1447
1423
|
J,
|
|
1448
1424
|
{
|
|
1449
|
-
|
|
1425
|
+
autoFocus: !0,
|
|
1426
|
+
className: "richtext-flex-1",
|
|
1450
1427
|
onInput: (x) => l(x.target.value),
|
|
1428
|
+
placeholder: "Enter link",
|
|
1451
1429
|
type: "url",
|
|
1452
|
-
|
|
1453
|
-
autoFocus: !0,
|
|
1454
|
-
placeholder: "Enter link"
|
|
1430
|
+
value: s
|
|
1455
1431
|
}
|
|
1456
1432
|
),
|
|
1457
|
-
/* @__PURE__ */ i(
|
|
1433
|
+
/* @__PURE__ */ i(
|
|
1434
|
+
U,
|
|
1435
|
+
{
|
|
1436
|
+
className: "richtext-w-[60px]",
|
|
1437
|
+
onClick: h,
|
|
1438
|
+
children: "OK"
|
|
1439
|
+
}
|
|
1440
|
+
)
|
|
1458
1441
|
] }),
|
|
1459
1442
|
a && /* @__PURE__ */ i(
|
|
1460
1443
|
Je,
|
|
@@ -1466,17 +1449,67 @@ function Tc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1466
1449
|
height: Number.parseInt(o) + p.height
|
|
1467
1450
|
});
|
|
1468
1451
|
},
|
|
1469
|
-
children: /* @__PURE__ */ i("div", { className: Pt(Ne.wrap, "render-wrapper"), children: /* @__PURE__ */ i(
|
|
1470
|
-
"
|
|
1452
|
+
children: /* @__PURE__ */ i("div", { className: Pt(Ne.wrap, "render-wrapper"), children: /* @__PURE__ */ i(
|
|
1453
|
+
"div",
|
|
1471
1454
|
{
|
|
1472
|
-
|
|
1473
|
-
|
|
1455
|
+
className: Ne.innerWrap,
|
|
1456
|
+
style: { pointerEvents: n ? "none" : "auto" },
|
|
1457
|
+
children: /* @__PURE__ */ i(
|
|
1458
|
+
"iframe",
|
|
1459
|
+
{
|
|
1460
|
+
className: "richtext-my-[12px] ",
|
|
1461
|
+
src: a
|
|
1462
|
+
}
|
|
1463
|
+
)
|
|
1474
1464
|
}
|
|
1475
|
-
) })
|
|
1465
|
+
) })
|
|
1476
1466
|
}
|
|
1477
1467
|
)
|
|
1478
1468
|
] });
|
|
1479
1469
|
}
|
|
1470
|
+
function Nc(t) {
|
|
1471
|
+
try {
|
|
1472
|
+
return JSON.stringify(t);
|
|
1473
|
+
} catch {
|
|
1474
|
+
return JSON.stringify({});
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
function ht(t, e = !1) {
|
|
1478
|
+
return (r) => {
|
|
1479
|
+
const n = t.startsWith("data-") ? t : `data-${t}`;
|
|
1480
|
+
let a = decodeURIComponent(r.getAttribute(n));
|
|
1481
|
+
if (a == null || typeof a == "string" && a === "null")
|
|
1482
|
+
try {
|
|
1483
|
+
const s = r.outerHTML.match(/([\S\s])+?="([\S\s])+?"/g);
|
|
1484
|
+
s && s.length > 0 && (a = (s.map((h) => h.trim()).reduce((h, d) => {
|
|
1485
|
+
const x = d.indexOf("="), m = [d.slice(0, x), d.slice(x + 1).slice(1, -1)];
|
|
1486
|
+
return h[m[0]] = m[1], h;
|
|
1487
|
+
}, {})[t.toLowerCase()] || "").replaceAll(""", '"'));
|
|
1488
|
+
} catch (o) {
|
|
1489
|
+
console.error("Error getDatasetAttribute ", o.message, r);
|
|
1490
|
+
}
|
|
1491
|
+
if (e)
|
|
1492
|
+
try {
|
|
1493
|
+
return JSON.parse(a);
|
|
1494
|
+
} catch {
|
|
1495
|
+
return {};
|
|
1496
|
+
}
|
|
1497
|
+
if (a.includes("%") || a.includes("auto"))
|
|
1498
|
+
return a;
|
|
1499
|
+
const c = Number.parseInt(a);
|
|
1500
|
+
return c !== c ? a : c;
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
function Tc(t) {
|
|
1504
|
+
const { attrs: e } = t;
|
|
1505
|
+
return Object.keys(e).reduce((r, n) => {
|
|
1506
|
+
const a = e[n];
|
|
1507
|
+
if (a == null)
|
|
1508
|
+
return r;
|
|
1509
|
+
let c = "";
|
|
1510
|
+
return typeof a == "object" ? c = Nc(a) : c = a, r[n] = c, r;
|
|
1511
|
+
}, /* @__PURE__ */ Object.create(null));
|
|
1512
|
+
}
|
|
1480
1513
|
const ot = dt.create({
|
|
1481
1514
|
name: "iframe",
|
|
1482
1515
|
content: "",
|
|
@@ -1568,7 +1601,7 @@ const ot = dt.create({
|
|
|
1568
1601
|
];
|
|
1569
1602
|
},
|
|
1570
1603
|
addNodeView() {
|
|
1571
|
-
return xt(
|
|
1604
|
+
return xt(Cc);
|
|
1572
1605
|
}
|
|
1573
1606
|
}), St = E.forwardRef(
|
|
1574
1607
|
({ className: t, ...e }, r) => /* @__PURE__ */ i(
|
|
@@ -1620,38 +1653,68 @@ function Sc({ editor: t, ...e }) {
|
|
|
1620
1653
|
return o;
|
|
1621
1654
|
}
|
|
1622
1655
|
}, [o]), d = P(
|
|
1623
|
-
() => `${o}`.trim() ? /* @__PURE__ */ i(
|
|
1656
|
+
() => `${o}`.trim() ? /* @__PURE__ */ i(
|
|
1657
|
+
"span",
|
|
1658
|
+
{
|
|
1659
|
+
contentEditable: !1,
|
|
1660
|
+
dangerouslySetInnerHTML: { __html: h || "" }
|
|
1661
|
+
}
|
|
1662
|
+
) : null,
|
|
1624
1663
|
[o, h]
|
|
1625
1664
|
);
|
|
1626
1665
|
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
1627
1666
|
/* @__PURE__ */ i(ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1628
1667
|
v,
|
|
1629
1668
|
{
|
|
1630
|
-
|
|
1631
|
-
|
|
1669
|
+
icon: e == null ? void 0 : e.icon,
|
|
1670
|
+
tooltip: e == null ? void 0 : e.tooltip
|
|
1632
1671
|
}
|
|
1633
1672
|
) }),
|
|
1634
|
-
/* @__PURE__ */ u(
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1673
|
+
/* @__PURE__ */ u(
|
|
1674
|
+
ct,
|
|
1675
|
+
{
|
|
1676
|
+
align: "start",
|
|
1677
|
+
className: "richtext-size-full richtext-p-2",
|
|
1678
|
+
hideWhenDetached: !0,
|
|
1679
|
+
side: "bottom",
|
|
1680
|
+
children: [
|
|
1681
|
+
/* @__PURE__ */ i(et, { className: "richtext-mb-[6px]", children: r("editor.formula.dialog.text") }),
|
|
1682
|
+
/* @__PURE__ */ i("div", { className: "richtext-mb-[16px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm", children: /* @__PURE__ */ i(
|
|
1683
|
+
St,
|
|
1684
|
+
{
|
|
1685
|
+
autoFocus: !0,
|
|
1686
|
+
className: "richtext-w-full",
|
|
1687
|
+
defaultValue: a,
|
|
1688
|
+
onChange: (x) => s(x.target.value),
|
|
1689
|
+
placeholder: "Text",
|
|
1690
|
+
required: !0,
|
|
1691
|
+
rows: 3,
|
|
1692
|
+
value: o
|
|
1693
|
+
}
|
|
1694
|
+
) }) }),
|
|
1695
|
+
d && /* @__PURE__ */ i("div", { className: "richtext-my-[10px] richtext-max-w-[286px] richtext-overflow-auto richtext-whitespace-nowrap richtext-rounded-[6px] !richtext-border richtext-p-[10px]", children: d }),
|
|
1696
|
+
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-items-center richtext-justify-between richtext-gap-[6px]", children: [
|
|
1697
|
+
/* @__PURE__ */ i(
|
|
1698
|
+
U,
|
|
1699
|
+
{
|
|
1700
|
+
className: "richtext-flex-1",
|
|
1701
|
+
onClick: l,
|
|
1702
|
+
children: "Submit"
|
|
1703
|
+
}
|
|
1704
|
+
),
|
|
1705
|
+
/* @__PURE__ */ i(
|
|
1706
|
+
"a",
|
|
1707
|
+
{
|
|
1708
|
+
href: "https://katex.org/docs/supported",
|
|
1709
|
+
rel: "noreferrer noopener",
|
|
1710
|
+
target: "_blank",
|
|
1711
|
+
children: /* @__PURE__ */ i(Ze, { size: 16 })
|
|
1712
|
+
}
|
|
1713
|
+
)
|
|
1714
|
+
] })
|
|
1715
|
+
]
|
|
1716
|
+
}
|
|
1717
|
+
)
|
|
1655
1718
|
] });
|
|
1656
1719
|
}
|
|
1657
1720
|
const pi = Be("light");
|
|
@@ -1720,8 +1783,7 @@ const lt = dt.create({
|
|
|
1720
1783
|
component: Sc,
|
|
1721
1784
|
componentProps: {
|
|
1722
1785
|
editor: t,
|
|
1723
|
-
action: () =>
|
|
1724
|
-
},
|
|
1786
|
+
action: () => !0,
|
|
1725
1787
|
isActive: () => !1,
|
|
1726
1788
|
disabled: !1,
|
|
1727
1789
|
icon: "KatexIcon",
|
|
@@ -1767,21 +1829,120 @@ const lt = dt.create({
|
|
|
1767
1829
|
addNodeView() {
|
|
1768
1830
|
return xt(Ic);
|
|
1769
1831
|
}
|
|
1770
|
-
})
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
}
|
|
1776
|
-
|
|
1777
|
-
|
|
1832
|
+
});
|
|
1833
|
+
let qt;
|
|
1834
|
+
function se() {
|
|
1835
|
+
try {
|
|
1836
|
+
return qt || (qt = _i()), qt;
|
|
1837
|
+
} catch {
|
|
1838
|
+
throw new Error("Error EventEmitter");
|
|
1839
|
+
}
|
|
1840
|
+
}
|
|
1841
|
+
const ie = "OPEN_EXCALIDRAW_SETTING_MODAL";
|
|
1842
|
+
function zc(t, e) {
|
|
1843
|
+
se().on(t, e);
|
|
1844
|
+
}
|
|
1845
|
+
function Rc(t, e) {
|
|
1846
|
+
se().off(t, e);
|
|
1847
|
+
}
|
|
1848
|
+
function Oc(t) {
|
|
1849
|
+
se().emit(ie, t);
|
|
1850
|
+
}
|
|
1851
|
+
const _c = ({ editor: t }) => {
|
|
1852
|
+
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(
|
|
1853
|
+
(k) => {
|
|
1854
|
+
k && import("@excalidraw/excalidraw").then((z) => {
|
|
1855
|
+
r(z.Excalidraw);
|
|
1856
|
+
}).catch(m).finally(() => d(!1));
|
|
1857
|
+
},
|
|
1858
|
+
[d]
|
|
1859
|
+
), p = C((k) => {
|
|
1860
|
+
setTimeout(() => {
|
|
1861
|
+
k.refresh();
|
|
1862
|
+
});
|
|
1863
|
+
}, []), b = C((k, z, $) => {
|
|
1864
|
+
a({
|
|
1865
|
+
elements: k,
|
|
1866
|
+
appState: { isLoading: !1 },
|
|
1867
|
+
files: $
|
|
1868
|
+
});
|
|
1869
|
+
}, []), T = C(() => {
|
|
1870
|
+
if (!e) {
|
|
1871
|
+
l(!1);
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
t.chain().focus().setExcalidraw({ data: n }).run(), l(!1);
|
|
1875
|
+
}, [e, t, n, l]);
|
|
1876
|
+
return I(() => {
|
|
1877
|
+
const k = (z) => {
|
|
1878
|
+
l(!0), z && o(z.data);
|
|
1879
|
+
};
|
|
1880
|
+
return zc(ie, k), () => {
|
|
1881
|
+
Rc(ie, k);
|
|
1882
|
+
};
|
|
1883
|
+
}, [t, l]), /* @__PURE__ */ u(
|
|
1884
|
+
jt,
|
|
1885
|
+
{
|
|
1886
|
+
onOpenChange: l,
|
|
1887
|
+
open: s,
|
|
1888
|
+
children: [
|
|
1889
|
+
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1890
|
+
v,
|
|
1891
|
+
{
|
|
1892
|
+
action: () => l(!0),
|
|
1893
|
+
icon: "Excalidraw",
|
|
1894
|
+
tooltip: "Excalidraw"
|
|
1895
|
+
}
|
|
1896
|
+
) }),
|
|
1897
|
+
/* @__PURE__ */ u(Nt, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
1898
|
+
/* @__PURE__ */ i(kt, { children: "Excalidraw" }),
|
|
1899
|
+
/* @__PURE__ */ u("div", { style: { height: "100%", borderWidth: 1 }, children: [
|
|
1900
|
+
h && /* @__PURE__ */ i("p", { children: "Loading..." }),
|
|
1901
|
+
x && /* @__PURE__ */ i("p", { children: x && x.message || "Error" }),
|
|
1902
|
+
/* @__PURE__ */ i(
|
|
1903
|
+
"div",
|
|
1904
|
+
{
|
|
1905
|
+
ref: f,
|
|
1906
|
+
style: { width: "100%", height: 600 },
|
|
1907
|
+
children: !h && !x && e ? /* @__PURE__ */ i(
|
|
1908
|
+
e,
|
|
1909
|
+
{
|
|
1910
|
+
initialData: c,
|
|
1911
|
+
langCode: "en",
|
|
1912
|
+
onChange: b,
|
|
1913
|
+
ref: p
|
|
1914
|
+
}
|
|
1915
|
+
) : null
|
|
1916
|
+
}
|
|
1917
|
+
)
|
|
1918
|
+
] }),
|
|
1919
|
+
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
1920
|
+
U,
|
|
1921
|
+
{
|
|
1922
|
+
onClick: T,
|
|
1923
|
+
type: "button",
|
|
1924
|
+
children: "Save changes"
|
|
1925
|
+
}
|
|
1926
|
+
) })
|
|
1927
|
+
] })
|
|
1928
|
+
]
|
|
1929
|
+
}
|
|
1930
|
+
);
|
|
1931
|
+
}, Hc = "_wrap_15k3c_1", Pc = "_renderWrap_15k3c_7", Dc = "_title_15k3c_14", Bc = "_handlerWrap_15k3c_30", gt = {
|
|
1932
|
+
wrap: Hc,
|
|
1933
|
+
renderWrap: Pc,
|
|
1934
|
+
title: Dc,
|
|
1935
|
+
handlerWrap: Bc
|
|
1936
|
+
}, $c = 10, Vc = 200, Te = 15, ke = { width: "100%", height: "100%", maxWidth: "100%" };
|
|
1937
|
+
function Wc({ editor: t, node: e, updateAttributes: r }) {
|
|
1938
|
+
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), z = C(
|
|
1778
1939
|
(M) => {
|
|
1779
1940
|
M && b(!0);
|
|
1780
1941
|
},
|
|
1781
1942
|
[b]
|
|
1782
1943
|
), $ = C((M) => () => {
|
|
1783
1944
|
k(
|
|
1784
|
-
(B) => ti(M === "minus" ? B - Te : B + Te,
|
|
1945
|
+
(B) => ti(M === "minus" ? B - Te : B + Te, $c, Vc)
|
|
1785
1946
|
);
|
|
1786
1947
|
}, []);
|
|
1787
1948
|
I(() => {
|
|
@@ -1805,7 +1966,7 @@ function Dc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1805
1966
|
const F = (M) => {
|
|
1806
1967
|
r({ width: M.width, height: M.height });
|
|
1807
1968
|
};
|
|
1808
|
-
return /* @__PURE__ */ i(ut, { className: Pt(gt.wrap, a && gt.isActive), children: /* @__PURE__ */ i(Wi, { onChange:
|
|
1969
|
+
return /* @__PURE__ */ i(ut, { className: Pt(gt.wrap, a && gt.isActive), children: /* @__PURE__ */ i(Wi, { onChange: z, children: /* @__PURE__ */ i(
|
|
1809
1970
|
Je,
|
|
1810
1971
|
{
|
|
1811
1972
|
size: { width: Number.parseInt(o), height: Number.parseInt(s) },
|
|
@@ -1826,6 +1987,7 @@ function Dc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1826
1987
|
!d && !m && p && /* @__PURE__ */ i(
|
|
1827
1988
|
"div",
|
|
1828
1989
|
{
|
|
1990
|
+
dangerouslySetInnerHTML: { __html: (l == null ? void 0 : l.outerHTML) ?? "" },
|
|
1829
1991
|
style: {
|
|
1830
1992
|
height: "100%",
|
|
1831
1993
|
maxHeight: "100%",
|
|
@@ -1836,8 +1998,7 @@ function Dc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1836
1998
|
alignItems: "center",
|
|
1837
1999
|
transform: `scale(${T / 100})`,
|
|
1838
2000
|
transition: "all ease-in-out .3s"
|
|
1839
|
-
}
|
|
1840
|
-
dangerouslySetInnerHTML: { __html: (l == null ? void 0 : l.outerHTML) ?? "" }
|
|
2001
|
+
}
|
|
1841
2002
|
}
|
|
1842
2003
|
),
|
|
1843
2004
|
/* @__PURE__ */ i("div", { className: gt.title }),
|
|
@@ -1845,16 +2006,16 @@ function Dc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1845
2006
|
/* @__PURE__ */ i(
|
|
1846
2007
|
v,
|
|
1847
2008
|
{
|
|
1848
|
-
icon: "ZoomOut",
|
|
1849
2009
|
action: $("minus"),
|
|
2010
|
+
icon: "ZoomOut",
|
|
1850
2011
|
tooltip: "Zoom Out"
|
|
1851
2012
|
}
|
|
1852
2013
|
),
|
|
1853
2014
|
/* @__PURE__ */ i(
|
|
1854
2015
|
v,
|
|
1855
2016
|
{
|
|
1856
|
-
icon: "ZoomIn",
|
|
1857
2017
|
action: $("plus"),
|
|
2018
|
+
icon: "ZoomIn",
|
|
1858
2019
|
tooltip: "Zoom In"
|
|
1859
2020
|
}
|
|
1860
2021
|
)
|
|
@@ -1865,91 +2026,7 @@ function Dc({ editor: t, node: e, updateAttributes: r }) {
|
|
|
1865
2026
|
}
|
|
1866
2027
|
) }) });
|
|
1867
2028
|
}
|
|
1868
|
-
const
|
|
1869
|
-
let qt;
|
|
1870
|
-
function se() {
|
|
1871
|
-
try {
|
|
1872
|
-
return qt || (qt = _i()), qt;
|
|
1873
|
-
} catch {
|
|
1874
|
-
throw new Error("Error EventEmitter");
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
const ie = "OPEN_EXCALIDRAW_SETTING_MODAL";
|
|
1878
|
-
function $c(t, e) {
|
|
1879
|
-
se().on(t, e);
|
|
1880
|
-
}
|
|
1881
|
-
function Vc(t, e) {
|
|
1882
|
-
se().off(t, e);
|
|
1883
|
-
}
|
|
1884
|
-
function Wc(t) {
|
|
1885
|
-
se().emit(ie, t);
|
|
1886
|
-
}
|
|
1887
|
-
const jc = ({ editor: t }) => {
|
|
1888
|
-
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(
|
|
1889
|
-
(k) => {
|
|
1890
|
-
k && import("@excalidraw/excalidraw").then((R) => {
|
|
1891
|
-
r(R.Excalidraw);
|
|
1892
|
-
}).catch(m).finally(() => d(!1));
|
|
1893
|
-
},
|
|
1894
|
-
[d]
|
|
1895
|
-
), p = C((k) => {
|
|
1896
|
-
setTimeout(() => {
|
|
1897
|
-
k.refresh();
|
|
1898
|
-
});
|
|
1899
|
-
}, []), b = C((k, R, $) => {
|
|
1900
|
-
a({
|
|
1901
|
-
elements: k,
|
|
1902
|
-
appState: { isLoading: !1 },
|
|
1903
|
-
files: $
|
|
1904
|
-
});
|
|
1905
|
-
}, []), T = C(() => {
|
|
1906
|
-
if (!e) {
|
|
1907
|
-
l(!1);
|
|
1908
|
-
return;
|
|
1909
|
-
}
|
|
1910
|
-
t.chain().focus().setExcalidraw({ data: n }).run(), l(!1);
|
|
1911
|
-
}, [e, t, n, l]);
|
|
1912
|
-
return I(() => {
|
|
1913
|
-
const k = (R) => {
|
|
1914
|
-
l(!0), R && o(R.data);
|
|
1915
|
-
};
|
|
1916
|
-
return $c(ie, k), () => {
|
|
1917
|
-
Vc(ie, k);
|
|
1918
|
-
};
|
|
1919
|
-
}, [t, l]), /* @__PURE__ */ u(
|
|
1920
|
-
jt,
|
|
1921
|
-
{
|
|
1922
|
-
open: s,
|
|
1923
|
-
onOpenChange: l,
|
|
1924
|
-
children: [
|
|
1925
|
-
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
1926
|
-
v,
|
|
1927
|
-
{
|
|
1928
|
-
icon: "Excalidraw",
|
|
1929
|
-
tooltip: "Excalidraw",
|
|
1930
|
-
action: () => l(!0)
|
|
1931
|
-
}
|
|
1932
|
-
) }),
|
|
1933
|
-
/* @__PURE__ */ u(Nt, { className: "!richtext-max-w-[1300px] richtext-z-[99999]", children: [
|
|
1934
|
-
/* @__PURE__ */ i(kt, { children: "Excalidraw" }),
|
|
1935
|
-
/* @__PURE__ */ u("div", { style: { height: "100%", borderWidth: 1 }, children: [
|
|
1936
|
-
h && /* @__PURE__ */ i("p", { children: "Loading..." }),
|
|
1937
|
-
x && /* @__PURE__ */ i("p", { children: x && x.message || "Error" }),
|
|
1938
|
-
/* @__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 })
|
|
1939
|
-
] }),
|
|
1940
|
-
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
1941
|
-
U,
|
|
1942
|
-
{
|
|
1943
|
-
type: "button",
|
|
1944
|
-
onClick: T,
|
|
1945
|
-
children: "Save changes"
|
|
1946
|
-
}
|
|
1947
|
-
) })
|
|
1948
|
-
] })
|
|
1949
|
-
]
|
|
1950
|
-
}
|
|
1951
|
-
);
|
|
1952
|
-
}, Se = { elements: [] }, st = dt.create({
|
|
2029
|
+
const jc = Oe.memo(Wc, (t, e) => !!We(t.node.attrs, e.node.attrs)), Se = { elements: [] }, st = dt.create({
|
|
1953
2030
|
name: "excalidraw",
|
|
1954
2031
|
group: "block",
|
|
1955
2032
|
selectable: !0,
|
|
@@ -1986,7 +2063,7 @@ const jc = ({ editor: t }) => {
|
|
|
1986
2063
|
class: "excalidraw"
|
|
1987
2064
|
},
|
|
1988
2065
|
button: ({ editor: e }) => ({
|
|
1989
|
-
component:
|
|
2066
|
+
component: _c,
|
|
1990
2067
|
componentProps: {
|
|
1991
2068
|
editor: e
|
|
1992
2069
|
}
|
|
@@ -2001,7 +2078,7 @@ const jc = ({ editor: t }) => {
|
|
|
2001
2078
|
];
|
|
2002
2079
|
},
|
|
2003
2080
|
renderHTML({ HTMLAttributes: t, node: e }) {
|
|
2004
|
-
return ["div", it(this.options.HTMLAttributes, t,
|
|
2081
|
+
return ["div", it(this.options.HTMLAttributes, t, Tc(e))];
|
|
2005
2082
|
},
|
|
2006
2083
|
addCommands() {
|
|
2007
2084
|
return {
|
|
@@ -2015,7 +2092,7 @@ const jc = ({ editor: t }) => {
|
|
|
2015
2092
|
};
|
|
2016
2093
|
},
|
|
2017
2094
|
addNodeView() {
|
|
2018
|
-
return xt(
|
|
2095
|
+
return xt(jc);
|
|
2019
2096
|
},
|
|
2020
2097
|
addInputRules() {
|
|
2021
2098
|
return [
|
|
@@ -2026,13 +2103,94 @@ const jc = ({ editor: t }) => {
|
|
|
2026
2103
|
})
|
|
2027
2104
|
];
|
|
2028
2105
|
}
|
|
2029
|
-
})
|
|
2106
|
+
});
|
|
2107
|
+
function Fc({ selectImage: t, giphyApiKey: e, children: r }) {
|
|
2108
|
+
const [n, a] = w([]), [c] = w(15), o = nt(null), s = (h, d = "search") => {
|
|
2109
|
+
if (!e)
|
|
2110
|
+
return;
|
|
2111
|
+
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}`;
|
|
2112
|
+
fetch(m).then((f) => f.json()).then((f) => {
|
|
2113
|
+
a(f.data);
|
|
2114
|
+
}).catch((f) => {
|
|
2115
|
+
console.log(f);
|
|
2116
|
+
});
|
|
2117
|
+
};
|
|
2118
|
+
I(() => {
|
|
2119
|
+
s("", "trend");
|
|
2120
|
+
}, []);
|
|
2121
|
+
const l = C(
|
|
2122
|
+
Ve((h) => {
|
|
2123
|
+
if (!h.target.value) {
|
|
2124
|
+
s("", "trend");
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
2127
|
+
s(h.target.value);
|
|
2128
|
+
}, 350),
|
|
2129
|
+
// Adjust the debounce delay as needed
|
|
2130
|
+
[]
|
|
2131
|
+
);
|
|
2132
|
+
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
2133
|
+
/* @__PURE__ */ i(ft, { asChild: !0, children: r }),
|
|
2134
|
+
/* @__PURE__ */ i(
|
|
2135
|
+
ct,
|
|
2136
|
+
{
|
|
2137
|
+
align: "start",
|
|
2138
|
+
className: "richtext-size-full richtext-p-2",
|
|
2139
|
+
hideWhenDetached: !0,
|
|
2140
|
+
side: "bottom",
|
|
2141
|
+
children: e ? /* @__PURE__ */ u(_, { children: [
|
|
2142
|
+
/* @__PURE__ */ i("div", { className: "richtext-mb-[10px] richtext-w-full", children: /* @__PURE__ */ i(
|
|
2143
|
+
J,
|
|
2144
|
+
{
|
|
2145
|
+
onChange: l,
|
|
2146
|
+
placeholder: "Search GIF",
|
|
2147
|
+
ref: o,
|
|
2148
|
+
type: "text"
|
|
2149
|
+
}
|
|
2150
|
+
) }),
|
|
2151
|
+
/* @__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(
|
|
2152
|
+
"img",
|
|
2153
|
+
{
|
|
2154
|
+
alt: "giphy",
|
|
2155
|
+
className: "richtext-cursor-pointer richtext-text-center",
|
|
2156
|
+
height: h.images.fixed_width_downsampled.height,
|
|
2157
|
+
onClick: () => t(h),
|
|
2158
|
+
src: h.images.fixed_width_downsampled.url,
|
|
2159
|
+
width: h.images.fixed_width_downsampled.width
|
|
2160
|
+
},
|
|
2161
|
+
`giphy-${h.id}`
|
|
2162
|
+
)) : /* @__PURE__ */ i("p", { children: "No GIFs found" }) }) })
|
|
2163
|
+
] }) : /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("p", { children: "Missing Giphy API Key" }) })
|
|
2164
|
+
}
|
|
2165
|
+
)
|
|
2166
|
+
] });
|
|
2167
|
+
}
|
|
2168
|
+
function Gc({ editor: t, icon: e, giphyApiKey: r, ...n }) {
|
|
2169
|
+
return /* @__PURE__ */ i(
|
|
2170
|
+
Fc,
|
|
2171
|
+
{
|
|
2172
|
+
giphyApiKey: r,
|
|
2173
|
+
selectImage: (c) => {
|
|
2174
|
+
const { url: o } = c.images.original;
|
|
2175
|
+
t.chain().focus().setImageGif({ src: o }).run();
|
|
2176
|
+
},
|
|
2177
|
+
children: /* @__PURE__ */ i(
|
|
2178
|
+
v,
|
|
2179
|
+
{
|
|
2180
|
+
icon: e,
|
|
2181
|
+
tooltip: n == null ? void 0 : n.tooltip
|
|
2182
|
+
}
|
|
2183
|
+
)
|
|
2184
|
+
}
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2187
|
+
const Lt = {
|
|
2030
2188
|
TOP_LEFT: "tl",
|
|
2031
2189
|
TOP_RIGHT: "tr",
|
|
2032
2190
|
BOTTOM_LEFT: "bl",
|
|
2033
2191
|
BOTTOM_RIGHT: "br"
|
|
2034
2192
|
};
|
|
2035
|
-
function
|
|
2193
|
+
function Uc(t) {
|
|
2036
2194
|
var B, W;
|
|
2037
2195
|
const [e, r] = w({
|
|
2038
2196
|
width: Ot,
|
|
@@ -2052,8 +2210,8 @@ function Fc(t) {
|
|
|
2052
2210
|
h: 0,
|
|
2053
2211
|
dir: ""
|
|
2054
2212
|
}), { align: d } = (B = t == null ? void 0 : t.node) == null ? void 0 : B.attrs, x = P(() => {
|
|
2055
|
-
var
|
|
2056
|
-
const { src: N, alt: H, width: y, height: g } = (
|
|
2213
|
+
var R;
|
|
2214
|
+
const { src: N, alt: H, width: y, height: g } = (R = t == null ? void 0 : t.node) == null ? void 0 : R.attrs, O = ge(y) ? `${y}px` : y, S = ge(g) ? `${g}px` : g;
|
|
2057
2215
|
return {
|
|
2058
2216
|
src: N || void 0,
|
|
2059
2217
|
alt: H || void 0,
|
|
@@ -2091,14 +2249,14 @@ function Fc(t) {
|
|
|
2091
2249
|
function T(N, H) {
|
|
2092
2250
|
N.preventDefault(), N.stopPropagation();
|
|
2093
2251
|
const y = n.width, g = n.height, O = y / g;
|
|
2094
|
-
let S = Number(t.node.attrs.width),
|
|
2252
|
+
let S = Number(t.node.attrs.width), R = Number(t.node.attrs.height);
|
|
2095
2253
|
const A = e.width;
|
|
2096
|
-
S && !
|
|
2254
|
+
S && !R ? (S = S > A ? A : S, R = Math.round(S / O)) : R && !S ? (S = Math.round(R * O), S = S > A ? A : S) : !S && !R ? (S = y > A ? A : y, R = Math.round(S / O)) : S = S > A ? A : S, Bt(() => {
|
|
2097
2255
|
s(!0), h({
|
|
2098
2256
|
x: N.clientX,
|
|
2099
2257
|
y: N.clientY,
|
|
2100
2258
|
w: S,
|
|
2101
|
-
h:
|
|
2259
|
+
h: R,
|
|
2102
2260
|
dir: H
|
|
2103
2261
|
});
|
|
2104
2262
|
});
|
|
@@ -2114,7 +2272,7 @@ function Fc(t) {
|
|
|
2114
2272
|
});
|
|
2115
2273
|
}, _t),
|
|
2116
2274
|
[o, l, e, t.updateAttributes]
|
|
2117
|
-
),
|
|
2275
|
+
), z = C(
|
|
2118
2276
|
(N) => {
|
|
2119
2277
|
N.preventDefault(), N.stopPropagation(), o && (Bt(() => {
|
|
2120
2278
|
h({
|
|
@@ -2128,114 +2286,50 @@ function Fc(t) {
|
|
|
2128
2286
|
},
|
|
2129
2287
|
[o, p]
|
|
2130
2288
|
), $ = C(() => {
|
|
2131
|
-
document == null || document.addEventListener("mousemove", k, !0), document == null || document.addEventListener("mouseup",
|
|
2132
|
-
}, [k,
|
|
2133
|
-
document == null || document.removeEventListener("mousemove", k, !0), document == null || document.removeEventListener("mouseup",
|
|
2134
|
-
}, [k,
|
|
2289
|
+
document == null || document.addEventListener("mousemove", k, !0), document == null || document.addEventListener("mouseup", z, !0);
|
|
2290
|
+
}, [k, z]), F = C(() => {
|
|
2291
|
+
document == null || document.removeEventListener("mousemove", k, !0), document == null || document.removeEventListener("mouseup", z, !0);
|
|
2292
|
+
}, [k, z]);
|
|
2135
2293
|
I(() => (o ? $() : F(), () => {
|
|
2136
2294
|
F();
|
|
2137
2295
|
}), [o, $, F]);
|
|
2138
2296
|
const M = P(() => new ResizeObserver(() => b()), [b]);
|
|
2139
|
-
return I(() => (M.observe(t.editor.view.dom), () => {
|
|
2140
|
-
M.disconnect();
|
|
2141
|
-
}), [t.editor.view.dom, M]), /* @__PURE__ */ i(
|
|
2142
|
-
|
|
2143
|
-
{
|
|
2144
|
-
draggable: "true",
|
|
2145
|
-
"data-drag-handle": !0,
|
|
2146
|
-
className: `image-view__body ${t != null && t.selected ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
|
|
2147
|
-
style: m,
|
|
2148
|
-
children: [
|
|
2149
|
-
/* @__PURE__ */ i(
|
|
2150
|
-
"img",
|
|
2151
|
-
{
|
|
2152
|
-
src: x.src,
|
|
2153
|
-
alt: x.alt,
|
|
2154
|
-
style: x.style,
|
|
2155
|
-
height: "auto",
|
|
2156
|
-
className: "image-view__body__image block",
|
|
2157
|
-
onLoad: f,
|
|
2158
|
-
onClick: p
|
|
2159
|
-
}
|
|
2160
|
-
),
|
|
2161
|
-
(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(
|
|
2162
|
-
"span",
|
|
2163
|
-
{
|
|
2164
|
-
className: `image-resizer__handler image-resizer__handler--${N}`,
|
|
2165
|
-
onMouseDown: (H) => T(H, N)
|
|
2166
|
-
},
|
|
2167
|
-
`image-dir-${N}`
|
|
2168
|
-
)) })
|
|
2169
|
-
]
|
|
2170
|
-
}
|
|
2171
|
-
) });
|
|
2172
|
-
}
|
|
2173
|
-
function Gc({ selectImage: t, giphyApiKey: e, children: r }) {
|
|
2174
|
-
const [n, a] = w([]), [c] = w(15), o = nt(null), s = (h, d = "search") => {
|
|
2175
|
-
if (!e)
|
|
2176
|
-
return;
|
|
2177
|
-
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}`;
|
|
2178
|
-
fetch(m).then((f) => f.json()).then((f) => {
|
|
2179
|
-
a(f.data);
|
|
2180
|
-
}).catch((f) => {
|
|
2181
|
-
console.log(f);
|
|
2182
|
-
});
|
|
2183
|
-
};
|
|
2184
|
-
I(() => {
|
|
2185
|
-
s("", "trend");
|
|
2186
|
-
}, []);
|
|
2187
|
-
const l = C(
|
|
2188
|
-
Ve((h) => {
|
|
2189
|
-
if (!h.target.value) {
|
|
2190
|
-
s("", "trend");
|
|
2191
|
-
return;
|
|
2192
|
-
}
|
|
2193
|
-
s(h.target.value);
|
|
2194
|
-
}, 350),
|
|
2195
|
-
// Adjust the debounce delay as needed
|
|
2196
|
-
[]
|
|
2197
|
-
);
|
|
2198
|
-
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
2199
|
-
/* @__PURE__ */ i(ft, { asChild: !0, children: r }),
|
|
2200
|
-
/* @__PURE__ */ i(ct, { hideWhenDetached: !0, className: "richtext-w-full richtext-h-full richtext-p-2", align: "start", side: "bottom", children: e ? /* @__PURE__ */ u(_, { children: [
|
|
2201
|
-
/* @__PURE__ */ i("div", { className: "richtext-w-full richtext-mb-[10px]", children: /* @__PURE__ */ i(
|
|
2202
|
-
J,
|
|
2203
|
-
{
|
|
2204
|
-
ref: o,
|
|
2205
|
-
type: "text",
|
|
2206
|
-
placeholder: "Search GIF",
|
|
2207
|
-
onChange: l
|
|
2208
|
-
}
|
|
2209
|
-
) }),
|
|
2210
|
-
/* @__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(
|
|
2211
|
-
"img",
|
|
2212
|
-
{
|
|
2213
|
-
alt: "giphy",
|
|
2214
|
-
className: "richtext-text-center richtext-cursor-pointer",
|
|
2215
|
-
onClick: (d) => t(h),
|
|
2216
|
-
height: h.images.fixed_width_downsampled.height,
|
|
2217
|
-
width: h.images.fixed_width_downsampled.width,
|
|
2218
|
-
src: h.images.fixed_width_downsampled.url
|
|
2219
|
-
},
|
|
2220
|
-
`giphy-${h.id}`
|
|
2221
|
-
)) : /* @__PURE__ */ i("p", { children: "No GIFs found" }) }) })
|
|
2222
|
-
] }) : /* @__PURE__ */ i("div", { children: /* @__PURE__ */ i("p", { children: "Missing Giphy API Key" }) }) })
|
|
2223
|
-
] });
|
|
2224
|
-
}
|
|
2225
|
-
function Uc({ editor: t, icon: e, giphyApiKey: r, ...n }) {
|
|
2226
|
-
return /* @__PURE__ */ i(
|
|
2227
|
-
Gc,
|
|
2297
|
+
return I(() => (M.observe(t.editor.view.dom), () => {
|
|
2298
|
+
M.disconnect();
|
|
2299
|
+
}), [t.editor.view.dom, M]), /* @__PURE__ */ i(
|
|
2300
|
+
ut,
|
|
2228
2301
|
{
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
giphyApiKey: r,
|
|
2234
|
-
children: /* @__PURE__ */ i(
|
|
2235
|
-
v,
|
|
2302
|
+
className: "image-view",
|
|
2303
|
+
style: { ...m, width: "100%", textAlign: d },
|
|
2304
|
+
children: /* @__PURE__ */ u(
|
|
2305
|
+
"div",
|
|
2236
2306
|
{
|
|
2237
|
-
|
|
2238
|
-
|
|
2307
|
+
"data-drag-handle": !0,
|
|
2308
|
+
draggable: "true",
|
|
2309
|
+
style: m,
|
|
2310
|
+
className: `image-view__body ${t != null && t.selected ? "image-view__body--focused" : ""} ${o ? "image-view__body--resizing" : ""}`,
|
|
2311
|
+
children: [
|
|
2312
|
+
/* @__PURE__ */ i(
|
|
2313
|
+
"img",
|
|
2314
|
+
{
|
|
2315
|
+
alt: x.alt,
|
|
2316
|
+
className: "image-view__body__image block",
|
|
2317
|
+
height: "auto",
|
|
2318
|
+
onClick: p,
|
|
2319
|
+
onLoad: f,
|
|
2320
|
+
src: x.src,
|
|
2321
|
+
style: x.style
|
|
2322
|
+
}
|
|
2323
|
+
),
|
|
2324
|
+
(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(
|
|
2325
|
+
"span",
|
|
2326
|
+
{
|
|
2327
|
+
className: `image-resizer__handler image-resizer__handler--${N}`,
|
|
2328
|
+
onMouseDown: (H) => T(H, N)
|
|
2329
|
+
},
|
|
2330
|
+
`image-dir-${N}`
|
|
2331
|
+
)) })
|
|
2332
|
+
]
|
|
2239
2333
|
}
|
|
2240
2334
|
)
|
|
2241
2335
|
}
|
|
@@ -2259,7 +2353,7 @@ const wi = He.extend({
|
|
|
2259
2353
|
var c;
|
|
2260
2354
|
const a = ((c = r == null ? void 0 : r.options) == null ? void 0 : c.GIPHY_API_KEY) || "";
|
|
2261
2355
|
return {
|
|
2262
|
-
component:
|
|
2356
|
+
component: Gc,
|
|
2263
2357
|
componentProps: {
|
|
2264
2358
|
editor: e,
|
|
2265
2359
|
action: () => {
|
|
@@ -2298,7 +2392,7 @@ const wi = He.extend({
|
|
|
2298
2392
|
};
|
|
2299
2393
|
},
|
|
2300
2394
|
addNodeView() {
|
|
2301
|
-
return xt(
|
|
2395
|
+
return xt(Uc);
|
|
2302
2396
|
},
|
|
2303
2397
|
addCommands() {
|
|
2304
2398
|
var t;
|
|
@@ -2380,31 +2474,31 @@ a-->b`, Kc = ({ editor: t, upload: e }) => {
|
|
|
2380
2474
|
}, [r]), /* @__PURE__ */ u(
|
|
2381
2475
|
jt,
|
|
2382
2476
|
{
|
|
2383
|
-
open: o,
|
|
2384
2477
|
onOpenChange: s,
|
|
2478
|
+
open: o,
|
|
2385
2479
|
children: [
|
|
2386
2480
|
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
2387
2481
|
v,
|
|
2388
2482
|
{
|
|
2483
|
+
action: () => s(!0),
|
|
2389
2484
|
icon: "Mermaid",
|
|
2390
|
-
tooltip: "Mermaid"
|
|
2391
|
-
action: () => s(!0)
|
|
2485
|
+
tooltip: "Mermaid"
|
|
2392
2486
|
}
|
|
2393
2487
|
) }),
|
|
2394
|
-
/* @__PURE__ */ u(Nt, { className: "
|
|
2488
|
+
/* @__PURE__ */ u(Nt, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
2395
2489
|
/* @__PURE__ */ i(kt, { children: "Mermaid" }),
|
|
2396
2490
|
/* @__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: [
|
|
2397
2491
|
/* @__PURE__ */ i(
|
|
2398
2492
|
St,
|
|
2399
2493
|
{
|
|
2494
|
+
autoFocus: !0,
|
|
2400
2495
|
className: "richtext-flex-1",
|
|
2401
|
-
|
|
2496
|
+
defaultValue: Ae,
|
|
2402
2497
|
onChange: (m) => n(m.target.value),
|
|
2403
|
-
|
|
2498
|
+
placeholder: "Text",
|
|
2404
2499
|
required: !0,
|
|
2405
2500
|
rows: 10,
|
|
2406
|
-
|
|
2407
|
-
placeholder: "Text",
|
|
2501
|
+
value: r,
|
|
2408
2502
|
style: {
|
|
2409
2503
|
color: "hsl(var(--richtext-foreground))"
|
|
2410
2504
|
}
|
|
@@ -2413,17 +2507,16 @@ a-->b`, Kc = ({ editor: t, upload: e }) => {
|
|
|
2413
2507
|
/* @__PURE__ */ i(
|
|
2414
2508
|
"div",
|
|
2415
2509
|
{
|
|
2416
|
-
className: "richtext-flex
|
|
2417
|
-
|
|
2510
|
+
className: "richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
2511
|
+
dangerouslySetInnerHTML: { __html: a },
|
|
2418
2512
|
ref: l,
|
|
2419
|
-
|
|
2513
|
+
style: { height: "100%", borderWidth: 1, minHeight: 500, background: "#fff" }
|
|
2420
2514
|
}
|
|
2421
2515
|
)
|
|
2422
2516
|
] }) }),
|
|
2423
2517
|
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
2424
2518
|
U,
|
|
2425
2519
|
{
|
|
2426
|
-
type: "button",
|
|
2427
2520
|
onClick: async () => {
|
|
2428
2521
|
if (r !== "") {
|
|
2429
2522
|
if (r) {
|
|
@@ -2447,6 +2540,7 @@ a-->b`, Kc = ({ editor: t, upload: e }) => {
|
|
|
2447
2540
|
s(!1);
|
|
2448
2541
|
}
|
|
2449
2542
|
},
|
|
2543
|
+
type: "button",
|
|
2450
2544
|
children: "Save changes"
|
|
2451
2545
|
}
|
|
2452
2546
|
) })
|
|
@@ -2479,12 +2573,12 @@ function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a })
|
|
|
2479
2573
|
h: 0,
|
|
2480
2574
|
dir: ""
|
|
2481
2575
|
}), { align: p } = e == null ? void 0 : e.attrs, b = P(() => {
|
|
2482
|
-
const { src: y, alt: g, width: O, height: S } = e == null ? void 0 : e.attrs,
|
|
2576
|
+
const { src: y, alt: g, width: O, height: S } = e == null ? void 0 : e.attrs, R = me(O) ? `${O}px` : O, A = me(S) ? `${S}px` : S;
|
|
2483
2577
|
return {
|
|
2484
2578
|
src: y || void 0,
|
|
2485
2579
|
alt: g || void 0,
|
|
2486
2580
|
style: {
|
|
2487
|
-
width:
|
|
2581
|
+
width: R || void 0,
|
|
2488
2582
|
height: A || void 0
|
|
2489
2583
|
}
|
|
2490
2584
|
};
|
|
@@ -2500,7 +2594,7 @@ function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a })
|
|
|
2500
2594
|
height: y.target.height
|
|
2501
2595
|
});
|
|
2502
2596
|
}
|
|
2503
|
-
function
|
|
2597
|
+
function z() {
|
|
2504
2598
|
t.commands.setNodeSelection(n());
|
|
2505
2599
|
}
|
|
2506
2600
|
const $ = C(
|
|
@@ -2515,10 +2609,10 @@ function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a })
|
|
|
2515
2609
|
);
|
|
2516
2610
|
function F(y, g) {
|
|
2517
2611
|
y.preventDefault(), y.stopPropagation();
|
|
2518
|
-
const O = s.width, S = s.height,
|
|
2612
|
+
const O = s.width, S = s.height, R = O / S;
|
|
2519
2613
|
let A = Number(e.attrs.width), K = Number(e.attrs.height);
|
|
2520
2614
|
const j = c.width;
|
|
2521
|
-
A && !K ? (A = A > j ? j : A, K = Math.round(A /
|
|
2615
|
+
A && !K ? (A = A > j ? j : A, K = Math.round(A / R)) : K && !A ? (A = Math.round(K * R), A = A > j ? j : A) : !A && !K ? (A = O > j ? j : O, K = Math.round(A / R)) : A = A > j ? j : A, Bt(() => {
|
|
2522
2616
|
x(!0), f({
|
|
2523
2617
|
x: y.clientX,
|
|
2524
2618
|
y: y.clientY,
|
|
@@ -2532,7 +2626,7 @@ function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a })
|
|
|
2532
2626
|
wt((y) => {
|
|
2533
2627
|
if (y.preventDefault(), y.stopPropagation(), !d)
|
|
2534
2628
|
return;
|
|
2535
|
-
const { x: g, w: O, dir: S } = m,
|
|
2629
|
+
const { x: g, w: O, dir: S } = m, R = (y.clientX - g) * (/l/.test(S) ? -1 : 1), A = ti(O + R, Pe, c.width);
|
|
2536
2630
|
r({
|
|
2537
2631
|
width: A,
|
|
2538
2632
|
height: null
|
|
@@ -2549,9 +2643,9 @@ function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a })
|
|
|
2549
2643
|
h: 0,
|
|
2550
2644
|
dir: ""
|
|
2551
2645
|
}), x(!1);
|
|
2552
|
-
}),
|
|
2646
|
+
}), z());
|
|
2553
2647
|
},
|
|
2554
|
-
[d,
|
|
2648
|
+
[d, z]
|
|
2555
2649
|
), W = C(() => {
|
|
2556
2650
|
document == null || document.addEventListener("mousemove", M, !0), document == null || document.addEventListener("mouseup", B, !0);
|
|
2557
2651
|
}, [M, B]), N = C(() => {
|
|
@@ -2563,37 +2657,44 @@ function Zc({ editor: t, node: e, updateAttributes: r, getPos: n, selected: a })
|
|
|
2563
2657
|
const H = P(() => new ResizeObserver(() => $()), [$]);
|
|
2564
2658
|
return I(() => (H.observe(t.view.dom), () => {
|
|
2565
2659
|
H.disconnect();
|
|
2566
|
-
}), [t.view.dom, H]), /* @__PURE__ */ i(
|
|
2567
|
-
|
|
2660
|
+
}), [t.view.dom, H]), /* @__PURE__ */ i(
|
|
2661
|
+
ut,
|
|
2568
2662
|
{
|
|
2569
|
-
|
|
2570
|
-
"
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
"
|
|
2576
|
-
{
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2663
|
+
className: "image-view",
|
|
2664
|
+
style: { ...T, width: "100%", textAlign: p },
|
|
2665
|
+
children: /* @__PURE__ */ u(
|
|
2666
|
+
"div",
|
|
2667
|
+
{
|
|
2668
|
+
"data-drag-handle": !0,
|
|
2669
|
+
draggable: "true",
|
|
2670
|
+
style: { ...T, background: "#fff" },
|
|
2671
|
+
className: `image-view__body ${a ? "image-view__body--focused" : ""} ${d ? "image-view__body--resizing" : ""}`,
|
|
2672
|
+
children: [
|
|
2673
|
+
/* @__PURE__ */ i(
|
|
2674
|
+
"img",
|
|
2675
|
+
{
|
|
2676
|
+
alt: b.alt,
|
|
2677
|
+
className: "image-view__body__image block",
|
|
2678
|
+
height: "auto",
|
|
2679
|
+
onClick: z,
|
|
2680
|
+
onLoad: k,
|
|
2681
|
+
src: b.src,
|
|
2682
|
+
style: b.style
|
|
2683
|
+
}
|
|
2684
|
+
),
|
|
2685
|
+
t.view.editable && (a || d) && /* @__PURE__ */ i("div", { className: "image-resizer", children: h == null ? void 0 : h.map((y) => /* @__PURE__ */ i(
|
|
2686
|
+
"span",
|
|
2687
|
+
{
|
|
2688
|
+
className: `image-resizer__handler image-resizer__handler--${y}`,
|
|
2689
|
+
onMouseDown: (g) => F(g, y)
|
|
2690
|
+
},
|
|
2691
|
+
`image-dir-${y}`
|
|
2692
|
+
)) })
|
|
2693
|
+
]
|
|
2694
|
+
}
|
|
2695
|
+
)
|
|
2595
2696
|
}
|
|
2596
|
-
)
|
|
2697
|
+
);
|
|
2597
2698
|
}
|
|
2598
2699
|
const Me = He.extend({
|
|
2599
2700
|
name: "mermaid",
|
|
@@ -2616,8 +2717,7 @@ const Me = He.extend({
|
|
|
2616
2717
|
return {
|
|
2617
2718
|
component: Kc,
|
|
2618
2719
|
componentProps: {
|
|
2619
|
-
action: () =>
|
|
2620
|
-
},
|
|
2720
|
+
action: () => !0,
|
|
2621
2721
|
isActive: () => !1,
|
|
2622
2722
|
disabled: !1,
|
|
2623
2723
|
editor: e,
|
|
@@ -2732,21 +2832,35 @@ function bi(t) {
|
|
|
2732
2832
|
function a(c) {
|
|
2733
2833
|
c.preventDefault(), c.stopPropagation(), t == null || t.onSetLink(r);
|
|
2734
2834
|
}
|
|
2735
|
-
return /* @__PURE__ */ i("div", { className: "
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2835
|
+
return /* @__PURE__ */ i("div", { className: "border-neutral-200 richtext-rounded-lg !richtext-border richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black", children: /* @__PURE__ */ u(
|
|
2836
|
+
"form",
|
|
2837
|
+
{
|
|
2838
|
+
className: "richtext-flex richtext-flex-col richtext-gap-2",
|
|
2839
|
+
onSubmit: a,
|
|
2840
|
+
children: [
|
|
2841
|
+
/* @__PURE__ */ i(et, { className: "mb-[6px]", children: e("editor.link.dialog.text") }),
|
|
2842
|
+
/* @__PURE__ */ i("div", { className: "richtext-mb-[10px] richtext-flex richtext-w-full richtext-max-w-sm richtext-items-center richtext-gap-1.5", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-w-full richtext-max-w-sm richtext-items-center", children: /* @__PURE__ */ i(
|
|
2843
|
+
J,
|
|
2844
|
+
{
|
|
2845
|
+
className: "richtext-w-80",
|
|
2846
|
+
onChange: (c) => n(c.target.value),
|
|
2847
|
+
placeholder: "Text",
|
|
2848
|
+
required: !0,
|
|
2849
|
+
type: "text",
|
|
2850
|
+
value: r
|
|
2851
|
+
}
|
|
2852
|
+
) }) }),
|
|
2853
|
+
/* @__PURE__ */ i(
|
|
2854
|
+
U,
|
|
2855
|
+
{
|
|
2856
|
+
className: "richtext-mt-2 richtext-self-end",
|
|
2857
|
+
type: "submit",
|
|
2858
|
+
children: e("editor.link.dialog.button.apply")
|
|
2859
|
+
}
|
|
2860
|
+
)
|
|
2861
|
+
]
|
|
2862
|
+
}
|
|
2863
|
+
) });
|
|
2750
2864
|
}
|
|
2751
2865
|
function qc(t) {
|
|
2752
2866
|
function e(r) {
|
|
@@ -2978,7 +3092,7 @@ function ia({ editor: t }) {
|
|
|
2978
3092
|
},
|
|
2979
3093
|
[t]
|
|
2980
3094
|
), h = C(() => {
|
|
2981
|
-
|
|
3095
|
+
Oc(n);
|
|
2982
3096
|
}, [t, n]), d = C(() => t.isActive(st.name), [t]), x = C(() => Ct(st.name, t), [t]);
|
|
2983
3097
|
return I(() => {
|
|
2984
3098
|
a && (h(), t.chain().updateAttributes(st.name, { defaultShowPicker: !1 }).focus().run());
|
|
@@ -3162,31 +3276,31 @@ a-->b`, na = ({ editor: t, attrs: e, extension: r }) => {
|
|
|
3162
3276
|
}, [c]), /* @__PURE__ */ u(
|
|
3163
3277
|
jt,
|
|
3164
3278
|
{
|
|
3165
|
-
open: h,
|
|
3166
3279
|
onOpenChange: d,
|
|
3280
|
+
open: h,
|
|
3167
3281
|
children: [
|
|
3168
3282
|
/* @__PURE__ */ i(Ft, { asChild: !0, children: /* @__PURE__ */ i(
|
|
3169
3283
|
v,
|
|
3170
3284
|
{
|
|
3285
|
+
action: () => d(!0),
|
|
3171
3286
|
icon: "Pencil",
|
|
3172
|
-
tooltip: "Edit Mermaid"
|
|
3173
|
-
action: () => d(!0)
|
|
3287
|
+
tooltip: "Edit Mermaid"
|
|
3174
3288
|
}
|
|
3175
3289
|
) }),
|
|
3176
|
-
/* @__PURE__ */ u(Nt, { className: "
|
|
3290
|
+
/* @__PURE__ */ u(Nt, { className: "richtext-z-[99999] !richtext-max-w-[1300px]", children: [
|
|
3177
3291
|
/* @__PURE__ */ i(kt, { children: "Edit Mermaid" }),
|
|
3178
3292
|
/* @__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: [
|
|
3179
3293
|
/* @__PURE__ */ i(
|
|
3180
3294
|
St,
|
|
3181
3295
|
{
|
|
3296
|
+
autoFocus: !0,
|
|
3182
3297
|
className: "richtext-flex-1",
|
|
3183
|
-
|
|
3298
|
+
defaultValue: Ie,
|
|
3184
3299
|
onChange: (T) => o(T.target.value),
|
|
3185
|
-
|
|
3300
|
+
placeholder: "Text",
|
|
3186
3301
|
required: !0,
|
|
3187
3302
|
rows: 10,
|
|
3188
|
-
|
|
3189
|
-
placeholder: "Text",
|
|
3303
|
+
value: c,
|
|
3190
3304
|
style: {
|
|
3191
3305
|
color: "hsl(var(--richtext-foreground))"
|
|
3192
3306
|
}
|
|
@@ -3195,21 +3309,20 @@ a-->b`, na = ({ editor: t, attrs: e, extension: r }) => {
|
|
|
3195
3309
|
/* @__PURE__ */ i(
|
|
3196
3310
|
"div",
|
|
3197
3311
|
{
|
|
3198
|
-
className: "richtext-flex
|
|
3199
|
-
|
|
3312
|
+
className: "richtext-flex richtext-flex-1 richtext-items-center richtext-justify-center richtext-rounded-[10px] richtext-p-[10px]",
|
|
3313
|
+
dangerouslySetInnerHTML: { __html: s },
|
|
3200
3314
|
ref: x,
|
|
3201
|
-
|
|
3315
|
+
style: { height: "100%", border: "1px solid hsl(var(--border))", minHeight: 500, background: "#fff" }
|
|
3202
3316
|
}
|
|
3203
3317
|
)
|
|
3204
3318
|
] }) }),
|
|
3205
3319
|
/* @__PURE__ */ i(Tt, { children: /* @__PURE__ */ i(
|
|
3206
3320
|
U,
|
|
3207
3321
|
{
|
|
3208
|
-
type: "button",
|
|
3209
3322
|
onClick: async () => {
|
|
3210
3323
|
if (c !== "") {
|
|
3211
3324
|
if (c) {
|
|
3212
|
-
const T = x.current.querySelector("svg"), { width: k, height:
|
|
3325
|
+
const T = x.current.querySelector("svg"), { width: k, height: z } = T.getBoundingClientRect(), $ = `mermaid-${vi()}.svg`;
|
|
3213
3326
|
let F = je(T.outerHTML);
|
|
3214
3327
|
if (m) {
|
|
3215
3328
|
const M = gi(F, $);
|
|
@@ -3221,7 +3334,7 @@ a-->b`, na = ({ editor: t, attrs: e, extension: r }) => {
|
|
|
3221
3334
|
src: F,
|
|
3222
3335
|
alt: encodeURIComponent(c),
|
|
3223
3336
|
width: k,
|
|
3224
|
-
height:
|
|
3337
|
+
height: z
|
|
3225
3338
|
},
|
|
3226
3339
|
!!c
|
|
3227
3340
|
).run(), t == null || t.commands.setAlignImageMermaid(a);
|
|
@@ -3229,6 +3342,7 @@ a-->b`, na = ({ editor: t, attrs: e, extension: r }) => {
|
|
|
3229
3342
|
d(!1);
|
|
3230
3343
|
}
|
|
3231
3344
|
},
|
|
3345
|
+
type: "button",
|
|
3232
3346
|
children: "Save changes"
|
|
3233
3347
|
}
|
|
3234
3348
|
) })
|
|
@@ -3258,12 +3372,18 @@ const aa = {
|
|
|
3258
3372
|
function oa({ item: t, disabled: e, editor: r }) {
|
|
3259
3373
|
var a;
|
|
3260
3374
|
const n = t.component;
|
|
3261
|
-
return n ? /* @__PURE__ */ i(_e, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
3375
|
+
return n ? /* @__PURE__ */ i(_e, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
3376
|
+
Q,
|
|
3377
|
+
{
|
|
3378
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
3379
|
+
orientation: "vertical"
|
|
3380
|
+
}
|
|
3381
|
+
) : /* @__PURE__ */ i(
|
|
3262
3382
|
n,
|
|
3263
3383
|
{
|
|
3264
3384
|
...t.componentProps,
|
|
3265
|
-
|
|
3266
|
-
|
|
3385
|
+
disabled: e || ((a = t == null ? void 0 : t.componentProps) == null ? void 0 : a.disabled),
|
|
3386
|
+
editor: r
|
|
3267
3387
|
}
|
|
3268
3388
|
) }) : /* @__PURE__ */ i(_, {});
|
|
3269
3389
|
}
|
|
@@ -3282,23 +3402,23 @@ function la(t) {
|
|
|
3282
3402
|
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
3283
3403
|
Y,
|
|
3284
3404
|
{
|
|
3285
|
-
shouldShow: a,
|
|
3286
3405
|
editor: t == null ? void 0 : t.editor,
|
|
3406
|
+
shouldShow: a,
|
|
3287
3407
|
tippyOptions: aa,
|
|
3288
|
-
children: c != null && c.length ? /* @__PURE__ */ i("div", { className: "richtext-
|
|
3408
|
+
children: c != null && c.length ? /* @__PURE__ */ i("div", { className: "richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: c == null ? void 0 : c.map((o, s) => o.type === "edit" && (r != null && r.src) ? /* @__PURE__ */ i(
|
|
3289
3409
|
na,
|
|
3290
3410
|
{
|
|
3291
|
-
editor: t.editor,
|
|
3292
3411
|
attrs: r,
|
|
3412
|
+
editor: t.editor,
|
|
3293
3413
|
extension: n
|
|
3294
3414
|
},
|
|
3295
3415
|
`bubbleMenu-mermaid-${s}`
|
|
3296
3416
|
) : /* @__PURE__ */ i(
|
|
3297
3417
|
oa,
|
|
3298
3418
|
{
|
|
3299
|
-
item: o,
|
|
3300
3419
|
disabled: t.disabled,
|
|
3301
|
-
editor: t.editor
|
|
3420
|
+
editor: t.editor,
|
|
3421
|
+
item: o
|
|
3302
3422
|
},
|
|
3303
3423
|
`bubbleMenu-mermaid-${s}`
|
|
3304
3424
|
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
@@ -3328,27 +3448,27 @@ function ha({ editor: t, disabled: e }) {
|
|
|
3328
3448
|
children: e ? /* @__PURE__ */ i(_, {}) : /* @__PURE__ */ i(_, { children: r ? /* @__PURE__ */ i(
|
|
3329
3449
|
bi,
|
|
3330
3450
|
{
|
|
3331
|
-
|
|
3332
|
-
|
|
3451
|
+
editor: t,
|
|
3452
|
+
onSetLink: o
|
|
3333
3453
|
}
|
|
3334
|
-
) : /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-
|
|
3454
|
+
) : /* @__PURE__ */ i("div", { className: "richtext-flex richtext-items-center richtext-gap-2 richtext-rounded-lg !richtext-border richtext-border-neutral-200 richtext-bg-white richtext-p-2 richtext-shadow-sm dark:richtext-border-neutral-800 dark:richtext-bg-black", children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-nowrap", children: [
|
|
3335
3455
|
/* @__PURE__ */ i(
|
|
3336
3456
|
v,
|
|
3337
3457
|
{
|
|
3338
3458
|
icon: "Pencil",
|
|
3339
3459
|
tooltip: a("editor.link.edit.tooltip"),
|
|
3460
|
+
tooltipOptions: { sideOffset: 15 },
|
|
3340
3461
|
action: () => {
|
|
3341
3462
|
n(!0);
|
|
3342
|
-
}
|
|
3343
|
-
tooltipOptions: { sideOffset: 15 }
|
|
3463
|
+
}
|
|
3344
3464
|
}
|
|
3345
3465
|
),
|
|
3346
3466
|
/* @__PURE__ */ i(
|
|
3347
3467
|
v,
|
|
3348
3468
|
{
|
|
3469
|
+
action: s,
|
|
3349
3470
|
icon: "Trash",
|
|
3350
3471
|
tooltip: a("editor.delete"),
|
|
3351
|
-
action: s,
|
|
3352
3472
|
tooltipOptions: { sideOffset: 15 }
|
|
3353
3473
|
}
|
|
3354
3474
|
)
|
|
@@ -3362,7 +3482,7 @@ function da({ editor: t, disabled: e, bubbleMenu: r }) {
|
|
|
3362
3482
|
return [
|
|
3363
3483
|
n.includes("columns") && !((c = r == null ? void 0 : r.columnConfig) != null && c.hidden) ? /* @__PURE__ */ i(Ba, { editor: t }, "columns") : null,
|
|
3364
3484
|
n.includes("table") && !((o = r == null ? void 0 : r.tableConfig) != null && o.hidden) ? /* @__PURE__ */ i(Ia, { editor: t }, "table") : null,
|
|
3365
|
-
n.includes("link") && !((s = r == null ? void 0 : r.linkConfig) != null && s.hidden) ? /* @__PURE__ */ i(
|
|
3485
|
+
n.includes("link") && !((s = r == null ? void 0 : r.linkConfig) != null && s.hidden) ? /* @__PURE__ */ i(za, { editor: t, disabled: e }, "link") : null,
|
|
3366
3486
|
n.includes("image") && !((l = r == null ? void 0 : r.imageConfig) != null && l.hidden) ? /* @__PURE__ */ i(Ha, { editor: t, disabled: e }, "image") : null,
|
|
3367
3487
|
n.includes(wi.name) && !((h = r == null ? void 0 : r.imageGifConfig) != null && h.hidden) ? /* @__PURE__ */ i(Pa, { editor: t, disabled: e }, "imageGif") : null,
|
|
3368
3488
|
n.includes("video") && !((d = r == null ? void 0 : r.videoConfig) != null && d.hidden) ? /* @__PURE__ */ i(Da, { editor: t, disabled: e }, "video") : null,
|
|
@@ -3405,102 +3525,126 @@ function ua(t) {
|
|
|
3405
3525
|
/^#([\da-f]{3}){1,2}$/i.test(f) && (c == null || c(f), o == null || o(f), x(f));
|
|
3406
3526
|
}
|
|
3407
3527
|
return /* @__PURE__ */ u(mt, { modal: !0, children: [
|
|
3408
|
-
/* @__PURE__ */ i(
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
"
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
onClick: () => m(b),
|
|
3438
|
-
children: /* @__PURE__ */ i(
|
|
3439
|
-
"span",
|
|
3528
|
+
/* @__PURE__ */ i(
|
|
3529
|
+
ft,
|
|
3530
|
+
{
|
|
3531
|
+
asChild: !0,
|
|
3532
|
+
className: "!richtext-p-0",
|
|
3533
|
+
disabled: n,
|
|
3534
|
+
children: t == null ? void 0 : t.children
|
|
3535
|
+
}
|
|
3536
|
+
),
|
|
3537
|
+
/* @__PURE__ */ i(
|
|
3538
|
+
ct,
|
|
3539
|
+
{
|
|
3540
|
+
align: "start",
|
|
3541
|
+
className: "richtext-size-full richtext-p-2",
|
|
3542
|
+
hideWhenDetached: !0,
|
|
3543
|
+
side: "bottom",
|
|
3544
|
+
children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col", children: [
|
|
3545
|
+
r ? /* @__PURE__ */ u(
|
|
3546
|
+
"div",
|
|
3547
|
+
{
|
|
3548
|
+
className: "rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",
|
|
3549
|
+
onClick: () => m(void 0),
|
|
3550
|
+
children: [
|
|
3551
|
+
/* @__PURE__ */ i(Ee, {}),
|
|
3552
|
+
/* @__PURE__ */ i("span", { className: "richtext-ml-1 richtext-text-sm", children: e("editor.nofill") })
|
|
3553
|
+
]
|
|
3554
|
+
}
|
|
3555
|
+
) : /* @__PURE__ */ u(
|
|
3556
|
+
"div",
|
|
3440
3557
|
{
|
|
3441
|
-
|
|
3442
|
-
|
|
3558
|
+
className: "rd-1 richtext-flex richtext-cursor-pointer richtext-items-center richtext-gap-[4px] richtext-p-1 hover:richtext-bg-accent",
|
|
3559
|
+
onClick: () => {
|
|
3560
|
+
m(void 0);
|
|
3443
3561
|
},
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
"
|
|
3447
|
-
|
|
3448
|
-
className: "richtext-absolute richtext-block richtext-top-[-1px] richtext-left-[1px] richtext-w-3 richtext-h-3",
|
|
3449
|
-
viewBox: "0 0 18 18",
|
|
3450
|
-
style: {
|
|
3451
|
-
fill: "rgb(255, 255, 255)"
|
|
3452
|
-
},
|
|
3453
|
-
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3454
|
-
}
|
|
3455
|
-
) : /* @__PURE__ */ i(
|
|
3456
|
-
"svg",
|
|
3457
|
-
{
|
|
3458
|
-
viewBox: "0 0 18 18",
|
|
3459
|
-
style: {
|
|
3460
|
-
fill: "rgb(255, 255, 255)",
|
|
3461
|
-
display: "none"
|
|
3462
|
-
},
|
|
3463
|
-
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3464
|
-
}
|
|
3465
|
-
)
|
|
3562
|
+
children: [
|
|
3563
|
+
/* @__PURE__ */ i(Ee, {}),
|
|
3564
|
+
/* @__PURE__ */ i("span", { className: "richtext-ml-1 richtext-text-sm", children: e("editor.default") })
|
|
3565
|
+
]
|
|
3466
3566
|
}
|
|
3467
|
-
)
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3567
|
+
),
|
|
3568
|
+
l.map((f, p) => /* @__PURE__ */ i(
|
|
3569
|
+
"span",
|
|
3570
|
+
{
|
|
3571
|
+
className: "richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2",
|
|
3572
|
+
children: f.map((b, T) => /* @__PURE__ */ i(
|
|
3573
|
+
"span",
|
|
3574
|
+
{
|
|
3575
|
+
className: "richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-transparent richtext-p-0.5 hover:richtext-border-border hover:richtext-shadow-sm",
|
|
3576
|
+
onClick: () => m(b),
|
|
3577
|
+
children: /* @__PURE__ */ i(
|
|
3578
|
+
"span",
|
|
3579
|
+
{
|
|
3580
|
+
className: "richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",
|
|
3581
|
+
style: {
|
|
3582
|
+
backgroundColor: b
|
|
3583
|
+
},
|
|
3584
|
+
children: b === a ? /* @__PURE__ */ i(
|
|
3585
|
+
"svg",
|
|
3586
|
+
{
|
|
3587
|
+
className: "richtext-absolute -richtext-top-px richtext-left-px richtext-block richtext-size-3",
|
|
3588
|
+
viewBox: "0 0 18 18",
|
|
3589
|
+
style: {
|
|
3590
|
+
fill: "rgb(255, 255, 255)"
|
|
3591
|
+
},
|
|
3592
|
+
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3593
|
+
}
|
|
3594
|
+
) : /* @__PURE__ */ i(
|
|
3595
|
+
"svg",
|
|
3596
|
+
{
|
|
3597
|
+
viewBox: "0 0 18 18",
|
|
3598
|
+
style: {
|
|
3599
|
+
fill: "rgb(255, 255, 255)",
|
|
3600
|
+
display: "none"
|
|
3601
|
+
},
|
|
3602
|
+
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3603
|
+
}
|
|
3604
|
+
)
|
|
3605
|
+
}
|
|
3606
|
+
)
|
|
3607
|
+
},
|
|
3608
|
+
`sub-color-${T}`
|
|
3609
|
+
))
|
|
3610
|
+
},
|
|
3611
|
+
p
|
|
3612
|
+
)),
|
|
3613
|
+
/* @__PURE__ */ u("div", { children: [
|
|
3614
|
+
/* @__PURE__ */ i("div", { className: "richtext-my-1 richtext-text-sm", children: e("editor.recent") }),
|
|
3615
|
+
/* @__PURE__ */ i("span", { className: "richtext-relative richtext-flex richtext-h-auto richtext-w-full richtext-p-0 last:richtext-pb-2", children: h == null ? void 0 : h.map((f, p) => /* @__PURE__ */ i(
|
|
3479
3616
|
"span",
|
|
3480
3617
|
{
|
|
3481
|
-
className: "richtext-
|
|
3482
|
-
|
|
3483
|
-
backgroundColor: f
|
|
3484
|
-
},
|
|
3618
|
+
className: "richtext-inline-block richtext-size-6 richtext-flex-[0_0_auto] richtext-cursor-pointer richtext-rounded-sm !richtext-border richtext-border-transparent richtext-p-0.5 hover:richtext-border-border hover:richtext-shadow-sm",
|
|
3619
|
+
onClick: () => m(f),
|
|
3485
3620
|
children: /* @__PURE__ */ i(
|
|
3486
|
-
"
|
|
3621
|
+
"span",
|
|
3487
3622
|
{
|
|
3488
|
-
|
|
3623
|
+
className: "richtext-relative richtext-block richtext-size-[18px] richtext-rounded-[2px] richtext-border-transparent",
|
|
3489
3624
|
style: {
|
|
3490
|
-
|
|
3491
|
-
display: "none"
|
|
3625
|
+
backgroundColor: f
|
|
3492
3626
|
},
|
|
3493
|
-
children: /* @__PURE__ */ i(
|
|
3627
|
+
children: /* @__PURE__ */ i(
|
|
3628
|
+
"svg",
|
|
3629
|
+
{
|
|
3630
|
+
viewBox: "0 0 18 18",
|
|
3631
|
+
style: {
|
|
3632
|
+
fill: "rgb(255, 255, 255)",
|
|
3633
|
+
display: "none"
|
|
3634
|
+
},
|
|
3635
|
+
children: /* @__PURE__ */ i("path", { d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" })
|
|
3636
|
+
}
|
|
3637
|
+
)
|
|
3494
3638
|
}
|
|
3495
3639
|
)
|
|
3496
|
-
}
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3640
|
+
},
|
|
3641
|
+
`sub-color-recent-${p}`
|
|
3642
|
+
)) })
|
|
3643
|
+
] }),
|
|
3644
|
+
/* @__PURE__ */ i(xa, { setColor: m })
|
|
3645
|
+
] })
|
|
3646
|
+
}
|
|
3647
|
+
)
|
|
3504
3648
|
] });
|
|
3505
3649
|
}
|
|
3506
3650
|
function xa({ setColor: t }) {
|
|
@@ -3511,10 +3655,10 @@ function xa({ setColor: t }) {
|
|
|
3511
3655
|
/* @__PURE__ */ i(ft, { asChild: !0, children: /* @__PURE__ */ u(
|
|
3512
3656
|
"div",
|
|
3513
3657
|
{
|
|
3658
|
+
className: "richtext-p-1.5 richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent",
|
|
3514
3659
|
onClick: (o) => {
|
|
3515
3660
|
o.preventDefault(), a(!0);
|
|
3516
3661
|
},
|
|
3517
|
-
className: "richtext-text-sm hover:richtext-cursor-pointer hover:richtext-bg-accent richtext-py-1.5 richtext-px-1.5",
|
|
3518
3662
|
children: [
|
|
3519
3663
|
c("editor.color.more"),
|
|
3520
3664
|
"..."
|
|
@@ -3523,16 +3667,22 @@ function xa({ setColor: t }) {
|
|
|
3523
3667
|
) }),
|
|
3524
3668
|
/* @__PURE__ */ u(ct, { children: [
|
|
3525
3669
|
/* @__PURE__ */ u("div", { className: "richtext-flex richtext-flex-col richtext-items-center richtext-justify-center", children: [
|
|
3526
|
-
/* @__PURE__ */ i(
|
|
3670
|
+
/* @__PURE__ */ i(
|
|
3671
|
+
xn,
|
|
3672
|
+
{
|
|
3673
|
+
color: e,
|
|
3674
|
+
onChange: r
|
|
3675
|
+
}
|
|
3676
|
+
),
|
|
3527
3677
|
/* @__PURE__ */ i(
|
|
3528
3678
|
J,
|
|
3529
3679
|
{
|
|
3530
3680
|
className: "richtext-mt-[8px] richtext-w-full",
|
|
3531
3681
|
type: "text",
|
|
3682
|
+
value: e.slice(1),
|
|
3532
3683
|
onChange: (o) => {
|
|
3533
3684
|
o.preventDefault(), r(`#${o.target.value}`);
|
|
3534
|
-
}
|
|
3535
|
-
value: e.slice(1)
|
|
3685
|
+
}
|
|
3536
3686
|
}
|
|
3537
3687
|
)
|
|
3538
3688
|
] }),
|
|
@@ -3540,10 +3690,10 @@ function xa({ setColor: t }) {
|
|
|
3540
3690
|
/* @__PURE__ */ i(
|
|
3541
3691
|
U,
|
|
3542
3692
|
{
|
|
3693
|
+
className: "richtext-w-full",
|
|
3543
3694
|
onClick: (o) => {
|
|
3544
3695
|
o.preventDefault(), t(e), a(!1);
|
|
3545
3696
|
},
|
|
3546
|
-
className: "richtext-w-full",
|
|
3547
3697
|
children: /* @__PURE__ */ i(Ge, { size: 16 })
|
|
3548
3698
|
}
|
|
3549
3699
|
)
|
|
@@ -3572,8 +3722,8 @@ function ma({ editor: t, disabled: e, toolbar: r }) {
|
|
|
3572
3722
|
t: n
|
|
3573
3723
|
});
|
|
3574
3724
|
if (Array.isArray(T)) {
|
|
3575
|
-
const k = T.map((
|
|
3576
|
-
button:
|
|
3725
|
+
const k = T.map((z, $) => ({
|
|
3726
|
+
button: z,
|
|
3577
3727
|
divider: $ === T.length - 1 ? f : !1,
|
|
3578
3728
|
spacer: $ === 0 ? p : !1,
|
|
3579
3729
|
type: x.type,
|
|
@@ -3810,8 +3960,7 @@ function Na(t) {
|
|
|
3810
3960
|
editor: t,
|
|
3811
3961
|
tooltip: Z.t("editor.edit"),
|
|
3812
3962
|
icon: "Pencil",
|
|
3813
|
-
action: () =>
|
|
3814
|
-
}
|
|
3963
|
+
action: () => !0
|
|
3815
3964
|
}
|
|
3816
3965
|
},
|
|
3817
3966
|
{
|
|
@@ -3890,7 +4039,7 @@ function Sa(t) {
|
|
|
3890
4039
|
function k(g) {
|
|
3891
4040
|
t.editor.commands.setTextAlign(g);
|
|
3892
4041
|
}
|
|
3893
|
-
function
|
|
4042
|
+
function z() {
|
|
3894
4043
|
const g = ee(t.editor.state.tr, c, 1);
|
|
3895
4044
|
g.setMeta("hideDragHandle", !0), t.editor.view.dispatch && t.editor.view.dispatch(g);
|
|
3896
4045
|
}
|
|
@@ -3907,8 +4056,8 @@ function Sa(t) {
|
|
|
3907
4056
|
function B() {
|
|
3908
4057
|
var g;
|
|
3909
4058
|
if (c !== -1) {
|
|
3910
|
-
const O = (n == null ? void 0 : n.nodeSize) || 0, S = c + O,
|
|
3911
|
-
t.editor.chain().command(({ dispatch: K, tr: j, state: Mt }) => K ? (
|
|
4059
|
+
const O = (n == null ? void 0 : n.nodeSize) || 0, S = c + O, R = (n == null ? void 0 : n.type.name) === "paragraph" && ((g = n == null ? void 0 : n.content) == null ? void 0 : g.size) === 0, A = R ? c + 2 : S + 2;
|
|
4060
|
+
t.editor.chain().command(({ dispatch: K, tr: j, state: Mt }) => K ? (R ? j.insertText("/", c, c + 1) : j.insert(
|
|
3912
4061
|
S,
|
|
3913
4062
|
Mt.schema.nodes.paragraph.create(null, [Mt.schema.text("/")])
|
|
3914
4063
|
), K(j)) : !0).focus(A).run();
|
|
@@ -4022,7 +4171,7 @@ function Sa(t) {
|
|
|
4022
4171
|
tt,
|
|
4023
4172
|
{
|
|
4024
4173
|
className: "richtext-flex richtext-gap-3",
|
|
4025
|
-
onClick:
|
|
4174
|
+
onClick: z,
|
|
4026
4175
|
disabled: ((H = n == null ? void 0 : n.attrs) == null ? void 0 : H.indent) >= te.max,
|
|
4027
4176
|
children: [
|
|
4028
4177
|
/* @__PURE__ */ i(G, { name: "IndentIncrease" }),
|
|
@@ -4063,8 +4212,8 @@ function Ma({ item: t, disabled: e, editor: r }) {
|
|
|
4063
4212
|
n,
|
|
4064
4213
|
{
|
|
4065
4214
|
...t.componentProps,
|
|
4066
|
-
|
|
4067
|
-
|
|
4215
|
+
disabled: e || ((a = t == null ? void 0 : t.componentProps) == null ? void 0 : a.disabled),
|
|
4216
|
+
editor: r
|
|
4068
4217
|
}
|
|
4069
4218
|
) : /* @__PURE__ */ i(_, {});
|
|
4070
4219
|
}
|
|
@@ -4073,26 +4222,34 @@ function La(t) {
|
|
|
4073
4222
|
const { selection: o } = c.view.state, { $from: s, to: l } = o;
|
|
4074
4223
|
return s.pos === l ? !1 : o instanceof bt;
|
|
4075
4224
|
}, a = P(() => t.disabled || !(t != null && t.editor) ? [] : ka(t.editor, e), [t.disabled, t.editor, r, e]);
|
|
4076
|
-
return /* @__PURE__ */ i(
|
|
4077
|
-
|
|
4078
|
-
{
|
|
4079
|
-
orientation: "vertical",
|
|
4080
|
-
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]"
|
|
4081
|
-
},
|
|
4082
|
-
`bubbleMenu-divider-${o}`
|
|
4083
|
-
) : /* @__PURE__ */ i(
|
|
4084
|
-
Ma,
|
|
4225
|
+
return /* @__PURE__ */ i(
|
|
4226
|
+
Y,
|
|
4085
4227
|
{
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4228
|
+
editor: t == null ? void 0 : t.editor,
|
|
4229
|
+
shouldShow: n,
|
|
4230
|
+
tippyOptions: Aa,
|
|
4231
|
+
children: a != null && a.length ? /* @__PURE__ */ i("div", { className: "richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-gap-[4px] richtext-whitespace-nowrap", children: a == null ? void 0 : a.map((c, o) => (c == null ? void 0 : c.type) === "divider" ? /* @__PURE__ */ i(
|
|
4232
|
+
Q,
|
|
4233
|
+
{
|
|
4234
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
4235
|
+
orientation: "vertical"
|
|
4236
|
+
},
|
|
4237
|
+
`bubbleMenu-divider-${o}`
|
|
4238
|
+
) : /* @__PURE__ */ i(
|
|
4239
|
+
Ma,
|
|
4240
|
+
{
|
|
4241
|
+
disabled: t.disabled,
|
|
4242
|
+
editor: t.editor,
|
|
4243
|
+
item: c
|
|
4244
|
+
},
|
|
4245
|
+
`bubbleMenu-text-${o}`
|
|
4246
|
+
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
4247
|
+
}
|
|
4248
|
+
);
|
|
4092
4249
|
}
|
|
4093
4250
|
function Ia({ editor: t, disabled: e }) {
|
|
4094
|
-
var b, T, k,
|
|
4095
|
-
const r = ({ editor: j }) =>
|
|
4251
|
+
var b, T, k, z, $, F, M, B, W, N, H, y, g, O, S, R, A, K;
|
|
4252
|
+
const r = ({ editor: j }) => zi(j.view.state, "table"), { t: n } = V();
|
|
4096
4253
|
function a() {
|
|
4097
4254
|
t.chain().focus().addColumnBefore().run();
|
|
4098
4255
|
}
|
|
@@ -4174,7 +4331,7 @@ function Ia({ editor: t, disabled: e }) {
|
|
|
4174
4331
|
"tooltip-options": {
|
|
4175
4332
|
sideOffset: 15
|
|
4176
4333
|
},
|
|
4177
|
-
disabled: !((
|
|
4334
|
+
disabled: !((z = (k = t == null ? void 0 : t.can()) == null ? void 0 : k.addColumnAfter) != null && z.call(k))
|
|
4178
4335
|
}
|
|
4179
4336
|
),
|
|
4180
4337
|
/* @__PURE__ */ i(
|
|
@@ -4248,7 +4405,7 @@ function Ia({ editor: t, disabled: e }) {
|
|
|
4248
4405
|
"tooltip-options": {
|
|
4249
4406
|
sideOffset: 15
|
|
4250
4407
|
},
|
|
4251
|
-
disabled: !((
|
|
4408
|
+
disabled: !((R = (S = t == null ? void 0 : t.can()) == null ? void 0 : S.splitCell) != null && R.call(S))
|
|
4252
4409
|
}
|
|
4253
4410
|
),
|
|
4254
4411
|
/* @__PURE__ */ i(Q, { orientation: "vertical", className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]" }),
|
|
@@ -4322,7 +4479,7 @@ function Ea(t) {
|
|
|
4322
4479
|
] })
|
|
4323
4480
|
] });
|
|
4324
4481
|
}
|
|
4325
|
-
function
|
|
4482
|
+
function za({ editor: t, disabled: e }) {
|
|
4326
4483
|
const [r, n] = w(!1), a = P(() => {
|
|
4327
4484
|
const { href: l } = t.getAttributes("link");
|
|
4328
4485
|
return l;
|
|
@@ -4382,16 +4539,22 @@ const le = {
|
|
|
4382
4539
|
function he({ item: t, disabled: e, editor: r }) {
|
|
4383
4540
|
var a;
|
|
4384
4541
|
const n = t.component;
|
|
4385
|
-
return n ? /* @__PURE__ */ i(_e, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
4542
|
+
return n ? /* @__PURE__ */ i(_e, { children: t.type === "divider" ? /* @__PURE__ */ i(
|
|
4543
|
+
Q,
|
|
4544
|
+
{
|
|
4545
|
+
className: "!richtext-mx-1 !richtext-my-2 !richtext-h-[16px]",
|
|
4546
|
+
orientation: "vertical"
|
|
4547
|
+
}
|
|
4548
|
+
) : /* @__PURE__ */ i(
|
|
4386
4549
|
n,
|
|
4387
4550
|
{
|
|
4388
4551
|
...t.componentProps,
|
|
4389
|
-
|
|
4390
|
-
|
|
4552
|
+
disabled: e || ((a = t == null ? void 0 : t.componentProps) == null ? void 0 : a.disabled),
|
|
4553
|
+
editor: r
|
|
4391
4554
|
}
|
|
4392
4555
|
) }) : /* @__PURE__ */ i(_, {});
|
|
4393
4556
|
}
|
|
4394
|
-
function
|
|
4557
|
+
function Ra(t) {
|
|
4395
4558
|
return t.type.name === "image";
|
|
4396
4559
|
}
|
|
4397
4560
|
function Oa(t) {
|
|
@@ -4405,22 +4568,22 @@ function Ha(t) {
|
|
|
4405
4568
|
const { selection: c } = a.view.state, { $from: o, to: s } = c;
|
|
4406
4569
|
let l = !1;
|
|
4407
4570
|
return a.view.state.doc.nodesBetween(o.pos, s, (h) => {
|
|
4408
|
-
if (
|
|
4571
|
+
if (Ra(h))
|
|
4409
4572
|
return l = !0, !1;
|
|
4410
4573
|
}), l;
|
|
4411
4574
|
}, n = P(() => t.disabled ? [] : ya(t.editor), [t.disabled, t.editor, e]);
|
|
4412
4575
|
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4413
4576
|
Y,
|
|
4414
4577
|
{
|
|
4415
|
-
shouldShow: r,
|
|
4416
4578
|
editor: t == null ? void 0 : t.editor,
|
|
4579
|
+
shouldShow: r,
|
|
4417
4580
|
tippyOptions: le,
|
|
4418
|
-
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-
|
|
4581
|
+
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: n == null ? void 0 : n.map((a, c) => /* @__PURE__ */ i(
|
|
4419
4582
|
he,
|
|
4420
4583
|
{
|
|
4421
|
-
item: a,
|
|
4422
4584
|
disabled: t.disabled,
|
|
4423
|
-
editor: t.editor
|
|
4585
|
+
editor: t.editor,
|
|
4586
|
+
item: a
|
|
4424
4587
|
},
|
|
4425
4588
|
`bubbleMenu-image-${c}`
|
|
4426
4589
|
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
@@ -4439,15 +4602,15 @@ function Pa(t) {
|
|
|
4439
4602
|
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4440
4603
|
Y,
|
|
4441
4604
|
{
|
|
4442
|
-
shouldShow: r,
|
|
4443
4605
|
editor: t == null ? void 0 : t.editor,
|
|
4606
|
+
shouldShow: r,
|
|
4444
4607
|
tippyOptions: le,
|
|
4445
|
-
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-
|
|
4608
|
+
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: n == null ? void 0 : n.map((a, c) => /* @__PURE__ */ i(
|
|
4446
4609
|
he,
|
|
4447
4610
|
{
|
|
4448
|
-
item: a,
|
|
4449
4611
|
disabled: t.disabled,
|
|
4450
|
-
editor: t.editor
|
|
4612
|
+
editor: t.editor,
|
|
4613
|
+
item: a
|
|
4451
4614
|
},
|
|
4452
4615
|
`bubbleMenu-image-gif-${c}`
|
|
4453
4616
|
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
@@ -4466,15 +4629,15 @@ function Da(t) {
|
|
|
4466
4629
|
return /* @__PURE__ */ i(_, { children: /* @__PURE__ */ i(
|
|
4467
4630
|
Y,
|
|
4468
4631
|
{
|
|
4469
|
-
shouldShow: r,
|
|
4470
4632
|
editor: t == null ? void 0 : t.editor,
|
|
4633
|
+
shouldShow: r,
|
|
4471
4634
|
tippyOptions: le,
|
|
4472
|
-
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-
|
|
4635
|
+
children: n != null && n.length ? /* @__PURE__ */ i("div", { className: "richtext-pointer-events-auto richtext-w-auto richtext-select-none richtext-rounded-sm !richtext-border richtext-border-neutral-200 richtext-bg-background richtext-px-3 richtext-py-2 richtext-shadow-sm richtext-transition-all dark:richtext-border-neutral-800", children: /* @__PURE__ */ i("div", { className: "richtext-relative richtext-flex richtext-h-[26px] richtext-flex-nowrap richtext-items-center richtext-justify-start richtext-whitespace-nowrap", children: n == null ? void 0 : n.map((a, c) => /* @__PURE__ */ i(
|
|
4473
4636
|
he,
|
|
4474
4637
|
{
|
|
4475
|
-
item: a,
|
|
4476
4638
|
disabled: t.disabled,
|
|
4477
|
-
editor: t.editor
|
|
4639
|
+
editor: t.editor,
|
|
4640
|
+
item: a
|
|
4478
4641
|
},
|
|
4479
4642
|
`bubbleMenu-video-${c}`
|
|
4480
4643
|
)) }) }) : /* @__PURE__ */ i(_, {})
|
|
@@ -4537,21 +4700,45 @@ function Ba({ editor: t }) {
|
|
|
4537
4700
|
}
|
|
4538
4701
|
);
|
|
4539
4702
|
}
|
|
4540
|
-
function $a() {
|
|
4703
|
+
function $a({ editor: t, extensions: e }) {
|
|
4704
|
+
const { t: r } = V(), n = P(() => {
|
|
4705
|
+
var a, c, o;
|
|
4706
|
+
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;
|
|
4707
|
+
}, [e]);
|
|
4708
|
+
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: [
|
|
4709
|
+
t.storage.characterCount.characters(),
|
|
4710
|
+
"/",
|
|
4711
|
+
n,
|
|
4712
|
+
" ",
|
|
4713
|
+
r("editor.characters")
|
|
4714
|
+
] }) }) }) }) : /* @__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: [
|
|
4715
|
+
t.storage.characterCount.characters(),
|
|
4716
|
+
" ",
|
|
4717
|
+
r("editor.characters")
|
|
4718
|
+
] }) }) }) });
|
|
4719
|
+
}
|
|
4720
|
+
function Va() {
|
|
4541
4721
|
const { toasts: t } = $n();
|
|
4542
4722
|
return /* @__PURE__ */ u(In, { children: [
|
|
4543
|
-
t.map(({ id: e, title: r, description: n, action: a, ...c }) => /* @__PURE__ */ u(
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4723
|
+
t.map(({ id: e, title: r, description: n, action: a, ...c }) => /* @__PURE__ */ u(
|
|
4724
|
+
ci,
|
|
4725
|
+
{
|
|
4726
|
+
...c,
|
|
4727
|
+
children: [
|
|
4728
|
+
/* @__PURE__ */ u("div", { className: "richtext-grid richtext-gap-1", children: [
|
|
4729
|
+
r && /* @__PURE__ */ i(oi, { children: r }),
|
|
4730
|
+
n && /* @__PURE__ */ i(si, { children: n })
|
|
4731
|
+
] }),
|
|
4732
|
+
a,
|
|
4733
|
+
/* @__PURE__ */ i(ai, {})
|
|
4734
|
+
]
|
|
4735
|
+
},
|
|
4736
|
+
e
|
|
4737
|
+
)),
|
|
4551
4738
|
/* @__PURE__ */ i(ni, {})
|
|
4552
4739
|
] });
|
|
4553
4740
|
}
|
|
4554
|
-
const
|
|
4741
|
+
const Wa = `
|
|
4555
4742
|
.reactjs-tiptap-editor, .richtext-dialog-content {
|
|
4556
4743
|
button,
|
|
4557
4744
|
input:where([type=button]),
|
|
@@ -4686,8 +4873,8 @@ video {
|
|
|
4686
4873
|
height: auto
|
|
4687
4874
|
}
|
|
4688
4875
|
}
|
|
4689
|
-
`,
|
|
4690
|
-
function
|
|
4876
|
+
`, ze = "data-rc-order", Re = "data-rc-priority", ja = "rc-util-key", ne = /* @__PURE__ */ new Map();
|
|
4877
|
+
function Fa(t, e) {
|
|
4691
4878
|
if (!t)
|
|
4692
4879
|
return !1;
|
|
4693
4880
|
if (t.contains)
|
|
@@ -4701,12 +4888,12 @@ function ja(t, e) {
|
|
|
4701
4888
|
return !1;
|
|
4702
4889
|
}
|
|
4703
4890
|
function Ci({ mark: t } = {}) {
|
|
4704
|
-
return t ? t.startsWith("data-") ? t : `data-${t}` :
|
|
4891
|
+
return t ? t.startsWith("data-") ? t : `data-${t}` : ja;
|
|
4705
4892
|
}
|
|
4706
4893
|
function de(t) {
|
|
4707
4894
|
return t.attachTo ? t.attachTo : document.querySelector("head") || document.body;
|
|
4708
4895
|
}
|
|
4709
|
-
function
|
|
4896
|
+
function Ga(t) {
|
|
4710
4897
|
return t === "queue" ? "prependQueue" : t ? "prepend" : "append";
|
|
4711
4898
|
}
|
|
4712
4899
|
function Ni(t) {
|
|
@@ -4715,15 +4902,15 @@ function Ni(t) {
|
|
|
4715
4902
|
);
|
|
4716
4903
|
}
|
|
4717
4904
|
function Ti(t, e = {}) {
|
|
4718
|
-
const { csp: r, prepend: n, priority: a = 0 } = e, c =
|
|
4719
|
-
s.setAttribute(
|
|
4905
|
+
const { csp: r, prepend: n, priority: a = 0 } = e, c = Ga(n), o = c === "prependQueue", s = document.createElement("style");
|
|
4906
|
+
s.setAttribute(ze, c), o && a && s.setAttribute(Re, `${a}`), r != null && r.nonce && (s.nonce = r == null ? void 0 : r.nonce), s.innerHTML = t;
|
|
4720
4907
|
const l = de(e), { firstChild: h } = l;
|
|
4721
4908
|
if (n) {
|
|
4722
4909
|
if (o) {
|
|
4723
4910
|
const d = Ni(l).filter((x) => {
|
|
4724
|
-
if (!["prepend", "prependQueue"].includes(x.getAttribute(
|
|
4911
|
+
if (!["prepend", "prependQueue"].includes(x.getAttribute(ze)))
|
|
4725
4912
|
return !1;
|
|
4726
|
-
const m = Number(x.getAttribute(
|
|
4913
|
+
const m = Number(x.getAttribute(Re) || 0);
|
|
4727
4914
|
return a >= m;
|
|
4728
4915
|
});
|
|
4729
4916
|
if (d.length > 0)
|
|
@@ -4738,44 +4925,27 @@ function ki(t, e = {}) {
|
|
|
4738
4925
|
const r = de(e);
|
|
4739
4926
|
return Ni(r).find((n) => n.getAttribute(Ci(e)) === t);
|
|
4740
4927
|
}
|
|
4741
|
-
function
|
|
4928
|
+
function Ua(t, e = {}) {
|
|
4742
4929
|
const r = ki(t, e);
|
|
4743
4930
|
r && r.remove();
|
|
4744
4931
|
}
|
|
4745
|
-
function
|
|
4932
|
+
function Ka(t, e) {
|
|
4746
4933
|
const r = ne.get(t);
|
|
4747
|
-
if (!r || !
|
|
4934
|
+
if (!r || !Fa(document, r)) {
|
|
4748
4935
|
const n = Ti("", e), { parentNode: a } = n;
|
|
4749
4936
|
ne.set(t, a), n.remove();
|
|
4750
4937
|
}
|
|
4751
4938
|
}
|
|
4752
|
-
function
|
|
4939
|
+
function Za(t, e, r = {}) {
|
|
4753
4940
|
var o, s, l;
|
|
4754
4941
|
const n = de(r);
|
|
4755
|
-
|
|
4942
|
+
Ka(n, r);
|
|
4756
4943
|
const a = ki(e, r);
|
|
4757
4944
|
if (a)
|
|
4758
4945
|
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;
|
|
4759
4946
|
const c = Ti(t, r);
|
|
4760
4947
|
return c.setAttribute(Ci(r), e), c;
|
|
4761
4948
|
}
|
|
4762
|
-
function Za({ editor: t, extensions: e }) {
|
|
4763
|
-
const { t: r } = V(), n = P(() => {
|
|
4764
|
-
var a, c, o;
|
|
4765
|
-
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;
|
|
4766
|
-
}, [e]);
|
|
4767
|
-
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: [
|
|
4768
|
-
t.storage.characterCount.characters(),
|
|
4769
|
-
"/",
|
|
4770
|
-
n,
|
|
4771
|
-
" ",
|
|
4772
|
-
r("editor.characters")
|
|
4773
|
-
] }) }) }) }) : /* @__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: [
|
|
4774
|
-
t.storage.characterCount.characters(),
|
|
4775
|
-
" ",
|
|
4776
|
-
r("editor.characters")
|
|
4777
|
-
] }) }) }) });
|
|
4778
|
-
}
|
|
4779
4949
|
function Xa(t, e) {
|
|
4780
4950
|
const { content: r, extensions: n, useEditorOptions: a = {} } = t, c = P(() => {
|
|
4781
4951
|
const d = Ui(n, n, "name");
|
|
@@ -4787,7 +4957,7 @@ function Xa(t, e) {
|
|
|
4787
4957
|
var m;
|
|
4788
4958
|
const x = l(d, t.output);
|
|
4789
4959
|
(m = t == null ? void 0 : t.onChangeContent) == null || m.call(t, x);
|
|
4790
|
-
}, Di), s =
|
|
4960
|
+
}, Di), s = Ri({
|
|
4791
4961
|
extensions: c,
|
|
4792
4962
|
content: r,
|
|
4793
4963
|
onUpdate: ({ editor: d }) => {
|
|
@@ -4801,8 +4971,8 @@ function Xa(t, e) {
|
|
|
4801
4971
|
document.documentElement.classList.toggle("dark", t.dark), Mc.setTheme(t.dark ? "dark" : "light");
|
|
4802
4972
|
}, [t.dark]), I(() => {
|
|
4803
4973
|
s == null || s.setEditable(!(t != null && t.disabled)), pn.setDisable(!(t != null && t.disabled));
|
|
4804
|
-
}, [s, t == null ? void 0 : t.disabled]), I(() => ((t == null ? void 0 : t.resetCSS) !== !1 &&
|
|
4805
|
-
|
|
4974
|
+
}, [s, t == null ? void 0 : t.disabled]), I(() => ((t == null ? void 0 : t.resetCSS) !== !1 && Za(Wa, "react-tiptap-reset"), () => {
|
|
4975
|
+
Ua("react-tiptap-reset");
|
|
4806
4976
|
}), [t == null ? void 0 : t.resetCSS]);
|
|
4807
4977
|
function l(d, x) {
|
|
4808
4978
|
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() : "";
|
|
@@ -4813,13 +4983,46 @@ function Xa(t, e) {
|
|
|
4813
4983
|
}, []);
|
|
4814
4984
|
const h = yn(s, "characterCount");
|
|
4815
4985
|
return s ? /* @__PURE__ */ u("div", { className: "reactjs-tiptap-editor", children: [
|
|
4816
|
-
/* @__PURE__ */ i(
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4986
|
+
/* @__PURE__ */ i(
|
|
4987
|
+
On,
|
|
4988
|
+
{
|
|
4989
|
+
delayDuration: 0,
|
|
4990
|
+
disableHoverableContent: !0,
|
|
4991
|
+
children: /* @__PURE__ */ i("div", { className: "richtext-overflow-hidden richtext-rounded-[0.5rem] richtext-bg-background richtext-shadow richtext-outline richtext-outline-1", children: /* @__PURE__ */ u("div", { className: "richtext-flex richtext-max-h-full richtext-w-full richtext-flex-col", children: [
|
|
4992
|
+
!(t != null && t.hideToolbar) && /* @__PURE__ */ i(
|
|
4993
|
+
ma,
|
|
4994
|
+
{
|
|
4995
|
+
disabled: !!(t != null && t.disabled),
|
|
4996
|
+
editor: s,
|
|
4997
|
+
toolbar: t.toolbar
|
|
4998
|
+
}
|
|
4999
|
+
),
|
|
5000
|
+
/* @__PURE__ */ i(
|
|
5001
|
+
Oi,
|
|
5002
|
+
{
|
|
5003
|
+
className: `richtext-relative ${(t == null ? void 0 : t.contentClass) || ""}`,
|
|
5004
|
+
editor: s
|
|
5005
|
+
}
|
|
5006
|
+
),
|
|
5007
|
+
h && /* @__PURE__ */ i(
|
|
5008
|
+
$a,
|
|
5009
|
+
{
|
|
5010
|
+
editor: s,
|
|
5011
|
+
extensions: n
|
|
5012
|
+
}
|
|
5013
|
+
),
|
|
5014
|
+
!(t != null && t.hideBubble) && /* @__PURE__ */ i(
|
|
5015
|
+
da,
|
|
5016
|
+
{
|
|
5017
|
+
bubbleMenu: t == null ? void 0 : t.bubbleMenu,
|
|
5018
|
+
disabled: t == null ? void 0 : t.disabled,
|
|
5019
|
+
editor: s
|
|
5020
|
+
}
|
|
5021
|
+
)
|
|
5022
|
+
] }) })
|
|
5023
|
+
}
|
|
5024
|
+
),
|
|
5025
|
+
/* @__PURE__ */ i(Va, {})
|
|
4823
5026
|
] }) : /* @__PURE__ */ i(_, {});
|
|
4824
5027
|
}
|
|
4825
5028
|
const bo = Si(Xa);
|