reactjs-tiptap-editor 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{ActionMenuButton-B4KDkZ0z.js → ActionMenuButton-BhiGvRJ7.js} +1 -1
- package/lib/{ActionMenuButton-C3Cfeza9.cjs → ActionMenuButton-qUxkZlQg.cjs} +1 -1
- package/lib/Attachment.cjs +1 -1
- package/lib/Attachment.js +27 -27
- package/lib/Blockquote.cjs +3 -3
- package/lib/Blockquote.js +251 -244
- package/lib/Bold.cjs +1 -1
- package/lib/Bold.js +2 -2
- package/lib/BulletList.cjs +1 -1
- package/lib/BulletList.js +2 -2
- package/lib/Callout-B9uXfbP3.js +340 -0
- package/lib/Callout-C_TXsss3.cjs +1 -0
- package/lib/Callout.cjs +1 -1
- package/lib/Callout.js +8 -222
- package/lib/Clear.cjs +1 -1
- package/lib/Clear.js +2 -2
- package/lib/Code.cjs +1 -1
- package/lib/Code.js +2 -2
- package/lib/CodeBlock.cjs +1 -1
- package/lib/CodeBlock.js +2 -2
- package/lib/CodeView.cjs +1 -1
- package/lib/CodeView.js +2 -2
- package/lib/Color.cjs +1 -1
- package/lib/Color.js +3 -3
- package/lib/Column.cjs +1 -1
- package/lib/Column.js +2 -2
- package/lib/{Drawer-D7E9kTca.cjs → Drawer-D3B4lQJF.cjs} +1 -1
- package/lib/{Drawer-DA0FLHs9.js → Drawer-h401Yy6Y.js} +20 -20
- package/lib/Drawer.cjs +1 -1
- package/lib/Drawer.js +4 -4
- package/lib/Emoji.cjs +1 -1
- package/lib/Emoji.js +168 -135
- package/lib/Excalidraw.cjs +1 -1
- package/lib/Excalidraw.js +5 -5
- package/lib/ExportPdf.cjs +1 -1
- package/lib/ExportPdf.js +2 -2
- package/lib/ExportWord.cjs +1 -1
- package/lib/ExportWord.js +2 -2
- package/lib/FontFamily.cjs +1 -1
- package/lib/FontFamily.js +5 -5
- package/lib/FontSize.cjs +1 -1
- package/lib/FontSize.js +5 -5
- package/lib/FormatPainter.cjs +1 -1
- package/lib/FormatPainter.js +2 -2
- package/lib/Heading.cjs +1 -1
- package/lib/Heading.js +10 -10
- package/lib/Highlight.cjs +1 -1
- package/lib/Highlight.js +3 -3
- package/lib/History.cjs +2 -2
- package/lib/History.js +584 -531
- package/lib/HorizontalRule.cjs +1 -1
- package/lib/HorizontalRule.js +2 -2
- package/lib/{Iframe-DZ3r3QzK.js → Iframe-Dhn40BXx.js} +3 -3
- package/lib/{Iframe-OMVd0xa_.cjs → Iframe-bvGuzYwC.cjs} +1 -1
- package/lib/Iframe.cjs +1 -1
- package/lib/Iframe.js +3 -3
- package/lib/Image.cjs +1 -1
- package/lib/Image.js +9 -6
- package/lib/ImageGif.cjs +1 -1
- package/lib/ImageGif.js +19 -19
- package/lib/ImportWord.cjs +1 -1
- package/lib/ImportWord.js +15 -15
- package/lib/{Indent-kI4G-clX.js → Indent-BK9DvCL7.js} +2 -2
- package/lib/{Indent-QgCoonRk.cjs → Indent-IOByomps.cjs} +1 -1
- package/lib/Indent.cjs +1 -1
- package/lib/Indent.js +2 -2
- package/lib/Italic.cjs +1 -1
- package/lib/Italic.js +2 -2
- package/lib/{Katex-BPbXjcZQ.js → Katex-C_Ah9G9w.js} +7 -6
- package/lib/Katex-oLGrtLTf.cjs +4 -0
- package/lib/Katex.cjs +1 -1
- package/lib/Katex.js +3 -3
- package/lib/LineHeight.cjs +1 -1
- package/lib/LineHeight.js +4 -4
- package/lib/Link.cjs +1 -1
- package/lib/Link.js +2 -2
- package/lib/{LinkEditBlock-Z7RRurvx.cjs → LinkEditBlock-BojxdGTm.cjs} +2 -2
- package/lib/{LinkEditBlock-BYWwH2_x.js → LinkEditBlock-DRdKXffy.js} +39 -35
- package/lib/MarkdownPaste.cjs +1 -1
- package/lib/MarkdownPaste.js +1 -1
- package/lib/Mention.cjs +1 -1
- package/lib/Mention.js +4 -4
- package/lib/Mermaid.cjs +2 -2
- package/lib/Mermaid.js +62 -61
- package/lib/MoreMark.cjs +1 -1
- package/lib/MoreMark.js +5 -5
- package/lib/OrderedList.cjs +1 -1
- package/lib/OrderedList.js +2 -2
- package/lib/SearchAndReplace.cjs +1 -1
- package/lib/SearchAndReplace.js +8 -8
- package/lib/SlashCommand.cjs +1 -1
- package/lib/SlashCommand.js +7 -7
- package/lib/{SlashCommandNodeView-DPPmYEjC.cjs → SlashCommandNodeView-Dai-O3aD.cjs} +1 -1
- package/lib/{SlashCommandNodeView-C0l3Fb_3.js → SlashCommandNodeView-qwW9cuYt.js} +6 -6
- package/lib/Strike.cjs +1 -1
- package/lib/Strike.js +2 -2
- package/lib/{Table-DwseaFSD.js → Table-BKM8SvVj.js} +20 -20
- package/lib/{Table-D5G3rfwb.cjs → Table-CWI7tKme.cjs} +1 -1
- package/lib/Table.cjs +1 -1
- package/lib/Table.js +1 -1
- package/lib/TaskList.cjs +1 -1
- package/lib/TaskList.js +2 -2
- package/lib/TextAlign.cjs +1 -1
- package/lib/TextAlign.js +3 -3
- package/lib/TextDirection.cjs +1 -1
- package/lib/TextDirection.js +3 -3
- package/lib/TextUnderline.cjs +1 -1
- package/lib/TextUnderline.js +2 -2
- package/lib/{Twitter-q4ZGZL0i.cjs → Twitter-BfsPzA8_.cjs} +1 -1
- package/lib/{Twitter-DP26Lkn8.js → Twitter-CofLQ-zj.js} +9 -9
- package/lib/Twitter.cjs +1 -1
- package/lib/Twitter.js +3 -3
- package/lib/Video.cjs +1 -1
- package/lib/Video.js +5 -5
- package/lib/bubble.cjs +6 -6
- package/lib/bubble.js +2258 -2552
- package/lib/{clsx-DRbkQ4T7.cjs → clsx-DJURdKPs.cjs} +2 -2
- package/lib/{clsx-_bq4MQQ7.js → clsx-b_2OwHLk.js} +19 -19
- package/lib/{dropdown-menu-CURWpB9o.cjs → dropdown-menu-CEMxzgnU.cjs} +1 -1
- package/lib/{dropdown-menu-BKSX4gvT.js → dropdown-menu-CKAKsyqu.js} +1 -1
- package/lib/extensions/Column/Column.d.ts +10 -2
- package/lib/extensions/Image/Image.d.ts +13 -1
- package/lib/index-BJQ1G8B1.js +311 -0
- package/lib/index-BO82_0q8.cjs +1 -0
- package/lib/{index-DQy9iBzV.js → index-Bn_WPziX.js} +1 -1
- package/lib/{index-BpLw6ebr.cjs → index-CwbGrQFa.cjs} +1 -1
- package/lib/{index-DtyAGMbq.js → index-DKruDABV.js} +1 -1
- package/lib/{index-SEMQrdk2.cjs → index-DN-IR-K0.cjs} +1 -1
- package/lib/{index-C52cuQ_Y.js → index-DRcwHivm.js} +1415 -1350
- package/lib/index-DUeBQoIA.cjs +1 -0
- package/lib/{index-Dbm_Mans.js → index-DeoYYWEA.js} +1 -1
- package/lib/{index-CHVV5iY-.cjs → index-Dgs2thVL.cjs} +1 -1
- package/lib/{index-BaR0Brts.js → index-DjB2kNdz.js} +171 -166
- package/lib/{index-CJMI7Fjf.js → index-DuWMq-Qs.js} +1 -1
- package/lib/{index-BGfIcDCQ.cjs → index-EoGU7W4e.cjs} +1 -1
- package/lib/{index-CDw4Eszh.cjs → index-MDz4NZcT.cjs} +9 -9
- package/lib/{index-Dx-Dh7KS.js → index-n4kM0Ll-.js} +110 -105
- package/lib/{index-BgNKVyMW.cjs → index-qZURFC5Q.cjs} +1 -1
- package/lib/index.cjs +1 -1
- package/lib/index.js +12 -12
- package/lib/locale-bundle.cjs +1 -1
- package/lib/locale-bundle.js +1 -1
- package/lib/{popover-BB-ZDnqk.js → popover-Beieacfy.js} +1 -1
- package/lib/{popover-CrywEkBR.cjs → popover-Bl1kxRJX.cjs} +1 -1
- package/lib/{renderNodeView-5h3-p80E.cjs → renderNodeView-BIgT6Ghg.cjs} +1 -1
- package/lib/{renderNodeView-DoKZ4GYy.js → renderNodeView-Bi58v3DZ.js} +2 -2
- package/lib/{separator-BGO9AZp4.cjs → separator-DMLtkcoo.cjs} +1 -1
- package/lib/{separator-DuuOJRQd.js → separator-DfvK668q.js} +14 -14
- package/lib/style.css +1 -1
- package/lib/textarea-DV9Fw3y1.cjs +1 -0
- package/lib/textarea-GXaWJbm9.js +20 -0
- package/lib/theme.cjs +1 -1
- package/lib/theme.js +1 -1
- package/lib/{updatePosition-CFTYKYNJ.js → updatePosition-DY1jI7qb.js} +2 -2
- package/lib/{updatePosition-B1oRJE1x.cjs → updatePosition-D_D-TbEu.cjs} +1 -1
- package/package.json +62 -61
- package/lib/Katex-CUofhjB5.cjs +0 -4
- package/lib/index-BG0kQamI.js +0 -285
- package/lib/index-NsYff_Ni.cjs +0 -1
- package/lib/index-aujjnfSJ.cjs +0 -1
package/lib/Blockquote.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { N as
|
|
1
|
+
import { N as Rt, w as At, m as Ot } from "./index-n4kM0Ll-.js";
|
|
2
2
|
import { h as Z } from "./jsx-runtime-DE8oVoME.js";
|
|
3
|
-
import { jsx as j, Fragment as
|
|
4
|
-
import { u as
|
|
3
|
+
import { jsx as j, Fragment as Et } from "react/jsx-runtime";
|
|
4
|
+
import { u as Tt, d as It, A as zt } from "./index-DRcwHivm.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "./theme.js";
|
|
7
7
|
function st(n, t, e) {
|
|
@@ -16,9 +16,10 @@ function st(n, t, e) {
|
|
|
16
16
|
if (!i.sameMarkup(s))
|
|
17
17
|
return e;
|
|
18
18
|
if (i.isText && i.text != s.text) {
|
|
19
|
-
|
|
19
|
+
let o = i.text, a = s.text, l = 0;
|
|
20
|
+
for (; o[l] == a[l]; l++)
|
|
20
21
|
e++;
|
|
21
|
-
return e;
|
|
22
|
+
return l && l < o.length && l < a.length && lt(o.charCodeAt(l - 1)) && at(o.charCodeAt(l)) && e--, e;
|
|
22
23
|
}
|
|
23
24
|
if (i.content.size || s.content.size) {
|
|
24
25
|
let o = st(i.content, s.content, e + 1);
|
|
@@ -40,20 +41,26 @@ function ot(n, t, e, r) {
|
|
|
40
41
|
if (!o.sameMarkup(a))
|
|
41
42
|
return { a: e, b: r };
|
|
42
43
|
if (o.isText && o.text != a.text) {
|
|
43
|
-
let
|
|
44
|
-
for (;
|
|
45
|
-
|
|
46
|
-
return { a: e, b: r };
|
|
44
|
+
let u = o.text, h = a.text, f = u.length, k = h.length;
|
|
45
|
+
for (; f > 0 && k > 0 && u[f - 1] == h[k - 1]; )
|
|
46
|
+
f--, k--, e--, r--;
|
|
47
|
+
return f && k && f < u.length && lt(u.charCodeAt(f - 1)) && at(u.charCodeAt(f)) && (e++, r++), { a: e, b: r };
|
|
47
48
|
}
|
|
48
49
|
if (o.content.size || a.content.size) {
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
51
|
-
return
|
|
50
|
+
let u = ot(o.content, a.content, e - 1, r - 1);
|
|
51
|
+
if (u)
|
|
52
|
+
return u;
|
|
52
53
|
}
|
|
53
54
|
e -= l, r -= l;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
function at(n) {
|
|
58
|
+
return n >= 56320 && n < 57344;
|
|
59
|
+
}
|
|
60
|
+
function lt(n) {
|
|
61
|
+
return n >= 55296 && n < 56320;
|
|
62
|
+
}
|
|
63
|
+
var g = class d {
|
|
57
64
|
/**
|
|
58
65
|
@internal
|
|
59
66
|
*/
|
|
@@ -69,12 +76,12 @@ var g = class m {
|
|
|
69
76
|
*/
|
|
70
77
|
nodesBetween(t, e, r, i = 0, s) {
|
|
71
78
|
for (let o = 0, a = 0; a < e; o++) {
|
|
72
|
-
let l = this.content[o],
|
|
73
|
-
if (
|
|
74
|
-
let
|
|
75
|
-
l.nodesBetween(Math.max(0, t -
|
|
79
|
+
let l = this.content[o], u = a + l.nodeSize;
|
|
80
|
+
if (u > t && r(l, i + a, s || null, o) !== !1 && l.content.size) {
|
|
81
|
+
let h = a + 1;
|
|
82
|
+
l.nodesBetween(Math.max(0, t - h), Math.min(l.content.size, e - h), r, i + h);
|
|
76
83
|
}
|
|
77
|
-
a =
|
|
84
|
+
a = u;
|
|
78
85
|
}
|
|
79
86
|
}
|
|
80
87
|
/**
|
|
@@ -92,8 +99,8 @@ var g = class m {
|
|
|
92
99
|
textBetween(t, e, r, i) {
|
|
93
100
|
let s = "", o = !0;
|
|
94
101
|
return this.nodesBetween(t, e, (a, l) => {
|
|
95
|
-
let
|
|
96
|
-
a.isBlock && (a.isLeaf &&
|
|
102
|
+
let u = a.isText ? a.text.slice(Math.max(t, l) - l, e - l) : a.isLeaf ? i ? typeof i == "function" ? i(a) : i : a.type.spec.leafText ? a.type.spec.leafText(a) : "" : "";
|
|
103
|
+
a.isBlock && (a.isLeaf && u || a.isTextblock) && r && (o ? o = !1 : s += r), s += u;
|
|
97
104
|
}, 0), s;
|
|
98
105
|
}
|
|
99
106
|
/**
|
|
@@ -108,7 +115,7 @@ var g = class m {
|
|
|
108
115
|
let e = this.lastChild, r = t.firstChild, i = this.content.slice(), s = 0;
|
|
109
116
|
for (e.isText && e.sameMarkup(r) && (i[i.length - 1] = e.withText(e.text + r.text), s = 1); s < t.content.length; s++)
|
|
110
117
|
i.push(t.content[s]);
|
|
111
|
-
return new
|
|
118
|
+
return new d(i, this.size + t.size);
|
|
112
119
|
}
|
|
113
120
|
/**
|
|
114
121
|
Cut out the sub-fragment between the two given positions.
|
|
@@ -122,13 +129,13 @@ var g = class m {
|
|
|
122
129
|
let a = this.content[s], l = o + a.nodeSize;
|
|
123
130
|
l > t && ((o < t || l > e) && (a.isText ? a = a.cut(Math.max(0, t - o), Math.min(a.text.length, e - o)) : a = a.cut(Math.max(0, t - o - 1), Math.min(a.content.size, e - o - 1))), r.push(a), i += a.nodeSize), o = l;
|
|
124
131
|
}
|
|
125
|
-
return new
|
|
132
|
+
return new d(r, i);
|
|
126
133
|
}
|
|
127
134
|
/**
|
|
128
135
|
@internal
|
|
129
136
|
*/
|
|
130
137
|
cutByIndex(t, e) {
|
|
131
|
-
return t == e ?
|
|
138
|
+
return t == e ? d.empty : t == 0 && e == this.content.length ? this : new d(this.content.slice(t, e));
|
|
132
139
|
}
|
|
133
140
|
/**
|
|
134
141
|
Create a new fragment in which the node at the given index is
|
|
@@ -139,21 +146,21 @@ var g = class m {
|
|
|
139
146
|
if (r == e)
|
|
140
147
|
return this;
|
|
141
148
|
let i = this.content.slice(), s = this.size + e.nodeSize - r.nodeSize;
|
|
142
|
-
return i[t] = e, new
|
|
149
|
+
return i[t] = e, new d(i, s);
|
|
143
150
|
}
|
|
144
151
|
/**
|
|
145
152
|
Create a new fragment by prepending the given node to this
|
|
146
153
|
fragment.
|
|
147
154
|
*/
|
|
148
155
|
addToStart(t) {
|
|
149
|
-
return new
|
|
156
|
+
return new d([t].concat(this.content), this.size + t.nodeSize);
|
|
150
157
|
}
|
|
151
158
|
/**
|
|
152
159
|
Create a new fragment by appending the given node to this
|
|
153
160
|
fragment.
|
|
154
161
|
*/
|
|
155
162
|
addToEnd(t) {
|
|
156
|
-
return new
|
|
163
|
+
return new d(this.content.concat(t), this.size + t.nodeSize);
|
|
157
164
|
}
|
|
158
165
|
/**
|
|
159
166
|
Compare this fragment to another one.
|
|
@@ -233,15 +240,15 @@ var g = class m {
|
|
|
233
240
|
*/
|
|
234
241
|
findIndex(t) {
|
|
235
242
|
if (t == 0)
|
|
236
|
-
return
|
|
243
|
+
return F(0, t);
|
|
237
244
|
if (t == this.size)
|
|
238
|
-
return
|
|
245
|
+
return F(this.content.length, t);
|
|
239
246
|
if (t > this.size || t < 0)
|
|
240
247
|
throw new RangeError(`Position ${t} outside of fragment (${this})`);
|
|
241
248
|
for (let e = 0, r = 0; ; e++) {
|
|
242
249
|
let i = this.child(e), s = r + i.nodeSize;
|
|
243
250
|
if (s >= t)
|
|
244
|
-
return s == t ?
|
|
251
|
+
return s == t ? F(e + 1, s) : F(e, r);
|
|
245
252
|
r = s;
|
|
246
253
|
}
|
|
247
254
|
}
|
|
@@ -268,10 +275,10 @@ var g = class m {
|
|
|
268
275
|
*/
|
|
269
276
|
static fromJSON(t, e) {
|
|
270
277
|
if (!e)
|
|
271
|
-
return
|
|
278
|
+
return d.empty;
|
|
272
279
|
if (!Array.isArray(e))
|
|
273
280
|
throw new RangeError("Invalid input for Fragment.fromJSON");
|
|
274
|
-
return
|
|
281
|
+
return d.fromArray(e.map(t.nodeFromJSON));
|
|
275
282
|
}
|
|
276
283
|
/**
|
|
277
284
|
Build a fragment from an array of nodes. Ensures that adjacent
|
|
@@ -279,13 +286,13 @@ var g = class m {
|
|
|
279
286
|
*/
|
|
280
287
|
static fromArray(t) {
|
|
281
288
|
if (!t.length)
|
|
282
|
-
return
|
|
289
|
+
return d.empty;
|
|
283
290
|
let e, r = 0;
|
|
284
291
|
for (let i = 0; i < t.length; i++) {
|
|
285
292
|
let s = t[i];
|
|
286
293
|
r += s.nodeSize, i && s.isText && t[i - 1].sameMarkup(s) ? (e || (e = t.slice(0, i)), e[e.length - 1] = s.withText(e[e.length - 1].text + s.text)) : e && e.push(s);
|
|
287
294
|
}
|
|
288
|
-
return new
|
|
295
|
+
return new d(e || t, r);
|
|
289
296
|
}
|
|
290
297
|
/**
|
|
291
298
|
Create a fragment from something that can be interpreted as a
|
|
@@ -295,23 +302,23 @@ var g = class m {
|
|
|
295
302
|
*/
|
|
296
303
|
static from(t) {
|
|
297
304
|
if (!t)
|
|
298
|
-
return
|
|
299
|
-
if (t instanceof
|
|
305
|
+
return d.empty;
|
|
306
|
+
if (t instanceof d)
|
|
300
307
|
return t;
|
|
301
308
|
if (Array.isArray(t))
|
|
302
309
|
return this.fromArray(t);
|
|
303
310
|
if (t.attrs)
|
|
304
|
-
return new
|
|
311
|
+
return new d([t], t.nodeSize);
|
|
305
312
|
throw new RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
306
313
|
}
|
|
307
314
|
};
|
|
308
315
|
g.empty = new g([], 0);
|
|
309
|
-
var
|
|
310
|
-
function
|
|
311
|
-
return
|
|
316
|
+
var $ = { index: 0, offset: 0 };
|
|
317
|
+
function F(n, t) {
|
|
318
|
+
return $.index = n, $.offset = t, $;
|
|
312
319
|
}
|
|
313
|
-
var
|
|
314
|
-
}, c = class
|
|
320
|
+
var Jt = class extends Error {
|
|
321
|
+
}, c = class x {
|
|
315
322
|
/**
|
|
316
323
|
Create a slice. When specifying a non-zero open depth, you must
|
|
317
324
|
make sure that there are nodes of at least that depth at the
|
|
@@ -337,14 +344,14 @@ var It = class extends Error {
|
|
|
337
344
|
@internal
|
|
338
345
|
*/
|
|
339
346
|
insertAt(t, e) {
|
|
340
|
-
let r =
|
|
341
|
-
return r && new
|
|
347
|
+
let r = ht(this.content, t + this.openStart, e, this.openStart + 1, this.openEnd + 1);
|
|
348
|
+
return r && new x(r, this.openStart, this.openEnd);
|
|
342
349
|
}
|
|
343
350
|
/**
|
|
344
351
|
@internal
|
|
345
352
|
*/
|
|
346
353
|
removeBetween(t, e) {
|
|
347
|
-
return new
|
|
354
|
+
return new x(ut(this.content, t + this.openStart, e + this.openStart), this.openStart, this.openEnd);
|
|
348
355
|
}
|
|
349
356
|
/**
|
|
350
357
|
Tests whether this slice is equal to another slice.
|
|
@@ -372,11 +379,11 @@ var It = class extends Error {
|
|
|
372
379
|
*/
|
|
373
380
|
static fromJSON(t, e) {
|
|
374
381
|
if (!e)
|
|
375
|
-
return
|
|
382
|
+
return x.empty;
|
|
376
383
|
let r = e.openStart || 0, i = e.openEnd || 0;
|
|
377
384
|
if (typeof r != "number" || typeof i != "number")
|
|
378
385
|
throw new RangeError("Invalid input for Slice.fromJSON");
|
|
379
|
-
return new
|
|
386
|
+
return new x(g.fromJSON(t, e.content), r, i);
|
|
380
387
|
}
|
|
381
388
|
/**
|
|
382
389
|
Create a slice from a fragment by taking the maximum possible
|
|
@@ -388,11 +395,11 @@ var It = class extends Error {
|
|
|
388
395
|
r++;
|
|
389
396
|
for (let s = t.lastChild; s && !s.isLeaf && (e || !s.type.spec.isolating); s = s.lastChild)
|
|
390
397
|
i++;
|
|
391
|
-
return new
|
|
398
|
+
return new x(t, r, i);
|
|
392
399
|
}
|
|
393
400
|
};
|
|
394
401
|
c.empty = new c(g.empty, 0, 0);
|
|
395
|
-
function
|
|
402
|
+
function ut(n, t, e) {
|
|
396
403
|
let { index: r, offset: i } = n.findIndex(t), s = n.maybeChild(r), { index: o, offset: a } = n.findIndex(e);
|
|
397
404
|
if (i == t || s.isText) {
|
|
398
405
|
if (a != e && !n.child(o).isText)
|
|
@@ -401,26 +408,26 @@ function at(n, t, e) {
|
|
|
401
408
|
}
|
|
402
409
|
if (r != o)
|
|
403
410
|
throw new RangeError("Removing non-flat range");
|
|
404
|
-
return n.replaceChild(r, s.copy(
|
|
411
|
+
return n.replaceChild(r, s.copy(ut(s.content, t - i - 1, e - i - 1)));
|
|
405
412
|
}
|
|
406
|
-
function
|
|
413
|
+
function ht(n, t, e, r, i, s) {
|
|
407
414
|
let { index: o, offset: a } = n.findIndex(t), l = n.maybeChild(o);
|
|
408
415
|
if (a == t || l.isText)
|
|
409
416
|
return s && r <= 0 && i <= 0 && !s.canReplace(o, o, e) ? null : n.cut(0, t).append(e).append(n.cut(t));
|
|
410
|
-
let
|
|
411
|
-
return
|
|
417
|
+
let u = ht(l.content, t - a - 1, e, o == 0 ? r - 1 : 0, o == n.childCount - 1 ? i - 1 : 0, l);
|
|
418
|
+
return u && n.replaceChild(o, l.copy(u));
|
|
412
419
|
}
|
|
413
|
-
var
|
|
414
|
-
function
|
|
415
|
-
return n + t *
|
|
420
|
+
var ct = 65535, ft = Math.pow(2, 16);
|
|
421
|
+
function Mt(n, t) {
|
|
422
|
+
return n + t * ft;
|
|
416
423
|
}
|
|
417
424
|
function _(n) {
|
|
418
|
-
return n &
|
|
425
|
+
return n & ct;
|
|
419
426
|
}
|
|
420
|
-
function
|
|
421
|
-
return (n - (n &
|
|
427
|
+
function bt(n) {
|
|
428
|
+
return (n - (n & ct)) / ft;
|
|
422
429
|
}
|
|
423
|
-
var
|
|
430
|
+
var pt = 1, mt = 2, q = 4, dt = 8, tt = class {
|
|
424
431
|
/**
|
|
425
432
|
@internal
|
|
426
433
|
*/
|
|
@@ -433,19 +440,19 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
433
440
|
argument from the document.
|
|
434
441
|
*/
|
|
435
442
|
get deleted() {
|
|
436
|
-
return (this.delInfo &
|
|
443
|
+
return (this.delInfo & dt) > 0;
|
|
437
444
|
}
|
|
438
445
|
/**
|
|
439
446
|
Tells you whether the token before the mapped position was deleted.
|
|
440
447
|
*/
|
|
441
448
|
get deletedBefore() {
|
|
442
|
-
return (this.delInfo & (
|
|
449
|
+
return (this.delInfo & (pt | q)) > 0;
|
|
443
450
|
}
|
|
444
451
|
/**
|
|
445
452
|
True when the token after the mapped position was deleted.
|
|
446
453
|
*/
|
|
447
454
|
get deletedAfter() {
|
|
448
|
-
return (this.delInfo & (
|
|
455
|
+
return (this.delInfo & (mt | q)) > 0;
|
|
449
456
|
}
|
|
450
457
|
/**
|
|
451
458
|
Tells whether any of the steps mapped through deletes across the
|
|
@@ -453,17 +460,17 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
453
460
|
position).
|
|
454
461
|
*/
|
|
455
462
|
get deletedAcross() {
|
|
456
|
-
return (this.delInfo &
|
|
463
|
+
return (this.delInfo & q) > 0;
|
|
457
464
|
}
|
|
458
|
-
},
|
|
465
|
+
}, v = class N {
|
|
459
466
|
/**
|
|
460
467
|
Create a position map. The modifications to the document are
|
|
461
468
|
represented as an array of numbers, in which each group of three
|
|
462
469
|
represents a modified chunk as `[start, oldSize, newSize]`.
|
|
463
470
|
*/
|
|
464
471
|
constructor(t, e = !1) {
|
|
465
|
-
if (this.ranges = t, this.inverted = e, !t.length &&
|
|
466
|
-
return
|
|
472
|
+
if (this.ranges = t, this.inverted = e, !t.length && N.empty)
|
|
473
|
+
return N.empty;
|
|
467
474
|
}
|
|
468
475
|
/**
|
|
469
476
|
@internal
|
|
@@ -473,7 +480,7 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
473
480
|
if (!this.inverted)
|
|
474
481
|
for (let i = 0; i < r; i++)
|
|
475
482
|
e += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];
|
|
476
|
-
return this.ranges[r * 3] + e +
|
|
483
|
+
return this.ranges[r * 3] + e + bt(t);
|
|
477
484
|
}
|
|
478
485
|
mapResult(t, e = 1) {
|
|
479
486
|
return this._map(t, e, !1);
|
|
@@ -490,15 +497,15 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
490
497
|
let l = this.ranges[a] - (this.inverted ? i : 0);
|
|
491
498
|
if (l > t)
|
|
492
499
|
break;
|
|
493
|
-
let
|
|
494
|
-
if (t <=
|
|
495
|
-
let
|
|
500
|
+
let u = this.ranges[a + s], h = this.ranges[a + o], f = l + u;
|
|
501
|
+
if (t <= f) {
|
|
502
|
+
let k = u ? t == l ? -1 : t == f ? 1 : e : e, E = l + i + (k < 0 ? 0 : h);
|
|
496
503
|
if (r)
|
|
497
504
|
return E;
|
|
498
|
-
let
|
|
499
|
-
return (e < 0 ? t != l : t !=
|
|
505
|
+
let y = t == (e < 0 ? l : f) ? null : Mt(a / 3, t - l), Y = t == l ? mt : t == f ? pt : q;
|
|
506
|
+
return (e < 0 ? t != l : t != f) && (Y |= dt), new tt(E, Y, y);
|
|
500
507
|
}
|
|
501
|
-
i +=
|
|
508
|
+
i += h - u;
|
|
502
509
|
}
|
|
503
510
|
return r ? t + i : new tt(t + i, 0, null);
|
|
504
511
|
}
|
|
@@ -511,10 +518,10 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
511
518
|
let l = this.ranges[a] - (this.inverted ? r : 0);
|
|
512
519
|
if (l > t)
|
|
513
520
|
break;
|
|
514
|
-
let
|
|
515
|
-
if (t <=
|
|
521
|
+
let u = this.ranges[a + s], h = l + u;
|
|
522
|
+
if (t <= h && a == i * 3)
|
|
516
523
|
return !0;
|
|
517
|
-
r += this.ranges[a + o] -
|
|
524
|
+
r += this.ranges[a + o] - u;
|
|
518
525
|
}
|
|
519
526
|
return !1;
|
|
520
527
|
}
|
|
@@ -525,8 +532,8 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
525
532
|
forEach(t) {
|
|
526
533
|
let e = this.inverted ? 2 : 1, r = this.inverted ? 1 : 2;
|
|
527
534
|
for (let i = 0, s = 0; i < this.ranges.length; i += 3) {
|
|
528
|
-
let o = this.ranges[i], a = o - (this.inverted ? s : 0), l = o + (this.inverted ? 0 : s),
|
|
529
|
-
t(a, a +
|
|
535
|
+
let o = this.ranges[i], a = o - (this.inverted ? s : 0), l = o + (this.inverted ? 0 : s), u = this.ranges[i + e], h = this.ranges[i + r];
|
|
536
|
+
t(a, a + u, l, l + h), s += h - u;
|
|
530
537
|
}
|
|
531
538
|
}
|
|
532
539
|
/**
|
|
@@ -534,7 +541,7 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
534
541
|
map positions in the post-step document to the pre-step document.
|
|
535
542
|
*/
|
|
536
543
|
invert() {
|
|
537
|
-
return new
|
|
544
|
+
return new N(this.ranges, !this.inverted);
|
|
538
545
|
}
|
|
539
546
|
/**
|
|
540
547
|
@internal
|
|
@@ -548,18 +555,18 @@ var ct = 1, ft = 2, D = 4, pt = 8, tt = class {
|
|
|
548
555
|
sub-document to a larger document, or vice-versa.
|
|
549
556
|
*/
|
|
550
557
|
static offset(t) {
|
|
551
|
-
return t == 0 ?
|
|
558
|
+
return t == 0 ? N.empty : new N(t < 0 ? [0, -t, 0] : [0, 0, t]);
|
|
552
559
|
}
|
|
553
560
|
};
|
|
554
|
-
|
|
555
|
-
var
|
|
561
|
+
v.empty = new v([]);
|
|
562
|
+
var K = /* @__PURE__ */ Object.create(null), m = class {
|
|
556
563
|
/**
|
|
557
564
|
Get the step map that represents the changes made by this step,
|
|
558
565
|
and which can be used to transform between positions in the old
|
|
559
566
|
and the new document.
|
|
560
567
|
*/
|
|
561
568
|
getMap() {
|
|
562
|
-
return
|
|
569
|
+
return v.empty;
|
|
563
570
|
}
|
|
564
571
|
/**
|
|
565
572
|
Try to merge this step with another one, to be applied directly
|
|
@@ -576,7 +583,7 @@ var $ = /* @__PURE__ */ Object.create(null), p = class {
|
|
|
576
583
|
static fromJSON(n, t) {
|
|
577
584
|
if (!t || !t.stepType)
|
|
578
585
|
throw new RangeError("Invalid input for Step.fromJSON");
|
|
579
|
-
let e =
|
|
586
|
+
let e = K[t.stepType];
|
|
580
587
|
if (!e)
|
|
581
588
|
throw new RangeError(`No step type ${t.stepType} defined`);
|
|
582
589
|
return e.fromJSON(n, t);
|
|
@@ -588,11 +595,11 @@ var $ = /* @__PURE__ */ Object.create(null), p = class {
|
|
|
588
595
|
that's unlikely to clash with steps from other modules.
|
|
589
596
|
*/
|
|
590
597
|
static jsonID(n, t) {
|
|
591
|
-
if (n in
|
|
598
|
+
if (n in K)
|
|
592
599
|
throw new RangeError("Duplicate use of step JSON ID " + n);
|
|
593
|
-
return
|
|
600
|
+
return K[n] = t, t.prototype.jsonID = n, t;
|
|
594
601
|
}
|
|
595
|
-
},
|
|
602
|
+
}, S = class T {
|
|
596
603
|
/**
|
|
597
604
|
@internal
|
|
598
605
|
*/
|
|
@@ -620,21 +627,21 @@ var $ = /* @__PURE__ */ Object.create(null), p = class {
|
|
|
620
627
|
try {
|
|
621
628
|
return T.ok(t.replace(e, r, i));
|
|
622
629
|
} catch (s) {
|
|
623
|
-
if (s instanceof
|
|
630
|
+
if (s instanceof Jt)
|
|
624
631
|
return T.fail(s.message);
|
|
625
632
|
throw s;
|
|
626
633
|
}
|
|
627
634
|
}
|
|
628
635
|
};
|
|
629
|
-
function
|
|
636
|
+
function U(n, t, e) {
|
|
630
637
|
let r = [];
|
|
631
638
|
for (let i = 0; i < n.childCount; i++) {
|
|
632
639
|
let s = n.child(i);
|
|
633
|
-
s.content.size && (s = s.copy(
|
|
640
|
+
s.content.size && (s = s.copy(U(s.content, t, s))), s.isInline && (s = t(s, e, i)), r.push(s);
|
|
634
641
|
}
|
|
635
642
|
return g.fromArray(r);
|
|
636
643
|
}
|
|
637
|
-
var
|
|
644
|
+
var St = class I extends m {
|
|
638
645
|
/**
|
|
639
646
|
Create a mark step.
|
|
640
647
|
*/
|
|
@@ -642,18 +649,18 @@ var mt = class A extends p {
|
|
|
642
649
|
super(), this.from = t, this.to = e, this.mark = r;
|
|
643
650
|
}
|
|
644
651
|
apply(t) {
|
|
645
|
-
let e = t.slice(this.from, this.to), r = t.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new c(
|
|
646
|
-
return
|
|
652
|
+
let e = t.slice(this.from, this.to), r = t.resolve(this.from), i = r.node(r.sharedDepth(this.to)), s = new c(U(e.content, (o, a) => !o.isAtom || !a.type.allowsMarkType(this.mark.type) ? o : o.mark(this.mark.addToSet(o.marks)), i), e.openStart, e.openEnd);
|
|
653
|
+
return S.fromReplace(t, this.from, this.to, s);
|
|
647
654
|
}
|
|
648
655
|
invert() {
|
|
649
|
-
return new
|
|
656
|
+
return new gt(this.from, this.to, this.mark);
|
|
650
657
|
}
|
|
651
658
|
map(t) {
|
|
652
659
|
let e = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
653
|
-
return e.deleted && r.deleted || e.pos >= r.pos ? null : new
|
|
660
|
+
return e.deleted && r.deleted || e.pos >= r.pos ? null : new I(e.pos, r.pos, this.mark);
|
|
654
661
|
}
|
|
655
662
|
merge(t) {
|
|
656
|
-
return t instanceof
|
|
663
|
+
return t instanceof I && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new I(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
|
|
657
664
|
}
|
|
658
665
|
toJSON() {
|
|
659
666
|
return {
|
|
@@ -669,11 +676,11 @@ var mt = class A extends p {
|
|
|
669
676
|
static fromJSON(t, e) {
|
|
670
677
|
if (typeof e.from != "number" || typeof e.to != "number")
|
|
671
678
|
throw new RangeError("Invalid input for AddMarkStep.fromJSON");
|
|
672
|
-
return new
|
|
679
|
+
return new I(e.from, e.to, t.markFromJSON(e.mark));
|
|
673
680
|
}
|
|
674
681
|
};
|
|
675
|
-
|
|
676
|
-
var
|
|
682
|
+
m.jsonID("addMark", St);
|
|
683
|
+
var gt = class z extends m {
|
|
677
684
|
/**
|
|
678
685
|
Create a mark-removing step.
|
|
679
686
|
*/
|
|
@@ -681,18 +688,18 @@ var dt = class I extends p {
|
|
|
681
688
|
super(), this.from = t, this.to = e, this.mark = r;
|
|
682
689
|
}
|
|
683
690
|
apply(t) {
|
|
684
|
-
let e = t.slice(this.from, this.to), r = new c(
|
|
685
|
-
return
|
|
691
|
+
let e = t.slice(this.from, this.to), r = new c(U(e.content, (i) => i.mark(this.mark.removeFromSet(i.marks)), t), e.openStart, e.openEnd);
|
|
692
|
+
return S.fromReplace(t, this.from, this.to, r);
|
|
686
693
|
}
|
|
687
694
|
invert() {
|
|
688
|
-
return new
|
|
695
|
+
return new St(this.from, this.to, this.mark);
|
|
689
696
|
}
|
|
690
697
|
map(t) {
|
|
691
698
|
let e = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
692
|
-
return e.deleted && r.deleted || e.pos >= r.pos ? null : new
|
|
699
|
+
return e.deleted && r.deleted || e.pos >= r.pos ? null : new z(e.pos, r.pos, this.mark);
|
|
693
700
|
}
|
|
694
701
|
merge(t) {
|
|
695
|
-
return t instanceof
|
|
702
|
+
return t instanceof z && t.mark.eq(this.mark) && this.from <= t.to && this.to >= t.from ? new z(Math.min(this.from, t.from), Math.max(this.to, t.to), this.mark) : null;
|
|
696
703
|
}
|
|
697
704
|
toJSON() {
|
|
698
705
|
return {
|
|
@@ -708,11 +715,11 @@ var dt = class I extends p {
|
|
|
708
715
|
static fromJSON(t, e) {
|
|
709
716
|
if (typeof e.from != "number" || typeof e.to != "number")
|
|
710
717
|
throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");
|
|
711
|
-
return new
|
|
718
|
+
return new z(e.from, e.to, t.markFromJSON(e.mark));
|
|
712
719
|
}
|
|
713
720
|
};
|
|
714
|
-
|
|
715
|
-
var
|
|
721
|
+
m.jsonID("removeMark", gt);
|
|
722
|
+
var wt = class J extends m {
|
|
716
723
|
/**
|
|
717
724
|
Create a node mark step.
|
|
718
725
|
*/
|
|
@@ -722,9 +729,9 @@ var St = class z extends p {
|
|
|
722
729
|
apply(t) {
|
|
723
730
|
let e = t.nodeAt(this.pos);
|
|
724
731
|
if (!e)
|
|
725
|
-
return
|
|
732
|
+
return S.fail("No node at mark step's position");
|
|
726
733
|
let r = e.type.create(e.attrs, null, this.mark.addToSet(e.marks));
|
|
727
|
-
return
|
|
734
|
+
return S.fromReplace(t, this.pos, this.pos + 1, new c(g.from(r), 0, e.isLeaf ? 0 : 1));
|
|
728
735
|
}
|
|
729
736
|
invert(t) {
|
|
730
737
|
let e = t.nodeAt(this.pos);
|
|
@@ -733,15 +740,15 @@ var St = class z extends p {
|
|
|
733
740
|
if (r.length == e.marks.length) {
|
|
734
741
|
for (let i = 0; i < e.marks.length; i++)
|
|
735
742
|
if (!e.marks[i].isInSet(r))
|
|
736
|
-
return new
|
|
737
|
-
return new
|
|
743
|
+
return new J(this.pos, e.marks[i]);
|
|
744
|
+
return new J(this.pos, this.mark);
|
|
738
745
|
}
|
|
739
746
|
}
|
|
740
|
-
return new
|
|
747
|
+
return new kt(this.pos, this.mark);
|
|
741
748
|
}
|
|
742
749
|
map(t) {
|
|
743
750
|
let e = t.mapResult(this.pos, 1);
|
|
744
|
-
return e.deletedAfter ? null : new
|
|
751
|
+
return e.deletedAfter ? null : new J(e.pos, this.mark);
|
|
745
752
|
}
|
|
746
753
|
toJSON() {
|
|
747
754
|
return { stepType: "addNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -752,11 +759,11 @@ var St = class z extends p {
|
|
|
752
759
|
static fromJSON(t, e) {
|
|
753
760
|
if (typeof e.pos != "number")
|
|
754
761
|
throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");
|
|
755
|
-
return new
|
|
762
|
+
return new J(e.pos, t.markFromJSON(e.mark));
|
|
756
763
|
}
|
|
757
764
|
};
|
|
758
|
-
|
|
759
|
-
var
|
|
765
|
+
m.jsonID("addNodeMark", wt);
|
|
766
|
+
var kt = class V extends m {
|
|
760
767
|
/**
|
|
761
768
|
Create a mark-removing step.
|
|
762
769
|
*/
|
|
@@ -766,17 +773,17 @@ var gt = class W extends p {
|
|
|
766
773
|
apply(t) {
|
|
767
774
|
let e = t.nodeAt(this.pos);
|
|
768
775
|
if (!e)
|
|
769
|
-
return
|
|
776
|
+
return S.fail("No node at mark step's position");
|
|
770
777
|
let r = e.type.create(e.attrs, null, this.mark.removeFromSet(e.marks));
|
|
771
|
-
return
|
|
778
|
+
return S.fromReplace(t, this.pos, this.pos + 1, new c(g.from(r), 0, e.isLeaf ? 0 : 1));
|
|
772
779
|
}
|
|
773
780
|
invert(t) {
|
|
774
781
|
let e = t.nodeAt(this.pos);
|
|
775
|
-
return !e || !this.mark.isInSet(e.marks) ? this : new
|
|
782
|
+
return !e || !this.mark.isInSet(e.marks) ? this : new wt(this.pos, this.mark);
|
|
776
783
|
}
|
|
777
784
|
map(t) {
|
|
778
785
|
let e = t.mapResult(this.pos, 1);
|
|
779
|
-
return e.deletedAfter ? null : new
|
|
786
|
+
return e.deletedAfter ? null : new V(e.pos, this.mark);
|
|
780
787
|
}
|
|
781
788
|
toJSON() {
|
|
782
789
|
return { stepType: "removeNodeMark", pos: this.pos, mark: this.mark.toJSON() };
|
|
@@ -787,11 +794,11 @@ var gt = class W extends p {
|
|
|
787
794
|
static fromJSON(t, e) {
|
|
788
795
|
if (typeof e.pos != "number")
|
|
789
796
|
throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");
|
|
790
|
-
return new
|
|
797
|
+
return new V(e.pos, t.markFromJSON(e.mark));
|
|
791
798
|
}
|
|
792
799
|
};
|
|
793
|
-
|
|
794
|
-
var
|
|
800
|
+
m.jsonID("removeNodeMark", kt);
|
|
801
|
+
var X = class w extends m {
|
|
795
802
|
/**
|
|
796
803
|
The given `slice` should fit the 'gap' between `from` and
|
|
797
804
|
`to`—the depths must line up, and the surrounding nodes must be
|
|
@@ -805,10 +812,10 @@ var U = class w extends p {
|
|
|
805
812
|
super(), this.from = t, this.to = e, this.slice = r, this.structure = i;
|
|
806
813
|
}
|
|
807
814
|
apply(t) {
|
|
808
|
-
return this.structure &&
|
|
815
|
+
return this.structure && G(t, this.from, this.to) ? S.fail("Structure replace would overwrite content") : S.fromReplace(t, this.from, this.to, this.slice);
|
|
809
816
|
}
|
|
810
817
|
getMap() {
|
|
811
|
-
return new
|
|
818
|
+
return new v([this.from, this.to - this.from, this.slice.size]);
|
|
812
819
|
}
|
|
813
820
|
invert(t) {
|
|
814
821
|
return new w(this.from, this.from + this.slice.size, t.slice(this.from, this.to));
|
|
@@ -842,9 +849,9 @@ var U = class w extends p {
|
|
|
842
849
|
return new w(e.from, e.to, c.fromJSON(t, e.slice), !!e.structure);
|
|
843
850
|
}
|
|
844
851
|
};
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
var
|
|
852
|
+
X.MAP_BIAS = 1;
|
|
853
|
+
m.jsonID("replace", X);
|
|
854
|
+
var vt = class L extends m {
|
|
848
855
|
/**
|
|
849
856
|
Create a replace-around step with the given range and gap.
|
|
850
857
|
`insert` should be the point in the slice into which the content
|
|
@@ -855,16 +862,16 @@ var wt = class q extends p {
|
|
|
855
862
|
super(), this.from = t, this.to = e, this.gapFrom = r, this.gapTo = i, this.slice = s, this.insert = o, this.structure = a;
|
|
856
863
|
}
|
|
857
864
|
apply(t) {
|
|
858
|
-
if (this.structure && (
|
|
859
|
-
return
|
|
865
|
+
if (this.structure && (G(t, this.from, this.gapFrom) || G(t, this.gapTo, this.to)))
|
|
866
|
+
return S.fail("Structure gap-replace would overwrite content");
|
|
860
867
|
let e = t.slice(this.gapFrom, this.gapTo);
|
|
861
868
|
if (e.openStart || e.openEnd)
|
|
862
|
-
return
|
|
869
|
+
return S.fail("Gap is not a flat range");
|
|
863
870
|
let r = this.slice.insertAt(this.insert, e.content);
|
|
864
|
-
return r ?
|
|
871
|
+
return r ? S.fromReplace(t, this.from, this.to, r) : S.fail("Content does not fit in gap");
|
|
865
872
|
}
|
|
866
873
|
getMap() {
|
|
867
|
-
return new
|
|
874
|
+
return new v([
|
|
868
875
|
this.from,
|
|
869
876
|
this.gapFrom - this.from,
|
|
870
877
|
this.insert,
|
|
@@ -875,11 +882,11 @@ var wt = class q extends p {
|
|
|
875
882
|
}
|
|
876
883
|
invert(t) {
|
|
877
884
|
let e = this.gapTo - this.gapFrom;
|
|
878
|
-
return new
|
|
885
|
+
return new L(this.from, this.from + this.slice.size + e, this.from + this.insert, this.from + this.insert + e, t.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);
|
|
879
886
|
}
|
|
880
887
|
map(t) {
|
|
881
888
|
let e = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1), i = this.from == this.gapFrom ? e.pos : t.map(this.gapFrom, -1), s = this.to == this.gapTo ? r.pos : t.map(this.gapTo, 1);
|
|
882
|
-
return e.deletedAcross && r.deletedAcross || i < e.pos || s > r.pos ? null : new
|
|
889
|
+
return e.deletedAcross && r.deletedAcross || i < e.pos || s > r.pos ? null : new L(e.pos, r.pos, i, s, this.slice, this.insert, this.structure);
|
|
883
890
|
}
|
|
884
891
|
toJSON() {
|
|
885
892
|
let t = {
|
|
@@ -898,11 +905,11 @@ var wt = class q extends p {
|
|
|
898
905
|
static fromJSON(t, e) {
|
|
899
906
|
if (typeof e.from != "number" || typeof e.to != "number" || typeof e.gapFrom != "number" || typeof e.gapTo != "number" || typeof e.insert != "number")
|
|
900
907
|
throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");
|
|
901
|
-
return new
|
|
908
|
+
return new L(e.from, e.to, e.gapFrom, e.gapTo, c.fromJSON(t, e.slice), e.insert, !!e.structure);
|
|
902
909
|
}
|
|
903
910
|
};
|
|
904
|
-
|
|
905
|
-
function
|
|
911
|
+
m.jsonID("replaceAround", vt);
|
|
912
|
+
function G(n, t, e) {
|
|
906
913
|
let r = n.resolve(t), i = e - t, s = r.depth;
|
|
907
914
|
for (; i > 0 && s > 0 && r.indexAfter(s) == r.node(s).childCount; )
|
|
908
915
|
s--, i--;
|
|
@@ -916,7 +923,7 @@ function V(n, t, e) {
|
|
|
916
923
|
}
|
|
917
924
|
return !1;
|
|
918
925
|
}
|
|
919
|
-
var
|
|
926
|
+
var Ct = class P extends m {
|
|
920
927
|
/**
|
|
921
928
|
Construct an attribute step.
|
|
922
929
|
*/
|
|
@@ -926,23 +933,23 @@ var Mt = class L extends p {
|
|
|
926
933
|
apply(t) {
|
|
927
934
|
let e = t.nodeAt(this.pos);
|
|
928
935
|
if (!e)
|
|
929
|
-
return
|
|
936
|
+
return S.fail("No node at attribute step's position");
|
|
930
937
|
let r = /* @__PURE__ */ Object.create(null);
|
|
931
938
|
for (let s in e.attrs)
|
|
932
939
|
r[s] = e.attrs[s];
|
|
933
940
|
r[this.attr] = this.value;
|
|
934
941
|
let i = e.type.create(r, null, e.marks);
|
|
935
|
-
return
|
|
942
|
+
return S.fromReplace(t, this.pos, this.pos + 1, new c(g.from(i), 0, e.isLeaf ? 0 : 1));
|
|
936
943
|
}
|
|
937
944
|
getMap() {
|
|
938
|
-
return
|
|
945
|
+
return v.empty;
|
|
939
946
|
}
|
|
940
947
|
invert(t) {
|
|
941
|
-
return new
|
|
948
|
+
return new P(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
942
949
|
}
|
|
943
950
|
map(t) {
|
|
944
951
|
let e = t.mapResult(this.pos, 1);
|
|
945
|
-
return e.deletedAfter ? null : new
|
|
952
|
+
return e.deletedAfter ? null : new P(e.pos, this.attr, this.value);
|
|
946
953
|
}
|
|
947
954
|
toJSON() {
|
|
948
955
|
return { stepType: "attr", pos: this.pos, attr: this.attr, value: this.value };
|
|
@@ -950,11 +957,11 @@ var Mt = class L extends p {
|
|
|
950
957
|
static fromJSON(t, e) {
|
|
951
958
|
if (typeof e.pos != "number" || typeof e.attr != "string")
|
|
952
959
|
throw new RangeError("Invalid input for AttrStep.fromJSON");
|
|
953
|
-
return new
|
|
960
|
+
return new P(e.pos, e.attr, e.value);
|
|
954
961
|
}
|
|
955
962
|
};
|
|
956
|
-
|
|
957
|
-
var
|
|
963
|
+
m.jsonID("attr", Ct);
|
|
964
|
+
var Bt = class Q extends m {
|
|
958
965
|
/**
|
|
959
966
|
Construct an attribute step.
|
|
960
967
|
*/
|
|
@@ -967,13 +974,13 @@ var bt = class G extends p {
|
|
|
967
974
|
e[i] = t.attrs[i];
|
|
968
975
|
e[this.attr] = this.value;
|
|
969
976
|
let r = t.type.create(e, t.content, t.marks);
|
|
970
|
-
return
|
|
977
|
+
return S.ok(r);
|
|
971
978
|
}
|
|
972
979
|
getMap() {
|
|
973
|
-
return
|
|
980
|
+
return v.empty;
|
|
974
981
|
}
|
|
975
982
|
invert(t) {
|
|
976
|
-
return new
|
|
983
|
+
return new Q(this.attr, t.attrs[this.attr]);
|
|
977
984
|
}
|
|
978
985
|
map(t) {
|
|
979
986
|
return this;
|
|
@@ -984,27 +991,27 @@ var bt = class G extends p {
|
|
|
984
991
|
static fromJSON(t, e) {
|
|
985
992
|
if (typeof e.attr != "string")
|
|
986
993
|
throw new RangeError("Invalid input for DocAttrStep.fromJSON");
|
|
987
|
-
return new
|
|
994
|
+
return new Q(e.attr, e.value);
|
|
988
995
|
}
|
|
989
996
|
};
|
|
990
|
-
|
|
991
|
-
var
|
|
997
|
+
m.jsonID("docAttr", Bt);
|
|
998
|
+
var B = class extends Error {
|
|
992
999
|
};
|
|
993
|
-
|
|
1000
|
+
B = function n(t) {
|
|
994
1001
|
let e = Error.call(this, t);
|
|
995
1002
|
return e.__proto__ = n.prototype, e;
|
|
996
1003
|
};
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
var
|
|
1004
|
+
B.prototype = Object.create(Error.prototype);
|
|
1005
|
+
B.prototype.constructor = B;
|
|
1006
|
+
B.prototype.name = "TransformError";
|
|
1007
|
+
var W = /* @__PURE__ */ Object.create(null), p = class {
|
|
1001
1008
|
/**
|
|
1002
1009
|
Initialize a selection with the head and anchor and ranges. If no
|
|
1003
1010
|
ranges are given, constructs a single range across `$anchor` and
|
|
1004
1011
|
`$head`.
|
|
1005
1012
|
*/
|
|
1006
1013
|
constructor(n, t, e) {
|
|
1007
|
-
this.$anchor = n, this.$head = t, this.ranges = e || [new
|
|
1014
|
+
this.$anchor = n, this.$head = t, this.ranges = e || [new Ft(n.min(t), n.max(t))];
|
|
1008
1015
|
}
|
|
1009
1016
|
/**
|
|
1010
1017
|
The selection's anchor, as an unresolved position.
|
|
@@ -1068,8 +1075,8 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1068
1075
|
r = e, e = e.lastChild;
|
|
1069
1076
|
let i = n.steps.length, s = this.ranges;
|
|
1070
1077
|
for (let o = 0; o < s.length; o++) {
|
|
1071
|
-
let { $from: a, $to: l } = s[o],
|
|
1072
|
-
n.replaceRange(
|
|
1078
|
+
let { $from: a, $to: l } = s[o], u = n.mapping.slice(i);
|
|
1079
|
+
n.replaceRange(u.map(a.pos), u.map(l.pos), o ? c.empty : t), o == 0 && nt(n, i, (e ? e.isInline : r && r.isTextblock) ? -1 : 1);
|
|
1073
1080
|
}
|
|
1074
1081
|
}
|
|
1075
1082
|
/**
|
|
@@ -1079,8 +1086,8 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1079
1086
|
replaceWith(n, t) {
|
|
1080
1087
|
let e = n.steps.length, r = this.ranges;
|
|
1081
1088
|
for (let i = 0; i < r.length; i++) {
|
|
1082
|
-
let { $from: s, $to: o } = r[i], a = n.mapping.slice(e), l = a.map(s.pos),
|
|
1083
|
-
i ? n.deleteRange(l,
|
|
1089
|
+
let { $from: s, $to: o } = r[i], a = n.mapping.slice(e), l = a.map(s.pos), u = a.map(o.pos);
|
|
1090
|
+
i ? n.deleteRange(l, u) : (n.replaceRangeWith(l, u, t), nt(n, e, t.isInline ? -1 : 1));
|
|
1084
1091
|
}
|
|
1085
1092
|
}
|
|
1086
1093
|
/**
|
|
@@ -1091,11 +1098,11 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1091
1098
|
found.
|
|
1092
1099
|
*/
|
|
1093
1100
|
static findFrom(n, t, e = !1) {
|
|
1094
|
-
let r = n.parent.inlineContent ? new
|
|
1101
|
+
let r = n.parent.inlineContent ? new A(n) : R(n.node(0), n.parent, n.pos, n.index(), t, e);
|
|
1095
1102
|
if (r)
|
|
1096
1103
|
return r;
|
|
1097
1104
|
for (let i = n.depth - 1; i >= 0; i--) {
|
|
1098
|
-
let s = t < 0 ?
|
|
1105
|
+
let s = t < 0 ? R(n.node(0), n.node(i), n.before(i + 1), n.index(i), t, e) : R(n.node(0), n.node(i), n.after(i + 1), n.index(i) + 1, t, e);
|
|
1099
1106
|
if (s)
|
|
1100
1107
|
return s;
|
|
1101
1108
|
}
|
|
@@ -1107,7 +1114,7 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1107
1114
|
negative, it will search backwards first.
|
|
1108
1115
|
*/
|
|
1109
1116
|
static near(n, t = 1) {
|
|
1110
|
-
return this.findFrom(n, t) || this.findFrom(n, -t) || new
|
|
1117
|
+
return this.findFrom(n, t) || this.findFrom(n, -t) || new C(n.node(0));
|
|
1111
1118
|
}
|
|
1112
1119
|
/**
|
|
1113
1120
|
Find the cursor or leaf node selection closest to the start of
|
|
@@ -1116,14 +1123,14 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1116
1123
|
exists.
|
|
1117
1124
|
*/
|
|
1118
1125
|
static atStart(n) {
|
|
1119
|
-
return
|
|
1126
|
+
return R(n, n, 0, 0, 1) || new C(n);
|
|
1120
1127
|
}
|
|
1121
1128
|
/**
|
|
1122
1129
|
Find the cursor or leaf node selection closest to the end of the
|
|
1123
1130
|
given document.
|
|
1124
1131
|
*/
|
|
1125
1132
|
static atEnd(n) {
|
|
1126
|
-
return
|
|
1133
|
+
return R(n, n, n.content.size, n.childCount, -1) || new C(n);
|
|
1127
1134
|
}
|
|
1128
1135
|
/**
|
|
1129
1136
|
Deserialize the JSON representation of a selection. Must be
|
|
@@ -1132,7 +1139,7 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1132
1139
|
static fromJSON(n, t) {
|
|
1133
1140
|
if (!t || !t.type)
|
|
1134
1141
|
throw new RangeError("Invalid input for Selection.fromJSON");
|
|
1135
|
-
let e =
|
|
1142
|
+
let e = W[t.type];
|
|
1136
1143
|
if (!e)
|
|
1137
1144
|
throw new RangeError(`No selection type ${t.type} defined`);
|
|
1138
1145
|
return e.fromJSON(n, t);
|
|
@@ -1144,9 +1151,9 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1144
1151
|
clash with classes from other modules.
|
|
1145
1152
|
*/
|
|
1146
1153
|
static jsonID(n, t) {
|
|
1147
|
-
if (n in
|
|
1154
|
+
if (n in W)
|
|
1148
1155
|
throw new RangeError("Duplicate use of selection JSON ID " + n);
|
|
1149
|
-
return
|
|
1156
|
+
return W[n] = t, t.prototype.jsonID = n, t;
|
|
1150
1157
|
}
|
|
1151
1158
|
/**
|
|
1152
1159
|
Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,
|
|
@@ -1158,11 +1165,11 @@ var K = /* @__PURE__ */ Object.create(null), f = class {
|
|
|
1158
1165
|
returns the bookmark for that.
|
|
1159
1166
|
*/
|
|
1160
1167
|
getBookmark() {
|
|
1161
|
-
return
|
|
1168
|
+
return A.between(this.$anchor, this.$head).getBookmark();
|
|
1162
1169
|
}
|
|
1163
1170
|
};
|
|
1164
|
-
|
|
1165
|
-
var
|
|
1171
|
+
p.prototype.visible = !0;
|
|
1172
|
+
var Ft = class {
|
|
1166
1173
|
/**
|
|
1167
1174
|
Create a range.
|
|
1168
1175
|
*/
|
|
@@ -1173,7 +1180,7 @@ var Ct = class {
|
|
|
1173
1180
|
function rt(n) {
|
|
1174
1181
|
!et && !n.parent.inlineContent && (et = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + n.parent.type.name + ")"));
|
|
1175
1182
|
}
|
|
1176
|
-
var
|
|
1183
|
+
var A = class M extends p {
|
|
1177
1184
|
/**
|
|
1178
1185
|
Construct a text selection between the given points.
|
|
1179
1186
|
*/
|
|
@@ -1190,9 +1197,9 @@ var R = class J extends f {
|
|
|
1190
1197
|
map(t, e) {
|
|
1191
1198
|
let r = t.resolve(e.map(this.head));
|
|
1192
1199
|
if (!r.parent.inlineContent)
|
|
1193
|
-
return
|
|
1200
|
+
return p.near(r);
|
|
1194
1201
|
let i = t.resolve(e.map(this.anchor));
|
|
1195
|
-
return new
|
|
1202
|
+
return new M(i.parent.inlineContent ? i : r, r);
|
|
1196
1203
|
}
|
|
1197
1204
|
replace(t, e = c.empty) {
|
|
1198
1205
|
if (super.replace(t, e), e == c.empty) {
|
|
@@ -1201,10 +1208,10 @@ var R = class J extends f {
|
|
|
1201
1208
|
}
|
|
1202
1209
|
}
|
|
1203
1210
|
eq(t) {
|
|
1204
|
-
return t instanceof
|
|
1211
|
+
return t instanceof M && t.anchor == this.anchor && t.head == this.head;
|
|
1205
1212
|
}
|
|
1206
1213
|
getBookmark() {
|
|
1207
|
-
return new
|
|
1214
|
+
return new yt(this.anchor, this.head);
|
|
1208
1215
|
}
|
|
1209
1216
|
toJSON() {
|
|
1210
1217
|
return { type: "text", anchor: this.anchor, head: this.head };
|
|
@@ -1215,7 +1222,7 @@ var R = class J extends f {
|
|
|
1215
1222
|
static fromJSON(t, e) {
|
|
1216
1223
|
if (typeof e.anchor != "number" || typeof e.head != "number")
|
|
1217
1224
|
throw new RangeError("Invalid input for TextSelection.fromJSON");
|
|
1218
|
-
return new
|
|
1225
|
+
return new M(t.resolve(e.anchor), t.resolve(e.head));
|
|
1219
1226
|
}
|
|
1220
1227
|
/**
|
|
1221
1228
|
Create a text selection from non-resolved positions.
|
|
@@ -1235,27 +1242,27 @@ var R = class J extends f {
|
|
|
1235
1242
|
static between(t, e, r) {
|
|
1236
1243
|
let i = t.pos - e.pos;
|
|
1237
1244
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !e.parent.inlineContent) {
|
|
1238
|
-
let s =
|
|
1245
|
+
let s = p.findFrom(e, r, !0) || p.findFrom(e, -r, !0);
|
|
1239
1246
|
if (s)
|
|
1240
1247
|
e = s.$head;
|
|
1241
1248
|
else
|
|
1242
|
-
return
|
|
1249
|
+
return p.near(e, r);
|
|
1243
1250
|
}
|
|
1244
|
-
return t.parent.inlineContent || (i == 0 ? t = e : (t = (
|
|
1251
|
+
return t.parent.inlineContent || (i == 0 ? t = e : (t = (p.findFrom(t, -r, !0) || p.findFrom(t, r, !0)).$anchor, t.pos < e.pos != i < 0 && (t = e))), new M(t, e);
|
|
1245
1252
|
}
|
|
1246
1253
|
};
|
|
1247
|
-
|
|
1248
|
-
var
|
|
1254
|
+
p.jsonID("text", A);
|
|
1255
|
+
var yt = class xt {
|
|
1249
1256
|
constructor(t, e) {
|
|
1250
1257
|
this.anchor = t, this.head = e;
|
|
1251
1258
|
}
|
|
1252
1259
|
map(t) {
|
|
1253
|
-
return new
|
|
1260
|
+
return new xt(t.map(this.anchor), t.map(this.head));
|
|
1254
1261
|
}
|
|
1255
1262
|
resolve(t) {
|
|
1256
|
-
return
|
|
1263
|
+
return A.between(t.resolve(this.anchor), t.resolve(this.head));
|
|
1257
1264
|
}
|
|
1258
|
-
}, O = class
|
|
1265
|
+
}, O = class b extends p {
|
|
1259
1266
|
/**
|
|
1260
1267
|
Create a node selection. Does not verify the validity of its
|
|
1261
1268
|
argument.
|
|
@@ -1266,19 +1273,19 @@ var kt = class vt {
|
|
|
1266
1273
|
}
|
|
1267
1274
|
map(t, e) {
|
|
1268
1275
|
let { deleted: r, pos: i } = e.mapResult(this.anchor), s = t.resolve(i);
|
|
1269
|
-
return r ?
|
|
1276
|
+
return r ? p.near(s) : new b(s);
|
|
1270
1277
|
}
|
|
1271
1278
|
content() {
|
|
1272
1279
|
return new c(g.from(this.node), 0, 0);
|
|
1273
1280
|
}
|
|
1274
1281
|
eq(t) {
|
|
1275
|
-
return t instanceof
|
|
1282
|
+
return t instanceof b && t.anchor == this.anchor;
|
|
1276
1283
|
}
|
|
1277
1284
|
toJSON() {
|
|
1278
1285
|
return { type: "node", anchor: this.anchor };
|
|
1279
1286
|
}
|
|
1280
1287
|
getBookmark() {
|
|
1281
|
-
return new
|
|
1288
|
+
return new Dt(this.anchor);
|
|
1282
1289
|
}
|
|
1283
1290
|
/**
|
|
1284
1291
|
@internal
|
|
@@ -1286,13 +1293,13 @@ var kt = class vt {
|
|
|
1286
1293
|
static fromJSON(t, e) {
|
|
1287
1294
|
if (typeof e.anchor != "number")
|
|
1288
1295
|
throw new RangeError("Invalid input for NodeSelection.fromJSON");
|
|
1289
|
-
return new
|
|
1296
|
+
return new b(t.resolve(e.anchor));
|
|
1290
1297
|
}
|
|
1291
1298
|
/**
|
|
1292
1299
|
Create a node selection from non-resolved positions.
|
|
1293
1300
|
*/
|
|
1294
1301
|
static create(t, e) {
|
|
1295
|
-
return new
|
|
1302
|
+
return new b(t.resolve(e));
|
|
1296
1303
|
}
|
|
1297
1304
|
/**
|
|
1298
1305
|
Determines whether the given node may be selected as a node
|
|
@@ -1303,20 +1310,20 @@ var kt = class vt {
|
|
|
1303
1310
|
}
|
|
1304
1311
|
};
|
|
1305
1312
|
O.prototype.visible = !1;
|
|
1306
|
-
|
|
1307
|
-
var
|
|
1313
|
+
p.jsonID("node", O);
|
|
1314
|
+
var Dt = class Nt {
|
|
1308
1315
|
constructor(t) {
|
|
1309
1316
|
this.anchor = t;
|
|
1310
1317
|
}
|
|
1311
1318
|
map(t) {
|
|
1312
1319
|
let { deleted: e, pos: r } = t.mapResult(this.anchor);
|
|
1313
|
-
return e ? new
|
|
1320
|
+
return e ? new yt(r, r) : new Nt(r);
|
|
1314
1321
|
}
|
|
1315
1322
|
resolve(t) {
|
|
1316
1323
|
let e = t.resolve(this.anchor), r = e.nodeAfter;
|
|
1317
|
-
return r && O.isSelectable(r) ? new O(e) :
|
|
1324
|
+
return r && O.isSelectable(r) ? new O(e) : p.near(e);
|
|
1318
1325
|
}
|
|
1319
|
-
},
|
|
1326
|
+
}, C = class H extends p {
|
|
1320
1327
|
/**
|
|
1321
1328
|
Create an all-selection over the given document.
|
|
1322
1329
|
*/
|
|
@@ -1326,7 +1333,7 @@ var Bt = class yt {
|
|
|
1326
1333
|
replace(t, e = c.empty) {
|
|
1327
1334
|
if (e == c.empty) {
|
|
1328
1335
|
t.delete(0, t.doc.content.size);
|
|
1329
|
-
let r =
|
|
1336
|
+
let r = p.atStart(t.doc);
|
|
1330
1337
|
r.eq(t.selection) || t.setSelection(r);
|
|
1331
1338
|
} else
|
|
1332
1339
|
super.replace(t, e);
|
|
@@ -1338,37 +1345,37 @@ var Bt = class yt {
|
|
|
1338
1345
|
@internal
|
|
1339
1346
|
*/
|
|
1340
1347
|
static fromJSON(t) {
|
|
1341
|
-
return new
|
|
1348
|
+
return new H(t);
|
|
1342
1349
|
}
|
|
1343
1350
|
map(t) {
|
|
1344
|
-
return new
|
|
1351
|
+
return new H(t);
|
|
1345
1352
|
}
|
|
1346
1353
|
eq(t) {
|
|
1347
|
-
return t instanceof
|
|
1354
|
+
return t instanceof H;
|
|
1348
1355
|
}
|
|
1349
1356
|
getBookmark() {
|
|
1350
|
-
return
|
|
1357
|
+
return qt;
|
|
1351
1358
|
}
|
|
1352
1359
|
};
|
|
1353
|
-
|
|
1354
|
-
var
|
|
1360
|
+
p.jsonID("all", C);
|
|
1361
|
+
var qt = {
|
|
1355
1362
|
map() {
|
|
1356
1363
|
return this;
|
|
1357
1364
|
},
|
|
1358
1365
|
resolve(n) {
|
|
1359
|
-
return new
|
|
1366
|
+
return new C(n);
|
|
1360
1367
|
}
|
|
1361
1368
|
};
|
|
1362
|
-
function
|
|
1369
|
+
function R(n, t, e, r, i, s = !1) {
|
|
1363
1370
|
if (t.inlineContent)
|
|
1364
|
-
return
|
|
1371
|
+
return A.create(n, e);
|
|
1365
1372
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
1366
1373
|
let a = t.child(o);
|
|
1367
1374
|
if (a.isAtom) {
|
|
1368
1375
|
if (!s && O.isSelectable(a))
|
|
1369
1376
|
return O.create(n, e - (i < 0 ? a.nodeSize : 0));
|
|
1370
1377
|
} else {
|
|
1371
|
-
let l =
|
|
1378
|
+
let l = R(n, a, e + i, i < 0 ? a.childCount : 0, i, s);
|
|
1372
1379
|
if (l)
|
|
1373
1380
|
return l;
|
|
1374
1381
|
}
|
|
@@ -1381,43 +1388,43 @@ function nt(n, t, e) {
|
|
|
1381
1388
|
if (r < t)
|
|
1382
1389
|
return;
|
|
1383
1390
|
let i = n.steps[r];
|
|
1384
|
-
if (!(i instanceof
|
|
1391
|
+
if (!(i instanceof X || i instanceof vt))
|
|
1385
1392
|
return;
|
|
1386
1393
|
let s = n.mapping.maps[r], o;
|
|
1387
|
-
s.forEach((a, l,
|
|
1388
|
-
o == null && (o =
|
|
1389
|
-
}), n.setSelection(
|
|
1394
|
+
s.forEach((a, l, u, h) => {
|
|
1395
|
+
o == null && (o = h);
|
|
1396
|
+
}), n.setSelection(p.near(n.doc.resolve(o), e));
|
|
1390
1397
|
}
|
|
1391
1398
|
function it(n, t) {
|
|
1392
1399
|
return !t || !n ? n : n.bind(t);
|
|
1393
1400
|
}
|
|
1394
|
-
var
|
|
1401
|
+
var D = class {
|
|
1395
1402
|
constructor(n, t, e) {
|
|
1396
1403
|
this.name = n, this.init = it(t.init, e), this.apply = it(t.apply, e);
|
|
1397
1404
|
}
|
|
1398
1405
|
};
|
|
1399
|
-
new
|
|
1406
|
+
new D("doc", {
|
|
1400
1407
|
init(n) {
|
|
1401
1408
|
return n.doc || n.schema.topNodeType.createAndFill();
|
|
1402
1409
|
},
|
|
1403
1410
|
apply(n) {
|
|
1404
1411
|
return n.doc;
|
|
1405
1412
|
}
|
|
1406
|
-
}), new
|
|
1413
|
+
}), new D("selection", {
|
|
1407
1414
|
init(n, t) {
|
|
1408
|
-
return n.selection ||
|
|
1415
|
+
return n.selection || p.atStart(t.doc);
|
|
1409
1416
|
},
|
|
1410
1417
|
apply(n) {
|
|
1411
1418
|
return n.selection;
|
|
1412
1419
|
}
|
|
1413
|
-
}), new
|
|
1420
|
+
}), new D("storedMarks", {
|
|
1414
1421
|
init(n) {
|
|
1415
1422
|
return n.storedMarks || null;
|
|
1416
1423
|
},
|
|
1417
1424
|
apply(n, t, e, r) {
|
|
1418
1425
|
return r.selection.$cursor ? n.storedMarks : null;
|
|
1419
1426
|
}
|
|
1420
|
-
}), new
|
|
1427
|
+
}), new D("scrollToSelection", {
|
|
1421
1428
|
init() {
|
|
1422
1429
|
return 0;
|
|
1423
1430
|
},
|
|
@@ -1425,22 +1432,22 @@ new F("doc", {
|
|
|
1425
1432
|
return n.scrolledIntoView ? t + 1 : t;
|
|
1426
1433
|
}
|
|
1427
1434
|
});
|
|
1428
|
-
var
|
|
1435
|
+
var Lt = (n, t) => {
|
|
1429
1436
|
var e;
|
|
1430
1437
|
const { state: r, view: i } = n, { selection: s } = r;
|
|
1431
1438
|
if (!s.empty) return !1;
|
|
1432
1439
|
const { $from: o } = s;
|
|
1433
1440
|
if (o.parentOffset !== 0) return !1;
|
|
1434
|
-
const a = o.depth - 1, l = o.node(a),
|
|
1435
|
-
if (
|
|
1441
|
+
const a = o.depth - 1, l = o.node(a), u = o.index(a);
|
|
1442
|
+
if (u === 0) return !1;
|
|
1436
1443
|
if (l.type === t)
|
|
1437
1444
|
return n.commands.lift(t.name);
|
|
1438
|
-
const
|
|
1439
|
-
if (
|
|
1445
|
+
const h = l.child(u - 1);
|
|
1446
|
+
if (h.type !== t || !((e = h.lastChild) != null && e.isTextblock))
|
|
1440
1447
|
return !1;
|
|
1441
|
-
const
|
|
1442
|
-
return
|
|
1443
|
-
},
|
|
1448
|
+
const f = o.before(), E = f - 1 - 1, { tr: y } = r;
|
|
1449
|
+
return y.delete(f, o.after()).insert(E, o.parent.content), y.setSelection(A.create(y.doc, E)), i.dispatch(y.scrollIntoView()), !0;
|
|
1450
|
+
}, Pt = /^\s*>\s$/, Ht = Rt.create({
|
|
1444
1451
|
name: "blockquote",
|
|
1445
1452
|
addOptions() {
|
|
1446
1453
|
return {
|
|
@@ -1454,7 +1461,7 @@ var Dt = (n, t) => {
|
|
|
1454
1461
|
return [{ tag: "blockquote" }];
|
|
1455
1462
|
},
|
|
1456
1463
|
renderHTML({ HTMLAttributes: n }) {
|
|
1457
|
-
return /* @__PURE__ */ Z("blockquote", { ...
|
|
1464
|
+
return /* @__PURE__ */ Z("blockquote", { ...Ot(this.options.HTMLAttributes, n), children: /* @__PURE__ */ Z("slot", {}) });
|
|
1458
1465
|
},
|
|
1459
1466
|
parseMarkdown: (n, t) => {
|
|
1460
1467
|
var e;
|
|
@@ -1467,9 +1474,9 @@ var Dt = (n, t) => {
|
|
|
1467
1474
|
const e = ">", r = [];
|
|
1468
1475
|
return n.content.forEach((i, s) => {
|
|
1469
1476
|
var o, a;
|
|
1470
|
-
const
|
|
1471
|
-
`).map((
|
|
1472
|
-
r.push(
|
|
1477
|
+
const h = ((a = (o = t.renderChild) == null ? void 0 : o.call(t, i, s)) != null ? a : t.renderChildren([i])).split(`
|
|
1478
|
+
`).map((f) => f.trim() === "" ? e : `${e} ${f}`);
|
|
1479
|
+
r.push(h.join(`
|
|
1473
1480
|
`));
|
|
1474
1481
|
}), r.join(`
|
|
1475
1482
|
${e}
|
|
@@ -1485,33 +1492,33 @@ ${e}
|
|
|
1485
1492
|
addKeyboardShortcuts() {
|
|
1486
1493
|
return {
|
|
1487
1494
|
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
|
|
1488
|
-
Backspace: () =>
|
|
1495
|
+
Backspace: () => Lt(this.editor, this.type)
|
|
1489
1496
|
};
|
|
1490
1497
|
},
|
|
1491
1498
|
addInputRules() {
|
|
1492
1499
|
return [
|
|
1493
|
-
|
|
1494
|
-
find:
|
|
1500
|
+
At({
|
|
1501
|
+
find: Pt,
|
|
1495
1502
|
type: this.type
|
|
1496
1503
|
})
|
|
1497
1504
|
];
|
|
1498
1505
|
}
|
|
1499
1506
|
});
|
|
1500
|
-
function
|
|
1501
|
-
const n =
|
|
1507
|
+
function Xt() {
|
|
1508
|
+
const n = Tt($t.name), {
|
|
1502
1509
|
icon: t = void 0,
|
|
1503
1510
|
tooltip: e = void 0,
|
|
1504
1511
|
shortcutKeys: r = void 0,
|
|
1505
1512
|
tooltipOptions: i = {},
|
|
1506
1513
|
action: s = void 0,
|
|
1507
1514
|
isActive: o = void 0
|
|
1508
|
-
} = (n == null ? void 0 : n.componentProps) ?? {}, { dataState: a, disabled: l, update:
|
|
1509
|
-
l || s && (s(),
|
|
1515
|
+
} = (n == null ? void 0 : n.componentProps) ?? {}, { dataState: a, disabled: l, update: u } = It(o), h = () => {
|
|
1516
|
+
l || s && (s(), u());
|
|
1510
1517
|
};
|
|
1511
1518
|
return n ? /* @__PURE__ */ j(
|
|
1512
|
-
|
|
1519
|
+
zt,
|
|
1513
1520
|
{
|
|
1514
|
-
action:
|
|
1521
|
+
action: h,
|
|
1515
1522
|
dataState: a,
|
|
1516
1523
|
disabled: l,
|
|
1517
1524
|
icon: t,
|
|
@@ -1519,9 +1526,9 @@ function Qt() {
|
|
|
1519
1526
|
tooltip: e,
|
|
1520
1527
|
tooltipOptions: i
|
|
1521
1528
|
}
|
|
1522
|
-
) : /* @__PURE__ */ j(
|
|
1529
|
+
) : /* @__PURE__ */ j(Et, {});
|
|
1523
1530
|
}
|
|
1524
|
-
const
|
|
1531
|
+
const $t = /* @__PURE__ */ Ht.extend({
|
|
1525
1532
|
//@ts-expect-error
|
|
1526
1533
|
addOptions() {
|
|
1527
1534
|
var n;
|
|
@@ -1544,6 +1551,6 @@ const Pt = /* @__PURE__ */ Lt.extend({
|
|
|
1544
1551
|
}
|
|
1545
1552
|
});
|
|
1546
1553
|
export {
|
|
1547
|
-
|
|
1548
|
-
|
|
1554
|
+
$t as Blockquote,
|
|
1555
|
+
Xt as RichTextBlockquote
|
|
1549
1556
|
};
|