@cyte-editor/react 1.0.1 → 1.0.3
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/dist/cyte-editor-react.cjs +4 -4
- package/dist/cyte-editor-react.js +339 -336
- package/package.json +13 -6
|
@@ -4,14 +4,14 @@ import { EditorManager as Tn, I18nManager as Ve, toolbarItemDefs as _t, uploadFi
|
|
|
4
4
|
import { getLicenseStatus as In } from "@cyte-editor/license";
|
|
5
5
|
import { createPortal as tt } from "react-dom";
|
|
6
6
|
/*!
|
|
7
|
-
* CyteEditor React Adapter v1.0.
|
|
7
|
+
* CyteEditor React Adapter v1.0.3 (@cyte-editor/react)
|
|
8
8
|
* (c) 2026 CyteEditor — All Rights Reserved.
|
|
9
9
|
*
|
|
10
10
|
* Commercial Software — NOT Open Source.
|
|
11
11
|
* Licensed under the CyteEditor Commercial License.
|
|
12
12
|
* SEE LICENSE IN ./LICENSE | Full EULA: https://cyteeditor.com/eula
|
|
13
13
|
*
|
|
14
|
-
* Build:
|
|
14
|
+
* Build: 712a52f-dirty @ 2026-08-15T07:59:15.348Z
|
|
15
15
|
* Homepage: https://cyteeditor.com
|
|
16
16
|
* Contact: legal@cyteeditor.com (legal) / support@cyteeditor.com (support)
|
|
17
17
|
*
|
|
@@ -512,8 +512,8 @@ class xe {
|
|
|
512
512
|
let T = d ? e == a ? -1 : e == b ? 1 : t : t, m = a + o + (T < 0 ? 0 : p);
|
|
513
513
|
if (r)
|
|
514
514
|
return m;
|
|
515
|
-
let k = e == (t < 0 ? a : b) ? null : On(l / 3, e - a),
|
|
516
|
-
return (t < 0 ? e != a : e != b) && (
|
|
515
|
+
let k = e == (t < 0 ? a : b) ? null : On(l / 3, e - a), w = e == a ? gn : e == b ? mn : gt;
|
|
516
|
+
return (t < 0 ? e != a : e != b) && (w |= wn), new Gt(m, w, k);
|
|
517
517
|
}
|
|
518
518
|
o += p - d;
|
|
519
519
|
}
|
|
@@ -1698,7 +1698,7 @@ function jn(n) {
|
|
|
1698
1698
|
for (let k = 0; ; k++) {
|
|
1699
1699
|
for (; o < r.length && r[o] != 0; ) o++;
|
|
1700
1700
|
if (k == b.childCount) break;
|
|
1701
|
-
const
|
|
1701
|
+
const w = b.child(k), { colspan: S, rowspan: u, colwidth: h } = w.attrs;
|
|
1702
1702
|
for (let x = 0; x < u; x++) {
|
|
1703
1703
|
if (x + d >= t) {
|
|
1704
1704
|
(s || (s = [])).push({
|
|
@@ -1708,22 +1708,22 @@ function jn(n) {
|
|
|
1708
1708
|
});
|
|
1709
1709
|
break;
|
|
1710
1710
|
}
|
|
1711
|
-
const
|
|
1711
|
+
const y = o + x * e;
|
|
1712
1712
|
for (let f = 0; f < S; f++) {
|
|
1713
|
-
r[
|
|
1713
|
+
r[y + f] == 0 ? r[y + f] = p : (s || (s = [])).push({
|
|
1714
1714
|
type: "collision",
|
|
1715
1715
|
row: d,
|
|
1716
1716
|
pos: p,
|
|
1717
1717
|
n: S - f
|
|
1718
1718
|
});
|
|
1719
|
-
const
|
|
1720
|
-
if (
|
|
1721
|
-
const $ = (
|
|
1722
|
-
P == null || P !=
|
|
1719
|
+
const C = h && h[f];
|
|
1720
|
+
if (C) {
|
|
1721
|
+
const $ = (y + f) % e * 2, P = i[$];
|
|
1722
|
+
P == null || P != C && i[$ + 1] == 1 ? (i[$] = C, i[$ + 1] = 1) : P == C && i[$ + 1]++;
|
|
1723
1723
|
}
|
|
1724
1724
|
}
|
|
1725
1725
|
}
|
|
1726
|
-
o += S, p +=
|
|
1726
|
+
o += S, p += w.nodeSize;
|
|
1727
1727
|
}
|
|
1728
1728
|
const T = (d + 1) * e;
|
|
1729
1729
|
let m = 0;
|
|
@@ -1875,10 +1875,10 @@ var Ie = class Ee extends ee {
|
|
|
1875
1875
|
const m = t.findCell(T);
|
|
1876
1876
|
let k = e.nodeAt(T);
|
|
1877
1877
|
if (!k) throw new RangeError(`No cell with offset ${T} found`);
|
|
1878
|
-
const
|
|
1879
|
-
if (
|
|
1878
|
+
const w = o.left - m.left, S = m.right - o.right;
|
|
1879
|
+
if (w > 0 || S > 0) {
|
|
1880
1880
|
let u = k.attrs;
|
|
1881
|
-
if (
|
|
1881
|
+
if (w > 0 && (u = nn(u, 0, w)), S > 0 && (u = nn(u, u.colspan - S, S)), m.left < o.left) {
|
|
1882
1882
|
if (k = k.type.createAndFill(u), !k) throw new RangeError(`Could not create cell with attrs ${JSON.stringify(u)}`);
|
|
1883
1883
|
} else k = k.type.create(u, k.content);
|
|
1884
1884
|
}
|
|
@@ -2114,7 +2114,7 @@ function nr(n) {
|
|
|
2114
2114
|
var m, k;
|
|
2115
2115
|
const e = H(null), t = H(null), [r, o] = D(!1), [s, i] = D(!1), [l, a] = D(!0), d = H(!1), p = H(n);
|
|
2116
2116
|
p.current = n;
|
|
2117
|
-
const b = E((
|
|
2117
|
+
const b = E((w, S) => {
|
|
2118
2118
|
if (!(d.current || !t.current)) {
|
|
2119
2119
|
if (S !== void 0) {
|
|
2120
2120
|
const u = JSON.stringify(t.current.getJSON()), h = JSON.stringify(S);
|
|
@@ -2122,42 +2122,42 @@ function nr(n) {
|
|
|
2122
2122
|
t.current.setJSON(S);
|
|
2123
2123
|
return;
|
|
2124
2124
|
}
|
|
2125
|
-
if (
|
|
2126
|
-
if (
|
|
2127
|
-
t.current.setContent(
|
|
2125
|
+
if (w !== void 0) {
|
|
2126
|
+
if (w === t.current.getHTML()) return;
|
|
2127
|
+
t.current.setContent(w);
|
|
2128
2128
|
}
|
|
2129
2129
|
}
|
|
2130
2130
|
}, []);
|
|
2131
2131
|
_(() => {
|
|
2132
2132
|
var u, h;
|
|
2133
|
-
const
|
|
2134
|
-
if (!
|
|
2135
|
-
const S = Tn.create(
|
|
2133
|
+
const w = e.current;
|
|
2134
|
+
if (!w) return;
|
|
2135
|
+
const S = Tn.create(w, p.current.config);
|
|
2136
2136
|
return t.current = S, a(S.isEmpty()), S.on("update", ({ html: x }) => {
|
|
2137
|
-
var
|
|
2138
|
-
a(S.isEmpty()), d.current = !0, (f = (
|
|
2137
|
+
var y, f;
|
|
2138
|
+
a(S.isEmpty()), d.current = !0, (f = (y = p.current).onUpdate) == null || f.call(y, x, S.getJSON()), Promise.resolve().then(() => {
|
|
2139
2139
|
d.current = !1;
|
|
2140
2140
|
});
|
|
2141
2141
|
}), S.on("focus", ({ event: x }) => {
|
|
2142
|
-
var
|
|
2143
|
-
i(!0), (f = (
|
|
2142
|
+
var y, f;
|
|
2143
|
+
i(!0), (f = (y = p.current).onFocus) == null || f.call(y, x);
|
|
2144
2144
|
}), S.on("blur", ({ event: x }) => {
|
|
2145
|
-
var
|
|
2146
|
-
i(!1), (f = (
|
|
2145
|
+
var y, f;
|
|
2146
|
+
i(!1), (f = (y = p.current).onBlur) == null || f.call(y, x);
|
|
2147
2147
|
}), o(!0), (h = (u = p.current).onReady) == null || h.call(u, S), () => {
|
|
2148
2148
|
S.destroy(), t.current = null, o(!1);
|
|
2149
2149
|
};
|
|
2150
2150
|
}, []), _(() => {
|
|
2151
|
-
const
|
|
2152
|
-
|
|
2151
|
+
const w = t.current;
|
|
2152
|
+
w && n.config.readonly !== void 0 && w.setReadonly(n.config.readonly);
|
|
2153
2153
|
}, [n.config.readonly, n.config.disabled]), _(() => {
|
|
2154
2154
|
n.config.locale && Ve.getInstance().setLocale(n.config.locale);
|
|
2155
2155
|
}, [n.config.locale]);
|
|
2156
2156
|
const T = H((m = n.config.license) == null ? void 0 : m.key);
|
|
2157
2157
|
return _(() => {
|
|
2158
2158
|
var S;
|
|
2159
|
-
const
|
|
2160
|
-
|
|
2159
|
+
const w = (S = n.config.license) == null ? void 0 : S.key;
|
|
2160
|
+
w !== T.current && (T.current = w, w && t.current && t.current.updateLicense(n.config.license));
|
|
2161
2161
|
}, [(k = n.config.license) == null ? void 0 : k.key]), {
|
|
2162
2162
|
manager: t.current,
|
|
2163
2163
|
isReady: r,
|
|
@@ -2258,10 +2258,10 @@ const sr = ({
|
|
|
2258
2258
|
onCancel: l,
|
|
2259
2259
|
onClose: a
|
|
2260
2260
|
}) => {
|
|
2261
|
-
const { t: d } = be(), [p, b] = D(o || ""), [T, m] = D(!1), k = H(null), [
|
|
2261
|
+
const { t: d } = be(), [p, b] = D(o || ""), [T, m] = D(!1), k = H(null), [w, S] = D(null), [u, h] = D(""), x = () => {
|
|
2262
2262
|
if (t && r)
|
|
2263
2263
|
try {
|
|
2264
|
-
const { from:
|
|
2264
|
+
const { from: N, to: A } = r, O = t.view.coordsAtPos(N), z = t.view.coordsAtPos(A);
|
|
2265
2265
|
if (O && z) {
|
|
2266
2266
|
S(new DOMRect(O.left, O.top, z.left - O.left, O.bottom - O.top));
|
|
2267
2267
|
return;
|
|
@@ -2271,49 +2271,49 @@ const sr = ({
|
|
|
2271
2271
|
S(e || null);
|
|
2272
2272
|
};
|
|
2273
2273
|
_(() => {
|
|
2274
|
-
const
|
|
2274
|
+
const N = () => {
|
|
2275
2275
|
n && x();
|
|
2276
2276
|
};
|
|
2277
|
-
return window.addEventListener("scroll",
|
|
2278
|
-
window.removeEventListener("scroll",
|
|
2277
|
+
return window.addEventListener("scroll", N, !0), window.addEventListener("resize", N), () => {
|
|
2278
|
+
window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N);
|
|
2279
2279
|
};
|
|
2280
2280
|
}, [n, t, r, e]), _(() => {
|
|
2281
2281
|
n && (b(o || ""), h(""), x(), setTimeout(() => {
|
|
2282
|
-
var
|
|
2283
|
-
(
|
|
2282
|
+
var N, A;
|
|
2283
|
+
(N = k.current) == null || N.focus(), (A = k.current) == null || A.select();
|
|
2284
2284
|
}, 0));
|
|
2285
2285
|
}, [n]);
|
|
2286
|
-
const
|
|
2287
|
-
const
|
|
2288
|
-
if (!
|
|
2286
|
+
const y = _e(() => {
|
|
2287
|
+
const N = w;
|
|
2288
|
+
if (!N) return {};
|
|
2289
2289
|
const A = 180, O = 8, z = window.innerHeight, G = window.innerWidth;
|
|
2290
|
-
let J =
|
|
2291
|
-
J + A > z && (J =
|
|
2292
|
-
let W =
|
|
2290
|
+
let J = N.bottom + O, K = !1;
|
|
2291
|
+
J + A > z && (J = N.top - A - O, K = !0), m(K);
|
|
2292
|
+
let W = N.left + N.width / 2;
|
|
2293
2293
|
const B = 320;
|
|
2294
2294
|
return W + B / 2 > G && (W = G - B / 2 - 16), W < B / 2 + 16 && (W = B / 2 + 16), { top: `${J}px`, left: `${W}px` };
|
|
2295
|
-
}, [
|
|
2295
|
+
}, [w]), f = (N) => {
|
|
2296
2296
|
try {
|
|
2297
|
-
const A = new URL(
|
|
2297
|
+
const A = new URL(N);
|
|
2298
2298
|
return A.protocol === "http:" || A.protocol === "https:";
|
|
2299
2299
|
} catch {
|
|
2300
2300
|
return !1;
|
|
2301
2301
|
}
|
|
2302
|
-
},
|
|
2303
|
-
const
|
|
2304
|
-
if (s &&
|
|
2302
|
+
}, C = () => {
|
|
2303
|
+
const N = p.trim();
|
|
2304
|
+
if (s && N === "") {
|
|
2305
2305
|
i(""), a();
|
|
2306
2306
|
return;
|
|
2307
2307
|
}
|
|
2308
|
-
if (!
|
|
2308
|
+
if (!N) {
|
|
2309
2309
|
h(d("link.urlRequired"));
|
|
2310
2310
|
return;
|
|
2311
2311
|
}
|
|
2312
|
-
if (!f(
|
|
2312
|
+
if (!f(N)) {
|
|
2313
2313
|
h(d("link.invalidUrl"));
|
|
2314
2314
|
return;
|
|
2315
2315
|
}
|
|
2316
|
-
i(
|
|
2316
|
+
i(N), a();
|
|
2317
2317
|
}, $ = () => {
|
|
2318
2318
|
i(""), a();
|
|
2319
2319
|
}, P = () => {
|
|
@@ -2323,17 +2323,17 @@ const sr = ({
|
|
|
2323
2323
|
"div",
|
|
2324
2324
|
{
|
|
2325
2325
|
style: { position: "fixed", top: 0, left: 0, right: 0, bottom: 0, zIndex: 9998, background: "transparent" },
|
|
2326
|
-
onMouseDown: (
|
|
2327
|
-
|
|
2326
|
+
onMouseDown: (N) => {
|
|
2327
|
+
N.target === N.currentTarget && P();
|
|
2328
2328
|
},
|
|
2329
2329
|
children: /* @__PURE__ */ v(
|
|
2330
2330
|
"div",
|
|
2331
2331
|
{
|
|
2332
2332
|
className: `tp-link-popover${T ? " is-above" : ""}`,
|
|
2333
|
-
style:
|
|
2334
|
-
onMouseDown: (
|
|
2335
|
-
onKeyDown: (
|
|
2336
|
-
|
|
2333
|
+
style: y,
|
|
2334
|
+
onMouseDown: (N) => N.stopPropagation(),
|
|
2335
|
+
onKeyDown: (N) => {
|
|
2336
|
+
N.key === "Enter" ? (N.preventDefault(), C()) : N.key === "Escape" && (N.preventDefault(), P());
|
|
2337
2337
|
},
|
|
2338
2338
|
children: [
|
|
2339
2339
|
/* @__PURE__ */ c("div", { className: "tp-popover-arrow" }),
|
|
@@ -2350,13 +2350,13 @@ const sr = ({
|
|
|
2350
2350
|
className: `tp-popover-input${u ? " is-error" : ""}`,
|
|
2351
2351
|
value: p,
|
|
2352
2352
|
placeholder: d("link.url"),
|
|
2353
|
-
onChange: (
|
|
2354
|
-
onKeyDown: (
|
|
2355
|
-
|
|
2353
|
+
onChange: (N) => b(N.target.value),
|
|
2354
|
+
onKeyDown: (N) => {
|
|
2355
|
+
N.key === "Enter" ? (N.preventDefault(), C()) : N.key === "Escape" && (N.preventDefault(), P());
|
|
2356
2356
|
}
|
|
2357
2357
|
}
|
|
2358
2358
|
),
|
|
2359
|
-
/* @__PURE__ */ c("button", { className: "tp-popover-btn-confirm", onClick:
|
|
2359
|
+
/* @__PURE__ */ c("button", { className: "tp-popover-btn-confirm", onClick: C, children: d("common.confirm") }),
|
|
2360
2360
|
s && /* @__PURE__ */ c("button", { className: "tp-popover-btn-unlink", onClick: $, children: d("link.unlink") })
|
|
2361
2361
|
] }),
|
|
2362
2362
|
u && /* @__PURE__ */ c("div", { className: "tp-link-error-message", children: u })
|
|
@@ -2371,10 +2371,10 @@ const sr = ({
|
|
|
2371
2371
|
const { t: s } = be(), [i, l] = D(!1), a = H(null), d = H(null), p = H(""), b = H(!1), T = (u) => {
|
|
2372
2372
|
var h;
|
|
2373
2373
|
if (u.preventDefault(), n.name === "link") {
|
|
2374
|
-
const { from: x, to:
|
|
2375
|
-
if (x !==
|
|
2376
|
-
if (a.current = { from: x, to:
|
|
2377
|
-
const f = e.state.selection.$head.marks().find((
|
|
2374
|
+
const { from: x, to: y } = e.state.selection;
|
|
2375
|
+
if (x !== y || e.isActive("link")) {
|
|
2376
|
+
if (a.current = { from: x, to: y }, e.isActive("link")) {
|
|
2377
|
+
const f = e.state.selection.$head.marks().find((C) => C.type.name === "link");
|
|
2378
2378
|
p.current = ((h = f == null ? void 0 : f.attrs) == null ? void 0 : h.href) || "", b.current = !0;
|
|
2379
2379
|
} else
|
|
2380
2380
|
p.current = "", b.current = !1;
|
|
@@ -2397,13 +2397,13 @@ const sr = ({
|
|
|
2397
2397
|
if (u === "link") {
|
|
2398
2398
|
if (e.isActive("link")) {
|
|
2399
2399
|
if (!a.current) {
|
|
2400
|
-
const { from: f, to:
|
|
2401
|
-
a.current = { from: f, to:
|
|
2400
|
+
const { from: f, to: C } = e.state.selection;
|
|
2401
|
+
a.current = { from: f, to: C };
|
|
2402
2402
|
}
|
|
2403
|
-
const
|
|
2404
|
-
if (p.current = ((h =
|
|
2403
|
+
const y = e.state.selection.$head.marks().find((f) => f.type.name === "link");
|
|
2404
|
+
if (p.current = ((h = y == null ? void 0 : y.attrs) == null ? void 0 : h.href) || "", b.current = !0, !d.current && a.current)
|
|
2405
2405
|
try {
|
|
2406
|
-
const { from: f, to:
|
|
2406
|
+
const { from: f, to: C } = a.current, $ = e.view.coordsAtPos(f), P = e.view.coordsAtPos(C);
|
|
2407
2407
|
$ && P && (d.current = new DOMRect(
|
|
2408
2408
|
$.left,
|
|
2409
2409
|
$.top,
|
|
@@ -2416,24 +2416,24 @@ const sr = ({
|
|
|
2416
2416
|
return;
|
|
2417
2417
|
}
|
|
2418
2418
|
if (!a.current) {
|
|
2419
|
-
const { from:
|
|
2420
|
-
if (
|
|
2421
|
-
a.current = { from:
|
|
2419
|
+
const { from: y, to: f } = e.state.selection;
|
|
2420
|
+
if (y === f) return;
|
|
2421
|
+
a.current = { from: y, to: f };
|
|
2422
2422
|
}
|
|
2423
2423
|
if (p.current = "", b.current = !1, !d.current && a.current)
|
|
2424
2424
|
try {
|
|
2425
|
-
const { from:
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
$.left -
|
|
2430
|
-
|
|
2425
|
+
const { from: y, to: f } = a.current, C = e.view.coordsAtPos(y), $ = e.view.coordsAtPos(f);
|
|
2426
|
+
C && $ && (d.current = new DOMRect(
|
|
2427
|
+
C.left,
|
|
2428
|
+
C.top,
|
|
2429
|
+
$.left - C.left,
|
|
2430
|
+
C.bottom - C.top
|
|
2431
2431
|
));
|
|
2432
2432
|
} catch {
|
|
2433
2433
|
}
|
|
2434
2434
|
if (a.current) {
|
|
2435
|
-
const { from:
|
|
2436
|
-
e.chain().focus().setTextSelection({ from:
|
|
2435
|
+
const { from: y, to: f } = a.current;
|
|
2436
|
+
e.chain().focus().setTextSelection({ from: y, to: f }).setHighlight({ color: ir }).run();
|
|
2437
2437
|
}
|
|
2438
2438
|
l(!0);
|
|
2439
2439
|
return;
|
|
@@ -2441,11 +2441,11 @@ const sr = ({
|
|
|
2441
2441
|
(x = n.command) == null || x.call(n, e);
|
|
2442
2442
|
}, k = (u) => {
|
|
2443
2443
|
if (a.current) {
|
|
2444
|
-
const { from: h, to: x } = a.current,
|
|
2445
|
-
u ?
|
|
2444
|
+
const { from: h, to: x } = a.current, y = e.chain().focus().setTextSelection({ from: h, to: x }).unsetHighlight();
|
|
2445
|
+
u ? y.setLink({ href: u }).run() : y.unsetLink().run();
|
|
2446
2446
|
}
|
|
2447
2447
|
a.current = null, d.current = null, p.current = "", b.current = !1;
|
|
2448
|
-
},
|
|
2448
|
+
}, w = () => {
|
|
2449
2449
|
if (a.current) {
|
|
2450
2450
|
const { from: u, to: h } = a.current;
|
|
2451
2451
|
e.chain().focus().setTextSelection({ from: u, to: h }).unsetHighlight().run();
|
|
@@ -2474,7 +2474,7 @@ const sr = ({
|
|
|
2474
2474
|
initialUrl: p.current,
|
|
2475
2475
|
isEditing: b.current,
|
|
2476
2476
|
onConfirm: k,
|
|
2477
|
-
onCancel:
|
|
2477
|
+
onCancel: w,
|
|
2478
2478
|
onClose: () => l(!1)
|
|
2479
2479
|
}
|
|
2480
2480
|
)
|
|
@@ -2496,8 +2496,8 @@ const sr = ({
|
|
|
2496
2496
|
}, [a, n, e]), T = (u) => {
|
|
2497
2497
|
const h = String(b), x = String(u);
|
|
2498
2498
|
if (n.name === "fontFamily") {
|
|
2499
|
-
const
|
|
2500
|
-
if (
|
|
2499
|
+
const y = on[h], f = on[x];
|
|
2500
|
+
if (y) return y.includes(x);
|
|
2501
2501
|
if (f) return f.includes(h);
|
|
2502
2502
|
}
|
|
2503
2503
|
return h === x;
|
|
@@ -2506,7 +2506,7 @@ const sr = ({
|
|
|
2506
2506
|
return h === 0 ? "tp-heading-preview-paragraph" : h >= 1 && h <= 6 ? `tp-heading-preview-h${h}` : "";
|
|
2507
2507
|
}, k = () => {
|
|
2508
2508
|
r || (l(!i), i || d((u) => u + 1));
|
|
2509
|
-
},
|
|
2509
|
+
}, w = (u) => {
|
|
2510
2510
|
var h;
|
|
2511
2511
|
n.isActionMenu ? o == null || o(String(u)) : (h = n.command) == null || h.call(n, e, u), l(!1);
|
|
2512
2512
|
};
|
|
@@ -2538,7 +2538,7 @@ const sr = ({
|
|
|
2538
2538
|
{
|
|
2539
2539
|
className: `tp-toolbar-dropdown-item${T(u.value) ? " is-active" : ""}${n.name === "heading" ? " " + m(u.value) : ""}`,
|
|
2540
2540
|
onMouseDown: (h) => h.preventDefault(),
|
|
2541
|
-
onClick: () =>
|
|
2541
|
+
onClick: () => w(u.value),
|
|
2542
2542
|
children: u.labelKey ? s(u.labelKey) : u.label
|
|
2543
2543
|
},
|
|
2544
2544
|
String(u.value)
|
|
@@ -2623,7 +2623,7 @@ const sr = ({
|
|
|
2623
2623
|
const k = (S) => {
|
|
2624
2624
|
var u;
|
|
2625
2625
|
(u = n.command) == null || u.call(n, e, S), setTimeout(m, 0), s(!1);
|
|
2626
|
-
},
|
|
2626
|
+
}, w = () => {
|
|
2627
2627
|
var S;
|
|
2628
2628
|
(S = n.command) == null || S.call(n, e, void 0), p(""), s(!1);
|
|
2629
2629
|
};
|
|
@@ -2652,7 +2652,7 @@ const sr = ({
|
|
|
2652
2652
|
}
|
|
2653
2653
|
),
|
|
2654
2654
|
o && /* @__PURE__ */ v("div", { className: "tp-color-picker-panel", children: [
|
|
2655
|
-
/* @__PURE__ */ c("button", { className: "tp-color-default-btn", onMouseDown: (S) => S.preventDefault(), onClick:
|
|
2655
|
+
/* @__PURE__ */ c("button", { className: "tp-color-default-btn", onMouseDown: (S) => S.preventDefault(), onClick: w, children: r("common.default") }),
|
|
2656
2656
|
/* @__PURE__ */ c("div", { className: "tp-color-grid tp-theme-colors", children: ar.map((S, u) => /* @__PURE__ */ c(
|
|
2657
2657
|
"button",
|
|
2658
2658
|
{
|
|
@@ -2687,42 +2687,42 @@ const sr = ({
|
|
|
2687
2687
|
initialTab: s,
|
|
2688
2688
|
onClose: i
|
|
2689
2689
|
}) => {
|
|
2690
|
-
const { t: l } = be(), [a, d] = D(s || "upload"), [p, b] = D(""), [T, m] = D(!1), [k,
|
|
2690
|
+
const { t: l } = be(), [a, d] = D(s || "upload"), [p, b] = D(""), [T, m] = D(!1), [k, w] = D(!1), [S, u] = D(0), [h, x] = D(""), y = H(null);
|
|
2691
2691
|
_(() => (n ? (b(""), x(""), d(s || "upload"), u(0), document.body.style.overflow = "hidden") : document.body.style.overflow = "", () => {
|
|
2692
2692
|
document.body.style.overflow = "";
|
|
2693
2693
|
}), [n, s]);
|
|
2694
|
-
const f = (
|
|
2694
|
+
const f = (N) => new Promise((A, O) => {
|
|
2695
2695
|
const z = new FileReader();
|
|
2696
|
-
z.onload = () => A(z.result), z.onerror = O, z.readAsDataURL(
|
|
2697
|
-
}),
|
|
2698
|
-
e.chain().focus().setImage({ src:
|
|
2699
|
-
}, $ = async (
|
|
2700
|
-
|
|
2696
|
+
z.onload = () => A(z.result), z.onerror = O, z.readAsDataURL(N);
|
|
2697
|
+
}), C = (N) => {
|
|
2698
|
+
e.chain().focus().setImage({ src: N }).run();
|
|
2699
|
+
}, $ = async (N) => {
|
|
2700
|
+
w(!0), u(0), x("");
|
|
2701
2701
|
try {
|
|
2702
2702
|
let A;
|
|
2703
|
-
o ? A = await o(
|
|
2703
|
+
o ? A = await o(N) : t ? A = await Ln(N, { url: t, headers: r, onProgress: u }) : A = await f(N), C(A), i();
|
|
2704
2704
|
} catch (A) {
|
|
2705
2705
|
x(A instanceof Error ? A.message : l("imageUpload.uploadFailed"));
|
|
2706
2706
|
} finally {
|
|
2707
|
-
|
|
2707
|
+
w(!1), u(0);
|
|
2708
2708
|
}
|
|
2709
2709
|
}, P = () => {
|
|
2710
|
-
const
|
|
2711
|
-
if (!
|
|
2710
|
+
const N = p.trim();
|
|
2711
|
+
if (!N) {
|
|
2712
2712
|
x(l("imageUpload.urlRequired"));
|
|
2713
2713
|
return;
|
|
2714
2714
|
}
|
|
2715
2715
|
try {
|
|
2716
|
-
new URL(
|
|
2716
|
+
new URL(N);
|
|
2717
2717
|
} catch {
|
|
2718
2718
|
x(l("imageUpload.invalidUrl"));
|
|
2719
2719
|
return;
|
|
2720
2720
|
}
|
|
2721
|
-
N
|
|
2721
|
+
C(N), i();
|
|
2722
2722
|
};
|
|
2723
|
-
return n ? /* @__PURE__ */ c("div", { className: "tp-image-upload-overlay", onMouseDown: (
|
|
2724
|
-
|
|
2725
|
-
}, children: /* @__PURE__ */ v("div", { className: "tp-image-upload-dialog", onMouseDown: (
|
|
2723
|
+
return n ? /* @__PURE__ */ c("div", { className: "tp-image-upload-overlay", onMouseDown: (N) => {
|
|
2724
|
+
N.target === N.currentTarget && i();
|
|
2725
|
+
}, children: /* @__PURE__ */ v("div", { className: "tp-image-upload-dialog", onMouseDown: (N) => N.stopPropagation(), children: [
|
|
2726
2726
|
/* @__PURE__ */ v("div", { className: "tp-dialog-header", children: [
|
|
2727
2727
|
/* @__PURE__ */ c("span", { className: "tp-dialog-title", children: l("image.upload") }),
|
|
2728
2728
|
/* @__PURE__ */ c("button", { className: "tp-dialog-close", onClick: i, children: "×" })
|
|
@@ -2737,22 +2737,22 @@ const sr = ({
|
|
|
2737
2737
|
"div",
|
|
2738
2738
|
{
|
|
2739
2739
|
className: `tp-dropzone${T ? " is-dragging" : ""}${k ? " is-uploading" : ""}`,
|
|
2740
|
-
onDragEnter: (
|
|
2741
|
-
|
|
2740
|
+
onDragEnter: (N) => {
|
|
2741
|
+
N.preventDefault(), m(!0);
|
|
2742
2742
|
},
|
|
2743
|
-
onDragLeave: (
|
|
2744
|
-
|
|
2743
|
+
onDragLeave: (N) => {
|
|
2744
|
+
N.preventDefault(), m(!1);
|
|
2745
2745
|
},
|
|
2746
|
-
onDragOver: (
|
|
2747
|
-
onDrop: (
|
|
2746
|
+
onDragOver: (N) => N.preventDefault(),
|
|
2747
|
+
onDrop: (N) => {
|
|
2748
2748
|
var O, z;
|
|
2749
|
-
|
|
2750
|
-
const A = (z = (O =
|
|
2749
|
+
N.preventDefault(), m(!1);
|
|
2750
|
+
const A = (z = (O = N.dataTransfer) == null ? void 0 : O.files) == null ? void 0 : z[0];
|
|
2751
2751
|
A != null && A.type.startsWith("image/") ? $(A) : x(l("imageUpload.invalidType"));
|
|
2752
2752
|
},
|
|
2753
2753
|
onClick: () => {
|
|
2754
|
-
var
|
|
2755
|
-
return (
|
|
2754
|
+
var N;
|
|
2755
|
+
return (N = y.current) == null ? void 0 : N.click();
|
|
2756
2756
|
},
|
|
2757
2757
|
children: k ? /* @__PURE__ */ v("div", { className: "tp-upload-progress", children: [
|
|
2758
2758
|
/* @__PURE__ */ c("div", { className: "tp-progress-bar", children: /* @__PURE__ */ c("div", { className: "tp-progress-fill", style: { width: S + "%" } }) }),
|
|
@@ -2772,14 +2772,14 @@ const sr = ({
|
|
|
2772
2772
|
/* @__PURE__ */ c(
|
|
2773
2773
|
"input",
|
|
2774
2774
|
{
|
|
2775
|
-
ref:
|
|
2775
|
+
ref: y,
|
|
2776
2776
|
type: "file",
|
|
2777
2777
|
accept: "image/*",
|
|
2778
2778
|
style: { display: "none" },
|
|
2779
|
-
onChange: (
|
|
2779
|
+
onChange: (N) => {
|
|
2780
2780
|
var O;
|
|
2781
|
-
const A = (O =
|
|
2782
|
-
A && $(A),
|
|
2781
|
+
const A = (O = N.target.files) == null ? void 0 : O[0];
|
|
2782
|
+
A && $(A), N.target.value = "";
|
|
2783
2783
|
}
|
|
2784
2784
|
}
|
|
2785
2785
|
)
|
|
@@ -2794,9 +2794,9 @@ const sr = ({
|
|
|
2794
2794
|
type: "url",
|
|
2795
2795
|
value: p,
|
|
2796
2796
|
placeholder: l("imageUpload.placeholder"),
|
|
2797
|
-
onChange: (
|
|
2798
|
-
onKeyDown: (
|
|
2799
|
-
|
|
2797
|
+
onChange: (N) => b(N.target.value),
|
|
2798
|
+
onKeyDown: (N) => {
|
|
2799
|
+
N.key === "Enter" && P(), N.key === "Escape" && i();
|
|
2800
2800
|
}
|
|
2801
2801
|
}
|
|
2802
2802
|
),
|
|
@@ -2807,11 +2807,11 @@ const sr = ({
|
|
|
2807
2807
|
] })
|
|
2808
2808
|
] }) }) : null;
|
|
2809
2809
|
}, pr = ({ def: n, editor: e, manager: t, active: r, disabled: o }) => {
|
|
2810
|
-
var u, h, x,
|
|
2811
|
-
const { t: s } = be(), [i, l] = D(!1), [a, d] = D(!1), [p, b] = D("upload"), T = H(null), m = (u = t == null ? void 0 : t.getConfig().upload) == null ? void 0 : u.url, k = (h = t == null ? void 0 : t.getConfig().upload) == null ? void 0 : h.headers,
|
|
2810
|
+
var u, h, x, y;
|
|
2811
|
+
const { t: s } = be(), [i, l] = D(!1), [a, d] = D(!1), [p, b] = D("upload"), T = H(null), m = (u = t == null ? void 0 : t.getConfig().upload) == null ? void 0 : u.url, k = (h = t == null ? void 0 : t.getConfig().upload) == null ? void 0 : h.headers, w = (x = t == null ? void 0 : t.getConfig().upload) == null ? void 0 : x.onUpload;
|
|
2812
2812
|
_(() => {
|
|
2813
|
-
const f = (
|
|
2814
|
-
T.current && !T.current.contains(
|
|
2813
|
+
const f = (C) => {
|
|
2814
|
+
T.current && !T.current.contains(C.target) && l(!1);
|
|
2815
2815
|
};
|
|
2816
2816
|
return document.addEventListener("pointerdown", f), () => document.removeEventListener("pointerdown", f);
|
|
2817
2817
|
}, []);
|
|
@@ -2835,13 +2835,13 @@ const sr = ({
|
|
|
2835
2835
|
]
|
|
2836
2836
|
}
|
|
2837
2837
|
),
|
|
2838
|
-
i && /* @__PURE__ */ c("div", { className: "tp-toolbar-dropdown-menu", children: (
|
|
2838
|
+
i && /* @__PURE__ */ c("div", { className: "tp-toolbar-dropdown-menu", children: (y = n.options) == null ? void 0 : y.map((f) => /* @__PURE__ */ c(
|
|
2839
2839
|
"button",
|
|
2840
2840
|
{
|
|
2841
2841
|
className: "tp-toolbar-dropdown-item",
|
|
2842
|
-
onMouseDown: (
|
|
2842
|
+
onMouseDown: (C) => C.preventDefault(),
|
|
2843
2843
|
onClick: () => S(f.value),
|
|
2844
|
-
children: f.label
|
|
2844
|
+
children: f.labelKey ? s(f.labelKey) : f.label
|
|
2845
2845
|
},
|
|
2846
2846
|
String(f.value)
|
|
2847
2847
|
)) }),
|
|
@@ -2852,7 +2852,7 @@ const sr = ({
|
|
|
2852
2852
|
editor: e,
|
|
2853
2853
|
uploadUrl: m,
|
|
2854
2854
|
uploadHeaders: k,
|
|
2855
|
-
onUpload:
|
|
2855
|
+
onUpload: w,
|
|
2856
2856
|
initialTab: p,
|
|
2857
2857
|
onClose: () => d(!1)
|
|
2858
2858
|
}
|
|
@@ -2861,33 +2861,33 @@ const sr = ({
|
|
|
2861
2861
|
}, fr = ({ visible: n, editor: e, onSuccess: t, onCancel: r, onClose: o }) => {
|
|
2862
2862
|
const { t: s } = be(), [i, l] = D(""), [a, d] = D(""), p = H(null);
|
|
2863
2863
|
_(() => (n ? (l(""), d(""), document.body.style.overflow = "hidden", setTimeout(() => {
|
|
2864
|
-
var
|
|
2865
|
-
return (
|
|
2864
|
+
var w;
|
|
2865
|
+
return (w = p.current) == null ? void 0 : w.focus();
|
|
2866
2866
|
}, 100)) : document.body.style.overflow = "", () => {
|
|
2867
2867
|
document.body.style.overflow = "";
|
|
2868
2868
|
}), [n]);
|
|
2869
2869
|
const b = E(() => {
|
|
2870
|
-
const
|
|
2871
|
-
if (!
|
|
2870
|
+
const w = i.trim();
|
|
2871
|
+
if (!w) {
|
|
2872
2872
|
d(s("video.urlRequired"));
|
|
2873
2873
|
return;
|
|
2874
2874
|
}
|
|
2875
2875
|
try {
|
|
2876
|
-
new URL(
|
|
2876
|
+
new URL(w);
|
|
2877
2877
|
} catch {
|
|
2878
2878
|
d(s("video.invalidUrl"));
|
|
2879
2879
|
return;
|
|
2880
2880
|
}
|
|
2881
|
-
e.chain().focus().setVideo({ src:
|
|
2881
|
+
e.chain().focus().setVideo({ src: w }).run(), t == null || t(w), o();
|
|
2882
2882
|
}, [i, e, s, t, o]), T = E(() => {
|
|
2883
2883
|
r == null || r(), o();
|
|
2884
|
-
}, [r, o]), m = E((
|
|
2885
|
-
|
|
2886
|
-
}, [T]), k = E((
|
|
2887
|
-
|
|
2884
|
+
}, [r, o]), m = E((w) => {
|
|
2885
|
+
w.target === w.currentTarget && T();
|
|
2886
|
+
}, [T]), k = E((w) => {
|
|
2887
|
+
w.key === "Enter" ? (w.preventDefault(), b()) : w.key === "Escape" && (w.preventDefault(), T());
|
|
2888
2888
|
}, [b, T]);
|
|
2889
2889
|
return n ? tt(
|
|
2890
|
-
/* @__PURE__ */ c("div", { className: "tp-video-dialog-overlay", onMouseDown: m, children: /* @__PURE__ */ v("div", { className: "tp-video-dialog", onMouseDown: (
|
|
2890
|
+
/* @__PURE__ */ c("div", { className: "tp-video-dialog-overlay", onMouseDown: m, children: /* @__PURE__ */ v("div", { className: "tp-video-dialog", onMouseDown: (w) => w.stopPropagation(), onKeyDown: k, children: [
|
|
2891
2891
|
/* @__PURE__ */ v("div", { className: "tp-dialog-header", children: [
|
|
2892
2892
|
/* @__PURE__ */ c("span", { className: "tp-dialog-title", children: s("video.title") }),
|
|
2893
2893
|
/* @__PURE__ */ c("button", { className: "tp-dialog-close", onClick: T, children: "×" })
|
|
@@ -2903,7 +2903,7 @@ const sr = ({
|
|
|
2903
2903
|
className: "tp-url-input",
|
|
2904
2904
|
placeholder: s("video.placeholder"),
|
|
2905
2905
|
value: i,
|
|
2906
|
-
onChange: (
|
|
2906
|
+
onChange: (w) => l(w.target.value),
|
|
2907
2907
|
onKeyDown: k
|
|
2908
2908
|
}
|
|
2909
2909
|
),
|
|
@@ -2972,7 +2972,7 @@ const sr = ({
|
|
|
2972
2972
|
),
|
|
2973
2973
|
s && /* @__PURE__ */ v("div", { className: "tp-table-grid-dropdown", children: [
|
|
2974
2974
|
/* @__PURE__ */ c("div", { className: "tp-table-grid-header", children: l.row > 0 ? `${l.row} × ${l.col}` : o("table.insertHint") }),
|
|
2975
|
-
/* @__PURE__ */ c("div", { className: "tp-table-grid", children: Array.from({ length: gr }, (m, k) => /* @__PURE__ */ c("div", { className: "tp-table-grid-row", children: Array.from({ length: wr }, (
|
|
2975
|
+
/* @__PURE__ */ c("div", { className: "tp-table-grid", children: Array.from({ length: gr }, (m, k) => /* @__PURE__ */ c("div", { className: "tp-table-grid-row", children: Array.from({ length: wr }, (w, S) => {
|
|
2976
2976
|
const u = k + 1, h = S + 1;
|
|
2977
2977
|
return /* @__PURE__ */ c(
|
|
2978
2978
|
"div",
|
|
@@ -2987,7 +2987,7 @@ const sr = ({
|
|
|
2987
2987
|
] })
|
|
2988
2988
|
] });
|
|
2989
2989
|
}, vr = ({ editor: n, disabled: e = !1 }) => {
|
|
2990
|
-
const { t } = be(), r = H("none"), [o, s] = D("none"), i = H([]), l = H(null), a = H(null), d = H(null), p = H(void 0), b = H(null), T = H(0), m = H(!1), k = o !== "none",
|
|
2990
|
+
const { t } = be(), r = H("none"), [o, s] = D("none"), i = H([]), l = H(null), a = H(null), d = H(null), p = H(void 0), b = H(null), T = H(0), m = H(!1), k = o !== "none", w = E(() => {
|
|
2991
2991
|
const { from: A, to: O } = n.state.selection;
|
|
2992
2992
|
if (n.isActive("orderedList")) return "orderedList";
|
|
2993
2993
|
if (n.isActive("bulletList")) return "bulletList";
|
|
@@ -3011,7 +3011,7 @@ const sr = ({
|
|
|
3011
3011
|
if (z) return !1;
|
|
3012
3012
|
const J = n.state.doc.resolve(Math.min(A + 1, O)).marks();
|
|
3013
3013
|
i.current = [...J];
|
|
3014
|
-
const K =
|
|
3014
|
+
const K = w();
|
|
3015
3015
|
l.current = K;
|
|
3016
3016
|
const W = n.getAttributes("textStyle");
|
|
3017
3017
|
a.current = {
|
|
@@ -3026,7 +3026,7 @@ const sr = ({
|
|
|
3026
3026
|
}, p.current = S();
|
|
3027
3027
|
const V = J.length > 0, q = !!W.color || !!W.fontFamily || !!W.fontSize, re = !!d.current.textAlign || !!d.current.lineHeight;
|
|
3028
3028
|
return V || q || re || K !== null || p.current !== void 0;
|
|
3029
|
-
}, [n,
|
|
3029
|
+
}, [n, w, S]), h = E(() => {
|
|
3030
3030
|
if (!l.current) return;
|
|
3031
3031
|
const A = n.chain().focus();
|
|
3032
3032
|
switch (l.current) {
|
|
@@ -3046,7 +3046,7 @@ const sr = ({
|
|
|
3046
3046
|
const { schema: O } = n.state;
|
|
3047
3047
|
O.nodes.heading && A.setNode("heading", { level: p.current }).run();
|
|
3048
3048
|
}
|
|
3049
|
-
}, [n]),
|
|
3049
|
+
}, [n]), y = E(() => {
|
|
3050
3050
|
let { state: A } = n, { from: O, to: z, empty: G } = A.selection;
|
|
3051
3051
|
if (G) return !1;
|
|
3052
3052
|
const { schema: J } = A;
|
|
@@ -3083,11 +3083,11 @@ const sr = ({
|
|
|
3083
3083
|
}), W.docChanged && n.view.dispatch(W)), !0;
|
|
3084
3084
|
}, [n, h, x]), f = E(() => {
|
|
3085
3085
|
r.current = "none", s("none"), i.current = [], l.current = null, a.current = null, d.current = null, p.current = void 0;
|
|
3086
|
-
}, []),
|
|
3086
|
+
}, []), C = E(() => {
|
|
3087
3087
|
if (r.current === "none") return;
|
|
3088
3088
|
const { empty: A } = n.state.selection;
|
|
3089
|
-
A || (
|
|
3090
|
-
}, [n,
|
|
3089
|
+
A || (y(), r.current === "single" && f());
|
|
3090
|
+
}, [n, y, f]), $ = E(() => {
|
|
3091
3091
|
if (r.current === "single" || r.current === "multiple") {
|
|
3092
3092
|
f();
|
|
3093
3093
|
return;
|
|
@@ -3099,7 +3099,7 @@ const sr = ({
|
|
|
3099
3099
|
return;
|
|
3100
3100
|
}
|
|
3101
3101
|
u() && (r.current = "multiple", s("multiple"));
|
|
3102
|
-
}, [u, f]),
|
|
3102
|
+
}, [u, f]), N = E(() => {
|
|
3103
3103
|
e || (T.current++, T.current === 1 ? b.current = window.setTimeout(() => {
|
|
3104
3104
|
$(), T.current = 0, b.current = null;
|
|
3105
3105
|
}, 250) : T.current === 2 && (b.current && (clearTimeout(b.current), b.current = null), P(), T.current = 0));
|
|
@@ -3110,24 +3110,24 @@ const sr = ({
|
|
|
3110
3110
|
const A = (J) => {
|
|
3111
3111
|
r.current === "none" || J.target.closest(".tp-toolbar-btn") || (m.current = !0);
|
|
3112
3112
|
}, O = (J) => {
|
|
3113
|
-
!m.current || (m.current = !1, r.current === "none") || J.target.closest(".tp-toolbar-btn") || requestAnimationFrame(() =>
|
|
3113
|
+
!m.current || (m.current = !1, r.current === "none") || J.target.closest(".tp-toolbar-btn") || requestAnimationFrame(() => C());
|
|
3114
3114
|
}, z = (J) => {
|
|
3115
3115
|
J.key === "Escape" && r.current !== "none" && f();
|
|
3116
3116
|
}, G = (J) => {
|
|
3117
3117
|
if (r.current === "none") return;
|
|
3118
3118
|
const K = ["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Home", "End", "PageUp", "PageDown"];
|
|
3119
|
-
J.shiftKey && K.includes(J.key) &&
|
|
3119
|
+
J.shiftKey && K.includes(J.key) && C();
|
|
3120
3120
|
};
|
|
3121
3121
|
return document.addEventListener("mousedown", A), document.addEventListener("mouseup", O), document.addEventListener("keydown", z), document.addEventListener("keyup", G), () => {
|
|
3122
3122
|
document.removeEventListener("mousedown", A), document.removeEventListener("mouseup", O), document.removeEventListener("keydown", z), document.removeEventListener("keyup", G), b.current && clearTimeout(b.current);
|
|
3123
3123
|
};
|
|
3124
|
-
}, [
|
|
3124
|
+
}, [C, f]), /* @__PURE__ */ v(
|
|
3125
3125
|
"button",
|
|
3126
3126
|
{
|
|
3127
3127
|
className: `tp-toolbar-btn${k ? " is-active" : ""}${o === "multiple" ? " is-locked" : ""}${e ? " is-disabled" : ""}`,
|
|
3128
3128
|
disabled: e,
|
|
3129
3129
|
title: t("toolbar.formatPainter"),
|
|
3130
|
-
onClick:
|
|
3130
|
+
onClick: N,
|
|
3131
3131
|
style: { position: "relative" },
|
|
3132
3132
|
children: [
|
|
3133
3133
|
/* @__PURE__ */ c("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: Be("formatPainter") } }),
|
|
@@ -3144,44 +3144,44 @@ const sr = ({
|
|
|
3144
3144
|
{ type: "upper-alpha", lines: ["A.", "B.", "C."] }
|
|
3145
3145
|
], kr = ({ def: n, editor: e, active: t, disabled: r }) => {
|
|
3146
3146
|
const { t: o } = be(), [s, i] = D(!1), [l, a] = D(0), d = H(null), p = () => {
|
|
3147
|
-
const { state:
|
|
3148
|
-
let
|
|
3147
|
+
const { state: y } = e, f = y.selection.$from;
|
|
3148
|
+
let C = null, $ = 0;
|
|
3149
3149
|
for (let P = f.depth; P >= 0; P--) {
|
|
3150
|
-
const
|
|
3151
|
-
|
|
3150
|
+
const N = f.node(P);
|
|
3151
|
+
N.type.name === "orderedList" && (C || (C = N), $++);
|
|
3152
3152
|
}
|
|
3153
|
-
return { node:
|
|
3153
|
+
return { node: C, depth: $ };
|
|
3154
3154
|
}, b = (() => {
|
|
3155
|
-
const { node:
|
|
3156
|
-
return
|
|
3155
|
+
const { node: y, depth: f } = p();
|
|
3156
|
+
return y && y.attrs.listStyleType ? y.attrs.listStyleType : f <= 1 ? "decimal" : f === 2 ? "lower-alpha" : "lower-roman";
|
|
3157
3157
|
})(), T = (() => {
|
|
3158
|
-
const { node:
|
|
3158
|
+
const { node: y } = p(), f = y == null ? void 0 : y.attrs.start;
|
|
3159
3159
|
return f != null ? Number(f) : 1;
|
|
3160
3160
|
})(), m = (() => {
|
|
3161
|
-
const { node:
|
|
3162
|
-
return !!(
|
|
3161
|
+
const { node: y } = p();
|
|
3162
|
+
return !!(y != null && y.attrs.reversed);
|
|
3163
3163
|
})(), k = E(() => {
|
|
3164
|
-
var
|
|
3165
|
-
(
|
|
3166
|
-
}, [n, e]),
|
|
3167
|
-
r || i((
|
|
3168
|
-
}, [r]), S = E((
|
|
3169
|
-
e.commands.createStyledOrderedList({ listStyleType:
|
|
3170
|
-
}, [e]), u = E((
|
|
3171
|
-
const f = parseInt(
|
|
3164
|
+
var y;
|
|
3165
|
+
(y = n.command) == null || y.call(n, e);
|
|
3166
|
+
}, [n, e]), w = E(() => {
|
|
3167
|
+
r || i((y) => !y);
|
|
3168
|
+
}, [r]), S = E((y) => {
|
|
3169
|
+
e.commands.createStyledOrderedList({ listStyleType: y }), e.commands.focus(), i(!1);
|
|
3170
|
+
}, [e]), u = E((y) => {
|
|
3171
|
+
const f = parseInt(y.target.value, 10);
|
|
3172
3172
|
isNaN(f) || e.commands.setOrderedListAttrs({ start: f });
|
|
3173
|
-
}, [e]), h = E((
|
|
3174
|
-
["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Tab", "Home", "End"].includes(
|
|
3173
|
+
}, [e]), h = E((y) => {
|
|
3174
|
+
["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Tab", "Home", "End"].includes(y.key) || y.key === "-" || y.key === "Minus" || y.key >= "0" && y.key <= "9" || y.ctrlKey || y.metaKey || y.preventDefault();
|
|
3175
3175
|
}, []), x = E(() => {
|
|
3176
|
-
const
|
|
3177
|
-
e.commands.setOrderedListAttrs({ reversed:
|
|
3176
|
+
const y = !m;
|
|
3177
|
+
e.commands.setOrderedListAttrs({ reversed: y || null });
|
|
3178
3178
|
}, [e, m]);
|
|
3179
3179
|
return _(() => {
|
|
3180
|
-
const
|
|
3181
|
-
d.current && !d.current.contains(
|
|
3182
|
-
}, f = () => a((
|
|
3183
|
-
return document.addEventListener("pointerdown",
|
|
3184
|
-
document.removeEventListener("pointerdown",
|
|
3180
|
+
const y = (C) => {
|
|
3181
|
+
d.current && !d.current.contains(C.target) && i(!1);
|
|
3182
|
+
}, f = () => a((C) => C + 1);
|
|
3183
|
+
return document.addEventListener("pointerdown", y), e.on("transaction", f), () => {
|
|
3184
|
+
document.removeEventListener("pointerdown", y), e.off("transaction", f);
|
|
3185
3185
|
};
|
|
3186
3186
|
}, [e]), /* @__PURE__ */ v("div", { ref: d, className: "tp-toolbar-split-btn", children: [
|
|
3187
3187
|
/* @__PURE__ */ c(
|
|
@@ -3190,7 +3190,7 @@ const sr = ({
|
|
|
3190
3190
|
className: `tp-toolbar-split-main${t ? " is-active" : ""}`,
|
|
3191
3191
|
title: o(n.titleKey),
|
|
3192
3192
|
disabled: r,
|
|
3193
|
-
onMouseDown: (
|
|
3193
|
+
onMouseDown: (y) => y.preventDefault(),
|
|
3194
3194
|
onClick: k,
|
|
3195
3195
|
children: /* @__PURE__ */ c("span", { className: "tp-toolbar-icon", dangerouslySetInnerHTML: { __html: Be(n.name) } })
|
|
3196
3196
|
}
|
|
@@ -3200,24 +3200,24 @@ const sr = ({
|
|
|
3200
3200
|
{
|
|
3201
3201
|
className: `tp-toolbar-split-arrow${s ? " is-open" : ""}`,
|
|
3202
3202
|
disabled: r,
|
|
3203
|
-
onMouseDown: (
|
|
3204
|
-
onClick:
|
|
3203
|
+
onMouseDown: (y) => y.preventDefault(),
|
|
3204
|
+
onClick: w,
|
|
3205
3205
|
children: "▾"
|
|
3206
3206
|
}
|
|
3207
3207
|
),
|
|
3208
3208
|
s && /* @__PURE__ */ v("div", { className: "tp-ol-panel", children: [
|
|
3209
|
-
/* @__PURE__ */ c("div", { className: "tp-ol-style-grid", children: br.map((
|
|
3209
|
+
/* @__PURE__ */ c("div", { className: "tp-ol-style-grid", children: br.map((y) => /* @__PURE__ */ c(
|
|
3210
3210
|
"button",
|
|
3211
3211
|
{
|
|
3212
|
-
className: `tp-ol-style-item${b ===
|
|
3212
|
+
className: `tp-ol-style-item${b === y.type ? " is-active" : ""}`,
|
|
3213
3213
|
onMouseDown: (f) => f.preventDefault(),
|
|
3214
|
-
onClick: () => S(
|
|
3215
|
-
children:
|
|
3214
|
+
onClick: () => S(y.type),
|
|
3215
|
+
children: y.lines.map((f, C) => /* @__PURE__ */ v("span", { className: "tp-ol-style-line", children: [
|
|
3216
3216
|
/* @__PURE__ */ c("span", { className: "tp-ol-style-marker", children: f }),
|
|
3217
3217
|
/* @__PURE__ */ c("span", { className: "tp-ol-style-bar" })
|
|
3218
|
-
] },
|
|
3218
|
+
] }, C))
|
|
3219
3219
|
},
|
|
3220
|
-
|
|
3220
|
+
y.type
|
|
3221
3221
|
)) }),
|
|
3222
3222
|
/* @__PURE__ */ v("div", { className: "tp-ol-properties", children: [
|
|
3223
3223
|
/* @__PURE__ */ c("div", { className: "tp-ol-prop-title", children: o("orderedList.properties") }),
|
|
@@ -3231,7 +3231,7 @@ const sr = ({
|
|
|
3231
3231
|
defaultValue: T,
|
|
3232
3232
|
onChange: u,
|
|
3233
3233
|
onKeyDown: h,
|
|
3234
|
-
onMouseDown: (
|
|
3234
|
+
onMouseDown: (y) => y.stopPropagation()
|
|
3235
3235
|
}
|
|
3236
3236
|
)
|
|
3237
3237
|
] }),
|
|
@@ -3241,7 +3241,7 @@ const sr = ({
|
|
|
3241
3241
|
"button",
|
|
3242
3242
|
{
|
|
3243
3243
|
className: `tp-ol-toggle${m ? " is-on" : ""}`,
|
|
3244
|
-
onMouseDown: (
|
|
3244
|
+
onMouseDown: (y) => y.preventDefault(),
|
|
3245
3245
|
onClick: x
|
|
3246
3246
|
}
|
|
3247
3247
|
)
|
|
@@ -3256,10 +3256,10 @@ const sr = ({
|
|
|
3256
3256
|
{ type: "none", marker: "—" }
|
|
3257
3257
|
], Cr = ({ def: n, editor: e, active: t, disabled: r }) => {
|
|
3258
3258
|
const { t: o } = be(), [s, i] = D(!1), [l, a] = D(0), d = H(null), p = (() => {
|
|
3259
|
-
const { state: k } = e,
|
|
3259
|
+
const { state: k } = e, w = k.selection.$from;
|
|
3260
3260
|
let S = null, u = 0;
|
|
3261
|
-
for (let h =
|
|
3262
|
-
const x =
|
|
3261
|
+
for (let h = w.depth; h >= 0; h--) {
|
|
3262
|
+
const x = w.node(h);
|
|
3263
3263
|
x.type.name === "bulletList" && (S || (S = x), u++);
|
|
3264
3264
|
}
|
|
3265
3265
|
return S && S.attrs.listStyleType ? S.attrs.listStyleType : u <= 1 ? "disc" : u === 2 ? "circle" : "square";
|
|
@@ -3274,9 +3274,9 @@ const sr = ({
|
|
|
3274
3274
|
return _(() => {
|
|
3275
3275
|
const k = (S) => {
|
|
3276
3276
|
d.current && !d.current.contains(S.target) && i(!1);
|
|
3277
|
-
},
|
|
3278
|
-
return document.addEventListener("pointerdown", k), e.on("transaction",
|
|
3279
|
-
document.removeEventListener("pointerdown", k), e.off("transaction",
|
|
3277
|
+
}, w = () => a((S) => S + 1);
|
|
3278
|
+
return document.addEventListener("pointerdown", k), e.on("transaction", w), () => {
|
|
3279
|
+
document.removeEventListener("pointerdown", k), e.off("transaction", w);
|
|
3280
3280
|
};
|
|
3281
3281
|
}, [e]), /* @__PURE__ */ v("div", { ref: d, className: "tp-toolbar-split-btn", children: [
|
|
3282
3282
|
/* @__PURE__ */ c(
|
|
@@ -3304,12 +3304,12 @@ const sr = ({
|
|
|
3304
3304
|
"button",
|
|
3305
3305
|
{
|
|
3306
3306
|
className: `tp-ol-style-item${p === k.type ? " is-active" : ""}`,
|
|
3307
|
-
onMouseDown: (
|
|
3307
|
+
onMouseDown: (w) => w.preventDefault(),
|
|
3308
3308
|
onClick: () => m(k.type),
|
|
3309
|
-
children: [0, 1, 2].map((
|
|
3309
|
+
children: [0, 1, 2].map((w) => /* @__PURE__ */ v("span", { className: "tp-ol-style-line", children: [
|
|
3310
3310
|
/* @__PURE__ */ c("span", { className: "tp-ul-style-marker", children: k.marker }),
|
|
3311
3311
|
/* @__PURE__ */ c("span", { className: "tp-ol-style-bar" })
|
|
3312
|
-
] },
|
|
3312
|
+
] }, w))
|
|
3313
3313
|
},
|
|
3314
3314
|
k.type
|
|
3315
3315
|
)) }) })
|
|
@@ -3339,7 +3339,7 @@ const Nr = ({
|
|
|
3339
3339
|
return;
|
|
3340
3340
|
}
|
|
3341
3341
|
i == null || i(u);
|
|
3342
|
-
}, [s, i]), b = (u) => o !== "normal" ? u === "getHTML" ? o === "html" : u === "getJSON" ? o === "json" : !1 : u === "getHTML" || u === "getJSON" ? !1 : t[u] ?? !1, T = (u) => o !== "normal" ? u !== "getHTML" && u !== "getJSON" : r[u] ?? !1, m = _e(() => Rn(n), [n]), k = m.filter((u) => u.category === "meta-left" || u.category === "content"),
|
|
3342
|
+
}, [s, i]), b = (u) => o !== "normal" ? u === "getHTML" ? o === "html" : u === "getJSON" ? o === "json" : !1 : u === "getHTML" || u === "getJSON" ? !1 : t[u] ?? !1, T = (u) => o !== "normal" ? u !== "getHTML" && u !== "getJSON" : r[u] ?? !1, m = _e(() => Rn(n), [n]), k = m.filter((u) => u.category === "meta-left" || u.category === "content"), w = m.filter((u) => u.category === "meta-io" || u.category === "meta-view");
|
|
3343
3343
|
function S(u) {
|
|
3344
3344
|
const h = En(u);
|
|
3345
3345
|
if (!h) return null;
|
|
@@ -3352,7 +3352,7 @@ const Nr = ({
|
|
|
3352
3352
|
h > 0 && /* @__PURE__ */ c(sn, {}),
|
|
3353
3353
|
u.category !== "content" ? /* @__PURE__ */ c("div", { className: ln(u.category), children: u.items.map(S) }) : /* @__PURE__ */ c(Ft, { children: u.items.map(S) })
|
|
3354
3354
|
] }, `g-${h}`)),
|
|
3355
|
-
|
|
3355
|
+
w.length > 0 && /* @__PURE__ */ c("div", { className: "tp-toolbar-right", children: w.map((u, h) => /* @__PURE__ */ v(Ot.Fragment, { children: [
|
|
3356
3356
|
h > 0 && /* @__PURE__ */ c(sn, {}),
|
|
3357
3357
|
/* @__PURE__ */ c("div", { className: ln(u.category), children: u.items.map(S) })
|
|
3358
3358
|
] }, `r-${h}`)) }),
|
|
@@ -3366,7 +3366,7 @@ const Nr = ({
|
|
|
3366
3366
|
onVisibleChange: o,
|
|
3367
3367
|
onAction: s
|
|
3368
3368
|
}) => {
|
|
3369
|
-
const i = H(null), [l, a] = D({ x: 0, y: 0 }), [d, p] = D(!1), [b, T] = D(!1), m = H({ x: 0, y: 0 }), k = Ve.getInstance(),
|
|
3369
|
+
const i = H(null), [l, a] = D({ x: 0, y: 0 }), [d, p] = D(!1), [b, T] = D(!1), m = H({ x: 0, y: 0 }), k = Ve.getInstance(), w = (h) => k.t(h), S = E((h) => {
|
|
3370
3370
|
if (!i.current) return h;
|
|
3371
3371
|
const x = i.current.getBoundingClientRect();
|
|
3372
3372
|
return x.width === 0 || x.height === 0 ? h : Vt({
|
|
@@ -3401,16 +3401,16 @@ const Nr = ({
|
|
|
3401
3401
|
}, [e, l.x, l.y]), _(() => {
|
|
3402
3402
|
const h = () => {
|
|
3403
3403
|
if (!e || !r) return;
|
|
3404
|
-
const
|
|
3405
|
-
if (
|
|
3404
|
+
const y = r.getBoundingClientRect();
|
|
3405
|
+
if (y.bottom < 0 || y.top > window.innerHeight) {
|
|
3406
3406
|
o(!1);
|
|
3407
3407
|
return;
|
|
3408
3408
|
}
|
|
3409
3409
|
const f = {
|
|
3410
|
-
x:
|
|
3411
|
-
y:
|
|
3412
|
-
},
|
|
3413
|
-
a({ x:
|
|
3410
|
+
x: y.left + m.current.x,
|
|
3411
|
+
y: y.top + m.current.y
|
|
3412
|
+
}, C = S(f);
|
|
3413
|
+
a({ x: C.x, y: C.y });
|
|
3414
3414
|
}, x = () => {
|
|
3415
3415
|
e && h();
|
|
3416
3416
|
};
|
|
@@ -3418,10 +3418,10 @@ const Nr = ({
|
|
|
3418
3418
|
window.removeEventListener("scroll", x, !0), window.removeEventListener("wheel", x);
|
|
3419
3419
|
};
|
|
3420
3420
|
}, [e, r, o, S]), _(() => {
|
|
3421
|
-
const h = (
|
|
3422
|
-
i.current && !i.current.contains(
|
|
3423
|
-
}, x = (
|
|
3424
|
-
|
|
3421
|
+
const h = (y) => {
|
|
3422
|
+
i.current && !i.current.contains(y.target) && o(!1);
|
|
3423
|
+
}, x = (y) => {
|
|
3424
|
+
y.key === "Escape" && o(!1);
|
|
3425
3425
|
};
|
|
3426
3426
|
return document.addEventListener("click", h), document.addEventListener("keydown", x), () => {
|
|
3427
3427
|
document.removeEventListener("click", h), document.removeEventListener("keydown", x);
|
|
@@ -3440,26 +3440,26 @@ const Nr = ({
|
|
|
3440
3440
|
onClick: (h) => h.stopPropagation(),
|
|
3441
3441
|
children: [
|
|
3442
3442
|
/* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
|
|
3443
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addRowBefore"), children:
|
|
3444
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addRowAfter"), children:
|
|
3445
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addColumnBefore"), children:
|
|
3446
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addColumnAfter"), children:
|
|
3443
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addRowBefore"), children: w("table.addRowBefore") }),
|
|
3444
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addRowAfter"), children: w("table.addRowAfter") }),
|
|
3445
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addColumnBefore"), children: w("table.addColumnBefore") }),
|
|
3446
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("addColumnAfter"), children: w("table.addColumnAfter") })
|
|
3447
3447
|
] }),
|
|
3448
3448
|
/* @__PURE__ */ c("div", { className: "tp-table-menu-divider" }),
|
|
3449
3449
|
/* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
|
|
3450
|
-
/* @__PURE__ */ c("div", { className: `tp-table-menu-item${d ? "" : " disabled"}`, onClick: () => d && u("mergeCells"), children:
|
|
3451
|
-
/* @__PURE__ */ c("div", { className: `tp-table-menu-item${b ? "" : " disabled"}`, onClick: () => b && u("splitCell"), children:
|
|
3450
|
+
/* @__PURE__ */ c("div", { className: `tp-table-menu-item${d ? "" : " disabled"}`, onClick: () => d && u("mergeCells"), children: w("table.mergeCells") }),
|
|
3451
|
+
/* @__PURE__ */ c("div", { className: `tp-table-menu-item${b ? "" : " disabled"}`, onClick: () => b && u("splitCell"), children: w("table.splitCell") })
|
|
3452
3452
|
] }),
|
|
3453
3453
|
/* @__PURE__ */ c("div", { className: "tp-table-menu-divider" }),
|
|
3454
3454
|
/* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
|
|
3455
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("deleteRow"), children:
|
|
3456
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("deleteColumn"), children:
|
|
3457
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item tp-table-menu-item-danger", onClick: () => u("deleteTable"), children:
|
|
3455
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("deleteRow"), children: w("table.deleteRow") }),
|
|
3456
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("deleteColumn"), children: w("table.deleteColumn") }),
|
|
3457
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item tp-table-menu-item-danger", onClick: () => u("deleteTable"), children: w("table.deleteTable") })
|
|
3458
3458
|
] }),
|
|
3459
3459
|
/* @__PURE__ */ c("div", { className: "tp-table-menu-divider" }),
|
|
3460
3460
|
/* @__PURE__ */ v("div", { className: "tp-table-menu-section", children: [
|
|
3461
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("tableSettings"), children:
|
|
3462
|
-
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("cellSettings"), children:
|
|
3461
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("tableSettings"), children: w("table.tableSettings") }),
|
|
3462
|
+
/* @__PURE__ */ c("div", { className: "tp-table-menu-item", onClick: () => u("cellSettings"), children: w("table.cellSettings") })
|
|
3463
3463
|
] })
|
|
3464
3464
|
]
|
|
3465
3465
|
}
|
|
@@ -3602,7 +3602,7 @@ function Er(n, e, t) {
|
|
|
3602
3602
|
}
|
|
3603
3603
|
const kt = Mn(
|
|
3604
3604
|
({ value: n, onChange: e, placeholder: t, mode: r = "border", beforeOpen: o, onClose: s }, i) => {
|
|
3605
|
-
const [l, a] = D(!1), d = H(null), p = H(null), b = H(null), T = H(null), m = H(null), [k,
|
|
3605
|
+
const [l, a] = D(!1), d = H(null), p = H(null), b = H(null), T = H(null), m = H(null), [k, w] = D(-1e4), [S, u] = D(-1e4), [h, x] = D(n), [y, f] = D(n), C = H(n), [$, P] = D("hex"), [N, A] = D({ h: 0, s: 100, v: 100 }), [O, z] = D({ r: 0, g: 0, b: 0 }), [G, J] = D({ h: 0, s: 0, l: 0 }), [K, W] = D(!1), [B, F] = D(!1), [V, q] = D(!1), re = E(() => {
|
|
3606
3606
|
let L = 0;
|
|
3607
3607
|
const I = 3, te = () => {
|
|
3608
3608
|
if (L >= I * 2) {
|
|
@@ -3616,19 +3616,19 @@ const kt = Mn(
|
|
|
3616
3616
|
cn(i, () => ({
|
|
3617
3617
|
triggerButtonFlash: re
|
|
3618
3618
|
}));
|
|
3619
|
-
const oe = _e(() => r === "background" ? Tr : Mr, [r]), Me =
|
|
3619
|
+
const oe = _e(() => r === "background" ? Tr : Mr, [r]), Me = y || "#d9d9d9", se = E((L) => {
|
|
3620
3620
|
x(L), f(L);
|
|
3621
3621
|
const I = Lr(L);
|
|
3622
3622
|
I && (z(I), J(It(I.r, I.g, I.b)), A($t(I.r, I.g, I.b)));
|
|
3623
3623
|
}, []), ge = E(() => {
|
|
3624
|
-
const L = Rr(
|
|
3624
|
+
const L = Rr(N.h, N.s, N.v), I = At(L.r, L.g, L.b);
|
|
3625
3625
|
z(L), J(It(L.r, L.g, L.b)), x(I), f(I);
|
|
3626
|
-
}, [
|
|
3626
|
+
}, [N]);
|
|
3627
3627
|
_(() => {
|
|
3628
3628
|
se(n);
|
|
3629
3629
|
}, [n, se]), _(() => {
|
|
3630
3630
|
ge();
|
|
3631
|
-
}, [
|
|
3631
|
+
}, [N, ge]);
|
|
3632
3632
|
const pe = E((L) => {
|
|
3633
3633
|
let I = L.parentElement;
|
|
3634
3634
|
for (; I; ) {
|
|
@@ -3656,7 +3656,7 @@ const kt = Mn(
|
|
|
3656
3656
|
const ve = qe - fe.right - ae, we = fe.left - ae;
|
|
3657
3657
|
ve >= we ? (Pe = Math.max(ae, qe - Ge - ae), M = "right") : (Pe = ae, M = "left");
|
|
3658
3658
|
}
|
|
3659
|
-
Xe + $e > Ye - ae && (Xe = Math.max(ae, Ye - $e - ae)),
|
|
3659
|
+
Xe + $e > Ye - ae && (Xe = Math.max(ae, Ye - $e - ae)), w(Xe), u(Pe), L.dataset.placement = M;
|
|
3660
3660
|
let U = fe.top + fe.height / 2 - Xe - Nt;
|
|
3661
3661
|
const ce = ae, le = Math.max(ce, $e - at - ae);
|
|
3662
3662
|
U = Math.max(ce, Math.min(le, U)), L.style.setProperty("--triangle-top", `${U}px`);
|
|
@@ -3675,7 +3675,7 @@ const kt = Mn(
|
|
|
3675
3675
|
s == null || s();
|
|
3676
3676
|
else {
|
|
3677
3677
|
if (o && o() === !1) return;
|
|
3678
|
-
|
|
3678
|
+
C.current = n, f(n), se(n);
|
|
3679
3679
|
}
|
|
3680
3680
|
a(!l);
|
|
3681
3681
|
}, [l, n, se, o, s]), j = E((L) => {
|
|
@@ -3684,8 +3684,8 @@ const kt = Mn(
|
|
|
3684
3684
|
const I = L.target.value;
|
|
3685
3685
|
x(I), (/^#[0-9A-Fa-f]{6}$/.test(I) || /^#[0-9A-Fa-f]{3}$/.test(I)) && se(I);
|
|
3686
3686
|
}, [se]), Ne = E(() => {
|
|
3687
|
-
h !==
|
|
3688
|
-
}, [h,
|
|
3687
|
+
h !== y && (/^#[0-9A-Fa-f]{6}$/.test(h) || /^#[0-9A-Fa-f]{3}$/.test(h) ? se(h) : (x(y), se(y)));
|
|
3688
|
+
}, [h, y, se]), nt = E(() => {
|
|
3689
3689
|
const L = At(O.r, O.g, O.b);
|
|
3690
3690
|
x(L), f(L), J(It(O.r, O.g, O.b)), A($t(O.r, O.g, O.b));
|
|
3691
3691
|
}, [O]), Re = E(() => {
|
|
@@ -3730,9 +3730,9 @@ const kt = Mn(
|
|
|
3730
3730
|
};
|
|
3731
3731
|
}, [l, Y]);
|
|
3732
3732
|
const Ct = E(() => {
|
|
3733
|
-
e(
|
|
3734
|
-
}, [
|
|
3735
|
-
f(
|
|
3733
|
+
e(y), a(!1), s == null || s();
|
|
3734
|
+
}, [y, e, s]), g = E(() => {
|
|
3735
|
+
f(C.current), se(C.current), a(!1), s == null || s();
|
|
3736
3736
|
}, [se, s]), ne = E((L) => {
|
|
3737
3737
|
L.stopPropagation();
|
|
3738
3738
|
}, []);
|
|
@@ -3768,14 +3768,14 @@ const kt = Mn(
|
|
|
3768
3768
|
ref: T,
|
|
3769
3769
|
className: "tp-sv-area",
|
|
3770
3770
|
style: {
|
|
3771
|
-
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${
|
|
3771
|
+
background: `linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(${N.h}, 100%, 50%)`
|
|
3772
3772
|
},
|
|
3773
3773
|
onMouseDown: je,
|
|
3774
3774
|
children: /* @__PURE__ */ c(
|
|
3775
3775
|
"div",
|
|
3776
3776
|
{
|
|
3777
3777
|
className: "tp-sv-indicator",
|
|
3778
|
-
style: { left: `${
|
|
3778
|
+
style: { left: `${N.s}%`, top: `${100 - N.v}%` }
|
|
3779
3779
|
}
|
|
3780
3780
|
)
|
|
3781
3781
|
}
|
|
@@ -3784,7 +3784,7 @@ const kt = Mn(
|
|
|
3784
3784
|
"div",
|
|
3785
3785
|
{
|
|
3786
3786
|
className: "tp-hue-indicator",
|
|
3787
|
-
style: { left: `${
|
|
3787
|
+
style: { left: `${N.h / 360 * 100}%` }
|
|
3788
3788
|
}
|
|
3789
3789
|
) }),
|
|
3790
3790
|
/* @__PURE__ */ c("div", { className: "tp-color-section-label", children: "常用颜色" }),
|
|
@@ -3876,10 +3876,10 @@ const Dr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
3876
3876
|
if (e) {
|
|
3877
3877
|
document.body.style.overflow = "hidden";
|
|
3878
3878
|
const { state: m } = n, { $from: k } = m.selection;
|
|
3879
|
-
let
|
|
3880
|
-
m.doc.nodesBetween(k.start(), k.end(), (S) => S.type.name === "table" ? (
|
|
3881
|
-
borderColor:
|
|
3882
|
-
borderWidth:
|
|
3879
|
+
let w = null;
|
|
3880
|
+
m.doc.nodesBetween(k.start(), k.end(), (S) => S.type.name === "table" ? (w = S, !1) : !0), i(w ? {
|
|
3881
|
+
borderColor: w.attrs.borderColor || "#d9d9d9",
|
|
3882
|
+
borderWidth: w.attrs.borderWidth ? parseInt(w.attrs.borderWidth, 10) : 1
|
|
3883
3883
|
} : { borderColor: "#d9d9d9", borderWidth: 1 });
|
|
3884
3884
|
} else
|
|
3885
3885
|
document.body.style.overflow = "";
|
|
@@ -4016,29 +4016,29 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4016
4016
|
}), [l, a] = D({ borderColor: "#d9d9d9", borderWidth: 1 }), [d, p] = D(""), b = H(null), T = H(null), m = E(() => {
|
|
4017
4017
|
const h = d === "border" ? b.current : T.current;
|
|
4018
4018
|
h == null || h.triggerButtonFlash();
|
|
4019
|
-
}, [d]), k = E((h) => d && d !== h ? (m(), !1) : (p(h), !0), [d, m]),
|
|
4019
|
+
}, [d]), k = E((h) => d && d !== h ? (m(), !1) : (p(h), !0), [d, m]), w = E(() => {
|
|
4020
4020
|
const { state: h } = n, { selection: x } = h;
|
|
4021
4021
|
if ("$anchorCell" in x && x.$anchorCell) {
|
|
4022
|
-
const
|
|
4022
|
+
const C = x.$anchorCell;
|
|
4023
4023
|
let $ = null;
|
|
4024
|
-
return h.doc.nodesBetween(
|
|
4024
|
+
return h.doc.nodesBetween(C.pos, C.pos + 1, (P) => P.type.name === "tableCell" || P.type.name === "tableHeader" ? ($ = P, !1) : !0), ($ == null ? void 0 : $.attrs) || null;
|
|
4025
4025
|
}
|
|
4026
|
-
const { $from:
|
|
4026
|
+
const { $from: y } = x;
|
|
4027
4027
|
let f = null;
|
|
4028
|
-
return h.doc.nodesBetween(
|
|
4028
|
+
return h.doc.nodesBetween(y.pos, y.pos + 1, (C) => C.type.name === "tableCell" || C.type.name === "tableHeader" ? (f = C, !1) : !0), (f == null ? void 0 : f.attrs) || null;
|
|
4029
4029
|
}, [n]);
|
|
4030
4030
|
_(() => {
|
|
4031
|
-
var h, x,
|
|
4031
|
+
var h, x, y, f;
|
|
4032
4032
|
if (e) {
|
|
4033
4033
|
document.body.style.overflow = "hidden";
|
|
4034
|
-
const
|
|
4035
|
-
if (
|
|
4034
|
+
const C = w();
|
|
4035
|
+
if (C) {
|
|
4036
4036
|
const $ = {
|
|
4037
|
-
borderColor: ((x = (h =
|
|
4038
|
-
borderWidth: (f = (
|
|
4039
|
-
backgroundColor:
|
|
4040
|
-
textAlign:
|
|
4041
|
-
verticalAlign:
|
|
4037
|
+
borderColor: ((x = (h = C.borderLeft) == null ? void 0 : h.match(/#\w+/)) == null ? void 0 : x[0]) || "#d9d9d9",
|
|
4038
|
+
borderWidth: (f = (y = C.borderLeft) == null ? void 0 : y.match(/(\d+)px/)) != null && f[1] ? parseInt(C.borderLeft.match(/(\d+)px/)[1], 10) : 1,
|
|
4039
|
+
backgroundColor: C.backgroundColor || "#ffffff",
|
|
4040
|
+
textAlign: C.textAlign || "left",
|
|
4041
|
+
verticalAlign: C.verticalAlign || "middle"
|
|
4042
4042
|
};
|
|
4043
4043
|
i($), a({ borderColor: $.borderColor, borderWidth: $.borderWidth });
|
|
4044
4044
|
} else
|
|
@@ -4048,17 +4048,17 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4048
4048
|
return () => {
|
|
4049
4049
|
document.body.style.overflow = "";
|
|
4050
4050
|
};
|
|
4051
|
-
}, [e,
|
|
4051
|
+
}, [e, w]);
|
|
4052
4052
|
const S = E(() => {
|
|
4053
4053
|
d || (n.commands.focus(), t(!1));
|
|
4054
4054
|
}, [d, n, t]), u = E(() => {
|
|
4055
4055
|
if (d)
|
|
4056
4056
|
return;
|
|
4057
|
-
const { state: h, dispatch: x } = n.view, { selection:
|
|
4057
|
+
const { state: h, dispatch: x } = n.view, { selection: y } = h, f = y, C = h.tr;
|
|
4058
4058
|
let $ = !1;
|
|
4059
|
-
const P = s.borderColor !== l.borderColor || s.borderWidth !== l.borderWidth,
|
|
4060
|
-
const re = V + 1, oe = Or(K, B.row, B.col, F, q,
|
|
4061
|
-
if (
|
|
4059
|
+
const P = s.borderColor !== l.borderColor || s.borderWidth !== l.borderWidth, N = `${s.borderWidth}px solid ${s.borderColor}`, A = (K, W, B, F, V, q) => {
|
|
4060
|
+
const re = V + 1, oe = Or(K, B.row, B.col, F, q, N, s.backgroundColor, s.textAlign, s.verticalAlign, P);
|
|
4061
|
+
if (C.setNodeMarkup(W, null, oe), $ = !0, !P) return;
|
|
4062
4062
|
const Me = K.attrs.colspan || 1, se = K.attrs.rowspan || 1, ge = "1px solid #d9d9d9", pe = /* @__PURE__ */ new Map();
|
|
4063
4063
|
for (let Y = 0; Y < F.height; Y++)
|
|
4064
4064
|
for (let ie = 0; ie < F.width; ie++) {
|
|
@@ -4066,46 +4066,46 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4066
4066
|
pe.has(j) || pe.set(j, { row: Y, col: ie });
|
|
4067
4067
|
}
|
|
4068
4068
|
if (B.col > 0) {
|
|
4069
|
-
const Y = F.map[B.row * F.width + B.col - 1], ie = re + Y, j =
|
|
4069
|
+
const Y = F.map[B.row * F.width + B.col - 1], ie = re + Y, j = C.doc.nodeAt(ie);
|
|
4070
4070
|
if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
|
|
4071
4071
|
const Z = pe.get(Y);
|
|
4072
4072
|
if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "right")) {
|
|
4073
4073
|
const Ne = mt(j, Z.row, Z.col, F, q, ge, "right", oe.borderLeft);
|
|
4074
|
-
|
|
4074
|
+
C.setNodeMarkup(ie, null, Ne);
|
|
4075
4075
|
}
|
|
4076
4076
|
}
|
|
4077
4077
|
}
|
|
4078
4078
|
if (B.row > 0) {
|
|
4079
|
-
const Y = F.map[(B.row - 1) * F.width + B.col], ie = re + Y, j =
|
|
4079
|
+
const Y = F.map[(B.row - 1) * F.width + B.col], ie = re + Y, j = C.doc.nodeAt(ie);
|
|
4080
4080
|
if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
|
|
4081
4081
|
const Z = pe.get(Y);
|
|
4082
4082
|
if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "bottom")) {
|
|
4083
4083
|
const Ne = mt(j, Z.row, Z.col, F, q, ge, "bottom", oe.borderTop);
|
|
4084
|
-
|
|
4084
|
+
C.setNodeMarkup(ie, null, Ne);
|
|
4085
4085
|
}
|
|
4086
4086
|
}
|
|
4087
4087
|
}
|
|
4088
4088
|
if (B.col + (K.attrs.colspan || 1) < F.width) {
|
|
4089
|
-
const Y = F.map[B.row * F.width + B.col + Me], ie = re + Y, j =
|
|
4089
|
+
const Y = F.map[B.row * F.width + B.col + Me], ie = re + Y, j = C.doc.nodeAt(ie);
|
|
4090
4090
|
if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
|
|
4091
4091
|
const Z = pe.get(Y);
|
|
4092
4092
|
if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "left")) {
|
|
4093
4093
|
const Ne = mt(j, Z.row, Z.col, F, q, ge, "left", oe.borderRight);
|
|
4094
|
-
|
|
4094
|
+
C.setNodeMarkup(ie, null, Ne);
|
|
4095
4095
|
}
|
|
4096
4096
|
}
|
|
4097
4097
|
}
|
|
4098
4098
|
if (B.row + (K.attrs.rowspan || 1) < F.height) {
|
|
4099
|
-
const Y = F.map[(B.row + se) * F.width + B.col], ie = re + Y, j =
|
|
4099
|
+
const Y = F.map[(B.row + se) * F.width + B.col], ie = re + Y, j = C.doc.nodeAt(ie);
|
|
4100
4100
|
if (j && (j.type.name === "tableCell" || j.type.name === "tableHeader")) {
|
|
4101
4101
|
const Z = pe.get(Y);
|
|
4102
4102
|
if (Z && !Se(Z.row, Z.col, j.attrs.colspan || 1, j.attrs.rowspan || 1, F, "top")) {
|
|
4103
4103
|
const Ne = mt(j, Z.row, Z.col, F, q, ge, "top", oe.borderBottom);
|
|
4104
|
-
|
|
4104
|
+
C.setNodeMarkup(ie, null, Ne);
|
|
4105
4105
|
}
|
|
4106
4106
|
}
|
|
4107
4107
|
}
|
|
4108
|
-
}, { $from: O, $to: z } =
|
|
4108
|
+
}, { $from: O, $to: z } = y;
|
|
4109
4109
|
let G = -1, J = null;
|
|
4110
4110
|
if (h.doc.nodesBetween(O.pos, z.pos, (K, W) => K.type.name === "table" ? (G = W, J = K, !1) : !0), J && G >= 0) {
|
|
4111
4111
|
const K = $r(J), W = Te.get(J), B = G + 1, F = /* @__PURE__ */ new Map();
|
|
@@ -4114,8 +4114,8 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4114
4114
|
const re = W.map[V * W.width + q];
|
|
4115
4115
|
F.has(re) || F.set(re, { row: V, col: q });
|
|
4116
4116
|
}
|
|
4117
|
-
if ("$anchorCell" in
|
|
4118
|
-
const V =
|
|
4117
|
+
if ("$anchorCell" in y && y.$anchorCell) {
|
|
4118
|
+
const V = y.$anchorCell, q = y.$headCell, re = V.pos - B, oe = q.pos - B, Me = W.rectBetween(re, oe);
|
|
4119
4119
|
W.cellsInRect(Me).forEach((ge) => {
|
|
4120
4120
|
const pe = B + ge, Y = h.doc.nodeAt(pe);
|
|
4121
4121
|
if (Y && (Y.type.name === "tableCell" || Y.type.name === "tableHeader")) {
|
|
@@ -4132,7 +4132,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4132
4132
|
return !0;
|
|
4133
4133
|
});
|
|
4134
4134
|
}
|
|
4135
|
-
$ && x && (
|
|
4135
|
+
$ && x && (C.setSelection(f.map(C.doc, C.mapping)), x(C), n.commands.focus()), t(!1);
|
|
4136
4136
|
}, [d, n, s, l, t]);
|
|
4137
4137
|
return e ? tt(
|
|
4138
4138
|
/* @__PURE__ */ c("div", { className: "tp-modal-overlay", onMouseDown: (h) => {
|
|
@@ -4241,30 +4241,33 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4241
4241
|
document.body
|
|
4242
4242
|
) : null;
|
|
4243
4243
|
}, Br = ({ manager: n, visible: e, onVisibleChange: t }) => {
|
|
4244
|
-
const r = Ve.getInstance(), [o, s] = D([]), [i, l] = D(""), [a, d] = D(null), [p, b] = D(!1), T = H(null), m = H(null), k = H(null),
|
|
4244
|
+
const r = Ve.getInstance(), [o, s] = D([]), [i, l] = D(""), [a, d] = D(null), [p, b] = D(!1), T = H(null), m = H(null), k = H(null), w = E((f, C) => r.t(f, C) || f, [r]), S = E((f) => {
|
|
4245
4245
|
try {
|
|
4246
|
-
const
|
|
4247
|
-
return
|
|
4246
|
+
const C = new Date(f), P = (/* @__PURE__ */ new Date()).getTime() - C.getTime(), N = Math.floor(P / 6e4), A = Math.floor(P / 36e5), O = Math.floor(P / 864e5);
|
|
4247
|
+
return N < 1 ? w("compare.justNow") : N < 60 ? w("compare.minutesAgo", { n: String(N) }) : A < 24 ? w("compare.hoursAgo", { n: String(A) }) : O < 7 ? w("compare.daysAgo", { n: String(O) }) : C.toLocaleDateString() + " " + C.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" });
|
|
4248
4248
|
} catch {
|
|
4249
4249
|
return f;
|
|
4250
4250
|
}
|
|
4251
|
-
}, [
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4251
|
+
}, [w]), u = E((f) => {
|
|
4252
|
+
const C = {
|
|
4253
|
+
blur: "compare.sourceBlur",
|
|
4254
|
+
baseline: "compare.sourceBaseline",
|
|
4255
|
+
paste: "compare.sourcePaste",
|
|
4256
|
+
import: "compare.sourceImport",
|
|
4257
|
+
manual: "compare.sourceManual",
|
|
4258
|
+
interval: "compare.sourceInterval",
|
|
4259
|
+
imported: "compare.sourceImported"
|
|
4260
|
+
};
|
|
4261
|
+
return C[f] ? w(C[f]) : f;
|
|
4262
|
+
}, [w]), h = E((f, C) => `v${o.length - C}.0 - ${S(f.timestamp)} (${u(f.source)})${f.label ? ` - ${f.label}` : ""}`, [S, u, o]);
|
|
4260
4263
|
_(() => {
|
|
4261
4264
|
if (!e) {
|
|
4262
4265
|
l(""), d(null);
|
|
4263
4266
|
return;
|
|
4264
4267
|
}
|
|
4265
4268
|
let f = !1;
|
|
4266
|
-
return b(!0), n.listVersions().then((
|
|
4267
|
-
f || (s(
|
|
4269
|
+
return b(!0), n.listVersions().then((C) => {
|
|
4270
|
+
f || (s(C), !i && C.length > 0 && l(C[0].id), b(!1));
|
|
4268
4271
|
}).catch(() => {
|
|
4269
4272
|
f || (s([]), b(!1));
|
|
4270
4273
|
}), () => {
|
|
@@ -4277,7 +4280,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4277
4280
|
}
|
|
4278
4281
|
n.compareWithVersion(i).then(d).catch(() => d(null));
|
|
4279
4282
|
}, [i, n]), _(() => {
|
|
4280
|
-
var f,
|
|
4283
|
+
var f, C;
|
|
4281
4284
|
if (a && T.current && m.current) {
|
|
4282
4285
|
(f = k.current) == null || f.detach();
|
|
4283
4286
|
const $ = new Dn(T.current, m.current);
|
|
@@ -4287,19 +4290,19 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4287
4290
|
clearTimeout(P), $.detach();
|
|
4288
4291
|
};
|
|
4289
4292
|
} else
|
|
4290
|
-
(
|
|
4293
|
+
(C = k.current) == null || C.detach(), k.current = null;
|
|
4291
4294
|
}, [a]), _(() => {
|
|
4292
|
-
const f = (
|
|
4293
|
-
|
|
4295
|
+
const f = (C) => {
|
|
4296
|
+
C.key === "Escape" && e && t(!1);
|
|
4294
4297
|
};
|
|
4295
4298
|
return document.addEventListener("keydown", f), () => document.removeEventListener("keydown", f);
|
|
4296
4299
|
}, [e, t]);
|
|
4297
4300
|
const x = E(async () => {
|
|
4298
|
-
const f = await n.createSnapshot(
|
|
4299
|
-
f ? yt(
|
|
4300
|
-
const
|
|
4301
|
-
s(
|
|
4302
|
-
}, [n,
|
|
4301
|
+
const f = await n.createSnapshot(w("compare.createSnapshot"));
|
|
4302
|
+
f ? yt(w("compare.snapshotCreated").replace("{time}", f.label || f.timestamp)) : yt({ message: w("compare.snapshotFailed"), type: "error" });
|
|
4303
|
+
const C = await n.listVersions();
|
|
4304
|
+
s(C);
|
|
4305
|
+
}, [n, w]), y = E(() => {
|
|
4303
4306
|
t(!1);
|
|
4304
4307
|
}, [t]);
|
|
4305
4308
|
return e ? /* @__PURE__ */ v("div", { className: "cyte-compare-overlay", children: [
|
|
@@ -4312,12 +4315,12 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4312
4315
|
/* @__PURE__ */ c("line", { x1: "10", y1: "12", x2: "14", y2: "12" }),
|
|
4313
4316
|
/* @__PURE__ */ c("line", { x1: "10", y1: "16", x2: "14", y2: "16" })
|
|
4314
4317
|
] }),
|
|
4315
|
-
|
|
4318
|
+
w("compare.title")
|
|
4316
4319
|
] }),
|
|
4317
4320
|
/* @__PURE__ */ v("div", { className: "cyte-compare-header__actions", children: [
|
|
4318
4321
|
/* @__PURE__ */ v("div", { className: "cyte-compare-version-selector", children: [
|
|
4319
4322
|
/* @__PURE__ */ v("span", { className: "cyte-compare-version-selector__label", children: [
|
|
4320
|
-
|
|
4323
|
+
w("compare.selectVersion"),
|
|
4321
4324
|
":"
|
|
4322
4325
|
] }),
|
|
4323
4326
|
/* @__PURE__ */ v(
|
|
@@ -4327,13 +4330,13 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4327
4330
|
onChange: (f) => l(f.target.value),
|
|
4328
4331
|
className: "cyte-compare-version-selector__select",
|
|
4329
4332
|
children: [
|
|
4330
|
-
/* @__PURE__ */ c("option", { value: "", disabled: !0, children:
|
|
4331
|
-
o.map((f,
|
|
4333
|
+
/* @__PURE__ */ c("option", { value: "", disabled: !0, children: w("compare.selectVersion") }),
|
|
4334
|
+
o.map((f, C) => /* @__PURE__ */ c("option", { value: f.id, children: h(f, C) }, f.id))
|
|
4332
4335
|
]
|
|
4333
4336
|
}
|
|
4334
4337
|
)
|
|
4335
4338
|
] }),
|
|
4336
|
-
/* @__PURE__ */ c("button", { className: "cyte-compare-btn--close", onClick:
|
|
4339
|
+
/* @__PURE__ */ c("button", { className: "cyte-compare-btn--close", onClick: y, title: w("compare.close"), children: "✕" })
|
|
4337
4340
|
] })
|
|
4338
4341
|
] }),
|
|
4339
4342
|
a && /* @__PURE__ */ v("div", { className: "cyte-compare-stats", children: [
|
|
@@ -4342,28 +4345,28 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4342
4345
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--added" }),
|
|
4343
4346
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__count cyte-compare-stats__count--added", children: a.stats.added })
|
|
4344
4347
|
] }),
|
|
4345
|
-
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children:
|
|
4348
|
+
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children: w("compare.statsAdded") })
|
|
4346
4349
|
] }),
|
|
4347
4350
|
/* @__PURE__ */ v("div", { className: "cyte-compare-stats__item", children: [
|
|
4348
4351
|
/* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
|
|
4349
4352
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--removed" }),
|
|
4350
4353
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__count cyte-compare-stats__count--removed", children: a.stats.removed })
|
|
4351
4354
|
] }),
|
|
4352
|
-
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children:
|
|
4355
|
+
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children: w("compare.statsRemoved") })
|
|
4353
4356
|
] }),
|
|
4354
4357
|
/* @__PURE__ */ v("div", { className: "cyte-compare-stats__item", children: [
|
|
4355
4358
|
/* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
|
|
4356
4359
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--modified" }),
|
|
4357
4360
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__count cyte-compare-stats__count--modified", children: a.stats.modified })
|
|
4358
4361
|
] }),
|
|
4359
|
-
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children:
|
|
4362
|
+
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children: w("compare.statsModified") })
|
|
4360
4363
|
] }),
|
|
4361
4364
|
/* @__PURE__ */ v("div", { className: "cyte-compare-stats__item cyte-compare-stats__item--unchanged", children: [
|
|
4362
4365
|
/* @__PURE__ */ v("span", { className: "cyte-compare-stats__badge", children: [
|
|
4363
4366
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__dot cyte-compare-stats__dot--unchanged" }),
|
|
4364
4367
|
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__count", children: a.stats.unchanged })
|
|
4365
4368
|
] }),
|
|
4366
|
-
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children:
|
|
4369
|
+
/* @__PURE__ */ c("span", { className: "cyte-compare-stats__label", children: w("compare.statsUnchanged") })
|
|
4367
4370
|
] })
|
|
4368
4371
|
] }),
|
|
4369
4372
|
/* @__PURE__ */ v("div", { className: "cyte-compare-content", children: [
|
|
@@ -4372,15 +4375,15 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4372
4375
|
/* @__PURE__ */ c("circle", { cx: "12", cy: "12", r: "10" }),
|
|
4373
4376
|
/* @__PURE__ */ c("path", { d: "M8 12h8M12 8v8" })
|
|
4374
4377
|
] }),
|
|
4375
|
-
/* @__PURE__ */ c("div", { className: "cyte-compare-empty__text", children:
|
|
4376
|
-
/* @__PURE__ */ c("div", { className: "cyte-compare-empty__hint", children:
|
|
4377
|
-
/* @__PURE__ */ c("button", { className: "cyte-compare-btn cyte-compare-btn--primary cyte-compare-snapshot-btn", onClick: x, children:
|
|
4378
|
+
/* @__PURE__ */ c("div", { className: "cyte-compare-empty__text", children: w("compare.noVersions") }),
|
|
4379
|
+
/* @__PURE__ */ c("div", { className: "cyte-compare-empty__hint", children: w("compare.noVersionsHint") }),
|
|
4380
|
+
/* @__PURE__ */ c("button", { className: "cyte-compare-btn cyte-compare-btn--primary cyte-compare-snapshot-btn", onClick: x, children: w("compare.createSnapshot") })
|
|
4378
4381
|
] }),
|
|
4379
4382
|
a && /* @__PURE__ */ v(Ft, { children: [
|
|
4380
4383
|
/* @__PURE__ */ v("div", { ref: T, className: "cyte-compare-pane", children: [
|
|
4381
4384
|
/* @__PURE__ */ c("div", { className: "cyte-compare-pane__header", children: (() => {
|
|
4382
|
-
const f = o.findIndex((
|
|
4383
|
-
return f === -1 ?
|
|
4385
|
+
const f = o.findIndex((C) => C.id === i);
|
|
4386
|
+
return f === -1 ? w("compare.leftLabel") : `${w("compare.leftLabel")} - ${h(o[f], f)}`;
|
|
4384
4387
|
})() }),
|
|
4385
4388
|
/* @__PURE__ */ c("div", { className: "cyte-compare-pane__body", children: a.left.map((f) => /* @__PURE__ */ c(
|
|
4386
4389
|
"div",
|
|
@@ -4391,7 +4394,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4391
4394
|
)) })
|
|
4392
4395
|
] }),
|
|
4393
4396
|
/* @__PURE__ */ v("div", { ref: m, className: "cyte-compare-pane", children: [
|
|
4394
|
-
/* @__PURE__ */ c("div", { className: "cyte-compare-pane__header", children:
|
|
4397
|
+
/* @__PURE__ */ c("div", { className: "cyte-compare-pane__header", children: w("compare.rightLabel") }),
|
|
4395
4398
|
/* @__PURE__ */ c("div", { className: "cyte-compare-pane__body", children: a.right.map((f) => /* @__PURE__ */ c(
|
|
4396
4399
|
"div",
|
|
4397
4400
|
{
|
|
@@ -4401,7 +4404,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4401
4404
|
)) })
|
|
4402
4405
|
] })
|
|
4403
4406
|
] }),
|
|
4404
|
-
o.length > 0 && !i && !a && /* @__PURE__ */ c("div", { className: "cyte-compare-empty", children: /* @__PURE__ */ c("div", { className: "cyte-compare-empty__text", children:
|
|
4407
|
+
o.length > 0 && !i && !a && /* @__PURE__ */ c("div", { className: "cyte-compare-empty", children: /* @__PURE__ */ c("div", { className: "cyte-compare-empty__text", children: w("compare.selectVersion") }) })
|
|
4405
4408
|
] })
|
|
4406
4409
|
] }) : null;
|
|
4407
4410
|
}, zr = ({ visible: n, defaultFilename: e, onConfirm: t, onCancel: r, onClose: o }) => {
|
|
@@ -4509,20 +4512,20 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4509
4512
|
disabled: T = !1,
|
|
4510
4513
|
autofocus: m = !1,
|
|
4511
4514
|
locale: k,
|
|
4512
|
-
pasteMode:
|
|
4515
|
+
pasteMode: w,
|
|
4513
4516
|
uploadUrl: S,
|
|
4514
4517
|
onChange: u,
|
|
4515
4518
|
onFocus: h,
|
|
4516
4519
|
onBlur: x,
|
|
4517
|
-
onReady:
|
|
4520
|
+
onReady: y,
|
|
4518
4521
|
onViewModeChange: f,
|
|
4519
|
-
onToolbarClick:
|
|
4522
|
+
onToolbarClick: C,
|
|
4520
4523
|
onFullscreenChange: $,
|
|
4521
4524
|
toolbarRender: P
|
|
4522
|
-
} = n, [
|
|
4525
|
+
} = n, [N, A] = D("normal"), O = H(""), z = H(null), [G, J] = D(!1), [K, W] = D({ x: 0, y: 0 }), [B, F] = D(null), [V, q] = D(!1), [re, oe] = D(!1), [Me, se] = D(!1), [ge, pe] = D(!1), [Y, ie] = D("document"), [j, Z] = D(!1), [Ne, nt] = D("document"), [Re, ze] = D(!1), je = Ve.getInstance(), Fe = E((M) => je.t(M) || M, [je]), rt = _e(() => {
|
|
4523
4526
|
const R = { ...o || {} };
|
|
4524
|
-
return s !== void 0 && (R.height = s), i !== void 0 && (R.minHeight = i), l !== void 0 && (R.maxHeight = l), a !== void 0 && (R.autoHeight = a), d !== void 0 && (R.placeholder = d), p !== void 0 && (R.toolbar = p), b !== void 0 && (R.readonly = b), T !== void 0 && (R.disabled = T), m !== void 0 && (R.autofocus = m), k !== void 0 && (R.locale = k),
|
|
4525
|
-
}, [o, s, i, l, a, d, p, b, T, m, k,
|
|
4527
|
+
return s !== void 0 && (R.height = s), i !== void 0 && (R.minHeight = i), l !== void 0 && (R.maxHeight = l), a !== void 0 && (R.autoHeight = a), d !== void 0 && (R.placeholder = d), p !== void 0 && (R.toolbar = p), b !== void 0 && (R.readonly = b), T !== void 0 && (R.disabled = T), m !== void 0 && (R.autofocus = m), k !== void 0 && (R.locale = k), w !== void 0 && (R.paste = { ...R.paste, mode: w }), S !== void 0 && (R.upload = { ...R.upload, url: S }), R;
|
|
4528
|
+
}, [o, s, i, l, a, d, p, b, T, m, k, w, S]), Ct = _e(() => rt.toolbar || [
|
|
4526
4529
|
// A: 历史操作
|
|
4527
4530
|
"undo",
|
|
4528
4531
|
"redo",
|
|
@@ -4583,7 +4586,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4583
4586
|
x == null || x(M);
|
|
4584
4587
|
},
|
|
4585
4588
|
onReady(M) {
|
|
4586
|
-
t ? M.setContent(t) : r && M.setJSON(r), at(M),
|
|
4589
|
+
t ? M.setContent(t) : r && M.setJSON(r), at(M), y == null || y(M);
|
|
4587
4590
|
}
|
|
4588
4591
|
}), { activeStates: fe, disabledStates: ot } = rr(g);
|
|
4589
4592
|
_(() => {
|
|
@@ -4620,18 +4623,18 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4620
4623
|
}, []), Ye = E((M) => {
|
|
4621
4624
|
if (!g) return;
|
|
4622
4625
|
const R = g.getEditor();
|
|
4623
|
-
if (
|
|
4626
|
+
if (N === M) {
|
|
4624
4627
|
ae();
|
|
4625
4628
|
return;
|
|
4626
4629
|
}
|
|
4627
|
-
|
|
4630
|
+
N !== "normal" ? ae() : (O.current = g.getHTML(), z.current = g.getJSON());
|
|
4628
4631
|
const U = M === "html" ? g.getHTML() : JSON.stringify(g.getJSON(), null, 2), ce = M === "html" ? qe(U) : U;
|
|
4629
4632
|
R.commands.clearContent(), R.commands.insertContent({ type: "codeBlock", attrs: { language: M === "html" ? "html" : "json" }, content: [{ type: "text", text: ce }] }), A(M), f == null || f(M);
|
|
4630
|
-
}, [g,
|
|
4633
|
+
}, [g, N, qe, f]), ae = E(() => {
|
|
4631
4634
|
if (!g) return;
|
|
4632
4635
|
const M = g.getEditor();
|
|
4633
|
-
if (
|
|
4634
|
-
const R = M.getText(), U =
|
|
4636
|
+
if (N !== "normal") {
|
|
4637
|
+
const R = M.getText(), U = N;
|
|
4635
4638
|
if (R)
|
|
4636
4639
|
try {
|
|
4637
4640
|
if (U === "html") {
|
|
@@ -4650,7 +4653,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4650
4653
|
} else
|
|
4651
4654
|
z.current ? M.commands.setContent(z.current) : O.current && M.commands.setContent(O.current);
|
|
4652
4655
|
A("normal"), f == null || f("normal");
|
|
4653
|
-
}, [g,
|
|
4656
|
+
}, [g, N, f]), at = E((M) => {
|
|
4654
4657
|
const R = M.getEditor();
|
|
4655
4658
|
R.view.dom.addEventListener("contextmenu", (U) => {
|
|
4656
4659
|
const le = U.target.closest("td, th");
|
|
@@ -4679,7 +4682,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4679
4682
|
J(!1), F(null), qt();
|
|
4680
4683
|
});
|
|
4681
4684
|
}, [G]), Nt = E((M) => {
|
|
4682
|
-
if (
|
|
4685
|
+
if (C == null || C(M), M === "snapshot") {
|
|
4683
4686
|
g == null || g.createSnapshot().then((R) => {
|
|
4684
4687
|
R ? yt(je.t("compare.snapshotCreated", { time: R.label || R.timestamp })) : yt({ message: je.t("compare.snapshotFailed"), type: "error" });
|
|
4685
4688
|
});
|
|
@@ -4702,7 +4705,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4702
4705
|
}, R.click();
|
|
4703
4706
|
}
|
|
4704
4707
|
M === "exportWord" && (ie((g == null ? void 0 : g.getDocumentTitle()) || "document"), pe(!0)), M === "exportMarkdown" && (nt((g == null ? void 0 : g.getDocumentTitle()) || "document"), Z(!0));
|
|
4705
|
-
}, [
|
|
4708
|
+
}, [C, g]), Ge = E((M) => {
|
|
4706
4709
|
if (!g) return;
|
|
4707
4710
|
const R = g.getEditor();
|
|
4708
4711
|
switch ("$anchorCell" in R.state.selection || (jt(R), qt()), M) {
|
|
@@ -4837,10 +4840,10 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4837
4840
|
addSnapshot: (M, R) => (g == null ? void 0 : g.addSnapshot(M, R)) ?? Promise.resolve(null),
|
|
4838
4841
|
toggleViewMode: Ye,
|
|
4839
4842
|
restoreOriginalContent: ae,
|
|
4840
|
-
getViewMode: () =>
|
|
4843
|
+
getViewMode: () => N,
|
|
4841
4844
|
toggleFullscreen: $e,
|
|
4842
4845
|
isFullscreen: () => Re
|
|
4843
|
-
}), [g, Ye, ae,
|
|
4846
|
+
}), [g, Ye, ae, N, $e, Re]), /* @__PURE__ */ v(
|
|
4844
4847
|
"div",
|
|
4845
4848
|
{
|
|
4846
4849
|
className: `cyte-editor${T ? " is-disabled" : ""}${b ? " is-readonly" : ""}${L ? " is-focused" : ""}${I ? " is-empty" : ""}${a ? " is-auto-height" : ""}${a && l ? " is-auto-height-limited" : ""}${Re ? " is-fullscreen" : ""}`,
|
|
@@ -4869,7 +4872,7 @@ const Hr = ({ editor: n, visible: e, onVisibleChange: t }) => {
|
|
|
4869
4872
|
manager: g,
|
|
4870
4873
|
activeStates: fe,
|
|
4871
4874
|
disabledStates: ot,
|
|
4872
|
-
viewMode:
|
|
4875
|
+
viewMode: N,
|
|
4873
4876
|
onToggleViewMode: Ye,
|
|
4874
4877
|
onToolbarClick: Nt
|
|
4875
4878
|
}
|