ai-word-editor 0.0.27 → 0.0.29
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 +819 -819
- package/dist/types/utils/wordDocxExport.d.ts.map +1 -1
- package/dist/{wordDocxExport-DpuGbDiU.js → wordDocxExport-HUc5glnu.js} +79 -80
- package/dist/wordDocxExport.js +1 -1
- package/package.json +1 -1
- package/src/utils/docxFeatureExtract.ts +5 -10
- package/src/utils/wordCommentImport.js +3 -7
- package/src/utils/wordDocxExport.ts +3 -6
- package/src/utils/wordStyleImport.js +3 -8
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useUmoEditor as
|
|
2
|
-
import { ref as z, computed as
|
|
3
|
-
import { e as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
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 hr, renderList as pr, normalizeClass as mr, onMounted as gr, createBlock as Ie, Teleport as yr, withModifiers as ze, withDirectives as vo, withKeys as dn, vModelText as So, watch as hn, normalizeStyle as Co, onUnmounted as To, resolveComponent as Ao, mergeProps as Mo, withCtx as Eo, createVNode as No, createApp as Io, h as Oo } from "vue";
|
|
3
|
+
import { e as $o, a as Bo, s as Ro } from "./wordDocxExport-HUc5glnu.js";
|
|
4
|
+
import wr from "jszip";
|
|
5
|
+
const zo = "http://localhost:8000";
|
|
6
6
|
async function Tt(r, t = {}) {
|
|
7
7
|
const e = {
|
|
8
8
|
"Content-Type": "application/json",
|
|
9
9
|
...t.headers
|
|
10
|
-
}, n = await fetch(`${
|
|
10
|
+
}, n = await fetch(`${zo}${r}`, {
|
|
11
11
|
...t,
|
|
12
12
|
headers: e
|
|
13
13
|
});
|
|
@@ -17,7 +17,7 @@ async function Tt(r, t = {}) {
|
|
|
17
17
|
throw new Error(o.detail || `请求失败 (${n.status})`);
|
|
18
18
|
return o;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const Po = {
|
|
21
21
|
list() {
|
|
22
22
|
return Tt("/api/documents");
|
|
23
23
|
},
|
|
@@ -39,7 +39,7 @@ const _o = {
|
|
|
39
39
|
delete(r) {
|
|
40
40
|
return Tt(`/api/documents/${r}`, { method: "DELETE" });
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, Oe = {
|
|
43
43
|
list(r) {
|
|
44
44
|
return Tt(`/api/documents/${r}/comments`);
|
|
45
45
|
},
|
|
@@ -67,17 +67,17 @@ const _o = {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
}, tt = 20, Ct = z([]), ve = z(null), ut = z(null), ft = /* @__PURE__ */ new Map(), yt = /* @__PURE__ */ new Map(), xt = /* @__PURE__ */ new Set();
|
|
70
|
-
function
|
|
70
|
+
function Fo(r, t) {
|
|
71
71
|
const e = Number.parseInt(r, 10);
|
|
72
72
|
return ((Number.isNaN(e) ? t : e) % tt + tt) % tt;
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function _o(r, t) {
|
|
75
75
|
if (xt.delete(t.id), ft.set(t.id, { ...t, docId: r }), yt.has(t.id)) {
|
|
76
76
|
const e = yt.get(t.id);
|
|
77
77
|
yt.delete(t.id), ft.set(t.id, { ...ft.get(t.id), ...e });
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function Do(r, t) {
|
|
81
81
|
if (xt.has(r)) return;
|
|
82
82
|
if (ft.has(r)) {
|
|
83
83
|
ft.set(r, { ...ft.get(r), ...t });
|
|
@@ -86,20 +86,20 @@ function Lo(r, t) {
|
|
|
86
86
|
const e = yt.get(r) || {};
|
|
87
87
|
yt.set(r, { ...e, ...t });
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function Jn(r) {
|
|
90
90
|
if (ft.has(r)) {
|
|
91
91
|
ft.delete(r), yt.delete(r), xt.delete(r);
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
yt.delete(r), xt.add(r);
|
|
95
95
|
}
|
|
96
|
-
function
|
|
96
|
+
function Lo(r) {
|
|
97
97
|
xt.delete(r);
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Jo() {
|
|
100
100
|
ft.clear(), yt.clear(), xt.clear();
|
|
101
101
|
}
|
|
102
|
-
async function
|
|
102
|
+
async function Wo(r) {
|
|
103
103
|
if (!r || ft.size === 0 && yt.size === 0 && xt.size === 0) return;
|
|
104
104
|
const t = Array.from(ft.values()).filter((o) => o && o.docId === r).map((o) => ({
|
|
105
105
|
id: o.id,
|
|
@@ -110,22 +110,22 @@ async function Vo(r) {
|
|
|
110
110
|
resolved: o.resolved
|
|
111
111
|
}));
|
|
112
112
|
for (const o of t)
|
|
113
|
-
await
|
|
113
|
+
await Oe.create(r, o), ft.delete(o.id);
|
|
114
114
|
const e = Array.from(yt.entries()).filter(([o]) => !xt.has(o)).map(([o, i]) => ({ id: o, patch: i }));
|
|
115
115
|
for (const { id: o, patch: i } of e)
|
|
116
|
-
await
|
|
116
|
+
await Oe.update(r, o, i), yt.delete(o);
|
|
117
117
|
const n = Array.from(xt.values());
|
|
118
118
|
for (const o of n)
|
|
119
|
-
await
|
|
119
|
+
await Oe.delete(r, o), xt.delete(o);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function xr() {
|
|
122
122
|
return {
|
|
123
123
|
comments: Ct,
|
|
124
124
|
activeCommentId: ve,
|
|
125
125
|
loadComments: async (s) => {
|
|
126
126
|
if (s)
|
|
127
127
|
try {
|
|
128
|
-
const l = await
|
|
128
|
+
const l = await Oe.list(s);
|
|
129
129
|
Ct.value = l.map((a, c) => ({
|
|
130
130
|
id: a.id,
|
|
131
131
|
selectedText: a.selected_text,
|
|
@@ -143,7 +143,7 @@ function br() {
|
|
|
143
143
|
addComment: async ({ id: s, selectedText: l, note: a, author: c = "我", colorIndex: u }) => {
|
|
144
144
|
const f = ut.value;
|
|
145
145
|
if (!f) return;
|
|
146
|
-
const d =
|
|
146
|
+
const d = Fo(
|
|
147
147
|
u,
|
|
148
148
|
Ct.value.length % tt
|
|
149
149
|
), h = {
|
|
@@ -155,7 +155,7 @@ function br() {
|
|
|
155
155
|
resolved: !1,
|
|
156
156
|
colorIndex: d
|
|
157
157
|
};
|
|
158
|
-
Ct.value.push(h),
|
|
158
|
+
Ct.value.push(h), _o(f, {
|
|
159
159
|
id: s,
|
|
160
160
|
selectedText: l,
|
|
161
161
|
note: a,
|
|
@@ -168,14 +168,14 @@ function br() {
|
|
|
168
168
|
const l = Ct.value.slice();
|
|
169
169
|
Ct.value = Ct.value.filter((a) => a.id !== s), ve.value === s && (ve.value = null);
|
|
170
170
|
try {
|
|
171
|
-
|
|
171
|
+
Jn(s);
|
|
172
172
|
} catch (a) {
|
|
173
173
|
Ct.value = l, console.error("删除批注入队失败:", a);
|
|
174
174
|
}
|
|
175
175
|
},
|
|
176
176
|
resolveComment: async (s) => {
|
|
177
177
|
const l = Ct.value.find((a) => a.id === s);
|
|
178
|
-
l && (l.resolved = !l.resolved,
|
|
178
|
+
l && (l.resolved = !l.resolved, Do(s, { resolved: l.resolved }));
|
|
179
179
|
},
|
|
180
180
|
setActiveComment: (s) => {
|
|
181
181
|
ve.value = s;
|
|
@@ -184,49 +184,49 @@ function br() {
|
|
|
184
184
|
const l = new Date(s), a = (c) => String(c).padStart(2, "0");
|
|
185
185
|
return `${l.getMonth() + 1}/${l.getDate()} ${a(l.getHours())}:${a(l.getMinutes())}`;
|
|
186
186
|
},
|
|
187
|
-
flushPending:
|
|
188
|
-
resetPending:
|
|
187
|
+
flushPending: Wo,
|
|
188
|
+
resetPending: Jo,
|
|
189
189
|
// 供 App.vue 的“孤立批注软删除/撤销”逻辑使用
|
|
190
|
-
queueDelete:
|
|
191
|
-
cancelPendingDelete:
|
|
190
|
+
queueDelete: Jn,
|
|
191
|
+
cancelPendingDelete: Lo
|
|
192
192
|
};
|
|
193
193
|
}
|
|
194
|
-
const
|
|
194
|
+
const He = (r, t) => {
|
|
195
195
|
const e = r.__vccOpts || r;
|
|
196
196
|
for (const [n, o] of t)
|
|
197
197
|
e[n] = o;
|
|
198
198
|
return e;
|
|
199
|
-
},
|
|
199
|
+
}, jo = { class: "comment-panel" }, Vo = { class: "comment-panel__header" }, qo = { class: "comment-panel__title" }, Ho = {
|
|
200
200
|
key: 0,
|
|
201
201
|
class: "comment-panel__badge"
|
|
202
|
-
},
|
|
202
|
+
}, Uo = {
|
|
203
203
|
key: 0,
|
|
204
204
|
class: "comment-panel__empty"
|
|
205
|
-
},
|
|
205
|
+
}, Go = {
|
|
206
206
|
key: 1,
|
|
207
207
|
class: "comment-panel__list"
|
|
208
|
-
},
|
|
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 = {
|
|
209
209
|
__name: "CommentPanel",
|
|
210
210
|
emits: ["activate", "delete", "resolve"],
|
|
211
211
|
setup(r, { emit: t }) {
|
|
212
|
-
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) => {
|
|
213
213
|
o(u), s("activate", u);
|
|
214
214
|
};
|
|
215
|
-
return (u, f) => (q(), rt("aside",
|
|
216
|
-
y("div",
|
|
217
|
-
y("h3",
|
|
218
|
-
f[0] || (f[0] =
|
|
219
|
-
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)
|
|
220
220
|
])
|
|
221
221
|
]),
|
|
222
|
-
oe(e).length === 0 ? (q(), rt("div",
|
|
222
|
+
oe(e).length === 0 ? (q(), rt("div", Uo, [...f[1] || (f[1] = [
|
|
223
223
|
y("div", { class: "comment-panel__empty-icon" }, "💬", -1),
|
|
224
224
|
y("p", null, "暂无批注", -1),
|
|
225
225
|
y("p", { class: "comment-panel__empty-hint" }, "选中文本后点击「添加批注」", -1)
|
|
226
|
-
])])) : (q(), rt("ul",
|
|
227
|
-
(q(!0), rt(
|
|
226
|
+
])])) : (q(), rt("ul", Go, [
|
|
227
|
+
(q(!0), rt(hr, null, pr(oe(e), (d) => (q(), rt("li", {
|
|
228
228
|
key: d.id,
|
|
229
|
-
class:
|
|
229
|
+
class: mr(["comment-item", [
|
|
230
230
|
`comment-item--c${d.colorIndex ?? 0}`,
|
|
231
231
|
{
|
|
232
232
|
"comment-item--active": oe(n) === d.id,
|
|
@@ -235,23 +235,23 @@ const Ke = (r, t) => {
|
|
|
235
235
|
]]),
|
|
236
236
|
onClick: (h) => c(d.id)
|
|
237
237
|
}, [
|
|
238
|
-
y("div",
|
|
238
|
+
y("div", Xo, [
|
|
239
239
|
f[2] || (f[2] = y("span", { class: "comment-item__quote-icon" }, "❝", -1)),
|
|
240
|
-
|
|
240
|
+
Ln(" " + Y(a(d.selectedText, 40)), 1)
|
|
241
241
|
]),
|
|
242
|
-
y("div",
|
|
243
|
-
y("div",
|
|
244
|
-
y("span",
|
|
245
|
-
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)
|
|
246
246
|
])
|
|
247
|
-
], 10,
|
|
247
|
+
], 10, Ko))), 128))
|
|
248
248
|
]))
|
|
249
249
|
]));
|
|
250
250
|
}
|
|
251
|
-
},
|
|
251
|
+
}, ni = /* @__PURE__ */ He(ei, [["__scopeId", "data-v-870abb9c"]]), ri = { class: "dialog" }, oi = { class: "dialog__header" }, ii = {
|
|
252
252
|
key: 0,
|
|
253
253
|
class: "dialog__quote"
|
|
254
|
-
},
|
|
254
|
+
}, si = { class: "dialog__quote-text" }, li = { class: "dialog__body" }, ai = ["onKeydown"], ci = { class: "dialog__footer" }, ui = ["disabled"], fi = {
|
|
255
255
|
__name: "CommentAddDialog",
|
|
256
256
|
props: {
|
|
257
257
|
selectedText: {
|
|
@@ -266,35 +266,35 @@ const Ke = (r, t) => {
|
|
|
266
266
|
emits: ["confirm", "cancel"],
|
|
267
267
|
setup(r, { emit: t }) {
|
|
268
268
|
const e = r, n = t, o = z(e.initialNote), i = z(null);
|
|
269
|
-
|
|
269
|
+
gr(() => {
|
|
270
270
|
i.value?.focus();
|
|
271
271
|
});
|
|
272
272
|
const s = (a, c) => a ? a.length > c ? a.slice(0, c) + "…" : a : "", l = () => {
|
|
273
273
|
o.value.trim() && (n("confirm", o.value.trim()), o.value = "");
|
|
274
274
|
};
|
|
275
|
-
return (a, c) => (q(),
|
|
275
|
+
return (a, c) => (q(), Ie(yr, { to: "body" }, [
|
|
276
276
|
y("div", {
|
|
277
277
|
class: "dialog-backdrop",
|
|
278
|
-
onClick: c[4] || (c[4] =
|
|
278
|
+
onClick: c[4] || (c[4] = ze((u) => a.$emit("cancel"), ["self"]))
|
|
279
279
|
}, [
|
|
280
|
-
y("div",
|
|
281
|
-
y("div",
|
|
280
|
+
y("div", ri, [
|
|
281
|
+
y("div", oi, [
|
|
282
282
|
c[5] || (c[5] = y("h4", { class: "dialog__title" }, "添加批注", -1)),
|
|
283
283
|
y("button", {
|
|
284
284
|
class: "dialog__close",
|
|
285
285
|
onClick: c[0] || (c[0] = (u) => a.$emit("cancel"))
|
|
286
286
|
}, "✕")
|
|
287
287
|
]),
|
|
288
|
-
r.selectedText ? (q(), rt("div",
|
|
288
|
+
r.selectedText ? (q(), rt("div", ii, [
|
|
289
289
|
c[6] || (c[6] = y("span", { class: "dialog__quote-label" }, "选中文本", -1)),
|
|
290
|
-
y("blockquote",
|
|
290
|
+
y("blockquote", si, Y(s(r.selectedText, 120)), 1)
|
|
291
291
|
])) : le("", !0),
|
|
292
|
-
y("div",
|
|
292
|
+
y("div", li, [
|
|
293
293
|
c[7] || (c[7] = y("label", {
|
|
294
294
|
class: "dialog__label",
|
|
295
295
|
for: "comment-input"
|
|
296
296
|
}, "批注内容", -1)),
|
|
297
|
-
|
|
297
|
+
vo(y("textarea", {
|
|
298
298
|
id: "comment-input",
|
|
299
299
|
ref_key: "textareaRef",
|
|
300
300
|
ref: i,
|
|
@@ -303,15 +303,15 @@ const Ke = (r, t) => {
|
|
|
303
303
|
placeholder: "请输入批注内容…",
|
|
304
304
|
rows: "4",
|
|
305
305
|
onKeydown: [
|
|
306
|
-
|
|
307
|
-
c[2] || (c[2] =
|
|
306
|
+
dn(ze(l, ["ctrl"]), ["enter"]),
|
|
307
|
+
c[2] || (c[2] = dn((u) => a.$emit("cancel"), ["escape"]))
|
|
308
308
|
]
|
|
309
|
-
}, null, 40,
|
|
310
|
-
[
|
|
309
|
+
}, null, 40, ai), [
|
|
310
|
+
[So, o.value]
|
|
311
311
|
]),
|
|
312
312
|
c[8] || (c[8] = y("p", { class: "dialog__hint" }, "Ctrl+Enter 确认 · Esc 取消", -1))
|
|
313
313
|
]),
|
|
314
|
-
y("div",
|
|
314
|
+
y("div", ci, [
|
|
315
315
|
y("button", {
|
|
316
316
|
class: "dialog__btn dialog__btn--cancel",
|
|
317
317
|
onClick: c[3] || (c[3] = (u) => a.$emit("cancel"))
|
|
@@ -320,13 +320,13 @@ const Ke = (r, t) => {
|
|
|
320
320
|
class: "dialog__btn dialog__btn--confirm",
|
|
321
321
|
disabled: !o.value.trim(),
|
|
322
322
|
onClick: l
|
|
323
|
-
}, " 确认添加 ", 8,
|
|
323
|
+
}, " 确认添加 ", 8, ui)
|
|
324
324
|
])
|
|
325
325
|
])
|
|
326
326
|
])
|
|
327
327
|
]));
|
|
328
328
|
}
|
|
329
|
-
},
|
|
329
|
+
}, di = /* @__PURE__ */ He(fi, [["__scopeId", "data-v-8cbc8293"]]);
|
|
330
330
|
function X(r) {
|
|
331
331
|
this.content = r;
|
|
332
332
|
}
|
|
@@ -427,7 +427,7 @@ X.from = function(r) {
|
|
|
427
427
|
if (r) for (var e in r) t.push(e, r[e]);
|
|
428
428
|
return new X(t);
|
|
429
429
|
};
|
|
430
|
-
function
|
|
430
|
+
function kr(r, t, e) {
|
|
431
431
|
for (let n = 0; ; n++) {
|
|
432
432
|
if (n == r.childCount || n == t.childCount)
|
|
433
433
|
return r.childCount == t.childCount ? null : e;
|
|
@@ -444,14 +444,14 @@ function vr(r, t, e) {
|
|
|
444
444
|
return e;
|
|
445
445
|
}
|
|
446
446
|
if (o.content.size || i.content.size) {
|
|
447
|
-
let s =
|
|
447
|
+
let s = kr(o.content, i.content, e + 1);
|
|
448
448
|
if (s != null)
|
|
449
449
|
return s;
|
|
450
450
|
}
|
|
451
451
|
e += o.nodeSize;
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
function
|
|
454
|
+
function br(r, t, e, n) {
|
|
455
455
|
for (let o = r.childCount, i = t.childCount; ; ) {
|
|
456
456
|
if (o == 0 || i == 0)
|
|
457
457
|
return o == i ? null : { a: e, b: n };
|
|
@@ -469,7 +469,7 @@ function Sr(r, t, e, n) {
|
|
|
469
469
|
return { a: e, b: n };
|
|
470
470
|
}
|
|
471
471
|
if (s.content.size || l.content.size) {
|
|
472
|
-
let c =
|
|
472
|
+
let c = br(s.content, l.content, e - 1, n - 1);
|
|
473
473
|
if (c)
|
|
474
474
|
return c;
|
|
475
475
|
}
|
|
@@ -638,7 +638,7 @@ class x {
|
|
|
638
638
|
fragment differ, or `null` if they are the same.
|
|
639
639
|
*/
|
|
640
640
|
findDiffStart(t, e = 0) {
|
|
641
|
-
return
|
|
641
|
+
return kr(this, t, e);
|
|
642
642
|
}
|
|
643
643
|
/**
|
|
644
644
|
Find the first position, searching from the end, at which this
|
|
@@ -647,7 +647,7 @@ class x {
|
|
|
647
647
|
nodes, an object with two separate positions is returned.
|
|
648
648
|
*/
|
|
649
649
|
findDiffEnd(t, e = this.size, n = t.size) {
|
|
650
|
-
return
|
|
650
|
+
return br(this, t, e, n);
|
|
651
651
|
}
|
|
652
652
|
/**
|
|
653
653
|
Find the index and inner offset corresponding to a given relative
|
|
@@ -729,11 +729,11 @@ class x {
|
|
|
729
729
|
}
|
|
730
730
|
}
|
|
731
731
|
x.empty = new x([], 0);
|
|
732
|
-
const
|
|
732
|
+
const nn = { index: 0, offset: 0 };
|
|
733
733
|
function Se(r, t) {
|
|
734
|
-
return
|
|
734
|
+
return nn.index = r, nn.offset = t, nn;
|
|
735
735
|
}
|
|
736
|
-
function
|
|
736
|
+
function Pe(r, t) {
|
|
737
737
|
if (r === t)
|
|
738
738
|
return !0;
|
|
739
739
|
if (!(r && typeof r == "object") || !(t && typeof t == "object"))
|
|
@@ -745,11 +745,11 @@ function De(r, t) {
|
|
|
745
745
|
if (r.length != t.length)
|
|
746
746
|
return !1;
|
|
747
747
|
for (let n = 0; n < r.length; n++)
|
|
748
|
-
if (!
|
|
748
|
+
if (!Pe(r[n], t[n]))
|
|
749
749
|
return !1;
|
|
750
750
|
} else {
|
|
751
751
|
for (let n in r)
|
|
752
|
-
if (!(n in t) || !
|
|
752
|
+
if (!(n in t) || !Pe(r[n], t[n]))
|
|
753
753
|
return !1;
|
|
754
754
|
for (let n in t)
|
|
755
755
|
if (!(n in r))
|
|
@@ -757,7 +757,7 @@ function De(r, t) {
|
|
|
757
757
|
}
|
|
758
758
|
return !0;
|
|
759
759
|
}
|
|
760
|
-
let
|
|
760
|
+
let J = class pn {
|
|
761
761
|
/**
|
|
762
762
|
@internal
|
|
763
763
|
*/
|
|
@@ -811,7 +811,7 @@ let L = class yn {
|
|
|
811
811
|
another mark.
|
|
812
812
|
*/
|
|
813
813
|
eq(t) {
|
|
814
|
-
return this == t || this.type == t.type &&
|
|
814
|
+
return this == t || this.type == t.type && Pe(this.attrs, t.attrs);
|
|
815
815
|
}
|
|
816
816
|
/**
|
|
817
817
|
Convert this mark to a JSON-serializeable representation.
|
|
@@ -855,15 +855,15 @@ let L = class yn {
|
|
|
855
855
|
*/
|
|
856
856
|
static setFrom(t) {
|
|
857
857
|
if (!t || Array.isArray(t) && t.length == 0)
|
|
858
|
-
return
|
|
859
|
-
if (t instanceof
|
|
858
|
+
return pn.none;
|
|
859
|
+
if (t instanceof pn)
|
|
860
860
|
return [t];
|
|
861
861
|
let e = t.slice();
|
|
862
862
|
return e.sort((n, o) => n.type.rank - o.type.rank), e;
|
|
863
863
|
}
|
|
864
864
|
};
|
|
865
|
-
|
|
866
|
-
class
|
|
865
|
+
J.none = [];
|
|
866
|
+
class Fe extends Error {
|
|
867
867
|
}
|
|
868
868
|
class S {
|
|
869
869
|
/**
|
|
@@ -891,14 +891,14 @@ class S {
|
|
|
891
891
|
@internal
|
|
892
892
|
*/
|
|
893
893
|
insertAt(t, e) {
|
|
894
|
-
let n =
|
|
894
|
+
let n = Sr(this.content, t + this.openStart, e);
|
|
895
895
|
return n && new S(n, this.openStart, this.openEnd);
|
|
896
896
|
}
|
|
897
897
|
/**
|
|
898
898
|
@internal
|
|
899
899
|
*/
|
|
900
900
|
removeBetween(t, e) {
|
|
901
|
-
return new S(
|
|
901
|
+
return new S(vr(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
|
|
902
902
|
}
|
|
903
903
|
/**
|
|
904
904
|
Tests whether this slice is equal to another slice.
|
|
@@ -946,7 +946,7 @@ class S {
|
|
|
946
946
|
}
|
|
947
947
|
}
|
|
948
948
|
S.empty = new S(x.empty, 0, 0);
|
|
949
|
-
function
|
|
949
|
+
function vr(r, t, e) {
|
|
950
950
|
let { index: n, offset: o } = r.findIndex(t), i = r.maybeChild(n), { index: s, offset: l } = r.findIndex(e);
|
|
951
951
|
if (o == t || i.isText) {
|
|
952
952
|
if (l != e && !r.child(s).isText)
|
|
@@ -955,44 +955,44 @@ function Cr(r, t, e) {
|
|
|
955
955
|
}
|
|
956
956
|
if (n != s)
|
|
957
957
|
throw new RangeError("Removing non-flat range");
|
|
958
|
-
return r.replaceChild(n, i.copy(
|
|
958
|
+
return r.replaceChild(n, i.copy(vr(i.content, t - o - 1, e - o - 1)));
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function Sr(r, t, e, n) {
|
|
961
961
|
let { index: o, offset: i } = r.findIndex(t), s = r.maybeChild(o);
|
|
962
962
|
if (i == t || s.isText)
|
|
963
963
|
return n && !n.canReplace(o, o, e) ? null : r.cut(0, t).append(e).append(r.cut(t));
|
|
964
|
-
let l =
|
|
964
|
+
let l = Sr(s.content, t - i - 1, e, s);
|
|
965
965
|
return l && r.replaceChild(o, s.copy(l));
|
|
966
966
|
}
|
|
967
|
-
function
|
|
967
|
+
function hi(r, t, e) {
|
|
968
968
|
if (e.openStart > r.depth)
|
|
969
|
-
throw new
|
|
969
|
+
throw new Fe("Inserted content deeper than insertion position");
|
|
970
970
|
if (r.depth - e.openStart != t.depth - e.openEnd)
|
|
971
|
-
throw new
|
|
972
|
-
return
|
|
971
|
+
throw new Fe("Inconsistent open depths");
|
|
972
|
+
return Cr(r, t, e, 0);
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function Cr(r, t, e, n) {
|
|
975
975
|
let o = r.index(n), i = r.node(n);
|
|
976
976
|
if (o == t.index(n) && n < r.depth - e.openStart) {
|
|
977
|
-
let s =
|
|
977
|
+
let s = Cr(r, t, e, n + 1);
|
|
978
978
|
return i.copy(i.content.replaceChild(o, s));
|
|
979
979
|
} else if (e.content.size)
|
|
980
980
|
if (!e.openStart && !e.openEnd && r.depth == n && t.depth == n) {
|
|
981
981
|
let s = r.parent, l = s.content;
|
|
982
982
|
return jt(s, l.cut(0, r.parentOffset).append(e.content).append(l.cut(t.parentOffset)));
|
|
983
983
|
} else {
|
|
984
|
-
let { start: s, end: l } =
|
|
985
|
-
return jt(i,
|
|
984
|
+
let { start: s, end: l } = pi(e, r);
|
|
985
|
+
return jt(i, Ar(r, s, l, t, n));
|
|
986
986
|
}
|
|
987
|
-
else return jt(i,
|
|
987
|
+
else return jt(i, _e(r, t, n));
|
|
988
988
|
}
|
|
989
|
-
function
|
|
989
|
+
function Tr(r, t) {
|
|
990
990
|
if (!t.type.compatibleContent(r.type))
|
|
991
|
-
throw new
|
|
991
|
+
throw new Fe("Cannot join " + t.type.name + " onto " + r.type.name);
|
|
992
992
|
}
|
|
993
|
-
function
|
|
993
|
+
function mn(r, t, e) {
|
|
994
994
|
let n = r.node(e);
|
|
995
|
-
return
|
|
995
|
+
return Tr(n, t.node(e)), n;
|
|
996
996
|
}
|
|
997
997
|
function Wt(r, t) {
|
|
998
998
|
let e = t.length - 1;
|
|
@@ -1008,19 +1008,19 @@ function ae(r, t, e, n) {
|
|
|
1008
1008
|
function jt(r, t) {
|
|
1009
1009
|
return r.type.checkContent(t), r.copy(t);
|
|
1010
1010
|
}
|
|
1011
|
-
function
|
|
1012
|
-
let i = r.depth > o &&
|
|
1013
|
-
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 && mn(r, t, o + 1), s = n.depth > o && mn(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);
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1015
|
+
function _e(r, t, e) {
|
|
1016
1016
|
let n = [];
|
|
1017
1017
|
if (ae(null, r, e, n), r.depth > e) {
|
|
1018
|
-
let o =
|
|
1019
|
-
Wt(jt(o,
|
|
1018
|
+
let o = mn(r, t, e + 1);
|
|
1019
|
+
Wt(jt(o, _e(r, t, e + 1)), n);
|
|
1020
1020
|
}
|
|
1021
1021
|
return ae(t, null, e, n), new x(n);
|
|
1022
1022
|
}
|
|
1023
|
-
function
|
|
1023
|
+
function pi(r, t) {
|
|
1024
1024
|
let e = t.depth - r.openStart, o = t.node(e).copy(r.content);
|
|
1025
1025
|
for (let i = e - 1; i >= 0; i--)
|
|
1026
1026
|
o = t.node(i).copy(x.from(o));
|
|
@@ -1160,7 +1160,7 @@ class fe {
|
|
|
1160
1160
|
marks() {
|
|
1161
1161
|
let t = this.parent, e = this.index();
|
|
1162
1162
|
if (t.content.size == 0)
|
|
1163
|
-
return
|
|
1163
|
+
return J.none;
|
|
1164
1164
|
if (this.textOffset)
|
|
1165
1165
|
return t.child(e).marks;
|
|
1166
1166
|
let n = t.maybeChild(e - 1), o = t.maybeChild(e);
|
|
@@ -1214,7 +1214,7 @@ class fe {
|
|
|
1214
1214
|
return t.blockRange(this);
|
|
1215
1215
|
for (let n = this.depth - (this.parent.inlineContent || this.pos == t.pos ? 1 : 0); n >= 0; n--)
|
|
1216
1216
|
if (t.pos <= this.end(n) && (!e || e(this.node(n))))
|
|
1217
|
-
return new
|
|
1217
|
+
return new De(this, t, n);
|
|
1218
1218
|
return null;
|
|
1219
1219
|
}
|
|
1220
1220
|
/**
|
|
@@ -1263,7 +1263,7 @@ class fe {
|
|
|
1263
1263
|
@internal
|
|
1264
1264
|
*/
|
|
1265
1265
|
static resolveCached(t, e) {
|
|
1266
|
-
let n =
|
|
1266
|
+
let n = Wn.get(t);
|
|
1267
1267
|
if (n)
|
|
1268
1268
|
for (let i = 0; i < n.elts.length; i++) {
|
|
1269
1269
|
let s = n.elts[i];
|
|
@@ -1271,18 +1271,18 @@ class fe {
|
|
|
1271
1271
|
return s;
|
|
1272
1272
|
}
|
|
1273
1273
|
else
|
|
1274
|
-
|
|
1274
|
+
Wn.set(t, n = new mi());
|
|
1275
1275
|
let o = n.elts[n.i] = fe.resolve(t, e);
|
|
1276
|
-
return n.i = (n.i + 1) %
|
|
1276
|
+
return n.i = (n.i + 1) % gi, o;
|
|
1277
1277
|
}
|
|
1278
1278
|
}
|
|
1279
|
-
class
|
|
1279
|
+
class mi {
|
|
1280
1280
|
constructor() {
|
|
1281
1281
|
this.elts = [], this.i = 0;
|
|
1282
1282
|
}
|
|
1283
1283
|
}
|
|
1284
|
-
const
|
|
1285
|
-
class
|
|
1284
|
+
const gi = 12, Wn = /* @__PURE__ */ new WeakMap();
|
|
1285
|
+
class De {
|
|
1286
1286
|
/**
|
|
1287
1287
|
Construct a node range. `$from` and `$to` should point into the
|
|
1288
1288
|
same node until at least the given `depth`, since a node range
|
|
@@ -1322,12 +1322,12 @@ class We {
|
|
|
1322
1322
|
return this.$to.indexAfter(this.depth);
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
const
|
|
1325
|
+
const yi = /* @__PURE__ */ Object.create(null);
|
|
1326
1326
|
class kt {
|
|
1327
1327
|
/**
|
|
1328
1328
|
@internal
|
|
1329
1329
|
*/
|
|
1330
|
-
constructor(t, e, n, o =
|
|
1330
|
+
constructor(t, e, n, o = J.none) {
|
|
1331
1331
|
this.type = t, this.attrs = e, this.marks = o, this.content = n || x.empty;
|
|
1332
1332
|
}
|
|
1333
1333
|
/**
|
|
@@ -1441,7 +1441,7 @@ class kt {
|
|
|
1441
1441
|
attributes, and marks.
|
|
1442
1442
|
*/
|
|
1443
1443
|
hasMarkup(t, e, n) {
|
|
1444
|
-
return this.type == t &&
|
|
1444
|
+
return this.type == t && Pe(this.attrs, e || t.defaultAttrs || yi) && J.sameSet(this.marks, n || J.none);
|
|
1445
1445
|
}
|
|
1446
1446
|
/**
|
|
1447
1447
|
Create a new node with the same markup as this node, containing
|
|
@@ -1484,7 +1484,7 @@ class kt {
|
|
|
1484
1484
|
[`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.
|
|
1485
1485
|
*/
|
|
1486
1486
|
replace(t, e, n) {
|
|
1487
|
-
return
|
|
1487
|
+
return hi(this.resolve(t), this.resolve(e), n);
|
|
1488
1488
|
}
|
|
1489
1489
|
/**
|
|
1490
1490
|
Find the node directly after the given position.
|
|
@@ -1599,7 +1599,7 @@ class kt {
|
|
|
1599
1599
|
if (this.type.spec.toDebugString)
|
|
1600
1600
|
return this.type.spec.toDebugString(this);
|
|
1601
1601
|
let t = this.type.name;
|
|
1602
|
-
return this.content.size && (t += "(" + this.content.toStringInner() + ")"),
|
|
1602
|
+
return this.content.size && (t += "(" + this.content.toStringInner() + ")"), Mr(this.marks, t);
|
|
1603
1603
|
}
|
|
1604
1604
|
/**
|
|
1605
1605
|
Get the content match in this node at the given index.
|
|
@@ -1651,12 +1651,12 @@ class kt {
|
|
|
1651
1651
|
*/
|
|
1652
1652
|
check() {
|
|
1653
1653
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
1654
|
-
let t =
|
|
1654
|
+
let t = J.none;
|
|
1655
1655
|
for (let e = 0; e < this.marks.length; e++) {
|
|
1656
1656
|
let n = this.marks[e];
|
|
1657
1657
|
n.type.checkAttrs(n.attrs), t = n.addToSet(t);
|
|
1658
1658
|
}
|
|
1659
|
-
if (!
|
|
1659
|
+
if (!J.sameSet(t, this.marks))
|
|
1660
1660
|
throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
|
|
1661
1661
|
this.content.forEach((e) => e.check());
|
|
1662
1662
|
}
|
|
@@ -1693,7 +1693,7 @@ class kt {
|
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
1695
1695
|
kt.prototype.text = void 0;
|
|
1696
|
-
class
|
|
1696
|
+
class Le extends kt {
|
|
1697
1697
|
/**
|
|
1698
1698
|
@internal
|
|
1699
1699
|
*/
|
|
@@ -1703,7 +1703,7 @@ class je extends kt {
|
|
|
1703
1703
|
this.text = n;
|
|
1704
1704
|
}
|
|
1705
1705
|
toString() {
|
|
1706
|
-
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));
|
|
1707
1707
|
}
|
|
1708
1708
|
get textContent() {
|
|
1709
1709
|
return this.text;
|
|
@@ -1715,10 +1715,10 @@ class je extends kt {
|
|
|
1715
1715
|
return this.text.length;
|
|
1716
1716
|
}
|
|
1717
1717
|
mark(t) {
|
|
1718
|
-
return t == this.marks ? this : new
|
|
1718
|
+
return t == this.marks ? this : new Le(this.type, this.attrs, this.text, t);
|
|
1719
1719
|
}
|
|
1720
1720
|
withText(t) {
|
|
1721
|
-
return t == this.text ? this : new
|
|
1721
|
+
return t == this.text ? this : new Le(this.type, this.attrs, t, this.marks);
|
|
1722
1722
|
}
|
|
1723
1723
|
cut(t = 0, e = this.text.length) {
|
|
1724
1724
|
return t == 0 && e == this.text.length ? this : this.withText(this.text.slice(t, e));
|
|
@@ -1731,7 +1731,7 @@ class je extends kt {
|
|
|
1731
1731
|
return t.text = this.text, t;
|
|
1732
1732
|
}
|
|
1733
1733
|
}
|
|
1734
|
-
function
|
|
1734
|
+
function Mr(r, t) {
|
|
1735
1735
|
for (let e = r.length - 1; e >= 0; e--)
|
|
1736
1736
|
t = r[e].type.name + "(" + t + ")";
|
|
1737
1737
|
return t;
|
|
@@ -1747,13 +1747,13 @@ class Vt {
|
|
|
1747
1747
|
@internal
|
|
1748
1748
|
*/
|
|
1749
1749
|
static parse(t, e) {
|
|
1750
|
-
let n = new
|
|
1750
|
+
let n = new wi(t, e);
|
|
1751
1751
|
if (n.next == null)
|
|
1752
1752
|
return Vt.empty;
|
|
1753
|
-
let o =
|
|
1753
|
+
let o = Er(n);
|
|
1754
1754
|
n.next && n.err("Unexpected trailing text");
|
|
1755
|
-
let i =
|
|
1756
|
-
return
|
|
1755
|
+
let i = Ti(Ci(o));
|
|
1756
|
+
return Ai(i, n), i;
|
|
1757
1757
|
}
|
|
1758
1758
|
/**
|
|
1759
1759
|
Match a node type, returning a match after that node if
|
|
@@ -1899,7 +1899,7 @@ class Vt {
|
|
|
1899
1899
|
}
|
|
1900
1900
|
}
|
|
1901
1901
|
Vt.empty = new Vt(!0);
|
|
1902
|
-
class
|
|
1902
|
+
class wi {
|
|
1903
1903
|
constructor(t, e) {
|
|
1904
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();
|
|
1905
1905
|
}
|
|
@@ -1913,22 +1913,22 @@ class ki {
|
|
|
1913
1913
|
throw new SyntaxError(t + " (in content expression '" + this.string + "')");
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
|
-
function
|
|
1916
|
+
function Er(r) {
|
|
1917
1917
|
let t = [];
|
|
1918
1918
|
do
|
|
1919
|
-
t.push(
|
|
1919
|
+
t.push(xi(r));
|
|
1920
1920
|
while (r.eat("|"));
|
|
1921
1921
|
return t.length == 1 ? t[0] : { type: "choice", exprs: t };
|
|
1922
1922
|
}
|
|
1923
|
-
function
|
|
1923
|
+
function xi(r) {
|
|
1924
1924
|
let t = [];
|
|
1925
1925
|
do
|
|
1926
|
-
t.push(
|
|
1926
|
+
t.push(ki(r));
|
|
1927
1927
|
while (r.next && r.next != ")" && r.next != "|");
|
|
1928
1928
|
return t.length == 1 ? t[0] : { type: "seq", exprs: t };
|
|
1929
1929
|
}
|
|
1930
|
-
function
|
|
1931
|
-
let t =
|
|
1930
|
+
function ki(r) {
|
|
1931
|
+
let t = Si(r);
|
|
1932
1932
|
for (; ; )
|
|
1933
1933
|
if (r.eat("+"))
|
|
1934
1934
|
t = { type: "plus", expr: t };
|
|
@@ -1937,21 +1937,21 @@ function vi(r) {
|
|
|
1937
1937
|
else if (r.eat("?"))
|
|
1938
1938
|
t = { type: "opt", expr: t };
|
|
1939
1939
|
else if (r.eat("{"))
|
|
1940
|
-
t =
|
|
1940
|
+
t = bi(r, t);
|
|
1941
1941
|
else
|
|
1942
1942
|
break;
|
|
1943
1943
|
return t;
|
|
1944
1944
|
}
|
|
1945
|
-
function
|
|
1945
|
+
function jn(r) {
|
|
1946
1946
|
/\D/.test(r.next) && r.err("Expected number, got '" + r.next + "'");
|
|
1947
1947
|
let t = Number(r.next);
|
|
1948
1948
|
return r.pos++, t;
|
|
1949
1949
|
}
|
|
1950
|
-
function
|
|
1951
|
-
let e =
|
|
1952
|
-
return r.eat(",") && (r.next != "}" ? n =
|
|
1950
|
+
function bi(r, t) {
|
|
1951
|
+
let e = jn(r), n = e;
|
|
1952
|
+
return r.eat(",") && (r.next != "}" ? n = jn(r) : n = -1), r.eat("}") || r.err("Unclosed braced range"), { type: "range", min: e, max: n, expr: t };
|
|
1953
1953
|
}
|
|
1954
|
-
function
|
|
1954
|
+
function vi(r, t) {
|
|
1955
1955
|
let e = r.nodeTypes, n = e[t];
|
|
1956
1956
|
if (n)
|
|
1957
1957
|
return [n];
|
|
@@ -1962,18 +1962,18 @@ function Ci(r, t) {
|
|
|
1962
1962
|
}
|
|
1963
1963
|
return o.length == 0 && r.err("No node type or group '" + t + "' found"), o;
|
|
1964
1964
|
}
|
|
1965
|
-
function
|
|
1965
|
+
function Si(r) {
|
|
1966
1966
|
if (r.eat("(")) {
|
|
1967
|
-
let t =
|
|
1967
|
+
let t = Er(r);
|
|
1968
1968
|
return r.eat(")") || r.err("Missing closing paren"), t;
|
|
1969
1969
|
} else if (/\W/.test(r.next))
|
|
1970
1970
|
r.err("Unexpected token '" + r.next + "'");
|
|
1971
1971
|
else {
|
|
1972
|
-
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 }));
|
|
1973
1973
|
return r.pos++, t.length == 1 ? t[0] : { type: "choice", exprs: t };
|
|
1974
1974
|
}
|
|
1975
1975
|
}
|
|
1976
|
-
function
|
|
1976
|
+
function Ci(r) {
|
|
1977
1977
|
let t = [[]];
|
|
1978
1978
|
return o(i(r, 0), e()), t;
|
|
1979
1979
|
function e() {
|
|
@@ -2027,12 +2027,12 @@ function Ai(r) {
|
|
|
2027
2027
|
}
|
|
2028
2028
|
}
|
|
2029
2029
|
}
|
|
2030
|
-
function
|
|
2030
|
+
function Nr(r, t) {
|
|
2031
2031
|
return t - r;
|
|
2032
2032
|
}
|
|
2033
|
-
function
|
|
2033
|
+
function Vn(r, t) {
|
|
2034
2034
|
let e = [];
|
|
2035
|
-
return n(t), e.sort(
|
|
2035
|
+
return n(t), e.sort(Nr);
|
|
2036
2036
|
function n(o) {
|
|
2037
2037
|
let i = r[o];
|
|
2038
2038
|
if (i.length == 1 && !i[0].term)
|
|
@@ -2044,9 +2044,9 @@ function Un(r, t) {
|
|
|
2044
2044
|
}
|
|
2045
2045
|
}
|
|
2046
2046
|
}
|
|
2047
|
-
function
|
|
2047
|
+
function Ti(r) {
|
|
2048
2048
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2049
|
-
return e(
|
|
2049
|
+
return e(Vn(r, 0));
|
|
2050
2050
|
function e(n) {
|
|
2051
2051
|
let o = [];
|
|
2052
2052
|
n.forEach((s) => {
|
|
@@ -2056,20 +2056,20 @@ function Mi(r) {
|
|
|
2056
2056
|
let c;
|
|
2057
2057
|
for (let u = 0; u < o.length; u++)
|
|
2058
2058
|
o[u][0] == l && (c = o[u][1]);
|
|
2059
|
-
|
|
2059
|
+
Vn(r, a).forEach((u) => {
|
|
2060
2060
|
c || o.push([l, c = []]), c.indexOf(u) == -1 && c.push(u);
|
|
2061
2061
|
});
|
|
2062
2062
|
});
|
|
2063
2063
|
});
|
|
2064
2064
|
let i = t[n.join(",")] = new Vt(n.indexOf(r.length - 1) > -1);
|
|
2065
2065
|
for (let s = 0; s < o.length; s++) {
|
|
2066
|
-
let l = o[s][1].sort(
|
|
2066
|
+
let l = o[s][1].sort(Nr);
|
|
2067
2067
|
i.next.push({ type: o[s][0], next: t[l.join(",")] || e(l) });
|
|
2068
2068
|
}
|
|
2069
2069
|
return i;
|
|
2070
2070
|
}
|
|
2071
2071
|
}
|
|
2072
|
-
function
|
|
2072
|
+
function Ai(r, t) {
|
|
2073
2073
|
for (let e = 0, n = [r]; e < n.length; e++) {
|
|
2074
2074
|
let o = n[e], i = !o.validEnd, s = [];
|
|
2075
2075
|
for (let l = 0; l < o.next.length; l++) {
|
|
@@ -2079,7 +2079,7 @@ function Ei(r, t) {
|
|
|
2079
2079
|
i && t.err("Only non-generatable nodes (" + s.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
2080
2080
|
}
|
|
2081
2081
|
}
|
|
2082
|
-
function
|
|
2082
|
+
function Ir(r) {
|
|
2083
2083
|
let t = /* @__PURE__ */ Object.create(null);
|
|
2084
2084
|
for (let e in r) {
|
|
2085
2085
|
let n = r[e];
|
|
@@ -2089,7 +2089,7 @@ function $r(r) {
|
|
|
2089
2089
|
}
|
|
2090
2090
|
return t;
|
|
2091
2091
|
}
|
|
2092
|
-
function
|
|
2092
|
+
function Or(r, t) {
|
|
2093
2093
|
let e = /* @__PURE__ */ Object.create(null);
|
|
2094
2094
|
for (let n in r) {
|
|
2095
2095
|
let o = t && t[n];
|
|
@@ -2104,7 +2104,7 @@ function Br(r, t) {
|
|
|
2104
2104
|
}
|
|
2105
2105
|
return e;
|
|
2106
2106
|
}
|
|
2107
|
-
function
|
|
2107
|
+
function $r(r, t, e, n) {
|
|
2108
2108
|
for (let o in t)
|
|
2109
2109
|
if (!(o in r))
|
|
2110
2110
|
throw new RangeError(`Unsupported attribute ${o} for ${e} of type ${o}`);
|
|
@@ -2113,19 +2113,19 @@ function Rr(r, t, e, n) {
|
|
|
2113
2113
|
i.validate && i.validate(t[o]);
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function Br(r, t) {
|
|
2117
2117
|
let e = /* @__PURE__ */ Object.create(null);
|
|
2118
2118
|
if (t)
|
|
2119
2119
|
for (let n in t)
|
|
2120
|
-
e[n] = new
|
|
2120
|
+
e[n] = new Ei(r, n, t[n]);
|
|
2121
2121
|
return e;
|
|
2122
2122
|
}
|
|
2123
|
-
class
|
|
2123
|
+
class Je {
|
|
2124
2124
|
/**
|
|
2125
2125
|
@internal
|
|
2126
2126
|
*/
|
|
2127
2127
|
constructor(t, e, n) {
|
|
2128
|
-
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";
|
|
2129
2129
|
}
|
|
2130
2130
|
/**
|
|
2131
2131
|
True if this is an inline type.
|
|
@@ -2186,7 +2186,7 @@ class Ve {
|
|
|
2186
2186
|
@internal
|
|
2187
2187
|
*/
|
|
2188
2188
|
computeAttrs(t) {
|
|
2189
|
-
return !t && this.defaultAttrs ? this.defaultAttrs :
|
|
2189
|
+
return !t && this.defaultAttrs ? this.defaultAttrs : Or(this.attrs, t);
|
|
2190
2190
|
}
|
|
2191
2191
|
/**
|
|
2192
2192
|
Create a `Node` of this type. The given attributes are
|
|
@@ -2199,7 +2199,7 @@ class Ve {
|
|
|
2199
2199
|
create(t = null, e, n) {
|
|
2200
2200
|
if (this.isText)
|
|
2201
2201
|
throw new Error("NodeType.create can't construct text nodes");
|
|
2202
|
-
return new kt(this, this.computeAttrs(t), x.from(e),
|
|
2202
|
+
return new kt(this, this.computeAttrs(t), x.from(e), J.setFrom(n));
|
|
2203
2203
|
}
|
|
2204
2204
|
/**
|
|
2205
2205
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
|
|
@@ -2207,7 +2207,7 @@ class Ve {
|
|
|
2207
2207
|
if it doesn't match.
|
|
2208
2208
|
*/
|
|
2209
2209
|
createChecked(t = null, e, n) {
|
|
2210
|
-
return e = x.from(e), this.checkContent(e), new kt(this, this.computeAttrs(t), e,
|
|
2210
|
+
return e = x.from(e), this.checkContent(e), new kt(this, this.computeAttrs(t), e, J.setFrom(n));
|
|
2211
2211
|
}
|
|
2212
2212
|
/**
|
|
2213
2213
|
Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
|
|
@@ -2225,7 +2225,7 @@ class Ve {
|
|
|
2225
2225
|
e = s.append(e);
|
|
2226
2226
|
}
|
|
2227
2227
|
let o = this.contentMatch.matchFragment(e), i = o && o.fillBefore(x.empty, !0);
|
|
2228
|
-
return i ? new kt(this, t, e.append(i),
|
|
2228
|
+
return i ? new kt(this, t, e.append(i), J.setFrom(n)) : null;
|
|
2229
2229
|
}
|
|
2230
2230
|
/**
|
|
2231
2231
|
Returns true if the given fragment is valid content for this node
|
|
@@ -2253,7 +2253,7 @@ class Ve {
|
|
|
2253
2253
|
@internal
|
|
2254
2254
|
*/
|
|
2255
2255
|
checkAttrs(t) {
|
|
2256
|
-
|
|
2256
|
+
$r(this.attrs, t, "node", this.name);
|
|
2257
2257
|
}
|
|
2258
2258
|
/**
|
|
2259
2259
|
Check whether the given mark type is allowed in this node.
|
|
@@ -2281,14 +2281,14 @@ class Ve {
|
|
|
2281
2281
|
let e;
|
|
2282
2282
|
for (let n = 0; n < t.length; n++)
|
|
2283
2283
|
this.allowsMarkType(t[n].type) ? e && e.push(t[n]) : e || (e = t.slice(0, n));
|
|
2284
|
-
return e ? e.length ? e :
|
|
2284
|
+
return e ? e.length ? e : J.none : t;
|
|
2285
2285
|
}
|
|
2286
2286
|
/**
|
|
2287
2287
|
@internal
|
|
2288
2288
|
*/
|
|
2289
2289
|
static compile(t, e) {
|
|
2290
2290
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2291
|
-
t.forEach((i, s) => n[i] = new
|
|
2291
|
+
t.forEach((i, s) => n[i] = new Je(i, e, s));
|
|
2292
2292
|
let o = e.spec.topNode || "doc";
|
|
2293
2293
|
if (!n[o])
|
|
2294
2294
|
throw new RangeError("Schema is missing its top node type ('" + o + "')");
|
|
@@ -2299,7 +2299,7 @@ class Ve {
|
|
|
2299
2299
|
return n;
|
|
2300
2300
|
}
|
|
2301
2301
|
}
|
|
2302
|
-
function
|
|
2302
|
+
function Mi(r, t, e) {
|
|
2303
2303
|
let n = e.split("|");
|
|
2304
2304
|
return (o) => {
|
|
2305
2305
|
let i = o === null ? "null" : typeof o;
|
|
@@ -2307,22 +2307,22 @@ function Ni(r, t, e) {
|
|
|
2307
2307
|
throw new RangeError(`Expected value of type ${n} for attribute ${t} on type ${r}, got ${i}`);
|
|
2308
2308
|
};
|
|
2309
2309
|
}
|
|
2310
|
-
class
|
|
2310
|
+
class Ei {
|
|
2311
2311
|
constructor(t, e, n) {
|
|
2312
|
-
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;
|
|
2313
2313
|
}
|
|
2314
2314
|
get isRequired() {
|
|
2315
2315
|
return !this.hasDefault;
|
|
2316
2316
|
}
|
|
2317
2317
|
}
|
|
2318
|
-
class
|
|
2318
|
+
class kn {
|
|
2319
2319
|
/**
|
|
2320
2320
|
@internal
|
|
2321
2321
|
*/
|
|
2322
2322
|
constructor(t, e, n, o) {
|
|
2323
|
-
this.name = t, this.rank = e, this.schema = n, this.spec = o, this.attrs =
|
|
2324
|
-
let i =
|
|
2325
|
-
this.instance = i ? new
|
|
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);
|
|
2325
|
+
this.instance = i ? new J(this, i) : null;
|
|
2326
2326
|
}
|
|
2327
2327
|
/**
|
|
2328
2328
|
Create a mark of this type. `attrs` may be `null` or an object
|
|
@@ -2330,14 +2330,14 @@ class Sn {
|
|
|
2330
2330
|
they have defaults, will be added.
|
|
2331
2331
|
*/
|
|
2332
2332
|
create(t = null) {
|
|
2333
|
-
return !t && this.instance ? this.instance : new
|
|
2333
|
+
return !t && this.instance ? this.instance : new J(this, Or(this.attrs, t));
|
|
2334
2334
|
}
|
|
2335
2335
|
/**
|
|
2336
2336
|
@internal
|
|
2337
2337
|
*/
|
|
2338
2338
|
static compile(t, e) {
|
|
2339
2339
|
let n = /* @__PURE__ */ Object.create(null), o = 0;
|
|
2340
|
-
return t.forEach((i, s) => n[i] = new
|
|
2340
|
+
return t.forEach((i, s) => n[i] = new kn(i, o++, e, s)), n;
|
|
2341
2341
|
}
|
|
2342
2342
|
/**
|
|
2343
2343
|
When there is a mark of this type in the given set, a new set
|
|
@@ -2360,7 +2360,7 @@ class Sn {
|
|
|
2360
2360
|
@internal
|
|
2361
2361
|
*/
|
|
2362
2362
|
checkAttrs(t) {
|
|
2363
|
-
|
|
2363
|
+
$r(this.attrs, t, "mark", this.name);
|
|
2364
2364
|
}
|
|
2365
2365
|
/**
|
|
2366
2366
|
Queries whether a given mark type is
|
|
@@ -2370,7 +2370,7 @@ class Sn {
|
|
|
2370
2370
|
return this.excluded.indexOf(t) > -1;
|
|
2371
2371
|
}
|
|
2372
2372
|
}
|
|
2373
|
-
class
|
|
2373
|
+
class Ni {
|
|
2374
2374
|
/**
|
|
2375
2375
|
Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).
|
|
2376
2376
|
*/
|
|
@@ -2379,7 +2379,7 @@ class Oi {
|
|
|
2379
2379
|
let e = this.spec = {};
|
|
2380
2380
|
for (let o in t)
|
|
2381
2381
|
e[o] = t[o];
|
|
2382
|
-
e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes =
|
|
2382
|
+
e.nodes = X.from(t.nodes), e.marks = X.from(t.marks || {}), this.nodes = Je.compile(this.spec.nodes, this), this.marks = kn.compile(this.spec.marks, this);
|
|
2383
2383
|
let n = /* @__PURE__ */ Object.create(null);
|
|
2384
2384
|
for (let o in this.nodes) {
|
|
2385
2385
|
if (o in this.marks)
|
|
@@ -2392,13 +2392,13 @@ class Oi {
|
|
|
2392
2392
|
throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
2393
2393
|
this.linebreakReplacement = i;
|
|
2394
2394
|
}
|
|
2395
|
-
i.markSet = l == "_" ? null : l ?
|
|
2395
|
+
i.markSet = l == "_" ? null : l ? qn(this, l.split(" ")) : l == "" || !i.inlineContent ? [] : null;
|
|
2396
2396
|
}
|
|
2397
2397
|
for (let o in this.marks) {
|
|
2398
2398
|
let i = this.marks[o], s = i.spec.excludes;
|
|
2399
|
-
i.excluded = s == null ? [i] : s == "" ? [] :
|
|
2399
|
+
i.excluded = s == null ? [i] : s == "" ? [] : qn(this, s.split(" "));
|
|
2400
2400
|
}
|
|
2401
|
-
this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) =>
|
|
2401
|
+
this.nodeFromJSON = (o) => kt.fromJSON(this, o), this.markFromJSON = (o) => J.fromJSON(this, o), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = /* @__PURE__ */ Object.create(null);
|
|
2402
2402
|
}
|
|
2403
2403
|
/**
|
|
2404
2404
|
Create a node in this schema. The `type` may be a string or a
|
|
@@ -2409,7 +2409,7 @@ class Oi {
|
|
|
2409
2409
|
node(t, e = null, n, o) {
|
|
2410
2410
|
if (typeof t == "string")
|
|
2411
2411
|
t = this.nodeType(t);
|
|
2412
|
-
else if (t instanceof
|
|
2412
|
+
else if (t instanceof Je) {
|
|
2413
2413
|
if (t.schema != this)
|
|
2414
2414
|
throw new RangeError("Node type from different schema used (" + t.name + ")");
|
|
2415
2415
|
} else throw new RangeError("Invalid node type: " + t);
|
|
@@ -2421,7 +2421,7 @@ class Oi {
|
|
|
2421
2421
|
*/
|
|
2422
2422
|
text(t, e) {
|
|
2423
2423
|
let n = this.nodes.text;
|
|
2424
|
-
return new
|
|
2424
|
+
return new Le(n, n.defaultAttrs, t, J.setFrom(e));
|
|
2425
2425
|
}
|
|
2426
2426
|
/**
|
|
2427
2427
|
Create a mark with the given type and attributes.
|
|
@@ -2439,7 +2439,7 @@ class Oi {
|
|
|
2439
2439
|
return e;
|
|
2440
2440
|
}
|
|
2441
2441
|
}
|
|
2442
|
-
function
|
|
2442
|
+
function qn(r, t) {
|
|
2443
2443
|
let e = [];
|
|
2444
2444
|
for (let n = 0; n < t.length; n++) {
|
|
2445
2445
|
let o = t[n], i = r.marks[o], s = i;
|
|
@@ -2455,13 +2455,13 @@ function Gn(r, t) {
|
|
|
2455
2455
|
}
|
|
2456
2456
|
return e;
|
|
2457
2457
|
}
|
|
2458
|
-
function
|
|
2458
|
+
function Ii(r) {
|
|
2459
2459
|
return r.tag != null;
|
|
2460
2460
|
}
|
|
2461
|
-
function
|
|
2461
|
+
function Oi(r) {
|
|
2462
2462
|
return r.style != null;
|
|
2463
2463
|
}
|
|
2464
|
-
let
|
|
2464
|
+
let rn = class gn {
|
|
2465
2465
|
/**
|
|
2466
2466
|
Create a parser that targets the given schema, using the given
|
|
2467
2467
|
parsing rules.
|
|
@@ -2470,9 +2470,9 @@ let ln = class xn {
|
|
|
2470
2470
|
this.schema = t, this.rules = e, this.tags = [], this.styles = [];
|
|
2471
2471
|
let n = this.matchedStyles = [];
|
|
2472
2472
|
e.forEach((o) => {
|
|
2473
|
-
if (
|
|
2473
|
+
if (Ii(o))
|
|
2474
2474
|
this.tags.push(o);
|
|
2475
|
-
else if (
|
|
2475
|
+
else if (Oi(o)) {
|
|
2476
2476
|
let i = /[^=]*/.exec(o.style)[0];
|
|
2477
2477
|
n.indexOf(i) < 0 && n.push(i), this.styles.push(o);
|
|
2478
2478
|
}
|
|
@@ -2487,8 +2487,8 @@ let ln = class xn {
|
|
|
2487
2487
|
Parse a document from the content of a DOM node.
|
|
2488
2488
|
*/
|
|
2489
2489
|
parse(t, e = {}) {
|
|
2490
|
-
let n = new
|
|
2491
|
-
return n.addAll(t,
|
|
2490
|
+
let n = new Un(this, e, !1);
|
|
2491
|
+
return n.addAll(t, J.none, e.from, e.to), n.finish();
|
|
2492
2492
|
}
|
|
2493
2493
|
/**
|
|
2494
2494
|
Parses the content of the given DOM node, like
|
|
@@ -2499,8 +2499,8 @@ let ln = class xn {
|
|
|
2499
2499
|
the left of the input and the end of nodes at the end.
|
|
2500
2500
|
*/
|
|
2501
2501
|
parseSlice(t, e = {}) {
|
|
2502
|
-
let n = new
|
|
2503
|
-
return n.addAll(t,
|
|
2502
|
+
let n = new Un(this, e, !0);
|
|
2503
|
+
return n.addAll(t, J.none, e.from, e.to), S.maxOpen(n.finish());
|
|
2504
2504
|
}
|
|
2505
2505
|
/**
|
|
2506
2506
|
@internal
|
|
@@ -2508,7 +2508,7 @@ let ln = class xn {
|
|
|
2508
2508
|
matchTag(t, e, n) {
|
|
2509
2509
|
for (let o = n ? this.tags.indexOf(n) + 1 : 0; o < this.tags.length; o++) {
|
|
2510
2510
|
let i = this.tags[o];
|
|
2511
|
-
if (
|
|
2511
|
+
if (Ri(t, i.tag) && (i.namespace === void 0 || t.namespaceURI == i.namespace) && (!i.context || e.matchesContext(i.context))) {
|
|
2512
2512
|
if (i.getAttrs) {
|
|
2513
2513
|
let s = i.getAttrs(t);
|
|
2514
2514
|
if (s === !1)
|
|
@@ -2556,13 +2556,13 @@ let ln = class xn {
|
|
|
2556
2556
|
for (let o in t.marks) {
|
|
2557
2557
|
let i = t.marks[o].spec.parseDOM;
|
|
2558
2558
|
i && i.forEach((s) => {
|
|
2559
|
-
n(s =
|
|
2559
|
+
n(s = Gn(s)), s.mark || s.ignore || s.clearMark || (s.mark = o);
|
|
2560
2560
|
});
|
|
2561
2561
|
}
|
|
2562
2562
|
for (let o in t.nodes) {
|
|
2563
2563
|
let i = t.nodes[o].spec.parseDOM;
|
|
2564
2564
|
i && i.forEach((s) => {
|
|
2565
|
-
n(s =
|
|
2565
|
+
n(s = Gn(s)), s.node || s.ignore || s.mark || (s.node = o);
|
|
2566
2566
|
});
|
|
2567
2567
|
}
|
|
2568
2568
|
return e;
|
|
@@ -2573,10 +2573,10 @@ let ln = class xn {
|
|
|
2573
2573
|
[priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
|
|
2574
2574
|
*/
|
|
2575
2575
|
static fromSchema(t) {
|
|
2576
|
-
return t.cached.domParser || (t.cached.domParser = new
|
|
2576
|
+
return t.cached.domParser || (t.cached.domParser = new gn(t, gn.schemaRules(t)));
|
|
2577
2577
|
}
|
|
2578
2578
|
};
|
|
2579
|
-
const
|
|
2579
|
+
const Rr = {
|
|
2580
2580
|
address: !0,
|
|
2581
2581
|
article: !0,
|
|
2582
2582
|
aside: !0,
|
|
@@ -2609,20 +2609,20 @@ const Pr = {
|
|
|
2609
2609
|
table: !0,
|
|
2610
2610
|
tfoot: !0,
|
|
2611
2611
|
ul: !0
|
|
2612
|
-
},
|
|
2612
|
+
}, $i = {
|
|
2613
2613
|
head: !0,
|
|
2614
2614
|
noscript: !0,
|
|
2615
2615
|
object: !0,
|
|
2616
2616
|
script: !0,
|
|
2617
2617
|
style: !0,
|
|
2618
2618
|
title: !0
|
|
2619
|
-
},
|
|
2620
|
-
function
|
|
2621
|
-
return t != null ? (t ? de : 0) | (t === "full" ?
|
|
2619
|
+
}, zr = { ol: !0, ul: !0 }, de = 1, yn = 2, ce = 4;
|
|
2620
|
+
function Hn(r, t, e) {
|
|
2621
|
+
return t != null ? (t ? de : 0) | (t === "full" ? yn : 0) : r && r.whitespace == "pre" ? de | yn : e & ~ce;
|
|
2622
2622
|
}
|
|
2623
2623
|
class Ce {
|
|
2624
2624
|
constructor(t, e, n, o, i, s) {
|
|
2625
|
-
this.type = t, this.attrs = e, this.marks = n, this.solid = o, this.options = s, this.content = [], this.activeMarks =
|
|
2625
|
+
this.type = t, this.attrs = e, this.marks = n, this.solid = o, this.options = s, this.content = [], this.activeMarks = J.none, this.match = i || (s & ce ? null : t.contentMatch);
|
|
2626
2626
|
}
|
|
2627
2627
|
findWrapping(t) {
|
|
2628
2628
|
if (!this.match) {
|
|
@@ -2650,14 +2650,14 @@ class Ce {
|
|
|
2650
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;
|
|
2651
2651
|
}
|
|
2652
2652
|
inlineContext(t) {
|
|
2653
|
-
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());
|
|
2654
2654
|
}
|
|
2655
2655
|
}
|
|
2656
|
-
class
|
|
2656
|
+
class Un {
|
|
2657
2657
|
constructor(t, e, n) {
|
|
2658
2658
|
this.parser = t, this.options = e, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
2659
|
-
let o = e.topNode, i, s =
|
|
2660
|
-
o ? i = new Ce(o.type, o.attrs,
|
|
2659
|
+
let o = e.topNode, i, s = Hn(null, e.preserveWhitespace, 0) | (n ? ce : 0);
|
|
2660
|
+
o ? i = new Ce(o.type, o.attrs, J.none, !0, e.topMatch || o.type.contentMatch, s) : n ? i = new Ce(null, null, J.none, !0, null, s) : i = new Ce(t.schema.topNodeType, null, J.none, !0, null, s), this.nodes = [i], this.find = e.findPositions, this.needsBlock = !1;
|
|
2661
2661
|
}
|
|
2662
2662
|
get top() {
|
|
2663
2663
|
return this.nodes[this.open];
|
|
@@ -2669,7 +2669,7 @@ class Xn {
|
|
|
2669
2669
|
t.nodeType == 3 ? this.addTextNode(t, e) : t.nodeType == 1 && this.addElement(t, e);
|
|
2670
2670
|
}
|
|
2671
2671
|
addTextNode(t, e) {
|
|
2672
|
-
let n = t.nodeValue, o = this.top, i = o.options &
|
|
2672
|
+
let n = t.nodeValue, o = this.top, i = o.options & yn ? "full" : this.localPreserveWS || (o.options & de) > 0, { schema: s } = this.parser;
|
|
2673
2673
|
if (i === "full" || o.inlineContext(t) || /[^ \t\r\n\u000c]/.test(n)) {
|
|
2674
2674
|
if (i)
|
|
2675
2675
|
if (i === "full")
|
|
@@ -2696,14 +2696,14 @@ class Xn {
|
|
|
2696
2696
|
let o = this.localPreserveWS, i = this.top;
|
|
2697
2697
|
(t.tagName == "PRE" || /pre/.test(t.style && t.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
2698
2698
|
let s = t.nodeName.toLowerCase(), l;
|
|
2699
|
-
|
|
2699
|
+
zr.hasOwnProperty(s) && this.parser.normalizeLists && Bi(t);
|
|
2700
2700
|
let a = this.options.ruleFromNode && this.options.ruleFromNode(t) || (l = this.parser.matchTag(t, this, n));
|
|
2701
|
-
t: if (a ? a.ignore :
|
|
2701
|
+
t: if (a ? a.ignore : $i.hasOwnProperty(s))
|
|
2702
2702
|
this.findInside(t), this.ignoreFallback(t, e);
|
|
2703
2703
|
else if (!a || a.skip || a.closeParent) {
|
|
2704
2704
|
a && a.closeParent ? this.open = Math.max(0, this.open - 1) : a && a.skip.nodeType && (t = a.skip);
|
|
2705
2705
|
let c, u = this.needsBlock;
|
|
2706
|
-
if (
|
|
2706
|
+
if (Rr.hasOwnProperty(s))
|
|
2707
2707
|
i.content.length && i.content[0].isInline && this.open && (this.open--, i = this.top), c = !0, i.type || (this.needsBlock = !0);
|
|
2708
2708
|
else if (!t.firstChild) {
|
|
2709
2709
|
this.leafFallback(t, e);
|
|
@@ -2820,9 +2820,9 @@ class Xn {
|
|
|
2820
2820
|
this.closeExtra();
|
|
2821
2821
|
let i = this.top;
|
|
2822
2822
|
i.match && (i.match = i.match.matchType(t.type));
|
|
2823
|
-
let s =
|
|
2823
|
+
let s = J.none;
|
|
2824
2824
|
for (let l of o.concat(t.marks))
|
|
2825
|
-
(i.type ? i.type.allowsMarkType(l.type) :
|
|
2825
|
+
(i.type ? i.type.allowsMarkType(l.type) : Kn(l.type, t.type)) && (s = l.addToSet(s));
|
|
2826
2826
|
return i.content.push(t.mark(s)), !0;
|
|
2827
2827
|
}
|
|
2828
2828
|
return !1;
|
|
@@ -2838,10 +2838,10 @@ class Xn {
|
|
|
2838
2838
|
this.closeExtra();
|
|
2839
2839
|
let s = this.top;
|
|
2840
2840
|
s.match = s.match && s.match.matchType(t);
|
|
2841
|
-
let l =
|
|
2841
|
+
let l = Hn(t, i, s.options);
|
|
2842
2842
|
s.options & ce && s.content.length == 0 && (l |= ce);
|
|
2843
|
-
let a =
|
|
2844
|
-
return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) :
|
|
2843
|
+
let a = J.none;
|
|
2844
|
+
return n = n.filter((c) => (s.type ? s.type.allowsMarkType(c.type) : Kn(c.type, t)) ? (a = c.addToSet(a), !1) : !0), this.nodes.push(new Ce(t, e, a, o, null, l)), this.open++, n;
|
|
2845
2845
|
}
|
|
2846
2846
|
// Make sure all nodes above this.open are finished and added to
|
|
2847
2847
|
// their parents
|
|
@@ -2935,22 +2935,22 @@ class Xn {
|
|
|
2935
2935
|
}
|
|
2936
2936
|
}
|
|
2937
2937
|
}
|
|
2938
|
-
function
|
|
2938
|
+
function Bi(r) {
|
|
2939
2939
|
for (let t = r.firstChild, e = null; t; t = t.nextSibling) {
|
|
2940
2940
|
let n = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
|
|
2941
|
-
n &&
|
|
2941
|
+
n && zr.hasOwnProperty(n) && e ? (e.appendChild(t), t = e) : n == "li" ? e = t : n && (e = null);
|
|
2942
2942
|
}
|
|
2943
2943
|
}
|
|
2944
|
-
function
|
|
2944
|
+
function Ri(r, t) {
|
|
2945
2945
|
return (r.matches || r.msMatchesSelector || r.webkitMatchesSelector || r.mozMatchesSelector).call(r, t);
|
|
2946
2946
|
}
|
|
2947
|
-
function
|
|
2947
|
+
function Gn(r) {
|
|
2948
2948
|
let t = {};
|
|
2949
2949
|
for (let e in r)
|
|
2950
2950
|
t[e] = r[e];
|
|
2951
2951
|
return t;
|
|
2952
2952
|
}
|
|
2953
|
-
function
|
|
2953
|
+
function Kn(r, t) {
|
|
2954
2954
|
let e = t.schema.nodes;
|
|
2955
2955
|
for (let n in e) {
|
|
2956
2956
|
let o = e[n];
|
|
@@ -2968,18 +2968,18 @@ function Qn(r, t) {
|
|
|
2968
2968
|
return !0;
|
|
2969
2969
|
}
|
|
2970
2970
|
}
|
|
2971
|
-
const
|
|
2972
|
-
function
|
|
2973
|
-
return r + t *
|
|
2971
|
+
const Pr = 65535, Fr = Math.pow(2, 16);
|
|
2972
|
+
function zi(r, t) {
|
|
2973
|
+
return r + t * Fr;
|
|
2974
2974
|
}
|
|
2975
|
-
function
|
|
2976
|
-
return r &
|
|
2975
|
+
function Xn(r) {
|
|
2976
|
+
return r & Pr;
|
|
2977
2977
|
}
|
|
2978
|
-
function
|
|
2979
|
-
return (r - (r &
|
|
2978
|
+
function Pi(r) {
|
|
2979
|
+
return (r - (r & Pr)) / Fr;
|
|
2980
2980
|
}
|
|
2981
|
-
const
|
|
2982
|
-
class
|
|
2981
|
+
const _r = 1, Dr = 2, $e = 4, Lr = 8;
|
|
2982
|
+
class Zn {
|
|
2983
2983
|
/**
|
|
2984
2984
|
@internal
|
|
2985
2985
|
*/
|
|
@@ -2992,19 +2992,19 @@ class tr {
|
|
|
2992
2992
|
argument from the document.
|
|
2993
2993
|
*/
|
|
2994
2994
|
get deleted() {
|
|
2995
|
-
return (this.delInfo &
|
|
2995
|
+
return (this.delInfo & Lr) > 0;
|
|
2996
2996
|
}
|
|
2997
2997
|
/**
|
|
2998
2998
|
Tells you whether the token before the mapped position was deleted.
|
|
2999
2999
|
*/
|
|
3000
3000
|
get deletedBefore() {
|
|
3001
|
-
return (this.delInfo & (
|
|
3001
|
+
return (this.delInfo & (_r | $e)) > 0;
|
|
3002
3002
|
}
|
|
3003
3003
|
/**
|
|
3004
3004
|
True when the token after the mapped position was deleted.
|
|
3005
3005
|
*/
|
|
3006
3006
|
get deletedAfter() {
|
|
3007
|
-
return (this.delInfo & (
|
|
3007
|
+
return (this.delInfo & (Dr | $e)) > 0;
|
|
3008
3008
|
}
|
|
3009
3009
|
/**
|
|
3010
3010
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -3012,7 +3012,7 @@ class tr {
|
|
|
3012
3012
|
position).
|
|
3013
3013
|
*/
|
|
3014
3014
|
get deletedAcross() {
|
|
3015
|
-
return (this.delInfo &
|
|
3015
|
+
return (this.delInfo & $e) > 0;
|
|
3016
3016
|
}
|
|
3017
3017
|
}
|
|
3018
3018
|
class lt {
|
|
@@ -3029,11 +3029,11 @@ class lt {
|
|
|
3029
3029
|
@internal
|
|
3030
3030
|
*/
|
|
3031
3031
|
recover(t) {
|
|
3032
|
-
let e = 0, n =
|
|
3032
|
+
let e = 0, n = Xn(t);
|
|
3033
3033
|
if (!this.inverted)
|
|
3034
3034
|
for (let o = 0; o < n; o++)
|
|
3035
3035
|
e += this.ranges[o * 3 + 2] - this.ranges[o * 3 + 1];
|
|
3036
|
-
return this.ranges[n * 3] + e +
|
|
3036
|
+
return this.ranges[n * 3] + e + Pi(t);
|
|
3037
3037
|
}
|
|
3038
3038
|
mapResult(t, e = 1) {
|
|
3039
3039
|
return this._map(t, e, !1);
|
|
@@ -3055,18 +3055,18 @@ class lt {
|
|
|
3055
3055
|
let d = c ? t == a ? -1 : t == f ? 1 : e : e, h = a + o + (d < 0 ? 0 : u);
|
|
3056
3056
|
if (n)
|
|
3057
3057
|
return h;
|
|
3058
|
-
let m = t == (e < 0 ? a : f) ? null :
|
|
3059
|
-
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 |= Lr), new Zn(h, p, m);
|
|
3060
3060
|
}
|
|
3061
3061
|
o += u - c;
|
|
3062
3062
|
}
|
|
3063
|
-
return n ? t + o : new
|
|
3063
|
+
return n ? t + o : new Zn(t + o, 0, null);
|
|
3064
3064
|
}
|
|
3065
3065
|
/**
|
|
3066
3066
|
@internal
|
|
3067
3067
|
*/
|
|
3068
3068
|
touches(t, e) {
|
|
3069
|
-
let n = 0, o =
|
|
3069
|
+
let n = 0, o = Xn(e), i = this.inverted ? 2 : 1, s = this.inverted ? 1 : 2;
|
|
3070
3070
|
for (let l = 0; l < this.ranges.length; l += 3) {
|
|
3071
3071
|
let a = this.ranges[l] - (this.inverted ? n : 0);
|
|
3072
3072
|
if (a > t)
|
|
@@ -3112,7 +3112,7 @@ class lt {
|
|
|
3112
3112
|
}
|
|
3113
3113
|
}
|
|
3114
3114
|
lt.empty = new lt([]);
|
|
3115
|
-
const
|
|
3115
|
+
const on = /* @__PURE__ */ Object.create(null);
|
|
3116
3116
|
class nt {
|
|
3117
3117
|
/**
|
|
3118
3118
|
Get the step map that represents the changes made by this step,
|
|
@@ -3137,7 +3137,7 @@ class nt {
|
|
|
3137
3137
|
static fromJSON(t, e) {
|
|
3138
3138
|
if (!e || !e.stepType)
|
|
3139
3139
|
throw new RangeError("Invalid input for Step.fromJSON");
|
|
3140
|
-
let n =
|
|
3140
|
+
let n = on[e.stepType];
|
|
3141
3141
|
if (!n)
|
|
3142
3142
|
throw new RangeError(`No step type ${e.stepType} defined`);
|
|
3143
3143
|
return n.fromJSON(t, e);
|
|
@@ -3149,9 +3149,9 @@ class nt {
|
|
|
3149
3149
|
that's unlikely to clash with steps from other modules.
|
|
3150
3150
|
*/
|
|
3151
3151
|
static jsonID(t, e) {
|
|
3152
|
-
if (t in
|
|
3152
|
+
if (t in on)
|
|
3153
3153
|
throw new RangeError("Duplicate use of step JSON ID " + t);
|
|
3154
|
-
return
|
|
3154
|
+
return on[t] = e, e.prototype.jsonID = t, e;
|
|
3155
3155
|
}
|
|
3156
3156
|
}
|
|
3157
3157
|
class V {
|
|
@@ -3182,17 +3182,17 @@ class V {
|
|
|
3182
3182
|
try {
|
|
3183
3183
|
return V.ok(t.replace(e, n, o));
|
|
3184
3184
|
} catch (i) {
|
|
3185
|
-
if (i instanceof
|
|
3185
|
+
if (i instanceof Fe)
|
|
3186
3186
|
return V.fail(i.message);
|
|
3187
3187
|
throw i;
|
|
3188
3188
|
}
|
|
3189
3189
|
}
|
|
3190
3190
|
}
|
|
3191
|
-
function
|
|
3191
|
+
function bn(r, t, e) {
|
|
3192
3192
|
let n = [];
|
|
3193
3193
|
for (let o = 0; o < r.childCount; o++) {
|
|
3194
3194
|
let i = r.child(o);
|
|
3195
|
-
i.content.size && (i = i.copy(
|
|
3195
|
+
i.content.size && (i = i.copy(bn(i.content, t, i))), i.isInline && (i = t(i, e, o)), n.push(i);
|
|
3196
3196
|
}
|
|
3197
3197
|
return x.fromArray(n);
|
|
3198
3198
|
}
|
|
@@ -3204,7 +3204,7 @@ class _t extends nt {
|
|
|
3204
3204
|
super(), this.from = t, this.to = e, this.mark = n;
|
|
3205
3205
|
}
|
|
3206
3206
|
apply(t) {
|
|
3207
|
-
let e = t.slice(this.from, this.to), n = t.resolve(this.from), o = n.node(n.sharedDepth(this.to)), i = new S(
|
|
3207
|
+
let e = t.slice(this.from, this.to), n = t.resolve(this.from), o = n.node(n.sharedDepth(this.to)), i = new S(bn(e.content, (s, l) => !s.isAtom || !l.type.allowsMarkType(this.mark.type) ? s : s.mark(this.mark.addToSet(s.marks)), o), e.openStart, e.openEnd);
|
|
3208
3208
|
return V.fromReplace(t, this.from, this.to, i);
|
|
3209
3209
|
}
|
|
3210
3210
|
invert() {
|
|
@@ -3243,7 +3243,7 @@ class Dt extends nt {
|
|
|
3243
3243
|
super(), this.from = t, this.to = e, this.mark = n;
|
|
3244
3244
|
}
|
|
3245
3245
|
apply(t) {
|
|
3246
|
-
let e = t.slice(this.from, this.to), n = new S(
|
|
3246
|
+
let e = t.slice(this.from, this.to), n = new S(bn(e.content, (o) => o.mark(this.mark.removeFromSet(o.marks)), t), e.openStart, e.openEnd);
|
|
3247
3247
|
return V.fromReplace(t, this.from, this.to, n);
|
|
3248
3248
|
}
|
|
3249
3249
|
invert() {
|
|
@@ -3274,7 +3274,7 @@ class Dt extends nt {
|
|
|
3274
3274
|
}
|
|
3275
3275
|
}
|
|
3276
3276
|
nt.jsonID("removeMark", Dt);
|
|
3277
|
-
class
|
|
3277
|
+
class Lt extends nt {
|
|
3278
3278
|
/**
|
|
3279
3279
|
Create a node mark step.
|
|
3280
3280
|
*/
|
|
@@ -3295,15 +3295,15 @@ class Jt extends nt {
|
|
|
3295
3295
|
if (n.length == e.marks.length) {
|
|
3296
3296
|
for (let o = 0; o < e.marks.length; o++)
|
|
3297
3297
|
if (!e.marks[o].isInSet(n))
|
|
3298
|
-
return new
|
|
3299
|
-
return new
|
|
3298
|
+
return new Lt(this.pos, e.marks[o]);
|
|
3299
|
+
return new Lt(this.pos, this.mark);
|
|
3300
3300
|
}
|
|
3301
3301
|
}
|
|
3302
3302
|
return new he(this.pos, this.mark);
|
|
3303
3303
|
}
|
|
3304
3304
|
map(t) {
|
|
3305
3305
|
let e = t.mapResult(this.pos, 1);
|
|
3306
|
-
return e.deletedAfter ? null : new
|
|
3306
|
+
return e.deletedAfter ? null : new Lt(e.pos, this.mark);
|
|
3307
3307
|
}
|
|
3308
3308
|
toJSON() {
|
|
3309
3309
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -3314,10 +3314,10 @@ class Jt extends nt {
|
|
|
3314
3314
|
static fromJSON(t, e) {
|
|
3315
3315
|
if (typeof e.pos != "number")
|
|
3316
3316
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
3317
|
-
return new
|
|
3317
|
+
return new Lt(e.pos, t.markFromJSON(e.mark));
|
|
3318
3318
|
}
|
|
3319
3319
|
}
|
|
3320
|
-
nt.jsonID("addNodeMark",
|
|
3320
|
+
nt.jsonID("addNodeMark", Lt);
|
|
3321
3321
|
class he extends nt {
|
|
3322
3322
|
/**
|
|
3323
3323
|
Create a mark-removing step.
|
|
@@ -3334,7 +3334,7 @@ class he extends nt {
|
|
|
3334
3334
|
}
|
|
3335
3335
|
invert(t) {
|
|
3336
3336
|
let e = t.nodeAt(this.pos);
|
|
3337
|
-
return !e || !this.mark.isInSet(e.marks) ? this : new
|
|
3337
|
+
return !e || !this.mark.isInSet(e.marks) ? this : new Lt(this.pos, this.mark);
|
|
3338
3338
|
}
|
|
3339
3339
|
map(t) {
|
|
3340
3340
|
let e = t.mapResult(this.pos, 1);
|
|
@@ -3367,7 +3367,7 @@ class st extends nt {
|
|
|
3367
3367
|
super(), this.from = t, this.to = e, this.slice = n, this.structure = o;
|
|
3368
3368
|
}
|
|
3369
3369
|
apply(t) {
|
|
3370
|
-
return this.structure &&
|
|
3370
|
+
return this.structure && wn(t, this.from, this.to) ? V.fail("Structure replace would overwrite content") : V.fromReplace(t, this.from, this.to, this.slice);
|
|
3371
3371
|
}
|
|
3372
3372
|
getMap() {
|
|
3373
3373
|
return new lt([this.from, this.to - this.from, this.slice.size]);
|
|
@@ -3416,7 +3416,7 @@ class it extends nt {
|
|
|
3416
3416
|
super(), this.from = t, this.to = e, this.gapFrom = n, this.gapTo = o, this.slice = i, this.insert = s, this.structure = l;
|
|
3417
3417
|
}
|
|
3418
3418
|
apply(t) {
|
|
3419
|
-
if (this.structure && (
|
|
3419
|
+
if (this.structure && (wn(t, this.from, this.gapFrom) || wn(t, this.gapTo, this.to)))
|
|
3420
3420
|
return V.fail("Structure gap-replace would overwrite content");
|
|
3421
3421
|
let e = t.slice(this.gapFrom, this.gapTo);
|
|
3422
3422
|
if (e.openStart || e.openEnd)
|
|
@@ -3463,7 +3463,7 @@ class it extends nt {
|
|
|
3463
3463
|
}
|
|
3464
3464
|
}
|
|
3465
3465
|
nt.jsonID("replaceAround", it);
|
|
3466
|
-
function
|
|
3466
|
+
function wn(r, t, e) {
|
|
3467
3467
|
let n = r.resolve(t), o = e - t, i = n.depth;
|
|
3468
3468
|
for (; o > 0 && i > 0 && n.indexAfter(i) == n.node(i).childCount; )
|
|
3469
3469
|
i--, o--;
|
|
@@ -3477,7 +3477,7 @@ function bn(r, t, e) {
|
|
|
3477
3477
|
}
|
|
3478
3478
|
return !1;
|
|
3479
3479
|
}
|
|
3480
|
-
function
|
|
3480
|
+
function Fi(r, t, e) {
|
|
3481
3481
|
return (t == 0 || r.canReplace(t, r.childCount)) && (e == r.childCount || r.canReplace(0, e));
|
|
3482
3482
|
}
|
|
3483
3483
|
function Qt(r) {
|
|
@@ -3486,27 +3486,27 @@ function Qt(r) {
|
|
|
3486
3486
|
let s = r.$from.node(n), l = r.$from.index(n) + o, a = r.$to.indexAfter(n) - i;
|
|
3487
3487
|
if (n < r.depth && s.canReplace(l, a, e))
|
|
3488
3488
|
return n;
|
|
3489
|
-
if (n == 0 || s.type.spec.isolating || !
|
|
3489
|
+
if (n == 0 || s.type.spec.isolating || !Fi(s, l, a))
|
|
3490
3490
|
break;
|
|
3491
3491
|
l && (o = 1), a < s.childCount && (i = 1);
|
|
3492
3492
|
}
|
|
3493
3493
|
return null;
|
|
3494
3494
|
}
|
|
3495
|
-
function
|
|
3496
|
-
let o =
|
|
3497
|
-
return i ? o.map(
|
|
3495
|
+
function Jr(r, t, e = null, n = r) {
|
|
3496
|
+
let o = _i(r, t), i = o && Di(n, t);
|
|
3497
|
+
return i ? o.map(Qn).concat({ type: t, attrs: e }).concat(i.map(Qn)) : null;
|
|
3498
3498
|
}
|
|
3499
|
-
function
|
|
3499
|
+
function Qn(r) {
|
|
3500
3500
|
return { type: r, attrs: null };
|
|
3501
3501
|
}
|
|
3502
|
-
function
|
|
3502
|
+
function _i(r, t) {
|
|
3503
3503
|
let { parent: e, startIndex: n, endIndex: o } = r, i = e.contentMatchAt(n).findWrapping(t);
|
|
3504
3504
|
if (!i)
|
|
3505
3505
|
return null;
|
|
3506
3506
|
let s = i.length ? i[0] : t;
|
|
3507
3507
|
return e.canReplaceWith(n, o, s) ? i : null;
|
|
3508
3508
|
}
|
|
3509
|
-
function
|
|
3509
|
+
function Di(r, t) {
|
|
3510
3510
|
let { parent: e, startIndex: n, endIndex: o } = r, i = e.child(n), s = t.contentMatch.findWrapping(i.type);
|
|
3511
3511
|
if (!s)
|
|
3512
3512
|
return null;
|
|
@@ -3534,9 +3534,9 @@ function Mt(r, t, e = 1, n) {
|
|
|
3534
3534
|
}
|
|
3535
3535
|
function qt(r, t) {
|
|
3536
3536
|
let e = r.resolve(t), n = e.index();
|
|
3537
|
-
return
|
|
3537
|
+
return Wr(e.nodeBefore, e.nodeAfter) && e.parent.canReplace(n, n + 1);
|
|
3538
3538
|
}
|
|
3539
|
-
function
|
|
3539
|
+
function Li(r, t) {
|
|
3540
3540
|
t.content.size || r.type.compatibleContent(t.type);
|
|
3541
3541
|
let e = r.contentMatchAt(r.childCount), { linebreakReplacement: n } = r.type.schema;
|
|
3542
3542
|
for (let o = 0; o < t.childCount; o++) {
|
|
@@ -3546,30 +3546,30 @@ function Wi(r, t) {
|
|
|
3546
3546
|
}
|
|
3547
3547
|
return e.validEnd;
|
|
3548
3548
|
}
|
|
3549
|
-
function
|
|
3550
|
-
return !!(r && t && !r.isLeaf &&
|
|
3549
|
+
function Wr(r, t) {
|
|
3550
|
+
return !!(r && t && !r.isLeaf && Li(r, t));
|
|
3551
3551
|
}
|
|
3552
|
-
function
|
|
3552
|
+
function Ue(r, t, e = -1) {
|
|
3553
3553
|
let n = r.resolve(t);
|
|
3554
3554
|
for (let o = n.depth; ; o--) {
|
|
3555
3555
|
let i, s, l = n.index(o);
|
|
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 &&
|
|
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))
|
|
3557
3557
|
return t;
|
|
3558
3558
|
if (o == 0)
|
|
3559
3559
|
break;
|
|
3560
3560
|
t = e < 0 ? n.before(o) : n.after(o);
|
|
3561
3561
|
}
|
|
3562
3562
|
}
|
|
3563
|
-
function
|
|
3563
|
+
function vn(r, t, e = t, n = S.empty) {
|
|
3564
3564
|
if (t == e && !n.size)
|
|
3565
3565
|
return null;
|
|
3566
3566
|
let o = r.resolve(t), i = r.resolve(e);
|
|
3567
|
-
return
|
|
3567
|
+
return Ji(o, i, n) ? new st(t, e, n) : new Wi(o, i, n).fit();
|
|
3568
3568
|
}
|
|
3569
|
-
function
|
|
3569
|
+
function Ji(r, t, e) {
|
|
3570
3570
|
return !e.openStart && !e.openEnd && r.start() == t.start() && r.parent.canReplace(r.index(), t.index(), e.content);
|
|
3571
3571
|
}
|
|
3572
|
-
class
|
|
3572
|
+
class Wi {
|
|
3573
3573
|
constructor(t, e, n) {
|
|
3574
3574
|
this.$from = t, this.$to = e, this.unplaced = n, this.frontier = [], this.placed = x.empty;
|
|
3575
3575
|
for (let o = 0; o <= t.depth; o++) {
|
|
@@ -3615,7 +3615,7 @@ class Vi {
|
|
|
3615
3615
|
for (let e = 1; e <= 2; e++)
|
|
3616
3616
|
for (let n = e == 1 ? t : this.unplaced.openStart; n >= 0; n--) {
|
|
3617
3617
|
let o, i = null;
|
|
3618
|
-
n ? (i =
|
|
3618
|
+
n ? (i = sn(this.unplaced.content, n - 1).firstChild, o = i.content) : o = this.unplaced.content;
|
|
3619
3619
|
let s = o.firstChild;
|
|
3620
3620
|
for (let l = this.depth; l >= 0; l--) {
|
|
3621
3621
|
let { type: a, match: c } = this.frontier[l], u, f = null;
|
|
@@ -3629,11 +3629,11 @@ class Vi {
|
|
|
3629
3629
|
}
|
|
3630
3630
|
}
|
|
3631
3631
|
openMore() {
|
|
3632
|
-
let { content: t, openStart: e, openEnd: n } = this.unplaced, o =
|
|
3632
|
+
let { content: t, openStart: e, openEnd: n } = this.unplaced, o = sn(t, e);
|
|
3633
3633
|
return !o.childCount || o.firstChild.isLeaf ? !1 : (this.unplaced = new S(t, e + 1, Math.max(n, o.size + e >= t.size - n ? e + 1 : 0)), !0);
|
|
3634
3634
|
}
|
|
3635
3635
|
dropNode() {
|
|
3636
|
-
let { content: t, openStart: e, openEnd: n } = this.unplaced, o =
|
|
3636
|
+
let { content: t, openStart: e, openEnd: n } = this.unplaced, o = sn(t, e);
|
|
3637
3637
|
if (o.childCount <= 1 && e > 0) {
|
|
3638
3638
|
let i = t.size - e <= e + o.size;
|
|
3639
3639
|
this.unplaced = new S(ie(t, e - 1, 1), e - 1, i ? e - 1 : n);
|
|
@@ -3660,7 +3660,7 @@ class Vi {
|
|
|
3660
3660
|
let p = l.child(c), k = f.matchType(p.type);
|
|
3661
3661
|
if (!k)
|
|
3662
3662
|
break;
|
|
3663
|
-
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)));
|
|
3664
3664
|
}
|
|
3665
3665
|
let m = c == l.childCount;
|
|
3666
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();
|
|
@@ -3674,7 +3674,7 @@ class Vi {
|
|
|
3674
3674
|
if (!this.$to.parent.isTextblock)
|
|
3675
3675
|
return -1;
|
|
3676
3676
|
let t = this.frontier[this.depth], e;
|
|
3677
|
-
if (!t.type.isTextblock || !
|
|
3677
|
+
if (!t.type.isTextblock || !ln(this.$to, this.$to.depth, t.type, t.match, !1) || this.$to.depth == this.depth && (e = this.findCloseLevel(this.$to)) && e.depth == this.depth)
|
|
3678
3678
|
return -1;
|
|
3679
3679
|
let { depth: n } = this.$to, o = this.$to.after(n);
|
|
3680
3680
|
for (; n > 1 && o == this.$to.end(--n); )
|
|
@@ -3683,10 +3683,10 @@ class Vi {
|
|
|
3683
3683
|
}
|
|
3684
3684
|
findCloseLevel(t) {
|
|
3685
3685
|
t: for (let e = Math.min(this.depth, t.depth); e >= 0; e--) {
|
|
3686
|
-
let { match: n, type: o } = this.frontier[e], i = e < t.depth && t.end(e + 1) == t.pos + (t.depth - (e + 1)), s =
|
|
3686
|
+
let { match: n, type: o } = this.frontier[e], i = e < t.depth && t.end(e + 1) == t.pos + (t.depth - (e + 1)), s = ln(t, e, o, n, i);
|
|
3687
3687
|
if (s) {
|
|
3688
3688
|
for (let l = e - 1; l >= 0; l--) {
|
|
3689
|
-
let { match: a, type: c } = this.frontier[l], u =
|
|
3689
|
+
let { match: a, type: c } = this.frontier[l], u = ln(t, l, c, a, !0);
|
|
3690
3690
|
if (!u || u.childCount)
|
|
3691
3691
|
continue t;
|
|
3692
3692
|
}
|
|
@@ -3722,25 +3722,25 @@ function ie(r, t, e) {
|
|
|
3722
3722
|
function se(r, t, e) {
|
|
3723
3723
|
return t == 0 ? r.append(e) : r.replaceChild(r.childCount - 1, r.lastChild.copy(se(r.lastChild.content, t - 1, e)));
|
|
3724
3724
|
}
|
|
3725
|
-
function
|
|
3725
|
+
function sn(r, t) {
|
|
3726
3726
|
for (let e = 0; e < t; e++)
|
|
3727
3727
|
r = r.firstChild.content;
|
|
3728
3728
|
return r;
|
|
3729
3729
|
}
|
|
3730
|
-
function
|
|
3730
|
+
function jr(r, t, e) {
|
|
3731
3731
|
if (t <= 0)
|
|
3732
3732
|
return r;
|
|
3733
3733
|
let n = r.content;
|
|
3734
|
-
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);
|
|
3735
3735
|
}
|
|
3736
|
-
function
|
|
3736
|
+
function ln(r, t, e, n, o) {
|
|
3737
3737
|
let i = r.node(t), s = o ? r.indexAfter(t) : r.index(t);
|
|
3738
3738
|
if (s == i.childCount && !e.compatibleContent(i.type))
|
|
3739
3739
|
return null;
|
|
3740
3740
|
let l = n.fillBefore(i.content, !0, s);
|
|
3741
|
-
return l && !
|
|
3741
|
+
return l && !ji(e, i.content, s) ? l : null;
|
|
3742
3742
|
}
|
|
3743
|
-
function
|
|
3743
|
+
function ji(r, t, e) {
|
|
3744
3744
|
for (let n = e; n < t.childCount; n++)
|
|
3745
3745
|
if (!r.allowsMarks(t.child(n).marks))
|
|
3746
3746
|
return !0;
|
|
@@ -3784,7 +3784,7 @@ class ue extends nt {
|
|
|
3784
3784
|
}
|
|
3785
3785
|
}
|
|
3786
3786
|
nt.jsonID("attr", ue);
|
|
3787
|
-
class
|
|
3787
|
+
class We extends nt {
|
|
3788
3788
|
/**
|
|
3789
3789
|
Construct an attribute step.
|
|
3790
3790
|
*/
|
|
@@ -3803,7 +3803,7 @@ class qe extends nt {
|
|
|
3803
3803
|
return lt.empty;
|
|
3804
3804
|
}
|
|
3805
3805
|
invert(t) {
|
|
3806
|
-
return new
|
|
3806
|
+
return new We(this.attr, t.attrs[this.attr]);
|
|
3807
3807
|
}
|
|
3808
3808
|
map(t) {
|
|
3809
3809
|
return this;
|
|
@@ -3814,10 +3814,10 @@ class qe extends nt {
|
|
|
3814
3814
|
static fromJSON(t, e) {
|
|
3815
3815
|
if (typeof e.attr != "string")
|
|
3816
3816
|
throw new RangeError("Invalid input for DocAttrStep.fromJSON");
|
|
3817
|
-
return new
|
|
3817
|
+
return new We(e.attr, e.value);
|
|
3818
3818
|
}
|
|
3819
3819
|
}
|
|
3820
|
-
nt.jsonID("docAttr",
|
|
3820
|
+
nt.jsonID("docAttr", We);
|
|
3821
3821
|
let pe = class extends Error {
|
|
3822
3822
|
};
|
|
3823
3823
|
pe = function r(t) {
|
|
@@ -3827,7 +3827,7 @@ pe = function r(t) {
|
|
|
3827
3827
|
pe.prototype = Object.create(Error.prototype);
|
|
3828
3828
|
pe.prototype.constructor = pe;
|
|
3829
3829
|
pe.prototype.name = "TransformError";
|
|
3830
|
-
const
|
|
3830
|
+
const an = /* @__PURE__ */ Object.create(null);
|
|
3831
3831
|
class $ {
|
|
3832
3832
|
/**
|
|
3833
3833
|
Initialize a selection with the head and anchor and ranges. If no
|
|
@@ -3835,7 +3835,7 @@ class $ {
|
|
|
3835
3835
|
`$head`.
|
|
3836
3836
|
*/
|
|
3837
3837
|
constructor(t, e, n) {
|
|
3838
|
-
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))];
|
|
3839
3839
|
}
|
|
3840
3840
|
/**
|
|
3841
3841
|
The selection's anchor, as an unresolved position.
|
|
@@ -3900,7 +3900,7 @@ class $ {
|
|
|
3900
3900
|
let i = t.steps.length, s = this.ranges;
|
|
3901
3901
|
for (let l = 0; l < s.length; l++) {
|
|
3902
3902
|
let { $from: a, $to: c } = s[l], u = t.mapping.slice(i);
|
|
3903
|
-
t.replaceRange(u.map(a.pos), u.map(c.pos), l ? S.empty : e), l == 0 &&
|
|
3903
|
+
t.replaceRange(u.map(a.pos), u.map(c.pos), l ? S.empty : e), l == 0 && er(t, i, (n ? n.isInline : o && o.isTextblock) ? -1 : 1);
|
|
3904
3904
|
}
|
|
3905
3905
|
}
|
|
3906
3906
|
/**
|
|
@@ -3911,7 +3911,7 @@ class $ {
|
|
|
3911
3911
|
let n = t.steps.length, o = this.ranges;
|
|
3912
3912
|
for (let i = 0; i < o.length; i++) {
|
|
3913
3913
|
let { $from: s, $to: l } = o[i], a = t.mapping.slice(n), c = a.map(s.pos), u = a.map(l.pos);
|
|
3914
|
-
i ? t.deleteRange(c, u) : (t.replaceRangeWith(c, u, e),
|
|
3914
|
+
i ? t.deleteRange(c, u) : (t.replaceRangeWith(c, u, e), er(t, n, e.isInline ? -1 : 1));
|
|
3915
3915
|
}
|
|
3916
3916
|
}
|
|
3917
3917
|
/**
|
|
@@ -3963,7 +3963,7 @@ class $ {
|
|
|
3963
3963
|
static fromJSON(t, e) {
|
|
3964
3964
|
if (!e || !e.type)
|
|
3965
3965
|
throw new RangeError("Invalid input for Selection.fromJSON");
|
|
3966
|
-
let n =
|
|
3966
|
+
let n = an[e.type];
|
|
3967
3967
|
if (!n)
|
|
3968
3968
|
throw new RangeError(`No selection type ${e.type} defined`);
|
|
3969
3969
|
return n.fromJSON(t, e);
|
|
@@ -3975,9 +3975,9 @@ class $ {
|
|
|
3975
3975
|
clash with classes from other modules.
|
|
3976
3976
|
*/
|
|
3977
3977
|
static jsonID(t, e) {
|
|
3978
|
-
if (t in
|
|
3978
|
+
if (t in an)
|
|
3979
3979
|
throw new RangeError("Duplicate use of selection JSON ID " + t);
|
|
3980
|
-
return
|
|
3980
|
+
return an[t] = e, e.prototype.jsonID = t, e;
|
|
3981
3981
|
}
|
|
3982
3982
|
/**
|
|
3983
3983
|
Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
|
|
@@ -3993,7 +3993,7 @@ class $ {
|
|
|
3993
3993
|
}
|
|
3994
3994
|
}
|
|
3995
3995
|
$.prototype.visible = !0;
|
|
3996
|
-
class
|
|
3996
|
+
class Vi {
|
|
3997
3997
|
/**
|
|
3998
3998
|
Create a range.
|
|
3999
3999
|
*/
|
|
@@ -4001,16 +4001,16 @@ class Hi {
|
|
|
4001
4001
|
this.$from = t, this.$to = e;
|
|
4002
4002
|
}
|
|
4003
4003
|
}
|
|
4004
|
-
let
|
|
4005
|
-
function
|
|
4006
|
-
!
|
|
4004
|
+
let Yn = !1;
|
|
4005
|
+
function tr(r) {
|
|
4006
|
+
!Yn && !r.parent.inlineContent && (Yn = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + r.parent.type.name + ")"));
|
|
4007
4007
|
}
|
|
4008
4008
|
class D extends $ {
|
|
4009
4009
|
/**
|
|
4010
4010
|
Construct a text selection between the given points.
|
|
4011
4011
|
*/
|
|
4012
4012
|
constructor(t, e = t) {
|
|
4013
|
-
|
|
4013
|
+
tr(t), tr(e), super(t, e);
|
|
4014
4014
|
}
|
|
4015
4015
|
/**
|
|
4016
4016
|
Returns a resolved position if this is a cursor selection (an
|
|
@@ -4036,7 +4036,7 @@ class D extends $ {
|
|
|
4036
4036
|
return t instanceof D && t.anchor == this.anchor && t.head == this.head;
|
|
4037
4037
|
}
|
|
4038
4038
|
getBookmark() {
|
|
4039
|
-
return new
|
|
4039
|
+
return new Ge(this.anchor, this.head);
|
|
4040
4040
|
}
|
|
4041
4041
|
toJSON() {
|
|
4042
4042
|
return { type: "text", anchor: this.anchor, head: this.head };
|
|
@@ -4077,12 +4077,12 @@ class D extends $ {
|
|
|
4077
4077
|
}
|
|
4078
4078
|
}
|
|
4079
4079
|
$.jsonID("text", D);
|
|
4080
|
-
class
|
|
4080
|
+
class Ge {
|
|
4081
4081
|
constructor(t, e) {
|
|
4082
4082
|
this.anchor = t, this.head = e;
|
|
4083
4083
|
}
|
|
4084
4084
|
map(t) {
|
|
4085
|
-
return new
|
|
4085
|
+
return new Ge(t.map(this.anchor), t.map(this.head));
|
|
4086
4086
|
}
|
|
4087
4087
|
resolve(t) {
|
|
4088
4088
|
return D.between(t.resolve(this.anchor), t.resolve(this.head));
|
|
@@ -4111,7 +4111,7 @@ class P extends $ {
|
|
|
4111
4111
|
return { type: "node", anchor: this.anchor };
|
|
4112
4112
|
}
|
|
4113
4113
|
getBookmark() {
|
|
4114
|
-
return new
|
|
4114
|
+
return new Sn(this.anchor);
|
|
4115
4115
|
}
|
|
4116
4116
|
/**
|
|
4117
4117
|
@internal
|
|
@@ -4137,13 +4137,13 @@ class P extends $ {
|
|
|
4137
4137
|
}
|
|
4138
4138
|
P.prototype.visible = !1;
|
|
4139
4139
|
$.jsonID("node", P);
|
|
4140
|
-
class
|
|
4140
|
+
class Sn {
|
|
4141
4141
|
constructor(t) {
|
|
4142
4142
|
this.anchor = t;
|
|
4143
4143
|
}
|
|
4144
4144
|
map(t) {
|
|
4145
4145
|
let { deleted: e, pos: n } = t.mapResult(this.anchor);
|
|
4146
|
-
return e ? new
|
|
4146
|
+
return e ? new Ge(n, n) : new Sn(n);
|
|
4147
4147
|
}
|
|
4148
4148
|
resolve(t) {
|
|
4149
4149
|
let e = t.resolve(this.anchor), n = e.nodeAfter;
|
|
@@ -4181,11 +4181,11 @@ class dt extends $ {
|
|
|
4181
4181
|
return t instanceof dt;
|
|
4182
4182
|
}
|
|
4183
4183
|
getBookmark() {
|
|
4184
|
-
return
|
|
4184
|
+
return qi;
|
|
4185
4185
|
}
|
|
4186
4186
|
}
|
|
4187
4187
|
$.jsonID("all", dt);
|
|
4188
|
-
const
|
|
4188
|
+
const qi = {
|
|
4189
4189
|
map() {
|
|
4190
4190
|
return this;
|
|
4191
4191
|
},
|
|
@@ -4210,7 +4210,7 @@ function Xt(r, t, e, n, o, i = !1) {
|
|
|
4210
4210
|
}
|
|
4211
4211
|
return null;
|
|
4212
4212
|
}
|
|
4213
|
-
function
|
|
4213
|
+
function er(r, t, e) {
|
|
4214
4214
|
let n = r.steps.length - 1;
|
|
4215
4215
|
if (n < t)
|
|
4216
4216
|
return;
|
|
@@ -4222,12 +4222,12 @@ function or(r, t, e) {
|
|
|
4222
4222
|
s == null && (s = u);
|
|
4223
4223
|
}), r.setSelection($.near(r.doc.resolve(s), e));
|
|
4224
4224
|
}
|
|
4225
|
-
function
|
|
4225
|
+
function nr(r, t) {
|
|
4226
4226
|
return !t || !r ? r : r.bind(t);
|
|
4227
4227
|
}
|
|
4228
4228
|
class Te {
|
|
4229
4229
|
constructor(t, e, n) {
|
|
4230
|
-
this.name = t, this.init =
|
|
4230
|
+
this.name = t, this.init = nr(e.init, n), this.apply = nr(e.apply, n);
|
|
4231
4231
|
}
|
|
4232
4232
|
}
|
|
4233
4233
|
new Te("doc", {
|
|
@@ -4259,10 +4259,10 @@ new Te("doc", {
|
|
|
4259
4259
|
return r.scrolledIntoView ? t + 1 : t;
|
|
4260
4260
|
}
|
|
4261
4261
|
});
|
|
4262
|
-
function
|
|
4262
|
+
function Vr(r, t, e) {
|
|
4263
4263
|
for (let n in r) {
|
|
4264
4264
|
let o = r[n];
|
|
4265
|
-
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;
|
|
4266
4266
|
}
|
|
4267
4267
|
return e;
|
|
4268
4268
|
}
|
|
@@ -4271,7 +4271,7 @@ class Bt {
|
|
|
4271
4271
|
Create a plugin.
|
|
4272
4272
|
*/
|
|
4273
4273
|
constructor(t) {
|
|
4274
|
-
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");
|
|
4275
4275
|
}
|
|
4276
4276
|
/**
|
|
4277
4277
|
Extract the plugin's state field from an editor state.
|
|
@@ -4280,16 +4280,16 @@ class Bt {
|
|
|
4280
4280
|
return t[this.key];
|
|
4281
4281
|
}
|
|
4282
4282
|
}
|
|
4283
|
-
const
|
|
4284
|
-
function
|
|
4285
|
-
return r in
|
|
4283
|
+
const cn = /* @__PURE__ */ Object.create(null);
|
|
4284
|
+
function qr(r) {
|
|
4285
|
+
return r in cn ? r + "$" + ++cn[r] : (cn[r] = 0, r + "$");
|
|
4286
4286
|
}
|
|
4287
4287
|
class Rt {
|
|
4288
4288
|
/**
|
|
4289
4289
|
Create a plugin key.
|
|
4290
4290
|
*/
|
|
4291
4291
|
constructor(t = "key") {
|
|
4292
|
-
this.key =
|
|
4292
|
+
this.key = qr(t);
|
|
4293
4293
|
}
|
|
4294
4294
|
/**
|
|
4295
4295
|
Get the active plugin with this key, if any, from an editor
|
|
@@ -4305,26 +4305,26 @@ class Rt {
|
|
|
4305
4305
|
return t[this.key];
|
|
4306
4306
|
}
|
|
4307
4307
|
}
|
|
4308
|
-
const
|
|
4309
|
-
function
|
|
4308
|
+
const Cn = (r, t) => r.selection.empty ? !1 : (t && t(r.tr.deleteSelection().scrollIntoView()), !0);
|
|
4309
|
+
function Hr(r, t) {
|
|
4310
4310
|
let { $cursor: e } = r.selection;
|
|
4311
4311
|
return !e || (t ? !t.endOfTextblock("backward", r) : e.parentOffset > 0) ? null : e;
|
|
4312
4312
|
}
|
|
4313
|
-
const
|
|
4314
|
-
let n =
|
|
4313
|
+
const Ur = (r, t, e) => {
|
|
4314
|
+
let n = Hr(r, e);
|
|
4315
4315
|
if (!n)
|
|
4316
4316
|
return !1;
|
|
4317
|
-
let o =
|
|
4317
|
+
let o = Tn(n);
|
|
4318
4318
|
if (!o) {
|
|
4319
4319
|
let s = n.blockRange(), l = s && Qt(s);
|
|
4320
4320
|
return l == null ? !1 : (t && t(r.tr.lift(s, l).scrollIntoView()), !0);
|
|
4321
4321
|
}
|
|
4322
4322
|
let i = o.nodeBefore;
|
|
4323
|
-
if (
|
|
4323
|
+
if (no(r, o, t, -1))
|
|
4324
4324
|
return !0;
|
|
4325
4325
|
if (n.parent.content.size == 0 && (Zt(i, "end") || P.isSelectable(i)))
|
|
4326
4326
|
for (let s = n.depth; ; s--) {
|
|
4327
|
-
let l =
|
|
4327
|
+
let l = vn(r.doc, n.before(s), n.after(s), S.empty);
|
|
4328
4328
|
if (l && l.slice.size < l.to - l.from) {
|
|
4329
4329
|
if (t) {
|
|
4330
4330
|
let a = r.tr.step(l);
|
|
@@ -4336,20 +4336,20 @@ const Kr = (r, t, e) => {
|
|
|
4336
4336
|
break;
|
|
4337
4337
|
}
|
|
4338
4338
|
return i.isAtom && o.depth == n.depth - 1 ? (t && t(r.tr.delete(o.pos - i.nodeSize, o.pos).scrollIntoView()), !0) : !1;
|
|
4339
|
-
},
|
|
4340
|
-
let n =
|
|
4339
|
+
}, Hi = (r, t, e) => {
|
|
4340
|
+
let n = Hr(r, e);
|
|
4341
4341
|
if (!n)
|
|
4342
4342
|
return !1;
|
|
4343
|
-
let o =
|
|
4344
|
-
return o ?
|
|
4345
|
-
},
|
|
4346
|
-
let n =
|
|
4343
|
+
let o = Tn(n);
|
|
4344
|
+
return o ? Gr(r, o, t) : !1;
|
|
4345
|
+
}, Ui = (r, t, e) => {
|
|
4346
|
+
let n = Xr(r, e);
|
|
4347
4347
|
if (!n)
|
|
4348
4348
|
return !1;
|
|
4349
|
-
let o =
|
|
4350
|
-
return o ?
|
|
4349
|
+
let o = An(n);
|
|
4350
|
+
return o ? Gr(r, o, t) : !1;
|
|
4351
4351
|
};
|
|
4352
|
-
function
|
|
4352
|
+
function Gr(r, t, e) {
|
|
4353
4353
|
let n = t.nodeBefore, o = n, i = t.pos - 1;
|
|
4354
4354
|
for (; !o.isTextblock; i--) {
|
|
4355
4355
|
if (o.type.spec.isolating)
|
|
@@ -4368,7 +4368,7 @@ function Xr(r, t, e) {
|
|
|
4368
4368
|
return !1;
|
|
4369
4369
|
l = u;
|
|
4370
4370
|
}
|
|
4371
|
-
let c =
|
|
4371
|
+
let c = vn(r.doc, i, a, S.empty);
|
|
4372
4372
|
if (!c || c.from != i || c instanceof st && c.slice.size >= a - i)
|
|
4373
4373
|
return !1;
|
|
4374
4374
|
if (e) {
|
|
@@ -4386,19 +4386,19 @@ function Zt(r, t, e = !1) {
|
|
|
4386
4386
|
}
|
|
4387
4387
|
return !1;
|
|
4388
4388
|
}
|
|
4389
|
-
const
|
|
4389
|
+
const Kr = (r, t, e) => {
|
|
4390
4390
|
let { $head: n, empty: o } = r.selection, i = n;
|
|
4391
4391
|
if (!o)
|
|
4392
4392
|
return !1;
|
|
4393
4393
|
if (n.parent.isTextblock) {
|
|
4394
4394
|
if (e ? !e.endOfTextblock("backward", r) : n.parentOffset > 0)
|
|
4395
4395
|
return !1;
|
|
4396
|
-
i =
|
|
4396
|
+
i = Tn(n);
|
|
4397
4397
|
}
|
|
4398
4398
|
let s = i && i.nodeBefore;
|
|
4399
4399
|
return !s || !P.isSelectable(s) ? !1 : (t && t(r.tr.setSelection(P.create(r.doc, i.pos - s.nodeSize)).scrollIntoView()), !0);
|
|
4400
4400
|
};
|
|
4401
|
-
function
|
|
4401
|
+
function Tn(r) {
|
|
4402
4402
|
if (!r.parent.type.spec.isolating)
|
|
4403
4403
|
for (let t = r.depth - 1; t >= 0; t--) {
|
|
4404
4404
|
if (r.index(t) > 0)
|
|
@@ -4408,22 +4408,22 @@ function En(r) {
|
|
|
4408
4408
|
}
|
|
4409
4409
|
return null;
|
|
4410
4410
|
}
|
|
4411
|
-
function
|
|
4411
|
+
function Xr(r, t) {
|
|
4412
4412
|
let { $cursor: e } = r.selection;
|
|
4413
4413
|
return !e || (t ? !t.endOfTextblock("forward", r) : e.parentOffset < e.parent.content.size) ? null : e;
|
|
4414
4414
|
}
|
|
4415
|
-
const
|
|
4416
|
-
let n =
|
|
4415
|
+
const Zr = (r, t, e) => {
|
|
4416
|
+
let n = Xr(r, e);
|
|
4417
4417
|
if (!n)
|
|
4418
4418
|
return !1;
|
|
4419
|
-
let o =
|
|
4419
|
+
let o = An(n);
|
|
4420
4420
|
if (!o)
|
|
4421
4421
|
return !1;
|
|
4422
4422
|
let i = o.nodeAfter;
|
|
4423
|
-
if (
|
|
4423
|
+
if (no(r, o, t, 1))
|
|
4424
4424
|
return !0;
|
|
4425
4425
|
if (n.parent.content.size == 0 && (Zt(i, "start") || P.isSelectable(i))) {
|
|
4426
|
-
let s =
|
|
4426
|
+
let s = vn(r.doc, n.before(), n.after(), S.empty);
|
|
4427
4427
|
if (s && s.slice.size < s.to - s.from) {
|
|
4428
4428
|
if (t) {
|
|
4429
4429
|
let l = r.tr.step(s);
|
|
@@ -4433,19 +4433,19 @@ const Yr = (r, t, e) => {
|
|
|
4433
4433
|
}
|
|
4434
4434
|
}
|
|
4435
4435
|
return i.isAtom && o.depth == n.depth - 1 ? (t && t(r.tr.delete(o.pos, o.pos + i.nodeSize).scrollIntoView()), !0) : !1;
|
|
4436
|
-
},
|
|
4436
|
+
}, Qr = (r, t, e) => {
|
|
4437
4437
|
let { $head: n, empty: o } = r.selection, i = n;
|
|
4438
4438
|
if (!o)
|
|
4439
4439
|
return !1;
|
|
4440
4440
|
if (n.parent.isTextblock) {
|
|
4441
4441
|
if (e ? !e.endOfTextblock("forward", r) : n.parentOffset < n.parent.content.size)
|
|
4442
4442
|
return !1;
|
|
4443
|
-
i =
|
|
4443
|
+
i = An(n);
|
|
4444
4444
|
}
|
|
4445
4445
|
let s = i && i.nodeAfter;
|
|
4446
4446
|
return !s || !P.isSelectable(s) ? !1 : (t && t(r.tr.setSelection(P.create(r.doc, i.pos)).scrollIntoView()), !0);
|
|
4447
4447
|
};
|
|
4448
|
-
function
|
|
4448
|
+
function An(r) {
|
|
4449
4449
|
if (!r.parent.type.spec.isolating)
|
|
4450
4450
|
for (let t = r.depth - 1; t >= 0; t--) {
|
|
4451
4451
|
let e = r.node(t);
|
|
@@ -4456,37 +4456,37 @@ function Nn(r) {
|
|
|
4456
4456
|
}
|
|
4457
4457
|
return null;
|
|
4458
4458
|
}
|
|
4459
|
-
const
|
|
4459
|
+
const Gi = (r, t) => {
|
|
4460
4460
|
let e = r.selection, n = e instanceof P, o;
|
|
4461
4461
|
if (n) {
|
|
4462
4462
|
if (e.node.isTextblock || !qt(r.doc, e.from))
|
|
4463
4463
|
return !1;
|
|
4464
4464
|
o = e.from;
|
|
4465
|
-
} else if (o =
|
|
4465
|
+
} else if (o = Ue(r.doc, e.from, -1), o == null)
|
|
4466
4466
|
return !1;
|
|
4467
4467
|
if (t) {
|
|
4468
4468
|
let i = r.tr.join(o);
|
|
4469
4469
|
n && i.setSelection(P.create(i.doc, o - r.doc.resolve(o).nodeBefore.nodeSize)), t(i.scrollIntoView());
|
|
4470
4470
|
}
|
|
4471
4471
|
return !0;
|
|
4472
|
-
},
|
|
4472
|
+
}, Ki = (r, t) => {
|
|
4473
4473
|
let e = r.selection, n;
|
|
4474
4474
|
if (e instanceof P) {
|
|
4475
4475
|
if (e.node.isTextblock || !qt(r.doc, e.to))
|
|
4476
4476
|
return !1;
|
|
4477
4477
|
n = e.to;
|
|
4478
|
-
} else if (n =
|
|
4478
|
+
} else if (n = Ue(r.doc, e.to, 1), n == null)
|
|
4479
4479
|
return !1;
|
|
4480
4480
|
return t && t(r.tr.join(n).scrollIntoView()), !0;
|
|
4481
|
-
},
|
|
4481
|
+
}, Xi = (r, t) => {
|
|
4482
4482
|
let { $from: e, $to: n } = r.selection, o = e.blockRange(n), i = o && Qt(o);
|
|
4483
4483
|
return i == null ? !1 : (t && t(r.tr.lift(o, i).scrollIntoView()), !0);
|
|
4484
|
-
},
|
|
4484
|
+
}, Yr = (r, t) => {
|
|
4485
4485
|
let { $head: e, $anchor: n } = r.selection;
|
|
4486
4486
|
return !e.parent.type.spec.code || !e.sameParent(n) ? !1 : (t && t(r.tr.insertText(`
|
|
4487
4487
|
`).scrollIntoView()), !0);
|
|
4488
4488
|
};
|
|
4489
|
-
function
|
|
4489
|
+
function Mn(r) {
|
|
4490
4490
|
for (let t = 0; t < r.edgeCount; t++) {
|
|
4491
4491
|
let { type: e } = r.edge(t);
|
|
4492
4492
|
if (e.isTextblock && !e.hasRequiredAttrs())
|
|
@@ -4494,11 +4494,11 @@ function In(r) {
|
|
|
4494
4494
|
}
|
|
4495
4495
|
return null;
|
|
4496
4496
|
}
|
|
4497
|
-
const
|
|
4497
|
+
const Zi = (r, t) => {
|
|
4498
4498
|
let { $head: e, $anchor: n } = r.selection;
|
|
4499
4499
|
if (!e.parent.type.spec.code || !e.sameParent(n))
|
|
4500
4500
|
return !1;
|
|
4501
|
-
let o = e.node(-1), i = e.indexAfter(-1), s =
|
|
4501
|
+
let o = e.node(-1), i = e.indexAfter(-1), s = Mn(o.contentMatchAt(i));
|
|
4502
4502
|
if (!s || !o.canReplaceWith(i, i, s))
|
|
4503
4503
|
return !1;
|
|
4504
4504
|
if (t) {
|
|
@@ -4506,11 +4506,11 @@ const Yi = (r, t) => {
|
|
|
4506
4506
|
a.setSelection($.near(a.doc.resolve(l), 1)), t(a.scrollIntoView());
|
|
4507
4507
|
}
|
|
4508
4508
|
return !0;
|
|
4509
|
-
},
|
|
4509
|
+
}, to = (r, t) => {
|
|
4510
4510
|
let e = r.selection, { $from: n, $to: o } = e;
|
|
4511
4511
|
if (e instanceof dt || n.parent.inlineContent || o.parent.inlineContent)
|
|
4512
4512
|
return !1;
|
|
4513
|
-
let i =
|
|
4513
|
+
let i = Mn(o.parent.contentMatchAt(o.indexAfter()));
|
|
4514
4514
|
if (!i || !i.isTextblock)
|
|
4515
4515
|
return !1;
|
|
4516
4516
|
if (t) {
|
|
@@ -4518,7 +4518,7 @@ const Yi = (r, t) => {
|
|
|
4518
4518
|
l.setSelection(D.create(l.doc, s + 1)), t(l.scrollIntoView());
|
|
4519
4519
|
}
|
|
4520
4520
|
return !0;
|
|
4521
|
-
},
|
|
4521
|
+
}, eo = (r, t) => {
|
|
4522
4522
|
let { $cursor: e } = r.selection;
|
|
4523
4523
|
if (!e || e.parent.content.size)
|
|
4524
4524
|
return !1;
|
|
@@ -4530,7 +4530,7 @@ const Yi = (r, t) => {
|
|
|
4530
4530
|
let n = e.blockRange(), o = n && Qt(n);
|
|
4531
4531
|
return o == null ? !1 : (t && t(r.tr.lift(n, o).scrollIntoView()), !0);
|
|
4532
4532
|
};
|
|
4533
|
-
function
|
|
4533
|
+
function Qi(r) {
|
|
4534
4534
|
return (t, e) => {
|
|
4535
4535
|
let { $from: n, $to: o } = t.selection;
|
|
4536
4536
|
if (t.selection instanceof P && t.selection.node.isBlock)
|
|
@@ -4540,7 +4540,7 @@ function ts(r) {
|
|
|
4540
4540
|
let i = [], s, l, a = !1, c = !1;
|
|
4541
4541
|
for (let h = n.depth; ; h--)
|
|
4542
4542
|
if (n.node(h).isBlock) {
|
|
4543
|
-
a = n.end(h) == n.pos + (n.depth - h), c = n.start(h) == n.pos - (n.depth - h), l =
|
|
4543
|
+
a = n.end(h) == n.pos + (n.depth - h), c = n.start(h) == n.pos - (n.depth - h), l = Mn(n.node(h - 1).contentMatchAt(n.indexAfter(h - 1))), i.unshift(a && l ? { type: l } : null), s = h;
|
|
4544
4544
|
break;
|
|
4545
4545
|
} else {
|
|
4546
4546
|
if (h == 1)
|
|
@@ -4559,17 +4559,17 @@ function ts(r) {
|
|
|
4559
4559
|
return e && e(u.scrollIntoView()), !0;
|
|
4560
4560
|
};
|
|
4561
4561
|
}
|
|
4562
|
-
const
|
|
4562
|
+
const Yi = Qi(), ts = (r, t) => {
|
|
4563
4563
|
let { $from: e, to: n } = r.selection, o, i = e.sharedDepth(n);
|
|
4564
4564
|
return i == 0 ? !1 : (o = e.before(i), t && t(r.tr.setSelection(P.create(r.doc, o))), !0);
|
|
4565
4565
|
};
|
|
4566
|
-
function
|
|
4566
|
+
function es(r, t, e) {
|
|
4567
4567
|
let n = t.nodeBefore, o = t.nodeAfter, i = t.index();
|
|
4568
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);
|
|
4569
4569
|
}
|
|
4570
|
-
function
|
|
4570
|
+
function no(r, t, e, n) {
|
|
4571
4571
|
let o = t.nodeBefore, i = t.nodeAfter, s, l, a = o.type.spec.isolating || i.type.spec.isolating;
|
|
4572
|
-
if (!a &&
|
|
4572
|
+
if (!a && es(r, t, e))
|
|
4573
4573
|
return !0;
|
|
4574
4574
|
let c = !a && t.parent.canReplace(t.index(), t.index() + 1);
|
|
4575
4575
|
if (c && (s = (l = o.contentMatchAt(o.childCount)).findWrapping(i.type)) && l.matchType(s[0] || i.type).validEnd) {
|
|
@@ -4606,7 +4606,7 @@ function oo(r, t, e, n) {
|
|
|
4606
4606
|
}
|
|
4607
4607
|
return !1;
|
|
4608
4608
|
}
|
|
4609
|
-
function
|
|
4609
|
+
function ro(r) {
|
|
4610
4610
|
return function(t, e) {
|
|
4611
4611
|
let n = t.selection, o = r < 0 ? n.$from : n.$to, i = o.depth;
|
|
4612
4612
|
for (; o.node(i).isInline; ) {
|
|
@@ -4617,14 +4617,14 @@ function io(r) {
|
|
|
4617
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;
|
|
4618
4618
|
};
|
|
4619
4619
|
}
|
|
4620
|
-
const
|
|
4621
|
-
function
|
|
4620
|
+
const ns = ro(-1), rs = ro(1);
|
|
4621
|
+
function is(r, t = null) {
|
|
4622
4622
|
return function(e, n) {
|
|
4623
|
-
let { $from: o, $to: i } = e.selection, s = o.blockRange(i), l = s &&
|
|
4623
|
+
let { $from: o, $to: i } = e.selection, s = o.blockRange(i), l = s && Jr(s, r, t);
|
|
4624
4624
|
return l ? (n && n(e.tr.wrap(s, l).scrollIntoView()), !0) : !1;
|
|
4625
4625
|
};
|
|
4626
4626
|
}
|
|
4627
|
-
function
|
|
4627
|
+
function rr(r, t = null) {
|
|
4628
4628
|
return function(e, n) {
|
|
4629
4629
|
let o = !1;
|
|
4630
4630
|
for (let i = 0; i < e.selection.ranges.length && !o; i++) {
|
|
@@ -4654,7 +4654,7 @@ function sr(r, t = null) {
|
|
|
4654
4654
|
return !0;
|
|
4655
4655
|
};
|
|
4656
4656
|
}
|
|
4657
|
-
function
|
|
4657
|
+
function En(...r) {
|
|
4658
4658
|
return function(t, e, n) {
|
|
4659
4659
|
for (let o = 0; o < r.length; o++)
|
|
4660
4660
|
if (r[o](t, e, n))
|
|
@@ -4662,31 +4662,31 @@ function On(...r) {
|
|
|
4662
4662
|
return !1;
|
|
4663
4663
|
};
|
|
4664
4664
|
}
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4665
|
+
En(Cn, Ur, Kr);
|
|
4666
|
+
En(Cn, Zr, Qr);
|
|
4667
|
+
En(Yr, to, eo, Yi);
|
|
4668
4668
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform() == "darwin";
|
|
4669
|
-
function
|
|
4669
|
+
function ss(r, t = null) {
|
|
4670
4670
|
return function(e, n) {
|
|
4671
4671
|
let { $from: o, $to: i } = e.selection, s = o.blockRange(i);
|
|
4672
4672
|
if (!s)
|
|
4673
4673
|
return !1;
|
|
4674
4674
|
let l = n ? e.tr : null;
|
|
4675
|
-
return
|
|
4675
|
+
return ls(l, s, r, t) ? (n && n(l.scrollIntoView()), !0) : !1;
|
|
4676
4676
|
};
|
|
4677
4677
|
}
|
|
4678
|
-
function
|
|
4678
|
+
function ls(r, t, e, n = null) {
|
|
4679
4679
|
let o = !1, i = t, s = t.$from.doc;
|
|
4680
4680
|
if (t.depth >= 2 && t.$from.node(t.depth - 1).type.compatibleContent(e) && t.startIndex == 0) {
|
|
4681
4681
|
if (t.$from.index(t.depth - 1) == 0)
|
|
4682
4682
|
return !1;
|
|
4683
4683
|
let a = s.resolve(t.start - 2);
|
|
4684
|
-
i = new
|
|
4684
|
+
i = new De(a, a, t.depth), t.endIndex < t.parent.childCount && (t = new De(t.$from, s.resolve(t.$to.end(t.depth)), t.depth)), o = !0;
|
|
4685
4685
|
}
|
|
4686
|
-
let l =
|
|
4687
|
-
return l ? (r &&
|
|
4686
|
+
let l = Jr(i, e, n, t);
|
|
4687
|
+
return l ? (r && as(r, t, l, o, e), !0) : !1;
|
|
4688
4688
|
}
|
|
4689
|
-
function
|
|
4689
|
+
function as(r, t, e, n, o) {
|
|
4690
4690
|
let i = x.empty;
|
|
4691
4691
|
for (let u = e.length - 1; u >= 0; u--)
|
|
4692
4692
|
i = x.from(e[u].type.create(e[u].attrs, i));
|
|
@@ -4699,15 +4699,15 @@ function us(r, t, e, n, o) {
|
|
|
4699
4699
|
!d && Mt(r.doc, a, l) && (r.split(a, l), a += 2 * l), a += c.child(u).nodeSize;
|
|
4700
4700
|
return r;
|
|
4701
4701
|
}
|
|
4702
|
-
function
|
|
4702
|
+
function cs(r) {
|
|
4703
4703
|
return function(t, e) {
|
|
4704
4704
|
let { $from: n, $to: o } = t.selection, i = n.blockRange(o, (s) => s.childCount > 0 && s.firstChild.type == r);
|
|
4705
|
-
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;
|
|
4706
4706
|
};
|
|
4707
4707
|
}
|
|
4708
|
-
function
|
|
4708
|
+
function us(r, t, e, n) {
|
|
4709
4709
|
let o = r.tr, i = n.end, s = n.$to.end(n.depth);
|
|
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
|
|
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));
|
|
4711
4711
|
const l = Qt(n);
|
|
4712
4712
|
if (l == null)
|
|
4713
4713
|
return !1;
|
|
@@ -4715,7 +4715,7 @@ function ds(r, t, e, n) {
|
|
|
4715
4715
|
let a = o.doc.resolve(o.mapping.map(i, -1) - 1);
|
|
4716
4716
|
return qt(o.doc, a.pos) && a.nodeBefore.type == a.nodeAfter.type && o.join(a.pos), t(o.scrollIntoView()), !0;
|
|
4717
4717
|
}
|
|
4718
|
-
function
|
|
4718
|
+
function fs(r, t, e) {
|
|
4719
4719
|
let n = r.tr, o = e.parent;
|
|
4720
4720
|
for (let h = e.end, m = e.endIndex - 1, p = e.startIndex; m > p; m--)
|
|
4721
4721
|
h -= o.child(m).nodeSize, n.delete(h - 1, h + 1);
|
|
@@ -4728,7 +4728,7 @@ function hs(r, t, e) {
|
|
|
4728
4728
|
let f = i.pos, d = f + s.nodeSize;
|
|
4729
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;
|
|
4730
4730
|
}
|
|
4731
|
-
function
|
|
4731
|
+
function ds(r) {
|
|
4732
4732
|
return function(t, e) {
|
|
4733
4733
|
let { $from: n, $to: o } = t.selection, i = n.blockRange(o, (c) => c.childCount > 0 && c.firstChild.type == r);
|
|
4734
4734
|
if (!i)
|
|
@@ -4746,7 +4746,7 @@ function ps(r) {
|
|
|
4746
4746
|
return !0;
|
|
4747
4747
|
};
|
|
4748
4748
|
}
|
|
4749
|
-
function
|
|
4749
|
+
function oo(r) {
|
|
4750
4750
|
const { state: t, transaction: e } = r;
|
|
4751
4751
|
let { selection: n } = e, { doc: o } = e, { storedMarks: i } = e;
|
|
4752
4752
|
return {
|
|
@@ -4771,7 +4771,7 @@ function so(r) {
|
|
|
4771
4771
|
}
|
|
4772
4772
|
};
|
|
4773
4773
|
}
|
|
4774
|
-
class
|
|
4774
|
+
class hs {
|
|
4775
4775
|
constructor(t) {
|
|
4776
4776
|
this.editor = t.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = t.state;
|
|
4777
4777
|
}
|
|
@@ -4816,7 +4816,7 @@ class ms {
|
|
|
4816
4816
|
tr: t,
|
|
4817
4817
|
editor: o,
|
|
4818
4818
|
view: s,
|
|
4819
|
-
state:
|
|
4819
|
+
state: oo({
|
|
4820
4820
|
state: i,
|
|
4821
4821
|
transaction: t
|
|
4822
4822
|
}),
|
|
@@ -4837,7 +4837,7 @@ function gt(r, t, e) {
|
|
|
4837
4837
|
parent: r.parent ? gt(r.parent, t, e) : null
|
|
4838
4838
|
}) : r.config[t];
|
|
4839
4839
|
}
|
|
4840
|
-
function
|
|
4840
|
+
function ps(r) {
|
|
4841
4841
|
const t = r.filter((o) => o.type === "extension"), e = r.filter((o) => o.type === "node"), n = r.filter((o) => o.type === "mark");
|
|
4842
4842
|
return {
|
|
4843
4843
|
baseExtensions: t,
|
|
@@ -4853,28 +4853,28 @@ function et(r, t) {
|
|
|
4853
4853
|
}
|
|
4854
4854
|
return r;
|
|
4855
4855
|
}
|
|
4856
|
-
function
|
|
4856
|
+
function ms(r) {
|
|
4857
4857
|
return typeof r == "function";
|
|
4858
4858
|
}
|
|
4859
4859
|
function At(r, t = void 0, ...e) {
|
|
4860
|
-
return
|
|
4860
|
+
return ms(r) ? t ? r.bind(t)(...e) : r(...e) : r;
|
|
4861
4861
|
}
|
|
4862
|
-
function
|
|
4862
|
+
function gs(r) {
|
|
4863
4863
|
return Object.prototype.toString.call(r) === "[object RegExp]";
|
|
4864
4864
|
}
|
|
4865
|
-
function
|
|
4865
|
+
function ys(r) {
|
|
4866
4866
|
return Object.prototype.toString.call(r).slice(8, -1);
|
|
4867
4867
|
}
|
|
4868
4868
|
function Ae(r) {
|
|
4869
|
-
return
|
|
4869
|
+
return ys(r) !== "Object" ? !1 : r.constructor === Object && Object.getPrototypeOf(r) === Object.prototype;
|
|
4870
4870
|
}
|
|
4871
|
-
function
|
|
4871
|
+
function Nn(r, t) {
|
|
4872
4872
|
const e = { ...r };
|
|
4873
4873
|
return Ae(r) && Ae(t) && Object.keys(t).forEach((n) => {
|
|
4874
|
-
Ae(t[n]) && Ae(r[n]) ? e[n] =
|
|
4874
|
+
Ae(t[n]) && Ae(r[n]) ? e[n] = Nn(r[n], t[n]) : e[n] = t[n];
|
|
4875
4875
|
}), e;
|
|
4876
4876
|
}
|
|
4877
|
-
class
|
|
4877
|
+
class je {
|
|
4878
4878
|
constructor(t = {}) {
|
|
4879
4879
|
this.type = "mark", this.name = "mark", this.parent = null, this.child = null, this.config = {
|
|
4880
4880
|
name: this.name,
|
|
@@ -4890,17 +4890,17 @@ class He {
|
|
|
4890
4890
|
})) || {};
|
|
4891
4891
|
}
|
|
4892
4892
|
static create(t = {}) {
|
|
4893
|
-
return new
|
|
4893
|
+
return new je(t);
|
|
4894
4894
|
}
|
|
4895
4895
|
configure(t = {}) {
|
|
4896
4896
|
const e = this.extend({
|
|
4897
4897
|
...this.config,
|
|
4898
|
-
addOptions: () =>
|
|
4898
|
+
addOptions: () => Nn(this.options, t)
|
|
4899
4899
|
});
|
|
4900
4900
|
return e.name = this.name, e.parent = this.parent, e;
|
|
4901
4901
|
}
|
|
4902
4902
|
extend(t = {}) {
|
|
4903
|
-
const e = new
|
|
4903
|
+
const e = new je(t);
|
|
4904
4904
|
return e.parent = this, this.child = e, e.name = t.name ? t.name : e.parent.name, t.defaultOptions && Object.keys(t.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`), e.options = At(gt(e, "addOptions", {
|
|
4905
4905
|
name: e.name
|
|
4906
4906
|
})), e.storage = At(gt(e, "addStorage", {
|
|
@@ -4941,7 +4941,7 @@ class ht {
|
|
|
4941
4941
|
configure(t = {}) {
|
|
4942
4942
|
const e = this.extend({
|
|
4943
4943
|
...this.config,
|
|
4944
|
-
addOptions: () =>
|
|
4944
|
+
addOptions: () => Nn(this.options, t)
|
|
4945
4945
|
});
|
|
4946
4946
|
return e.name = this.name, e.parent = this.parent, e;
|
|
4947
4947
|
}
|
|
@@ -4955,7 +4955,7 @@ class ht {
|
|
|
4955
4955
|
})), e;
|
|
4956
4956
|
}
|
|
4957
4957
|
}
|
|
4958
|
-
function
|
|
4958
|
+
function ws(r, t, e) {
|
|
4959
4959
|
const { from: n, to: o } = t, { blockSeparator: i = `
|
|
4960
4960
|
|
|
4961
4961
|
`, textSerializers: s = {} } = e || {};
|
|
@@ -4975,7 +4975,7 @@ function ks(r, t, e) {
|
|
|
4975
4975
|
a.isText && (l += (d = a?.text) === null || d === void 0 ? void 0 : d.slice(Math.max(n, c) - c, o - c));
|
|
4976
4976
|
}), l;
|
|
4977
4977
|
}
|
|
4978
|
-
function
|
|
4978
|
+
function xs(r) {
|
|
4979
4979
|
return Object.fromEntries(Object.entries(r.nodes).filter(([, t]) => t.spec.toText).map(([t, e]) => [t, e.spec.toText]));
|
|
4980
4980
|
}
|
|
4981
4981
|
ht.create({
|
|
@@ -4991,8 +4991,8 @@ ht.create({
|
|
|
4991
4991
|
key: new Rt("clipboardTextSerializer"),
|
|
4992
4992
|
props: {
|
|
4993
4993
|
clipboardTextSerializer: () => {
|
|
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 =
|
|
4995
|
-
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 }, {
|
|
4996
4996
|
...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
|
|
4997
4997
|
textSerializers: a
|
|
4998
4998
|
});
|
|
@@ -5002,10 +5002,10 @@ ht.create({
|
|
|
5002
5002
|
];
|
|
5003
5003
|
}
|
|
5004
5004
|
});
|
|
5005
|
-
const
|
|
5005
|
+
const ks = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
5006
5006
|
var e;
|
|
5007
5007
|
r.isDestroyed || (t.dom.blur(), (e = window?.getSelection()) === null || e === void 0 || e.removeAllRanges());
|
|
5008
|
-
}), !0),
|
|
5008
|
+
}), !0), bs = (r = !1) => ({ commands: t }) => t.setContent("", r), vs = () => ({ state: r, tr: t, dispatch: e }) => {
|
|
5009
5009
|
const { selection: n } = t, { ranges: o } = n;
|
|
5010
5010
|
return e && o.forEach(({ $from: i, $to: s }) => {
|
|
5011
5011
|
r.doc.nodesBetween(i.pos, s.pos, (l, a) => {
|
|
@@ -5022,12 +5022,12 @@ const vs = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5022
5022
|
(m || m === 0) && t.lift(h, m);
|
|
5023
5023
|
});
|
|
5024
5024
|
}), !0;
|
|
5025
|
-
},
|
|
5025
|
+
}, Ss = (r) => (t) => r(t), Cs = () => ({ state: r, dispatch: t }) => to(r, t), Ts = (r, t) => ({ editor: e, tr: n }) => {
|
|
5026
5026
|
const { state: o } = e, i = o.doc.slice(r.from, r.to);
|
|
5027
5027
|
n.deleteRange(r.from, r.to);
|
|
5028
5028
|
const s = n.mapping.map(t);
|
|
5029
5029
|
return n.insert(s, i.content), n.setSelection(new D(n.doc.resolve(s - 1))), !0;
|
|
5030
|
-
},
|
|
5030
|
+
}, As = () => ({ tr: r, dispatch: t }) => {
|
|
5031
5031
|
const { selection: e } = r, n = e.$anchor.node();
|
|
5032
5032
|
if (n.content.size > 0)
|
|
5033
5033
|
return !1;
|
|
@@ -5041,7 +5041,7 @@ const vs = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5041
5041
|
return !0;
|
|
5042
5042
|
}
|
|
5043
5043
|
return !1;
|
|
5044
|
-
},
|
|
5044
|
+
}, Ms = (r) => ({ tr: t, state: e, dispatch: n }) => {
|
|
5045
5045
|
const o = et(r, e.schema), i = t.selection.$anchor;
|
|
5046
5046
|
for (let s = i.depth; s > 0; s -= 1)
|
|
5047
5047
|
if (i.node(s).type === o) {
|
|
@@ -5052,35 +5052,35 @@ const vs = () => ({ editor: r, view: t }) => (requestAnimationFrame(() => {
|
|
|
5052
5052
|
return !0;
|
|
5053
5053
|
}
|
|
5054
5054
|
return !1;
|
|
5055
|
-
},
|
|
5055
|
+
}, Es = (r) => ({ tr: t, dispatch: e }) => {
|
|
5056
5056
|
const { from: n, to: o } = r;
|
|
5057
5057
|
return e && t.delete(n, o), !0;
|
|
5058
|
-
},
|
|
5059
|
-
function
|
|
5058
|
+
}, Ns = () => ({ state: r, dispatch: t }) => Cn(r, t), Is = () => ({ commands: r }) => r.keyboardShortcut("Enter"), Os = () => ({ state: r, dispatch: t }) => Zi(r, t);
|
|
5059
|
+
function Ve(r, t, e = { strict: !0 }) {
|
|
5060
5060
|
const n = Object.keys(t);
|
|
5061
|
-
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;
|
|
5062
5062
|
}
|
|
5063
|
-
function
|
|
5064
|
-
return r.find((n) => n.type === t &&
|
|
5063
|
+
function io(r, t, e = {}) {
|
|
5064
|
+
return r.find((n) => n.type === t && Ve(
|
|
5065
5065
|
// Only check equality for the attributes that are provided
|
|
5066
5066
|
Object.fromEntries(Object.keys(e).map((o) => [o, n.attrs[o]])),
|
|
5067
5067
|
e
|
|
5068
5068
|
));
|
|
5069
5069
|
}
|
|
5070
|
-
function
|
|
5071
|
-
return !!
|
|
5070
|
+
function or(r, t, e = {}) {
|
|
5071
|
+
return !!io(r, t, e);
|
|
5072
5072
|
}
|
|
5073
|
-
function
|
|
5073
|
+
function so(r, t, e) {
|
|
5074
5074
|
var n;
|
|
5075
5075
|
if (!r || !t)
|
|
5076
5076
|
return;
|
|
5077
5077
|
let o = r.parent.childAfter(r.parentOffset);
|
|
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), !
|
|
5078
|
+
if ((!o.node || !o.node.marks.some((u) => u.type === t)) && (o = r.parent.childBefore(r.parentOffset)), !o.node || !o.node.marks.some((u) => u.type === t) || (e = e || ((n = o.node.marks[0]) === null || n === void 0 ? void 0 : n.attrs), !io([...o.node.marks], t, e)))
|
|
5079
5079
|
return;
|
|
5080
5080
|
let s = o.index, l = r.start() + o.offset, a = s + 1, c = l + o.node.nodeSize;
|
|
5081
|
-
for (; s > 0 &&
|
|
5081
|
+
for (; s > 0 && or([...r.parent.child(s - 1).marks], t, e); )
|
|
5082
5082
|
s -= 1, l -= r.parent.child(s).nodeSize;
|
|
5083
|
-
for (; a < r.parent.childCount &&
|
|
5083
|
+
for (; a < r.parent.childCount && or([...r.parent.child(a).marks], t, e); )
|
|
5084
5084
|
c += r.parent.child(a).nodeSize, a += 1;
|
|
5085
5085
|
return {
|
|
5086
5086
|
from: l,
|
|
@@ -5095,30 +5095,30 @@ function zt(r, t) {
|
|
|
5095
5095
|
}
|
|
5096
5096
|
return r;
|
|
5097
5097
|
}
|
|
5098
|
-
const
|
|
5098
|
+
const $s = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5099
5099
|
const i = zt(r, n.schema), { doc: s, selection: l } = e, { $from: a, from: c, to: u } = l;
|
|
5100
5100
|
if (o) {
|
|
5101
|
-
const f =
|
|
5101
|
+
const f = so(a, i, t);
|
|
5102
5102
|
if (f && f.from <= c && f.to >= u) {
|
|
5103
5103
|
const d = D.create(s, f.from, f.to);
|
|
5104
5104
|
e.setSelection(d);
|
|
5105
5105
|
}
|
|
5106
5106
|
}
|
|
5107
5107
|
return !0;
|
|
5108
|
-
},
|
|
5108
|
+
}, Bs = (r) => (t) => {
|
|
5109
5109
|
const e = typeof r == "function" ? r(t) : r;
|
|
5110
5110
|
for (let n = 0; n < e.length; n += 1)
|
|
5111
5111
|
if (e[n](t))
|
|
5112
5112
|
return !0;
|
|
5113
5113
|
return !1;
|
|
5114
5114
|
};
|
|
5115
|
-
function
|
|
5115
|
+
function lo(r) {
|
|
5116
5116
|
return r instanceof D;
|
|
5117
5117
|
}
|
|
5118
|
-
function
|
|
5118
|
+
function Jt(r = 0, t = 0, e = 0) {
|
|
5119
5119
|
return Math.min(Math.max(r, t), e);
|
|
5120
5120
|
}
|
|
5121
|
-
function
|
|
5121
|
+
function Rs(r, t = null) {
|
|
5122
5122
|
if (!t)
|
|
5123
5123
|
return null;
|
|
5124
5124
|
const e = $.atStart(r), n = $.atEnd(r);
|
|
@@ -5127,12 +5127,12 @@ function Ps(r, t = null) {
|
|
|
5127
5127
|
if (t === "end")
|
|
5128
5128
|
return n;
|
|
5129
5129
|
const o = e.from, i = n.to;
|
|
5130
|
-
return t === "all" ? D.create(r,
|
|
5130
|
+
return t === "all" ? D.create(r, Jt(0, o, i), Jt(r.content.size, o, i)) : D.create(r, Jt(t, o, i), Jt(t, o, i));
|
|
5131
5131
|
}
|
|
5132
|
-
function
|
|
5132
|
+
function zs() {
|
|
5133
5133
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
5134
5134
|
}
|
|
5135
|
-
function
|
|
5135
|
+
function In() {
|
|
5136
5136
|
return [
|
|
5137
5137
|
"iPad Simulator",
|
|
5138
5138
|
"iPhone Simulator",
|
|
@@ -5142,35 +5142,35 @@ function Bn() {
|
|
|
5142
5142
|
"iPod"
|
|
5143
5143
|
].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
|
|
5144
5144
|
}
|
|
5145
|
-
const
|
|
5145
|
+
const Ps = (r = null, t = {}) => ({ editor: e, view: n, tr: o, dispatch: i }) => {
|
|
5146
5146
|
t = {
|
|
5147
5147
|
scrollIntoView: !0,
|
|
5148
5148
|
...t
|
|
5149
5149
|
};
|
|
5150
5150
|
const s = () => {
|
|
5151
|
-
(
|
|
5151
|
+
(In() || zs()) && n.dom.focus(), requestAnimationFrame(() => {
|
|
5152
5152
|
e.isDestroyed || (n.focus(), t?.scrollIntoView && e.commands.scrollIntoView());
|
|
5153
5153
|
});
|
|
5154
5154
|
};
|
|
5155
5155
|
if (n.hasFocus() && r === null || r === !1)
|
|
5156
5156
|
return !0;
|
|
5157
|
-
if (i && r === null && !
|
|
5157
|
+
if (i && r === null && !lo(e.state.selection))
|
|
5158
5158
|
return s(), !0;
|
|
5159
|
-
const l =
|
|
5159
|
+
const l = Rs(o.doc, r) || e.state.selection, a = e.state.selection.eq(l);
|
|
5160
5160
|
return i && (a || o.setSelection(l), a && o.storedMarks && o.setStoredMarks(o.storedMarks), s()), !0;
|
|
5161
|
-
},
|
|
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) => {
|
|
5162
5162
|
const t = r.childNodes;
|
|
5163
5163
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
5164
5164
|
const n = t[e];
|
|
5165
|
-
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);
|
|
5166
5166
|
}
|
|
5167
5167
|
return r;
|
|
5168
5168
|
};
|
|
5169
5169
|
function Me(r) {
|
|
5170
5170
|
const t = `<body>${r}</body>`, e = new window.DOMParser().parseFromString(t, "text/html").body;
|
|
5171
|
-
return
|
|
5171
|
+
return ao(e);
|
|
5172
5172
|
}
|
|
5173
|
-
function
|
|
5173
|
+
function qe(r, t, e) {
|
|
5174
5174
|
if (r instanceof kt || r instanceof x)
|
|
5175
5175
|
return r;
|
|
5176
5176
|
e = {
|
|
@@ -5188,12 +5188,12 @@ function Ge(r, t, e) {
|
|
|
5188
5188
|
} catch (i) {
|
|
5189
5189
|
if (e.errorOnInvalidContent)
|
|
5190
5190
|
throw new Error("[tiptap error]: Invalid JSON content", { cause: i });
|
|
5191
|
-
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", r, "Error:", i),
|
|
5191
|
+
return console.warn("[tiptap warn]: Invalid content.", "Passed value:", r, "Error:", i), qe("", t, e);
|
|
5192
5192
|
}
|
|
5193
5193
|
if (o) {
|
|
5194
5194
|
if (e.errorOnInvalidContent) {
|
|
5195
5195
|
let s = !1, l = "";
|
|
5196
|
-
const a = new
|
|
5196
|
+
const a = new Ni({
|
|
5197
5197
|
topNode: t.spec.topNode,
|
|
5198
5198
|
marks: t.spec.marks,
|
|
5199
5199
|
// Prosemirror's schemas are executed such that: the last to execute, matches last
|
|
@@ -5211,15 +5211,15 @@ function Ge(r, t, e) {
|
|
|
5211
5211
|
}
|
|
5212
5212
|
})
|
|
5213
5213
|
});
|
|
5214
|
-
if (e.slice ?
|
|
5214
|
+
if (e.slice ? rn.fromSchema(a).parseSlice(Me(r), e.parseOptions) : rn.fromSchema(a).parse(Me(r), e.parseOptions), e.errorOnInvalidContent && s)
|
|
5215
5215
|
throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${l}`) });
|
|
5216
5216
|
}
|
|
5217
|
-
const i =
|
|
5217
|
+
const i = rn.fromSchema(t);
|
|
5218
5218
|
return e.slice ? i.parseSlice(Me(r), e.parseOptions).content : i.parse(Me(r), e.parseOptions);
|
|
5219
5219
|
}
|
|
5220
|
-
return
|
|
5220
|
+
return qe("", t, e);
|
|
5221
5221
|
}
|
|
5222
|
-
function
|
|
5222
|
+
function Ds(r, t, e) {
|
|
5223
5223
|
const n = r.steps.length - 1;
|
|
5224
5224
|
if (n < t)
|
|
5225
5225
|
return;
|
|
@@ -5232,7 +5232,7 @@ function Ls(r, t, e) {
|
|
|
5232
5232
|
s === 0 && (s = u);
|
|
5233
5233
|
}), r.setSelection($.near(r.doc.resolve(s), e));
|
|
5234
5234
|
}
|
|
5235
|
-
const
|
|
5235
|
+
const Ls = (r) => !("type" in r), Js = (r, t, e) => ({ tr: n, dispatch: o, editor: i }) => {
|
|
5236
5236
|
var s;
|
|
5237
5237
|
if (o) {
|
|
5238
5238
|
e = {
|
|
@@ -5244,7 +5244,7 @@ const Ws = (r) => !("type" in r), js = (r, t, e) => ({ tr: n, dispatch: o, edito
|
|
|
5244
5244
|
};
|
|
5245
5245
|
let l;
|
|
5246
5246
|
try {
|
|
5247
|
-
l =
|
|
5247
|
+
l = qe(t, i.schema, {
|
|
5248
5248
|
parseOptions: {
|
|
5249
5249
|
preserveWhitespace: "full",
|
|
5250
5250
|
...e.parseOptions
|
|
@@ -5261,7 +5261,7 @@ const Ws = (r) => !("type" in r), js = (r, t, e) => ({ tr: n, dispatch: o, edito
|
|
|
5261
5261
|
}), !1;
|
|
5262
5262
|
}
|
|
5263
5263
|
let { from: a, to: c } = typeof r == "number" ? { from: r, to: r } : { from: r.from, to: r.to }, u = !0, f = !0;
|
|
5264
|
-
if ((
|
|
5264
|
+
if ((Ls(l) ? l : [l]).forEach((m) => {
|
|
5265
5265
|
m.check(), u = u ? m.isText && m.marks.length === 0 : !1, f = f ? m.isBlock : !1;
|
|
5266
5266
|
}), a === c && f) {
|
|
5267
5267
|
const { parent: m } = n.doc.resolve(a);
|
|
@@ -5280,28 +5280,28 @@ const Ws = (r) => !("type" in r), js = (r, t, e) => ({ tr: n, dispatch: o, edito
|
|
|
5280
5280
|
n.insertText(h, a, c);
|
|
5281
5281
|
} else
|
|
5282
5282
|
h = l, n.replaceWith(a, c, h);
|
|
5283
|
-
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 });
|
|
5284
5284
|
}
|
|
5285
5285
|
return !0;
|
|
5286
|
-
},
|
|
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 }) => {
|
|
5287
5287
|
try {
|
|
5288
|
-
const n =
|
|
5288
|
+
const n = Ue(r.doc, r.selection.$from.pos, -1);
|
|
5289
5289
|
return n == null ? !1 : (e.join(n, 2), t && t(e), !0);
|
|
5290
5290
|
} catch {
|
|
5291
5291
|
return !1;
|
|
5292
5292
|
}
|
|
5293
|
-
},
|
|
5293
|
+
}, Us = () => ({ state: r, dispatch: t, tr: e }) => {
|
|
5294
5294
|
try {
|
|
5295
|
-
const n =
|
|
5295
|
+
const n = Ue(r.doc, r.selection.$from.pos, 1);
|
|
5296
5296
|
return n == null ? !1 : (e.join(n, 2), t && t(e), !0);
|
|
5297
5297
|
} catch {
|
|
5298
5298
|
return !1;
|
|
5299
5299
|
}
|
|
5300
|
-
},
|
|
5301
|
-
function
|
|
5300
|
+
}, Gs = () => ({ state: r, dispatch: t }) => Hi(r, t), Ks = () => ({ state: r, dispatch: t }) => Ui(r, t);
|
|
5301
|
+
function co() {
|
|
5302
5302
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
5303
5303
|
}
|
|
5304
|
-
function
|
|
5304
|
+
function Xs(r) {
|
|
5305
5305
|
const t = r.split(/-(?!$)/);
|
|
5306
5306
|
let e = t[t.length - 1];
|
|
5307
5307
|
e === "Space" && (e = " ");
|
|
@@ -5317,14 +5317,14 @@ function Qs(r) {
|
|
|
5317
5317
|
else if (/^s(hift)?$/i.test(a))
|
|
5318
5318
|
i = !0;
|
|
5319
5319
|
else if (/^mod$/i.test(a))
|
|
5320
|
-
|
|
5320
|
+
In() || co() ? s = !0 : o = !0;
|
|
5321
5321
|
else
|
|
5322
5322
|
throw new Error(`Unrecognized modifier name: ${a}`);
|
|
5323
5323
|
}
|
|
5324
5324
|
return n && (e = `Alt-${e}`), o && (e = `Ctrl-${e}`), s && (e = `Meta-${e}`), i && (e = `Shift-${e}`), e;
|
|
5325
5325
|
}
|
|
5326
|
-
const
|
|
5327
|
-
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", {
|
|
5328
5328
|
key: s === "Space" ? " " : s,
|
|
5329
5329
|
altKey: i.includes("Alt"),
|
|
5330
5330
|
ctrlKey: i.includes("Ctrl"),
|
|
@@ -5340,7 +5340,7 @@ const Ys = (r) => ({ editor: t, view: e, tr: n, dispatch: o }) => {
|
|
|
5340
5340
|
u && o && n.maybeStep(u);
|
|
5341
5341
|
}), !0;
|
|
5342
5342
|
};
|
|
5343
|
-
function
|
|
5343
|
+
function On(r, t, e = {}) {
|
|
5344
5344
|
const { from: n, to: o, empty: i } = r.selection, s = t ? et(t, r.schema) : null, l = [];
|
|
5345
5345
|
r.doc.nodesBetween(n, o, (f, d) => {
|
|
5346
5346
|
if (f.isText)
|
|
@@ -5352,52 +5352,52 @@ function Rn(r, t, e = {}) {
|
|
|
5352
5352
|
to: m
|
|
5353
5353
|
});
|
|
5354
5354
|
});
|
|
5355
|
-
const a = o - n, c = l.filter((f) => s ? s.name === f.node.type.name : !0).filter((f) =>
|
|
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 }));
|
|
5356
5356
|
return i ? !!c.length : c.reduce((f, d) => f + d.to - d.from, 0) >= a;
|
|
5357
5357
|
}
|
|
5358
|
-
const
|
|
5358
|
+
const Qs = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5359
5359
|
const o = et(r, e.schema);
|
|
5360
|
-
return
|
|
5361
|
-
},
|
|
5360
|
+
return On(e, o, t) ? Xi(e, n) : !1;
|
|
5361
|
+
}, Ys = () => ({ state: r, dispatch: t }) => eo(r, t), tl = (r) => ({ state: t, dispatch: e }) => {
|
|
5362
5362
|
const n = et(r, t.schema);
|
|
5363
|
-
return
|
|
5364
|
-
},
|
|
5365
|
-
function
|
|
5363
|
+
return cs(n)(t, e);
|
|
5364
|
+
}, el = () => ({ state: r, dispatch: t }) => Yr(r, t);
|
|
5365
|
+
function uo(r, t) {
|
|
5366
5366
|
return t.nodes[r] ? "node" : t.marks[r] ? "mark" : null;
|
|
5367
5367
|
}
|
|
5368
|
-
function
|
|
5368
|
+
function ir(r, t) {
|
|
5369
5369
|
const e = typeof t == "string" ? [t] : t;
|
|
5370
5370
|
return Object.keys(r).reduce((n, o) => (e.includes(o) || (n[o] = r[o]), n), {});
|
|
5371
5371
|
}
|
|
5372
|
-
const
|
|
5372
|
+
const nl = (r, t) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5373
5373
|
let i = null, s = null;
|
|
5374
|
-
const l =
|
|
5374
|
+
const l = uo(typeof r == "string" ? r : r.name, n.schema);
|
|
5375
5375
|
return l ? (l === "node" && (i = et(r, n.schema)), l === "mark" && (s = zt(r, n.schema)), o && e.selection.ranges.forEach((a) => {
|
|
5376
5376
|
n.doc.nodesBetween(a.$from.pos, a.$to.pos, (c, u) => {
|
|
5377
|
-
i && i === c.type && e.setNodeMarkup(u, void 0,
|
|
5378
|
-
s === f.type && e.addMark(u, u + c.nodeSize, s.create(
|
|
5377
|
+
i && i === c.type && e.setNodeMarkup(u, void 0, ir(c.attrs, t)), s && c.marks.length && c.marks.forEach((f) => {
|
|
5378
|
+
s === f.type && e.addMark(u, u + c.nodeSize, s.create(ir(f.attrs, t)));
|
|
5379
5379
|
});
|
|
5380
5380
|
});
|
|
5381
5381
|
}), !0) : !1;
|
|
5382
|
-
},
|
|
5382
|
+
}, rl = () => ({ tr: r, dispatch: t }) => (t && r.scrollIntoView(), !0), ol = () => ({ tr: r, dispatch: t }) => {
|
|
5383
5383
|
if (t) {
|
|
5384
5384
|
const e = new dt(r.doc);
|
|
5385
5385
|
r.setSelection(e);
|
|
5386
5386
|
}
|
|
5387
5387
|
return !0;
|
|
5388
|
-
},
|
|
5389
|
-
function
|
|
5390
|
-
return
|
|
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 = {}) {
|
|
5390
|
+
return qe(r, t, {
|
|
5391
5391
|
slice: !1,
|
|
5392
5392
|
parseOptions: e,
|
|
5393
5393
|
errorOnInvalidContent: n.errorOnInvalidContent
|
|
5394
5394
|
});
|
|
5395
5395
|
}
|
|
5396
|
-
const
|
|
5396
|
+
const fl = (r, t = !1, e = {}, n = {}) => ({ editor: o, tr: i, dispatch: s, commands: l }) => {
|
|
5397
5397
|
var a, c;
|
|
5398
5398
|
const { doc: u } = i;
|
|
5399
5399
|
if (e.preserveWhitespace !== "full") {
|
|
5400
|
-
const f =
|
|
5400
|
+
const f = ul(r, o.schema, e, {
|
|
5401
5401
|
errorOnInvalidContent: (a = n.errorOnInvalidContent) !== null && a !== void 0 ? a : o.options.enableContentCheck
|
|
5402
5402
|
});
|
|
5403
5403
|
return s && i.replaceWith(0, u.content.size, f).setMeta("preventUpdate", !t), !0;
|
|
@@ -5407,7 +5407,7 @@ const hl = (r, t = !1, e = {}, n = {}) => ({ editor: o, tr: i, dispatch: s, comm
|
|
|
5407
5407
|
errorOnInvalidContent: (c = n.errorOnInvalidContent) !== null && c !== void 0 ? c : o.options.enableContentCheck
|
|
5408
5408
|
});
|
|
5409
5409
|
};
|
|
5410
|
-
function
|
|
5410
|
+
function dl(r, t) {
|
|
5411
5411
|
const e = zt(t, r.schema), { from: n, to: o, empty: i } = r.selection, s = [];
|
|
5412
5412
|
i ? (r.storedMarks && s.push(...r.storedMarks), s.push(...r.selection.$head.marks())) : r.doc.nodesBetween(n, o, (a) => {
|
|
5413
5413
|
s.push(...a.marks);
|
|
@@ -5415,7 +5415,7 @@ function pl(r, t) {
|
|
|
5415
5415
|
const l = s.find((a) => a.type.name === e.name);
|
|
5416
5416
|
return l ? { ...l.attrs } : {};
|
|
5417
5417
|
}
|
|
5418
|
-
function
|
|
5418
|
+
function hl(r) {
|
|
5419
5419
|
for (let t = 0; t < r.edgeCount; t += 1) {
|
|
5420
5420
|
const { type: e } = r.edge(t);
|
|
5421
5421
|
if (e.isTextblock && !e.hasRequiredAttrs())
|
|
@@ -5423,7 +5423,7 @@ function ml(r) {
|
|
|
5423
5423
|
}
|
|
5424
5424
|
return null;
|
|
5425
5425
|
}
|
|
5426
|
-
function
|
|
5426
|
+
function pl(r, t) {
|
|
5427
5427
|
for (let e = r.depth; e > 0; e -= 1) {
|
|
5428
5428
|
const n = r.node(e);
|
|
5429
5429
|
if (t(n))
|
|
@@ -5435,19 +5435,19 @@ function gl(r, t) {
|
|
|
5435
5435
|
};
|
|
5436
5436
|
}
|
|
5437
5437
|
}
|
|
5438
|
-
function
|
|
5439
|
-
return (t) =>
|
|
5438
|
+
function $n(r) {
|
|
5439
|
+
return (t) => pl(t.$from, r);
|
|
5440
5440
|
}
|
|
5441
|
-
function
|
|
5441
|
+
function Be(r, t, e) {
|
|
5442
5442
|
return Object.fromEntries(Object.entries(e).filter(([n]) => {
|
|
5443
5443
|
const o = r.find((i) => i.type === t && i.name === n);
|
|
5444
5444
|
return o ? o.attribute.keepOnSplit : !1;
|
|
5445
5445
|
}));
|
|
5446
5446
|
}
|
|
5447
|
-
function
|
|
5447
|
+
function ml(r, t, e = {}) {
|
|
5448
5448
|
const { empty: n, ranges: o } = r.selection, i = t ? zt(t, r.schema) : null;
|
|
5449
5449
|
if (n)
|
|
5450
|
-
return !!(r.storedMarks || r.selection.$from.marks()).filter((f) => i ? i.name === f.type.name : !0).find((f) =>
|
|
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 }));
|
|
5451
5451
|
let s = 0;
|
|
5452
5452
|
const l = [];
|
|
5453
5453
|
if (o.forEach(({ $from: f, $to: d }) => {
|
|
@@ -5456,19 +5456,19 @@ function yl(r, t, e = {}) {
|
|
|
5456
5456
|
if (!p.isText && !p.marks.length)
|
|
5457
5457
|
return;
|
|
5458
5458
|
const b = Math.max(h, k), I = Math.min(m, k + p.nodeSize), R = I - b;
|
|
5459
|
-
s += R, l.push(...p.marks.map((
|
|
5460
|
-
mark:
|
|
5459
|
+
s += R, l.push(...p.marks.map((L) => ({
|
|
5460
|
+
mark: L,
|
|
5461
5461
|
from: b,
|
|
5462
5462
|
to: I
|
|
5463
5463
|
})));
|
|
5464
5464
|
});
|
|
5465
5465
|
}), s === 0)
|
|
5466
5466
|
return !1;
|
|
5467
|
-
const a = l.filter((f) => i ? i.name === f.mark.type.name : !0).filter((f) =>
|
|
5467
|
+
const a = l.filter((f) => i ? i.name === f.mark.type.name : !0).filter((f) => Ve(f.mark.attrs, e, { strict: !1 })).reduce((f, d) => f + d.to - d.from, 0), c = l.filter((f) => i ? f.mark.type !== i && f.mark.type.excludes(i) : !0).reduce((f, d) => f + d.to - d.from, 0);
|
|
5468
5468
|
return (a > 0 ? a + c : a) >= s;
|
|
5469
5469
|
}
|
|
5470
|
-
function
|
|
5471
|
-
const { nodeExtensions: e } =
|
|
5470
|
+
function sr(r, t) {
|
|
5471
|
+
const { nodeExtensions: e } = ps(t), n = e.find((s) => s.name === r);
|
|
5472
5472
|
if (!n)
|
|
5473
5473
|
return !1;
|
|
5474
5474
|
const o = {
|
|
@@ -5478,7 +5478,7 @@ function cr(r, t) {
|
|
|
5478
5478
|
}, i = At(gt(n, "group", o));
|
|
5479
5479
|
return typeof i != "string" ? !1 : i.split(" ").includes("list");
|
|
5480
5480
|
}
|
|
5481
|
-
function
|
|
5481
|
+
function fo(r, { checkChildren: t = !0, ignoreWhitespace: e = !1 } = {}) {
|
|
5482
5482
|
var n;
|
|
5483
5483
|
if (e) {
|
|
5484
5484
|
if (r.type.name === "hardBreak")
|
|
@@ -5495,16 +5495,16 @@ function po(r, { checkChildren: t = !0, ignoreWhitespace: e = !1 } = {}) {
|
|
|
5495
5495
|
if (t) {
|
|
5496
5496
|
let o = !0;
|
|
5497
5497
|
return r.content.forEach((i) => {
|
|
5498
|
-
o !== !1 && (
|
|
5498
|
+
o !== !1 && (fo(i, { ignoreWhitespace: e, checkChildren: t }) || (o = !1));
|
|
5499
5499
|
}), o;
|
|
5500
5500
|
}
|
|
5501
5501
|
return !1;
|
|
5502
5502
|
}
|
|
5503
|
-
function
|
|
5503
|
+
function gl(r, t, e) {
|
|
5504
5504
|
var n;
|
|
5505
5505
|
const { selection: o } = t;
|
|
5506
5506
|
let i = null;
|
|
5507
|
-
if (
|
|
5507
|
+
if (lo(o) && (i = o.$cursor), i) {
|
|
5508
5508
|
const l = (n = r.storedMarks) !== null && n !== void 0 ? n : i.marks();
|
|
5509
5509
|
return !!e.isInSet(l) || !l.some((a) => a.type.excludes(e));
|
|
5510
5510
|
}
|
|
@@ -5522,11 +5522,11 @@ function wl(r, t, e) {
|
|
|
5522
5522
|
}), c;
|
|
5523
5523
|
});
|
|
5524
5524
|
}
|
|
5525
|
-
const
|
|
5525
|
+
const yl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5526
5526
|
const { selection: i } = e, { empty: s, ranges: l } = i, a = zt(r, n.schema);
|
|
5527
5527
|
if (o)
|
|
5528
5528
|
if (s) {
|
|
5529
|
-
const c =
|
|
5529
|
+
const c = dl(n, a);
|
|
5530
5530
|
e.addStoredMark(a.create({
|
|
5531
5531
|
...c,
|
|
5532
5532
|
...t
|
|
@@ -5544,41 +5544,41 @@ const xl = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
|
5544
5544
|
}) : e.addMark(m, p, a.create(t));
|
|
5545
5545
|
});
|
|
5546
5546
|
});
|
|
5547
|
-
return
|
|
5548
|
-
},
|
|
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 }) => {
|
|
5549
5549
|
const i = et(r, e.schema);
|
|
5550
5550
|
let s;
|
|
5551
|
-
return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) =>
|
|
5552
|
-
},
|
|
5551
|
+
return e.selection.$anchor.sameParent(e.selection.$head) && (s = e.selection.$anchor.parent.attrs), i.isTextblock ? o().command(({ commands: l }) => rr(i, { ...s, ...t })(e) ? !0 : l.clearNodes()).command(({ state: l }) => rr(i, { ...s, ...t })(l, n)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
|
|
5552
|
+
}, kl = (r) => ({ tr: t, dispatch: e }) => {
|
|
5553
5553
|
if (e) {
|
|
5554
|
-
const { doc: n } = t, o =
|
|
5554
|
+
const { doc: n } = t, o = Jt(r, 0, n.content.size), i = P.create(n, o);
|
|
5555
5555
|
t.setSelection(i);
|
|
5556
5556
|
}
|
|
5557
5557
|
return !0;
|
|
5558
|
-
},
|
|
5558
|
+
}, bl = (r) => ({ tr: t, dispatch: e }) => {
|
|
5559
5559
|
if (e) {
|
|
5560
|
-
const { doc: n } = t, { from: o, to: i } = typeof r == "number" ? { from: r, to: r } : r, s = D.atStart(n).from, l = D.atEnd(n).to, a =
|
|
5560
|
+
const { doc: n } = t, { from: o, to: i } = typeof r == "number" ? { from: r, to: r } : r, s = D.atStart(n).from, l = D.atEnd(n).to, a = Jt(o, s, l), c = Jt(i, s, l), u = D.create(n, a, c);
|
|
5561
5561
|
t.setSelection(u);
|
|
5562
5562
|
}
|
|
5563
5563
|
return !0;
|
|
5564
|
-
},
|
|
5564
|
+
}, vl = (r) => ({ state: t, dispatch: e }) => {
|
|
5565
5565
|
const n = et(r, t.schema);
|
|
5566
|
-
return
|
|
5566
|
+
return ds(n)(t, e);
|
|
5567
5567
|
};
|
|
5568
|
-
function
|
|
5568
|
+
function lr(r, t) {
|
|
5569
5569
|
const e = r.storedMarks || r.selection.$to.parentOffset && r.selection.$from.marks();
|
|
5570
5570
|
if (e) {
|
|
5571
5571
|
const n = e.filter((o) => t?.includes(o.type.name));
|
|
5572
5572
|
r.tr.ensureMarks(n);
|
|
5573
5573
|
}
|
|
5574
5574
|
}
|
|
5575
|
-
const
|
|
5576
|
-
const { selection: i, doc: s } = t, { $from: l, $to: a } = i, c = o.extensionManager.attributes, u =
|
|
5575
|
+
const Sl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, editor: o }) => {
|
|
5576
|
+
const { selection: i, doc: s } = t, { $from: l, $to: a } = i, c = o.extensionManager.attributes, u = Be(c, l.node().type.name, l.node().attrs);
|
|
5577
5577
|
if (i instanceof P && i.node.isBlock)
|
|
5578
|
-
return !l.parentOffset || !Mt(s, l.pos) ? !1 : (n && (r &&
|
|
5578
|
+
return !l.parentOffset || !Mt(s, l.pos) ? !1 : (n && (r && lr(e, o.extensionManager.splittableMarks), t.split(l.pos).scrollIntoView()), !0);
|
|
5579
5579
|
if (!l.parent.isBlock)
|
|
5580
5580
|
return !1;
|
|
5581
|
-
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)));
|
|
5582
5582
|
let h = f && d ? [
|
|
5583
5583
|
{
|
|
5584
5584
|
type: d,
|
|
@@ -5595,10 +5595,10 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5595
5595
|
const p = t.mapping.map(l.before()), k = t.doc.resolve(p);
|
|
5596
5596
|
l.node(-1).canReplaceWith(k.index(), k.index() + 1, d) && t.setNodeMarkup(t.mapping.map(l.before()), d);
|
|
5597
5597
|
}
|
|
5598
|
-
r &&
|
|
5598
|
+
r && lr(e, o.extensionManager.splittableMarks), t.scrollIntoView();
|
|
5599
5599
|
}
|
|
5600
5600
|
return m;
|
|
5601
|
-
},
|
|
5601
|
+
}, Cl = (r, t = {}) => ({ tr: e, state: n, dispatch: o, editor: i }) => {
|
|
5602
5602
|
var s;
|
|
5603
5603
|
const l = et(r, n.schema), { $from: a, $to: c } = n.selection, u = n.selection.node;
|
|
5604
5604
|
if (u && u.isBlock || a.depth < 2 || !a.sameParent(c))
|
|
@@ -5615,10 +5615,10 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5615
5615
|
const I = a.index(-1) ? 1 : a.index(-2) ? 2 : 3;
|
|
5616
5616
|
for (let W = a.depth - I; W >= a.depth - 3; W -= 1)
|
|
5617
5617
|
b = x.from(a.node(W).copy(b));
|
|
5618
|
-
const R = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3,
|
|
5619
|
-
...
|
|
5618
|
+
const R = a.indexAfter(-1) < a.node(-2).childCount ? 1 : a.indexAfter(-2) < a.node(-3).childCount ? 2 : 3, L = {
|
|
5619
|
+
...Be(d, a.node().type.name, a.node().attrs),
|
|
5620
5620
|
...t
|
|
5621
|
-
}, H = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(
|
|
5621
|
+
}, H = ((s = l.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(L)) || void 0;
|
|
5622
5622
|
b = b.append(x.from(l.createAndFill(null, H) || void 0));
|
|
5623
5623
|
const Z = a.before(a.depth - (I - 1));
|
|
5624
5624
|
e.replace(Z, a.after(-R), new S(b, 4 - I, 0));
|
|
@@ -5632,10 +5632,10 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5632
5632
|
return !0;
|
|
5633
5633
|
}
|
|
5634
5634
|
const h = c.pos === a.end() ? f.contentMatchAt(0).defaultType : null, m = {
|
|
5635
|
-
...
|
|
5635
|
+
...Be(d, f.type.name, f.attrs),
|
|
5636
5636
|
...t
|
|
5637
5637
|
}, p = {
|
|
5638
|
-
...
|
|
5638
|
+
...Be(d, a.node().type.name, a.node().attrs),
|
|
5639
5639
|
...t
|
|
5640
5640
|
};
|
|
5641
5641
|
e.delete(a.pos, c.pos);
|
|
@@ -5646,15 +5646,15 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5646
5646
|
if (!Mt(e.doc, a.pos, 2))
|
|
5647
5647
|
return !1;
|
|
5648
5648
|
if (o) {
|
|
5649
|
-
const { selection: b, storedMarks: I } = n, { splittableMarks: R } = i.extensionManager,
|
|
5650
|
-
if (e.split(a.pos, 2, k).scrollIntoView(), !
|
|
5649
|
+
const { selection: b, storedMarks: I } = n, { splittableMarks: R } = i.extensionManager, L = I || b.$to.parentOffset && b.$from.marks();
|
|
5650
|
+
if (e.split(a.pos, 2, k).scrollIntoView(), !L || !o)
|
|
5651
5651
|
return !0;
|
|
5652
|
-
const H =
|
|
5652
|
+
const H = L.filter((Z) => R.includes(Z.type.name));
|
|
5653
5653
|
e.ensureMarks(H);
|
|
5654
5654
|
}
|
|
5655
5655
|
return !0;
|
|
5656
|
-
},
|
|
5657
|
-
const e =
|
|
5656
|
+
}, un = (r, t) => {
|
|
5657
|
+
const e = $n((s) => s.type === t)(r.selection);
|
|
5658
5658
|
if (!e)
|
|
5659
5659
|
return !0;
|
|
5660
5660
|
const n = r.doc.resolve(Math.max(0, e.pos - 1)).before(e.depth);
|
|
@@ -5662,8 +5662,8 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5662
5662
|
return !0;
|
|
5663
5663
|
const o = r.doc.nodeAt(n);
|
|
5664
5664
|
return e.node.type === o?.type && qt(r.doc, e.pos) && r.join(e.pos), !0;
|
|
5665
|
-
},
|
|
5666
|
-
const e =
|
|
5665
|
+
}, fn = (r, t) => {
|
|
5666
|
+
const e = $n((s) => s.type === t)(r.selection);
|
|
5667
5667
|
if (!e)
|
|
5668
5668
|
return !0;
|
|
5669
5669
|
const n = r.doc.resolve(e.start).after(e.depth);
|
|
@@ -5671,32 +5671,32 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5671
5671
|
return !0;
|
|
5672
5672
|
const o = r.doc.nodeAt(n);
|
|
5673
5673
|
return e.node.type === o?.type && qt(r.doc, n) && r.join(n), !0;
|
|
5674
|
-
},
|
|
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),
|
|
5674
|
+
}, Tl = (r, t, e, n = {}) => ({ editor: o, tr: i, state: s, dispatch: l, chain: a, commands: c, can: u }) => {
|
|
5675
|
+
const { extensions: f, splittableMarks: d } = o.extensionManager, h = et(r, s.schema), m = et(t, s.schema), { selection: p, storedMarks: k } = s, { $from: b, $to: I } = p, R = b.blockRange(I), L = k || p.$to.parentOffset && p.$from.marks();
|
|
5676
5676
|
if (!R)
|
|
5677
5677
|
return !1;
|
|
5678
|
-
const H =
|
|
5678
|
+
const H = $n((Z) => sr(Z.type.name, f))(p);
|
|
5679
5679
|
if (R.depth >= 1 && H && R.depth - H.depth <= 1) {
|
|
5680
5680
|
if (H.node.type === h)
|
|
5681
5681
|
return c.liftListItem(m);
|
|
5682
|
-
if (
|
|
5683
|
-
return a().command(() => (i.setNodeMarkup(H.pos, h), !0)).command(() =>
|
|
5682
|
+
if (sr(H.node.type.name, f) && h.validContent(H.node.content) && l)
|
|
5683
|
+
return a().command(() => (i.setNodeMarkup(H.pos, h), !0)).command(() => un(i, h)).command(() => fn(i, h)).run();
|
|
5684
5684
|
}
|
|
5685
|
-
return !e || !
|
|
5686
|
-
const Z = u().wrapInList(h, n), at =
|
|
5685
|
+
return !e || !L || !l ? a().command(() => u().wrapInList(h, n) ? !0 : c.clearNodes()).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run() : a().command(() => {
|
|
5686
|
+
const Z = u().wrapInList(h, n), at = L.filter((W) => d.includes(W.type.name));
|
|
5687
5687
|
return i.ensureMarks(at), Z ? !0 : c.clearNodes();
|
|
5688
|
-
}).wrapInList(h, n).command(() =>
|
|
5689
|
-
},
|
|
5688
|
+
}).wrapInList(h, n).command(() => un(i, h)).command(() => fn(i, h)).run();
|
|
5689
|
+
}, Al = (r, t = {}, e = {}) => ({ state: n, commands: o }) => {
|
|
5690
5690
|
const { extendEmptyMarkRange: i = !1 } = e, s = zt(r, n.schema);
|
|
5691
|
-
return
|
|
5692
|
-
},
|
|
5693
|
-
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 = On(n, i, e);
|
|
5694
5694
|
let a;
|
|
5695
5695
|
return n.selection.$anchor.sameParent(n.selection.$head) && (a = n.selection.$anchor.parent.attrs), l ? o.setNode(s, a) : o.setNode(i, { ...a, ...e });
|
|
5696
|
-
},
|
|
5696
|
+
}, El = (r, t = {}) => ({ state: e, commands: n }) => {
|
|
5697
5697
|
const o = et(r, e.schema);
|
|
5698
|
-
return
|
|
5699
|
-
},
|
|
5698
|
+
return On(e, o, t) ? n.lift(o) : n.wrapIn(o, t);
|
|
5699
|
+
}, Nl = () => ({ state: r, dispatch: t }) => {
|
|
5700
5700
|
const e = r.plugins;
|
|
5701
5701
|
for (let n = 0; n < e.length; n += 1) {
|
|
5702
5702
|
const o = e[n];
|
|
@@ -5716,28 +5716,28 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5716
5716
|
}
|
|
5717
5717
|
}
|
|
5718
5718
|
return !1;
|
|
5719
|
-
},
|
|
5719
|
+
}, Il = () => ({ tr: r, dispatch: t }) => {
|
|
5720
5720
|
const { selection: e } = r, { empty: n, ranges: o } = e;
|
|
5721
5721
|
return n || t && o.forEach((i) => {
|
|
5722
5722
|
r.removeMark(i.$from.pos, i.$to.pos);
|
|
5723
5723
|
}), !0;
|
|
5724
|
-
},
|
|
5724
|
+
}, Ol = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5725
5725
|
var i;
|
|
5726
5726
|
const { extendEmptyMarkRange: s = !1 } = t, { selection: l } = e, a = zt(r, n.schema), { $from: c, empty: u, ranges: f } = l;
|
|
5727
5727
|
if (!o)
|
|
5728
5728
|
return !0;
|
|
5729
5729
|
if (u && s) {
|
|
5730
5730
|
let { from: d, to: h } = l;
|
|
5731
|
-
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);
|
|
5732
5732
|
p && (d = p.from, h = p.to), e.removeMark(d, h, a);
|
|
5733
5733
|
} else
|
|
5734
5734
|
f.forEach((d) => {
|
|
5735
5735
|
e.removeMark(d.$from.pos, d.$to.pos, a);
|
|
5736
5736
|
});
|
|
5737
5737
|
return e.removeStoredMark(a), !0;
|
|
5738
|
-
},
|
|
5738
|
+
}, $l = (r, t = {}) => ({ tr: e, state: n, dispatch: o }) => {
|
|
5739
5739
|
let i = null, s = null;
|
|
5740
|
-
const l =
|
|
5740
|
+
const l = uo(typeof r == "string" ? r : r.name, n.schema);
|
|
5741
5741
|
return l ? (l === "node" && (i = et(r, n.schema)), l === "mark" && (s = zt(r, n.schema)), o && e.selection.ranges.forEach((a) => {
|
|
5742
5742
|
const c = a.$from.pos, u = a.$to.pos;
|
|
5743
5743
|
let f, d, h, m;
|
|
@@ -5766,79 +5766,79 @@ const Tl = ({ keepMarks: r = !0 } = {}) => ({ tr: t, state: e, dispatch: n, edit
|
|
|
5766
5766
|
}));
|
|
5767
5767
|
}));
|
|
5768
5768
|
}), !0) : !1;
|
|
5769
|
-
},
|
|
5769
|
+
}, Bl = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5770
5770
|
const o = et(r, e.schema);
|
|
5771
|
-
return
|
|
5772
|
-
},
|
|
5771
|
+
return is(o, t)(e, n);
|
|
5772
|
+
}, Rl = (r, t = {}) => ({ state: e, dispatch: n }) => {
|
|
5773
5773
|
const o = et(r, e.schema);
|
|
5774
|
-
return
|
|
5774
|
+
return ss(o, t)(e, n);
|
|
5775
5775
|
};
|
|
5776
|
-
var
|
|
5776
|
+
var zl = /* @__PURE__ */ Object.freeze({
|
|
5777
5777
|
__proto__: null,
|
|
5778
|
-
blur:
|
|
5779
|
-
clearContent:
|
|
5780
|
-
clearNodes:
|
|
5781
|
-
command:
|
|
5782
|
-
createParagraphNear:
|
|
5783
|
-
cut:
|
|
5784
|
-
deleteCurrentNode:
|
|
5785
|
-
deleteNode:
|
|
5786
|
-
deleteRange:
|
|
5787
|
-
deleteSelection:
|
|
5788
|
-
enter:
|
|
5789
|
-
exitCode:
|
|
5790
|
-
extendMarkRange:
|
|
5791
|
-
first:
|
|
5792
|
-
focus:
|
|
5793
|
-
forEach:
|
|
5794
|
-
insertContent:
|
|
5795
|
-
insertContentAt:
|
|
5796
|
-
joinBackward:
|
|
5797
|
-
joinDown:
|
|
5798
|
-
joinForward:
|
|
5799
|
-
joinItemBackward:
|
|
5800
|
-
joinItemForward:
|
|
5801
|
-
joinTextblockBackward:
|
|
5802
|
-
joinTextblockForward:
|
|
5803
|
-
joinUp:
|
|
5804
|
-
keyboardShortcut:
|
|
5805
|
-
lift:
|
|
5806
|
-
liftEmptyBlock:
|
|
5807
|
-
liftListItem:
|
|
5808
|
-
newlineInCode:
|
|
5809
|
-
resetAttributes:
|
|
5810
|
-
scrollIntoView:
|
|
5811
|
-
selectAll:
|
|
5812
|
-
selectNodeBackward:
|
|
5813
|
-
selectNodeForward:
|
|
5814
|
-
selectParentNode:
|
|
5815
|
-
selectTextblockEnd:
|
|
5816
|
-
selectTextblockStart:
|
|
5817
|
-
setContent:
|
|
5818
|
-
setMark:
|
|
5819
|
-
setMeta:
|
|
5820
|
-
setNode:
|
|
5821
|
-
setNodeSelection:
|
|
5822
|
-
setTextSelection:
|
|
5823
|
-
sinkListItem:
|
|
5824
|
-
splitBlock:
|
|
5825
|
-
splitListItem:
|
|
5826
|
-
toggleList:
|
|
5827
|
-
toggleMark:
|
|
5828
|
-
toggleNode:
|
|
5829
|
-
toggleWrap:
|
|
5830
|
-
undoInputRule:
|
|
5831
|
-
unsetAllMarks:
|
|
5832
|
-
unsetMark:
|
|
5833
|
-
updateAttributes:
|
|
5834
|
-
wrapIn:
|
|
5835
|
-
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: Js,
|
|
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
|
|
5836
5836
|
});
|
|
5837
5837
|
ht.create({
|
|
5838
5838
|
name: "commands",
|
|
5839
5839
|
addCommands() {
|
|
5840
5840
|
return {
|
|
5841
|
-
...
|
|
5841
|
+
...zl
|
|
5842
5842
|
};
|
|
5843
5843
|
}
|
|
5844
5844
|
});
|
|
@@ -5945,7 +5945,7 @@ ht.create({
|
|
|
5945
5945
|
"Ctrl-a": () => this.editor.commands.selectTextblockStart(),
|
|
5946
5946
|
"Ctrl-e": () => this.editor.commands.selectTextblockEnd()
|
|
5947
5947
|
};
|
|
5948
|
-
return
|
|
5948
|
+
return In() || co() ? i : o;
|
|
5949
5949
|
},
|
|
5950
5950
|
addProseMirrorPlugins() {
|
|
5951
5951
|
return [
|
|
@@ -5963,12 +5963,12 @@ ht.create({
|
|
|
5963
5963
|
if (!n || o)
|
|
5964
5964
|
return;
|
|
5965
5965
|
const { empty: i, from: s, to: l } = t.selection, a = $.atStart(t.doc).from, c = $.atEnd(t.doc).to;
|
|
5966
|
-
if (i || !(s === a && l === c) || !
|
|
5966
|
+
if (i || !(s === a && l === c) || !fo(e.doc))
|
|
5967
5967
|
return;
|
|
5968
|
-
const d = e.tr, h =
|
|
5968
|
+
const d = e.tr, h = oo({
|
|
5969
5969
|
state: e,
|
|
5970
5970
|
transaction: d
|
|
5971
|
-
}), { commands: m } = new
|
|
5971
|
+
}), { commands: m } = new hs({
|
|
5972
5972
|
editor: this.editor,
|
|
5973
5973
|
state: h
|
|
5974
5974
|
});
|
|
@@ -6011,7 +6011,7 @@ ht.create({
|
|
|
6011
6011
|
];
|
|
6012
6012
|
}
|
|
6013
6013
|
});
|
|
6014
|
-
const
|
|
6014
|
+
const ar = [
|
|
6015
6015
|
{ border: "#f97316", background: "rgba(254, 243, 199, 0.9)" },
|
|
6016
6016
|
// 0 橙
|
|
6017
6017
|
{ border: "#22c55e", background: "rgba(220, 252, 231, 0.85)" },
|
|
@@ -6052,7 +6052,7 @@ const fr = [
|
|
|
6052
6052
|
// 18 深青
|
|
6053
6053
|
{ border: "#64748b", background: "rgba(241, 245, 249, 0.9)" }
|
|
6054
6054
|
// 19 灰蓝
|
|
6055
|
-
],
|
|
6055
|
+
], Pl = je.create({
|
|
6056
6056
|
name: "comment",
|
|
6057
6057
|
addAttributes() {
|
|
6058
6058
|
return {
|
|
@@ -6078,7 +6078,7 @@ const fr = [
|
|
|
6078
6078
|
return [{ tag: "span[data-comment-id]" }];
|
|
6079
6079
|
},
|
|
6080
6080
|
renderHTML({ HTMLAttributes: r }) {
|
|
6081
|
-
const t = r.colorIndex ?? r["data-comment-color"] ?? 0, e = Number.parseInt(t, 10), n = Number.isNaN(e) || !Number.isFinite(e) ? 0 : (e % tt + tt) % tt, o =
|
|
6081
|
+
const t = r.colorIndex ?? r["data-comment-color"] ?? 0, e = Number.parseInt(t, 10), n = Number.isNaN(e) || !Number.isFinite(e) ? 0 : (e % tt + tt) % tt, o = ar[n] || ar[0], i = o.border, s = o.background;
|
|
6082
6082
|
return [
|
|
6083
6083
|
"span",
|
|
6084
6084
|
{
|
|
@@ -6120,11 +6120,11 @@ const fr = [
|
|
|
6120
6120
|
}
|
|
6121
6121
|
};
|
|
6122
6122
|
}
|
|
6123
|
-
}),
|
|
6123
|
+
}), Fl = {
|
|
6124
6124
|
class: "comment-gutter",
|
|
6125
6125
|
style: { "margin-top": "-100px" },
|
|
6126
6126
|
"aria-label": "批注贴行栏"
|
|
6127
|
-
},
|
|
6127
|
+
}, _l = ["onClick", "onKeydown"], Dl = { class: "gutter-item__quote" }, Ll = { class: "gutter-item__note" }, Jl = { class: "gutter-item__meta" }, Wl = { class: "gutter-item__author" }, jl = { class: "gutter-item__time" }, Vl = {
|
|
6128
6128
|
__name: "CommentGutter",
|
|
6129
6129
|
props: {
|
|
6130
6130
|
anchors: { type: Array, default: () => [] },
|
|
@@ -6144,18 +6144,18 @@ const fr = [
|
|
|
6144
6144
|
const c = String(l);
|
|
6145
6145
|
return c.length > a ? c.slice(0, a) + "…" : c;
|
|
6146
6146
|
}, n = z([]);
|
|
6147
|
-
|
|
6147
|
+
hn(
|
|
6148
6148
|
() => ({ anchors: t.anchors, commentsLen: (t.comments || []).length }),
|
|
6149
6149
|
({ anchors: l, commentsLen: a }) => {
|
|
6150
6150
|
!l || !l.length || a && (!n.value.length || n.value.length < a) && l.length >= a && (n.value = l.slice());
|
|
6151
6151
|
},
|
|
6152
6152
|
{ immediate: !0 }
|
|
6153
6153
|
);
|
|
6154
|
-
const o =
|
|
6154
|
+
const o = Ne(() => {
|
|
6155
6155
|
const l = /* @__PURE__ */ new Map();
|
|
6156
6156
|
for (const a of t.comments || []) l.set(a.id, a);
|
|
6157
6157
|
return l;
|
|
6158
|
-
}), i =
|
|
6158
|
+
}), i = Ne(() => {
|
|
6159
6159
|
const l = [], a = n.value.length ? n.value : t.anchors || [];
|
|
6160
6160
|
for (const c of a) {
|
|
6161
6161
|
const u = o.value.get(c.id);
|
|
@@ -6171,7 +6171,7 @@ const fr = [
|
|
|
6171
6171
|
});
|
|
6172
6172
|
}
|
|
6173
6173
|
return l.sort((c, u) => c.anchorTop - u.anchorTop);
|
|
6174
|
-
}), s =
|
|
6174
|
+
}), s = Ne(() => {
|
|
6175
6175
|
const l = [];
|
|
6176
6176
|
let a = 0;
|
|
6177
6177
|
const c = t.itemHeight, u = t.minGap;
|
|
@@ -6181,14 +6181,14 @@ const fr = [
|
|
|
6181
6181
|
}
|
|
6182
6182
|
return l;
|
|
6183
6183
|
});
|
|
6184
|
-
return (l, a) => (q(), rt("div",
|
|
6185
|
-
(q(!0), rt(
|
|
6184
|
+
return (l, a) => (q(), rt("div", Fl, [
|
|
6185
|
+
(q(!0), rt(hr, null, pr(s.value, (c) => (q(), rt("div", {
|
|
6186
6186
|
key: c.id,
|
|
6187
6187
|
class: "gutter-item-wrapper",
|
|
6188
|
-
style:
|
|
6188
|
+
style: Co({ marginTop: `${c.marginTop}px` })
|
|
6189
6189
|
}, [
|
|
6190
6190
|
y("div", {
|
|
6191
|
-
class:
|
|
6191
|
+
class: mr(["gutter-item", [
|
|
6192
6192
|
`gutter-item--c${c.colorIndex ?? 0}`,
|
|
6193
6193
|
{
|
|
6194
6194
|
"gutter-item--active": r.activeCommentId === c.id,
|
|
@@ -6198,19 +6198,19 @@ const fr = [
|
|
|
6198
6198
|
role: "button",
|
|
6199
6199
|
tabindex: "0",
|
|
6200
6200
|
onClick: (u) => l.$emit("activate", c.id),
|
|
6201
|
-
onKeydown:
|
|
6201
|
+
onKeydown: dn(ze((u) => l.$emit("activate", c.id), ["prevent"]), ["enter"])
|
|
6202
6202
|
}, [
|
|
6203
|
-
y("div",
|
|
6204
|
-
y("div",
|
|
6205
|
-
y("div",
|
|
6206
|
-
y("span",
|
|
6207
|
-
y("span",
|
|
6203
|
+
y("div", Dl, Y(e(c.selectedText, 28)), 1),
|
|
6204
|
+
y("div", Ll, Y(e(c.note, 36)), 1),
|
|
6205
|
+
y("div", Jl, [
|
|
6206
|
+
y("span", Wl, Y(c.author), 1),
|
|
6207
|
+
y("span", jl, Y(r.formatTime(c.createdAt)), 1)
|
|
6208
6208
|
])
|
|
6209
|
-
], 42,
|
|
6209
|
+
], 42, _l)
|
|
6210
6210
|
], 4))), 128))
|
|
6211
6211
|
]));
|
|
6212
6212
|
}
|
|
6213
|
-
},
|
|
6213
|
+
}, ql = /* @__PURE__ */ He(Vl, [["__scopeId", "data-v-ac6164bd"]]), Hl = new Rt("commentGutter"), Ul = ht.create({
|
|
6214
6214
|
name: "commentGutter",
|
|
6215
6215
|
addOptions() {
|
|
6216
6216
|
return {
|
|
@@ -6232,7 +6232,7 @@ const fr = [
|
|
|
6232
6232
|
const r = this.options.getStageEl, t = this.options.getScrollEl, e = this.options.onAnchors, n = this.options.mountGutter;
|
|
6233
6233
|
return [
|
|
6234
6234
|
new Bt({
|
|
6235
|
-
key:
|
|
6235
|
+
key: Hl,
|
|
6236
6236
|
view: (o) => {
|
|
6237
6237
|
let i = !1, s = null, l = !1;
|
|
6238
6238
|
const a = () => {
|
|
@@ -6258,12 +6258,12 @@ const fr = [
|
|
|
6258
6258
|
if (!u) return;
|
|
6259
6259
|
const f = r?.(), h = t?.() || f || u, m = h.getBoundingClientRect(), p = typeof h.scrollTop == "number" ? h.scrollTop : 0, k = u.querySelectorAll("span[data-comment-id]") || [], b = /* @__PURE__ */ new Map();
|
|
6260
6260
|
k.forEach((R) => {
|
|
6261
|
-
const
|
|
6262
|
-
if (!
|
|
6261
|
+
const L = R.getAttribute("data-comment-id");
|
|
6262
|
+
if (!L) return;
|
|
6263
6263
|
const H = R.getClientRects()[0] || R.getBoundingClientRect();
|
|
6264
6264
|
if (!H) return;
|
|
6265
|
-
const Z = H.top - m.top + p, at = H.height || 0, W = b.get(
|
|
6266
|
-
(!W || Z < W.top) && b.set(
|
|
6265
|
+
const Z = H.top - m.top + p, at = H.height || 0, W = b.get(L);
|
|
6266
|
+
(!W || Z < W.top) && b.set(L, { id: L, top: Z, height: at });
|
|
6267
6267
|
});
|
|
6268
6268
|
const I = Array.from(b.values());
|
|
6269
6269
|
e?.(I);
|
|
@@ -6280,19 +6280,19 @@ const fr = [
|
|
|
6280
6280
|
})
|
|
6281
6281
|
];
|
|
6282
6282
|
}
|
|
6283
|
-
})
|
|
6284
|
-
async function
|
|
6285
|
-
const t = await r.arrayBuffer(), e = await
|
|
6283
|
+
});
|
|
6284
|
+
async function Gl(r) {
|
|
6285
|
+
const t = await r.arrayBuffer(), e = await wr.loadAsync(t), n = e.file("word/comments.xml");
|
|
6286
6286
|
if (!n) return [];
|
|
6287
|
-
const o = await n.async("text"), i =
|
|
6287
|
+
const o = await n.async("text"), i = cr(o), s = /* @__PURE__ */ new Map(), l = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", a = i.getElementsByTagNameNS(l, "comment");
|
|
6288
6288
|
for (const p of a) {
|
|
6289
|
-
const k = p.getAttribute("w:id"), b = p.getAttribute("w:author") || "", I = p.getAttribute("w:date") || "", R =
|
|
6289
|
+
const k = p.getAttribute("w:id"), b = p.getAttribute("w:author") || "", I = p.getAttribute("w:date") || "", R = Kl(p, l);
|
|
6290
6290
|
s.set(k, { author: b, date: I, note: R });
|
|
6291
6291
|
}
|
|
6292
6292
|
if (s.size === 0) return [];
|
|
6293
6293
|
const c = e.file("word/document.xml");
|
|
6294
|
-
if (!c) return
|
|
6295
|
-
const u = await c.async("text"), f =
|
|
6294
|
+
if (!c) return Zl(s);
|
|
6295
|
+
const u = await c.async("text"), f = cr(u), { selectedTextMap: d, containsDelTextMap: h } = Xl(f, l), m = [];
|
|
6296
6296
|
for (const [p, k] of s)
|
|
6297
6297
|
m.push({
|
|
6298
6298
|
wordId: p,
|
|
@@ -6304,17 +6304,17 @@ async function Zl(r) {
|
|
|
6304
6304
|
});
|
|
6305
6305
|
return m;
|
|
6306
6306
|
}
|
|
6307
|
-
function
|
|
6307
|
+
function cr(r) {
|
|
6308
6308
|
return new DOMParser().parseFromString(r, "application/xml");
|
|
6309
6309
|
}
|
|
6310
|
-
function
|
|
6310
|
+
function Kl(r, t) {
|
|
6311
6311
|
return [...r.getElementsByTagNameNS(t, "t")].map((n) => n.textContent).join("");
|
|
6312
6312
|
}
|
|
6313
|
-
function
|
|
6313
|
+
function Xl(r, t) {
|
|
6314
6314
|
const e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), s = r.getElementsByTagNameNS(t, "body")[0];
|
|
6315
|
-
return s ? (
|
|
6315
|
+
return s ? (ho(s, t, o, i, e, n), { selectedTextMap: e, containsDelTextMap: n }) : { selectedTextMap: e, containsDelTextMap: n };
|
|
6316
6316
|
}
|
|
6317
|
-
function
|
|
6317
|
+
function ho(r, t, e, n, o, i) {
|
|
6318
6318
|
for (const s of r.childNodes) {
|
|
6319
6319
|
const l = s.localName;
|
|
6320
6320
|
if (l === "commentRangeStart") {
|
|
@@ -6331,10 +6331,10 @@ function mo(r, t, e, n, o, i) {
|
|
|
6331
6331
|
if (l === "delText")
|
|
6332
6332
|
for (const c of n.keys())
|
|
6333
6333
|
n.set(c, !0);
|
|
6334
|
-
} 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);
|
|
6335
6335
|
}
|
|
6336
6336
|
}
|
|
6337
|
-
function
|
|
6337
|
+
function Zl(r) {
|
|
6338
6338
|
return [...r.entries()].map(([t, e]) => ({
|
|
6339
6339
|
wordId: t,
|
|
6340
6340
|
author: e.author,
|
|
@@ -6343,15 +6343,15 @@ function ta(r) {
|
|
|
6343
6343
|
selectedText: ""
|
|
6344
6344
|
}));
|
|
6345
6345
|
}
|
|
6346
|
-
const
|
|
6347
|
-
async function
|
|
6348
|
-
const t = await r.arrayBuffer(), e = await
|
|
6349
|
-
return await
|
|
6346
|
+
const po = "http://schemas.openxmlformats.org/wordprocessingml/2006/main", Ql = "http://schemas.openxmlformats.org/officeDocument/2006/relationships";
|
|
6347
|
+
async function Yl(r) {
|
|
6348
|
+
const t = await r.arrayBuffer(), e = await wr.loadAsync(t), n = await ta(e), o = await ea(e);
|
|
6349
|
+
return await na(e, n, o);
|
|
6350
6350
|
}
|
|
6351
|
-
async function
|
|
6351
|
+
async function ta(r) {
|
|
6352
6352
|
const t = r.file("word/styles.xml");
|
|
6353
6353
|
if (!t) return /* @__PURE__ */ new Map();
|
|
6354
|
-
const e = await t.async("text"), n =
|
|
6354
|
+
const e = await t.async("text"), n = Rn(e), o = /* @__PURE__ */ new Map(), i = n.getElementsByTagNameNS(po, "style");
|
|
6355
6355
|
for (const a of i) {
|
|
6356
6356
|
const c = a.getAttribute("w:styleId");
|
|
6357
6357
|
if (!c) continue;
|
|
@@ -6359,8 +6359,8 @@ async function oa(r) {
|
|
|
6359
6359
|
const f = v(a, "basedOn")?.getAttribute("w:val") || null, d = v(a, "rPr"), h = v(a, "pPr");
|
|
6360
6360
|
o.set(c, {
|
|
6361
6361
|
basedOn: f,
|
|
6362
|
-
rProps: d ?
|
|
6363
|
-
pProps: h ?
|
|
6362
|
+
rProps: d ? Bn(d) : {},
|
|
6363
|
+
pProps: h ? wo(h) : {},
|
|
6364
6364
|
name: v(a, "name")?.getAttribute("w:val") || ""
|
|
6365
6365
|
});
|
|
6366
6366
|
}
|
|
@@ -6382,38 +6382,38 @@ async function oa(r) {
|
|
|
6382
6382
|
for (const a of o.keys()) l(a);
|
|
6383
6383
|
return s;
|
|
6384
6384
|
}
|
|
6385
|
-
async function
|
|
6385
|
+
async function ea(r) {
|
|
6386
6386
|
const t = r.file("word/_rels/document.xml.rels");
|
|
6387
6387
|
if (!t) return /* @__PURE__ */ new Map();
|
|
6388
|
-
const e = await t.async("text"), n =
|
|
6388
|
+
const e = await t.async("text"), n = Rn(e), o = /* @__PURE__ */ new Map(), i = n.getElementsByTagName("Relationship");
|
|
6389
6389
|
for (const s of i)
|
|
6390
6390
|
o.set(s.getAttribute("Id"), s.getAttribute("Target"));
|
|
6391
6391
|
return o;
|
|
6392
6392
|
}
|
|
6393
|
-
async function
|
|
6393
|
+
async function na(r, t, e) {
|
|
6394
6394
|
const n = r.file("word/document.xml");
|
|
6395
6395
|
if (!n) return "<p></p>";
|
|
6396
|
-
const o = await n.async("text"), s =
|
|
6396
|
+
const o = await n.async("text"), s = Rn(o).getElementsByTagNameNS(po, "body")[0];
|
|
6397
6397
|
if (!s) return "<p></p>";
|
|
6398
|
-
const l = v(s, "sectPr"), a = l ?
|
|
6398
|
+
const l = v(s, "sectPr"), a = l ? ur(l) : { count: 1, gap: 720, widths: [] }, c = ra(l), u = [];
|
|
6399
6399
|
let f = { colInfo: null, nodes: [] };
|
|
6400
6400
|
for (const h of s.childNodes) {
|
|
6401
6401
|
if (h.nodeType !== 1) continue;
|
|
6402
6402
|
const m = h.localName;
|
|
6403
6403
|
if (m === "p") {
|
|
6404
6404
|
const p = v(h, "pPr"), k = p ? v(p, "sectPr") : null;
|
|
6405
|
-
f.nodes.push({ type: "p", node: h }), k && (f.colInfo =
|
|
6405
|
+
f.nodes.push({ type: "p", node: h }), k && (f.colInfo = ur(k), u.push(f), f = { colInfo: null, nodes: [] });
|
|
6406
6406
|
} else m === "tbl" && f.nodes.push({ type: "tbl", node: h });
|
|
6407
6407
|
}
|
|
6408
6408
|
f.nodes.length && (f.colInfo = a, u.push(f));
|
|
6409
6409
|
let d = "";
|
|
6410
6410
|
for (const h of u) {
|
|
6411
6411
|
const m = h.colInfo || { count: 1 };
|
|
6412
|
-
m.count > 1 ? d +=
|
|
6412
|
+
m.count > 1 ? d += oa(h.nodes, m, t, e, c) : d += mo(h.nodes, t, e, c);
|
|
6413
6413
|
}
|
|
6414
6414
|
return d || "<p></p>";
|
|
6415
6415
|
}
|
|
6416
|
-
function
|
|
6416
|
+
function ra(r) {
|
|
6417
6417
|
if (!r) return 0;
|
|
6418
6418
|
const t = v(r, "pgSz");
|
|
6419
6419
|
if (!t) return 0;
|
|
@@ -6422,7 +6422,7 @@ function la(r) {
|
|
|
6422
6422
|
const n = v(r, "pgMar"), o = n && parseInt(n.getAttribute("w:left"), 10) || 0, i = n && parseInt(n.getAttribute("w:right"), 10) || 0;
|
|
6423
6423
|
return Math.max(e - o - i, 1);
|
|
6424
6424
|
}
|
|
6425
|
-
function
|
|
6425
|
+
function ur(r) {
|
|
6426
6426
|
const t = v(r, "cols");
|
|
6427
6427
|
if (!t) return { count: 1, gap: 720, widths: [] };
|
|
6428
6428
|
const e = parseInt(t.getAttribute("w:num"), 10) || 1, n = parseInt(t.getAttribute("w:space"), 10) || 720, o = [...t.childNodes].filter(
|
|
@@ -6435,18 +6435,18 @@ function hr(r) {
|
|
|
6435
6435
|
}
|
|
6436
6436
|
return { count: e, gap: n, widths: i };
|
|
6437
6437
|
}
|
|
6438
|
-
function
|
|
6438
|
+
function oa(r, t, e, n, o = 0) {
|
|
6439
6439
|
const { count: i, widths: s } = t, l = Array.from({ length: i }, () => []);
|
|
6440
6440
|
let a = 0;
|
|
6441
6441
|
for (const d of r)
|
|
6442
|
-
a >= i && (a = i - 1), d.type === "p" &&
|
|
6442
|
+
a >= i && (a = i - 1), d.type === "p" && ia(d.node) ? (l[a].push({ ...d, stripColBreak: !0 }), a < i - 1 && a++) : l[a].push(d);
|
|
6443
6443
|
const u = `<colgroup data-word-col-layout="1">${Array.from({ length: i }, (d, h) => `<col style="width:${s[h] ? `${s[h]}%` : `${(100 / i).toFixed(2)}%`}"/>`).join("")}</colgroup>`, f = l.map((d, h) => {
|
|
6444
|
-
const m =
|
|
6444
|
+
const m = mo(d, e, n, o);
|
|
6445
6445
|
return `<td style="${s[h] ? `width:${s[h]}%;` : `width:${(100 / i).toFixed(2)}%;`}vertical-align:top;padding:0 4px;">${m || "<p></p>"}</td>`;
|
|
6446
6446
|
});
|
|
6447
6447
|
return `<table style="width:100%;border-collapse:collapse;table-layout:fixed;">${u}<tr>${f.join("")}</tr></table>`;
|
|
6448
6448
|
}
|
|
6449
|
-
function
|
|
6449
|
+
function ia(r) {
|
|
6450
6450
|
for (const t of r.childNodes)
|
|
6451
6451
|
if (!(t.nodeType !== 1 || t.localName !== "r")) {
|
|
6452
6452
|
for (const e of t.childNodes)
|
|
@@ -6455,66 +6455,66 @@ function ca(r) {
|
|
|
6455
6455
|
}
|
|
6456
6456
|
return !1;
|
|
6457
6457
|
}
|
|
6458
|
-
function
|
|
6458
|
+
function mo(r, t, e, n = 0) {
|
|
6459
6459
|
let o = "", i = [];
|
|
6460
6460
|
for (const { type: s, node: l, stripColBreak: a } of r)
|
|
6461
6461
|
if (s === "p") {
|
|
6462
|
-
const { tag: c, pStyle: u, isList: f, content: d } =
|
|
6462
|
+
const { tag: c, pStyle: u, isList: f, content: d } = go(l, t, e, a);
|
|
6463
6463
|
f ? i.push(`<li${u}>${d}</li>`) : (i.length && (o += `<ul>${i.join("")}</ul>`, i = []), o += `<${c}${u}>${d}</${c}>`);
|
|
6464
|
-
} 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));
|
|
6465
6465
|
return i.length && (o += `<ul>${i.join("")}</ul>`), o;
|
|
6466
6466
|
}
|
|
6467
|
-
function
|
|
6468
|
-
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 = {
|
|
6469
6469
|
...l.rProps || {},
|
|
6470
|
-
...u ?
|
|
6471
|
-
}, h = (o ? v(o, "numPr") : null) !== null || s === "ListParagraph" || l.name && /list/i.test(l.name), m =
|
|
6470
|
+
...u ? Bn(u) : {}
|
|
6471
|
+
}, h = (o ? v(o, "numPr") : null) !== null || s === "ListParagraph" || l.name && /list/i.test(l.name), m = ha(s, l.name), p = m ? `h${m}` : "p", k = da(c), b = k ? ` style="${k}"` : "", I = Re(r, f, t, e, n);
|
|
6472
6472
|
return { tag: p, pStyle: b, isList: h, content: I };
|
|
6473
6473
|
}
|
|
6474
|
-
function
|
|
6474
|
+
function Re(r, t, e, n, o = !1) {
|
|
6475
6475
|
let i = "";
|
|
6476
6476
|
for (const s of r.childNodes) {
|
|
6477
6477
|
if (s.nodeType !== 1) continue;
|
|
6478
6478
|
const l = s.localName;
|
|
6479
6479
|
if (l === "r") {
|
|
6480
|
-
if (o &&
|
|
6481
|
-
i +=
|
|
6480
|
+
if (o && sa(s)) continue;
|
|
6481
|
+
i += la(s, t);
|
|
6482
6482
|
} else if (l === "hyperlink") {
|
|
6483
|
-
const a = s.getAttribute("r:id") || s.getAttributeNS(
|
|
6484
|
-
i += `<a href="${
|
|
6483
|
+
const a = s.getAttribute("r:id") || s.getAttributeNS(Ql, "id"), c = a && n.get(a) || "#", u = Re(s, t, e, n, o);
|
|
6484
|
+
i += `<a href="${xn(c)}">${u}</a>`;
|
|
6485
6485
|
} else if (l === "ins") {
|
|
6486
|
-
const a =
|
|
6486
|
+
const a = Re(s, t, e, n, o);
|
|
6487
6487
|
a && (i += `<span data-word-rev="ins" style="background:rgba(255,230,150,.6);">${a}</span>`);
|
|
6488
6488
|
} else if (l === "del") {
|
|
6489
|
-
const a =
|
|
6489
|
+
const a = Re(s, t, e, n, o);
|
|
6490
6490
|
a && (i += `<span data-word-rev="del" style="text-decoration:line-through;">${a}</span>`);
|
|
6491
6491
|
}
|
|
6492
6492
|
}
|
|
6493
6493
|
return i;
|
|
6494
6494
|
}
|
|
6495
|
-
function
|
|
6495
|
+
function sa(r) {
|
|
6496
6496
|
for (const t of r.childNodes)
|
|
6497
6497
|
if (t.nodeType === 1 && t.localName === "br" && t.getAttribute("w:type") === "column")
|
|
6498
6498
|
return !0;
|
|
6499
6499
|
return !1;
|
|
6500
6500
|
}
|
|
6501
|
-
function
|
|
6502
|
-
const e = v(r, "rPr"), n = e ?
|
|
6501
|
+
function la(r, t) {
|
|
6502
|
+
const e = v(r, "rPr"), n = e ? Bn(e) : {}, o = { ...t, ...n };
|
|
6503
6503
|
let i = "";
|
|
6504
6504
|
for (const f of r.childNodes)
|
|
6505
6505
|
f.nodeType === 1 && (f.localName === "t" || f.localName === "delText" ? i += f.textContent : f.localName === "br" ? f.getAttribute("w:type") !== "column" && (i += `
|
|
6506
6506
|
`) : f.localName === "tab" && (i += " "));
|
|
6507
6507
|
if (!i) return "";
|
|
6508
6508
|
const a = i.split(`
|
|
6509
|
-
`).map((f) => /^[ \t]+$/.test(f) ? f.replace(/ /g, " ").replace(/\t/g, " ") :
|
|
6509
|
+
`).map((f) => /^[ \t]+$/.test(f) ? f.replace(/ /g, " ").replace(/\t/g, " ") : xo(f)).join("<br/>"), c = fa(o);
|
|
6510
6510
|
let u = "";
|
|
6511
|
-
return o.lang && (u += ` data-word-lang="${
|
|
6511
|
+
return o.lang && (u += ` data-word-lang="${xn(String(o.lang))}"`), o.langEastAsia && (u += ` data-word-lang-eastAsia="${xn(String(o.langEastAsia))}"`), o.noProof && (u += ' data-word-no-proof="1"'), c || u ? `<span${c ? ` style="${c}"` : ""}${u}>${a}</span>` : a;
|
|
6512
6512
|
}
|
|
6513
|
-
function
|
|
6514
|
-
const o = v(r, "tblPr"), i =
|
|
6513
|
+
function yo(r, t, e, n = 0) {
|
|
6514
|
+
const o = v(r, "tblPr"), i = aa(o), s = ca(o), l = o ? v(o, "tblW") : null, a = l?.getAttribute("w:type") || "", c = l && parseInt(l.getAttribute("w:w"), 10) || 0;
|
|
6515
6515
|
let u = "100%";
|
|
6516
6516
|
a === "pct" && c > 0 ? u = `${(c / 50).toFixed(1)}%` : a === "dxa" && c > 0 && n > 0 && (u = `${Math.min(c / n * 100, 100).toFixed(1)}%`);
|
|
6517
|
-
const f = o ? v(o, "tblCellMar") : null, d =
|
|
6517
|
+
const f = o ? v(o, "tblCellMar") : null, d = fr(f) ?? { top: 0, right: 108, bottom: 0, left: 108 }, h = v(r, "tblGrid"), m = [];
|
|
6518
6518
|
if (h) {
|
|
6519
6519
|
for (const T of h.childNodes)
|
|
6520
6520
|
if (T.nodeType === 1 && T.localName === "gridCol") {
|
|
@@ -6554,8 +6554,8 @@ function xo(r, t, e, n = 0) {
|
|
|
6554
6554
|
} else
|
|
6555
6555
|
I = 1;
|
|
6556
6556
|
const R = b > 0 && p.length > 0 ? p.map((T) => (T / b * 100).toFixed(2)) : Array.from({ length: I }, () => (100 / I).toFixed(2));
|
|
6557
|
-
let
|
|
6558
|
-
R.length && (
|
|
6557
|
+
let L = "";
|
|
6558
|
+
R.length && (L = `<colgroup>${R.map((O) => `<col style="width:${O}%"/>`).join("")}</colgroup>`);
|
|
6559
6559
|
const Z = (o ? v(o, "jc") : null)?.getAttribute("w:val") || "left", at = `border-collapse:collapse;table-layout:fixed;width:${u};${Z === "center" ? "margin:0 auto;" : ""}`, W = [];
|
|
6560
6560
|
for (const T of r.childNodes) {
|
|
6561
6561
|
if (T.nodeType !== 1 || T.localName !== "tr") continue;
|
|
@@ -6589,23 +6589,23 @@ function xo(r, t, e, n = 0) {
|
|
|
6589
6589
|
let O = "";
|
|
6590
6590
|
for (const B of T) {
|
|
6591
6591
|
if (B.vMerge === "continue") continue;
|
|
6592
|
-
const { tc: U, tcPrEl: j, colspan: ot, rowspan: wt = 1 } = B, Ut =
|
|
6592
|
+
const { tc: U, tcPrEl: j, colspan: ot, rowspan: wt = 1 } = B, Ut = ua(j, i) ? "border:1px solid #d0d0d0;" : "border:none;", Ft = (j ? v(j, "vAlign") : null)?.getAttribute("w:val") || "top", Xe = Ft === "center" ? "middle" : Ft === "bottom" ? "bottom" : "top", me = j ? v(j, "tcMar") : null, vt = fr(me) ?? d, te = Ee(vt.top ?? d.top ?? 0), Gt = Ee(vt.right ?? d.right ?? 108), Ze = Ee(vt.bottom ?? d.bottom ?? 0), Qe = Ee(vt.left ?? d.left ?? 108), Kt = `padding:${te}px ${Gt}px ${Ze}px ${Qe}px;`;
|
|
6593
6593
|
let ee = "";
|
|
6594
6594
|
for (const Et of U.childNodes)
|
|
6595
6595
|
if (Et.nodeType === 1)
|
|
6596
6596
|
if (Et.localName === "p") {
|
|
6597
|
-
const { tag: ye, pStyle:
|
|
6598
|
-
ee += `<${ye}${
|
|
6599
|
-
} else Et.localName === "tbl" && (ee +=
|
|
6597
|
+
const { tag: ye, pStyle: Ye, content: tn } = go(Et, t, e);
|
|
6598
|
+
ee += `<${ye}${Ye}>${tn}</${ye}>`;
|
|
6599
|
+
} else Et.localName === "tbl" && (ee += yo(Et, t, e, n));
|
|
6600
6600
|
const ge = ot > 1 ? ` colspan="${ot}"` : "", pt = wt > 1 ? ` rowspan="${wt}"` : "";
|
|
6601
|
-
O += `<td${ge}${pt} style="${Ut}${Kt}vertical-align:${
|
|
6601
|
+
O += `<td${ge}${pt} style="${Ut}${Kt}vertical-align:${Xe};">${ee}</td>`;
|
|
6602
6602
|
}
|
|
6603
6603
|
Ht += `<tr>${O}</tr>`;
|
|
6604
6604
|
}
|
|
6605
|
-
const
|
|
6606
|
-
return `<table style="${at}"${
|
|
6605
|
+
const Ke = s ? ` data-word-tbl-borders='${JSON.stringify(s)}'` : "";
|
|
6606
|
+
return `<table style="${at}"${Ke}>${L}${Ht}</table>`;
|
|
6607
6607
|
}
|
|
6608
|
-
function
|
|
6608
|
+
function aa(r) {
|
|
6609
6609
|
if (!r) return !0;
|
|
6610
6610
|
const t = v(r, "tblBorders");
|
|
6611
6611
|
if (!t) return !0;
|
|
@@ -6623,7 +6623,7 @@ function da(r) {
|
|
|
6623
6623
|
}
|
|
6624
6624
|
return !n;
|
|
6625
6625
|
}
|
|
6626
|
-
function
|
|
6626
|
+
function ca(r) {
|
|
6627
6627
|
if (!r) return null;
|
|
6628
6628
|
const t = v(r, "tblBorders");
|
|
6629
6629
|
if (!t) return null;
|
|
@@ -6632,7 +6632,7 @@ function ha(r) {
|
|
|
6632
6632
|
const n = e.getAttribute("w:val") || "", o = e.getAttribute("w:sz") || "", i = e.getAttribute("w:color") || "", s = e.getAttribute("w:space") || "";
|
|
6633
6633
|
return { val: n, sz: o, color: i, space: s };
|
|
6634
6634
|
}
|
|
6635
|
-
function
|
|
6635
|
+
function ua(r, t) {
|
|
6636
6636
|
if (!r) return t;
|
|
6637
6637
|
const e = v(r, "tcBorders");
|
|
6638
6638
|
if (!e) return t;
|
|
@@ -6650,7 +6650,7 @@ function pa(r, t) {
|
|
|
6650
6650
|
}
|
|
6651
6651
|
return !o;
|
|
6652
6652
|
}
|
|
6653
|
-
function
|
|
6653
|
+
function fr(r) {
|
|
6654
6654
|
if (!r) return null;
|
|
6655
6655
|
const t = {};
|
|
6656
6656
|
for (const e of ["top", "right", "bottom", "left"]) {
|
|
@@ -6662,10 +6662,10 @@ function pr(r) {
|
|
|
6662
6662
|
}
|
|
6663
6663
|
return Object.keys(t).length > 0 ? t : null;
|
|
6664
6664
|
}
|
|
6665
|
-
function
|
|
6665
|
+
function Ee(r) {
|
|
6666
6666
|
return Math.round(r / 15);
|
|
6667
6667
|
}
|
|
6668
|
-
function
|
|
6668
|
+
function Bn(r) {
|
|
6669
6669
|
const t = {}, e = v(r, "rFonts");
|
|
6670
6670
|
if (e) {
|
|
6671
6671
|
const f = e.getAttribute("w:eastAsia") || e.getAttribute("w:ascii") || e.getAttribute("w:hAnsi") || e.getAttribute("w:cs") || "";
|
|
@@ -6708,7 +6708,7 @@ function Pn(r) {
|
|
|
6708
6708
|
}
|
|
6709
6709
|
return v(r, "noProof") && (t.noProof = !0), t;
|
|
6710
6710
|
}
|
|
6711
|
-
function
|
|
6711
|
+
function wo(r) {
|
|
6712
6712
|
const t = {}, e = v(r, "jc");
|
|
6713
6713
|
if (e) {
|
|
6714
6714
|
const i = e.getAttribute("w:val") || "", s = { left: "left", center: "center", right: "right", both: "justify", distribute: "justify" };
|
|
@@ -6740,17 +6740,17 @@ function ko(r) {
|
|
|
6740
6740
|
}
|
|
6741
6741
|
return t;
|
|
6742
6742
|
}
|
|
6743
|
-
function
|
|
6743
|
+
function fa(r) {
|
|
6744
6744
|
const t = [];
|
|
6745
6745
|
r.fontFamily && t.push(`font-family:${r.fontFamily}`), r.fontSize && t.push(`font-size:${r.fontSize}`), r.bold && t.push("font-weight:bold"), r.italic && t.push("font-style:italic");
|
|
6746
6746
|
const e = [];
|
|
6747
6747
|
return r.underline && e.push("underline"), r.strike && e.push("line-through"), e.length && t.push(`text-decoration:${e.join(" ")}`), r.color && t.push(`color:${r.color}`), t.join(";");
|
|
6748
6748
|
}
|
|
6749
|
-
function
|
|
6749
|
+
function da(r) {
|
|
6750
6750
|
const t = [];
|
|
6751
6751
|
return r.textAlign && r.textAlign !== "left" && t.push(`text-align:${r.textAlign}`), r.paddingLeft && t.push(`padding-left:${r.paddingLeft}`), r.lineHeight ? t.push(`line-height:${r.lineHeight}`) : r.lineHeightPx && t.push(`line-height:${r.lineHeightPx}`), r.marginTop && t.push(`margin-top:${r.marginTop}`), r.marginBottom && t.push(`margin-bottom:${r.marginBottom}`), t.join(";");
|
|
6752
6752
|
}
|
|
6753
|
-
const
|
|
6753
|
+
const dr = {
|
|
6754
6754
|
Heading1: 1,
|
|
6755
6755
|
Heading2: 2,
|
|
6756
6756
|
Heading3: 3,
|
|
@@ -6764,8 +6764,8 @@ const mr = {
|
|
|
6764
6764
|
5: 5,
|
|
6765
6765
|
6: 6
|
|
6766
6766
|
};
|
|
6767
|
-
function
|
|
6768
|
-
if (
|
|
6767
|
+
function ha(r, t) {
|
|
6768
|
+
if (dr[r] !== void 0) return dr[r];
|
|
6769
6769
|
const e = r.match(/^Heading(\d)$/i) || r.match(/^heading(\d)$/i);
|
|
6770
6770
|
if (e) return parseInt(e[1], 10);
|
|
6771
6771
|
if (t) {
|
|
@@ -6774,7 +6774,7 @@ function ya(r, t) {
|
|
|
6774
6774
|
}
|
|
6775
6775
|
return 0;
|
|
6776
6776
|
}
|
|
6777
|
-
function
|
|
6777
|
+
function Rn(r) {
|
|
6778
6778
|
return new DOMParser().parseFromString(r, "application/xml");
|
|
6779
6779
|
}
|
|
6780
6780
|
function v(r, t) {
|
|
@@ -6783,27 +6783,27 @@ function v(r, t) {
|
|
|
6783
6783
|
if (e.nodeType === 1 && e.localName === t) return e;
|
|
6784
6784
|
return null;
|
|
6785
6785
|
}
|
|
6786
|
-
function
|
|
6786
|
+
function xo(r) {
|
|
6787
6787
|
return String(r).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
6788
6788
|
}
|
|
6789
|
-
function
|
|
6790
|
-
return
|
|
6789
|
+
function xn(r) {
|
|
6790
|
+
return xo(r).replace(/"/g, """);
|
|
6791
6791
|
}
|
|
6792
|
-
const
|
|
6792
|
+
const pa = { class: "app-layout" }, ma = { class: "editor-wrapper" }, ga = { class: "umo-editor-instance" }, ya = ["disabled"], wa = { class: "umo-custom-huge-btn__text" }, xa = ["disabled"], ka = { class: "umo-custom-huge-btn__text" }, ba = ["disabled"], va = { class: "umo-custom-huge-btn__text" }, Sa = { class: "umo-custom-huge-btn__icon" }, Ca = {
|
|
6793
6793
|
viewBox: "0 0 24 24",
|
|
6794
6794
|
fill: "none",
|
|
6795
6795
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6796
|
-
},
|
|
6796
|
+
}, Ta = {
|
|
6797
6797
|
key: 0,
|
|
6798
6798
|
d: "M12 14l2 2 4-4",
|
|
6799
6799
|
stroke: "currentColor",
|
|
6800
6800
|
"stroke-width": "1.5",
|
|
6801
6801
|
"stroke-linecap": "round",
|
|
6802
6802
|
"stroke-linejoin": "round"
|
|
6803
|
-
},
|
|
6803
|
+
}, Aa = { class: "umo-custom-huge-btn__text" }, Ma = {
|
|
6804
6804
|
key: 1,
|
|
6805
6805
|
class: "editor-placeholder"
|
|
6806
|
-
},
|
|
6806
|
+
}, Ea = { class: "html-dialog" }, Na = { class: "html-dialog__header" }, Ia = { class: "html-dialog__toolbar" }, Oa = { class: "html-dialog__content" }, $a = {
|
|
6807
6807
|
__name: "App",
|
|
6808
6808
|
props: {
|
|
6809
6809
|
cdnUrl: {
|
|
@@ -6826,7 +6826,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6826
6826
|
n.value = !0;
|
|
6827
6827
|
let M = !0;
|
|
6828
6828
|
try {
|
|
6829
|
-
await
|
|
6829
|
+
await Po.update(ut.value, { content: JSON.stringify(C) }), await b(ut.value);
|
|
6830
6830
|
} catch (A) {
|
|
6831
6831
|
M = !1, console.error("保存失败:", A), w || alert("保存失败:" + A.message);
|
|
6832
6832
|
} finally {
|
|
@@ -6867,20 +6867,20 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6867
6867
|
flushPending: b,
|
|
6868
6868
|
queueDelete: I,
|
|
6869
6869
|
cancelPendingDelete: R
|
|
6870
|
-
} =
|
|
6870
|
+
} = xr();
|
|
6871
6871
|
z(!0);
|
|
6872
|
-
const
|
|
6872
|
+
const L = z(null), H = z([]), Z = () => L.value, at = () => L.value?.querySelector?.(".umo-scrollable-container") || L.value?.querySelector?.(".umo-scrollable") || L.value, W = (g, w) => {
|
|
6873
6873
|
if (!g || g.__gutterMounted) return;
|
|
6874
|
-
g.__gutterMounted = !0,
|
|
6874
|
+
g.__gutterMounted = !0, Io({
|
|
6875
6875
|
setup() {
|
|
6876
6876
|
const M = (A) => {
|
|
6877
|
-
|
|
6877
|
+
zn(A);
|
|
6878
6878
|
try {
|
|
6879
6879
|
w?.commands?.focusComment?.(A);
|
|
6880
6880
|
} catch {
|
|
6881
6881
|
}
|
|
6882
6882
|
};
|
|
6883
|
-
return () =>
|
|
6883
|
+
return () => Oo(ql, {
|
|
6884
6884
|
anchors: H.value,
|
|
6885
6885
|
comments: f.value,
|
|
6886
6886
|
activeCommentId: d.value,
|
|
@@ -6889,7 +6889,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6889
6889
|
});
|
|
6890
6890
|
}
|
|
6891
6891
|
}).mount(g);
|
|
6892
|
-
}, Pt = z(!1), Ht = z(""),
|
|
6892
|
+
}, Pt = z(!1), Ht = z(""), Ke = z(""), T = z(!1), O = async () => {
|
|
6893
6893
|
if (T.value) return;
|
|
6894
6894
|
const w = pt()?.getHTML() ?? u.value?.getHTML();
|
|
6895
6895
|
if (!w) {
|
|
@@ -6898,7 +6898,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6898
6898
|
}
|
|
6899
6899
|
T.value = !0;
|
|
6900
6900
|
try {
|
|
6901
|
-
await
|
|
6901
|
+
await $o(w, f.value, e.value || "文档");
|
|
6902
6902
|
} catch (C) {
|
|
6903
6903
|
console.error("导出 Word 失败:", C), alert("导出 Word 失败,请稍后重试");
|
|
6904
6904
|
} finally {
|
|
@@ -6913,8 +6913,8 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6913
6913
|
}
|
|
6914
6914
|
B.value = !0;
|
|
6915
6915
|
try {
|
|
6916
|
-
const C = await
|
|
6917
|
-
|
|
6916
|
+
const C = await Bo(w, e.value || "文档");
|
|
6917
|
+
Ro(C, `${e.value || "文档"}.docx`);
|
|
6918
6918
|
} catch (C) {
|
|
6919
6919
|
console.error("Word 流导出失败:", C), alert("Word 流导出失败,请稍后重试");
|
|
6920
6920
|
} finally {
|
|
@@ -6929,7 +6929,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6929
6929
|
}, bt = async (g) => {
|
|
6930
6930
|
ut.value || (ut.value = crypto.randomUUID()), ot.value = !0;
|
|
6931
6931
|
try {
|
|
6932
|
-
const w = await
|
|
6932
|
+
const w = await Yl(g);
|
|
6933
6933
|
let C = pt();
|
|
6934
6934
|
for (let E = 0; E < 40 && !C; E++)
|
|
6935
6935
|
await new Promise((It) => setTimeout(It, 50)), C = pt();
|
|
@@ -6937,7 +6937,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6937
6937
|
C.commands.setContent(w, !1);
|
|
6938
6938
|
const M = C.view.dom;
|
|
6939
6939
|
Et(M), await new Promise((E) => setTimeout(E, 50)), Et(M);
|
|
6940
|
-
const A = await
|
|
6940
|
+
const A = await Gl(g);
|
|
6941
6941
|
if (A.length === 0) {
|
|
6942
6942
|
s(), console.info("[Word 导入] 文档导入成功,未检测到批注");
|
|
6943
6943
|
return;
|
|
@@ -6947,7 +6947,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6947
6947
|
for (const E of A) {
|
|
6948
6948
|
if (!E.selectedText) continue;
|
|
6949
6949
|
const It = crypto.randomUUID(), ne = (f.value.length + F) % tt;
|
|
6950
|
-
if (
|
|
6950
|
+
if (Xe(C, E.selectedText, It, ne, {
|
|
6951
6951
|
preferDel: !!E.containsDelText
|
|
6952
6952
|
}))
|
|
6953
6953
|
await h({
|
|
@@ -6981,7 +6981,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6981
6981
|
function Ft(g) {
|
|
6982
6982
|
return typeof g != "string" ? "" : g.replace(/[\u200B\u200C\u200D\uFEFF]/g, " ").trim().replace(/\s+/g, " ").replace(/[\uFF01-\uFF5E]/g, (w) => String.fromCharCode(w.charCodeAt(0) - 65248));
|
|
6983
6983
|
}
|
|
6984
|
-
const
|
|
6984
|
+
const Xe = (g, w, C, M = 0, A = {}) => {
|
|
6985
6985
|
const F = w.trim();
|
|
6986
6986
|
if (!F) return !1;
|
|
6987
6987
|
const { doc: Nt } = g.state, E = Ft(w);
|
|
@@ -6994,7 +6994,7 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
6994
6994
|
return typeof K == "string" && /line-through/i.test(K);
|
|
6995
6995
|
}
|
|
6996
6996
|
return !1;
|
|
6997
|
-
}), re = (_) => !_ || _.length !== 1 ? null : _[0] || null, we = (_) => _ && _.length > 0 ? _[0] : null,
|
|
6997
|
+
}), re = (_) => !_ || _.length !== 1 ? null : _[0] || null, we = (_) => _ && _.length > 0 ? _[0] : null, Pn = (_) => {
|
|
6998
6998
|
const G = [];
|
|
6999
6999
|
return Nt.descendants((N, K) => {
|
|
7000
7000
|
if (N.isText && !(_ && !ne(N))) {
|
|
@@ -7047,32 +7047,32 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7047
7047
|
return ke;
|
|
7048
7048
|
};
|
|
7049
7049
|
if (It) {
|
|
7050
|
-
const _ =
|
|
7050
|
+
const _ = Pn(!0), G = we(_);
|
|
7051
7051
|
if (G)
|
|
7052
7052
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7053
7053
|
}
|
|
7054
|
-
const
|
|
7055
|
-
if (
|
|
7056
|
-
return g.chain().setTextSelection(
|
|
7054
|
+
const ko = Pn(!1), Fn = re(ko);
|
|
7055
|
+
if (Fn)
|
|
7056
|
+
return g.chain().setTextSelection(Fn).addComment(C, M).run(), !0;
|
|
7057
7057
|
if (It) {
|
|
7058
7058
|
const _ = xe(E, !0), G = we(_);
|
|
7059
7059
|
if (G)
|
|
7060
7060
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7061
7061
|
}
|
|
7062
|
-
let
|
|
7063
|
-
const
|
|
7064
|
-
if (
|
|
7065
|
-
return g.chain().setTextSelection(
|
|
7066
|
-
const
|
|
7067
|
-
if (
|
|
7068
|
-
const _ = E.slice(0,
|
|
7062
|
+
let en = xe(E, !1);
|
|
7063
|
+
const _n = re(en);
|
|
7064
|
+
if (_n)
|
|
7065
|
+
return g.chain().setTextSelection(_n).addComment(C, M).run(), !0;
|
|
7066
|
+
const Dn = Math.min(30, Math.max(8, Math.floor(E.length * 0.6)));
|
|
7067
|
+
if (Dn < E.length) {
|
|
7068
|
+
const _ = E.slice(0, Dn);
|
|
7069
7069
|
if (It) {
|
|
7070
7070
|
const N = xe(_, !0), K = re(N);
|
|
7071
7071
|
if (K)
|
|
7072
7072
|
return g.chain().setTextSelection(K).addComment(C, M).run(), !0;
|
|
7073
7073
|
}
|
|
7074
|
-
|
|
7075
|
-
const G = re(
|
|
7074
|
+
en = xe(_, !1);
|
|
7075
|
+
const G = re(en);
|
|
7076
7076
|
if (G)
|
|
7077
7077
|
return g.chain().setTextSelection(G).addComment(C, M).run(), !0;
|
|
7078
7078
|
}
|
|
@@ -7103,14 +7103,14 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7103
7103
|
}
|
|
7104
7104
|
return g.length;
|
|
7105
7105
|
}
|
|
7106
|
-
const vt = z(!1), te = z(""), Gt = z(!1),
|
|
7106
|
+
const vt = z(!1), te = z(""), Gt = z(!1), Ze = () => {
|
|
7107
7107
|
const g = u.value?.getHTML();
|
|
7108
7108
|
if (!g) {
|
|
7109
7109
|
alert("编辑器内容为空,无法导出");
|
|
7110
7110
|
return;
|
|
7111
7111
|
}
|
|
7112
7112
|
te.value = g, Gt.value = !1, vt.value = !0;
|
|
7113
|
-
},
|
|
7113
|
+
}, Qe = async () => {
|
|
7114
7114
|
try {
|
|
7115
7115
|
await navigator.clipboard.writeText(te.value), Gt.value = !0, setTimeout(() => Gt.value = !1, 2e3);
|
|
7116
7116
|
} catch {
|
|
@@ -7136,8 +7136,8 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7136
7136
|
height: "100%",
|
|
7137
7137
|
cdnUrl: t.cdnUrl,
|
|
7138
7138
|
extensions: [
|
|
7139
|
-
|
|
7140
|
-
|
|
7139
|
+
Pl,
|
|
7140
|
+
Ul.configure({
|
|
7141
7141
|
getStageEl: Z,
|
|
7142
7142
|
getScrollEl: at,
|
|
7143
7143
|
onAnchors: (g) => {
|
|
@@ -7154,12 +7154,12 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7154
7154
|
s(), c(g);
|
|
7155
7155
|
}
|
|
7156
7156
|
});
|
|
7157
|
-
|
|
7157
|
+
hn(
|
|
7158
7158
|
() => t.cdnUrl,
|
|
7159
7159
|
(g) => {
|
|
7160
7160
|
ge.value.cdnUrl = g;
|
|
7161
7161
|
}
|
|
7162
|
-
),
|
|
7162
|
+
), hn(
|
|
7163
7163
|
() => t.initialDocxBlob,
|
|
7164
7164
|
async (g) => {
|
|
7165
7165
|
if (console.log("props.initialDocxBlob changed in UmoEditorApp", g), !g) return;
|
|
@@ -7195,11 +7195,11 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7195
7195
|
w.commands.removeComment(C);
|
|
7196
7196
|
}
|
|
7197
7197
|
Pt.value = !1, Ht.value = "";
|
|
7198
|
-
},
|
|
7198
|
+
}, Ye = async (g) => {
|
|
7199
7199
|
pt()?.commands.removeComment(g), await m(g);
|
|
7200
|
-
},
|
|
7200
|
+
}, tn = async (g) => {
|
|
7201
7201
|
await p(g);
|
|
7202
|
-
},
|
|
7202
|
+
}, zn = (g) => {
|
|
7203
7203
|
const w = "rgba(251, 191, 36, 0.95)";
|
|
7204
7204
|
document.querySelectorAll(`.comment-mark[data-comment-id="${g}"]`).forEach((M) => {
|
|
7205
7205
|
if (!(M instanceof HTMLElement)) return;
|
|
@@ -7213,25 +7213,25 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7213
7213
|
C?.commands.focusComment(g);
|
|
7214
7214
|
}, 0);
|
|
7215
7215
|
};
|
|
7216
|
-
return
|
|
7216
|
+
return gr(() => {
|
|
7217
7217
|
ut.value || (ut.value = crypto.randomUUID()), e.value || (e.value = "未命名文档");
|
|
7218
|
-
}),
|
|
7218
|
+
}), To(() => {
|
|
7219
7219
|
}), (g, w) => {
|
|
7220
|
-
const C =
|
|
7221
|
-
return q(), rt("div",
|
|
7222
|
-
y("div",
|
|
7223
|
-
y("div",
|
|
7220
|
+
const C = Ao("umo-editor");
|
|
7221
|
+
return q(), rt("div", pa, [
|
|
7222
|
+
y("div", ma, [
|
|
7223
|
+
y("div", ga, [
|
|
7224
7224
|
y("div", {
|
|
7225
7225
|
ref_key: "editorStageRef",
|
|
7226
|
-
ref:
|
|
7226
|
+
ref: L,
|
|
7227
7227
|
class: "umo-editor-stage"
|
|
7228
7228
|
}, [
|
|
7229
|
-
oe(ut) ? (q(),
|
|
7229
|
+
oe(ut) ? (q(), Ie(C, Mo({
|
|
7230
7230
|
key: 0,
|
|
7231
7231
|
ref_key: "editorRef",
|
|
7232
7232
|
ref: u
|
|
7233
7233
|
}, ge.value), {
|
|
7234
|
-
toolbar_export:
|
|
7234
|
+
toolbar_export: Eo(() => [
|
|
7235
7235
|
y("input", {
|
|
7236
7236
|
ref_key: "importWordFileInput",
|
|
7237
7237
|
ref: j,
|
|
@@ -7274,8 +7274,8 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7274
7274
|
})
|
|
7275
7275
|
])
|
|
7276
7276
|
], -1)),
|
|
7277
|
-
y("span",
|
|
7278
|
-
], 8,
|
|
7277
|
+
y("span", wa, Y(ot.value ? "导入中…" : "导入 Word"), 1)
|
|
7278
|
+
], 8, ya),
|
|
7279
7279
|
y("button", {
|
|
7280
7280
|
class: "umo-custom-huge-btn",
|
|
7281
7281
|
disabled: T.value,
|
|
@@ -7310,8 +7310,8 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7310
7310
|
})
|
|
7311
7311
|
])
|
|
7312
7312
|
], -1)),
|
|
7313
|
-
y("span",
|
|
7314
|
-
], 8,
|
|
7313
|
+
y("span", ka, Y(T.value ? "导出中…" : "导出 Word"), 1)
|
|
7314
|
+
], 8, xa),
|
|
7315
7315
|
y("button", {
|
|
7316
7316
|
class: "umo-custom-huge-btn",
|
|
7317
7317
|
disabled: B.value,
|
|
@@ -7346,11 +7346,11 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7346
7346
|
})
|
|
7347
7347
|
])
|
|
7348
7348
|
], -1)),
|
|
7349
|
-
y("span",
|
|
7350
|
-
], 8,
|
|
7349
|
+
y("span", va, Y(B.value ? "生成中…" : "Word 流下载"), 1)
|
|
7350
|
+
], 8, ba),
|
|
7351
7351
|
y("button", {
|
|
7352
7352
|
class: "umo-custom-huge-btn",
|
|
7353
|
-
onClick:
|
|
7353
|
+
onClick: Ze
|
|
7354
7354
|
}, [...w[6] || (w[6] = [
|
|
7355
7355
|
y("span", { class: "umo-custom-huge-btn__icon" }, [
|
|
7356
7356
|
y("svg", {
|
|
@@ -7387,8 +7387,8 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7387
7387
|
class: "umo-custom-huge-btn",
|
|
7388
7388
|
onClick: ee
|
|
7389
7389
|
}, [
|
|
7390
|
-
y("span",
|
|
7391
|
-
(q(), rt("svg",
|
|
7390
|
+
y("span", Sa, [
|
|
7391
|
+
(q(), rt("svg", Ca, [
|
|
7392
7392
|
w[7] || (w[7] = y("rect", {
|
|
7393
7393
|
x: "9",
|
|
7394
7394
|
y: "9",
|
|
@@ -7407,70 +7407,70 @@ const wa = { class: "app-layout" }, xa = { class: "editor-wrapper" }, ka = { cla
|
|
|
7407
7407
|
"stroke-linecap": "round",
|
|
7408
7408
|
"stroke-linejoin": "round"
|
|
7409
7409
|
}, null, -1)),
|
|
7410
|
-
Kt.value ? (q(), rt("path",
|
|
7410
|
+
Kt.value ? (q(), rt("path", Ta)) : le("", !0)
|
|
7411
7411
|
]))
|
|
7412
7412
|
]),
|
|
7413
|
-
y("span",
|
|
7413
|
+
y("span", Aa, Y(Kt.value ? "已复制" : "复制 HTML"), 1)
|
|
7414
7414
|
])
|
|
7415
7415
|
]),
|
|
7416
7416
|
_: 1
|
|
7417
|
-
}, 16)) : (q(), rt("div",
|
|
7417
|
+
}, 16)) : (q(), rt("div", Ma, [...w[9] || (w[9] = [
|
|
7418
7418
|
y("p", null, "正在初始化编辑器,请稍候…", -1)
|
|
7419
7419
|
])]))
|
|
7420
7420
|
], 512)
|
|
7421
7421
|
])
|
|
7422
7422
|
]),
|
|
7423
|
-
|
|
7424
|
-
onActivate:
|
|
7425
|
-
onDelete:
|
|
7426
|
-
onResolve:
|
|
7423
|
+
No(ni, {
|
|
7424
|
+
onActivate: zn,
|
|
7425
|
+
onDelete: Ye,
|
|
7426
|
+
onResolve: tn
|
|
7427
7427
|
}),
|
|
7428
|
-
(q(),
|
|
7428
|
+
(q(), Ie(yr, { to: "body" }, [
|
|
7429
7429
|
vt.value ? (q(), rt("div", {
|
|
7430
7430
|
key: 0,
|
|
7431
7431
|
class: "html-dialog-mask",
|
|
7432
|
-
onClick: w[1] || (w[1] =
|
|
7432
|
+
onClick: w[1] || (w[1] = ze((M) => vt.value = !1, ["self"]))
|
|
7433
7433
|
}, [
|
|
7434
|
-
y("div",
|
|
7435
|
-
y("div",
|
|
7434
|
+
y("div", Ea, [
|
|
7435
|
+
y("div", Na, [
|
|
7436
7436
|
w[10] || (w[10] = y("span", { class: "html-dialog__title" }, "导出 HTML", -1)),
|
|
7437
7437
|
y("button", {
|
|
7438
7438
|
class: "html-dialog__close",
|
|
7439
7439
|
onClick: w[0] || (w[0] = (M) => vt.value = !1)
|
|
7440
7440
|
}, "✕")
|
|
7441
7441
|
]),
|
|
7442
|
-
y("div",
|
|
7442
|
+
y("div", Ia, [
|
|
7443
7443
|
y("button", {
|
|
7444
7444
|
class: "html-dialog__copy-btn",
|
|
7445
|
-
onClick:
|
|
7445
|
+
onClick: Qe
|
|
7446
7446
|
}, Y(Gt.value ? "✓ 已复制" : "复制"), 1)
|
|
7447
7447
|
]),
|
|
7448
|
-
y("pre",
|
|
7448
|
+
y("pre", Oa, [
|
|
7449
7449
|
y("code", null, Y(te.value), 1)
|
|
7450
7450
|
])
|
|
7451
7451
|
])
|
|
7452
7452
|
])) : le("", !0)
|
|
7453
7453
|
])),
|
|
7454
|
-
Pt.value ? (q(),
|
|
7454
|
+
Pt.value ? (q(), Ie(di, {
|
|
7455
7455
|
key: 0,
|
|
7456
7456
|
"selected-text": Ht.value,
|
|
7457
|
-
"initial-note":
|
|
7457
|
+
"initial-note": Ke.value,
|
|
7458
7458
|
onConfirm: ye,
|
|
7459
7459
|
onCancel: w[2] || (w[2] = (M) => Pt.value = !1)
|
|
7460
7460
|
}, null, 8, ["selected-text", "initial-note"])) : le("", !0)
|
|
7461
7461
|
]);
|
|
7462
7462
|
};
|
|
7463
7463
|
}
|
|
7464
|
-
},
|
|
7465
|
-
function
|
|
7464
|
+
}, Ba = /* @__PURE__ */ He($a, [["__scopeId", "data-v-d6ad3b04"]]);
|
|
7465
|
+
function _a() {
|
|
7466
7466
|
}
|
|
7467
|
-
const
|
|
7467
|
+
const Da = {
|
|
7468
7468
|
install(r, t) {
|
|
7469
|
-
r.use(
|
|
7469
|
+
r.use(bo, t ?? {}), r.component("UmoEditorApp", Ba);
|
|
7470
7470
|
}
|
|
7471
7471
|
};
|
|
7472
7472
|
export {
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7473
|
+
Ba as UmoEditorApp,
|
|
7474
|
+
Da as UmoEditorAppPlugin,
|
|
7475
|
+
_a as ensureUmoEditorGlobals
|
|
7476
7476
|
};
|