ai-word-editor 0.0.26 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +304 -304
- package/dist/types/utils/wordDocxExport.d.ts.map +1 -1
- package/dist/{wordDocxExport-CYxYyGfR.js → wordDocxExport-HUc5glnu.js} +49 -50
- package/dist/wordDocxExport.js +1 -1
- package/package.json +1 -1
- package/src/utils/docxFeatureExtract.ts +5 -8
- package/src/utils/wordCommentImport.js +3 -4
- package/src/utils/wordDocxExport.ts +3 -4
- package/src/utils/wordStyleImport.js +3 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useUmoEditor as bo } from "@umoteam/editor";
|
|
2
|
-
import { ref as z, computed as Ne, openBlock as q, createElementBlock as rt, createElementVNode as y, createTextVNode as Ln, toDisplayString as Y, createCommentVNode as le, unref as oe, Fragment as
|
|
3
|
-
import { e as $o, a as Bo, s as Ro } from "./wordDocxExport-
|
|
4
|
-
import
|
|
2
|
+
import { ref as z, computed as Ne, openBlock as q, createElementBlock as rt, createElementVNode as y, createTextVNode as Ln, toDisplayString as Y, createCommentVNode as le, unref as oe, Fragment as hr, renderList as pr, normalizeClass as mr, onMounted as gr, createBlock as Ie, Teleport as yr, withModifiers as ze, withDirectives as vo, withKeys as dn, vModelText as So, watch as hn, normalizeStyle as Co, onUnmounted as To, resolveComponent as Ao, mergeProps as Mo, withCtx as Eo, createVNode as No, createApp as Io, h as Oo } from "vue";
|
|
3
|
+
import { e as $o, a as Bo, s as Ro } from "./wordDocxExport-HUc5glnu.js";
|
|
4
|
+
import wr from "jszip";
|
|
5
5
|
const zo = "http://localhost:8000";
|
|
6
6
|
async function Tt(r, t = {}) {
|
|
7
7
|
const e = {
|
|
@@ -86,17 +86,17 @@ function Do(r, t) {
|
|
|
86
86
|
const e = yt.get(r) || {};
|
|
87
87
|
yt.set(r, { ...e, ...t });
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Jn(r) {
|
|
90
90
|
if (ft.has(r)) {
|
|
91
91
|
ft.delete(r), yt.delete(r), xt.delete(r);
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
yt.delete(r), xt.add(r);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Lo(r) {
|
|
97
97
|
xt.delete(r);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Jo() {
|
|
100
100
|
ft.clear(), yt.clear(), xt.clear();
|
|
101
101
|
}
|
|
102
102
|
async function Wo(r) {
|
|
@@ -168,7 +168,7 @@ function xr() {
|
|
|
168
168
|
const l = Ct.value.slice();
|
|
169
169
|
Ct.value = Ct.value.filter((a) => a.id !== s), ve.value === s && (ve.value = null);
|
|
170
170
|
try {
|
|
171
|
-
|
|
171
|
+
Jn(s);
|
|
172
172
|
} catch (a) {
|
|
173
173
|
Ct.value = l, console.error("删除批注入队失败:", a);
|
|
174
174
|
}
|
|
@@ -185,10 +185,10 @@ function xr() {
|
|
|
185
185
|
return `${l.getMonth() + 1}/${l.getDate()} ${a(l.getHours())}:${a(l.getMinutes())}`;
|
|
186
186
|
},
|
|
187
187
|
flushPending: Wo,
|
|
188
|
-
resetPending:
|
|
188
|
+
resetPending: Jo,
|
|
189
189
|
// 供 App.vue 的“孤立批注软删除/撤销”逻辑使用
|
|
190
|
-
queueDelete:
|
|
191
|
-
cancelPendingDelete:
|
|
190
|
+
queueDelete: Jn,
|
|
191
|
+
cancelPendingDelete: Lo
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
194
|
const He = (r, t) => {
|
|
@@ -224,9 +224,9 @@ const He = (r, t) => {
|
|
|
224
224
|
y("p", null, "暂无批注", -1),
|
|
225
225
|
y("p", { class: "comment-panel__empty-hint" }, "选中文本后点击「添加批注」", -1)
|
|
226
226
|
])])) : (q(), rt("ul", Go, [
|
|
227
|
-
(q(!0), rt(
|
|
227
|
+
(q(!0), rt(hr, null, pr(oe(e), (d) => (q(), rt("li", {
|
|
228
228
|
key: d.id,
|
|
229
|
-
class:
|
|
229
|
+
class: mr(["comment-item", [
|
|
230
230
|
`comment-item--c${d.colorIndex ?? 0}`,
|
|
231
231
|
{
|
|
232
232
|
"comment-item--active": oe(n) === d.id,
|
|
@@ -266,13 +266,13 @@ const He = (r, t) => {
|
|
|
266
266
|
emits: ["confirm", "cancel"],
|
|
267
267
|
setup(r, { emit: t }) {
|
|
268
268
|
const e = r, n = t, o = z(e.initialNote), i = z(null);
|
|
269
|
-
|
|
269
|
+
gr(() => {
|
|
270
270
|
i.value?.focus();
|
|
271
271
|
});
|
|
272
272
|
const s = (a, c) => a ? a.length > c ? a.slice(0, c) + "…" : a : "", l = () => {
|
|
273
273
|
o.value.trim() && (n("confirm", o.value.trim()), o.value = "");
|
|
274
274
|
};
|
|
275
|
-
return (a, c) => (q(), Ie(
|
|
275
|
+
return (a, c) => (q(), Ie(yr, { to: "body" }, [
|
|
276
276
|
y("div", {
|
|
277
277
|
class: "dialog-backdrop",
|
|
278
278
|
onClick: c[4] || (c[4] = ze((u) => a.$emit("cancel"), ["self"]))
|
|
@@ -757,7 +757,7 @@ function Pe(r, t) {
|
|
|
757
757
|
}
|
|
758
758
|
return !0;
|
|
759
759
|
}
|
|
760
|
-
let
|
|
760
|
+
let J = class pn {
|
|
761
761
|
/**
|
|
762
762
|
@internal
|
|
763
763
|
*/
|
|
@@ -855,14 +855,14 @@ let L = class mn {
|
|
|
855
855
|
*/
|
|
856
856
|
static setFrom(t) {
|
|
857
857
|
if (!t || Array.isArray(t) && t.length == 0)
|
|
858
|
-
return
|
|
859
|
-
if (t instanceof
|
|
858
|
+
return pn.none;
|
|
859
|
+
if (t instanceof pn)
|
|
860
860
|
return [t];
|
|
861
861
|
let e = t.slice();
|
|
862
862
|
return e.sort((n, o) => n.type.rank - o.type.rank), e;
|
|
863
863
|
}
|
|
864
864
|
};
|
|
865
|
-
|
|
865
|
+
J.none = [];
|
|
866
866
|
class Fe extends Error {
|
|
867
867
|
}
|
|
868
868
|
class S {
|
|
@@ -990,7 +990,7 @@ function Tr(r, t) {
|
|
|
990
990
|
if (!t.type.compatibleContent(r.type))
|
|
991
991
|
throw new Fe("Cannot join " + t.type.name + " onto " + r.type.name);
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function mn(r, t, e) {
|
|
994
994
|
let n = r.node(e);
|
|
995
995
|
return Tr(n, t.node(e)), n;
|
|
996
996
|
}
|
|
@@ -1009,13 +1009,13 @@ function jt(r, t) {
|
|
|
1009
1009
|
return r.type.checkContent(t), r.copy(t);
|
|
1010
1010
|
}
|
|
1011
1011
|
function Ar(r, t, e, n, o) {
|
|
1012
|
-
let i = r.depth > o &&
|
|
1012
|
+
let i = r.depth > o && mn(r, t, o + 1), s = n.depth > o && mn(e, n, o + 1), l = [];
|
|
1013
1013
|
return ae(null, r, o, l), i && s && t.index(o) == e.index(o) ? (Tr(i, s), Wt(jt(i, Ar(r, t, e, n, o + 1)), l)) : (i && Wt(jt(i, _e(r, t, o + 1)), l), ae(t, e, o, l), s && Wt(jt(s, _e(e, n, o + 1)), l)), ae(n, null, o, l), new x(l);
|
|
1014
1014
|
}
|
|
1015
1015
|
function _e(r, t, e) {
|
|
1016
1016
|
let n = [];
|
|
1017
1017
|
if (ae(null, r, e, n), r.depth > e) {
|
|
1018
|
-
let o =
|
|
1018
|
+
let o = mn(r, t, e + 1);
|
|
1019
1019
|
Wt(jt(o, _e(r, t, e + 1)), n);
|
|
1020
1020
|
}
|
|
1021
1021
|
return ae(t, null, e, n), new x(n);
|
|
@@ -1160,7 +1160,7 @@ class fe {
|
|
|
1160
1160
|
marks() {
|
|
1161
1161
|
let t = this.parent, e = this.index();
|
|
1162
1162
|
if (t.content.size == 0)
|
|
1163
|
-
return
|
|
1163
|
+
return J.none;
|
|
1164
1164
|
if (this.textOffset)
|
|
1165
1165
|
return t.child(e).marks;
|
|
1166
1166
|
let n = t.maybeChild(e - 1), o = t.maybeChild(e);
|
|
@@ -1263,7 +1263,7 @@ class fe {
|
|
|
1263
1263
|
@internal
|
|
1264
1264
|
*/
|
|
1265
1265
|
static resolveCached(t, e) {
|
|
1266
|
-
let n =
|
|
1266
|
+
let n = Wn.get(t);
|
|
1267
1267
|
if (n)
|
|
1268
1268
|
for (let i = 0; i < n.elts.length; i++) {
|
|
1269
1269
|
let s = n.elts[i];
|
|
@@ -1271,7 +1271,7 @@ class fe {
|
|
|
1271
1271
|
return s;
|
|
1272
1272
|
}
|
|
1273
1273
|
else
|
|
1274
|
-
|
|
1274
|
+
Wn.set(t, n = new mi());
|
|
1275
1275
|
let o = n.elts[n.i] = fe.resolve(t, e);
|
|
1276
1276
|
return n.i = (n.i + 1) % gi, o;
|
|
1277
1277
|
}
|
|
@@ -1281,7 +1281,7 @@ class mi {
|
|
|
1281
1281
|
this.elts = [], this.i = 0;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
|
-
const gi = 12,
|
|
1284
|
+
const gi = 12, Wn = /* @__PURE__ */ new WeakMap();
|
|
1285
1285
|
class De {
|
|
1286
1286
|
/**
|
|
1287
1287
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -1327,7 +1327,7 @@ class kt {
|
|
|
1327
1327
|
/**
|
|
1328
1328
|
@internal
|
|
1329
1329
|
*/
|
|
1330
|
-
constructor(t, e, n, o =
|
|
1330
|
+
constructor(t, e, n, o = J.none) {
|
|
1331
1331
|
this.type = t, this.attrs = e, this.marks = o, this.content = n || x.empty;
|
|
1332
1332
|
}
|
|
1333
1333
|
/**
|
|
@@ -1441,7 +1441,7 @@ class kt {
|
|
|
1441
1441
|
attributes, and marks.
|
|
1442
1442
|
*/
|
|
1443
1443
|
hasMarkup(t, e, n) {
|
|
1444
|
-
return this.type == t && Pe(this.attrs, e || t.defaultAttrs || yi) &&
|
|
1444
|
+
return this.type == t && Pe(this.attrs, e || t.defaultAttrs || yi) && J.sameSet(this.marks, n || J.none);
|
|
1445
1445
|
}
|
|
1446
1446
|
/**
|
|
1447
1447
|
Create a new node with the same markup as this node, containing
|
|
@@ -1651,12 +1651,12 @@ class kt {
|
|
|
1651
1651
|
*/
|
|
1652
1652
|
check() {
|
|
1653
1653
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1654
|
-
let t =
|
|
1654
|
+
let t = J.none;
|
|
1655
1655
|
for (let e = 0; e < this.marks.length; e++) {
|
|
1656
1656
|
let n = this.marks[e];
|
|
1657
1657
|
n.type.checkAttrs(n.attrs), t = n.addToSet(t);
|
|
1658
1658
|
}
|
|
1659
|
-
if (!
|
|
1659
|
+
if (!J.sameSet(t, this.marks))
|
|
1660
1660
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
|
|
1661
1661
|
this.content.forEach((e) => e.check());
|
|
1662
1662
|
}
|
|
@@ -1693,7 +1693,7 @@ class kt {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
kt.prototype.text = void 0;
|
|
1696
|
-
class
|
|
1696
|
+
class Le extends kt {
|
|
1697
1697
|
/**
|
|
1698
1698
|
@internal
|
|
1699
1699
|
*/
|
|
@@ -1715,10 +1715,10 @@ class Je extends kt {
|
|
|
1715
1715
|
return this.text.length;
|
|
1716
1716
|
}
|
|
1717
1717
|
mark(t) {
|
|
1718
|
-
return t == this.marks ? this : new
|
|
1718
|
+
return t == this.marks ? this : new Le(this.type, this.attrs, this.text, t);
|
|
1719
1719
|
}
|
|
1720
1720
|
withText(t) {
|
|
1721
|
-
return t == this.text ? this : new
|
|
1721
|
+
return t == this.text ? this : new Le(this.type, this.attrs, t, this.marks);
|
|
1722
1722
|
}
|
|
1723
1723
|
cut(t = 0, e = this.text.length) {
|
|
1724
1724
|
return t == 0 && e == this.text.length ? this : this.withText(this.text.slice(t, e));
|
|
@@ -1942,14 +1942,14 @@ function ki(r) {
|
|
|
1942
1942
|
break;
|
|
1943
1943
|
return t;
|
|
1944
1944
|
}
|
|
1945
|
-
function
|
|
1945
|
+
function jn(r) {
|
|
1946
1946
|
/\D/.test(r.next) && r.err("Expected number, got '" + r.next + "'");
|
|
1947
1947
|
let t = Number(r.next);
|
|
1948
1948
|
return r.pos++, t;
|
|
1949
1949
|
}
|
|
1950
1950
|
function bi(r, t) {
|
|
1951
|
-
let e =
|
|
1952
|
-
return r.eat(",") && (r.next != "}" ? n =
|
|
1951
|
+
let e = jn(r), n = e;
|
|
1952
|
+
return r.eat(",") && (r.next != "}" ? n = jn(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: e, max: n, expr: t };
|
|
1953
1953
|
}
|
|
1954
1954
|
function vi(r, t) {
|
|
1955
1955
|
let e = r.nodeTypes, n = e[t];
|
|
@@ -2030,7 +2030,7 @@ function Ci(r) {
|
|
|
2030
2030
|
function Nr(r, t) {
|
|
2031
2031
|
return t - r;
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function Vn(r, t) {
|
|
2034
2034
|
let e = [];
|
|
2035
2035
|
return n(t), e.sort(Nr);
|
|
2036
2036
|
function n(o) {
|
|
@@ -2046,7 +2046,7 @@ function qn(r, t) {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
function Ti(r) {
|
|
2048
2048
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2049
|
-
return e(
|
|
2049
|
+
return e(Vn(r, 0));
|
|
2050
2050
|
function e(n) {
|
|
2051
2051
|
let o = [];
|
|
2052
2052
|
n.forEach((s) => {
|
|
@@ -2056,7 +2056,7 @@ function Ti(r) {
|
|
|
2056
2056
|
let c;
|
|
2057
2057
|
for (let u = 0; u < o.length; u++)
|
|
2058
2058
|
o[u][0] == l && (c = o[u][1]);
|
|
2059
|
-
|
|
2059
|
+
Vn(r, a).forEach((u) => {
|
|
2060
2060
|
c || o.push([l, c = []]), c.indexOf(u) == -1 && c.push(u);
|
|
2061
2061
|
});
|
|
2062
2062
|
});
|
|
@@ -2120,7 +2120,7 @@ function Br(r, t) {
|
|
|
2120
2120
|
e[n] = new Ei(r, n, t[n]);
|
|
2121
2121
|
return e;
|
|
2122
2122
|
}
|
|
2123
|
-
class
|
|
2123
|
+
class Je {
|
|
2124
2124
|
/**
|
|
2125
2125
|
@internal
|
|
2126
2126
|
*/
|
|
@@ -2199,7 +2199,7 @@ class Le {
|
|
|
2199
2199
|
create(t = null, e, n) {
|
|
2200
2200
|
if (this.isText)
|
|
2201
2201
|
throw new Error("NodeType.create can't construct text nodes");
|
|
2202
|
-
return new kt(this, this.computeAttrs(t), x.from(e),
|
|
2202
|
+
return new kt(this, this.computeAttrs(t), x.from(e), J.setFrom(n));
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -2207,7 +2207,7 @@ class Le {
|
|
|
2207
2207
|
if it doesn't match.
|
|
2208
2208
|
*/
|
|
2209
2209
|
createChecked(t = null, e, n) {
|
|
2210
|
-
return e = x.from(e), this.checkContent(e), new kt(this, this.computeAttrs(t), e,
|
|
2210
|
+
return e = x.from(e), this.checkContent(e), new kt(this, this.computeAttrs(t), e, J.setFrom(n));
|
|
2211
2211
|
}
|
|
2212
2212
|
/**
|
|
2213
2213
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -2225,7 +2225,7 @@ class Le {
|
|
|
2225
2225
|
e = s.append(e);
|
|
2226
2226
|
}
|
|
2227
2227
|
let o = this.contentMatch.matchFragment(e), i = o && o.fillBefore(x.empty, !0);
|
|
2228
|
-
return i ? new kt(this, t, e.append(i),
|
|
2228
|
+
return i ? new kt(this, t, e.append(i), J.setFrom(n)) : null;
|
|
2229
2229
|
}
|
|
2230
2230
|
/**
|
|
2231
2231
|
Returns true if the given fragment is valid content for this node
|
|
@@ -2281,14 +2281,14 @@ class Le {
|
|
|
2281
2281
|
let e;
|
|
2282
2282
|
for (let n = 0; n < t.length; n++)
|
|
2283
2283
|
this.allowsMarkType(t[n].type) ? e && e.push(t[n]) : e || (e = t.slice(0, n));
|
|
2284
|
-
return e ? e.length ? e :
|
|
2284
|
+
return e ? e.length ? e : J.none : t;
|
|
2285
2285
|
}
|
|
2286
2286
|
/**
|
|
2287
2287
|
@internal
|
|
2288
2288
|
*/
|
|
2289
2289
|
static compile(t, e) {
|
|
2290
2290
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2291
|
-
t.forEach((i, s) => n[i] = new
|
|
2291
|
+
t.forEach((i, s) => n[i] = new Je(i, e, s));
|
|
2292
2292
|
let o = e.spec.topNode || "doc";
|
|
2293
2293
|
if (!n[o])
|
|
2294
2294
|
throw new RangeError("Schema is missing its top node type ('" + o + "')");
|
|
@@ -2315,14 +2315,14 @@ class Ei {
|
|
|
2315
2315
|
return !this.hasDefault;
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
|
-
class
|
|
2318
|
+
class kn {
|
|
2319
2319
|
/**
|
|
2320
2320
|
@internal
|
|
2321
2321
|
*/
|
|
2322
2322
|
constructor(t, e, n, o) {
|
|
2323
2323
|
this.name = t, this.rank = e, this.schema = n, this.spec = o, this.attrs = Br(t, o.attrs), this.excluded = null;
|
|
2324
2324
|
let i = Ir(this.attrs);
|
|
2325
|
-
this.instance = i ? new
|
|
2325
|
+
this.instance = i ? new J(this, i) : null;
|
|
2326
2326
|
}
|
|
2327
2327
|
/**
|
|
2328
2328
|
Create a mark of this type. `attrs` may be `null` or an object
|
|
@@ -2330,14 +2330,14 @@ class bn {
|
|
|
2330
2330
|
they have defaults, will be added.
|
|
2331
2331
|
*/
|
|
2332
2332
|
create(t = null) {
|
|
2333
|
-
return !t && this.instance ? this.instance : new
|
|
2333
|
+
return !t && this.instance ? this.instance : new J(this, Or(this.attrs, t));
|
|
2334
2334
|
}
|
|
2335
2335
|
/**
|
|
2336
2336
|
@internal
|
|
2337
2337
|
*/
|
|
2338
2338
|
static compile(t, e) {
|
|
2339
2339
|
let n = /* @__PURE__ */ Object.create(null), o = 0;
|
|
2340
|
-
return t.forEach((i, s) => n[i] = new
|
|
2340
|
+
return t.forEach((i, s) => n[i] = new kn(i, o++, e, s)), n;
|
|
2341
2341
|
}
|
|
2342
2342
|
/**
|
|
2343
2343
|
When there is a mark of this type in the given set, a new set
|
|
@@ -2379,7 +2379,7 @@ class Ni {
|
|
|
2379
2379
|
let e = this.spec = {};
|
|
2380
2380
|
for (let o in t)
|
|
2381
2381
|
e[o] = t[o];
|
|
2382
|
-
e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes =
|
|
2382
|
+
e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes = Je.compile(this.spec.nodes, this), this.marks = kn.compile(this.spec.marks, this);
|
|
2383
2383
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2384
2384
|
for (let o in this.nodes) {
|
|
2385
2385
|
if (o in this.marks)
|
|
@@ -2392,13 +2392,13 @@ class Ni {
|
|
|
2392
2392
|
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
2393
2393
|
this.linebreakReplacement = i;
|
|
2394
2394
|
}
|
|
2395
|
-
i.markSet = l == "_" ? null : l ?
|
|
2395
|
+
i.markSet = l == "_" ? null : l ? qn(this, l.split(" ")) : l == "" || !i.inlineContent ? [] : null;
|
|
2396
2396
|
}
|
|
2397
2397
|
for (let o in this.marks) {
|
|
2398
2398
|
let i = this.marks[o], s = i.spec.excludes;
|
|
2399
|
-
i.excluded = s == null ? [i] : s == "" ? [] :
|
|
2399
|
+
i.excluded = s == null ? [i] : s == "" ? [] : qn(this, s.split(" "));
|
|
2400
2400
|
}
|
|
2401
|
-
this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) =>
|
|
2401
|
+
this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) => J.fromJSON(this, o), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
|
|
2402
2402
|
}
|
|
2403
2403
|
/**
|
|
2404
2404
|
Create a node in this schema. The `type` may be a string or a
|
|
@@ -2409,7 +2409,7 @@ class Ni {
|
|
|
2409
2409
|
node(t, e = null, n, o) {
|
|
2410
2410
|
if (typeof t == "string")
|
|
2411
2411
|
t = this.nodeType(t);
|
|
2412
|
-
else if (t instanceof
|
|
2412
|
+
else if (t instanceof Je) {
|
|
2413
2413
|
if (t.schema != this)
|
|
2414
2414
|
throw new RangeError("Node type from different schema used (" + t.name + ")");
|
|
2415
2415
|
} else throw new RangeError("Invalid node type: " + t);
|
|
@@ -2421,7 +2421,7 @@ class Ni {
|
|
|
2421
2421
|
*/
|
|
2422
2422
|
text(t, e) {
|
|
2423
2423
|
let n = this.nodes.text;
|
|
2424
|
-
return new
|
|
2424
|
+
return new Le(n, n.defaultAttrs, t, J.setFrom(e));
|
|
2425
2425
|
}
|
|
2426
2426
|
/**
|
|
2427
2427
|
Create a mark with the given type and attributes.
|
|
@@ -2439,7 +2439,7 @@ class Ni {
|
|
|
2439
2439
|
return e;
|
|
2440
2440
|
}
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function qn(r, t) {
|
|
2443
2443
|
let e = [];
|
|
2444
2444
|
for (let n = 0; n < t.length; n++) {
|
|
2445
2445
|
let o = t[n], i = r.marks[o], s = i;
|
|
@@ -2461,7 +2461,7 @@ function Ii(r) {
|
|
|
2461
2461
|
function Oi(r) {
|
|
2462
2462
|
return r.style != null;
|
|
2463
2463
|
}
|
|
2464
|
-
let rn = class
|
|
2464
|
+
let rn = class gn {
|
|
2465
2465
|
/**
|
|
2466
2466
|
Create a parser that targets the given schema, using the given
|
|
2467
2467
|
parsing rules.
|
|
@@ -2487,8 +2487,8 @@ let rn = class yn {
|
|
|
2487
2487
|
Parse a document from the content of a DOM node.
|
|
2488
2488
|
*/
|
|
2489
2489
|
parse(t, e = {}) {
|
|
2490
|
-
let n = new
|
|
2491
|
-
return n.addAll(t,
|
|
2490
|
+
let n = new Un(this, e, !1);
|
|
2491
|
+
return n.addAll(t, J.none, e.from, e.to), n.finish();
|
|
2492
2492
|
}
|
|
2493
2493
|
/**
|
|
2494
2494
|
Parses the content of the given DOM node, like
|
|
@@ -2499,8 +2499,8 @@ let rn = class yn {
|
|
|
2499
2499
|
the left of the input and the end of nodes at the end.
|
|
2500
2500
|
*/
|
|
2501
2501
|
parseSlice(t, e = {}) {
|
|
2502
|
-
let n = new
|
|
2503
|
-
return n.addAll(t,
|
|
2502
|
+
let n = new Un(this, e, !0);
|
|
2503
|
+
return n.addAll(t, J.none, e.from, e.to), S.maxOpen(n.finish());
|
|
2504
2504
|
}
|
|
2505
2505
|
/**
|
|
2506
2506
|
@internal
|
|
@@ -2556,13 +2556,13 @@ let rn = class yn {
|
|
|
2556
2556
|
for (let o in t.marks) {
|
|
2557
2557
|
let i = t.marks[o].spec.parseDOM;
|
|
2558
2558
|
i && i.forEach((s) => {
|
|
2559
|
-
n(s =
|
|
2559
|
+
n(s = Gn(s)), s.mark || s.ignore || s.clearMark || (s.mark = o);
|
|
2560
2560
|
});
|
|
2561
2561
|
}
|
|
2562
2562
|
for (let o in t.nodes) {
|
|
2563
2563
|
let i = t.nodes[o].spec.parseDOM;
|
|
2564
2564
|
i && i.forEach((s) => {
|
|
2565
|
-
n(s =
|
|
2565
|
+
n(s = Gn(s)), s.node || s.ignore || s.mark || (s.node = o);
|
|
2566
2566
|
});
|
|
2567
2567
|
}
|
|
2568
2568
|
return e;
|
|
@@ -2573,7 +2573,7 @@ let rn = class yn {
|
|
|
2573
2573
|
[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
|
|
2574
2574
|
*/
|
|
2575
2575
|
static fromSchema(t) {
|
|
2576
|
-
return t.cached.domParser || (t.cached.domParser = new
|
|
2576
|
+
return t.cached.domParser || (t.cached.domParser = new gn(t, gn.schemaRules(t)));
|
|
2577
2577
|
}
|
|
2578
2578
|
};
|
|
2579
2579
|
const Rr = {
|
|
@@ -2616,13 +2616,13 @@ const Rr = {
|
|
|
2616
2616
|
script: !0,
|
|
2617
2617
|
style: !0,
|
|
2618
2618
|
title: !0
|
|
2619
|
-
}, zr = { ol: !0, ul: !0 }, de = 1,
|
|
2620
|
-
function
|
|
2621
|
-
return t != null ? (t ? de : 0) | (t === "full" ?
|
|
2619
|
+
}, zr = { ol: !0, ul: !0 }, de = 1, yn = 2, ce = 4;
|
|
2620
|
+
function Hn(r, t, e) {
|
|
2621
|
+
return t != null ? (t ? de : 0) | (t === "full" ? yn : 0) : r && r.whitespace == "pre" ? de | yn : e & ~ce;
|
|
2622
2622
|
}
|
|
2623
2623
|
class Ce {
|
|
2624
2624
|
constructor(t, e, n, o, i, s) {
|
|
2625
|
-
this.type = t, this.attrs = e, this.marks = n, this.solid = o, this.options = s, this.content = [], this.activeMarks =
|
|
2625
|
+
this.type = t, this.attrs = e, this.marks = n, this.solid = o, this.options = s, this.content = [], this.activeMarks = J.none, this.match = i || (s & ce ? null : t.contentMatch);
|
|
2626
2626
|
}
|
|
2627
2627
|
findWrapping(t) {
|
|
2628
2628
|
if (!this.match) {
|
|
@@ -2653,11 +2653,11 @@ class Ce {
|
|
|
2653
2653
|
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : t.parentNode && !Rr.hasOwnProperty(t.parentNode.nodeName.toLowerCase());
|
|
2654
2654
|
}
|
|
2655
2655
|
}
|
|
2656
|
-
class
|
|
2656
|
+
class Un {
|
|
2657
2657
|
constructor(t, e, n) {
|
|
2658
2658
|
this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2659
|
-
let o = e.topNode, i, s =
|
|
2660
|
-
o ? i = new Ce(o.type, o.attrs,
|
|
2659
|
+
let o = e.topNode, i, s = Hn(null, e.preserveWhitespace, 0) | (n ? ce : 0);
|
|
2660
|
+
o ? i = new Ce(o.type, o.attrs, J.none, !0, e.topMatch || o.type.contentMatch, s) : n ? i = new Ce(null, null, J.none, !0, null, s) : i = new Ce(t.schema.topNodeType, null, J.none, !0, null, s), this.nodes = [i], this.find = e.findPositions, this.needsBlock = !1;
|
|
2661
2661
|
}
|
|
2662
2662
|
get top() {
|
|
2663
2663
|
return this.nodes[this.open];
|
|
@@ -2669,7 +2669,7 @@ class Gn {
|
|
|
2669
2669
|
t.nodeType == 3 ? this.addTextNode(t, e) : t.nodeType == 1 && this.addElement(t, e);
|
|
2670
2670
|
}
|
|
2671
2671
|
addTextNode(t, e) {
|
|
2672
|
-
let n = t.nodeValue, o = this.top, i = o.options &
|
|
2672
|
+
let n = t.nodeValue, o = this.top, i = o.options & yn ? "full" : this.localPreserveWS || (o.options & de) > 0, { schema: s } = this.parser;
|
|
2673
2673
|
if (i === "full" || o.inlineContext(t) || /[^ \t\r\n\u000c]/.test(n)) {
|
|
2674
2674
|
if (i)
|
|
2675
2675
|
if (i === "full")
|
|
@@ -2820,9 +2820,9 @@ class Gn {
|
|
|
2820
2820
|
this.closeExtra();
|
|
2821
2821
|
let i = this.top;
|
|
2822
2822
|
i.match && (i.match = i.match.matchType(t.type));
|
|
2823
|
-
let s =
|
|
2823
|
+
let s = J.none;
|
|
2824
2824
|
for (let l of o.concat(t.marks))
|
|
2825
|
-
(i.type ? i.type.allowsMarkType(l.type) :
|
|
2825
|
+
(i.type ? i.type.allowsMarkType(l.type) : Kn(l.type, t.type)) && (s = l.addToSet(s));
|
|
2826
2826
|
return i.content.push(t.mark(s)), !0;
|
|
2827
2827
|
}
|
|
2828
2828
|
return !1;
|
|
@@ -2838,10 +2838,10 @@ class Gn {
|
|
|
2838
2838
|
this.closeExtra();
|
|
2839
2839
|
let s = this.top;
|
|
2840
2840
|
s.match = s.match && s.match.matchType(t);
|
|
2841
|
-
let l =
|
|
2841
|
+
let l = Hn(t, i, s.options);
|
|
2842
2842
|
s.options & ce && s.content.length == 0 && (l |= ce);
|
|
2843
|
-
let a =
|
|
2844
|
-
return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) :
|
|
2843
|
+
let a = J.none;
|
|
2844
|
+
return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : Kn(c.type, t)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Ce(t, e, a, o, null, l)), this.open++, n;
|
|
2845
2845
|
}
|
|
2846
2846
|
// Make sure all nodes above this.open are finished and added to
|
|
2847
2847
|
// their parents
|
|
@@ -2944,13 +2944,13 @@ function Bi(r) {
|
|
|
2944
2944
|
function Ri(r, t) {
|
|
2945
2945
|
return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, t);
|
|
2946
2946
|
}
|
|
2947
|
-
function
|
|
2947
|
+
function Gn(r) {
|
|
2948
2948
|
let t = {};
|
|
2949
2949
|
for (let e in r)
|
|
2950
2950
|
t[e] = r[e];
|
|
2951
2951
|
return t;
|
|
2952
2952
|
}
|
|
2953
|
-
function
|
|
2953
|
+
function Kn(r, t) {
|
|
2954
2954
|
let e = t.schema.nodes;
|
|
2955
2955
|
for (let n in e) {
|
|
2956
2956
|
let o = e[n];
|
|
@@ -2972,14 +2972,14 @@ const Pr = 65535, Fr = Math.pow(2, 16);
|
|
|
2972
2972
|
function zi(r, t) {
|
|
2973
2973
|
return r + t * Fr;
|
|
2974
2974
|
}
|
|
2975
|
-
function
|
|
2975
|
+
function Xn(r) {
|
|
2976
2976
|
return r & Pr;
|
|
2977
2977
|
}
|
|
2978
2978
|
function Pi(r) {
|
|
2979
2979
|
return (r - (r & Pr)) / Fr;
|
|
2980
2980
|
}
|
|
2981
|
-
const _r = 1, Dr = 2, $e = 4,
|
|
2982
|
-
class
|
|
2981
|
+
const _r = 1, Dr = 2, $e = 4, Lr = 8;
|
|
2982
|
+
class Zn {
|
|
2983
2983
|
/**
|
|
2984
2984
|
@internal
|
|
2985
2985
|
*/
|
|
@@ -2992,7 +2992,7 @@ class Qn {
|
|
|
2992
2992
|
argument from the document.
|
|
2993
2993
|
*/
|
|
2994
2994
|
get deleted() {
|
|
2995
|
-
return (this.delInfo &
|
|
2995
|
+
return (this.delInfo & Lr) > 0;
|
|
2996
2996
|
}
|
|
2997
2997
|
/**
|
|
2998
2998
|
Tells you whether the token before the mapped position was deleted.
|
|
@@ -3029,7 +3029,7 @@ class lt {
|
|
|
3029
3029
|
@internal
|
|
3030
3030
|
*/
|
|
3031
3031
|
recover(t) {
|
|
3032
|
-
let e = 0, n =
|
|
3032
|
+
let e = 0, n = Xn(t);
|
|
3033
3033
|
if (!this.inverted)
|
|
3034
3034
|
for (let o = 0; o < n; o++)
|
|
3035
3035
|
e += this.ranges[o * 3 + 2] - this.ranges[o * 3 + 1];
|
|
@@ -3056,17 +3056,17 @@ class lt {
|
|
|
3056
3056
|
if (n)
|
|
3057
3057
|
return h;
|
|
3058
3058
|
let m = t == (e < 0 ? a : f) ? null : zi(l / 3, t - a), p = t == a ? Dr : t == f ? _r : $e;
|
|
3059
|
-
return (e < 0 ? t != a : t != f) && (p |=
|
|
3059
|
+
return (e < 0 ? t != a : t != f) && (p |= Lr), new Zn(h, p, m);
|
|
3060
3060
|
}
|
|
3061
3061
|
o += u - c;
|
|
3062
3062
|
}
|
|
3063
|
-
return n ? t + o : new
|
|
3063
|
+
return n ? t + o : new Zn(t + o, 0, null);
|
|
3064
3064
|
}
|
|
3065
3065
|
/**
|
|
3066
3066
|
@internal
|
|
3067
3067
|
*/
|
|
3068
3068
|
touches(t, e) {
|
|
3069
|
-
let n = 0, o =
|
|
3069
|
+
let n = 0, o = Xn(e), i = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
|
|
3070
3070
|
for (let l = 0; l < this.ranges.length; l += 3) {
|
|
3071
3071
|
let a = this.ranges[l] - (this.inverted ? n : 0);
|
|
3072
3072
|
if (a > t)
|
|
@@ -3188,11 +3188,11 @@ class V {
|
|
|
3188
3188
|
}
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
|
-
function
|
|
3191
|
+
function bn(r, t, e) {
|
|
3192
3192
|
let n = [];
|
|
3193
3193
|
for (let o = 0; o < r.childCount; o++) {
|
|
3194
3194
|
let i = r.child(o);
|
|
3195
|
-
i.content.size && (i = i.copy(
|
|
3195
|
+
i.content.size && (i = i.copy(bn(i.content, t, i))), i.isInline && (i = t(i, e, o)), n.push(i);
|
|
3196
3196
|
}
|
|
3197
3197
|
return x.fromArray(n);
|
|
3198
3198
|
}
|
|
@@ -3204,7 +3204,7 @@ class _t extends nt {
|
|
|
3204
3204
|
super(), this.from = t, this.to = e, this.mark = n;
|
|
3205
3205
|
}
|
|
3206
3206
|
apply(t) {
|
|
3207
|
-
let e = t.slice(this.from, this.to), n = t.resolve(this.from), o = n.node(n.sharedDepth(this.to)), i = new S(
|
|
3207
|
+
let e = t.slice(this.from, this.to), n = t.resolve(this.from), o = n.node(n.sharedDepth(this.to)), i = new S(bn(e.content, (s, l) => !s.isAtom || !l.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), o), e.openStart, e.openEnd);
|
|
3208
3208
|
return V.fromReplace(t, this.from, this.to, i);
|
|
3209
3209
|
}
|
|
3210
3210
|
invert() {
|
|
@@ -3243,7 +3243,7 @@ class Dt extends nt {
|
|
|
3243
3243
|
super(), this.from = t, this.to = e, this.mark = n;
|
|
3244
3244
|
}
|
|
3245
3245
|
apply(t) {
|
|
3246
|
-
let e = t.slice(this.from, this.to), n = new S(
|
|
3246
|
+
let e = t.slice(this.from, this.to), n = new S(bn(e.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), t), e.openStart, e.openEnd);
|
|
3247
3247
|
return V.fromReplace(t, this.from, this.to, n);
|
|
3248
3248
|
}
|
|
3249
3249
|
invert() {
|
|
@@ -3274,7 +3274,7 @@ class Dt extends nt {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
3276
|
nt.jsonID("removeMark", Dt);
|
|
3277
|
-
class
|
|
3277
|
+
class Lt extends nt {
|
|
3278
3278
|
/**
|
|
3279
3279
|
Create a node mark step.
|
|
3280
3280
|
*/
|
|
@@ -3295,15 +3295,15 @@ class Jt extends nt {
|
|
|
3295
3295
|
if (n.length == e.marks.length) {
|
|
3296
3296
|
for (let o = 0; o < e.marks.length; o++)
|
|
3297
3297
|
if (!e.marks[o].isInSet(n))
|
|
3298
|
-
return new
|
|
3299
|
-
return new
|
|
3298
|
+
return new Lt(this.pos, e.marks[o]);
|
|
3299
|
+
return new Lt(this.pos, this.mark);
|
|
3300
3300
|
}
|
|
3301
3301
|
}
|
|
3302
3302
|
return new he(this.pos, this.mark);
|
|
3303
3303
|
}
|
|
3304
3304
|
map(t) {
|
|
3305
3305
|
let e = t.mapResult(this.pos, 1);
|
|
3306
|
-
return e.deletedAfter ? null : new
|
|
3306
|
+
return e.deletedAfter ? null : new Lt(e.pos, this.mark);
|
|
3307
3307
|
}
|
|
3308
3308
|
toJSON() {
|
|
3309
3309
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3314,10 +3314,10 @@ class Jt extends nt {
|
|
|
3314
3314
|
static fromJSON(t, e) {
|
|
3315
3315
|
if (typeof e.pos != "number")
|
|
3316
3316
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
3317
|
-
return new
|
|
3317
|
+
return new Lt(e.pos, t.markFromJSON(e.mark));
|
|
3318
3318
|
}
|
|
3319
3319
|
}
|
|
3320
|
-
nt.jsonID("addNodeMark",
|
|
3320
|
+
nt.jsonID("addNodeMark", Lt);
|
|
3321
3321
|
class he extends nt {
|
|
3322
3322
|
/**
|
|
3323
3323
|
Create a mark-removing step.
|
|
@@ -3334,7 +3334,7 @@ class he extends nt {
|
|
|
3334
3334
|
}
|
|
3335
3335
|
invert(t) {
|
|
3336
3336
|
let e = t.nodeAt(this.pos);
|
|
3337
|
-
return !e || !this.mark.isInSet(e.marks) ? this : new
|
|
3337
|
+
return !e || !this.mark.isInSet(e.marks) ? this : new Lt(this.pos, this.mark);
|
|
3338
3338
|
}
|
|
3339
3339
|
map(t) {
|
|
3340
3340
|
let e = t.mapResult(this.pos, 1);
|
|
@@ -3367,7 +3367,7 @@ class st extends nt {
|
|
|
3367
3367
|
super(), this.from = t, this.to = e, this.slice = n, this.structure = o;
|
|
3368
3368
|
}
|
|
3369
3369
|
apply(t) {
|
|
3370
|
-
return this.structure &&
|
|
3370
|
+
return this.structure && wn(t, this.from, this.to) ? V.fail("Structure replace would overwrite content") : V.fromReplace(t, this.from, this.to, this.slice);
|
|
3371
3371
|
}
|
|
3372
3372
|
getMap() {
|
|
3373
3373
|
return new lt([this.from, this.to - this.from, this.slice.size]);
|
|
@@ -3416,7 +3416,7 @@ class it extends nt {
|
|
|
3416
3416
|
super(), this.from = t, this.to = e, this.gapFrom = n, this.gapTo = o, this.slice = i, this.insert = s, this.structure = l;
|
|
3417
3417
|
}
|
|
3418
3418
|
apply(t) {
|
|
3419
|
-
if (this.structure && (
|
|
3419
|
+
if (this.structure && (wn(t, this.from, this.gapFrom) || wn(t, this.gapTo, this.to)))
|
|
3420
3420
|
return V.fail("Structure gap-replace would overwrite content");
|
|
3421
3421
|
let e = t.slice(this.gapFrom, this.gapTo);
|
|
3422
3422
|
if (e.openStart || e.openEnd)
|
|
@@ -3463,7 +3463,7 @@ class it extends nt {
|
|
|
3463
3463
|
}
|
|
3464
3464
|
}
|
|
3465
3465
|
nt.jsonID("replaceAround", it);
|
|
3466
|
-
function
|
|
3466
|
+
function wn(r, t, e) {
|
|
3467
3467
|
let n = r.resolve(t), o = e - t, i = n.depth;
|
|
3468
3468
|
for (; o > 0 && i > 0 && n.indexAfter(i) == n.node(i).childCount; )
|
|
3469
3469
|
i--, o--;
|
|
@@ -3492,11 +3492,11 @@ function Qt(r) {
|
|
|
3492
3492
|
}
|
|
3493
3493
|
return null;
|
|
3494
3494
|
}
|
|
3495
|
-
function
|
|
3495
|
+
function Jr(r, t, e = null, n = r) {
|
|
3496
3496
|
let o = _i(r, t), i = o && Di(n, t);
|
|
3497
|
-
return i ? o.map(
|
|
3497
|
+
return i ? o.map(Qn).concat({ type: t, attrs: e }).concat(i.map(Qn)) : null;
|
|
3498
3498
|
}
|
|
3499
|
-
function
|
|
3499
|
+
function Qn(r) {
|
|
3500
3500
|
return { type: r, attrs: null };
|
|
3501
3501
|
}
|
|
3502
3502
|
function _i(r, t) {
|
|
@@ -3536,7 +3536,7 @@ function qt(r, t) {
|
|
|
3536
3536
|
let e = r.resolve(t), n = e.index();
|
|
3537
3537
|
return Wr(e.nodeBefore, e.nodeAfter) && e.parent.canReplace(n, n + 1);
|
|
3538
3538
|
}
|
|
3539
|
-
function
|
|
3539
|
+
function Li(r, t) {
|
|
3540
3540
|
t.content.size || r.type.compatibleContent(t.type);
|
|
3541
3541
|
let e = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
|
|
3542
3542
|
for (let o = 0; o < t.childCount; o++) {
|
|
@@ -3547,7 +3547,7 @@ function Ji(r, t) {
|
|
|
3547
3547
|
return e.validEnd;
|
|
3548
3548
|
}
|
|
3549
3549
|
function Wr(r, t) {
|
|
3550
|
-
return !!(r && t && !r.isLeaf &&
|
|
3550
|
+
return !!(r && t && !r.isLeaf && Li(r, t));
|
|
3551
3551
|
}
|
|
3552
3552
|
function Ue(r, t, e = -1) {
|
|
3553
3553
|
let n = r.resolve(t);
|
|
@@ -3560,13 +3560,13 @@ function Ue(r, t, e = -1) {
|
|
|
3560
3560
|
t = e < 0 ? n.before(o) : n.after(o);
|
|
3561
3561
|
}
|
|
3562
3562
|
}
|
|
3563
|
-
function
|
|
3563
|
+
function vn(r, t, e = t, n = S.empty) {
|
|
3564
3564
|
if (t == e && !n.size)
|
|
3565
3565
|
return null;
|
|
3566
3566
|
let o = r.resolve(t), i = r.resolve(e);
|
|
3567
|
-
return
|
|
3567
|
+
return Ji(o, i, n) ? new st(t, e, n) : new Wi(o, i, n).fit();
|
|
3568
3568
|
}
|
|
3569
|
-
function
|
|
3569
|
+
function Ji(r, t, e) {
|
|
3570
3570
|
return !e.openStart && !e.openEnd && r.start() == t.start() && r.parent.canReplace(r.index(), t.index(), e.content);
|
|
3571
3571
|
}
|
|
3572
3572
|
class Wi {
|
|
@@ -3900,7 +3900,7 @@ class $ {
|
|
|
3900
3900
|
let i = t.steps.length, s = this.ranges;
|
|
3901
3901
|
for (let l = 0; l < s.length; l++) {
|
|
3902
3902
|
let { $from: a, $to: c } = s[l], u = t.mapping.slice(i);
|
|
3903
|
-
t.replaceRange(u.map(a.pos), u.map(c.pos), l ? S.empty : e), l == 0 &&
|
|
3903
|
+
t.replaceRange(u.map(a.pos), u.map(c.pos), l ? S.empty : e), l == 0 && er(t, i, (n ? n.isInline : o && o.isTextblock) ? -1 : 1);
|
|
3904
3904
|
}
|
|
3905
3905
|
}
|
|
3906
3906
|
/**
|
|
@@ -3911,7 +3911,7 @@ class $ {
|
|
|
3911
3911
|
let n = t.steps.length, o = this.ranges;
|
|
3912
3912
|
for (let i = 0; i < o.length; i++) {
|
|
3913
3913
|
let { $from: s, $to: l } = o[i], a = t.mapping.slice(n), c = a.map(s.pos), u = a.map(l.pos);
|
|
3914
|
-
i ? t.deleteRange(c, u) : (t.replaceRangeWith(c, u, e),
|
|
3914
|
+
i ? t.deleteRange(c, u) : (t.replaceRangeWith(c, u, e), er(t, n, e.isInline ? -1 : 1));
|
|
3915
3915
|
}
|
|
3916
3916
|
}
|
|
3917
3917
|
/**
|
|
@@ -4001,16 +4001,16 @@ class Vi {
|
|
|
4001
4001
|
this.$from = t, this.$to = e;
|
|
4002
4002
|
}
|
|
4003
4003
|
}
|
|
4004
|
-
let
|
|
4005
|
-
function
|
|
4006
|
-
!
|
|
4004
|
+
let Yn = !1;
|
|
4005
|
+
function tr(r) {
|
|
4006
|
+
!Yn && !r.parent.inlineContent && (Yn = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
|
|
4007
4007
|
}
|
|
4008
4008
|
class D extends $ {
|
|
4009
4009
|
/**
|
|
4010
4010
|
Construct a text selection between the given points.
|
|
4011
4011
|
*/
|
|
4012
4012
|
constructor(t, e = t) {
|
|
4013
|
-
|
|
4013
|
+
tr(t), tr(e), super(t, e);
|
|
4014
4014
|
}
|
|
4015
4015
|
/**
|
|
4016
4016
|
Returns a resolved position if this is a cursor selection (an
|
|
@@ -4111,7 +4111,7 @@ class P extends $ {
|
|
|
4111
4111
|
return { type: "node", anchor: this.anchor };
|
|
4112
4112
|
}
|
|
4113
4113
|
getBookmark() {
|
|
4114
|
-
return new
|
|
4114
|
+
return new Sn(this.anchor);
|
|
4115
4115
|
}
|
|
4116
4116
|
/**
|
|
4117
4117
|
@internal
|
|
@@ -4137,13 +4137,13 @@ class P extends $ {
|
|
|
4137
4137
|
}
|
|
4138
4138
|
P.prototype.visible = !1;
|
|
4139
4139
|
$.jsonID("node", P);
|
|
4140
|
-
class
|
|
4140
|
+
class Sn {
|
|
4141
4141
|
constructor(t) {
|
|
4142
4142
|
this.anchor = t;
|
|
4143
4143
|
}
|
|
4144
4144
|
map(t) {
|
|
4145
4145
|
let { deleted: e, pos: n } = t.mapResult(this.anchor);
|
|
4146
|
-
return e ? new Ge(n, n) : new
|
|
4146
|
+
return e ? new Ge(n, n) : new Sn(n);
|
|
4147
4147
|
}
|
|
4148
4148
|
resolve(t) {
|
|
4149
4149
|
let e = t.resolve(this.anchor), n = e.nodeAfter;
|
|
@@ -4210,7 +4210,7 @@ function Xt(r, t, e, n, o, i = !1) {
|
|
|
4210
4210
|
}
|
|
4211
4211
|
return null;
|
|
4212
4212
|
}
|
|
4213
|
-
function
|
|
4213
|
+
function er(r, t, e) {
|
|
4214
4214
|
let n = r.steps.length - 1;
|
|
4215
4215
|
if (n < t)
|
|
4216
4216
|
return;
|
|
@@ -4222,12 +4222,12 @@ function nr(r, t, e) {
|
|
|
4222
4222
|
s == null && (s = u);
|
|
4223
4223
|
}), r.setSelection($.near(r.doc.resolve(s), e));
|
|
4224
4224
|
}
|
|
4225
|
-
function
|
|
4225
|
+
function nr(r, t) {
|
|
4226
4226
|
return !t || !r ? r : r.bind(t);
|
|
4227
4227
|
}
|
|
4228
4228
|
class Te {
|
|
4229
4229
|
constructor(t, e, n) {
|
|
4230
|
-
this.name = t, this.init =
|
|
4230
|
+
this.name = t, this.init = nr(e.init, n), this.apply = nr(e.apply, n);
|
|
4231
4231
|
}
|
|
4232
4232
|
}
|
|
4233
4233
|
new Te("doc", {
|
|
@@ -4305,7 +4305,7 @@ class Rt {
|
|
|
4305
4305
|
return t[this.key];
|
|
4306
4306
|
}
|
|
4307
4307
|
}
|
|
4308
|
-
const
|
|
4308
|
+
const Cn = (r, t) => r.selection.empty ? !1 : (t && t(r.tr.deleteSelection().scrollIntoView()), !0);
|
|
4309
4309
|
function Hr(r, t) {
|
|
4310
4310
|
let { $cursor: e } = r.selection;
|
|
4311
4311
|
return !e || (t ? !t.endOfTextblock("backward", r) : e.parentOffset > 0) ? null : e;
|
|
@@ -4314,7 +4314,7 @@ const Ur = (r, t, e) => {
|
|
|
4314
4314
|
let n = Hr(r, e);
|
|
4315
4315
|
if (!n)
|
|
4316
4316
|
return !1;
|
|
4317
|
-
let o =
|
|
4317
|
+
let o = Tn(n);
|
|
4318
4318
|
if (!o) {
|
|
4319
4319
|
let s = n.blockRange(), l = s && Qt(s);
|
|
4320
4320
|
return l == null ? !1 : (t && t(r.tr.lift(s, l).scrollIntoView()), !0);
|
|
@@ -4324,7 +4324,7 @@ const Ur = (r, t, e) => {
|
|
|
4324
4324
|
return !0;
|
|
4325
4325
|
if (n.parent.content.size == 0 && (Zt(i, "end") || P.isSelectable(i)))
|
|
4326
4326
|
for (let s = n.depth; ; s--) {
|
|
4327
|
-
let l =
|
|
4327
|
+
let l = vn(r.doc, n.before(s), n.after(s), S.empty);
|
|
4328
4328
|
if (l && l.slice.size < l.to - l.from) {
|
|
4329
4329
|
if (t) {
|
|
4330
4330
|
let a = r.tr.step(l);
|
|
@@ -4340,13 +4340,13 @@ const Ur = (r, t, e) => {
|
|
|
4340
4340
|
let n = Hr(r, e);
|
|
4341
4341
|
if (!n)
|
|
4342
4342
|
return !1;
|
|
4343
|
-
let o =
|
|
4343
|
+
let o = Tn(n);
|
|
4344
4344
|
return o ? Gr(r, o, t) : !1;
|
|
4345
4345
|
}, Ui = (r, t, e) => {
|
|
4346
4346
|
let n = Xr(r, e);
|
|
4347
4347
|
if (!n)
|
|
4348
4348
|
return !1;
|
|
4349
|
-
let o =
|
|
4349
|
+
let o = An(n);
|
|
4350
4350
|
return o ? Gr(r, o, t) : !1;
|
|
4351
4351
|
};
|
|
4352
4352
|
function Gr(r, t, e) {
|
|
@@ -4368,7 +4368,7 @@ function Gr(r, t, e) {
|
|
|
4368
4368
|
return !1;
|
|
4369
4369
|
l = u;
|
|
4370
4370
|
}
|
|
4371
|
-
let c =
|
|
4371
|
+
let c = vn(r.doc, i, a, S.empty);
|
|
4372
4372
|
if (!c || c.from != i || c instanceof st && c.slice.size >= a - i)
|
|
4373
4373
|
return !1;
|
|
4374
4374
|
if (e) {
|
|
@@ -4393,12 +4393,12 @@ const Kr = (r, t, e) => {
|
|
|
4393
4393
|
if (n.parent.isTextblock) {
|
|
4394
4394
|
if (e ? !e.endOfTextblock("backward", r) : n.parentOffset > 0)
|
|
4395
4395
|
return !1;
|
|
4396
|
-
i =
|
|
4396
|
+
i = Tn(n);
|
|
4397
4397
|
}
|
|
4398
4398
|
let s = i && i.nodeBefore;
|
|
4399
4399
|
return !s || !P.isSelectable(s) ? !1 : (t && t(r.tr.setSelection(P.create(r.doc, i.pos - s.nodeSize)).scrollIntoView()), !0);
|
|
4400
4400
|
};
|
|
4401
|
-
function
|
|
4401
|
+
function Tn(r) {
|
|
4402
4402
|
if (!r.parent.type.spec.isolating)
|
|
4403
4403
|
for (let t = r.depth - 1; t >= 0; t--) {
|
|
4404
4404
|
if (r.index(t) > 0)
|
|
@@ -4416,14 +4416,14 @@ const Zr = (r, t, e) => {
|
|
|
4416
4416
|
let n = Xr(r, e);
|
|
4417
4417
|
if (!n)
|
|
4418
4418
|
return !1;
|
|
4419
|
-
let o =
|
|
4419
|
+
let o = An(n);
|
|
4420
4420
|
if (!o)
|
|
4421
4421
|
return !1;
|
|
4422
4422
|
let i = o.nodeAfter;
|
|
4423
4423
|
if (no(r, o, t, 1))
|
|
4424
4424
|
return !0;
|
|
4425
4425
|
if (n.parent.content.size == 0 && (Zt(i, "start") || P.isSelectable(i))) {
|
|
4426
|
-
let s =
|
|
4426
|
+
let s = vn(r.doc, n.before(), n.after(), S.empty);
|
|
4427
4427
|
if (s && s.slice.size < s.to - s.from) {
|
|
4428
4428
|
if (t) {
|
|
4429
4429
|
let l = r.tr.step(s);
|
|
@@ -4440,12 +4440,12 @@ const Zr = (r, t, e) => {
|
|
|
4440
4440
|
if (n.parent.isTextblock) {
|
|
4441
4441
|
if (e ? !e.endOfTextblock("forward", r) : n.parentOffset < n.parent.content.size)
|
|
4442
4442
|
return !1;
|
|
4443
|
-
i =
|
|
4443
|
+
i = An(n);
|
|
4444
4444
|
}
|
|
4445
4445
|
let s = i && i.nodeAfter;
|
|
4446
4446
|
return !s || !P.isSelectable(s) ? !1 : (t && t(r.tr.setSelection(P.create(r.doc, i.pos)).scrollIntoView()), !0);
|
|
4447
4447
|
};
|
|
4448
|
-
function
|
|
4448
|
+
function An(r) {
|
|
4449
4449
|
if (!r.parent.type.spec.isolating)
|
|
4450
4450
|
for (let t = r.depth - 1; t >= 0; t--) {
|
|
4451
4451
|
let e = r.node(t);
|
|
@@ -4486,7 +4486,7 @@ const Gi = (r, t) => {
|
|
|
4486
4486
|
return !e.parent.type.spec.code || !e.sameParent(n) ? !1 : (t && t(r.tr.insertText(`
|
|
4487
4487
|
`).scrollIntoView()), !0);
|
|
4488
4488
|
};
|
|
4489
|
-
function
|
|
4489
|
+
function Mn(r) {
|
|
4490
4490
|
for (let t = 0; t < r.edgeCount; t++) {
|
|
4491
4491
|
let { type: e } = r.edge(t);
|
|
4492
4492
|
if (e.isTextblock && !e.hasRequiredAttrs())
|
|
@@ -4498,7 +4498,7 @@ const Zi = (r, t) => {
|
|
|
4498
4498
|
let { $head: e, $anchor: n } = r.selection;
|
|
4499
4499
|
if (!e.parent.type.spec.code || !e.sameParent(n))
|
|
4500
4500
|
return !1;
|
|
4501
|
-
let o = e.node(-1), i = e.indexAfter(-1), s =
|
|
4501
|
+
let o = e.node(-1), i = e.indexAfter(-1), s = Mn(o.contentMatchAt(i));
|
|
4502
4502
|
if (!s || !o.canReplaceWith(i, i, s))
|
|
4503
4503
|
return !1;
|
|
4504
4504
|
if (t) {
|
|
@@ -4510,7 +4510,7 @@ const Zi = (r, t) => {
|
|
|
4510
4510
|
let e = r.selection, { $from: n, $to: o } = e;
|
|
4511
4511
|
if (e instanceof dt || n.parent.inlineContent || o.parent.inlineContent)
|
|
4512
4512
|
return !1;
|
|
4513
|
-
let i =
|
|
4513
|
+
let i = Mn(o.parent.contentMatchAt(o.indexAfter()));
|
|
4514
4514
|
if (!i || !i.isTextblock)
|
|
4515
4515
|
return !1;
|
|
4516
4516
|
if (t) {
|
|
@@ -4540,7 +4540,7 @@ function Qi(r) {
|
|
|
4540
4540
|
let i = [], s, l, a = !1, c = !1;
|
|
4541
4541
|
for (let h = n.depth; ; h--)
|
|
4542
4542
|
if (n.node(h).isBlock) {
|
|
4543
|
-
a = n.end(h) == n.pos + (n.depth - h), c = n.start(h) == n.pos - (n.depth - h), l =
|
|
4543
|
+
a = n.end(h) == n.pos + (n.depth - h), c = n.start(h) == n.pos - (n.depth - h), l = Mn(n.node(h - 1).contentMatchAt(n.indexAfter(h - 1))), i.unshift(a && l ? { type: l } : null), s = h;
|
|
4544
4544
|
break;
|
|
4545
4545
|
} else {
|
|
4546
4546
|
if (h == 1)
|
|
@@ -4620,11 +4620,11 @@ function ro(r) {
|
|
|
4620
4620
|
const ns = ro(-1), rs = ro(1);
|
|
4621
4621
|
function is(r, t = null) {
|
|
4622
4622
|
return function(e, n) {
|
|
4623
|
-
let { $from: o, $to: i } = e.selection, s = o.blockRange(i), l = s &&
|
|
4623
|
+
let { $from: o, $to: i } = e.selection, s = o.blockRange(i), l = s && Jr(s, r, t);
|
|
4624
4624
|
return l ? (n && n(e.tr.wrap(s, l).scrollIntoView()), !0) : !1;
|
|
4625
4625
|
};
|
|
4626
4626
|
}
|
|
4627
|
-
function
|
|
4627
|
+
function rr(r, t = null) {
|
|
4628
4628
|
return function(e, n) {
|
|
4629
4629
|
let o = !1;
|
|
4630
4630
|
for (let i = 0; i < e.selection.ranges.length && !o; i++) {
|
|
@@ -4654,7 +4654,7 @@ function or(r, t = null) {
|
|
|
4654
4654
|
return !0;
|
|
4655
4655
|
};
|
|
4656
4656
|
}
|
|
4657
|
-
function
|
|
4657
|
+
function En(...r) {
|
|
4658
4658
|
return function(t, e, n) {
|
|
4659
4659
|
for (let o = 0; o < r.length; o++)
|
|
4660
4660
|
if (r[o](t, e, n))
|
|
@@ -4662,9 +4662,9 @@ function Nn(...r) {
|
|
|
4662
4662
|
return !1;
|
|
4663
4663
|
};
|
|
4664
4664
|
}
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4665
|
+
En(Cn, Ur, Kr);
|
|
4666
|
+
En(Cn, Zr, Qr);
|
|
4667
|
+
En(Yr, to, eo, Yi);
|
|
4668
4668
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
4669
4669
|
function ss(r, t = null) {
|
|
4670
4670
|
return function(e, n) {
|
|
@@ -4683,7 +4683,7 @@ function ls(r, t, e, n = null) {
|
|
|
4683
4683
|
let a = s.resolve(t.start - 2);
|
|
4684
4684
|
i = new De(a, a, t.depth), t.endIndex < t.parent.childCount && (t = new De(t.$from, s.resolve(t.$to.end(t.depth)), t.depth)), o = !0;
|
|
4685
4685
|
}
|
|
4686
|
-
let l =
|
|
4686
|
+
let l = Jr(i, e, n, t);
|
|
4687
4687
|
return l ? (r && as(r, t, l, o, e), !0) : !1;
|
|
4688
4688
|
}
|
|
4689
4689
|
function as(r, t, e, n, o) {
|
|
@@ -4868,10 +4868,10 @@ function ys(r) {
|
|
|
4868
4868
|
function Ae(r) {
|
|
4869
4869
|
return ys(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
|
|
4870
4870
|
}
|
|
4871
|
-
function
|
|
4871
|
+
function Nn(r, t) {
|
|
4872
4872
|
const e = { ...r };
|
|
4873
4873
|
return Ae(r) && Ae(t) && Object.keys(t).forEach((n) => {
|
|
4874
|
-
Ae(t[n]) && Ae(r[n]) ? e[n] =
|
|
4874
|
+
Ae(t[n]) && Ae(r[n]) ? e[n] = Nn(r[n], t[n]) : e[n] = t[n];
|
|
4875
4875
|
}), e;
|
|
4876
4876
|
}
|
|
4877
4877
|
class je {
|
|
@@ -4895,7 +4895,7 @@ class je {
|
|
|
4895
4895
|
configure(t = {}) {
|
|
4896
4896
|
const e = this.extend({
|
|
4897
4897
|
...this.config,
|
|
4898
|
-
addOptions: () =>
|
|
4898
|
+
addOptions: () => Nn(this.options, t)
|
|
4899
4899
|
});
|
|
4900
4900
|
return e.name = this.name, e.parent = this.parent, e;
|
|
4901
4901
|
}
|
|
@@ -4941,7 +4941,7 @@ class ht {
|
|
|
4941
4941
|
configure(t = {}) {
|
|
4942
4942
|
const e = this.extend({
|
|
4943
4943
|
...this.config,
|
|
4944
|
-
addOptions: () =>
|
|
4944
|
+
addOptions: () => Nn(this.options, t)
|
|
4945
4945
|
});
|
|
4946
4946
|
return e.name = this.name, e.parent = this.parent, e;
|
|
4947
4947
|
}
|
|
@@ -5055,7 +5055,7 @@ const ks = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5055
5055
|
}, Es = (r) => ({ tr: t, dispatch: e }) => {
|
|
5056
5056
|
const { from: n, to: o } = r;
|
|
5057
5057
|
return e && t.delete(n, o), !0;
|
|
5058
|
-
}, Ns = () => ({ state: r, dispatch: t }) =>
|
|
5058
|
+
}, Ns = () => ({ state: r, dispatch: t }) => Cn(r, t), Is = () => ({ commands: r }) => r.keyboardShortcut("Enter"), Os = () => ({ state: r, dispatch: t }) => Zi(r, t);
|
|
5059
5059
|
function Ve(r, t, e = { strict: !0 }) {
|
|
5060
5060
|
const n = Object.keys(t);
|
|
5061
5061
|
return n.length ? n.every((o) => e.strict ? t[o] === r[o] : gs(t[o]) ? t[o].test(r[o]) : t[o] === r[o]) : !0;
|
|
@@ -5067,7 +5067,7 @@ function io(r, t, e = {}) {
|
|
|
5067
5067
|
e
|
|
5068
5068
|
));
|
|
5069
5069
|
}
|
|
5070
|
-
function
|
|
5070
|
+
function or(r, t, e = {}) {
|
|
5071
5071
|
return !!io(r, t, e);
|
|
5072
5072
|
}
|
|
5073
5073
|
function so(r, t, e) {
|
|
@@ -5078,9 +5078,9 @@ function so(r, t, e) {
|
|
|
5078
5078
|
if ((!o.node || !o.node.marks.some((u) => u.type === t)) && (o = r.parent.childBefore(r.parentOffset)), !o.node || !o.node.marks.some((u) => u.type === t) || (e = e || ((n = o.node.marks[0]) === null || n === void 0 ? void 0 : n.attrs), !io([...o.node.marks], t, e)))
|
|
5079
5079
|
return;
|
|
5080
5080
|
let s = o.index, l = r.start() + o.offset, a = s + 1, c = l + o.node.nodeSize;
|
|
5081
|
-
for (; s > 0 &&
|
|
5081
|
+
for (; s > 0 && or([...r.parent.child(s - 1).marks], t, e); )
|
|
5082
5082
|
s -= 1, l -= r.parent.child(s).nodeSize;
|
|
5083
|
-
for (; a < r.parent.childCount &&
|
|
5083
|
+
for (; a < r.parent.childCount && or([...r.parent.child(a).marks], t, e); )
|
|
5084
5084
|
c += r.parent.child(a).nodeSize, a += 1;
|
|
5085
5085
|
return {
|
|
5086
5086
|
from: l,
|
|
@@ -5115,7 +5115,7 @@ const $s = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
|
5115
5115
|
function lo(r) {
|
|
5116
5116
|
return r instanceof D;
|
|
5117
5117
|
}
|
|
5118
|
-
function
|
|
5118
|
+
function Jt(r = 0, t = 0, e = 0) {
|
|
5119
5119
|
return Math.min(Math.max(r, t), e);
|
|
5120
5120
|
}
|
|
5121
5121
|
function Rs(r, t = null) {
|
|
@@ -5127,12 +5127,12 @@ function Rs(r, t = null) {
|
|
|
5127
5127
|
if (t === "end")
|
|
5128
5128
|
return n;
|
|
5129
5129
|
const o = e.from, i = n.to;
|
|
5130
|
-
return t === "all" ? D.create(r,
|
|
5130
|
+
return t === "all" ? D.create(r, Jt(0, o, i), Jt(r.content.size, o, i)) : D.create(r, Jt(t, o, i), Jt(t, o, i));
|
|
5131
5131
|
}
|
|
5132
5132
|
function zs() {
|
|
5133
5133
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
5134
5134
|
}
|
|
5135
|
-
function
|
|
5135
|
+
function In() {
|
|
5136
5136
|
return [
|
|
5137
5137
|
"iPad Simulator",
|
|
5138
5138
|
"iPhone Simulator",
|
|
@@ -5148,7 +5148,7 @@ const Ps = (r = null, t = {}) => ({ editor: e, view: n, tr: o, dispatch: i }) =>
|
|
|
5148
5148
|
...t
|
|
5149
5149
|
};
|
|
5150
5150
|
const s = () => {
|
|
5151
|
-
(
|
|
5151
|
+
(In() || zs()) && n.dom.focus(), requestAnimationFrame(() => {
|
|
5152
5152
|
e.isDestroyed || (n.focus(), t?.scrollIntoView && e.commands.scrollIntoView());
|
|
5153
5153
|
});
|
|
5154
5154
|
};
|
|
@@ -5232,7 +5232,7 @@ function Ds(r, t, e) {
|
|
|
5232
5232
|
s === 0 && (s = u);
|
|
5233
5233
|
}), r.setSelection($.near(r.doc.resolve(s), e));
|
|
5234
5234
|
}
|
|
5235
|
-
const
|
|
5235
|
+
const Ls = (r) => !("type" in r), Js = (r, t, e) => ({ tr: n, dispatch: o, editor: i }) => {
|
|
5236
5236
|
var s;
|
|
5237
5237
|
if (o) {
|
|
5238
5238
|
e = {
|
|
@@ -5261,7 +5261,7 @@ const Js = (r) => !("type" in r), Ls = (r, t, e) => ({ tr: n, dispatch: o, edito
|
|
|
5261
5261
|
}), !1;
|
|
5262
5262
|
}
|
|
5263
5263
|
let { from: a, to: c } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, u = !0, f = !0;
|
|
5264
|
-
if ((
|
|
5264
|
+
if ((Ls(l) ? l : [l]).forEach((m) => {
|
|
5265
5265
|
m.check(), u = u ? m.isText && m.marks.length === 0 : !1, f = f ? m.isBlock : !1;
|
|
5266
5266
|
}), a === c && f) {
|
|
5267
5267
|
const { parent: m } = n.doc.resolve(a);
|
|
@@ -5317,7 +5317,7 @@ function Xs(r) {
|
|
|
5317
5317
|
else if (/^s(hift)?$/i.test(a))
|
|
5318
5318
|
i = !0;
|
|
5319
5319
|
else if (/^mod$/i.test(a))
|
|
5320
|
-
|
|
5320
|
+
In() || co() ? s = !0 : o = !0;
|
|
5321
5321
|
else
|
|
5322
5322
|
throw new Error(`Unrecognized modifier name: ${a}`);
|
|
5323
5323
|
}
|
|
@@ -5340,7 +5340,7 @@ const Zs = (r) => ({ editor: t, view: e, tr: n, dispatch: o }) => {
|
|
|
5340
5340
|
u && o && n.maybeStep(u);
|
|
5341
5341
|
}), !0;
|
|
5342
5342
|
};
|
|
5343
|
-
function
|
|
5343
|
+
function On(r, t, e = {}) {
|
|
5344
5344
|
const { from: n, to: o, empty: i } = r.selection, s = t ? et(t, r.schema) : null, l = [];
|
|
5345
5345
|
r.doc.nodesBetween(n, o, (f, d) => {
|
|
5346
5346
|
if (f.isText)
|
|
@@ -5357,7 +5357,7 @@ function $n(r, t, e = {}) {
|
|
|
5357
5357
|
}
|
|
5358
5358
|
const Qs = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5359
5359
|
const o = et(r, e.schema);
|
|
5360
|
-
return
|
|
5360
|
+
return On(e, o, t) ? Xi(e, n) : !1;
|
|
5361
5361
|
}, Ys = () => ({ state: r, dispatch: t }) => eo(r, t), tl = (r) => ({ state: t, dispatch: e }) => {
|
|
5362
5362
|
const n = et(r, t.schema);
|
|
5363
5363
|
return cs(n)(t, e);
|
|
@@ -5365,7 +5365,7 @@ const Qs = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
|
5365
5365
|
function uo(r, t) {
|
|
5366
5366
|
return t.nodes[r] ? "node" : t.marks[r] ? "mark" : null;
|
|
5367
5367
|
}
|
|
5368
|
-
function
|
|
5368
|
+
function ir(r, t) {
|
|
5369
5369
|
const e = typeof t == "string" ? [t] : t;
|
|
5370
5370
|
return Object.keys(r).reduce((n, o) => (e.includes(o) || (n[o] = r[o]), n), {});
|
|
5371
5371
|
}
|
|
@@ -5374,8 +5374,8 @@ const nl = (r, t) => ({ tr: e, state: n, dispatch: o }) => {
|
|
|
5374
5374
|
const l = uo(typeof r == "string" ? r : r.name, n.schema);
|
|
5375
5375
|
return l ? (l === "node" && (i = et(r, n.schema)), l === "mark" && (s = zt(r, n.schema)), o && e.selection.ranges.forEach((a) => {
|
|
5376
5376
|
n.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, u) => {
|
|
5377
|
-
i && i === c.type && e.setNodeMarkup(u, void 0,
|
|
5378
|
-
s === f.type && e.addMark(u, u + c.nodeSize, s.create(
|
|
5377
|
+
i && i === c.type && e.setNodeMarkup(u, void 0, ir(c.attrs, t)), s && c.marks.length && c.marks.forEach((f) => {
|
|
5378
|
+
s === f.type && e.addMark(u, u + c.nodeSize, s.create(ir(f.attrs, t)));
|
|
5379
5379
|
});
|
|
5380
5380
|
});
|
|
5381
5381
|
}), !0) : !1;
|
|
@@ -5435,7 +5435,7 @@ function pl(r, t) {
|
|
|
5435
5435
|
};
|
|
5436
5436
|
}
|
|
5437
5437
|
}
|
|
5438
|
-
function
|
|
5438
|
+
function $n(r) {
|
|
5439
5439
|
return (t) => pl(t.$from, r);
|
|
5440
5440
|
}
|
|
5441
5441
|
function Be(r, t, e) {
|
|
@@ -5456,8 +5456,8 @@ function ml(r, t, e = {}) {
|
|
|
5456
5456
|
if (!p.isText && !p.marks.length)
|
|
5457
5457
|
return;
|
|
5458
5458
|
const b = Math.max(h, k), I = Math.min(m, k + p.nodeSize), R = I - b;
|
|
5459
|
-
s += R, l.push(...p.marks.map((
|
|
5460
|
-
mark:
|
|
5459
|
+
s += R, l.push(...p.marks.map((L) => ({
|
|
5460
|
+
mark: L,
|
|
5461
5461
|
from: b,
|
|
5462
5462
|
to: I
|
|
5463
5463
|
})));
|
|
@@ -5467,7 +5467,7 @@ function ml(r, t, e = {}) {
|
|
|
5467
5467
|
const a = l.filter((f) => i ? i.name === f.mark.type.name : !0).filter((f) => Ve(f.mark.attrs, e, { strict: !1 })).reduce((f, d) => f + d.to - d.from, 0), c = l.filter((f) => i ? f.mark.type !== i && f.mark.type.excludes(i) : !0).reduce((f, d) => f + d.to - d.from, 0);
|
|
5468
5468
|
return (a > 0 ? a + c : a) >= s;
|
|
5469
5469
|
}
|
|
5470
|
-
function
|
|
5470
|
+
function sr(r, t) {
|
|
5471
5471
|
const { nodeExtensions: e } = ps(t), n = e.find((s) => s.name === r);
|
|
5472
5472
|
if (!n)
|
|
5473
5473
|
return !1;
|
|
@@ -5548,16 +5548,16 @@ const yl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
|
5548
5548
|
}, wl = (r, t) => ({ tr: e }) => (e.setMeta(r, t), !0), xl = (r, t = {}) => ({ state: e, dispatch: n, chain: o }) => {
|
|
5549
5549
|
const i = et(r, e.schema);
|
|
5550
5550
|
let s;
|
|
5551
|
-
return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) =>
|
|
5551
|
+
return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) => rr(i, { ...s, ...t })(e) ? !0 : l.clearNodes()).command(({ state: l }) => rr(i, { ...s, ...t })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
5552
5552
|
}, kl = (r) => ({ tr: t, dispatch: e }) => {
|
|
5553
5553
|
if (e) {
|
|
5554
|
-
const { doc: n } = t, o =
|
|
5554
|
+
const { doc: n } = t, o = Jt(r, 0, n.content.size), i = P.create(n, o);
|
|
5555
5555
|
t.setSelection(i);
|
|
5556
5556
|
}
|
|
5557
5557
|
return !0;
|
|
5558
5558
|
}, bl = (r) => ({ tr: t, dispatch: e }) => {
|
|
5559
5559
|
if (e) {
|
|
5560
|
-
const { doc: n } = t, { from: o, to: i } = typeof r == "number" ? { from: r, to: r } : r, s = D.atStart(n).from, l = D.atEnd(n).to, a =
|
|
5560
|
+
const { doc: n } = t, { from: o, to: i } = typeof r == "number" ? { from: r, to: r } : r, s = D.atStart(n).from, l = D.atEnd(n).to, a = Jt(o, s, l), c = Jt(i, s, l), u = D.create(n, a, c);
|
|
5561
5561
|
t.setSelection(u);
|
|
5562
5562
|
}
|
|
5563
5563
|
return !0;
|
|
@@ -5565,7 +5565,7 @@ const yl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
|
5565
5565
|
const n = et(r, t.schema);
|
|
5566
5566
|
return ds(n)(t, e);
|
|
5567
5567
|
};
|
|
5568
|
-
function
|
|
5568
|
+
function lr(r, t) {
|
|
5569
5569
|
const e = r.storedMarks || r.selection.$to.parentOffset && r.selection.$from.marks();
|
|
5570
5570
|
if (e) {
|
|
5571
5571
|
const n = e.filter((o) => t?.includes(o.type.name));
|
|
@@ -5575,7 +5575,7 @@ function ar(r, t) {
|
|
|
5575
5575
|
const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, editor: o }) => {
|
|
5576
5576
|
const { selection: i, doc: s } = t, { $from: l, $to: a } = i, c = o.extensionManager.attributes, u = Be(c, l.node().type.name, l.node().attrs);
|
|
5577
5577
|
if (i instanceof P && i.node.isBlock)
|
|
5578
|
-
return !l.parentOffset || !Mt(s, l.pos) ? !1 : (n && (r &&
|
|
5578
|
+
return !l.parentOffset || !Mt(s, l.pos) ? !1 : (n && (r && lr(e, o.extensionManager.splittableMarks), t.split(l.pos).scrollIntoView()), !0);
|
|
5579
5579
|
if (!l.parent.isBlock)
|
|
5580
5580
|
return !1;
|
|
5581
5581
|
const f = a.parentOffset === a.parent.content.size, d = l.depth === 0 ? void 0 : hl(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
@@ -5595,7 +5595,7 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5595
5595
|
const p = t.mapping.map(l.before()), k = t.doc.resolve(p);
|
|
5596
5596
|
l.node(-1).canReplaceWith(k.index(), k.index() + 1, d) && t.setNodeMarkup(t.mapping.map(l.before()), d);
|
|
5597
5597
|
}
|
|
5598
|
-
r &&
|
|
5598
|
+
r && lr(e, o.extensionManager.splittableMarks), t.scrollIntoView();
|
|
5599
5599
|
}
|
|
5600
5600
|
return m;
|
|
5601
5601
|
}, Cl = (r, t = {}) => ({ tr: e, state: n, dispatch: o, editor: i }) => {
|
|
@@ -5615,10 +5615,10 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5615
5615
|
const I = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
5616
5616
|
for (let W = a.depth - I; W >= a.depth - 3; W -= 1)
|
|
5617
5617
|
b = x.from(a.node(W).copy(b));
|
|
5618
|
-
const R = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3,
|
|
5618
|
+
const R = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, L = {
|
|
5619
5619
|
...Be(d, a.node().type.name, a.node().attrs),
|
|
5620
5620
|
...t
|
|
5621
|
-
}, H = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(
|
|
5621
|
+
}, H = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(L)) || void 0;
|
|
5622
5622
|
b = b.append(x.from(l.createAndFill(null, H) || void 0));
|
|
5623
5623
|
const Z = a.before(a.depth - (I - 1));
|
|
5624
5624
|
e.replace(Z, a.after(-R), new S(b, 4 - I, 0));
|
|
@@ -5646,15 +5646,15 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5646
5646
|
if (!Mt(e.doc, a.pos, 2))
|
|
5647
5647
|
return !1;
|
|
5648
5648
|
if (o) {
|
|
5649
|
-
const { selection: b, storedMarks: I } = n, { splittableMarks: R } = i.extensionManager,
|
|
5650
|
-
if (e.split(a.pos, 2, k).scrollIntoView(), !
|
|
5649
|
+
const { selection: b, storedMarks: I } = n, { splittableMarks: R } = i.extensionManager, L = I || b.$to.parentOffset && b.$from.marks();
|
|
5650
|
+
if (e.split(a.pos, 2, k).scrollIntoView(), !L || !o)
|
|
5651
5651
|
return !0;
|
|
5652
|
-
const H =
|
|
5652
|
+
const H = L.filter((Z) => R.includes(Z.type.name));
|
|
5653
5653
|
e.ensureMarks(H);
|
|
5654
5654
|
}
|
|
5655
5655
|
return !0;
|
|
5656
5656
|
}, un = (r, t) => {
|
|
5657
|
-
const e =
|
|
5657
|
+
const e = $n((s) => s.type === t)(r.selection);
|
|
5658
5658
|
if (!e)
|
|
5659
5659
|
return !0;
|
|
5660
5660
|
const n = r.doc.resolve(Math.max(0, e.pos - 1)).before(e.depth);
|
|
@@ -5663,7 +5663,7 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5663
5663
|
const o = r.doc.nodeAt(n);
|
|
5664
5664
|
return e.node.type === o?.type && qt(r.doc, e.pos) && r.join(e.pos), !0;
|
|
5665
5665
|
}, fn = (r, t) => {
|
|
5666
|
-
const e =
|
|
5666
|
+
const e = $n((s) => s.type === t)(r.selection);
|
|
5667
5667
|
if (!e)
|
|
5668
5668
|
return !0;
|
|
5669
5669
|
const n = r.doc.resolve(e.start).after(e.depth);
|
|
@@ -5672,30 +5672,30 @@ const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5672
5672
|
const o = r.doc.nodeAt(n);
|
|
5673
5673
|
return e.node.type === o?.type && qt(r.doc, n) && r.join(n), !0;
|
|
5674
5674
|
}, Tl = (r, t, e, n = {}) => ({ editor: o, tr: i, state: s, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
5675
|
-
const { extensions: f, splittableMarks: d } = o.extensionManager, h = et(r, s.schema), m = et(t, s.schema), { selection: p, storedMarks: k } = s, { $from: b, $to: I } = p, R = b.blockRange(I),
|
|
5675
|
+
const { extensions: f, splittableMarks: d } = o.extensionManager, h = et(r, s.schema), m = et(t, s.schema), { selection: p, storedMarks: k } = s, { $from: b, $to: I } = p, R = b.blockRange(I), L = k || p.$to.parentOffset && p.$from.marks();
|
|
5676
5676
|
if (!R)
|
|
5677
5677
|
return !1;
|
|
5678
|
-
const H =
|
|
5678
|
+
const H = $n((Z) => sr(Z.type.name, f))(p);
|
|
5679
5679
|
if (R.depth >= 1 && H && R.depth - H.depth <= 1) {
|
|
5680
5680
|
if (H.node.type === h)
|
|
5681
5681
|
return c.liftListItem(m);
|
|
5682
|
-
if (
|
|
5682
|
+
if (sr(H.node.type.name, f) && h.validContent(H.node.content) && l)
|
|
5683
5683
|
return a().command(() => (i.setNodeMarkup(H.pos, h), !0)).command(() => un(i, h)).command(() => fn(i, h)).run();
|
|
5684
5684
|
}
|
|
5685
|
-
return !e || !
|
|
5686
|
-
const Z = u().wrapInList(h, n), at =
|
|
5685
|
+
return !e || !L || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run() : a().command(() => {
|
|
5686
|
+
const Z = u().wrapInList(h, n), at = L.filter((W) => d.includes(W.type.name));
|
|
5687
5687
|
return i.ensureMarks(at), Z ? !0 : c.clearNodes();
|
|
5688
5688
|
}).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run();
|
|
5689
5689
|
}, Al = (r, t = {}, e = {}) => ({ state: n, commands: o }) => {
|
|
5690
5690
|
const { extendEmptyMarkRange: i = !1 } = e, s = zt(r, n.schema);
|
|
5691
5691
|
return ml(n, s, t) ? o.unsetMark(s, { extendEmptyMarkRange: i }) : o.setMark(s, t);
|
|
5692
5692
|
}, Ml = (r, t, e = {}) => ({ state: n, commands: o }) => {
|
|
5693
|
-
const i = et(r, n.schema), s = et(t, n.schema), l =
|
|
5693
|
+
const i = et(r, n.schema), s = et(t, n.schema), l = On(n, i, e);
|
|
5694
5694
|
let a;
|
|
5695
5695
|
return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? o.setNode(s, a) : o.setNode(i, { ...a, ...e });
|
|
5696
5696
|
}, El = (r, t = {}) => ({ state: e, commands: n }) => {
|
|
5697
5697
|
const o = et(r, e.schema);
|
|
5698
|
-
return
|
|
5698
|
+
return On(e, o, t) ? n.lift(o) : n.wrapIn(o, t);
|
|
5699
5699
|
}, Nl = () => ({ state: r, dispatch: t }) => {
|
|
5700
5700
|
const e = r.plugins;
|
|
5701
5701
|
for (let n = 0; n < e.length; n += 1) {
|
|
@@ -5792,7 +5792,7 @@ var zl = /* @__PURE__ */ Object.freeze({
|
|
|
5792
5792
|
focus: Ps,
|
|
5793
5793
|
forEach: Fs,
|
|
5794
5794
|
insertContent: _s,
|
|
5795
|
-
insertContentAt:
|
|
5795
|
+
insertContentAt: Js,
|
|
5796
5796
|
joinBackward: Vs,
|
|
5797
5797
|
joinDown: js,
|
|
5798
5798
|
joinForward: qs,
|
|
@@ -5945,7 +5945,7 @@ ht.create({
|
|
|
5945
5945
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
5946
5946
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
5947
5947
|
};
|
|
5948
|
-
return
|
|
5948
|
+
return In() || co() ? i : o;
|
|
5949
5949
|
},
|
|
5950
5950
|
addProseMirrorPlugins() {
|
|
5951
5951
|
return [
|
|
@@ -6011,7 +6011,7 @@ ht.create({
|
|
|
6011
6011
|
];
|
|
6012
6012
|
}
|
|
6013
6013
|
});
|
|
6014
|
-
const
|
|
6014
|
+
const ar = [
|
|
6015
6015
|
{ border: "#f97316", background: "rgba(254, 243, 199, 0.9)" },
|
|
6016
6016
|
// 0 橙
|
|
6017
6017
|
{ border: "#22c55e", background: "rgba(220, 252, 231, 0.85)" },
|
|
@@ -6078,7 +6078,7 @@ const cr = [
|
|
|
6078
6078
|
return [{ tag: "span[data-comment-id]" }];
|
|
6079
6079
|
},
|
|
6080
6080
|
renderHTML({ HTMLAttributes: r }) {
|
|
6081
|
-
const t = r.colorIndex ?? r["data-comment-color"] ?? 0, e = Number.parseInt(t, 10), n = Number.isNaN(e) || !Number.isFinite(e) ? 0 : (e % tt + tt) % tt, o =
|
|
6081
|
+
const t = r.colorIndex ?? r["data-comment-color"] ?? 0, e = Number.parseInt(t, 10), n = Number.isNaN(e) || !Number.isFinite(e) ? 0 : (e % tt + tt) % tt, o = ar[n] || ar[0], i = o.border, s = o.background;
|
|
6082
6082
|
return [
|
|
6083
6083
|
"span",
|
|
6084
6084
|
{
|
|
@@ -6124,7 +6124,7 @@ const cr = [
|
|
|
6124
6124
|
class: "comment-gutter",
|
|
6125
6125
|
style: { "margin-top": "-100px" },
|
|
6126
6126
|
"aria-label": "批注贴行栏"
|
|
6127
|
-
}, _l = ["onClick", "onKeydown"], Dl = { class: "gutter-item__quote" },
|
|
6127
|
+
}, _l = ["onClick", "onKeydown"], Dl = { class: "gutter-item__quote" }, Ll = { class: "gutter-item__note" }, Jl = { class: "gutter-item__meta" }, Wl = { class: "gutter-item__author" }, jl = { class: "gutter-item__time" }, Vl = {
|
|
6128
6128
|
__name: "CommentGutter",
|
|
6129
6129
|
props: {
|
|
6130
6130
|
anchors: { type: Array, default: () => [] },
|
|
@@ -6182,13 +6182,13 @@ const cr = [
|
|
|
6182
6182
|
return l;
|
|
6183
6183
|
});
|
|
6184
6184
|
return (l, a) => (q(), rt("div", Fl, [
|
|
6185
|
-
(q(!0), rt(
|
|
6185
|
+
(q(!0), rt(hr, null, pr(s.value, (c) => (q(), rt("div", {
|
|
6186
6186
|
key: c.id,
|
|
6187
6187
|
class: "gutter-item-wrapper",
|
|
6188
6188
|
style: Co({ marginTop: `${c.marginTop}px` })
|
|
6189
6189
|
}, [
|
|
6190
6190
|
y("div", {
|
|
6191
|
-
class:
|
|
6191
|
+
class: mr(["gutter-item", [
|
|
6192
6192
|
`gutter-item--c${c.colorIndex ?? 0}`,
|
|
6193
6193
|
{
|
|
6194
6194
|
"gutter-item--active": r.activeCommentId === c.id,
|
|
@@ -6201,8 +6201,8 @@ const cr = [
|
|
|
6201
6201
|
onKeydown: dn(ze((u) => l.$emit("activate", c.id), ["prevent"]), ["enter"])
|
|
6202
6202
|
}, [
|
|
6203
6203
|
y("div", Dl, Y(e(c.selectedText, 28)), 1),
|
|
6204
|
-
y("div",
|
|
6205
|
-
y("div",
|
|
6204
|
+
y("div", Ll, Y(e(c.note, 36)), 1),
|
|
6205
|
+
y("div", Jl, [
|
|
6206
6206
|
y("span", Wl, Y(c.author), 1),
|
|
6207
6207
|
y("span", jl, Y(r.formatTime(c.createdAt)), 1)
|
|
6208
6208
|
])
|
|
@@ -6258,12 +6258,12 @@ const cr = [
|
|
|
6258
6258
|
if (!u) return;
|
|
6259
6259
|
const f = r?.(), h = t?.() || f || u, m = h.getBoundingClientRect(), p = typeof h.scrollTop == "number" ? h.scrollTop : 0, k = u.querySelectorAll("span[data-comment-id]") || [], b = /* @__PURE__ */ new Map();
|
|
6260
6260
|
k.forEach((R) => {
|
|
6261
|
-
const
|
|
6262
|
-
if (!
|
|
6261
|
+
const L = R.getAttribute("data-comment-id");
|
|
6262
|
+
if (!L) return;
|
|
6263
6263
|
const H = R.getClientRects()[0] || R.getBoundingClientRect();
|
|
6264
6264
|
if (!H) return;
|
|
6265
|
-
const Z = H.top - m.top + p, at = H.height || 0, W = b.get(
|
|
6266
|
-
(!W || Z < W.top) && b.set(
|
|
6265
|
+
const Z = H.top - m.top + p, at = H.height || 0, W = b.get(L);
|
|
6266
|
+
(!W || Z < W.top) && b.set(L, { id: L, top: Z, height: at });
|
|
6267
6267
|
});
|
|
6268
6268
|
const I = Array.from(b.values());
|
|
6269
6269
|
e?.(I);
|
|
@@ -6280,19 +6280,19 @@ const cr = [
|
|
|
6280
6280
|
})
|
|
6281
6281
|
];
|
|
6282
6282
|
}
|
|
6283
|
-
})
|
|
6284
|
-
async function
|
|
6285
|
-
const t = await r.arrayBuffer(), e = await
|
|
6283
|
+
});
|
|
6284
|
+
async function Gl(r) {
|
|
6285
|
+
const t = await r.arrayBuffer(), e = await wr.loadAsync(t), n = e.file("word/comments.xml");
|
|
6286
6286
|
if (!n) return [];
|
|
6287
|
-
const o = await n.async("text"), i =
|
|
6287
|
+
const o = await n.async("text"), i = cr(o), s = /* @__PURE__ */ new Map(), l = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", a = i.getElementsByTagNameNS(l, "comment");
|
|
6288
6288
|
for (const p of a) {
|
|
6289
|
-
const k = p.getAttribute("w:id"), b = p.getAttribute("w:author") || "", I = p.getAttribute("w:date") || "", R =
|
|
6289
|
+
const k = p.getAttribute("w:id"), b = p.getAttribute("w:author") || "", I = p.getAttribute("w:date") || "", R = Kl(p, l);
|
|
6290
6290
|
s.set(k, { author: b, date: I, note: R });
|
|
6291
6291
|
}
|
|
6292
6292
|
if (s.size === 0) return [];
|
|
6293
6293
|
const c = e.file("word/document.xml");
|
|
6294
|
-
if (!c) return
|
|
6295
|
-
const u = await c.async("text"), f =
|
|
6294
|
+
if (!c) return Zl(s);
|
|
6295
|
+
const u = await c.async("text"), f = cr(u), { selectedTextMap: d, containsDelTextMap: h } = Xl(f, l), m = [];
|
|
6296
6296
|
for (const [p, k] of s)
|
|
6297
6297
|
m.push({
|
|
6298
6298
|
wordId: p,
|
|
@@ -6304,13 +6304,13 @@ async function Kl(r) {
|
|
|
6304
6304
|
});
|
|
6305
6305
|
return m;
|
|
6306
6306
|
}
|
|
6307
|
-
function
|
|
6307
|
+
function cr(r) {
|
|
6308
6308
|
return new DOMParser().parseFromString(r, "application/xml");
|
|
6309
6309
|
}
|
|
6310
|
-
function
|
|
6310
|
+
function Kl(r, t) {
|
|
6311
6311
|
return [...r.getElementsByTagNameNS(t, "t")].map((n) => n.textContent).join("");
|
|
6312
6312
|
}
|
|
6313
|
-
function
|
|
6313
|
+
function Xl(r, t) {
|
|
6314
6314
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = r.getElementsByTagNameNS(t, "body")[0];
|
|
6315
6315
|
return s ? (ho(s, t, o, i, e, n), { selectedTextMap: e, containsDelTextMap: n }) : { selectedTextMap: e, containsDelTextMap: n };
|
|
6316
6316
|
}
|
|
@@ -6334,7 +6334,7 @@ function ho(r, t, e, n, o, i) {
|
|
|
6334
6334
|
} else l === "instrText" || s.childNodes && s.childNodes.length > 0 && ho(s, t, e, n, o, i);
|
|
6335
6335
|
}
|
|
6336
6336
|
}
|
|
6337
|
-
function
|
|
6337
|
+
function Zl(r) {
|
|
6338
6338
|
return [...r.entries()].map(([t, e]) => ({
|
|
6339
6339
|
wordId: t,
|
|
6340
6340
|
author: e.author,
|
|
@@ -6343,15 +6343,15 @@ function Ql(r) {
|
|
|
6343
6343
|
selectedText: ""
|
|
6344
6344
|
}));
|
|
6345
6345
|
}
|
|
6346
|
-
const po = "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
|
|
6347
|
-
async function
|
|
6348
|
-
const t = await r.arrayBuffer(), e = await
|
|
6349
|
-
return await
|
|
6346
|
+
const po = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Ql = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
6347
|
+
async function Yl(r) {
|
|
6348
|
+
const t = await r.arrayBuffer(), e = await wr.loadAsync(t), n = await ta(e), o = await ea(e);
|
|
6349
|
+
return await na(e, n, o);
|
|
6350
6350
|
}
|
|
6351
|
-
async function
|
|
6351
|
+
async function ta(r) {
|
|
6352
6352
|
const t = r.file("word/styles.xml");
|
|
6353
6353
|
if (!t) return /* @__PURE__ */ new Map();
|
|
6354
|
-
const e = await t.async("text"), n =
|
|
6354
|
+
const e = await t.async("text"), n = Rn(e), o = /* @__PURE__ */ new Map(), i = n.getElementsByTagNameNS(po, "style");
|
|
6355
6355
|
for (const a of i) {
|
|
6356
6356
|
const c = a.getAttribute("w:styleId");
|
|
6357
6357
|
if (!c) continue;
|
|
@@ -6359,7 +6359,7 @@ async function ea(r) {
|
|
|
6359
6359
|
const f = v(a, "basedOn")?.getAttribute("w:val") || null, d = v(a, "rPr"), h = v(a, "pPr");
|
|
6360
6360
|
o.set(c, {
|
|
6361
6361
|
basedOn: f,
|
|
6362
|
-
rProps: d ?
|
|
6362
|
+
rProps: d ? Bn(d) : {},
|
|
6363
6363
|
pProps: h ? wo(h) : {},
|
|
6364
6364
|
name: v(a, "name")?.getAttribute("w:val") || ""
|
|
6365
6365
|
});
|
|
@@ -6382,38 +6382,38 @@ async function ea(r) {
|
|
|
6382
6382
|
for (const a of o.keys()) l(a);
|
|
6383
6383
|
return s;
|
|
6384
6384
|
}
|
|
6385
|
-
async function
|
|
6385
|
+
async function ea(r) {
|
|
6386
6386
|
const t = r.file("word/_rels/document.xml.rels");
|
|
6387
6387
|
if (!t) return /* @__PURE__ */ new Map();
|
|
6388
|
-
const e = await t.async("text"), n =
|
|
6388
|
+
const e = await t.async("text"), n = Rn(e), o = /* @__PURE__ */ new Map(), i = n.getElementsByTagName("Relationship");
|
|
6389
6389
|
for (const s of i)
|
|
6390
6390
|
o.set(s.getAttribute("Id"), s.getAttribute("Target"));
|
|
6391
6391
|
return o;
|
|
6392
6392
|
}
|
|
6393
|
-
async function
|
|
6393
|
+
async function na(r, t, e) {
|
|
6394
6394
|
const n = r.file("word/document.xml");
|
|
6395
6395
|
if (!n) return "<p></p>";
|
|
6396
|
-
const o = await n.async("text"), s =
|
|
6396
|
+
const o = await n.async("text"), s = Rn(o).getElementsByTagNameNS(po, "body")[0];
|
|
6397
6397
|
if (!s) return "<p></p>";
|
|
6398
|
-
const l = v(s, "sectPr"), a = l ?
|
|
6398
|
+
const l = v(s, "sectPr"), a = l ? ur(l) : { count: 1, gap: 720, widths: [] }, c = ra(l), u = [];
|
|
6399
6399
|
let f = { colInfo: null, nodes: [] };
|
|
6400
6400
|
for (const h of s.childNodes) {
|
|
6401
6401
|
if (h.nodeType !== 1) continue;
|
|
6402
6402
|
const m = h.localName;
|
|
6403
6403
|
if (m === "p") {
|
|
6404
6404
|
const p = v(h, "pPr"), k = p ? v(p, "sectPr") : null;
|
|
6405
|
-
f.nodes.push({ type: "p", node: h }), k && (f.colInfo =
|
|
6405
|
+
f.nodes.push({ type: "p", node: h }), k && (f.colInfo = ur(k), u.push(f), f = { colInfo: null, nodes: [] });
|
|
6406
6406
|
} else m === "tbl" && f.nodes.push({ type: "tbl", node: h });
|
|
6407
6407
|
}
|
|
6408
6408
|
f.nodes.length && (f.colInfo = a, u.push(f));
|
|
6409
6409
|
let d = "";
|
|
6410
6410
|
for (const h of u) {
|
|
6411
6411
|
const m = h.colInfo || { count: 1 };
|
|
6412
|
-
m.count > 1 ? d +=
|
|
6412
|
+
m.count > 1 ? d += oa(h.nodes, m, t, e, c) : d += mo(h.nodes, t, e, c);
|
|
6413
6413
|
}
|
|
6414
6414
|
return d || "<p></p>";
|
|
6415
6415
|
}
|
|
6416
|
-
function
|
|
6416
|
+
function ra(r) {
|
|
6417
6417
|
if (!r) return 0;
|
|
6418
6418
|
const t = v(r, "pgSz");
|
|
6419
6419
|
if (!t) return 0;
|
|
@@ -6422,7 +6422,7 @@ function oa(r) {
|
|
|
6422
6422
|
const n = v(r, "pgMar"), o = n && parseInt(n.getAttribute("w:left"), 10) || 0, i = n && parseInt(n.getAttribute("w:right"), 10) || 0;
|
|
6423
6423
|
return Math.max(e - o - i, 1);
|
|
6424
6424
|
}
|
|
6425
|
-
function
|
|
6425
|
+
function ur(r) {
|
|
6426
6426
|
const t = v(r, "cols");
|
|
6427
6427
|
if (!t) return { count: 1, gap: 720, widths: [] };
|
|
6428
6428
|
const e = parseInt(t.getAttribute("w:num"), 10) || 1, n = parseInt(t.getAttribute("w:space"), 10) || 720, o = [...t.childNodes].filter(
|
|
@@ -6435,18 +6435,18 @@ function fr(r) {
|
|
|
6435
6435
|
}
|
|
6436
6436
|
return { count: e, gap: n, widths: i };
|
|
6437
6437
|
}
|
|
6438
|
-
function
|
|
6438
|
+
function oa(r, t, e, n, o = 0) {
|
|
6439
6439
|
const { count: i, widths: s } = t, l = Array.from({ length: i }, () => []);
|
|
6440
6440
|
let a = 0;
|
|
6441
6441
|
for (const d of r)
|
|
6442
|
-
a >= i && (a = i - 1), d.type === "p" &&
|
|
6442
|
+
a >= i && (a = i - 1), d.type === "p" && ia(d.node) ? (l[a].push({ ...d, stripColBreak: !0 }), a < i - 1 && a++) : l[a].push(d);
|
|
6443
6443
|
const u = `<colgroup data-word-col-layout="1">${Array.from({ length: i }, (d, h) => `<col style="width:${s[h] ? `${s[h]}%` : `${(100 / i).toFixed(2)}%`}"/>`).join("")}</colgroup>`, f = l.map((d, h) => {
|
|
6444
6444
|
const m = mo(d, e, n, o);
|
|
6445
6445
|
return `<td style="${s[h] ? `width:${s[h]}%;` : `width:${(100 / i).toFixed(2)}%;`}vertical-align:top;padding:0 4px;">${m || "<p></p>"}</td>`;
|
|
6446
6446
|
});
|
|
6447
6447
|
return `<table style="width:100%;border-collapse:collapse;table-layout:fixed;">${u}<tr>${f.join("")}</tr></table>`;
|
|
6448
6448
|
}
|
|
6449
|
-
function
|
|
6449
|
+
function ia(r) {
|
|
6450
6450
|
for (const t of r.childNodes)
|
|
6451
6451
|
if (!(t.nodeType !== 1 || t.localName !== "r")) {
|
|
6452
6452
|
for (const e of t.childNodes)
|
|
@@ -6467,8 +6467,8 @@ function mo(r, t, e, n = 0) {
|
|
|
6467
6467
|
function go(r, t, e, n = !1) {
|
|
6468
6468
|
const o = v(r, "pPr"), s = (o ? v(o, "pStyle") : null)?.getAttribute("w:val") || "", l = t.get(s) || {}, a = o ? wo(o) : {}, c = { ...l.pProps, ...a }, u = o ? v(o, "rPr") : null, f = {
|
|
6469
6469
|
...l.rProps || {},
|
|
6470
|
-
...u ?
|
|
6471
|
-
}, h = (o ? v(o, "numPr") : null) !== null || s === "ListParagraph" || l.name && /list/i.test(l.name), m =
|
|
6470
|
+
...u ? Bn(u) : {}
|
|
6471
|
+
}, h = (o ? v(o, "numPr") : null) !== null || s === "ListParagraph" || l.name && /list/i.test(l.name), m = ha(s, l.name), p = m ? `h${m}` : "p", k = da(c), b = k ? ` style="${k}"` : "", I = Re(r, f, t, e, n);
|
|
6472
6472
|
return { tag: p, pStyle: b, isList: h, content: I };
|
|
6473
6473
|
}
|
|
6474
6474
|
function Re(r, t, e, n, o = !1) {
|
|
@@ -6477,11 +6477,11 @@ function Re(r, t, e, n, o = !1) {
|
|
|
6477
6477
|
if (s.nodeType !== 1) continue;
|
|
6478
6478
|
const l = s.localName;
|
|
6479
6479
|
if (l === "r") {
|
|
6480
|
-
if (o &&
|
|
6481
|
-
i +=
|
|
6480
|
+
if (o && sa(s)) continue;
|
|
6481
|
+
i += la(s, t);
|
|
6482
6482
|
} else if (l === "hyperlink") {
|
|
6483
|
-
const a = s.getAttribute("r:id") || s.getAttributeNS(
|
|
6484
|
-
i += `<a href="${
|
|
6483
|
+
const a = s.getAttribute("r:id") || s.getAttributeNS(Ql, "id"), c = a && n.get(a) || "#", u = Re(s, t, e, n, o);
|
|
6484
|
+
i += `<a href="${xn(c)}">${u}</a>`;
|
|
6485
6485
|
} else if (l === "ins") {
|
|
6486
6486
|
const a = Re(s, t, e, n, o);
|
|
6487
6487
|
a && (i += `<span data-word-rev="ins" style="background:rgba(255,230,150,.6);">${a}</span>`);
|
|
@@ -6492,29 +6492,29 @@ function Re(r, t, e, n, o = !1) {
|
|
|
6492
6492
|
}
|
|
6493
6493
|
return i;
|
|
6494
6494
|
}
|
|
6495
|
-
function
|
|
6495
|
+
function sa(r) {
|
|
6496
6496
|
for (const t of r.childNodes)
|
|
6497
6497
|
if (t.nodeType === 1 && t.localName === "br" && t.getAttribute("w:type") === "column")
|
|
6498
6498
|
return !0;
|
|
6499
6499
|
return !1;
|
|
6500
6500
|
}
|
|
6501
|
-
function
|
|
6502
|
-
const e = v(r, "rPr"), n = e ?
|
|
6501
|
+
function la(r, t) {
|
|
6502
|
+
const e = v(r, "rPr"), n = e ? Bn(e) : {}, o = { ...t, ...n };
|
|
6503
6503
|
let i = "";
|
|
6504
6504
|
for (const f of r.childNodes)
|
|
6505
6505
|
f.nodeType === 1 && (f.localName === "t" || f.localName === "delText" ? i += f.textContent : f.localName === "br" ? f.getAttribute("w:type") !== "column" && (i += `
|
|
6506
6506
|
`) : f.localName === "tab" && (i += " "));
|
|
6507
6507
|
if (!i) return "";
|
|
6508
6508
|
const a = i.split(`
|
|
6509
|
-
`).map((f) => /^[ \t]+$/.test(f) ? f.replace(/ /g, " ").replace(/\t/g, " ") : xo(f)).join("<br/>"), c =
|
|
6509
|
+
`).map((f) => /^[ \t]+$/.test(f) ? f.replace(/ /g, " ").replace(/\t/g, " ") : xo(f)).join("<br/>"), c = fa(o);
|
|
6510
6510
|
let u = "";
|
|
6511
|
-
return o.lang && (u += ` data-word-lang="${
|
|
6511
|
+
return o.lang && (u += ` data-word-lang="${xn(String(o.lang))}"`), o.langEastAsia && (u += ` data-word-lang-eastAsia="${xn(String(o.langEastAsia))}"`), o.noProof && (u += ' data-word-no-proof="1"'), c || u ? `<span${c ? ` style="${c}"` : ""}${u}>${a}</span>` : a;
|
|
6512
6512
|
}
|
|
6513
6513
|
function yo(r, t, e, n = 0) {
|
|
6514
|
-
const o = v(r, "tblPr"), i =
|
|
6514
|
+
const o = v(r, "tblPr"), i = aa(o), s = ca(o), l = o ? v(o, "tblW") : null, a = l?.getAttribute("w:type") || "", c = l && parseInt(l.getAttribute("w:w"), 10) || 0;
|
|
6515
6515
|
let u = "100%";
|
|
6516
6516
|
a === "pct" && c > 0 ? u = `${(c / 50).toFixed(1)}%` : a === "dxa" && c > 0 && n > 0 && (u = `${Math.min(c / n * 100, 100).toFixed(1)}%`);
|
|
6517
|
-
const f = o ? v(o, "tblCellMar") : null, d =
|
|
6517
|
+
const f = o ? v(o, "tblCellMar") : null, d = fr(f) ?? { top: 0, right: 108, bottom: 0, left: 108 }, h = v(r, "tblGrid"), m = [];
|
|
6518
6518
|
if (h) {
|
|
6519
6519
|
for (const T of h.childNodes)
|
|
6520
6520
|
if (T.nodeType === 1 && T.localName === "gridCol") {
|
|
@@ -6554,8 +6554,8 @@ function yo(r, t, e, n = 0) {
|
|
|
6554
6554
|
} else
|
|
6555
6555
|
I = 1;
|
|
6556
6556
|
const R = b > 0 && p.length > 0 ? p.map((T) => (T / b * 100).toFixed(2)) : Array.from({ length: I }, () => (100 / I).toFixed(2));
|
|
6557
|
-
let
|
|
6558
|
-
R.length && (
|
|
6557
|
+
let L = "";
|
|
6558
|
+
R.length && (L = `<colgroup>${R.map((O) => `<col style="width:${O}%"/>`).join("")}</colgroup>`);
|
|
6559
6559
|
const Z = (o ? v(o, "jc") : null)?.getAttribute("w:val") || "left", at = `border-collapse:collapse;table-layout:fixed;width:${u};${Z === "center" ? "margin:0 auto;" : ""}`, W = [];
|
|
6560
6560
|
for (const T of r.childNodes) {
|
|
6561
6561
|
if (T.nodeType !== 1 || T.localName !== "tr") continue;
|
|
@@ -6589,7 +6589,7 @@ function yo(r, t, e, n = 0) {
|
|
|
6589
6589
|
let O = "";
|
|
6590
6590
|
for (const B of T) {
|
|
6591
6591
|
if (B.vMerge === "continue") continue;
|
|
6592
|
-
const { tc: U, tcPrEl: j, colspan: ot, rowspan: wt = 1 } = B, Ut =
|
|
6592
|
+
const { tc: U, tcPrEl: j, colspan: ot, rowspan: wt = 1 } = B, Ut = ua(j, i) ? "border:1px solid #d0d0d0;" : "border:none;", Ft = (j ? v(j, "vAlign") : null)?.getAttribute("w:val") || "top", Xe = Ft === "center" ? "middle" : Ft === "bottom" ? "bottom" : "top", me = j ? v(j, "tcMar") : null, vt = fr(me) ?? d, te = Ee(vt.top ?? d.top ?? 0), Gt = Ee(vt.right ?? d.right ?? 108), Ze = Ee(vt.bottom ?? d.bottom ?? 0), Qe = Ee(vt.left ?? d.left ?? 108), Kt = `padding:${te}px ${Gt}px ${Ze}px ${Qe}px;`;
|
|
6593
6593
|
let ee = "";
|
|
6594
6594
|
for (const Et of U.childNodes)
|
|
6595
6595
|
if (Et.nodeType === 1)
|
|
@@ -6603,9 +6603,9 @@ function yo(r, t, e, n = 0) {
|
|
|
6603
6603
|
Ht += `<tr>${O}</tr>`;
|
|
6604
6604
|
}
|
|
6605
6605
|
const Ke = s ? ` data-word-tbl-borders='${JSON.stringify(s)}'` : "";
|
|
6606
|
-
return `<table style="${at}"${Ke}>${
|
|
6606
|
+
return `<table style="${at}"${Ke}>${L}${Ht}</table>`;
|
|
6607
6607
|
}
|
|
6608
|
-
function
|
|
6608
|
+
function aa(r) {
|
|
6609
6609
|
if (!r) return !0;
|
|
6610
6610
|
const t = v(r, "tblBorders");
|
|
6611
6611
|
if (!t) return !0;
|
|
@@ -6623,7 +6623,7 @@ function ca(r) {
|
|
|
6623
6623
|
}
|
|
6624
6624
|
return !n;
|
|
6625
6625
|
}
|
|
6626
|
-
function
|
|
6626
|
+
function ca(r) {
|
|
6627
6627
|
if (!r) return null;
|
|
6628
6628
|
const t = v(r, "tblBorders");
|
|
6629
6629
|
if (!t) return null;
|
|
@@ -6632,7 +6632,7 @@ function ua(r) {
|
|
|
6632
6632
|
const n = e.getAttribute("w:val") || "", o = e.getAttribute("w:sz") || "", i = e.getAttribute("w:color") || "", s = e.getAttribute("w:space") || "";
|
|
6633
6633
|
return { val: n, sz: o, color: i, space: s };
|
|
6634
6634
|
}
|
|
6635
|
-
function
|
|
6635
|
+
function ua(r, t) {
|
|
6636
6636
|
if (!r) return t;
|
|
6637
6637
|
const e = v(r, "tcBorders");
|
|
6638
6638
|
if (!e) return t;
|
|
@@ -6650,7 +6650,7 @@ function fa(r, t) {
|
|
|
6650
6650
|
}
|
|
6651
6651
|
return !o;
|
|
6652
6652
|
}
|
|
6653
|
-
function
|
|
6653
|
+
function fr(r) {
|
|
6654
6654
|
if (!r) return null;
|
|
6655
6655
|
const t = {};
|
|
6656
6656
|
for (const e of ["top", "right", "bottom", "left"]) {
|
|
@@ -6665,7 +6665,7 @@ function dr(r) {
|
|
|
6665
6665
|
function Ee(r) {
|
|
6666
6666
|
return Math.round(r / 15);
|
|
6667
6667
|
}
|
|
6668
|
-
function
|
|
6668
|
+
function Bn(r) {
|
|
6669
6669
|
const t = {}, e = v(r, "rFonts");
|
|
6670
6670
|
if (e) {
|
|
6671
6671
|
const f = e.getAttribute("w:eastAsia") || e.getAttribute("w:ascii") || e.getAttribute("w:hAnsi") || e.getAttribute("w:cs") || "";
|
|
@@ -6740,17 +6740,17 @@ function wo(r) {
|
|
|
6740
6740
|
}
|
|
6741
6741
|
return t;
|
|
6742
6742
|
}
|
|
6743
|
-
function
|
|
6743
|
+
function fa(r) {
|
|
6744
6744
|
const t = [];
|
|
6745
6745
|
r.fontFamily && t.push(`font-family:${r.fontFamily}`), r.fontSize && t.push(`font-size:${r.fontSize}`), r.bold && t.push("font-weight:bold"), r.italic && t.push("font-style:italic");
|
|
6746
6746
|
const e = [];
|
|
6747
6747
|
return r.underline && e.push("underline"), r.strike && e.push("line-through"), e.length && t.push(`text-decoration:${e.join(" ")}`), r.color && t.push(`color:${r.color}`), t.join(";");
|
|
6748
6748
|
}
|
|
6749
|
-
function
|
|
6749
|
+
function da(r) {
|
|
6750
6750
|
const t = [];
|
|
6751
6751
|
return r.textAlign && r.textAlign !== "left" && t.push(`text-align:${r.textAlign}`), r.paddingLeft && t.push(`padding-left:${r.paddingLeft}`), r.lineHeight ? t.push(`line-height:${r.lineHeight}`) : r.lineHeightPx && t.push(`line-height:${r.lineHeightPx}`), r.marginTop && t.push(`margin-top:${r.marginTop}`), r.marginBottom && t.push(`margin-bottom:${r.marginBottom}`), t.join(";");
|
|
6752
6752
|
}
|
|
6753
|
-
const
|
|
6753
|
+
const dr = {
|
|
6754
6754
|
Heading1: 1,
|
|
6755
6755
|
Heading2: 2,
|
|
6756
6756
|
Heading3: 3,
|
|
@@ -6764,8 +6764,8 @@ const hr = {
|
|
|
6764
6764
|
5: 5,
|
|
6765
6765
|
6: 6
|
|
6766
6766
|
};
|
|
6767
|
-
function
|
|
6768
|
-
if (
|
|
6767
|
+
function ha(r, t) {
|
|
6768
|
+
if (dr[r] !== void 0) return dr[r];
|
|
6769
6769
|
const e = r.match(/^Heading(\d)$/i) || r.match(/^heading(\d)$/i);
|
|
6770
6770
|
if (e) return parseInt(e[1], 10);
|
|
6771
6771
|
if (t) {
|
|
@@ -6774,7 +6774,7 @@ function pa(r, t) {
|
|
|
6774
6774
|
}
|
|
6775
6775
|
return 0;
|
|
6776
6776
|
}
|
|
6777
|
-
function
|
|
6777
|
+
function Rn(r) {
|
|
6778
6778
|
return new DOMParser().parseFromString(r, "application/xml");
|
|
6779
6779
|
}
|
|
6780
6780
|
function v(r, t) {
|
|
@@ -6786,24 +6786,24 @@ function v(r, t) {
|
|
|
6786
6786
|
function xo(r) {
|
|
6787
6787
|
return String(r).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
6788
6788
|
}
|
|
6789
|
-
function
|
|
6789
|
+
function xn(r) {
|
|
6790
6790
|
return xo(r).replace(/"/g, """);
|
|
6791
6791
|
}
|
|
6792
|
-
const
|
|
6792
|
+
const pa = { class: "app-layout" }, ma = { class: "editor-wrapper" }, ga = { class: "umo-editor-instance" }, ya = ["disabled"], wa = { class: "umo-custom-huge-btn__text" }, xa = ["disabled"], ka = { class: "umo-custom-huge-btn__text" }, ba = ["disabled"], va = { class: "umo-custom-huge-btn__text" }, Sa = { class: "umo-custom-huge-btn__icon" }, Ca = {
|
|
6793
6793
|
viewBox: "0 0 24 24",
|
|
6794
6794
|
fill: "none",
|
|
6795
6795
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6796
|
-
},
|
|
6796
|
+
}, Ta = {
|
|
6797
6797
|
key: 0,
|
|
6798
6798
|
d: "M12 14l2 2 4-4",
|
|
6799
6799
|
stroke: "currentColor",
|
|
6800
6800
|
"stroke-width": "1.5",
|
|
6801
6801
|
"stroke-linecap": "round",
|
|
6802
6802
|
"stroke-linejoin": "round"
|
|
6803
|
-
},
|
|
6803
|
+
}, Aa = { class: "umo-custom-huge-btn__text" }, Ma = {
|
|
6804
6804
|
key: 1,
|
|
6805
6805
|
class: "editor-placeholder"
|
|
6806
|
-
},
|
|
6806
|
+
}, Ea = { class: "html-dialog" }, Na = { class: "html-dialog__header" }, Ia = { class: "html-dialog__toolbar" }, Oa = { class: "html-dialog__content" }, $a = {
|
|
6807
6807
|
__name: "App",
|
|
6808
6808
|
props: {
|
|
6809
6809
|
cdnUrl: {
|
|
@@ -6869,12 +6869,12 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6869
6869
|
cancelPendingDelete: R
|
|
6870
6870
|
} = xr();
|
|
6871
6871
|
z(!0);
|
|
6872
|
-
const
|
|
6872
|
+
const L = z(null), H = z([]), Z = () => L.value, at = () => L.value?.querySelector?.(".umo-scrollable-container") || L.value?.querySelector?.(".umo-scrollable") || L.value, W = (g, w) => {
|
|
6873
6873
|
if (!g || g.__gutterMounted) return;
|
|
6874
6874
|
g.__gutterMounted = !0, Io({
|
|
6875
6875
|
setup() {
|
|
6876
6876
|
const M = (A) => {
|
|
6877
|
-
|
|
6877
|
+
zn(A);
|
|
6878
6878
|
try {
|
|
6879
6879
|
w?.commands?.focusComment?.(A);
|
|
6880
6880
|
} catch {
|
|
@@ -6929,7 +6929,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6929
6929
|
}, bt = async (g) => {
|
|
6930
6930
|
ut.value || (ut.value = crypto.randomUUID()), ot.value = !0;
|
|
6931
6931
|
try {
|
|
6932
|
-
const w = await
|
|
6932
|
+
const w = await Yl(g);
|
|
6933
6933
|
let C = pt();
|
|
6934
6934
|
for (let E = 0; E < 40 && !C; E++)
|
|
6935
6935
|
await new Promise((It) => setTimeout(It, 50)), C = pt();
|
|
@@ -6937,7 +6937,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6937
6937
|
C.commands.setContent(w, !1);
|
|
6938
6938
|
const M = C.view.dom;
|
|
6939
6939
|
Et(M), await new Promise((E) => setTimeout(E, 50)), Et(M);
|
|
6940
|
-
const A = await
|
|
6940
|
+
const A = await Gl(g);
|
|
6941
6941
|
if (A.length === 0) {
|
|
6942
6942
|
s(), console.info("[Word 导入] 文档导入成功,未检测到批注");
|
|
6943
6943
|
return;
|
|
@@ -6994,7 +6994,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6994
6994
|
return typeof K == "string" && /line-through/i.test(K);
|
|
6995
6995
|
}
|
|
6996
6996
|
return !1;
|
|
6997
|
-
}), re = (_) => !_ || _.length !== 1 ? null : _[0] || null, we = (_) => _ && _.length > 0 ? _[0] : null,
|
|
6997
|
+
}), re = (_) => !_ || _.length !== 1 ? null : _[0] || null, we = (_) => _ && _.length > 0 ? _[0] : null, Pn = (_) => {
|
|
6998
6998
|
const G = [];
|
|
6999
6999
|
return Nt.descendants((N, K) => {
|
|
7000
7000
|
if (N.isText && !(_ && !ne(N))) {
|
|
@@ -7047,25 +7047,25 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7047
7047
|
return ke;
|
|
7048
7048
|
};
|
|
7049
7049
|
if (It) {
|
|
7050
|
-
const _ =
|
|
7050
|
+
const _ = Pn(!0), G = we(_);
|
|
7051
7051
|
if (G)
|
|
7052
7052
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7053
7053
|
}
|
|
7054
|
-
const ko =
|
|
7055
|
-
if (
|
|
7056
|
-
return g.chain().setTextSelection(
|
|
7054
|
+
const ko = Pn(!1), Fn = re(ko);
|
|
7055
|
+
if (Fn)
|
|
7056
|
+
return g.chain().setTextSelection(Fn).addComment(C, M).run(), !0;
|
|
7057
7057
|
if (It) {
|
|
7058
7058
|
const _ = xe(E, !0), G = we(_);
|
|
7059
7059
|
if (G)
|
|
7060
7060
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7061
7061
|
}
|
|
7062
7062
|
let en = xe(E, !1);
|
|
7063
|
-
const
|
|
7064
|
-
if (
|
|
7065
|
-
return g.chain().setTextSelection(
|
|
7066
|
-
const
|
|
7067
|
-
if (
|
|
7068
|
-
const _ = E.slice(0,
|
|
7063
|
+
const _n = re(en);
|
|
7064
|
+
if (_n)
|
|
7065
|
+
return g.chain().setTextSelection(_n).addComment(C, M).run(), !0;
|
|
7066
|
+
const Dn = Math.min(30, Math.max(8, Math.floor(E.length * 0.6)));
|
|
7067
|
+
if (Dn < E.length) {
|
|
7068
|
+
const _ = E.slice(0, Dn);
|
|
7069
7069
|
if (It) {
|
|
7070
7070
|
const N = xe(_, !0), K = re(N);
|
|
7071
7071
|
if (K)
|
|
@@ -7199,7 +7199,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7199
7199
|
pt()?.commands.removeComment(g), await m(g);
|
|
7200
7200
|
}, tn = async (g) => {
|
|
7201
7201
|
await p(g);
|
|
7202
|
-
},
|
|
7202
|
+
}, zn = (g) => {
|
|
7203
7203
|
const w = "rgba(251, 191, 36, 0.95)";
|
|
7204
7204
|
document.querySelectorAll(`.comment-mark[data-comment-id="${g}"]`).forEach((M) => {
|
|
7205
7205
|
if (!(M instanceof HTMLElement)) return;
|
|
@@ -7213,17 +7213,17 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7213
7213
|
C?.commands.focusComment(g);
|
|
7214
7214
|
}, 0);
|
|
7215
7215
|
};
|
|
7216
|
-
return
|
|
7216
|
+
return gr(() => {
|
|
7217
7217
|
ut.value || (ut.value = crypto.randomUUID()), e.value || (e.value = "未命名文档");
|
|
7218
7218
|
}), To(() => {
|
|
7219
7219
|
}), (g, w) => {
|
|
7220
7220
|
const C = Ao("umo-editor");
|
|
7221
|
-
return q(), rt("div",
|
|
7222
|
-
y("div",
|
|
7223
|
-
y("div",
|
|
7221
|
+
return q(), rt("div", pa, [
|
|
7222
|
+
y("div", ma, [
|
|
7223
|
+
y("div", ga, [
|
|
7224
7224
|
y("div", {
|
|
7225
7225
|
ref_key: "editorStageRef",
|
|
7226
|
-
ref:
|
|
7226
|
+
ref: L,
|
|
7227
7227
|
class: "umo-editor-stage"
|
|
7228
7228
|
}, [
|
|
7229
7229
|
oe(ut) ? (q(), Ie(C, Mo({
|
|
@@ -7274,8 +7274,8 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7274
7274
|
})
|
|
7275
7275
|
])
|
|
7276
7276
|
], -1)),
|
|
7277
|
-
y("span",
|
|
7278
|
-
], 8,
|
|
7277
|
+
y("span", wa, Y(ot.value ? "导入中…" : "导入 Word"), 1)
|
|
7278
|
+
], 8, ya),
|
|
7279
7279
|
y("button", {
|
|
7280
7280
|
class: "umo-custom-huge-btn",
|
|
7281
7281
|
disabled: T.value,
|
|
@@ -7310,8 +7310,8 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7310
7310
|
})
|
|
7311
7311
|
])
|
|
7312
7312
|
], -1)),
|
|
7313
|
-
y("span",
|
|
7314
|
-
], 8,
|
|
7313
|
+
y("span", ka, Y(T.value ? "导出中…" : "导出 Word"), 1)
|
|
7314
|
+
], 8, xa),
|
|
7315
7315
|
y("button", {
|
|
7316
7316
|
class: "umo-custom-huge-btn",
|
|
7317
7317
|
disabled: B.value,
|
|
@@ -7346,8 +7346,8 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7346
7346
|
})
|
|
7347
7347
|
])
|
|
7348
7348
|
], -1)),
|
|
7349
|
-
y("span",
|
|
7350
|
-
], 8,
|
|
7349
|
+
y("span", va, Y(B.value ? "生成中…" : "Word 流下载"), 1)
|
|
7350
|
+
], 8, ba),
|
|
7351
7351
|
y("button", {
|
|
7352
7352
|
class: "umo-custom-huge-btn",
|
|
7353
7353
|
onClick: Ze
|
|
@@ -7387,8 +7387,8 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7387
7387
|
class: "umo-custom-huge-btn",
|
|
7388
7388
|
onClick: ee
|
|
7389
7389
|
}, [
|
|
7390
|
-
y("span",
|
|
7391
|
-
(q(), rt("svg",
|
|
7390
|
+
y("span", Sa, [
|
|
7391
|
+
(q(), rt("svg", Ca, [
|
|
7392
7392
|
w[7] || (w[7] = y("rect", {
|
|
7393
7393
|
x: "9",
|
|
7394
7394
|
y: "9",
|
|
@@ -7407,45 +7407,45 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7407
7407
|
"stroke-linecap": "round",
|
|
7408
7408
|
"stroke-linejoin": "round"
|
|
7409
7409
|
}, null, -1)),
|
|
7410
|
-
Kt.value ? (q(), rt("path",
|
|
7410
|
+
Kt.value ? (q(), rt("path", Ta)) : le("", !0)
|
|
7411
7411
|
]))
|
|
7412
7412
|
]),
|
|
7413
|
-
y("span",
|
|
7413
|
+
y("span", Aa, Y(Kt.value ? "已复制" : "复制 HTML"), 1)
|
|
7414
7414
|
])
|
|
7415
7415
|
]),
|
|
7416
7416
|
_: 1
|
|
7417
|
-
}, 16)) : (q(), rt("div",
|
|
7417
|
+
}, 16)) : (q(), rt("div", Ma, [...w[9] || (w[9] = [
|
|
7418
7418
|
y("p", null, "正在初始化编辑器,请稍候…", -1)
|
|
7419
7419
|
])]))
|
|
7420
7420
|
], 512)
|
|
7421
7421
|
])
|
|
7422
7422
|
]),
|
|
7423
7423
|
No(ni, {
|
|
7424
|
-
onActivate:
|
|
7424
|
+
onActivate: zn,
|
|
7425
7425
|
onDelete: Ye,
|
|
7426
7426
|
onResolve: tn
|
|
7427
7427
|
}),
|
|
7428
|
-
(q(), Ie(
|
|
7428
|
+
(q(), Ie(yr, { to: "body" }, [
|
|
7429
7429
|
vt.value ? (q(), rt("div", {
|
|
7430
7430
|
key: 0,
|
|
7431
7431
|
class: "html-dialog-mask",
|
|
7432
7432
|
onClick: w[1] || (w[1] = ze((M) => vt.value = !1, ["self"]))
|
|
7433
7433
|
}, [
|
|
7434
|
-
y("div",
|
|
7435
|
-
y("div",
|
|
7434
|
+
y("div", Ea, [
|
|
7435
|
+
y("div", Na, [
|
|
7436
7436
|
w[10] || (w[10] = y("span", { class: "html-dialog__title" }, "导出 HTML", -1)),
|
|
7437
7437
|
y("button", {
|
|
7438
7438
|
class: "html-dialog__close",
|
|
7439
7439
|
onClick: w[0] || (w[0] = (M) => vt.value = !1)
|
|
7440
7440
|
}, "✕")
|
|
7441
7441
|
]),
|
|
7442
|
-
y("div",
|
|
7442
|
+
y("div", Ia, [
|
|
7443
7443
|
y("button", {
|
|
7444
7444
|
class: "html-dialog__copy-btn",
|
|
7445
7445
|
onClick: Qe
|
|
7446
7446
|
}, Y(Gt.value ? "✓ 已复制" : "复制"), 1)
|
|
7447
7447
|
]),
|
|
7448
|
-
y("pre",
|
|
7448
|
+
y("pre", Oa, [
|
|
7449
7449
|
y("code", null, Y(te.value), 1)
|
|
7450
7450
|
])
|
|
7451
7451
|
])
|
|
@@ -7461,16 +7461,16 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7461
7461
|
]);
|
|
7462
7462
|
};
|
|
7463
7463
|
}
|
|
7464
|
-
},
|
|
7464
|
+
}, Ba = /* @__PURE__ */ He($a, [["__scopeId", "data-v-d6ad3b04"]]);
|
|
7465
7465
|
function _a() {
|
|
7466
7466
|
}
|
|
7467
7467
|
const Da = {
|
|
7468
7468
|
install(r, t) {
|
|
7469
|
-
r.use(bo, t ?? {}), r.component("UmoEditorApp",
|
|
7469
|
+
r.use(bo, t ?? {}), r.component("UmoEditorApp", Ba);
|
|
7470
7470
|
}
|
|
7471
7471
|
};
|
|
7472
7472
|
export {
|
|
7473
|
-
|
|
7473
|
+
Ba as UmoEditorApp,
|
|
7474
7474
|
Da as UmoEditorAppPlugin,
|
|
7475
7475
|
_a as ensureUmoEditorGlobals
|
|
7476
7476
|
};
|