@yungu-fed/rich-text-editor 0.1.2 → 0.1.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/README.md +3 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1805 -1315
- package/dist/index.mjs +1240 -895
- package/dist/rich-text-editor/index.d.ts +1 -1
- package/dist/rich-text-editor/index.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/Editor.d.ts +1 -1
- package/dist/rich-text-editor/primitives/Editor.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/ImageObject.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/codecs.d.ts +4 -1
- package/dist/rich-text-editor/primitives/codecs.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/featureDefinitions.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/featureRegistry.d.ts +17 -0
- package/dist/rich-text-editor/primitives/featureRegistry.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/index.d.ts +1 -1
- package/dist/rich-text-editor/primitives/index.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/slateRuntime.d.ts +4 -1
- package/dist/rich-text-editor/primitives/slateRuntime.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/slateTypes.d.ts +1 -0
- package/dist/rich-text-editor/primitives/slateTypes.d.ts.map +1 -1
- package/dist/rich-text-editor/primitives/types.d.ts +38 -0
- package/dist/rich-text-editor/primitives/types.d.ts.map +1 -1
- package/dist/rich-text-editor/styled/Editor.d.ts.map +1 -1
- package/dist/rich-text-editor/styled/ImageButton.d.ts.map +1 -1
- package/package.json +6 -11
package/dist/index.mjs
CHANGED
|
@@ -7060,12 +7060,14 @@ function Du({ element: e, focused: t, selected: n, updateElement: r }) {
|
|
|
7060
7060
|
style: Ou(u),
|
|
7061
7061
|
children: c ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x("img", {
|
|
7062
7062
|
alt: l,
|
|
7063
|
+
draggable: !1,
|
|
7063
7064
|
ref: m,
|
|
7064
7065
|
src: c,
|
|
7065
7066
|
style: ku(u)
|
|
7066
7067
|
}), f ? /* @__PURE__ */ x("span", {
|
|
7067
7068
|
"aria-hidden": "true",
|
|
7068
7069
|
className: at["image-resize-handle"],
|
|
7070
|
+
draggable: !1,
|
|
7069
7071
|
onMouseDown: (e) => {
|
|
7070
7072
|
var t;
|
|
7071
7073
|
e.preventDefault(), e.stopPropagation();
|
|
@@ -7239,52 +7241,52 @@ function Xu(e) {
|
|
|
7239
7241
|
//#endregion
|
|
7240
7242
|
//#region src/rich-text-editor/primitives/slateTypes.ts
|
|
7241
7243
|
function Zu(e) {
|
|
7242
|
-
return e.map(
|
|
7244
|
+
return e.map(rd);
|
|
7243
7245
|
}
|
|
7244
7246
|
function Qu(e) {
|
|
7245
|
-
return e.map(
|
|
7247
|
+
return e.map(id);
|
|
7246
7248
|
}
|
|
7247
7249
|
function $u(e) {
|
|
7248
|
-
return
|
|
7250
|
+
return rd(e);
|
|
7249
7251
|
}
|
|
7250
7252
|
function ed(e) {
|
|
7251
7253
|
return e.map($u);
|
|
7252
7254
|
}
|
|
7253
7255
|
function td(e) {
|
|
7254
|
-
return
|
|
7256
|
+
return sd(e);
|
|
7255
7257
|
}
|
|
7256
7258
|
function nd(e) {
|
|
7257
|
-
return
|
|
7259
|
+
return id(e);
|
|
7258
7260
|
}
|
|
7259
|
-
function
|
|
7261
|
+
function Q(e) {
|
|
7260
7262
|
return !!(e && typeof e == "object" && "type" in e && "children" in e);
|
|
7261
7263
|
}
|
|
7262
|
-
function
|
|
7263
|
-
return
|
|
7264
|
-
children: e.children.map(
|
|
7264
|
+
function rd(e) {
|
|
7265
|
+
return ad(e) ? sd(e) : I(I({}, od(e)), {}, {
|
|
7266
|
+
children: e.children.map(rd),
|
|
7265
7267
|
type: e.type
|
|
7266
7268
|
});
|
|
7267
7269
|
}
|
|
7268
|
-
function
|
|
7269
|
-
if (
|
|
7270
|
+
function id(e) {
|
|
7271
|
+
if (ad(e)) return sd(e);
|
|
7270
7272
|
let t = e;
|
|
7271
|
-
return I(I({},
|
|
7272
|
-
children: t.children.map(
|
|
7273
|
+
return I(I({}, od(t)), {}, {
|
|
7274
|
+
children: t.children.map(id),
|
|
7273
7275
|
type: t.type
|
|
7274
7276
|
});
|
|
7275
7277
|
}
|
|
7276
|
-
function
|
|
7278
|
+
function ad(e) {
|
|
7277
7279
|
return !!(e && typeof e == "object" && "text" in e && typeof e.text == "string");
|
|
7278
7280
|
}
|
|
7279
|
-
function
|
|
7280
|
-
return Object.entries(e).filter(([e]) => e !== "children").reduce((e, [t, n]) => I(I({}, e), {}, { [t]:
|
|
7281
|
+
function od(e) {
|
|
7282
|
+
return Object.entries(e).filter(([e]) => e !== "children").reduce((e, [t, n]) => I(I({}, e), {}, { [t]: sd(n) }), {});
|
|
7281
7283
|
}
|
|
7282
|
-
function
|
|
7283
|
-
return Array.isArray(e) ? e.map(
|
|
7284
|
+
function sd(e) {
|
|
7285
|
+
return Array.isArray(e) ? e.map(sd) : !e || typeof e != "object" ? e : Object.entries(e).reduce((e, [t, n]) => I(I({}, e), {}, { [t]: sd(n) }), {});
|
|
7284
7286
|
}
|
|
7285
7287
|
//#endregion
|
|
7286
7288
|
//#region src/rich-text-editor/i18n.tsx
|
|
7287
|
-
var
|
|
7289
|
+
var cd = "zh-CN", ld = {
|
|
7288
7290
|
contentPlaceholder: "Write rich content...",
|
|
7289
7291
|
formulaButton: "Formula",
|
|
7290
7292
|
formulaDialogCancel: "Cancel",
|
|
@@ -7329,7 +7331,7 @@ var ld = "zh-CN", ud = {
|
|
|
7329
7331
|
toolbarTextColor: "Text color",
|
|
7330
7332
|
toolbarUnderline: "Underline",
|
|
7331
7333
|
toolbarUndo: "Undo"
|
|
7332
|
-
},
|
|
7334
|
+
}, ud = {
|
|
7333
7335
|
contentPlaceholder: "\u8bf7\u8f93\u5165\u5bcc\u6587\u672c\u5185\u5bb9...",
|
|
7334
7336
|
formulaButton: "\u516c\u5f0f",
|
|
7335
7337
|
formulaDialogCancel: "\u53d6\u6d88",
|
|
@@ -7374,142 +7376,142 @@ var ld = "zh-CN", ud = {
|
|
|
7374
7376
|
toolbarTextColor: "\u6587\u5b57\u989c\u8272",
|
|
7375
7377
|
toolbarUnderline: "\u4e0b\u5212\u7ebf",
|
|
7376
7378
|
toolbarUndo: "\u64a4\u9500"
|
|
7377
|
-
},
|
|
7378
|
-
locale:
|
|
7379
|
-
messages:
|
|
7379
|
+
}, dd = o({
|
|
7380
|
+
locale: cd,
|
|
7381
|
+
messages: hd(cd)
|
|
7380
7382
|
});
|
|
7381
|
-
function
|
|
7383
|
+
function fd({ children: e, locale: t = cd, messages: n }) {
|
|
7382
7384
|
let r = g(() => ({
|
|
7383
7385
|
locale: t,
|
|
7384
|
-
messages: I(I({},
|
|
7386
|
+
messages: I(I({}, hd(t)), n)
|
|
7385
7387
|
}), [t, n]);
|
|
7386
|
-
return /* @__PURE__ */ x(
|
|
7388
|
+
return /* @__PURE__ */ x(dd.Provider, {
|
|
7387
7389
|
value: r,
|
|
7388
7390
|
children: e
|
|
7389
7391
|
});
|
|
7390
7392
|
}
|
|
7391
|
-
function
|
|
7392
|
-
return f(
|
|
7393
|
+
function pd() {
|
|
7394
|
+
return f(dd);
|
|
7393
7395
|
}
|
|
7394
|
-
function
|
|
7396
|
+
function md(e, t) {
|
|
7395
7397
|
if (!t) return;
|
|
7396
7398
|
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
7397
7399
|
return typeof (n == null ? void 0 : n.value) == "string" ? n.value : void 0;
|
|
7398
7400
|
}
|
|
7399
|
-
function
|
|
7400
|
-
return e === "en-US" ?
|
|
7401
|
+
function hd(e) {
|
|
7402
|
+
return e === "en-US" ? ld : ud;
|
|
7401
7403
|
}
|
|
7402
|
-
var
|
|
7404
|
+
var gd = {
|
|
7403
7405
|
table: "_table_s6kc0_1",
|
|
7404
7406
|
cell: "_cell_s6kc0_11",
|
|
7405
7407
|
menu: "_menu_s6kc0_29",
|
|
7406
7408
|
separator: "_separator_s6kc0_60"
|
|
7407
|
-
},
|
|
7408
|
-
function
|
|
7409
|
+
}, _d = "table", vd = "table-row", yd = "table-cell";
|
|
7410
|
+
function bd(e = "") {
|
|
7409
7411
|
return {
|
|
7410
7412
|
children: [{ text: e }],
|
|
7411
7413
|
type: "paragraph"
|
|
7412
7414
|
};
|
|
7413
7415
|
}
|
|
7414
|
-
function
|
|
7416
|
+
function xd(e = [bd()]) {
|
|
7415
7417
|
return {
|
|
7416
|
-
children: e.length > 0 ? [...e] : [
|
|
7417
|
-
type:
|
|
7418
|
+
children: e.length > 0 ? [...e] : [bd()],
|
|
7419
|
+
type: yd
|
|
7418
7420
|
};
|
|
7419
7421
|
}
|
|
7420
|
-
function
|
|
7422
|
+
function Sd(e = 3) {
|
|
7421
7423
|
return {
|
|
7422
|
-
children: Array.from({ length: Math.max(Number(e) || 1, 1) }, () =>
|
|
7423
|
-
type:
|
|
7424
|
+
children: Array.from({ length: Math.max(Number(e) || 1, 1) }, () => xd()),
|
|
7425
|
+
type: vd
|
|
7424
7426
|
};
|
|
7425
7427
|
}
|
|
7426
|
-
function
|
|
7428
|
+
function Cd(e = 3, t = 3) {
|
|
7427
7429
|
return {
|
|
7428
|
-
children: Array.from({ length: Math.max(Number(e) || 1, 1) }, () =>
|
|
7429
|
-
type:
|
|
7430
|
+
children: Array.from({ length: Math.max(Number(e) || 1, 1) }, () => Sd(t)),
|
|
7431
|
+
type: _d
|
|
7430
7432
|
};
|
|
7431
7433
|
}
|
|
7432
|
-
function
|
|
7434
|
+
function wd(e) {
|
|
7433
7435
|
let t = Array.from(e.querySelectorAll("tr")).map((e) => Array.from(e.children).filter((e) => e.tagName === "TD" || e.tagName === "TH").map((e) => {
|
|
7434
7436
|
var t;
|
|
7435
7437
|
return String((t = e.textContent) == null ? "" : t).replace(/\s+/g, " ").trim();
|
|
7436
7438
|
}).filter(Boolean).join(" | ")).filter(Boolean);
|
|
7437
|
-
return t.length > 0 ? t.map((e) =>
|
|
7439
|
+
return t.length > 0 ? t.map((e) => bd(e)) : null;
|
|
7438
7440
|
}
|
|
7439
|
-
function
|
|
7441
|
+
function Td(e, t) {
|
|
7440
7442
|
var n, r;
|
|
7441
|
-
if (
|
|
7443
|
+
if (Ad(e)) return wd(e);
|
|
7442
7444
|
let i = Array.from(e.querySelectorAll("tr"));
|
|
7443
|
-
if (i.length === 0) return
|
|
7444
|
-
let a = i.map(
|
|
7445
|
-
return o === 0 || a.some((e) => e.length !== o) ?
|
|
7445
|
+
if (i.length === 0) return wd(e);
|
|
7446
|
+
let a = i.map(jd), o = (n = (r = a[0]) == null ? void 0 : r.length) == null ? 0 : n;
|
|
7447
|
+
return o === 0 || a.some((e) => e.length !== o) ? wd(e) : [{
|
|
7446
7448
|
children: a.map((e) => ({
|
|
7447
|
-
children: e.map((e) =>
|
|
7448
|
-
type:
|
|
7449
|
+
children: e.map((e) => xd(Md(t(e)))),
|
|
7450
|
+
type: vd
|
|
7449
7451
|
})),
|
|
7450
|
-
type:
|
|
7452
|
+
type: _d
|
|
7451
7453
|
}];
|
|
7452
7454
|
}
|
|
7453
|
-
function
|
|
7454
|
-
return !
|
|
7455
|
+
function Ed(e) {
|
|
7456
|
+
return !Q(e) || e.type !== "table" ? null : Dd(e);
|
|
7455
7457
|
}
|
|
7456
|
-
function
|
|
7457
|
-
let t = e.children.map((e) =>
|
|
7458
|
+
function Dd(e) {
|
|
7459
|
+
let t = e.children.map((e) => Q(e) && e.type === "table-row" ? kd(e) : null).filter((e) => !!e);
|
|
7458
7460
|
return {
|
|
7459
|
-
children: t.length > 0 ? t : [
|
|
7460
|
-
type:
|
|
7461
|
+
children: t.length > 0 ? t : [Sd(1)],
|
|
7462
|
+
type: _d
|
|
7461
7463
|
};
|
|
7462
7464
|
}
|
|
7463
|
-
function
|
|
7464
|
-
return
|
|
7465
|
+
function Od(e) {
|
|
7466
|
+
return xd(Md(e.children));
|
|
7465
7467
|
}
|
|
7466
|
-
function
|
|
7467
|
-
let t = e.children.map((e) =>
|
|
7468
|
+
function kd(e) {
|
|
7469
|
+
let t = e.children.map((e) => Q(e) && e.type === "table-cell" ? Od(e) : null).filter((e) => !!e);
|
|
7468
7470
|
return {
|
|
7469
|
-
children: t.length > 0 ? t : [
|
|
7470
|
-
type:
|
|
7471
|
+
children: t.length > 0 ? t : [xd()],
|
|
7472
|
+
type: vd
|
|
7471
7473
|
};
|
|
7472
7474
|
}
|
|
7473
|
-
function
|
|
7475
|
+
function Ad(e) {
|
|
7474
7476
|
return e.querySelector("table") ? !0 : Array.from(e.querySelectorAll("td,th")).some((e) => {
|
|
7475
7477
|
var t, n;
|
|
7476
7478
|
let r = Number((t = e.getAttribute("colspan")) == null ? 1 : t), i = Number((n = e.getAttribute("rowspan")) == null ? 1 : n);
|
|
7477
7479
|
return r > 1 || i > 1;
|
|
7478
7480
|
});
|
|
7479
7481
|
}
|
|
7480
|
-
function
|
|
7482
|
+
function jd(e) {
|
|
7481
7483
|
return Array.from(e.children).filter((e) => e instanceof HTMLElement && (e.tagName === "TD" || e.tagName === "TH"));
|
|
7482
7484
|
}
|
|
7483
|
-
function
|
|
7484
|
-
let t = e.reduce((e, t) => G.isText(t) ? t.text.length > 0 ? [...e,
|
|
7485
|
-
return t.length > 0 ? t : [
|
|
7485
|
+
function Md(e) {
|
|
7486
|
+
let t = e.reduce((e, t) => G.isText(t) ? t.text.length > 0 ? [...e, bd(t.text)] : e : B.isElement(t) ? Q(t) && t.type === "table" ? e : [...e, t] : e, []);
|
|
7487
|
+
return t.length > 0 ? t : [bd()];
|
|
7486
7488
|
}
|
|
7487
7489
|
//#endregion
|
|
7488
7490
|
//#region src/rich-text-editor/primitives/tableCommands.ts
|
|
7489
|
-
function
|
|
7491
|
+
function Nd(e, t) {
|
|
7490
7492
|
if (!t) return null;
|
|
7491
7493
|
try {
|
|
7492
|
-
return
|
|
7494
|
+
return rf(U.above(e, {
|
|
7493
7495
|
at: t,
|
|
7494
|
-
match: (e) =>
|
|
7496
|
+
match: (e) => tf(e, yd)
|
|
7495
7497
|
}));
|
|
7496
7498
|
} catch (e) {
|
|
7497
7499
|
return null;
|
|
7498
7500
|
}
|
|
7499
7501
|
}
|
|
7500
|
-
function
|
|
7501
|
-
return e.selection ?
|
|
7502
|
+
function Pd(e) {
|
|
7503
|
+
return e.selection ? Nd(e, e.selection.anchor) : null;
|
|
7502
7504
|
}
|
|
7503
|
-
function
|
|
7505
|
+
function Fd(e) {
|
|
7504
7506
|
let { selection: t } = e;
|
|
7505
7507
|
if (!t || z.isCollapsed(t)) return !1;
|
|
7506
|
-
let n =
|
|
7508
|
+
let n = Nd(e, t.anchor), r = Nd(e, t.focus);
|
|
7507
7509
|
return !n && !r ? !1 : !n || !r ? !0 : !R.equals(n[1], r[1]);
|
|
7508
7510
|
}
|
|
7509
|
-
function
|
|
7511
|
+
function Id(e) {
|
|
7510
7512
|
let { selection: t } = e;
|
|
7511
7513
|
if (!t) return !1;
|
|
7512
|
-
let n =
|
|
7514
|
+
let n = Nd(e, t.anchor) || Nd(e, t.focus);
|
|
7513
7515
|
if (!n) return !1;
|
|
7514
7516
|
try {
|
|
7515
7517
|
return q.select(e, U.start(e, n[1])), !0;
|
|
@@ -7517,44 +7519,44 @@ function Ld(e) {
|
|
|
7517
7519
|
return !1;
|
|
7518
7520
|
}
|
|
7519
7521
|
}
|
|
7520
|
-
function
|
|
7522
|
+
function Ld(e) {
|
|
7521
7523
|
let { selection: t } = e;
|
|
7522
7524
|
if (!t || !z.isCollapsed(t)) return !1;
|
|
7523
|
-
let n =
|
|
7525
|
+
let n = Nd(e, t.anchor);
|
|
7524
7526
|
return n ? U.isStart(e, t.anchor, n[1]) : !1;
|
|
7525
7527
|
}
|
|
7526
|
-
function
|
|
7528
|
+
function Rd(e) {
|
|
7527
7529
|
let { selection: t } = e;
|
|
7528
7530
|
if (!t || !z.isCollapsed(t)) return !1;
|
|
7529
|
-
let n =
|
|
7531
|
+
let n = Nd(e, t.anchor);
|
|
7530
7532
|
return n ? U.isEnd(e, t.anchor, n[1]) : !1;
|
|
7531
7533
|
}
|
|
7532
|
-
function
|
|
7533
|
-
if (n.length !== 1 || !
|
|
7534
|
+
function zd(e, t, n) {
|
|
7535
|
+
if (n.length !== 1 || !tf(t, "table")) return !1;
|
|
7534
7536
|
let r = e.children[n[0] - 1];
|
|
7535
|
-
if (!
|
|
7537
|
+
if (!ef(r)) return q.insertNodes(e, bd(), { at: n }), !0;
|
|
7536
7538
|
let i = e.children[n[0] + 1];
|
|
7537
|
-
return
|
|
7539
|
+
return ef(i) ? !1 : (q.insertNodes(e, bd(), { at: [n[0] + 1] }), !0);
|
|
7538
7540
|
}
|
|
7539
|
-
function
|
|
7541
|
+
function Bd(e) {
|
|
7540
7542
|
let { selection: t } = e;
|
|
7541
7543
|
if (!t || !z.isCollapsed(t)) return !1;
|
|
7542
|
-
let n =
|
|
7544
|
+
let n = Zd(e, t.anchor);
|
|
7543
7545
|
if (!n) return !1;
|
|
7544
7546
|
let [, r] = n;
|
|
7545
7547
|
if (r.length !== 1 || r[0] === 0 || !U.isStart(e, t.anchor, r)) return !1;
|
|
7546
7548
|
let i = [r[0] - 1];
|
|
7547
|
-
return
|
|
7549
|
+
return tf(e.children[i[0]], "table") ? (q.removeNodes(e, { at: i }), $d(e, i), !0) : !1;
|
|
7548
7550
|
}
|
|
7549
|
-
function
|
|
7551
|
+
function Vd(e) {
|
|
7550
7552
|
let { selection: t } = e;
|
|
7551
7553
|
if (!t || !z.isCollapsed(t)) return !1;
|
|
7552
|
-
let n =
|
|
7554
|
+
let n = Zd(e, t.anchor);
|
|
7553
7555
|
if (!n) return !1;
|
|
7554
7556
|
let [, r] = n;
|
|
7555
7557
|
if (r.length !== 1 || !U.isEnd(e, t.anchor, r)) return !1;
|
|
7556
7558
|
let i = [r[0] + 1];
|
|
7557
|
-
if (!
|
|
7559
|
+
if (!tf(e.children[i[0]], "table")) return !1;
|
|
7558
7560
|
q.removeNodes(e, { at: i });
|
|
7559
7561
|
try {
|
|
7560
7562
|
q.select(e, U.end(e, r));
|
|
@@ -7563,10 +7565,10 @@ function Hd(e) {
|
|
|
7563
7565
|
}
|
|
7564
7566
|
return !0;
|
|
7565
7567
|
}
|
|
7566
|
-
function
|
|
7567
|
-
let { columns: n = 3, rows: r = 3 } = t, i =
|
|
7568
|
+
function Hd(e, t = {}) {
|
|
7569
|
+
let { columns: n = 3, rows: r = 3 } = t, i = Yd(e, Cd(r, n));
|
|
7568
7570
|
U.withoutNormalizing(e, () => {
|
|
7569
|
-
|
|
7571
|
+
Xd(e, i);
|
|
7570
7572
|
});
|
|
7571
7573
|
try {
|
|
7572
7574
|
q.select(e, U.start(e, [
|
|
@@ -7580,24 +7582,24 @@ function Ud(e, t = {}) {
|
|
|
7580
7582
|
}
|
|
7581
7583
|
return !0;
|
|
7582
7584
|
}
|
|
7583
|
-
function
|
|
7584
|
-
let n =
|
|
7585
|
+
function Ud(e, t = "after") {
|
|
7586
|
+
let n = qd(e);
|
|
7585
7587
|
if (!n) return !1;
|
|
7586
7588
|
let r = Math.max(n.rowNode.children.length, 1), i = [...n.tablePath, n.rowIndex + (t === "before" ? 0 : 1)];
|
|
7587
|
-
return q.insertNodes(e,
|
|
7589
|
+
return q.insertNodes(e, Sd(r), { at: i }), !0;
|
|
7588
7590
|
}
|
|
7589
|
-
function
|
|
7590
|
-
let t =
|
|
7591
|
-
return t ? t.tableNode.children.length <= 1 ? (
|
|
7591
|
+
function Wd(e) {
|
|
7592
|
+
let t = qd(e);
|
|
7593
|
+
return t ? t.tableNode.children.length <= 1 ? (Qd(e, t.tablePath), !0) : (q.removeNodes(e, { at: t.rowPath }), !0) : !1;
|
|
7592
7594
|
}
|
|
7593
|
-
function
|
|
7594
|
-
let n =
|
|
7595
|
+
function Gd(e, t = "after") {
|
|
7596
|
+
let n = qd(e);
|
|
7595
7597
|
if (!n) return !1;
|
|
7596
7598
|
let r = t === "before" ? 0 : 1;
|
|
7597
7599
|
return U.withoutNormalizing(e, () => {
|
|
7598
7600
|
n.tableNode.children.forEach((t, i) => {
|
|
7599
|
-
let a =
|
|
7600
|
-
q.insertNodes(e,
|
|
7601
|
+
let a = nf(t) ? t.children.length : 0, o = Math.min(n.cellIndex + r, a);
|
|
7602
|
+
q.insertNodes(e, xd(), { at: [
|
|
7601
7603
|
...n.tablePath,
|
|
7602
7604
|
i,
|
|
7603
7605
|
o
|
|
@@ -7605,11 +7607,11 @@ function Kd(e, t = "after") {
|
|
|
7605
7607
|
});
|
|
7606
7608
|
}), !0;
|
|
7607
7609
|
}
|
|
7608
|
-
function
|
|
7609
|
-
let t =
|
|
7610
|
-
return t ? t.rowNode.children.length <= 1 ? (
|
|
7610
|
+
function Kd(e) {
|
|
7611
|
+
let t = qd(e);
|
|
7612
|
+
return t ? t.rowNode.children.length <= 1 ? (Qd(e, t.tablePath), !0) : (U.withoutNormalizing(e, () => {
|
|
7611
7613
|
t.tableNode.children.forEach((n, r) => {
|
|
7612
|
-
|
|
7614
|
+
nf(n) && n.children.length > t.cellIndex && q.removeNodes(e, { at: [
|
|
7613
7615
|
...t.tablePath,
|
|
7614
7616
|
r,
|
|
7615
7617
|
t.cellIndex
|
|
@@ -7617,16 +7619,16 @@ function qd(e) {
|
|
|
7617
7619
|
});
|
|
7618
7620
|
}), !0) : !1;
|
|
7619
7621
|
}
|
|
7620
|
-
function
|
|
7621
|
-
let t =
|
|
7622
|
+
function qd(e) {
|
|
7623
|
+
let t = Pd(e);
|
|
7622
7624
|
if (!t) return null;
|
|
7623
7625
|
let [, n] = t, r = U.above(e, {
|
|
7624
7626
|
at: n,
|
|
7625
|
-
match: (e) =>
|
|
7627
|
+
match: (e) => tf(e, vd)
|
|
7626
7628
|
}), i = U.above(e, {
|
|
7627
7629
|
at: n,
|
|
7628
|
-
match: (e) =>
|
|
7629
|
-
}), a =
|
|
7630
|
+
match: (e) => tf(e, _d)
|
|
7631
|
+
}), a = rf(r), o = rf(i);
|
|
7630
7632
|
if (!a || !o) return null;
|
|
7631
7633
|
let [s, c] = a, [l, u] = o, d = n[n.length - 1], f = c[c.length - 1];
|
|
7632
7634
|
return d == null || f == null ? null : {
|
|
@@ -7638,7 +7640,7 @@ function Jd(e) {
|
|
|
7638
7640
|
tablePath: u
|
|
7639
7641
|
};
|
|
7640
7642
|
}
|
|
7641
|
-
function
|
|
7643
|
+
function Jd(e) {
|
|
7642
7644
|
if (!e.selection) return {
|
|
7643
7645
|
insertPath: [e.children.length],
|
|
7644
7646
|
replacePath: null
|
|
@@ -7652,7 +7654,7 @@ function Yd(e) {
|
|
|
7652
7654
|
replacePath: null
|
|
7653
7655
|
};
|
|
7654
7656
|
let [n, r] = t;
|
|
7655
|
-
return
|
|
7657
|
+
return tf(n, "paragraph") && V.string(n).trim().length === 0 ? {
|
|
7656
7658
|
insertPath: r,
|
|
7657
7659
|
replacePath: r
|
|
7658
7660
|
} : {
|
|
@@ -7660,40 +7662,40 @@ function Yd(e) {
|
|
|
7660
7662
|
replacePath: null
|
|
7661
7663
|
};
|
|
7662
7664
|
}
|
|
7663
|
-
function
|
|
7665
|
+
function Yd(e, t) {
|
|
7664
7666
|
var n;
|
|
7665
|
-
let { insertPath: r, replacePath: i } =
|
|
7667
|
+
let { insertPath: r, replacePath: i } = Jd(e), a = (n = r[0]) == null ? e.children.length : n, [o] = e.children.slice(a - 1, a), s = !ef(o), c = i ? a + 1 : a, [l] = e.children.slice(c, c + 1), u = !ef(l);
|
|
7666
7668
|
return {
|
|
7667
7669
|
insertPath: r,
|
|
7668
7670
|
nodes: [
|
|
7669
|
-
s ?
|
|
7671
|
+
s ? bd() : null,
|
|
7670
7672
|
t,
|
|
7671
|
-
u ?
|
|
7673
|
+
u ? bd() : null
|
|
7672
7674
|
].filter((e) => !!e),
|
|
7673
7675
|
replacePath: i,
|
|
7674
7676
|
tablePath: [a + +!!s]
|
|
7675
7677
|
};
|
|
7676
7678
|
}
|
|
7677
|
-
function
|
|
7679
|
+
function Xd(e, t) {
|
|
7678
7680
|
t.replacePath && q.removeNodes(e, { at: t.replacePath }), q.insertNodes(e, t.nodes, { at: t.insertPath });
|
|
7679
7681
|
}
|
|
7680
|
-
function
|
|
7682
|
+
function Zd(e, t) {
|
|
7681
7683
|
if (!t) return null;
|
|
7682
7684
|
try {
|
|
7683
|
-
return
|
|
7685
|
+
return rf(U.above(e, {
|
|
7684
7686
|
at: t,
|
|
7685
|
-
match: (e) =>
|
|
7687
|
+
match: (e) => tf(e, "paragraph")
|
|
7686
7688
|
}));
|
|
7687
7689
|
} catch (e) {
|
|
7688
7690
|
return null;
|
|
7689
7691
|
}
|
|
7690
7692
|
}
|
|
7691
|
-
function
|
|
7692
|
-
q.removeNodes(e, { at: t }), q.insertNodes(e,
|
|
7693
|
+
function Qd(e, t) {
|
|
7694
|
+
q.removeNodes(e, { at: t }), q.insertNodes(e, bd(), { at: t }), q.select(e, U.start(e, t));
|
|
7693
7695
|
}
|
|
7694
|
-
function
|
|
7696
|
+
function $d(e, t) {
|
|
7695
7697
|
var n;
|
|
7696
|
-
e.children.length === 0 && q.insertNodes(e,
|
|
7698
|
+
e.children.length === 0 && q.insertNodes(e, bd(), { at: [0] });
|
|
7697
7699
|
let r = [Math.min((n = t[0]) == null ? 0 : n, e.children.length - 1)];
|
|
7698
7700
|
try {
|
|
7699
7701
|
q.select(e, U.start(e, r));
|
|
@@ -7701,22 +7703,22 @@ function ef(e, t) {
|
|
|
7701
7703
|
q.select(e, [0]);
|
|
7702
7704
|
}
|
|
7703
7705
|
}
|
|
7704
|
-
function
|
|
7705
|
-
return
|
|
7706
|
+
function ef(e) {
|
|
7707
|
+
return tf(e, "paragraph");
|
|
7706
7708
|
}
|
|
7707
|
-
function
|
|
7709
|
+
function tf(e, t) {
|
|
7708
7710
|
return !!(B.isElement(e) && "type" in e && e.type === t);
|
|
7709
7711
|
}
|
|
7710
|
-
function
|
|
7712
|
+
function nf(e) {
|
|
7711
7713
|
return !!(B.isElement(e) && "type" in e && typeof e.type == "string");
|
|
7712
7714
|
}
|
|
7713
|
-
function
|
|
7714
|
-
return !e || !
|
|
7715
|
+
function rf(e) {
|
|
7716
|
+
return !e || !nf(e[0]) ? null : [e[0], e[1]];
|
|
7715
7717
|
}
|
|
7716
7718
|
//#endregion
|
|
7717
7719
|
//#region src/rich-text-editor/primitives/TableCellElement.tsx
|
|
7718
|
-
function
|
|
7719
|
-
let { messages: r } =
|
|
7720
|
+
function af({ attributes: e, children: t, element: n }) {
|
|
7721
|
+
let { messages: r } = pd(), i = rs(), a = El(), o = Qc(), s = v(null), [c, l] = y(null), u = d(() => {
|
|
7720
7722
|
try {
|
|
7721
7723
|
let e = J.findPath(i, n);
|
|
7722
7724
|
J.focus(i), q.select(i, U.start(i, e));
|
|
@@ -7741,12 +7743,12 @@ function of({ attributes: e, children: t, element: n }) {
|
|
|
7741
7743
|
};
|
|
7742
7744
|
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
7743
7745
|
}, [c]), /* @__PURE__ */ S("td", I(I({}, e), {}, {
|
|
7744
|
-
className:
|
|
7746
|
+
className: gd.cell,
|
|
7745
7747
|
"data-selected": o && a ? "true" : void 0,
|
|
7746
7748
|
onContextMenu: m,
|
|
7747
7749
|
onMouseDown: f,
|
|
7748
7750
|
children: [t, c ? /* @__PURE__ */ S("div", {
|
|
7749
|
-
className:
|
|
7751
|
+
className: gd.menu,
|
|
7750
7752
|
contentEditable: !1,
|
|
7751
7753
|
ref: s,
|
|
7752
7754
|
role: "menu",
|
|
@@ -7756,38 +7758,38 @@ function of({ attributes: e, children: t, element: n }) {
|
|
|
7756
7758
|
},
|
|
7757
7759
|
children: [
|
|
7758
7760
|
/* @__PURE__ */ x("button", {
|
|
7759
|
-
onMouseDown: h((e) =>
|
|
7761
|
+
onMouseDown: h((e) => Ud(e, "before")),
|
|
7760
7762
|
role: "menuitem",
|
|
7761
7763
|
type: "button",
|
|
7762
7764
|
children: r.tableRowBefore
|
|
7763
7765
|
}),
|
|
7764
7766
|
/* @__PURE__ */ x("button", {
|
|
7765
|
-
onMouseDown: h((e) =>
|
|
7767
|
+
onMouseDown: h((e) => Ud(e, "after")),
|
|
7766
7768
|
role: "menuitem",
|
|
7767
7769
|
type: "button",
|
|
7768
7770
|
children: r.tableRowAfter
|
|
7769
7771
|
}),
|
|
7770
7772
|
/* @__PURE__ */ x("button", {
|
|
7771
|
-
onMouseDown: h(
|
|
7773
|
+
onMouseDown: h(Wd),
|
|
7772
7774
|
role: "menuitem",
|
|
7773
7775
|
type: "button",
|
|
7774
7776
|
children: r.tableRowDelete
|
|
7775
7777
|
}),
|
|
7776
|
-
/* @__PURE__ */ x("span", { className:
|
|
7778
|
+
/* @__PURE__ */ x("span", { className: gd.separator }),
|
|
7777
7779
|
/* @__PURE__ */ x("button", {
|
|
7778
|
-
onMouseDown: h((e) =>
|
|
7780
|
+
onMouseDown: h((e) => Gd(e, "before")),
|
|
7779
7781
|
role: "menuitem",
|
|
7780
7782
|
type: "button",
|
|
7781
7783
|
children: r.tableColumnBefore
|
|
7782
7784
|
}),
|
|
7783
7785
|
/* @__PURE__ */ x("button", {
|
|
7784
|
-
onMouseDown: h((e) =>
|
|
7786
|
+
onMouseDown: h((e) => Gd(e, "after")),
|
|
7785
7787
|
role: "menuitem",
|
|
7786
7788
|
type: "button",
|
|
7787
7789
|
children: r.tableColumnAfter
|
|
7788
7790
|
}),
|
|
7789
7791
|
/* @__PURE__ */ x("button", {
|
|
7790
|
-
onMouseDown: h(
|
|
7792
|
+
onMouseDown: h(Kd),
|
|
7791
7793
|
role: "menuitem",
|
|
7792
7794
|
type: "button",
|
|
7793
7795
|
children: r.tableColumnDelete
|
|
@@ -7798,72 +7800,84 @@ function of({ attributes: e, children: t, element: n }) {
|
|
|
7798
7800
|
}
|
|
7799
7801
|
//#endregion
|
|
7800
7802
|
//#region src/rich-text-editor/primitives/TableElement.tsx
|
|
7801
|
-
function
|
|
7803
|
+
function of({ attributes: e, children: t }) {
|
|
7802
7804
|
return /* @__PURE__ */ x("table", I(I({}, e), {}, {
|
|
7803
|
-
className:
|
|
7805
|
+
className: gd.table,
|
|
7804
7806
|
children: /* @__PURE__ */ x("tbody", { children: t })
|
|
7805
7807
|
}));
|
|
7806
7808
|
}
|
|
7807
7809
|
//#endregion
|
|
7808
7810
|
//#region src/rich-text-editor/primitives/featureDefinitions.tsx
|
|
7809
|
-
var
|
|
7811
|
+
var sf = { type: "paragraph" }, cf = [
|
|
7810
7812
|
{
|
|
7811
7813
|
key: "document-blocks",
|
|
7812
7814
|
createDefaultElement: yu,
|
|
7813
7815
|
commands: [
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7816
|
+
lf("block.heading", ({ command: e, editor: t }) => (cp(t, e.payload), !0)),
|
|
7817
|
+
lf("block.list.bulleted", ({ editor: e }) => (up(e, "bulleted"), !0)),
|
|
7818
|
+
lf("block.list.numbered", ({ editor: e }) => (up(e, "numbered"), !0)),
|
|
7819
|
+
lf("block.align", ({ command: e, editor: t }) => (sp(t, e.payload), !0))
|
|
7818
7820
|
],
|
|
7819
7821
|
nodes: [
|
|
7820
7822
|
{
|
|
7821
7823
|
codecs: {
|
|
7822
7824
|
html: {
|
|
7823
|
-
deserialize: ({ deserializeChildren: e, element: t }) => t.tagName === "P" ? vu("paragraph", e(t)) : null,
|
|
7825
|
+
deserialize: ({ deserializeChildren: e, element: t }) => t.tagName === "P" || t.tagName === "DIV" ? vu("paragraph", e(t), Gf(t)) : null,
|
|
7824
7826
|
serialize: ({ node: e, serializeChildren: t }) => e.type === "paragraph" ? `<p>${t(e)}</p>` : null
|
|
7825
7827
|
},
|
|
7826
7828
|
hyperscript: { tagName: "paragraph" },
|
|
7827
|
-
json:
|
|
7829
|
+
json: Tf("paragraph")
|
|
7828
7830
|
},
|
|
7829
7831
|
behavior: {
|
|
7830
|
-
onDeleteBackward: ({ editor: e }) =>
|
|
7831
|
-
onDeleteForward: ({ editor: e }) =>
|
|
7832
|
+
onDeleteBackward: ({ editor: e }) => Bd(e),
|
|
7833
|
+
onDeleteForward: ({ editor: e }) => Vd(e)
|
|
7832
7834
|
},
|
|
7833
|
-
render: ({ attributes: e, children: t, element: n }) =>
|
|
7835
|
+
render: ({ attributes: e, children: t, element: n }) => Pf(e, jf(t), n),
|
|
7834
7836
|
type: "paragraph"
|
|
7835
7837
|
},
|
|
7836
7838
|
{
|
|
7837
7839
|
codecs: {
|
|
7838
7840
|
html: {
|
|
7839
|
-
deserialize: (e) =>
|
|
7840
|
-
serialize: ({ node: e, serializeChildren: t }) =>
|
|
7841
|
+
deserialize: (e) => Ef(e),
|
|
7842
|
+
serialize: ({ node: e, serializeChildren: t }) => kf(e) && Df(e.level) ? `<h${e.level}>${t(e)}</h${e.level}>` : null
|
|
7841
7843
|
},
|
|
7842
7844
|
hyperscript: { tagName: "heading" },
|
|
7843
|
-
json:
|
|
7845
|
+
json: Tf("heading")
|
|
7844
7846
|
},
|
|
7845
|
-
render: ({ attributes: e, children: t, element: n }) =>
|
|
7847
|
+
render: ({ attributes: e, children: t, element: n }) => Mf(e, jf(t), n),
|
|
7846
7848
|
type: "heading"
|
|
7847
7849
|
},
|
|
7848
7850
|
{
|
|
7849
7851
|
codecs: {
|
|
7852
|
+
html: {
|
|
7853
|
+
deserialize: ({ deserializeChildren: e, element: t }) => t.tagName === "UL" || t.tagName === "OL" ? vu("list", e(t), { listKind: t.tagName === "OL" ? "numbered" : "bulleted" }) : null,
|
|
7854
|
+
serialize: ({ node: e, serializeChildren: t }) => {
|
|
7855
|
+
if (e.type !== "list") return null;
|
|
7856
|
+
let n = t(e);
|
|
7857
|
+
return e.listKind === "numbered" ? `<ol>${n}</ol>` : `<ul>${n}</ul>`;
|
|
7858
|
+
}
|
|
7859
|
+
},
|
|
7850
7860
|
hyperscript: { tagName: "list" },
|
|
7851
|
-
json:
|
|
7861
|
+
json: Tf("list")
|
|
7852
7862
|
},
|
|
7853
|
-
render: ({ attributes: e, children: t, element: n }) =>
|
|
7863
|
+
render: ({ attributes: e, children: t, element: n }) => Nf(e, jf(t), n),
|
|
7854
7864
|
type: "list"
|
|
7855
7865
|
},
|
|
7856
7866
|
{
|
|
7857
7867
|
codecs: {
|
|
7868
|
+
html: {
|
|
7869
|
+
deserialize: ({ deserializeChildren: e, element: t }) => t.tagName === "LI" ? vu("list-item", e(t), Gf(t)) : null,
|
|
7870
|
+
serialize: ({ node: e, serializeChildren: t }) => e.type === "list-item" ? `<li>${t(e)}</li>` : null
|
|
7871
|
+
},
|
|
7858
7872
|
hyperscript: { tagName: "list-item" },
|
|
7859
|
-
json:
|
|
7873
|
+
json: Tf("list-item")
|
|
7860
7874
|
},
|
|
7861
|
-
render: ({ attributes: e, children: t, element: n }) =>
|
|
7875
|
+
render: ({ attributes: e, children: t, element: n }) => Ff(e, jf(t), n),
|
|
7862
7876
|
type: "list-item"
|
|
7863
7877
|
}
|
|
7864
7878
|
],
|
|
7865
7879
|
toolbarActions: [
|
|
7866
|
-
|
|
7880
|
+
wf("heading1", {
|
|
7867
7881
|
command: "block.heading",
|
|
7868
7882
|
defaultLabel: "Heading 1",
|
|
7869
7883
|
icon: $l,
|
|
@@ -7871,7 +7885,7 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7871
7885
|
payload: { level: 1 },
|
|
7872
7886
|
stateful: !0
|
|
7873
7887
|
}),
|
|
7874
|
-
|
|
7888
|
+
wf("heading2", {
|
|
7875
7889
|
command: "block.heading",
|
|
7876
7890
|
defaultLabel: "Heading 2",
|
|
7877
7891
|
icon: eu,
|
|
@@ -7879,7 +7893,7 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7879
7893
|
payload: { level: 2 },
|
|
7880
7894
|
stateful: !0
|
|
7881
7895
|
}),
|
|
7882
|
-
|
|
7896
|
+
wf("heading3", {
|
|
7883
7897
|
command: "block.heading",
|
|
7884
7898
|
defaultLabel: "Heading 3",
|
|
7885
7899
|
icon: tu,
|
|
@@ -7887,19 +7901,19 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7887
7901
|
payload: { level: 3 },
|
|
7888
7902
|
stateful: !0
|
|
7889
7903
|
}),
|
|
7890
|
-
|
|
7904
|
+
wf("bulletedList", {
|
|
7891
7905
|
command: "block.list.bulleted",
|
|
7892
7906
|
defaultLabel: "Bulleted list",
|
|
7893
7907
|
icon: au,
|
|
7894
7908
|
kind: "toggle"
|
|
7895
7909
|
}),
|
|
7896
|
-
|
|
7910
|
+
wf("numberedList", {
|
|
7897
7911
|
command: "block.list.numbered",
|
|
7898
7912
|
defaultLabel: "Numbered list",
|
|
7899
7913
|
icon: iu,
|
|
7900
7914
|
kind: "toggle"
|
|
7901
7915
|
}),
|
|
7902
|
-
|
|
7916
|
+
wf("alignLeft", {
|
|
7903
7917
|
command: "block.align",
|
|
7904
7918
|
defaultLabel: "Align left",
|
|
7905
7919
|
icon: pu,
|
|
@@ -7907,7 +7921,7 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7907
7921
|
payload: "left",
|
|
7908
7922
|
stateful: !0
|
|
7909
7923
|
}),
|
|
7910
|
-
|
|
7924
|
+
wf("alignCenter", {
|
|
7911
7925
|
command: "block.align",
|
|
7912
7926
|
defaultLabel: "Align center",
|
|
7913
7927
|
icon: du,
|
|
@@ -7915,7 +7929,7 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7915
7929
|
payload: "center",
|
|
7916
7930
|
stateful: !0
|
|
7917
7931
|
}),
|
|
7918
|
-
|
|
7932
|
+
wf("alignRight", {
|
|
7919
7933
|
command: "block.align",
|
|
7920
7934
|
defaultLabel: "Align right",
|
|
7921
7935
|
icon: fu,
|
|
@@ -7924,7 +7938,7 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7924
7938
|
stateful: !0
|
|
7925
7939
|
})
|
|
7926
7940
|
],
|
|
7927
|
-
readToolbarState:
|
|
7941
|
+
readToolbarState: ff,
|
|
7928
7942
|
toolbarGroups: [{
|
|
7929
7943
|
actionKeys: [
|
|
7930
7944
|
"heading1",
|
|
@@ -7944,14 +7958,14 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7944
7958
|
}]
|
|
7945
7959
|
},
|
|
7946
7960
|
{
|
|
7947
|
-
commands: [
|
|
7961
|
+
commands: [lf("history.redo", ({ editor: e }) => (wa.redo(e), !0)), lf("history.undo", ({ editor: e }) => (wa.undo(e), !0))],
|
|
7948
7962
|
key: "history",
|
|
7949
|
-
toolbarActions: [
|
|
7963
|
+
toolbarActions: [wf("undo", {
|
|
7950
7964
|
command: "history.undo",
|
|
7951
7965
|
defaultLabel: "Undo",
|
|
7952
7966
|
icon: gu,
|
|
7953
7967
|
kind: "button"
|
|
7954
|
-
}),
|
|
7968
|
+
}), wf("redo", {
|
|
7955
7969
|
command: "history.redo",
|
|
7956
7970
|
defaultLabel: "Redo",
|
|
7957
7971
|
icon: su,
|
|
@@ -7964,46 +7978,46 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
7964
7978
|
},
|
|
7965
7979
|
{
|
|
7966
7980
|
commands: [
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7981
|
+
uf("mark.bold", "bold"),
|
|
7982
|
+
uf("mark.italic", "italic"),
|
|
7983
|
+
uf("mark.underline", "underline"),
|
|
7984
|
+
uf("mark.strike", "strike"),
|
|
7985
|
+
uf("mark.code", "code"),
|
|
7986
|
+
df("mark.color", "color"),
|
|
7987
|
+
df("mark.font-size", "fontSize")
|
|
7974
7988
|
],
|
|
7975
7989
|
toolbarActions: [
|
|
7976
|
-
|
|
7990
|
+
wf("bold", {
|
|
7977
7991
|
command: "mark.bold",
|
|
7978
7992
|
defaultLabel: "Bold",
|
|
7979
7993
|
icon: Xl,
|
|
7980
7994
|
kind: "toggle"
|
|
7981
7995
|
}),
|
|
7982
|
-
|
|
7996
|
+
wf("italic", {
|
|
7983
7997
|
command: "mark.italic",
|
|
7984
7998
|
defaultLabel: "Italic",
|
|
7985
7999
|
icon: ru,
|
|
7986
8000
|
kind: "toggle"
|
|
7987
8001
|
}),
|
|
7988
|
-
|
|
8002
|
+
wf("underline", {
|
|
7989
8003
|
command: "mark.underline",
|
|
7990
8004
|
defaultLabel: "Underline",
|
|
7991
8005
|
icon: hu,
|
|
7992
8006
|
kind: "toggle"
|
|
7993
8007
|
}),
|
|
7994
|
-
|
|
8008
|
+
wf("strike", {
|
|
7995
8009
|
command: "mark.strike",
|
|
7996
8010
|
defaultLabel: "Strikethrough",
|
|
7997
8011
|
icon: lu,
|
|
7998
8012
|
kind: "toggle"
|
|
7999
8013
|
}),
|
|
8000
|
-
|
|
8014
|
+
wf("code", {
|
|
8001
8015
|
command: "mark.code",
|
|
8002
8016
|
defaultLabel: "Code",
|
|
8003
8017
|
icon: Zl,
|
|
8004
8018
|
kind: "toggle"
|
|
8005
8019
|
}),
|
|
8006
|
-
|
|
8020
|
+
wf("color", {
|
|
8007
8021
|
command: "mark.color",
|
|
8008
8022
|
defaultLabel: "Text color",
|
|
8009
8023
|
icon: Yl,
|
|
@@ -8011,7 +8025,7 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8011
8025
|
payload: "#0445FC",
|
|
8012
8026
|
stateful: !0
|
|
8013
8027
|
}),
|
|
8014
|
-
|
|
8028
|
+
wf("fontSize", {
|
|
8015
8029
|
command: "mark.font-size",
|
|
8016
8030
|
defaultLabel: "Font size",
|
|
8017
8031
|
icon: mu,
|
|
@@ -8021,8 +8035,8 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8021
8035
|
})
|
|
8022
8036
|
],
|
|
8023
8037
|
key: "text-style",
|
|
8024
|
-
renderLeaf:
|
|
8025
|
-
readToolbarState:
|
|
8038
|
+
renderLeaf: hf,
|
|
8039
|
+
readToolbarState: pf,
|
|
8026
8040
|
toolbarGroups: [{
|
|
8027
8041
|
actionKeys: [
|
|
8028
8042
|
"bold",
|
|
@@ -8037,15 +8051,15 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8037
8051
|
}]
|
|
8038
8052
|
},
|
|
8039
8053
|
{
|
|
8040
|
-
commands: [
|
|
8054
|
+
commands: [lf(_u, ({ command: e, editor: t, registry: n }) => (Uu(t, n, e.payload), !0))],
|
|
8041
8055
|
key: "insert-blocks",
|
|
8042
8056
|
nodes: [
|
|
8043
8057
|
{
|
|
8044
8058
|
behavior: {
|
|
8045
8059
|
onBreak: ({ editor: e, elementPath: t }) => (q.insertNodes(e, yu(), { at: R.next(t) }), !0),
|
|
8046
|
-
onDeleteBackward: ({ editor: e, elementPath: t }) => e.children.length <= 1 ? (q.setNodes(e,
|
|
8047
|
-
onDeleteForward: ({ editor: e, elementPath: t }) => e.children.length <= 1 ? (q.setNodes(e,
|
|
8048
|
-
onDeleteSelection: ({ editor: e, elementPath: t }) => e.children.length <= 1 ? (q.setNodes(e,
|
|
8060
|
+
onDeleteBackward: ({ editor: e, elementPath: t }) => e.children.length <= 1 ? (q.setNodes(e, sf, { at: t }), !0) : (q.removeNodes(e, { at: t }), !0),
|
|
8061
|
+
onDeleteForward: ({ editor: e, elementPath: t }) => e.children.length <= 1 ? (q.setNodes(e, sf, { at: t }), !0) : (q.removeNodes(e, { at: t }), !0),
|
|
8062
|
+
onDeleteSelection: ({ editor: e, elementPath: t }) => e.children.length <= 1 ? (q.setNodes(e, sf, { at: t }), !0) : (q.removeNodes(e, { at: t }), !0)
|
|
8049
8063
|
},
|
|
8050
8064
|
codecs: {
|
|
8051
8065
|
html: {
|
|
@@ -8053,35 +8067,27 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8053
8067
|
serialize: ({ node: e }) => e.type === "divider" ? "<hr data-rte-node=\"divider\" />" : null
|
|
8054
8068
|
},
|
|
8055
8069
|
hyperscript: { tagName: "divider" },
|
|
8056
|
-
json:
|
|
8070
|
+
json: Tf("divider")
|
|
8057
8071
|
},
|
|
8058
8072
|
commands: { insert: () => ({
|
|
8059
8073
|
element: vu("divider"),
|
|
8060
8074
|
kind: "patch"
|
|
8061
8075
|
}) },
|
|
8062
|
-
render: ({ attributes: e, children: t }) =>
|
|
8076
|
+
render: ({ attributes: e, children: t }) => If(e, jf(t)),
|
|
8063
8077
|
schema: { void: !0 },
|
|
8064
8078
|
type: "divider"
|
|
8065
8079
|
},
|
|
8066
8080
|
{
|
|
8067
8081
|
codecs: {
|
|
8068
8082
|
html: {
|
|
8069
|
-
deserialize: ({ element: e }) =>
|
|
8070
|
-
|
|
8071
|
-
return e.tagName === "IMG" || e.dataset.rteNode === "image" ? vu("image", [{ text: "" }], {
|
|
8072
|
-
alt: (t = e.getAttribute("alt")) == null ? "" : t,
|
|
8073
|
-
height: Hf(e, "height"),
|
|
8074
|
-
src: (n = e.getAttribute("src")) == null ? "" : n,
|
|
8075
|
-
width: Hf(e, "width")
|
|
8076
|
-
}) : null;
|
|
8077
|
-
},
|
|
8078
|
-
serialize: ({ node: e }) => e.type === "image" ? `<img data-rte-node="image" src="${wu(xu(e.src))}" alt="${wu(xu(e.alt))}"${Uf(e)} />` : null
|
|
8083
|
+
deserialize: ({ element: e }) => e.dataset.rteNode === "image" ? Hf(e) : e.tagName === "IMG" ? Vf(e) ? null : Hf(e) : null,
|
|
8084
|
+
serialize: ({ node: e }) => e.type === "image" ? `<img data-rte-node="image" src="${wu(xu(e.src))}" alt="${wu(xu(e.alt))}"${Yf(e)} />` : null
|
|
8079
8085
|
},
|
|
8080
8086
|
hyperscript: { tagName: "image" },
|
|
8081
|
-
json:
|
|
8087
|
+
json: Tf("image")
|
|
8082
8088
|
},
|
|
8083
8089
|
commands: { insert: ({ payload: e }) => ({
|
|
8084
|
-
element: vu("image", [{ text: "" }],
|
|
8090
|
+
element: vu("image", [{ text: "" }], Rf(e)),
|
|
8085
8091
|
kind: "patch"
|
|
8086
8092
|
}) },
|
|
8087
8093
|
object: {
|
|
@@ -8094,19 +8100,27 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8094
8100
|
codecs: {
|
|
8095
8101
|
html: {
|
|
8096
8102
|
deserialize: ({ element: e }) => {
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8103
|
+
if (e.dataset.rteNode === "formula") {
|
|
8104
|
+
var t, n, r;
|
|
8105
|
+
return vu("formula", [{ text: "" }], {
|
|
8106
|
+
latex: (t = e.dataset.latex) == null ? "" : t,
|
|
8107
|
+
src: (n = (r = e.dataset.src) == null ? e.getAttribute("src") : r) == null ? "" : n
|
|
8108
|
+
});
|
|
8109
|
+
}
|
|
8110
|
+
let i = Vf(e);
|
|
8111
|
+
return i ? vu("formula", [{ text: "" }], i) : null;
|
|
8102
8112
|
},
|
|
8103
|
-
serialize: ({ node: e }) =>
|
|
8113
|
+
serialize: ({ node: e }) => {
|
|
8114
|
+
if (e.type !== "formula") return null;
|
|
8115
|
+
let t = xu(e.src);
|
|
8116
|
+
return t ? Uf(xu(e.latex), t) : "";
|
|
8117
|
+
}
|
|
8104
8118
|
},
|
|
8105
8119
|
hyperscript: { tagName: "formula" },
|
|
8106
|
-
json:
|
|
8120
|
+
json: Tf("formula")
|
|
8107
8121
|
},
|
|
8108
8122
|
commands: { insert: ({ payload: e }) => ({
|
|
8109
|
-
element: vu("formula", [{ text: "" }],
|
|
8123
|
+
element: vu("formula", [{ text: "" }], Bf(e)),
|
|
8110
8124
|
kind: "patch"
|
|
8111
8125
|
}) },
|
|
8112
8126
|
object: {
|
|
@@ -8117,19 +8131,19 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8117
8131
|
}
|
|
8118
8132
|
],
|
|
8119
8133
|
toolbarActions: [
|
|
8120
|
-
|
|
8134
|
+
wf("divider", {
|
|
8121
8135
|
command: _u,
|
|
8122
8136
|
defaultLabel: "Divider",
|
|
8123
8137
|
icon: ou,
|
|
8124
8138
|
kind: "button"
|
|
8125
8139
|
}),
|
|
8126
|
-
|
|
8140
|
+
wf("image", {
|
|
8127
8141
|
command: _u,
|
|
8128
8142
|
defaultLabel: "Image",
|
|
8129
8143
|
icon: nu,
|
|
8130
8144
|
kind: "button"
|
|
8131
8145
|
}),
|
|
8132
|
-
|
|
8146
|
+
wf("formula", {
|
|
8133
8147
|
command: _u,
|
|
8134
8148
|
defaultLabel: "Formula",
|
|
8135
8149
|
icon: cu,
|
|
@@ -8151,69 +8165,69 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8151
8165
|
{
|
|
8152
8166
|
codecs: {
|
|
8153
8167
|
html: {
|
|
8154
|
-
deserialize: ({ deserializeChildren: e, element: t }) => t.tagName === "TABLE" ?
|
|
8168
|
+
deserialize: ({ deserializeChildren: e, element: t }) => t.tagName === "TABLE" ? Td(t, (t) => e(t)) : null,
|
|
8155
8169
|
serialize: ({ node: e, serializeChildren: t }) => e.type === "table" ? `<table><tbody>${t(e)}</tbody></table>` : null
|
|
8156
8170
|
},
|
|
8157
8171
|
hyperscript: { tagName: "table" },
|
|
8158
8172
|
json: {
|
|
8159
|
-
deserialize: ({ input: e }) =>
|
|
8173
|
+
deserialize: ({ input: e }) => Ed(e),
|
|
8160
8174
|
serialize: ({ node: e }) => e.type === "table" ? e : null
|
|
8161
8175
|
}
|
|
8162
8176
|
},
|
|
8163
|
-
commands: { insert: ({ editor: e, payload: t }) =>
|
|
8177
|
+
commands: { insert: ({ editor: e, payload: t }) => Hd(e, Xf(t)) ? {
|
|
8164
8178
|
elements: [],
|
|
8165
8179
|
kind: "elements"
|
|
8166
8180
|
} : null },
|
|
8167
8181
|
normalize: ({ editor: e, element: t, elementPath: n }) => {
|
|
8168
|
-
if (
|
|
8169
|
-
let r =
|
|
8170
|
-
return
|
|
8182
|
+
if (zd(e, t, n)) return !0;
|
|
8183
|
+
let r = Dd(t);
|
|
8184
|
+
return Qf(t.children, r.children) ? !1 : (q.setNodes(e, { children: r.children }, { at: n }), !0);
|
|
8171
8185
|
},
|
|
8172
|
-
render: ({ attributes: e, children: t }) => /* @__PURE__ */ x(
|
|
8186
|
+
render: ({ attributes: e, children: t }) => /* @__PURE__ */ x(of, {
|
|
8173
8187
|
attributes: e,
|
|
8174
|
-
children:
|
|
8188
|
+
children: jf(t)
|
|
8175
8189
|
}),
|
|
8176
|
-
type:
|
|
8190
|
+
type: _d
|
|
8177
8191
|
},
|
|
8178
8192
|
{
|
|
8179
8193
|
codecs: {
|
|
8180
8194
|
html: { serialize: ({ node: e, serializeChildren: t }) => e.type === "table-row" ? `<tr>${t(e)}</tr>` : null },
|
|
8181
8195
|
hyperscript: { tagName: "table-row" },
|
|
8182
|
-
json:
|
|
8196
|
+
json: Tf("table-row")
|
|
8183
8197
|
},
|
|
8184
|
-
render: ({ attributes: e, children: t }) => /* @__PURE__ */ x("tr", I(I({}, e), {}, { children:
|
|
8185
|
-
type:
|
|
8198
|
+
render: ({ attributes: e, children: t }) => /* @__PURE__ */ x("tr", I(I({}, e), {}, { children: jf(t) })),
|
|
8199
|
+
type: vd
|
|
8186
8200
|
},
|
|
8187
8201
|
{
|
|
8188
8202
|
behavior: {
|
|
8189
|
-
onBeforeInputText: (e) =>
|
|
8190
|
-
onDeleteBackward: (e) =>
|
|
8191
|
-
onDeleteForward: (e) =>
|
|
8192
|
-
onDeleteFragment: (e) =>
|
|
8193
|
-
onDeleteSelection: (e) =>
|
|
8194
|
-
onInsertData: (e) =>
|
|
8203
|
+
onBeforeInputText: (e) => $f(e.editor),
|
|
8204
|
+
onDeleteBackward: (e) => ep(e.editor, "backward"),
|
|
8205
|
+
onDeleteForward: (e) => ep(e.editor, "forward"),
|
|
8206
|
+
onDeleteFragment: (e) => tp(e.editor),
|
|
8207
|
+
onDeleteSelection: (e) => np(e.editor, e.key),
|
|
8208
|
+
onInsertData: (e) => $f(e.editor)
|
|
8195
8209
|
},
|
|
8196
8210
|
codecs: {
|
|
8197
8211
|
html: { serialize: ({ node: e, serializeChildren: t }) => e.type === "table-cell" ? `<td>${t(e) || "<p><br/></p>"}</td>` : null },
|
|
8198
8212
|
hyperscript: { tagName: "table-cell" },
|
|
8199
8213
|
json: {
|
|
8200
|
-
deserialize: ({ input: e }) =>
|
|
8214
|
+
deserialize: ({ input: e }) => Q(e) && e.type === "table-cell" ? Od(e) : null,
|
|
8201
8215
|
serialize: ({ node: e }) => e.type === "table-cell" ? e : null
|
|
8202
8216
|
}
|
|
8203
8217
|
},
|
|
8204
8218
|
normalize: ({ editor: e, element: t, elementPath: n }) => {
|
|
8205
|
-
let r =
|
|
8206
|
-
return
|
|
8219
|
+
let r = Od(t);
|
|
8220
|
+
return Qf(t.children, r.children) ? !1 : (q.setNodes(e, { children: r.children }, { at: n }), !0);
|
|
8207
8221
|
},
|
|
8208
|
-
render: ({ attributes: e, children: t, element: n }) => /* @__PURE__ */ x(
|
|
8222
|
+
render: ({ attributes: e, children: t, element: n }) => /* @__PURE__ */ x(af, {
|
|
8209
8223
|
attributes: e,
|
|
8210
8224
|
element: n,
|
|
8211
|
-
children:
|
|
8225
|
+
children: jf(t)
|
|
8212
8226
|
}),
|
|
8213
|
-
type:
|
|
8227
|
+
type: yd
|
|
8214
8228
|
}
|
|
8215
8229
|
],
|
|
8216
|
-
toolbarActions: [
|
|
8230
|
+
toolbarActions: [wf("table", {
|
|
8217
8231
|
command: _u,
|
|
8218
8232
|
defaultLabel: "Table",
|
|
8219
8233
|
icon: uu,
|
|
@@ -8229,46 +8243,46 @@ var cf = { type: "paragraph" }, lf = [
|
|
|
8229
8243
|
}]
|
|
8230
8244
|
}
|
|
8231
8245
|
];
|
|
8232
|
-
function
|
|
8246
|
+
function lf(e, t) {
|
|
8233
8247
|
return {
|
|
8234
8248
|
command: e,
|
|
8235
8249
|
run: t
|
|
8236
8250
|
};
|
|
8237
8251
|
}
|
|
8238
|
-
function
|
|
8239
|
-
return
|
|
8240
|
-
}
|
|
8241
|
-
function ff(e, t) {
|
|
8242
|
-
return uf(e, ({ command: e, editor: n }) => (Qf(n, t, e.payload), !0));
|
|
8252
|
+
function uf(e, t) {
|
|
8253
|
+
return lf(e, ({ editor: e }) => (rp(e, t), !0));
|
|
8243
8254
|
}
|
|
8244
|
-
function
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8250
|
-
|
|
8255
|
+
function df(e, t) {
|
|
8256
|
+
return lf(e, ({ command: e, editor: n }) => (ip(n, t, e.payload), !0));
|
|
8257
|
+
}
|
|
8258
|
+
function ff({ editor: e }) {
|
|
8259
|
+
let t = fp(e);
|
|
8260
|
+
return Cf([
|
|
8261
|
+
bf(t),
|
|
8262
|
+
xf(t, "bulleted", "block.list.bulleted"),
|
|
8263
|
+
xf(t, "numbered", "block.list.numbered"),
|
|
8264
|
+
Sf(t)
|
|
8251
8265
|
]);
|
|
8252
8266
|
}
|
|
8253
|
-
function
|
|
8254
|
-
let t =
|
|
8255
|
-
return
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8267
|
+
function pf({ editor: e }) {
|
|
8268
|
+
let t = mf(e);
|
|
8269
|
+
return Cf([
|
|
8270
|
+
vf(t == null ? void 0 : t.bold, "mark.bold"),
|
|
8271
|
+
vf(t == null ? void 0 : t.italic, "mark.italic"),
|
|
8272
|
+
vf(t == null ? void 0 : t.underline, "mark.underline"),
|
|
8273
|
+
vf(t == null ? void 0 : t.strike, "mark.strike"),
|
|
8274
|
+
vf(t == null ? void 0 : t.code, "mark.code"),
|
|
8275
|
+
yf(t == null ? void 0 : t.color, "mark.color"),
|
|
8276
|
+
yf(t == null ? void 0 : t.fontSize, "mark.font-size")
|
|
8263
8277
|
]);
|
|
8264
8278
|
}
|
|
8265
|
-
function
|
|
8279
|
+
function mf(e) {
|
|
8266
8280
|
return U.marks(e);
|
|
8267
8281
|
}
|
|
8268
|
-
function
|
|
8282
|
+
function hf({ children: e, leaf: t }) {
|
|
8269
8283
|
let n = t;
|
|
8270
|
-
if (!
|
|
8271
|
-
let r =
|
|
8284
|
+
if (!gf(n)) return e;
|
|
8285
|
+
let r = _f(e, n);
|
|
8272
8286
|
return !n.color && !n.fontSize ? r : /* @__PURE__ */ x("span", {
|
|
8273
8287
|
style: {
|
|
8274
8288
|
color: n.color,
|
|
@@ -8277,73 +8291,73 @@ function gf({ children: e, leaf: t }) {
|
|
|
8277
8291
|
children: r
|
|
8278
8292
|
});
|
|
8279
8293
|
}
|
|
8280
|
-
function
|
|
8294
|
+
function gf(e) {
|
|
8281
8295
|
return !!(e.bold || e.code || e.color || e.fontSize || e.italic || e.strike || e.underline);
|
|
8282
8296
|
}
|
|
8283
|
-
function
|
|
8297
|
+
function _f(e, t) {
|
|
8284
8298
|
let n = e;
|
|
8285
8299
|
return t.code && (n = /* @__PURE__ */ x("code", { children: n })), t.bold && (n = /* @__PURE__ */ x("strong", { children: n })), t.italic && (n = /* @__PURE__ */ x("em", { children: n })), t.underline && (n = /* @__PURE__ */ x("u", { children: n })), t.strike && (n = /* @__PURE__ */ x("s", { children: n })), n;
|
|
8286
8300
|
}
|
|
8287
|
-
function
|
|
8301
|
+
function vf(e, t) {
|
|
8288
8302
|
return e ? { command: t } : null;
|
|
8289
8303
|
}
|
|
8290
|
-
function
|
|
8304
|
+
function yf(e, t) {
|
|
8291
8305
|
return e ? {
|
|
8292
8306
|
command: t,
|
|
8293
8307
|
payload: e
|
|
8294
8308
|
} : null;
|
|
8295
8309
|
}
|
|
8296
|
-
function
|
|
8297
|
-
return
|
|
8310
|
+
function bf(e) {
|
|
8311
|
+
return kf(e) && e.level ? {
|
|
8298
8312
|
command: "block.heading",
|
|
8299
8313
|
payload: { level: e.level }
|
|
8300
8314
|
} : null;
|
|
8301
8315
|
}
|
|
8302
|
-
function
|
|
8303
|
-
return
|
|
8316
|
+
function xf(e, t, n) {
|
|
8317
|
+
return Af(e) && e.listKind === t ? { command: n } : null;
|
|
8304
8318
|
}
|
|
8305
|
-
function
|
|
8306
|
-
return
|
|
8319
|
+
function Sf(e) {
|
|
8320
|
+
return Of(e) && e.align ? {
|
|
8307
8321
|
command: "block.align",
|
|
8308
8322
|
payload: e.align
|
|
8309
8323
|
} : null;
|
|
8310
8324
|
}
|
|
8311
|
-
function
|
|
8325
|
+
function Cf(e) {
|
|
8312
8326
|
return e.filter((e) => !!e);
|
|
8313
8327
|
}
|
|
8314
|
-
function
|
|
8328
|
+
function wf(e, t) {
|
|
8315
8329
|
return {
|
|
8316
8330
|
action: t,
|
|
8317
8331
|
key: e
|
|
8318
8332
|
};
|
|
8319
8333
|
}
|
|
8320
|
-
function
|
|
8334
|
+
function Tf(e) {
|
|
8321
8335
|
return {
|
|
8322
8336
|
deserialize: ({ input: t }) => bu(t) && t.type === e && Array.isArray(t.children) ? $u(t) : null,
|
|
8323
8337
|
serialize: ({ node: t }) => t.type === e ? t : null
|
|
8324
8338
|
};
|
|
8325
8339
|
}
|
|
8326
|
-
function
|
|
8340
|
+
function Ef({ deserializeChildren: e, element: t }) {
|
|
8327
8341
|
let n = Number(t.tagName.slice(1));
|
|
8328
8342
|
return /^H[1-3]$/.exec(t.tagName) ? vu("heading", e(t), { level: n }) : null;
|
|
8329
8343
|
}
|
|
8330
|
-
function
|
|
8344
|
+
function Df(e) {
|
|
8331
8345
|
return e === 1 || e === 2 || e === 3;
|
|
8332
8346
|
}
|
|
8333
|
-
function
|
|
8347
|
+
function Of(e) {
|
|
8334
8348
|
return !!e;
|
|
8335
8349
|
}
|
|
8336
|
-
function
|
|
8350
|
+
function kf(e) {
|
|
8337
8351
|
return (e == null ? void 0 : e.type) === "heading";
|
|
8338
8352
|
}
|
|
8339
|
-
function
|
|
8353
|
+
function Af(e) {
|
|
8340
8354
|
return (e == null ? void 0 : e.type) === "list";
|
|
8341
8355
|
}
|
|
8342
|
-
function
|
|
8356
|
+
function jf(e) {
|
|
8343
8357
|
return e;
|
|
8344
8358
|
}
|
|
8345
|
-
function
|
|
8346
|
-
let r = n, i =
|
|
8359
|
+
function Mf(e, t, n) {
|
|
8360
|
+
let r = n, i = Lf(r);
|
|
8347
8361
|
return r.level === 1 ? /* @__PURE__ */ x("h1", I(I({}, e), {}, {
|
|
8348
8362
|
style: i,
|
|
8349
8363
|
children: t
|
|
@@ -8355,29 +8369,29 @@ function Nf(e, t, n) {
|
|
|
8355
8369
|
children: t
|
|
8356
8370
|
}));
|
|
8357
8371
|
}
|
|
8358
|
-
function
|
|
8359
|
-
let r = n, i =
|
|
8372
|
+
function Nf(e, t, n) {
|
|
8373
|
+
let r = n, i = Lf(r);
|
|
8360
8374
|
return r.listKind === "numbered" ? /* @__PURE__ */ x("ol", I(I({}, e), {}, {
|
|
8361
8375
|
style: i,
|
|
8362
|
-
children:
|
|
8376
|
+
children: t
|
|
8363
8377
|
})) : /* @__PURE__ */ x("ul", I(I({}, e), {}, {
|
|
8364
8378
|
style: i,
|
|
8365
|
-
children:
|
|
8379
|
+
children: t
|
|
8366
8380
|
}));
|
|
8367
8381
|
}
|
|
8368
|
-
function
|
|
8382
|
+
function Pf(e, t, n) {
|
|
8369
8383
|
return /* @__PURE__ */ x("p", I(I({}, e), {}, {
|
|
8370
|
-
style:
|
|
8384
|
+
style: Lf(n),
|
|
8371
8385
|
children: t
|
|
8372
8386
|
}));
|
|
8373
8387
|
}
|
|
8374
|
-
function
|
|
8388
|
+
function Ff(e, t, n) {
|
|
8375
8389
|
return /* @__PURE__ */ x("li", I(I({}, e), {}, {
|
|
8376
|
-
style:
|
|
8390
|
+
style: Lf(n),
|
|
8377
8391
|
children: t
|
|
8378
8392
|
}));
|
|
8379
8393
|
}
|
|
8380
|
-
function
|
|
8394
|
+
function If(e, t) {
|
|
8381
8395
|
return /* @__PURE__ */ S("div", I(I({}, e), {}, {
|
|
8382
8396
|
className: at["divider-block"],
|
|
8383
8397
|
children: [/* @__PURE__ */ x("div", {
|
|
@@ -8386,155 +8400,254 @@ function Lf(e, t) {
|
|
|
8386
8400
|
}), t]
|
|
8387
8401
|
}));
|
|
8388
8402
|
}
|
|
8389
|
-
function
|
|
8403
|
+
function Lf(e) {
|
|
8390
8404
|
return { textAlign: e.align };
|
|
8391
8405
|
}
|
|
8392
|
-
function
|
|
8406
|
+
function Rf(e) {
|
|
8393
8407
|
return bu(e) ? {
|
|
8394
8408
|
alt: typeof e.alt == "string" ? e.alt : "",
|
|
8395
8409
|
height: Su(e.height),
|
|
8396
|
-
src:
|
|
8410
|
+
src: zf(e),
|
|
8397
8411
|
width: Su(e.width)
|
|
8398
8412
|
} : {};
|
|
8399
8413
|
}
|
|
8400
|
-
function
|
|
8414
|
+
function zf(e) {
|
|
8401
8415
|
return typeof e.src == "string" ? e.src : "";
|
|
8402
8416
|
}
|
|
8403
|
-
function
|
|
8417
|
+
function Bf(e) {
|
|
8404
8418
|
return bu(e) ? {
|
|
8405
8419
|
latex: typeof e.latex == "string" ? e.latex : "",
|
|
8406
8420
|
src: typeof e.src == "string" ? e.src : ""
|
|
8407
8421
|
} : {};
|
|
8408
8422
|
}
|
|
8409
|
-
function
|
|
8410
|
-
|
|
8423
|
+
function Vf(e) {
|
|
8424
|
+
var t;
|
|
8425
|
+
if (e.tagName !== "IMG") return null;
|
|
8426
|
+
let n = (t = e.getAttribute("src")) == null ? "" : t, r = Wf(n);
|
|
8427
|
+
return r ? {
|
|
8428
|
+
latex: r,
|
|
8429
|
+
src: n
|
|
8430
|
+
} : null;
|
|
8431
|
+
}
|
|
8432
|
+
function Hf(e) {
|
|
8433
|
+
var t, n;
|
|
8434
|
+
return vu("image", [{ text: "" }], {
|
|
8435
|
+
alt: (t = e.getAttribute("alt")) == null ? "" : t,
|
|
8436
|
+
height: Kf(e, "height"),
|
|
8437
|
+
src: (n = e.getAttribute("src")) == null ? "" : n,
|
|
8438
|
+
width: Kf(e, "width")
|
|
8439
|
+
});
|
|
8440
|
+
}
|
|
8441
|
+
function Uf(e, t) {
|
|
8442
|
+
return `<img class="math-inline" data-math="inline" alt="${wu(e)}" src="${wu(t)}" style="display:inline-block;vertical-align:middle;" />`;
|
|
8443
|
+
}
|
|
8444
|
+
function Wf(e) {
|
|
8445
|
+
try {
|
|
8446
|
+
var t, n;
|
|
8447
|
+
let r = new URL(e);
|
|
8448
|
+
return r.pathname.includes("/document-render/api/math-svg") ? (t = (n = r.searchParams.get("mathUrl")) == null ? void 0 : n.trim()) == null ? "" : t : "";
|
|
8449
|
+
} catch (e) {
|
|
8450
|
+
return "";
|
|
8451
|
+
}
|
|
8411
8452
|
}
|
|
8412
|
-
function
|
|
8453
|
+
function Gf(e) {
|
|
8454
|
+
let t = e.style.textAlign;
|
|
8455
|
+
return t === "center" || t === "left" || t === "right" ? { align: t } : {};
|
|
8456
|
+
}
|
|
8457
|
+
function Kf(e, t) {
|
|
8458
|
+
var n;
|
|
8459
|
+
return (n = qf(t === "height" ? e.style.height : e.style.width)) == null ? qf(e.getAttribute(t)) : n;
|
|
8460
|
+
}
|
|
8461
|
+
function qf(e) {
|
|
8462
|
+
var t;
|
|
8463
|
+
let n = (t = e == null ? void 0 : e.trim()) == null ? "" : t, r = n.toLowerCase().endsWith("px") ? n.slice(0, -2) : n;
|
|
8464
|
+
if (Jf(r)) return Su(Number(r));
|
|
8465
|
+
}
|
|
8466
|
+
function Jf(e) {
|
|
8467
|
+
let t = e.indexOf(".");
|
|
8468
|
+
return e.length === 0 || t !== e.lastIndexOf(".") || t === 0 || t === e.length - 1 ? !1 : [...e].every((e, n) => n === t ? !0 : e >= "0" && e <= "9");
|
|
8469
|
+
}
|
|
8470
|
+
function Yf(e) {
|
|
8413
8471
|
let t = Su(e.width), n = Su(e.height), r = [t ? `width="${t}"` : "", n ? `height="${n}"` : ""].filter(Boolean);
|
|
8414
8472
|
return r.length > 0 ? ` ${r.join(" ")}` : "";
|
|
8415
8473
|
}
|
|
8416
|
-
function
|
|
8474
|
+
function Xf(e) {
|
|
8417
8475
|
let t = bu(e) ? Number(e.rows) : 3, n = bu(e) ? Number(e.columns) : 3;
|
|
8418
8476
|
return {
|
|
8419
8477
|
columns: Number.isFinite(n) && n > 0 ? n : 3,
|
|
8420
8478
|
rows: Number.isFinite(t) && t > 0 ? t : 3
|
|
8421
8479
|
};
|
|
8422
8480
|
}
|
|
8423
|
-
var
|
|
8481
|
+
var Zf = new Map([
|
|
8424
8482
|
["bold", (e) => !!(e != null && e.bold)],
|
|
8425
8483
|
["code", (e) => !!(e != null && e.code)],
|
|
8426
8484
|
["italic", (e) => !!(e != null && e.italic)],
|
|
8427
8485
|
["strike", (e) => !!(e != null && e.strike)],
|
|
8428
8486
|
["underline", (e) => !!(e != null && e.underline)]
|
|
8429
8487
|
]);
|
|
8430
|
-
function
|
|
8488
|
+
function Qf(e, t) {
|
|
8431
8489
|
return JSON.stringify(e) === JSON.stringify(t);
|
|
8432
8490
|
}
|
|
8433
|
-
function
|
|
8434
|
-
return
|
|
8491
|
+
function $f(e) {
|
|
8492
|
+
return Fd(e) ? Id(e) : !1;
|
|
8435
8493
|
}
|
|
8436
|
-
function
|
|
8437
|
-
return
|
|
8494
|
+
function ep(e, t) {
|
|
8495
|
+
return Fd(e) ? (Id(e), !0) : t === "backward" ? Ld(e) : Rd(e);
|
|
8438
8496
|
}
|
|
8439
|
-
function
|
|
8440
|
-
return
|
|
8497
|
+
function tp(e) {
|
|
8498
|
+
return Fd(e) ? (Id(e), !0) : !1;
|
|
8441
8499
|
}
|
|
8442
|
-
function
|
|
8443
|
-
return
|
|
8500
|
+
function np(e, t) {
|
|
8501
|
+
return Fd(e) ? (Id(e), !0) : t === "Backspace" ? Ld(e) : Rd(e);
|
|
8444
8502
|
}
|
|
8445
|
-
function
|
|
8446
|
-
if (
|
|
8503
|
+
function rp(e, t) {
|
|
8504
|
+
if (op(U.marks(e), t)) {
|
|
8447
8505
|
U.removeMark(e, t);
|
|
8448
8506
|
return;
|
|
8449
8507
|
}
|
|
8450
8508
|
U.addMark(e, t, !0);
|
|
8451
8509
|
}
|
|
8452
|
-
function
|
|
8510
|
+
function ip(e, t, n) {
|
|
8453
8511
|
if (!(typeof n != "string" || n.length === 0)) {
|
|
8454
|
-
if (
|
|
8512
|
+
if (ap(U.marks(e), t) === n) {
|
|
8455
8513
|
U.removeMark(e, t);
|
|
8456
8514
|
return;
|
|
8457
8515
|
}
|
|
8458
8516
|
U.addMark(e, t, n);
|
|
8459
8517
|
}
|
|
8460
8518
|
}
|
|
8461
|
-
function
|
|
8519
|
+
function ap(e, t) {
|
|
8462
8520
|
return t === "color" ? e == null ? void 0 : e.color : e == null ? void 0 : e.fontSize;
|
|
8463
8521
|
}
|
|
8464
|
-
function
|
|
8522
|
+
function op(e, t) {
|
|
8465
8523
|
var n, r;
|
|
8466
|
-
return (n = (r =
|
|
8524
|
+
return (n = (r = Zf.get(t)) == null ? void 0 : r(e)) == null ? !1 : n;
|
|
8467
8525
|
}
|
|
8468
|
-
function
|
|
8526
|
+
function sp(e, t) {
|
|
8469
8527
|
if (t === "center" || t === "left" || t === "right") {
|
|
8470
|
-
let n =
|
|
8528
|
+
let n = fp(e), r = { align: Of(n) && n.align === t ? void 0 : t };
|
|
8471
8529
|
q.setNodes(e, r, { match: (t) => B.isElement(t) && U.isBlock(e, t) });
|
|
8472
8530
|
}
|
|
8473
8531
|
}
|
|
8474
|
-
function
|
|
8475
|
-
let n =
|
|
8532
|
+
function cp(e, t) {
|
|
8533
|
+
let n = lp(t);
|
|
8476
8534
|
if (!n) return;
|
|
8477
|
-
let r =
|
|
8535
|
+
let r = fp(e), i = kf(r) && r.level === n, a = {
|
|
8478
8536
|
level: i ? void 0 : n,
|
|
8479
8537
|
type: i ? "paragraph" : "heading"
|
|
8480
8538
|
};
|
|
8481
8539
|
q.setNodes(e, a, { match: (t) => B.isElement(t) && U.isBlock(e, t) });
|
|
8482
8540
|
}
|
|
8483
|
-
function
|
|
8541
|
+
function lp(e) {
|
|
8484
8542
|
let t = e && typeof e == "object" && "level" in e ? e.level : void 0;
|
|
8485
8543
|
return t === 1 || t === 2 || t === 3 ? t : null;
|
|
8486
8544
|
}
|
|
8487
|
-
function
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8545
|
+
function up(e, t) {
|
|
8546
|
+
var n;
|
|
8547
|
+
let r = dp(e);
|
|
8548
|
+
if (Af((n = r == null ? void 0 : r[0]) == null ? null : n) && (r == null ? void 0 : r[0].listKind) === t) {
|
|
8549
|
+
q.unwrapNodes(e, {
|
|
8550
|
+
match: (e) => Q(e) && e.type === "list",
|
|
8551
|
+
split: !0
|
|
8552
|
+
}), q.setNodes(e, { type: "paragraph" }, { match: (e) => Q(e) && e.type === "list-item" });
|
|
8553
|
+
return;
|
|
8554
|
+
}
|
|
8555
|
+
if (r) {
|
|
8556
|
+
let n = { listKind: t };
|
|
8557
|
+
q.setNodes(e, n, { at: r[1] });
|
|
8558
|
+
return;
|
|
8559
|
+
}
|
|
8560
|
+
q.setNodes(e, { type: "list-item" }, { match: (t) => B.isElement(t) && U.isBlock(e, t) && !U.isEditor(t) }), q.wrapNodes(e, {
|
|
8561
|
+
children: [],
|
|
8562
|
+
listKind: t,
|
|
8563
|
+
type: "list"
|
|
8564
|
+
}, {
|
|
8565
|
+
match: (e) => Q(e) && e.type === "list-item",
|
|
8566
|
+
split: !0
|
|
8567
|
+
});
|
|
8493
8568
|
}
|
|
8494
|
-
function
|
|
8569
|
+
function dp(e) {
|
|
8570
|
+
if (!e.selection) return null;
|
|
8571
|
+
let [t] = U.nodes(e, {
|
|
8572
|
+
at: U.unhangRange(e, e.selection),
|
|
8573
|
+
match: (e) => Q(e) && e.type === "list"
|
|
8574
|
+
});
|
|
8575
|
+
return t && Q(t[0]) ? t : null;
|
|
8576
|
+
}
|
|
8577
|
+
function fp(e) {
|
|
8495
8578
|
if (!e.selection) return null;
|
|
8496
8579
|
let [t] = U.nodes(e, {
|
|
8497
8580
|
at: U.unhangRange(e, e.selection),
|
|
8498
8581
|
match: (t) => B.isElement(t) && U.isBlock(e, t) && !G.isText(t)
|
|
8499
8582
|
});
|
|
8500
|
-
return t &&
|
|
8583
|
+
return t && Q(t[0]) ? t[0] : null;
|
|
8501
8584
|
}
|
|
8502
8585
|
//#endregion
|
|
8503
8586
|
//#region src/rich-text-editor/primitives/featureRegistry.ts
|
|
8504
|
-
function
|
|
8505
|
-
let t =
|
|
8506
|
-
return
|
|
8587
|
+
function pp(e = []) {
|
|
8588
|
+
let t = hp(e);
|
|
8589
|
+
return mp([...cf, t]);
|
|
8507
8590
|
}
|
|
8508
|
-
function
|
|
8509
|
-
let t =
|
|
8591
|
+
function mp(e) {
|
|
8592
|
+
let t = wp(e), n = Tp(e), r = Ep(e), i = Dp(e), a = kp(e), o = Ap(a), s = Op(e), c = jp(e), l = Mp(e), u = Np(t, (e) => e.type, "Duplicate RichTextEditor node definition"), d = Np(n, (e) => e.command, "Duplicate RichTextEditor command definition"), f = Np(r, (e) => e.key, "Duplicate RichTextEditor toolbar action definition");
|
|
8510
8593
|
return {
|
|
8511
8594
|
commandDefinitions: n,
|
|
8512
|
-
createDefaultElement:
|
|
8595
|
+
createDefaultElement: l,
|
|
8513
8596
|
definitions: t,
|
|
8514
8597
|
featureDefinitions: e,
|
|
8515
|
-
get: (e) =>
|
|
8516
|
-
getCommand: (e) =>
|
|
8517
|
-
getToolbarAction: (e) =>
|
|
8598
|
+
get: (e) => u.get(e),
|
|
8599
|
+
getCommand: (e) => d.get(e),
|
|
8600
|
+
getToolbarAction: (e) => f.get(e),
|
|
8601
|
+
clearOnSelectionDeleteMarkKeys: o,
|
|
8518
8602
|
toolbarActions: r,
|
|
8519
8603
|
toolbarGroups: i,
|
|
8520
|
-
|
|
8521
|
-
|
|
8604
|
+
markDefinitions: a,
|
|
8605
|
+
leafRenderers: s,
|
|
8606
|
+
toolbarStateReaders: c
|
|
8522
8607
|
};
|
|
8523
8608
|
}
|
|
8524
|
-
function
|
|
8609
|
+
function hp(e) {
|
|
8525
8610
|
return {
|
|
8526
8611
|
key: "plugins",
|
|
8612
|
+
commands: e.reduce((e, t) => {
|
|
8613
|
+
var n;
|
|
8614
|
+
return [...e, ...((n = t.marks) == null ? [] : n).reduce((e, t) => [...e, ...gp(t)], [])];
|
|
8615
|
+
}, []),
|
|
8616
|
+
marks: e.reduce((e, t) => {
|
|
8617
|
+
var n;
|
|
8618
|
+
return [...e, ...((n = t.marks) == null ? [] : n).map(_p)];
|
|
8619
|
+
}, []),
|
|
8527
8620
|
nodes: e.reduce((e, t) => {
|
|
8528
8621
|
var n;
|
|
8529
|
-
return [...e, ...((n = t.nodes) == null ? [] : n).map(
|
|
8622
|
+
return [...e, ...((n = t.nodes) == null ? [] : n).map(vp)];
|
|
8530
8623
|
}, [])
|
|
8531
8624
|
};
|
|
8532
8625
|
}
|
|
8533
|
-
function
|
|
8626
|
+
function gp(e) {
|
|
8627
|
+
var t;
|
|
8628
|
+
return ((t = e.commands) == null ? [] : t).map((e) => ({
|
|
8629
|
+
command: e.command,
|
|
8630
|
+
run: ({ command: t, editor: n }) => {
|
|
8631
|
+
var r;
|
|
8632
|
+
return !n.selection || z.isCollapsed(n.selection) ? !1 : t.payload === null || t.payload === !1 ? (n.removeMark(e.markKey), !0) : (n.addMark(e.markKey, (r = t.payload) == null ? !0 : r), !0);
|
|
8633
|
+
}
|
|
8634
|
+
}));
|
|
8635
|
+
}
|
|
8636
|
+
function _p(e) {
|
|
8637
|
+
var t, n, r, i;
|
|
8638
|
+
return {
|
|
8639
|
+
clearOnSelectionDeleteMarkKeys: (t = e.behavior) != null && t.clearOnSelectionDelete ? ((n = e.commands) == null ? [] : n).map((e) => e.markKey) : [],
|
|
8640
|
+
commands: gp(e),
|
|
8641
|
+
deserializeHtml: (r = e.codecs) == null || (r = r.html) == null ? void 0 : r.deserialize,
|
|
8642
|
+
renderLeaf: e.render,
|
|
8643
|
+
serializeHtml: (i = e.codecs) == null || (i = i.html) == null ? void 0 : i.serialize
|
|
8644
|
+
};
|
|
8645
|
+
}
|
|
8646
|
+
function vp(e) {
|
|
8534
8647
|
let t = e.render;
|
|
8535
8648
|
return {
|
|
8536
|
-
codecs:
|
|
8537
|
-
commands:
|
|
8649
|
+
codecs: bp(e.codecs),
|
|
8650
|
+
commands: yp(e.commands),
|
|
8538
8651
|
object: e.object,
|
|
8539
8652
|
render: t ? (e) => s("div", e.attributes, t({
|
|
8540
8653
|
children: e.children,
|
|
@@ -8544,7 +8657,7 @@ function lp(e) {
|
|
|
8544
8657
|
type: e.type
|
|
8545
8658
|
};
|
|
8546
8659
|
}
|
|
8547
|
-
function
|
|
8660
|
+
function yp(e) {
|
|
8548
8661
|
return e ? { insert: e.insert ? (t) => {
|
|
8549
8662
|
var n;
|
|
8550
8663
|
let r = (n = e.insert) == null ? void 0 : n.call(e, { payload: t.payload });
|
|
@@ -8557,21 +8670,21 @@ function up(e) {
|
|
|
8557
8670
|
} : null;
|
|
8558
8671
|
} : void 0 } : void 0;
|
|
8559
8672
|
}
|
|
8560
|
-
function
|
|
8673
|
+
function bp(e) {
|
|
8561
8674
|
return e ? {
|
|
8562
|
-
html:
|
|
8675
|
+
html: Sp(e.html),
|
|
8563
8676
|
hyperscript: e.hyperscript,
|
|
8564
|
-
json:
|
|
8677
|
+
json: Cp(e.json)
|
|
8565
8678
|
} : void 0;
|
|
8566
8679
|
}
|
|
8567
|
-
function
|
|
8680
|
+
function xp(e) {
|
|
8568
8681
|
return e ? Array.isArray(e) ? ed(e) : [$u(e)] : null;
|
|
8569
8682
|
}
|
|
8570
|
-
function
|
|
8683
|
+
function Sp(e) {
|
|
8571
8684
|
if (e) return {
|
|
8572
8685
|
deserialize: e.deserialize ? (t) => {
|
|
8573
8686
|
var n;
|
|
8574
|
-
return
|
|
8687
|
+
return xp((n = e.deserialize) == null ? void 0 : n.call(e, {
|
|
8575
8688
|
deserializeChildren: (e) => Qu(t.deserializeChildren(e)),
|
|
8576
8689
|
element: t.element
|
|
8577
8690
|
}));
|
|
@@ -8585,11 +8698,11 @@ function pp(e) {
|
|
|
8585
8698
|
} : void 0
|
|
8586
8699
|
};
|
|
8587
8700
|
}
|
|
8588
|
-
function
|
|
8701
|
+
function Cp(e) {
|
|
8589
8702
|
if (e) return {
|
|
8590
8703
|
deserialize: e.deserialize ? (t) => {
|
|
8591
8704
|
var n;
|
|
8592
|
-
return
|
|
8705
|
+
return xp((n = e.deserialize) == null ? void 0 : n.call(e, t));
|
|
8593
8706
|
} : void 0,
|
|
8594
8707
|
serialize: e.serialize ? (t) => {
|
|
8595
8708
|
var n;
|
|
@@ -8597,42 +8710,64 @@ function mp(e) {
|
|
|
8597
8710
|
} : void 0
|
|
8598
8711
|
};
|
|
8599
8712
|
}
|
|
8600
|
-
function
|
|
8713
|
+
function wp(e) {
|
|
8601
8714
|
return e.reduce((e, t) => {
|
|
8602
8715
|
var n;
|
|
8603
8716
|
return [...e, ...(n = t.nodes) == null ? [] : n];
|
|
8604
8717
|
}, []);
|
|
8605
8718
|
}
|
|
8606
|
-
function
|
|
8719
|
+
function Tp(e) {
|
|
8607
8720
|
return e.reduce((e, t) => {
|
|
8608
8721
|
var n;
|
|
8609
8722
|
return [...e, ...(n = t.commands) == null ? [] : n];
|
|
8610
8723
|
}, []);
|
|
8611
8724
|
}
|
|
8612
|
-
function
|
|
8725
|
+
function Ep(e) {
|
|
8613
8726
|
return e.reduce((e, t) => {
|
|
8614
8727
|
var n;
|
|
8615
8728
|
return [...e, ...(n = t.toolbarActions) == null ? [] : n];
|
|
8616
8729
|
}, []);
|
|
8617
8730
|
}
|
|
8618
|
-
function
|
|
8731
|
+
function Dp(e) {
|
|
8619
8732
|
return e.reduce((e, t) => {
|
|
8620
8733
|
var n;
|
|
8621
8734
|
return [...e, ...(n = t.toolbarGroups) == null ? [] : n];
|
|
8622
8735
|
}, []);
|
|
8623
8736
|
}
|
|
8624
|
-
function
|
|
8625
|
-
return e.reduce((e, t) =>
|
|
8737
|
+
function Op(e) {
|
|
8738
|
+
return e.reduce((e, t) => {
|
|
8739
|
+
var n;
|
|
8740
|
+
return [
|
|
8741
|
+
...e,
|
|
8742
|
+
...t.renderLeaf ? [t.renderLeaf] : [],
|
|
8743
|
+
...((n = t.marks) == null ? [] : n).reduce((e, t) => t.renderLeaf ? [...e, t.renderLeaf] : e, [])
|
|
8744
|
+
];
|
|
8745
|
+
}, []);
|
|
8626
8746
|
}
|
|
8627
|
-
function
|
|
8747
|
+
function kp(e) {
|
|
8748
|
+
return e.reduce((e, t) => {
|
|
8749
|
+
var n;
|
|
8750
|
+
return [...e, ...(n = t.marks) == null ? [] : n];
|
|
8751
|
+
}, []);
|
|
8752
|
+
}
|
|
8753
|
+
function Ap(e) {
|
|
8754
|
+
let t = /* @__PURE__ */ new Set();
|
|
8755
|
+
return e.forEach((e) => {
|
|
8756
|
+
var n;
|
|
8757
|
+
(n = e.clearOnSelectionDeleteMarkKeys) == null || n.forEach((e) => {
|
|
8758
|
+
t.add(e);
|
|
8759
|
+
});
|
|
8760
|
+
}), Array.from(t);
|
|
8761
|
+
}
|
|
8762
|
+
function jp(e) {
|
|
8628
8763
|
return e.reduce((e, t) => t.readToolbarState ? [...e, t.readToolbarState] : e, []);
|
|
8629
8764
|
}
|
|
8630
|
-
function
|
|
8765
|
+
function Mp(e) {
|
|
8631
8766
|
let t = e.map((e) => e.createDefaultElement).filter((e) => !!e);
|
|
8632
8767
|
if (t.length !== 1) throw Error(`Expected exactly one RichTextEditor default element factory, received ${t.length}.`);
|
|
8633
8768
|
return t[0];
|
|
8634
8769
|
}
|
|
8635
|
-
function
|
|
8770
|
+
function Np(e, t, n) {
|
|
8636
8771
|
let r = /* @__PURE__ */ new Map();
|
|
8637
8772
|
return e.forEach((e) => {
|
|
8638
8773
|
let i = t(e);
|
|
@@ -8641,8 +8776,217 @@ function Sp(e, t, n) {
|
|
|
8641
8776
|
}), r;
|
|
8642
8777
|
}
|
|
8643
8778
|
//#endregion
|
|
8779
|
+
//#region src/rich-text-editor/primitives/codecs.ts
|
|
8780
|
+
function Pp(e, t = {}) {
|
|
8781
|
+
let n = pp(t.plugins);
|
|
8782
|
+
return qp(Fp(e, n), n);
|
|
8783
|
+
}
|
|
8784
|
+
function Fp(e, t) {
|
|
8785
|
+
return rm(zp(new DOMParser().parseFromString(e, "text/html").body, t, {}), t);
|
|
8786
|
+
}
|
|
8787
|
+
function Ip(e, t = {}) {
|
|
8788
|
+
let n = pp(t.plugins);
|
|
8789
|
+
return Zu(e).filter((e, t, n) => !Yp(n, t)).map((e) => Vp(e, n)).join("");
|
|
8790
|
+
}
|
|
8791
|
+
function Lp(e, t = {}) {
|
|
8792
|
+
let n = pp(t.plugins);
|
|
8793
|
+
return qp((Array.isArray(e) ? e : [e]).reduce((e, t) => [...e, ...Gp(t, n)], []), n);
|
|
8794
|
+
}
|
|
8795
|
+
function Rp(e, t = {}) {
|
|
8796
|
+
let n = pp(t.plugins);
|
|
8797
|
+
return Zu(e).map((e) => Kp(e, n));
|
|
8798
|
+
}
|
|
8799
|
+
function zp(e, t, n) {
|
|
8800
|
+
return Array.from(e.childNodes).reduce((e, r) => [...e, ...Bp(r, t, n)], []);
|
|
8801
|
+
}
|
|
8802
|
+
function Bp(e, t, n) {
|
|
8803
|
+
if (e.nodeType === Node.TEXT_NODE) {
|
|
8804
|
+
var r;
|
|
8805
|
+
return [I(I({}, n), {}, { text: (r = e.textContent) == null ? "" : r })];
|
|
8806
|
+
}
|
|
8807
|
+
if (!(e instanceof HTMLElement) || lm(e)) return [];
|
|
8808
|
+
let i = dm(e, t, n);
|
|
8809
|
+
if (e.tagName === "BR") return [I(I({}, i), {}, { text: "\n" })];
|
|
8810
|
+
let a = Wp(e, t, i);
|
|
8811
|
+
return a ? Array.isArray(a) ? a : [a] : zp(e, t, i);
|
|
8812
|
+
}
|
|
8813
|
+
function Vp(e, t) {
|
|
8814
|
+
if (G.isText(e)) return Up(e, t);
|
|
8815
|
+
if (!Q(e)) return "";
|
|
8816
|
+
let n = t.definitions.map((n) => {
|
|
8817
|
+
var r, i;
|
|
8818
|
+
return (r = n.codecs) == null || (r = r.html) == null || (i = r.serialize) == null ? void 0 : i.call(r, {
|
|
8819
|
+
node: e,
|
|
8820
|
+
serializeChildren: (e) => e.children.map((e) => Vp(e, t)).join("")
|
|
8821
|
+
});
|
|
8822
|
+
}).find((e) => e != null);
|
|
8823
|
+
return n == null ? "" : n;
|
|
8824
|
+
}
|
|
8825
|
+
function Hp(e, t) {
|
|
8826
|
+
for (let r of t.markDefinitions) {
|
|
8827
|
+
var n;
|
|
8828
|
+
let t = (n = r.deserializeHtml) == null ? void 0 : n.call(r, { element: e });
|
|
8829
|
+
if (t) return t;
|
|
8830
|
+
}
|
|
8831
|
+
return null;
|
|
8832
|
+
}
|
|
8833
|
+
function Up(e, t) {
|
|
8834
|
+
return t.markDefinitions.reduce((t, n) => {
|
|
8835
|
+
var r, i;
|
|
8836
|
+
return (r = (i = n.serializeHtml) == null ? void 0 : i.call(n, {
|
|
8837
|
+
leaf: e,
|
|
8838
|
+
text: t
|
|
8839
|
+
})) == null ? t : r;
|
|
8840
|
+
}, tm(e));
|
|
8841
|
+
}
|
|
8842
|
+
function Wp(e, t, n) {
|
|
8843
|
+
for (let a of t.definitions) {
|
|
8844
|
+
var r, i;
|
|
8845
|
+
let o = (r = a.codecs) == null || (r = r.html) == null || (i = r.deserialize) == null ? void 0 : i.call(r, {
|
|
8846
|
+
deserializeChildren: (e) => zp(e, t, n),
|
|
8847
|
+
element: e
|
|
8848
|
+
});
|
|
8849
|
+
if (o) return o;
|
|
8850
|
+
}
|
|
8851
|
+
return null;
|
|
8852
|
+
}
|
|
8853
|
+
function Gp(e, t) {
|
|
8854
|
+
for (let i of t.definitions) {
|
|
8855
|
+
var n, r;
|
|
8856
|
+
let t = (n = i.codecs) == null || (n = n.json) == null || (r = n.deserialize) == null ? void 0 : r.call(n, { input: e });
|
|
8857
|
+
if (t) return Array.isArray(t) ? t : [t];
|
|
8858
|
+
}
|
|
8859
|
+
return Jp(e) ? [{ text: e.text }] : [];
|
|
8860
|
+
}
|
|
8861
|
+
function Kp(e, t) {
|
|
8862
|
+
if (G.isText(e)) return e;
|
|
8863
|
+
if (!Q(e)) return null;
|
|
8864
|
+
let n = t.definitions.map((t) => {
|
|
8865
|
+
var n, r;
|
|
8866
|
+
return (n = t.codecs) == null || (n = n.json) == null || (r = n.serialize) == null ? void 0 : r.call(n, { node: e });
|
|
8867
|
+
}).find((e) => e != null);
|
|
8868
|
+
return n == null ? null : n;
|
|
8869
|
+
}
|
|
8870
|
+
function qp(e, t) {
|
|
8871
|
+
let n = rm(e, t).filter(Q);
|
|
8872
|
+
return Qu(n.length > 0 ? n : [t.createDefaultElement()]);
|
|
8873
|
+
}
|
|
8874
|
+
function Jp(e) {
|
|
8875
|
+
return !!(e && typeof e == "object" && "text" in e && typeof e.text == "string");
|
|
8876
|
+
}
|
|
8877
|
+
function Yp(e, t) {
|
|
8878
|
+
return Xp(e, t) || Zp(e, t);
|
|
8879
|
+
}
|
|
8880
|
+
function Xp(e, t) {
|
|
8881
|
+
let [n] = e.slice(t, t + 1), [r] = e.slice(t + 1, t + 2);
|
|
8882
|
+
return t < e.length - 1 && Qp(r) && $p(n);
|
|
8883
|
+
}
|
|
8884
|
+
function Zp(e, t) {
|
|
8885
|
+
let [n] = e.slice(t, t + 1), [r] = e.slice(t - 1, t);
|
|
8886
|
+
return t > 0 && Qp(r) && $p(n);
|
|
8887
|
+
}
|
|
8888
|
+
function Qp(e) {
|
|
8889
|
+
return Q(e) && e.type === "table";
|
|
8890
|
+
}
|
|
8891
|
+
function $p(e) {
|
|
8892
|
+
return Q(e) && e.type === "paragraph" && !em(e);
|
|
8893
|
+
}
|
|
8894
|
+
function em(e) {
|
|
8895
|
+
return G.isText(e) ? e.text.replace(/\u200b/g, "").trim().length > 0 : Q(e) ? e.type === "image" ? typeof e.src == "string" && e.src.length > 0 : e.type === "formula" ? typeof e.latex == "string" && e.latex.length > 0 : e.children.some(em) : !1;
|
|
8896
|
+
}
|
|
8897
|
+
function tm(e) {
|
|
8898
|
+
let t = nm(e, Cu(e.text));
|
|
8899
|
+
return [
|
|
8900
|
+
e.code ? "code" : "",
|
|
8901
|
+
e.strike ? "s" : "",
|
|
8902
|
+
e.underline ? "u" : "",
|
|
8903
|
+
e.italic ? "em" : "",
|
|
8904
|
+
e.bold ? "strong" : ""
|
|
8905
|
+
].filter(Boolean).reduce((e, t) => `<${t}>${e}</${t}>`, t);
|
|
8906
|
+
}
|
|
8907
|
+
function nm(e, t) {
|
|
8908
|
+
let n = [e.color ? `color:${Cu(e.color)}` : "", e.fontSize ? `font-size:${Cu(e.fontSize)}px` : ""].filter(Boolean);
|
|
8909
|
+
return n.length > 0 ? `<span style="${n.join(";")}">${t}</span>` : t;
|
|
8910
|
+
}
|
|
8911
|
+
function rm(e, t) {
|
|
8912
|
+
let n = [], r = [], i = () => {
|
|
8913
|
+
r.length !== 0 && (n.push(I(I({}, yu()), {}, { children: om(r, t) })), r = []);
|
|
8914
|
+
};
|
|
8915
|
+
return e.forEach((e) => {
|
|
8916
|
+
if (G.isText(e) || cm(e, t)) {
|
|
8917
|
+
r = [...r, e];
|
|
8918
|
+
return;
|
|
8919
|
+
}
|
|
8920
|
+
Q(e) && (i(), n.push(im(e, t)));
|
|
8921
|
+
}), i(), n;
|
|
8922
|
+
}
|
|
8923
|
+
function im(e, t) {
|
|
8924
|
+
var n;
|
|
8925
|
+
let r = t.get(e.type);
|
|
8926
|
+
return !(r == null || (n = r.schema) == null) && n.void || r != null && r.object ? e : am(e) ? I(I({}, e), {}, { children: om(e.children, t) }) : e.type === "list" ? I(I({}, e), {}, { children: e.children.map((e) => Q(e) ? im(e, t) : e) }) : e;
|
|
8927
|
+
}
|
|
8928
|
+
function am(e) {
|
|
8929
|
+
return [
|
|
8930
|
+
"heading",
|
|
8931
|
+
"list-item",
|
|
8932
|
+
"paragraph"
|
|
8933
|
+
].includes(e.type);
|
|
8934
|
+
}
|
|
8935
|
+
function om(e, t) {
|
|
8936
|
+
let n = e.reduce((e, n, r) => [...e, ...sm(n, t, r)], []);
|
|
8937
|
+
return n.length === 0 ? [{ text: "" }] : n.reduce((e, r, i) => {
|
|
8938
|
+
if (!cm(r, t)) return [...e, r];
|
|
8939
|
+
let a = e[e.length - 1], o = n[i + 1], s = [...G.isText(a) ? e : [...e, { text: "" }], r];
|
|
8940
|
+
return o && G.isText(o) ? s : [...s, { text: "" }];
|
|
8941
|
+
}, []);
|
|
8942
|
+
}
|
|
8943
|
+
function sm(e, t, n) {
|
|
8944
|
+
if (G.isText(e) || cm(e, t)) return [e];
|
|
8945
|
+
if (!Q(e)) return [];
|
|
8946
|
+
let r = e.children.reduce((e, n, r) => [...e, ...sm(n, t, r)], []);
|
|
8947
|
+
return n > 0 && r.length > 0 ? [{ text: "\n" }, ...r] : r;
|
|
8948
|
+
}
|
|
8949
|
+
function cm(e, t) {
|
|
8950
|
+
var n, r, i;
|
|
8951
|
+
if (!Q(e)) return !1;
|
|
8952
|
+
let a = t.get(e.type);
|
|
8953
|
+
return !!((n = a == null || (r = a.schema) == null ? void 0 : r.inline) == null ? !(a == null || (i = a.object) == null) && i.inline : n);
|
|
8954
|
+
}
|
|
8955
|
+
function lm(e) {
|
|
8956
|
+
return [
|
|
8957
|
+
"HEAD",
|
|
8958
|
+
"LINK",
|
|
8959
|
+
"META",
|
|
8960
|
+
"SCRIPT",
|
|
8961
|
+
"STYLE",
|
|
8962
|
+
"TITLE",
|
|
8963
|
+
"XML"
|
|
8964
|
+
].includes(e.tagName);
|
|
8965
|
+
}
|
|
8966
|
+
var um = new Map([
|
|
8967
|
+
["B", { bold: !0 }],
|
|
8968
|
+
["STRONG", { bold: !0 }],
|
|
8969
|
+
["I", { italic: !0 }],
|
|
8970
|
+
["EM", { italic: !0 }],
|
|
8971
|
+
["U", { underline: !0 }],
|
|
8972
|
+
["DEL", { strike: !0 }],
|
|
8973
|
+
["S", { strike: !0 }],
|
|
8974
|
+
["STRIKE", { strike: !0 }],
|
|
8975
|
+
["CODE", { code: !0 }]
|
|
8976
|
+
]);
|
|
8977
|
+
function dm(e, t, n) {
|
|
8978
|
+
var r;
|
|
8979
|
+
let i = I(I({}, n), (r = um.get(e.tagName)) == null ? {} : r), a = e.style;
|
|
8980
|
+
return a.color && (i.color = a.color), a.fontSize && (i.fontSize = fm(a.fontSize)), I(I({}, i), Hp(e, t));
|
|
8981
|
+
}
|
|
8982
|
+
function fm(e) {
|
|
8983
|
+
var t;
|
|
8984
|
+
let n = /\d+/.exec(e);
|
|
8985
|
+
return (t = n == null ? void 0 : n[0]) == null ? e : t;
|
|
8986
|
+
}
|
|
8987
|
+
//#endregion
|
|
8644
8988
|
//#region src/rich-text-editor/primitives/ObjectElement.tsx
|
|
8645
|
-
function
|
|
8989
|
+
function pm({ attributes: e, children: t, element: n, object: r }) {
|
|
8646
8990
|
let i = rs(), a = El(), o = Qc(), { onObjectInteraction: s } = Me(), c = (e) => {
|
|
8647
8991
|
e.preventDefault();
|
|
8648
8992
|
try {
|
|
@@ -8692,11 +9036,11 @@ function Cp({ attributes: e, children: t, element: n, object: r }) {
|
|
|
8692
9036
|
}
|
|
8693
9037
|
//#endregion
|
|
8694
9038
|
//#region src/rich-text-editor/primitives/slateRenderers.tsx
|
|
8695
|
-
function
|
|
9039
|
+
function mm(e) {
|
|
8696
9040
|
return function({ attributes: t, children: n, element: r }) {
|
|
8697
|
-
if (!
|
|
9041
|
+
if (!Q(r)) throw Error("RichTextEditor received a Slate element without a type.");
|
|
8698
9042
|
let i = e.get(r.type);
|
|
8699
|
-
if (i != null && i.object) return /* @__PURE__ */ x(
|
|
9043
|
+
if (i != null && i.object) return /* @__PURE__ */ x(pm, {
|
|
8700
9044
|
attributes: t,
|
|
8701
9045
|
element: r,
|
|
8702
9046
|
object: i.object,
|
|
@@ -8710,7 +9054,7 @@ function wp(e) {
|
|
|
8710
9054
|
});
|
|
8711
9055
|
};
|
|
8712
9056
|
}
|
|
8713
|
-
function
|
|
9057
|
+
function hm(e) {
|
|
8714
9058
|
return function({ attributes: t, children: n, leaf: r }) {
|
|
8715
9059
|
let i = e.leafRenderers.reduce((e, t) => t({
|
|
8716
9060
|
children: e,
|
|
@@ -8721,80 +9065,85 @@ function Tp(e) {
|
|
|
8721
9065
|
}
|
|
8722
9066
|
//#endregion
|
|
8723
9067
|
//#region src/rich-text-editor/primitives/slateRuntime.tsx
|
|
8724
|
-
function
|
|
8725
|
-
let t = g(() =>
|
|
9068
|
+
function gm(e) {
|
|
9069
|
+
let t = g(() => pp(e), [e]);
|
|
8726
9070
|
return {
|
|
8727
|
-
editor: g(() =>
|
|
9071
|
+
editor: g(() => _m(Ta(Il(ba())), t), [t]),
|
|
8728
9072
|
registry: t
|
|
8729
9073
|
};
|
|
8730
9074
|
}
|
|
8731
|
-
function
|
|
9075
|
+
function _m(e, t) {
|
|
8732
9076
|
let { addMark: n, deleteBackward: r, deleteForward: i, deleteFragment: a, insertBreak: o, insertData: s, insertText: c, isInline: l, isVoid: u, markableVoid: d, normalizeNode: f, removeMark: p } = e;
|
|
8733
9077
|
return e.isInline = (e) => {
|
|
8734
9078
|
var n;
|
|
8735
|
-
return (n =
|
|
9079
|
+
return (n = vm(t, e, "inline")) == null ? l(e) : n;
|
|
8736
9080
|
}, e.isVoid = (e) => {
|
|
8737
9081
|
var n;
|
|
8738
|
-
return (n =
|
|
9082
|
+
return (n = vm(t, e, "void")) == null ? u(e) : n;
|
|
8739
9083
|
}, e.markableVoid = (e) => {
|
|
8740
9084
|
var n;
|
|
8741
|
-
return (n =
|
|
9085
|
+
return (n = vm(t, e, "markableVoid")) == null ? d(e) : n;
|
|
8742
9086
|
}, e.normalizeNode = (n) => {
|
|
8743
|
-
|
|
9087
|
+
bm(e, t, n) || f(n);
|
|
8744
9088
|
}, e.insertText = (n) => {
|
|
8745
|
-
|
|
9089
|
+
Sm(e, t, (e) => {
|
|
8746
9090
|
var t, r;
|
|
8747
9091
|
return (t = e.definition.behavior) == null || (r = t.onBeforeInputText) == null ? void 0 : r.call(t, I(I({}, e.action), {}, { text: n }));
|
|
8748
9092
|
}) || c(n);
|
|
8749
9093
|
}, e.insertData = (n) => {
|
|
8750
|
-
|
|
9094
|
+
Sm(e, t, (e) => {
|
|
8751
9095
|
var t, r;
|
|
8752
9096
|
return (t = e.definition.behavior) == null || (r = t.onInsertData) == null ? void 0 : r.call(t, I(I({}, e.action), {}, { data: n }));
|
|
8753
9097
|
}) || s(n);
|
|
8754
9098
|
}, e.insertBreak = () => {
|
|
8755
|
-
|
|
9099
|
+
Sm(e, t, (e) => {
|
|
8756
9100
|
var t, n;
|
|
8757
9101
|
return (t = e.definition.behavior) == null || (n = t.onBreak) == null ? void 0 : n.call(t, e.action);
|
|
8758
9102
|
}) || o();
|
|
8759
9103
|
}, e.deleteBackward = (n) => {
|
|
8760
|
-
|
|
9104
|
+
Cm(e, t, n, "backward") || r(n);
|
|
8761
9105
|
}, e.deleteForward = (n) => {
|
|
8762
|
-
|
|
9106
|
+
Cm(e, t, n, "forward") || i(n);
|
|
8763
9107
|
}, e.deleteFragment = () => {
|
|
8764
|
-
|
|
9108
|
+
let n = Om(e, t);
|
|
9109
|
+
if (wm(e, t)) {
|
|
9110
|
+
km(e, t, n);
|
|
9111
|
+
return;
|
|
9112
|
+
}
|
|
9113
|
+
a(), km(e, t, n);
|
|
8765
9114
|
}, e.addMark = (r, i) => {
|
|
8766
|
-
|
|
9115
|
+
Em(e, t, r, i) || n(r, i);
|
|
8767
9116
|
}, e.removeMark = (n) => {
|
|
8768
|
-
|
|
9117
|
+
Em(e, t, n, void 0) || p(n);
|
|
8769
9118
|
}, e;
|
|
8770
9119
|
}
|
|
8771
|
-
function
|
|
9120
|
+
function vm(e, t, n) {
|
|
8772
9121
|
var r;
|
|
8773
|
-
if (!
|
|
9122
|
+
if (!Q(t)) return;
|
|
8774
9123
|
let i = (r = e.get(t.type)) == null ? void 0 : r.schema;
|
|
8775
|
-
return i ? n === "inline" ? i.inline : n === "markableVoid" ? i.markableVoid : i.void :
|
|
9124
|
+
return i ? n === "inline" ? i.inline : n === "markableVoid" ? i.markableVoid : i.void : ym(e, t, n);
|
|
8776
9125
|
}
|
|
8777
|
-
function
|
|
9126
|
+
function ym(e, t, n) {
|
|
8778
9127
|
var r;
|
|
8779
|
-
if (!
|
|
9128
|
+
if (!Q(t)) return;
|
|
8780
9129
|
let i = (r = e.get(t.type)) == null ? void 0 : r.object;
|
|
8781
9130
|
if (i) return n === "inline" ? i.inline : n === "markableVoid" ? i.markable : !0;
|
|
8782
9131
|
}
|
|
8783
|
-
function
|
|
9132
|
+
function bm(e, t, n) {
|
|
8784
9133
|
var r, i, a;
|
|
8785
9134
|
let [o, s] = n;
|
|
8786
|
-
return
|
|
9135
|
+
return Q(o) ? xm(e, t, o, s) ? !0 : (r = (i = t.get(o.type)) == null || (a = i.normalize) == null ? void 0 : a.call(i, {
|
|
8787
9136
|
editor: e,
|
|
8788
9137
|
element: o,
|
|
8789
9138
|
elementPath: s
|
|
8790
9139
|
})) == null ? !1 : r : !1;
|
|
8791
9140
|
}
|
|
8792
|
-
function
|
|
9141
|
+
function xm(e, t, n, r) {
|
|
8793
9142
|
var i;
|
|
8794
9143
|
return !((i = t.get(n.type)) != null && i.object) || n.children.length === 1 && G.isText(n.children[0]) && n.children[0].text === "" ? !1 : (q.setNodes(e, { children: [{ text: "" }] }, { at: r }), !0);
|
|
8795
9144
|
}
|
|
8796
|
-
function
|
|
8797
|
-
let r =
|
|
9145
|
+
function Sm(e, t, n) {
|
|
9146
|
+
let r = Dm(e);
|
|
8798
9147
|
if (r.length === 0) return !1;
|
|
8799
9148
|
for (let [i, a] of r) {
|
|
8800
9149
|
let r = t.get(i.type);
|
|
@@ -8809,27 +9158,27 @@ function Mp(e, t, n) {
|
|
|
8809
9158
|
}
|
|
8810
9159
|
return !1;
|
|
8811
9160
|
}
|
|
8812
|
-
function
|
|
8813
|
-
return
|
|
9161
|
+
function Cm(e, t, n, r) {
|
|
9162
|
+
return Sm(e, t, (e) => {
|
|
8814
9163
|
var t, i, a, o;
|
|
8815
9164
|
let s = I(I({}, e.action), {}, { unit: n });
|
|
8816
9165
|
return r === "backward" ? (t = e.definition.behavior) == null || (i = t.onDeleteBackward) == null ? void 0 : i.call(t, s) : (a = e.definition.behavior) == null || (o = a.onDeleteForward) == null ? void 0 : o.call(a, s);
|
|
8817
9166
|
});
|
|
8818
9167
|
}
|
|
8819
|
-
function
|
|
8820
|
-
return
|
|
9168
|
+
function wm(e, t) {
|
|
9169
|
+
return Sm(e, t, (e) => {
|
|
8821
9170
|
var t, n;
|
|
8822
9171
|
return (t = e.definition.behavior) == null || (n = t.onDeleteFragment) == null ? void 0 : n.call(t, e.action);
|
|
8823
9172
|
});
|
|
8824
9173
|
}
|
|
8825
|
-
function
|
|
8826
|
-
return
|
|
9174
|
+
function Tm(e, t, n) {
|
|
9175
|
+
return Sm(e, t, (e) => {
|
|
8827
9176
|
var t, r;
|
|
8828
9177
|
return (t = e.definition.behavior) == null || (r = t.onDeleteSelection) == null ? void 0 : r.call(t, I(I({}, e.action), {}, { key: n }));
|
|
8829
9178
|
});
|
|
8830
9179
|
}
|
|
8831
|
-
function
|
|
8832
|
-
return
|
|
9180
|
+
function Em(e, t, n, r) {
|
|
9181
|
+
return Sm(e, t, (e) => {
|
|
8833
9182
|
var t, i;
|
|
8834
9183
|
return (t = e.definition.behavior) == null || (i = t.onMark) == null ? void 0 : i.call(t, I(I({}, e.action), {}, {
|
|
8835
9184
|
key: n,
|
|
@@ -8837,39 +9186,62 @@ function Ip(e, t, n, r) {
|
|
|
8837
9186
|
}));
|
|
8838
9187
|
});
|
|
8839
9188
|
}
|
|
8840
|
-
function
|
|
9189
|
+
function Dm(e) {
|
|
8841
9190
|
return e.selection ? Array.from(U.nodes(e, {
|
|
8842
9191
|
at: U.unhangRange(e, e.selection),
|
|
8843
|
-
match: (e) =>
|
|
9192
|
+
match: (e) => Q(e),
|
|
8844
9193
|
mode: "all",
|
|
8845
9194
|
voids: !0
|
|
8846
|
-
})).filter((e) =>
|
|
9195
|
+
})).filter((e) => Q(e[0])).reverse() : [];
|
|
9196
|
+
}
|
|
9197
|
+
function Om(e, t) {
|
|
9198
|
+
return t.clearOnSelectionDeleteMarkKeys.length > 0 && !!(e.selection && !z.isCollapsed(e.selection));
|
|
9199
|
+
}
|
|
9200
|
+
function km(e, t, n) {
|
|
9201
|
+
n && t.clearOnSelectionDeleteMarkKeys.forEach((t) => {
|
|
9202
|
+
e.removeMark(t);
|
|
9203
|
+
});
|
|
8847
9204
|
}
|
|
8848
|
-
function
|
|
8849
|
-
let
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
e.
|
|
9205
|
+
function Am({ apiRef: e, ariaLabel: t, children: n, className: r, editor: i, initialValue: a, isFocused: o, onBlurEditor: s, onChange: c, onCommandTargetActivate: l, onFocusEditor: u, onPasteHtml: f, onPasteImageFiles: h, onPasteImageSources: _, onToolbarStateChange: v, placeholder: y, registry: b, value: C }) {
|
|
9206
|
+
let w = (e) => {
|
|
9207
|
+
if (!jm(e.key)) return;
|
|
9208
|
+
let t = Om(i, b);
|
|
9209
|
+
Tm(i, b, e.key) && (e.preventDefault(), km(i, b, t), c(Qu(i.children)));
|
|
9210
|
+
}, T = g(() => mm(b), [b]), E = g(() => hm(b), [b]), D = g(() => Zu(a), [a]), O = d((e) => {
|
|
9211
|
+
e.defaultPrevented || (l(), !Um(i) && !Vm(i, e) && Bm(i), v());
|
|
8853
9212
|
}, [
|
|
8854
9213
|
i,
|
|
8855
9214
|
l,
|
|
8856
|
-
|
|
8857
|
-
]),
|
|
8858
|
-
e.defaultPrevented || (u(),
|
|
8859
|
-
}, [i, u]),
|
|
9215
|
+
v
|
|
9216
|
+
]), k = d((e) => {
|
|
9217
|
+
e.defaultPrevented || (u(), Bm(i));
|
|
9218
|
+
}, [i, u]), A = d((e) => {
|
|
8860
9219
|
e.defaultPrevented || l();
|
|
8861
|
-
}, [l]),
|
|
8862
|
-
e.defaultPrevented ||
|
|
8863
|
-
}, [i,
|
|
8864
|
-
e.defaultPrevented ||
|
|
9220
|
+
}, [l]), j = d((e) => {
|
|
9221
|
+
e.defaultPrevented || Hm(i) && v();
|
|
9222
|
+
}, [i, v]), M = d((e) => {
|
|
9223
|
+
e.defaultPrevented || Mm({
|
|
9224
|
+
editor: i,
|
|
8865
9225
|
event: e,
|
|
8866
|
-
|
|
8867
|
-
|
|
9226
|
+
onChange: c,
|
|
9227
|
+
onPasteHtml: f,
|
|
9228
|
+
onPasteImageFiles: h,
|
|
9229
|
+
onPasteImageSources: _,
|
|
9230
|
+
registry: b
|
|
8868
9231
|
});
|
|
8869
|
-
}, [
|
|
9232
|
+
}, [
|
|
9233
|
+
i,
|
|
9234
|
+
c,
|
|
9235
|
+
f,
|
|
9236
|
+
h,
|
|
9237
|
+
_,
|
|
9238
|
+
b
|
|
9239
|
+
]);
|
|
8870
9240
|
return p(() => {
|
|
8871
|
-
|
|
8872
|
-
}, [i
|
|
9241
|
+
U.normalize(i, { force: !0 });
|
|
9242
|
+
}, [i]), p(() => {
|
|
9243
|
+
C && (q.removeNodes(i, { at: [] }), q.insertNodes(i, Zu(C), { at: [0] }), U.normalize(i, { force: !0 }));
|
|
9244
|
+
}, [i, C]), m(e, () => ({
|
|
8873
9245
|
blur: () => {
|
|
8874
9246
|
J.blur(i), s();
|
|
8875
9247
|
},
|
|
@@ -8879,52 +9251,72 @@ function Rp({ apiRef: e, ariaLabel: t, children: n, className: r, editor: i, ini
|
|
|
8879
9251
|
getValue: () => Qu(i.children),
|
|
8880
9252
|
isFocused: o,
|
|
8881
9253
|
insertNode: (e, t) => {
|
|
8882
|
-
J.focus(i), u(),
|
|
9254
|
+
J.focus(i), u(), Bm(i), zm(i, b, Bu(e, t));
|
|
8883
9255
|
},
|
|
8884
9256
|
runCommand: (e) => {
|
|
8885
|
-
let t =
|
|
8886
|
-
J.focus(i), u(), t ||
|
|
9257
|
+
let t = Hm(i);
|
|
9258
|
+
J.focus(i), u(), t || Bm(i), zm(i, b, e);
|
|
8887
9259
|
}
|
|
8888
9260
|
}), [
|
|
8889
9261
|
i,
|
|
8890
9262
|
o,
|
|
8891
9263
|
s,
|
|
8892
9264
|
u,
|
|
8893
|
-
|
|
9265
|
+
b
|
|
8894
9266
|
]), /* @__PURE__ */ S(Al, {
|
|
8895
9267
|
editor: i,
|
|
8896
|
-
initialValue:
|
|
9268
|
+
initialValue: D,
|
|
8897
9269
|
onChange: () => c(Qu(i.children)),
|
|
8898
9270
|
children: [n, /* @__PURE__ */ x(vl, {
|
|
8899
|
-
"aria-label": t == null ?
|
|
9271
|
+
"aria-label": t == null ? y : t,
|
|
8900
9272
|
className: r,
|
|
8901
|
-
onClick:
|
|
8902
|
-
onFocus:
|
|
8903
|
-
onKeyDownCapture:
|
|
8904
|
-
onMouseDown:
|
|
8905
|
-
onMouseUp:
|
|
8906
|
-
onPasteCapture:
|
|
8907
|
-
placeholder:
|
|
8908
|
-
renderElement:
|
|
8909
|
-
renderLeaf:
|
|
9273
|
+
onClick: O,
|
|
9274
|
+
onFocus: k,
|
|
9275
|
+
onKeyDownCapture: w,
|
|
9276
|
+
onMouseDown: A,
|
|
9277
|
+
onMouseUp: j,
|
|
9278
|
+
onPasteCapture: M,
|
|
9279
|
+
placeholder: y,
|
|
9280
|
+
renderElement: T,
|
|
9281
|
+
renderLeaf: E,
|
|
8910
9282
|
style: { minHeight: "var(--rte-content-min-height, 8rem)" }
|
|
8911
9283
|
})]
|
|
8912
9284
|
});
|
|
8913
9285
|
}
|
|
8914
|
-
function
|
|
9286
|
+
function jm(e) {
|
|
8915
9287
|
return e === "Backspace" || e === "Delete";
|
|
8916
9288
|
}
|
|
8917
|
-
function
|
|
8918
|
-
if (!
|
|
8919
|
-
let
|
|
8920
|
-
if (
|
|
8921
|
-
|
|
9289
|
+
function Mm({ editor: e, event: t, onChange: n, onPasteHtml: r, onPasteImageFiles: i, onPasteImageSources: a, registry: o }) {
|
|
9290
|
+
if (!i && !a && !r) return;
|
|
9291
|
+
let s = Im(t.clipboardData);
|
|
9292
|
+
if (s.length > 0) {
|
|
9293
|
+
t.preventDefault(), i == null || i(s);
|
|
8922
9294
|
return;
|
|
8923
9295
|
}
|
|
8924
|
-
let
|
|
8925
|
-
|
|
9296
|
+
let c = t.clipboardData.getData("text/html");
|
|
9297
|
+
Nm({
|
|
9298
|
+
editor: e,
|
|
9299
|
+
event: t,
|
|
9300
|
+
html: c,
|
|
9301
|
+
onChange: n,
|
|
9302
|
+
onPasteHtml: r,
|
|
9303
|
+
registry: o
|
|
9304
|
+
}) || Pm(t, c, a);
|
|
9305
|
+
}
|
|
9306
|
+
function Nm({ editor: e, event: t, html: n, onChange: r, onPasteHtml: i, registry: a }) {
|
|
9307
|
+
return !i || !n.trim() || Fm(t.clipboardData) ? !1 : (t.preventDefault(), Promise.resolve(i(n)).then((t) => {
|
|
9308
|
+
t != null && t.trim() && (q.insertFragment(e, Fp(t, a)), r(Qu(e.children)));
|
|
9309
|
+
}).catch(() => void 0), !0);
|
|
9310
|
+
}
|
|
9311
|
+
function Pm(e, t, n) {
|
|
9312
|
+
let r = Lm(t);
|
|
9313
|
+
r.length > 0 && (e.preventDefault(), n == null || n(r));
|
|
9314
|
+
}
|
|
9315
|
+
function Fm(e) {
|
|
9316
|
+
var t;
|
|
9317
|
+
return Array.from((t = e.types) == null ? [] : t).includes("application/x-slate-fragment") || e.getData("application/x-slate-fragment").length > 0 || e.getData("text/html").includes("data-slate-fragment");
|
|
8926
9318
|
}
|
|
8927
|
-
function
|
|
9319
|
+
function Im(e) {
|
|
8928
9320
|
var t;
|
|
8929
9321
|
let n = [], r = /* @__PURE__ */ new Set(), i = (e) => {
|
|
8930
9322
|
if (!(e != null && e.type.startsWith("image/"))) return;
|
|
@@ -8939,7 +9331,7 @@ function Vp(e) {
|
|
|
8939
9331
|
}
|
|
8940
9332
|
return n;
|
|
8941
9333
|
}
|
|
8942
|
-
function
|
|
9334
|
+
function Lm(e) {
|
|
8943
9335
|
if (!e.trim() || typeof DOMParser > "u") return [];
|
|
8944
9336
|
let t = new DOMParser().parseFromString(`<!doctype html><body>${e}</body>`, "text/html");
|
|
8945
9337
|
return Array.from(t.body.querySelectorAll("img")).map((e) => {
|
|
@@ -8947,18 +9339,18 @@ function Hp(e) {
|
|
|
8947
9339
|
return (t = (n = e.getAttribute("src")) == null ? void 0 : n.trim()) == null ? "" : t;
|
|
8948
9340
|
}).filter((e) => e.length > 0);
|
|
8949
9341
|
}
|
|
8950
|
-
function
|
|
9342
|
+
function Rm(e, t) {
|
|
8951
9343
|
return {
|
|
8952
9344
|
editor: e,
|
|
8953
|
-
getToolbarState: () =>
|
|
9345
|
+
getToolbarState: () => Jm(e, t),
|
|
8954
9346
|
getValue: () => Qu(e.children),
|
|
8955
9347
|
runCommand: (n) => {
|
|
8956
|
-
let r =
|
|
8957
|
-
J.focus(e), r ||
|
|
9348
|
+
let r = Hm(e);
|
|
9349
|
+
J.focus(e), r || Bm(e), zm(e, t, n);
|
|
8958
9350
|
}
|
|
8959
9351
|
};
|
|
8960
9352
|
}
|
|
8961
|
-
function
|
|
9353
|
+
function zm(e, t, n) {
|
|
8962
9354
|
let r = t.getCommand(n.command);
|
|
8963
9355
|
r && r.run({
|
|
8964
9356
|
command: n,
|
|
@@ -8966,20 +9358,26 @@ function Wp(e, t, n) {
|
|
|
8966
9358
|
registry: t
|
|
8967
9359
|
});
|
|
8968
9360
|
}
|
|
8969
|
-
function
|
|
9361
|
+
function Bm(e) {
|
|
8970
9362
|
e.selection || q.select(e, U.end(e, []));
|
|
8971
9363
|
}
|
|
8972
|
-
function
|
|
9364
|
+
function Vm(e, t) {
|
|
8973
9365
|
try {
|
|
8974
9366
|
let n = J.findEventRange(e, t.nativeEvent);
|
|
8975
9367
|
return e.selection && z.equals(e.selection, n) || q.select(e, n), !0;
|
|
8976
9368
|
} catch (t) {
|
|
8977
|
-
return
|
|
9369
|
+
return Hm(e);
|
|
8978
9370
|
}
|
|
8979
9371
|
}
|
|
8980
|
-
function
|
|
8981
|
-
let t =
|
|
8982
|
-
|
|
9372
|
+
function Hm(e) {
|
|
9373
|
+
let t = Gm(e);
|
|
9374
|
+
return t ? Wm(e, t) : !1;
|
|
9375
|
+
}
|
|
9376
|
+
function Um(e) {
|
|
9377
|
+
let t = Gm(e);
|
|
9378
|
+
return !t || t.isCollapsed ? !1 : Wm(e, t);
|
|
9379
|
+
}
|
|
9380
|
+
function Wm(e, t) {
|
|
8983
9381
|
try {
|
|
8984
9382
|
let n = J.toSlateRange(e, t, {
|
|
8985
9383
|
exactMatch: !1,
|
|
@@ -8990,86 +9388,87 @@ function qp(e) {
|
|
|
8990
9388
|
return !1;
|
|
8991
9389
|
}
|
|
8992
9390
|
}
|
|
8993
|
-
function
|
|
9391
|
+
function Gm(e) {
|
|
8994
9392
|
let t = J.findDocumentOrShadowRoot(e), n = t instanceof Document ? t.getSelection() : t.ownerDocument.getSelection();
|
|
8995
|
-
return !n || n.rangeCount === 0 ? null :
|
|
9393
|
+
return !n || n.rangeCount === 0 ? null : Km(e, n) ? n : null;
|
|
8996
9394
|
}
|
|
8997
|
-
function
|
|
9395
|
+
function Km(e, t) {
|
|
8998
9396
|
let n = J.toDOMNode(e, e);
|
|
8999
|
-
return
|
|
9397
|
+
return qm(n, t.anchorNode) && qm(n, t.focusNode);
|
|
9000
9398
|
}
|
|
9001
|
-
function
|
|
9399
|
+
function qm(e, t) {
|
|
9002
9400
|
return !!(t && (t === e || e.contains(t)));
|
|
9003
9401
|
}
|
|
9004
|
-
function
|
|
9402
|
+
function Jm(e, t) {
|
|
9005
9403
|
return Ce(t.toolbarStateReaders.reduce((t, n) => [...t, ...n({ editor: e })], []));
|
|
9006
9404
|
}
|
|
9007
9405
|
//#endregion
|
|
9008
9406
|
//#region src/rich-text-editor/primitives/Editor.tsx
|
|
9009
|
-
function
|
|
9010
|
-
var
|
|
9011
|
-
let
|
|
9012
|
-
p(() =>
|
|
9013
|
-
|
|
9014
|
-
|
|
9015
|
-
|
|
9016
|
-
|
|
9407
|
+
function Ym({ "aria-label": e, apiRef: t, className: n, editorId: r, initialValue: i, onChange: a, onObjectInteraction: o, onPasteHtml: s, onPasteImageFiles: c, onPasteImageSources: l, placeholder: u, toolbar: f, value: m }) {
|
|
9408
|
+
var h;
|
|
9409
|
+
let g = Ze(), [_] = y(() => r == null ? `rte-editor-${g}` : r), { activeEditorId: v, clearEditorFocus: b, focusEditor: S, isEditorFocused: C, plugins: w, refreshToolbarState: T, registerEditor: E, setCommandTargetEditor: D } = je(), { editor: O, registry: k } = gm(w), [A] = y(() => Rm(O, k));
|
|
9410
|
+
p(() => E(_, A, f), [
|
|
9411
|
+
E,
|
|
9412
|
+
A,
|
|
9413
|
+
_,
|
|
9414
|
+
f
|
|
9017
9415
|
]);
|
|
9018
|
-
let
|
|
9019
|
-
|
|
9020
|
-
}, [
|
|
9021
|
-
|
|
9022
|
-
}, [
|
|
9023
|
-
|
|
9416
|
+
let j = d(() => {
|
|
9417
|
+
D(_);
|
|
9418
|
+
}, [_, D]), M = d(() => {
|
|
9419
|
+
S(_);
|
|
9420
|
+
}, [S, _]), N = d(() => {
|
|
9421
|
+
C(_) && b();
|
|
9024
9422
|
}, [
|
|
9025
|
-
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
]),
|
|
9029
|
-
|
|
9030
|
-
}, [
|
|
9031
|
-
a == null || a(e),
|
|
9032
|
-
}, [a,
|
|
9423
|
+
b,
|
|
9424
|
+
C,
|
|
9425
|
+
_
|
|
9426
|
+
]), P = d(() => C(_), [C, _]), F = d(() => {
|
|
9427
|
+
T(_);
|
|
9428
|
+
}, [T, _]), ee = d((e) => {
|
|
9429
|
+
a == null || a(e), F();
|
|
9430
|
+
}, [a, F]), te = (h = i == null ? m : i) == null ? Qu([k.createDefaultElement()]) : h;
|
|
9033
9431
|
return /* @__PURE__ */ x(ot, {
|
|
9034
9432
|
apiRef: t,
|
|
9035
|
-
editorId:
|
|
9433
|
+
editorId: _,
|
|
9036
9434
|
initialValue: i,
|
|
9037
|
-
onChange:
|
|
9435
|
+
onChange: ee,
|
|
9038
9436
|
onObjectInteraction: o,
|
|
9039
|
-
registration:
|
|
9040
|
-
registry:
|
|
9041
|
-
value:
|
|
9437
|
+
registration: A,
|
|
9438
|
+
registry: k,
|
|
9439
|
+
value: m,
|
|
9042
9440
|
children: /* @__PURE__ */ x("div", {
|
|
9043
9441
|
className: at.root,
|
|
9044
|
-
"data-active":
|
|
9045
|
-
"data-editor-id":
|
|
9046
|
-
[Qe]:
|
|
9047
|
-
children: /* @__PURE__ */ x(
|
|
9442
|
+
"data-active": v === _ ? "true" : void 0,
|
|
9443
|
+
"data-editor-id": _,
|
|
9444
|
+
[Qe]: _,
|
|
9445
|
+
children: /* @__PURE__ */ x(Am, {
|
|
9048
9446
|
apiRef: t,
|
|
9049
9447
|
className: L(at.content, n),
|
|
9050
|
-
editor:
|
|
9051
|
-
initialValue:
|
|
9052
|
-
isFocused:
|
|
9053
|
-
onBlurEditor:
|
|
9054
|
-
onChange:
|
|
9055
|
-
onCommandTargetActivate:
|
|
9056
|
-
onFocusEditor:
|
|
9057
|
-
onPasteImageFiles:
|
|
9058
|
-
onPasteImageSources:
|
|
9059
|
-
|
|
9448
|
+
editor: A.editor,
|
|
9449
|
+
initialValue: te,
|
|
9450
|
+
isFocused: P,
|
|
9451
|
+
onBlurEditor: N,
|
|
9452
|
+
onChange: ee,
|
|
9453
|
+
onCommandTargetActivate: j,
|
|
9454
|
+
onFocusEditor: M,
|
|
9455
|
+
onPasteImageFiles: c,
|
|
9456
|
+
onPasteImageSources: l,
|
|
9457
|
+
onPasteHtml: s,
|
|
9458
|
+
onToolbarStateChange: F,
|
|
9060
9459
|
ariaLabel: e,
|
|
9061
|
-
placeholder:
|
|
9062
|
-
registry:
|
|
9063
|
-
value:
|
|
9460
|
+
placeholder: u,
|
|
9461
|
+
registry: k,
|
|
9462
|
+
value: m
|
|
9064
9463
|
})
|
|
9065
9464
|
})
|
|
9066
9465
|
});
|
|
9067
9466
|
}
|
|
9068
9467
|
//#endregion
|
|
9069
9468
|
//#region src/rich-text-editor/primitives/InsertNodeButton.tsx
|
|
9070
|
-
var
|
|
9071
|
-
function
|
|
9072
|
-
let { nodeType: t, payload: n } = e, r = te(e,
|
|
9469
|
+
var Xm = ["nodeType", "payload"];
|
|
9470
|
+
function Zm(e) {
|
|
9471
|
+
let { nodeType: t, payload: n } = e, r = te(e, Xm);
|
|
9073
9472
|
return /* @__PURE__ */ x(Ve, I({
|
|
9074
9473
|
action: {
|
|
9075
9474
|
command: _u,
|
|
@@ -9082,21 +9481,21 @@ function em(e) {
|
|
|
9082
9481
|
}
|
|
9083
9482
|
//#endregion
|
|
9084
9483
|
//#region src/rich-text-editor/primitives/Root.tsx
|
|
9085
|
-
function
|
|
9484
|
+
function Qm({ children: e, className: t, defaultActiveEditorId: n, id: r, onCommand: i, onEditorFocusChange: a, plugins: o }) {
|
|
9086
9485
|
return /* @__PURE__ */ x(Ae, {
|
|
9087
9486
|
defaultActiveEditorId: n,
|
|
9088
9487
|
onCommand: i,
|
|
9089
9488
|
onEditorFocusChange: a,
|
|
9090
9489
|
plugins: o,
|
|
9091
9490
|
rootId: r,
|
|
9092
|
-
children: /* @__PURE__ */ x(
|
|
9491
|
+
children: /* @__PURE__ */ x($m, {
|
|
9093
9492
|
className: t,
|
|
9094
9493
|
rootId: r,
|
|
9095
9494
|
children: e
|
|
9096
9495
|
})
|
|
9097
9496
|
});
|
|
9098
9497
|
}
|
|
9099
|
-
function
|
|
9498
|
+
function $m({ children: e, className: t, rootId: n }) {
|
|
9100
9499
|
let { clearEditorFocus: r, focusEditor: i } = je();
|
|
9101
9500
|
return /* @__PURE__ */ x("div", {
|
|
9102
9501
|
className: L(at.scope, t),
|
|
@@ -9120,10 +9519,10 @@ function nm({ children: e, className: t, rootId: n }) {
|
|
|
9120
9519
|
}
|
|
9121
9520
|
//#endregion
|
|
9122
9521
|
//#region src/rich-text-editor/primitives/Toolbar.tsx
|
|
9123
|
-
function
|
|
9522
|
+
function eh({ "aria-label": e, children: t, className: n, defaultContent: r, visibleWhen: i = "always" }) {
|
|
9124
9523
|
let { activeToolbar: a, focusedEditorId: o, registerToolbar: s } = je(), c = i === "editor-focus" && !o;
|
|
9125
9524
|
p(() => s(), [s]);
|
|
9126
|
-
let l =
|
|
9525
|
+
let l = ah({
|
|
9127
9526
|
activeToolbar: a,
|
|
9128
9527
|
children: t,
|
|
9129
9528
|
defaultContent: r
|
|
@@ -9132,7 +9531,7 @@ function rm({ "aria-label": e, children: t, className: n, defaultContent: r, vis
|
|
|
9132
9531
|
"aria-label": e,
|
|
9133
9532
|
hidden: c,
|
|
9134
9533
|
onMouseDownCapture: (e) => {
|
|
9135
|
-
e.defaultPrevented ||
|
|
9534
|
+
e.defaultPrevented || th(e.target) || e.preventDefault();
|
|
9136
9535
|
},
|
|
9137
9536
|
[$e]: "true",
|
|
9138
9537
|
role: "toolbar",
|
|
@@ -9142,34 +9541,34 @@ function rm({ "aria-label": e, children: t, className: n, defaultContent: r, vis
|
|
|
9142
9541
|
})
|
|
9143
9542
|
});
|
|
9144
9543
|
}
|
|
9145
|
-
function
|
|
9544
|
+
function th(e) {
|
|
9146
9545
|
return e instanceof Element && !!e.closest("input, select, textarea");
|
|
9147
9546
|
}
|
|
9148
|
-
function
|
|
9547
|
+
function nh({ children: e }) {
|
|
9149
9548
|
return /* @__PURE__ */ x(b, { children: e });
|
|
9150
9549
|
}
|
|
9151
|
-
function
|
|
9550
|
+
function rh({ children: e }) {
|
|
9152
9551
|
return /* @__PURE__ */ x(b, { children: e });
|
|
9153
9552
|
}
|
|
9154
|
-
function
|
|
9553
|
+
function ih({ children: e }) {
|
|
9155
9554
|
return /* @__PURE__ */ x(b, { children: e });
|
|
9156
9555
|
}
|
|
9157
|
-
function
|
|
9556
|
+
function ah({ activeToolbar: e, children: t, defaultContent: n }) {
|
|
9158
9557
|
var r, i, a, o;
|
|
9159
|
-
let s =
|
|
9160
|
-
return /* @__PURE__ */ x(b, { children: s ? (r = (i = (a =
|
|
9558
|
+
let s = sh(t, nh);
|
|
9559
|
+
return /* @__PURE__ */ x(b, { children: s ? (r = (i = (a = oh(s.props.children, e)) == null ? void 0 : a.props.children) == null ? (o = sh(s.props.children, ih)) == null ? void 0 : o.props.children : i) == null ? n : r : t == null ? n : t });
|
|
9161
9560
|
}
|
|
9162
|
-
function
|
|
9561
|
+
function oh(e, t) {
|
|
9163
9562
|
var n;
|
|
9164
|
-
return t ? (n = r.toArray(e).find((e) => l(e) && e.type ===
|
|
9563
|
+
return t ? (n = r.toArray(e).find((e) => l(e) && e.type === rh && e.props.value === t)) == null ? null : n : null;
|
|
9165
9564
|
}
|
|
9166
|
-
function
|
|
9565
|
+
function sh(e, t) {
|
|
9167
9566
|
var n;
|
|
9168
9567
|
return (n = r.toArray(e).find((e) => l(e) && e.type === t)) == null ? null : n;
|
|
9169
9568
|
}
|
|
9170
9569
|
//#endregion
|
|
9171
9570
|
//#region src/rich-text-editor/primitives/ToolbarSection.tsx
|
|
9172
|
-
function
|
|
9571
|
+
function ch({ "aria-label": e, children: t, className: n }) {
|
|
9173
9572
|
return /* @__PURE__ */ x("div", {
|
|
9174
9573
|
"aria-label": e,
|
|
9175
9574
|
className: L(Ne["toolbar-section"], n),
|
|
@@ -9179,7 +9578,7 @@ function dm({ "aria-label": e, children: t, className: n }) {
|
|
|
9179
9578
|
}
|
|
9180
9579
|
//#endregion
|
|
9181
9580
|
//#region src/rich-text-editor/primitives/ToolbarSeparator.tsx
|
|
9182
|
-
function
|
|
9581
|
+
function lh(e) {
|
|
9183
9582
|
let { className: t } = e;
|
|
9184
9583
|
return /* @__PURE__ */ x("span", {
|
|
9185
9584
|
"aria-orientation": "vertical",
|
|
@@ -9188,140 +9587,43 @@ function fm(e) {
|
|
|
9188
9587
|
});
|
|
9189
9588
|
}
|
|
9190
9589
|
//#endregion
|
|
9191
|
-
//#region src/rich-text-editor/primitives/codecs.ts
|
|
9192
|
-
function pm(e, t = {}) {
|
|
9193
|
-
let n = op(t.plugins);
|
|
9194
|
-
return Cm(_m(new DOMParser().parseFromString(e, "text/html").body, n), n);
|
|
9195
|
-
}
|
|
9196
|
-
function mm(e, t = {}) {
|
|
9197
|
-
let n = op(t.plugins);
|
|
9198
|
-
return Zu(e).filter((e, t, n) => !Tm(n, t)).map((e) => ym(e, n)).join("");
|
|
9199
|
-
}
|
|
9200
|
-
function hm(e, t = {}) {
|
|
9201
|
-
let n = op(t.plugins);
|
|
9202
|
-
return Cm((Array.isArray(e) ? e : [e]).reduce((e, t) => [...e, ...xm(t, n)], []), n);
|
|
9203
|
-
}
|
|
9204
|
-
function gm(e, t = {}) {
|
|
9205
|
-
let n = op(t.plugins);
|
|
9206
|
-
return Zu(e).map((e) => Sm(e, n));
|
|
9207
|
-
}
|
|
9208
|
-
function _m(e, t) {
|
|
9209
|
-
return Array.from(e.childNodes).reduce((e, n) => [...e, ...vm(n, t)], []);
|
|
9210
|
-
}
|
|
9211
|
-
function vm(e, t) {
|
|
9212
|
-
if (e.nodeType === Node.TEXT_NODE) {
|
|
9213
|
-
var n;
|
|
9214
|
-
return [{ text: (n = e.textContent) == null ? "" : n }];
|
|
9215
|
-
}
|
|
9216
|
-
if (!(e instanceof HTMLElement)) return [];
|
|
9217
|
-
let r = bm(e, t);
|
|
9218
|
-
return r ? Array.isArray(r) ? r : [r] : _m(e, t);
|
|
9219
|
-
}
|
|
9220
|
-
function ym(e, t) {
|
|
9221
|
-
if (G.isText(e)) return Cu(e.text);
|
|
9222
|
-
if (!rd(e)) return "";
|
|
9223
|
-
let n = t.definitions.map((n) => {
|
|
9224
|
-
var r, i;
|
|
9225
|
-
return (r = n.codecs) == null || (r = r.html) == null || (i = r.serialize) == null ? void 0 : i.call(r, {
|
|
9226
|
-
node: e,
|
|
9227
|
-
serializeChildren: (e) => e.children.map((e) => ym(e, t)).join("")
|
|
9228
|
-
});
|
|
9229
|
-
}).find((e) => e != null);
|
|
9230
|
-
return n == null ? "" : n;
|
|
9231
|
-
}
|
|
9232
|
-
function bm(e, t) {
|
|
9233
|
-
for (let i of t.definitions) {
|
|
9234
|
-
var n, r;
|
|
9235
|
-
let a = (n = i.codecs) == null || (n = n.html) == null || (r = n.deserialize) == null ? void 0 : r.call(n, {
|
|
9236
|
-
deserializeChildren: (e) => _m(e, t),
|
|
9237
|
-
element: e
|
|
9238
|
-
});
|
|
9239
|
-
if (a) return a;
|
|
9240
|
-
}
|
|
9241
|
-
return null;
|
|
9242
|
-
}
|
|
9243
|
-
function xm(e, t) {
|
|
9244
|
-
for (let i of t.definitions) {
|
|
9245
|
-
var n, r;
|
|
9246
|
-
let t = (n = i.codecs) == null || (n = n.json) == null || (r = n.deserialize) == null ? void 0 : r.call(n, { input: e });
|
|
9247
|
-
if (t) return Array.isArray(t) ? t : [t];
|
|
9248
|
-
}
|
|
9249
|
-
return wm(e) ? [{ text: e.text }] : [];
|
|
9250
|
-
}
|
|
9251
|
-
function Sm(e, t) {
|
|
9252
|
-
if (G.isText(e)) return e;
|
|
9253
|
-
if (!rd(e)) return null;
|
|
9254
|
-
let n = t.definitions.map((t) => {
|
|
9255
|
-
var n, r;
|
|
9256
|
-
return (n = t.codecs) == null || (n = n.json) == null || (r = n.serialize) == null ? void 0 : r.call(n, { node: e });
|
|
9257
|
-
}).find((e) => e != null);
|
|
9258
|
-
return n == null ? null : n;
|
|
9259
|
-
}
|
|
9260
|
-
function Cm(e, t) {
|
|
9261
|
-
let n = e.filter(rd);
|
|
9262
|
-
return Qu(n.length > 0 ? n : [t.createDefaultElement()]);
|
|
9263
|
-
}
|
|
9264
|
-
function wm(e) {
|
|
9265
|
-
return !!(e && typeof e == "object" && "text" in e && typeof e.text == "string");
|
|
9266
|
-
}
|
|
9267
|
-
function Tm(e, t) {
|
|
9268
|
-
return Em(e, t) || Dm(e, t);
|
|
9269
|
-
}
|
|
9270
|
-
function Em(e, t) {
|
|
9271
|
-
let [n] = e.slice(t, t + 1), [r] = e.slice(t + 1, t + 2);
|
|
9272
|
-
return t < e.length - 1 && Om(r) && km(n);
|
|
9273
|
-
}
|
|
9274
|
-
function Dm(e, t) {
|
|
9275
|
-
let [n] = e.slice(t, t + 1), [r] = e.slice(t - 1, t);
|
|
9276
|
-
return t > 0 && Om(r) && km(n);
|
|
9277
|
-
}
|
|
9278
|
-
function Om(e) {
|
|
9279
|
-
return rd(e) && e.type === "table";
|
|
9280
|
-
}
|
|
9281
|
-
function km(e) {
|
|
9282
|
-
return rd(e) && e.type === "paragraph" && !Am(e);
|
|
9283
|
-
}
|
|
9284
|
-
function Am(e) {
|
|
9285
|
-
return G.isText(e) ? e.text.replace(/\u200b/g, "").trim().length > 0 : rd(e) ? e.type === "image" ? typeof e.src == "string" && e.src.length > 0 : e.type === "formula" ? typeof e.latex == "string" && e.latex.length > 0 : e.children.some(Am) : !1;
|
|
9286
|
-
}
|
|
9287
|
-
//#endregion
|
|
9288
9590
|
//#region src/rich-text-editor/primitives/index.ts
|
|
9289
|
-
var
|
|
9290
|
-
AlignCenterButton: He(
|
|
9291
|
-
AlignLeftButton: He(
|
|
9292
|
-
AlignRightButton: He(
|
|
9293
|
-
BoldToggle: He(
|
|
9294
|
-
BulletedListToggle: He(
|
|
9295
|
-
CodeToggle: He(
|
|
9296
|
-
ColorSelect: Be(
|
|
9297
|
-
Case:
|
|
9298
|
-
Default:
|
|
9299
|
-
DividerButton:
|
|
9300
|
-
FontSizeSelect: Be(
|
|
9301
|
-
FormulaButton:
|
|
9302
|
-
Heading1Button: He(
|
|
9303
|
-
Heading2Button: He(
|
|
9304
|
-
Heading3Button: He(
|
|
9305
|
-
ImageButton:
|
|
9306
|
-
InsertNodeButton:
|
|
9307
|
-
ItalicToggle: He(
|
|
9308
|
-
NumberedListToggle: He(
|
|
9309
|
-
RedoButton: He(
|
|
9310
|
-
Section:
|
|
9311
|
-
Separator:
|
|
9312
|
-
StrikeToggle: He(
|
|
9313
|
-
Switch:
|
|
9314
|
-
TableButton:
|
|
9315
|
-
UnderlineToggle: He(
|
|
9316
|
-
UndoButton: He(
|
|
9591
|
+
var uh = pp(), dh = Object.assign(eh, {
|
|
9592
|
+
AlignCenterButton: He(fh("alignCenter")),
|
|
9593
|
+
AlignLeftButton: He(fh("alignLeft")),
|
|
9594
|
+
AlignRightButton: He(fh("alignRight")),
|
|
9595
|
+
BoldToggle: He(fh("bold")),
|
|
9596
|
+
BulletedListToggle: He(fh("bulletedList")),
|
|
9597
|
+
CodeToggle: He(fh("code")),
|
|
9598
|
+
ColorSelect: Be(fh("color")),
|
|
9599
|
+
Case: rh,
|
|
9600
|
+
Default: ih,
|
|
9601
|
+
DividerButton: ph(fh("divider"), "divider"),
|
|
9602
|
+
FontSizeSelect: Be(fh("fontSize")),
|
|
9603
|
+
FormulaButton: ph(fh("formula"), "formula"),
|
|
9604
|
+
Heading1Button: He(fh("heading1")),
|
|
9605
|
+
Heading2Button: He(fh("heading2")),
|
|
9606
|
+
Heading3Button: He(fh("heading3")),
|
|
9607
|
+
ImageButton: ph(fh("image"), "image"),
|
|
9608
|
+
InsertNodeButton: Zm,
|
|
9609
|
+
ItalicToggle: He(fh("italic")),
|
|
9610
|
+
NumberedListToggle: He(fh("numberedList")),
|
|
9611
|
+
RedoButton: He(fh("redo")),
|
|
9612
|
+
Section: ch,
|
|
9613
|
+
Separator: lh,
|
|
9614
|
+
StrikeToggle: He(fh("strike")),
|
|
9615
|
+
Switch: nh,
|
|
9616
|
+
TableButton: ph(fh("table"), "table"),
|
|
9617
|
+
UnderlineToggle: He(fh("underline")),
|
|
9618
|
+
UndoButton: He(fh("undo"))
|
|
9317
9619
|
});
|
|
9318
|
-
function
|
|
9620
|
+
function fh(e) {
|
|
9319
9621
|
var t;
|
|
9320
|
-
let n = (t =
|
|
9622
|
+
let n = (t = uh.getToolbarAction(e)) == null ? void 0 : t.action;
|
|
9321
9623
|
if (!n) throw Error(`Missing RichTextEditor toolbar action: ${e}.`);
|
|
9322
9624
|
return n;
|
|
9323
9625
|
}
|
|
9324
|
-
function
|
|
9626
|
+
function ph(e, t) {
|
|
9325
9627
|
return function(n) {
|
|
9326
9628
|
var r, i;
|
|
9327
9629
|
return s(Ve, I(I({ action: e }, n), {}, {
|
|
@@ -9330,27 +9632,27 @@ function Pm(e, t) {
|
|
|
9330
9632
|
}));
|
|
9331
9633
|
};
|
|
9332
9634
|
}
|
|
9333
|
-
var
|
|
9334
|
-
Editor:
|
|
9335
|
-
Root:
|
|
9336
|
-
Toolbar:
|
|
9337
|
-
},
|
|
9635
|
+
var $ = {
|
|
9636
|
+
Editor: Ym,
|
|
9637
|
+
Root: Qm,
|
|
9638
|
+
Toolbar: dh
|
|
9639
|
+
}, mh = {
|
|
9338
9640
|
button: "_button_1v6qc_1",
|
|
9339
9641
|
icon: "_icon_1v6qc_21"
|
|
9340
|
-
},
|
|
9341
|
-
function
|
|
9642
|
+
}, hh = ["className"];
|
|
9643
|
+
function gh(e, t) {
|
|
9342
9644
|
return function(n) {
|
|
9343
9645
|
var r;
|
|
9344
|
-
let { className: i } = n, a = te(n,
|
|
9646
|
+
let { className: i } = n, a = te(n, hh), { messages: o } = pd(), s = (r = a["aria-label"]) == null ? md(o, t) : r;
|
|
9345
9647
|
return /* @__PURE__ */ x(e, I(I({}, a), {}, {
|
|
9346
9648
|
"aria-label": s,
|
|
9347
|
-
className: L(
|
|
9649
|
+
className: L(mh.button, i)
|
|
9348
9650
|
}));
|
|
9349
9651
|
};
|
|
9350
9652
|
}
|
|
9351
9653
|
//#endregion
|
|
9352
9654
|
//#region src/rich-text-editor/styled/mediaCommands.ts
|
|
9353
|
-
function
|
|
9655
|
+
function _h() {
|
|
9354
9656
|
let e = je();
|
|
9355
9657
|
return (t, n = "") => {
|
|
9356
9658
|
e.dispatchCommand(Bu("image", {
|
|
@@ -9359,38 +9661,38 @@ function Rm() {
|
|
|
9359
9661
|
}));
|
|
9360
9662
|
};
|
|
9361
9663
|
}
|
|
9362
|
-
function
|
|
9664
|
+
function vh() {
|
|
9363
9665
|
let e = je();
|
|
9364
9666
|
return (t) => {
|
|
9365
9667
|
e.dispatchCommand(Bu("formula", t));
|
|
9366
9668
|
};
|
|
9367
9669
|
}
|
|
9368
|
-
function
|
|
9670
|
+
function yh(e, t) {
|
|
9369
9671
|
let n = encodeURIComponent(e);
|
|
9370
9672
|
if (typeof t == "function") return t(e);
|
|
9371
9673
|
if (typeof t == "string" && t.includes("{latex}")) return t.split("{latex}").join(n);
|
|
9372
|
-
let r = t ||
|
|
9674
|
+
let r = t || bh();
|
|
9373
9675
|
return `${r}${r.includes("?") ? "&" : "?"}display=inline&mathUrl=${n}`;
|
|
9374
9676
|
}
|
|
9375
|
-
function
|
|
9677
|
+
function bh() {
|
|
9376
9678
|
return typeof window < "u" && window.location.hostname.includes("yungu.org") ? "https://ai.yungu.org/center/api/custom-services/document-render/api/math-svg" : "https://ai.daily.yungu-inc.org/center/api/custom-services/document-render/api/math-svg";
|
|
9377
9679
|
}
|
|
9378
9680
|
//#endregion
|
|
9379
9681
|
//#region src/rich-text-editor/styled/mediaContext.tsx
|
|
9380
|
-
var
|
|
9381
|
-
function
|
|
9382
|
-
let o =
|
|
9682
|
+
var xh = o(null);
|
|
9683
|
+
function Sh({ children: e, formulaRenderUrl: t, onOpenFormula: n, onOpenImageUpload: r, runtime: i, uploadImage: a }) {
|
|
9684
|
+
let o = Ch({
|
|
9383
9685
|
formulaRenderUrl: t,
|
|
9384
9686
|
onOpenFormula: n,
|
|
9385
9687
|
onOpenImageUpload: r,
|
|
9386
9688
|
uploadImage: a
|
|
9387
9689
|
});
|
|
9388
|
-
return /* @__PURE__ */ x(
|
|
9690
|
+
return /* @__PURE__ */ x(xh.Provider, {
|
|
9389
9691
|
value: i == null ? o : i,
|
|
9390
9692
|
children: e
|
|
9391
9693
|
});
|
|
9392
9694
|
}
|
|
9393
|
-
function
|
|
9695
|
+
function Ch({ formulaRenderUrl: e, onOpenFormula: t, onOpenImageUpload: n, uploadImage: r }) {
|
|
9394
9696
|
let [i, a] = y({
|
|
9395
9697
|
initialLatex: "",
|
|
9396
9698
|
open: !1,
|
|
@@ -9419,58 +9721,99 @@ function Wm({ formulaRenderUrl: e, onOpenFormula: t, onOpenImageUpload: n, uploa
|
|
|
9419
9721
|
r
|
|
9420
9722
|
]);
|
|
9421
9723
|
}
|
|
9422
|
-
function
|
|
9423
|
-
let e = f(
|
|
9724
|
+
function wh() {
|
|
9725
|
+
let e = f(xh);
|
|
9424
9726
|
if (!e) throw Error("RichTextEditor media controls must be rendered inside RichTextEditor.Root.");
|
|
9425
9727
|
return e;
|
|
9426
9728
|
}
|
|
9427
|
-
var
|
|
9729
|
+
var Th = {
|
|
9428
9730
|
root: "_root_1dv0n_1",
|
|
9429
9731
|
toolbar: "_toolbar_1dv0n_18",
|
|
9430
9732
|
"toolbar-section": "_toolbar-section_1dv0n_25",
|
|
9431
9733
|
"toolbar-separator": "_toolbar-separator_1dv0n_29",
|
|
9432
9734
|
"content-root": "_content-root_1dv0n_35",
|
|
9433
9735
|
content: "_content_1dv0n_35"
|
|
9434
|
-
},
|
|
9736
|
+
}, Eh = [
|
|
9435
9737
|
"className",
|
|
9436
9738
|
"onPasteImageFiles",
|
|
9437
9739
|
"onPasteImageSources",
|
|
9438
9740
|
"onObjectInteraction",
|
|
9439
9741
|
"placeholder"
|
|
9440
9742
|
];
|
|
9441
|
-
function
|
|
9442
|
-
let { className:
|
|
9743
|
+
function Dh(t) {
|
|
9744
|
+
let { className: n, onPasteImageFiles: r, onPasteImageSources: i, onObjectInteraction: a, placeholder: o } = t, s = te(t, Eh), { messages: c } = pd(), l = wh(), u = _h(), d = (e) => {
|
|
9745
|
+
a == null || a(e), e.action === "formula.edit" && l.openFormulaDialog(typeof e.element.latex == "string" ? e.element.latex : "", e.updateElement);
|
|
9746
|
+
}, f = (e) => {
|
|
9747
|
+
r == null || r(e), l.uploadImage && jh(e, l.uploadImage, u);
|
|
9748
|
+
}, p = (e) => {
|
|
9749
|
+
i == null || i(e), l.uploadImage && Promise.all(e.map((e, t) => Mh(e, t))).then((e) => jh(e.filter((e) => !!e), l.uploadImage, u));
|
|
9750
|
+
}, m = function() {
|
|
9751
|
+
var t = e(function* (e) {
|
|
9752
|
+
return l.uploadImage ? yield Oh(e, l.uploadImage) : e;
|
|
9753
|
+
});
|
|
9754
|
+
return function(e) {
|
|
9755
|
+
return t.apply(this, arguments);
|
|
9756
|
+
};
|
|
9757
|
+
}();
|
|
9443
9758
|
return /* @__PURE__ */ x("div", {
|
|
9444
|
-
className:
|
|
9445
|
-
children: /* @__PURE__ */ x(
|
|
9446
|
-
className: L(
|
|
9447
|
-
onObjectInteraction:
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
},
|
|
9453
|
-
onPasteImageSources: (e) => {
|
|
9454
|
-
r == null || r(e), c.uploadImage && Promise.all(e.map((e, t) => Xm(e, t))).then((e) => Ym(e.filter((e) => !!e), c.uploadImage, l));
|
|
9455
|
-
},
|
|
9456
|
-
placeholder: a == null ? s.contentPlaceholder : a
|
|
9759
|
+
className: Th["content-root"],
|
|
9760
|
+
children: /* @__PURE__ */ x($.Editor, I(I({}, s), {}, {
|
|
9761
|
+
className: L(Th.content, n),
|
|
9762
|
+
onObjectInteraction: d,
|
|
9763
|
+
onPasteHtml: m,
|
|
9764
|
+
onPasteImageFiles: f,
|
|
9765
|
+
onPasteImageSources: p,
|
|
9766
|
+
placeholder: o == null ? c.contentPlaceholder : o
|
|
9457
9767
|
}))
|
|
9458
9768
|
});
|
|
9459
9769
|
}
|
|
9460
|
-
function
|
|
9770
|
+
function Oh(e, t) {
|
|
9771
|
+
return kh.apply(this, arguments);
|
|
9772
|
+
}
|
|
9773
|
+
function kh() {
|
|
9774
|
+
return kh = e(function* (t, n) {
|
|
9775
|
+
if (!t.trim() || typeof DOMParser > "u") return t;
|
|
9776
|
+
let r = new DOMParser().parseFromString(`<!doctype html><body>${t}</body>`, "text/html");
|
|
9777
|
+
Ah(r.body);
|
|
9778
|
+
let i = Array.from(r.body.querySelectorAll("img"));
|
|
9779
|
+
return yield Promise.all(i.map(function() {
|
|
9780
|
+
var t = e(function* (e, t) {
|
|
9781
|
+
var r;
|
|
9782
|
+
let i = yield Mh((r = e.getAttribute("src")) == null ? "" : r, t);
|
|
9783
|
+
if (!i) {
|
|
9784
|
+
e.remove();
|
|
9785
|
+
return;
|
|
9786
|
+
}
|
|
9787
|
+
let a = yield Promise.resolve(n(i)).catch(() => "");
|
|
9788
|
+
if (a) {
|
|
9789
|
+
e.setAttribute("src", a);
|
|
9790
|
+
return;
|
|
9791
|
+
}
|
|
9792
|
+
e.remove();
|
|
9793
|
+
});
|
|
9794
|
+
return function(e, n) {
|
|
9795
|
+
return t.apply(this, arguments);
|
|
9796
|
+
};
|
|
9797
|
+
}())), r.body.innerHTML;
|
|
9798
|
+
}), kh.apply(this, arguments);
|
|
9799
|
+
}
|
|
9800
|
+
function Ah(e) {
|
|
9801
|
+
e.querySelectorAll("head,link,meta,script,style,title,xml").forEach((e) => e.remove());
|
|
9802
|
+
}
|
|
9803
|
+
function jh(e, t, n) {
|
|
9461
9804
|
t && e.forEach((e) => {
|
|
9462
9805
|
Promise.resolve(t(e)).then((t) => {
|
|
9463
9806
|
t && n(t, e.name);
|
|
9464
9807
|
});
|
|
9465
9808
|
});
|
|
9466
9809
|
}
|
|
9467
|
-
function
|
|
9468
|
-
return
|
|
9810
|
+
function Mh(e, t) {
|
|
9811
|
+
return Nh.apply(this, arguments);
|
|
9469
9812
|
}
|
|
9470
|
-
function
|
|
9471
|
-
return
|
|
9472
|
-
let n =
|
|
9473
|
-
if (
|
|
9813
|
+
function Nh() {
|
|
9814
|
+
return Nh = e(function* (e, t) {
|
|
9815
|
+
let n = Ph(e);
|
|
9816
|
+
if (!Fh(n) || typeof fetch != "function") return null;
|
|
9474
9817
|
try {
|
|
9475
9818
|
let e = yield fetch(n);
|
|
9476
9819
|
if (!e.ok) return null;
|
|
@@ -9479,56 +9822,56 @@ function Zm() {
|
|
|
9479
9822
|
} catch (e) {
|
|
9480
9823
|
return null;
|
|
9481
9824
|
}
|
|
9482
|
-
}),
|
|
9825
|
+
}), Nh.apply(this, arguments);
|
|
9483
9826
|
}
|
|
9484
|
-
function
|
|
9827
|
+
function Ph(e) {
|
|
9485
9828
|
return e.startsWith("//") && typeof window < "u" && window.location ? `${window.location.protocol}${e}` : e;
|
|
9486
9829
|
}
|
|
9487
|
-
function
|
|
9830
|
+
function Fh(e) {
|
|
9488
9831
|
return e.startsWith("data:image/") || e.startsWith("blob:") || /^https?:\/\//i.test(e);
|
|
9489
9832
|
}
|
|
9490
9833
|
//#endregion
|
|
9491
9834
|
//#region src/vendor/mathlive.ts
|
|
9492
|
-
var
|
|
9493
|
-
function
|
|
9835
|
+
var Ih = null;
|
|
9836
|
+
function Lh() {
|
|
9494
9837
|
var e;
|
|
9495
9838
|
return !!(typeof window < "u" && (e = window.customElements) != null && e.get("math-field"));
|
|
9496
9839
|
}
|
|
9497
|
-
function
|
|
9498
|
-
return
|
|
9499
|
-
if (!
|
|
9500
|
-
|
|
9501
|
-
})),
|
|
9502
|
-
|
|
9840
|
+
function Rh(t) {
|
|
9841
|
+
return Ih || (Ih = import("./mathlive.min-DIRFgINt.mjs").then((e) => {
|
|
9842
|
+
if (!Lh()) throw Error("MathLive did not register math-field.");
|
|
9843
|
+
Vh(e, t);
|
|
9844
|
+
})), Ih.then(e(function* () {
|
|
9845
|
+
Vh(yield import("./mathlive.min-DIRFgINt.mjs"), t);
|
|
9503
9846
|
}));
|
|
9504
9847
|
}
|
|
9505
|
-
function
|
|
9506
|
-
|
|
9507
|
-
let e =
|
|
9508
|
-
e != null && e.hide && e.hide(),
|
|
9848
|
+
function zh() {
|
|
9849
|
+
Uh();
|
|
9850
|
+
let e = Hh();
|
|
9851
|
+
e != null && e.hide && e.hide(), Wh();
|
|
9509
9852
|
}
|
|
9510
|
-
function
|
|
9511
|
-
let e =
|
|
9853
|
+
function Bh() {
|
|
9854
|
+
let e = Hh();
|
|
9512
9855
|
e != null && e.show && e.show();
|
|
9513
9856
|
}
|
|
9514
|
-
function
|
|
9857
|
+
function Vh(e, t) {
|
|
9515
9858
|
e.MathfieldElement.locale = t, e.setKeyboardLayoutLocale(t);
|
|
9516
9859
|
}
|
|
9517
|
-
function
|
|
9860
|
+
function Hh() {
|
|
9518
9861
|
var e;
|
|
9519
9862
|
return typeof window > "u" || (e = window.mathVirtualKeyboard) == null ? null : e;
|
|
9520
9863
|
}
|
|
9521
|
-
function
|
|
9864
|
+
function Uh() {
|
|
9522
9865
|
if (typeof document > "u") return;
|
|
9523
9866
|
let e = document.activeElement;
|
|
9524
9867
|
e instanceof HTMLElement && e.blur();
|
|
9525
9868
|
}
|
|
9526
|
-
function
|
|
9869
|
+
function Wh() {
|
|
9527
9870
|
typeof document > "u" || document.querySelectorAll("#mathlive-suggestion-popover, #mathlive-environment-popover").forEach((e) => {
|
|
9528
9871
|
e.classList.remove("is-visible"), e.setAttribute("aria-hidden", "true");
|
|
9529
9872
|
});
|
|
9530
9873
|
}
|
|
9531
|
-
var
|
|
9874
|
+
var Gh = {
|
|
9532
9875
|
"dialog-backdrop": "_dialog-backdrop_u3zy8_1",
|
|
9533
9876
|
dialog: "_dialog_u3zy8_1",
|
|
9534
9877
|
"dialog-textarea": "_dialog-textarea_u3zy8_29",
|
|
@@ -9541,14 +9884,14 @@ var lh = {
|
|
|
9541
9884
|
};
|
|
9542
9885
|
//#endregion
|
|
9543
9886
|
//#region src/rich-text-editor/styled/MathFieldInput.tsx
|
|
9544
|
-
function
|
|
9545
|
-
let { locale: r, messages: i } =
|
|
9887
|
+
function Kh({ autoFocus: e, onChange: t, value: n }) {
|
|
9888
|
+
let { locale: r, messages: i } = pd(), [a, o] = y(null), [c, l] = y(!1), [u, f] = y(!1), m = d((e) => {
|
|
9546
9889
|
let t = e;
|
|
9547
9890
|
t && (t.mathVirtualKeyboardPolicy = "manual"), o(t);
|
|
9548
9891
|
}, []);
|
|
9549
9892
|
return p(() => {
|
|
9550
9893
|
let e = !0;
|
|
9551
|
-
return
|
|
9894
|
+
return Rh(r).then(() => {
|
|
9552
9895
|
e && l(!0);
|
|
9553
9896
|
}).catch(() => {
|
|
9554
9897
|
e && f(!0);
|
|
@@ -9558,22 +9901,22 @@ function uh({ autoFocus: e, onChange: t, value: n }) {
|
|
|
9558
9901
|
}, [r]), p(() => {
|
|
9559
9902
|
if (!c || !a) return;
|
|
9560
9903
|
let e = () => {
|
|
9561
|
-
t(
|
|
9904
|
+
t(qh(a));
|
|
9562
9905
|
}, n = () => {
|
|
9563
|
-
|
|
9906
|
+
Bh();
|
|
9564
9907
|
}, r = () => {
|
|
9565
|
-
|
|
9908
|
+
zh();
|
|
9566
9909
|
};
|
|
9567
9910
|
return a.addEventListener("input", e), a.addEventListener("focusin", n), a.addEventListener("focusout", r), () => {
|
|
9568
|
-
a.removeEventListener("input", e), a.removeEventListener("focusin", n), a.removeEventListener("focusout", r),
|
|
9911
|
+
a.removeEventListener("input", e), a.removeEventListener("focusin", n), a.removeEventListener("focusout", r), zh();
|
|
9569
9912
|
};
|
|
9570
9913
|
}, [
|
|
9571
9914
|
a,
|
|
9572
9915
|
t,
|
|
9573
9916
|
c
|
|
9574
|
-
]), p(() => () =>
|
|
9917
|
+
]), p(() => () => zh(), []), p(() => {
|
|
9575
9918
|
var e;
|
|
9576
|
-
!c || !a ||
|
|
9919
|
+
!c || !a || qh(a) === n || (e = a.setValue) == null || e.call(a, n, { silenceNotifications: !0 });
|
|
9577
9920
|
}, [
|
|
9578
9921
|
a,
|
|
9579
9922
|
c,
|
|
@@ -9585,29 +9928,29 @@ function uh({ autoFocus: e, onChange: t, value: n }) {
|
|
|
9585
9928
|
a,
|
|
9586
9929
|
c
|
|
9587
9930
|
]), u ? /* @__PURE__ */ x("div", {
|
|
9588
|
-
className:
|
|
9931
|
+
className: Gh["math-field-status"],
|
|
9589
9932
|
children: i.formulaEditorFailed
|
|
9590
9933
|
}) : c ? s("math-field", {
|
|
9591
|
-
class:
|
|
9934
|
+
class: Gh["math-field"],
|
|
9592
9935
|
"math-virtual-keyboard-policy": "manual",
|
|
9593
9936
|
ref: m,
|
|
9594
9937
|
"smart-fence": ""
|
|
9595
9938
|
}) : /* @__PURE__ */ x("div", {
|
|
9596
|
-
className:
|
|
9939
|
+
className: Gh["math-field-status"],
|
|
9597
9940
|
children: i.formulaEditorLoading
|
|
9598
9941
|
});
|
|
9599
9942
|
}
|
|
9600
|
-
function
|
|
9943
|
+
function qh(e) {
|
|
9601
9944
|
var t;
|
|
9602
9945
|
return e.getValue ? e.getValue("latex") : (t = e.value) == null ? "" : t;
|
|
9603
9946
|
}
|
|
9604
9947
|
//#endregion
|
|
9605
9948
|
//#region src/rich-text-editor/styled/FormulaDialogContent.tsx
|
|
9606
|
-
function
|
|
9607
|
-
let { messages: e } =
|
|
9608
|
-
|
|
9949
|
+
function Jh() {
|
|
9950
|
+
let { messages: e } = pd(), t = wh(), n = vh(), [r, i] = y(t.formulaDialog.initialLatex), a = r.trim(), o = a ? yh(a, t.formulaRenderUrl) : "", s = d(() => {
|
|
9951
|
+
zh(), t.closeFormulaDialog();
|
|
9609
9952
|
}, [t]);
|
|
9610
|
-
p(() => () =>
|
|
9953
|
+
p(() => () => zh(), []);
|
|
9611
9954
|
let c = () => {
|
|
9612
9955
|
if (!a) {
|
|
9613
9956
|
s();
|
|
@@ -9615,41 +9958,41 @@ function fh() {
|
|
|
9615
9958
|
}
|
|
9616
9959
|
let e = {
|
|
9617
9960
|
latex: a,
|
|
9618
|
-
src:
|
|
9961
|
+
src: yh(a, t.formulaRenderUrl)
|
|
9619
9962
|
};
|
|
9620
9963
|
t.formulaDialog.updateFormula ? t.formulaDialog.updateFormula(e) : n(e), s();
|
|
9621
9964
|
};
|
|
9622
9965
|
return /* @__PURE__ */ x("div", {
|
|
9623
|
-
className:
|
|
9966
|
+
className: Gh["dialog-backdrop"],
|
|
9624
9967
|
role: "presentation",
|
|
9625
9968
|
children: /* @__PURE__ */ S("section", {
|
|
9626
9969
|
"aria-label": e.formulaDialogLabel,
|
|
9627
|
-
className:
|
|
9970
|
+
className: Gh.dialog,
|
|
9628
9971
|
children: [
|
|
9629
|
-
/* @__PURE__ */ x(
|
|
9972
|
+
/* @__PURE__ */ x(Kh, {
|
|
9630
9973
|
autoFocus: !0,
|
|
9631
9974
|
onChange: i,
|
|
9632
9975
|
value: r
|
|
9633
9976
|
}),
|
|
9634
9977
|
/* @__PURE__ */ x("textarea", {
|
|
9635
9978
|
"aria-label": e.formulaLatexInput,
|
|
9636
|
-
className:
|
|
9979
|
+
className: Gh["dialog-textarea"],
|
|
9637
9980
|
onChange: (e) => i(e.target.value),
|
|
9638
9981
|
value: r
|
|
9639
9982
|
}),
|
|
9640
9983
|
/* @__PURE__ */ x("div", {
|
|
9641
|
-
className:
|
|
9984
|
+
className: Gh["formula-preview"],
|
|
9642
9985
|
children: o ? /* @__PURE__ */ x("img", {
|
|
9643
9986
|
alt: a,
|
|
9644
|
-
className:
|
|
9987
|
+
className: Gh["formula-preview-image"],
|
|
9645
9988
|
src: o
|
|
9646
9989
|
}) : e.formulaPreviewEmpty
|
|
9647
9990
|
}),
|
|
9648
9991
|
/* @__PURE__ */ S("div", {
|
|
9649
|
-
className:
|
|
9992
|
+
className: Gh["dialog-actions"],
|
|
9650
9993
|
children: [/* @__PURE__ */ x("button", {
|
|
9651
9994
|
"aria-label": e.formulaDialogCancel,
|
|
9652
|
-
className:
|
|
9995
|
+
className: Gh["dialog-button"],
|
|
9653
9996
|
onMouseDown: (e) => {
|
|
9654
9997
|
e.preventDefault(), s();
|
|
9655
9998
|
},
|
|
@@ -9658,7 +10001,7 @@ function fh() {
|
|
|
9658
10001
|
children: e.formulaDialogCancel
|
|
9659
10002
|
}), /* @__PURE__ */ x("button", {
|
|
9660
10003
|
"aria-label": e.formulaDialogInsert,
|
|
9661
|
-
className:
|
|
10004
|
+
className: Gh["dialog-button"],
|
|
9662
10005
|
onMouseDown: (e) => {
|
|
9663
10006
|
e.preventDefault(), c();
|
|
9664
10007
|
},
|
|
@@ -9673,63 +10016,63 @@ function fh() {
|
|
|
9673
10016
|
}
|
|
9674
10017
|
//#endregion
|
|
9675
10018
|
//#region src/rich-text-editor/styled/FormulaDialog.tsx
|
|
9676
|
-
function
|
|
9677
|
-
let e =
|
|
9678
|
-
return e.formulaDialog.open ? /* @__PURE__ */ x(
|
|
10019
|
+
function Yh() {
|
|
10020
|
+
let e = wh();
|
|
10021
|
+
return e.formulaDialog.open ? /* @__PURE__ */ x(Jh, {}, e.formulaDialog.initialLatex) : null;
|
|
9679
10022
|
}
|
|
9680
10023
|
//#endregion
|
|
9681
10024
|
//#region src/rich-text-editor/styled/Root.tsx
|
|
9682
|
-
function
|
|
9683
|
-
return /* @__PURE__ */ x(
|
|
10025
|
+
function Xh({ children: e, className: t, defaultActiveEditorId: n, formulaRenderUrl: r, id: i, locale: a, messages: o, onCommand: s, onEditorFocusChange: c, onOpenFormula: l, onOpenImageUpload: u, plugins: d, uploadImage: f }) {
|
|
10026
|
+
return /* @__PURE__ */ x(fd, {
|
|
9684
10027
|
locale: a,
|
|
9685
10028
|
messages: o,
|
|
9686
|
-
children: /* @__PURE__ */ x(
|
|
10029
|
+
children: /* @__PURE__ */ x(Sh, {
|
|
9687
10030
|
formulaRenderUrl: r,
|
|
9688
10031
|
onOpenFormula: l,
|
|
9689
10032
|
onOpenImageUpload: u,
|
|
9690
10033
|
uploadImage: f,
|
|
9691
|
-
children: /* @__PURE__ */ S(
|
|
9692
|
-
className: L(
|
|
10034
|
+
children: /* @__PURE__ */ S($.Root, {
|
|
10035
|
+
className: L(Th.root, t),
|
|
9693
10036
|
defaultActiveEditorId: n,
|
|
9694
10037
|
id: i,
|
|
9695
10038
|
onCommand: s,
|
|
9696
10039
|
onEditorFocusChange: c,
|
|
9697
10040
|
plugins: d,
|
|
9698
|
-
children: [e, /* @__PURE__ */ x(
|
|
10041
|
+
children: [e, /* @__PURE__ */ x(Yh, {})]
|
|
9699
10042
|
})
|
|
9700
10043
|
})
|
|
9701
10044
|
});
|
|
9702
10045
|
}
|
|
9703
10046
|
//#endregion
|
|
9704
10047
|
//#region src/rich-text-editor/styled/DefaultToolbarSection.tsx
|
|
9705
|
-
var
|
|
9706
|
-
function
|
|
9707
|
-
let { children: t } = e, n = te(e,
|
|
9708
|
-
return /* @__PURE__ */ x(
|
|
10048
|
+
var Zh = ["children"];
|
|
10049
|
+
function Qh(e) {
|
|
10050
|
+
let { children: t } = e, n = te(e, Zh);
|
|
10051
|
+
return /* @__PURE__ */ x(dh.Section, {
|
|
9709
10052
|
"aria-label": n["aria-label"],
|
|
9710
|
-
className:
|
|
10053
|
+
className: Th["toolbar-section"],
|
|
9711
10054
|
children: t
|
|
9712
10055
|
});
|
|
9713
10056
|
}
|
|
9714
10057
|
//#endregion
|
|
9715
10058
|
//#region src/rich-text-editor/styled/DefaultToolbarSeparator.tsx
|
|
9716
|
-
function
|
|
9717
|
-
return /* @__PURE__ */ x(
|
|
10059
|
+
function $h() {
|
|
10060
|
+
return /* @__PURE__ */ x(dh.Separator, { className: Th["toolbar-separator"] });
|
|
9718
10061
|
}
|
|
9719
10062
|
//#endregion
|
|
9720
10063
|
//#region src/rich-text-editor/styled/createStyledSelectButton.tsx
|
|
9721
|
-
var
|
|
10064
|
+
var eg = [
|
|
9722
10065
|
"children",
|
|
9723
10066
|
"className",
|
|
9724
10067
|
"payload"
|
|
9725
10068
|
];
|
|
9726
|
-
function
|
|
10069
|
+
function tg(e, t, n) {
|
|
9727
10070
|
return function(r) {
|
|
9728
10071
|
var i, a;
|
|
9729
|
-
let { children: o, className: s, payload: c } = r, l = te(r,
|
|
10072
|
+
let { children: o, className: s, payload: c } = r, l = te(r, eg), { messages: u } = pd(), d = (i = l["aria-label"]) == null ? md(u, n) : i, f = c == null ? l.asChild || !((a = l.options) != null && a.length) ? t : void 0 : c;
|
|
9730
10073
|
return /* @__PURE__ */ x(e, I(I({}, l), {}, {
|
|
9731
10074
|
"aria-label": d,
|
|
9732
|
-
className: L(
|
|
10075
|
+
className: L(mh.button, s),
|
|
9733
10076
|
payload: f,
|
|
9734
10077
|
children: o
|
|
9735
10078
|
}));
|
|
@@ -9737,40 +10080,40 @@ function yh(e, t, n) {
|
|
|
9737
10080
|
}
|
|
9738
10081
|
//#endregion
|
|
9739
10082
|
//#region src/rich-text-editor/styled/createStyledToolbarButton.tsx
|
|
9740
|
-
var
|
|
9741
|
-
function
|
|
10083
|
+
var ng = ["children", "className"];
|
|
10084
|
+
function rg(e, t) {
|
|
9742
10085
|
return function(n) {
|
|
9743
10086
|
var r;
|
|
9744
|
-
let { children: i, className: a } = n, o = te(n,
|
|
10087
|
+
let { children: i, className: a } = n, o = te(n, ng), { messages: s } = pd(), c = (r = o["aria-label"]) == null ? md(s, t) : r;
|
|
9745
10088
|
return /* @__PURE__ */ x(e, I(I({}, o), {}, {
|
|
9746
10089
|
"aria-label": c,
|
|
9747
|
-
className: L(
|
|
10090
|
+
className: L(mh.button, a),
|
|
9748
10091
|
children: i
|
|
9749
10092
|
}));
|
|
9750
10093
|
};
|
|
9751
10094
|
}
|
|
9752
10095
|
//#endregion
|
|
9753
10096
|
//#region src/rich-text-editor/styled/StyledToolbarIconButton.tsx
|
|
9754
|
-
function
|
|
10097
|
+
function ig({ className: e, disabled: t = !1, icon: n, label: r, onPress: i }) {
|
|
9755
10098
|
return /* @__PURE__ */ x("button", {
|
|
9756
10099
|
"aria-label": r,
|
|
9757
|
-
className: L(
|
|
10100
|
+
className: L(mh.button, e),
|
|
9758
10101
|
"data-disabled": t ? "true" : void 0,
|
|
9759
10102
|
disabled: t,
|
|
9760
10103
|
onClick: i,
|
|
9761
10104
|
type: "button",
|
|
9762
10105
|
children: /* @__PURE__ */ x(n, {
|
|
9763
10106
|
"aria-hidden": "true",
|
|
9764
|
-
className:
|
|
10107
|
+
className: mh.icon
|
|
9765
10108
|
})
|
|
9766
10109
|
});
|
|
9767
10110
|
}
|
|
9768
10111
|
//#endregion
|
|
9769
10112
|
//#region src/rich-text-editor/styled/FormulaButton.tsx
|
|
9770
|
-
function
|
|
10113
|
+
function ag(e) {
|
|
9771
10114
|
var t;
|
|
9772
|
-
let { messages: n } =
|
|
9773
|
-
return /* @__PURE__ */ x(
|
|
10115
|
+
let { messages: n } = pd(), r = wh();
|
|
10116
|
+
return /* @__PURE__ */ x(ig, {
|
|
9774
10117
|
className: e.className,
|
|
9775
10118
|
disabled: e.disabled,
|
|
9776
10119
|
icon: cu,
|
|
@@ -9788,9 +10131,9 @@ function Ch(e) {
|
|
|
9788
10131
|
}
|
|
9789
10132
|
//#endregion
|
|
9790
10133
|
//#region src/rich-text-editor/styled/ImageButton.tsx
|
|
9791
|
-
function
|
|
10134
|
+
function og(t) {
|
|
9792
10135
|
var n;
|
|
9793
|
-
let { messages: r } =
|
|
10136
|
+
let { messages: r } = pd(), i = v(null), a = wh(), o = _h(), s = t.disabled || !a.onOpenImageUpload && !a.uploadImage, c = () => {
|
|
9794
10137
|
var e;
|
|
9795
10138
|
if (!s) {
|
|
9796
10139
|
if (a.onOpenImageUpload) {
|
|
@@ -9809,7 +10152,7 @@ function wh(t) {
|
|
|
9809
10152
|
return t.apply(this, arguments);
|
|
9810
10153
|
};
|
|
9811
10154
|
}();
|
|
9812
|
-
return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(
|
|
10155
|
+
return /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(ig, {
|
|
9813
10156
|
className: t.className,
|
|
9814
10157
|
disabled: s,
|
|
9815
10158
|
icon: nu,
|
|
@@ -9818,6 +10161,8 @@ function wh(t) {
|
|
|
9818
10161
|
}), /* @__PURE__ */ x("input", {
|
|
9819
10162
|
accept: "image/*",
|
|
9820
10163
|
"aria-hidden": "true",
|
|
10164
|
+
id: "rich-text-editor-image-upload",
|
|
10165
|
+
name: "richTextEditorImageUpload",
|
|
9821
10166
|
onChange: (e) => {
|
|
9822
10167
|
l(e);
|
|
9823
10168
|
},
|
|
@@ -9829,113 +10174,113 @@ function wh(t) {
|
|
|
9829
10174
|
}
|
|
9830
10175
|
//#endregion
|
|
9831
10176
|
//#region src/rich-text-editor/styled/toolbarDescriptors.tsx
|
|
9832
|
-
var
|
|
10177
|
+
var sg = [
|
|
9833
10178
|
{
|
|
9834
|
-
Component:
|
|
10179
|
+
Component: rg($.Toolbar.AlignCenterButton, "toolbarAlignCenter"),
|
|
9835
10180
|
actionKey: "alignCenter",
|
|
9836
10181
|
messageKey: "toolbarAlignCenter"
|
|
9837
10182
|
},
|
|
9838
10183
|
{
|
|
9839
|
-
Component:
|
|
10184
|
+
Component: rg($.Toolbar.AlignLeftButton, "toolbarAlignLeft"),
|
|
9840
10185
|
actionKey: "alignLeft",
|
|
9841
10186
|
messageKey: "toolbarAlignLeft"
|
|
9842
10187
|
},
|
|
9843
10188
|
{
|
|
9844
|
-
Component:
|
|
10189
|
+
Component: rg($.Toolbar.AlignRightButton, "toolbarAlignRight"),
|
|
9845
10190
|
actionKey: "alignRight",
|
|
9846
10191
|
messageKey: "toolbarAlignRight"
|
|
9847
10192
|
},
|
|
9848
10193
|
{
|
|
9849
|
-
Component:
|
|
10194
|
+
Component: rg($.Toolbar.BoldToggle, "toolbarBold"),
|
|
9850
10195
|
actionKey: "bold",
|
|
9851
10196
|
messageKey: "toolbarBold"
|
|
9852
10197
|
},
|
|
9853
10198
|
{
|
|
9854
|
-
Component:
|
|
10199
|
+
Component: rg($.Toolbar.BulletedListToggle, "toolbarBulletedList"),
|
|
9855
10200
|
actionKey: "bulletedList",
|
|
9856
10201
|
messageKey: "toolbarBulletedList"
|
|
9857
10202
|
},
|
|
9858
10203
|
{
|
|
9859
|
-
Component:
|
|
10204
|
+
Component: rg($.Toolbar.CodeToggle, "toolbarCode"),
|
|
9860
10205
|
actionKey: "code",
|
|
9861
10206
|
messageKey: "toolbarCode"
|
|
9862
10207
|
},
|
|
9863
10208
|
{
|
|
9864
|
-
Component:
|
|
10209
|
+
Component: tg($.Toolbar.ColorSelect, "#0445FC", "toolbarTextColor"),
|
|
9865
10210
|
actionKey: "color",
|
|
9866
10211
|
messageKey: "toolbarTextColor"
|
|
9867
10212
|
},
|
|
9868
10213
|
{
|
|
9869
|
-
Component:
|
|
10214
|
+
Component: rg($.Toolbar.DividerButton, "toolbarDivider"),
|
|
9870
10215
|
actionKey: "divider",
|
|
9871
10216
|
messageKey: "toolbarDivider"
|
|
9872
10217
|
},
|
|
9873
10218
|
{
|
|
9874
|
-
Component:
|
|
10219
|
+
Component: tg($.Toolbar.FontSizeSelect, "16px", "toolbarFontSize"),
|
|
9875
10220
|
actionKey: "fontSize",
|
|
9876
10221
|
messageKey: "toolbarFontSize"
|
|
9877
10222
|
},
|
|
9878
10223
|
{
|
|
9879
|
-
Component:
|
|
10224
|
+
Component: ag,
|
|
9880
10225
|
actionKey: "formula",
|
|
9881
10226
|
messageKey: "toolbarFormula"
|
|
9882
10227
|
},
|
|
9883
10228
|
{
|
|
9884
|
-
Component:
|
|
10229
|
+
Component: rg($.Toolbar.Heading1Button, "toolbarHeading1"),
|
|
9885
10230
|
actionKey: "heading1",
|
|
9886
10231
|
messageKey: "toolbarHeading1"
|
|
9887
10232
|
},
|
|
9888
10233
|
{
|
|
9889
|
-
Component:
|
|
10234
|
+
Component: rg($.Toolbar.Heading2Button, "toolbarHeading2"),
|
|
9890
10235
|
actionKey: "heading2",
|
|
9891
10236
|
messageKey: "toolbarHeading2"
|
|
9892
10237
|
},
|
|
9893
10238
|
{
|
|
9894
|
-
Component:
|
|
10239
|
+
Component: rg($.Toolbar.Heading3Button, "toolbarHeading3"),
|
|
9895
10240
|
actionKey: "heading3",
|
|
9896
10241
|
messageKey: "toolbarHeading3"
|
|
9897
10242
|
},
|
|
9898
10243
|
{
|
|
9899
|
-
Component:
|
|
10244
|
+
Component: og,
|
|
9900
10245
|
actionKey: "image",
|
|
9901
10246
|
messageKey: "toolbarImage"
|
|
9902
10247
|
},
|
|
9903
10248
|
{
|
|
9904
|
-
Component:
|
|
10249
|
+
Component: rg($.Toolbar.ItalicToggle, "toolbarItalic"),
|
|
9905
10250
|
actionKey: "italic",
|
|
9906
10251
|
messageKey: "toolbarItalic"
|
|
9907
10252
|
},
|
|
9908
10253
|
{
|
|
9909
|
-
Component:
|
|
10254
|
+
Component: rg($.Toolbar.NumberedListToggle, "toolbarNumberedList"),
|
|
9910
10255
|
actionKey: "numberedList",
|
|
9911
10256
|
messageKey: "toolbarNumberedList"
|
|
9912
10257
|
},
|
|
9913
10258
|
{
|
|
9914
|
-
Component:
|
|
10259
|
+
Component: rg($.Toolbar.RedoButton, "toolbarRedo"),
|
|
9915
10260
|
actionKey: "redo",
|
|
9916
10261
|
messageKey: "toolbarRedo"
|
|
9917
10262
|
},
|
|
9918
10263
|
{
|
|
9919
|
-
Component:
|
|
10264
|
+
Component: rg($.Toolbar.StrikeToggle, "toolbarStrike"),
|
|
9920
10265
|
actionKey: "strike",
|
|
9921
10266
|
messageKey: "toolbarStrike"
|
|
9922
10267
|
},
|
|
9923
10268
|
{
|
|
9924
|
-
Component:
|
|
10269
|
+
Component: rg($.Toolbar.TableButton, "toolbarTable"),
|
|
9925
10270
|
actionKey: "table",
|
|
9926
10271
|
messageKey: "toolbarTable"
|
|
9927
10272
|
},
|
|
9928
10273
|
{
|
|
9929
|
-
Component:
|
|
10274
|
+
Component: rg($.Toolbar.UnderlineToggle, "toolbarUnderline"),
|
|
9930
10275
|
actionKey: "underline",
|
|
9931
10276
|
messageKey: "toolbarUnderline"
|
|
9932
10277
|
},
|
|
9933
10278
|
{
|
|
9934
|
-
Component:
|
|
10279
|
+
Component: rg($.Toolbar.UndoButton, "toolbarUndo"),
|
|
9935
10280
|
actionKey: "undo",
|
|
9936
10281
|
messageKey: "toolbarUndo"
|
|
9937
10282
|
}
|
|
9938
|
-
],
|
|
10283
|
+
], cg = new Map(sg.map((e) => [e.actionKey, e])), lg = new Map([
|
|
9939
10284
|
["Heading", "toolbarGroupHeading"],
|
|
9940
10285
|
["History", "toolbarGroupHistory"],
|
|
9941
10286
|
["Insert", "toolbarGroupInsert"],
|
|
@@ -9943,52 +10288,52 @@ var Th = [
|
|
|
9943
10288
|
["Table", "toolbarGroupTable"],
|
|
9944
10289
|
["Text style", "toolbarGroupTextStyle"]
|
|
9945
10290
|
]);
|
|
9946
|
-
function
|
|
9947
|
-
let t =
|
|
10291
|
+
function ug(e) {
|
|
10292
|
+
let t = cg.get(e);
|
|
9948
10293
|
if (!t) throw Error(`Missing RichTextEditor styled toolbar action: ${e}.`);
|
|
9949
10294
|
return t;
|
|
9950
10295
|
}
|
|
9951
|
-
function
|
|
9952
|
-
return
|
|
10296
|
+
function dg(e) {
|
|
10297
|
+
return ug(e).Component;
|
|
9953
10298
|
}
|
|
9954
|
-
function
|
|
9955
|
-
return
|
|
10299
|
+
function fg(e) {
|
|
10300
|
+
return ug(e).messageKey;
|
|
9956
10301
|
}
|
|
9957
|
-
function
|
|
9958
|
-
return
|
|
10302
|
+
function pg(e) {
|
|
10303
|
+
return lg.get(e);
|
|
9959
10304
|
}
|
|
9960
10305
|
//#endregion
|
|
9961
10306
|
//#region src/rich-text-editor/styled/defaultToolbar.tsx
|
|
9962
|
-
function
|
|
9963
|
-
let { messages: e } =
|
|
9964
|
-
return /* @__PURE__ */ x(b, { children:
|
|
10307
|
+
function mg() {
|
|
10308
|
+
let { messages: e } = pd();
|
|
10309
|
+
return /* @__PURE__ */ x(b, { children: vg().map((t, n) => /* @__PURE__ */ S(a, { children: [hg(n), gg(t, e)] }, t.groupKey)) });
|
|
9965
10310
|
}
|
|
9966
|
-
function
|
|
9967
|
-
return e > 0 ? /* @__PURE__ */ x(
|
|
10311
|
+
function hg(e) {
|
|
10312
|
+
return e > 0 ? /* @__PURE__ */ x($h, {}) : null;
|
|
9968
10313
|
}
|
|
9969
|
-
function
|
|
9970
|
-
return /* @__PURE__ */ x(
|
|
9971
|
-
"aria-label":
|
|
9972
|
-
children: e.actions.map((e) =>
|
|
10314
|
+
function gg(e, t) {
|
|
10315
|
+
return /* @__PURE__ */ x(Qh, {
|
|
10316
|
+
"aria-label": yg(e, t),
|
|
10317
|
+
children: e.actions.map((e) => _g(e, t))
|
|
9973
10318
|
});
|
|
9974
10319
|
}
|
|
9975
|
-
function
|
|
9976
|
-
let i =
|
|
10320
|
+
function _g({ Action: e, actionKey: t, payload: n }, r) {
|
|
10321
|
+
let i = bg(t, r);
|
|
9977
10322
|
return /* @__PURE__ */ x(e, {
|
|
9978
10323
|
"aria-label": i,
|
|
9979
|
-
className:
|
|
10324
|
+
className: mh.button,
|
|
9980
10325
|
payload: n
|
|
9981
10326
|
}, i);
|
|
9982
10327
|
}
|
|
9983
|
-
function
|
|
9984
|
-
let e =
|
|
10328
|
+
function vg() {
|
|
10329
|
+
let e = pp();
|
|
9985
10330
|
return e.toolbarGroups.map((t) => ({
|
|
9986
10331
|
actions: t.actionKeys.map((t) => {
|
|
9987
10332
|
var n;
|
|
9988
10333
|
let r = (n = e.getToolbarAction(t)) == null ? void 0 : n.action;
|
|
9989
10334
|
if (!r) throw Error(`Missing RichTextEditor toolbar action: ${t}.`);
|
|
9990
10335
|
return {
|
|
9991
|
-
Action:
|
|
10336
|
+
Action: xg(t),
|
|
9992
10337
|
actionKey: t,
|
|
9993
10338
|
payload: r.payload
|
|
9994
10339
|
};
|
|
@@ -9996,78 +10341,78 @@ function Fh() {
|
|
|
9996
10341
|
groupKey: t.label
|
|
9997
10342
|
}));
|
|
9998
10343
|
}
|
|
9999
|
-
function
|
|
10344
|
+
function yg(e, t) {
|
|
10000
10345
|
var n;
|
|
10001
|
-
return (n =
|
|
10346
|
+
return (n = md(t, pg(e.groupKey))) == null ? t.toolbarLabel : n;
|
|
10002
10347
|
}
|
|
10003
|
-
function
|
|
10348
|
+
function bg(e, t) {
|
|
10004
10349
|
var n;
|
|
10005
|
-
return (n =
|
|
10350
|
+
return (n = md(t, fg(e))) == null ? t.toolbarLabel : n;
|
|
10006
10351
|
}
|
|
10007
|
-
function
|
|
10008
|
-
return
|
|
10352
|
+
function xg(e) {
|
|
10353
|
+
return dg(e);
|
|
10009
10354
|
}
|
|
10010
10355
|
//#endregion
|
|
10011
10356
|
//#region src/rich-text-editor/styled/Toolbar.tsx
|
|
10012
|
-
function
|
|
10013
|
-
let { messages: i } =
|
|
10014
|
-
return /* @__PURE__ */ x(
|
|
10357
|
+
function Sg({ "aria-label": e, children: t, className: n, visibleWhen: r }) {
|
|
10358
|
+
let { messages: i } = pd();
|
|
10359
|
+
return /* @__PURE__ */ x($.Toolbar, {
|
|
10015
10360
|
"aria-label": e == null ? i.toolbarLabel : e,
|
|
10016
|
-
className: L(
|
|
10017
|
-
defaultContent: /* @__PURE__ */ x(
|
|
10361
|
+
className: L(Th.toolbar, n),
|
|
10362
|
+
defaultContent: /* @__PURE__ */ x(mg, {}),
|
|
10018
10363
|
visibleWhen: r,
|
|
10019
10364
|
children: t
|
|
10020
10365
|
});
|
|
10021
10366
|
}
|
|
10022
10367
|
//#endregion
|
|
10023
10368
|
//#region src/rich-text-editor/styled/ToolbarSection.tsx
|
|
10024
|
-
function
|
|
10025
|
-
return /* @__PURE__ */ x(
|
|
10369
|
+
function Cg({ "aria-label": e, children: t, className: n }) {
|
|
10370
|
+
return /* @__PURE__ */ x($.Toolbar.Section, {
|
|
10026
10371
|
"aria-label": e,
|
|
10027
|
-
className: L(
|
|
10372
|
+
className: L(Th["toolbar-section"], n),
|
|
10028
10373
|
children: t
|
|
10029
10374
|
});
|
|
10030
10375
|
}
|
|
10031
10376
|
//#endregion
|
|
10032
10377
|
//#region src/rich-text-editor/styled/ToolbarSeparator.tsx
|
|
10033
|
-
function
|
|
10378
|
+
function wg(e) {
|
|
10034
10379
|
let { className: t } = e;
|
|
10035
|
-
return /* @__PURE__ */ x(
|
|
10380
|
+
return /* @__PURE__ */ x($.Toolbar.Separator, { className: L(Th["toolbar-separator"], t) });
|
|
10036
10381
|
}
|
|
10037
10382
|
//#endregion
|
|
10038
10383
|
//#region src/rich-text-editor/index.ts
|
|
10039
|
-
var
|
|
10040
|
-
Editor:
|
|
10041
|
-
Root:
|
|
10042
|
-
Toolbar: Object.assign(
|
|
10043
|
-
AlignCenterButton:
|
|
10044
|
-
AlignLeftButton:
|
|
10045
|
-
AlignRightButton:
|
|
10046
|
-
BoldToggle:
|
|
10047
|
-
BulletedListToggle:
|
|
10048
|
-
CodeToggle:
|
|
10049
|
-
ColorSelect:
|
|
10050
|
-
Case:
|
|
10051
|
-
Default:
|
|
10052
|
-
DividerButton:
|
|
10053
|
-
FontSizeSelect:
|
|
10054
|
-
FormulaButton:
|
|
10055
|
-
Heading1Button:
|
|
10056
|
-
Heading2Button:
|
|
10057
|
-
Heading3Button:
|
|
10058
|
-
ImageButton:
|
|
10059
|
-
InsertNodeButton:
|
|
10060
|
-
ItalicToggle:
|
|
10061
|
-
NumberedListToggle:
|
|
10062
|
-
RedoButton:
|
|
10063
|
-
Section:
|
|
10064
|
-
Separator:
|
|
10065
|
-
StrikeToggle:
|
|
10066
|
-
Switch:
|
|
10067
|
-
TableButton:
|
|
10068
|
-
UnderlineToggle:
|
|
10069
|
-
UndoButton:
|
|
10384
|
+
var Tg = {
|
|
10385
|
+
Editor: Dh,
|
|
10386
|
+
Root: Xh,
|
|
10387
|
+
Toolbar: Object.assign(Sg, {
|
|
10388
|
+
AlignCenterButton: dg("alignCenter"),
|
|
10389
|
+
AlignLeftButton: dg("alignLeft"),
|
|
10390
|
+
AlignRightButton: dg("alignRight"),
|
|
10391
|
+
BoldToggle: dg("bold"),
|
|
10392
|
+
BulletedListToggle: dg("bulletedList"),
|
|
10393
|
+
CodeToggle: dg("code"),
|
|
10394
|
+
ColorSelect: dg("color"),
|
|
10395
|
+
Case: $.Toolbar.Case,
|
|
10396
|
+
Default: $.Toolbar.Default,
|
|
10397
|
+
DividerButton: dg("divider"),
|
|
10398
|
+
FontSizeSelect: dg("fontSize"),
|
|
10399
|
+
FormulaButton: dg("formula"),
|
|
10400
|
+
Heading1Button: dg("heading1"),
|
|
10401
|
+
Heading2Button: dg("heading2"),
|
|
10402
|
+
Heading3Button: dg("heading3"),
|
|
10403
|
+
ImageButton: dg("image"),
|
|
10404
|
+
InsertNodeButton: gh($.Toolbar.InsertNodeButton),
|
|
10405
|
+
ItalicToggle: dg("italic"),
|
|
10406
|
+
NumberedListToggle: dg("numberedList"),
|
|
10407
|
+
RedoButton: dg("redo"),
|
|
10408
|
+
Section: Cg,
|
|
10409
|
+
Separator: wg,
|
|
10410
|
+
StrikeToggle: dg("strike"),
|
|
10411
|
+
Switch: $.Toolbar.Switch,
|
|
10412
|
+
TableButton: dg("table"),
|
|
10413
|
+
UnderlineToggle: dg("underline"),
|
|
10414
|
+
UndoButton: dg("undo")
|
|
10070
10415
|
})
|
|
10071
10416
|
};
|
|
10072
10417
|
//#endregion
|
|
10073
|
-
export {
|
|
10418
|
+
export { Tg as RichTextEditor, Pp as deserializeRichTextEditorHtml, Lp as deserializeRichTextEditorJson, Ip as serializeRichTextEditorHtml, Rp as serializeRichTextEditorJson };
|