reactjs-tiptap-editor-pro 0.2.35 → 0.2.37
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/extension-bundle.d.cts +77 -77
- package/lib/extension-bundle.d.ts +77 -77
- package/lib/index.cjs +3 -3
- package/lib/index.d.cts +93 -78
- package/lib/index.d.ts +93 -78
- package/lib/index.js +127 -124
- package/lib/locale-bundle.d.cts +77 -77
- package/lib/locale-bundle.d.ts +77 -77
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -4,8 +4,8 @@ var me = (e, t, n) => ur(e, typeof t != "symbol" ? t + "" : t, n);
|
|
|
4
4
|
import * as ie from "react";
|
|
5
5
|
import { useRef as ne, useState as I, useEffect as R, useMemo as F, Fragment as Ve, useCallback as O, memo as fr, forwardRef as hr, useId as mr, useImperativeHandle as gr, useLayoutEffect as pr } from "react";
|
|
6
6
|
import { jsx as a, jsxs as p, Fragment as N } from "react/jsx-runtime";
|
|
7
|
-
import { i as Ke, S as re, t as vr, a as Ce, b as oe, r as J, c as Z, f as yr, d as ae, e as wr, D as Xe, g as qe, A as C, h as Ye, j as Je, C as xr, k as Ze, B as Y, s as cn, l as dn, m as un, u as Te, n as vt, o as L, p as U, P as br, q as Cr, v as Tr, L as $e, I as ye, w as se, x as Ae, y as Ar, K as ge, T as fn, M as yt, z as wt, F as Sr, E as hn, G as mn, H as Pr, J as he, N as _r, O as Nr, Q as Er, R as gn, U as $r, V as Or, W as z, X as Rr, Y as Ir, Z as Dr, _ as
|
|
8
|
-
import { u as D, B as ti, l as
|
|
7
|
+
import { i as Ke, S as re, t as vr, a as Ce, b as oe, r as J, c as Z, f as yr, d as ae, e as wr, D as Xe, g as qe, A as C, h as Ye, j as Je, C as xr, k as Ze, B as Y, s as cn, l as dn, m as un, u as Te, n as vt, o as L, p as U, P as br, q as Cr, v as Tr, L as $e, I as ye, w as se, x as Ae, y as Ar, K as ge, T as fn, M as yt, z as wt, F as Sr, E as hn, G as mn, H as Pr, J as he, N as _r, O as Nr, Q as Er, R as gn, U as $r, V as Or, W as z, X as Rr, Y as Ir, Z as Dr, _ as Br, $ as Mr, a0 as kr, a1 as W, a2 as Lr, a3 as xt, a4 as bt, a5 as Ct, a6 as Tt, a7 as At, a8 as St, a9 as pn, aa as zr, ab as vn, ac as yn, ad as Fr, ae as jr, af as Hr, ag as Pt, ah as Ur, ai as Gr, aj as Wr, ak as Vr, al as Kr, am as _t, an as Nt, ao as Xr, ap as qr, aq as Yr, ar as Jr, as as Zr, at as Qr, au as ei } from "./ColorPicker-BGCCdXrc.js";
|
|
8
|
+
import { u as D, B as ti, l as B, I as we, V as Et, E as ni } from "./locale-bundle-CT7qZRHF.js";
|
|
9
9
|
import * as j from "@radix-ui/react-toast";
|
|
10
10
|
import { X as ri, HelpCircle as ii, Pencil as oi, Trash2 as ai } from "lucide-react";
|
|
11
11
|
import { Editor as si, makeDropdownToolbar as li } from "easydrawer";
|
|
@@ -97,7 +97,7 @@ function te(e, t) {
|
|
|
97
97
|
var n = Oi(e, t);
|
|
98
98
|
return $i(n) ? n : void 0;
|
|
99
99
|
}
|
|
100
|
-
var
|
|
100
|
+
var Be = te(J, "WeakMap");
|
|
101
101
|
function Ri(e, t, n) {
|
|
102
102
|
switch (n.length) {
|
|
103
103
|
case 0:
|
|
@@ -111,11 +111,11 @@ function Ri(e, t, n) {
|
|
|
111
111
|
}
|
|
112
112
|
return e.apply(t, n);
|
|
113
113
|
}
|
|
114
|
-
var Ii = 800, Di = 16,
|
|
115
|
-
function
|
|
114
|
+
var Ii = 800, Di = 16, Bi = Date.now;
|
|
115
|
+
function Mi(e) {
|
|
116
116
|
var t = 0, n = 0;
|
|
117
117
|
return function() {
|
|
118
|
-
var r =
|
|
118
|
+
var r = Bi(), i = Di - (r - n);
|
|
119
119
|
if (n = r, i > 0) {
|
|
120
120
|
if (++t >= Ii)
|
|
121
121
|
return arguments[0];
|
|
@@ -142,7 +142,7 @@ var Dt = function() {
|
|
|
142
142
|
value: ki(t),
|
|
143
143
|
writable: !0
|
|
144
144
|
});
|
|
145
|
-
} : Qe, zi =
|
|
145
|
+
} : Qe, zi = Mi(Li);
|
|
146
146
|
function Fi(e, t, n, r) {
|
|
147
147
|
for (var i = e.length, o = n + -1; ++o < i; )
|
|
148
148
|
if (t(e[o], o, e))
|
|
@@ -173,10 +173,10 @@ function bn(e, t) {
|
|
|
173
173
|
function Cn(e, t) {
|
|
174
174
|
return e === t || e !== e && t !== t;
|
|
175
175
|
}
|
|
176
|
-
var
|
|
176
|
+
var Bt = Math.max;
|
|
177
177
|
function Ki(e, t, n) {
|
|
178
|
-
return t =
|
|
179
|
-
for (var r = arguments, i = -1, o =
|
|
178
|
+
return t = Bt(t === void 0 ? e.length - 1 : t, 0), function() {
|
|
179
|
+
for (var r = arguments, i = -1, o = Bt(r.length - t, 0), s = Array(o); ++i < o; )
|
|
180
180
|
s[i] = r[t + i];
|
|
181
181
|
i = -1;
|
|
182
182
|
for (var c = Array(t + 1); ++i < t; )
|
|
@@ -205,18 +205,18 @@ function Zi(e, t) {
|
|
|
205
205
|
return r;
|
|
206
206
|
}
|
|
207
207
|
var Qi = "[object Arguments]";
|
|
208
|
-
function
|
|
208
|
+
function Mt(e) {
|
|
209
209
|
return Z(e) && oe(e) == Qi;
|
|
210
210
|
}
|
|
211
|
-
var An = Object.prototype, eo = An.hasOwnProperty, to = An.propertyIsEnumerable, tt =
|
|
211
|
+
var An = Object.prototype, eo = An.hasOwnProperty, to = An.propertyIsEnumerable, tt = Mt(/* @__PURE__ */ function() {
|
|
212
212
|
return arguments;
|
|
213
|
-
}()) ?
|
|
213
|
+
}()) ? Mt : function(e) {
|
|
214
214
|
return Z(e) && eo.call(e, "callee") && !to.call(e, "callee");
|
|
215
215
|
};
|
|
216
216
|
function no() {
|
|
217
217
|
return !1;
|
|
218
218
|
}
|
|
219
|
-
var Sn = typeof exports == "object" && exports && !exports.nodeType && exports, kt = Sn && typeof module == "object" && module && !module.nodeType && module, ro = kt && kt.exports === Sn, Lt = ro ? J.Buffer : void 0, io = Lt ? Lt.isBuffer : void 0,
|
|
219
|
+
var Sn = typeof exports == "object" && exports && !exports.nodeType && exports, kt = Sn && typeof module == "object" && module && !module.nodeType && module, ro = kt && kt.exports === Sn, Lt = ro ? J.Buffer : void 0, io = Lt ? Lt.isBuffer : void 0, Me = io || no, oo = "[object Arguments]", ao = "[object Array]", so = "[object Boolean]", lo = "[object Date]", co = "[object Error]", uo = "[object Function]", fo = "[object Map]", ho = "[object Number]", mo = "[object Object]", go = "[object RegExp]", po = "[object Set]", vo = "[object String]", yo = "[object WeakMap]", wo = "[object ArrayBuffer]", xo = "[object DataView]", bo = "[object Float32Array]", Co = "[object Float64Array]", To = "[object Int8Array]", Ao = "[object Int16Array]", So = "[object Int32Array]", Po = "[object Uint8Array]", _o = "[object Uint8ClampedArray]", No = "[object Uint16Array]", Eo = "[object Uint32Array]", $ = {};
|
|
220
220
|
$[bo] = $[Co] = $[To] = $[Ao] = $[So] = $[Po] = $[_o] = $[No] = $[Eo] = !0;
|
|
221
221
|
$[oo] = $[ao] = $[wo] = $[so] = $[xo] = $[lo] = $[co] = $[uo] = $[fo] = $[ho] = $[mo] = $[go] = $[po] = $[vo] = $[yo] = !1;
|
|
222
222
|
function $o(e) {
|
|
@@ -235,7 +235,7 @@ var Pn = typeof exports == "object" && exports && !exports.nodeType && exports,
|
|
|
235
235
|
}
|
|
236
236
|
}(), zt = be && be.isTypedArray, _n = zt ? nt(zt) : $o, Ro = Object.prototype, Io = Ro.hasOwnProperty;
|
|
237
237
|
function Do(e, t) {
|
|
238
|
-
var n = G(e), r = !n && tt(e), i = !n && !r &&
|
|
238
|
+
var n = G(e), r = !n && tt(e), i = !n && !r && Me(e), o = !n && !r && !i && _n(e), s = n || r || i || o, c = s ? Zi(e.length, String) : [], l = c.length;
|
|
239
239
|
for (var d in e)
|
|
240
240
|
Io.call(e, d) && !(s && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
241
241
|
(d == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
@@ -244,15 +244,15 @@ function Do(e, t) {
|
|
|
244
244
|
bn(d, l))) && c.push(d);
|
|
245
245
|
return c;
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Bo(e, t) {
|
|
248
248
|
return function(n) {
|
|
249
249
|
return e(t(n));
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
-
var
|
|
252
|
+
var Mo = Bo(Object.keys, Object), ko = Object.prototype, Lo = ko.hasOwnProperty;
|
|
253
253
|
function zo(e) {
|
|
254
254
|
if (!Ji(e))
|
|
255
|
-
return
|
|
255
|
+
return Mo(e);
|
|
256
256
|
var t = [];
|
|
257
257
|
for (var n in Object(e))
|
|
258
258
|
Lo.call(e, n) && n != "constructor" && t.push(n);
|
|
@@ -473,7 +473,7 @@ function ot(e) {
|
|
|
473
473
|
function Oa(e) {
|
|
474
474
|
return e.split("");
|
|
475
475
|
}
|
|
476
|
-
var Rn = "\\ud800-\\udfff", Ra = "\\u0300-\\u036f", Ia = "\\ufe20-\\ufe2f", Da = "\\u20d0-\\u20ff",
|
|
476
|
+
var Rn = "\\ud800-\\udfff", Ra = "\\u0300-\\u036f", Ia = "\\ufe20-\\ufe2f", Da = "\\u20d0-\\u20ff", Ba = Ra + Ia + Da, Ma = "\\ufe0e\\ufe0f", ka = "[" + Rn + "]", Le = "[" + Ba + "]", ze = "\\ud83c[\\udffb-\\udfff]", La = "(?:" + Le + "|" + ze + ")", In = "[^" + Rn + "]", Dn = "(?:\\ud83c[\\udde6-\\uddff]){2}", Bn = "[\\ud800-\\udbff][\\udc00-\\udfff]", za = "\\u200d", Mn = La + "?", kn = "[" + Ma + "]?", Fa = "(?:" + za + "(?:" + [In, Dn, Bn].join("|") + ")" + kn + Mn + ")*", ja = kn + Mn + Fa, Ha = "(?:" + [In + Le + "?", Le, Dn, Bn, ka].join("|") + ")", Ua = RegExp(ze + "(?=" + ze + ")|" + Ha + ja, "g");
|
|
477
477
|
function Ga(e) {
|
|
478
478
|
return e.match(Ua) || [];
|
|
479
479
|
}
|
|
@@ -535,8 +535,8 @@ function rs(e, t, n) {
|
|
|
535
535
|
function Ht(e) {
|
|
536
536
|
return rs(e, Nn, ns);
|
|
537
537
|
}
|
|
538
|
-
var Fe = te(J, "DataView"), je = te(J, "Promise"), He = te(J, "Set"), Ut = "[object Map]", is = "[object Object]", Gt = "[object Promise]", Wt = "[object Set]", Vt = "[object WeakMap]", Kt = "[object DataView]", os = ee(Fe), as = ee(ue), ss = ee(je), ls = ee(He), cs = ee(
|
|
539
|
-
(Fe && q(new Fe(new ArrayBuffer(1))) != Kt || ue && q(new ue()) != Ut || je && q(je.resolve()) != Gt || He && q(new He()) != Wt ||
|
|
538
|
+
var Fe = te(J, "DataView"), je = te(J, "Promise"), He = te(J, "Set"), Ut = "[object Map]", is = "[object Object]", Gt = "[object Promise]", Wt = "[object Set]", Vt = "[object WeakMap]", Kt = "[object DataView]", os = ee(Fe), as = ee(ue), ss = ee(je), ls = ee(He), cs = ee(Be), q = oe;
|
|
539
|
+
(Fe && q(new Fe(new ArrayBuffer(1))) != Kt || ue && q(new ue()) != Ut || je && q(je.resolve()) != Gt || He && q(new He()) != Wt || Be && q(new Be()) != Vt) && (q = function(e) {
|
|
540
540
|
var t = oe(e), n = t == is ? e.constructor : void 0, r = n ? ee(n) : "";
|
|
541
541
|
if (r)
|
|
542
542
|
switch (r) {
|
|
@@ -586,9 +586,9 @@ function zn(e, t, n, r, i, o) {
|
|
|
586
586
|
return d == t && f == e;
|
|
587
587
|
var u = -1, h = !0, m = n & gs ? new fe() : void 0;
|
|
588
588
|
for (o.set(e, t), o.set(t, e); ++u < c; ) {
|
|
589
|
-
var g = e[u],
|
|
589
|
+
var g = e[u], y = t[u];
|
|
590
590
|
if (r)
|
|
591
|
-
var x = s ? r(
|
|
591
|
+
var x = s ? r(y, g, u, t, e, o) : r(g, y, u, e, t, o);
|
|
592
592
|
if (x !== void 0) {
|
|
593
593
|
if (x)
|
|
594
594
|
continue;
|
|
@@ -603,7 +603,7 @@ function zn(e, t, n, r, i, o) {
|
|
|
603
603
|
h = !1;
|
|
604
604
|
break;
|
|
605
605
|
}
|
|
606
|
-
} else if (!(g ===
|
|
606
|
+
} else if (!(g === y || i(g, y, n, r, o))) {
|
|
607
607
|
h = !1;
|
|
608
608
|
break;
|
|
609
609
|
}
|
|
@@ -659,7 +659,7 @@ function Os(e, t, n, r, i, o, s) {
|
|
|
659
659
|
return !1;
|
|
660
660
|
}
|
|
661
661
|
var Rs = 1, Is = Object.prototype, Ds = Is.hasOwnProperty;
|
|
662
|
-
function
|
|
662
|
+
function Bs(e, t, n, r, i, o) {
|
|
663
663
|
var s = n & Rs, c = Ht(e), l = c.length, d = Ht(t), f = d.length;
|
|
664
664
|
if (l != f && !s)
|
|
665
665
|
return !1;
|
|
@@ -671,7 +671,7 @@ function Ms(e, t, n, r, i, o) {
|
|
|
671
671
|
var m = o.get(e), g = o.get(t);
|
|
672
672
|
if (m && g)
|
|
673
673
|
return m == t && g == e;
|
|
674
|
-
var
|
|
674
|
+
var y = !0;
|
|
675
675
|
o.set(e, t), o.set(t, e);
|
|
676
676
|
for (var x = s; ++u < l; ) {
|
|
677
677
|
h = c[u];
|
|
@@ -679,37 +679,37 @@ function Ms(e, t, n, r, i, o) {
|
|
|
679
679
|
if (r)
|
|
680
680
|
var E = s ? r(_, A, h, t, e, o) : r(A, _, h, e, t, o);
|
|
681
681
|
if (!(E === void 0 ? A === _ || i(A, _, n, r, o) : E)) {
|
|
682
|
-
|
|
682
|
+
y = !1;
|
|
683
683
|
break;
|
|
684
684
|
}
|
|
685
685
|
x || (x = h == "constructor");
|
|
686
686
|
}
|
|
687
|
-
if (
|
|
688
|
-
var b = e.constructor,
|
|
689
|
-
b !=
|
|
687
|
+
if (y && !x) {
|
|
688
|
+
var b = e.constructor, v = t.constructor;
|
|
689
|
+
b != v && "constructor" in e && "constructor" in t && !(typeof b == "function" && b instanceof b && typeof v == "function" && v instanceof v) && (y = !1);
|
|
690
690
|
}
|
|
691
|
-
return o.delete(e), o.delete(t),
|
|
691
|
+
return o.delete(e), o.delete(t), y;
|
|
692
692
|
}
|
|
693
|
-
var
|
|
693
|
+
var Ms = 1, Yt = "[object Arguments]", Jt = "[object Array]", pe = "[object Object]", ks = Object.prototype, Zt = ks.hasOwnProperty;
|
|
694
694
|
function Ls(e, t, n, r, i, o) {
|
|
695
695
|
var s = G(e), c = G(t), l = s ? Jt : q(e), d = c ? Jt : q(t);
|
|
696
696
|
l = l == Yt ? pe : l, d = d == Yt ? pe : d;
|
|
697
697
|
var f = l == pe, u = d == pe, h = l == d;
|
|
698
|
-
if (h &&
|
|
699
|
-
if (!
|
|
698
|
+
if (h && Me(e)) {
|
|
699
|
+
if (!Me(t))
|
|
700
700
|
return !1;
|
|
701
701
|
s = !0, f = !1;
|
|
702
702
|
}
|
|
703
703
|
if (h && !f)
|
|
704
704
|
return o || (o = new V()), s || _n(e) ? zn(e, t, n, r, i, o) : Os(e, t, l, n, r, i, o);
|
|
705
|
-
if (!(n &
|
|
705
|
+
if (!(n & Ms)) {
|
|
706
706
|
var m = f && Zt.call(e, "__wrapped__"), g = u && Zt.call(t, "__wrapped__");
|
|
707
707
|
if (m || g) {
|
|
708
|
-
var
|
|
709
|
-
return o || (o = new V()), i(
|
|
708
|
+
var y = m ? e.value() : e, x = g ? t.value() : t;
|
|
709
|
+
return o || (o = new V()), i(y, x, n, r, o);
|
|
710
710
|
}
|
|
711
711
|
}
|
|
712
|
-
return h ? (o || (o = new V()),
|
|
712
|
+
return h ? (o || (o = new V()), Bs(e, t, n, r, i, o)) : !1;
|
|
713
713
|
}
|
|
714
714
|
function at(e, t, n, r, i) {
|
|
715
715
|
return e === t ? !0 : e == null || t == null || !Z(e) && !Z(t) ? e !== e && t !== t : Ls(e, t, n, r, at, i);
|
|
@@ -970,15 +970,15 @@ function _l({ editor: e, attrs: t, extension: n }) {
|
|
|
970
970
|
const u = async () => {
|
|
971
971
|
if (o.current) {
|
|
972
972
|
const T = o.current.toSVG(), w = T.outerHTML, P = `drawer-${cn()}.svg`;
|
|
973
|
-
let
|
|
973
|
+
let M = dn(T.outerHTML);
|
|
974
974
|
if (d) {
|
|
975
|
-
const k = un(
|
|
976
|
-
|
|
975
|
+
const k = un(M, P);
|
|
976
|
+
M = await d(k);
|
|
977
977
|
}
|
|
978
978
|
e == null || e.chain().focus().setDrawer(
|
|
979
979
|
{
|
|
980
980
|
type: "drawer",
|
|
981
|
-
src:
|
|
981
|
+
src: M,
|
|
982
982
|
alt: encodeURIComponent(w),
|
|
983
983
|
width: 426,
|
|
984
984
|
height: 212
|
|
@@ -996,7 +996,7 @@ function _l({ editor: e, attrs: t, extension: n }) {
|
|
|
996
996
|
}, g = (T) => {
|
|
997
997
|
const w = o.current.toolController.getPrimaryTools()[3], P = s.current.getWidgetById("pen-2");
|
|
998
998
|
w && P && (w.setColor(T), P.serializeState());
|
|
999
|
-
},
|
|
999
|
+
}, y = (T) => {
|
|
1000
1000
|
const w = s.current.getWidgetById("shape");
|
|
1001
1001
|
w && w.setShapeType(T);
|
|
1002
1002
|
}, x = (T) => {
|
|
@@ -1046,7 +1046,7 @@ function _l({ editor: e, attrs: t, extension: n }) {
|
|
|
1046
1046
|
{
|
|
1047
1047
|
changeBorderColorShape: _,
|
|
1048
1048
|
changeColorShape: x,
|
|
1049
|
-
changeShape:
|
|
1049
|
+
changeShape: y,
|
|
1050
1050
|
onClear: () => {
|
|
1051
1051
|
if (!le) {
|
|
1052
1052
|
for (; o.current.history.undoStackSize > 0; )
|
|
@@ -1231,7 +1231,7 @@ function Dl({ editor: e }) {
|
|
|
1231
1231
|
e.chain().updateAttributes(se.name, x).setNodeSelection(e.state.selection.from).focus().run();
|
|
1232
1232
|
},
|
|
1233
1233
|
[e]
|
|
1234
|
-
), g = O(() => e.isActive(se.name) && !i, [e, i]),
|
|
1234
|
+
), g = O(() => e.isActive(se.name) && !i, [e, i]), y = O(() => Ae(se.name, e), [e]);
|
|
1235
1235
|
return /* @__PURE__ */ p(N, { children: [
|
|
1236
1236
|
/* @__PURE__ */ a(
|
|
1237
1237
|
L,
|
|
@@ -1278,7 +1278,7 @@ function Dl({ editor: e }) {
|
|
|
1278
1278
|
/* @__PURE__ */ a(
|
|
1279
1279
|
C,
|
|
1280
1280
|
{
|
|
1281
|
-
action:
|
|
1281
|
+
action: y,
|
|
1282
1282
|
icon: "Trash2",
|
|
1283
1283
|
tooltip: t("editor.delete")
|
|
1284
1284
|
}
|
|
@@ -1315,7 +1315,7 @@ function Dl({ editor: e }) {
|
|
|
1315
1315
|
)
|
|
1316
1316
|
] });
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1318
|
+
function Bl({ editor: e, ...t }) {
|
|
1319
1319
|
const n = Te(e, ge.name, {
|
|
1320
1320
|
text: "",
|
|
1321
1321
|
defaultShowPicker: !1
|
|
@@ -1380,7 +1380,7 @@ function Ml({ editor: e, ...t }) {
|
|
|
1380
1380
|
);
|
|
1381
1381
|
}
|
|
1382
1382
|
const tn = `graph TB
|
|
1383
|
-
a-->b`,
|
|
1383
|
+
a-->b`, Ml = ({ editor: e, attrs: t, extension: n }) => {
|
|
1384
1384
|
const { alt: r, align: i } = t, [o, s] = I(decodeURIComponent(r ?? tn)), [c, l] = I(""), [d, f] = I(!1), u = ne(null), h = n == null ? void 0 : n.options.upload, m = async (x) => {
|
|
1385
1385
|
try {
|
|
1386
1386
|
const { svg: A } = await $t.render("mermaid-svg", x);
|
|
@@ -1453,8 +1453,8 @@ a-->b`, Bl = ({ editor: e, attrs: t, extension: n }) => {
|
|
|
1453
1453
|
const x = u.current.querySelector("svg"), { width: A, height: _ } = x.getBoundingClientRect(), E = `mermaid-${cn()}.svg`;
|
|
1454
1454
|
let b = dn(x.outerHTML);
|
|
1455
1455
|
if (h) {
|
|
1456
|
-
const
|
|
1457
|
-
b = await h(
|
|
1456
|
+
const v = un(b, E);
|
|
1457
|
+
b = await h(v);
|
|
1458
1458
|
}
|
|
1459
1459
|
e == null || e.chain().focus().setMermaid(
|
|
1460
1460
|
{
|
|
@@ -1521,7 +1521,7 @@ function Fl(e) {
|
|
|
1521
1521
|
shouldShow: i,
|
|
1522
1522
|
tippyOptions: kl,
|
|
1523
1523
|
children: o != null && o.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start whitespace-nowrap", children: o == null ? void 0 : o.map((s, c) => s.type === "edit" && (n != null && n.src) ? /* @__PURE__ */ a(
|
|
1524
|
-
|
|
1524
|
+
Ml,
|
|
1525
1525
|
{
|
|
1526
1526
|
attrs: n,
|
|
1527
1527
|
editor: e.editor,
|
|
@@ -1593,7 +1593,7 @@ function jl({ editor: e, disabled: t }) {
|
|
|
1593
1593
|
}
|
|
1594
1594
|
function Hl({ editor: e, disabled: t, bubbleMenu: n }) {
|
|
1595
1595
|
const r = e.extensionManager.extensions.map((o) => o.name), i = () => {
|
|
1596
|
-
var o, s, c, l, d, f, u, h, m, g,
|
|
1596
|
+
var o, s, c, l, d, f, u, h, m, g, y, x, A, _, E, b, v, T;
|
|
1597
1597
|
return [
|
|
1598
1598
|
r.includes("columns") && !((o = n == null ? void 0 : n.columnConfig) != null && o.hidden) ? /* @__PURE__ */ a(
|
|
1599
1599
|
bc,
|
|
@@ -1644,7 +1644,7 @@ function Hl({ editor: e, disabled: t, bubbleMenu: n }) {
|
|
|
1644
1644
|
"video"
|
|
1645
1645
|
) : null,
|
|
1646
1646
|
r.includes("katex") && !((m = n == null ? void 0 : n.katexConfig) != null && m.hidden) ? /* @__PURE__ */ a(
|
|
1647
|
-
|
|
1647
|
+
Bl,
|
|
1648
1648
|
{
|
|
1649
1649
|
disabled: t,
|
|
1650
1650
|
editor: e
|
|
@@ -1659,7 +1659,7 @@ function Hl({ editor: e, disabled: t, bubbleMenu: n }) {
|
|
|
1659
1659
|
},
|
|
1660
1660
|
"mermaid"
|
|
1661
1661
|
) : null,
|
|
1662
|
-
r.includes("iframe") && !((
|
|
1662
|
+
r.includes("iframe") && !((y = n == null ? void 0 : n.iframeConfig) != null && y.hidden) ? /* @__PURE__ */ a(
|
|
1663
1663
|
Dl,
|
|
1664
1664
|
{
|
|
1665
1665
|
disabled: t,
|
|
@@ -1688,11 +1688,13 @@ function Hl({ editor: e, disabled: t, bubbleMenu: n }) {
|
|
|
1688
1688
|
{
|
|
1689
1689
|
disabled: t,
|
|
1690
1690
|
editor: e,
|
|
1691
|
-
items: (E = n == null ? void 0 : n.textConfig) == null ? void 0 : E.items
|
|
1691
|
+
items: (E = n == null ? void 0 : n.textConfig) == null ? void 0 : E.items,
|
|
1692
|
+
showShow: (b = n == null ? void 0 : n.textConfig) == null ? void 0 : b.showShow,
|
|
1693
|
+
filterItem: (v = n == null ? void 0 : n.textConfig) == null ? void 0 : v.filterItem
|
|
1692
1694
|
},
|
|
1693
1695
|
"text"
|
|
1694
1696
|
),
|
|
1695
|
-
r.includes("drawer") && !((
|
|
1697
|
+
r.includes("drawer") && !((T = n == null ? void 0 : n.drawerConfig) != null && T.hidden) ? /* @__PURE__ */ a(
|
|
1696
1698
|
Ol,
|
|
1697
1699
|
{
|
|
1698
1700
|
disabled: t,
|
|
@@ -1716,9 +1718,9 @@ function Ul({ editor: e, disabled: t, toolbar: n }) {
|
|
|
1716
1718
|
button: h,
|
|
1717
1719
|
divider: m = !1,
|
|
1718
1720
|
spacer: g = !1,
|
|
1719
|
-
toolbar:
|
|
1721
|
+
toolbar: y = !0
|
|
1720
1722
|
} = u.options;
|
|
1721
|
-
if (!h || !Pr(h) || !
|
|
1723
|
+
if (!h || !Pr(h) || !y)
|
|
1722
1724
|
continue;
|
|
1723
1725
|
const x = h({
|
|
1724
1726
|
editor: e,
|
|
@@ -1782,7 +1784,7 @@ function Gl(e) {
|
|
|
1782
1784
|
type: `image-${r}`,
|
|
1783
1785
|
component: C,
|
|
1784
1786
|
componentProps: {
|
|
1785
|
-
tooltip:
|
|
1787
|
+
tooltip: B.t(`editor.${r.replace("-", ".")}.tooltip`),
|
|
1786
1788
|
icon: n[i],
|
|
1787
1789
|
action: () => e.commands.updateImage({ width: we[r] }),
|
|
1788
1790
|
isActive: () => e.isActive("image", { width: we[r] })
|
|
@@ -1799,7 +1801,7 @@ function Wl(e) {
|
|
|
1799
1801
|
type: `image-${r}`,
|
|
1800
1802
|
component: C,
|
|
1801
1803
|
componentProps: {
|
|
1802
|
-
tooltip:
|
|
1804
|
+
tooltip: B.t(`editor.${r.replace("-", ".")}.tooltip`),
|
|
1803
1805
|
icon: n[i],
|
|
1804
1806
|
action: () => e.commands.updateImageGif({ width: we[r] }),
|
|
1805
1807
|
isActive: () => e.isActive("image", { width: we[r] })
|
|
@@ -1816,7 +1818,7 @@ function Vl(e) {
|
|
|
1816
1818
|
type: `image-${r}`,
|
|
1817
1819
|
component: C,
|
|
1818
1820
|
componentProps: {
|
|
1819
|
-
tooltip:
|
|
1821
|
+
tooltip: B.t(`editor.textalign.${r}.tooltip`),
|
|
1820
1822
|
icon: n[r],
|
|
1821
1823
|
action: () => {
|
|
1822
1824
|
var i, o;
|
|
@@ -1837,7 +1839,7 @@ function Kl(e) {
|
|
|
1837
1839
|
type: `image-${r}`,
|
|
1838
1840
|
component: C,
|
|
1839
1841
|
componentProps: {
|
|
1840
|
-
tooltip:
|
|
1842
|
+
tooltip: B.t(`editor.textalign.${r}.tooltip`),
|
|
1841
1843
|
icon: n[r],
|
|
1842
1844
|
action: () => {
|
|
1843
1845
|
var i, o;
|
|
@@ -1858,7 +1860,7 @@ function Xl(e) {
|
|
|
1858
1860
|
type: `image-${r}`,
|
|
1859
1861
|
component: C,
|
|
1860
1862
|
componentProps: {
|
|
1861
|
-
tooltip:
|
|
1863
|
+
tooltip: B.t(`editor.textalign.${r}.tooltip`),
|
|
1862
1864
|
icon: n[r],
|
|
1863
1865
|
action: () => {
|
|
1864
1866
|
var i, o;
|
|
@@ -1879,7 +1881,7 @@ function ql(e) {
|
|
|
1879
1881
|
type: `image-${r}`,
|
|
1880
1882
|
component: C,
|
|
1881
1883
|
componentProps: {
|
|
1882
|
-
tooltip:
|
|
1884
|
+
tooltip: B.t(`editor.textalign.${r}.tooltip`),
|
|
1883
1885
|
icon: n[r],
|
|
1884
1886
|
action: () => {
|
|
1885
1887
|
var i, o;
|
|
@@ -1900,7 +1902,7 @@ function Yl(e) {
|
|
|
1900
1902
|
type: `video-${r}`,
|
|
1901
1903
|
component: C,
|
|
1902
1904
|
componentProps: {
|
|
1903
|
-
tooltip:
|
|
1905
|
+
tooltip: B.t(`editor.${r.replace("-", ".")}.tooltip`),
|
|
1904
1906
|
icon: n[i],
|
|
1905
1907
|
action: () => e.commands.updateVideo({ width: Et[r] }),
|
|
1906
1908
|
isActive: () => e.isActive("video", { width: Et[r] })
|
|
@@ -1914,7 +1916,7 @@ function Jl(e) {
|
|
|
1914
1916
|
component: C,
|
|
1915
1917
|
componentProps: {
|
|
1916
1918
|
editor: e,
|
|
1917
|
-
tooltip:
|
|
1919
|
+
tooltip: B.t("editor.tooltip.flipX"),
|
|
1918
1920
|
icon: "FlipX",
|
|
1919
1921
|
action: () => {
|
|
1920
1922
|
const t = e.getAttributes("image"), { flipX: n } = t;
|
|
@@ -1929,7 +1931,7 @@ function Jl(e) {
|
|
|
1929
1931
|
component: C,
|
|
1930
1932
|
componentProps: {
|
|
1931
1933
|
editor: e,
|
|
1932
|
-
tooltip:
|
|
1934
|
+
tooltip: B.t("editor.tooltip.flipY"),
|
|
1933
1935
|
icon: "FlipY",
|
|
1934
1936
|
action: () => {
|
|
1935
1937
|
const t = e.getAttributes("image"), { flipY: n } = t;
|
|
@@ -1946,7 +1948,7 @@ function Jl(e) {
|
|
|
1946
1948
|
component: C,
|
|
1947
1949
|
componentProps: {
|
|
1948
1950
|
editor: e,
|
|
1949
|
-
tooltip:
|
|
1951
|
+
tooltip: B.t("editor.remove"),
|
|
1950
1952
|
icon: "Trash2",
|
|
1951
1953
|
action: () => {
|
|
1952
1954
|
const { state: t, dispatch: n } = e.view;
|
|
@@ -1965,7 +1967,7 @@ function Zl(e) {
|
|
|
1965
1967
|
component: C,
|
|
1966
1968
|
componentProps: {
|
|
1967
1969
|
editor: e,
|
|
1968
|
-
tooltip:
|
|
1970
|
+
tooltip: B.t("editor.remove"),
|
|
1969
1971
|
icon: "Trash2",
|
|
1970
1972
|
action: () => {
|
|
1971
1973
|
const { state: t, dispatch: n } = e.view;
|
|
@@ -1983,7 +1985,7 @@ function Ql(e) {
|
|
|
1983
1985
|
component: C,
|
|
1984
1986
|
componentProps: {
|
|
1985
1987
|
editor: e,
|
|
1986
|
-
tooltip:
|
|
1988
|
+
tooltip: B.t("editor.edit"),
|
|
1987
1989
|
icon: "Pencil",
|
|
1988
1990
|
action: () => !0
|
|
1989
1991
|
}
|
|
@@ -1993,7 +1995,7 @@ function Ql(e) {
|
|
|
1993
1995
|
component: C,
|
|
1994
1996
|
componentProps: {
|
|
1995
1997
|
editor: e,
|
|
1996
|
-
tooltip:
|
|
1998
|
+
tooltip: B.t("editor.remove"),
|
|
1997
1999
|
icon: "Trash2",
|
|
1998
2000
|
action: () => {
|
|
1999
2001
|
const { state: t, dispatch: n } = e.view;
|
|
@@ -2011,7 +2013,7 @@ function ec(e) {
|
|
|
2011
2013
|
component: C,
|
|
2012
2014
|
componentProps: {
|
|
2013
2015
|
editor: e,
|
|
2014
|
-
tooltip:
|
|
2016
|
+
tooltip: B.t("editor.edit"),
|
|
2015
2017
|
icon: "Pencil",
|
|
2016
2018
|
action: () => (console.log("AAA"), !0)
|
|
2017
2019
|
}
|
|
@@ -2021,7 +2023,7 @@ function ec(e) {
|
|
|
2021
2023
|
component: C,
|
|
2022
2024
|
componentProps: {
|
|
2023
2025
|
editor: e,
|
|
2024
|
-
tooltip:
|
|
2026
|
+
tooltip: B.t("editor.remove"),
|
|
2025
2027
|
icon: "Trash2",
|
|
2026
2028
|
action: () => {
|
|
2027
2029
|
const { state: t, dispatch: n } = e.view;
|
|
@@ -2039,7 +2041,7 @@ function tc(e) {
|
|
|
2039
2041
|
component: C,
|
|
2040
2042
|
componentProps: {
|
|
2041
2043
|
editor: e,
|
|
2042
|
-
tooltip:
|
|
2044
|
+
tooltip: B.t("editor.remove"),
|
|
2043
2045
|
icon: "Trash2",
|
|
2044
2046
|
action: () => {
|
|
2045
2047
|
const { state: t, dispatch: n } = e.view;
|
|
@@ -2189,11 +2191,11 @@ function ic(e, t) {
|
|
|
2189
2191
|
const { doc: n } = t.view.state, r = nr({ editor: t, x: e.clientX, y: e.clientY, direction: "right" });
|
|
2190
2192
|
if (!r.resultNode || r.pos === null) return [];
|
|
2191
2193
|
const i = e.clientX, o = function(f, u, h) {
|
|
2192
|
-
const m = Number.parseInt(ve(f.dom, "paddingLeft"), 10), g = Number.parseInt(ve(f.dom, "paddingRight"), 10),
|
|
2194
|
+
const m = Number.parseInt(ve(f.dom, "paddingLeft"), 10), g = Number.parseInt(ve(f.dom, "paddingRight"), 10), y = Number.parseInt(ve(f.dom, "borderLeftWidth"), 10), x = Number.parseInt(ve(f.dom, "borderLeftWidth"), 10), A = f.dom.getBoundingClientRect();
|
|
2193
2195
|
return {
|
|
2194
2196
|
left: rc(
|
|
2195
2197
|
u,
|
|
2196
|
-
A.left + m +
|
|
2198
|
+
A.left + m + y,
|
|
2197
2199
|
A.right - g - x
|
|
2198
2200
|
),
|
|
2199
2201
|
top: h
|
|
@@ -2236,11 +2238,11 @@ function oc({
|
|
|
2236
2238
|
return t.addEventListener("dragstart", (f) => {
|
|
2237
2239
|
const { view: u } = n;
|
|
2238
2240
|
if (!f.dataTransfer) return;
|
|
2239
|
-
const { empty: h, $from: m, $to: g } = u.state.selection,
|
|
2241
|
+
const { empty: h, $from: m, $to: g } = u.state.selection, y = ic(f, n), x = st(m, g, 0), A = x.some((M) => y.find((k) => k.$from === M.$from && k.$to === M.$to)), _ = h || !A ? y : x;
|
|
2240
2242
|
if (_.length === 0) return;
|
|
2241
|
-
const { tr: E } = u.state, b = document.createElement("div"),
|
|
2242
|
-
_.forEach((
|
|
2243
|
-
const k = nc(u.nodeDOM(
|
|
2243
|
+
const { tr: E } = u.state, b = document.createElement("div"), v = _[0].$from.pos, T = _[_.length - 1].$to.pos, w = H.create(u.state.doc, v, T), P = w.content();
|
|
2244
|
+
_.forEach((M) => {
|
|
2245
|
+
const k = nc(u.nodeDOM(M.$from.pos));
|
|
2244
2246
|
b.append(k);
|
|
2245
2247
|
}), b.style.position = "absolute", b.style.top = "-10000px", document.body.append(b), f.dataTransfer.clearData(), f.dataTransfer.setDragImage(b, 0, 0), u.dragging = { slice: P, move: !0 }, E.setSelection(w), u.dispatch(E), document.addEventListener("drop", () => nn(b), { once: !0 }), setTimeout(() => {
|
|
2246
2248
|
t && (t.style.pointerEvents = "none");
|
|
@@ -2267,8 +2269,8 @@ function oc({
|
|
|
2267
2269
|
...m(),
|
|
2268
2270
|
...r
|
|
2269
2271
|
}), {
|
|
2270
|
-
update(b,
|
|
2271
|
-
if (!g(t, s) || (t.draggable = !c, !
|
|
2272
|
+
update(b, v) {
|
|
2273
|
+
if (!g(t, s) || (t.draggable = !c, !y(b, v)))
|
|
2272
2274
|
return;
|
|
2273
2275
|
const T = x(b);
|
|
2274
2276
|
T && A(b, T);
|
|
@@ -2281,8 +2283,8 @@ function oc({
|
|
|
2281
2283
|
t.draggable = !0, t.style.pointerEvents = "auto";
|
|
2282
2284
|
}
|
|
2283
2285
|
function h(b) {
|
|
2284
|
-
var
|
|
2285
|
-
(
|
|
2286
|
+
var v;
|
|
2287
|
+
(v = b.parentElement) == null || v.appendChild(o), o.appendChild(t), Object.assign(o.style, {
|
|
2286
2288
|
pointerEvents: "none",
|
|
2287
2289
|
position: "absolute",
|
|
2288
2290
|
top: "0",
|
|
@@ -2314,18 +2316,18 @@ function oc({
|
|
|
2314
2316
|
}
|
|
2315
2317
|
};
|
|
2316
2318
|
}
|
|
2317
|
-
function g(b,
|
|
2318
|
-
return b &&
|
|
2319
|
+
function g(b, v) {
|
|
2320
|
+
return b && v;
|
|
2319
2321
|
}
|
|
2320
|
-
function
|
|
2321
|
-
return !b.state.doc.eq(
|
|
2322
|
+
function y(b, v) {
|
|
2323
|
+
return !b.state.doc.eq(v.doc) && d !== -1;
|
|
2322
2324
|
}
|
|
2323
2325
|
function x(b) {
|
|
2324
|
-
let
|
|
2325
|
-
return
|
|
2326
|
+
let v = b.nodeDOM(d);
|
|
2327
|
+
return v = an(b, v), v === b.dom || (v == null ? void 0 : v.nodeType) !== 1 ? null : v;
|
|
2326
2328
|
}
|
|
2327
|
-
function A(b,
|
|
2328
|
-
const T = b.posAtDOM(
|
|
2329
|
+
function A(b, v) {
|
|
2330
|
+
const T = b.posAtDOM(v, 0), w = on(n.state.doc, T);
|
|
2329
2331
|
if (w === l)
|
|
2330
2332
|
return;
|
|
2331
2333
|
const P = rn(n.state.doc, T);
|
|
@@ -2333,7 +2335,7 @@ function oc({
|
|
|
2333
2335
|
editor: n,
|
|
2334
2336
|
node: l,
|
|
2335
2337
|
pos: d
|
|
2336
|
-
}), _(
|
|
2338
|
+
}), _(v);
|
|
2337
2339
|
}
|
|
2338
2340
|
function _(b) {
|
|
2339
2341
|
s.setProps({
|
|
@@ -2349,8 +2351,8 @@ function oc({
|
|
|
2349
2351
|
mouseleave: (f, u) => {
|
|
2350
2352
|
if (c || !h(u)) return !1;
|
|
2351
2353
|
return m(), g(), !1;
|
|
2352
|
-
function h(
|
|
2353
|
-
return
|
|
2354
|
+
function h(y) {
|
|
2355
|
+
return y.target && !o.contains(y.relatedTarget);
|
|
2354
2356
|
}
|
|
2355
2357
|
function m() {
|
|
2356
2358
|
s == null || s.hide();
|
|
@@ -2377,11 +2379,11 @@ function oc({
|
|
|
2377
2379
|
const m = an(f, h.resultElement);
|
|
2378
2380
|
if (m === f.dom || (m == null ? void 0 : m.nodeType) !== 1)
|
|
2379
2381
|
return !1;
|
|
2380
|
-
const g = f.posAtDOM(m, 0),
|
|
2381
|
-
if (
|
|
2382
|
+
const g = f.posAtDOM(m, 0), y = on(n.state.doc, g);
|
|
2383
|
+
if (y === l)
|
|
2382
2384
|
return !1;
|
|
2383
2385
|
const x = rn(n.state.doc, g);
|
|
2384
|
-
return l =
|
|
2386
|
+
return l = y, d = x, i == null || i({
|
|
2385
2387
|
editor: n,
|
|
2386
2388
|
node: l,
|
|
2387
2389
|
pos: d
|
|
@@ -2394,7 +2396,7 @@ function oc({
|
|
|
2394
2396
|
});
|
|
2395
2397
|
}
|
|
2396
2398
|
function ac(e) {
|
|
2397
|
-
var P,
|
|
2399
|
+
var P, M, k;
|
|
2398
2400
|
const { pluginKey: t = rr } = e, { t: n } = D(), [r, i] = I(null), [o, s] = I(-1), c = ne(null), l = ne(null), [d, f] = I(!1), u = e.editor.extensionManager.extensions.some((S) => S.name === "textAlign"), h = e.editor.extensionManager.extensions.some((S) => S.name === "indent"), m = e.editor.extensionManager.extensions.some((S) => S.name === "clear");
|
|
2399
2401
|
R(() => {
|
|
2400
2402
|
c.current && !e.editor.isDestroyed && (l.current = oc({
|
|
@@ -2406,14 +2408,14 @@ function ac(e) {
|
|
|
2406
2408
|
zIndex: 99,
|
|
2407
2409
|
moveTransition: "transform 0.15s ease-out"
|
|
2408
2410
|
},
|
|
2409
|
-
onNodeChange:
|
|
2411
|
+
onNodeChange: v
|
|
2410
2412
|
}), e.editor.registerPlugin(l.current));
|
|
2411
2413
|
}, [e.editor, c]);
|
|
2412
2414
|
function g() {
|
|
2413
2415
|
const S = e.editor.chain();
|
|
2414
2416
|
S.setNodeSelection(o).unsetAllMarks(), (r == null ? void 0 : r.type.name) !== "paragraph" && S.setParagraph(), S.run();
|
|
2415
2417
|
}
|
|
2416
|
-
function
|
|
2418
|
+
function y() {
|
|
2417
2419
|
e.editor.chain().focus().setNodeSelection(o).run(), document.execCommand("copy");
|
|
2418
2420
|
}
|
|
2419
2421
|
function x() {
|
|
@@ -2435,7 +2437,7 @@ function ac(e) {
|
|
|
2435
2437
|
function b() {
|
|
2436
2438
|
e.editor.chain().setMeta("hideDragHandle", !0).setNodeSelection(o).deleteSelection().run();
|
|
2437
2439
|
}
|
|
2438
|
-
function
|
|
2440
|
+
function v(S) {
|
|
2439
2441
|
S.node && i(S.node), s(S.pos);
|
|
2440
2442
|
}
|
|
2441
2443
|
function T() {
|
|
@@ -2521,9 +2523,9 @@ function ac(e) {
|
|
|
2521
2523
|
)
|
|
2522
2524
|
}
|
|
2523
2525
|
),
|
|
2524
|
-
/* @__PURE__ */ a(
|
|
2526
|
+
/* @__PURE__ */ a(Br, { children: n("editor.draghandle.tooltip") })
|
|
2525
2527
|
] }),
|
|
2526
|
-
/* @__PURE__ */ a(
|
|
2528
|
+
/* @__PURE__ */ a(Mr, { className: "absolute left-0 top-0 z-0 size-[28px]" })
|
|
2527
2529
|
] }),
|
|
2528
2530
|
/* @__PURE__ */ p(
|
|
2529
2531
|
kr,
|
|
@@ -2559,7 +2561,7 @@ function ac(e) {
|
|
|
2559
2561
|
W,
|
|
2560
2562
|
{
|
|
2561
2563
|
className: "flex gap-3",
|
|
2562
|
-
onClick:
|
|
2564
|
+
onClick: y,
|
|
2563
2565
|
children: [
|
|
2564
2566
|
/* @__PURE__ */ a(z, { name: "Clipboard" }),
|
|
2565
2567
|
/* @__PURE__ */ a("span", { children: n("editor.copyToClipboard") })
|
|
@@ -2629,7 +2631,7 @@ function ac(e) {
|
|
|
2629
2631
|
W,
|
|
2630
2632
|
{
|
|
2631
2633
|
className: "flex gap-3",
|
|
2632
|
-
disabled: ((
|
|
2634
|
+
disabled: ((M = r == null ? void 0 : r.attrs) == null ? void 0 : M.indent) >= At.max,
|
|
2633
2635
|
onClick: _,
|
|
2634
2636
|
children: [
|
|
2635
2637
|
/* @__PURE__ */ a(z, { name: "IndentIncrease" }),
|
|
@@ -2682,12 +2684,12 @@ function lc(e) {
|
|
|
2682
2684
|
const { t, lang: n } = D(), r = ({ editor: o }) => {
|
|
2683
2685
|
const { selection: s } = o.view.state, { $from: c, to: l } = s;
|
|
2684
2686
|
return c.pos === l ? !1 : s instanceof pn;
|
|
2685
|
-
}, i = F(() => e.disabled || !(e != null && e.editor) ? [] : tr(e.editor, t, e.items), [e.disabled, e.editor, e.items, n, t]);
|
|
2687
|
+
}, i = F(() => e.disabled || !(e != null && e.editor) ? [] : tr(e.editor, t, e.items).filter((o) => e.filterItem ? e.filterItem(o, e.editor) : !0), [e.disabled, e.editor, e.items, e.filterItem, n, t]);
|
|
2686
2688
|
return /* @__PURE__ */ a(
|
|
2687
2689
|
L,
|
|
2688
2690
|
{
|
|
2689
2691
|
editor: e == null ? void 0 : e.editor,
|
|
2690
|
-
shouldShow: r,
|
|
2692
|
+
shouldShow: e.showShow ?? r,
|
|
2691
2693
|
tippyOptions: sc,
|
|
2692
2694
|
children: i != null && i.length ? /* @__PURE__ */ a("div", { className: "pointer-events-auto w-auto select-none rounded-sm !border border-neutral-200 bg-background px-3 py-2 shadow-sm transition-all dark:border-neutral-800", children: /* @__PURE__ */ a("div", { className: "relative flex h-[26px] flex-nowrap items-center justify-start gap-[4px] whitespace-nowrap", children: i == null ? void 0 : i.map((o, s) => (o == null ? void 0 : o.type) === "divider" ? /* @__PURE__ */ a(
|
|
2693
2695
|
U,
|
|
@@ -2720,7 +2722,7 @@ function ct({ children: e, vertical: t }) {
|
|
|
2720
2722
|
function cc({ editor: e, disabled: t }) {
|
|
2721
2723
|
var c, l, d, f, u, h;
|
|
2722
2724
|
const { t: n } = D(), r = O(
|
|
2723
|
-
({ view: m, state: g, from:
|
|
2725
|
+
({ view: m, state: g, from: y }) => !g || !y ? !1 : vn({ editor: e, view: m, state: g, from: y }),
|
|
2724
2726
|
[e]
|
|
2725
2727
|
);
|
|
2726
2728
|
function i() {
|
|
@@ -2790,7 +2792,7 @@ function cc({ editor: e, disabled: t }) {
|
|
|
2790
2792
|
function dc({ editor: e, disabled: t }) {
|
|
2791
2793
|
var c, l, d, f, u, h;
|
|
2792
2794
|
const { t: n } = D(), r = O(
|
|
2793
|
-
({ view: m, state: g, from:
|
|
2795
|
+
({ view: m, state: g, from: y }) => g ? yn({ editor: e, view: m, state: g, from: y || 0 }) : !1,
|
|
2794
2796
|
[e]
|
|
2795
2797
|
);
|
|
2796
2798
|
function i() {
|
|
@@ -2857,11 +2859,11 @@ function dc({ editor: e, disabled: t }) {
|
|
|
2857
2859
|
);
|
|
2858
2860
|
}
|
|
2859
2861
|
function uc({ editor: e, disabled: t, actions: n, ...r }) {
|
|
2860
|
-
var
|
|
2861
|
-
const i = ({ editor:
|
|
2862
|
-
const { selection:
|
|
2863
|
-
return k.pos === S || !w || !P ? !1 :
|
|
2864
|
-
}, o = ({ editor:
|
|
2862
|
+
var y, x, A, _, E, b;
|
|
2863
|
+
const i = ({ editor: v, view: T, state: w, from: P }) => {
|
|
2864
|
+
const { selection: M } = v.view.state, { $from: k, to: S } = M;
|
|
2865
|
+
return k.pos === S || !w || !P ? !1 : M instanceof pn || vn({ editor: v, view: T, state: w, from: P }) || yn({ editor: v, view: T, state: w, from: P });
|
|
2866
|
+
}, o = ({ editor: v }) => Fr(v.view.state, "table"), s = (v) => o(v) && !i(v), { t: c, lang: l } = D();
|
|
2865
2867
|
function d() {
|
|
2866
2868
|
e.chain().focus().mergeCells().run();
|
|
2867
2869
|
}
|
|
@@ -2871,17 +2873,17 @@ function uc({ editor: e, disabled: t, actions: n, ...r }) {
|
|
|
2871
2873
|
function u() {
|
|
2872
2874
|
e.chain().focus().deleteTable().run();
|
|
2873
2875
|
}
|
|
2874
|
-
function h(
|
|
2875
|
-
e.chain().focus().setTableCellBackground(
|
|
2876
|
+
function h(v) {
|
|
2877
|
+
e.chain().focus().setTableCellBackground(v).run();
|
|
2876
2878
|
}
|
|
2877
2879
|
const m = () => {
|
|
2878
2880
|
var k;
|
|
2879
2881
|
const {
|
|
2880
|
-
view:
|
|
2882
|
+
view: v,
|
|
2881
2883
|
state: {
|
|
2882
2884
|
selection: { from: T }
|
|
2883
2885
|
}
|
|
2884
|
-
} = e, w =
|
|
2886
|
+
} = e, w = v.domAtPos(T).node;
|
|
2885
2887
|
if (!w)
|
|
2886
2888
|
return new DOMRect(-1e3, -1e3, 0, 0);
|
|
2887
2889
|
const P = (k = w == null ? void 0 : w.closest) == null ? void 0 : k.call(w, ".tableWrapper");
|
|
@@ -2906,7 +2908,7 @@ function uc({ editor: e, disabled: t, actions: n, ...r }) {
|
|
|
2906
2908
|
},
|
|
2907
2909
|
children: /* @__PURE__ */ p(ct, { children: [
|
|
2908
2910
|
n && /* @__PURE__ */ p(N, { children: [
|
|
2909
|
-
n.map((
|
|
2911
|
+
n.map((v, T) => /* @__PURE__ */ a(C, { ...v }, T)),
|
|
2910
2912
|
/* @__PURE__ */ a(
|
|
2911
2913
|
U,
|
|
2912
2914
|
{
|
|
@@ -2916,12 +2918,12 @@ function uc({ editor: e, disabled: t, actions: n, ...r }) {
|
|
|
2916
2918
|
)
|
|
2917
2919
|
] }),
|
|
2918
2920
|
r.items && /* @__PURE__ */ p(N, { children: [
|
|
2919
|
-
g.map((
|
|
2921
|
+
g.map((v, T) => /* @__PURE__ */ a(
|
|
2920
2922
|
ir,
|
|
2921
2923
|
{
|
|
2922
2924
|
disabled: t,
|
|
2923
2925
|
editor: e,
|
|
2924
|
-
item:
|
|
2926
|
+
item: v
|
|
2925
2927
|
},
|
|
2926
2928
|
T
|
|
2927
2929
|
)),
|
|
@@ -2937,7 +2939,7 @@ function uc({ editor: e, disabled: t, actions: n, ...r }) {
|
|
|
2937
2939
|
C,
|
|
2938
2940
|
{
|
|
2939
2941
|
action: d,
|
|
2940
|
-
disabled: !((x = (
|
|
2942
|
+
disabled: !((x = (y = e == null ? void 0 : e.can()) == null ? void 0 : y.mergeCells) != null && x.call(y)),
|
|
2941
2943
|
icon: "TableCellsMerge",
|
|
2942
2944
|
tooltip: c("editor.table.menu.mergeCells"),
|
|
2943
2945
|
"tooltip-options": {
|
|
@@ -3529,7 +3531,7 @@ function Ic(e, t) {
|
|
|
3529
3531
|
const { content: n, extensions: r, useEditorOptions: i = {} } = e, o = mr(), s = F(() => {
|
|
3530
3532
|
const u = nl(r, r, "name");
|
|
3531
3533
|
return [...r.map((m) => {
|
|
3532
|
-
const g = r.find((
|
|
3534
|
+
const g = r.find((y) => y.name === m.name);
|
|
3533
3535
|
return g ? m.configure(g.options) : m;
|
|
3534
3536
|
}), ...u].map((m, g) => m.configure({ sort: g }));
|
|
3535
3537
|
}, [r]), c = Xr((u) => {
|
|
@@ -3614,6 +3616,7 @@ function Ic(e, t) {
|
|
|
3614
3616
|
}
|
|
3615
3617
|
const Wc = hr(Ic);
|
|
3616
3618
|
export {
|
|
3619
|
+
C as ActionButton,
|
|
3617
3620
|
L as BubbleMenu,
|
|
3618
3621
|
Wc as default,
|
|
3619
3622
|
Gc as useEditorState
|