@box/threaded-annotations 2.1.11 → 3.0.0
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/chunks/dist.js +301 -293
- package/dist/esm/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.js +2 -2
- package/dist/esm/lib/components/message-editor/hooks/useMessageEditor.js +2 -1
- package/dist/esm/lib/components/v2/message-editor/message-editor.js +4 -3
- package/dist/types/lib/components/message-editor/editor-extensions/custom-mention/custom-mention.d.ts +1 -1
- package/dist/types/lib/components/message-editor/editor-extensions/custom-placeholder/custom-placeholder-utils.d.ts +1 -1
- package/dist/types/lib/components/message-editor/hooks/useMessageEditor.d.ts +2 -2
- package/dist/types/lib/components/v2/message-editor/editor-extensions/custom-mention/custom-mention.d.ts +1 -1
- package/package.json +22 -21
package/dist/chunks/dist.js
CHANGED
|
@@ -1,54 +1,61 @@
|
|
|
1
|
-
function e(t,
|
|
2
|
-
for (let
|
|
3
|
-
if (
|
|
4
|
-
let
|
|
5
|
-
if (
|
|
6
|
-
|
|
1
|
+
function e(t, i, a) {
|
|
2
|
+
for (let o = 0;; o++) {
|
|
3
|
+
if (o == t.childCount || o == i.childCount) return t.childCount == i.childCount ? null : a;
|
|
4
|
+
let s = t.child(o), c = i.child(o);
|
|
5
|
+
if (s == c) {
|
|
6
|
+
a += s.nodeSize;
|
|
7
7
|
continue;
|
|
8
8
|
}
|
|
9
|
-
if (!
|
|
10
|
-
if (
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
if (!s.sameMarkup(c)) return a;
|
|
10
|
+
if (s.isText && s.text != c.text) {
|
|
11
|
+
let e = s.text, t = c.text, i = 0;
|
|
12
|
+
for (; e[i] == t[i]; i++) a++;
|
|
13
|
+
return i && i < e.length && i < t.length && r(e.charCodeAt(i - 1)) && n(e.charCodeAt(i)) && a--, a;
|
|
13
14
|
}
|
|
14
|
-
if (
|
|
15
|
-
let t = e(
|
|
15
|
+
if (s.content.size || c.content.size) {
|
|
16
|
+
let t = e(s.content, c.content, a + 1);
|
|
16
17
|
if (t != null) return t;
|
|
17
18
|
}
|
|
18
|
-
|
|
19
|
+
a += s.nodeSize;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
function t(e,
|
|
22
|
-
for (let
|
|
23
|
-
if (
|
|
24
|
-
a
|
|
25
|
-
b:
|
|
22
|
+
function t(e, i, a, o) {
|
|
23
|
+
for (let s = e.childCount, c = i.childCount;;) {
|
|
24
|
+
if (s == 0 || c == 0) return s == c ? null : {
|
|
25
|
+
a,
|
|
26
|
+
b: o
|
|
26
27
|
};
|
|
27
|
-
let
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
let l = e.child(--s), u = i.child(--c), d = l.nodeSize;
|
|
29
|
+
if (l == u) {
|
|
30
|
+
a -= d, o -= d;
|
|
30
31
|
continue;
|
|
31
32
|
}
|
|
32
|
-
if (!
|
|
33
|
-
a
|
|
34
|
-
b:
|
|
33
|
+
if (!l.sameMarkup(u)) return {
|
|
34
|
+
a,
|
|
35
|
+
b: o
|
|
35
36
|
};
|
|
36
|
-
if (
|
|
37
|
-
let e =
|
|
38
|
-
for (;
|
|
39
|
-
return {
|
|
40
|
-
a
|
|
41
|
-
b:
|
|
37
|
+
if (l.isText && l.text != u.text) {
|
|
38
|
+
let e = l.text, t = u.text, i = e.length, s = t.length;
|
|
39
|
+
for (; i > 0 && s > 0 && e[i - 1] == t[s - 1];) i--, s--, a--, o--;
|
|
40
|
+
return i && s && i < e.length && r(e.charCodeAt(i - 1)) && n(e.charCodeAt(i)) && (a++, o++), {
|
|
41
|
+
a,
|
|
42
|
+
b: o
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
|
-
if (
|
|
45
|
-
let e = t(
|
|
45
|
+
if (l.content.size || u.content.size) {
|
|
46
|
+
let e = t(l.content, u.content, a - 1, o - 1);
|
|
46
47
|
if (e) return e;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
a -= d, o -= d;
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
+
function n(e) {
|
|
53
|
+
return e >= 56320 && e < 57344;
|
|
54
|
+
}
|
|
55
|
+
function r(e) {
|
|
56
|
+
return e >= 55296 && e < 56320;
|
|
57
|
+
}
|
|
58
|
+
var i = class n {
|
|
52
59
|
constructor(e, t) {
|
|
53
60
|
if (this.content = e, this.size = t || 0, t == null) for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize;
|
|
54
61
|
}
|
|
@@ -138,13 +145,13 @@ var n = class n {
|
|
|
138
145
|
return t(this, e, n, r);
|
|
139
146
|
}
|
|
140
147
|
findIndex(e) {
|
|
141
|
-
if (e == 0) return
|
|
142
|
-
if (e == this.size) return
|
|
148
|
+
if (e == 0) return o(0, e);
|
|
149
|
+
if (e == this.size) return o(this.content.length, e);
|
|
143
150
|
if (e > this.size || e < 0) throw RangeError(`Position ${e} outside of fragment (${this})`);
|
|
144
151
|
for (let t = 0, n = 0;; t++) {
|
|
145
|
-
let r = this.child(t),
|
|
146
|
-
if (
|
|
147
|
-
n =
|
|
152
|
+
let r = this.child(t), i = n + r.nodeSize;
|
|
153
|
+
if (i >= e) return i == e ? o(t + 1, i) : o(t, n);
|
|
154
|
+
n = i;
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
157
|
toString() {
|
|
@@ -159,7 +166,7 @@ var n = class n {
|
|
|
159
166
|
static fromJSON(e, t) {
|
|
160
167
|
if (!t) return n.empty;
|
|
161
168
|
if (!Array.isArray(t)) throw RangeError("Invalid input for Fragment.fromJSON");
|
|
162
|
-
return
|
|
169
|
+
return n.fromArray(t.map(e.nodeFromJSON));
|
|
163
170
|
}
|
|
164
171
|
static fromArray(e) {
|
|
165
172
|
if (!e.length) return n.empty;
|
|
@@ -178,29 +185,29 @@ var n = class n {
|
|
|
178
185
|
throw RangeError("Can not convert " + e + " to a Fragment" + (e.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
179
186
|
}
|
|
180
187
|
};
|
|
181
|
-
|
|
182
|
-
var
|
|
188
|
+
i.empty = new i([], 0);
|
|
189
|
+
var a = {
|
|
183
190
|
index: 0,
|
|
184
191
|
offset: 0
|
|
185
192
|
};
|
|
186
|
-
function
|
|
187
|
-
return
|
|
193
|
+
function o(e, t) {
|
|
194
|
+
return a.index = e, a.offset = t, a;
|
|
188
195
|
}
|
|
189
|
-
function
|
|
196
|
+
function s(e, t) {
|
|
190
197
|
if (e === t) return !0;
|
|
191
198
|
if (!(e && typeof e == "object") || !(t && typeof t == "object")) return !1;
|
|
192
199
|
let n = Array.isArray(e);
|
|
193
200
|
if (Array.isArray(t) != n) return !1;
|
|
194
201
|
if (n) {
|
|
195
202
|
if (e.length != t.length) return !1;
|
|
196
|
-
for (let n = 0; n < e.length; n++) if (!
|
|
203
|
+
for (let n = 0; n < e.length; n++) if (!s(e[n], t[n])) return !1;
|
|
197
204
|
} else {
|
|
198
|
-
for (let n in e) if (!(n in t) || !
|
|
205
|
+
for (let n in e) if (!(n in t) || !s(e[n], t[n])) return !1;
|
|
199
206
|
for (let n in t) if (!(n in e)) return !1;
|
|
200
207
|
}
|
|
201
208
|
return !0;
|
|
202
209
|
}
|
|
203
|
-
var
|
|
210
|
+
var c = class e {
|
|
204
211
|
constructor(e, t) {
|
|
205
212
|
this.type = e, this.attrs = t;
|
|
206
213
|
}
|
|
@@ -224,7 +231,7 @@ var o = class e {
|
|
|
224
231
|
return !1;
|
|
225
232
|
}
|
|
226
233
|
eq(e) {
|
|
227
|
-
return this == e || this.type == e.type &&
|
|
234
|
+
return this == e || this.type == e.type && s(this.attrs, e.attrs);
|
|
228
235
|
}
|
|
229
236
|
toJSON() {
|
|
230
237
|
let e = { type: this.type.name };
|
|
@@ -254,8 +261,8 @@ var o = class e {
|
|
|
254
261
|
return n.sort((e, t) => e.type.rank - t.type.rank), n;
|
|
255
262
|
}
|
|
256
263
|
};
|
|
257
|
-
|
|
258
|
-
var
|
|
264
|
+
c.none = [];
|
|
265
|
+
var l = class extends Error {}, u = class e {
|
|
259
266
|
constructor(e, t, n) {
|
|
260
267
|
this.content = e, this.openStart = t, this.openEnd = n;
|
|
261
268
|
}
|
|
@@ -263,11 +270,11 @@ var s = class extends Error {}, c = class e {
|
|
|
263
270
|
return this.content.size - this.openStart - this.openEnd;
|
|
264
271
|
}
|
|
265
272
|
insertAt(t, n) {
|
|
266
|
-
let r =
|
|
273
|
+
let r = f(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
|
|
267
274
|
return r && new e(r, this.openStart, this.openEnd);
|
|
268
275
|
}
|
|
269
276
|
removeBetween(t, n) {
|
|
270
|
-
return new e(
|
|
277
|
+
return new e(d(this.content, t + this.openStart, n + this.openStart), this.openStart, this.openEnd);
|
|
271
278
|
}
|
|
272
279
|
eq(e) {
|
|
273
280
|
return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
|
|
@@ -280,11 +287,11 @@ var s = class extends Error {}, c = class e {
|
|
|
280
287
|
let e = { content: this.content.toJSON() };
|
|
281
288
|
return this.openStart > 0 && (e.openStart = this.openStart), this.openEnd > 0 && (e.openEnd = this.openEnd), e;
|
|
282
289
|
}
|
|
283
|
-
static fromJSON(t,
|
|
284
|
-
if (!
|
|
285
|
-
let
|
|
286
|
-
if (typeof
|
|
287
|
-
return new e(
|
|
290
|
+
static fromJSON(t, n) {
|
|
291
|
+
if (!n) return e.empty;
|
|
292
|
+
let r = n.openStart || 0, a = n.openEnd || 0;
|
|
293
|
+
if (typeof r != "number" || typeof a != "number") throw RangeError("Invalid input for Slice.fromJSON");
|
|
294
|
+
return new e(i.fromJSON(t, n.content), r, a);
|
|
288
295
|
}
|
|
289
296
|
static maxOpen(t, n = !0) {
|
|
290
297
|
let r = 0, i = 0;
|
|
@@ -293,78 +300,79 @@ var s = class extends Error {}, c = class e {
|
|
|
293
300
|
return new e(t, r, i);
|
|
294
301
|
}
|
|
295
302
|
};
|
|
296
|
-
|
|
297
|
-
function
|
|
303
|
+
u.empty = new u(i.empty, 0, 0);
|
|
304
|
+
function d(e, t, n) {
|
|
298
305
|
let { index: r, offset: i } = e.findIndex(t), a = e.maybeChild(r), { index: o, offset: s } = e.findIndex(n);
|
|
299
306
|
if (i == t || a.isText) {
|
|
300
307
|
if (s != n && !e.child(o).isText) throw RangeError("Removing non-flat range");
|
|
301
308
|
return e.cut(0, t).append(e.cut(n));
|
|
302
309
|
}
|
|
303
310
|
if (r != o) throw RangeError("Removing non-flat range");
|
|
304
|
-
return e.replaceChild(r, a.copy(
|
|
311
|
+
return e.replaceChild(r, a.copy(d(a.content, t - i - 1, n - i - 1)));
|
|
305
312
|
}
|
|
306
|
-
function
|
|
307
|
-
let { index:
|
|
308
|
-
if (
|
|
309
|
-
let
|
|
310
|
-
return
|
|
313
|
+
function f(e, t, n, r, i, a) {
|
|
314
|
+
let { index: o, offset: s } = e.findIndex(t), c = e.maybeChild(o);
|
|
315
|
+
if (s == t || c.isText) return a && r <= 0 && i <= 0 && !a.canReplace(o, o, n) ? null : e.cut(0, t).append(n).append(e.cut(t));
|
|
316
|
+
let l = f(c.content, t - s - 1, n, o == 0 ? r - 1 : 0, o == e.childCount - 1 ? i - 1 : 0, c);
|
|
317
|
+
return l && e.replaceChild(o, c.copy(l));
|
|
311
318
|
}
|
|
312
|
-
function
|
|
313
|
-
if (n.openStart > e.depth) throw new
|
|
314
|
-
if (e.depth - n.openStart != t.depth - n.openEnd) throw new
|
|
315
|
-
return
|
|
319
|
+
function ee(e, t, n) {
|
|
320
|
+
if (n.openStart > e.depth) throw new l("Inserted content deeper than insertion position");
|
|
321
|
+
if (e.depth - n.openStart != t.depth - n.openEnd) throw new l("Inconsistent open depths");
|
|
322
|
+
return p(e, t, n, 0);
|
|
316
323
|
}
|
|
317
|
-
function
|
|
324
|
+
function p(e, t, n, r) {
|
|
318
325
|
let i = e.index(r), a = e.node(r);
|
|
319
326
|
if (i == t.index(r) && r < e.depth - n.openStart) {
|
|
320
|
-
let o =
|
|
327
|
+
let o = p(e, t, n, r + 1);
|
|
321
328
|
return a.copy(a.content.replaceChild(i, o));
|
|
322
|
-
} else if (!n.content.size) return
|
|
329
|
+
} else if (!n.content.size) return v(a, y(e, t, r));
|
|
323
330
|
else if (!n.openStart && !n.openEnd && e.depth == r && t.depth == r) {
|
|
324
331
|
let r = e.parent, i = r.content;
|
|
325
|
-
return
|
|
332
|
+
return v(r, i.cut(0, e.parentOffset).append(n.content).append(i.cut(t.parentOffset)));
|
|
326
333
|
} else {
|
|
327
|
-
let { start: i, end: o } =
|
|
328
|
-
return
|
|
334
|
+
let { start: i, end: o } = ne(n, e);
|
|
335
|
+
return v(a, te(e, i, o, t, r));
|
|
329
336
|
}
|
|
330
337
|
}
|
|
331
|
-
function
|
|
332
|
-
if (!t.type.compatibleContent(e.type)) throw new
|
|
338
|
+
function m(e, t) {
|
|
339
|
+
if (!t.type.compatibleContent(e.type)) throw new l("Cannot join " + t.type.name + " onto " + e.type.name);
|
|
333
340
|
}
|
|
334
|
-
function
|
|
341
|
+
function h(e, t, n) {
|
|
335
342
|
let r = e.node(n);
|
|
336
|
-
return
|
|
343
|
+
return m(r, t.node(n)), r;
|
|
337
344
|
}
|
|
338
|
-
function
|
|
345
|
+
function g(e, t) {
|
|
339
346
|
let n = t.length - 1;
|
|
340
347
|
n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e);
|
|
341
348
|
}
|
|
342
|
-
function
|
|
349
|
+
function _(e, t, n, r) {
|
|
343
350
|
let i = (t || e).node(n), a = 0, o = t ? t.index(n) : i.childCount;
|
|
344
|
-
e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (
|
|
345
|
-
for (let e = a; e < o; e++)
|
|
346
|
-
t && t.depth == n && t.textOffset &&
|
|
351
|
+
e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (g(e.nodeAfter, r), a++));
|
|
352
|
+
for (let e = a; e < o; e++) g(i.child(e), r);
|
|
353
|
+
t && t.depth == n && t.textOffset && g(t.nodeBefore, r);
|
|
347
354
|
}
|
|
348
|
-
function
|
|
349
|
-
|
|
355
|
+
function v(e, t) {
|
|
356
|
+
if (!e.type.validContent(t)) throw new l("Invalid content for node " + e.type.name);
|
|
357
|
+
return e.copy(t);
|
|
350
358
|
}
|
|
351
|
-
function
|
|
352
|
-
let o = e.depth > a &&
|
|
353
|
-
return
|
|
359
|
+
function te(e, t, n, r, a) {
|
|
360
|
+
let o = e.depth > a && h(e, t, a + 1), s = r.depth > a && h(n, r, a + 1), c = [];
|
|
361
|
+
return _(null, e, a, c), o && s && t.index(a) == n.index(a) ? (m(o, s), g(v(o, te(e, t, n, r, a + 1)), c)) : (o && g(v(o, y(e, t, a + 1)), c), _(t, n, a, c), s && g(v(s, y(n, r, a + 1)), c)), _(r, null, a, c), new i(c);
|
|
354
362
|
}
|
|
355
|
-
function
|
|
356
|
-
let
|
|
357
|
-
return
|
|
363
|
+
function y(e, t, n) {
|
|
364
|
+
let r = [];
|
|
365
|
+
return _(null, e, n, r), e.depth > n && g(v(h(e, t, n + 1), y(e, t, n + 1)), r), _(t, null, n, r), new i(r);
|
|
358
366
|
}
|
|
359
|
-
function
|
|
360
|
-
let
|
|
361
|
-
for (let e =
|
|
367
|
+
function ne(e, t) {
|
|
368
|
+
let n = t.depth - e.openStart, r = t.node(n).copy(e.content);
|
|
369
|
+
for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(i.from(r));
|
|
362
370
|
return {
|
|
363
|
-
start:
|
|
364
|
-
end:
|
|
371
|
+
start: r.resolveNoCache(e.openStart + n),
|
|
372
|
+
end: r.resolveNoCache(r.content.size - e.openEnd - n)
|
|
365
373
|
};
|
|
366
374
|
}
|
|
367
|
-
var
|
|
375
|
+
var b = class e {
|
|
368
376
|
constructor(e, t, n) {
|
|
369
377
|
this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
|
|
370
378
|
}
|
|
@@ -421,7 +429,7 @@ var y = class e {
|
|
|
421
429
|
}
|
|
422
430
|
marks() {
|
|
423
431
|
let e = this.parent, t = this.index();
|
|
424
|
-
if (e.content.size == 0) return
|
|
432
|
+
if (e.content.size == 0) return c.none;
|
|
425
433
|
if (this.textOffset) return e.child(t).marks;
|
|
426
434
|
let n = e.maybeChild(t - 1), r = e.maybeChild(t);
|
|
427
435
|
if (!n) {
|
|
@@ -445,7 +453,7 @@ var y = class e {
|
|
|
445
453
|
}
|
|
446
454
|
blockRange(e = this, t) {
|
|
447
455
|
if (e.pos < this.pos) return e.blockRange(this);
|
|
448
|
-
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new
|
|
456
|
+
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new ae(this, e, n);
|
|
449
457
|
return null;
|
|
450
458
|
}
|
|
451
459
|
sameParent(e) {
|
|
@@ -473,20 +481,20 @@ var y = class e {
|
|
|
473
481
|
return new e(n, r, a);
|
|
474
482
|
}
|
|
475
483
|
static resolveCached(t, n) {
|
|
476
|
-
let r =
|
|
484
|
+
let r = x.get(t);
|
|
477
485
|
if (r) for (let e = 0; e < r.elts.length; e++) {
|
|
478
486
|
let t = r.elts[e];
|
|
479
487
|
if (t.pos == n) return t;
|
|
480
488
|
}
|
|
481
|
-
else
|
|
489
|
+
else x.set(t, r = new re());
|
|
482
490
|
let i = r.elts[r.i] = e.resolve(t, n);
|
|
483
|
-
return r.i = (r.i + 1) %
|
|
491
|
+
return r.i = (r.i + 1) % ie, i;
|
|
484
492
|
}
|
|
485
|
-
},
|
|
493
|
+
}, re = class {
|
|
486
494
|
constructor() {
|
|
487
495
|
this.elts = [], this.i = 0;
|
|
488
496
|
}
|
|
489
|
-
},
|
|
497
|
+
}, ie = 12, x = /* @__PURE__ */ new WeakMap(), ae = class {
|
|
490
498
|
constructor(e, t, n) {
|
|
491
499
|
this.$from = e, this.$to = t, this.depth = n;
|
|
492
500
|
}
|
|
@@ -505,9 +513,9 @@ var y = class e {
|
|
|
505
513
|
get endIndex() {
|
|
506
514
|
return this.$to.indexAfter(this.depth);
|
|
507
515
|
}
|
|
508
|
-
},
|
|
509
|
-
constructor(e, t,
|
|
510
|
-
this.type = e, this.attrs = t, this.marks =
|
|
516
|
+
}, oe = Object.create(null), se = class e {
|
|
517
|
+
constructor(e, t, n, r = c.none) {
|
|
518
|
+
this.type = e, this.attrs = t, this.marks = r, this.content = n || i.empty;
|
|
511
519
|
}
|
|
512
520
|
get children() {
|
|
513
521
|
return this.content.content;
|
|
@@ -552,7 +560,7 @@ var y = class e {
|
|
|
552
560
|
return this.hasMarkup(e.type, e.attrs, e.marks);
|
|
553
561
|
}
|
|
554
562
|
hasMarkup(e, t, n) {
|
|
555
|
-
return this.type == e &&
|
|
563
|
+
return this.type == e && s(this.attrs, t || e.defaultAttrs || oe) && c.sameSet(this.marks, n || c.none);
|
|
556
564
|
}
|
|
557
565
|
copy(t = null) {
|
|
558
566
|
return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
|
|
@@ -564,12 +572,12 @@ var y = class e {
|
|
|
564
572
|
return e == 0 && t == this.content.size ? this : this.copy(this.content.cut(e, t));
|
|
565
573
|
}
|
|
566
574
|
slice(e, t = this.content.size, n = !1) {
|
|
567
|
-
if (e == t) return
|
|
575
|
+
if (e == t) return u.empty;
|
|
568
576
|
let r = this.resolve(e), i = this.resolve(t), a = n ? 0 : r.sharedDepth(t), o = r.start(a);
|
|
569
|
-
return new
|
|
577
|
+
return new u(r.node(a).content.cut(r.pos - o, i.pos - o), r.depth - a, i.depth - a);
|
|
570
578
|
}
|
|
571
579
|
replace(e, t, n) {
|
|
572
|
-
return
|
|
580
|
+
return ee(this.resolve(e), this.resolve(t), n);
|
|
573
581
|
}
|
|
574
582
|
nodeAt(e) {
|
|
575
583
|
for (let t = this;;) {
|
|
@@ -607,10 +615,10 @@ var y = class e {
|
|
|
607
615
|
};
|
|
608
616
|
}
|
|
609
617
|
resolve(e) {
|
|
610
|
-
return
|
|
618
|
+
return b.resolveCached(this, e);
|
|
611
619
|
}
|
|
612
620
|
resolveNoCache(e) {
|
|
613
|
-
return
|
|
621
|
+
return b.resolve(this, e);
|
|
614
622
|
}
|
|
615
623
|
rangeHasMark(e, t, n) {
|
|
616
624
|
let r = !1;
|
|
@@ -640,17 +648,17 @@ var y = class e {
|
|
|
640
648
|
toString() {
|
|
641
649
|
if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
|
|
642
650
|
let e = this.type.name;
|
|
643
|
-
return this.content.size && (e += "(" + this.content.toStringInner() + ")"),
|
|
651
|
+
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), ce(this.marks, e);
|
|
644
652
|
}
|
|
645
653
|
contentMatchAt(e) {
|
|
646
654
|
let t = this.type.contentMatch.matchFragment(this.content, 0, e);
|
|
647
655
|
if (!t) throw Error("Called contentMatchAt on a node with invalid content");
|
|
648
656
|
return t;
|
|
649
657
|
}
|
|
650
|
-
canReplace(e, t,
|
|
651
|
-
let o = this.contentMatchAt(e).matchFragment(
|
|
658
|
+
canReplace(e, t, n = i.empty, r = 0, a = n.childCount) {
|
|
659
|
+
let o = this.contentMatchAt(e).matchFragment(n, r, a), s = o && o.matchFragment(this.content, t);
|
|
652
660
|
if (!s || !s.validEnd) return !1;
|
|
653
|
-
for (let e =
|
|
661
|
+
for (let e = r; e < a; e++) if (!this.type.allowsMarks(n.child(e).marks)) return !1;
|
|
654
662
|
return !0;
|
|
655
663
|
}
|
|
656
664
|
canReplaceWith(e, t, n, r) {
|
|
@@ -663,12 +671,12 @@ var y = class e {
|
|
|
663
671
|
}
|
|
664
672
|
check() {
|
|
665
673
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
666
|
-
let e =
|
|
674
|
+
let e = c.none;
|
|
667
675
|
for (let t = 0; t < this.marks.length; t++) {
|
|
668
676
|
let n = this.marks[t];
|
|
669
677
|
n.type.checkAttrs(n.attrs), e = n.addToSet(e);
|
|
670
678
|
}
|
|
671
|
-
if (!
|
|
679
|
+
if (!c.sameSet(e, this.marks)) throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
|
|
672
680
|
this.content.forEach((e) => e.check());
|
|
673
681
|
}
|
|
674
682
|
toJSON() {
|
|
@@ -681,32 +689,32 @@ var y = class e {
|
|
|
681
689
|
}
|
|
682
690
|
static fromJSON(e, t) {
|
|
683
691
|
if (!t) throw RangeError("Invalid input for Node.fromJSON");
|
|
684
|
-
let
|
|
692
|
+
let n;
|
|
685
693
|
if (t.marks) {
|
|
686
694
|
if (!Array.isArray(t.marks)) throw RangeError("Invalid mark data for Node.fromJSON");
|
|
687
|
-
|
|
695
|
+
n = t.marks.map(e.markFromJSON);
|
|
688
696
|
}
|
|
689
697
|
if (t.type == "text") {
|
|
690
698
|
if (typeof t.text != "string") throw RangeError("Invalid text node in JSON");
|
|
691
|
-
return e.text(t.text,
|
|
699
|
+
return e.text(t.text, n);
|
|
692
700
|
}
|
|
693
|
-
let
|
|
701
|
+
let r = i.fromJSON(e, t.content), a = e.nodeType(t.type).create(t.attrs, r, n);
|
|
694
702
|
return a.type.checkAttrs(a.attrs), a;
|
|
695
703
|
}
|
|
696
704
|
};
|
|
697
|
-
|
|
698
|
-
function
|
|
705
|
+
se.prototype.text = void 0;
|
|
706
|
+
function ce(e, t) {
|
|
699
707
|
for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
|
|
700
708
|
return t;
|
|
701
709
|
}
|
|
702
|
-
var
|
|
710
|
+
var S = class e {
|
|
703
711
|
constructor(e) {
|
|
704
712
|
this.validEnd = e, this.next = [], this.wrapCache = [];
|
|
705
713
|
}
|
|
706
714
|
static parse(t, n) {
|
|
707
|
-
let r = new
|
|
715
|
+
let r = new le(t, n);
|
|
708
716
|
if (r.next == null) return e.empty;
|
|
709
|
-
let i =
|
|
717
|
+
let i = ue(r);
|
|
710
718
|
r.next && r.err("Unexpected trailing text");
|
|
711
719
|
let a = _e(ge(i));
|
|
712
720
|
return ve(a, r), a;
|
|
@@ -734,15 +742,15 @@ var x = class e {
|
|
|
734
742
|
for (let t = 0; t < this.next.length; t++) for (let n = 0; n < e.next.length; n++) if (this.next[t].type == e.next[n].type) return !0;
|
|
735
743
|
return !1;
|
|
736
744
|
}
|
|
737
|
-
fillBefore(e, t = !1,
|
|
738
|
-
let
|
|
745
|
+
fillBefore(e, t = !1, n = 0) {
|
|
746
|
+
let r = [this];
|
|
739
747
|
function a(o, s) {
|
|
740
|
-
let c = o.matchFragment(e,
|
|
741
|
-
if (c && (!t || c.validEnd)) return
|
|
748
|
+
let c = o.matchFragment(e, n);
|
|
749
|
+
if (c && (!t || c.validEnd)) return i.from(s.map((e) => e.createAndFill()));
|
|
742
750
|
for (let e = 0; e < o.next.length; e++) {
|
|
743
751
|
let { type: t, next: n } = o.next[e];
|
|
744
|
-
if (!(t.isText || t.hasRequiredAttrs()) &&
|
|
745
|
-
|
|
752
|
+
if (!(t.isText || t.hasRequiredAttrs()) && r.indexOf(n) == -1) {
|
|
753
|
+
r.push(n);
|
|
746
754
|
let e = a(n, s.concat(t));
|
|
747
755
|
if (e) return e;
|
|
748
756
|
}
|
|
@@ -800,8 +808,8 @@ var x = class e {
|
|
|
800
808
|
}).join("\n");
|
|
801
809
|
}
|
|
802
810
|
};
|
|
803
|
-
|
|
804
|
-
var
|
|
811
|
+
S.empty = new S(!0);
|
|
812
|
+
var le = class {
|
|
805
813
|
constructor(e, t) {
|
|
806
814
|
this.string = e, this.nodeTypes = t, this.inline = null, this.pos = 0, this.tokens = e.split(/\s*(?=\b|\W|$)/), this.tokens[this.tokens.length - 1] == "" && this.tokens.pop(), this.tokens[0] == "" && this.tokens.shift();
|
|
807
815
|
}
|
|
@@ -815,27 +823,27 @@ var ce = class {
|
|
|
815
823
|
throw SyntaxError(e + " (in content expression '" + this.string + "')");
|
|
816
824
|
}
|
|
817
825
|
};
|
|
818
|
-
function
|
|
826
|
+
function ue(e) {
|
|
819
827
|
let t = [];
|
|
820
828
|
do
|
|
821
|
-
t.push(
|
|
829
|
+
t.push(de(e));
|
|
822
830
|
while (e.eat("|"));
|
|
823
831
|
return t.length == 1 ? t[0] : {
|
|
824
832
|
type: "choice",
|
|
825
833
|
exprs: t
|
|
826
834
|
};
|
|
827
835
|
}
|
|
828
|
-
function
|
|
836
|
+
function de(e) {
|
|
829
837
|
let t = [];
|
|
830
838
|
do
|
|
831
|
-
t.push(
|
|
839
|
+
t.push(fe(e));
|
|
832
840
|
while (e.next && e.next != ")" && e.next != "|");
|
|
833
841
|
return t.length == 1 ? t[0] : {
|
|
834
842
|
type: "seq",
|
|
835
843
|
exprs: t
|
|
836
844
|
};
|
|
837
845
|
}
|
|
838
|
-
function
|
|
846
|
+
function fe(e) {
|
|
839
847
|
let t = he(e);
|
|
840
848
|
for (;;) if (e.eat("+")) t = {
|
|
841
849
|
type: "plus",
|
|
@@ -853,14 +861,14 @@ function de(e) {
|
|
|
853
861
|
else break;
|
|
854
862
|
return t;
|
|
855
863
|
}
|
|
856
|
-
function
|
|
864
|
+
function C(e) {
|
|
857
865
|
/\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
|
|
858
866
|
let t = Number(e.next);
|
|
859
867
|
return e.pos++, t;
|
|
860
868
|
}
|
|
861
869
|
function pe(e, t) {
|
|
862
|
-
let n =
|
|
863
|
-
return e.eat(",") && (r = e.next == "}" ? -1 :
|
|
870
|
+
let n = C(e), r = n;
|
|
871
|
+
return e.eat(",") && (r = e.next == "}" ? -1 : C(e)), e.eat("}") || e.err("Unclosed braced range"), {
|
|
864
872
|
type: "range",
|
|
865
873
|
min: n,
|
|
866
874
|
max: r,
|
|
@@ -879,7 +887,7 @@ function me(e, t) {
|
|
|
879
887
|
}
|
|
880
888
|
function he(e) {
|
|
881
889
|
if (e.eat("(")) {
|
|
882
|
-
let t =
|
|
890
|
+
let t = ue(e);
|
|
883
891
|
return e.eat(")") || e.err("Missing closing paren"), t;
|
|
884
892
|
} else if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
|
|
885
893
|
else {
|
|
@@ -939,12 +947,12 @@ function ge(e) {
|
|
|
939
947
|
else throw Error("Unknown expr type");
|
|
940
948
|
}
|
|
941
949
|
}
|
|
942
|
-
function
|
|
950
|
+
function w(e, t) {
|
|
943
951
|
return t - e;
|
|
944
952
|
}
|
|
945
|
-
function
|
|
953
|
+
function T(e, t) {
|
|
946
954
|
let n = [];
|
|
947
|
-
return r(t), n.sort(
|
|
955
|
+
return r(t), n.sort(w);
|
|
948
956
|
function r(t) {
|
|
949
957
|
let i = e[t];
|
|
950
958
|
if (i.length == 1 && !i[0].term) return r(i[0].to);
|
|
@@ -957,7 +965,7 @@ function C(e, t) {
|
|
|
957
965
|
}
|
|
958
966
|
function _e(e) {
|
|
959
967
|
let t = Object.create(null);
|
|
960
|
-
return n(
|
|
968
|
+
return n(T(e, 0));
|
|
961
969
|
function n(r) {
|
|
962
970
|
let i = [];
|
|
963
971
|
r.forEach((t) => {
|
|
@@ -965,14 +973,14 @@ function _e(e) {
|
|
|
965
973
|
if (!t) return;
|
|
966
974
|
let r;
|
|
967
975
|
for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
|
|
968
|
-
|
|
976
|
+
T(e, n).forEach((e) => {
|
|
969
977
|
r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
|
|
970
978
|
});
|
|
971
979
|
});
|
|
972
980
|
});
|
|
973
|
-
let a = t[r.join(",")] = new
|
|
981
|
+
let a = t[r.join(",")] = new S(r.indexOf(e.length - 1) > -1);
|
|
974
982
|
for (let e = 0; e < i.length; e++) {
|
|
975
|
-
let r = i[e][1].sort(
|
|
983
|
+
let r = i[e][1].sort(w);
|
|
976
984
|
a.next.push({
|
|
977
985
|
type: i[e][0],
|
|
978
986
|
next: t[r.join(",")] || n(r)
|
|
@@ -991,22 +999,22 @@ function ve(e, t) {
|
|
|
991
999
|
i && t.err("Only non-generatable nodes (" + a.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
992
1000
|
}
|
|
993
1001
|
}
|
|
994
|
-
var
|
|
1002
|
+
var E = 65535, D = 2 ** 16;
|
|
995
1003
|
function ye(e, t) {
|
|
996
|
-
return e + t *
|
|
1004
|
+
return e + t * D;
|
|
997
1005
|
}
|
|
998
|
-
function
|
|
999
|
-
return e &
|
|
1006
|
+
function O(e) {
|
|
1007
|
+
return e & E;
|
|
1000
1008
|
}
|
|
1001
1009
|
function be(e) {
|
|
1002
|
-
return (e - (e &
|
|
1010
|
+
return (e - (e & E)) / D;
|
|
1003
1011
|
}
|
|
1004
|
-
var xe = 1, Se = 2,
|
|
1012
|
+
var xe = 1, Se = 2, k = 4, A = 8, j = class {
|
|
1005
1013
|
constructor(e, t, n) {
|
|
1006
1014
|
this.pos = e, this.delInfo = t, this.recover = n;
|
|
1007
1015
|
}
|
|
1008
1016
|
get deleted() {
|
|
1009
|
-
return (this.delInfo &
|
|
1017
|
+
return (this.delInfo & A) > 0;
|
|
1010
1018
|
}
|
|
1011
1019
|
get deletedBefore() {
|
|
1012
1020
|
return (this.delInfo & 5) > 0;
|
|
@@ -1015,14 +1023,14 @@ var xe = 1, Se = 2, D = 4, O = 8, k = class {
|
|
|
1015
1023
|
return (this.delInfo & 6) > 0;
|
|
1016
1024
|
}
|
|
1017
1025
|
get deletedAcross() {
|
|
1018
|
-
return (this.delInfo &
|
|
1026
|
+
return (this.delInfo & k) > 0;
|
|
1019
1027
|
}
|
|
1020
|
-
},
|
|
1028
|
+
}, M = class e {
|
|
1021
1029
|
constructor(t, n = !1) {
|
|
1022
1030
|
if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
|
|
1023
1031
|
}
|
|
1024
1032
|
recover(e) {
|
|
1025
|
-
let t = 0, n =
|
|
1033
|
+
let t = 0, n = O(e);
|
|
1026
1034
|
if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
|
|
1027
1035
|
return this.ranges[n * 3] + t + be(e);
|
|
1028
1036
|
}
|
|
@@ -1041,15 +1049,15 @@ var xe = 1, Se = 2, D = 4, O = 8, k = class {
|
|
|
1041
1049
|
if (e <= u) {
|
|
1042
1050
|
let i = c ? e == s ? -1 : e == u ? 1 : t : t, a = s + r + (i < 0 ? 0 : l);
|
|
1043
1051
|
if (n) return a;
|
|
1044
|
-
let d = e == (t < 0 ? s : u) ? null : ye(o / 3, e - s), f = e == s ? Se : e == u ? xe :
|
|
1045
|
-
return (t < 0 ? e != s : e != u) && (f |=
|
|
1052
|
+
let d = e == (t < 0 ? s : u) ? null : ye(o / 3, e - s), f = e == s ? Se : e == u ? xe : k;
|
|
1053
|
+
return (t < 0 ? e != s : e != u) && (f |= A), new j(a, f, d);
|
|
1046
1054
|
}
|
|
1047
1055
|
r += l - c;
|
|
1048
1056
|
}
|
|
1049
|
-
return n ? e + r : new
|
|
1057
|
+
return n ? e + r : new j(e + r, 0, null);
|
|
1050
1058
|
}
|
|
1051
1059
|
touches(e, t) {
|
|
1052
|
-
let n = 0, r =
|
|
1060
|
+
let n = 0, r = O(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
|
|
1053
1061
|
for (let t = 0; t < this.ranges.length; t += 3) {
|
|
1054
1062
|
let o = this.ranges[t] - (this.inverted ? n : 0);
|
|
1055
1063
|
if (o > e) break;
|
|
@@ -1084,25 +1092,25 @@ var xe = 1, Se = 2, D = 4, O = 8, k = class {
|
|
|
1084
1092
|
]);
|
|
1085
1093
|
}
|
|
1086
1094
|
};
|
|
1087
|
-
|
|
1088
|
-
var
|
|
1095
|
+
M.empty = new M([]);
|
|
1096
|
+
var N = Object.create(null), P = class {
|
|
1089
1097
|
getMap() {
|
|
1090
|
-
return
|
|
1098
|
+
return M.empty;
|
|
1091
1099
|
}
|
|
1092
1100
|
merge(e) {
|
|
1093
1101
|
return null;
|
|
1094
1102
|
}
|
|
1095
1103
|
static fromJSON(e, t) {
|
|
1096
1104
|
if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
|
|
1097
|
-
let n =
|
|
1105
|
+
let n = N[t.stepType];
|
|
1098
1106
|
if (!n) throw RangeError(`No step type ${t.stepType} defined`);
|
|
1099
1107
|
return n.fromJSON(e, t);
|
|
1100
1108
|
}
|
|
1101
1109
|
static jsonID(e, t) {
|
|
1102
|
-
if (e in
|
|
1103
|
-
return
|
|
1110
|
+
if (e in N) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
1111
|
+
return N[e] = t, t.prototype.jsonID = e, t;
|
|
1104
1112
|
}
|
|
1105
|
-
},
|
|
1113
|
+
}, F = class e {
|
|
1106
1114
|
constructor(e, t) {
|
|
1107
1115
|
this.doc = e, this.failed = t;
|
|
1108
1116
|
}
|
|
@@ -1116,29 +1124,29 @@ var j = Object.create(null), M = class {
|
|
|
1116
1124
|
try {
|
|
1117
1125
|
return e.ok(t.replace(n, r, i));
|
|
1118
1126
|
} catch (t) {
|
|
1119
|
-
if (t instanceof
|
|
1127
|
+
if (t instanceof l) return e.fail(t.message);
|
|
1120
1128
|
throw t;
|
|
1121
1129
|
}
|
|
1122
1130
|
}
|
|
1123
1131
|
};
|
|
1124
|
-
function
|
|
1125
|
-
let
|
|
1126
|
-
for (let
|
|
1127
|
-
let a = e.child(
|
|
1128
|
-
a.content.size && (a = a.copy(
|
|
1132
|
+
function I(e, t, n) {
|
|
1133
|
+
let r = [];
|
|
1134
|
+
for (let i = 0; i < e.childCount; i++) {
|
|
1135
|
+
let a = e.child(i);
|
|
1136
|
+
a.content.size && (a = a.copy(I(a.content, t, a))), a.isInline && (a = t(a, n, i)), r.push(a);
|
|
1129
1137
|
}
|
|
1130
|
-
return
|
|
1138
|
+
return i.fromArray(r);
|
|
1131
1139
|
}
|
|
1132
|
-
var
|
|
1140
|
+
var L = class e extends P {
|
|
1133
1141
|
constructor(e, t, n) {
|
|
1134
1142
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1135
1143
|
}
|
|
1136
1144
|
apply(e) {
|
|
1137
|
-
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new
|
|
1138
|
-
return
|
|
1145
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new u(I(t.content, (e, t) => !e.isAtom || !t.type.allowsMarkType(this.mark.type) ? e : e.mark(this.mark.addToSet(e.marks)), r), t.openStart, t.openEnd);
|
|
1146
|
+
return F.fromReplace(e, this.from, this.to, i);
|
|
1139
1147
|
}
|
|
1140
1148
|
invert() {
|
|
1141
|
-
return new
|
|
1149
|
+
return new R(this.from, this.to, this.mark);
|
|
1142
1150
|
}
|
|
1143
1151
|
map(t) {
|
|
1144
1152
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1160,17 +1168,17 @@ var F = class e extends M {
|
|
|
1160
1168
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1161
1169
|
}
|
|
1162
1170
|
};
|
|
1163
|
-
|
|
1164
|
-
var
|
|
1171
|
+
P.jsonID("addMark", L);
|
|
1172
|
+
var R = class e extends P {
|
|
1165
1173
|
constructor(e, t, n) {
|
|
1166
1174
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1167
1175
|
}
|
|
1168
1176
|
apply(e) {
|
|
1169
|
-
let t = e.slice(this.from, this.to), n = new
|
|
1170
|
-
return
|
|
1177
|
+
let t = e.slice(this.from, this.to), n = new u(I(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
|
|
1178
|
+
return F.fromReplace(e, this.from, this.to, n);
|
|
1171
1179
|
}
|
|
1172
1180
|
invert() {
|
|
1173
|
-
return new
|
|
1181
|
+
return new L(this.from, this.to, this.mark);
|
|
1174
1182
|
}
|
|
1175
1183
|
map(t) {
|
|
1176
1184
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1192,16 +1200,16 @@ var I = class e extends M {
|
|
|
1192
1200
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1193
1201
|
}
|
|
1194
1202
|
};
|
|
1195
|
-
|
|
1196
|
-
var
|
|
1203
|
+
P.jsonID("removeMark", R);
|
|
1204
|
+
var z = class e extends P {
|
|
1197
1205
|
constructor(e, t) {
|
|
1198
1206
|
super(), this.pos = e, this.mark = t;
|
|
1199
1207
|
}
|
|
1200
1208
|
apply(e) {
|
|
1201
1209
|
let t = e.nodeAt(this.pos);
|
|
1202
|
-
if (!t) return
|
|
1203
|
-
let
|
|
1204
|
-
return
|
|
1210
|
+
if (!t) return F.fail("No node at mark step's position");
|
|
1211
|
+
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
1212
|
+
return F.fromReplace(e, this.pos, this.pos + 1, new u(i.from(n), 0, +!t.isLeaf));
|
|
1205
1213
|
}
|
|
1206
1214
|
invert(t) {
|
|
1207
1215
|
let n = t.nodeAt(this.pos);
|
|
@@ -1212,7 +1220,7 @@ var L = class e extends M {
|
|
|
1212
1220
|
return new e(this.pos, this.mark);
|
|
1213
1221
|
}
|
|
1214
1222
|
}
|
|
1215
|
-
return new
|
|
1223
|
+
return new B(this.pos, this.mark);
|
|
1216
1224
|
}
|
|
1217
1225
|
map(t) {
|
|
1218
1226
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1230,20 +1238,20 @@ var L = class e extends M {
|
|
|
1230
1238
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1231
1239
|
}
|
|
1232
1240
|
};
|
|
1233
|
-
|
|
1234
|
-
var
|
|
1241
|
+
P.jsonID("addNodeMark", z);
|
|
1242
|
+
var B = class e extends P {
|
|
1235
1243
|
constructor(e, t) {
|
|
1236
1244
|
super(), this.pos = e, this.mark = t;
|
|
1237
1245
|
}
|
|
1238
1246
|
apply(e) {
|
|
1239
1247
|
let t = e.nodeAt(this.pos);
|
|
1240
|
-
if (!t) return
|
|
1241
|
-
let
|
|
1242
|
-
return
|
|
1248
|
+
if (!t) return F.fail("No node at mark step's position");
|
|
1249
|
+
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
1250
|
+
return F.fromReplace(e, this.pos, this.pos + 1, new u(i.from(n), 0, +!t.isLeaf));
|
|
1243
1251
|
}
|
|
1244
1252
|
invert(e) {
|
|
1245
1253
|
let t = e.nodeAt(this.pos);
|
|
1246
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
1254
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new z(this.pos, this.mark);
|
|
1247
1255
|
}
|
|
1248
1256
|
map(t) {
|
|
1249
1257
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1261,16 +1269,16 @@ var R = class e extends M {
|
|
|
1261
1269
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1262
1270
|
}
|
|
1263
1271
|
};
|
|
1264
|
-
|
|
1265
|
-
var
|
|
1272
|
+
P.jsonID("removeNodeMark", B);
|
|
1273
|
+
var V = class e extends P {
|
|
1266
1274
|
constructor(e, t, n, r = !1) {
|
|
1267
1275
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
1268
1276
|
}
|
|
1269
1277
|
apply(e) {
|
|
1270
|
-
return this.structure &&
|
|
1278
|
+
return this.structure && U(e, this.from, this.to) ? F.fail("Structure replace would overwrite content") : F.fromReplace(e, this.from, this.to, this.slice);
|
|
1271
1279
|
}
|
|
1272
1280
|
getMap() {
|
|
1273
|
-
return new
|
|
1281
|
+
return new M([
|
|
1274
1282
|
this.from,
|
|
1275
1283
|
this.to - this.from,
|
|
1276
1284
|
this.slice.size
|
|
@@ -1286,10 +1294,10 @@ var z = class e extends M {
|
|
|
1286
1294
|
merge(t) {
|
|
1287
1295
|
if (!(t instanceof e) || t.structure || this.structure) return null;
|
|
1288
1296
|
if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
|
|
1289
|
-
let n = this.slice.size + t.slice.size == 0 ?
|
|
1297
|
+
let n = this.slice.size + t.slice.size == 0 ? u.empty : new u(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
|
|
1290
1298
|
return new e(this.from, this.to + (t.to - t.from), n, this.structure);
|
|
1291
1299
|
} else if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
|
|
1292
|
-
let n = this.slice.size + t.slice.size == 0 ?
|
|
1300
|
+
let n = this.slice.size + t.slice.size == 0 ? u.empty : new u(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
|
|
1293
1301
|
return new e(t.from, this.to, n, this.structure);
|
|
1294
1302
|
} else return null;
|
|
1295
1303
|
}
|
|
@@ -1303,23 +1311,23 @@ var z = class e extends M {
|
|
|
1303
1311
|
}
|
|
1304
1312
|
static fromJSON(t, n) {
|
|
1305
1313
|
if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
1306
|
-
return new e(n.from, n.to,
|
|
1314
|
+
return new e(n.from, n.to, u.fromJSON(t, n.slice), !!n.structure);
|
|
1307
1315
|
}
|
|
1308
1316
|
};
|
|
1309
|
-
|
|
1310
|
-
var
|
|
1317
|
+
P.jsonID("replace", V);
|
|
1318
|
+
var H = class e extends P {
|
|
1311
1319
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
1312
1320
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
1313
1321
|
}
|
|
1314
1322
|
apply(e) {
|
|
1315
|
-
if (this.structure && (
|
|
1323
|
+
if (this.structure && (U(e, this.from, this.gapFrom) || U(e, this.gapTo, this.to))) return F.fail("Structure gap-replace would overwrite content");
|
|
1316
1324
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
1317
|
-
if (t.openStart || t.openEnd) return
|
|
1325
|
+
if (t.openStart || t.openEnd) return F.fail("Gap is not a flat range");
|
|
1318
1326
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
1319
|
-
return n ?
|
|
1327
|
+
return n ? F.fromReplace(e, this.from, this.to, n) : F.fail("Content does not fit in gap");
|
|
1320
1328
|
}
|
|
1321
1329
|
getMap() {
|
|
1322
|
-
return new
|
|
1330
|
+
return new M([
|
|
1323
1331
|
this.from,
|
|
1324
1332
|
this.gapFrom - this.from,
|
|
1325
1333
|
this.insert,
|
|
@@ -1349,11 +1357,11 @@ var B = class e extends M {
|
|
|
1349
1357
|
}
|
|
1350
1358
|
static fromJSON(t, n) {
|
|
1351
1359
|
if (typeof n.from != "number" || typeof n.to != "number" || typeof n.gapFrom != "number" || typeof n.gapTo != "number" || typeof n.insert != "number") throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
1352
|
-
return new e(n.from, n.to, n.gapFrom, n.gapTo,
|
|
1360
|
+
return new e(n.from, n.to, n.gapFrom, n.gapTo, u.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
1353
1361
|
}
|
|
1354
1362
|
};
|
|
1355
|
-
|
|
1356
|
-
function
|
|
1363
|
+
P.jsonID("replaceAround", H);
|
|
1364
|
+
function U(e, t, n) {
|
|
1357
1365
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
1358
1366
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
1359
1367
|
if (i > 0) {
|
|
@@ -1365,21 +1373,21 @@ function V(e, t, n) {
|
|
|
1365
1373
|
}
|
|
1366
1374
|
return !1;
|
|
1367
1375
|
}
|
|
1368
|
-
var Ce = class e extends
|
|
1376
|
+
var Ce = class e extends P {
|
|
1369
1377
|
constructor(e, t, n) {
|
|
1370
1378
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
1371
1379
|
}
|
|
1372
1380
|
apply(e) {
|
|
1373
1381
|
let t = e.nodeAt(this.pos);
|
|
1374
|
-
if (!t) return
|
|
1375
|
-
let
|
|
1376
|
-
for (let e in t.attrs)
|
|
1377
|
-
|
|
1378
|
-
let
|
|
1379
|
-
return
|
|
1382
|
+
if (!t) return F.fail("No node at attribute step's position");
|
|
1383
|
+
let n = Object.create(null);
|
|
1384
|
+
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
1385
|
+
n[this.attr] = this.value;
|
|
1386
|
+
let r = t.type.create(n, null, t.marks);
|
|
1387
|
+
return F.fromReplace(e, this.pos, this.pos + 1, new u(i.from(r), 0, +!t.isLeaf));
|
|
1380
1388
|
}
|
|
1381
1389
|
getMap() {
|
|
1382
|
-
return
|
|
1390
|
+
return M.empty;
|
|
1383
1391
|
}
|
|
1384
1392
|
invert(t) {
|
|
1385
1393
|
return new e(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -1401,8 +1409,8 @@ var Ce = class e extends M {
|
|
|
1401
1409
|
return new e(n.pos, n.attr, n.value);
|
|
1402
1410
|
}
|
|
1403
1411
|
};
|
|
1404
|
-
|
|
1405
|
-
var we = class e extends
|
|
1412
|
+
P.jsonID("attr", Ce);
|
|
1413
|
+
var we = class e extends P {
|
|
1406
1414
|
constructor(e, t) {
|
|
1407
1415
|
super(), this.attr = e, this.value = t;
|
|
1408
1416
|
}
|
|
@@ -1411,10 +1419,10 @@ var we = class e extends M {
|
|
|
1411
1419
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
1412
1420
|
t[this.attr] = this.value;
|
|
1413
1421
|
let n = e.type.create(t, e.content, e.marks);
|
|
1414
|
-
return
|
|
1422
|
+
return F.ok(n);
|
|
1415
1423
|
}
|
|
1416
1424
|
getMap() {
|
|
1417
|
-
return
|
|
1425
|
+
return M.empty;
|
|
1418
1426
|
}
|
|
1419
1427
|
invert(t) {
|
|
1420
1428
|
return new e(this.attr, t.attrs[this.attr]);
|
|
@@ -1434,13 +1442,13 @@ var we = class e extends M {
|
|
|
1434
1442
|
return new e(n.attr, n.value);
|
|
1435
1443
|
}
|
|
1436
1444
|
};
|
|
1437
|
-
|
|
1438
|
-
var
|
|
1439
|
-
|
|
1445
|
+
P.jsonID("docAttr", we);
|
|
1446
|
+
var W = class extends Error {};
|
|
1447
|
+
W = function e(t) {
|
|
1440
1448
|
let n = Error.call(this, t);
|
|
1441
1449
|
return n.__proto__ = e.prototype, n;
|
|
1442
|
-
},
|
|
1443
|
-
var
|
|
1450
|
+
}, W.prototype = Object.create(Error.prototype), W.prototype.constructor = W, W.prototype.name = "TransformError";
|
|
1451
|
+
var G = Object.create(null), K = class {
|
|
1444
1452
|
constructor(e, t, n) {
|
|
1445
1453
|
this.$anchor = e, this.$head = t, this.ranges = n || [new Te(e.min(t), e.max(t))];
|
|
1446
1454
|
}
|
|
@@ -1470,64 +1478,64 @@ var U = Object.create(null), W = class {
|
|
|
1470
1478
|
content() {
|
|
1471
1479
|
return this.$from.doc.slice(this.from, this.to, !0);
|
|
1472
1480
|
}
|
|
1473
|
-
replace(e, t =
|
|
1481
|
+
replace(e, t = u.empty) {
|
|
1474
1482
|
let n = t.content.lastChild, r = null;
|
|
1475
1483
|
for (let e = 0; e < t.openEnd; e++) r = n, n = n.lastChild;
|
|
1476
1484
|
let i = e.steps.length, a = this.ranges;
|
|
1477
1485
|
for (let o = 0; o < a.length; o++) {
|
|
1478
|
-
let { $from: s, $to:
|
|
1479
|
-
e.replaceRange(
|
|
1486
|
+
let { $from: s, $to: c } = a[o], l = e.mapping.slice(i);
|
|
1487
|
+
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? u.empty : t), o == 0 && Ae(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
1480
1488
|
}
|
|
1481
1489
|
}
|
|
1482
1490
|
replaceWith(e, t) {
|
|
1483
1491
|
let n = e.steps.length, r = this.ranges;
|
|
1484
1492
|
for (let i = 0; i < r.length; i++) {
|
|
1485
1493
|
let { $from: a, $to: o } = r[i], s = e.mapping.slice(n), c = s.map(a.pos), l = s.map(o.pos);
|
|
1486
|
-
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t),
|
|
1494
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), Ae(e, n, t.isInline ? -1 : 1));
|
|
1487
1495
|
}
|
|
1488
1496
|
}
|
|
1489
1497
|
static findFrom(e, t, n = !1) {
|
|
1490
|
-
let r = e.parent.inlineContent ? new
|
|
1498
|
+
let r = e.parent.inlineContent ? new J(e) : Z(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
1491
1499
|
if (r) return r;
|
|
1492
1500
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
1493
|
-
let i = t < 0 ?
|
|
1501
|
+
let i = t < 0 ? Z(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : Z(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
1494
1502
|
if (i) return i;
|
|
1495
1503
|
}
|
|
1496
1504
|
return null;
|
|
1497
1505
|
}
|
|
1498
1506
|
static near(e, t = 1) {
|
|
1499
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
1507
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new X(e.node(0));
|
|
1500
1508
|
}
|
|
1501
1509
|
static atStart(e) {
|
|
1502
|
-
return
|
|
1510
|
+
return Z(e, e, 0, 0, 1) || new X(e);
|
|
1503
1511
|
}
|
|
1504
1512
|
static atEnd(e) {
|
|
1505
|
-
return
|
|
1513
|
+
return Z(e, e, e.content.size, e.childCount, -1) || new X(e);
|
|
1506
1514
|
}
|
|
1507
1515
|
static fromJSON(e, t) {
|
|
1508
1516
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
1509
|
-
let n =
|
|
1517
|
+
let n = G[t.type];
|
|
1510
1518
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
1511
1519
|
return n.fromJSON(e, t);
|
|
1512
1520
|
}
|
|
1513
1521
|
static jsonID(e, t) {
|
|
1514
|
-
if (e in
|
|
1515
|
-
return
|
|
1522
|
+
if (e in G) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
1523
|
+
return G[e] = t, t.prototype.jsonID = e, t;
|
|
1516
1524
|
}
|
|
1517
1525
|
getBookmark() {
|
|
1518
|
-
return
|
|
1526
|
+
return J.between(this.$anchor, this.$head).getBookmark();
|
|
1519
1527
|
}
|
|
1520
1528
|
};
|
|
1521
|
-
|
|
1529
|
+
K.prototype.visible = !0;
|
|
1522
1530
|
var Te = class {
|
|
1523
1531
|
constructor(e, t) {
|
|
1524
1532
|
this.$from = e, this.$to = t;
|
|
1525
1533
|
}
|
|
1526
|
-
},
|
|
1534
|
+
}, q = !1;
|
|
1527
1535
|
function Ee(e) {
|
|
1528
|
-
!
|
|
1536
|
+
!q && !e.parent.inlineContent && (q = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
1529
1537
|
}
|
|
1530
|
-
var
|
|
1538
|
+
var J = class e extends K {
|
|
1531
1539
|
constructor(e, t = e) {
|
|
1532
1540
|
Ee(e), Ee(t), super(e, t);
|
|
1533
1541
|
}
|
|
@@ -1536,12 +1544,12 @@ var K = class e extends W {
|
|
|
1536
1544
|
}
|
|
1537
1545
|
map(t, n) {
|
|
1538
1546
|
let r = t.resolve(n.map(this.head));
|
|
1539
|
-
if (!r.parent.inlineContent) return
|
|
1547
|
+
if (!r.parent.inlineContent) return K.near(r);
|
|
1540
1548
|
let i = t.resolve(n.map(this.anchor));
|
|
1541
1549
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
1542
1550
|
}
|
|
1543
|
-
replace(e, t =
|
|
1544
|
-
if (super.replace(e, t), t ==
|
|
1551
|
+
replace(e, t = u.empty) {
|
|
1552
|
+
if (super.replace(e, t), t == u.empty) {
|
|
1545
1553
|
let t = this.$from.marksAcross(this.$to);
|
|
1546
1554
|
t && e.ensureMarks(t);
|
|
1547
1555
|
}
|
|
@@ -1550,7 +1558,7 @@ var K = class e extends W {
|
|
|
1550
1558
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
1551
1559
|
}
|
|
1552
1560
|
getBookmark() {
|
|
1553
|
-
return new
|
|
1561
|
+
return new De(this.anchor, this.head);
|
|
1554
1562
|
}
|
|
1555
1563
|
toJSON() {
|
|
1556
1564
|
return {
|
|
@@ -1570,15 +1578,15 @@ var K = class e extends W {
|
|
|
1570
1578
|
static between(t, n, r) {
|
|
1571
1579
|
let i = t.pos - n.pos;
|
|
1572
1580
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
1573
|
-
let e =
|
|
1581
|
+
let e = K.findFrom(n, r, !0) || K.findFrom(n, -r, !0);
|
|
1574
1582
|
if (e) n = e.$head;
|
|
1575
|
-
else return
|
|
1583
|
+
else return K.near(n, r);
|
|
1576
1584
|
}
|
|
1577
|
-
return t.parent.inlineContent || (i == 0 ? t = n : (t = (
|
|
1585
|
+
return t.parent.inlineContent || (i == 0 ? t = n : (t = (K.findFrom(t, -r, !0) || K.findFrom(t, r, !0)).$anchor, t.pos < n.pos != i < 0 && (t = n))), new e(t, n);
|
|
1578
1586
|
}
|
|
1579
1587
|
};
|
|
1580
|
-
|
|
1581
|
-
var
|
|
1588
|
+
K.jsonID("text", J);
|
|
1589
|
+
var De = class e {
|
|
1582
1590
|
constructor(e, t) {
|
|
1583
1591
|
this.anchor = e, this.head = t;
|
|
1584
1592
|
}
|
|
@@ -1586,19 +1594,19 @@ var q = class e {
|
|
|
1586
1594
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
1587
1595
|
}
|
|
1588
1596
|
resolve(e) {
|
|
1589
|
-
return
|
|
1597
|
+
return J.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
1590
1598
|
}
|
|
1591
|
-
},
|
|
1599
|
+
}, Y = class e extends K {
|
|
1592
1600
|
constructor(e) {
|
|
1593
1601
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
1594
1602
|
super(e, n), this.node = t;
|
|
1595
1603
|
}
|
|
1596
1604
|
map(t, n) {
|
|
1597
1605
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
1598
|
-
return r ?
|
|
1606
|
+
return r ? K.near(a) : new e(a);
|
|
1599
1607
|
}
|
|
1600
1608
|
content() {
|
|
1601
|
-
return new
|
|
1609
|
+
return new u(i.from(this.node), 0, 0);
|
|
1602
1610
|
}
|
|
1603
1611
|
eq(t) {
|
|
1604
1612
|
return t instanceof e && t.anchor == this.anchor;
|
|
@@ -1610,7 +1618,7 @@ var q = class e {
|
|
|
1610
1618
|
};
|
|
1611
1619
|
}
|
|
1612
1620
|
getBookmark() {
|
|
1613
|
-
return new
|
|
1621
|
+
return new Oe(this.anchor);
|
|
1614
1622
|
}
|
|
1615
1623
|
static fromJSON(t, n) {
|
|
1616
1624
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -1623,27 +1631,27 @@ var q = class e {
|
|
|
1623
1631
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
1624
1632
|
}
|
|
1625
1633
|
};
|
|
1626
|
-
|
|
1627
|
-
var
|
|
1634
|
+
Y.prototype.visible = !1, K.jsonID("node", Y);
|
|
1635
|
+
var Oe = class e {
|
|
1628
1636
|
constructor(e) {
|
|
1629
1637
|
this.anchor = e;
|
|
1630
1638
|
}
|
|
1631
1639
|
map(t) {
|
|
1632
1640
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
1633
|
-
return n ? new
|
|
1641
|
+
return n ? new De(r, r) : new e(r);
|
|
1634
1642
|
}
|
|
1635
1643
|
resolve(e) {
|
|
1636
1644
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
1637
|
-
return n &&
|
|
1645
|
+
return n && Y.isSelectable(n) ? new Y(t) : K.near(t);
|
|
1638
1646
|
}
|
|
1639
|
-
},
|
|
1647
|
+
}, X = class e extends K {
|
|
1640
1648
|
constructor(e) {
|
|
1641
1649
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
1642
1650
|
}
|
|
1643
|
-
replace(e, t =
|
|
1644
|
-
if (t ==
|
|
1651
|
+
replace(e, t = u.empty) {
|
|
1652
|
+
if (t == u.empty) {
|
|
1645
1653
|
e.delete(0, e.doc.content.size);
|
|
1646
|
-
let t =
|
|
1654
|
+
let t = K.atStart(e.doc);
|
|
1647
1655
|
t.eq(e.selection) || e.setSelection(t);
|
|
1648
1656
|
} else super.replace(e, t);
|
|
1649
1657
|
}
|
|
@@ -1660,46 +1668,46 @@ var De = class e {
|
|
|
1660
1668
|
return t instanceof e;
|
|
1661
1669
|
}
|
|
1662
1670
|
getBookmark() {
|
|
1663
|
-
return
|
|
1671
|
+
return ke;
|
|
1664
1672
|
}
|
|
1665
1673
|
};
|
|
1666
|
-
|
|
1667
|
-
var
|
|
1674
|
+
K.jsonID("all", X);
|
|
1675
|
+
var ke = {
|
|
1668
1676
|
map() {
|
|
1669
1677
|
return this;
|
|
1670
1678
|
},
|
|
1671
1679
|
resolve(e) {
|
|
1672
|
-
return new
|
|
1680
|
+
return new X(e);
|
|
1673
1681
|
}
|
|
1674
1682
|
};
|
|
1675
|
-
function
|
|
1676
|
-
if (t.inlineContent) return
|
|
1683
|
+
function Z(e, t, n, r, i, a = !1) {
|
|
1684
|
+
if (t.inlineContent) return J.create(e, n);
|
|
1677
1685
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
1678
1686
|
let r = t.child(o);
|
|
1679
1687
|
if (!r.isAtom) {
|
|
1680
|
-
let t =
|
|
1688
|
+
let t = Z(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
1681
1689
|
if (t) return t;
|
|
1682
|
-
} else if (!a &&
|
|
1690
|
+
} else if (!a && Y.isSelectable(r)) return Y.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
1683
1691
|
n += r.nodeSize * i;
|
|
1684
1692
|
}
|
|
1685
1693
|
return null;
|
|
1686
1694
|
}
|
|
1687
|
-
function
|
|
1695
|
+
function Ae(e, t, n) {
|
|
1688
1696
|
let r = e.steps.length - 1;
|
|
1689
1697
|
if (r < t) return;
|
|
1690
1698
|
let i = e.steps[r];
|
|
1691
|
-
if (!(i instanceof
|
|
1699
|
+
if (!(i instanceof V || i instanceof H)) return;
|
|
1692
1700
|
let a = e.mapping.maps[r], o;
|
|
1693
1701
|
a.forEach((e, t, n, r) => {
|
|
1694
1702
|
o ??= r;
|
|
1695
|
-
}), e.setSelection(
|
|
1703
|
+
}), e.setSelection(K.near(e.doc.resolve(o), n));
|
|
1696
1704
|
}
|
|
1697
|
-
function
|
|
1705
|
+
function je(e, t) {
|
|
1698
1706
|
return !t || !e ? e : e.bind(t);
|
|
1699
1707
|
}
|
|
1700
1708
|
var Q = class {
|
|
1701
1709
|
constructor(e, t, n) {
|
|
1702
|
-
this.name = e, this.init =
|
|
1710
|
+
this.name = e, this.init = je(t.init, n), this.apply = je(t.apply, n);
|
|
1703
1711
|
}
|
|
1704
1712
|
};
|
|
1705
1713
|
new Q("doc", {
|
|
@@ -1711,7 +1719,7 @@ new Q("doc", {
|
|
|
1711
1719
|
}
|
|
1712
1720
|
}), new Q("selection", {
|
|
1713
1721
|
init(e, t) {
|
|
1714
|
-
return e.selection ||
|
|
1722
|
+
return e.selection || K.atStart(t.doc);
|
|
1715
1723
|
},
|
|
1716
1724
|
apply(e) {
|
|
1717
1725
|
return e.selection;
|
|
@@ -1732,12 +1740,12 @@ new Q("doc", {
|
|
|
1732
1740
|
}
|
|
1733
1741
|
});
|
|
1734
1742
|
var $ = Object.create(null);
|
|
1735
|
-
function
|
|
1743
|
+
function Me(e) {
|
|
1736
1744
|
return e in $ ? e + "$" + ++$[e] : ($[e] = 0, e + "$");
|
|
1737
1745
|
}
|
|
1738
|
-
var
|
|
1746
|
+
var Ne = class {
|
|
1739
1747
|
constructor(e = "key") {
|
|
1740
|
-
this.key =
|
|
1748
|
+
this.key = Me(e);
|
|
1741
1749
|
}
|
|
1742
1750
|
get(e) {
|
|
1743
1751
|
return e.config.pluginsByKey[this.key];
|
|
@@ -1746,4 +1754,4 @@ var je = class {
|
|
|
1746
1754
|
return e[this.key];
|
|
1747
1755
|
}
|
|
1748
1756
|
};
|
|
1749
|
-
export {
|
|
1757
|
+
export { Ne as t };
|