@templatical/editor 0.10.4 → 0.11.1
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/{AiChatSidebar-Djjqrmoh.js → AiChatSidebar-Cm5RM5Qh.js} +8 -8
- package/dist/{AiFeatureMenu-DR56EYbL.js → AiFeatureMenu-DBWcfcWl.js} +6 -6
- package/dist/{BlockIssueBadge-ySMhwDRR.js → BlockIssueBadge-BF4sdsr4.js} +4 -4
- package/dist/{CloudEditor-BLlRKq5D.js → CloudEditor-C6cSXtcP.js} +162 -160
- package/dist/{CollaboratorBar-BlXmZrIj.js → CollaboratorBar-B8-AQfG2.js} +3 -3
- package/dist/{CommentsSidebar-XcYtqAn8.js → CommentsSidebar-BQJzyCc6.js} +11 -11
- package/dist/{CountdownBlock-sAAv3BHE.js → CountdownBlock-D_AsF4F3.js} +1 -1
- package/dist/{CountdownToolbar-CUvqPILZ.js → CountdownToolbar-BGTkFky9.js} +2 -2
- package/dist/{DesignReferenceSidebar-B0Upq2MY.js → DesignReferenceSidebar-O3epZMXD.js} +6 -6
- package/dist/{IssuesPanel-BvcqQ0ec.js → IssuesPanel-CPBbR8yp.js} +7 -7
- package/dist/{ModuleBrowserModal-BdOB1Lbt.js → ModuleBrowserModal-B_tLzFAk.js} +9 -9
- package/dist/{ModulePreviewCanvas-BeglLfBF.js → ModulePreviewCanvas-B7pNpAHM.js} +2 -2
- package/dist/{NumberWithSuffix-Cb7HI_yW.js → NumberWithSuffix-eI9pPDWT.js} +1 -1
- package/dist/{ParagraphEditor-4Wrd3nnB.js → ParagraphEditor-DmA9K7dx.js} +27 -27
- package/dist/{RichTextEditorContent-D-uKzBDa.js → RichTextEditorContent-Dvn4woIt.js} +6 -6
- package/dist/{SaveModuleDialog-ueFhCVWN.js → SaveModuleDialog-B8ypoxdj.js} +6 -6
- package/dist/{SnapshotHistory-DNuw_gCY.js → SnapshotHistory-BTHd7CVP.js} +7 -7
- package/dist/{TemplateScoringPanel-bkIhEokb.js → TemplateScoringPanel-Bt5Rsgen.js} +12 -12
- package/dist/{TestEmailModal-Tg30-itu.js → TestEmailModal-CBIFMzK6.js} +4 -4
- package/dist/{TitleEditor-CY8QWbEw.js → TitleEditor-C9jDA5lI.js} +12 -12
- package/dist/{TplModal-D338Vv9U.js → TplModal-ND4fiqOS.js} +3 -3
- package/dist/{blockTypeIcons-CYoPwoH9.js → blockTypeIcons-Bn-_Smlm.js} +5 -5
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AiFeatureMenu-DRWRoPdh.js → AiFeatureMenu-BuSO0dXP.js} +8 -8
- package/dist/cdn/chunks/{AiFeatureMenu-DRWRoPdh.js.map → AiFeatureMenu-BuSO0dXP.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-D2ApLp61.js → BlockIssueBadge-sv3IZ1Pb.js} +4 -4
- package/dist/cdn/chunks/{BlockIssueBadge-D2ApLp61.js.map → BlockIssueBadge-sv3IZ1Pb.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-gvOOuXac.js → CloudEditor-hxoqsTsq.js} +242 -240
- package/dist/cdn/chunks/CloudEditor-hxoqsTsq.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-BZK3R383.js → CollaboratorBar-DFqsaNX0.js} +3 -3
- package/dist/cdn/chunks/{CollaboratorBar-BZK3R383.js.map → CollaboratorBar-DFqsaNX0.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-DU5YmjFP.js → CountdownBlock-PpH3fxAX.js} +2 -2
- package/dist/cdn/chunks/{CountdownBlock-DU5YmjFP.js.map → CountdownBlock-PpH3fxAX.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-C1nlFm4e.js → CountdownToolbar-CZN92Bhz.js} +3 -3
- package/dist/cdn/chunks/{CountdownToolbar-C1nlFm4e.js.map → CountdownToolbar-CZN92Bhz.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-R3M60NTk.js → IssuesPanel-wQjrnuyc.js} +7 -7
- package/dist/cdn/chunks/{IssuesPanel-R3M60NTk.js.map → IssuesPanel-wQjrnuyc.js.map} +1 -1
- package/dist/cdn/chunks/{ModuleBrowserModal-DMithQu8.js → ModuleBrowserModal-348wCgft.js} +8 -8
- package/dist/cdn/chunks/{ModuleBrowserModal-DMithQu8.js.map → ModuleBrowserModal-348wCgft.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-BNKbV_c2.js → ModulePreviewCanvas-Cf6DUHml.js} +22 -22
- package/dist/cdn/chunks/{ModulePreviewCanvas-BNKbV_c2.js.map → ModulePreviewCanvas-Cf6DUHml.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-C5zNn3Oc.js → NumberWithSuffix-Deo8EOSz.js} +2 -2
- package/dist/cdn/chunks/{NumberWithSuffix-C5zNn3Oc.js.map → NumberWithSuffix-Deo8EOSz.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-H136qVNI.js → ParagraphEditor-Cbl_gBYM.js} +53 -53
- package/dist/cdn/chunks/{ParagraphEditor-H136qVNI.js.map → ParagraphEditor-Cbl_gBYM.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-BxW6vSck.js → RichTextEditorContent-TBPzn3RC.js} +4 -4
- package/dist/cdn/chunks/{RichTextEditorContent-BxW6vSck.js.map → RichTextEditorContent-TBPzn3RC.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-BaiynUWb.js → SaveModuleDialog-CxdYMutK.js} +4 -4
- package/dist/cdn/chunks/{SaveModuleDialog-BaiynUWb.js.map → SaveModuleDialog-CxdYMutK.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-BBsR46vE.js → TitleEditor--XulEf7R.js} +9 -9
- package/dist/cdn/chunks/{TitleEditor-BBsR46vE.js.map → TitleEditor--XulEf7R.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-CX05RINM.js → blockTypeIcons-BJND4L-A.js} +6 -6
- package/dist/cdn/chunks/{blockTypeIcons-CX05RINM.js.map → blockTypeIcons-BJND4L-A.js.map} +1 -1
- package/dist/{de-DIAGP7yH.js → cdn/chunks/de-BJMLpg_p.js} +6 -0
- package/dist/cdn/chunks/{de-DIAGP7yH.js.map → de-BJMLpg_p.js.map} +1 -1
- package/dist/{en-nqIW8Q9W.js → cdn/chunks/en-DFMMw7SL.js} +6 -0
- package/dist/cdn/chunks/{en-nqIW8Q9W.js.map → en-DFMMw7SL.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-2LuW8PHB.js → extensions-BtWoLy6E.js} +28 -28
- package/dist/cdn/chunks/{extensions-2LuW8PHB.js.map → extensions-BtWoLy6E.js.map} +1 -1
- package/dist/cdn/chunks/{features-CxHQG9xr.js → features-mO5NzwnN.js} +657 -678
- package/dist/cdn/chunks/features-mO5NzwnN.js.map +1 -0
- package/dist/cdn/chunks/{icons-DrsFvnNP.js → icons-CuXm6XAT.js} +2 -2
- package/dist/cdn/chunks/{icons-DrsFvnNP.js.map → icons-CuXm6XAT.js.map} +1 -1
- package/dist/cdn/chunks/{media-library-CDXkfBa7.js → media-library-BtNzYUTi.js} +524 -524
- package/dist/cdn/chunks/{media-library-CDXkfBa7.js.map → media-library-BtNzYUTi.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-DCNnLLx9.js → pt-BR-C-9aWLlR.js} +5 -1
- package/dist/cdn/chunks/{pt-BR-DCNnLLx9.js.map → pt-BR-C-9aWLlR.js.map} +1 -1
- package/dist/cdn/chunks/{quality-HR87TCZc.js → quality-YKe19zp8.js} +481 -481
- package/dist/cdn/chunks/{quality-HR87TCZc.js.map → quality-YKe19zp8.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-Dh5WdraW.js → renderer-BcOaxCs6.js} +9 -9
- package/dist/cdn/chunks/{renderer-Dh5WdraW.js.map → renderer-BcOaxCs6.js.map} +1 -1
- package/dist/cdn/chunks/{src-fyYLC_tY.js → src-B_ZRmuit.js} +63 -63
- package/dist/cdn/chunks/{src-fyYLC_tY.js.map → src-B_ZRmuit.js.map} +1 -1
- package/dist/cdn/chunks/{styles-NhU45rEI.js → styles-DDBCCJ-l.js} +675 -626
- package/dist/cdn/chunks/styles-DDBCCJ-l.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-CfnwT9a8.js → tiptap-BAwu9VcJ.js} +4454 -3328
- package/dist/cdn/chunks/tiptap-BAwu9VcJ.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +104 -102
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-B4oiQEsJ.js → check-BsNM6BDs.js} +1 -1
- package/dist/{chevron-down-BrL7CDST.js → chevron-down-fcsZ5DU7.js} +1 -1
- package/dist/{circle-alert-Ddf06I0D.js → circle-alert-BZTbwc-B.js} +1 -1
- package/dist/{clock-CbIkIHL5.js → clock-B7iQRubC.js} +1 -1
- package/dist/{createLucideIcon-Bn5l6hkC.js → createLucideIcon-C_fetdGM.js} +2 -2
- package/dist/{cdn/chunks/de-DIAGP7yH.js → de-BJMLpg_p.js} +4 -2
- package/dist/{dist-BRvZBY6r.js → dist-B4NkMBYc.js} +2 -2
- package/dist/{dist-DDB4TfTY.js → dist-BLcYl_de.js} +2 -2
- package/dist/{dist-DS9NXb20.js → dist-BOHAk4zI.js} +2 -2
- package/dist/dist-BsB4nPJD.js +5 -0
- package/dist/{dist-B6B8IO1W.js → dist-ByBVNmRN.js} +2 -2
- package/dist/dist-CD3wbUoR.js +5 -0
- package/dist/{dist-DbGsZrPu.js → dist-Cwl7XXr4.js} +806 -601
- package/dist/{dist-BShwEwPy.js → dist-Dem8ODLh.js} +1512 -1501
- package/dist/{dist-BdIM5Jt8.js → dist-Dhs3W2WW.js} +2 -2
- package/dist/{dist-ZiEahccA.js → dist-XdF11ZkX.js} +2 -2
- package/dist/{dist-BhZo8-eC.js → dist-c2sj5PQ5.js} +2 -2
- package/dist/{dist-Ctv43HTN.js → dist-eVlXvuKI.js} +3 -3
- package/dist/{cdn/chunks/en-nqIW8Q9W.js → en-DFMMw7SL.js} +4 -2
- package/dist/extensions-B2lSGCA8.js +1720 -0
- package/dist/{image-up-D3KvvHLf.js → image-up-1xrPPJYH.js} +1 -1
- package/dist/index.d.ts +61 -0
- package/dist/{info-RwcI2EUD.js → info-ByAFxArD.js} +1 -1
- package/dist/keys-DsRdOmg3.js +10 -0
- package/dist/{list-checks-ruqK9lCo.js → list-checks-CKUP4UZU.js} +1 -1
- package/dist/{loader-circle-D4SXJ8eQ.js → loader-circle-BuxX338d.js} +1 -1
- package/dist/{message-circle-p9UiFyS7.js → message-circle-nLwqegRi.js} +1 -1
- package/dist/{pt-BR-DCNnLLx9.js → pt-BR-C-9aWLlR.js} +4 -0
- package/dist/{refresh-cw-C8HbO4hg.js → refresh-cw-DAkD6iDI.js} +1 -1
- package/dist/{scan-line-CmPIMm63.js → scan-line-DEELRJJ5.js} +1 -1
- package/dist/{send-DacXlri3.js → send-DCMgrNT4.js} +1 -1
- package/dist/{shield-check-BdrHnTnJ.js → shield-check-BFtVr_ov.js} +1 -1
- package/dist/{sparkles-tT7wcus5.js → sparkles-CeYIQ5RJ.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-BmZWc8sc.js → styles-DZcQGzsN.js} +735 -686
- package/dist/templatical-editor.js +118 -116
- package/dist/{text-align-start-DaSSBZVi.js → text-align-start-BsmIoqLS.js} +1 -1
- package/dist/{trash-2-B0uIJOwX.js → trash-2-C2S4-CIH.js} +1 -1
- package/dist/{triangle-alert-FLQWRf-c.js → triangle-alert-DMdedF6W.js} +1 -1
- package/dist/{useCloudI18n-Lh0xWlQ4.js → useCloudI18n-BEuiZdzs.js} +1 -1
- package/dist/{useEditorCore-CMukR8kX.js → useEditorCore-D00QzW07.js} +742 -763
- package/dist/{useI18n-CNEz8RK7.js → useI18n-DNspT6uw.js} +1 -1
- package/dist/{useMergeTag-C54tabTK.js → useMergeTag-abutjUud.js} +1 -1
- package/dist/{usePopoverRoot-dvg2XFmj.js → usePopoverRoot-DG3mlvd1.js} +1 -1
- package/dist/{x-BROzFhGs.js → x-_9jw816B.js} +1 -1
- package/package.json +25 -25
- package/dist/cdn/chunks/CloudEditor-gvOOuXac.js.map +0 -1
- package/dist/cdn/chunks/features-CxHQG9xr.js.map +0 -1
- package/dist/cdn/chunks/styles-NhU45rEI.js.map +0 -1
- package/dist/cdn/chunks/tiptap-CfnwT9a8.js.map +0 -1
- package/dist/dist-BVKpiz3S.js +0 -5
- package/dist/dist-BzeOnbU8.js +0 -5
- package/dist/extensions-CqrSpX_i.js +0 -806
- package/dist/keys-DSm2p8zn.js +0 -10
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Cn as e, Ct as t, Dn as n, En as r, Mt as i, Nt as a, On as o, Pt as s, Sn as c, Tn as l, Ut as u, Wt as d, Xt as f, Z as p, _n as
|
|
2
|
-
import { Link as
|
|
3
|
-
import { Underline as
|
|
4
|
-
//#region ../../node_modules/.pnpm/@tiptap+core@3.
|
|
5
|
-
var
|
|
1
|
+
import { Cn as e, Ct as t, Dn as n, En as r, Mt as i, Nt as a, On as o, Pt as s, Sn as c, Tn as l, Ut as u, Wt as d, Xt as f, Z as p, _n as m, at as h, bn as g, c as _, en as ee, gn as v, i as y, in as te, k as ne, mn as re, ot as ie, qt as b, rt as ae, u as x, v as oe, vn as S, wn as C, wt as se, xn as w, y as ce, yn as T } from "./dist-Dem8ODLh.js";
|
|
2
|
+
import { Link as le } from "./dist-eVlXvuKI.js";
|
|
3
|
+
import { Underline as ue } from "./dist-B4NkMBYc.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@tiptap+core@3.27.1_@tiptap+pm@3.27.1/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js
|
|
5
|
+
var de = (e, t) => {
|
|
6
6
|
if (e === "slot") return 0;
|
|
7
7
|
if (e instanceof Function) return e(t);
|
|
8
8
|
let { children: n, ...r } = t ?? {};
|
|
@@ -14,8 +14,8 @@ var C = (e, t) => {
|
|
|
14
14
|
];
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.
|
|
18
|
-
function
|
|
17
|
+
//#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.27.1_@tiptap+core@3.27.1_@tiptap+pm@3.27.1_/node_modules/@tiptap/extension-blockquote/dist/index.js
|
|
18
|
+
function fe(e, t, n) {
|
|
19
19
|
for (let r = 0;; r++) {
|
|
20
20
|
if (r == e.childCount || r == t.childCount) return e.childCount == t.childCount ? null : n;
|
|
21
21
|
let i = e.child(r), a = t.child(r);
|
|
@@ -29,13 +29,13 @@ function me(e, t, n) {
|
|
|
29
29
|
return n;
|
|
30
30
|
}
|
|
31
31
|
if (i.content.size || a.content.size) {
|
|
32
|
-
let e =
|
|
32
|
+
let e = fe(i.content, a.content, n + 1);
|
|
33
33
|
if (e != null) return e;
|
|
34
34
|
}
|
|
35
35
|
n += i.nodeSize;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function pe(e, t, n, r) {
|
|
39
39
|
for (let i = e.childCount, a = t.childCount;;) {
|
|
40
40
|
if (i == 0 || a == 0) return i == a ? null : {
|
|
41
41
|
a: n,
|
|
@@ -59,13 +59,13 @@ function he(e, t, n, r) {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
if (o.content.size || s.content.size) {
|
|
62
|
-
let e =
|
|
62
|
+
let e = pe(o.content, s.content, n - 1, r - 1);
|
|
63
63
|
if (e) return e;
|
|
64
64
|
}
|
|
65
65
|
n -= c, r -= c;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
var
|
|
68
|
+
var E = class e {
|
|
69
69
|
constructor(e, t) {
|
|
70
70
|
if (this.content = e, this.size = t || 0, t == null) for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize;
|
|
71
71
|
}
|
|
@@ -149,18 +149,18 @@ var w = class e {
|
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
findDiffStart(e, t = 0) {
|
|
152
|
-
return
|
|
152
|
+
return fe(this, e, t);
|
|
153
153
|
}
|
|
154
154
|
findDiffEnd(e, t = this.size, n = e.size) {
|
|
155
|
-
return
|
|
155
|
+
return pe(this, e, t, n);
|
|
156
156
|
}
|
|
157
157
|
findIndex(e) {
|
|
158
|
-
if (e == 0) return
|
|
159
|
-
if (e == this.size) return
|
|
158
|
+
if (e == 0) return D(0, e);
|
|
159
|
+
if (e == this.size) return D(this.content.length, e);
|
|
160
160
|
if (e > this.size || e < 0) throw RangeError(`Position ${e} outside of fragment (${this})`);
|
|
161
161
|
for (let t = 0, n = 0;; t++) {
|
|
162
162
|
let r = this.child(t), i = n + r.nodeSize;
|
|
163
|
-
if (i >= e) return i == e ?
|
|
163
|
+
if (i >= e) return i == e ? D(t + 1, i) : D(t, n);
|
|
164
164
|
n = i;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -195,29 +195,29 @@ var w = class e {
|
|
|
195
195
|
throw RangeError("Can not convert " + t + " to a Fragment" + (t.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
|
-
|
|
199
|
-
var
|
|
198
|
+
E.empty = new E([], 0);
|
|
199
|
+
var me = {
|
|
200
200
|
index: 0,
|
|
201
201
|
offset: 0
|
|
202
202
|
};
|
|
203
|
-
function
|
|
204
|
-
return
|
|
203
|
+
function D(e, t) {
|
|
204
|
+
return me.index = e, me.offset = t, me;
|
|
205
205
|
}
|
|
206
|
-
function
|
|
206
|
+
function he(e, t) {
|
|
207
207
|
if (e === t) return !0;
|
|
208
208
|
if (!(e && typeof e == "object") || !(t && typeof t == "object")) return !1;
|
|
209
209
|
let n = Array.isArray(e);
|
|
210
210
|
if (Array.isArray(t) != n) return !1;
|
|
211
211
|
if (n) {
|
|
212
212
|
if (e.length != t.length) return !1;
|
|
213
|
-
for (let n = 0; n < e.length; n++) if (!
|
|
213
|
+
for (let n = 0; n < e.length; n++) if (!he(e[n], t[n])) return !1;
|
|
214
214
|
} else {
|
|
215
|
-
for (let n in e) if (!(n in t) || !
|
|
215
|
+
for (let n in e) if (!(n in t) || !he(e[n], t[n])) return !1;
|
|
216
216
|
for (let n in t) if (!(n in e)) return !1;
|
|
217
217
|
}
|
|
218
218
|
return !0;
|
|
219
219
|
}
|
|
220
|
-
var
|
|
220
|
+
var O = class e {
|
|
221
221
|
constructor(e, t) {
|
|
222
222
|
this.type = e, this.attrs = t;
|
|
223
223
|
}
|
|
@@ -241,7 +241,7 @@ var T = class e {
|
|
|
241
241
|
return !1;
|
|
242
242
|
}
|
|
243
243
|
eq(e) {
|
|
244
|
-
return this == e || this.type == e.type &&
|
|
244
|
+
return this == e || this.type == e.type && he(this.attrs, e.attrs);
|
|
245
245
|
}
|
|
246
246
|
toJSON() {
|
|
247
247
|
let e = { type: this.type.name };
|
|
@@ -271,8 +271,8 @@ var T = class e {
|
|
|
271
271
|
return n.sort((e, t) => e.type.rank - t.type.rank), n;
|
|
272
272
|
}
|
|
273
273
|
};
|
|
274
|
-
|
|
275
|
-
var
|
|
274
|
+
O.none = [];
|
|
275
|
+
var k = class extends Error {}, A = class e {
|
|
276
276
|
constructor(e, t, n) {
|
|
277
277
|
this.content = e, this.openStart = t, this.openEnd = n;
|
|
278
278
|
}
|
|
@@ -280,11 +280,11 @@ var E = class extends Error {}, D = class e {
|
|
|
280
280
|
return this.content.size - this.openStart - this.openEnd;
|
|
281
281
|
}
|
|
282
282
|
insertAt(t, n) {
|
|
283
|
-
let r =
|
|
283
|
+
let r = _e(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
|
|
284
284
|
return r && new e(r, this.openStart, this.openEnd);
|
|
285
285
|
}
|
|
286
286
|
removeBetween(t, n) {
|
|
287
|
-
return new e(
|
|
287
|
+
return new e(ge(this.content, t + this.openStart, n + this.openStart), this.openStart, this.openEnd);
|
|
288
288
|
}
|
|
289
289
|
eq(e) {
|
|
290
290
|
return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
|
|
@@ -301,7 +301,7 @@ var E = class extends Error {}, D = class e {
|
|
|
301
301
|
if (!n) return e.empty;
|
|
302
302
|
let r = n.openStart || 0, i = n.openEnd || 0;
|
|
303
303
|
if (typeof r != "number" || typeof i != "number") throw RangeError("Invalid input for Slice.fromJSON");
|
|
304
|
-
return new e(
|
|
304
|
+
return new e(E.fromJSON(t, n.content), r, i);
|
|
305
305
|
}
|
|
306
306
|
static maxOpen(t, n = !0) {
|
|
307
307
|
let r = 0, i = 0;
|
|
@@ -310,78 +310,78 @@ var E = class extends Error {}, D = class e {
|
|
|
310
310
|
return new e(t, r, i);
|
|
311
311
|
}
|
|
312
312
|
};
|
|
313
|
-
|
|
314
|
-
function
|
|
313
|
+
A.empty = new A(E.empty, 0, 0);
|
|
314
|
+
function ge(e, t, n) {
|
|
315
315
|
let { index: r, offset: i } = e.findIndex(t), a = e.maybeChild(r), { index: o, offset: s } = e.findIndex(n);
|
|
316
316
|
if (i == t || a.isText) {
|
|
317
317
|
if (s != n && !e.child(o).isText) throw RangeError("Removing non-flat range");
|
|
318
318
|
return e.cut(0, t).append(e.cut(n));
|
|
319
319
|
}
|
|
320
320
|
if (r != o) throw RangeError("Removing non-flat range");
|
|
321
|
-
return e.replaceChild(r, a.copy(
|
|
321
|
+
return e.replaceChild(r, a.copy(ge(a.content, t - i - 1, n - i - 1)));
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function _e(e, t, n, r, i, a) {
|
|
324
324
|
let { index: o, offset: s } = e.findIndex(t), c = e.maybeChild(o);
|
|
325
325
|
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));
|
|
326
|
-
let l =
|
|
326
|
+
let l = _e(c.content, t - s - 1, n, o == 0 ? r - 1 : 0, o == e.childCount - 1 ? i - 1 : 0, c);
|
|
327
327
|
return l && e.replaceChild(o, c.copy(l));
|
|
328
328
|
}
|
|
329
|
-
function
|
|
330
|
-
if (n.openStart > e.depth) throw new
|
|
331
|
-
if (e.depth - n.openStart != t.depth - n.openEnd) throw new
|
|
332
|
-
return
|
|
329
|
+
function ve(e, t, n) {
|
|
330
|
+
if (n.openStart > e.depth) throw new k("Inserted content deeper than insertion position");
|
|
331
|
+
if (e.depth - n.openStart != t.depth - n.openEnd) throw new k("Inconsistent open depths");
|
|
332
|
+
return ye(e, t, n, 0);
|
|
333
333
|
}
|
|
334
|
-
function
|
|
334
|
+
function ye(e, t, n, r) {
|
|
335
335
|
let i = e.index(r), a = e.node(r);
|
|
336
336
|
if (i == t.index(r) && r < e.depth - n.openStart) {
|
|
337
|
-
let o =
|
|
337
|
+
let o = ye(e, t, n, r + 1);
|
|
338
338
|
return a.copy(a.content.replaceChild(i, o));
|
|
339
|
-
} else if (!n.content.size) return
|
|
339
|
+
} else if (!n.content.size) return N(a, P(e, t, r));
|
|
340
340
|
else if (!n.openStart && !n.openEnd && e.depth == r && t.depth == r) {
|
|
341
341
|
let r = e.parent, i = r.content;
|
|
342
|
-
return
|
|
342
|
+
return N(r, i.cut(0, e.parentOffset).append(n.content).append(i.cut(t.parentOffset)));
|
|
343
343
|
} else {
|
|
344
|
-
let { start: i, end: o } =
|
|
345
|
-
return
|
|
344
|
+
let { start: i, end: o } = Ce(n, e);
|
|
345
|
+
return N(a, Se(e, i, o, t, r));
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
-
function
|
|
349
|
-
if (!t.type.compatibleContent(e.type)) throw new
|
|
348
|
+
function be(e, t) {
|
|
349
|
+
if (!t.type.compatibleContent(e.type)) throw new k("Cannot join " + t.type.name + " onto " + e.type.name);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function xe(e, t, n) {
|
|
352
352
|
let r = e.node(n);
|
|
353
|
-
return
|
|
353
|
+
return be(r, t.node(n)), r;
|
|
354
354
|
}
|
|
355
|
-
function
|
|
355
|
+
function j(e, t) {
|
|
356
356
|
let n = t.length - 1;
|
|
357
357
|
n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e);
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function M(e, t, n, r) {
|
|
360
360
|
let i = (t || e).node(n), a = 0, o = t ? t.index(n) : i.childCount;
|
|
361
|
-
e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (
|
|
362
|
-
for (let e = a; e < o; e++)
|
|
363
|
-
t && t.depth == n && t.textOffset &&
|
|
361
|
+
e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (j(e.nodeAfter, r), a++));
|
|
362
|
+
for (let e = a; e < o; e++) j(i.child(e), r);
|
|
363
|
+
t && t.depth == n && t.textOffset && j(t.nodeBefore, r);
|
|
364
364
|
}
|
|
365
|
-
function
|
|
365
|
+
function N(e, t) {
|
|
366
366
|
return e.type.checkContent(t), e.copy(t);
|
|
367
367
|
}
|
|
368
|
-
function
|
|
369
|
-
let a = e.depth > i &&
|
|
370
|
-
return
|
|
368
|
+
function Se(e, t, n, r, i) {
|
|
369
|
+
let a = e.depth > i && xe(e, t, i + 1), o = r.depth > i && xe(n, r, i + 1), s = [];
|
|
370
|
+
return M(null, e, i, s), a && o && t.index(i) == n.index(i) ? (be(a, o), j(N(a, Se(e, t, n, r, i + 1)), s)) : (a && j(N(a, P(e, t, i + 1)), s), M(t, n, i, s), o && j(N(o, P(n, r, i + 1)), s)), M(r, null, i, s), new E(s);
|
|
371
371
|
}
|
|
372
|
-
function
|
|
372
|
+
function P(e, t, n) {
|
|
373
373
|
let r = [];
|
|
374
|
-
return
|
|
374
|
+
return M(null, e, n, r), e.depth > n && j(N(xe(e, t, n + 1), P(e, t, n + 1)), r), M(t, null, n, r), new E(r);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function Ce(e, t) {
|
|
377
377
|
let n = t.depth - e.openStart, r = t.node(n).copy(e.content);
|
|
378
|
-
for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(
|
|
378
|
+
for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(E.from(r));
|
|
379
379
|
return {
|
|
380
380
|
start: r.resolveNoCache(e.openStart + n),
|
|
381
381
|
end: r.resolveNoCache(r.content.size - e.openEnd - n)
|
|
382
382
|
};
|
|
383
383
|
}
|
|
384
|
-
var
|
|
384
|
+
var we = class e {
|
|
385
385
|
constructor(e, t, n) {
|
|
386
386
|
this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
|
|
387
387
|
}
|
|
@@ -438,7 +438,7 @@ var De = class e {
|
|
|
438
438
|
}
|
|
439
439
|
marks() {
|
|
440
440
|
let e = this.parent, t = this.index();
|
|
441
|
-
if (e.content.size == 0) return
|
|
441
|
+
if (e.content.size == 0) return O.none;
|
|
442
442
|
if (this.textOffset) return e.child(t).marks;
|
|
443
443
|
let n = e.maybeChild(t - 1), r = e.maybeChild(t);
|
|
444
444
|
if (!n) {
|
|
@@ -462,7 +462,7 @@ var De = class e {
|
|
|
462
462
|
}
|
|
463
463
|
blockRange(e = this, t) {
|
|
464
464
|
if (e.pos < this.pos) return e.blockRange(this);
|
|
465
|
-
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
|
|
465
|
+
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 Oe(this, e, n);
|
|
466
466
|
return null;
|
|
467
467
|
}
|
|
468
468
|
sameParent(e) {
|
|
@@ -490,20 +490,20 @@ var De = class e {
|
|
|
490
490
|
return new e(n, r, a);
|
|
491
491
|
}
|
|
492
492
|
static resolveCached(t, n) {
|
|
493
|
-
let r =
|
|
493
|
+
let r = De.get(t);
|
|
494
494
|
if (r) for (let e = 0; e < r.elts.length; e++) {
|
|
495
495
|
let t = r.elts[e];
|
|
496
496
|
if (t.pos == n) return t;
|
|
497
497
|
}
|
|
498
|
-
else
|
|
498
|
+
else De.set(t, r = new Te());
|
|
499
499
|
let i = r.elts[r.i] = e.resolve(t, n);
|
|
500
|
-
return r.i = (r.i + 1) %
|
|
500
|
+
return r.i = (r.i + 1) % Ee, i;
|
|
501
501
|
}
|
|
502
|
-
},
|
|
502
|
+
}, Te = class {
|
|
503
503
|
constructor() {
|
|
504
504
|
this.elts = [], this.i = 0;
|
|
505
505
|
}
|
|
506
|
-
},
|
|
506
|
+
}, Ee = 12, De = /* @__PURE__ */ new WeakMap(), Oe = class {
|
|
507
507
|
constructor(e, t, n) {
|
|
508
508
|
this.$from = e, this.$to = t, this.depth = n;
|
|
509
509
|
}
|
|
@@ -522,9 +522,9 @@ var De = class e {
|
|
|
522
522
|
get endIndex() {
|
|
523
523
|
return this.$to.indexAfter(this.depth);
|
|
524
524
|
}
|
|
525
|
-
},
|
|
526
|
-
constructor(e, t, n, r =
|
|
527
|
-
this.type = e, this.attrs = t, this.marks = r, this.content = n ||
|
|
525
|
+
}, ke = /* @__PURE__ */ Object.create(null), Ae = class e {
|
|
526
|
+
constructor(e, t, n, r = O.none) {
|
|
527
|
+
this.type = e, this.attrs = t, this.marks = r, this.content = n || E.empty;
|
|
528
528
|
}
|
|
529
529
|
get children() {
|
|
530
530
|
return this.content.content;
|
|
@@ -569,7 +569,7 @@ var De = class e {
|
|
|
569
569
|
return this.hasMarkup(e.type, e.attrs, e.marks);
|
|
570
570
|
}
|
|
571
571
|
hasMarkup(e, t, n) {
|
|
572
|
-
return this.type == e &&
|
|
572
|
+
return this.type == e && he(this.attrs, t || e.defaultAttrs || ke) && O.sameSet(this.marks, n || O.none);
|
|
573
573
|
}
|
|
574
574
|
copy(t = null) {
|
|
575
575
|
return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
|
|
@@ -581,12 +581,12 @@ var De = class e {
|
|
|
581
581
|
return e == 0 && t == this.content.size ? this : this.copy(this.content.cut(e, t));
|
|
582
582
|
}
|
|
583
583
|
slice(e, t = this.content.size, n = !1) {
|
|
584
|
-
if (e == t) return
|
|
584
|
+
if (e == t) return A.empty;
|
|
585
585
|
let r = this.resolve(e), i = this.resolve(t), a = n ? 0 : r.sharedDepth(t), o = r.start(a);
|
|
586
|
-
return new
|
|
586
|
+
return new A(r.node(a).content.cut(r.pos - o, i.pos - o), r.depth - a, i.depth - a);
|
|
587
587
|
}
|
|
588
588
|
replace(e, t, n) {
|
|
589
|
-
return
|
|
589
|
+
return ve(this.resolve(e), this.resolve(t), n);
|
|
590
590
|
}
|
|
591
591
|
nodeAt(e) {
|
|
592
592
|
for (let t = this;;) {
|
|
@@ -624,10 +624,10 @@ var De = class e {
|
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
626
|
resolve(e) {
|
|
627
|
-
return
|
|
627
|
+
return we.resolveCached(this, e);
|
|
628
628
|
}
|
|
629
629
|
resolveNoCache(e) {
|
|
630
|
-
return
|
|
630
|
+
return we.resolve(this, e);
|
|
631
631
|
}
|
|
632
632
|
rangeHasMark(e, t, n) {
|
|
633
633
|
let r = !1;
|
|
@@ -657,14 +657,14 @@ var De = class e {
|
|
|
657
657
|
toString() {
|
|
658
658
|
if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
|
|
659
659
|
let e = this.type.name;
|
|
660
|
-
return this.content.size && (e += "(" + this.content.toStringInner() + ")"),
|
|
660
|
+
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), je(this.marks, e);
|
|
661
661
|
}
|
|
662
662
|
contentMatchAt(e) {
|
|
663
663
|
let t = this.type.contentMatch.matchFragment(this.content, 0, e);
|
|
664
664
|
if (!t) throw Error("Called contentMatchAt on a node with invalid content");
|
|
665
665
|
return t;
|
|
666
666
|
}
|
|
667
|
-
canReplace(e, t, n =
|
|
667
|
+
canReplace(e, t, n = E.empty, r = 0, i = n.childCount) {
|
|
668
668
|
let a = this.contentMatchAt(e).matchFragment(n, r, i), o = a && a.matchFragment(this.content, t);
|
|
669
669
|
if (!o || !o.validEnd) return !1;
|
|
670
670
|
for (let e = r; e < i; e++) if (!this.type.allowsMarks(n.child(e).marks)) return !1;
|
|
@@ -680,12 +680,12 @@ var De = class e {
|
|
|
680
680
|
}
|
|
681
681
|
check() {
|
|
682
682
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
683
|
-
let e =
|
|
683
|
+
let e = O.none;
|
|
684
684
|
for (let t = 0; t < this.marks.length; t++) {
|
|
685
685
|
let n = this.marks[t];
|
|
686
686
|
n.type.checkAttrs(n.attrs), e = n.addToSet(e);
|
|
687
687
|
}
|
|
688
|
-
if (!
|
|
688
|
+
if (!O.sameSet(e, this.marks)) throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
|
|
689
689
|
this.content.forEach((e) => e.check());
|
|
690
690
|
}
|
|
691
691
|
toJSON() {
|
|
@@ -707,26 +707,26 @@ var De = class e {
|
|
|
707
707
|
if (typeof t.text != "string") throw RangeError("Invalid text node in JSON");
|
|
708
708
|
return e.text(t.text, n);
|
|
709
709
|
}
|
|
710
|
-
let r =
|
|
710
|
+
let r = E.fromJSON(e, t.content), i = e.nodeType(t.type).create(t.attrs, r, n);
|
|
711
711
|
return i.type.checkAttrs(i.attrs), i;
|
|
712
712
|
}
|
|
713
713
|
};
|
|
714
|
-
|
|
715
|
-
function
|
|
714
|
+
Ae.prototype.text = void 0;
|
|
715
|
+
function je(e, t) {
|
|
716
716
|
for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
|
|
717
717
|
return t;
|
|
718
718
|
}
|
|
719
|
-
var
|
|
719
|
+
var Me = class e {
|
|
720
720
|
constructor(e) {
|
|
721
721
|
this.validEnd = e, this.next = [], this.wrapCache = [];
|
|
722
722
|
}
|
|
723
723
|
static parse(t, n) {
|
|
724
|
-
let r = new
|
|
724
|
+
let r = new Ne(t, n);
|
|
725
725
|
if (r.next == null) return e.empty;
|
|
726
|
-
let i =
|
|
726
|
+
let i = Pe(r);
|
|
727
727
|
r.next && r.err("Unexpected trailing text");
|
|
728
|
-
let a =
|
|
729
|
-
return
|
|
728
|
+
let a = We(Ve(i));
|
|
729
|
+
return Ge(a, r), a;
|
|
730
730
|
}
|
|
731
731
|
matchType(e) {
|
|
732
732
|
for (let t = 0; t < this.next.length; t++) if (this.next[t].type == e) return this.next[t].next;
|
|
@@ -755,7 +755,7 @@ var Fe = class e {
|
|
|
755
755
|
let r = [this];
|
|
756
756
|
function i(a, o) {
|
|
757
757
|
let s = a.matchFragment(e, n);
|
|
758
|
-
if (s && (!t || s.validEnd)) return
|
|
758
|
+
if (s && (!t || s.validEnd)) return E.from(o.map((e) => e.createAndFill()));
|
|
759
759
|
for (let e = 0; e < a.next.length; e++) {
|
|
760
760
|
let { type: t, next: n } = a.next[e];
|
|
761
761
|
if (!(t.isText || t.hasRequiredAttrs()) && r.indexOf(n) == -1) {
|
|
@@ -817,8 +817,8 @@ var Fe = class e {
|
|
|
817
817
|
}).join("\n");
|
|
818
818
|
}
|
|
819
819
|
};
|
|
820
|
-
|
|
821
|
-
var
|
|
820
|
+
Me.empty = new Me(!0);
|
|
821
|
+
var Ne = class {
|
|
822
822
|
constructor(e, t) {
|
|
823
823
|
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();
|
|
824
824
|
}
|
|
@@ -832,28 +832,28 @@ var Ie = class {
|
|
|
832
832
|
throw SyntaxError(e + " (in content expression '" + this.string + "')");
|
|
833
833
|
}
|
|
834
834
|
};
|
|
835
|
-
function
|
|
835
|
+
function Pe(e) {
|
|
836
836
|
let t = [];
|
|
837
837
|
do
|
|
838
|
-
t.push(
|
|
838
|
+
t.push(Fe(e));
|
|
839
839
|
while (e.eat("|"));
|
|
840
840
|
return t.length == 1 ? t[0] : {
|
|
841
841
|
type: "choice",
|
|
842
842
|
exprs: t
|
|
843
843
|
};
|
|
844
844
|
}
|
|
845
|
-
function
|
|
845
|
+
function Fe(e) {
|
|
846
846
|
let t = [];
|
|
847
847
|
do
|
|
848
|
-
t.push(
|
|
848
|
+
t.push(Ie(e));
|
|
849
849
|
while (e.next && e.next != ")" && e.next != "|");
|
|
850
850
|
return t.length == 1 ? t[0] : {
|
|
851
851
|
type: "seq",
|
|
852
852
|
exprs: t
|
|
853
853
|
};
|
|
854
854
|
}
|
|
855
|
-
function
|
|
856
|
-
let t =
|
|
855
|
+
function Ie(e) {
|
|
856
|
+
let t = Be(e);
|
|
857
857
|
for (;;) if (e.eat("+")) t = {
|
|
858
858
|
type: "plus",
|
|
859
859
|
expr: t
|
|
@@ -866,25 +866,25 @@ function ze(e) {
|
|
|
866
866
|
type: "opt",
|
|
867
867
|
expr: t
|
|
868
868
|
};
|
|
869
|
-
else if (e.eat("{")) t =
|
|
869
|
+
else if (e.eat("{")) t = Re(e, t);
|
|
870
870
|
else break;
|
|
871
871
|
return t;
|
|
872
872
|
}
|
|
873
|
-
function
|
|
873
|
+
function Le(e) {
|
|
874
874
|
/\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
|
|
875
875
|
let t = Number(e.next);
|
|
876
876
|
return e.pos++, t;
|
|
877
877
|
}
|
|
878
|
-
function
|
|
879
|
-
let n =
|
|
880
|
-
return e.eat(",") && (r = e.next == "}" ? -1 :
|
|
878
|
+
function Re(e, t) {
|
|
879
|
+
let n = Le(e), r = n;
|
|
880
|
+
return e.eat(",") && (r = e.next == "}" ? -1 : Le(e)), e.eat("}") || e.err("Unclosed braced range"), {
|
|
881
881
|
type: "range",
|
|
882
882
|
min: n,
|
|
883
883
|
max: r,
|
|
884
884
|
expr: t
|
|
885
885
|
};
|
|
886
886
|
}
|
|
887
|
-
function
|
|
887
|
+
function ze(e, t) {
|
|
888
888
|
let n = e.nodeTypes, r = n[t];
|
|
889
889
|
if (r) return [r];
|
|
890
890
|
let i = [];
|
|
@@ -894,13 +894,13 @@ function He(e, t) {
|
|
|
894
894
|
}
|
|
895
895
|
return i.length == 0 && e.err("No node type or group '" + t + "' found"), i;
|
|
896
896
|
}
|
|
897
|
-
function
|
|
897
|
+
function Be(e) {
|
|
898
898
|
if (e.eat("(")) {
|
|
899
|
-
let t =
|
|
899
|
+
let t = Pe(e);
|
|
900
900
|
return e.eat(")") || e.err("Missing closing paren"), t;
|
|
901
901
|
} else if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
|
|
902
902
|
else {
|
|
903
|
-
let t =
|
|
903
|
+
let t = ze(e, e.next).map((t) => (e.inline == null ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
|
|
904
904
|
type: "name",
|
|
905
905
|
value: t
|
|
906
906
|
}));
|
|
@@ -910,7 +910,7 @@ function Ue(e) {
|
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
912
|
}
|
|
913
|
-
function
|
|
913
|
+
function Ve(e) {
|
|
914
914
|
let t = [[]];
|
|
915
915
|
return i(a(e, 0), n()), t;
|
|
916
916
|
function n() {
|
|
@@ -956,12 +956,12 @@ function We(e) {
|
|
|
956
956
|
else throw Error("Unknown expr type");
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
function
|
|
959
|
+
function He(e, t) {
|
|
960
960
|
return t - e;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
962
|
+
function Ue(e, t) {
|
|
963
963
|
let n = [];
|
|
964
|
-
return r(t), n.sort(
|
|
964
|
+
return r(t), n.sort(He);
|
|
965
965
|
function r(t) {
|
|
966
966
|
let i = e[t];
|
|
967
967
|
if (i.length == 1 && !i[0].term) return r(i[0].to);
|
|
@@ -972,9 +972,9 @@ function Ke(e, t) {
|
|
|
972
972
|
}
|
|
973
973
|
}
|
|
974
974
|
}
|
|
975
|
-
function
|
|
975
|
+
function We(e) {
|
|
976
976
|
let t = /* @__PURE__ */ Object.create(null);
|
|
977
|
-
return n(
|
|
977
|
+
return n(Ue(e, 0));
|
|
978
978
|
function n(r) {
|
|
979
979
|
let i = [];
|
|
980
980
|
r.forEach((t) => {
|
|
@@ -982,14 +982,14 @@ function qe(e) {
|
|
|
982
982
|
if (!t) return;
|
|
983
983
|
let r;
|
|
984
984
|
for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
|
|
985
|
-
|
|
985
|
+
Ue(e, n).forEach((e) => {
|
|
986
986
|
r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
|
|
987
987
|
});
|
|
988
988
|
});
|
|
989
989
|
});
|
|
990
|
-
let a = t[r.join(",")] = new
|
|
990
|
+
let a = t[r.join(",")] = new Me(r.indexOf(e.length - 1) > -1);
|
|
991
991
|
for (let e = 0; e < i.length; e++) {
|
|
992
|
-
let r = i[e][1].sort(
|
|
992
|
+
let r = i[e][1].sort(He);
|
|
993
993
|
a.next.push({
|
|
994
994
|
type: i[e][0],
|
|
995
995
|
next: t[r.join(",")] || n(r)
|
|
@@ -998,7 +998,7 @@ function qe(e) {
|
|
|
998
998
|
return a;
|
|
999
999
|
}
|
|
1000
1000
|
}
|
|
1001
|
-
function
|
|
1001
|
+
function Ge(e, t) {
|
|
1002
1002
|
for (let n = 0, r = [e]; n < r.length; n++) {
|
|
1003
1003
|
let e = r[n], i = !e.validEnd, a = [];
|
|
1004
1004
|
for (let t = 0; t < e.next.length; t++) {
|
|
@@ -1008,40 +1008,40 @@ function Je(e, t) {
|
|
|
1008
1008
|
i && t.err("Only non-generatable nodes (" + a.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
|
-
var
|
|
1012
|
-
function
|
|
1013
|
-
return e + t *
|
|
1011
|
+
var Ke = 65535, qe = 2 ** 16;
|
|
1012
|
+
function Je(e, t) {
|
|
1013
|
+
return e + t * qe;
|
|
1014
1014
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return e &
|
|
1015
|
+
function Ye(e) {
|
|
1016
|
+
return e & Ke;
|
|
1017
1017
|
}
|
|
1018
|
-
function
|
|
1019
|
-
return (e - (e &
|
|
1018
|
+
function Xe(e) {
|
|
1019
|
+
return (e - (e & Ke)) / qe;
|
|
1020
1020
|
}
|
|
1021
|
-
var
|
|
1021
|
+
var Ze = 1, Qe = 2, F = 4, $e = 8, et = class {
|
|
1022
1022
|
constructor(e, t, n) {
|
|
1023
1023
|
this.pos = e, this.delInfo = t, this.recover = n;
|
|
1024
1024
|
}
|
|
1025
1025
|
get deleted() {
|
|
1026
|
-
return (this.delInfo &
|
|
1026
|
+
return (this.delInfo & $e) > 0;
|
|
1027
1027
|
}
|
|
1028
1028
|
get deletedBefore() {
|
|
1029
|
-
return (this.delInfo & (
|
|
1029
|
+
return (this.delInfo & (Ze | F)) > 0;
|
|
1030
1030
|
}
|
|
1031
1031
|
get deletedAfter() {
|
|
1032
|
-
return (this.delInfo & (
|
|
1032
|
+
return (this.delInfo & (Qe | F)) > 0;
|
|
1033
1033
|
}
|
|
1034
1034
|
get deletedAcross() {
|
|
1035
|
-
return (this.delInfo &
|
|
1035
|
+
return (this.delInfo & F) > 0;
|
|
1036
1036
|
}
|
|
1037
|
-
},
|
|
1037
|
+
}, I = class e {
|
|
1038
1038
|
constructor(t, n = !1) {
|
|
1039
1039
|
if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
|
|
1040
1040
|
}
|
|
1041
1041
|
recover(e) {
|
|
1042
|
-
let t = 0, n =
|
|
1042
|
+
let t = 0, n = Ye(e);
|
|
1043
1043
|
if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
|
|
1044
|
-
return this.ranges[n * 3] + t +
|
|
1044
|
+
return this.ranges[n * 3] + t + Xe(e);
|
|
1045
1045
|
}
|
|
1046
1046
|
mapResult(e, t = 1) {
|
|
1047
1047
|
return this._map(e, t, !1);
|
|
@@ -1058,15 +1058,15 @@ var et = 1, tt = 2, M = 4, nt = 8, rt = class {
|
|
|
1058
1058
|
if (e <= u) {
|
|
1059
1059
|
let i = c ? e == s ? -1 : e == u ? 1 : t : t, a = s + r + (i < 0 ? 0 : l);
|
|
1060
1060
|
if (n) return a;
|
|
1061
|
-
let d = e == (t < 0 ? s : u) ? null :
|
|
1062
|
-
return (t < 0 ? e != s : e != u) && (f |=
|
|
1061
|
+
let d = e == (t < 0 ? s : u) ? null : Je(o / 3, e - s), f = e == s ? Qe : e == u ? Ze : F;
|
|
1062
|
+
return (t < 0 ? e != s : e != u) && (f |= $e), new et(a, f, d);
|
|
1063
1063
|
}
|
|
1064
1064
|
r += l - c;
|
|
1065
1065
|
}
|
|
1066
|
-
return n ? e + r : new
|
|
1066
|
+
return n ? e + r : new et(e + r, 0, null);
|
|
1067
1067
|
}
|
|
1068
1068
|
touches(e, t) {
|
|
1069
|
-
let n = 0, r =
|
|
1069
|
+
let n = 0, r = Ye(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
|
|
1070
1070
|
for (let t = 0; t < this.ranges.length; t += 3) {
|
|
1071
1071
|
let o = this.ranges[t] - (this.inverted ? n : 0);
|
|
1072
1072
|
if (o > e) break;
|
|
@@ -1101,25 +1101,25 @@ var et = 1, tt = 2, M = 4, nt = 8, rt = class {
|
|
|
1101
1101
|
]);
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
|
-
|
|
1105
|
-
var
|
|
1104
|
+
I.empty = new I([]);
|
|
1105
|
+
var tt = /* @__PURE__ */ Object.create(null), L = class {
|
|
1106
1106
|
getMap() {
|
|
1107
|
-
return
|
|
1107
|
+
return I.empty;
|
|
1108
1108
|
}
|
|
1109
1109
|
merge(e) {
|
|
1110
1110
|
return null;
|
|
1111
1111
|
}
|
|
1112
1112
|
static fromJSON(e, t) {
|
|
1113
1113
|
if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
|
|
1114
|
-
let n =
|
|
1114
|
+
let n = tt[t.stepType];
|
|
1115
1115
|
if (!n) throw RangeError(`No step type ${t.stepType} defined`);
|
|
1116
1116
|
return n.fromJSON(e, t);
|
|
1117
1117
|
}
|
|
1118
1118
|
static jsonID(e, t) {
|
|
1119
|
-
if (e in
|
|
1120
|
-
return
|
|
1119
|
+
if (e in tt) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
1120
|
+
return tt[e] = t, t.prototype.jsonID = e, t;
|
|
1121
1121
|
}
|
|
1122
|
-
},
|
|
1122
|
+
}, R = class e {
|
|
1123
1123
|
constructor(e, t) {
|
|
1124
1124
|
this.doc = e, this.failed = t;
|
|
1125
1125
|
}
|
|
@@ -1133,29 +1133,29 @@ var it = /* @__PURE__ */ Object.create(null), P = class {
|
|
|
1133
1133
|
try {
|
|
1134
1134
|
return e.ok(t.replace(n, r, i));
|
|
1135
1135
|
} catch (t) {
|
|
1136
|
-
if (t instanceof
|
|
1136
|
+
if (t instanceof k) return e.fail(t.message);
|
|
1137
1137
|
throw t;
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
1140
|
};
|
|
1141
|
-
function
|
|
1141
|
+
function nt(e, t, n) {
|
|
1142
1142
|
let r = [];
|
|
1143
1143
|
for (let i = 0; i < e.childCount; i++) {
|
|
1144
1144
|
let a = e.child(i);
|
|
1145
|
-
a.content.size && (a = a.copy(
|
|
1145
|
+
a.content.size && (a = a.copy(nt(a.content, t, a))), a.isInline && (a = t(a, n, i)), r.push(a);
|
|
1146
1146
|
}
|
|
1147
|
-
return
|
|
1147
|
+
return E.fromArray(r);
|
|
1148
1148
|
}
|
|
1149
|
-
var
|
|
1149
|
+
var rt = class e extends L {
|
|
1150
1150
|
constructor(e, t, n) {
|
|
1151
1151
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1152
1152
|
}
|
|
1153
1153
|
apply(e) {
|
|
1154
|
-
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new
|
|
1155
|
-
return
|
|
1154
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new A(nt(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);
|
|
1155
|
+
return R.fromReplace(e, this.from, this.to, i);
|
|
1156
1156
|
}
|
|
1157
1157
|
invert() {
|
|
1158
|
-
return new
|
|
1158
|
+
return new it(this.from, this.to, this.mark);
|
|
1159
1159
|
}
|
|
1160
1160
|
map(t) {
|
|
1161
1161
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1177,17 +1177,17 @@ var ot = class e extends P {
|
|
|
1177
1177
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1178
1178
|
}
|
|
1179
1179
|
};
|
|
1180
|
-
|
|
1181
|
-
var
|
|
1180
|
+
L.jsonID("addMark", rt);
|
|
1181
|
+
var it = class e extends L {
|
|
1182
1182
|
constructor(e, t, n) {
|
|
1183
1183
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1184
1184
|
}
|
|
1185
1185
|
apply(e) {
|
|
1186
|
-
let t = e.slice(this.from, this.to), n = new
|
|
1187
|
-
return
|
|
1186
|
+
let t = e.slice(this.from, this.to), n = new A(nt(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
|
|
1187
|
+
return R.fromReplace(e, this.from, this.to, n);
|
|
1188
1188
|
}
|
|
1189
1189
|
invert() {
|
|
1190
|
-
return new
|
|
1190
|
+
return new rt(this.from, this.to, this.mark);
|
|
1191
1191
|
}
|
|
1192
1192
|
map(t) {
|
|
1193
1193
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1209,16 +1209,16 @@ var st = class e extends P {
|
|
|
1209
1209
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1210
1210
|
}
|
|
1211
1211
|
};
|
|
1212
|
-
|
|
1213
|
-
var
|
|
1212
|
+
L.jsonID("removeMark", it);
|
|
1213
|
+
var at = class e extends L {
|
|
1214
1214
|
constructor(e, t) {
|
|
1215
1215
|
super(), this.pos = e, this.mark = t;
|
|
1216
1216
|
}
|
|
1217
1217
|
apply(e) {
|
|
1218
1218
|
let t = e.nodeAt(this.pos);
|
|
1219
|
-
if (!t) return
|
|
1219
|
+
if (!t) return R.fail("No node at mark step's position");
|
|
1220
1220
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
1221
|
-
return
|
|
1221
|
+
return R.fromReplace(e, this.pos, this.pos + 1, new A(E.from(n), 0, +!t.isLeaf));
|
|
1222
1222
|
}
|
|
1223
1223
|
invert(t) {
|
|
1224
1224
|
let n = t.nodeAt(this.pos);
|
|
@@ -1229,7 +1229,7 @@ var ct = class e extends P {
|
|
|
1229
1229
|
return new e(this.pos, this.mark);
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
|
-
return new
|
|
1232
|
+
return new ot(this.pos, this.mark);
|
|
1233
1233
|
}
|
|
1234
1234
|
map(t) {
|
|
1235
1235
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1247,20 +1247,20 @@ var ct = class e extends P {
|
|
|
1247
1247
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1248
1248
|
}
|
|
1249
1249
|
};
|
|
1250
|
-
|
|
1251
|
-
var
|
|
1250
|
+
L.jsonID("addNodeMark", at);
|
|
1251
|
+
var ot = class e extends L {
|
|
1252
1252
|
constructor(e, t) {
|
|
1253
1253
|
super(), this.pos = e, this.mark = t;
|
|
1254
1254
|
}
|
|
1255
1255
|
apply(e) {
|
|
1256
1256
|
let t = e.nodeAt(this.pos);
|
|
1257
|
-
if (!t) return
|
|
1257
|
+
if (!t) return R.fail("No node at mark step's position");
|
|
1258
1258
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
1259
|
-
return
|
|
1259
|
+
return R.fromReplace(e, this.pos, this.pos + 1, new A(E.from(n), 0, +!t.isLeaf));
|
|
1260
1260
|
}
|
|
1261
1261
|
invert(e) {
|
|
1262
1262
|
let t = e.nodeAt(this.pos);
|
|
1263
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
1263
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new at(this.pos, this.mark);
|
|
1264
1264
|
}
|
|
1265
1265
|
map(t) {
|
|
1266
1266
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1278,16 +1278,16 @@ var lt = class e extends P {
|
|
|
1278
1278
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1279
1279
|
}
|
|
1280
1280
|
};
|
|
1281
|
-
|
|
1282
|
-
var
|
|
1281
|
+
L.jsonID("removeNodeMark", ot);
|
|
1282
|
+
var st = class e extends L {
|
|
1283
1283
|
constructor(e, t, n, r = !1) {
|
|
1284
1284
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
1285
1285
|
}
|
|
1286
1286
|
apply(e) {
|
|
1287
|
-
return this.structure &&
|
|
1287
|
+
return this.structure && lt(e, this.from, this.to) ? R.fail("Structure replace would overwrite content") : R.fromReplace(e, this.from, this.to, this.slice);
|
|
1288
1288
|
}
|
|
1289
1289
|
getMap() {
|
|
1290
|
-
return new
|
|
1290
|
+
return new I([
|
|
1291
1291
|
this.from,
|
|
1292
1292
|
this.to - this.from,
|
|
1293
1293
|
this.slice.size
|
|
@@ -1303,10 +1303,10 @@ var ut = class e extends P {
|
|
|
1303
1303
|
merge(t) {
|
|
1304
1304
|
if (!(t instanceof e) || t.structure || this.structure) return null;
|
|
1305
1305
|
if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
|
|
1306
|
-
let n = this.slice.size + t.slice.size == 0 ?
|
|
1306
|
+
let n = this.slice.size + t.slice.size == 0 ? A.empty : new A(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
|
|
1307
1307
|
return new e(this.from, this.to + (t.to - t.from), n, this.structure);
|
|
1308
1308
|
} else if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
|
|
1309
|
-
let n = this.slice.size + t.slice.size == 0 ?
|
|
1309
|
+
let n = this.slice.size + t.slice.size == 0 ? A.empty : new A(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
|
|
1310
1310
|
return new e(t.from, this.to, n, this.structure);
|
|
1311
1311
|
} else return null;
|
|
1312
1312
|
}
|
|
@@ -1320,23 +1320,23 @@ var ut = class e extends P {
|
|
|
1320
1320
|
}
|
|
1321
1321
|
static fromJSON(t, n) {
|
|
1322
1322
|
if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
1323
|
-
return new e(n.from, n.to,
|
|
1323
|
+
return new e(n.from, n.to, A.fromJSON(t, n.slice), !!n.structure);
|
|
1324
1324
|
}
|
|
1325
1325
|
};
|
|
1326
|
-
|
|
1327
|
-
var
|
|
1326
|
+
st.MAP_BIAS = 1, L.jsonID("replace", st);
|
|
1327
|
+
var ct = class e extends L {
|
|
1328
1328
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
1329
1329
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
1330
1330
|
}
|
|
1331
1331
|
apply(e) {
|
|
1332
|
-
if (this.structure && (
|
|
1332
|
+
if (this.structure && (lt(e, this.from, this.gapFrom) || lt(e, this.gapTo, this.to))) return R.fail("Structure gap-replace would overwrite content");
|
|
1333
1333
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
1334
|
-
if (t.openStart || t.openEnd) return
|
|
1334
|
+
if (t.openStart || t.openEnd) return R.fail("Gap is not a flat range");
|
|
1335
1335
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
1336
|
-
return n ?
|
|
1336
|
+
return n ? R.fromReplace(e, this.from, this.to, n) : R.fail("Content does not fit in gap");
|
|
1337
1337
|
}
|
|
1338
1338
|
getMap() {
|
|
1339
|
-
return new
|
|
1339
|
+
return new I([
|
|
1340
1340
|
this.from,
|
|
1341
1341
|
this.gapFrom - this.from,
|
|
1342
1342
|
this.insert,
|
|
@@ -1366,11 +1366,11 @@ var dt = class e extends P {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
static fromJSON(t, n) {
|
|
1368
1368
|
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");
|
|
1369
|
-
return new e(n.from, n.to, n.gapFrom, n.gapTo,
|
|
1369
|
+
return new e(n.from, n.to, n.gapFrom, n.gapTo, A.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
1370
1370
|
}
|
|
1371
1371
|
};
|
|
1372
|
-
|
|
1373
|
-
function
|
|
1372
|
+
L.jsonID("replaceAround", ct);
|
|
1373
|
+
function lt(e, t, n) {
|
|
1374
1374
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
1375
1375
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
1376
1376
|
if (i > 0) {
|
|
@@ -1382,21 +1382,21 @@ function ft(e, t, n) {
|
|
|
1382
1382
|
}
|
|
1383
1383
|
return !1;
|
|
1384
1384
|
}
|
|
1385
|
-
var
|
|
1385
|
+
var ut = class e extends L {
|
|
1386
1386
|
constructor(e, t, n) {
|
|
1387
1387
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
1388
1388
|
}
|
|
1389
1389
|
apply(e) {
|
|
1390
1390
|
let t = e.nodeAt(this.pos);
|
|
1391
|
-
if (!t) return
|
|
1391
|
+
if (!t) return R.fail("No node at attribute step's position");
|
|
1392
1392
|
let n = /* @__PURE__ */ Object.create(null);
|
|
1393
1393
|
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
1394
1394
|
n[this.attr] = this.value;
|
|
1395
1395
|
let r = t.type.create(n, null, t.marks);
|
|
1396
|
-
return
|
|
1396
|
+
return R.fromReplace(e, this.pos, this.pos + 1, new A(E.from(r), 0, +!t.isLeaf));
|
|
1397
1397
|
}
|
|
1398
1398
|
getMap() {
|
|
1399
|
-
return
|
|
1399
|
+
return I.empty;
|
|
1400
1400
|
}
|
|
1401
1401
|
invert(t) {
|
|
1402
1402
|
return new e(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -1418,8 +1418,8 @@ var pt = class e extends P {
|
|
|
1418
1418
|
return new e(n.pos, n.attr, n.value);
|
|
1419
1419
|
}
|
|
1420
1420
|
};
|
|
1421
|
-
|
|
1422
|
-
var
|
|
1421
|
+
L.jsonID("attr", ut);
|
|
1422
|
+
var dt = class e extends L {
|
|
1423
1423
|
constructor(e, t) {
|
|
1424
1424
|
super(), this.attr = e, this.value = t;
|
|
1425
1425
|
}
|
|
@@ -1428,10 +1428,10 @@ var mt = class e extends P {
|
|
|
1428
1428
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
1429
1429
|
t[this.attr] = this.value;
|
|
1430
1430
|
let n = e.type.create(t, e.content, e.marks);
|
|
1431
|
-
return
|
|
1431
|
+
return R.ok(n);
|
|
1432
1432
|
}
|
|
1433
1433
|
getMap() {
|
|
1434
|
-
return
|
|
1434
|
+
return I.empty;
|
|
1435
1435
|
}
|
|
1436
1436
|
invert(t) {
|
|
1437
1437
|
return new e(this.attr, t.attrs[this.attr]);
|
|
@@ -1451,15 +1451,15 @@ var mt = class e extends P {
|
|
|
1451
1451
|
return new e(n.attr, n.value);
|
|
1452
1452
|
}
|
|
1453
1453
|
};
|
|
1454
|
-
|
|
1455
|
-
var
|
|
1456
|
-
|
|
1454
|
+
L.jsonID("docAttr", dt);
|
|
1455
|
+
var z = class extends Error {};
|
|
1456
|
+
z = function e(t) {
|
|
1457
1457
|
let n = Error.call(this, t);
|
|
1458
1458
|
return n.__proto__ = e.prototype, n;
|
|
1459
|
-
},
|
|
1460
|
-
var
|
|
1459
|
+
}, z.prototype = Object.create(Error.prototype), z.prototype.constructor = z, z.prototype.name = "TransformError";
|
|
1460
|
+
var ft = /* @__PURE__ */ Object.create(null), B = class {
|
|
1461
1461
|
constructor(e, t, n) {
|
|
1462
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
1462
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new pt(e.min(t), e.max(t))];
|
|
1463
1463
|
}
|
|
1464
1464
|
get anchor() {
|
|
1465
1465
|
return this.$anchor.pos;
|
|
@@ -1487,78 +1487,78 @@ var ht = /* @__PURE__ */ Object.create(null), L = class {
|
|
|
1487
1487
|
content() {
|
|
1488
1488
|
return this.$from.doc.slice(this.from, this.to, !0);
|
|
1489
1489
|
}
|
|
1490
|
-
replace(e, t =
|
|
1490
|
+
replace(e, t = A.empty) {
|
|
1491
1491
|
let n = t.content.lastChild, r = null;
|
|
1492
1492
|
for (let e = 0; e < t.openEnd; e++) r = n, n = n.lastChild;
|
|
1493
1493
|
let i = e.steps.length, a = this.ranges;
|
|
1494
1494
|
for (let o = 0; o < a.length; o++) {
|
|
1495
1495
|
let { $from: s, $to: c } = a[o], l = e.mapping.slice(i);
|
|
1496
|
-
e.replaceRange(l.map(s.pos), l.map(c.pos), o ?
|
|
1496
|
+
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? A.empty : t), o == 0 && yt(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
replaceWith(e, t) {
|
|
1500
1500
|
let n = e.steps.length, r = this.ranges;
|
|
1501
1501
|
for (let i = 0; i < r.length; i++) {
|
|
1502
1502
|
let { $from: a, $to: o } = r[i], s = e.mapping.slice(n), c = s.map(a.pos), l = s.map(o.pos);
|
|
1503
|
-
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t),
|
|
1503
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), yt(e, n, t.isInline ? -1 : 1));
|
|
1504
1504
|
}
|
|
1505
1505
|
}
|
|
1506
1506
|
static findFrom(e, t, n = !1) {
|
|
1507
|
-
let r = e.parent.inlineContent ? new
|
|
1507
|
+
let r = e.parent.inlineContent ? new V(e) : W(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
1508
1508
|
if (r) return r;
|
|
1509
1509
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
1510
|
-
let i = t < 0 ?
|
|
1510
|
+
let i = t < 0 ? W(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : W(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
1511
1511
|
if (i) return i;
|
|
1512
1512
|
}
|
|
1513
1513
|
return null;
|
|
1514
1514
|
}
|
|
1515
1515
|
static near(e, t = 1) {
|
|
1516
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
1516
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new U(e.node(0));
|
|
1517
1517
|
}
|
|
1518
1518
|
static atStart(e) {
|
|
1519
|
-
return
|
|
1519
|
+
return W(e, e, 0, 0, 1) || new U(e);
|
|
1520
1520
|
}
|
|
1521
1521
|
static atEnd(e) {
|
|
1522
|
-
return
|
|
1522
|
+
return W(e, e, e.content.size, e.childCount, -1) || new U(e);
|
|
1523
1523
|
}
|
|
1524
1524
|
static fromJSON(e, t) {
|
|
1525
1525
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
1526
|
-
let n =
|
|
1526
|
+
let n = ft[t.type];
|
|
1527
1527
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
1528
1528
|
return n.fromJSON(e, t);
|
|
1529
1529
|
}
|
|
1530
1530
|
static jsonID(e, t) {
|
|
1531
|
-
if (e in
|
|
1532
|
-
return
|
|
1531
|
+
if (e in ft) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
1532
|
+
return ft[e] = t, t.prototype.jsonID = e, t;
|
|
1533
1533
|
}
|
|
1534
1534
|
getBookmark() {
|
|
1535
|
-
return
|
|
1535
|
+
return V.between(this.$anchor, this.$head).getBookmark();
|
|
1536
1536
|
}
|
|
1537
1537
|
};
|
|
1538
|
-
|
|
1539
|
-
var
|
|
1538
|
+
B.prototype.visible = !0;
|
|
1539
|
+
var pt = class {
|
|
1540
1540
|
constructor(e, t) {
|
|
1541
1541
|
this.$from = e, this.$to = t;
|
|
1542
1542
|
}
|
|
1543
|
-
},
|
|
1544
|
-
function
|
|
1545
|
-
!
|
|
1543
|
+
}, mt = !1;
|
|
1544
|
+
function ht(e) {
|
|
1545
|
+
!mt && !e.parent.inlineContent && (mt = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
1546
1546
|
}
|
|
1547
|
-
var
|
|
1547
|
+
var V = class e extends B {
|
|
1548
1548
|
constructor(e, t = e) {
|
|
1549
|
-
|
|
1549
|
+
ht(e), ht(t), super(e, t);
|
|
1550
1550
|
}
|
|
1551
1551
|
get $cursor() {
|
|
1552
1552
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
1553
1553
|
}
|
|
1554
1554
|
map(t, n) {
|
|
1555
1555
|
let r = t.resolve(n.map(this.head));
|
|
1556
|
-
if (!r.parent.inlineContent) return
|
|
1556
|
+
if (!r.parent.inlineContent) return B.near(r);
|
|
1557
1557
|
let i = t.resolve(n.map(this.anchor));
|
|
1558
1558
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
1559
1559
|
}
|
|
1560
|
-
replace(e, t =
|
|
1561
|
-
if (super.replace(e, t), t ==
|
|
1560
|
+
replace(e, t = A.empty) {
|
|
1561
|
+
if (super.replace(e, t), t == A.empty) {
|
|
1562
1562
|
let t = this.$from.marksAcross(this.$to);
|
|
1563
1563
|
t && e.ensureMarks(t);
|
|
1564
1564
|
}
|
|
@@ -1567,7 +1567,7 @@ var R = class e extends L {
|
|
|
1567
1567
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
1568
1568
|
}
|
|
1569
1569
|
getBookmark() {
|
|
1570
|
-
return new
|
|
1570
|
+
return new gt(this.anchor, this.head);
|
|
1571
1571
|
}
|
|
1572
1572
|
toJSON() {
|
|
1573
1573
|
return {
|
|
@@ -1587,15 +1587,15 @@ var R = class e extends L {
|
|
|
1587
1587
|
static between(t, n, r) {
|
|
1588
1588
|
let i = t.pos - n.pos;
|
|
1589
1589
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
1590
|
-
let e =
|
|
1590
|
+
let e = B.findFrom(n, r, !0) || B.findFrom(n, -r, !0);
|
|
1591
1591
|
if (e) n = e.$head;
|
|
1592
|
-
else return
|
|
1592
|
+
else return B.near(n, r);
|
|
1593
1593
|
}
|
|
1594
|
-
return t.parent.inlineContent || (i == 0 ? t = n : (t = (
|
|
1594
|
+
return t.parent.inlineContent || (i == 0 ? t = n : (t = (B.findFrom(t, -r, !0) || B.findFrom(t, r, !0)).$anchor, t.pos < n.pos != i < 0 && (t = n))), new e(t, n);
|
|
1595
1595
|
}
|
|
1596
1596
|
};
|
|
1597
|
-
|
|
1598
|
-
var
|
|
1597
|
+
B.jsonID("text", V);
|
|
1598
|
+
var gt = class e {
|
|
1599
1599
|
constructor(e, t) {
|
|
1600
1600
|
this.anchor = e, this.head = t;
|
|
1601
1601
|
}
|
|
@@ -1603,19 +1603,19 @@ var yt = class e {
|
|
|
1603
1603
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
1604
1604
|
}
|
|
1605
1605
|
resolve(e) {
|
|
1606
|
-
return
|
|
1606
|
+
return V.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
1607
1607
|
}
|
|
1608
|
-
},
|
|
1608
|
+
}, H = class e extends B {
|
|
1609
1609
|
constructor(e) {
|
|
1610
1610
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
1611
1611
|
super(e, n), this.node = t;
|
|
1612
1612
|
}
|
|
1613
1613
|
map(t, n) {
|
|
1614
1614
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
1615
|
-
return r ?
|
|
1615
|
+
return r ? B.near(a) : new e(a);
|
|
1616
1616
|
}
|
|
1617
1617
|
content() {
|
|
1618
|
-
return new
|
|
1618
|
+
return new A(E.from(this.node), 0, 0);
|
|
1619
1619
|
}
|
|
1620
1620
|
eq(t) {
|
|
1621
1621
|
return t instanceof e && t.anchor == this.anchor;
|
|
@@ -1627,7 +1627,7 @@ var yt = class e {
|
|
|
1627
1627
|
};
|
|
1628
1628
|
}
|
|
1629
1629
|
getBookmark() {
|
|
1630
|
-
return new
|
|
1630
|
+
return new _t(this.anchor);
|
|
1631
1631
|
}
|
|
1632
1632
|
static fromJSON(t, n) {
|
|
1633
1633
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -1640,27 +1640,27 @@ var yt = class e {
|
|
|
1640
1640
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
1641
1641
|
}
|
|
1642
1642
|
};
|
|
1643
|
-
|
|
1644
|
-
var
|
|
1643
|
+
H.prototype.visible = !1, B.jsonID("node", H);
|
|
1644
|
+
var _t = class e {
|
|
1645
1645
|
constructor(e) {
|
|
1646
1646
|
this.anchor = e;
|
|
1647
1647
|
}
|
|
1648
1648
|
map(t) {
|
|
1649
1649
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
1650
|
-
return n ? new
|
|
1650
|
+
return n ? new gt(r, r) : new e(r);
|
|
1651
1651
|
}
|
|
1652
1652
|
resolve(e) {
|
|
1653
1653
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
1654
|
-
return n &&
|
|
1654
|
+
return n && H.isSelectable(n) ? new H(t) : B.near(t);
|
|
1655
1655
|
}
|
|
1656
|
-
},
|
|
1656
|
+
}, U = class e extends B {
|
|
1657
1657
|
constructor(e) {
|
|
1658
1658
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
1659
1659
|
}
|
|
1660
|
-
replace(e, t =
|
|
1661
|
-
if (t ==
|
|
1660
|
+
replace(e, t = A.empty) {
|
|
1661
|
+
if (t == A.empty) {
|
|
1662
1662
|
e.delete(0, e.doc.content.size);
|
|
1663
|
-
let t =
|
|
1663
|
+
let t = B.atStart(e.doc);
|
|
1664
1664
|
t.eq(e.selection) || e.setSelection(t);
|
|
1665
1665
|
} else super.replace(e, t);
|
|
1666
1666
|
}
|
|
@@ -1677,70 +1677,70 @@ var bt = class e {
|
|
|
1677
1677
|
return t instanceof e;
|
|
1678
1678
|
}
|
|
1679
1679
|
getBookmark() {
|
|
1680
|
-
return
|
|
1680
|
+
return vt;
|
|
1681
1681
|
}
|
|
1682
1682
|
};
|
|
1683
|
-
|
|
1684
|
-
var
|
|
1683
|
+
B.jsonID("all", U);
|
|
1684
|
+
var vt = {
|
|
1685
1685
|
map() {
|
|
1686
1686
|
return this;
|
|
1687
1687
|
},
|
|
1688
1688
|
resolve(e) {
|
|
1689
|
-
return new
|
|
1689
|
+
return new U(e);
|
|
1690
1690
|
}
|
|
1691
1691
|
};
|
|
1692
|
-
function
|
|
1693
|
-
if (t.inlineContent) return
|
|
1692
|
+
function W(e, t, n, r, i, a = !1) {
|
|
1693
|
+
if (t.inlineContent) return V.create(e, n);
|
|
1694
1694
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
1695
1695
|
let r = t.child(o);
|
|
1696
1696
|
if (!r.isAtom) {
|
|
1697
|
-
let t =
|
|
1697
|
+
let t = W(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
1698
1698
|
if (t) return t;
|
|
1699
|
-
} else if (!a &&
|
|
1699
|
+
} else if (!a && H.isSelectable(r)) return H.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
1700
1700
|
n += r.nodeSize * i;
|
|
1701
1701
|
}
|
|
1702
1702
|
return null;
|
|
1703
1703
|
}
|
|
1704
|
-
function
|
|
1704
|
+
function yt(e, t, n) {
|
|
1705
1705
|
let r = e.steps.length - 1;
|
|
1706
1706
|
if (r < t) return;
|
|
1707
1707
|
let i = e.steps[r];
|
|
1708
|
-
if (!(i instanceof
|
|
1708
|
+
if (!(i instanceof st || i instanceof ct)) return;
|
|
1709
1709
|
let a = e.mapping.maps[r], o;
|
|
1710
1710
|
a.forEach((e, t, n, r) => {
|
|
1711
1711
|
o ??= r;
|
|
1712
|
-
}), e.setSelection(
|
|
1712
|
+
}), e.setSelection(B.near(e.doc.resolve(o), n));
|
|
1713
1713
|
}
|
|
1714
|
-
function
|
|
1714
|
+
function bt(e, t) {
|
|
1715
1715
|
return !t || !e ? e : e.bind(t);
|
|
1716
1716
|
}
|
|
1717
|
-
var
|
|
1717
|
+
var G = class {
|
|
1718
1718
|
constructor(e, t, n) {
|
|
1719
|
-
this.name = e, this.init =
|
|
1719
|
+
this.name = e, this.init = bt(t.init, n), this.apply = bt(t.apply, n);
|
|
1720
1720
|
}
|
|
1721
1721
|
};
|
|
1722
|
-
new
|
|
1722
|
+
new G("doc", {
|
|
1723
1723
|
init(e) {
|
|
1724
1724
|
return e.doc || e.schema.topNodeType.createAndFill();
|
|
1725
1725
|
},
|
|
1726
1726
|
apply(e) {
|
|
1727
1727
|
return e.doc;
|
|
1728
1728
|
}
|
|
1729
|
-
}), new
|
|
1729
|
+
}), new G("selection", {
|
|
1730
1730
|
init(e, t) {
|
|
1731
|
-
return e.selection ||
|
|
1731
|
+
return e.selection || B.atStart(t.doc);
|
|
1732
1732
|
},
|
|
1733
1733
|
apply(e) {
|
|
1734
1734
|
return e.selection;
|
|
1735
1735
|
}
|
|
1736
|
-
}), new
|
|
1736
|
+
}), new G("storedMarks", {
|
|
1737
1737
|
init(e) {
|
|
1738
1738
|
return e.storedMarks || null;
|
|
1739
1739
|
},
|
|
1740
1740
|
apply(e, t, n, r) {
|
|
1741
1741
|
return r.selection.$cursor ? e.storedMarks : null;
|
|
1742
1742
|
}
|
|
1743
|
-
}), new
|
|
1743
|
+
}), new G("scrollToSelection", {
|
|
1744
1744
|
init() {
|
|
1745
1745
|
return 0;
|
|
1746
1746
|
},
|
|
@@ -1748,7 +1748,7 @@ new H("doc", {
|
|
|
1748
1748
|
return e.scrolledIntoView ? t + 1 : t;
|
|
1749
1749
|
}
|
|
1750
1750
|
});
|
|
1751
|
-
var
|
|
1751
|
+
var xt = (e, t) => {
|
|
1752
1752
|
let { state: n, view: r } = e, { selection: i } = n;
|
|
1753
1753
|
if (!i.empty) return !1;
|
|
1754
1754
|
let { $from: a } = i;
|
|
@@ -1759,8 +1759,8 @@ var wt = (e, t) => {
|
|
|
1759
1759
|
let l = s.child(c - 1);
|
|
1760
1760
|
if (l.type !== t || !l.lastChild?.isTextblock) return !1;
|
|
1761
1761
|
let u = a.before(), d = u - 1 - 1, { tr: f } = n;
|
|
1762
|
-
return f.delete(u, a.after()).insert(d, a.parent.content), f.setSelection(
|
|
1763
|
-
},
|
|
1762
|
+
return f.delete(u, a.after()).insert(d, a.parent.content), f.setSelection(V.create(f.doc, d)), r.dispatch(f.scrollIntoView()), !0;
|
|
1763
|
+
}, St = /^\s*>\s$/, Ct = x.create({
|
|
1764
1764
|
name: "blockquote",
|
|
1765
1765
|
addOptions() {
|
|
1766
1766
|
return { HTMLAttributes: {} };
|
|
@@ -1772,9 +1772,9 @@ var wt = (e, t) => {
|
|
|
1772
1772
|
return [{ tag: "blockquote" }];
|
|
1773
1773
|
},
|
|
1774
1774
|
renderHTML({ HTMLAttributes: e }) {
|
|
1775
|
-
return /* @__PURE__ */
|
|
1776
|
-
...
|
|
1777
|
-
children: /* @__PURE__ */
|
|
1775
|
+
return /* @__PURE__ */ de("blockquote", {
|
|
1776
|
+
...b(this.options.HTMLAttributes, e),
|
|
1777
|
+
children: /* @__PURE__ */ de("slot", {})
|
|
1778
1778
|
});
|
|
1779
1779
|
},
|
|
1780
1780
|
parseMarkdown: (e, t) => {
|
|
@@ -1799,16 +1799,16 @@ var wt = (e, t) => {
|
|
|
1799
1799
|
addKeyboardShortcuts() {
|
|
1800
1800
|
return {
|
|
1801
1801
|
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
|
|
1802
|
-
Backspace: () =>
|
|
1802
|
+
Backspace: () => xt(this.editor, this.type)
|
|
1803
1803
|
};
|
|
1804
1804
|
},
|
|
1805
1805
|
addInputRules() {
|
|
1806
|
-
return [
|
|
1807
|
-
find:
|
|
1806
|
+
return [v({
|
|
1807
|
+
find: St,
|
|
1808
1808
|
type: this.type
|
|
1809
1809
|
})];
|
|
1810
1810
|
}
|
|
1811
|
-
}),
|
|
1811
|
+
}), wt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, Tt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, Et = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Dt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Ot = _.create({
|
|
1812
1812
|
name: "bold",
|
|
1813
1813
|
addOptions() {
|
|
1814
1814
|
return { HTMLAttributes: {} };
|
|
@@ -1831,9 +1831,9 @@ var wt = (e, t) => {
|
|
|
1831
1831
|
];
|
|
1832
1832
|
},
|
|
1833
1833
|
renderHTML({ HTMLAttributes: e }) {
|
|
1834
|
-
return /* @__PURE__ */
|
|
1835
|
-
...
|
|
1836
|
-
children: /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ de("strong", {
|
|
1835
|
+
...b(this.options.HTMLAttributes, e),
|
|
1836
|
+
children: /* @__PURE__ */ de("slot", {})
|
|
1837
1837
|
});
|
|
1838
1838
|
},
|
|
1839
1839
|
markdownTokenName: "strong",
|
|
@@ -1858,30 +1858,30 @@ var wt = (e, t) => {
|
|
|
1858
1858
|
},
|
|
1859
1859
|
addInputRules() {
|
|
1860
1860
|
return [u({
|
|
1861
|
-
find:
|
|
1861
|
+
find: wt,
|
|
1862
1862
|
type: this.type
|
|
1863
1863
|
}), u({
|
|
1864
|
-
find:
|
|
1864
|
+
find: Et,
|
|
1865
1865
|
type: this.type
|
|
1866
1866
|
})];
|
|
1867
1867
|
},
|
|
1868
1868
|
addPasteRules() {
|
|
1869
1869
|
return [d({
|
|
1870
|
-
find:
|
|
1870
|
+
find: Tt,
|
|
1871
1871
|
type: this.type
|
|
1872
1872
|
}), d({
|
|
1873
|
-
find:
|
|
1873
|
+
find: Dt,
|
|
1874
1874
|
type: this.type
|
|
1875
1875
|
})];
|
|
1876
1876
|
}
|
|
1877
|
-
}),
|
|
1877
|
+
}), kt = (e) => {
|
|
1878
1878
|
let t = /`([^`]+)`(?!`)$/.exec(e);
|
|
1879
1879
|
return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
|
|
1880
1880
|
index: t.index,
|
|
1881
1881
|
text: t[0],
|
|
1882
1882
|
replaceWith: t[1]
|
|
1883
1883
|
};
|
|
1884
|
-
},
|
|
1884
|
+
}, At = (e) => {
|
|
1885
1885
|
let t = /`([^`]+)`(?!`)/g, n = [], r;
|
|
1886
1886
|
for (; (r = t.exec(e)) !== null;) r.index > 0 && e[r.index - 1] === "`" || n.push({
|
|
1887
1887
|
index: r.index,
|
|
@@ -1889,7 +1889,7 @@ var wt = (e, t) => {
|
|
|
1889
1889
|
replaceWith: r[1]
|
|
1890
1890
|
});
|
|
1891
1891
|
return n;
|
|
1892
|
-
},
|
|
1892
|
+
}, jt = _.create({
|
|
1893
1893
|
name: "code",
|
|
1894
1894
|
addOptions() {
|
|
1895
1895
|
return { HTMLAttributes: {} };
|
|
@@ -1903,7 +1903,7 @@ var wt = (e, t) => {
|
|
|
1903
1903
|
renderHTML({ HTMLAttributes: e }) {
|
|
1904
1904
|
return [
|
|
1905
1905
|
"code",
|
|
1906
|
-
|
|
1906
|
+
b(this.options.HTMLAttributes, e),
|
|
1907
1907
|
0
|
|
1908
1908
|
];
|
|
1909
1909
|
},
|
|
@@ -1925,17 +1925,17 @@ var wt = (e, t) => {
|
|
|
1925
1925
|
},
|
|
1926
1926
|
addInputRules() {
|
|
1927
1927
|
return [u({
|
|
1928
|
-
find:
|
|
1928
|
+
find: kt,
|
|
1929
1929
|
type: this.type
|
|
1930
1930
|
})];
|
|
1931
1931
|
},
|
|
1932
1932
|
addPasteRules() {
|
|
1933
1933
|
return [d({
|
|
1934
|
-
find:
|
|
1934
|
+
find: At,
|
|
1935
1935
|
type: this.type
|
|
1936
1936
|
})];
|
|
1937
1937
|
}
|
|
1938
|
-
}),
|
|
1938
|
+
}), Mt = 4, Nt = /^```([a-z]+)?[\s\n]$/, Pt = /^~~~([a-z]+)?[\s\n]$/, Ft = x.create({
|
|
1939
1939
|
name: "codeBlock",
|
|
1940
1940
|
addOptions() {
|
|
1941
1941
|
return {
|
|
@@ -1944,7 +1944,7 @@ var wt = (e, t) => {
|
|
|
1944
1944
|
exitOnArrowDown: !0,
|
|
1945
1945
|
defaultLanguage: null,
|
|
1946
1946
|
enableTabIndentation: !1,
|
|
1947
|
-
tabSize:
|
|
1947
|
+
tabSize: Mt,
|
|
1948
1948
|
HTMLAttributes: {}
|
|
1949
1949
|
};
|
|
1950
1950
|
},
|
|
@@ -1972,7 +1972,7 @@ var wt = (e, t) => {
|
|
|
1972
1972
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
1973
1973
|
return [
|
|
1974
1974
|
"pre",
|
|
1975
|
-
|
|
1975
|
+
b(this.options.HTMLAttributes, t),
|
|
1976
1976
|
[
|
|
1977
1977
|
"code",
|
|
1978
1978
|
{ class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null },
|
|
@@ -2007,7 +2007,7 @@ var wt = (e, t) => {
|
|
|
2007
2007
|
},
|
|
2008
2008
|
Tab: ({ editor: e }) => {
|
|
2009
2009
|
if (!this.options.enableTabIndentation) return !1;
|
|
2010
|
-
let t = this.options.tabSize ??
|
|
2010
|
+
let t = this.options.tabSize ?? Mt, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
|
|
2011
2011
|
if (i.parent.type !== this.type) return !1;
|
|
2012
2012
|
let o = " ".repeat(t);
|
|
2013
2013
|
return a ? e.commands.insertContent(o) : e.commands.command(({ tr: e }) => {
|
|
@@ -2017,7 +2017,7 @@ var wt = (e, t) => {
|
|
|
2017
2017
|
},
|
|
2018
2018
|
"Shift-Tab": ({ editor: e }) => {
|
|
2019
2019
|
if (!this.options.enableTabIndentation) return !1;
|
|
2020
|
-
let t = this.options.tabSize ??
|
|
2020
|
+
let t = this.options.tabSize ?? Mt, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
|
|
2021
2021
|
return i.parent.type === this.type ? a ? e.commands.command(({ tr: e }) => {
|
|
2022
2022
|
let { pos: r } = i, a = i.start(), o = i.end(), s = n.doc.textBetween(a, o, "\n", "\n").split("\n"), c = 0, l = 0, u = r - a;
|
|
2023
2023
|
for (let e = 0; e < s.length; e += 1) {
|
|
@@ -2031,7 +2031,7 @@ var wt = (e, t) => {
|
|
|
2031
2031
|
if (f === 0) return !0;
|
|
2032
2032
|
let p = a;
|
|
2033
2033
|
for (let e = 0; e < c; e += 1) p += s[e].length + 1;
|
|
2034
|
-
return e.delete(p, p + f), r - p <= f && e.setSelection(
|
|
2034
|
+
return e.delete(p, p + f), r - p <= f && e.setSelection(C.create(e.doc, p)), !0;
|
|
2035
2035
|
}) : e.commands.command(({ tr: e }) => {
|
|
2036
2036
|
let { from: i, to: a } = r, o = n.doc.textBetween(i, a, "\n", "\n").split("\n").map((e) => {
|
|
2037
2037
|
let n = e.match(/^ */)?.[0] || "", r = Math.min(n.length, t);
|
|
@@ -2057,34 +2057,34 @@ var wt = (e, t) => {
|
|
|
2057
2057
|
};
|
|
2058
2058
|
},
|
|
2059
2059
|
addInputRules() {
|
|
2060
|
-
return [
|
|
2061
|
-
find:
|
|
2060
|
+
return [re({
|
|
2061
|
+
find: Nt,
|
|
2062
2062
|
type: this.type,
|
|
2063
2063
|
getAttributes: (e) => ({ language: e[1] })
|
|
2064
|
-
}),
|
|
2065
|
-
find:
|
|
2064
|
+
}), re({
|
|
2065
|
+
find: Pt,
|
|
2066
2066
|
type: this.type,
|
|
2067
2067
|
getAttributes: (e) => ({ language: e[1] })
|
|
2068
2068
|
})];
|
|
2069
2069
|
},
|
|
2070
2070
|
addProseMirrorPlugins() {
|
|
2071
|
-
return [new
|
|
2071
|
+
return [new w({
|
|
2072
2072
|
key: new c("codeBlockVSCodeHandler"),
|
|
2073
2073
|
props: { handlePaste: (e, t) => {
|
|
2074
2074
|
if (!t.clipboardData || this.editor.isActive(this.type.name)) return !1;
|
|
2075
2075
|
let n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), i = (r ? JSON.parse(r) : void 0)?.mode;
|
|
2076
2076
|
if (!n || !i) return !1;
|
|
2077
2077
|
let { tr: a, schema: o } = e.state, s = o.text(n.replace(/\r\n?/g, "\n"));
|
|
2078
|
-
return a.replaceSelectionWith(this.type.create({ language: i }, s)), a.selection.$from.parent.type !== this.type && a.setSelection(
|
|
2078
|
+
return a.replaceSelectionWith(this.type.create({ language: i }, s)), a.selection.$from.parent.type !== this.type && a.setSelection(C.near(a.doc.resolve(Math.max(0, a.selection.from - 2)))), a.setMeta("paste", !0), e.dispatch(a), !0;
|
|
2079
2079
|
} }
|
|
2080
2080
|
})];
|
|
2081
2081
|
}
|
|
2082
|
-
}),
|
|
2082
|
+
}), It = x.create({
|
|
2083
2083
|
name: "doc",
|
|
2084
2084
|
topNode: !0,
|
|
2085
2085
|
content: "block+",
|
|
2086
2086
|
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n\n") : ""
|
|
2087
|
-
}),
|
|
2087
|
+
}), Lt = x.create({
|
|
2088
2088
|
name: "hardBreak",
|
|
2089
2089
|
markdownTokenName: "br",
|
|
2090
2090
|
addOptions() {
|
|
@@ -2101,7 +2101,7 @@ var wt = (e, t) => {
|
|
|
2101
2101
|
return [{ tag: "br" }];
|
|
2102
2102
|
},
|
|
2103
2103
|
renderHTML({ HTMLAttributes: e }) {
|
|
2104
|
-
return ["br",
|
|
2104
|
+
return ["br", b(this.options.HTMLAttributes, e)];
|
|
2105
2105
|
},
|
|
2106
2106
|
renderText() {
|
|
2107
2107
|
return "\n";
|
|
@@ -2128,7 +2128,7 @@ var wt = (e, t) => {
|
|
|
2128
2128
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
2129
2129
|
};
|
|
2130
2130
|
}
|
|
2131
|
-
}),
|
|
2131
|
+
}), Rt = x.create({
|
|
2132
2132
|
name: "heading",
|
|
2133
2133
|
addOptions() {
|
|
2134
2134
|
return {
|
|
@@ -2161,7 +2161,7 @@ var wt = (e, t) => {
|
|
|
2161
2161
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2162
2162
|
return [
|
|
2163
2163
|
`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
|
|
2164
|
-
|
|
2164
|
+
b(this.options.HTMLAttributes, t),
|
|
2165
2165
|
0
|
|
2166
2166
|
];
|
|
2167
2167
|
},
|
|
@@ -2183,13 +2183,13 @@ var wt = (e, t) => {
|
|
|
2183
2183
|
}), {});
|
|
2184
2184
|
},
|
|
2185
2185
|
addInputRules() {
|
|
2186
|
-
return this.options.levels.map((e) =>
|
|
2186
|
+
return this.options.levels.map((e) => re({
|
|
2187
2187
|
find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
2188
2188
|
type: this.type,
|
|
2189
2189
|
getAttributes: { level: e }
|
|
2190
2190
|
}));
|
|
2191
2191
|
}
|
|
2192
|
-
}),
|
|
2192
|
+
}), zt = x.create({
|
|
2193
2193
|
name: "horizontalRule",
|
|
2194
2194
|
addOptions() {
|
|
2195
2195
|
return {
|
|
@@ -2202,22 +2202,22 @@ var wt = (e, t) => {
|
|
|
2202
2202
|
return [{ tag: "hr" }];
|
|
2203
2203
|
},
|
|
2204
2204
|
renderHTML({ HTMLAttributes: e }) {
|
|
2205
|
-
return ["hr",
|
|
2205
|
+
return ["hr", b(this.options.HTMLAttributes, e)];
|
|
2206
2206
|
},
|
|
2207
2207
|
markdownTokenName: "hr",
|
|
2208
2208
|
parseMarkdown: (e, t) => t.createNode("horizontalRule"),
|
|
2209
2209
|
renderMarkdown: () => "---",
|
|
2210
2210
|
addCommands() {
|
|
2211
2211
|
return { setHorizontalRule: () => ({ chain: e, state: t }) => {
|
|
2212
|
-
if (!
|
|
2212
|
+
if (!ce(t, t.schema.nodes[this.name])) return !1;
|
|
2213
2213
|
let { selection: n } = t, { $to: r } = n, i = e();
|
|
2214
2214
|
return s(n) ? i.insertContentAt(r.pos, { type: this.name }) : i.insertContent({ type: this.name }), i.command(({ state: e, tr: t, dispatch: n }) => {
|
|
2215
2215
|
if (n) {
|
|
2216
2216
|
let { $to: n } = t.selection, r = n.end();
|
|
2217
|
-
if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(
|
|
2217
|
+
if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(C.create(t.doc, n.pos + 1)) : n.nodeAfter.isBlock ? t.setSelection(g.create(t.doc, n.pos)) : t.setSelection(C.create(t.doc, n.pos));
|
|
2218
2218
|
else {
|
|
2219
2219
|
let i = (e.schema.nodes[this.options.nextNodeType] || n.parent.type.contentMatch.defaultType)?.create();
|
|
2220
|
-
i && (t.insert(r, i), t.setSelection(
|
|
2220
|
+
i && (t.insert(r, i), t.setSelection(C.create(t.doc, r + 1)));
|
|
2221
2221
|
}
|
|
2222
2222
|
t.scrollIntoView();
|
|
2223
2223
|
}
|
|
@@ -2231,7 +2231,7 @@ var wt = (e, t) => {
|
|
|
2231
2231
|
type: this.type
|
|
2232
2232
|
})];
|
|
2233
2233
|
}
|
|
2234
|
-
}),
|
|
2234
|
+
}), Bt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Vt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Ht = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Ut = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Wt = _.create({
|
|
2235
2235
|
name: "italic",
|
|
2236
2236
|
addOptions() {
|
|
2237
2237
|
return { HTMLAttributes: {} };
|
|
@@ -2253,7 +2253,7 @@ var wt = (e, t) => {
|
|
|
2253
2253
|
renderHTML({ HTMLAttributes: e }) {
|
|
2254
2254
|
return [
|
|
2255
2255
|
"em",
|
|
2256
|
-
|
|
2256
|
+
b(this.options.HTMLAttributes, e),
|
|
2257
2257
|
0
|
|
2258
2258
|
];
|
|
2259
2259
|
},
|
|
@@ -2279,28 +2279,28 @@ var wt = (e, t) => {
|
|
|
2279
2279
|
},
|
|
2280
2280
|
addInputRules() {
|
|
2281
2281
|
return [u({
|
|
2282
|
-
find:
|
|
2282
|
+
find: Bt,
|
|
2283
2283
|
type: this.type
|
|
2284
2284
|
}), u({
|
|
2285
|
-
find:
|
|
2285
|
+
find: Ht,
|
|
2286
2286
|
type: this.type
|
|
2287
2287
|
})];
|
|
2288
2288
|
},
|
|
2289
2289
|
addPasteRules() {
|
|
2290
2290
|
return [d({
|
|
2291
|
-
find:
|
|
2291
|
+
find: Vt,
|
|
2292
2292
|
type: this.type
|
|
2293
2293
|
}), d({
|
|
2294
|
-
find:
|
|
2294
|
+
find: Ut,
|
|
2295
2295
|
type: this.type
|
|
2296
2296
|
})];
|
|
2297
2297
|
}
|
|
2298
|
-
}),
|
|
2299
|
-
for (var n in t)
|
|
2298
|
+
}), Gt = Object.defineProperty, Kt = (e, t) => {
|
|
2299
|
+
for (var n in t) Gt(e, n, {
|
|
2300
2300
|
get: t[n],
|
|
2301
2301
|
enumerable: !0
|
|
2302
2302
|
});
|
|
2303
|
-
},
|
|
2303
|
+
}, qt = "listItem", Jt = "textStyle", Yt = /^\s*([-+*])\s$/, Xt = x.create({
|
|
2304
2304
|
name: "bulletList",
|
|
2305
2305
|
addOptions() {
|
|
2306
2306
|
return {
|
|
@@ -2320,7 +2320,7 @@ var wt = (e, t) => {
|
|
|
2320
2320
|
renderHTML({ HTMLAttributes: e }) {
|
|
2321
2321
|
return [
|
|
2322
2322
|
"ul",
|
|
2323
|
-
|
|
2323
|
+
b(this.options.HTMLAttributes, e),
|
|
2324
2324
|
0
|
|
2325
2325
|
];
|
|
2326
2326
|
},
|
|
@@ -2332,26 +2332,26 @@ var wt = (e, t) => {
|
|
|
2332
2332
|
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
|
|
2333
2333
|
markdownOptions: { indentsContent: !0 },
|
|
2334
2334
|
addCommands() {
|
|
2335
|
-
return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
2335
|
+
return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(qt, this.editor.getAttributes(Jt)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
2336
2336
|
},
|
|
2337
2337
|
addKeyboardShortcuts() {
|
|
2338
2338
|
return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
|
|
2339
2339
|
},
|
|
2340
2340
|
addInputRules() {
|
|
2341
|
-
let e =
|
|
2342
|
-
find:
|
|
2341
|
+
let e = v({
|
|
2342
|
+
find: Yt,
|
|
2343
2343
|
type: this.type
|
|
2344
2344
|
});
|
|
2345
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (e =
|
|
2346
|
-
find:
|
|
2345
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (e = v({
|
|
2346
|
+
find: Yt,
|
|
2347
2347
|
type: this.type,
|
|
2348
2348
|
keepMarks: this.options.keepMarks,
|
|
2349
2349
|
keepAttributes: this.options.keepAttributes,
|
|
2350
|
-
getAttributes: () => this.editor.getAttributes(
|
|
2350
|
+
getAttributes: () => this.editor.getAttributes(Jt),
|
|
2351
2351
|
editor: this.editor
|
|
2352
2352
|
})), [e];
|
|
2353
2353
|
}
|
|
2354
|
-
}),
|
|
2354
|
+
}), Zt = (e, t, n) => {
|
|
2355
2355
|
let { selection: r } = e;
|
|
2356
2356
|
if (!r.empty) return null;
|
|
2357
2357
|
let { $from: i } = r;
|
|
@@ -2382,36 +2382,148 @@ var wt = (e, t) => {
|
|
|
2382
2382
|
insertPos: i.after(a),
|
|
2383
2383
|
items: f
|
|
2384
2384
|
};
|
|
2385
|
-
},
|
|
2386
|
-
let a =
|
|
2385
|
+
}, Qt = (e, t, r, i) => {
|
|
2386
|
+
let a = Zt(e, r, i);
|
|
2387
2387
|
if (!a) return !1;
|
|
2388
2388
|
let { selection: o } = e, { nestedList: s, nestedListPos: c, insertPos: l, items: u } = a, d = e.tr;
|
|
2389
2389
|
d.delete(c, c + s.nodeSize);
|
|
2390
2390
|
let f = d.mapping.map(l);
|
|
2391
2391
|
return d.insert(f, n.from(u)), d.setSelection(o.map(d.doc, d.mapping)), t && t(d), !0;
|
|
2392
|
-
},
|
|
2392
|
+
}, $t = (e, t, n) => Qt(e.state, e.view.dispatch, t, n), en = (e, t) => y.create({
|
|
2393
2393
|
name: `${e}BranchingDeleteKeymap`,
|
|
2394
2394
|
priority: 101,
|
|
2395
2395
|
addKeyboardShortcuts() {
|
|
2396
|
-
let n = () =>
|
|
2396
|
+
let n = () => $t(this.editor, e, t);
|
|
2397
2397
|
return {
|
|
2398
2398
|
Delete: n,
|
|
2399
2399
|
"Mod-Delete": n
|
|
2400
2400
|
};
|
|
2401
2401
|
}
|
|
2402
|
-
})
|
|
2402
|
+
}), tn = [
|
|
2403
|
+
[1e3, "m"],
|
|
2404
|
+
[900, "cm"],
|
|
2405
|
+
[500, "d"],
|
|
2406
|
+
[400, "cd"],
|
|
2407
|
+
[100, "c"],
|
|
2408
|
+
[90, "xc"],
|
|
2409
|
+
[50, "l"],
|
|
2410
|
+
[40, "xl"],
|
|
2411
|
+
[10, "x"],
|
|
2412
|
+
[9, "ix"],
|
|
2413
|
+
[5, "v"],
|
|
2414
|
+
[4, "iv"],
|
|
2415
|
+
[1, "i"]
|
|
2416
|
+
], K = "abcdefghijklmnopqrstuvwxyz", nn = String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;
|
|
2417
|
+
function rn(e) {
|
|
2418
|
+
let t = e, n = "";
|
|
2419
|
+
for (let [e, r] of tn) for (; t >= e;) n += r, t -= e;
|
|
2420
|
+
return n;
|
|
2421
|
+
}
|
|
2403
2422
|
function an(e) {
|
|
2423
|
+
return rn(e).toUpperCase();
|
|
2424
|
+
}
|
|
2425
|
+
function on(e) {
|
|
2426
|
+
let t = e.toLowerCase(), n = 0, r = 0;
|
|
2427
|
+
for (; n < t.length;) {
|
|
2428
|
+
let e = !1;
|
|
2429
|
+
for (let [i, a] of tn) if (t.startsWith(a, n)) {
|
|
2430
|
+
r += i, n += a.length, e = !0;
|
|
2431
|
+
break;
|
|
2432
|
+
}
|
|
2433
|
+
if (!e) return 0;
|
|
2434
|
+
}
|
|
2435
|
+
return r;
|
|
2436
|
+
}
|
|
2437
|
+
function sn(e) {
|
|
2438
|
+
if (!/^[ivxlcdmIVXLCDM]+$/.test(e)) return !1;
|
|
2439
|
+
let t = on(e);
|
|
2440
|
+
return t <= 0 ? !1 : (e === e.toLowerCase() ? rn(t) : an(t)) === e;
|
|
2441
|
+
}
|
|
2442
|
+
function cn(e) {
|
|
2443
|
+
let t = e.toLowerCase();
|
|
2444
|
+
if (t.length === 1) return t.charCodeAt(0) - 97 + 1;
|
|
2445
|
+
if (t.length === 2) {
|
|
2446
|
+
let e = t.charCodeAt(0) - 97, n = t.charCodeAt(1) - 97;
|
|
2447
|
+
return (e + 1) * 26 + n + 1;
|
|
2448
|
+
}
|
|
2449
|
+
return 0;
|
|
2450
|
+
}
|
|
2451
|
+
function ln(e) {
|
|
2452
|
+
if (e <= 26) return K[e - 1];
|
|
2453
|
+
let t = Math.floor((e - 1) / 26) - 1, n = (e - 1) % 26;
|
|
2454
|
+
return t < 0 ? K[n] : K[t] + K[n];
|
|
2455
|
+
}
|
|
2456
|
+
function un(e) {
|
|
2457
|
+
if (!(!e || /^\d+$/.test(e))) {
|
|
2458
|
+
if (sn(e)) return e === e.toLowerCase() ? "i" : "I";
|
|
2459
|
+
if (/^[a-z]{1,2}$/.test(e)) return "a";
|
|
2460
|
+
if (/^[A-Z]{1,2}$/.test(e)) return "A";
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
function dn(e) {
|
|
2464
|
+
if (/^\d+$/.test(e)) return parseInt(e, 10);
|
|
2465
|
+
let t = un(e);
|
|
2466
|
+
if (t === "i" || t === "I") return on(e);
|
|
2467
|
+
if (t === "a" || t === "A") {
|
|
2468
|
+
let t = cn(e);
|
|
2469
|
+
return t > 0 ? t : 1;
|
|
2470
|
+
}
|
|
2471
|
+
let n = parseInt(e, 10);
|
|
2472
|
+
return Number.isNaN(n) ? 1 : n;
|
|
2473
|
+
}
|
|
2474
|
+
function fn(e, t) {
|
|
2475
|
+
if (e === "numeric") return String(t);
|
|
2476
|
+
switch (e) {
|
|
2477
|
+
case "a": return ln(t);
|
|
2478
|
+
case "A": return ln(t).toUpperCase();
|
|
2479
|
+
case "i": return rn(t);
|
|
2480
|
+
case "I": return an(t);
|
|
2481
|
+
default: return String(t);
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
function pn(e) {
|
|
2485
|
+
if (e.length === 0) return !1;
|
|
2486
|
+
let t = un(e[0]) ?? "numeric", n = dn(e[0]);
|
|
2487
|
+
if (n < 1) return !1;
|
|
2488
|
+
for (let r = 0; r < e.length; r++) {
|
|
2489
|
+
let i = fn(t, n + r);
|
|
2490
|
+
if (e[r] !== i) return !1;
|
|
2491
|
+
}
|
|
2492
|
+
return !0;
|
|
2493
|
+
}
|
|
2494
|
+
function mn(e) {
|
|
2495
|
+
return {
|
|
2496
|
+
type: un(e),
|
|
2497
|
+
start: dn(e)
|
|
2498
|
+
};
|
|
2499
|
+
}
|
|
2500
|
+
function hn(e) {
|
|
2501
|
+
let { type: t, start: n } = mn(e), r = {};
|
|
2502
|
+
return t && (r.type = t), n !== 1 && (r.start = n), r;
|
|
2503
|
+
}
|
|
2504
|
+
function gn(e, t, n = ". ") {
|
|
2505
|
+
let r = t + 1;
|
|
2506
|
+
if (!e || e === "1") return `${r}${n}`;
|
|
2507
|
+
switch (e) {
|
|
2508
|
+
case "a": return `${ln(r)}${n}`;
|
|
2509
|
+
case "A": return `${ln(r).toUpperCase()}${n}`;
|
|
2510
|
+
case "i": return `${rn(r)}${n}`;
|
|
2511
|
+
case "I": return `${an(r)}${n}`;
|
|
2512
|
+
default: return `${r}${n}`;
|
|
2513
|
+
}
|
|
2514
|
+
}
|
|
2515
|
+
function _n(e) {
|
|
2404
2516
|
let t = e.tokens?.[0];
|
|
2405
2517
|
return !!(e.text && e.tokens?.length === 1 && t?.type === "list" && t.ordered && t.raw === e.text);
|
|
2406
2518
|
}
|
|
2407
|
-
function
|
|
2519
|
+
function vn(e, t) {
|
|
2408
2520
|
return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([{
|
|
2409
2521
|
type: "text",
|
|
2410
2522
|
raw: e,
|
|
2411
2523
|
text: e
|
|
2412
2524
|
}]);
|
|
2413
2525
|
}
|
|
2414
|
-
var
|
|
2526
|
+
var yn = x.create({
|
|
2415
2527
|
name: "listItem",
|
|
2416
2528
|
addOptions() {
|
|
2417
2529
|
return {
|
|
@@ -2428,7 +2540,7 @@ var sn = v.create({
|
|
|
2428
2540
|
renderHTML({ HTMLAttributes: e }) {
|
|
2429
2541
|
return [
|
|
2430
2542
|
"li",
|
|
2431
|
-
|
|
2543
|
+
b(this.options.HTMLAttributes, e),
|
|
2432
2544
|
0
|
|
2433
2545
|
];
|
|
2434
2546
|
},
|
|
@@ -2437,11 +2549,11 @@ var sn = v.create({
|
|
|
2437
2549
|
if (e.type !== "list_item") return [];
|
|
2438
2550
|
let n = t.parseBlockChildren ?? t.parseChildren, r = [];
|
|
2439
2551
|
if (e.tokens && e.tokens.length > 0) {
|
|
2440
|
-
if (
|
|
2552
|
+
if (_n(e)) return {
|
|
2441
2553
|
type: "listItem",
|
|
2442
2554
|
content: [{
|
|
2443
2555
|
type: "paragraph",
|
|
2444
|
-
content:
|
|
2556
|
+
content: vn(e.text || "", t)
|
|
2445
2557
|
}]
|
|
2446
2558
|
};
|
|
2447
2559
|
if (e.tokens.some((e) => e.type === "paragraph")) r = n(e.tokens);
|
|
@@ -2466,9 +2578,16 @@ var sn = v.create({
|
|
|
2466
2578
|
content: r
|
|
2467
2579
|
};
|
|
2468
2580
|
},
|
|
2469
|
-
renderMarkdown: (e, t, n) =>
|
|
2581
|
+
renderMarkdown: (e, t, n) => te(e, t, (e) => {
|
|
2582
|
+
if (e.parentType === "bulletList") return "- ";
|
|
2583
|
+
if (e.parentType === "orderedList") {
|
|
2584
|
+
let t = e.meta?.parentAttrs?.start || 1;
|
|
2585
|
+
return gn(e.meta?.parentAttrs?.type, t - 1 + (e.index || 0), ". ");
|
|
2586
|
+
}
|
|
2587
|
+
return "- ";
|
|
2588
|
+
}, n),
|
|
2470
2589
|
addExtensions() {
|
|
2471
|
-
return [
|
|
2590
|
+
return [en(this.name, [this.options.bulletListTypeName, this.options.orderedListTypeName])];
|
|
2472
2591
|
},
|
|
2473
2592
|
addKeyboardShortcuts() {
|
|
2474
2593
|
return {
|
|
@@ -2478,37 +2597,37 @@ var sn = v.create({
|
|
|
2478
2597
|
};
|
|
2479
2598
|
}
|
|
2480
2599
|
});
|
|
2481
|
-
|
|
2482
|
-
findListItemPos: () =>
|
|
2483
|
-
getNextListDepth: () =>
|
|
2484
|
-
handleBackspace: () =>
|
|
2485
|
-
handleDelete: () =>
|
|
2486
|
-
hasListBefore: () =>
|
|
2487
|
-
hasListItemAfter: () =>
|
|
2488
|
-
hasListItemBefore: () =>
|
|
2489
|
-
listItemHasSubList: () =>
|
|
2490
|
-
nextListIsDeeper: () =>
|
|
2491
|
-
nextListIsHigher: () =>
|
|
2600
|
+
Kt({}, {
|
|
2601
|
+
findListItemPos: () => bn,
|
|
2602
|
+
getNextListDepth: () => xn,
|
|
2603
|
+
handleBackspace: () => Cn,
|
|
2604
|
+
handleDelete: () => En,
|
|
2605
|
+
hasListBefore: () => Sn,
|
|
2606
|
+
hasListItemAfter: () => Dn,
|
|
2607
|
+
hasListItemBefore: () => On,
|
|
2608
|
+
listItemHasSubList: () => kn,
|
|
2609
|
+
nextListIsDeeper: () => wn,
|
|
2610
|
+
nextListIsHigher: () => Tn
|
|
2492
2611
|
});
|
|
2493
|
-
var
|
|
2494
|
-
let { $from: n } = t.selection, r =
|
|
2612
|
+
var bn = (e, t) => {
|
|
2613
|
+
let { $from: n } = t.selection, r = h(e, t.schema), i = null, a = n.depth, o = n.pos, s = null;
|
|
2495
2614
|
for (; a > 0 && s === null;) i = n.node(a), i.type === r ? s = a : (--a, --o);
|
|
2496
2615
|
return s === null ? null : {
|
|
2497
2616
|
$pos: t.doc.resolve(o),
|
|
2498
2617
|
depth: s
|
|
2499
2618
|
};
|
|
2500
|
-
},
|
|
2501
|
-
let n =
|
|
2619
|
+
}, xn = (e, t) => {
|
|
2620
|
+
let n = bn(e, t);
|
|
2502
2621
|
if (!n) return !1;
|
|
2503
|
-
let [, r] =
|
|
2622
|
+
let [, r] = ae(t, e, n.$pos.pos + 4);
|
|
2504
2623
|
return r;
|
|
2505
|
-
},
|
|
2624
|
+
}, Sn = (e, t, n) => {
|
|
2506
2625
|
let { $anchor: r } = e.selection, i = Math.max(0, r.pos - 2), a = e.doc.resolve(i).node();
|
|
2507
2626
|
return !(!a || !n.includes(a.type.name));
|
|
2508
|
-
},
|
|
2627
|
+
}, Cn = (e, t, n) => {
|
|
2509
2628
|
if (e.commands.undoInputRule()) return !0;
|
|
2510
2629
|
if (e.state.selection.from !== e.state.selection.to) return !1;
|
|
2511
|
-
if (!i(e.state, t) &&
|
|
2630
|
+
if (!i(e.state, t) && Sn(e.state, t, n)) {
|
|
2512
2631
|
let { $anchor: n } = e.state.selection, r = e.state.doc.resolve(n.before() - 1), i = [];
|
|
2513
2632
|
r.node().descendants((e, n) => {
|
|
2514
2633
|
e.type.name === t && i.push({
|
|
@@ -2524,30 +2643,30 @@ var U = (e, t) => {
|
|
|
2524
2643
|
to: n.end() + 1
|
|
2525
2644
|
}, o.end()).joinForward().run();
|
|
2526
2645
|
}
|
|
2527
|
-
return !i(e.state, t) || !
|
|
2528
|
-
},
|
|
2529
|
-
let n =
|
|
2646
|
+
return !i(e.state, t) || !se(e.state) ? !1 : e.chain().liftListItem(t).run();
|
|
2647
|
+
}, wn = (e, t) => {
|
|
2648
|
+
let n = xn(e, t), r = bn(e, t);
|
|
2530
2649
|
return !r || !n ? !1 : n > r.depth;
|
|
2531
|
-
},
|
|
2532
|
-
let n =
|
|
2650
|
+
}, Tn = (e, t) => {
|
|
2651
|
+
let n = xn(e, t), r = bn(e, t);
|
|
2533
2652
|
return !r || !n ? !1 : n < r.depth;
|
|
2534
|
-
},
|
|
2653
|
+
}, En = (e, n) => {
|
|
2535
2654
|
if (!i(e.state, n) || !t(e.state, n)) return !1;
|
|
2536
2655
|
let { selection: r } = e.state, { $from: a, $to: o } = r;
|
|
2537
|
-
return !r.empty && a.sameParent(o) ? !1 :
|
|
2538
|
-
},
|
|
2656
|
+
return !r.empty && a.sameParent(o) ? !1 : wn(n, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(n).joinBackward().run() : Tn(n, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
|
|
2657
|
+
}, Dn = (e, t) => {
|
|
2539
2658
|
let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - n.parentOffset - 2);
|
|
2540
2659
|
return !(r.index() === r.parent.childCount - 1 || r.nodeAfter?.type.name !== e);
|
|
2541
|
-
},
|
|
2660
|
+
}, On = (e, t) => {
|
|
2542
2661
|
let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - 2);
|
|
2543
2662
|
return !(r.index() === 0 || r.nodeBefore?.type.name !== e);
|
|
2544
|
-
},
|
|
2663
|
+
}, kn = (e, t, n) => {
|
|
2545
2664
|
if (!n) return !1;
|
|
2546
|
-
let r =
|
|
2665
|
+
let r = h(e, t.schema), i = !1;
|
|
2547
2666
|
return n.descendants((e) => {
|
|
2548
2667
|
e.type === r && (i = !0);
|
|
2549
2668
|
}), i;
|
|
2550
|
-
},
|
|
2669
|
+
}, An = y.create({
|
|
2551
2670
|
name: "listKeymap",
|
|
2552
2671
|
addOptions() {
|
|
2553
2672
|
return { listTypes: [{
|
|
@@ -2563,35 +2682,38 @@ var U = (e, t) => {
|
|
|
2563
2682
|
Delete: ({ editor: e }) => {
|
|
2564
2683
|
let t = !1;
|
|
2565
2684
|
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
2566
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2685
|
+
e.state.schema.nodes[n] !== void 0 && En(e, n) && (t = !0);
|
|
2567
2686
|
}), t;
|
|
2568
2687
|
},
|
|
2569
2688
|
"Mod-Delete": ({ editor: e }) => {
|
|
2570
2689
|
let t = !1;
|
|
2571
2690
|
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
2572
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2691
|
+
e.state.schema.nodes[n] !== void 0 && En(e, n) && (t = !0);
|
|
2573
2692
|
}), t;
|
|
2574
2693
|
},
|
|
2575
2694
|
Backspace: ({ editor: e }) => {
|
|
2576
2695
|
let t = !1;
|
|
2577
2696
|
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
2578
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2697
|
+
e.state.schema.nodes[n] !== void 0 && Cn(e, n, r) && (t = !0);
|
|
2579
2698
|
}), t;
|
|
2580
2699
|
},
|
|
2581
2700
|
"Mod-Backspace": ({ editor: e }) => {
|
|
2582
2701
|
let t = !1;
|
|
2583
2702
|
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
2584
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2703
|
+
e.state.schema.nodes[n] !== void 0 && Cn(e, n, r) && (t = !0);
|
|
2585
2704
|
}), t;
|
|
2586
2705
|
}
|
|
2587
2706
|
};
|
|
2588
2707
|
}
|
|
2589
|
-
}),
|
|
2590
|
-
function
|
|
2708
|
+
}), jn = RegExp(`^(\\s*)(${nn})([.)])\\s+(.*)$`), Mn = RegExp(`^(\\s*)(${nn})([.)])\\s+`), Nn = /^\s/;
|
|
2709
|
+
function Pn(e) {
|
|
2710
|
+
return jn.test(e.trimStart());
|
|
2711
|
+
}
|
|
2712
|
+
function Fn(e) {
|
|
2591
2713
|
let t = e.trimStart();
|
|
2592
|
-
return /^[-+*]\s+/.test(t) ||
|
|
2714
|
+
return /^[-+*]\s+/.test(t) || Pn(t) || /^>\s?/.test(t) || /^```/.test(t) || /^~~~/.test(t);
|
|
2593
2715
|
}
|
|
2594
|
-
function
|
|
2716
|
+
function In(e) {
|
|
2595
2717
|
let t = [], n = [], r = !1;
|
|
2596
2718
|
return e.forEach((e) => {
|
|
2597
2719
|
if (r) {
|
|
@@ -2602,7 +2724,7 @@ function xn(e) {
|
|
|
2602
2724
|
r = !0, n.push(e);
|
|
2603
2725
|
return;
|
|
2604
2726
|
}
|
|
2605
|
-
if (t.length > 0 &&
|
|
2727
|
+
if (t.length > 0 && Fn(e)) {
|
|
2606
2728
|
r = !0, n.push(e);
|
|
2607
2729
|
return;
|
|
2608
2730
|
}
|
|
@@ -2612,38 +2734,69 @@ function xn(e) {
|
|
|
2612
2734
|
blockLines: n
|
|
2613
2735
|
};
|
|
2614
2736
|
}
|
|
2615
|
-
function
|
|
2737
|
+
function Ln(e) {
|
|
2616
2738
|
let t = [], n = 0, r = 0;
|
|
2617
2739
|
for (; n < e.length;) {
|
|
2618
|
-
let i = e[n], a = i.match(
|
|
2740
|
+
let i = e[n], a = i.match(jn);
|
|
2619
2741
|
if (!a) break;
|
|
2620
|
-
let [, o, s, c] = a,
|
|
2621
|
-
for (;
|
|
2622
|
-
let t = e[
|
|
2623
|
-
if (t.match(
|
|
2624
|
-
if (t.trim() === "")
|
|
2625
|
-
else if (t.match(
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2742
|
+
let [, o, s, c, l] = a, u = o.length, d = parseInt(s, 10), f = isNaN(d) ? un(s) : void 0, p = isNaN(d) ? dn(s) : d, m = [l], h = n + 1, g = [i], _ = !1;
|
|
2743
|
+
for (; h < e.length;) {
|
|
2744
|
+
let t = e[h];
|
|
2745
|
+
if (t.match(jn)) break;
|
|
2746
|
+
if (t.trim() === "") g.push(t), m.push(""), _ = !0, h += 1;
|
|
2747
|
+
else if (t.match(Nn)) {
|
|
2748
|
+
let e = t.length - t.trimStart().length, n = u + s.length + 1;
|
|
2749
|
+
g.push(t), m.push(t.slice(Math.min(e, n))), h += 1;
|
|
2750
|
+
} else {
|
|
2751
|
+
if (_) break;
|
|
2752
|
+
g.push(t), m.push(t), h += 1;
|
|
2629
2753
|
}
|
|
2630
2754
|
}
|
|
2631
2755
|
t.push({
|
|
2632
|
-
indent:
|
|
2633
|
-
number:
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2756
|
+
indent: u,
|
|
2757
|
+
number: p,
|
|
2758
|
+
type: f,
|
|
2759
|
+
content: m.join("\n").trim(),
|
|
2760
|
+
contentLines: m,
|
|
2761
|
+
raw: g.join("\n")
|
|
2762
|
+
}), r = h, n = h;
|
|
2638
2763
|
}
|
|
2639
2764
|
return [t, r];
|
|
2640
2765
|
}
|
|
2641
|
-
|
|
2766
|
+
var Rn = RegExp(`^(${nn})([.)])\\s+(.+)$`);
|
|
2767
|
+
function zn(e) {
|
|
2768
|
+
let t = e.split("\n").filter((e) => e.trim().length > 0);
|
|
2769
|
+
if (t.length === 0) return null;
|
|
2770
|
+
let n = [];
|
|
2771
|
+
for (let e of t) {
|
|
2772
|
+
let t = e.trim().match(Rn);
|
|
2773
|
+
if (!t) return null;
|
|
2774
|
+
n.push({
|
|
2775
|
+
marker: t[1],
|
|
2776
|
+
content: t[3]
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2779
|
+
return pn(n.map((e) => e.marker)) ? {
|
|
2780
|
+
type: "orderedList",
|
|
2781
|
+
attrs: hn(n[0].marker),
|
|
2782
|
+
content: n.map((e) => ({
|
|
2783
|
+
type: "listItem",
|
|
2784
|
+
content: [{
|
|
2785
|
+
type: "paragraph",
|
|
2786
|
+
content: [{
|
|
2787
|
+
type: "text",
|
|
2788
|
+
text: e.content
|
|
2789
|
+
}]
|
|
2790
|
+
}]
|
|
2791
|
+
}))
|
|
2792
|
+
} : null;
|
|
2793
|
+
}
|
|
2794
|
+
function Bn(e, t, n) {
|
|
2642
2795
|
let r = [], i = 0;
|
|
2643
2796
|
for (; i < e.length;) {
|
|
2644
2797
|
let a = e[i];
|
|
2645
2798
|
if (a.indent === t) {
|
|
2646
|
-
let { paragraphLines: o, blockLines: s } =
|
|
2799
|
+
let { paragraphLines: o, blockLines: s } = In(a.contentLines), c = o.join("\n").trim(), l = [];
|
|
2647
2800
|
c && l.push({
|
|
2648
2801
|
type: "paragraph",
|
|
2649
2802
|
raw: c,
|
|
@@ -2657,11 +2810,12 @@ function Cn(e, t, n) {
|
|
|
2657
2810
|
let d = i + 1, f = [];
|
|
2658
2811
|
for (; d < e.length && e[d].indent > t;) f.push(e[d]), d += 1;
|
|
2659
2812
|
if (f.length > 0) {
|
|
2660
|
-
let e =
|
|
2813
|
+
let e = Bn(f, Math.min(...f.map((e) => e.indent)), n);
|
|
2661
2814
|
l.push({
|
|
2662
2815
|
type: "list",
|
|
2663
2816
|
ordered: !0,
|
|
2664
2817
|
start: f[0].number,
|
|
2818
|
+
typeMarker: f[0].type,
|
|
2665
2819
|
items: e,
|
|
2666
2820
|
raw: f.map((e) => e.raw).join("\n")
|
|
2667
2821
|
});
|
|
@@ -2675,7 +2829,7 @@ function Cn(e, t, n) {
|
|
|
2675
2829
|
}
|
|
2676
2830
|
return r;
|
|
2677
2831
|
}
|
|
2678
|
-
function
|
|
2832
|
+
function Vn(e, t) {
|
|
2679
2833
|
return e.map((e) => {
|
|
2680
2834
|
if (e.type !== "list_item") return t.parseChildren([e])[0];
|
|
2681
2835
|
let n = [];
|
|
@@ -2697,7 +2851,21 @@ function wn(e, t) {
|
|
|
2697
2851
|
};
|
|
2698
2852
|
});
|
|
2699
2853
|
}
|
|
2700
|
-
var
|
|
2854
|
+
var Hn = "listItem", Un = "textStyle", Wn = /^(\d+)\.\s$/;
|
|
2855
|
+
function Gn(e) {
|
|
2856
|
+
let t = e.match(/list-style-type\s*:\s*([^;]+)/i);
|
|
2857
|
+
if (!t) return null;
|
|
2858
|
+
switch (t[1].trim().toLowerCase()) {
|
|
2859
|
+
case "upper-roman": return "I";
|
|
2860
|
+
case "lower-roman": return "i";
|
|
2861
|
+
case "upper-alpha":
|
|
2862
|
+
case "upper-latin": return "A";
|
|
2863
|
+
case "lower-alpha":
|
|
2864
|
+
case "lower-latin": return "a";
|
|
2865
|
+
default: return null;
|
|
2866
|
+
}
|
|
2867
|
+
}
|
|
2868
|
+
var Kn = x.create({
|
|
2701
2869
|
name: "orderedList",
|
|
2702
2870
|
addOptions() {
|
|
2703
2871
|
return {
|
|
@@ -2719,7 +2887,24 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2719
2887
|
},
|
|
2720
2888
|
type: {
|
|
2721
2889
|
default: null,
|
|
2722
|
-
parseHTML: (e) =>
|
|
2890
|
+
parseHTML: (e) => {
|
|
2891
|
+
let t = e.getAttribute("type");
|
|
2892
|
+
if (t) return t;
|
|
2893
|
+
let n = e.getAttribute("style");
|
|
2894
|
+
if (n) {
|
|
2895
|
+
let e = Gn(n);
|
|
2896
|
+
if (e) return e;
|
|
2897
|
+
}
|
|
2898
|
+
let r = e.querySelector("li");
|
|
2899
|
+
if (r) {
|
|
2900
|
+
let e = r.getAttribute("style");
|
|
2901
|
+
if (e) {
|
|
2902
|
+
let t = Gn(e);
|
|
2903
|
+
if (t) return t;
|
|
2904
|
+
}
|
|
2905
|
+
}
|
|
2906
|
+
return null;
|
|
2907
|
+
}
|
|
2723
2908
|
}
|
|
2724
2909
|
};
|
|
2725
2910
|
},
|
|
@@ -2727,28 +2912,24 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2727
2912
|
return [{ tag: "ol" }];
|
|
2728
2913
|
},
|
|
2729
2914
|
renderHTML({ HTMLAttributes: e }) {
|
|
2730
|
-
let { start: t,
|
|
2731
|
-
return t
|
|
2915
|
+
let { start: t, type: n, ...r } = e, i = b(this.options.HTMLAttributes, r);
|
|
2916
|
+
return t !== 1 && (i.start = t), n && n !== "1" && (i.type = n), [
|
|
2732
2917
|
"ol",
|
|
2733
|
-
|
|
2734
|
-
0
|
|
2735
|
-
] : [
|
|
2736
|
-
"ol",
|
|
2737
|
-
_(this.options.HTMLAttributes, e),
|
|
2918
|
+
i,
|
|
2738
2919
|
0
|
|
2739
2920
|
];
|
|
2740
2921
|
},
|
|
2741
2922
|
markdownTokenName: "list",
|
|
2742
2923
|
parseMarkdown: (e, t) => {
|
|
2743
2924
|
if (e.type !== "list" || !e.ordered) return [];
|
|
2744
|
-
let n = e.start || 1, r = e.items ?
|
|
2745
|
-
return n
|
|
2925
|
+
let n = e.start || 1, r = e.typeMarker, i = e.items ? Vn(e.items, t) : [], a = {};
|
|
2926
|
+
return n !== 1 && (a.start = n), r && (a.type = r), Object.keys(a).length > 0 ? {
|
|
2746
2927
|
type: "orderedList",
|
|
2747
|
-
|
|
2928
|
+
attrs: a,
|
|
2929
|
+
content: i
|
|
2748
2930
|
} : {
|
|
2749
2931
|
type: "orderedList",
|
|
2750
|
-
|
|
2751
|
-
content: r
|
|
2932
|
+
content: i
|
|
2752
2933
|
};
|
|
2753
2934
|
},
|
|
2754
2935
|
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
|
|
@@ -2756,17 +2937,18 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2756
2937
|
name: "orderedList",
|
|
2757
2938
|
level: "block",
|
|
2758
2939
|
start: (e) => {
|
|
2759
|
-
let t = e.match(
|
|
2940
|
+
let t = e.match(Mn)?.index;
|
|
2760
2941
|
return t === void 0 ? -1 : t;
|
|
2761
2942
|
},
|
|
2762
2943
|
tokenize: (e, t, n) => {
|
|
2763
|
-
let r = e.split("\n"), [i, a] =
|
|
2944
|
+
let r = e.split("\n"), [i, a] = Ln(r);
|
|
2764
2945
|
if (i.length === 0) return;
|
|
2765
|
-
let o =
|
|
2946
|
+
let o = Bn(i, 0, n);
|
|
2766
2947
|
if (o.length !== 0) return {
|
|
2767
2948
|
type: "list",
|
|
2768
2949
|
ordered: !0,
|
|
2769
2950
|
start: i[0]?.number || 1,
|
|
2951
|
+
typeMarker: i[0]?.type,
|
|
2770
2952
|
items: o,
|
|
2771
2953
|
raw: r.slice(0, a).join("\n")
|
|
2772
2954
|
};
|
|
@@ -2774,32 +2956,47 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2774
2956
|
},
|
|
2775
2957
|
markdownOptions: { indentsContent: !0 },
|
|
2776
2958
|
addCommands() {
|
|
2777
|
-
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
2959
|
+
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Hn, this.editor.getAttributes(Un)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
2778
2960
|
},
|
|
2779
2961
|
addKeyboardShortcuts() {
|
|
2780
2962
|
return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
|
|
2781
2963
|
},
|
|
2964
|
+
addProseMirrorPlugins() {
|
|
2965
|
+
return [new w({ props: { handlePaste: (e, t) => {
|
|
2966
|
+
if ((t.clipboardData?.getData("text/html"))?.trim()) return !1;
|
|
2967
|
+
let n = t.clipboardData?.getData("text/plain");
|
|
2968
|
+
if (!n) return !1;
|
|
2969
|
+
let r = zn(n);
|
|
2970
|
+
if (!r) return !1;
|
|
2971
|
+
try {
|
|
2972
|
+
let t = e.state.schema.nodeFromJSON(r), n = e.state.tr.replaceSelectionWith(t);
|
|
2973
|
+
return e.dispatch(n), !0;
|
|
2974
|
+
} catch {
|
|
2975
|
+
return !1;
|
|
2976
|
+
}
|
|
2977
|
+
} } })];
|
|
2978
|
+
},
|
|
2782
2979
|
addInputRules() {
|
|
2783
|
-
let e =
|
|
2784
|
-
find:
|
|
2980
|
+
let e = (e, t) => (!t.attrs.type || t.attrs.type === "1") && t.childCount + t.attrs.start === +e[1], t = v({
|
|
2981
|
+
find: Wn,
|
|
2785
2982
|
type: this.type,
|
|
2786
2983
|
getAttributes: (e) => ({ start: +e[1] }),
|
|
2787
|
-
joinPredicate:
|
|
2984
|
+
joinPredicate: e
|
|
2788
2985
|
});
|
|
2789
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (
|
|
2790
|
-
find:
|
|
2986
|
+
return (this.options.keepMarks || this.options.keepAttributes) && (t = v({
|
|
2987
|
+
find: Wn,
|
|
2791
2988
|
type: this.type,
|
|
2792
2989
|
keepMarks: this.options.keepMarks,
|
|
2793
2990
|
keepAttributes: this.options.keepAttributes,
|
|
2794
2991
|
getAttributes: (e) => ({
|
|
2795
2992
|
start: +e[1],
|
|
2796
|
-
...this.editor.getAttributes(
|
|
2993
|
+
...this.editor.getAttributes(Un)
|
|
2797
2994
|
}),
|
|
2798
|
-
joinPredicate:
|
|
2995
|
+
joinPredicate: e,
|
|
2799
2996
|
editor: this.editor
|
|
2800
|
-
})), [
|
|
2997
|
+
})), [t];
|
|
2801
2998
|
}
|
|
2802
|
-
}),
|
|
2999
|
+
}), qn = /^\s*(\[([( |x])?\])\s$/, Jn = x.create({
|
|
2803
3000
|
name: "taskItem",
|
|
2804
3001
|
addOptions() {
|
|
2805
3002
|
return {
|
|
@@ -2833,7 +3030,7 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2833
3030
|
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
2834
3031
|
return [
|
|
2835
3032
|
"li",
|
|
2836
|
-
|
|
3033
|
+
b(this.options.HTMLAttributes, t, { "data-type": this.name }),
|
|
2837
3034
|
[
|
|
2838
3035
|
"label",
|
|
2839
3036
|
["input", {
|
|
@@ -2853,9 +3050,9 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2853
3050
|
}
|
|
2854
3051
|
return t.createNode("taskItem", { checked: e.checked || !1 }, n);
|
|
2855
3052
|
},
|
|
2856
|
-
renderMarkdown: (e, t) =>
|
|
3053
|
+
renderMarkdown: (e, t) => te(e, t, `- [${e.attrs?.checked ? "x" : " "}] `),
|
|
2857
3054
|
addExtensions() {
|
|
2858
|
-
return this.options.nested ? [
|
|
3055
|
+
return this.options.nested ? [en(this.name, [this.options.taskListTypeName])] : [];
|
|
2859
3056
|
},
|
|
2860
3057
|
addKeyboardShortcuts() {
|
|
2861
3058
|
let e = {
|
|
@@ -2900,7 +3097,7 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2900
3097
|
update: (e) => {
|
|
2901
3098
|
if (e.type !== this.type) return !1;
|
|
2902
3099
|
i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, l(e);
|
|
2903
|
-
let t = r.extensionManager.attributes, n =
|
|
3100
|
+
let t = r.extensionManager.attributes, n = ie(e, t), a = new Set(Object.keys(n)), o = this.options.HTMLAttributes;
|
|
2904
3101
|
return u.forEach((e) => {
|
|
2905
3102
|
a.has(e) || (e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e));
|
|
2906
3103
|
}), Object.entries(n).forEach(([e, t]) => {
|
|
@@ -2911,13 +3108,13 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2911
3108
|
};
|
|
2912
3109
|
},
|
|
2913
3110
|
addInputRules() {
|
|
2914
|
-
return [
|
|
2915
|
-
find:
|
|
3111
|
+
return [v({
|
|
3112
|
+
find: qn,
|
|
2916
3113
|
type: this.type,
|
|
2917
3114
|
getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
|
|
2918
3115
|
})];
|
|
2919
3116
|
}
|
|
2920
|
-
}),
|
|
3117
|
+
}), Yn = x.create({
|
|
2921
3118
|
name: "taskList",
|
|
2922
3119
|
addOptions() {
|
|
2923
3120
|
return {
|
|
@@ -2938,7 +3135,7 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2938
3135
|
renderHTML({ HTMLAttributes: e }) {
|
|
2939
3136
|
return [
|
|
2940
3137
|
"ul",
|
|
2941
|
-
|
|
3138
|
+
b(this.options.HTMLAttributes, e, { "data-type": this.name }),
|
|
2942
3139
|
0
|
|
2943
3140
|
];
|
|
2944
3141
|
},
|
|
@@ -2953,7 +3150,7 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2953
3150
|
},
|
|
2954
3151
|
tokenize(e, t, n) {
|
|
2955
3152
|
let r = (e) => {
|
|
2956
|
-
let t =
|
|
3153
|
+
let t = ee(e, {
|
|
2957
3154
|
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
2958
3155
|
extractItemData: (e) => ({
|
|
2959
3156
|
indentLevel: e[1].length,
|
|
@@ -2977,7 +3174,7 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
2977
3174
|
raw: t.raw,
|
|
2978
3175
|
items: t.items
|
|
2979
3176
|
}] : n.blockTokens(e);
|
|
2980
|
-
}, i =
|
|
3177
|
+
}, i = ee(e, {
|
|
2981
3178
|
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
2982
3179
|
extractItemData: (e) => ({
|
|
2983
3180
|
indentLevel: e[1].length,
|
|
@@ -3011,16 +3208,16 @@ var Tn = "listItem", En = "textStyle", Dn = /^(\d+)\.\s$/, On = v.create({
|
|
|
3011
3208
|
return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
|
|
3012
3209
|
}
|
|
3013
3210
|
});
|
|
3014
|
-
|
|
3211
|
+
y.create({
|
|
3015
3212
|
name: "listKit",
|
|
3016
3213
|
addExtensions() {
|
|
3017
3214
|
let e = [];
|
|
3018
|
-
return this.options.bulletList !== !1 && e.push(
|
|
3215
|
+
return this.options.bulletList !== !1 && e.push(Xt.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(yn.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(An.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Kn.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(Jn.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(Yn.configure(this.options.taskList)), e;
|
|
3019
3216
|
}
|
|
3020
3217
|
});
|
|
3021
3218
|
//#endregion
|
|
3022
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.
|
|
3023
|
-
var
|
|
3219
|
+
//#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.27.1_@tiptap+core@3.27.1_@tiptap+pm@3.27.1_/node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
3220
|
+
var Xn = " ", Zn = "\xA0", Qn = x.create({
|
|
3024
3221
|
name: "paragraph",
|
|
3025
3222
|
priority: 1e3,
|
|
3026
3223
|
addOptions() {
|
|
@@ -3034,7 +3231,7 @@ var W = " ", Mn = "\xA0", Nn = v.create({
|
|
|
3034
3231
|
renderHTML({ HTMLAttributes: e }) {
|
|
3035
3232
|
return [
|
|
3036
3233
|
"p",
|
|
3037
|
-
|
|
3234
|
+
b(this.options.HTMLAttributes, e),
|
|
3038
3235
|
0
|
|
3039
3236
|
];
|
|
3040
3237
|
},
|
|
@@ -3042,14 +3239,14 @@ var W = " ", Mn = "\xA0", Nn = v.create({
|
|
|
3042
3239
|
let n = e.tokens || [];
|
|
3043
3240
|
if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
|
|
3044
3241
|
let r = t.parseInline(n);
|
|
3045
|
-
return n.length === 1 && n[0].type === "text" && (n[0].raw ===
|
|
3242
|
+
return n.length === 1 && n[0].type === "text" && (n[0].raw === Xn || n[0].text === Xn || n[0].raw === Zn || n[0].text === Zn) && r.length === 1 && r[0].type === "text" && (r[0].text === Xn || r[0].text === Zn) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
|
|
3046
3243
|
},
|
|
3047
3244
|
renderMarkdown: (e, t, n) => {
|
|
3048
3245
|
if (!e) return "";
|
|
3049
3246
|
let r = Array.isArray(e.content) ? e.content : [];
|
|
3050
3247
|
if (r.length === 0) {
|
|
3051
3248
|
let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
|
|
3052
|
-
return n?.previousNode?.type === "paragraph" && e.length === 0 ?
|
|
3249
|
+
return n?.previousNode?.type === "paragraph" && e.length === 0 ? Xn : "";
|
|
3053
3250
|
}
|
|
3054
3251
|
return t.renderChildren(r);
|
|
3055
3252
|
},
|
|
@@ -3059,7 +3256,7 @@ var W = " ", Mn = "\xA0", Nn = v.create({
|
|
|
3059
3256
|
addKeyboardShortcuts() {
|
|
3060
3257
|
return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
|
|
3061
3258
|
}
|
|
3062
|
-
}),
|
|
3259
|
+
}), $n = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, er = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, tr = _.create({
|
|
3063
3260
|
name: "strike",
|
|
3064
3261
|
addOptions() {
|
|
3065
3262
|
return { HTMLAttributes: {} };
|
|
@@ -3079,7 +3276,7 @@ var W = " ", Mn = "\xA0", Nn = v.create({
|
|
|
3079
3276
|
renderHTML({ HTMLAttributes: e }) {
|
|
3080
3277
|
return [
|
|
3081
3278
|
"s",
|
|
3082
|
-
|
|
3279
|
+
b(this.options.HTMLAttributes, e),
|
|
3083
3280
|
0
|
|
3084
3281
|
];
|
|
3085
3282
|
},
|
|
@@ -3098,17 +3295,17 @@ var W = " ", Mn = "\xA0", Nn = v.create({
|
|
|
3098
3295
|
},
|
|
3099
3296
|
addInputRules() {
|
|
3100
3297
|
return [u({
|
|
3101
|
-
find:
|
|
3298
|
+
find: $n,
|
|
3102
3299
|
type: this.type
|
|
3103
3300
|
})];
|
|
3104
3301
|
},
|
|
3105
3302
|
addPasteRules() {
|
|
3106
3303
|
return [d({
|
|
3107
|
-
find:
|
|
3304
|
+
find: er,
|
|
3108
3305
|
type: this.type
|
|
3109
3306
|
})];
|
|
3110
3307
|
}
|
|
3111
|
-
}),
|
|
3308
|
+
}), nr = x.create({
|
|
3112
3309
|
name: "text",
|
|
3113
3310
|
group: "inline",
|
|
3114
3311
|
parseMarkdown: (e) => ({
|
|
@@ -3119,12 +3316,12 @@ var W = " ", Mn = "\xA0", Nn = v.create({
|
|
|
3119
3316
|
});
|
|
3120
3317
|
//#endregion
|
|
3121
3318
|
//#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
|
|
3122
|
-
function
|
|
3123
|
-
return new
|
|
3124
|
-
return new
|
|
3319
|
+
function rr(e = {}) {
|
|
3320
|
+
return new w({ view(t) {
|
|
3321
|
+
return new ir(t, e);
|
|
3125
3322
|
} });
|
|
3126
3323
|
}
|
|
3127
|
-
var
|
|
3324
|
+
var ir = class {
|
|
3128
3325
|
constructor(e, t) {
|
|
3129
3326
|
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = t.width ?? 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = [
|
|
3130
3327
|
"dragover",
|
|
@@ -3215,7 +3412,7 @@ var zn = class {
|
|
|
3215
3412
|
dragleave(e) {
|
|
3216
3413
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
3217
3414
|
}
|
|
3218
|
-
},
|
|
3415
|
+
}, q = class t extends e {
|
|
3219
3416
|
constructor(e) {
|
|
3220
3417
|
super(e, e);
|
|
3221
3418
|
}
|
|
@@ -3240,11 +3437,11 @@ var zn = class {
|
|
|
3240
3437
|
return new t(e.resolve(n.pos));
|
|
3241
3438
|
}
|
|
3242
3439
|
getBookmark() {
|
|
3243
|
-
return new
|
|
3440
|
+
return new ar(this.anchor);
|
|
3244
3441
|
}
|
|
3245
3442
|
static valid(e) {
|
|
3246
3443
|
let t = e.parent;
|
|
3247
|
-
if (t.inlineContent || !
|
|
3444
|
+
if (t.inlineContent || !sr(e) || !cr(e)) return !1;
|
|
3248
3445
|
let n = t.type.spec.allowGapCursor;
|
|
3249
3446
|
if (n != null) return n;
|
|
3250
3447
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
@@ -3267,7 +3464,7 @@ var zn = class {
|
|
|
3267
3464
|
for (;;) {
|
|
3268
3465
|
let o = n > 0 ? a.firstChild : a.lastChild;
|
|
3269
3466
|
if (!o) {
|
|
3270
|
-
if (a.isAtom && !a.isText && !
|
|
3467
|
+
if (a.isAtom && !a.isText && !g.isSelectable(a)) {
|
|
3271
3468
|
e = e.doc.resolve(i + a.nodeSize * n), r = !1;
|
|
3272
3469
|
continue search;
|
|
3273
3470
|
}
|
|
@@ -3281,8 +3478,8 @@ var zn = class {
|
|
|
3281
3478
|
}
|
|
3282
3479
|
}
|
|
3283
3480
|
};
|
|
3284
|
-
|
|
3285
|
-
var
|
|
3481
|
+
q.prototype.visible = !1, q.findFrom = q.findGapCursorFrom, e.jsonID("gapcursor", q);
|
|
3482
|
+
var ar = class t {
|
|
3286
3483
|
constructor(e) {
|
|
3287
3484
|
this.pos = e;
|
|
3288
3485
|
}
|
|
@@ -3291,13 +3488,13 @@ var Bn = class t {
|
|
|
3291
3488
|
}
|
|
3292
3489
|
resolve(t) {
|
|
3293
3490
|
let n = t.resolve(this.pos);
|
|
3294
|
-
return
|
|
3491
|
+
return q.valid(n) ? new q(n) : e.near(n);
|
|
3295
3492
|
}
|
|
3296
3493
|
};
|
|
3297
|
-
function
|
|
3494
|
+
function or(e) {
|
|
3298
3495
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
3299
3496
|
}
|
|
3300
|
-
function
|
|
3497
|
+
function sr(e) {
|
|
3301
3498
|
for (let t = e.depth; t >= 0; t--) {
|
|
3302
3499
|
let n = e.index(t), r = e.node(t);
|
|
3303
3500
|
if (n == 0) {
|
|
@@ -3305,13 +3502,13 @@ function Hn(e) {
|
|
|
3305
3502
|
continue;
|
|
3306
3503
|
}
|
|
3307
3504
|
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
3308
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
3505
|
+
if (e.childCount == 0 && !e.inlineContent || or(e.type)) return !0;
|
|
3309
3506
|
if (e.inlineContent) return !1;
|
|
3310
3507
|
}
|
|
3311
3508
|
}
|
|
3312
3509
|
return !0;
|
|
3313
3510
|
}
|
|
3314
|
-
function
|
|
3511
|
+
function cr(e) {
|
|
3315
3512
|
for (let t = e.depth; t >= 0; t--) {
|
|
3316
3513
|
let n = e.indexAfter(t), r = e.node(t);
|
|
3317
3514
|
if (n == r.childCount) {
|
|
@@ -3319,74 +3516,74 @@ function Un(e) {
|
|
|
3319
3516
|
continue;
|
|
3320
3517
|
}
|
|
3321
3518
|
for (let e = r.child(n);; e = e.firstChild) {
|
|
3322
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
3519
|
+
if (e.childCount == 0 && !e.inlineContent || or(e.type)) return !0;
|
|
3323
3520
|
if (e.inlineContent) return !1;
|
|
3324
3521
|
}
|
|
3325
3522
|
}
|
|
3326
3523
|
return !0;
|
|
3327
3524
|
}
|
|
3328
|
-
function
|
|
3329
|
-
return new
|
|
3330
|
-
decorations:
|
|
3525
|
+
function lr() {
|
|
3526
|
+
return new w({ props: {
|
|
3527
|
+
decorations: mr,
|
|
3331
3528
|
createSelectionBetween(e, t, n) {
|
|
3332
|
-
return t.pos == n.pos &&
|
|
3529
|
+
return t.pos == n.pos && q.valid(n) ? new q(n) : null;
|
|
3333
3530
|
},
|
|
3334
|
-
handleClick:
|
|
3335
|
-
handleKeyDown:
|
|
3336
|
-
handleDOMEvents: { beforeinput:
|
|
3531
|
+
handleClick: fr,
|
|
3532
|
+
handleKeyDown: ur,
|
|
3533
|
+
handleDOMEvents: { beforeinput: pr }
|
|
3337
3534
|
} });
|
|
3338
3535
|
}
|
|
3339
|
-
var
|
|
3340
|
-
ArrowLeft:
|
|
3341
|
-
ArrowRight:
|
|
3342
|
-
ArrowUp:
|
|
3343
|
-
ArrowDown:
|
|
3536
|
+
var ur = m({
|
|
3537
|
+
ArrowLeft: dr("horiz", -1),
|
|
3538
|
+
ArrowRight: dr("horiz", 1),
|
|
3539
|
+
ArrowUp: dr("vert", -1),
|
|
3540
|
+
ArrowDown: dr("vert", 1)
|
|
3344
3541
|
});
|
|
3345
|
-
function
|
|
3542
|
+
function dr(e, t) {
|
|
3346
3543
|
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
3347
3544
|
return function(e, r, i) {
|
|
3348
3545
|
let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
|
|
3349
|
-
if (a instanceof
|
|
3546
|
+
if (a instanceof C) {
|
|
3350
3547
|
if (!i.endOfTextblock(n) || o.depth == 0) return !1;
|
|
3351
3548
|
s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
|
|
3352
3549
|
}
|
|
3353
|
-
let c =
|
|
3354
|
-
return c ? (r && r(e.tr.setSelection(new
|
|
3550
|
+
let c = q.findGapCursorFrom(o, t, s);
|
|
3551
|
+
return c ? (r && r(e.tr.setSelection(new q(c))), !0) : !1;
|
|
3355
3552
|
};
|
|
3356
3553
|
}
|
|
3357
|
-
function
|
|
3554
|
+
function fr(e, t, n) {
|
|
3358
3555
|
if (!e || !e.editable) return !1;
|
|
3359
3556
|
let r = e.state.doc.resolve(t);
|
|
3360
|
-
if (!
|
|
3557
|
+
if (!q.valid(r)) return !1;
|
|
3361
3558
|
let i = e.posAtCoords({
|
|
3362
3559
|
left: n.clientX,
|
|
3363
3560
|
top: n.clientY
|
|
3364
3561
|
});
|
|
3365
|
-
return i && i.inside > -1 &&
|
|
3562
|
+
return i && i.inside > -1 && g.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new q(r))), !0);
|
|
3366
3563
|
}
|
|
3367
|
-
function
|
|
3368
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
3564
|
+
function pr(e, t) {
|
|
3565
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof q)) return !1;
|
|
3369
3566
|
let { $from: r } = e.state.selection, i = r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);
|
|
3370
3567
|
if (!i) return !1;
|
|
3371
3568
|
let a = n.empty;
|
|
3372
3569
|
for (let e = i.length - 1; e >= 0; e--) a = n.from(i[e].createAndFill(null, a));
|
|
3373
3570
|
let s = e.state.tr.replace(r.pos, r.pos, new o(a, 0, 0));
|
|
3374
|
-
return s.setSelection(
|
|
3571
|
+
return s.setSelection(C.near(s.doc.resolve(r.pos + 1))), e.dispatch(s), !1;
|
|
3375
3572
|
}
|
|
3376
|
-
function
|
|
3377
|
-
if (!(e.selection instanceof
|
|
3573
|
+
function mr(e) {
|
|
3574
|
+
if (!(e.selection instanceof q)) return null;
|
|
3378
3575
|
let t = document.createElement("div");
|
|
3379
|
-
return t.className = "ProseMirror-gapcursor",
|
|
3576
|
+
return t.className = "ProseMirror-gapcursor", T.create(e.doc, [S.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
3380
3577
|
}
|
|
3381
3578
|
//#endregion
|
|
3382
3579
|
//#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
|
|
3383
|
-
var
|
|
3580
|
+
var hr = 200, J = function() {};
|
|
3384
3581
|
J.prototype.append = function(e) {
|
|
3385
|
-
return e.length ? (e = J.from(e), !this.length && e || e.length <
|
|
3582
|
+
return e.length ? (e = J.from(e), !this.length && e || e.length < hr && this.leafAppend(e) || this.length < hr && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
3386
3583
|
}, J.prototype.prepend = function(e) {
|
|
3387
3584
|
return e.length ? J.from(e).append(this) : this;
|
|
3388
3585
|
}, J.prototype.appendInner = function(e) {
|
|
3389
|
-
return new
|
|
3586
|
+
return new _r(this, e);
|
|
3390
3587
|
}, J.prototype.slice = function(e, t) {
|
|
3391
3588
|
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? J.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
3392
3589
|
}, J.prototype.get = function(e) {
|
|
@@ -3400,9 +3597,9 @@ J.prototype.append = function(e) {
|
|
|
3400
3597
|
return r.push(e(t, n));
|
|
3401
3598
|
}, t, n), r;
|
|
3402
3599
|
}, J.from = function(e) {
|
|
3403
|
-
return e instanceof J ? e : e && e.length ? new
|
|
3600
|
+
return e instanceof J ? e : e && e.length ? new gr(e) : J.empty;
|
|
3404
3601
|
};
|
|
3405
|
-
var
|
|
3602
|
+
var gr = /* @__PURE__ */ function(e) {
|
|
3406
3603
|
function t(t) {
|
|
3407
3604
|
e.call(this), this.values = t;
|
|
3408
3605
|
}
|
|
@@ -3422,17 +3619,17 @@ var Yn = /* @__PURE__ */ function(e) {
|
|
|
3422
3619
|
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
3423
3620
|
for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
|
|
3424
3621
|
}, t.prototype.leafAppend = function(e) {
|
|
3425
|
-
if (this.length + e.length <=
|
|
3622
|
+
if (this.length + e.length <= hr) return new t(this.values.concat(e.flatten()));
|
|
3426
3623
|
}, t.prototype.leafPrepend = function(e) {
|
|
3427
|
-
if (this.length + e.length <=
|
|
3624
|
+
if (this.length + e.length <= hr) return new t(e.flatten().concat(this.values));
|
|
3428
3625
|
}, n.length.get = function() {
|
|
3429
3626
|
return this.values.length;
|
|
3430
3627
|
}, n.depth.get = function() {
|
|
3431
3628
|
return 0;
|
|
3432
3629
|
}, Object.defineProperties(t.prototype, n), t;
|
|
3433
3630
|
}(J);
|
|
3434
|
-
J.empty = new
|
|
3435
|
-
var
|
|
3631
|
+
J.empty = new gr([]);
|
|
3632
|
+
var _r = /* @__PURE__ */ function(e) {
|
|
3436
3633
|
function t(t, n) {
|
|
3437
3634
|
e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
3438
3635
|
}
|
|
@@ -3459,7 +3656,7 @@ var Xn = /* @__PURE__ */ function(e) {
|
|
|
3459
3656
|
}, t.prototype.appendInner = function(e) {
|
|
3460
3657
|
return this.left.depth >= Math.max(this.right.depth, e.depth) + 1 ? new t(this.left, new t(this.right, e)) : new t(this, e);
|
|
3461
3658
|
}, t;
|
|
3462
|
-
}(J),
|
|
3659
|
+
}(J), vr = 500, Y = class e {
|
|
3463
3660
|
constructor(e, t) {
|
|
3464
3661
|
this.items = e, this.eventCount = t;
|
|
3465
3662
|
}
|
|
@@ -3497,7 +3694,7 @@ var Xn = /* @__PURE__ */ function(e) {
|
|
|
3497
3694
|
(u = c && c.merge(l)) && (l = u, e ? a.pop() : s = s.slice(0, s.length - 1)), a.push(l), n &&= (o++, void 0), i || (c = l);
|
|
3498
3695
|
}
|
|
3499
3696
|
let l = o - r.depth;
|
|
3500
|
-
return l >
|
|
3697
|
+
return l > br && (s = yr(s, l), o -= l), new e(s.append(a), o);
|
|
3501
3698
|
}
|
|
3502
3699
|
remapping(e, t) {
|
|
3503
3700
|
let n = new l();
|
|
@@ -3529,7 +3726,7 @@ var Xn = /* @__PURE__ */ function(e) {
|
|
|
3529
3726
|
let l = [];
|
|
3530
3727
|
for (let e = n; e < o; e++) l.push(new X(a.maps[e]));
|
|
3531
3728
|
let u = new e(this.items.slice(0, i).append(l).append(r), s);
|
|
3532
|
-
return u.emptyItemCount() >
|
|
3729
|
+
return u.emptyItemCount() > vr && (u = u.compress(this.items.length - r.length)), u;
|
|
3533
3730
|
}
|
|
3534
3731
|
emptyItemCount() {
|
|
3535
3732
|
let e = 0;
|
|
@@ -3554,7 +3751,7 @@ var Xn = /* @__PURE__ */ function(e) {
|
|
|
3554
3751
|
}
|
|
3555
3752
|
};
|
|
3556
3753
|
Y.empty = new Y(J.empty, 0);
|
|
3557
|
-
function
|
|
3754
|
+
function yr(e, t) {
|
|
3558
3755
|
let n;
|
|
3559
3756
|
return e.forEach((e, r) => {
|
|
3560
3757
|
if (e.selection && t-- == 0) return n = r, !1;
|
|
@@ -3574,21 +3771,21 @@ var X = class e {
|
|
|
3574
3771
|
constructor(e, t, n, r, i) {
|
|
3575
3772
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
|
|
3576
3773
|
}
|
|
3577
|
-
},
|
|
3578
|
-
function
|
|
3774
|
+
}, br = 20;
|
|
3775
|
+
function xr(e, t, n, r) {
|
|
3579
3776
|
let i = n.getMeta(Q), a;
|
|
3580
3777
|
if (i) return i.historyState;
|
|
3581
|
-
n.getMeta(
|
|
3778
|
+
n.getMeta(kr) && (e = new Z(e.done, e.undone, null, 0, -1));
|
|
3582
3779
|
let o = n.getMeta("appendedTransaction");
|
|
3583
3780
|
if (n.steps.length == 0) return e;
|
|
3584
|
-
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r,
|
|
3781
|
+
if (o && o.getMeta(Q)) return o.getMeta(Q).redo ? new Z(e.done.addTransform(n, void 0, r, Or(t)), e.undone, Cr(n.mapping.maps), e.prevTime, e.prevComposition) : new Z(e.done, e.undone.addTransform(n, void 0, r, Or(t)), null, e.prevTime, e.prevComposition);
|
|
3585
3782
|
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
3586
|
-
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !
|
|
3587
|
-
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r,
|
|
3588
|
-
} else if (a = n.getMeta("rebased")) return new Z(e.done.rebased(n, a), e.undone.rebased(n, a),
|
|
3589
|
-
else return new Z(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps),
|
|
3783
|
+
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !Sr(n, e.prevRanges)), s = o ? wr(e.prevRanges, n.mapping) : Cr(n.mapping.maps);
|
|
3784
|
+
return new Z(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, Or(t)), Y.empty, s, n.time, i ?? e.prevComposition);
|
|
3785
|
+
} else if (a = n.getMeta("rebased")) return new Z(e.done.rebased(n, a), e.undone.rebased(n, a), wr(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
3786
|
+
else return new Z(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), wr(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
3590
3787
|
}
|
|
3591
|
-
function
|
|
3788
|
+
function Sr(e, t) {
|
|
3592
3789
|
if (!t) return !1;
|
|
3593
3790
|
if (!e.docChanged) return !0;
|
|
3594
3791
|
let n = !1;
|
|
@@ -3596,12 +3793,12 @@ function tr(e, t) {
|
|
|
3596
3793
|
for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
|
|
3597
3794
|
}), n;
|
|
3598
3795
|
}
|
|
3599
|
-
function
|
|
3796
|
+
function Cr(e) {
|
|
3600
3797
|
let t = [];
|
|
3601
3798
|
for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
|
|
3602
3799
|
return t;
|
|
3603
3800
|
}
|
|
3604
|
-
function
|
|
3801
|
+
function wr(e, t) {
|
|
3605
3802
|
if (!e) return null;
|
|
3606
3803
|
let n = [];
|
|
3607
3804
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -3610,8 +3807,8 @@ function rr(e, t) {
|
|
|
3610
3807
|
}
|
|
3611
3808
|
return n;
|
|
3612
3809
|
}
|
|
3613
|
-
function
|
|
3614
|
-
let r =
|
|
3810
|
+
function Tr(e, t, n) {
|
|
3811
|
+
let r = Or(t), i = Q.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
3615
3812
|
if (!a) return null;
|
|
3616
3813
|
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new Z(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
3617
3814
|
return a.transform.setSelection(o).setMeta(Q, {
|
|
@@ -3619,53 +3816,53 @@ function ir(e, t, n) {
|
|
|
3619
3816
|
historyState: c
|
|
3620
3817
|
});
|
|
3621
3818
|
}
|
|
3622
|
-
var
|
|
3623
|
-
function
|
|
3819
|
+
var Er = !1, Dr = null;
|
|
3820
|
+
function Or(e) {
|
|
3624
3821
|
let t = e.plugins;
|
|
3625
|
-
if (
|
|
3626
|
-
|
|
3822
|
+
if (Dr != t) {
|
|
3823
|
+
Er = !1, Dr = t;
|
|
3627
3824
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
3628
|
-
|
|
3825
|
+
Er = !0;
|
|
3629
3826
|
break;
|
|
3630
3827
|
}
|
|
3631
3828
|
}
|
|
3632
|
-
return
|
|
3829
|
+
return Er;
|
|
3633
3830
|
}
|
|
3634
|
-
var Q = new c("history"),
|
|
3635
|
-
function
|
|
3831
|
+
var Q = new c("history"), kr = new c("closeHistory");
|
|
3832
|
+
function Ar(e = {}) {
|
|
3636
3833
|
return e = {
|
|
3637
3834
|
depth: e.depth || 100,
|
|
3638
3835
|
newGroupDelay: e.newGroupDelay || 500
|
|
3639
|
-
}, new
|
|
3836
|
+
}, new w({
|
|
3640
3837
|
key: Q,
|
|
3641
3838
|
state: {
|
|
3642
3839
|
init() {
|
|
3643
3840
|
return new Z(Y.empty, Y.empty, null, 0, -1);
|
|
3644
3841
|
},
|
|
3645
3842
|
apply(t, n, r) {
|
|
3646
|
-
return
|
|
3843
|
+
return xr(n, r, t, e);
|
|
3647
3844
|
}
|
|
3648
3845
|
},
|
|
3649
3846
|
config: e,
|
|
3650
3847
|
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
3651
|
-
let n = t.inputType, r = n == "historyUndo" ?
|
|
3848
|
+
let n = t.inputType, r = n == "historyUndo" ? Mr : n == "historyRedo" ? Nr : null;
|
|
3652
3849
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
3653
3850
|
} } }
|
|
3654
3851
|
});
|
|
3655
3852
|
}
|
|
3656
|
-
function
|
|
3853
|
+
function jr(e, t) {
|
|
3657
3854
|
return (n, r) => {
|
|
3658
3855
|
let i = Q.getState(n);
|
|
3659
3856
|
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
3660
3857
|
if (r) {
|
|
3661
|
-
let a =
|
|
3858
|
+
let a = Tr(i, n, e);
|
|
3662
3859
|
a && r(t ? a.scrollIntoView() : a);
|
|
3663
3860
|
}
|
|
3664
3861
|
return !0;
|
|
3665
3862
|
};
|
|
3666
3863
|
}
|
|
3667
|
-
var
|
|
3668
|
-
|
|
3864
|
+
var Mr = jr(!1, !0), Nr = jr(!0, !0);
|
|
3865
|
+
y.create({
|
|
3669
3866
|
name: "characterCount",
|
|
3670
3867
|
addOptions() {
|
|
3671
3868
|
return {
|
|
@@ -3697,7 +3894,7 @@ g.create({
|
|
|
3697
3894
|
},
|
|
3698
3895
|
addProseMirrorPlugins() {
|
|
3699
3896
|
let e = !1;
|
|
3700
|
-
return [new
|
|
3897
|
+
return [new w({
|
|
3701
3898
|
key: new c("characterCount"),
|
|
3702
3899
|
appendTransaction: (t, n, r) => {
|
|
3703
3900
|
if (e) return;
|
|
@@ -3727,7 +3924,7 @@ g.create({
|
|
|
3727
3924
|
})];
|
|
3728
3925
|
}
|
|
3729
3926
|
});
|
|
3730
|
-
var
|
|
3927
|
+
var Pr = y.create({
|
|
3731
3928
|
name: "dropCursor",
|
|
3732
3929
|
addOptions() {
|
|
3733
3930
|
return {
|
|
@@ -3737,10 +3934,10 @@ var pr = g.create({
|
|
|
3737
3934
|
};
|
|
3738
3935
|
},
|
|
3739
3936
|
addProseMirrorPlugins() {
|
|
3740
|
-
return [
|
|
3937
|
+
return [rr(this.options)];
|
|
3741
3938
|
}
|
|
3742
3939
|
});
|
|
3743
|
-
|
|
3940
|
+
y.create({
|
|
3744
3941
|
name: "focus",
|
|
3745
3942
|
addOptions() {
|
|
3746
3943
|
return {
|
|
@@ -3749,11 +3946,11 @@ g.create({
|
|
|
3749
3946
|
};
|
|
3750
3947
|
},
|
|
3751
3948
|
addProseMirrorPlugins() {
|
|
3752
|
-
return [new
|
|
3949
|
+
return [new w({
|
|
3753
3950
|
key: new c("focus"),
|
|
3754
3951
|
props: { decorations: ({ doc: e, selection: t }) => {
|
|
3755
3952
|
let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
|
|
3756
|
-
if (!n || !r) return
|
|
3953
|
+
if (!n || !r) return T.create(e, []);
|
|
3757
3954
|
let o = 0;
|
|
3758
3955
|
this.options.mode === "deepest" && e.descendants((e, t) => {
|
|
3759
3956
|
if (!e.isText) {
|
|
@@ -3765,28 +3962,28 @@ g.create({
|
|
|
3765
3962
|
return e.descendants((e, t) => {
|
|
3766
3963
|
if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
|
|
3767
3964
|
if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
|
|
3768
|
-
a.push(
|
|
3769
|
-
}),
|
|
3965
|
+
a.push(S.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
3966
|
+
}), T.create(e, a);
|
|
3770
3967
|
} }
|
|
3771
3968
|
})];
|
|
3772
3969
|
}
|
|
3773
3970
|
});
|
|
3774
|
-
var
|
|
3971
|
+
var Fr = y.create({
|
|
3775
3972
|
name: "gapCursor",
|
|
3776
3973
|
addProseMirrorPlugins() {
|
|
3777
|
-
return [
|
|
3974
|
+
return [lr()];
|
|
3778
3975
|
},
|
|
3779
3976
|
extendNodeSchema(e) {
|
|
3780
|
-
return { allowGapCursor:
|
|
3977
|
+
return { allowGapCursor: oe(p(e, "allowGapCursor", {
|
|
3781
3978
|
name: e.name,
|
|
3782
3979
|
options: e.options,
|
|
3783
3980
|
storage: e.storage
|
|
3784
3981
|
})) ?? null };
|
|
3785
3982
|
}
|
|
3786
|
-
}),
|
|
3787
|
-
function
|
|
3983
|
+
}), Ir = "placeholder", $ = new c("tiptap__placeholder"), Lr = 200;
|
|
3984
|
+
function Rr(e) {
|
|
3788
3985
|
let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
|
|
3789
|
-
return o && u.push(l),
|
|
3986
|
+
return o && u.push(l), S.node(i, i + a.nodeSize, {
|
|
3790
3987
|
class: u.join(" "),
|
|
3791
3988
|
[r]: typeof n == "function" ? n({
|
|
3792
3989
|
editor: t,
|
|
@@ -3796,17 +3993,17 @@ function _r(e) {
|
|
|
3796
3993
|
}) : n
|
|
3797
3994
|
});
|
|
3798
3995
|
}
|
|
3799
|
-
function
|
|
3996
|
+
function zr(e, t) {
|
|
3800
3997
|
return typeof e == "function" ? e(t) : e;
|
|
3801
3998
|
}
|
|
3802
|
-
function
|
|
3999
|
+
function Br({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
3803
4000
|
if (!(e.isEditable || !t.showOnlyWhenEditable)) return null;
|
|
3804
4001
|
let { anchor: o } = i, s = [], c = e.isEmpty;
|
|
3805
4002
|
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
3806
4003
|
let i = r.resolve(o), l = i.depth > 0 ? i.node(1) : i.nodeAfter, u = i.depth > 0 ? i.before(1) : o;
|
|
3807
4004
|
if (l && l.type.isTextblock && a(l)) {
|
|
3808
4005
|
let r = o >= u && o <= u + l.nodeSize;
|
|
3809
|
-
s.push(
|
|
4006
|
+
s.push(Rr({
|
|
3810
4007
|
editor: e,
|
|
3811
4008
|
isEmptyDoc: c,
|
|
3812
4009
|
dataAttribute: n,
|
|
@@ -3814,7 +4011,7 @@ function yr({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
3814
4011
|
placeholder: t.placeholder,
|
|
3815
4012
|
classes: {
|
|
3816
4013
|
emptyEditor: t.emptyEditorClass,
|
|
3817
|
-
emptyNode:
|
|
4014
|
+
emptyNode: zr(t.emptyNodeClass, {
|
|
3818
4015
|
editor: e,
|
|
3819
4016
|
node: l,
|
|
3820
4017
|
pos: u,
|
|
@@ -3829,7 +4026,7 @@ function yr({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
3829
4026
|
let i = $.getState(e.state), l = i?.topPos ?? 0, u = i?.bottomPos ?? r.content.size;
|
|
3830
4027
|
r.nodesBetween(l, u, (r, i) => {
|
|
3831
4028
|
let l = o >= i && o <= i + r.nodeSize, u = !r.isLeaf && a(r);
|
|
3832
|
-
return r.type.isTextblock && (l || !t.showOnlyCurrent) && u && s.push(
|
|
4029
|
+
return r.type.isTextblock && (l || !t.showOnlyCurrent) && u && s.push(Rr({
|
|
3833
4030
|
editor: e,
|
|
3834
4031
|
isEmptyDoc: c,
|
|
3835
4032
|
dataAttribute: n,
|
|
@@ -3837,7 +4034,7 @@ function yr({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
3837
4034
|
placeholder: t.placeholder,
|
|
3838
4035
|
classes: {
|
|
3839
4036
|
emptyEditor: t.emptyEditorClass,
|
|
3840
|
-
emptyNode:
|
|
4037
|
+
emptyNode: zr(t.emptyNodeClass, {
|
|
3841
4038
|
editor: e,
|
|
3842
4039
|
node: r,
|
|
3843
4040
|
pos: i,
|
|
@@ -3849,19 +4046,19 @@ function yr({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
3849
4046
|
})), t.includeChildren;
|
|
3850
4047
|
});
|
|
3851
4048
|
}
|
|
3852
|
-
return
|
|
4049
|
+
return T.create(r, s);
|
|
3853
4050
|
}
|
|
3854
|
-
function
|
|
4051
|
+
function Vr(e) {
|
|
3855
4052
|
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
3856
4053
|
}
|
|
3857
|
-
function
|
|
4054
|
+
function Hr(e) {
|
|
3858
4055
|
let t = getComputedStyle(e), n = `${t.overflow} ${t.overflowY} ${t.overflowX}`;
|
|
3859
4056
|
return /auto|scroll|overlay/.test(n);
|
|
3860
4057
|
}
|
|
3861
|
-
function
|
|
4058
|
+
function Ur(e) {
|
|
3862
4059
|
let t = e;
|
|
3863
4060
|
for (; t;) {
|
|
3864
|
-
if (
|
|
4061
|
+
if (Hr(t)) return t;
|
|
3865
4062
|
let e = t.parentElement;
|
|
3866
4063
|
if (!e) {
|
|
3867
4064
|
let e = t.getRootNode();
|
|
@@ -3875,34 +4072,37 @@ function Sr(e) {
|
|
|
3875
4072
|
}
|
|
3876
4073
|
return window;
|
|
3877
4074
|
}
|
|
3878
|
-
function
|
|
4075
|
+
function Wr(e) {
|
|
3879
4076
|
return e === window ? {
|
|
3880
4077
|
top: 0,
|
|
3881
4078
|
bottom: window.innerHeight
|
|
3882
4079
|
} : e.getBoundingClientRect();
|
|
3883
4080
|
}
|
|
3884
|
-
function
|
|
3885
|
-
let
|
|
4081
|
+
function Gr({ view: e, scrollContainer: t }) {
|
|
4082
|
+
let n = e.dom.getBoundingClientRect();
|
|
4083
|
+
if (n.width <= 0 || n.height <= 0) return null;
|
|
4084
|
+
let r = t ? Wr(t) : {
|
|
3886
4085
|
top: 0,
|
|
3887
4086
|
bottom: window.innerHeight
|
|
3888
|
-
},
|
|
3889
|
-
if (
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
4087
|
+
}, i = Math.max(n.top, r.top) - Lr, a = Math.min(n.bottom, r.bottom) + Lr;
|
|
4088
|
+
if (i >= a) return null;
|
|
4089
|
+
let o = n.left + 1, s = n.right - 1;
|
|
4090
|
+
if (o > s) return null;
|
|
4091
|
+
let c = getComputedStyle(e.dom).direction === "rtl" ? n.right - 2 : n.left + 2, l = Math.min(Math.max(c, o), s), u = Math.max(i + 2, n.top + 1), d = Math.min(a - 2, n.bottom - 1);
|
|
4092
|
+
if (u > d) return null;
|
|
4093
|
+
let f = e.posAtCoords({
|
|
4094
|
+
left: l,
|
|
4095
|
+
top: u
|
|
4096
|
+
}), p = e.posAtCoords({
|
|
4097
|
+
left: l,
|
|
4098
|
+
top: d
|
|
3899
4099
|
});
|
|
3900
|
-
return {
|
|
3901
|
-
top:
|
|
3902
|
-
bottom:
|
|
4100
|
+
return !f || !p ? null : {
|
|
4101
|
+
top: f.pos,
|
|
4102
|
+
bottom: p.pos
|
|
3903
4103
|
};
|
|
3904
4104
|
}
|
|
3905
|
-
var
|
|
4105
|
+
var Kr = {
|
|
3906
4106
|
init() {
|
|
3907
4107
|
return {
|
|
3908
4108
|
topPos: null,
|
|
@@ -3920,13 +4120,14 @@ var Tr = {
|
|
|
3920
4120
|
} : t;
|
|
3921
4121
|
}
|
|
3922
4122
|
};
|
|
3923
|
-
function
|
|
3924
|
-
let t =
|
|
3925
|
-
let n =
|
|
4123
|
+
function qr(e) {
|
|
4124
|
+
let t = Ur(e.dom), n = () => {
|
|
4125
|
+
let n = Gr({
|
|
3926
4126
|
view: e,
|
|
3927
|
-
doc: e.state.doc,
|
|
3928
4127
|
scrollContainer: t
|
|
3929
|
-
})
|
|
4128
|
+
});
|
|
4129
|
+
if (n === null) return;
|
|
4130
|
+
let r = $.getState(e.state);
|
|
3930
4131
|
if (r?.topPos === n.top && r?.bottomPos === n.bottom) return;
|
|
3931
4132
|
let i = e.state.tr.setMeta($, { positions: n });
|
|
3932
4133
|
e.dispatch(i);
|
|
@@ -3937,22 +4138,26 @@ function Er(e) {
|
|
|
3937
4138
|
e - i >= 150 ? (i = e, n()) : a();
|
|
3938
4139
|
}));
|
|
3939
4140
|
};
|
|
3940
|
-
|
|
4141
|
+
t.addEventListener("scroll", a, { passive: !0 });
|
|
4142
|
+
let o = typeof ResizeObserver < "u" ? new ResizeObserver(a) : null;
|
|
4143
|
+
o?.observe(e.dom);
|
|
4144
|
+
let s = typeof IntersectionObserver < "u" ? new IntersectionObserver(a) : null;
|
|
4145
|
+
return s?.observe(e.dom), e.dom.addEventListener("focus", a), n(), {
|
|
3941
4146
|
update(t, n) {
|
|
3942
4147
|
e.state.doc.content.size !== n.doc.content.size && a();
|
|
3943
4148
|
},
|
|
3944
4149
|
destroy: () => {
|
|
3945
|
-
r !== null && cancelAnimationFrame(r), t.removeEventListener("scroll", a);
|
|
4150
|
+
r !== null && cancelAnimationFrame(r), t.removeEventListener("scroll", a), o?.disconnect(), s?.disconnect(), e.dom.removeEventListener("focus", a);
|
|
3946
4151
|
}
|
|
3947
4152
|
};
|
|
3948
4153
|
}
|
|
3949
|
-
function
|
|
3950
|
-
let n = t.dataAttribute ? `data-${
|
|
3951
|
-
return new
|
|
4154
|
+
function Jr({ editor: e, options: t }) {
|
|
4155
|
+
let n = t.dataAttribute ? `data-${Vr(t.dataAttribute)}` : `data-${Ir}`;
|
|
4156
|
+
return new w({
|
|
3952
4157
|
key: $,
|
|
3953
|
-
state:
|
|
3954
|
-
view:
|
|
3955
|
-
props: { decorations: ({ doc: r, selection: i }) =>
|
|
4158
|
+
state: Kr,
|
|
4159
|
+
view: qr,
|
|
4160
|
+
props: { decorations: ({ doc: r, selection: i }) => Br({
|
|
3956
4161
|
editor: e,
|
|
3957
4162
|
options: t,
|
|
3958
4163
|
dataAttribute: n,
|
|
@@ -3961,13 +4166,13 @@ function Dr({ editor: e, options: t }) {
|
|
|
3961
4166
|
}) }
|
|
3962
4167
|
});
|
|
3963
4168
|
}
|
|
3964
|
-
|
|
4169
|
+
y.create({
|
|
3965
4170
|
name: "placeholder",
|
|
3966
4171
|
addOptions() {
|
|
3967
4172
|
return {
|
|
3968
4173
|
emptyEditorClass: "is-editor-empty",
|
|
3969
4174
|
emptyNodeClass: "is-empty",
|
|
3970
|
-
dataAttribute:
|
|
4175
|
+
dataAttribute: Ir,
|
|
3971
4176
|
placeholder: "Write something …",
|
|
3972
4177
|
showOnlyWhenEditable: !0,
|
|
3973
4178
|
showOnlyCurrent: !0,
|
|
@@ -3975,32 +4180,32 @@ g.create({
|
|
|
3975
4180
|
};
|
|
3976
4181
|
},
|
|
3977
4182
|
addProseMirrorPlugins() {
|
|
3978
|
-
return [
|
|
4183
|
+
return [Jr({
|
|
3979
4184
|
editor: this.editor,
|
|
3980
4185
|
options: this.options
|
|
3981
4186
|
})];
|
|
3982
4187
|
}
|
|
3983
4188
|
});
|
|
3984
|
-
var
|
|
3985
|
-
|
|
4189
|
+
var Yr = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
4190
|
+
y.create({
|
|
3986
4191
|
name: "selection",
|
|
3987
4192
|
addOptions() {
|
|
3988
4193
|
return { className: "selection" };
|
|
3989
4194
|
},
|
|
3990
4195
|
addProseMirrorPlugins() {
|
|
3991
4196
|
let { editor: e, options: t } = this;
|
|
3992
|
-
return e.options.injectCSS && typeof document < "u" &&
|
|
4197
|
+
return e.options.injectCSS && typeof document < "u" && ne(Yr, e.options.injectNonce, "selection"), [new w({
|
|
3993
4198
|
key: new c("selection"),
|
|
3994
4199
|
props: { decorations(n) {
|
|
3995
|
-
return n.selection.empty || e.isFocused || !e.isEditable || s(n.selection) || e.view.dragging ? null :
|
|
4200
|
+
return n.selection.empty || e.isFocused || !e.isEditable || s(n.selection) || e.view.dragging ? null : T.create(n.doc, [S.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
3996
4201
|
} }
|
|
3997
4202
|
})];
|
|
3998
4203
|
}
|
|
3999
4204
|
});
|
|
4000
|
-
function
|
|
4205
|
+
function Xr({ types: e, node: t }) {
|
|
4001
4206
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
4002
4207
|
}
|
|
4003
|
-
var
|
|
4208
|
+
var Zr = y.create({
|
|
4004
4209
|
name: "trailingNode",
|
|
4005
4210
|
addOptions() {
|
|
4006
4211
|
return {
|
|
@@ -4010,7 +4215,7 @@ var Ar = g.create({
|
|
|
4010
4215
|
},
|
|
4011
4216
|
addProseMirrorPlugins() {
|
|
4012
4217
|
let e = new c(this.name), t = this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, e]) => e).filter((e) => (this.options.notAfter || []).concat(t).includes(e.name));
|
|
4013
|
-
return [new
|
|
4218
|
+
return [new w({
|
|
4014
4219
|
key: e,
|
|
4015
4220
|
appendTransaction: (n, r, i) => {
|
|
4016
4221
|
let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
|
|
@@ -4019,7 +4224,7 @@ var Ar = g.create({
|
|
|
4019
4224
|
state: {
|
|
4020
4225
|
init: (e, t) => {
|
|
4021
4226
|
let r = t.tr.doc.lastChild;
|
|
4022
|
-
return !
|
|
4227
|
+
return !Xr({
|
|
4023
4228
|
node: r,
|
|
4024
4229
|
types: n
|
|
4025
4230
|
});
|
|
@@ -4027,7 +4232,7 @@ var Ar = g.create({
|
|
|
4027
4232
|
apply: (e, t) => {
|
|
4028
4233
|
if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
|
|
4029
4234
|
let r = e.doc.lastChild;
|
|
4030
|
-
return !
|
|
4235
|
+
return !Xr({
|
|
4031
4236
|
node: r,
|
|
4032
4237
|
types: n
|
|
4033
4238
|
});
|
|
@@ -4035,7 +4240,7 @@ var Ar = g.create({
|
|
|
4035
4240
|
}
|
|
4036
4241
|
})];
|
|
4037
4242
|
}
|
|
4038
|
-
}),
|
|
4243
|
+
}), Qr = y.create({
|
|
4039
4244
|
name: "undoRedo",
|
|
4040
4245
|
addOptions() {
|
|
4041
4246
|
return {
|
|
@@ -4045,12 +4250,12 @@ var Ar = g.create({
|
|
|
4045
4250
|
},
|
|
4046
4251
|
addCommands() {
|
|
4047
4252
|
return {
|
|
4048
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
4049
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
4253
|
+
undo: () => ({ state: e, dispatch: t }) => Mr(e, t),
|
|
4254
|
+
redo: () => ({ state: e, dispatch: t }) => Nr(e, t)
|
|
4050
4255
|
};
|
|
4051
4256
|
},
|
|
4052
4257
|
addProseMirrorPlugins() {
|
|
4053
|
-
return [
|
|
4258
|
+
return [Ar(this.options)];
|
|
4054
4259
|
},
|
|
4055
4260
|
addKeyboardShortcuts() {
|
|
4056
4261
|
return {
|
|
@@ -4061,12 +4266,12 @@ var Ar = g.create({
|
|
|
4061
4266
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
4062
4267
|
};
|
|
4063
4268
|
}
|
|
4064
|
-
}),
|
|
4269
|
+
}), $r = y.create({
|
|
4065
4270
|
name: "starterKit",
|
|
4066
4271
|
addExtensions() {
|
|
4067
4272
|
let e = [];
|
|
4068
|
-
return this.options.bold !== !1 && e.push(
|
|
4273
|
+
return this.options.bold !== !1 && e.push(Ot.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(Ct.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(Xt.configure(this.options.bulletList)), this.options.code !== !1 && e.push(jt.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(Ft.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(It.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(Pr.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(Fr.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Lt.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(Rt.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(Qr.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(zt.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(Wt.configure(this.options.italic)), this.options.listItem !== !1 && e.push(yn.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(An.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(le.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Kn.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(Qn.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(tr.configure(this.options.strike)), this.options.text !== !1 && e.push(nr.configure(this.options.text)), this.options.underline !== !1 && e.push(ue.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(Zr.configure(this.options?.trailingNode)), e;
|
|
4069
4274
|
}
|
|
4070
|
-
}),
|
|
4275
|
+
}), ei = $r;
|
|
4071
4276
|
//#endregion
|
|
4072
|
-
export {
|
|
4277
|
+
export { $r as StarterKit, ei as default };
|