ai-word-editor 0.0.25 → 0.0.26
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 +598 -599
- package/package.json +1 -1
- package/src/utils/wordCommentImport.js +5 -2
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { useUmoEditor as
|
|
2
|
-
import { ref as z, computed as Ne, openBlock as q, createElementBlock as rt, createElementVNode as y, createTextVNode as
|
|
3
|
-
import { e as
|
|
4
|
-
import * as
|
|
5
|
-
|
|
6
|
-
const Po = "http://localhost:8000";
|
|
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 pr, renderList as mr, normalizeClass as gr, onMounted as yr, createBlock as Ie, Teleport as wr, 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-CYxYyGfR.js";
|
|
4
|
+
import * as pn from "jszip";
|
|
5
|
+
const zo = "http://localhost:8000";
|
|
7
6
|
async function Tt(r, t = {}) {
|
|
8
7
|
const e = {
|
|
9
8
|
"Content-Type": "application/json",
|
|
10
9
|
...t.headers
|
|
11
|
-
}, n = await fetch(`${
|
|
10
|
+
}, n = await fetch(`${zo}${r}`, {
|
|
12
11
|
...t,
|
|
13
12
|
headers: e
|
|
14
13
|
});
|
|
@@ -18,7 +17,7 @@ async function Tt(r, t = {}) {
|
|
|
18
17
|
throw new Error(o.detail || `请求失败 (${n.status})`);
|
|
19
18
|
return o;
|
|
20
19
|
}
|
|
21
|
-
const
|
|
20
|
+
const Po = {
|
|
22
21
|
list() {
|
|
23
22
|
return Tt("/api/documents");
|
|
24
23
|
},
|
|
@@ -68,17 +67,17 @@ const Fo = {
|
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
69
|
}, tt = 20, Ct = z([]), ve = z(null), ut = z(null), ft = /* @__PURE__ */ new Map(), yt = /* @__PURE__ */ new Map(), xt = /* @__PURE__ */ new Set();
|
|
71
|
-
function
|
|
70
|
+
function Fo(r, t) {
|
|
72
71
|
const e = Number.parseInt(r, 10);
|
|
73
72
|
return ((Number.isNaN(e) ? t : e) % tt + tt) % tt;
|
|
74
73
|
}
|
|
75
|
-
function
|
|
74
|
+
function _o(r, t) {
|
|
76
75
|
if (xt.delete(t.id), ft.set(t.id, { ...t, docId: r }), yt.has(t.id)) {
|
|
77
76
|
const e = yt.get(t.id);
|
|
78
77
|
yt.delete(t.id), ft.set(t.id, { ...ft.get(t.id), ...e });
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
function
|
|
80
|
+
function Do(r, t) {
|
|
82
81
|
if (xt.has(r)) return;
|
|
83
82
|
if (ft.has(r)) {
|
|
84
83
|
ft.set(r, { ...ft.get(r), ...t });
|
|
@@ -87,20 +86,20 @@ function Jo(r, t) {
|
|
|
87
86
|
const e = yt.get(r) || {};
|
|
88
87
|
yt.set(r, { ...e, ...t });
|
|
89
88
|
}
|
|
90
|
-
function
|
|
89
|
+
function Wn(r) {
|
|
91
90
|
if (ft.has(r)) {
|
|
92
91
|
ft.delete(r), yt.delete(r), xt.delete(r);
|
|
93
92
|
return;
|
|
94
93
|
}
|
|
95
94
|
yt.delete(r), xt.add(r);
|
|
96
95
|
}
|
|
97
|
-
function
|
|
96
|
+
function Jo(r) {
|
|
98
97
|
xt.delete(r);
|
|
99
98
|
}
|
|
100
|
-
function
|
|
99
|
+
function Lo() {
|
|
101
100
|
ft.clear(), yt.clear(), xt.clear();
|
|
102
101
|
}
|
|
103
|
-
async function
|
|
102
|
+
async function Wo(r) {
|
|
104
103
|
if (!r || ft.size === 0 && yt.size === 0 && xt.size === 0) return;
|
|
105
104
|
const t = Array.from(ft.values()).filter((o) => o && o.docId === r).map((o) => ({
|
|
106
105
|
id: o.id,
|
|
@@ -119,7 +118,7 @@ async function jo(r) {
|
|
|
119
118
|
for (const o of n)
|
|
120
119
|
await Oe.delete(r, o), xt.delete(o);
|
|
121
120
|
}
|
|
122
|
-
function
|
|
121
|
+
function xr() {
|
|
123
122
|
return {
|
|
124
123
|
comments: Ct,
|
|
125
124
|
activeCommentId: ve,
|
|
@@ -144,7 +143,7 @@ function wr() {
|
|
|
144
143
|
addComment: async ({ id: s, selectedText: l, note: a, author: c = "我", colorIndex: u }) => {
|
|
145
144
|
const f = ut.value;
|
|
146
145
|
if (!f) return;
|
|
147
|
-
const d =
|
|
146
|
+
const d = Fo(
|
|
148
147
|
u,
|
|
149
148
|
Ct.value.length % tt
|
|
150
149
|
), h = {
|
|
@@ -156,7 +155,7 @@ function wr() {
|
|
|
156
155
|
resolved: !1,
|
|
157
156
|
colorIndex: d
|
|
158
157
|
};
|
|
159
|
-
Ct.value.push(h),
|
|
158
|
+
Ct.value.push(h), _o(f, {
|
|
160
159
|
id: s,
|
|
161
160
|
selectedText: l,
|
|
162
161
|
note: a,
|
|
@@ -169,14 +168,14 @@ function wr() {
|
|
|
169
168
|
const l = Ct.value.slice();
|
|
170
169
|
Ct.value = Ct.value.filter((a) => a.id !== s), ve.value === s && (ve.value = null);
|
|
171
170
|
try {
|
|
172
|
-
|
|
171
|
+
Wn(s);
|
|
173
172
|
} catch (a) {
|
|
174
173
|
Ct.value = l, console.error("删除批注入队失败:", a);
|
|
175
174
|
}
|
|
176
175
|
},
|
|
177
176
|
resolveComment: async (s) => {
|
|
178
177
|
const l = Ct.value.find((a) => a.id === s);
|
|
179
|
-
l && (l.resolved = !l.resolved,
|
|
178
|
+
l && (l.resolved = !l.resolved, Do(s, { resolved: l.resolved }));
|
|
180
179
|
},
|
|
181
180
|
setActiveComment: (s) => {
|
|
182
181
|
ve.value = s;
|
|
@@ -185,11 +184,11 @@ function wr() {
|
|
|
185
184
|
const l = new Date(s), a = (c) => String(c).padStart(2, "0");
|
|
186
185
|
return `${l.getMonth() + 1}/${l.getDate()} ${a(l.getHours())}:${a(l.getMinutes())}`;
|
|
187
186
|
},
|
|
188
|
-
flushPending:
|
|
189
|
-
resetPending:
|
|
187
|
+
flushPending: Wo,
|
|
188
|
+
resetPending: Lo,
|
|
190
189
|
// 供 App.vue 的“孤立批注软删除/撤销”逻辑使用
|
|
191
|
-
queueDelete:
|
|
192
|
-
cancelPendingDelete:
|
|
190
|
+
queueDelete: Wn,
|
|
191
|
+
cancelPendingDelete: Jo
|
|
193
192
|
};
|
|
194
193
|
}
|
|
195
194
|
const He = (r, t) => {
|
|
@@ -197,37 +196,37 @@ const He = (r, t) => {
|
|
|
197
196
|
for (const [n, o] of t)
|
|
198
197
|
e[n] = o;
|
|
199
198
|
return e;
|
|
200
|
-
},
|
|
199
|
+
}, jo = { class: "comment-panel" }, Vo = { class: "comment-panel__header" }, qo = { class: "comment-panel__title" }, Ho = {
|
|
201
200
|
key: 0,
|
|
202
201
|
class: "comment-panel__badge"
|
|
203
|
-
},
|
|
202
|
+
}, Uo = {
|
|
204
203
|
key: 0,
|
|
205
204
|
class: "comment-panel__empty"
|
|
206
|
-
},
|
|
205
|
+
}, Go = {
|
|
207
206
|
key: 1,
|
|
208
207
|
class: "comment-panel__list"
|
|
209
|
-
},
|
|
208
|
+
}, Ko = ["onClick"], Xo = { class: "comment-item__quote" }, Zo = { class: "comment-item__note" }, Qo = { class: "comment-item__meta" }, Yo = { class: "comment-item__author" }, ti = { class: "comment-item__time" }, ei = {
|
|
210
209
|
__name: "CommentPanel",
|
|
211
210
|
emits: ["activate", "delete", "resolve"],
|
|
212
211
|
setup(r, { emit: t }) {
|
|
213
|
-
const { comments: e, activeCommentId: n, setActiveComment: o, formatTime: i } =
|
|
212
|
+
const { comments: e, activeCommentId: n, setActiveComment: o, formatTime: i } = xr(), s = t, l = Ne(() => e.value.filter((u) => !u.resolved).length), a = (u, f) => u ? u.length > f ? u.slice(0, f) + "…" : u : "", c = (u) => {
|
|
214
213
|
o(u), s("activate", u);
|
|
215
214
|
};
|
|
216
|
-
return (u, f) => (q(), rt("aside",
|
|
217
|
-
y("div",
|
|
218
|
-
y("h3",
|
|
219
|
-
f[0] || (f[0] =
|
|
220
|
-
l.value ? (q(), rt("span",
|
|
215
|
+
return (u, f) => (q(), rt("aside", jo, [
|
|
216
|
+
y("div", Vo, [
|
|
217
|
+
y("h3", qo, [
|
|
218
|
+
f[0] || (f[0] = Ln(" 批注 ", -1)),
|
|
219
|
+
l.value ? (q(), rt("span", Ho, Y(l.value), 1)) : le("", !0)
|
|
221
220
|
])
|
|
222
221
|
]),
|
|
223
|
-
oe(e).length === 0 ? (q(), rt("div",
|
|
222
|
+
oe(e).length === 0 ? (q(), rt("div", Uo, [...f[1] || (f[1] = [
|
|
224
223
|
y("div", { class: "comment-panel__empty-icon" }, "💬", -1),
|
|
225
224
|
y("p", null, "暂无批注", -1),
|
|
226
225
|
y("p", { class: "comment-panel__empty-hint" }, "选中文本后点击「添加批注」", -1)
|
|
227
|
-
])])) : (q(), rt("ul",
|
|
228
|
-
(q(!0), rt(
|
|
226
|
+
])])) : (q(), rt("ul", Go, [
|
|
227
|
+
(q(!0), rt(pr, null, mr(oe(e), (d) => (q(), rt("li", {
|
|
229
228
|
key: d.id,
|
|
230
|
-
class:
|
|
229
|
+
class: gr(["comment-item", [
|
|
231
230
|
`comment-item--c${d.colorIndex ?? 0}`,
|
|
232
231
|
{
|
|
233
232
|
"comment-item--active": oe(n) === d.id,
|
|
@@ -236,23 +235,23 @@ const He = (r, t) => {
|
|
|
236
235
|
]]),
|
|
237
236
|
onClick: (h) => c(d.id)
|
|
238
237
|
}, [
|
|
239
|
-
y("div",
|
|
238
|
+
y("div", Xo, [
|
|
240
239
|
f[2] || (f[2] = y("span", { class: "comment-item__quote-icon" }, "❝", -1)),
|
|
241
|
-
|
|
240
|
+
Ln(" " + Y(a(d.selectedText, 40)), 1)
|
|
242
241
|
]),
|
|
243
|
-
y("div",
|
|
244
|
-
y("div",
|
|
245
|
-
y("span",
|
|
246
|
-
y("span",
|
|
242
|
+
y("div", Zo, Y(d.note), 1),
|
|
243
|
+
y("div", Qo, [
|
|
244
|
+
y("span", Yo, Y(d.author), 1),
|
|
245
|
+
y("span", ti, Y(oe(i)(d.createdAt)), 1)
|
|
247
246
|
])
|
|
248
|
-
], 10,
|
|
247
|
+
], 10, Ko))), 128))
|
|
249
248
|
]))
|
|
250
249
|
]));
|
|
251
250
|
}
|
|
252
|
-
},
|
|
251
|
+
}, ni = /* @__PURE__ */ He(ei, [["__scopeId", "data-v-870abb9c"]]), ri = { class: "dialog" }, oi = { class: "dialog__header" }, ii = {
|
|
253
252
|
key: 0,
|
|
254
253
|
class: "dialog__quote"
|
|
255
|
-
},
|
|
254
|
+
}, si = { class: "dialog__quote-text" }, li = { class: "dialog__body" }, ai = ["onKeydown"], ci = { class: "dialog__footer" }, ui = ["disabled"], fi = {
|
|
256
255
|
__name: "CommentAddDialog",
|
|
257
256
|
props: {
|
|
258
257
|
selectedText: {
|
|
@@ -267,35 +266,35 @@ const He = (r, t) => {
|
|
|
267
266
|
emits: ["confirm", "cancel"],
|
|
268
267
|
setup(r, { emit: t }) {
|
|
269
268
|
const e = r, n = t, o = z(e.initialNote), i = z(null);
|
|
270
|
-
|
|
269
|
+
yr(() => {
|
|
271
270
|
i.value?.focus();
|
|
272
271
|
});
|
|
273
272
|
const s = (a, c) => a ? a.length > c ? a.slice(0, c) + "…" : a : "", l = () => {
|
|
274
273
|
o.value.trim() && (n("confirm", o.value.trim()), o.value = "");
|
|
275
274
|
};
|
|
276
|
-
return (a, c) => (q(), Ie(
|
|
275
|
+
return (a, c) => (q(), Ie(wr, { to: "body" }, [
|
|
277
276
|
y("div", {
|
|
278
277
|
class: "dialog-backdrop",
|
|
279
278
|
onClick: c[4] || (c[4] = ze((u) => a.$emit("cancel"), ["self"]))
|
|
280
279
|
}, [
|
|
281
|
-
y("div",
|
|
282
|
-
y("div",
|
|
280
|
+
y("div", ri, [
|
|
281
|
+
y("div", oi, [
|
|
283
282
|
c[5] || (c[5] = y("h4", { class: "dialog__title" }, "添加批注", -1)),
|
|
284
283
|
y("button", {
|
|
285
284
|
class: "dialog__close",
|
|
286
285
|
onClick: c[0] || (c[0] = (u) => a.$emit("cancel"))
|
|
287
286
|
}, "✕")
|
|
288
287
|
]),
|
|
289
|
-
r.selectedText ? (q(), rt("div",
|
|
288
|
+
r.selectedText ? (q(), rt("div", ii, [
|
|
290
289
|
c[6] || (c[6] = y("span", { class: "dialog__quote-label" }, "选中文本", -1)),
|
|
291
|
-
y("blockquote",
|
|
290
|
+
y("blockquote", si, Y(s(r.selectedText, 120)), 1)
|
|
292
291
|
])) : le("", !0),
|
|
293
|
-
y("div",
|
|
292
|
+
y("div", li, [
|
|
294
293
|
c[7] || (c[7] = y("label", {
|
|
295
294
|
class: "dialog__label",
|
|
296
295
|
for: "comment-input"
|
|
297
296
|
}, "批注内容", -1)),
|
|
298
|
-
|
|
297
|
+
vo(y("textarea", {
|
|
299
298
|
id: "comment-input",
|
|
300
299
|
ref_key: "textareaRef",
|
|
301
300
|
ref: i,
|
|
@@ -307,12 +306,12 @@ const He = (r, t) => {
|
|
|
307
306
|
dn(ze(l, ["ctrl"]), ["enter"]),
|
|
308
307
|
c[2] || (c[2] = dn((u) => a.$emit("cancel"), ["escape"]))
|
|
309
308
|
]
|
|
310
|
-
}, null, 40,
|
|
311
|
-
[
|
|
309
|
+
}, null, 40, ai), [
|
|
310
|
+
[So, o.value]
|
|
312
311
|
]),
|
|
313
312
|
c[8] || (c[8] = y("p", { class: "dialog__hint" }, "Ctrl+Enter 确认 · Esc 取消", -1))
|
|
314
313
|
]),
|
|
315
|
-
y("div",
|
|
314
|
+
y("div", ci, [
|
|
316
315
|
y("button", {
|
|
317
316
|
class: "dialog__btn dialog__btn--cancel",
|
|
318
317
|
onClick: c[3] || (c[3] = (u) => a.$emit("cancel"))
|
|
@@ -321,13 +320,13 @@ const He = (r, t) => {
|
|
|
321
320
|
class: "dialog__btn dialog__btn--confirm",
|
|
322
321
|
disabled: !o.value.trim(),
|
|
323
322
|
onClick: l
|
|
324
|
-
}, " 确认添加 ", 8,
|
|
323
|
+
}, " 确认添加 ", 8, ui)
|
|
325
324
|
])
|
|
326
325
|
])
|
|
327
326
|
])
|
|
328
327
|
]));
|
|
329
328
|
}
|
|
330
|
-
},
|
|
329
|
+
}, di = /* @__PURE__ */ He(fi, [["__scopeId", "data-v-8cbc8293"]]);
|
|
331
330
|
function X(r) {
|
|
332
331
|
this.content = r;
|
|
333
332
|
}
|
|
@@ -428,7 +427,7 @@ X.from = function(r) {
|
|
|
428
427
|
if (r) for (var e in r) t.push(e, r[e]);
|
|
429
428
|
return new X(t);
|
|
430
429
|
};
|
|
431
|
-
function
|
|
430
|
+
function kr(r, t, e) {
|
|
432
431
|
for (let n = 0; ; n++) {
|
|
433
432
|
if (n == r.childCount || n == t.childCount)
|
|
434
433
|
return r.childCount == t.childCount ? null : e;
|
|
@@ -445,14 +444,14 @@ function xr(r, t, e) {
|
|
|
445
444
|
return e;
|
|
446
445
|
}
|
|
447
446
|
if (o.content.size || i.content.size) {
|
|
448
|
-
let s =
|
|
447
|
+
let s = kr(o.content, i.content, e + 1);
|
|
449
448
|
if (s != null)
|
|
450
449
|
return s;
|
|
451
450
|
}
|
|
452
451
|
e += o.nodeSize;
|
|
453
452
|
}
|
|
454
453
|
}
|
|
455
|
-
function
|
|
454
|
+
function br(r, t, e, n) {
|
|
456
455
|
for (let o = r.childCount, i = t.childCount; ; ) {
|
|
457
456
|
if (o == 0 || i == 0)
|
|
458
457
|
return o == i ? null : { a: e, b: n };
|
|
@@ -470,7 +469,7 @@ function kr(r, t, e, n) {
|
|
|
470
469
|
return { a: e, b: n };
|
|
471
470
|
}
|
|
472
471
|
if (s.content.size || l.content.size) {
|
|
473
|
-
let c =
|
|
472
|
+
let c = br(s.content, l.content, e - 1, n - 1);
|
|
474
473
|
if (c)
|
|
475
474
|
return c;
|
|
476
475
|
}
|
|
@@ -639,7 +638,7 @@ class x {
|
|
|
639
638
|
fragment differ, or `null` if they are the same.
|
|
640
639
|
*/
|
|
641
640
|
findDiffStart(t, e = 0) {
|
|
642
|
-
return
|
|
641
|
+
return kr(this, t, e);
|
|
643
642
|
}
|
|
644
643
|
/**
|
|
645
644
|
Find the first position, searching from the end, at which this
|
|
@@ -648,7 +647,7 @@ class x {
|
|
|
648
647
|
nodes, an object with two separate positions is returned.
|
|
649
648
|
*/
|
|
650
649
|
findDiffEnd(t, e = this.size, n = t.size) {
|
|
651
|
-
return
|
|
650
|
+
return br(this, t, e, n);
|
|
652
651
|
}
|
|
653
652
|
/**
|
|
654
653
|
Find the index and inner offset corresponding to a given relative
|
|
@@ -758,7 +757,7 @@ function Pe(r, t) {
|
|
|
758
757
|
}
|
|
759
758
|
return !0;
|
|
760
759
|
}
|
|
761
|
-
let L = class
|
|
760
|
+
let L = class mn {
|
|
762
761
|
/**
|
|
763
762
|
@internal
|
|
764
763
|
*/
|
|
@@ -856,8 +855,8 @@ let L = class pn {
|
|
|
856
855
|
*/
|
|
857
856
|
static setFrom(t) {
|
|
858
857
|
if (!t || Array.isArray(t) && t.length == 0)
|
|
859
|
-
return
|
|
860
|
-
if (t instanceof
|
|
858
|
+
return mn.none;
|
|
859
|
+
if (t instanceof mn)
|
|
861
860
|
return [t];
|
|
862
861
|
let e = t.slice();
|
|
863
862
|
return e.sort((n, o) => n.type.rank - o.type.rank), e;
|
|
@@ -892,14 +891,14 @@ class S {
|
|
|
892
891
|
@internal
|
|
893
892
|
*/
|
|
894
893
|
insertAt(t, e) {
|
|
895
|
-
let n =
|
|
894
|
+
let n = Sr(this.content, t + this.openStart, e);
|
|
896
895
|
return n && new S(n, this.openStart, this.openEnd);
|
|
897
896
|
}
|
|
898
897
|
/**
|
|
899
898
|
@internal
|
|
900
899
|
*/
|
|
901
900
|
removeBetween(t, e) {
|
|
902
|
-
return new S(
|
|
901
|
+
return new S(vr(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
|
|
903
902
|
}
|
|
904
903
|
/**
|
|
905
904
|
Tests whether this slice is equal to another slice.
|
|
@@ -947,7 +946,7 @@ class S {
|
|
|
947
946
|
}
|
|
948
947
|
}
|
|
949
948
|
S.empty = new S(x.empty, 0, 0);
|
|
950
|
-
function
|
|
949
|
+
function vr(r, t, e) {
|
|
951
950
|
let { index: n, offset: o } = r.findIndex(t), i = r.maybeChild(n), { index: s, offset: l } = r.findIndex(e);
|
|
952
951
|
if (o == t || i.isText) {
|
|
953
952
|
if (l != e && !r.child(s).isText)
|
|
@@ -956,44 +955,44 @@ function br(r, t, e) {
|
|
|
956
955
|
}
|
|
957
956
|
if (n != s)
|
|
958
957
|
throw new RangeError("Removing non-flat range");
|
|
959
|
-
return r.replaceChild(n, i.copy(
|
|
958
|
+
return r.replaceChild(n, i.copy(vr(i.content, t - o - 1, e - o - 1)));
|
|
960
959
|
}
|
|
961
|
-
function
|
|
960
|
+
function Sr(r, t, e, n) {
|
|
962
961
|
let { index: o, offset: i } = r.findIndex(t), s = r.maybeChild(o);
|
|
963
962
|
if (i == t || s.isText)
|
|
964
963
|
return n && !n.canReplace(o, o, e) ? null : r.cut(0, t).append(e).append(r.cut(t));
|
|
965
|
-
let l =
|
|
964
|
+
let l = Sr(s.content, t - i - 1, e, s);
|
|
966
965
|
return l && r.replaceChild(o, s.copy(l));
|
|
967
966
|
}
|
|
968
|
-
function
|
|
967
|
+
function hi(r, t, e) {
|
|
969
968
|
if (e.openStart > r.depth)
|
|
970
969
|
throw new Fe("Inserted content deeper than insertion position");
|
|
971
970
|
if (r.depth - e.openStart != t.depth - e.openEnd)
|
|
972
971
|
throw new Fe("Inconsistent open depths");
|
|
973
|
-
return
|
|
972
|
+
return Cr(r, t, e, 0);
|
|
974
973
|
}
|
|
975
|
-
function
|
|
974
|
+
function Cr(r, t, e, n) {
|
|
976
975
|
let o = r.index(n), i = r.node(n);
|
|
977
976
|
if (o == t.index(n) && n < r.depth - e.openStart) {
|
|
978
|
-
let s =
|
|
977
|
+
let s = Cr(r, t, e, n + 1);
|
|
979
978
|
return i.copy(i.content.replaceChild(o, s));
|
|
980
979
|
} else if (e.content.size)
|
|
981
980
|
if (!e.openStart && !e.openEnd && r.depth == n && t.depth == n) {
|
|
982
981
|
let s = r.parent, l = s.content;
|
|
983
982
|
return jt(s, l.cut(0, r.parentOffset).append(e.content).append(l.cut(t.parentOffset)));
|
|
984
983
|
} else {
|
|
985
|
-
let { start: s, end: l } =
|
|
986
|
-
return jt(i,
|
|
984
|
+
let { start: s, end: l } = pi(e, r);
|
|
985
|
+
return jt(i, Ar(r, s, l, t, n));
|
|
987
986
|
}
|
|
988
987
|
else return jt(i, _e(r, t, n));
|
|
989
988
|
}
|
|
990
|
-
function
|
|
989
|
+
function Tr(r, t) {
|
|
991
990
|
if (!t.type.compatibleContent(r.type))
|
|
992
991
|
throw new Fe("Cannot join " + t.type.name + " onto " + r.type.name);
|
|
993
992
|
}
|
|
994
|
-
function
|
|
993
|
+
function gn(r, t, e) {
|
|
995
994
|
let n = r.node(e);
|
|
996
|
-
return
|
|
995
|
+
return Tr(n, t.node(e)), n;
|
|
997
996
|
}
|
|
998
997
|
function Wt(r, t) {
|
|
999
998
|
let e = t.length - 1;
|
|
@@ -1009,19 +1008,19 @@ function ae(r, t, e, n) {
|
|
|
1009
1008
|
function jt(r, t) {
|
|
1010
1009
|
return r.type.checkContent(t), r.copy(t);
|
|
1011
1010
|
}
|
|
1012
|
-
function
|
|
1013
|
-
let i = r.depth > o &&
|
|
1014
|
-
return ae(null, r, o, l), i && s && t.index(o) == e.index(o) ? (
|
|
1011
|
+
function Ar(r, t, e, n, o) {
|
|
1012
|
+
let i = r.depth > o && gn(r, t, o + 1), s = n.depth > o && gn(e, n, o + 1), l = [];
|
|
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);
|
|
1015
1014
|
}
|
|
1016
1015
|
function _e(r, t, e) {
|
|
1017
1016
|
let n = [];
|
|
1018
1017
|
if (ae(null, r, e, n), r.depth > e) {
|
|
1019
|
-
let o =
|
|
1018
|
+
let o = gn(r, t, e + 1);
|
|
1020
1019
|
Wt(jt(o, _e(r, t, e + 1)), n);
|
|
1021
1020
|
}
|
|
1022
1021
|
return ae(t, null, e, n), new x(n);
|
|
1023
1022
|
}
|
|
1024
|
-
function
|
|
1023
|
+
function pi(r, t) {
|
|
1025
1024
|
let e = t.depth - r.openStart, o = t.node(e).copy(r.content);
|
|
1026
1025
|
for (let i = e - 1; i >= 0; i--)
|
|
1027
1026
|
o = t.node(i).copy(x.from(o));
|
|
@@ -1264,7 +1263,7 @@ class fe {
|
|
|
1264
1263
|
@internal
|
|
1265
1264
|
*/
|
|
1266
1265
|
static resolveCached(t, e) {
|
|
1267
|
-
let n =
|
|
1266
|
+
let n = jn.get(t);
|
|
1268
1267
|
if (n)
|
|
1269
1268
|
for (let i = 0; i < n.elts.length; i++) {
|
|
1270
1269
|
let s = n.elts[i];
|
|
@@ -1272,17 +1271,17 @@ class fe {
|
|
|
1272
1271
|
return s;
|
|
1273
1272
|
}
|
|
1274
1273
|
else
|
|
1275
|
-
|
|
1274
|
+
jn.set(t, n = new mi());
|
|
1276
1275
|
let o = n.elts[n.i] = fe.resolve(t, e);
|
|
1277
|
-
return n.i = (n.i + 1) %
|
|
1276
|
+
return n.i = (n.i + 1) % gi, o;
|
|
1278
1277
|
}
|
|
1279
1278
|
}
|
|
1280
|
-
class
|
|
1279
|
+
class mi {
|
|
1281
1280
|
constructor() {
|
|
1282
1281
|
this.elts = [], this.i = 0;
|
|
1283
1282
|
}
|
|
1284
1283
|
}
|
|
1285
|
-
const
|
|
1284
|
+
const gi = 12, jn = /* @__PURE__ */ new WeakMap();
|
|
1286
1285
|
class De {
|
|
1287
1286
|
/**
|
|
1288
1287
|
Construct a node range. `$from` and `$to` should point into the
|
|
@@ -1323,7 +1322,7 @@ class De {
|
|
|
1323
1322
|
return this.$to.indexAfter(this.depth);
|
|
1324
1323
|
}
|
|
1325
1324
|
}
|
|
1326
|
-
const
|
|
1325
|
+
const yi = /* @__PURE__ */ Object.create(null);
|
|
1327
1326
|
class kt {
|
|
1328
1327
|
/**
|
|
1329
1328
|
@internal
|
|
@@ -1442,7 +1441,7 @@ class kt {
|
|
|
1442
1441
|
attributes, and marks.
|
|
1443
1442
|
*/
|
|
1444
1443
|
hasMarkup(t, e, n) {
|
|
1445
|
-
return this.type == t && Pe(this.attrs, e || t.defaultAttrs ||
|
|
1444
|
+
return this.type == t && Pe(this.attrs, e || t.defaultAttrs || yi) && L.sameSet(this.marks, n || L.none);
|
|
1446
1445
|
}
|
|
1447
1446
|
/**
|
|
1448
1447
|
Create a new node with the same markup as this node, containing
|
|
@@ -1485,7 +1484,7 @@ class kt {
|
|
|
1485
1484
|
[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
|
|
1486
1485
|
*/
|
|
1487
1486
|
replace(t, e, n) {
|
|
1488
|
-
return
|
|
1487
|
+
return hi(this.resolve(t), this.resolve(e), n);
|
|
1489
1488
|
}
|
|
1490
1489
|
/**
|
|
1491
1490
|
Find the node directly after the given position.
|
|
@@ -1600,7 +1599,7 @@ class kt {
|
|
|
1600
1599
|
if (this.type.spec.toDebugString)
|
|
1601
1600
|
return this.type.spec.toDebugString(this);
|
|
1602
1601
|
let t = this.type.name;
|
|
1603
|
-
return this.content.size && (t += "(" + this.content.toStringInner() + ")"),
|
|
1602
|
+
return this.content.size && (t += "(" + this.content.toStringInner() + ")"), Mr(this.marks, t);
|
|
1604
1603
|
}
|
|
1605
1604
|
/**
|
|
1606
1605
|
Get the content match in this node at the given index.
|
|
@@ -1704,7 +1703,7 @@ class Je extends kt {
|
|
|
1704
1703
|
this.text = n;
|
|
1705
1704
|
}
|
|
1706
1705
|
toString() {
|
|
1707
|
-
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) :
|
|
1706
|
+
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : Mr(this.marks, JSON.stringify(this.text));
|
|
1708
1707
|
}
|
|
1709
1708
|
get textContent() {
|
|
1710
1709
|
return this.text;
|
|
@@ -1732,7 +1731,7 @@ class Je extends kt {
|
|
|
1732
1731
|
return t.text = this.text, t;
|
|
1733
1732
|
}
|
|
1734
1733
|
}
|
|
1735
|
-
function
|
|
1734
|
+
function Mr(r, t) {
|
|
1736
1735
|
for (let e = r.length - 1; e >= 0; e--)
|
|
1737
1736
|
t = r[e].type.name + "(" + t + ")";
|
|
1738
1737
|
return t;
|
|
@@ -1748,13 +1747,13 @@ class Vt {
|
|
|
1748
1747
|
@internal
|
|
1749
1748
|
*/
|
|
1750
1749
|
static parse(t, e) {
|
|
1751
|
-
let n = new
|
|
1750
|
+
let n = new wi(t, e);
|
|
1752
1751
|
if (n.next == null)
|
|
1753
1752
|
return Vt.empty;
|
|
1754
|
-
let o =
|
|
1753
|
+
let o = Er(n);
|
|
1755
1754
|
n.next && n.err("Unexpected trailing text");
|
|
1756
|
-
let i =
|
|
1757
|
-
return
|
|
1755
|
+
let i = Ti(Ci(o));
|
|
1756
|
+
return Ai(i, n), i;
|
|
1758
1757
|
}
|
|
1759
1758
|
/**
|
|
1760
1759
|
Match a node type, returning a match after that node if
|
|
@@ -1900,7 +1899,7 @@ class Vt {
|
|
|
1900
1899
|
}
|
|
1901
1900
|
}
|
|
1902
1901
|
Vt.empty = new Vt(!0);
|
|
1903
|
-
class
|
|
1902
|
+
class wi {
|
|
1904
1903
|
constructor(t, e) {
|
|
1905
1904
|
this.string = t, this.nodeTypes = e, this.inline = null, this.pos = 0, this.tokens = t.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
|
|
1906
1905
|
}
|
|
@@ -1914,22 +1913,22 @@ class xi {
|
|
|
1914
1913
|
throw new SyntaxError(t + " (in content expression '" + this.string + "')");
|
|
1915
1914
|
}
|
|
1916
1915
|
}
|
|
1917
|
-
function
|
|
1916
|
+
function Er(r) {
|
|
1918
1917
|
let t = [];
|
|
1919
1918
|
do
|
|
1920
|
-
t.push(
|
|
1919
|
+
t.push(xi(r));
|
|
1921
1920
|
while (r.eat("|"));
|
|
1922
1921
|
return t.length == 1 ? t[0] : { type: "choice", exprs: t };
|
|
1923
1922
|
}
|
|
1924
|
-
function
|
|
1923
|
+
function xi(r) {
|
|
1925
1924
|
let t = [];
|
|
1926
1925
|
do
|
|
1927
|
-
t.push(
|
|
1926
|
+
t.push(ki(r));
|
|
1928
1927
|
while (r.next && r.next != ")" && r.next != "|");
|
|
1929
1928
|
return t.length == 1 ? t[0] : { type: "seq", exprs: t };
|
|
1930
1929
|
}
|
|
1931
|
-
function
|
|
1932
|
-
let t =
|
|
1930
|
+
function ki(r) {
|
|
1931
|
+
let t = Si(r);
|
|
1933
1932
|
for (; ; )
|
|
1934
1933
|
if (r.eat("+"))
|
|
1935
1934
|
t = { type: "plus", expr: t };
|
|
@@ -1938,21 +1937,21 @@ function bi(r) {
|
|
|
1938
1937
|
else if (r.eat("?"))
|
|
1939
1938
|
t = { type: "opt", expr: t };
|
|
1940
1939
|
else if (r.eat("{"))
|
|
1941
|
-
t =
|
|
1940
|
+
t = bi(r, t);
|
|
1942
1941
|
else
|
|
1943
1942
|
break;
|
|
1944
1943
|
return t;
|
|
1945
1944
|
}
|
|
1946
|
-
function
|
|
1945
|
+
function Vn(r) {
|
|
1947
1946
|
/\D/.test(r.next) && r.err("Expected number, got '" + r.next + "'");
|
|
1948
1947
|
let t = Number(r.next);
|
|
1949
1948
|
return r.pos++, t;
|
|
1950
1949
|
}
|
|
1951
|
-
function
|
|
1952
|
-
let e =
|
|
1953
|
-
return r.eat(",") && (r.next != "}" ? n =
|
|
1950
|
+
function bi(r, t) {
|
|
1951
|
+
let e = Vn(r), n = e;
|
|
1952
|
+
return r.eat(",") && (r.next != "}" ? n = Vn(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: e, max: n, expr: t };
|
|
1954
1953
|
}
|
|
1955
|
-
function
|
|
1954
|
+
function vi(r, t) {
|
|
1956
1955
|
let e = r.nodeTypes, n = e[t];
|
|
1957
1956
|
if (n)
|
|
1958
1957
|
return [n];
|
|
@@ -1963,18 +1962,18 @@ function Si(r, t) {
|
|
|
1963
1962
|
}
|
|
1964
1963
|
return o.length == 0 && r.err("No node type or group '" + t + "' found"), o;
|
|
1965
1964
|
}
|
|
1966
|
-
function
|
|
1965
|
+
function Si(r) {
|
|
1967
1966
|
if (r.eat("(")) {
|
|
1968
|
-
let t =
|
|
1967
|
+
let t = Er(r);
|
|
1969
1968
|
return r.eat(")") || r.err("Missing closing paren"), t;
|
|
1970
1969
|
} else if (/\W/.test(r.next))
|
|
1971
1970
|
r.err("Unexpected token '" + r.next + "'");
|
|
1972
1971
|
else {
|
|
1973
|
-
let t =
|
|
1972
|
+
let t = vi(r, r.next).map((e) => (r.inline == null ? r.inline = e.isInline : r.inline != e.isInline && r.err("Mixing inline and block content"), { type: "name", value: e }));
|
|
1974
1973
|
return r.pos++, t.length == 1 ? t[0] : { type: "choice", exprs: t };
|
|
1975
1974
|
}
|
|
1976
1975
|
}
|
|
1977
|
-
function
|
|
1976
|
+
function Ci(r) {
|
|
1978
1977
|
let t = [[]];
|
|
1979
1978
|
return o(i(r, 0), e()), t;
|
|
1980
1979
|
function e() {
|
|
@@ -2028,12 +2027,12 @@ function Ti(r) {
|
|
|
2028
2027
|
}
|
|
2029
2028
|
}
|
|
2030
2029
|
}
|
|
2031
|
-
function
|
|
2030
|
+
function Nr(r, t) {
|
|
2032
2031
|
return t - r;
|
|
2033
2032
|
}
|
|
2034
|
-
function
|
|
2033
|
+
function qn(r, t) {
|
|
2035
2034
|
let e = [];
|
|
2036
|
-
return n(t), e.sort(
|
|
2035
|
+
return n(t), e.sort(Nr);
|
|
2037
2036
|
function n(o) {
|
|
2038
2037
|
let i = r[o];
|
|
2039
2038
|
if (i.length == 1 && !i[0].term)
|
|
@@ -2045,9 +2044,9 @@ function Vn(r, t) {
|
|
|
2045
2044
|
}
|
|
2046
2045
|
}
|
|
2047
2046
|
}
|
|
2048
|
-
function
|
|
2047
|
+
function Ti(r) {
|
|
2049
2048
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2050
|
-
return e(
|
|
2049
|
+
return e(qn(r, 0));
|
|
2051
2050
|
function e(n) {
|
|
2052
2051
|
let o = [];
|
|
2053
2052
|
n.forEach((s) => {
|
|
@@ -2057,20 +2056,20 @@ function Ai(r) {
|
|
|
2057
2056
|
let c;
|
|
2058
2057
|
for (let u = 0; u < o.length; u++)
|
|
2059
2058
|
o[u][0] == l && (c = o[u][1]);
|
|
2060
|
-
|
|
2059
|
+
qn(r, a).forEach((u) => {
|
|
2061
2060
|
c || o.push([l, c = []]), c.indexOf(u) == -1 && c.push(u);
|
|
2062
2061
|
});
|
|
2063
2062
|
});
|
|
2064
2063
|
});
|
|
2065
2064
|
let i = t[n.join(",")] = new Vt(n.indexOf(r.length - 1) > -1);
|
|
2066
2065
|
for (let s = 0; s < o.length; s++) {
|
|
2067
|
-
let l = o[s][1].sort(
|
|
2066
|
+
let l = o[s][1].sort(Nr);
|
|
2068
2067
|
i.next.push({ type: o[s][0], next: t[l.join(",")] || e(l) });
|
|
2069
2068
|
}
|
|
2070
2069
|
return i;
|
|
2071
2070
|
}
|
|
2072
2071
|
}
|
|
2073
|
-
function
|
|
2072
|
+
function Ai(r, t) {
|
|
2074
2073
|
for (let e = 0, n = [r]; e < n.length; e++) {
|
|
2075
2074
|
let o = n[e], i = !o.validEnd, s = [];
|
|
2076
2075
|
for (let l = 0; l < o.next.length; l++) {
|
|
@@ -2080,7 +2079,7 @@ function Mi(r, t) {
|
|
|
2080
2079
|
i && t.err("Only non-generatable nodes (" + s.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
2081
2080
|
}
|
|
2082
2081
|
}
|
|
2083
|
-
function
|
|
2082
|
+
function Ir(r) {
|
|
2084
2083
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2085
2084
|
for (let e in r) {
|
|
2086
2085
|
let n = r[e];
|
|
@@ -2090,7 +2089,7 @@ function Nr(r) {
|
|
|
2090
2089
|
}
|
|
2091
2090
|
return t;
|
|
2092
2091
|
}
|
|
2093
|
-
function
|
|
2092
|
+
function Or(r, t) {
|
|
2094
2093
|
let e = /* @__PURE__ */ Object.create(null);
|
|
2095
2094
|
for (let n in r) {
|
|
2096
2095
|
let o = t && t[n];
|
|
@@ -2105,7 +2104,7 @@ function Ir(r, t) {
|
|
|
2105
2104
|
}
|
|
2106
2105
|
return e;
|
|
2107
2106
|
}
|
|
2108
|
-
function
|
|
2107
|
+
function $r(r, t, e, n) {
|
|
2109
2108
|
for (let o in t)
|
|
2110
2109
|
if (!(o in r))
|
|
2111
2110
|
throw new RangeError(`Unsupported attribute ${o} for ${e} of type ${o}`);
|
|
@@ -2114,11 +2113,11 @@ function Or(r, t, e, n) {
|
|
|
2114
2113
|
i.validate && i.validate(t[o]);
|
|
2115
2114
|
}
|
|
2116
2115
|
}
|
|
2117
|
-
function
|
|
2116
|
+
function Br(r, t) {
|
|
2118
2117
|
let e = /* @__PURE__ */ Object.create(null);
|
|
2119
2118
|
if (t)
|
|
2120
2119
|
for (let n in t)
|
|
2121
|
-
e[n] = new
|
|
2120
|
+
e[n] = new Ei(r, n, t[n]);
|
|
2122
2121
|
return e;
|
|
2123
2122
|
}
|
|
2124
2123
|
class Le {
|
|
@@ -2126,7 +2125,7 @@ class Le {
|
|
|
2126
2125
|
@internal
|
|
2127
2126
|
*/
|
|
2128
2127
|
constructor(t, e, n) {
|
|
2129
|
-
this.name = t, this.schema = e, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs =
|
|
2128
|
+
this.name = t, this.schema = e, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = Br(t, n.attrs), this.defaultAttrs = Ir(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || t == "text"), this.isText = t == "text";
|
|
2130
2129
|
}
|
|
2131
2130
|
/**
|
|
2132
2131
|
True if this is an inline type.
|
|
@@ -2187,7 +2186,7 @@ class Le {
|
|
|
2187
2186
|
@internal
|
|
2188
2187
|
*/
|
|
2189
2188
|
computeAttrs(t) {
|
|
2190
|
-
return !t && this.defaultAttrs ? this.defaultAttrs :
|
|
2189
|
+
return !t && this.defaultAttrs ? this.defaultAttrs : Or(this.attrs, t);
|
|
2191
2190
|
}
|
|
2192
2191
|
/**
|
|
2193
2192
|
Create a `Node` of this type. The given attributes are
|
|
@@ -2254,7 +2253,7 @@ class Le {
|
|
|
2254
2253
|
@internal
|
|
2255
2254
|
*/
|
|
2256
2255
|
checkAttrs(t) {
|
|
2257
|
-
|
|
2256
|
+
$r(this.attrs, t, "node", this.name);
|
|
2258
2257
|
}
|
|
2259
2258
|
/**
|
|
2260
2259
|
Check whether the given mark type is allowed in this node.
|
|
@@ -2300,7 +2299,7 @@ class Le {
|
|
|
2300
2299
|
return n;
|
|
2301
2300
|
}
|
|
2302
2301
|
}
|
|
2303
|
-
function
|
|
2302
|
+
function Mi(r, t, e) {
|
|
2304
2303
|
let n = e.split("|");
|
|
2305
2304
|
return (o) => {
|
|
2306
2305
|
let i = o === null ? "null" : typeof o;
|
|
@@ -2308,21 +2307,21 @@ function Ei(r, t, e) {
|
|
|
2308
2307
|
throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${r}, got ${i}`);
|
|
2309
2308
|
};
|
|
2310
2309
|
}
|
|
2311
|
-
class
|
|
2310
|
+
class Ei {
|
|
2312
2311
|
constructor(t, e, n) {
|
|
2313
|
-
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ?
|
|
2312
|
+
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Mi(t, e, n.validate) : n.validate;
|
|
2314
2313
|
}
|
|
2315
2314
|
get isRequired() {
|
|
2316
2315
|
return !this.hasDefault;
|
|
2317
2316
|
}
|
|
2318
2317
|
}
|
|
2319
|
-
class
|
|
2318
|
+
class bn {
|
|
2320
2319
|
/**
|
|
2321
2320
|
@internal
|
|
2322
2321
|
*/
|
|
2323
2322
|
constructor(t, e, n, o) {
|
|
2324
|
-
this.name = t, this.rank = e, this.schema = n, this.spec = o, this.attrs =
|
|
2325
|
-
let i =
|
|
2323
|
+
this.name = t, this.rank = e, this.schema = n, this.spec = o, this.attrs = Br(t, o.attrs), this.excluded = null;
|
|
2324
|
+
let i = Ir(this.attrs);
|
|
2326
2325
|
this.instance = i ? new L(this, i) : null;
|
|
2327
2326
|
}
|
|
2328
2327
|
/**
|
|
@@ -2331,14 +2330,14 @@ class kn {
|
|
|
2331
2330
|
they have defaults, will be added.
|
|
2332
2331
|
*/
|
|
2333
2332
|
create(t = null) {
|
|
2334
|
-
return !t && this.instance ? this.instance : new L(this,
|
|
2333
|
+
return !t && this.instance ? this.instance : new L(this, Or(this.attrs, t));
|
|
2335
2334
|
}
|
|
2336
2335
|
/**
|
|
2337
2336
|
@internal
|
|
2338
2337
|
*/
|
|
2339
2338
|
static compile(t, e) {
|
|
2340
2339
|
let n = /* @__PURE__ */ Object.create(null), o = 0;
|
|
2341
|
-
return t.forEach((i, s) => n[i] = new
|
|
2340
|
+
return t.forEach((i, s) => n[i] = new bn(i, o++, e, s)), n;
|
|
2342
2341
|
}
|
|
2343
2342
|
/**
|
|
2344
2343
|
When there is a mark of this type in the given set, a new set
|
|
@@ -2361,7 +2360,7 @@ class kn {
|
|
|
2361
2360
|
@internal
|
|
2362
2361
|
*/
|
|
2363
2362
|
checkAttrs(t) {
|
|
2364
|
-
|
|
2363
|
+
$r(this.attrs, t, "mark", this.name);
|
|
2365
2364
|
}
|
|
2366
2365
|
/**
|
|
2367
2366
|
Queries whether a given mark type is
|
|
@@ -2371,7 +2370,7 @@ class kn {
|
|
|
2371
2370
|
return this.excluded.indexOf(t) > -1;
|
|
2372
2371
|
}
|
|
2373
2372
|
}
|
|
2374
|
-
class
|
|
2373
|
+
class Ni {
|
|
2375
2374
|
/**
|
|
2376
2375
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
2377
2376
|
*/
|
|
@@ -2380,7 +2379,7 @@ class Ii {
|
|
|
2380
2379
|
let e = this.spec = {};
|
|
2381
2380
|
for (let o in t)
|
|
2382
2381
|
e[o] = t[o];
|
|
2383
|
-
e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes = Le.compile(this.spec.nodes, this), this.marks =
|
|
2382
|
+
e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes = Le.compile(this.spec.nodes, this), this.marks = bn.compile(this.spec.marks, this);
|
|
2384
2383
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2385
2384
|
for (let o in this.nodes) {
|
|
2386
2385
|
if (o in this.marks)
|
|
@@ -2393,11 +2392,11 @@ class Ii {
|
|
|
2393
2392
|
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
2394
2393
|
this.linebreakReplacement = i;
|
|
2395
2394
|
}
|
|
2396
|
-
i.markSet = l == "_" ? null : l ?
|
|
2395
|
+
i.markSet = l == "_" ? null : l ? Hn(this, l.split(" ")) : l == "" || !i.inlineContent ? [] : null;
|
|
2397
2396
|
}
|
|
2398
2397
|
for (let o in this.marks) {
|
|
2399
2398
|
let i = this.marks[o], s = i.spec.excludes;
|
|
2400
|
-
i.excluded = s == null ? [i] : s == "" ? [] :
|
|
2399
|
+
i.excluded = s == null ? [i] : s == "" ? [] : Hn(this, s.split(" "));
|
|
2401
2400
|
}
|
|
2402
2401
|
this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) => L.fromJSON(this, o), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
|
|
2403
2402
|
}
|
|
@@ -2440,7 +2439,7 @@ class Ii {
|
|
|
2440
2439
|
return e;
|
|
2441
2440
|
}
|
|
2442
2441
|
}
|
|
2443
|
-
function
|
|
2442
|
+
function Hn(r, t) {
|
|
2444
2443
|
let e = [];
|
|
2445
2444
|
for (let n = 0; n < t.length; n++) {
|
|
2446
2445
|
let o = t[n], i = r.marks[o], s = i;
|
|
@@ -2456,13 +2455,13 @@ function qn(r, t) {
|
|
|
2456
2455
|
}
|
|
2457
2456
|
return e;
|
|
2458
2457
|
}
|
|
2459
|
-
function
|
|
2458
|
+
function Ii(r) {
|
|
2460
2459
|
return r.tag != null;
|
|
2461
2460
|
}
|
|
2462
|
-
function
|
|
2461
|
+
function Oi(r) {
|
|
2463
2462
|
return r.style != null;
|
|
2464
2463
|
}
|
|
2465
|
-
let rn = class
|
|
2464
|
+
let rn = class yn {
|
|
2466
2465
|
/**
|
|
2467
2466
|
Create a parser that targets the given schema, using the given
|
|
2468
2467
|
parsing rules.
|
|
@@ -2471,9 +2470,9 @@ let rn = class gn {
|
|
|
2471
2470
|
this.schema = t, this.rules = e, this.tags = [], this.styles = [];
|
|
2472
2471
|
let n = this.matchedStyles = [];
|
|
2473
2472
|
e.forEach((o) => {
|
|
2474
|
-
if (
|
|
2473
|
+
if (Ii(o))
|
|
2475
2474
|
this.tags.push(o);
|
|
2476
|
-
else if (
|
|
2475
|
+
else if (Oi(o)) {
|
|
2477
2476
|
let i = /[^=]*/.exec(o.style)[0];
|
|
2478
2477
|
n.indexOf(i) < 0 && n.push(i), this.styles.push(o);
|
|
2479
2478
|
}
|
|
@@ -2488,7 +2487,7 @@ let rn = class gn {
|
|
|
2488
2487
|
Parse a document from the content of a DOM node.
|
|
2489
2488
|
*/
|
|
2490
2489
|
parse(t, e = {}) {
|
|
2491
|
-
let n = new
|
|
2490
|
+
let n = new Gn(this, e, !1);
|
|
2492
2491
|
return n.addAll(t, L.none, e.from, e.to), n.finish();
|
|
2493
2492
|
}
|
|
2494
2493
|
/**
|
|
@@ -2500,7 +2499,7 @@ let rn = class gn {
|
|
|
2500
2499
|
the left of the input and the end of nodes at the end.
|
|
2501
2500
|
*/
|
|
2502
2501
|
parseSlice(t, e = {}) {
|
|
2503
|
-
let n = new
|
|
2502
|
+
let n = new Gn(this, e, !0);
|
|
2504
2503
|
return n.addAll(t, L.none, e.from, e.to), S.maxOpen(n.finish());
|
|
2505
2504
|
}
|
|
2506
2505
|
/**
|
|
@@ -2509,7 +2508,7 @@ let rn = class gn {
|
|
|
2509
2508
|
matchTag(t, e, n) {
|
|
2510
2509
|
for (let o = n ? this.tags.indexOf(n) + 1 : 0; o < this.tags.length; o++) {
|
|
2511
2510
|
let i = this.tags[o];
|
|
2512
|
-
if (
|
|
2511
|
+
if (Ri(t, i.tag) && (i.namespace === void 0 || t.namespaceURI == i.namespace) && (!i.context || e.matchesContext(i.context))) {
|
|
2513
2512
|
if (i.getAttrs) {
|
|
2514
2513
|
let s = i.getAttrs(t);
|
|
2515
2514
|
if (s === !1)
|
|
@@ -2557,13 +2556,13 @@ let rn = class gn {
|
|
|
2557
2556
|
for (let o in t.marks) {
|
|
2558
2557
|
let i = t.marks[o].spec.parseDOM;
|
|
2559
2558
|
i && i.forEach((s) => {
|
|
2560
|
-
n(s =
|
|
2559
|
+
n(s = Kn(s)), s.mark || s.ignore || s.clearMark || (s.mark = o);
|
|
2561
2560
|
});
|
|
2562
2561
|
}
|
|
2563
2562
|
for (let o in t.nodes) {
|
|
2564
2563
|
let i = t.nodes[o].spec.parseDOM;
|
|
2565
2564
|
i && i.forEach((s) => {
|
|
2566
|
-
n(s =
|
|
2565
|
+
n(s = Kn(s)), s.node || s.ignore || s.mark || (s.node = o);
|
|
2567
2566
|
});
|
|
2568
2567
|
}
|
|
2569
2568
|
return e;
|
|
@@ -2574,10 +2573,10 @@ let rn = class gn {
|
|
|
2574
2573
|
[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
|
|
2575
2574
|
*/
|
|
2576
2575
|
static fromSchema(t) {
|
|
2577
|
-
return t.cached.domParser || (t.cached.domParser = new
|
|
2576
|
+
return t.cached.domParser || (t.cached.domParser = new yn(t, yn.schemaRules(t)));
|
|
2578
2577
|
}
|
|
2579
2578
|
};
|
|
2580
|
-
const
|
|
2579
|
+
const Rr = {
|
|
2581
2580
|
address: !0,
|
|
2582
2581
|
article: !0,
|
|
2583
2582
|
aside: !0,
|
|
@@ -2610,16 +2609,16 @@ const Br = {
|
|
|
2610
2609
|
table: !0,
|
|
2611
2610
|
tfoot: !0,
|
|
2612
2611
|
ul: !0
|
|
2613
|
-
},
|
|
2612
|
+
}, $i = {
|
|
2614
2613
|
head: !0,
|
|
2615
2614
|
noscript: !0,
|
|
2616
2615
|
object: !0,
|
|
2617
2616
|
script: !0,
|
|
2618
2617
|
style: !0,
|
|
2619
2618
|
title: !0
|
|
2620
|
-
},
|
|
2621
|
-
function
|
|
2622
|
-
return t != null ? (t ? de : 0) | (t === "full" ?
|
|
2619
|
+
}, zr = { ol: !0, ul: !0 }, de = 1, wn = 2, ce = 4;
|
|
2620
|
+
function Un(r, t, e) {
|
|
2621
|
+
return t != null ? (t ? de : 0) | (t === "full" ? wn : 0) : r && r.whitespace == "pre" ? de | wn : e & ~ce;
|
|
2623
2622
|
}
|
|
2624
2623
|
class Ce {
|
|
2625
2624
|
constructor(t, e, n, o, i, s) {
|
|
@@ -2651,13 +2650,13 @@ class Ce {
|
|
|
2651
2650
|
return !t && this.match && (e = e.append(this.match.fillBefore(x.empty, !0))), this.type ? this.type.create(this.attrs, e, this.marks) : e;
|
|
2652
2651
|
}
|
|
2653
2652
|
inlineContext(t) {
|
|
2654
|
-
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : t.parentNode && !
|
|
2653
|
+
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : t.parentNode && !Rr.hasOwnProperty(t.parentNode.nodeName.toLowerCase());
|
|
2655
2654
|
}
|
|
2656
2655
|
}
|
|
2657
|
-
class
|
|
2656
|
+
class Gn {
|
|
2658
2657
|
constructor(t, e, n) {
|
|
2659
2658
|
this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2660
|
-
let o = e.topNode, i, s =
|
|
2659
|
+
let o = e.topNode, i, s = Un(null, e.preserveWhitespace, 0) | (n ? ce : 0);
|
|
2661
2660
|
o ? i = new Ce(o.type, o.attrs, L.none, !0, e.topMatch || o.type.contentMatch, s) : n ? i = new Ce(null, null, L.none, !0, null, s) : i = new Ce(t.schema.topNodeType, null, L.none, !0, null, s), this.nodes = [i], this.find = e.findPositions, this.needsBlock = !1;
|
|
2662
2661
|
}
|
|
2663
2662
|
get top() {
|
|
@@ -2670,7 +2669,7 @@ class Un {
|
|
|
2670
2669
|
t.nodeType == 3 ? this.addTextNode(t, e) : t.nodeType == 1 && this.addElement(t, e);
|
|
2671
2670
|
}
|
|
2672
2671
|
addTextNode(t, e) {
|
|
2673
|
-
let n = t.nodeValue, o = this.top, i = o.options &
|
|
2672
|
+
let n = t.nodeValue, o = this.top, i = o.options & wn ? "full" : this.localPreserveWS || (o.options & de) > 0, { schema: s } = this.parser;
|
|
2674
2673
|
if (i === "full" || o.inlineContext(t) || /[^ \t\r\n\u000c]/.test(n)) {
|
|
2675
2674
|
if (i)
|
|
2676
2675
|
if (i === "full")
|
|
@@ -2697,14 +2696,14 @@ class Un {
|
|
|
2697
2696
|
let o = this.localPreserveWS, i = this.top;
|
|
2698
2697
|
(t.tagName == "PRE" || /pre/.test(t.style && t.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
2699
2698
|
let s = t.nodeName.toLowerCase(), l;
|
|
2700
|
-
|
|
2699
|
+
zr.hasOwnProperty(s) && this.parser.normalizeLists && Bi(t);
|
|
2701
2700
|
let a = this.options.ruleFromNode && this.options.ruleFromNode(t) || (l = this.parser.matchTag(t, this, n));
|
|
2702
|
-
t: if (a ? a.ignore :
|
|
2701
|
+
t: if (a ? a.ignore : $i.hasOwnProperty(s))
|
|
2703
2702
|
this.findInside(t), this.ignoreFallback(t, e);
|
|
2704
2703
|
else if (!a || a.skip || a.closeParent) {
|
|
2705
2704
|
a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (t = a.skip);
|
|
2706
2705
|
let c, u = this.needsBlock;
|
|
2707
|
-
if (
|
|
2706
|
+
if (Rr.hasOwnProperty(s))
|
|
2708
2707
|
i.content.length && i.content[0].isInline && this.open && (this.open--, i = this.top), c = !0, i.type || (this.needsBlock = !0);
|
|
2709
2708
|
else if (!t.firstChild) {
|
|
2710
2709
|
this.leafFallback(t, e);
|
|
@@ -2823,7 +2822,7 @@ class Un {
|
|
|
2823
2822
|
i.match && (i.match = i.match.matchType(t.type));
|
|
2824
2823
|
let s = L.none;
|
|
2825
2824
|
for (let l of o.concat(t.marks))
|
|
2826
|
-
(i.type ? i.type.allowsMarkType(l.type) :
|
|
2825
|
+
(i.type ? i.type.allowsMarkType(l.type) : Xn(l.type, t.type)) && (s = l.addToSet(s));
|
|
2827
2826
|
return i.content.push(t.mark(s)), !0;
|
|
2828
2827
|
}
|
|
2829
2828
|
return !1;
|
|
@@ -2839,10 +2838,10 @@ class Un {
|
|
|
2839
2838
|
this.closeExtra();
|
|
2840
2839
|
let s = this.top;
|
|
2841
2840
|
s.match = s.match && s.match.matchType(t);
|
|
2842
|
-
let l =
|
|
2841
|
+
let l = Un(t, i, s.options);
|
|
2843
2842
|
s.options & ce && s.content.length == 0 && (l |= ce);
|
|
2844
2843
|
let a = L.none;
|
|
2845
|
-
return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) :
|
|
2844
|
+
return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : Xn(c.type, t)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Ce(t, e, a, o, null, l)), this.open++, n;
|
|
2846
2845
|
}
|
|
2847
2846
|
// Make sure all nodes above this.open are finished and added to
|
|
2848
2847
|
// their parents
|
|
@@ -2936,22 +2935,22 @@ class Un {
|
|
|
2936
2935
|
}
|
|
2937
2936
|
}
|
|
2938
2937
|
}
|
|
2939
|
-
function
|
|
2938
|
+
function Bi(r) {
|
|
2940
2939
|
for (let t = r.firstChild, e = null; t; t = t.nextSibling) {
|
|
2941
2940
|
let n = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
|
|
2942
|
-
n &&
|
|
2941
|
+
n && zr.hasOwnProperty(n) && e ? (e.appendChild(t), t = e) : n == "li" ? e = t : n && (e = null);
|
|
2943
2942
|
}
|
|
2944
2943
|
}
|
|
2945
|
-
function
|
|
2944
|
+
function Ri(r, t) {
|
|
2946
2945
|
return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, t);
|
|
2947
2946
|
}
|
|
2948
|
-
function
|
|
2947
|
+
function Kn(r) {
|
|
2949
2948
|
let t = {};
|
|
2950
2949
|
for (let e in r)
|
|
2951
2950
|
t[e] = r[e];
|
|
2952
2951
|
return t;
|
|
2953
2952
|
}
|
|
2954
|
-
function
|
|
2953
|
+
function Xn(r, t) {
|
|
2955
2954
|
let e = t.schema.nodes;
|
|
2956
2955
|
for (let n in e) {
|
|
2957
2956
|
let o = e[n];
|
|
@@ -2969,18 +2968,18 @@ function Kn(r, t) {
|
|
|
2969
2968
|
return !0;
|
|
2970
2969
|
}
|
|
2971
2970
|
}
|
|
2972
|
-
const
|
|
2973
|
-
function
|
|
2974
|
-
return r + t *
|
|
2971
|
+
const Pr = 65535, Fr = Math.pow(2, 16);
|
|
2972
|
+
function zi(r, t) {
|
|
2973
|
+
return r + t * Fr;
|
|
2975
2974
|
}
|
|
2976
|
-
function
|
|
2977
|
-
return r &
|
|
2975
|
+
function Zn(r) {
|
|
2976
|
+
return r & Pr;
|
|
2978
2977
|
}
|
|
2979
|
-
function
|
|
2980
|
-
return (r - (r &
|
|
2978
|
+
function Pi(r) {
|
|
2979
|
+
return (r - (r & Pr)) / Fr;
|
|
2981
2980
|
}
|
|
2982
|
-
const
|
|
2983
|
-
class
|
|
2981
|
+
const _r = 1, Dr = 2, $e = 4, Jr = 8;
|
|
2982
|
+
class Qn {
|
|
2984
2983
|
/**
|
|
2985
2984
|
@internal
|
|
2986
2985
|
*/
|
|
@@ -2993,19 +2992,19 @@ class Zn {
|
|
|
2993
2992
|
argument from the document.
|
|
2994
2993
|
*/
|
|
2995
2994
|
get deleted() {
|
|
2996
|
-
return (this.delInfo &
|
|
2995
|
+
return (this.delInfo & Jr) > 0;
|
|
2997
2996
|
}
|
|
2998
2997
|
/**
|
|
2999
2998
|
Tells you whether the token before the mapped position was deleted.
|
|
3000
2999
|
*/
|
|
3001
3000
|
get deletedBefore() {
|
|
3002
|
-
return (this.delInfo & (
|
|
3001
|
+
return (this.delInfo & (_r | $e)) > 0;
|
|
3003
3002
|
}
|
|
3004
3003
|
/**
|
|
3005
3004
|
True when the token after the mapped position was deleted.
|
|
3006
3005
|
*/
|
|
3007
3006
|
get deletedAfter() {
|
|
3008
|
-
return (this.delInfo & (
|
|
3007
|
+
return (this.delInfo & (Dr | $e)) > 0;
|
|
3009
3008
|
}
|
|
3010
3009
|
/**
|
|
3011
3010
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -3030,11 +3029,11 @@ class lt {
|
|
|
3030
3029
|
@internal
|
|
3031
3030
|
*/
|
|
3032
3031
|
recover(t) {
|
|
3033
|
-
let e = 0, n =
|
|
3032
|
+
let e = 0, n = Zn(t);
|
|
3034
3033
|
if (!this.inverted)
|
|
3035
3034
|
for (let o = 0; o < n; o++)
|
|
3036
3035
|
e += this.ranges[o * 3 + 2] - this.ranges[o * 3 + 1];
|
|
3037
|
-
return this.ranges[n * 3] + e +
|
|
3036
|
+
return this.ranges[n * 3] + e + Pi(t);
|
|
3038
3037
|
}
|
|
3039
3038
|
mapResult(t, e = 1) {
|
|
3040
3039
|
return this._map(t, e, !1);
|
|
@@ -3056,18 +3055,18 @@ class lt {
|
|
|
3056
3055
|
let d = c ? t == a ? -1 : t == f ? 1 : e : e, h = a + o + (d < 0 ? 0 : u);
|
|
3057
3056
|
if (n)
|
|
3058
3057
|
return h;
|
|
3059
|
-
let m = t == (e < 0 ? a : f) ? null :
|
|
3060
|
-
return (e < 0 ? t != a : t != f) && (p |=
|
|
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 |= Jr), new Qn(h, p, m);
|
|
3061
3060
|
}
|
|
3062
3061
|
o += u - c;
|
|
3063
3062
|
}
|
|
3064
|
-
return n ? t + o : new
|
|
3063
|
+
return n ? t + o : new Qn(t + o, 0, null);
|
|
3065
3064
|
}
|
|
3066
3065
|
/**
|
|
3067
3066
|
@internal
|
|
3068
3067
|
*/
|
|
3069
3068
|
touches(t, e) {
|
|
3070
|
-
let n = 0, o =
|
|
3069
|
+
let n = 0, o = Zn(e), i = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
|
|
3071
3070
|
for (let l = 0; l < this.ranges.length; l += 3) {
|
|
3072
3071
|
let a = this.ranges[l] - (this.inverted ? n : 0);
|
|
3073
3072
|
if (a > t)
|
|
@@ -3189,11 +3188,11 @@ class V {
|
|
|
3189
3188
|
}
|
|
3190
3189
|
}
|
|
3191
3190
|
}
|
|
3192
|
-
function
|
|
3191
|
+
function vn(r, t, e) {
|
|
3193
3192
|
let n = [];
|
|
3194
3193
|
for (let o = 0; o < r.childCount; o++) {
|
|
3195
3194
|
let i = r.child(o);
|
|
3196
|
-
i.content.size && (i = i.copy(
|
|
3195
|
+
i.content.size && (i = i.copy(vn(i.content, t, i))), i.isInline && (i = t(i, e, o)), n.push(i);
|
|
3197
3196
|
}
|
|
3198
3197
|
return x.fromArray(n);
|
|
3199
3198
|
}
|
|
@@ -3205,7 +3204,7 @@ class _t extends nt {
|
|
|
3205
3204
|
super(), this.from = t, this.to = e, this.mark = n;
|
|
3206
3205
|
}
|
|
3207
3206
|
apply(t) {
|
|
3208
|
-
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(vn(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);
|
|
3209
3208
|
return V.fromReplace(t, this.from, this.to, i);
|
|
3210
3209
|
}
|
|
3211
3210
|
invert() {
|
|
@@ -3244,7 +3243,7 @@ class Dt extends nt {
|
|
|
3244
3243
|
super(), this.from = t, this.to = e, this.mark = n;
|
|
3245
3244
|
}
|
|
3246
3245
|
apply(t) {
|
|
3247
|
-
let e = t.slice(this.from, this.to), n = new S(
|
|
3246
|
+
let e = t.slice(this.from, this.to), n = new S(vn(e.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), t), e.openStart, e.openEnd);
|
|
3248
3247
|
return V.fromReplace(t, this.from, this.to, n);
|
|
3249
3248
|
}
|
|
3250
3249
|
invert() {
|
|
@@ -3368,7 +3367,7 @@ class st extends nt {
|
|
|
3368
3367
|
super(), this.from = t, this.to = e, this.slice = n, this.structure = o;
|
|
3369
3368
|
}
|
|
3370
3369
|
apply(t) {
|
|
3371
|
-
return this.structure &&
|
|
3370
|
+
return this.structure && xn(t, this.from, this.to) ? V.fail("Structure replace would overwrite content") : V.fromReplace(t, this.from, this.to, this.slice);
|
|
3372
3371
|
}
|
|
3373
3372
|
getMap() {
|
|
3374
3373
|
return new lt([this.from, this.to - this.from, this.slice.size]);
|
|
@@ -3417,7 +3416,7 @@ class it extends nt {
|
|
|
3417
3416
|
super(), this.from = t, this.to = e, this.gapFrom = n, this.gapTo = o, this.slice = i, this.insert = s, this.structure = l;
|
|
3418
3417
|
}
|
|
3419
3418
|
apply(t) {
|
|
3420
|
-
if (this.structure && (
|
|
3419
|
+
if (this.structure && (xn(t, this.from, this.gapFrom) || xn(t, this.gapTo, this.to)))
|
|
3421
3420
|
return V.fail("Structure gap-replace would overwrite content");
|
|
3422
3421
|
let e = t.slice(this.gapFrom, this.gapTo);
|
|
3423
3422
|
if (e.openStart || e.openEnd)
|
|
@@ -3464,7 +3463,7 @@ class it extends nt {
|
|
|
3464
3463
|
}
|
|
3465
3464
|
}
|
|
3466
3465
|
nt.jsonID("replaceAround", it);
|
|
3467
|
-
function
|
|
3466
|
+
function xn(r, t, e) {
|
|
3468
3467
|
let n = r.resolve(t), o = e - t, i = n.depth;
|
|
3469
3468
|
for (; o > 0 && i > 0 && n.indexAfter(i) == n.node(i).childCount; )
|
|
3470
3469
|
i--, o--;
|
|
@@ -3478,7 +3477,7 @@ function wn(r, t, e) {
|
|
|
3478
3477
|
}
|
|
3479
3478
|
return !1;
|
|
3480
3479
|
}
|
|
3481
|
-
function
|
|
3480
|
+
function Fi(r, t, e) {
|
|
3482
3481
|
return (t == 0 || r.canReplace(t, r.childCount)) && (e == r.childCount || r.canReplace(0, e));
|
|
3483
3482
|
}
|
|
3484
3483
|
function Qt(r) {
|
|
@@ -3487,27 +3486,27 @@ function Qt(r) {
|
|
|
3487
3486
|
let s = r.$from.node(n), l = r.$from.index(n) + o, a = r.$to.indexAfter(n) - i;
|
|
3488
3487
|
if (n < r.depth && s.canReplace(l, a, e))
|
|
3489
3488
|
return n;
|
|
3490
|
-
if (n == 0 || s.type.spec.isolating || !
|
|
3489
|
+
if (n == 0 || s.type.spec.isolating || !Fi(s, l, a))
|
|
3491
3490
|
break;
|
|
3492
3491
|
l && (o = 1), a < s.childCount && (i = 1);
|
|
3493
3492
|
}
|
|
3494
3493
|
return null;
|
|
3495
3494
|
}
|
|
3496
|
-
function
|
|
3497
|
-
let o =
|
|
3498
|
-
return i ? o.map(
|
|
3495
|
+
function Lr(r, t, e = null, n = r) {
|
|
3496
|
+
let o = _i(r, t), i = o && Di(n, t);
|
|
3497
|
+
return i ? o.map(Yn).concat({ type: t, attrs: e }).concat(i.map(Yn)) : null;
|
|
3499
3498
|
}
|
|
3500
|
-
function
|
|
3499
|
+
function Yn(r) {
|
|
3501
3500
|
return { type: r, attrs: null };
|
|
3502
3501
|
}
|
|
3503
|
-
function
|
|
3502
|
+
function _i(r, t) {
|
|
3504
3503
|
let { parent: e, startIndex: n, endIndex: o } = r, i = e.contentMatchAt(n).findWrapping(t);
|
|
3505
3504
|
if (!i)
|
|
3506
3505
|
return null;
|
|
3507
3506
|
let s = i.length ? i[0] : t;
|
|
3508
3507
|
return e.canReplaceWith(n, o, s) ? i : null;
|
|
3509
3508
|
}
|
|
3510
|
-
function
|
|
3509
|
+
function Di(r, t) {
|
|
3511
3510
|
let { parent: e, startIndex: n, endIndex: o } = r, i = e.child(n), s = t.contentMatch.findWrapping(i.type);
|
|
3512
3511
|
if (!s)
|
|
3513
3512
|
return null;
|
|
@@ -3535,9 +3534,9 @@ function Mt(r, t, e = 1, n) {
|
|
|
3535
3534
|
}
|
|
3536
3535
|
function qt(r, t) {
|
|
3537
3536
|
let e = r.resolve(t), n = e.index();
|
|
3538
|
-
return
|
|
3537
|
+
return Wr(e.nodeBefore, e.nodeAfter) && e.parent.canReplace(n, n + 1);
|
|
3539
3538
|
}
|
|
3540
|
-
function
|
|
3539
|
+
function Ji(r, t) {
|
|
3541
3540
|
t.content.size || r.type.compatibleContent(t.type);
|
|
3542
3541
|
let e = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
|
|
3543
3542
|
for (let o = 0; o < t.childCount; o++) {
|
|
@@ -3547,30 +3546,30 @@ function Li(r, t) {
|
|
|
3547
3546
|
}
|
|
3548
3547
|
return e.validEnd;
|
|
3549
3548
|
}
|
|
3550
|
-
function
|
|
3551
|
-
return !!(r && t && !r.isLeaf &&
|
|
3549
|
+
function Wr(r, t) {
|
|
3550
|
+
return !!(r && t && !r.isLeaf && Ji(r, t));
|
|
3552
3551
|
}
|
|
3553
3552
|
function Ue(r, t, e = -1) {
|
|
3554
3553
|
let n = r.resolve(t);
|
|
3555
3554
|
for (let o = n.depth; ; o--) {
|
|
3556
3555
|
let i, s, l = n.index(o);
|
|
3557
|
-
if (o == n.depth ? (i = n.nodeBefore, s = n.nodeAfter) : e > 0 ? (i = n.node(o + 1), l++, s = n.node(o).maybeChild(l)) : (i = n.node(o).maybeChild(l - 1), s = n.node(o + 1)), i && !i.isTextblock &&
|
|
3556
|
+
if (o == n.depth ? (i = n.nodeBefore, s = n.nodeAfter) : e > 0 ? (i = n.node(o + 1), l++, s = n.node(o).maybeChild(l)) : (i = n.node(o).maybeChild(l - 1), s = n.node(o + 1)), i && !i.isTextblock && Wr(i, s) && n.node(o).canReplace(l, l + 1))
|
|
3558
3557
|
return t;
|
|
3559
3558
|
if (o == 0)
|
|
3560
3559
|
break;
|
|
3561
3560
|
t = e < 0 ? n.before(o) : n.after(o);
|
|
3562
3561
|
}
|
|
3563
3562
|
}
|
|
3564
|
-
function
|
|
3563
|
+
function Sn(r, t, e = t, n = S.empty) {
|
|
3565
3564
|
if (t == e && !n.size)
|
|
3566
3565
|
return null;
|
|
3567
3566
|
let o = r.resolve(t), i = r.resolve(e);
|
|
3568
|
-
return
|
|
3567
|
+
return Li(o, i, n) ? new st(t, e, n) : new Wi(o, i, n).fit();
|
|
3569
3568
|
}
|
|
3570
|
-
function
|
|
3569
|
+
function Li(r, t, e) {
|
|
3571
3570
|
return !e.openStart && !e.openEnd && r.start() == t.start() && r.parent.canReplace(r.index(), t.index(), e.content);
|
|
3572
3571
|
}
|
|
3573
|
-
class
|
|
3572
|
+
class Wi {
|
|
3574
3573
|
constructor(t, e, n) {
|
|
3575
3574
|
this.$from = t, this.$to = e, this.unplaced = n, this.frontier = [], this.placed = x.empty;
|
|
3576
3575
|
for (let o = 0; o <= t.depth; o++) {
|
|
@@ -3661,7 +3660,7 @@ class ji {
|
|
|
3661
3660
|
let p = l.child(c), k = f.matchType(p.type);
|
|
3662
3661
|
if (!k)
|
|
3663
3662
|
break;
|
|
3664
|
-
c++, (c > 1 || a == 0 || p.content.size) && (f = k, u.push(
|
|
3663
|
+
c++, (c > 1 || a == 0 || p.content.size) && (f = k, u.push(jr(p.mark(d.allowedMarks(p.marks)), c == 1 ? a : 0, c == l.childCount ? h : -1)));
|
|
3665
3664
|
}
|
|
3666
3665
|
let m = c == l.childCount;
|
|
3667
3666
|
m || (h = -1), this.placed = se(this.placed, e, x.from(u)), this.frontier[e].match = f, m && h < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
@@ -3728,20 +3727,20 @@ function sn(r, t) {
|
|
|
3728
3727
|
r = r.firstChild.content;
|
|
3729
3728
|
return r;
|
|
3730
3729
|
}
|
|
3731
|
-
function
|
|
3730
|
+
function jr(r, t, e) {
|
|
3732
3731
|
if (t <= 0)
|
|
3733
3732
|
return r;
|
|
3734
3733
|
let n = r.content;
|
|
3735
|
-
return t > 1 && (n = n.replaceChild(0,
|
|
3734
|
+
return t > 1 && (n = n.replaceChild(0, jr(n.firstChild, t - 1, n.childCount == 1 ? e - 1 : 0))), t > 0 && (n = r.type.contentMatch.fillBefore(n).append(n), e <= 0 && (n = n.append(r.type.contentMatch.matchFragment(n).fillBefore(x.empty, !0)))), r.copy(n);
|
|
3736
3735
|
}
|
|
3737
3736
|
function ln(r, t, e, n, o) {
|
|
3738
3737
|
let i = r.node(t), s = o ? r.indexAfter(t) : r.index(t);
|
|
3739
3738
|
if (s == i.childCount && !e.compatibleContent(i.type))
|
|
3740
3739
|
return null;
|
|
3741
3740
|
let l = n.fillBefore(i.content, !0, s);
|
|
3742
|
-
return l && !
|
|
3741
|
+
return l && !ji(e, i.content, s) ? l : null;
|
|
3743
3742
|
}
|
|
3744
|
-
function
|
|
3743
|
+
function ji(r, t, e) {
|
|
3745
3744
|
for (let n = e; n < t.childCount; n++)
|
|
3746
3745
|
if (!r.allowsMarks(t.child(n).marks))
|
|
3747
3746
|
return !0;
|
|
@@ -3836,7 +3835,7 @@ class $ {
|
|
|
3836
3835
|
`$head`.
|
|
3837
3836
|
*/
|
|
3838
3837
|
constructor(t, e, n) {
|
|
3839
|
-
this.$anchor = t, this.$head = e, this.ranges = n || [new
|
|
3838
|
+
this.$anchor = t, this.$head = e, this.ranges = n || [new Vi(t.min(e), t.max(e))];
|
|
3840
3839
|
}
|
|
3841
3840
|
/**
|
|
3842
3841
|
The selection's anchor, as an unresolved position.
|
|
@@ -3901,7 +3900,7 @@ class $ {
|
|
|
3901
3900
|
let i = t.steps.length, s = this.ranges;
|
|
3902
3901
|
for (let l = 0; l < s.length; l++) {
|
|
3903
3902
|
let { $from: a, $to: c } = s[l], u = t.mapping.slice(i);
|
|
3904
|
-
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 && nr(t, i, (n ? n.isInline : o && o.isTextblock) ? -1 : 1);
|
|
3905
3904
|
}
|
|
3906
3905
|
}
|
|
3907
3906
|
/**
|
|
@@ -3912,7 +3911,7 @@ class $ {
|
|
|
3912
3911
|
let n = t.steps.length, o = this.ranges;
|
|
3913
3912
|
for (let i = 0; i < o.length; i++) {
|
|
3914
3913
|
let { $from: s, $to: l } = o[i], a = t.mapping.slice(n), c = a.map(s.pos), u = a.map(l.pos);
|
|
3915
|
-
i ? t.deleteRange(c, u) : (t.replaceRangeWith(c, u, e),
|
|
3914
|
+
i ? t.deleteRange(c, u) : (t.replaceRangeWith(c, u, e), nr(t, n, e.isInline ? -1 : 1));
|
|
3916
3915
|
}
|
|
3917
3916
|
}
|
|
3918
3917
|
/**
|
|
@@ -3994,7 +3993,7 @@ class $ {
|
|
|
3994
3993
|
}
|
|
3995
3994
|
}
|
|
3996
3995
|
$.prototype.visible = !0;
|
|
3997
|
-
class
|
|
3996
|
+
class Vi {
|
|
3998
3997
|
/**
|
|
3999
3998
|
Create a range.
|
|
4000
3999
|
*/
|
|
@@ -4002,16 +4001,16 @@ class qi {
|
|
|
4002
4001
|
this.$from = t, this.$to = e;
|
|
4003
4002
|
}
|
|
4004
4003
|
}
|
|
4005
|
-
let
|
|
4006
|
-
function
|
|
4007
|
-
!
|
|
4004
|
+
let tr = !1;
|
|
4005
|
+
function er(r) {
|
|
4006
|
+
!tr && !r.parent.inlineContent && (tr = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
|
|
4008
4007
|
}
|
|
4009
4008
|
class D extends $ {
|
|
4010
4009
|
/**
|
|
4011
4010
|
Construct a text selection between the given points.
|
|
4012
4011
|
*/
|
|
4013
4012
|
constructor(t, e = t) {
|
|
4014
|
-
|
|
4013
|
+
er(t), er(e), super(t, e);
|
|
4015
4014
|
}
|
|
4016
4015
|
/**
|
|
4017
4016
|
Returns a resolved position if this is a cursor selection (an
|
|
@@ -4112,7 +4111,7 @@ class P extends $ {
|
|
|
4112
4111
|
return { type: "node", anchor: this.anchor };
|
|
4113
4112
|
}
|
|
4114
4113
|
getBookmark() {
|
|
4115
|
-
return new
|
|
4114
|
+
return new Cn(this.anchor);
|
|
4116
4115
|
}
|
|
4117
4116
|
/**
|
|
4118
4117
|
@internal
|
|
@@ -4138,13 +4137,13 @@ class P extends $ {
|
|
|
4138
4137
|
}
|
|
4139
4138
|
P.prototype.visible = !1;
|
|
4140
4139
|
$.jsonID("node", P);
|
|
4141
|
-
class
|
|
4140
|
+
class Cn {
|
|
4142
4141
|
constructor(t) {
|
|
4143
4142
|
this.anchor = t;
|
|
4144
4143
|
}
|
|
4145
4144
|
map(t) {
|
|
4146
4145
|
let { deleted: e, pos: n } = t.mapResult(this.anchor);
|
|
4147
|
-
return e ? new Ge(n, n) : new
|
|
4146
|
+
return e ? new Ge(n, n) : new Cn(n);
|
|
4148
4147
|
}
|
|
4149
4148
|
resolve(t) {
|
|
4150
4149
|
let e = t.resolve(this.anchor), n = e.nodeAfter;
|
|
@@ -4182,11 +4181,11 @@ class dt extends $ {
|
|
|
4182
4181
|
return t instanceof dt;
|
|
4183
4182
|
}
|
|
4184
4183
|
getBookmark() {
|
|
4185
|
-
return
|
|
4184
|
+
return qi;
|
|
4186
4185
|
}
|
|
4187
4186
|
}
|
|
4188
4187
|
$.jsonID("all", dt);
|
|
4189
|
-
const
|
|
4188
|
+
const qi = {
|
|
4190
4189
|
map() {
|
|
4191
4190
|
return this;
|
|
4192
4191
|
},
|
|
@@ -4211,7 +4210,7 @@ function Xt(r, t, e, n, o, i = !1) {
|
|
|
4211
4210
|
}
|
|
4212
4211
|
return null;
|
|
4213
4212
|
}
|
|
4214
|
-
function
|
|
4213
|
+
function nr(r, t, e) {
|
|
4215
4214
|
let n = r.steps.length - 1;
|
|
4216
4215
|
if (n < t)
|
|
4217
4216
|
return;
|
|
@@ -4223,12 +4222,12 @@ function er(r, t, e) {
|
|
|
4223
4222
|
s == null && (s = u);
|
|
4224
4223
|
}), r.setSelection($.near(r.doc.resolve(s), e));
|
|
4225
4224
|
}
|
|
4226
|
-
function
|
|
4225
|
+
function rr(r, t) {
|
|
4227
4226
|
return !t || !r ? r : r.bind(t);
|
|
4228
4227
|
}
|
|
4229
4228
|
class Te {
|
|
4230
4229
|
constructor(t, e, n) {
|
|
4231
|
-
this.name = t, this.init =
|
|
4230
|
+
this.name = t, this.init = rr(e.init, n), this.apply = rr(e.apply, n);
|
|
4232
4231
|
}
|
|
4233
4232
|
}
|
|
4234
4233
|
new Te("doc", {
|
|
@@ -4260,10 +4259,10 @@ new Te("doc", {
|
|
|
4260
4259
|
return r.scrolledIntoView ? t + 1 : t;
|
|
4261
4260
|
}
|
|
4262
4261
|
});
|
|
4263
|
-
function
|
|
4262
|
+
function Vr(r, t, e) {
|
|
4264
4263
|
for (let n in r) {
|
|
4265
4264
|
let o = r[n];
|
|
4266
|
-
o instanceof Function ? o = o.bind(t) : n == "handleDOMEvents" && (o =
|
|
4265
|
+
o instanceof Function ? o = o.bind(t) : n == "handleDOMEvents" && (o = Vr(o, t, {})), e[n] = o;
|
|
4267
4266
|
}
|
|
4268
4267
|
return e;
|
|
4269
4268
|
}
|
|
@@ -4272,7 +4271,7 @@ class Bt {
|
|
|
4272
4271
|
Create a plugin.
|
|
4273
4272
|
*/
|
|
4274
4273
|
constructor(t) {
|
|
4275
|
-
this.spec = t, this.props = {}, t.props &&
|
|
4274
|
+
this.spec = t, this.props = {}, t.props && Vr(t.props, this, this.props), this.key = t.key ? t.key.key : qr("plugin");
|
|
4276
4275
|
}
|
|
4277
4276
|
/**
|
|
4278
4277
|
Extract the plugin's state field from an editor state.
|
|
@@ -4282,7 +4281,7 @@ class Bt {
|
|
|
4282
4281
|
}
|
|
4283
4282
|
}
|
|
4284
4283
|
const cn = /* @__PURE__ */ Object.create(null);
|
|
4285
|
-
function
|
|
4284
|
+
function qr(r) {
|
|
4286
4285
|
return r in cn ? r + "$" + ++cn[r] : (cn[r] = 0, r + "$");
|
|
4287
4286
|
}
|
|
4288
4287
|
class Rt {
|
|
@@ -4290,7 +4289,7 @@ class Rt {
|
|
|
4290
4289
|
Create a plugin key.
|
|
4291
4290
|
*/
|
|
4292
4291
|
constructor(t = "key") {
|
|
4293
|
-
this.key =
|
|
4292
|
+
this.key = qr(t);
|
|
4294
4293
|
}
|
|
4295
4294
|
/**
|
|
4296
4295
|
Get the active plugin with this key, if any, from an editor
|
|
@@ -4306,26 +4305,26 @@ class Rt {
|
|
|
4306
4305
|
return t[this.key];
|
|
4307
4306
|
}
|
|
4308
4307
|
}
|
|
4309
|
-
const
|
|
4310
|
-
function
|
|
4308
|
+
const Tn = (r, t) => r.selection.empty ? !1 : (t && t(r.tr.deleteSelection().scrollIntoView()), !0);
|
|
4309
|
+
function Hr(r, t) {
|
|
4311
4310
|
let { $cursor: e } = r.selection;
|
|
4312
4311
|
return !e || (t ? !t.endOfTextblock("backward", r) : e.parentOffset > 0) ? null : e;
|
|
4313
4312
|
}
|
|
4314
|
-
const
|
|
4315
|
-
let n =
|
|
4313
|
+
const Ur = (r, t, e) => {
|
|
4314
|
+
let n = Hr(r, e);
|
|
4316
4315
|
if (!n)
|
|
4317
4316
|
return !1;
|
|
4318
|
-
let o =
|
|
4317
|
+
let o = An(n);
|
|
4319
4318
|
if (!o) {
|
|
4320
4319
|
let s = n.blockRange(), l = s && Qt(s);
|
|
4321
4320
|
return l == null ? !1 : (t && t(r.tr.lift(s, l).scrollIntoView()), !0);
|
|
4322
4321
|
}
|
|
4323
4322
|
let i = o.nodeBefore;
|
|
4324
|
-
if (
|
|
4323
|
+
if (no(r, o, t, -1))
|
|
4325
4324
|
return !0;
|
|
4326
4325
|
if (n.parent.content.size == 0 && (Zt(i, "end") || P.isSelectable(i)))
|
|
4327
4326
|
for (let s = n.depth; ; s--) {
|
|
4328
|
-
let l =
|
|
4327
|
+
let l = Sn(r.doc, n.before(s), n.after(s), S.empty);
|
|
4329
4328
|
if (l && l.slice.size < l.to - l.from) {
|
|
4330
4329
|
if (t) {
|
|
4331
4330
|
let a = r.tr.step(l);
|
|
@@ -4337,20 +4336,20 @@ const Hr = (r, t, e) => {
|
|
|
4337
4336
|
break;
|
|
4338
4337
|
}
|
|
4339
4338
|
return i.isAtom && o.depth == n.depth - 1 ? (t && t(r.tr.delete(o.pos - i.nodeSize, o.pos).scrollIntoView()), !0) : !1;
|
|
4340
|
-
},
|
|
4341
|
-
let n =
|
|
4339
|
+
}, Hi = (r, t, e) => {
|
|
4340
|
+
let n = Hr(r, e);
|
|
4342
4341
|
if (!n)
|
|
4343
4342
|
return !1;
|
|
4344
|
-
let o =
|
|
4345
|
-
return o ?
|
|
4346
|
-
},
|
|
4347
|
-
let n =
|
|
4343
|
+
let o = An(n);
|
|
4344
|
+
return o ? Gr(r, o, t) : !1;
|
|
4345
|
+
}, Ui = (r, t, e) => {
|
|
4346
|
+
let n = Xr(r, e);
|
|
4348
4347
|
if (!n)
|
|
4349
4348
|
return !1;
|
|
4350
|
-
let o =
|
|
4351
|
-
return o ?
|
|
4349
|
+
let o = Mn(n);
|
|
4350
|
+
return o ? Gr(r, o, t) : !1;
|
|
4352
4351
|
};
|
|
4353
|
-
function
|
|
4352
|
+
function Gr(r, t, e) {
|
|
4354
4353
|
let n = t.nodeBefore, o = n, i = t.pos - 1;
|
|
4355
4354
|
for (; !o.isTextblock; i--) {
|
|
4356
4355
|
if (o.type.spec.isolating)
|
|
@@ -4369,7 +4368,7 @@ function Ur(r, t, e) {
|
|
|
4369
4368
|
return !1;
|
|
4370
4369
|
l = u;
|
|
4371
4370
|
}
|
|
4372
|
-
let c =
|
|
4371
|
+
let c = Sn(r.doc, i, a, S.empty);
|
|
4373
4372
|
if (!c || c.from != i || c instanceof st && c.slice.size >= a - i)
|
|
4374
4373
|
return !1;
|
|
4375
4374
|
if (e) {
|
|
@@ -4387,19 +4386,19 @@ function Zt(r, t, e = !1) {
|
|
|
4387
4386
|
}
|
|
4388
4387
|
return !1;
|
|
4389
4388
|
}
|
|
4390
|
-
const
|
|
4389
|
+
const Kr = (r, t, e) => {
|
|
4391
4390
|
let { $head: n, empty: o } = r.selection, i = n;
|
|
4392
4391
|
if (!o)
|
|
4393
4392
|
return !1;
|
|
4394
4393
|
if (n.parent.isTextblock) {
|
|
4395
4394
|
if (e ? !e.endOfTextblock("backward", r) : n.parentOffset > 0)
|
|
4396
4395
|
return !1;
|
|
4397
|
-
i =
|
|
4396
|
+
i = An(n);
|
|
4398
4397
|
}
|
|
4399
4398
|
let s = i && i.nodeBefore;
|
|
4400
4399
|
return !s || !P.isSelectable(s) ? !1 : (t && t(r.tr.setSelection(P.create(r.doc, i.pos - s.nodeSize)).scrollIntoView()), !0);
|
|
4401
4400
|
};
|
|
4402
|
-
function
|
|
4401
|
+
function An(r) {
|
|
4403
4402
|
if (!r.parent.type.spec.isolating)
|
|
4404
4403
|
for (let t = r.depth - 1; t >= 0; t--) {
|
|
4405
4404
|
if (r.index(t) > 0)
|
|
@@ -4409,22 +4408,22 @@ function Tn(r) {
|
|
|
4409
4408
|
}
|
|
4410
4409
|
return null;
|
|
4411
4410
|
}
|
|
4412
|
-
function
|
|
4411
|
+
function Xr(r, t) {
|
|
4413
4412
|
let { $cursor: e } = r.selection;
|
|
4414
4413
|
return !e || (t ? !t.endOfTextblock("forward", r) : e.parentOffset < e.parent.content.size) ? null : e;
|
|
4415
4414
|
}
|
|
4416
|
-
const
|
|
4417
|
-
let n =
|
|
4415
|
+
const Zr = (r, t, e) => {
|
|
4416
|
+
let n = Xr(r, e);
|
|
4418
4417
|
if (!n)
|
|
4419
4418
|
return !1;
|
|
4420
|
-
let o =
|
|
4419
|
+
let o = Mn(n);
|
|
4421
4420
|
if (!o)
|
|
4422
4421
|
return !1;
|
|
4423
4422
|
let i = o.nodeAfter;
|
|
4424
|
-
if (
|
|
4423
|
+
if (no(r, o, t, 1))
|
|
4425
4424
|
return !0;
|
|
4426
4425
|
if (n.parent.content.size == 0 && (Zt(i, "start") || P.isSelectable(i))) {
|
|
4427
|
-
let s =
|
|
4426
|
+
let s = Sn(r.doc, n.before(), n.after(), S.empty);
|
|
4428
4427
|
if (s && s.slice.size < s.to - s.from) {
|
|
4429
4428
|
if (t) {
|
|
4430
4429
|
let l = r.tr.step(s);
|
|
@@ -4434,19 +4433,19 @@ const Xr = (r, t, e) => {
|
|
|
4434
4433
|
}
|
|
4435
4434
|
}
|
|
4436
4435
|
return i.isAtom && o.depth == n.depth - 1 ? (t && t(r.tr.delete(o.pos, o.pos + i.nodeSize).scrollIntoView()), !0) : !1;
|
|
4437
|
-
},
|
|
4436
|
+
}, Qr = (r, t, e) => {
|
|
4438
4437
|
let { $head: n, empty: o } = r.selection, i = n;
|
|
4439
4438
|
if (!o)
|
|
4440
4439
|
return !1;
|
|
4441
4440
|
if (n.parent.isTextblock) {
|
|
4442
4441
|
if (e ? !e.endOfTextblock("forward", r) : n.parentOffset < n.parent.content.size)
|
|
4443
4442
|
return !1;
|
|
4444
|
-
i =
|
|
4443
|
+
i = Mn(n);
|
|
4445
4444
|
}
|
|
4446
4445
|
let s = i && i.nodeAfter;
|
|
4447
4446
|
return !s || !P.isSelectable(s) ? !1 : (t && t(r.tr.setSelection(P.create(r.doc, i.pos)).scrollIntoView()), !0);
|
|
4448
4447
|
};
|
|
4449
|
-
function
|
|
4448
|
+
function Mn(r) {
|
|
4450
4449
|
if (!r.parent.type.spec.isolating)
|
|
4451
4450
|
for (let t = r.depth - 1; t >= 0; t--) {
|
|
4452
4451
|
let e = r.node(t);
|
|
@@ -4457,7 +4456,7 @@ function An(r) {
|
|
|
4457
4456
|
}
|
|
4458
4457
|
return null;
|
|
4459
4458
|
}
|
|
4460
|
-
const
|
|
4459
|
+
const Gi = (r, t) => {
|
|
4461
4460
|
let e = r.selection, n = e instanceof P, o;
|
|
4462
4461
|
if (n) {
|
|
4463
4462
|
if (e.node.isTextblock || !qt(r.doc, e.from))
|
|
@@ -4470,7 +4469,7 @@ const Ki = (r, t) => {
|
|
|
4470
4469
|
n && i.setSelection(P.create(i.doc, o - r.doc.resolve(o).nodeBefore.nodeSize)), t(i.scrollIntoView());
|
|
4471
4470
|
}
|
|
4472
4471
|
return !0;
|
|
4473
|
-
},
|
|
4472
|
+
}, Ki = (r, t) => {
|
|
4474
4473
|
let e = r.selection, n;
|
|
4475
4474
|
if (e instanceof P) {
|
|
4476
4475
|
if (e.node.isTextblock || !qt(r.doc, e.to))
|
|
@@ -4479,15 +4478,15 @@ const Ki = (r, t) => {
|
|
|
4479
4478
|
} else if (n = Ue(r.doc, e.to, 1), n == null)
|
|
4480
4479
|
return !1;
|
|
4481
4480
|
return t && t(r.tr.join(n).scrollIntoView()), !0;
|
|
4482
|
-
},
|
|
4481
|
+
}, Xi = (r, t) => {
|
|
4483
4482
|
let { $from: e, $to: n } = r.selection, o = e.blockRange(n), i = o && Qt(o);
|
|
4484
4483
|
return i == null ? !1 : (t && t(r.tr.lift(o, i).scrollIntoView()), !0);
|
|
4485
|
-
},
|
|
4484
|
+
}, Yr = (r, t) => {
|
|
4486
4485
|
let { $head: e, $anchor: n } = r.selection;
|
|
4487
4486
|
return !e.parent.type.spec.code || !e.sameParent(n) ? !1 : (t && t(r.tr.insertText(`
|
|
4488
4487
|
`).scrollIntoView()), !0);
|
|
4489
4488
|
};
|
|
4490
|
-
function
|
|
4489
|
+
function En(r) {
|
|
4491
4490
|
for (let t = 0; t < r.edgeCount; t++) {
|
|
4492
4491
|
let { type: e } = r.edge(t);
|
|
4493
4492
|
if (e.isTextblock && !e.hasRequiredAttrs())
|
|
@@ -4495,11 +4494,11 @@ function Mn(r) {
|
|
|
4495
4494
|
}
|
|
4496
4495
|
return null;
|
|
4497
4496
|
}
|
|
4498
|
-
const
|
|
4497
|
+
const Zi = (r, t) => {
|
|
4499
4498
|
let { $head: e, $anchor: n } = r.selection;
|
|
4500
4499
|
if (!e.parent.type.spec.code || !e.sameParent(n))
|
|
4501
4500
|
return !1;
|
|
4502
|
-
let o = e.node(-1), i = e.indexAfter(-1), s =
|
|
4501
|
+
let o = e.node(-1), i = e.indexAfter(-1), s = En(o.contentMatchAt(i));
|
|
4503
4502
|
if (!s || !o.canReplaceWith(i, i, s))
|
|
4504
4503
|
return !1;
|
|
4505
4504
|
if (t) {
|
|
@@ -4507,11 +4506,11 @@ const Qi = (r, t) => {
|
|
|
4507
4506
|
a.setSelection($.near(a.doc.resolve(l), 1)), t(a.scrollIntoView());
|
|
4508
4507
|
}
|
|
4509
4508
|
return !0;
|
|
4510
|
-
},
|
|
4509
|
+
}, to = (r, t) => {
|
|
4511
4510
|
let e = r.selection, { $from: n, $to: o } = e;
|
|
4512
4511
|
if (e instanceof dt || n.parent.inlineContent || o.parent.inlineContent)
|
|
4513
4512
|
return !1;
|
|
4514
|
-
let i =
|
|
4513
|
+
let i = En(o.parent.contentMatchAt(o.indexAfter()));
|
|
4515
4514
|
if (!i || !i.isTextblock)
|
|
4516
4515
|
return !1;
|
|
4517
4516
|
if (t) {
|
|
@@ -4519,7 +4518,7 @@ const Qi = (r, t) => {
|
|
|
4519
4518
|
l.setSelection(D.create(l.doc, s + 1)), t(l.scrollIntoView());
|
|
4520
4519
|
}
|
|
4521
4520
|
return !0;
|
|
4522
|
-
},
|
|
4521
|
+
}, eo = (r, t) => {
|
|
4523
4522
|
let { $cursor: e } = r.selection;
|
|
4524
4523
|
if (!e || e.parent.content.size)
|
|
4525
4524
|
return !1;
|
|
@@ -4531,7 +4530,7 @@ const Qi = (r, t) => {
|
|
|
4531
4530
|
let n = e.blockRange(), o = n && Qt(n);
|
|
4532
4531
|
return o == null ? !1 : (t && t(r.tr.lift(n, o).scrollIntoView()), !0);
|
|
4533
4532
|
};
|
|
4534
|
-
function
|
|
4533
|
+
function Qi(r) {
|
|
4535
4534
|
return (t, e) => {
|
|
4536
4535
|
let { $from: n, $to: o } = t.selection;
|
|
4537
4536
|
if (t.selection instanceof P && t.selection.node.isBlock)
|
|
@@ -4541,7 +4540,7 @@ function Yi(r) {
|
|
|
4541
4540
|
let i = [], s, l, a = !1, c = !1;
|
|
4542
4541
|
for (let h = n.depth; ; h--)
|
|
4543
4542
|
if (n.node(h).isBlock) {
|
|
4544
|
-
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 = En(n.node(h - 1).contentMatchAt(n.indexAfter(h - 1))), i.unshift(a && l ? { type: l } : null), s = h;
|
|
4545
4544
|
break;
|
|
4546
4545
|
} else {
|
|
4547
4546
|
if (h == 1)
|
|
@@ -4560,17 +4559,17 @@ function Yi(r) {
|
|
|
4560
4559
|
return e && e(u.scrollIntoView()), !0;
|
|
4561
4560
|
};
|
|
4562
4561
|
}
|
|
4563
|
-
const
|
|
4562
|
+
const Yi = Qi(), ts = (r, t) => {
|
|
4564
4563
|
let { $from: e, to: n } = r.selection, o, i = e.sharedDepth(n);
|
|
4565
4564
|
return i == 0 ? !1 : (o = e.before(i), t && t(r.tr.setSelection(P.create(r.doc, o))), !0);
|
|
4566
4565
|
};
|
|
4567
|
-
function
|
|
4566
|
+
function es(r, t, e) {
|
|
4568
4567
|
let n = t.nodeBefore, o = t.nodeAfter, i = t.index();
|
|
4569
4568
|
return !n || !o || !n.type.compatibleContent(o.type) ? !1 : !n.content.size && t.parent.canReplace(i - 1, i) ? (e && e(r.tr.delete(t.pos - n.nodeSize, t.pos).scrollIntoView()), !0) : !t.parent.canReplace(i, i + 1) || !(o.isTextblock || qt(r.doc, t.pos)) ? !1 : (e && e(r.tr.join(t.pos).scrollIntoView()), !0);
|
|
4570
4569
|
}
|
|
4571
|
-
function
|
|
4570
|
+
function no(r, t, e, n) {
|
|
4572
4571
|
let o = t.nodeBefore, i = t.nodeAfter, s, l, a = o.type.spec.isolating || i.type.spec.isolating;
|
|
4573
|
-
if (!a &&
|
|
4572
|
+
if (!a && es(r, t, e))
|
|
4574
4573
|
return !0;
|
|
4575
4574
|
let c = !a && t.parent.canReplace(t.index(), t.index() + 1);
|
|
4576
4575
|
if (c && (s = (l = o.contentMatchAt(o.childCount)).findWrapping(i.type)) && l.matchType(s[0] || i.type).validEnd) {
|
|
@@ -4607,7 +4606,7 @@ function eo(r, t, e, n) {
|
|
|
4607
4606
|
}
|
|
4608
4607
|
return !1;
|
|
4609
4608
|
}
|
|
4610
|
-
function
|
|
4609
|
+
function ro(r) {
|
|
4611
4610
|
return function(t, e) {
|
|
4612
4611
|
let n = t.selection, o = r < 0 ? n.$from : n.$to, i = o.depth;
|
|
4613
4612
|
for (; o.node(i).isInline; ) {
|
|
@@ -4618,14 +4617,14 @@ function no(r) {
|
|
|
4618
4617
|
return o.node(i).isTextblock ? (e && e(t.tr.setSelection(D.create(t.doc, r < 0 ? o.start(i) : o.end(i)))), !0) : !1;
|
|
4619
4618
|
};
|
|
4620
4619
|
}
|
|
4621
|
-
const
|
|
4622
|
-
function
|
|
4620
|
+
const ns = ro(-1), rs = ro(1);
|
|
4621
|
+
function is(r, t = null) {
|
|
4623
4622
|
return function(e, n) {
|
|
4624
|
-
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 && Lr(s, r, t);
|
|
4625
4624
|
return l ? (n && n(e.tr.wrap(s, l).scrollIntoView()), !0) : !1;
|
|
4626
4625
|
};
|
|
4627
4626
|
}
|
|
4628
|
-
function
|
|
4627
|
+
function or(r, t = null) {
|
|
4629
4628
|
return function(e, n) {
|
|
4630
4629
|
let o = !1;
|
|
4631
4630
|
for (let i = 0; i < e.selection.ranges.length && !o; i++) {
|
|
@@ -4655,7 +4654,7 @@ function rr(r, t = null) {
|
|
|
4655
4654
|
return !0;
|
|
4656
4655
|
};
|
|
4657
4656
|
}
|
|
4658
|
-
function
|
|
4657
|
+
function Nn(...r) {
|
|
4659
4658
|
return function(t, e, n) {
|
|
4660
4659
|
for (let o = 0; o < r.length; o++)
|
|
4661
4660
|
if (r[o](t, e, n))
|
|
@@ -4663,20 +4662,20 @@ function En(...r) {
|
|
|
4663
4662
|
return !1;
|
|
4664
4663
|
};
|
|
4665
4664
|
}
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4665
|
+
Nn(Tn, Ur, Kr);
|
|
4666
|
+
Nn(Tn, Zr, Qr);
|
|
4667
|
+
Nn(Yr, to, eo, Yi);
|
|
4669
4668
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
4670
|
-
function
|
|
4669
|
+
function ss(r, t = null) {
|
|
4671
4670
|
return function(e, n) {
|
|
4672
4671
|
let { $from: o, $to: i } = e.selection, s = o.blockRange(i);
|
|
4673
4672
|
if (!s)
|
|
4674
4673
|
return !1;
|
|
4675
4674
|
let l = n ? e.tr : null;
|
|
4676
|
-
return
|
|
4675
|
+
return ls(l, s, r, t) ? (n && n(l.scrollIntoView()), !0) : !1;
|
|
4677
4676
|
};
|
|
4678
4677
|
}
|
|
4679
|
-
function
|
|
4678
|
+
function ls(r, t, e, n = null) {
|
|
4680
4679
|
let o = !1, i = t, s = t.$from.doc;
|
|
4681
4680
|
if (t.depth >= 2 && t.$from.node(t.depth - 1).type.compatibleContent(e) && t.startIndex == 0) {
|
|
4682
4681
|
if (t.$from.index(t.depth - 1) == 0)
|
|
@@ -4684,10 +4683,10 @@ function as(r, t, e, n = null) {
|
|
|
4684
4683
|
let a = s.resolve(t.start - 2);
|
|
4685
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;
|
|
4686
4685
|
}
|
|
4687
|
-
let l =
|
|
4688
|
-
return l ? (r &&
|
|
4686
|
+
let l = Lr(i, e, n, t);
|
|
4687
|
+
return l ? (r && as(r, t, l, o, e), !0) : !1;
|
|
4689
4688
|
}
|
|
4690
|
-
function
|
|
4689
|
+
function as(r, t, e, n, o) {
|
|
4691
4690
|
let i = x.empty;
|
|
4692
4691
|
for (let u = e.length - 1; u >= 0; u--)
|
|
4693
4692
|
i = x.from(e[u].type.create(e[u].attrs, i));
|
|
@@ -4700,13 +4699,13 @@ function cs(r, t, e, n, o) {
|
|
|
4700
4699
|
!d && Mt(r.doc, a, l) && (r.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
|
|
4701
4700
|
return r;
|
|
4702
4701
|
}
|
|
4703
|
-
function
|
|
4702
|
+
function cs(r) {
|
|
4704
4703
|
return function(t, e) {
|
|
4705
4704
|
let { $from: n, $to: o } = t.selection, i = n.blockRange(o, (s) => s.childCount > 0 && s.firstChild.type == r);
|
|
4706
|
-
return i ? e ? n.node(i.depth - 1).type == r ?
|
|
4705
|
+
return i ? e ? n.node(i.depth - 1).type == r ? us(t, e, r, i) : fs(t, e, i) : !0 : !1;
|
|
4707
4706
|
};
|
|
4708
4707
|
}
|
|
4709
|
-
function
|
|
4708
|
+
function us(r, t, e, n) {
|
|
4710
4709
|
let o = r.tr, i = n.end, s = n.$to.end(n.depth);
|
|
4711
4710
|
i < s && (o.step(new it(i - 1, s, i, s, new S(x.from(e.create(null, n.parent.copy())), 1, 0), 1, !0)), n = new De(o.doc.resolve(n.$from.pos), o.doc.resolve(s), n.depth));
|
|
4712
4711
|
const l = Qt(n);
|
|
@@ -4716,7 +4715,7 @@ function fs(r, t, e, n) {
|
|
|
4716
4715
|
let a = o.doc.resolve(o.mapping.map(i, -1) - 1);
|
|
4717
4716
|
return qt(o.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && o.join(a.pos), t(o.scrollIntoView()), !0;
|
|
4718
4717
|
}
|
|
4719
|
-
function
|
|
4718
|
+
function fs(r, t, e) {
|
|
4720
4719
|
let n = r.tr, o = e.parent;
|
|
4721
4720
|
for (let h = e.end, m = e.endIndex - 1, p = e.startIndex; m > p; m--)
|
|
4722
4721
|
h -= o.child(m).nodeSize, n.delete(h - 1, h + 1);
|
|
@@ -4729,7 +4728,7 @@ function ds(r, t, e) {
|
|
|
4729
4728
|
let f = i.pos, d = f + s.nodeSize;
|
|
4730
4729
|
return n.step(new it(f - (l ? 1 : 0), d + (a ? 1 : 0), f + 1, d - 1, new S((l ? x.empty : x.from(o.copy(x.empty))).append(a ? x.empty : x.from(o.copy(x.empty))), l ? 0 : 1, a ? 0 : 1), l ? 0 : 1)), t(n.scrollIntoView()), !0;
|
|
4731
4730
|
}
|
|
4732
|
-
function
|
|
4731
|
+
function ds(r) {
|
|
4733
4732
|
return function(t, e) {
|
|
4734
4733
|
let { $from: n, $to: o } = t.selection, i = n.blockRange(o, (c) => c.childCount > 0 && c.firstChild.type == r);
|
|
4735
4734
|
if (!i)
|
|
@@ -4747,7 +4746,7 @@ function hs(r) {
|
|
|
4747
4746
|
return !0;
|
|
4748
4747
|
};
|
|
4749
4748
|
}
|
|
4750
|
-
function
|
|
4749
|
+
function oo(r) {
|
|
4751
4750
|
const { state: t, transaction: e } = r;
|
|
4752
4751
|
let { selection: n } = e, { doc: o } = e, { storedMarks: i } = e;
|
|
4753
4752
|
return {
|
|
@@ -4772,7 +4771,7 @@ function ro(r) {
|
|
|
4772
4771
|
}
|
|
4773
4772
|
};
|
|
4774
4773
|
}
|
|
4775
|
-
class
|
|
4774
|
+
class hs {
|
|
4776
4775
|
constructor(t) {
|
|
4777
4776
|
this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
|
|
4778
4777
|
}
|
|
@@ -4817,7 +4816,7 @@ class ps {
|
|
|
4817
4816
|
tr: t,
|
|
4818
4817
|
editor: o,
|
|
4819
4818
|
view: s,
|
|
4820
|
-
state:
|
|
4819
|
+
state: oo({
|
|
4821
4820
|
state: i,
|
|
4822
4821
|
transaction: t
|
|
4823
4822
|
}),
|
|
@@ -4838,7 +4837,7 @@ function gt(r, t, e) {
|
|
|
4838
4837
|
parent: r.parent ? gt(r.parent, t, e) : null
|
|
4839
4838
|
}) : r.config[t];
|
|
4840
4839
|
}
|
|
4841
|
-
function
|
|
4840
|
+
function ps(r) {
|
|
4842
4841
|
const t = r.filter((o) => o.type === "extension"), e = r.filter((o) => o.type === "node"), n = r.filter((o) => o.type === "mark");
|
|
4843
4842
|
return {
|
|
4844
4843
|
baseExtensions: t,
|
|
@@ -4854,25 +4853,25 @@ function et(r, t) {
|
|
|
4854
4853
|
}
|
|
4855
4854
|
return r;
|
|
4856
4855
|
}
|
|
4857
|
-
function
|
|
4856
|
+
function ms(r) {
|
|
4858
4857
|
return typeof r == "function";
|
|
4859
4858
|
}
|
|
4860
4859
|
function At(r, t = void 0, ...e) {
|
|
4861
|
-
return
|
|
4860
|
+
return ms(r) ? t ? r.bind(t)(...e) : r(...e) : r;
|
|
4862
4861
|
}
|
|
4863
|
-
function
|
|
4862
|
+
function gs(r) {
|
|
4864
4863
|
return Object.prototype.toString.call(r) === "[object RegExp]";
|
|
4865
4864
|
}
|
|
4866
|
-
function
|
|
4865
|
+
function ys(r) {
|
|
4867
4866
|
return Object.prototype.toString.call(r).slice(8, -1);
|
|
4868
4867
|
}
|
|
4869
4868
|
function Ae(r) {
|
|
4870
|
-
return
|
|
4869
|
+
return ys(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
|
|
4871
4870
|
}
|
|
4872
|
-
function
|
|
4871
|
+
function In(r, t) {
|
|
4873
4872
|
const e = { ...r };
|
|
4874
4873
|
return Ae(r) && Ae(t) && Object.keys(t).forEach((n) => {
|
|
4875
|
-
Ae(t[n]) && Ae(r[n]) ? e[n] =
|
|
4874
|
+
Ae(t[n]) && Ae(r[n]) ? e[n] = In(r[n], t[n]) : e[n] = t[n];
|
|
4876
4875
|
}), e;
|
|
4877
4876
|
}
|
|
4878
4877
|
class je {
|
|
@@ -4896,7 +4895,7 @@ class je {
|
|
|
4896
4895
|
configure(t = {}) {
|
|
4897
4896
|
const e = this.extend({
|
|
4898
4897
|
...this.config,
|
|
4899
|
-
addOptions: () =>
|
|
4898
|
+
addOptions: () => In(this.options, t)
|
|
4900
4899
|
});
|
|
4901
4900
|
return e.name = this.name, e.parent = this.parent, e;
|
|
4902
4901
|
}
|
|
@@ -4942,7 +4941,7 @@ class ht {
|
|
|
4942
4941
|
configure(t = {}) {
|
|
4943
4942
|
const e = this.extend({
|
|
4944
4943
|
...this.config,
|
|
4945
|
-
addOptions: () =>
|
|
4944
|
+
addOptions: () => In(this.options, t)
|
|
4946
4945
|
});
|
|
4947
4946
|
return e.name = this.name, e.parent = this.parent, e;
|
|
4948
4947
|
}
|
|
@@ -4956,7 +4955,7 @@ class ht {
|
|
|
4956
4955
|
})), e;
|
|
4957
4956
|
}
|
|
4958
4957
|
}
|
|
4959
|
-
function
|
|
4958
|
+
function ws(r, t, e) {
|
|
4960
4959
|
const { from: n, to: o } = t, { blockSeparator: i = `
|
|
4961
4960
|
|
|
4962
4961
|
`, textSerializers: s = {} } = e || {};
|
|
@@ -4976,7 +4975,7 @@ function xs(r, t, e) {
|
|
|
4976
4975
|
a.isText && (l += (d = a?.text) === null || d === void 0 ? void 0 : d.slice(Math.max(n, c) - c, o - c));
|
|
4977
4976
|
}), l;
|
|
4978
4977
|
}
|
|
4979
|
-
function
|
|
4978
|
+
function xs(r) {
|
|
4980
4979
|
return Object.fromEntries(Object.entries(r.nodes).filter(([, t]) => t.spec.toText).map(([t, e]) => [t, e.spec.toText]));
|
|
4981
4980
|
}
|
|
4982
4981
|
ht.create({
|
|
@@ -4992,8 +4991,8 @@ ht.create({
|
|
|
4992
4991
|
key: new Rt("clipboardTextSerializer"),
|
|
4993
4992
|
props: {
|
|
4994
4993
|
clipboardTextSerializer: () => {
|
|
4995
|
-
const { editor: r } = this, { state: t, schema: e } = r, { doc: n, selection: o } = t, { ranges: i } = o, s = Math.min(...i.map((u) => u.$from.pos)), l = Math.max(...i.map((u) => u.$to.pos)), a =
|
|
4996
|
-
return
|
|
4994
|
+
const { editor: r } = this, { state: t, schema: e } = r, { doc: n, selection: o } = t, { ranges: i } = o, s = Math.min(...i.map((u) => u.$from.pos)), l = Math.max(...i.map((u) => u.$to.pos)), a = xs(e);
|
|
4995
|
+
return ws(n, { from: s, to: l }, {
|
|
4997
4996
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
4998
4997
|
textSerializers: a
|
|
4999
4998
|
});
|
|
@@ -5003,10 +5002,10 @@ ht.create({
|
|
|
5003
5002
|
];
|
|
5004
5003
|
}
|
|
5005
5004
|
});
|
|
5006
|
-
const
|
|
5005
|
+
const ks = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
5007
5006
|
var e;
|
|
5008
5007
|
r.isDestroyed || (t.dom.blur(), (e = window?.getSelection()) === null || e === void 0 || e.removeAllRanges());
|
|
5009
|
-
}), !0),
|
|
5008
|
+
}), !0), bs = (r = !1) => ({ commands: t }) => t.setContent("", r), vs = () => ({ state: r, tr: t, dispatch: e }) => {
|
|
5010
5009
|
const { selection: n } = t, { ranges: o } = n;
|
|
5011
5010
|
return e && o.forEach(({ $from: i, $to: s }) => {
|
|
5012
5011
|
r.doc.nodesBetween(i.pos, s.pos, (l, a) => {
|
|
@@ -5023,12 +5022,12 @@ const bs = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5023
5022
|
(m || m === 0) && t.lift(h, m);
|
|
5024
5023
|
});
|
|
5025
5024
|
}), !0;
|
|
5026
|
-
},
|
|
5025
|
+
}, Ss = (r) => (t) => r(t), Cs = () => ({ state: r, dispatch: t }) => to(r, t), Ts = (r, t) => ({ editor: e, tr: n }) => {
|
|
5027
5026
|
const { state: o } = e, i = o.doc.slice(r.from, r.to);
|
|
5028
5027
|
n.deleteRange(r.from, r.to);
|
|
5029
5028
|
const s = n.mapping.map(t);
|
|
5030
5029
|
return n.insert(s, i.content), n.setSelection(new D(n.doc.resolve(s - 1))), !0;
|
|
5031
|
-
},
|
|
5030
|
+
}, As = () => ({ tr: r, dispatch: t }) => {
|
|
5032
5031
|
const { selection: e } = r, n = e.$anchor.node();
|
|
5033
5032
|
if (n.content.size > 0)
|
|
5034
5033
|
return !1;
|
|
@@ -5042,7 +5041,7 @@ const bs = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5042
5041
|
return !0;
|
|
5043
5042
|
}
|
|
5044
5043
|
return !1;
|
|
5045
|
-
},
|
|
5044
|
+
}, Ms = (r) => ({ tr: t, state: e, dispatch: n }) => {
|
|
5046
5045
|
const o = et(r, e.schema), i = t.selection.$anchor;
|
|
5047
5046
|
for (let s = i.depth; s > 0; s -= 1)
|
|
5048
5047
|
if (i.node(s).type === o) {
|
|
@@ -5053,35 +5052,35 @@ const bs = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5053
5052
|
return !0;
|
|
5054
5053
|
}
|
|
5055
5054
|
return !1;
|
|
5056
|
-
},
|
|
5055
|
+
}, Es = (r) => ({ tr: t, dispatch: e }) => {
|
|
5057
5056
|
const { from: n, to: o } = r;
|
|
5058
5057
|
return e && t.delete(n, o), !0;
|
|
5059
|
-
},
|
|
5058
|
+
}, Ns = () => ({ state: r, dispatch: t }) => Tn(r, t), Is = () => ({ commands: r }) => r.keyboardShortcut("Enter"), Os = () => ({ state: r, dispatch: t }) => Zi(r, t);
|
|
5060
5059
|
function Ve(r, t, e = { strict: !0 }) {
|
|
5061
5060
|
const n = Object.keys(t);
|
|
5062
|
-
return n.length ? n.every((o) => e.strict ? t[o] === r[o] :
|
|
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;
|
|
5063
5062
|
}
|
|
5064
|
-
function
|
|
5063
|
+
function io(r, t, e = {}) {
|
|
5065
5064
|
return r.find((n) => n.type === t && Ve(
|
|
5066
5065
|
// Only check equality for the attributes that are provided
|
|
5067
5066
|
Object.fromEntries(Object.keys(e).map((o) => [o, n.attrs[o]])),
|
|
5068
5067
|
e
|
|
5069
5068
|
));
|
|
5070
5069
|
}
|
|
5071
|
-
function
|
|
5072
|
-
return !!
|
|
5070
|
+
function ir(r, t, e = {}) {
|
|
5071
|
+
return !!io(r, t, e);
|
|
5073
5072
|
}
|
|
5074
|
-
function
|
|
5073
|
+
function so(r, t, e) {
|
|
5075
5074
|
var n;
|
|
5076
5075
|
if (!r || !t)
|
|
5077
5076
|
return;
|
|
5078
5077
|
let o = r.parent.childAfter(r.parentOffset);
|
|
5079
|
-
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), !
|
|
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)))
|
|
5080
5079
|
return;
|
|
5081
5080
|
let s = o.index, l = r.start() + o.offset, a = s + 1, c = l + o.node.nodeSize;
|
|
5082
|
-
for (; s > 0 &&
|
|
5081
|
+
for (; s > 0 && ir([...r.parent.child(s - 1).marks], t, e); )
|
|
5083
5082
|
s -= 1, l -= r.parent.child(s).nodeSize;
|
|
5084
|
-
for (; a < r.parent.childCount &&
|
|
5083
|
+
for (; a < r.parent.childCount && ir([...r.parent.child(a).marks], t, e); )
|
|
5085
5084
|
c += r.parent.child(a).nodeSize, a += 1;
|
|
5086
5085
|
return {
|
|
5087
5086
|
from: l,
|
|
@@ -5096,30 +5095,30 @@ function zt(r, t) {
|
|
|
5096
5095
|
}
|
|
5097
5096
|
return r;
|
|
5098
5097
|
}
|
|
5099
|
-
const
|
|
5098
|
+
const $s = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5100
5099
|
const i = zt(r, n.schema), { doc: s, selection: l } = e, { $from: a, from: c, to: u } = l;
|
|
5101
5100
|
if (o) {
|
|
5102
|
-
const f =
|
|
5101
|
+
const f = so(a, i, t);
|
|
5103
5102
|
if (f && f.from <= c && f.to >= u) {
|
|
5104
5103
|
const d = D.create(s, f.from, f.to);
|
|
5105
5104
|
e.setSelection(d);
|
|
5106
5105
|
}
|
|
5107
5106
|
}
|
|
5108
5107
|
return !0;
|
|
5109
|
-
},
|
|
5108
|
+
}, Bs = (r) => (t) => {
|
|
5110
5109
|
const e = typeof r == "function" ? r(t) : r;
|
|
5111
5110
|
for (let n = 0; n < e.length; n += 1)
|
|
5112
5111
|
if (e[n](t))
|
|
5113
5112
|
return !0;
|
|
5114
5113
|
return !1;
|
|
5115
5114
|
};
|
|
5116
|
-
function
|
|
5115
|
+
function lo(r) {
|
|
5117
5116
|
return r instanceof D;
|
|
5118
5117
|
}
|
|
5119
5118
|
function Lt(r = 0, t = 0, e = 0) {
|
|
5120
5119
|
return Math.min(Math.max(r, t), e);
|
|
5121
5120
|
}
|
|
5122
|
-
function
|
|
5121
|
+
function Rs(r, t = null) {
|
|
5123
5122
|
if (!t)
|
|
5124
5123
|
return null;
|
|
5125
5124
|
const e = $.atStart(r), n = $.atEnd(r);
|
|
@@ -5130,10 +5129,10 @@ function zs(r, t = null) {
|
|
|
5130
5129
|
const o = e.from, i = n.to;
|
|
5131
5130
|
return t === "all" ? D.create(r, Lt(0, o, i), Lt(r.content.size, o, i)) : D.create(r, Lt(t, o, i), Lt(t, o, i));
|
|
5132
5131
|
}
|
|
5133
|
-
function
|
|
5132
|
+
function zs() {
|
|
5134
5133
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
5135
5134
|
}
|
|
5136
|
-
function
|
|
5135
|
+
function On() {
|
|
5137
5136
|
return [
|
|
5138
5137
|
"iPad Simulator",
|
|
5139
5138
|
"iPhone Simulator",
|
|
@@ -5143,33 +5142,33 @@ function In() {
|
|
|
5143
5142
|
"iPod"
|
|
5144
5143
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
5145
5144
|
}
|
|
5146
|
-
const
|
|
5145
|
+
const Ps = (r = null, t = {}) => ({ editor: e, view: n, tr: o, dispatch: i }) => {
|
|
5147
5146
|
t = {
|
|
5148
5147
|
scrollIntoView: !0,
|
|
5149
5148
|
...t
|
|
5150
5149
|
};
|
|
5151
5150
|
const s = () => {
|
|
5152
|
-
(
|
|
5151
|
+
(On() || zs()) && n.dom.focus(), requestAnimationFrame(() => {
|
|
5153
5152
|
e.isDestroyed || (n.focus(), t?.scrollIntoView && e.commands.scrollIntoView());
|
|
5154
5153
|
});
|
|
5155
5154
|
};
|
|
5156
5155
|
if (n.hasFocus() && r === null || r === !1)
|
|
5157
5156
|
return !0;
|
|
5158
|
-
if (i && r === null && !
|
|
5157
|
+
if (i && r === null && !lo(e.state.selection))
|
|
5159
5158
|
return s(), !0;
|
|
5160
|
-
const l =
|
|
5159
|
+
const l = Rs(o.doc, r) || e.state.selection, a = e.state.selection.eq(l);
|
|
5161
5160
|
return i && (a || o.setSelection(l), a && o.storedMarks && o.setStoredMarks(o.storedMarks), s()), !0;
|
|
5162
|
-
},
|
|
5161
|
+
}, Fs = (r, t) => (e) => r.every((n, o) => t(n, { ...e, index: o })), _s = (r, t) => ({ tr: e, commands: n }) => n.insertContentAt({ from: e.selection.from, to: e.selection.to }, r, t), ao = (r) => {
|
|
5163
5162
|
const t = r.childNodes;
|
|
5164
5163
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
5165
5164
|
const n = t[e];
|
|
5166
|
-
n.nodeType === 3 && n.nodeValue && /^(\n\s\s|\n)$/.test(n.nodeValue) ? r.removeChild(n) : n.nodeType === 1 &&
|
|
5165
|
+
n.nodeType === 3 && n.nodeValue && /^(\n\s\s|\n)$/.test(n.nodeValue) ? r.removeChild(n) : n.nodeType === 1 && ao(n);
|
|
5167
5166
|
}
|
|
5168
5167
|
return r;
|
|
5169
5168
|
};
|
|
5170
5169
|
function Me(r) {
|
|
5171
5170
|
const t = `<body>${r}</body>`, e = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
5172
|
-
return
|
|
5171
|
+
return ao(e);
|
|
5173
5172
|
}
|
|
5174
5173
|
function qe(r, t, e) {
|
|
5175
5174
|
if (r instanceof kt || r instanceof x)
|
|
@@ -5194,7 +5193,7 @@ function qe(r, t, e) {
|
|
|
5194
5193
|
if (o) {
|
|
5195
5194
|
if (e.errorOnInvalidContent) {
|
|
5196
5195
|
let s = !1, l = "";
|
|
5197
|
-
const a = new
|
|
5196
|
+
const a = new Ni({
|
|
5198
5197
|
topNode: t.spec.topNode,
|
|
5199
5198
|
marks: t.spec.marks,
|
|
5200
5199
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -5220,7 +5219,7 @@ function qe(r, t, e) {
|
|
|
5220
5219
|
}
|
|
5221
5220
|
return qe("", t, e);
|
|
5222
5221
|
}
|
|
5223
|
-
function
|
|
5222
|
+
function Ds(r, t, e) {
|
|
5224
5223
|
const n = r.steps.length - 1;
|
|
5225
5224
|
if (n < t)
|
|
5226
5225
|
return;
|
|
@@ -5233,7 +5232,7 @@ function Js(r, t, e) {
|
|
|
5233
5232
|
s === 0 && (s = u);
|
|
5234
5233
|
}), r.setSelection($.near(r.doc.resolve(s), e));
|
|
5235
5234
|
}
|
|
5236
|
-
const
|
|
5235
|
+
const Js = (r) => !("type" in r), Ls = (r, t, e) => ({ tr: n, dispatch: o, editor: i }) => {
|
|
5237
5236
|
var s;
|
|
5238
5237
|
if (o) {
|
|
5239
5238
|
e = {
|
|
@@ -5262,7 +5261,7 @@ const Ls = (r) => !("type" in r), Ws = (r, t, e) => ({ tr: n, dispatch: o, edito
|
|
|
5262
5261
|
}), !1;
|
|
5263
5262
|
}
|
|
5264
5263
|
let { from: a, to: c } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, u = !0, f = !0;
|
|
5265
|
-
if ((
|
|
5264
|
+
if ((Js(l) ? l : [l]).forEach((m) => {
|
|
5266
5265
|
m.check(), u = u ? m.isText && m.marks.length === 0 : !1, f = f ? m.isBlock : !1;
|
|
5267
5266
|
}), a === c && f) {
|
|
5268
5267
|
const { parent: m } = n.doc.resolve(a);
|
|
@@ -5281,28 +5280,28 @@ const Ls = (r) => !("type" in r), Ws = (r, t, e) => ({ tr: n, dispatch: o, edito
|
|
|
5281
5280
|
n.insertText(h, a, c);
|
|
5282
5281
|
} else
|
|
5283
5282
|
h = l, n.replaceWith(a, c, h);
|
|
5284
|
-
e.updateSelection &&
|
|
5283
|
+
e.updateSelection && Ds(n, n.steps.length - 1, -1), e.applyInputRules && n.setMeta("applyInputRules", { from: a, text: h }), e.applyPasteRules && n.setMeta("applyPasteRules", { from: a, text: h });
|
|
5285
5284
|
}
|
|
5286
5285
|
return !0;
|
|
5287
|
-
},
|
|
5286
|
+
}, Ws = () => ({ state: r, dispatch: t }) => Gi(r, t), js = () => ({ state: r, dispatch: t }) => Ki(r, t), Vs = () => ({ state: r, dispatch: t }) => Ur(r, t), qs = () => ({ state: r, dispatch: t }) => Zr(r, t), Hs = () => ({ state: r, dispatch: t, tr: e }) => {
|
|
5288
5287
|
try {
|
|
5289
5288
|
const n = Ue(r.doc, r.selection.$from.pos, -1);
|
|
5290
5289
|
return n == null ? !1 : (e.join(n, 2), t && t(e), !0);
|
|
5291
5290
|
} catch {
|
|
5292
5291
|
return !1;
|
|
5293
5292
|
}
|
|
5294
|
-
},
|
|
5293
|
+
}, Us = () => ({ state: r, dispatch: t, tr: e }) => {
|
|
5295
5294
|
try {
|
|
5296
5295
|
const n = Ue(r.doc, r.selection.$from.pos, 1);
|
|
5297
5296
|
return n == null ? !1 : (e.join(n, 2), t && t(e), !0);
|
|
5298
5297
|
} catch {
|
|
5299
5298
|
return !1;
|
|
5300
5299
|
}
|
|
5301
|
-
},
|
|
5302
|
-
function
|
|
5300
|
+
}, Gs = () => ({ state: r, dispatch: t }) => Hi(r, t), Ks = () => ({ state: r, dispatch: t }) => Ui(r, t);
|
|
5301
|
+
function co() {
|
|
5303
5302
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
5304
5303
|
}
|
|
5305
|
-
function
|
|
5304
|
+
function Xs(r) {
|
|
5306
5305
|
const t = r.split(/-(?!$)/);
|
|
5307
5306
|
let e = t[t.length - 1];
|
|
5308
5307
|
e === "Space" && (e = " ");
|
|
@@ -5318,14 +5317,14 @@ function Zs(r) {
|
|
|
5318
5317
|
else if (/^s(hift)?$/i.test(a))
|
|
5319
5318
|
i = !0;
|
|
5320
5319
|
else if (/^mod$/i.test(a))
|
|
5321
|
-
|
|
5320
|
+
On() || co() ? s = !0 : o = !0;
|
|
5322
5321
|
else
|
|
5323
5322
|
throw new Error(`Unrecognized modifier name: ${a}`);
|
|
5324
5323
|
}
|
|
5325
5324
|
return n && (e = `Alt-${e}`), o && (e = `Ctrl-${e}`), s && (e = `Meta-${e}`), i && (e = `Shift-${e}`), e;
|
|
5326
5325
|
}
|
|
5327
|
-
const
|
|
5328
|
-
const i =
|
|
5326
|
+
const Zs = (r) => ({ editor: t, view: e, tr: n, dispatch: o }) => {
|
|
5327
|
+
const i = Xs(r).split(/-(?!$)/), s = i.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), l = new KeyboardEvent("keydown", {
|
|
5329
5328
|
key: s === "Space" ? " " : s,
|
|
5330
5329
|
altKey: i.includes("Alt"),
|
|
5331
5330
|
ctrlKey: i.includes("Ctrl"),
|
|
@@ -5341,7 +5340,7 @@ const Qs = (r) => ({ editor: t, view: e, tr: n, dispatch: o }) => {
|
|
|
5341
5340
|
u && o && n.maybeStep(u);
|
|
5342
5341
|
}), !0;
|
|
5343
5342
|
};
|
|
5344
|
-
function
|
|
5343
|
+
function $n(r, t, e = {}) {
|
|
5345
5344
|
const { from: n, to: o, empty: i } = r.selection, s = t ? et(t, r.schema) : null, l = [];
|
|
5346
5345
|
r.doc.nodesBetween(n, o, (f, d) => {
|
|
5347
5346
|
if (f.isText)
|
|
@@ -5356,49 +5355,49 @@ function On(r, t, e = {}) {
|
|
|
5356
5355
|
const a = o - n, c = l.filter((f) => s ? s.name === f.node.type.name : !0).filter((f) => Ve(f.node.attrs, e, { strict: !1 }));
|
|
5357
5356
|
return i ? !!c.length : c.reduce((f, d) => f + d.to - d.from, 0) >= a;
|
|
5358
5357
|
}
|
|
5359
|
-
const
|
|
5358
|
+
const Qs = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5360
5359
|
const o = et(r, e.schema);
|
|
5361
|
-
return
|
|
5362
|
-
},
|
|
5360
|
+
return $n(e, o, t) ? Xi(e, n) : !1;
|
|
5361
|
+
}, Ys = () => ({ state: r, dispatch: t }) => eo(r, t), tl = (r) => ({ state: t, dispatch: e }) => {
|
|
5363
5362
|
const n = et(r, t.schema);
|
|
5364
|
-
return
|
|
5365
|
-
},
|
|
5366
|
-
function
|
|
5363
|
+
return cs(n)(t, e);
|
|
5364
|
+
}, el = () => ({ state: r, dispatch: t }) => Yr(r, t);
|
|
5365
|
+
function uo(r, t) {
|
|
5367
5366
|
return t.nodes[r] ? "node" : t.marks[r] ? "mark" : null;
|
|
5368
5367
|
}
|
|
5369
|
-
function
|
|
5368
|
+
function sr(r, t) {
|
|
5370
5369
|
const e = typeof t == "string" ? [t] : t;
|
|
5371
5370
|
return Object.keys(r).reduce((n, o) => (e.includes(o) || (n[o] = r[o]), n), {});
|
|
5372
5371
|
}
|
|
5373
|
-
const
|
|
5372
|
+
const nl = (r, t) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5374
5373
|
let i = null, s = null;
|
|
5375
|
-
const l =
|
|
5374
|
+
const l = uo(typeof r == "string" ? r : r.name, n.schema);
|
|
5376
5375
|
return l ? (l === "node" && (i = et(r, n.schema)), l === "mark" && (s = zt(r, n.schema)), o && e.selection.ranges.forEach((a) => {
|
|
5377
5376
|
n.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, u) => {
|
|
5378
|
-
i && i === c.type && e.setNodeMarkup(u, void 0,
|
|
5379
|
-
s === f.type && e.addMark(u, u + c.nodeSize, s.create(
|
|
5377
|
+
i && i === c.type && e.setNodeMarkup(u, void 0, sr(c.attrs, t)), s && c.marks.length && c.marks.forEach((f) => {
|
|
5378
|
+
s === f.type && e.addMark(u, u + c.nodeSize, s.create(sr(f.attrs, t)));
|
|
5380
5379
|
});
|
|
5381
5380
|
});
|
|
5382
5381
|
}), !0) : !1;
|
|
5383
|
-
},
|
|
5382
|
+
}, rl = () => ({ tr: r, dispatch: t }) => (t && r.scrollIntoView(), !0), ol = () => ({ tr: r, dispatch: t }) => {
|
|
5384
5383
|
if (t) {
|
|
5385
5384
|
const e = new dt(r.doc);
|
|
5386
5385
|
r.setSelection(e);
|
|
5387
5386
|
}
|
|
5388
5387
|
return !0;
|
|
5389
|
-
},
|
|
5390
|
-
function
|
|
5388
|
+
}, il = () => ({ state: r, dispatch: t }) => Kr(r, t), sl = () => ({ state: r, dispatch: t }) => Qr(r, t), ll = () => ({ state: r, dispatch: t }) => ts(r, t), al = () => ({ state: r, dispatch: t }) => rs(r, t), cl = () => ({ state: r, dispatch: t }) => ns(r, t);
|
|
5389
|
+
function ul(r, t, e = {}, n = {}) {
|
|
5391
5390
|
return qe(r, t, {
|
|
5392
5391
|
slice: !1,
|
|
5393
5392
|
parseOptions: e,
|
|
5394
5393
|
errorOnInvalidContent: n.errorOnInvalidContent
|
|
5395
5394
|
});
|
|
5396
5395
|
}
|
|
5397
|
-
const
|
|
5396
|
+
const fl = (r, t = !1, e = {}, n = {}) => ({ editor: o, tr: i, dispatch: s, commands: l }) => {
|
|
5398
5397
|
var a, c;
|
|
5399
5398
|
const { doc: u } = i;
|
|
5400
5399
|
if (e.preserveWhitespace !== "full") {
|
|
5401
|
-
const f =
|
|
5400
|
+
const f = ul(r, o.schema, e, {
|
|
5402
5401
|
errorOnInvalidContent: (a = n.errorOnInvalidContent) !== null && a !== void 0 ? a : o.options.enableContentCheck
|
|
5403
5402
|
});
|
|
5404
5403
|
return s && i.replaceWith(0, u.content.size, f).setMeta("preventUpdate", !t), !0;
|
|
@@ -5408,7 +5407,7 @@ const dl = (r, t = !1, e = {}, n = {}) => ({ editor: o, tr: i, dispatch: s, comm
|
|
|
5408
5407
|
errorOnInvalidContent: (c = n.errorOnInvalidContent) !== null && c !== void 0 ? c : o.options.enableContentCheck
|
|
5409
5408
|
});
|
|
5410
5409
|
};
|
|
5411
|
-
function
|
|
5410
|
+
function dl(r, t) {
|
|
5412
5411
|
const e = zt(t, r.schema), { from: n, to: o, empty: i } = r.selection, s = [];
|
|
5413
5412
|
i ? (r.storedMarks && s.push(...r.storedMarks), s.push(...r.selection.$head.marks())) : r.doc.nodesBetween(n, o, (a) => {
|
|
5414
5413
|
s.push(...a.marks);
|
|
@@ -5416,7 +5415,7 @@ function hl(r, t) {
|
|
|
5416
5415
|
const l = s.find((a) => a.type.name === e.name);
|
|
5417
5416
|
return l ? { ...l.attrs } : {};
|
|
5418
5417
|
}
|
|
5419
|
-
function
|
|
5418
|
+
function hl(r) {
|
|
5420
5419
|
for (let t = 0; t < r.edgeCount; t += 1) {
|
|
5421
5420
|
const { type: e } = r.edge(t);
|
|
5422
5421
|
if (e.isTextblock && !e.hasRequiredAttrs())
|
|
@@ -5424,7 +5423,7 @@ function pl(r) {
|
|
|
5424
5423
|
}
|
|
5425
5424
|
return null;
|
|
5426
5425
|
}
|
|
5427
|
-
function
|
|
5426
|
+
function pl(r, t) {
|
|
5428
5427
|
for (let e = r.depth; e > 0; e -= 1) {
|
|
5429
5428
|
const n = r.node(e);
|
|
5430
5429
|
if (t(n))
|
|
@@ -5436,8 +5435,8 @@ function ml(r, t) {
|
|
|
5436
5435
|
};
|
|
5437
5436
|
}
|
|
5438
5437
|
}
|
|
5439
|
-
function
|
|
5440
|
-
return (t) =>
|
|
5438
|
+
function Bn(r) {
|
|
5439
|
+
return (t) => pl(t.$from, r);
|
|
5441
5440
|
}
|
|
5442
5441
|
function Be(r, t, e) {
|
|
5443
5442
|
return Object.fromEntries(Object.entries(e).filter(([n]) => {
|
|
@@ -5445,7 +5444,7 @@ function Be(r, t, e) {
|
|
|
5445
5444
|
return o ? o.attribute.keepOnSplit : !1;
|
|
5446
5445
|
}));
|
|
5447
5446
|
}
|
|
5448
|
-
function
|
|
5447
|
+
function ml(r, t, e = {}) {
|
|
5449
5448
|
const { empty: n, ranges: o } = r.selection, i = t ? zt(t, r.schema) : null;
|
|
5450
5449
|
if (n)
|
|
5451
5450
|
return !!(r.storedMarks || r.selection.$from.marks()).filter((f) => i ? i.name === f.type.name : !0).find((f) => Ve(f.attrs, e, { strict: !1 }));
|
|
@@ -5468,8 +5467,8 @@ function gl(r, t, e = {}) {
|
|
|
5468
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);
|
|
5469
5468
|
return (a > 0 ? a + c : a) >= s;
|
|
5470
5469
|
}
|
|
5471
|
-
function
|
|
5472
|
-
const { nodeExtensions: e } =
|
|
5470
|
+
function lr(r, t) {
|
|
5471
|
+
const { nodeExtensions: e } = ps(t), n = e.find((s) => s.name === r);
|
|
5473
5472
|
if (!n)
|
|
5474
5473
|
return !1;
|
|
5475
5474
|
const o = {
|
|
@@ -5479,7 +5478,7 @@ function sr(r, t) {
|
|
|
5479
5478
|
}, i = At(gt(n, "group", o));
|
|
5480
5479
|
return typeof i != "string" ? !1 : i.split(" ").includes("list");
|
|
5481
5480
|
}
|
|
5482
|
-
function
|
|
5481
|
+
function fo(r, { checkChildren: t = !0, ignoreWhitespace: e = !1 } = {}) {
|
|
5483
5482
|
var n;
|
|
5484
5483
|
if (e) {
|
|
5485
5484
|
if (r.type.name === "hardBreak")
|
|
@@ -5496,16 +5495,16 @@ function uo(r, { checkChildren: t = !0, ignoreWhitespace: e = !1 } = {}) {
|
|
|
5496
5495
|
if (t) {
|
|
5497
5496
|
let o = !0;
|
|
5498
5497
|
return r.content.forEach((i) => {
|
|
5499
|
-
o !== !1 && (
|
|
5498
|
+
o !== !1 && (fo(i, { ignoreWhitespace: e, checkChildren: t }) || (o = !1));
|
|
5500
5499
|
}), o;
|
|
5501
5500
|
}
|
|
5502
5501
|
return !1;
|
|
5503
5502
|
}
|
|
5504
|
-
function
|
|
5503
|
+
function gl(r, t, e) {
|
|
5505
5504
|
var n;
|
|
5506
5505
|
const { selection: o } = t;
|
|
5507
5506
|
let i = null;
|
|
5508
|
-
if (
|
|
5507
|
+
if (lo(o) && (i = o.$cursor), i) {
|
|
5509
5508
|
const l = (n = r.storedMarks) !== null && n !== void 0 ? n : i.marks();
|
|
5510
5509
|
return !!e.isInSet(l) || !l.some((a) => a.type.excludes(e));
|
|
5511
5510
|
}
|
|
@@ -5523,11 +5522,11 @@ function yl(r, t, e) {
|
|
|
5523
5522
|
}), c;
|
|
5524
5523
|
});
|
|
5525
5524
|
}
|
|
5526
|
-
const
|
|
5525
|
+
const yl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5527
5526
|
const { selection: i } = e, { empty: s, ranges: l } = i, a = zt(r, n.schema);
|
|
5528
5527
|
if (o)
|
|
5529
5528
|
if (s) {
|
|
5530
|
-
const c =
|
|
5529
|
+
const c = dl(n, a);
|
|
5531
5530
|
e.addStoredMark(a.create({
|
|
5532
5531
|
...c,
|
|
5533
5532
|
...t
|
|
@@ -5545,41 +5544,41 @@ const wl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
|
5545
5544
|
}) : e.addMark(m, p, a.create(t));
|
|
5546
5545
|
});
|
|
5547
5546
|
});
|
|
5548
|
-
return
|
|
5549
|
-
},
|
|
5547
|
+
return gl(n, e, a);
|
|
5548
|
+
}, wl = (r, t) => ({ tr: e }) => (e.setMeta(r, t), !0), xl = (r, t = {}) => ({ state: e, dispatch: n, chain: o }) => {
|
|
5550
5549
|
const i = et(r, e.schema);
|
|
5551
5550
|
let s;
|
|
5552
|
-
return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) =>
|
|
5553
|
-
},
|
|
5551
|
+
return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) => or(i, { ...s, ...t })(e) ? !0 : l.clearNodes()).command(({ state: l }) => or(i, { ...s, ...t })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
5552
|
+
}, kl = (r) => ({ tr: t, dispatch: e }) => {
|
|
5554
5553
|
if (e) {
|
|
5555
5554
|
const { doc: n } = t, o = Lt(r, 0, n.content.size), i = P.create(n, o);
|
|
5556
5555
|
t.setSelection(i);
|
|
5557
5556
|
}
|
|
5558
5557
|
return !0;
|
|
5559
|
-
},
|
|
5558
|
+
}, bl = (r) => ({ tr: t, dispatch: e }) => {
|
|
5560
5559
|
if (e) {
|
|
5561
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 = Lt(o, s, l), c = Lt(i, s, l), u = D.create(n, a, c);
|
|
5562
5561
|
t.setSelection(u);
|
|
5563
5562
|
}
|
|
5564
5563
|
return !0;
|
|
5565
|
-
},
|
|
5564
|
+
}, vl = (r) => ({ state: t, dispatch: e }) => {
|
|
5566
5565
|
const n = et(r, t.schema);
|
|
5567
|
-
return
|
|
5566
|
+
return ds(n)(t, e);
|
|
5568
5567
|
};
|
|
5569
|
-
function
|
|
5568
|
+
function ar(r, t) {
|
|
5570
5569
|
const e = r.storedMarks || r.selection.$to.parentOffset && r.selection.$from.marks();
|
|
5571
5570
|
if (e) {
|
|
5572
5571
|
const n = e.filter((o) => t?.includes(o.type.name));
|
|
5573
5572
|
r.tr.ensureMarks(n);
|
|
5574
5573
|
}
|
|
5575
5574
|
}
|
|
5576
|
-
const
|
|
5575
|
+
const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, editor: o }) => {
|
|
5577
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);
|
|
5578
5577
|
if (i instanceof P && i.node.isBlock)
|
|
5579
|
-
return !l.parentOffset || !Mt(s, l.pos) ? !1 : (n && (r &&
|
|
5578
|
+
return !l.parentOffset || !Mt(s, l.pos) ? !1 : (n && (r && ar(e, o.extensionManager.splittableMarks), t.split(l.pos).scrollIntoView()), !0);
|
|
5580
5579
|
if (!l.parent.isBlock)
|
|
5581
5580
|
return !1;
|
|
5582
|
-
const f = a.parentOffset === a.parent.content.size, d = l.depth === 0 ? void 0 :
|
|
5581
|
+
const f = a.parentOffset === a.parent.content.size, d = l.depth === 0 ? void 0 : hl(l.node(-1).contentMatchAt(l.indexAfter(-1)));
|
|
5583
5582
|
let h = f && d ? [
|
|
5584
5583
|
{
|
|
5585
5584
|
type: d,
|
|
@@ -5596,10 +5595,10 @@ const Cl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5596
5595
|
const p = t.mapping.map(l.before()), k = t.doc.resolve(p);
|
|
5597
5596
|
l.node(-1).canReplaceWith(k.index(), k.index() + 1, d) && t.setNodeMarkup(t.mapping.map(l.before()), d);
|
|
5598
5597
|
}
|
|
5599
|
-
r &&
|
|
5598
|
+
r && ar(e, o.extensionManager.splittableMarks), t.scrollIntoView();
|
|
5600
5599
|
}
|
|
5601
5600
|
return m;
|
|
5602
|
-
},
|
|
5601
|
+
}, Cl = (r, t = {}) => ({ tr: e, state: n, dispatch: o, editor: i }) => {
|
|
5603
5602
|
var s;
|
|
5604
5603
|
const l = et(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
|
|
5605
5604
|
if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
|
|
@@ -5655,7 +5654,7 @@ const Cl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5655
5654
|
}
|
|
5656
5655
|
return !0;
|
|
5657
5656
|
}, un = (r, t) => {
|
|
5658
|
-
const e =
|
|
5657
|
+
const e = Bn((s) => s.type === t)(r.selection);
|
|
5659
5658
|
if (!e)
|
|
5660
5659
|
return !0;
|
|
5661
5660
|
const n = r.doc.resolve(Math.max(0, e.pos - 1)).before(e.depth);
|
|
@@ -5664,7 +5663,7 @@ const Cl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5664
5663
|
const o = r.doc.nodeAt(n);
|
|
5665
5664
|
return e.node.type === o?.type && qt(r.doc, e.pos) && r.join(e.pos), !0;
|
|
5666
5665
|
}, fn = (r, t) => {
|
|
5667
|
-
const e =
|
|
5666
|
+
const e = Bn((s) => s.type === t)(r.selection);
|
|
5668
5667
|
if (!e)
|
|
5669
5668
|
return !0;
|
|
5670
5669
|
const n = r.doc.resolve(e.start).after(e.depth);
|
|
@@ -5672,32 +5671,32 @@ const Cl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5672
5671
|
return !0;
|
|
5673
5672
|
const o = r.doc.nodeAt(n);
|
|
5674
5673
|
return e.node.type === o?.type && qt(r.doc, n) && r.join(n), !0;
|
|
5675
|
-
},
|
|
5674
|
+
}, Tl = (r, t, e, n = {}) => ({ editor: o, tr: i, state: s, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
5676
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), J = k || p.$to.parentOffset && p.$from.marks();
|
|
5677
5676
|
if (!R)
|
|
5678
5677
|
return !1;
|
|
5679
|
-
const H =
|
|
5678
|
+
const H = Bn((Z) => lr(Z.type.name, f))(p);
|
|
5680
5679
|
if (R.depth >= 1 && H && R.depth - H.depth <= 1) {
|
|
5681
5680
|
if (H.node.type === h)
|
|
5682
5681
|
return c.liftListItem(m);
|
|
5683
|
-
if (
|
|
5682
|
+
if (lr(H.node.type.name, f) && h.validContent(H.node.content) && l)
|
|
5684
5683
|
return a().command(() => (i.setNodeMarkup(H.pos, h), !0)).command(() => un(i, h)).command(() => fn(i, h)).run();
|
|
5685
5684
|
}
|
|
5686
5685
|
return !e || !J || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run() : a().command(() => {
|
|
5687
5686
|
const Z = u().wrapInList(h, n), at = J.filter((W) => d.includes(W.type.name));
|
|
5688
5687
|
return i.ensureMarks(at), Z ? !0 : c.clearNodes();
|
|
5689
5688
|
}).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run();
|
|
5690
|
-
},
|
|
5689
|
+
}, Al = (r, t = {}, e = {}) => ({ state: n, commands: o }) => {
|
|
5691
5690
|
const { extendEmptyMarkRange: i = !1 } = e, s = zt(r, n.schema);
|
|
5692
|
-
return
|
|
5693
|
-
},
|
|
5694
|
-
const i = et(r, n.schema), s = et(t, n.schema), l =
|
|
5691
|
+
return ml(n, s, t) ? o.unsetMark(s, { extendEmptyMarkRange: i }) : o.setMark(s, t);
|
|
5692
|
+
}, Ml = (r, t, e = {}) => ({ state: n, commands: o }) => {
|
|
5693
|
+
const i = et(r, n.schema), s = et(t, n.schema), l = $n(n, i, e);
|
|
5695
5694
|
let a;
|
|
5696
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 });
|
|
5697
|
-
},
|
|
5696
|
+
}, El = (r, t = {}) => ({ state: e, commands: n }) => {
|
|
5698
5697
|
const o = et(r, e.schema);
|
|
5699
|
-
return
|
|
5700
|
-
},
|
|
5698
|
+
return $n(e, o, t) ? n.lift(o) : n.wrapIn(o, t);
|
|
5699
|
+
}, Nl = () => ({ state: r, dispatch: t }) => {
|
|
5701
5700
|
const e = r.plugins;
|
|
5702
5701
|
for (let n = 0; n < e.length; n += 1) {
|
|
5703
5702
|
const o = e[n];
|
|
@@ -5717,28 +5716,28 @@ const Cl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5717
5716
|
}
|
|
5718
5717
|
}
|
|
5719
5718
|
return !1;
|
|
5720
|
-
},
|
|
5719
|
+
}, Il = () => ({ tr: r, dispatch: t }) => {
|
|
5721
5720
|
const { selection: e } = r, { empty: n, ranges: o } = e;
|
|
5722
5721
|
return n || t && o.forEach((i) => {
|
|
5723
5722
|
r.removeMark(i.$from.pos, i.$to.pos);
|
|
5724
5723
|
}), !0;
|
|
5725
|
-
},
|
|
5724
|
+
}, Ol = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5726
5725
|
var i;
|
|
5727
5726
|
const { extendEmptyMarkRange: s = !1 } = t, { selection: l } = e, a = zt(r, n.schema), { $from: c, empty: u, ranges: f } = l;
|
|
5728
5727
|
if (!o)
|
|
5729
5728
|
return !0;
|
|
5730
5729
|
if (u && s) {
|
|
5731
5730
|
let { from: d, to: h } = l;
|
|
5732
|
-
const m = (i = c.marks().find((k) => k.type === a)) === null || i === void 0 ? void 0 : i.attrs, p =
|
|
5731
|
+
const m = (i = c.marks().find((k) => k.type === a)) === null || i === void 0 ? void 0 : i.attrs, p = so(c, a, m);
|
|
5733
5732
|
p && (d = p.from, h = p.to), e.removeMark(d, h, a);
|
|
5734
5733
|
} else
|
|
5735
5734
|
f.forEach((d) => {
|
|
5736
5735
|
e.removeMark(d.$from.pos, d.$to.pos, a);
|
|
5737
5736
|
});
|
|
5738
5737
|
return e.removeStoredMark(a), !0;
|
|
5739
|
-
},
|
|
5738
|
+
}, $l = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5740
5739
|
let i = null, s = null;
|
|
5741
|
-
const l =
|
|
5740
|
+
const l = uo(typeof r == "string" ? r : r.name, n.schema);
|
|
5742
5741
|
return l ? (l === "node" && (i = et(r, n.schema)), l === "mark" && (s = zt(r, n.schema)), o && e.selection.ranges.forEach((a) => {
|
|
5743
5742
|
const c = a.$from.pos, u = a.$to.pos;
|
|
5744
5743
|
let f, d, h, m;
|
|
@@ -5767,79 +5766,79 @@ const Cl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5767
5766
|
}));
|
|
5768
5767
|
}));
|
|
5769
5768
|
}), !0) : !1;
|
|
5769
|
+
}, Bl = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5770
|
+
const o = et(r, e.schema);
|
|
5771
|
+
return is(o, t)(e, n);
|
|
5770
5772
|
}, Rl = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5771
5773
|
const o = et(r, e.schema);
|
|
5772
5774
|
return ss(o, t)(e, n);
|
|
5773
|
-
}, zl = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5774
|
-
const o = et(r, e.schema);
|
|
5775
|
-
return ls(o, t)(e, n);
|
|
5776
5775
|
};
|
|
5777
|
-
var
|
|
5776
|
+
var zl = /* @__PURE__ */ Object.freeze({
|
|
5778
5777
|
__proto__: null,
|
|
5779
|
-
blur:
|
|
5780
|
-
clearContent:
|
|
5781
|
-
clearNodes:
|
|
5782
|
-
command:
|
|
5783
|
-
createParagraphNear:
|
|
5784
|
-
cut:
|
|
5785
|
-
deleteCurrentNode:
|
|
5786
|
-
deleteNode:
|
|
5787
|
-
deleteRange:
|
|
5788
|
-
deleteSelection:
|
|
5789
|
-
enter:
|
|
5790
|
-
exitCode:
|
|
5791
|
-
extendMarkRange:
|
|
5792
|
-
first:
|
|
5793
|
-
focus:
|
|
5794
|
-
forEach:
|
|
5795
|
-
insertContent:
|
|
5796
|
-
insertContentAt:
|
|
5797
|
-
joinBackward:
|
|
5798
|
-
joinDown:
|
|
5799
|
-
joinForward:
|
|
5800
|
-
joinItemBackward:
|
|
5801
|
-
joinItemForward:
|
|
5802
|
-
joinTextblockBackward:
|
|
5803
|
-
joinTextblockForward:
|
|
5804
|
-
joinUp:
|
|
5805
|
-
keyboardShortcut:
|
|
5806
|
-
lift:
|
|
5807
|
-
liftEmptyBlock:
|
|
5808
|
-
liftListItem:
|
|
5809
|
-
newlineInCode:
|
|
5810
|
-
resetAttributes:
|
|
5811
|
-
scrollIntoView:
|
|
5812
|
-
selectAll:
|
|
5813
|
-
selectNodeBackward:
|
|
5814
|
-
selectNodeForward:
|
|
5815
|
-
selectParentNode:
|
|
5816
|
-
selectTextblockEnd:
|
|
5817
|
-
selectTextblockStart:
|
|
5818
|
-
setContent:
|
|
5819
|
-
setMark:
|
|
5820
|
-
setMeta:
|
|
5821
|
-
setNode:
|
|
5822
|
-
setNodeSelection:
|
|
5823
|
-
setTextSelection:
|
|
5824
|
-
sinkListItem:
|
|
5825
|
-
splitBlock:
|
|
5826
|
-
splitListItem:
|
|
5827
|
-
toggleList:
|
|
5828
|
-
toggleMark:
|
|
5829
|
-
toggleNode:
|
|
5830
|
-
toggleWrap:
|
|
5831
|
-
undoInputRule:
|
|
5832
|
-
unsetAllMarks:
|
|
5833
|
-
unsetMark:
|
|
5834
|
-
updateAttributes:
|
|
5835
|
-
wrapIn:
|
|
5836
|
-
wrapInList:
|
|
5778
|
+
blur: ks,
|
|
5779
|
+
clearContent: bs,
|
|
5780
|
+
clearNodes: vs,
|
|
5781
|
+
command: Ss,
|
|
5782
|
+
createParagraphNear: Cs,
|
|
5783
|
+
cut: Ts,
|
|
5784
|
+
deleteCurrentNode: As,
|
|
5785
|
+
deleteNode: Ms,
|
|
5786
|
+
deleteRange: Es,
|
|
5787
|
+
deleteSelection: Ns,
|
|
5788
|
+
enter: Is,
|
|
5789
|
+
exitCode: Os,
|
|
5790
|
+
extendMarkRange: $s,
|
|
5791
|
+
first: Bs,
|
|
5792
|
+
focus: Ps,
|
|
5793
|
+
forEach: Fs,
|
|
5794
|
+
insertContent: _s,
|
|
5795
|
+
insertContentAt: Ls,
|
|
5796
|
+
joinBackward: Vs,
|
|
5797
|
+
joinDown: js,
|
|
5798
|
+
joinForward: qs,
|
|
5799
|
+
joinItemBackward: Hs,
|
|
5800
|
+
joinItemForward: Us,
|
|
5801
|
+
joinTextblockBackward: Gs,
|
|
5802
|
+
joinTextblockForward: Ks,
|
|
5803
|
+
joinUp: Ws,
|
|
5804
|
+
keyboardShortcut: Zs,
|
|
5805
|
+
lift: Qs,
|
|
5806
|
+
liftEmptyBlock: Ys,
|
|
5807
|
+
liftListItem: tl,
|
|
5808
|
+
newlineInCode: el,
|
|
5809
|
+
resetAttributes: nl,
|
|
5810
|
+
scrollIntoView: rl,
|
|
5811
|
+
selectAll: ol,
|
|
5812
|
+
selectNodeBackward: il,
|
|
5813
|
+
selectNodeForward: sl,
|
|
5814
|
+
selectParentNode: ll,
|
|
5815
|
+
selectTextblockEnd: al,
|
|
5816
|
+
selectTextblockStart: cl,
|
|
5817
|
+
setContent: fl,
|
|
5818
|
+
setMark: yl,
|
|
5819
|
+
setMeta: wl,
|
|
5820
|
+
setNode: xl,
|
|
5821
|
+
setNodeSelection: kl,
|
|
5822
|
+
setTextSelection: bl,
|
|
5823
|
+
sinkListItem: vl,
|
|
5824
|
+
splitBlock: Sl,
|
|
5825
|
+
splitListItem: Cl,
|
|
5826
|
+
toggleList: Tl,
|
|
5827
|
+
toggleMark: Al,
|
|
5828
|
+
toggleNode: Ml,
|
|
5829
|
+
toggleWrap: El,
|
|
5830
|
+
undoInputRule: Nl,
|
|
5831
|
+
unsetAllMarks: Il,
|
|
5832
|
+
unsetMark: Ol,
|
|
5833
|
+
updateAttributes: $l,
|
|
5834
|
+
wrapIn: Bl,
|
|
5835
|
+
wrapInList: Rl
|
|
5837
5836
|
});
|
|
5838
5837
|
ht.create({
|
|
5839
5838
|
name: "commands",
|
|
5840
5839
|
addCommands() {
|
|
5841
5840
|
return {
|
|
5842
|
-
...
|
|
5841
|
+
...zl
|
|
5843
5842
|
};
|
|
5844
5843
|
}
|
|
5845
5844
|
});
|
|
@@ -5946,7 +5945,7 @@ ht.create({
|
|
|
5946
5945
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
5947
5946
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
5948
5947
|
};
|
|
5949
|
-
return
|
|
5948
|
+
return On() || co() ? i : o;
|
|
5950
5949
|
},
|
|
5951
5950
|
addProseMirrorPlugins() {
|
|
5952
5951
|
return [
|
|
@@ -5964,12 +5963,12 @@ ht.create({
|
|
|
5964
5963
|
if (!n || o)
|
|
5965
5964
|
return;
|
|
5966
5965
|
const { empty: i, from: s, to: l } = t.selection, a = $.atStart(t.doc).from, c = $.atEnd(t.doc).to;
|
|
5967
|
-
if (i || !(s === a && l === c) || !
|
|
5966
|
+
if (i || !(s === a && l === c) || !fo(e.doc))
|
|
5968
5967
|
return;
|
|
5969
|
-
const d = e.tr, h =
|
|
5968
|
+
const d = e.tr, h = oo({
|
|
5970
5969
|
state: e,
|
|
5971
5970
|
transaction: d
|
|
5972
|
-
}), { commands: m } = new
|
|
5971
|
+
}), { commands: m } = new hs({
|
|
5973
5972
|
editor: this.editor,
|
|
5974
5973
|
state: h
|
|
5975
5974
|
});
|
|
@@ -6012,7 +6011,7 @@ ht.create({
|
|
|
6012
6011
|
];
|
|
6013
6012
|
}
|
|
6014
6013
|
});
|
|
6015
|
-
const
|
|
6014
|
+
const cr = [
|
|
6016
6015
|
{ border: "#f97316", background: "rgba(254, 243, 199, 0.9)" },
|
|
6017
6016
|
// 0 橙
|
|
6018
6017
|
{ border: "#22c55e", background: "rgba(220, 252, 231, 0.85)" },
|
|
@@ -6053,7 +6052,7 @@ const ar = [
|
|
|
6053
6052
|
// 18 深青
|
|
6054
6053
|
{ border: "#64748b", background: "rgba(241, 245, 249, 0.9)" }
|
|
6055
6054
|
// 19 灰蓝
|
|
6056
|
-
],
|
|
6055
|
+
], Pl = je.create({
|
|
6057
6056
|
name: "comment",
|
|
6058
6057
|
addAttributes() {
|
|
6059
6058
|
return {
|
|
@@ -6079,7 +6078,7 @@ const ar = [
|
|
|
6079
6078
|
return [{ tag: "span[data-comment-id]" }];
|
|
6080
6079
|
},
|
|
6081
6080
|
renderHTML({ HTMLAttributes: r }) {
|
|
6082
|
-
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 = cr[n] || cr[0], i = o.border, s = o.background;
|
|
6083
6082
|
return [
|
|
6084
6083
|
"span",
|
|
6085
6084
|
{
|
|
@@ -6121,11 +6120,11 @@ const ar = [
|
|
|
6121
6120
|
}
|
|
6122
6121
|
};
|
|
6123
6122
|
}
|
|
6124
|
-
}),
|
|
6123
|
+
}), Fl = {
|
|
6125
6124
|
class: "comment-gutter",
|
|
6126
6125
|
style: { "margin-top": "-100px" },
|
|
6127
6126
|
"aria-label": "批注贴行栏"
|
|
6128
|
-
},
|
|
6127
|
+
}, _l = ["onClick", "onKeydown"], Dl = { class: "gutter-item__quote" }, Jl = { class: "gutter-item__note" }, Ll = { class: "gutter-item__meta" }, Wl = { class: "gutter-item__author" }, jl = { class: "gutter-item__time" }, Vl = {
|
|
6129
6128
|
__name: "CommentGutter",
|
|
6130
6129
|
props: {
|
|
6131
6130
|
anchors: { type: Array, default: () => [] },
|
|
@@ -6182,14 +6181,14 @@ const ar = [
|
|
|
6182
6181
|
}
|
|
6183
6182
|
return l;
|
|
6184
6183
|
});
|
|
6185
|
-
return (l, a) => (q(), rt("div",
|
|
6186
|
-
(q(!0), rt(
|
|
6184
|
+
return (l, a) => (q(), rt("div", Fl, [
|
|
6185
|
+
(q(!0), rt(pr, null, mr(s.value, (c) => (q(), rt("div", {
|
|
6187
6186
|
key: c.id,
|
|
6188
6187
|
class: "gutter-item-wrapper",
|
|
6189
|
-
style:
|
|
6188
|
+
style: Co({ marginTop: `${c.marginTop}px` })
|
|
6190
6189
|
}, [
|
|
6191
6190
|
y("div", {
|
|
6192
|
-
class:
|
|
6191
|
+
class: gr(["gutter-item", [
|
|
6193
6192
|
`gutter-item--c${c.colorIndex ?? 0}`,
|
|
6194
6193
|
{
|
|
6195
6194
|
"gutter-item--active": r.activeCommentId === c.id,
|
|
@@ -6201,17 +6200,17 @@ const ar = [
|
|
|
6201
6200
|
onClick: (u) => l.$emit("activate", c.id),
|
|
6202
6201
|
onKeydown: dn(ze((u) => l.$emit("activate", c.id), ["prevent"]), ["enter"])
|
|
6203
6202
|
}, [
|
|
6204
|
-
y("div",
|
|
6205
|
-
y("div",
|
|
6206
|
-
y("div",
|
|
6207
|
-
y("span",
|
|
6208
|
-
y("span",
|
|
6203
|
+
y("div", Dl, Y(e(c.selectedText, 28)), 1),
|
|
6204
|
+
y("div", Jl, Y(e(c.note, 36)), 1),
|
|
6205
|
+
y("div", Ll, [
|
|
6206
|
+
y("span", Wl, Y(c.author), 1),
|
|
6207
|
+
y("span", jl, Y(r.formatTime(c.createdAt)), 1)
|
|
6209
6208
|
])
|
|
6210
|
-
], 42,
|
|
6209
|
+
], 42, _l)
|
|
6211
6210
|
], 4))), 128))
|
|
6212
6211
|
]));
|
|
6213
6212
|
}
|
|
6214
|
-
},
|
|
6213
|
+
}, ql = /* @__PURE__ */ He(Vl, [["__scopeId", "data-v-ac6164bd"]]), Hl = new Rt("commentGutter"), Ul = ht.create({
|
|
6215
6214
|
name: "commentGutter",
|
|
6216
6215
|
addOptions() {
|
|
6217
6216
|
return {
|
|
@@ -6233,7 +6232,7 @@ const ar = [
|
|
|
6233
6232
|
const r = this.options.getStageEl, t = this.options.getScrollEl, e = this.options.onAnchors, n = this.options.mountGutter;
|
|
6234
6233
|
return [
|
|
6235
6234
|
new Bt({
|
|
6236
|
-
key:
|
|
6235
|
+
key: Hl,
|
|
6237
6236
|
view: (o) => {
|
|
6238
6237
|
let i = !1, s = null, l = !1;
|
|
6239
6238
|
const a = () => {
|
|
@@ -6281,11 +6280,11 @@ const ar = [
|
|
|
6281
6280
|
})
|
|
6282
6281
|
];
|
|
6283
6282
|
}
|
|
6284
|
-
});
|
|
6283
|
+
}), Gl = pn.default || pn;
|
|
6285
6284
|
async function Kl(r) {
|
|
6286
|
-
const t = await r.arrayBuffer(), e = await
|
|
6285
|
+
const t = await r.arrayBuffer(), e = await Gl.loadAsync(t), n = e.file("word/comments.xml");
|
|
6287
6286
|
if (!n) return [];
|
|
6288
|
-
const o = await n.async("text"), i =
|
|
6287
|
+
const o = await n.async("text"), i = ur(o), s = /* @__PURE__ */ new Map(), l = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", a = i.getElementsByTagNameNS(l, "comment");
|
|
6289
6288
|
for (const p of a) {
|
|
6290
6289
|
const k = p.getAttribute("w:id"), b = p.getAttribute("w:author") || "", I = p.getAttribute("w:date") || "", R = Xl(p, l);
|
|
6291
6290
|
s.set(k, { author: b, date: I, note: R });
|
|
@@ -6293,7 +6292,7 @@ async function Kl(r) {
|
|
|
6293
6292
|
if (s.size === 0) return [];
|
|
6294
6293
|
const c = e.file("word/document.xml");
|
|
6295
6294
|
if (!c) return Ql(s);
|
|
6296
|
-
const u = await c.async("text"), f =
|
|
6295
|
+
const u = await c.async("text"), f = ur(u), { selectedTextMap: d, containsDelTextMap: h } = Zl(f, l), m = [];
|
|
6297
6296
|
for (const [p, k] of s)
|
|
6298
6297
|
m.push({
|
|
6299
6298
|
wordId: p,
|
|
@@ -6305,7 +6304,7 @@ async function Kl(r) {
|
|
|
6305
6304
|
});
|
|
6306
6305
|
return m;
|
|
6307
6306
|
}
|
|
6308
|
-
function
|
|
6307
|
+
function ur(r) {
|
|
6309
6308
|
return new DOMParser().parseFromString(r, "application/xml");
|
|
6310
6309
|
}
|
|
6311
6310
|
function Xl(r, t) {
|
|
@@ -6313,9 +6312,9 @@ function Xl(r, t) {
|
|
|
6313
6312
|
}
|
|
6314
6313
|
function Zl(r, t) {
|
|
6315
6314
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = r.getElementsByTagNameNS(t, "body")[0];
|
|
6316
|
-
return s ? (
|
|
6315
|
+
return s ? (ho(s, t, o, i, e, n), { selectedTextMap: e, containsDelTextMap: n }) : { selectedTextMap: e, containsDelTextMap: n };
|
|
6317
6316
|
}
|
|
6318
|
-
function
|
|
6317
|
+
function ho(r, t, e, n, o, i) {
|
|
6319
6318
|
for (const s of r.childNodes) {
|
|
6320
6319
|
const l = s.localName;
|
|
6321
6320
|
if (l === "commentRangeStart") {
|
|
@@ -6332,7 +6331,7 @@ function fo(r, t, e, n, o, i) {
|
|
|
6332
6331
|
if (l === "delText")
|
|
6333
6332
|
for (const c of n.keys())
|
|
6334
6333
|
n.set(c, !0);
|
|
6335
|
-
} else l === "instrText" || s.childNodes && s.childNodes.length > 0 &&
|
|
6334
|
+
} else l === "instrText" || s.childNodes && s.childNodes.length > 0 && ho(s, t, e, n, o, i);
|
|
6336
6335
|
}
|
|
6337
6336
|
}
|
|
6338
6337
|
function Ql(r) {
|
|
@@ -6344,15 +6343,15 @@ function Ql(r) {
|
|
|
6344
6343
|
selectedText: ""
|
|
6345
6344
|
}));
|
|
6346
6345
|
}
|
|
6347
|
-
const
|
|
6346
|
+
const po = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Yl = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
6348
6347
|
async function ta(r) {
|
|
6349
|
-
const t = await r.arrayBuffer(), e = await
|
|
6348
|
+
const t = await r.arrayBuffer(), e = await pn.loadAsync(t), n = await ea(e), o = await na(e);
|
|
6350
6349
|
return await ra(e, n, o);
|
|
6351
6350
|
}
|
|
6352
6351
|
async function ea(r) {
|
|
6353
6352
|
const t = r.file("word/styles.xml");
|
|
6354
6353
|
if (!t) return /* @__PURE__ */ new Map();
|
|
6355
|
-
const e = await t.async("text"), n =
|
|
6354
|
+
const e = await t.async("text"), n = zn(e), o = /* @__PURE__ */ new Map(), i = n.getElementsByTagNameNS(po, "style");
|
|
6356
6355
|
for (const a of i) {
|
|
6357
6356
|
const c = a.getAttribute("w:styleId");
|
|
6358
6357
|
if (!c) continue;
|
|
@@ -6360,8 +6359,8 @@ async function ea(r) {
|
|
|
6360
6359
|
const f = v(a, "basedOn")?.getAttribute("w:val") || null, d = v(a, "rPr"), h = v(a, "pPr");
|
|
6361
6360
|
o.set(c, {
|
|
6362
6361
|
basedOn: f,
|
|
6363
|
-
rProps: d ?
|
|
6364
|
-
pProps: h ?
|
|
6362
|
+
rProps: d ? Rn(d) : {},
|
|
6363
|
+
pProps: h ? wo(h) : {},
|
|
6365
6364
|
name: v(a, "name")?.getAttribute("w:val") || ""
|
|
6366
6365
|
});
|
|
6367
6366
|
}
|
|
@@ -6386,7 +6385,7 @@ async function ea(r) {
|
|
|
6386
6385
|
async function na(r) {
|
|
6387
6386
|
const t = r.file("word/_rels/document.xml.rels");
|
|
6388
6387
|
if (!t) return /* @__PURE__ */ new Map();
|
|
6389
|
-
const e = await t.async("text"), n =
|
|
6388
|
+
const e = await t.async("text"), n = zn(e), o = /* @__PURE__ */ new Map(), i = n.getElementsByTagName("Relationship");
|
|
6390
6389
|
for (const s of i)
|
|
6391
6390
|
o.set(s.getAttribute("Id"), s.getAttribute("Target"));
|
|
6392
6391
|
return o;
|
|
@@ -6394,23 +6393,23 @@ async function na(r) {
|
|
|
6394
6393
|
async function ra(r, t, e) {
|
|
6395
6394
|
const n = r.file("word/document.xml");
|
|
6396
6395
|
if (!n) return "<p></p>";
|
|
6397
|
-
const o = await n.async("text"), s =
|
|
6396
|
+
const o = await n.async("text"), s = zn(o).getElementsByTagNameNS(po, "body")[0];
|
|
6398
6397
|
if (!s) return "<p></p>";
|
|
6399
|
-
const l = v(s, "sectPr"), a = l ?
|
|
6398
|
+
const l = v(s, "sectPr"), a = l ? fr(l) : { count: 1, gap: 720, widths: [] }, c = oa(l), u = [];
|
|
6400
6399
|
let f = { colInfo: null, nodes: [] };
|
|
6401
6400
|
for (const h of s.childNodes) {
|
|
6402
6401
|
if (h.nodeType !== 1) continue;
|
|
6403
6402
|
const m = h.localName;
|
|
6404
6403
|
if (m === "p") {
|
|
6405
6404
|
const p = v(h, "pPr"), k = p ? v(p, "sectPr") : null;
|
|
6406
|
-
f.nodes.push({ type: "p", node: h }), k && (f.colInfo =
|
|
6405
|
+
f.nodes.push({ type: "p", node: h }), k && (f.colInfo = fr(k), u.push(f), f = { colInfo: null, nodes: [] });
|
|
6407
6406
|
} else m === "tbl" && f.nodes.push({ type: "tbl", node: h });
|
|
6408
6407
|
}
|
|
6409
6408
|
f.nodes.length && (f.colInfo = a, u.push(f));
|
|
6410
6409
|
let d = "";
|
|
6411
6410
|
for (const h of u) {
|
|
6412
6411
|
const m = h.colInfo || { count: 1 };
|
|
6413
|
-
m.count > 1 ? d += ia(h.nodes, m, t, e, c) : d +=
|
|
6412
|
+
m.count > 1 ? d += ia(h.nodes, m, t, e, c) : d += mo(h.nodes, t, e, c);
|
|
6414
6413
|
}
|
|
6415
6414
|
return d || "<p></p>";
|
|
6416
6415
|
}
|
|
@@ -6423,7 +6422,7 @@ function oa(r) {
|
|
|
6423
6422
|
const n = v(r, "pgMar"), o = n && parseInt(n.getAttribute("w:left"), 10) || 0, i = n && parseInt(n.getAttribute("w:right"), 10) || 0;
|
|
6424
6423
|
return Math.max(e - o - i, 1);
|
|
6425
6424
|
}
|
|
6426
|
-
function
|
|
6425
|
+
function fr(r) {
|
|
6427
6426
|
const t = v(r, "cols");
|
|
6428
6427
|
if (!t) return { count: 1, gap: 720, widths: [] };
|
|
6429
6428
|
const e = parseInt(t.getAttribute("w:num"), 10) || 1, n = parseInt(t.getAttribute("w:space"), 10) || 720, o = [...t.childNodes].filter(
|
|
@@ -6442,7 +6441,7 @@ function ia(r, t, e, n, o = 0) {
|
|
|
6442
6441
|
for (const d of r)
|
|
6443
6442
|
a >= i && (a = i - 1), d.type === "p" && sa(d.node) ? (l[a].push({ ...d, stripColBreak: !0 }), a < i - 1 && a++) : l[a].push(d);
|
|
6444
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) => {
|
|
6445
|
-
const m =
|
|
6444
|
+
const m = mo(d, e, n, o);
|
|
6446
6445
|
return `<td style="${s[h] ? `width:${s[h]}%;` : `width:${(100 / i).toFixed(2)}%;`}vertical-align:top;padding:0 4px;">${m || "<p></p>"}</td>`;
|
|
6447
6446
|
});
|
|
6448
6447
|
return `<table style="width:100%;border-collapse:collapse;table-layout:fixed;">${u}<tr>${f.join("")}</tr></table>`;
|
|
@@ -6456,19 +6455,19 @@ function sa(r) {
|
|
|
6456
6455
|
}
|
|
6457
6456
|
return !1;
|
|
6458
6457
|
}
|
|
6459
|
-
function
|
|
6458
|
+
function mo(r, t, e, n = 0) {
|
|
6460
6459
|
let o = "", i = [];
|
|
6461
6460
|
for (const { type: s, node: l, stripColBreak: a } of r)
|
|
6462
6461
|
if (s === "p") {
|
|
6463
|
-
const { tag: c, pStyle: u, isList: f, content: d } =
|
|
6462
|
+
const { tag: c, pStyle: u, isList: f, content: d } = go(l, t, e, a);
|
|
6464
6463
|
f ? i.push(`<li${u}>${d}</li>`) : (i.length && (o += `<ul>${i.join("")}</ul>`, i = []), o += `<${c}${u}>${d}</${c}>`);
|
|
6465
|
-
} else s === "tbl" && (i.length && (o += `<ul>${i.join("")}</ul>`, i = []), o +=
|
|
6464
|
+
} else s === "tbl" && (i.length && (o += `<ul>${i.join("")}</ul>`, i = []), o += yo(l, t, e, n));
|
|
6466
6465
|
return i.length && (o += `<ul>${i.join("")}</ul>`), o;
|
|
6467
6466
|
}
|
|
6468
|
-
function
|
|
6469
|
-
const o = v(r, "pPr"), s = (o ? v(o, "pStyle") : null)?.getAttribute("w:val") || "", l = t.get(s) || {}, a = o ?
|
|
6467
|
+
function go(r, t, e, n = !1) {
|
|
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 = {
|
|
6470
6469
|
...l.rProps || {},
|
|
6471
|
-
...u ?
|
|
6470
|
+
...u ? Rn(u) : {}
|
|
6472
6471
|
}, h = (o ? v(o, "numPr") : null) !== null || s === "ListParagraph" || l.name && /list/i.test(l.name), m = pa(s, l.name), p = m ? `h${m}` : "p", k = ha(c), b = k ? ` style="${k}"` : "", I = Re(r, f, t, e, n);
|
|
6473
6472
|
return { tag: p, pStyle: b, isList: h, content: I };
|
|
6474
6473
|
}
|
|
@@ -6482,7 +6481,7 @@ function Re(r, t, e, n, o = !1) {
|
|
|
6482
6481
|
i += aa(s, t);
|
|
6483
6482
|
} else if (l === "hyperlink") {
|
|
6484
6483
|
const a = s.getAttribute("r:id") || s.getAttributeNS(Yl, "id"), c = a && n.get(a) || "#", u = Re(s, t, e, n, o);
|
|
6485
|
-
i += `<a href="${
|
|
6484
|
+
i += `<a href="${kn(c)}">${u}</a>`;
|
|
6486
6485
|
} else if (l === "ins") {
|
|
6487
6486
|
const a = Re(s, t, e, n, o);
|
|
6488
6487
|
a && (i += `<span data-word-rev="ins" style="background:rgba(255,230,150,.6);">${a}</span>`);
|
|
@@ -6500,22 +6499,22 @@ function la(r) {
|
|
|
6500
6499
|
return !1;
|
|
6501
6500
|
}
|
|
6502
6501
|
function aa(r, t) {
|
|
6503
|
-
const e = v(r, "rPr"), n = e ?
|
|
6502
|
+
const e = v(r, "rPr"), n = e ? Rn(e) : {}, o = { ...t, ...n };
|
|
6504
6503
|
let i = "";
|
|
6505
6504
|
for (const f of r.childNodes)
|
|
6506
6505
|
f.nodeType === 1 && (f.localName === "t" || f.localName === "delText" ? i += f.textContent : f.localName === "br" ? f.getAttribute("w:type") !== "column" && (i += `
|
|
6507
6506
|
`) : f.localName === "tab" && (i += " "));
|
|
6508
6507
|
if (!i) return "";
|
|
6509
6508
|
const a = i.split(`
|
|
6510
|
-
`).map((f) => /^[ \t]+$/.test(f) ? f.replace(/ /g, " ").replace(/\t/g, " ") :
|
|
6509
|
+
`).map((f) => /^[ \t]+$/.test(f) ? f.replace(/ /g, " ").replace(/\t/g, " ") : xo(f)).join("<br/>"), c = da(o);
|
|
6511
6510
|
let u = "";
|
|
6512
|
-
return o.lang && (u += ` data-word-lang="${
|
|
6511
|
+
return o.lang && (u += ` data-word-lang="${kn(String(o.lang))}"`), o.langEastAsia && (u += ` data-word-lang-eastAsia="${kn(String(o.langEastAsia))}"`), o.noProof && (u += ' data-word-no-proof="1"'), c || u ? `<span${c ? ` style="${c}"` : ""}${u}>${a}</span>` : a;
|
|
6513
6512
|
}
|
|
6514
|
-
function
|
|
6513
|
+
function yo(r, t, e, n = 0) {
|
|
6515
6514
|
const o = v(r, "tblPr"), i = ca(o), s = ua(o), l = o ? v(o, "tblW") : null, a = l?.getAttribute("w:type") || "", c = l && parseInt(l.getAttribute("w:w"), 10) || 0;
|
|
6516
6515
|
let u = "100%";
|
|
6517
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)}%`);
|
|
6518
|
-
const f = o ? v(o, "tblCellMar") : null, d =
|
|
6517
|
+
const f = o ? v(o, "tblCellMar") : null, d = dr(f) ?? { top: 0, right: 108, bottom: 0, left: 108 }, h = v(r, "tblGrid"), m = [];
|
|
6519
6518
|
if (h) {
|
|
6520
6519
|
for (const T of h.childNodes)
|
|
6521
6520
|
if (T.nodeType === 1 && T.localName === "gridCol") {
|
|
@@ -6590,14 +6589,14 @@ function go(r, t, e, n = 0) {
|
|
|
6590
6589
|
let O = "";
|
|
6591
6590
|
for (const B of T) {
|
|
6592
6591
|
if (B.vMerge === "continue") continue;
|
|
6593
|
-
const { tc: U, tcPrEl: j, colspan: ot, rowspan: wt = 1 } = B, Ut = fa(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 =
|
|
6592
|
+
const { tc: U, tcPrEl: j, colspan: ot, rowspan: wt = 1 } = B, Ut = fa(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 = dr(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;`;
|
|
6594
6593
|
let ee = "";
|
|
6595
6594
|
for (const Et of U.childNodes)
|
|
6596
6595
|
if (Et.nodeType === 1)
|
|
6597
6596
|
if (Et.localName === "p") {
|
|
6598
|
-
const { tag: ye, pStyle: Ye, content: tn } =
|
|
6597
|
+
const { tag: ye, pStyle: Ye, content: tn } = go(Et, t, e);
|
|
6599
6598
|
ee += `<${ye}${Ye}>${tn}</${ye}>`;
|
|
6600
|
-
} else Et.localName === "tbl" && (ee +=
|
|
6599
|
+
} else Et.localName === "tbl" && (ee += yo(Et, t, e, n));
|
|
6601
6600
|
const ge = ot > 1 ? ` colspan="${ot}"` : "", pt = wt > 1 ? ` rowspan="${wt}"` : "";
|
|
6602
6601
|
O += `<td${ge}${pt} style="${Ut}${Kt}vertical-align:${Xe};">${ee}</td>`;
|
|
6603
6602
|
}
|
|
@@ -6651,7 +6650,7 @@ function fa(r, t) {
|
|
|
6651
6650
|
}
|
|
6652
6651
|
return !o;
|
|
6653
6652
|
}
|
|
6654
|
-
function
|
|
6653
|
+
function dr(r) {
|
|
6655
6654
|
if (!r) return null;
|
|
6656
6655
|
const t = {};
|
|
6657
6656
|
for (const e of ["top", "right", "bottom", "left"]) {
|
|
@@ -6666,7 +6665,7 @@ function fr(r) {
|
|
|
6666
6665
|
function Ee(r) {
|
|
6667
6666
|
return Math.round(r / 15);
|
|
6668
6667
|
}
|
|
6669
|
-
function
|
|
6668
|
+
function Rn(r) {
|
|
6670
6669
|
const t = {}, e = v(r, "rFonts");
|
|
6671
6670
|
if (e) {
|
|
6672
6671
|
const f = e.getAttribute("w:eastAsia") || e.getAttribute("w:ascii") || e.getAttribute("w:hAnsi") || e.getAttribute("w:cs") || "";
|
|
@@ -6709,7 +6708,7 @@ function Bn(r) {
|
|
|
6709
6708
|
}
|
|
6710
6709
|
return v(r, "noProof") && (t.noProof = !0), t;
|
|
6711
6710
|
}
|
|
6712
|
-
function
|
|
6711
|
+
function wo(r) {
|
|
6713
6712
|
const t = {}, e = v(r, "jc");
|
|
6714
6713
|
if (e) {
|
|
6715
6714
|
const i = e.getAttribute("w:val") || "", s = { left: "left", center: "center", right: "right", both: "justify", distribute: "justify" };
|
|
@@ -6751,7 +6750,7 @@ function ha(r) {
|
|
|
6751
6750
|
const t = [];
|
|
6752
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(";");
|
|
6753
6752
|
}
|
|
6754
|
-
const
|
|
6753
|
+
const hr = {
|
|
6755
6754
|
Heading1: 1,
|
|
6756
6755
|
Heading2: 2,
|
|
6757
6756
|
Heading3: 3,
|
|
@@ -6766,7 +6765,7 @@ const dr = {
|
|
|
6766
6765
|
6: 6
|
|
6767
6766
|
};
|
|
6768
6767
|
function pa(r, t) {
|
|
6769
|
-
if (
|
|
6768
|
+
if (hr[r] !== void 0) return hr[r];
|
|
6770
6769
|
const e = r.match(/^Heading(\d)$/i) || r.match(/^heading(\d)$/i);
|
|
6771
6770
|
if (e) return parseInt(e[1], 10);
|
|
6772
6771
|
if (t) {
|
|
@@ -6775,7 +6774,7 @@ function pa(r, t) {
|
|
|
6775
6774
|
}
|
|
6776
6775
|
return 0;
|
|
6777
6776
|
}
|
|
6778
|
-
function
|
|
6777
|
+
function zn(r) {
|
|
6779
6778
|
return new DOMParser().parseFromString(r, "application/xml");
|
|
6780
6779
|
}
|
|
6781
6780
|
function v(r, t) {
|
|
@@ -6784,11 +6783,11 @@ function v(r, t) {
|
|
|
6784
6783
|
if (e.nodeType === 1 && e.localName === t) return e;
|
|
6785
6784
|
return null;
|
|
6786
6785
|
}
|
|
6787
|
-
function
|
|
6786
|
+
function xo(r) {
|
|
6788
6787
|
return String(r).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
6789
6788
|
}
|
|
6790
|
-
function
|
|
6791
|
-
return
|
|
6789
|
+
function kn(r) {
|
|
6790
|
+
return xo(r).replace(/"/g, """);
|
|
6792
6791
|
}
|
|
6793
6792
|
const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { class: "umo-editor-instance" }, wa = ["disabled"], xa = { class: "umo-custom-huge-btn__text" }, ka = ["disabled"], ba = { class: "umo-custom-huge-btn__text" }, va = ["disabled"], Sa = { class: "umo-custom-huge-btn__text" }, Ca = { class: "umo-custom-huge-btn__icon" }, Ta = {
|
|
6794
6793
|
viewBox: "0 0 24 24",
|
|
@@ -6827,7 +6826,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6827
6826
|
n.value = !0;
|
|
6828
6827
|
let M = !0;
|
|
6829
6828
|
try {
|
|
6830
|
-
await
|
|
6829
|
+
await Po.update(ut.value, { content: JSON.stringify(C) }), await b(ut.value);
|
|
6831
6830
|
} catch (A) {
|
|
6832
6831
|
M = !1, console.error("保存失败:", A), w || alert("保存失败:" + A.message);
|
|
6833
6832
|
} finally {
|
|
@@ -6868,20 +6867,20 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6868
6867
|
flushPending: b,
|
|
6869
6868
|
queueDelete: I,
|
|
6870
6869
|
cancelPendingDelete: R
|
|
6871
|
-
} =
|
|
6870
|
+
} = xr();
|
|
6872
6871
|
z(!0);
|
|
6873
6872
|
const J = z(null), H = z([]), Z = () => J.value, at = () => J.value?.querySelector?.(".umo-scrollable-container") || J.value?.querySelector?.(".umo-scrollable") || J.value, W = (g, w) => {
|
|
6874
6873
|
if (!g || g.__gutterMounted) return;
|
|
6875
|
-
g.__gutterMounted = !0,
|
|
6874
|
+
g.__gutterMounted = !0, Io({
|
|
6876
6875
|
setup() {
|
|
6877
6876
|
const M = (A) => {
|
|
6878
|
-
|
|
6877
|
+
Pn(A);
|
|
6879
6878
|
try {
|
|
6880
6879
|
w?.commands?.focusComment?.(A);
|
|
6881
6880
|
} catch {
|
|
6882
6881
|
}
|
|
6883
6882
|
};
|
|
6884
|
-
return () =>
|
|
6883
|
+
return () => Oo(ql, {
|
|
6885
6884
|
anchors: H.value,
|
|
6886
6885
|
comments: f.value,
|
|
6887
6886
|
activeCommentId: d.value,
|
|
@@ -6899,7 +6898,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6899
6898
|
}
|
|
6900
6899
|
T.value = !0;
|
|
6901
6900
|
try {
|
|
6902
|
-
await
|
|
6901
|
+
await $o(w, f.value, e.value || "文档");
|
|
6903
6902
|
} catch (C) {
|
|
6904
6903
|
console.error("导出 Word 失败:", C), alert("导出 Word 失败,请稍后重试");
|
|
6905
6904
|
} finally {
|
|
@@ -6914,8 +6913,8 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6914
6913
|
}
|
|
6915
6914
|
B.value = !0;
|
|
6916
6915
|
try {
|
|
6917
|
-
const C = await
|
|
6918
|
-
|
|
6916
|
+
const C = await Bo(w, e.value || "文档");
|
|
6917
|
+
Ro(C, `${e.value || "文档"}.docx`);
|
|
6919
6918
|
} catch (C) {
|
|
6920
6919
|
console.error("Word 流导出失败:", C), alert("Word 流导出失败,请稍后重试");
|
|
6921
6920
|
} finally {
|
|
@@ -6995,7 +6994,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
6995
6994
|
return typeof K == "string" && /line-through/i.test(K);
|
|
6996
6995
|
}
|
|
6997
6996
|
return !1;
|
|
6998
|
-
}), re = (_) => !_ || _.length !== 1 ? null : _[0] || null, we = (_) => _ && _.length > 0 ? _[0] : null,
|
|
6997
|
+
}), re = (_) => !_ || _.length !== 1 ? null : _[0] || null, we = (_) => _ && _.length > 0 ? _[0] : null, Fn = (_) => {
|
|
6999
6998
|
const G = [];
|
|
7000
6999
|
return Nt.descendants((N, K) => {
|
|
7001
7000
|
if (N.isText && !(_ && !ne(N))) {
|
|
@@ -7048,25 +7047,25 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7048
7047
|
return ke;
|
|
7049
7048
|
};
|
|
7050
7049
|
if (It) {
|
|
7051
|
-
const _ =
|
|
7050
|
+
const _ = Fn(!0), G = we(_);
|
|
7052
7051
|
if (G)
|
|
7053
7052
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7054
7053
|
}
|
|
7055
|
-
const
|
|
7056
|
-
if (
|
|
7057
|
-
return g.chain().setTextSelection(
|
|
7054
|
+
const ko = Fn(!1), _n = re(ko);
|
|
7055
|
+
if (_n)
|
|
7056
|
+
return g.chain().setTextSelection(_n).addComment(C, M).run(), !0;
|
|
7058
7057
|
if (It) {
|
|
7059
7058
|
const _ = xe(E, !0), G = we(_);
|
|
7060
7059
|
if (G)
|
|
7061
7060
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7062
7061
|
}
|
|
7063
7062
|
let en = xe(E, !1);
|
|
7064
|
-
const
|
|
7065
|
-
if (
|
|
7066
|
-
return g.chain().setTextSelection(
|
|
7067
|
-
const
|
|
7068
|
-
if (
|
|
7069
|
-
const _ = E.slice(0,
|
|
7063
|
+
const Dn = re(en);
|
|
7064
|
+
if (Dn)
|
|
7065
|
+
return g.chain().setTextSelection(Dn).addComment(C, M).run(), !0;
|
|
7066
|
+
const Jn = Math.min(30, Math.max(8, Math.floor(E.length * 0.6)));
|
|
7067
|
+
if (Jn < E.length) {
|
|
7068
|
+
const _ = E.slice(0, Jn);
|
|
7070
7069
|
if (It) {
|
|
7071
7070
|
const N = xe(_, !0), K = re(N);
|
|
7072
7071
|
if (K)
|
|
@@ -7137,8 +7136,8 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7137
7136
|
height: "100%",
|
|
7138
7137
|
cdnUrl: t.cdnUrl,
|
|
7139
7138
|
extensions: [
|
|
7140
|
-
|
|
7141
|
-
|
|
7139
|
+
Pl,
|
|
7140
|
+
Ul.configure({
|
|
7142
7141
|
getStageEl: Z,
|
|
7143
7142
|
getScrollEl: at,
|
|
7144
7143
|
onAnchors: (g) => {
|
|
@@ -7200,7 +7199,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7200
7199
|
pt()?.commands.removeComment(g), await m(g);
|
|
7201
7200
|
}, tn = async (g) => {
|
|
7202
7201
|
await p(g);
|
|
7203
|
-
},
|
|
7202
|
+
}, Pn = (g) => {
|
|
7204
7203
|
const w = "rgba(251, 191, 36, 0.95)";
|
|
7205
7204
|
document.querySelectorAll(`.comment-mark[data-comment-id="${g}"]`).forEach((M) => {
|
|
7206
7205
|
if (!(M instanceof HTMLElement)) return;
|
|
@@ -7214,11 +7213,11 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7214
7213
|
C?.commands.focusComment(g);
|
|
7215
7214
|
}, 0);
|
|
7216
7215
|
};
|
|
7217
|
-
return
|
|
7216
|
+
return yr(() => {
|
|
7218
7217
|
ut.value || (ut.value = crypto.randomUUID()), e.value || (e.value = "未命名文档");
|
|
7219
|
-
}),
|
|
7218
|
+
}), To(() => {
|
|
7220
7219
|
}), (g, w) => {
|
|
7221
|
-
const C =
|
|
7220
|
+
const C = Ao("umo-editor");
|
|
7222
7221
|
return q(), rt("div", ma, [
|
|
7223
7222
|
y("div", ga, [
|
|
7224
7223
|
y("div", ya, [
|
|
@@ -7227,12 +7226,12 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7227
7226
|
ref: J,
|
|
7228
7227
|
class: "umo-editor-stage"
|
|
7229
7228
|
}, [
|
|
7230
|
-
oe(ut) ? (q(), Ie(C,
|
|
7229
|
+
oe(ut) ? (q(), Ie(C, Mo({
|
|
7231
7230
|
key: 0,
|
|
7232
7231
|
ref_key: "editorRef",
|
|
7233
7232
|
ref: u
|
|
7234
7233
|
}, ge.value), {
|
|
7235
|
-
toolbar_export:
|
|
7234
|
+
toolbar_export: Eo(() => [
|
|
7236
7235
|
y("input", {
|
|
7237
7236
|
ref_key: "importWordFileInput",
|
|
7238
7237
|
ref: j,
|
|
@@ -7421,12 +7420,12 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7421
7420
|
], 512)
|
|
7422
7421
|
])
|
|
7423
7422
|
]),
|
|
7424
|
-
|
|
7425
|
-
onActivate:
|
|
7423
|
+
No(ni, {
|
|
7424
|
+
onActivate: Pn,
|
|
7426
7425
|
onDelete: Ye,
|
|
7427
7426
|
onResolve: tn
|
|
7428
7427
|
}),
|
|
7429
|
-
(q(), Ie(
|
|
7428
|
+
(q(), Ie(wr, { to: "body" }, [
|
|
7430
7429
|
vt.value ? (q(), rt("div", {
|
|
7431
7430
|
key: 0,
|
|
7432
7431
|
class: "html-dialog-mask",
|
|
@@ -7452,7 +7451,7 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7452
7451
|
])
|
|
7453
7452
|
])) : le("", !0)
|
|
7454
7453
|
])),
|
|
7455
|
-
Pt.value ? (q(), Ie(
|
|
7454
|
+
Pt.value ? (q(), Ie(di, {
|
|
7456
7455
|
key: 0,
|
|
7457
7456
|
"selected-text": Ht.value,
|
|
7458
7457
|
"initial-note": Ke.value,
|
|
@@ -7463,15 +7462,15 @@ const ma = { class: "app-layout" }, ga = { class: "editor-wrapper" }, ya = { cla
|
|
|
7463
7462
|
};
|
|
7464
7463
|
}
|
|
7465
7464
|
}, Ra = /* @__PURE__ */ He(Ba, [["__scopeId", "data-v-d6ad3b04"]]);
|
|
7466
|
-
function
|
|
7465
|
+
function _a() {
|
|
7467
7466
|
}
|
|
7468
|
-
const
|
|
7467
|
+
const Da = {
|
|
7469
7468
|
install(r, t) {
|
|
7470
|
-
r.use(
|
|
7469
|
+
r.use(bo, t ?? {}), r.component("UmoEditorApp", Ra);
|
|
7471
7470
|
}
|
|
7472
7471
|
};
|
|
7473
7472
|
export {
|
|
7474
7473
|
Ra as UmoEditorApp,
|
|
7475
|
-
|
|
7476
|
-
|
|
7474
|
+
Da as UmoEditorAppPlugin,
|
|
7475
|
+
_a as ensureUmoEditorGlobals
|
|
7477
7476
|
};
|