@templatical/editor 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AiChatSidebar-B0-U5-sb.js → AiChatSidebar-BIKvYREk.js} +57 -56
- package/dist/{AiFeatureMenu-DxDwLS8B.js → AiFeatureMenu-QbD82crt.js} +23 -23
- package/dist/{BlockIssueBadge-C-EPqWsh.js → BlockIssueBadge-B3xVgMTh.js} +11 -11
- package/dist/CloudEditor-DptuSf7A.js +1234 -0
- package/dist/{CollaboratorBar-DgwjisX2.js → CollaboratorBar-DrA_K69w.js} +20 -20
- package/dist/{CommentsSidebar-CpRLN40c.js → CommentsSidebar-D_tSGvTX.js} +158 -157
- package/dist/CountdownBlock-apiYUhkQ.js +92 -0
- package/dist/CountdownToolbar-CS0axcjz.js +210 -0
- package/dist/{DesignReferenceSidebar-BgPDbOsl.js → DesignReferenceSidebar-DWYK9nTk.js} +58 -57
- package/dist/{IssuesPanel-I0z6k6-H.js → IssuesPanel-CR1MPaDE.js} +40 -40
- package/dist/{LoadingTrack-C7mGWPHS.js → LoadingTrack-DsecR8Rw.js} +1 -1
- package/dist/MergeTagSuggestion-CH2SUxBo.js +1327 -0
- package/dist/ModuleBrowserModal-D45rBj5C.js +202 -0
- package/dist/{ModulePreviewCanvas-Dni9kK4j.js → ModulePreviewCanvas-BiQ6B2-l.js} +29 -29
- package/dist/{NumberWithSuffix-D3fdj0iO.js → NumberWithSuffix-CrA6quxx.js} +143 -142
- package/dist/ParagraphEditor-1NaUJpZO.js +721 -0
- package/dist/{RichTextEditorContent-Q5altsx1.js → RichTextEditorContent-BqLHIZY7.js} +45 -44
- package/dist/{SaveModuleDialog-C38VqN2T.js → SaveModuleDialog-B0sPOTgO.js} +38 -37
- package/dist/{SnapshotHistory-ByloTpwh.js → SnapshotHistory-DslVzmSb.js} +34 -33
- package/dist/{TemplateScoringPanel-CUxiPtEf.js → TemplateScoringPanel-CZ62rGHz.js} +83 -82
- package/dist/{TestEmailModal-BvZBMBad.js → TestEmailModal-DWGniJVu.js} +22 -21
- package/dist/TitleEditor-D4t_gZZJ.js +193 -0
- package/dist/{TplModal-BYb-X5Bj.js → TplModal-Br2VG6cn.js} +14 -13
- package/dist/{blockTypeIcons-CyAom3iI.js → blockTypeIcons-CXhCS5WV.js} +5 -5
- package/dist/bundle-stats.json +8 -8
- package/dist/cdn/chunks/{AiFeatureMenu-BSoy-SoF.js → AiFeatureMenu-3Slo_LGA.js} +8 -8
- package/dist/cdn/chunks/{AiFeatureMenu-BSoy-SoF.js.map → AiFeatureMenu-3Slo_LGA.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-BQDUuJxy.js → BlockIssueBadge-BxwEiiF3.js} +5 -5
- package/dist/cdn/chunks/{BlockIssueBadge-BQDUuJxy.js.map → BlockIssueBadge-BxwEiiF3.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-BZuzsQOZ.js → CloudEditor-DFIFWD9G.js} +163 -161
- package/dist/cdn/chunks/CloudEditor-DFIFWD9G.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-DUpSrtDr.js → CollaboratorBar-Cu3vuN66.js} +4 -4
- package/dist/cdn/chunks/{CollaboratorBar-DUpSrtDr.js.map → CollaboratorBar-Cu3vuN66.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-DChGTAsH.js → CountdownBlock-BEVAJQtQ.js} +3 -3
- package/dist/cdn/chunks/{CountdownBlock-DChGTAsH.js.map → CountdownBlock-BEVAJQtQ.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-C6gX2SJr.js → CountdownToolbar-CI2sQZv5.js} +4 -4
- package/dist/cdn/chunks/{CountdownToolbar-C6gX2SJr.js.map → CountdownToolbar-CI2sQZv5.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-Bo1uhdSe.js → IssuesPanel-BdeDoTcn.js} +11 -11
- package/dist/cdn/chunks/{IssuesPanel-Bo1uhdSe.js.map → IssuesPanel-BdeDoTcn.js.map} +1 -1
- package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js +213 -0
- package/dist/cdn/chunks/MergeTagSuggestion-BsCAo4Co.js.map +1 -0
- package/dist/cdn/chunks/{ModuleBrowserModal-a-tZRCcD.js → ModuleBrowserModal-Dz-I5zfj.js} +11 -8
- package/dist/cdn/chunks/{ModuleBrowserModal-a-tZRCcD.js.map → ModuleBrowserModal-Dz-I5zfj.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-Bm6k0Op0.js → ModulePreviewCanvas-BfinyuAN.js} +21 -21
- package/dist/cdn/chunks/{ModulePreviewCanvas-Bm6k0Op0.js.map → ModulePreviewCanvas-BfinyuAN.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-HTbuD3VJ.js → NumberWithSuffix-CDjEa08X.js} +4 -4
- package/dist/cdn/chunks/{NumberWithSuffix-HTbuD3VJ.js.map → NumberWithSuffix-CDjEa08X.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-pGrfSccu.js → ParagraphEditor-B3fG0vge.js} +130 -110
- package/dist/cdn/chunks/ParagraphEditor-B3fG0vge.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-D7XZix_1.js → RichTextEditorContent-C6YPCp9j.js} +4 -4
- package/dist/cdn/chunks/{RichTextEditorContent-D7XZix_1.js.map → RichTextEditorContent-C6YPCp9j.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-C9PQ9x6j.js → SaveModuleDialog-C6UIIVAM.js} +6 -6
- package/dist/cdn/chunks/{SaveModuleDialog-C9PQ9x6j.js.map → SaveModuleDialog-C6UIIVAM.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-BvFbL16O.js → TitleEditor-BiZbLYF1.js} +62 -46
- package/dist/cdn/chunks/TitleEditor-BiZbLYF1.js.map +1 -0
- package/dist/cdn/chunks/blockTypeIcons-BernVG06.js +22 -0
- package/dist/cdn/chunks/{blockTypeIcons-Kd1MT0u8.js.map → blockTypeIcons-BernVG06.js.map} +1 -1
- package/dist/{de-C2wOXoxs.js → cdn/chunks/de-LsV0u1tP.js} +19 -1
- package/dist/cdn/chunks/de-LsV0u1tP.js.map +1 -0
- package/dist/cdn/chunks/{draggable-Bci-fq8y.js → draggable-kG-D5Xsm.js} +19 -10
- package/dist/cdn/chunks/draggable-kG-D5Xsm.js.map +1 -0
- package/dist/cdn/chunks/{en-dR7zfNC3.js → en-Bb8X1bOs.js} +18 -2
- package/dist/cdn/chunks/en-Bb8X1bOs.js.map +1 -0
- package/dist/cdn/chunks/extensions-Drp8UDc6.js +421 -0
- package/dist/cdn/chunks/extensions-Drp8UDc6.js.map +1 -0
- package/dist/cdn/chunks/{features-DU6lA8l1.js → features-Dpczf9Su.js} +1171 -994
- package/dist/cdn/chunks/features-Dpczf9Su.js.map +1 -0
- package/dist/cdn/chunks/{icons-BjHUZZyJ.js → icons-CuxnJiGQ.js} +170 -164
- package/dist/cdn/chunks/icons-CuxnJiGQ.js.map +1 -0
- package/dist/cdn/chunks/{liquid.browser-DKKBzRQu.js → liquid.browser-BJOEu6Cg.js} +693 -678
- package/dist/cdn/chunks/liquid.browser-BJOEu6Cg.js.map +1 -0
- package/dist/cdn/chunks/{media-library-Byelliig.js → media-library-CiYl_BO7.js} +556 -554
- package/dist/cdn/chunks/{media-library-Byelliig.js.map → media-library-CiYl_BO7.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-BZ86xqK6.js → pt-BR-BwJY_cvb.js} +18 -2
- package/dist/cdn/chunks/pt-BR-BwJY_cvb.js.map +1 -0
- package/dist/cdn/chunks/{pusher-BICWUP2j.js → pusher-CIwiKF8H.js} +9 -6
- package/dist/cdn/chunks/{pusher-BICWUP2j.js.map → pusher-CIwiKF8H.js.map} +1 -1
- package/dist/cdn/chunks/quality-CNjGxBG0.js +2176 -0
- package/dist/cdn/chunks/{quality-DNnYAntR.js.map → quality-CNjGxBG0.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-CZKO-Tav.js → renderer-CFkg8h-K.js} +40 -31
- package/dist/cdn/chunks/renderer-CFkg8h-K.js.map +1 -0
- package/dist/cdn/chunks/{src-DsqSXXjk.js → src-DRpKu4Dy.js} +11 -11
- package/dist/cdn/chunks/{src-DsqSXXjk.js.map → src-DRpKu4Dy.js.map} +1 -1
- package/dist/cdn/chunks/styles-B7wryV0l.js +3943 -0
- package/dist/cdn/chunks/styles-B7wryV0l.js.map +1 -0
- package/dist/cdn/chunks/{tiptap-CwScfbsM.js → tiptap-DF9PEiqH.js} +5429 -5373
- package/dist/cdn/chunks/tiptap-DF9PEiqH.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +117 -115
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-BRzXxFHr.js → check-rl7ok6uJ.js} +1 -1
- package/dist/{chevron-down-DmEgzmYT.js → chevron-down-BKe__NOD.js} +1 -1
- package/dist/{circle-alert-BStvZr3O.js → circle-alert-C8xmpMsK.js} +1 -1
- package/dist/{clock-Blwp_1R6.js → clock-BW4JuDCN.js} +1 -1
- package/dist/{cloud-_olro76D.js → cloud-BQusL53H.js} +208 -208
- package/dist/createLucideIcon-Dx-EjR9r.js +43 -0
- package/dist/{cdn/chunks/de-C2wOXoxs.js → de-LsV0u1tP.js} +17 -3
- package/dist/{dist-BlG7k25W.js → dist-B5Sov3sS.js} +7 -7
- package/dist/dist-BEWiuOMi.js +251 -0
- package/dist/{dist-b7Ak-CuM.js → dist-BFmE-7hB.js} +2 -2
- package/dist/{dist-o73iaGqy.js → dist-BMoa33wT.js} +2 -2
- package/dist/{dist-BctFrpeA.js → dist-BibU4HNl.js} +74 -65
- package/dist/{dist-D6x1cQeh.js → dist-BsCGIDSt.js} +103 -102
- package/dist/dist-CNLKj9wa.js +5 -0
- package/dist/{dist-DULfKmTh.js → dist-CNXDNYQn.js} +729 -695
- package/dist/{dist-412xXefB.js → dist-COG3IdPK.js} +3 -3
- package/dist/{dist-Cz79qrLL.js → dist-CQZxDvFw.js} +3 -3
- package/dist/{dist-BwgjpLfr.js → dist-CRsjOQM-.js} +2 -2
- package/dist/dist-CTT6WYJ6.js +134 -0
- package/dist/dist-Cqa6aeAJ.js +5 -0
- package/dist/{dist-BCQZZUE9.js → dist-SXJJ2v41.js} +2 -2
- package/dist/{dist-DhKTdU52.js → dist-itdjZraK.js} +1445 -1420
- package/dist/{en-dR7zfNC3.js → en-Bb8X1bOs.js} +17 -1
- package/dist/extensions-DwaZAqm6.js +423 -0
- package/dist/{image-up-BFPbw_Zq.js → image-up-BwBCmQ4P.js} +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/{info-B_qLEBN2.js → info-TCn7uWR5.js} +1 -1
- package/dist/keys-Cv8-8GsD.js +10 -0
- package/dist/{liquid.browser-CVjP5Mex.js → liquid.browser-DZLtv26k.js} +692 -677
- package/dist/{list-checks-CGg7JxPm.js → list-checks-CSrOWNgq.js} +1 -1
- package/dist/{loader-circle-CDF8eR_Q.js → loader-circle-BLmicnPG.js} +1 -1
- package/dist/{message-circle-C3cHsCJl.js → message-circle-C9hHMQCI.js} +1 -1
- package/dist/{pt-BR-BZ86xqK6.js → pt-BR-BwJY_cvb.js} +17 -1
- package/dist/{refresh-cw-Butml7Q4.js → refresh-cw-D1JQ1LNa.js} +1 -1
- package/dist/runtime-dom.esm-bundler-BzuoCyNp.js +523 -0
- package/dist/scan-line-DgijVq9y.js +31 -0
- package/dist/{send-k7npFJNO.js → send-DjPdq69F.js} +1 -1
- package/dist/{shield-check-CV6GbmCu.js → shield-check-Bqluu8FS.js} +1 -1
- package/dist/{sparkles-C965Xop4.js → sparkles-M4azPVSP.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/styles-D7fQ7f_1.js +4164 -0
- package/dist/templatical-editor.js +155 -152
- package/dist/{text-align-start-Bxnps8fH.js → text-align-start-CMya5pCQ.js} +11 -11
- package/dist/{trash-2-DpGb7fIt.js → trash-2-C-81rkLS.js} +1 -1
- package/dist/{triangle-alert-BKYElAwz.js → triangle-alert-BuRWnynk.js} +1 -1
- package/dist/{upload-BF7sxd1_.js → upload-CWBIoLd4.js} +1 -1
- package/dist/{useAliveFlag-BinvbqQR.js → useAliveFlag-CECL_OUb.js} +1 -1
- package/dist/{useCloudI18n-L3H2XvdW.js → useCloudI18n-AKCy98qD.js} +2 -2
- package/dist/{useEditorCore-DKYZ7aKk.js → useEditorCore-vcWLdnjN.js} +1480 -1310
- package/dist/{useI18n-CTs_bP9d.js → useI18n-C-TDeJBt.js} +2 -2
- package/dist/{useMergeTag-e3RSY-s3.js → useMergeTag-DSrBY0-2.js} +6 -6
- package/dist/usePopoverRoot-DKUDnr55.js +8 -0
- package/dist/{vue.runtime.esm-bundler-B2k01iQh.js → vue.runtime.esm-bundler-l0XAqiyv.js} +639 -1151
- package/dist/{x-CGjkjdKK.js → x-CQSvXnGR.js} +1 -1
- package/package.json +27 -27
- package/dist/CloudEditor-DaEfipBn.js +0 -1230
- package/dist/CountdownBlock-DO9fziwf.js +0 -92
- package/dist/CountdownToolbar-BeII06yJ.js +0 -210
- package/dist/ModuleBrowserModal-DsZRr87F.js +0 -198
- package/dist/ParagraphEditor-CZ-cmhX3.js +0 -700
- package/dist/TitleEditor-DbNOcvhR.js +0 -177
- package/dist/cdn/chunks/CloudEditor-BZuzsQOZ.js.map +0 -1
- package/dist/cdn/chunks/ParagraphEditor-pGrfSccu.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-BvFbL16O.js.map +0 -1
- package/dist/cdn/chunks/blockTypeIcons-Kd1MT0u8.js +0 -22
- package/dist/cdn/chunks/de-C2wOXoxs.js.map +0 -1
- package/dist/cdn/chunks/draggable-Bci-fq8y.js.map +0 -1
- package/dist/cdn/chunks/en-dR7zfNC3.js.map +0 -1
- package/dist/cdn/chunks/extensions-CuUjSmuA.js +0 -605
- package/dist/cdn/chunks/extensions-CuUjSmuA.js.map +0 -1
- package/dist/cdn/chunks/features-DU6lA8l1.js.map +0 -1
- package/dist/cdn/chunks/icons-BjHUZZyJ.js.map +0 -1
- package/dist/cdn/chunks/liquid.browser-DKKBzRQu.js.map +0 -1
- package/dist/cdn/chunks/pt-BR-BZ86xqK6.js.map +0 -1
- package/dist/cdn/chunks/quality-DNnYAntR.js +0 -2176
- package/dist/cdn/chunks/renderer-CZKO-Tav.js.map +0 -1
- package/dist/cdn/chunks/styles-DiAdtiz9.js +0 -3428
- package/dist/cdn/chunks/styles-DiAdtiz9.js.map +0 -1
- package/dist/cdn/chunks/tiptap-CwScfbsM.js.map +0 -1
- package/dist/createLucideIcon-CmPAC-gt.js +0 -43
- package/dist/dist-BNEdeWub.js +0 -5
- package/dist/dist-Cgry6fNv.js +0 -382
- package/dist/dist-u0iIJH3V.js +0 -5
- package/dist/extensions-XPlNAKIL.js +0 -1720
- package/dist/keys-mFiJ5N0_.js +0 -10
- package/dist/scan-line-XYEqim_E.js +0 -25
- package/dist/styles-D0RCAWhB.js +0 -3647
- package/dist/usePopoverRoot-DVh7NY1q.js +0 -8
|
@@ -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,
|
|
2
|
-
import { Link as
|
|
3
|
-
import { Underline as
|
|
4
|
-
//#region ../../node_modules/.pnpm/@tiptap+core@3.27.
|
|
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, Y as p, Z as m, _n as h, at as g, bn as _, c as ee, en as te, gn as v, i as y, in as ne, k as re, mn as ie, ot as ae, qt as b, rt as oe, u as x, v as se, vn as S, wn as C, wt as ce, xn as w, y as le, yn as T } from "./dist-itdjZraK.js";
|
|
2
|
+
import { Link as ue } from "./dist-B5Sov3sS.js";
|
|
3
|
+
import { Underline as de } from "./dist-BMoa33wT.js";
|
|
4
|
+
//#region ../../node_modules/.pnpm/@tiptap+core@3.27.3_@tiptap+pm@3.27.3/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js
|
|
5
|
+
var fe = (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 de = (e, t) => {
|
|
|
14
14
|
];
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.27.
|
|
18
|
-
function
|
|
17
|
+
//#region ../../node_modules/.pnpm/@tiptap+extension-blockquote@3.27.3_@tiptap+core@3.27.3_@tiptap+pm@3.27.3_/node_modules/@tiptap/extension-blockquote/dist/index.js
|
|
18
|
+
function pe(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);
|
|
@@ -25,17 +25,18 @@ function fe(e, t, n) {
|
|
|
25
25
|
}
|
|
26
26
|
if (!i.sameMarkup(a)) return n;
|
|
27
27
|
if (i.isText && i.text != a.text) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let e = i.text, t = a.text, r = 0;
|
|
29
|
+
for (; e[r] == t[r]; r++) n++;
|
|
30
|
+
return r && r < e.length && r < t.length && ge(e.charCodeAt(r - 1)) && he(e.charCodeAt(r)) && n--, n;
|
|
30
31
|
}
|
|
31
32
|
if (i.content.size || a.content.size) {
|
|
32
|
-
let e =
|
|
33
|
+
let e = pe(i.content, a.content, n + 1);
|
|
33
34
|
if (e != null) return e;
|
|
34
35
|
}
|
|
35
36
|
n += i.nodeSize;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function me(e, t, n, r) {
|
|
39
40
|
for (let i = e.childCount, a = t.childCount;;) {
|
|
40
41
|
if (i == 0 || a == 0) return i == a ? null : {
|
|
41
42
|
a: n,
|
|
@@ -51,20 +52,26 @@ function pe(e, t, n, r) {
|
|
|
51
52
|
b: r
|
|
52
53
|
};
|
|
53
54
|
if (o.isText && o.text != s.text) {
|
|
54
|
-
let e =
|
|
55
|
-
for (;
|
|
56
|
-
return {
|
|
55
|
+
let e = o.text, t = s.text, i = e.length, a = t.length;
|
|
56
|
+
for (; i > 0 && a > 0 && e[i - 1] == t[a - 1];) i--, a--, n--, r--;
|
|
57
|
+
return i && a && i < e.length && ge(e.charCodeAt(i - 1)) && he(e.charCodeAt(i)) && (n++, r++), {
|
|
57
58
|
a: n,
|
|
58
59
|
b: r
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
if (o.content.size || s.content.size) {
|
|
62
|
-
let e =
|
|
63
|
+
let e = me(o.content, s.content, n - 1, r - 1);
|
|
63
64
|
if (e) return e;
|
|
64
65
|
}
|
|
65
66
|
n -= c, r -= c;
|
|
66
67
|
}
|
|
67
68
|
}
|
|
69
|
+
function he(e) {
|
|
70
|
+
return e >= 56320 && e < 57344;
|
|
71
|
+
}
|
|
72
|
+
function ge(e) {
|
|
73
|
+
return e >= 55296 && e < 56320;
|
|
74
|
+
}
|
|
68
75
|
var E = class e {
|
|
69
76
|
constructor(e, t) {
|
|
70
77
|
if (this.content = e, this.size = t || 0, t == null) for (let t = 0; t < e.length; t++) this.size += e[t].nodeSize;
|
|
@@ -149,18 +156,18 @@ var E = class e {
|
|
|
149
156
|
}
|
|
150
157
|
}
|
|
151
158
|
findDiffStart(e, t = 0) {
|
|
152
|
-
return
|
|
159
|
+
return pe(this, e, t);
|
|
153
160
|
}
|
|
154
161
|
findDiffEnd(e, t = this.size, n = e.size) {
|
|
155
|
-
return
|
|
162
|
+
return me(this, e, t, n);
|
|
156
163
|
}
|
|
157
164
|
findIndex(e) {
|
|
158
|
-
if (e == 0) return
|
|
159
|
-
if (e == this.size) return
|
|
165
|
+
if (e == 0) return ve(0, e);
|
|
166
|
+
if (e == this.size) return ve(this.content.length, e);
|
|
160
167
|
if (e > this.size || e < 0) throw RangeError(`Position ${e} outside of fragment (${this})`);
|
|
161
168
|
for (let t = 0, n = 0;; t++) {
|
|
162
169
|
let r = this.child(t), i = n + r.nodeSize;
|
|
163
|
-
if (i >= e) return i == e ?
|
|
170
|
+
if (i >= e) return i == e ? ve(t + 1, i) : ve(t, n);
|
|
164
171
|
n = i;
|
|
165
172
|
}
|
|
166
173
|
}
|
|
@@ -196,28 +203,28 @@ var E = class e {
|
|
|
196
203
|
}
|
|
197
204
|
};
|
|
198
205
|
E.empty = new E([], 0);
|
|
199
|
-
var
|
|
206
|
+
var _e = {
|
|
200
207
|
index: 0,
|
|
201
208
|
offset: 0
|
|
202
209
|
};
|
|
203
|
-
function
|
|
204
|
-
return
|
|
210
|
+
function ve(e, t) {
|
|
211
|
+
return _e.index = e, _e.offset = t, _e;
|
|
205
212
|
}
|
|
206
|
-
function
|
|
213
|
+
function ye(e, t) {
|
|
207
214
|
if (e === t) return !0;
|
|
208
215
|
if (!(e && typeof e == "object") || !(t && typeof t == "object")) return !1;
|
|
209
216
|
let n = Array.isArray(e);
|
|
210
217
|
if (Array.isArray(t) != n) return !1;
|
|
211
218
|
if (n) {
|
|
212
219
|
if (e.length != t.length) return !1;
|
|
213
|
-
for (let n = 0; n < e.length; n++) if (!
|
|
220
|
+
for (let n = 0; n < e.length; n++) if (!ye(e[n], t[n])) return !1;
|
|
214
221
|
} else {
|
|
215
|
-
for (let n in e) if (!(n in t) || !
|
|
222
|
+
for (let n in e) if (!(n in t) || !ye(e[n], t[n])) return !1;
|
|
216
223
|
for (let n in t) if (!(n in e)) return !1;
|
|
217
224
|
}
|
|
218
225
|
return !0;
|
|
219
226
|
}
|
|
220
|
-
var
|
|
227
|
+
var D = class e {
|
|
221
228
|
constructor(e, t) {
|
|
222
229
|
this.type = e, this.attrs = t;
|
|
223
230
|
}
|
|
@@ -241,7 +248,7 @@ var O = class e {
|
|
|
241
248
|
return !1;
|
|
242
249
|
}
|
|
243
250
|
eq(e) {
|
|
244
|
-
return this == e || this.type == e.type &&
|
|
251
|
+
return this == e || this.type == e.type && ye(this.attrs, e.attrs);
|
|
245
252
|
}
|
|
246
253
|
toJSON() {
|
|
247
254
|
let e = { type: this.type.name };
|
|
@@ -271,8 +278,8 @@ var O = class e {
|
|
|
271
278
|
return n.sort((e, t) => e.type.rank - t.type.rank), n;
|
|
272
279
|
}
|
|
273
280
|
};
|
|
274
|
-
|
|
275
|
-
var
|
|
281
|
+
D.none = [];
|
|
282
|
+
var O = class extends Error {}, k = class e {
|
|
276
283
|
constructor(e, t, n) {
|
|
277
284
|
this.content = e, this.openStart = t, this.openEnd = n;
|
|
278
285
|
}
|
|
@@ -280,11 +287,11 @@ var k = class extends Error {}, A = class e {
|
|
|
280
287
|
return this.content.size - this.openStart - this.openEnd;
|
|
281
288
|
}
|
|
282
289
|
insertAt(t, n) {
|
|
283
|
-
let r =
|
|
290
|
+
let r = xe(this.content, t + this.openStart, n, this.openStart + 1, this.openEnd + 1);
|
|
284
291
|
return r && new e(r, this.openStart, this.openEnd);
|
|
285
292
|
}
|
|
286
293
|
removeBetween(t, n) {
|
|
287
|
-
return new e(
|
|
294
|
+
return new e(be(this.content, t + this.openStart, n + this.openStart), this.openStart, this.openEnd);
|
|
288
295
|
}
|
|
289
296
|
eq(e) {
|
|
290
297
|
return this.content.eq(e.content) && this.openStart == e.openStart && this.openEnd == e.openEnd;
|
|
@@ -310,70 +317,71 @@ var k = class extends Error {}, A = class e {
|
|
|
310
317
|
return new e(t, r, i);
|
|
311
318
|
}
|
|
312
319
|
};
|
|
313
|
-
|
|
314
|
-
function
|
|
320
|
+
k.empty = new k(E.empty, 0, 0);
|
|
321
|
+
function be(e, t, n) {
|
|
315
322
|
let { index: r, offset: i } = e.findIndex(t), a = e.maybeChild(r), { index: o, offset: s } = e.findIndex(n);
|
|
316
323
|
if (i == t || a.isText) {
|
|
317
324
|
if (s != n && !e.child(o).isText) throw RangeError("Removing non-flat range");
|
|
318
325
|
return e.cut(0, t).append(e.cut(n));
|
|
319
326
|
}
|
|
320
327
|
if (r != o) throw RangeError("Removing non-flat range");
|
|
321
|
-
return e.replaceChild(r, a.copy(
|
|
328
|
+
return e.replaceChild(r, a.copy(be(a.content, t - i - 1, n - i - 1)));
|
|
322
329
|
}
|
|
323
|
-
function
|
|
330
|
+
function xe(e, t, n, r, i, a) {
|
|
324
331
|
let { index: o, offset: s } = e.findIndex(t), c = e.maybeChild(o);
|
|
325
332
|
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 =
|
|
333
|
+
let l = xe(c.content, t - s - 1, n, o == 0 ? r - 1 : 0, o == e.childCount - 1 ? i - 1 : 0, c);
|
|
327
334
|
return l && e.replaceChild(o, c.copy(l));
|
|
328
335
|
}
|
|
329
|
-
function
|
|
330
|
-
if (n.openStart > e.depth) throw new
|
|
331
|
-
if (e.depth - n.openStart != t.depth - n.openEnd) throw new
|
|
332
|
-
return
|
|
336
|
+
function Se(e, t, n) {
|
|
337
|
+
if (n.openStart > e.depth) throw new O("Inserted content deeper than insertion position");
|
|
338
|
+
if (e.depth - n.openStart != t.depth - n.openEnd) throw new O("Inconsistent open depths");
|
|
339
|
+
return Ce(e, t, n, 0);
|
|
333
340
|
}
|
|
334
|
-
function
|
|
341
|
+
function Ce(e, t, n, r) {
|
|
335
342
|
let i = e.index(r), a = e.node(r);
|
|
336
343
|
if (i == t.index(r) && r < e.depth - n.openStart) {
|
|
337
|
-
let o =
|
|
344
|
+
let o = Ce(e, t, n, r + 1);
|
|
338
345
|
return a.copy(a.content.replaceChild(i, o));
|
|
339
|
-
} else if (!n.content.size) return
|
|
346
|
+
} else if (!n.content.size) return M(a, N(e, t, r));
|
|
340
347
|
else if (!n.openStart && !n.openEnd && e.depth == r && t.depth == r) {
|
|
341
348
|
let r = e.parent, i = r.content;
|
|
342
|
-
return
|
|
349
|
+
return M(r, i.cut(0, e.parentOffset).append(n.content).append(i.cut(t.parentOffset)));
|
|
343
350
|
} else {
|
|
344
|
-
let { start: i, end: o } =
|
|
345
|
-
return
|
|
351
|
+
let { start: i, end: o } = De(n, e);
|
|
352
|
+
return M(a, Ee(e, i, o, t, r));
|
|
346
353
|
}
|
|
347
354
|
}
|
|
348
|
-
function
|
|
349
|
-
if (!t.type.compatibleContent(e.type)) throw new
|
|
355
|
+
function we(e, t) {
|
|
356
|
+
if (!t.type.compatibleContent(e.type)) throw new O("Cannot join " + t.type.name + " onto " + e.type.name);
|
|
350
357
|
}
|
|
351
|
-
function
|
|
358
|
+
function Te(e, t, n) {
|
|
352
359
|
let r = e.node(n);
|
|
353
|
-
return
|
|
360
|
+
return we(r, t.node(n)), r;
|
|
354
361
|
}
|
|
355
|
-
function
|
|
362
|
+
function A(e, t) {
|
|
356
363
|
let n = t.length - 1;
|
|
357
364
|
n >= 0 && e.isText && e.sameMarkup(t[n]) ? t[n] = e.withText(t[n].text + e.text) : t.push(e);
|
|
358
365
|
}
|
|
359
|
-
function
|
|
366
|
+
function j(e, t, n, r) {
|
|
360
367
|
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 &&
|
|
368
|
+
e && (a = e.index(n), e.depth > n ? a++ : e.textOffset && (A(e.nodeAfter, r), a++));
|
|
369
|
+
for (let e = a; e < o; e++) A(i.child(e), r);
|
|
370
|
+
t && t.depth == n && t.textOffset && A(t.nodeBefore, r);
|
|
364
371
|
}
|
|
365
|
-
function
|
|
366
|
-
|
|
372
|
+
function M(e, t) {
|
|
373
|
+
if (!e.type.validContent(t)) throw new O("Invalid content for node " + e.type.name);
|
|
374
|
+
return e.copy(t);
|
|
367
375
|
}
|
|
368
|
-
function
|
|
369
|
-
let a = e.depth > i &&
|
|
370
|
-
return
|
|
376
|
+
function Ee(e, t, n, r, i) {
|
|
377
|
+
let a = e.depth > i && Te(e, t, i + 1), o = r.depth > i && Te(n, r, i + 1), s = [];
|
|
378
|
+
return j(null, e, i, s), a && o && t.index(i) == n.index(i) ? (we(a, o), A(M(a, Ee(e, t, n, r, i + 1)), s)) : (a && A(M(a, N(e, t, i + 1)), s), j(t, n, i, s), o && A(M(o, N(n, r, i + 1)), s)), j(r, null, i, s), new E(s);
|
|
371
379
|
}
|
|
372
|
-
function
|
|
380
|
+
function N(e, t, n) {
|
|
373
381
|
let r = [];
|
|
374
|
-
return
|
|
382
|
+
return j(null, e, n, r), e.depth > n && A(M(Te(e, t, n + 1), N(e, t, n + 1)), r), j(t, null, n, r), new E(r);
|
|
375
383
|
}
|
|
376
|
-
function
|
|
384
|
+
function De(e, t) {
|
|
377
385
|
let n = t.depth - e.openStart, r = t.node(n).copy(e.content);
|
|
378
386
|
for (let e = n - 1; e >= 0; e--) r = t.node(e).copy(E.from(r));
|
|
379
387
|
return {
|
|
@@ -381,7 +389,7 @@ function Ce(e, t) {
|
|
|
381
389
|
end: r.resolveNoCache(r.content.size - e.openEnd - n)
|
|
382
390
|
};
|
|
383
391
|
}
|
|
384
|
-
var
|
|
392
|
+
var Oe = class e {
|
|
385
393
|
constructor(e, t, n) {
|
|
386
394
|
this.pos = e, this.path = t, this.parentOffset = n, this.depth = t.length / 3 - 1;
|
|
387
395
|
}
|
|
@@ -438,7 +446,7 @@ var we = class e {
|
|
|
438
446
|
}
|
|
439
447
|
marks() {
|
|
440
448
|
let e = this.parent, t = this.index();
|
|
441
|
-
if (e.content.size == 0) return
|
|
449
|
+
if (e.content.size == 0) return D.none;
|
|
442
450
|
if (this.textOffset) return e.child(t).marks;
|
|
443
451
|
let n = e.maybeChild(t - 1), r = e.maybeChild(t);
|
|
444
452
|
if (!n) {
|
|
@@ -462,7 +470,7 @@ var we = class e {
|
|
|
462
470
|
}
|
|
463
471
|
blockRange(e = this, t) {
|
|
464
472
|
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
|
|
473
|
+
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 Me(this, e, n);
|
|
466
474
|
return null;
|
|
467
475
|
}
|
|
468
476
|
sameParent(e) {
|
|
@@ -490,20 +498,20 @@ var we = class e {
|
|
|
490
498
|
return new e(n, r, a);
|
|
491
499
|
}
|
|
492
500
|
static resolveCached(t, n) {
|
|
493
|
-
let r =
|
|
501
|
+
let r = je.get(t);
|
|
494
502
|
if (r) for (let e = 0; e < r.elts.length; e++) {
|
|
495
503
|
let t = r.elts[e];
|
|
496
504
|
if (t.pos == n) return t;
|
|
497
505
|
}
|
|
498
|
-
else
|
|
506
|
+
else je.set(t, r = new ke());
|
|
499
507
|
let i = r.elts[r.i] = e.resolve(t, n);
|
|
500
|
-
return r.i = (r.i + 1) %
|
|
508
|
+
return r.i = (r.i + 1) % Ae, i;
|
|
501
509
|
}
|
|
502
|
-
},
|
|
510
|
+
}, ke = class {
|
|
503
511
|
constructor() {
|
|
504
512
|
this.elts = [], this.i = 0;
|
|
505
513
|
}
|
|
506
|
-
},
|
|
514
|
+
}, Ae = 12, je = /* @__PURE__ */ new WeakMap(), Me = class {
|
|
507
515
|
constructor(e, t, n) {
|
|
508
516
|
this.$from = e, this.$to = t, this.depth = n;
|
|
509
517
|
}
|
|
@@ -522,8 +530,8 @@ var we = class e {
|
|
|
522
530
|
get endIndex() {
|
|
523
531
|
return this.$to.indexAfter(this.depth);
|
|
524
532
|
}
|
|
525
|
-
},
|
|
526
|
-
constructor(e, t, n, r =
|
|
533
|
+
}, Ne = /* @__PURE__ */ Object.create(null), Pe = class e {
|
|
534
|
+
constructor(e, t, n, r = D.none) {
|
|
527
535
|
this.type = e, this.attrs = t, this.marks = r, this.content = n || E.empty;
|
|
528
536
|
}
|
|
529
537
|
get children() {
|
|
@@ -569,7 +577,7 @@ var we = class e {
|
|
|
569
577
|
return this.hasMarkup(e.type, e.attrs, e.marks);
|
|
570
578
|
}
|
|
571
579
|
hasMarkup(e, t, n) {
|
|
572
|
-
return this.type == e &&
|
|
580
|
+
return this.type == e && ye(this.attrs, t || e.defaultAttrs || Ne) && D.sameSet(this.marks, n || D.none);
|
|
573
581
|
}
|
|
574
582
|
copy(t = null) {
|
|
575
583
|
return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
|
|
@@ -581,12 +589,12 @@ var we = class e {
|
|
|
581
589
|
return e == 0 && t == this.content.size ? this : this.copy(this.content.cut(e, t));
|
|
582
590
|
}
|
|
583
591
|
slice(e, t = this.content.size, n = !1) {
|
|
584
|
-
if (e == t) return
|
|
592
|
+
if (e == t) return k.empty;
|
|
585
593
|
let r = this.resolve(e), i = this.resolve(t), a = n ? 0 : r.sharedDepth(t), o = r.start(a);
|
|
586
|
-
return new
|
|
594
|
+
return new k(r.node(a).content.cut(r.pos - o, i.pos - o), r.depth - a, i.depth - a);
|
|
587
595
|
}
|
|
588
596
|
replace(e, t, n) {
|
|
589
|
-
return
|
|
597
|
+
return Se(this.resolve(e), this.resolve(t), n);
|
|
590
598
|
}
|
|
591
599
|
nodeAt(e) {
|
|
592
600
|
for (let t = this;;) {
|
|
@@ -624,10 +632,10 @@ var we = class e {
|
|
|
624
632
|
};
|
|
625
633
|
}
|
|
626
634
|
resolve(e) {
|
|
627
|
-
return
|
|
635
|
+
return Oe.resolveCached(this, e);
|
|
628
636
|
}
|
|
629
637
|
resolveNoCache(e) {
|
|
630
|
-
return
|
|
638
|
+
return Oe.resolve(this, e);
|
|
631
639
|
}
|
|
632
640
|
rangeHasMark(e, t, n) {
|
|
633
641
|
let r = !1;
|
|
@@ -657,7 +665,7 @@ var we = class e {
|
|
|
657
665
|
toString() {
|
|
658
666
|
if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
|
|
659
667
|
let e = this.type.name;
|
|
660
|
-
return this.content.size && (e += "(" + this.content.toStringInner() + ")"),
|
|
668
|
+
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), Fe(this.marks, e);
|
|
661
669
|
}
|
|
662
670
|
contentMatchAt(e) {
|
|
663
671
|
let t = this.type.contentMatch.matchFragment(this.content, 0, e);
|
|
@@ -680,12 +688,12 @@ var we = class e {
|
|
|
680
688
|
}
|
|
681
689
|
check() {
|
|
682
690
|
this.type.checkContent(this.content), this.type.checkAttrs(this.attrs);
|
|
683
|
-
let e =
|
|
691
|
+
let e = D.none;
|
|
684
692
|
for (let t = 0; t < this.marks.length; t++) {
|
|
685
693
|
let n = this.marks[t];
|
|
686
694
|
n.type.checkAttrs(n.attrs), e = n.addToSet(e);
|
|
687
695
|
}
|
|
688
|
-
if (!
|
|
696
|
+
if (!D.sameSet(e, this.marks)) throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e) => e.type.name)}`);
|
|
689
697
|
this.content.forEach((e) => e.check());
|
|
690
698
|
}
|
|
691
699
|
toJSON() {
|
|
@@ -711,22 +719,22 @@ var we = class e {
|
|
|
711
719
|
return i.type.checkAttrs(i.attrs), i;
|
|
712
720
|
}
|
|
713
721
|
};
|
|
714
|
-
|
|
715
|
-
function
|
|
722
|
+
Pe.prototype.text = void 0;
|
|
723
|
+
function Fe(e, t) {
|
|
716
724
|
for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
|
|
717
725
|
return t;
|
|
718
726
|
}
|
|
719
|
-
var
|
|
727
|
+
var Ie = class e {
|
|
720
728
|
constructor(e) {
|
|
721
729
|
this.validEnd = e, this.next = [], this.wrapCache = [];
|
|
722
730
|
}
|
|
723
731
|
static parse(t, n) {
|
|
724
|
-
let r = new
|
|
732
|
+
let r = new Le(t, n);
|
|
725
733
|
if (r.next == null) return e.empty;
|
|
726
|
-
let i =
|
|
734
|
+
let i = Re(r);
|
|
727
735
|
r.next && r.err("Unexpected trailing text");
|
|
728
|
-
let a =
|
|
729
|
-
return
|
|
736
|
+
let a = Je(Ge(i));
|
|
737
|
+
return Ye(a, r), a;
|
|
730
738
|
}
|
|
731
739
|
matchType(e) {
|
|
732
740
|
for (let t = 0; t < this.next.length; t++) if (this.next[t].type == e) return this.next[t].next;
|
|
@@ -817,8 +825,8 @@ var Me = class e {
|
|
|
817
825
|
}).join("\n");
|
|
818
826
|
}
|
|
819
827
|
};
|
|
820
|
-
|
|
821
|
-
var
|
|
828
|
+
Ie.empty = new Ie(!0);
|
|
829
|
+
var Le = class {
|
|
822
830
|
constructor(e, t) {
|
|
823
831
|
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
832
|
}
|
|
@@ -832,28 +840,28 @@ var Ne = class {
|
|
|
832
840
|
throw SyntaxError(e + " (in content expression '" + this.string + "')");
|
|
833
841
|
}
|
|
834
842
|
};
|
|
835
|
-
function
|
|
843
|
+
function Re(e) {
|
|
836
844
|
let t = [];
|
|
837
845
|
do
|
|
838
|
-
t.push(
|
|
846
|
+
t.push(ze(e));
|
|
839
847
|
while (e.eat("|"));
|
|
840
848
|
return t.length == 1 ? t[0] : {
|
|
841
849
|
type: "choice",
|
|
842
850
|
exprs: t
|
|
843
851
|
};
|
|
844
852
|
}
|
|
845
|
-
function
|
|
853
|
+
function ze(e) {
|
|
846
854
|
let t = [];
|
|
847
855
|
do
|
|
848
|
-
t.push(
|
|
856
|
+
t.push(Be(e));
|
|
849
857
|
while (e.next && e.next != ")" && e.next != "|");
|
|
850
858
|
return t.length == 1 ? t[0] : {
|
|
851
859
|
type: "seq",
|
|
852
860
|
exprs: t
|
|
853
861
|
};
|
|
854
862
|
}
|
|
855
|
-
function
|
|
856
|
-
let t =
|
|
863
|
+
function Be(e) {
|
|
864
|
+
let t = We(e);
|
|
857
865
|
for (;;) if (e.eat("+")) t = {
|
|
858
866
|
type: "plus",
|
|
859
867
|
expr: t
|
|
@@ -866,25 +874,25 @@ function Ie(e) {
|
|
|
866
874
|
type: "opt",
|
|
867
875
|
expr: t
|
|
868
876
|
};
|
|
869
|
-
else if (e.eat("{")) t =
|
|
877
|
+
else if (e.eat("{")) t = He(e, t);
|
|
870
878
|
else break;
|
|
871
879
|
return t;
|
|
872
880
|
}
|
|
873
|
-
function
|
|
881
|
+
function Ve(e) {
|
|
874
882
|
/\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
|
|
875
883
|
let t = Number(e.next);
|
|
876
884
|
return e.pos++, t;
|
|
877
885
|
}
|
|
878
|
-
function
|
|
879
|
-
let n =
|
|
880
|
-
return e.eat(",") && (r = e.next == "}" ? -1 :
|
|
886
|
+
function He(e, t) {
|
|
887
|
+
let n = Ve(e), r = n;
|
|
888
|
+
return e.eat(",") && (r = e.next == "}" ? -1 : Ve(e)), e.eat("}") || e.err("Unclosed braced range"), {
|
|
881
889
|
type: "range",
|
|
882
890
|
min: n,
|
|
883
891
|
max: r,
|
|
884
892
|
expr: t
|
|
885
893
|
};
|
|
886
894
|
}
|
|
887
|
-
function
|
|
895
|
+
function Ue(e, t) {
|
|
888
896
|
let n = e.nodeTypes, r = n[t];
|
|
889
897
|
if (r) return [r];
|
|
890
898
|
let i = [];
|
|
@@ -894,13 +902,13 @@ function ze(e, t) {
|
|
|
894
902
|
}
|
|
895
903
|
return i.length == 0 && e.err("No node type or group '" + t + "' found"), i;
|
|
896
904
|
}
|
|
897
|
-
function
|
|
905
|
+
function We(e) {
|
|
898
906
|
if (e.eat("(")) {
|
|
899
|
-
let t =
|
|
907
|
+
let t = Re(e);
|
|
900
908
|
return e.eat(")") || e.err("Missing closing paren"), t;
|
|
901
909
|
} else if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
|
|
902
910
|
else {
|
|
903
|
-
let t =
|
|
911
|
+
let t = Ue(e, e.next).map((t) => (e.inline == null ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
|
|
904
912
|
type: "name",
|
|
905
913
|
value: t
|
|
906
914
|
}));
|
|
@@ -910,7 +918,7 @@ function Be(e) {
|
|
|
910
918
|
};
|
|
911
919
|
}
|
|
912
920
|
}
|
|
913
|
-
function
|
|
921
|
+
function Ge(e) {
|
|
914
922
|
let t = [[]];
|
|
915
923
|
return i(a(e, 0), n()), t;
|
|
916
924
|
function n() {
|
|
@@ -956,12 +964,12 @@ function Ve(e) {
|
|
|
956
964
|
else throw Error("Unknown expr type");
|
|
957
965
|
}
|
|
958
966
|
}
|
|
959
|
-
function
|
|
967
|
+
function Ke(e, t) {
|
|
960
968
|
return t - e;
|
|
961
969
|
}
|
|
962
|
-
function
|
|
970
|
+
function qe(e, t) {
|
|
963
971
|
let n = [];
|
|
964
|
-
return r(t), n.sort(
|
|
972
|
+
return r(t), n.sort(Ke);
|
|
965
973
|
function r(t) {
|
|
966
974
|
let i = e[t];
|
|
967
975
|
if (i.length == 1 && !i[0].term) return r(i[0].to);
|
|
@@ -972,9 +980,9 @@ function Ue(e, t) {
|
|
|
972
980
|
}
|
|
973
981
|
}
|
|
974
982
|
}
|
|
975
|
-
function
|
|
983
|
+
function Je(e) {
|
|
976
984
|
let t = /* @__PURE__ */ Object.create(null);
|
|
977
|
-
return n(
|
|
985
|
+
return n(qe(e, 0));
|
|
978
986
|
function n(r) {
|
|
979
987
|
let i = [];
|
|
980
988
|
r.forEach((t) => {
|
|
@@ -982,14 +990,14 @@ function We(e) {
|
|
|
982
990
|
if (!t) return;
|
|
983
991
|
let r;
|
|
984
992
|
for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
|
|
985
|
-
|
|
993
|
+
qe(e, n).forEach((e) => {
|
|
986
994
|
r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
|
|
987
995
|
});
|
|
988
996
|
});
|
|
989
997
|
});
|
|
990
|
-
let a = t[r.join(",")] = new
|
|
998
|
+
let a = t[r.join(",")] = new Ie(r.indexOf(e.length - 1) > -1);
|
|
991
999
|
for (let e = 0; e < i.length; e++) {
|
|
992
|
-
let r = i[e][1].sort(
|
|
1000
|
+
let r = i[e][1].sort(Ke);
|
|
993
1001
|
a.next.push({
|
|
994
1002
|
type: i[e][0],
|
|
995
1003
|
next: t[r.join(",")] || n(r)
|
|
@@ -998,7 +1006,7 @@ function We(e) {
|
|
|
998
1006
|
return a;
|
|
999
1007
|
}
|
|
1000
1008
|
}
|
|
1001
|
-
function
|
|
1009
|
+
function Ye(e, t) {
|
|
1002
1010
|
for (let n = 0, r = [e]; n < r.length; n++) {
|
|
1003
1011
|
let e = r[n], i = !e.validEnd, a = [];
|
|
1004
1012
|
for (let t = 0; t < e.next.length; t++) {
|
|
@@ -1008,40 +1016,40 @@ function Ge(e, t) {
|
|
|
1008
1016
|
i && t.err("Only non-generatable nodes (" + a.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
1009
1017
|
}
|
|
1010
1018
|
}
|
|
1011
|
-
var
|
|
1012
|
-
function
|
|
1013
|
-
return e + t *
|
|
1019
|
+
var Xe = 65535, Ze = 2 ** 16;
|
|
1020
|
+
function Qe(e, t) {
|
|
1021
|
+
return e + t * Ze;
|
|
1014
1022
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return e &
|
|
1023
|
+
function $e(e) {
|
|
1024
|
+
return e & Xe;
|
|
1017
1025
|
}
|
|
1018
|
-
function
|
|
1019
|
-
return (e - (e &
|
|
1026
|
+
function et(e) {
|
|
1027
|
+
return (e - (e & Xe)) / Ze;
|
|
1020
1028
|
}
|
|
1021
|
-
var
|
|
1029
|
+
var tt = 1, nt = 2, rt = 4, it = 8, at = class {
|
|
1022
1030
|
constructor(e, t, n) {
|
|
1023
1031
|
this.pos = e, this.delInfo = t, this.recover = n;
|
|
1024
1032
|
}
|
|
1025
1033
|
get deleted() {
|
|
1026
|
-
return (this.delInfo &
|
|
1034
|
+
return (this.delInfo & it) > 0;
|
|
1027
1035
|
}
|
|
1028
1036
|
get deletedBefore() {
|
|
1029
|
-
return (this.delInfo & (
|
|
1037
|
+
return (this.delInfo & (tt | rt)) > 0;
|
|
1030
1038
|
}
|
|
1031
1039
|
get deletedAfter() {
|
|
1032
|
-
return (this.delInfo & (
|
|
1040
|
+
return (this.delInfo & (nt | rt)) > 0;
|
|
1033
1041
|
}
|
|
1034
1042
|
get deletedAcross() {
|
|
1035
|
-
return (this.delInfo &
|
|
1043
|
+
return (this.delInfo & rt) > 0;
|
|
1036
1044
|
}
|
|
1037
|
-
},
|
|
1045
|
+
}, P = class e {
|
|
1038
1046
|
constructor(t, n = !1) {
|
|
1039
1047
|
if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
|
|
1040
1048
|
}
|
|
1041
1049
|
recover(e) {
|
|
1042
|
-
let t = 0, n =
|
|
1050
|
+
let t = 0, n = $e(e);
|
|
1043
1051
|
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 +
|
|
1052
|
+
return this.ranges[n * 3] + t + et(e);
|
|
1045
1053
|
}
|
|
1046
1054
|
mapResult(e, t = 1) {
|
|
1047
1055
|
return this._map(e, t, !1);
|
|
@@ -1058,15 +1066,15 @@ var Ze = 1, Qe = 2, F = 4, $e = 8, et = class {
|
|
|
1058
1066
|
if (e <= u) {
|
|
1059
1067
|
let i = c ? e == s ? -1 : e == u ? 1 : t : t, a = s + r + (i < 0 ? 0 : l);
|
|
1060
1068
|
if (n) return a;
|
|
1061
|
-
let d = e == (t < 0 ? s : u) ? null :
|
|
1062
|
-
return (t < 0 ? e != s : e != u) && (f |=
|
|
1069
|
+
let d = e == (t < 0 ? s : u) ? null : Qe(o / 3, e - s), f = e == s ? nt : e == u ? tt : rt;
|
|
1070
|
+
return (t < 0 ? e != s : e != u) && (f |= it), new at(a, f, d);
|
|
1063
1071
|
}
|
|
1064
1072
|
r += l - c;
|
|
1065
1073
|
}
|
|
1066
|
-
return n ? e + r : new
|
|
1074
|
+
return n ? e + r : new at(e + r, 0, null);
|
|
1067
1075
|
}
|
|
1068
1076
|
touches(e, t) {
|
|
1069
|
-
let n = 0, r =
|
|
1077
|
+
let n = 0, r = $e(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
|
|
1070
1078
|
for (let t = 0; t < this.ranges.length; t += 3) {
|
|
1071
1079
|
let o = this.ranges[t] - (this.inverted ? n : 0);
|
|
1072
1080
|
if (o > e) break;
|
|
@@ -1101,25 +1109,25 @@ var Ze = 1, Qe = 2, F = 4, $e = 8, et = class {
|
|
|
1101
1109
|
]);
|
|
1102
1110
|
}
|
|
1103
1111
|
};
|
|
1104
|
-
|
|
1105
|
-
var
|
|
1112
|
+
P.empty = new P([]);
|
|
1113
|
+
var ot = /* @__PURE__ */ Object.create(null), F = class {
|
|
1106
1114
|
getMap() {
|
|
1107
|
-
return
|
|
1115
|
+
return P.empty;
|
|
1108
1116
|
}
|
|
1109
1117
|
merge(e) {
|
|
1110
1118
|
return null;
|
|
1111
1119
|
}
|
|
1112
1120
|
static fromJSON(e, t) {
|
|
1113
1121
|
if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
|
|
1114
|
-
let n =
|
|
1122
|
+
let n = ot[t.stepType];
|
|
1115
1123
|
if (!n) throw RangeError(`No step type ${t.stepType} defined`);
|
|
1116
1124
|
return n.fromJSON(e, t);
|
|
1117
1125
|
}
|
|
1118
1126
|
static jsonID(e, t) {
|
|
1119
|
-
if (e in
|
|
1120
|
-
return
|
|
1127
|
+
if (e in ot) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
1128
|
+
return ot[e] = t, t.prototype.jsonID = e, t;
|
|
1121
1129
|
}
|
|
1122
|
-
},
|
|
1130
|
+
}, I = class e {
|
|
1123
1131
|
constructor(e, t) {
|
|
1124
1132
|
this.doc = e, this.failed = t;
|
|
1125
1133
|
}
|
|
@@ -1133,29 +1141,29 @@ var tt = /* @__PURE__ */ Object.create(null), L = class {
|
|
|
1133
1141
|
try {
|
|
1134
1142
|
return e.ok(t.replace(n, r, i));
|
|
1135
1143
|
} catch (t) {
|
|
1136
|
-
if (t instanceof
|
|
1144
|
+
if (t instanceof O) return e.fail(t.message);
|
|
1137
1145
|
throw t;
|
|
1138
1146
|
}
|
|
1139
1147
|
}
|
|
1140
1148
|
};
|
|
1141
|
-
function
|
|
1149
|
+
function st(e, t, n) {
|
|
1142
1150
|
let r = [];
|
|
1143
1151
|
for (let i = 0; i < e.childCount; i++) {
|
|
1144
1152
|
let a = e.child(i);
|
|
1145
|
-
a.content.size && (a = a.copy(
|
|
1153
|
+
a.content.size && (a = a.copy(st(a.content, t, a))), a.isInline && (a = t(a, n, i)), r.push(a);
|
|
1146
1154
|
}
|
|
1147
1155
|
return E.fromArray(r);
|
|
1148
1156
|
}
|
|
1149
|
-
var
|
|
1157
|
+
var ct = class e extends F {
|
|
1150
1158
|
constructor(e, t, n) {
|
|
1151
1159
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1152
1160
|
}
|
|
1153
1161
|
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
|
|
1162
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new k(st(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);
|
|
1163
|
+
return I.fromReplace(e, this.from, this.to, i);
|
|
1156
1164
|
}
|
|
1157
1165
|
invert() {
|
|
1158
|
-
return new
|
|
1166
|
+
return new lt(this.from, this.to, this.mark);
|
|
1159
1167
|
}
|
|
1160
1168
|
map(t) {
|
|
1161
1169
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1177,17 +1185,17 @@ var rt = class e extends L {
|
|
|
1177
1185
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1178
1186
|
}
|
|
1179
1187
|
};
|
|
1180
|
-
|
|
1181
|
-
var
|
|
1188
|
+
F.jsonID("addMark", ct);
|
|
1189
|
+
var lt = class e extends F {
|
|
1182
1190
|
constructor(e, t, n) {
|
|
1183
1191
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
1184
1192
|
}
|
|
1185
1193
|
apply(e) {
|
|
1186
|
-
let t = e.slice(this.from, this.to), n = new
|
|
1187
|
-
return
|
|
1194
|
+
let t = e.slice(this.from, this.to), n = new k(st(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
|
|
1195
|
+
return I.fromReplace(e, this.from, this.to, n);
|
|
1188
1196
|
}
|
|
1189
1197
|
invert() {
|
|
1190
|
-
return new
|
|
1198
|
+
return new ct(this.from, this.to, this.mark);
|
|
1191
1199
|
}
|
|
1192
1200
|
map(t) {
|
|
1193
1201
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -1209,16 +1217,16 @@ var it = class e extends L {
|
|
|
1209
1217
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
1210
1218
|
}
|
|
1211
1219
|
};
|
|
1212
|
-
|
|
1213
|
-
var
|
|
1220
|
+
F.jsonID("removeMark", lt);
|
|
1221
|
+
var ut = class e extends F {
|
|
1214
1222
|
constructor(e, t) {
|
|
1215
1223
|
super(), this.pos = e, this.mark = t;
|
|
1216
1224
|
}
|
|
1217
1225
|
apply(e) {
|
|
1218
1226
|
let t = e.nodeAt(this.pos);
|
|
1219
|
-
if (!t) return
|
|
1227
|
+
if (!t) return I.fail("No node at mark step's position");
|
|
1220
1228
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
1221
|
-
return
|
|
1229
|
+
return I.fromReplace(e, this.pos, this.pos + 1, new k(E.from(n), 0, +!t.isLeaf));
|
|
1222
1230
|
}
|
|
1223
1231
|
invert(t) {
|
|
1224
1232
|
let n = t.nodeAt(this.pos);
|
|
@@ -1229,7 +1237,7 @@ var at = class e extends L {
|
|
|
1229
1237
|
return new e(this.pos, this.mark);
|
|
1230
1238
|
}
|
|
1231
1239
|
}
|
|
1232
|
-
return new
|
|
1240
|
+
return new dt(this.pos, this.mark);
|
|
1233
1241
|
}
|
|
1234
1242
|
map(t) {
|
|
1235
1243
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1247,20 +1255,20 @@ var at = class e extends L {
|
|
|
1247
1255
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1248
1256
|
}
|
|
1249
1257
|
};
|
|
1250
|
-
|
|
1251
|
-
var
|
|
1258
|
+
F.jsonID("addNodeMark", ut);
|
|
1259
|
+
var dt = class e extends F {
|
|
1252
1260
|
constructor(e, t) {
|
|
1253
1261
|
super(), this.pos = e, this.mark = t;
|
|
1254
1262
|
}
|
|
1255
1263
|
apply(e) {
|
|
1256
1264
|
let t = e.nodeAt(this.pos);
|
|
1257
|
-
if (!t) return
|
|
1265
|
+
if (!t) return I.fail("No node at mark step's position");
|
|
1258
1266
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
1259
|
-
return
|
|
1267
|
+
return I.fromReplace(e, this.pos, this.pos + 1, new k(E.from(n), 0, +!t.isLeaf));
|
|
1260
1268
|
}
|
|
1261
1269
|
invert(e) {
|
|
1262
1270
|
let t = e.nodeAt(this.pos);
|
|
1263
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
1271
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new ut(this.pos, this.mark);
|
|
1264
1272
|
}
|
|
1265
1273
|
map(t) {
|
|
1266
1274
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -1278,16 +1286,16 @@ var ot = class e extends L {
|
|
|
1278
1286
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
1279
1287
|
}
|
|
1280
1288
|
};
|
|
1281
|
-
|
|
1282
|
-
var
|
|
1289
|
+
F.jsonID("removeNodeMark", dt);
|
|
1290
|
+
var ft = class e extends F {
|
|
1283
1291
|
constructor(e, t, n, r = !1) {
|
|
1284
1292
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
1285
1293
|
}
|
|
1286
1294
|
apply(e) {
|
|
1287
|
-
return this.structure &&
|
|
1295
|
+
return this.structure && mt(e, this.from, this.to) ? I.fail("Structure replace would overwrite content") : I.fromReplace(e, this.from, this.to, this.slice);
|
|
1288
1296
|
}
|
|
1289
1297
|
getMap() {
|
|
1290
|
-
return new
|
|
1298
|
+
return new P([
|
|
1291
1299
|
this.from,
|
|
1292
1300
|
this.to - this.from,
|
|
1293
1301
|
this.slice.size
|
|
@@ -1303,10 +1311,10 @@ var st = class e extends L {
|
|
|
1303
1311
|
merge(t) {
|
|
1304
1312
|
if (!(t instanceof e) || t.structure || this.structure) return null;
|
|
1305
1313
|
if (this.from + this.slice.size == t.from && !this.slice.openEnd && !t.slice.openStart) {
|
|
1306
|
-
let n = this.slice.size + t.slice.size == 0 ?
|
|
1314
|
+
let n = this.slice.size + t.slice.size == 0 ? k.empty : new k(this.slice.content.append(t.slice.content), this.slice.openStart, t.slice.openEnd);
|
|
1307
1315
|
return new e(this.from, this.to + (t.to - t.from), n, this.structure);
|
|
1308
1316
|
} else if (t.to == this.from && !this.slice.openStart && !t.slice.openEnd) {
|
|
1309
|
-
let n = this.slice.size + t.slice.size == 0 ?
|
|
1317
|
+
let n = this.slice.size + t.slice.size == 0 ? k.empty : new k(t.slice.content.append(this.slice.content), t.slice.openStart, this.slice.openEnd);
|
|
1310
1318
|
return new e(t.from, this.to, n, this.structure);
|
|
1311
1319
|
} else return null;
|
|
1312
1320
|
}
|
|
@@ -1320,23 +1328,23 @@ var st = class e extends L {
|
|
|
1320
1328
|
}
|
|
1321
1329
|
static fromJSON(t, n) {
|
|
1322
1330
|
if (typeof n.from != "number" || typeof n.to != "number") throw RangeError("Invalid input for ReplaceStep.fromJSON");
|
|
1323
|
-
return new e(n.from, n.to,
|
|
1331
|
+
return new e(n.from, n.to, k.fromJSON(t, n.slice), !!n.structure);
|
|
1324
1332
|
}
|
|
1325
1333
|
};
|
|
1326
|
-
|
|
1327
|
-
var
|
|
1334
|
+
ft.MAP_BIAS = 1, F.jsonID("replace", ft);
|
|
1335
|
+
var pt = class e extends F {
|
|
1328
1336
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
1329
1337
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
1330
1338
|
}
|
|
1331
1339
|
apply(e) {
|
|
1332
|
-
if (this.structure && (
|
|
1340
|
+
if (this.structure && (mt(e, this.from, this.gapFrom) || mt(e, this.gapTo, this.to))) return I.fail("Structure gap-replace would overwrite content");
|
|
1333
1341
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
1334
|
-
if (t.openStart || t.openEnd) return
|
|
1342
|
+
if (t.openStart || t.openEnd) return I.fail("Gap is not a flat range");
|
|
1335
1343
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
1336
|
-
return n ?
|
|
1344
|
+
return n ? I.fromReplace(e, this.from, this.to, n) : I.fail("Content does not fit in gap");
|
|
1337
1345
|
}
|
|
1338
1346
|
getMap() {
|
|
1339
|
-
return new
|
|
1347
|
+
return new P([
|
|
1340
1348
|
this.from,
|
|
1341
1349
|
this.gapFrom - this.from,
|
|
1342
1350
|
this.insert,
|
|
@@ -1366,11 +1374,11 @@ var ct = class e extends L {
|
|
|
1366
1374
|
}
|
|
1367
1375
|
static fromJSON(t, n) {
|
|
1368
1376
|
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,
|
|
1377
|
+
return new e(n.from, n.to, n.gapFrom, n.gapTo, k.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
1370
1378
|
}
|
|
1371
1379
|
};
|
|
1372
|
-
|
|
1373
|
-
function
|
|
1380
|
+
F.jsonID("replaceAround", pt);
|
|
1381
|
+
function mt(e, t, n) {
|
|
1374
1382
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
1375
1383
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
1376
1384
|
if (i > 0) {
|
|
@@ -1382,21 +1390,21 @@ function lt(e, t, n) {
|
|
|
1382
1390
|
}
|
|
1383
1391
|
return !1;
|
|
1384
1392
|
}
|
|
1385
|
-
var
|
|
1393
|
+
var ht = class e extends F {
|
|
1386
1394
|
constructor(e, t, n) {
|
|
1387
1395
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
1388
1396
|
}
|
|
1389
1397
|
apply(e) {
|
|
1390
1398
|
let t = e.nodeAt(this.pos);
|
|
1391
|
-
if (!t) return
|
|
1399
|
+
if (!t) return I.fail("No node at attribute step's position");
|
|
1392
1400
|
let n = /* @__PURE__ */ Object.create(null);
|
|
1393
1401
|
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
1394
1402
|
n[this.attr] = this.value;
|
|
1395
1403
|
let r = t.type.create(n, null, t.marks);
|
|
1396
|
-
return
|
|
1404
|
+
return I.fromReplace(e, this.pos, this.pos + 1, new k(E.from(r), 0, +!t.isLeaf));
|
|
1397
1405
|
}
|
|
1398
1406
|
getMap() {
|
|
1399
|
-
return
|
|
1407
|
+
return P.empty;
|
|
1400
1408
|
}
|
|
1401
1409
|
invert(t) {
|
|
1402
1410
|
return new e(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -1418,8 +1426,8 @@ var ut = class e extends L {
|
|
|
1418
1426
|
return new e(n.pos, n.attr, n.value);
|
|
1419
1427
|
}
|
|
1420
1428
|
};
|
|
1421
|
-
|
|
1422
|
-
var
|
|
1429
|
+
F.jsonID("attr", ht);
|
|
1430
|
+
var gt = class e extends F {
|
|
1423
1431
|
constructor(e, t) {
|
|
1424
1432
|
super(), this.attr = e, this.value = t;
|
|
1425
1433
|
}
|
|
@@ -1428,10 +1436,10 @@ var dt = class e extends L {
|
|
|
1428
1436
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
1429
1437
|
t[this.attr] = this.value;
|
|
1430
1438
|
let n = e.type.create(t, e.content, e.marks);
|
|
1431
|
-
return
|
|
1439
|
+
return I.ok(n);
|
|
1432
1440
|
}
|
|
1433
1441
|
getMap() {
|
|
1434
|
-
return
|
|
1442
|
+
return P.empty;
|
|
1435
1443
|
}
|
|
1436
1444
|
invert(t) {
|
|
1437
1445
|
return new e(this.attr, t.attrs[this.attr]);
|
|
@@ -1451,15 +1459,15 @@ var dt = class e extends L {
|
|
|
1451
1459
|
return new e(n.attr, n.value);
|
|
1452
1460
|
}
|
|
1453
1461
|
};
|
|
1454
|
-
|
|
1455
|
-
var
|
|
1456
|
-
|
|
1462
|
+
F.jsonID("docAttr", gt);
|
|
1463
|
+
var L = class extends Error {};
|
|
1464
|
+
L = function e(t) {
|
|
1457
1465
|
let n = Error.call(this, t);
|
|
1458
1466
|
return n.__proto__ = e.prototype, n;
|
|
1459
|
-
},
|
|
1460
|
-
var
|
|
1467
|
+
}, L.prototype = Object.create(Error.prototype), L.prototype.constructor = L, L.prototype.name = "TransformError";
|
|
1468
|
+
var _t = /* @__PURE__ */ Object.create(null), R = class {
|
|
1461
1469
|
constructor(e, t, n) {
|
|
1462
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
1470
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new vt(e.min(t), e.max(t))];
|
|
1463
1471
|
}
|
|
1464
1472
|
get anchor() {
|
|
1465
1473
|
return this.$anchor.pos;
|
|
@@ -1487,78 +1495,78 @@ var ft = /* @__PURE__ */ Object.create(null), B = class {
|
|
|
1487
1495
|
content() {
|
|
1488
1496
|
return this.$from.doc.slice(this.from, this.to, !0);
|
|
1489
1497
|
}
|
|
1490
|
-
replace(e, t =
|
|
1498
|
+
replace(e, t = k.empty) {
|
|
1491
1499
|
let n = t.content.lastChild, r = null;
|
|
1492
1500
|
for (let e = 0; e < t.openEnd; e++) r = n, n = n.lastChild;
|
|
1493
1501
|
let i = e.steps.length, a = this.ranges;
|
|
1494
1502
|
for (let o = 0; o < a.length; o++) {
|
|
1495
1503
|
let { $from: s, $to: c } = a[o], l = e.mapping.slice(i);
|
|
1496
|
-
e.replaceRange(l.map(s.pos), l.map(c.pos), o ?
|
|
1504
|
+
e.replaceRange(l.map(s.pos), l.map(c.pos), o ? k.empty : t), o == 0 && wt(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
1497
1505
|
}
|
|
1498
1506
|
}
|
|
1499
1507
|
replaceWith(e, t) {
|
|
1500
1508
|
let n = e.steps.length, r = this.ranges;
|
|
1501
1509
|
for (let i = 0; i < r.length; i++) {
|
|
1502
1510
|
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),
|
|
1511
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), wt(e, n, t.isInline ? -1 : 1));
|
|
1504
1512
|
}
|
|
1505
1513
|
}
|
|
1506
1514
|
static findFrom(e, t, n = !1) {
|
|
1507
|
-
let r = e.parent.inlineContent ? new
|
|
1515
|
+
let r = e.parent.inlineContent ? new z(e) : H(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
1508
1516
|
if (r) return r;
|
|
1509
1517
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
1510
|
-
let i = t < 0 ?
|
|
1518
|
+
let i = t < 0 ? H(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : H(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
1511
1519
|
if (i) return i;
|
|
1512
1520
|
}
|
|
1513
1521
|
return null;
|
|
1514
1522
|
}
|
|
1515
1523
|
static near(e, t = 1) {
|
|
1516
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
1524
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new V(e.node(0));
|
|
1517
1525
|
}
|
|
1518
1526
|
static atStart(e) {
|
|
1519
|
-
return
|
|
1527
|
+
return H(e, e, 0, 0, 1) || new V(e);
|
|
1520
1528
|
}
|
|
1521
1529
|
static atEnd(e) {
|
|
1522
|
-
return
|
|
1530
|
+
return H(e, e, e.content.size, e.childCount, -1) || new V(e);
|
|
1523
1531
|
}
|
|
1524
1532
|
static fromJSON(e, t) {
|
|
1525
1533
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
1526
|
-
let n =
|
|
1534
|
+
let n = _t[t.type];
|
|
1527
1535
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
1528
1536
|
return n.fromJSON(e, t);
|
|
1529
1537
|
}
|
|
1530
1538
|
static jsonID(e, t) {
|
|
1531
|
-
if (e in
|
|
1532
|
-
return
|
|
1539
|
+
if (e in _t) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
1540
|
+
return _t[e] = t, t.prototype.jsonID = e, t;
|
|
1533
1541
|
}
|
|
1534
1542
|
getBookmark() {
|
|
1535
|
-
return
|
|
1543
|
+
return z.between(this.$anchor, this.$head).getBookmark();
|
|
1536
1544
|
}
|
|
1537
1545
|
};
|
|
1538
|
-
|
|
1539
|
-
var
|
|
1546
|
+
R.prototype.visible = !0;
|
|
1547
|
+
var vt = class {
|
|
1540
1548
|
constructor(e, t) {
|
|
1541
1549
|
this.$from = e, this.$to = t;
|
|
1542
1550
|
}
|
|
1543
|
-
},
|
|
1544
|
-
function
|
|
1545
|
-
!
|
|
1551
|
+
}, yt = !1;
|
|
1552
|
+
function bt(e) {
|
|
1553
|
+
!yt && !e.parent.inlineContent && (yt = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
1546
1554
|
}
|
|
1547
|
-
var
|
|
1555
|
+
var z = class e extends R {
|
|
1548
1556
|
constructor(e, t = e) {
|
|
1549
|
-
|
|
1557
|
+
bt(e), bt(t), super(e, t);
|
|
1550
1558
|
}
|
|
1551
1559
|
get $cursor() {
|
|
1552
1560
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
1553
1561
|
}
|
|
1554
1562
|
map(t, n) {
|
|
1555
1563
|
let r = t.resolve(n.map(this.head));
|
|
1556
|
-
if (!r.parent.inlineContent) return
|
|
1564
|
+
if (!r.parent.inlineContent) return R.near(r);
|
|
1557
1565
|
let i = t.resolve(n.map(this.anchor));
|
|
1558
1566
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
1559
1567
|
}
|
|
1560
|
-
replace(e, t =
|
|
1561
|
-
if (super.replace(e, t), t ==
|
|
1568
|
+
replace(e, t = k.empty) {
|
|
1569
|
+
if (super.replace(e, t), t == k.empty) {
|
|
1562
1570
|
let t = this.$from.marksAcross(this.$to);
|
|
1563
1571
|
t && e.ensureMarks(t);
|
|
1564
1572
|
}
|
|
@@ -1567,7 +1575,7 @@ var V = class e extends B {
|
|
|
1567
1575
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
1568
1576
|
}
|
|
1569
1577
|
getBookmark() {
|
|
1570
|
-
return new
|
|
1578
|
+
return new xt(this.anchor, this.head);
|
|
1571
1579
|
}
|
|
1572
1580
|
toJSON() {
|
|
1573
1581
|
return {
|
|
@@ -1587,15 +1595,15 @@ var V = class e extends B {
|
|
|
1587
1595
|
static between(t, n, r) {
|
|
1588
1596
|
let i = t.pos - n.pos;
|
|
1589
1597
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
1590
|
-
let e =
|
|
1598
|
+
let e = R.findFrom(n, r, !0) || R.findFrom(n, -r, !0);
|
|
1591
1599
|
if (e) n = e.$head;
|
|
1592
|
-
else return
|
|
1600
|
+
else return R.near(n, r);
|
|
1593
1601
|
}
|
|
1594
|
-
return t.parent.inlineContent || (i == 0 ? t = n : (t = (
|
|
1602
|
+
return t.parent.inlineContent || (i == 0 ? t = n : (t = (R.findFrom(t, -r, !0) || R.findFrom(t, r, !0)).$anchor, t.pos < n.pos != i < 0 && (t = n))), new e(t, n);
|
|
1595
1603
|
}
|
|
1596
1604
|
};
|
|
1597
|
-
|
|
1598
|
-
var
|
|
1605
|
+
R.jsonID("text", z);
|
|
1606
|
+
var xt = class e {
|
|
1599
1607
|
constructor(e, t) {
|
|
1600
1608
|
this.anchor = e, this.head = t;
|
|
1601
1609
|
}
|
|
@@ -1603,19 +1611,19 @@ var gt = class e {
|
|
|
1603
1611
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
1604
1612
|
}
|
|
1605
1613
|
resolve(e) {
|
|
1606
|
-
return
|
|
1614
|
+
return z.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
1607
1615
|
}
|
|
1608
|
-
},
|
|
1616
|
+
}, B = class e extends R {
|
|
1609
1617
|
constructor(e) {
|
|
1610
1618
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
1611
1619
|
super(e, n), this.node = t;
|
|
1612
1620
|
}
|
|
1613
1621
|
map(t, n) {
|
|
1614
1622
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
1615
|
-
return r ?
|
|
1623
|
+
return r ? R.near(a) : new e(a);
|
|
1616
1624
|
}
|
|
1617
1625
|
content() {
|
|
1618
|
-
return new
|
|
1626
|
+
return new k(E.from(this.node), 0, 0);
|
|
1619
1627
|
}
|
|
1620
1628
|
eq(t) {
|
|
1621
1629
|
return t instanceof e && t.anchor == this.anchor;
|
|
@@ -1627,7 +1635,7 @@ var gt = class e {
|
|
|
1627
1635
|
};
|
|
1628
1636
|
}
|
|
1629
1637
|
getBookmark() {
|
|
1630
|
-
return new
|
|
1638
|
+
return new St(this.anchor);
|
|
1631
1639
|
}
|
|
1632
1640
|
static fromJSON(t, n) {
|
|
1633
1641
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -1640,27 +1648,27 @@ var gt = class e {
|
|
|
1640
1648
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
1641
1649
|
}
|
|
1642
1650
|
};
|
|
1643
|
-
|
|
1644
|
-
var
|
|
1651
|
+
B.prototype.visible = !1, R.jsonID("node", B);
|
|
1652
|
+
var St = class e {
|
|
1645
1653
|
constructor(e) {
|
|
1646
1654
|
this.anchor = e;
|
|
1647
1655
|
}
|
|
1648
1656
|
map(t) {
|
|
1649
1657
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
1650
|
-
return n ? new
|
|
1658
|
+
return n ? new xt(r, r) : new e(r);
|
|
1651
1659
|
}
|
|
1652
1660
|
resolve(e) {
|
|
1653
1661
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
1654
|
-
return n &&
|
|
1662
|
+
return n && B.isSelectable(n) ? new B(t) : R.near(t);
|
|
1655
1663
|
}
|
|
1656
|
-
},
|
|
1664
|
+
}, V = class e extends R {
|
|
1657
1665
|
constructor(e) {
|
|
1658
1666
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
1659
1667
|
}
|
|
1660
|
-
replace(e, t =
|
|
1661
|
-
if (t ==
|
|
1668
|
+
replace(e, t = k.empty) {
|
|
1669
|
+
if (t == k.empty) {
|
|
1662
1670
|
e.delete(0, e.doc.content.size);
|
|
1663
|
-
let t =
|
|
1671
|
+
let t = R.atStart(e.doc);
|
|
1664
1672
|
t.eq(e.selection) || e.setSelection(t);
|
|
1665
1673
|
} else super.replace(e, t);
|
|
1666
1674
|
}
|
|
@@ -1677,70 +1685,70 @@ var _t = class e {
|
|
|
1677
1685
|
return t instanceof e;
|
|
1678
1686
|
}
|
|
1679
1687
|
getBookmark() {
|
|
1680
|
-
return
|
|
1688
|
+
return Ct;
|
|
1681
1689
|
}
|
|
1682
1690
|
};
|
|
1683
|
-
|
|
1684
|
-
var
|
|
1691
|
+
R.jsonID("all", V);
|
|
1692
|
+
var Ct = {
|
|
1685
1693
|
map() {
|
|
1686
1694
|
return this;
|
|
1687
1695
|
},
|
|
1688
1696
|
resolve(e) {
|
|
1689
|
-
return new
|
|
1697
|
+
return new V(e);
|
|
1690
1698
|
}
|
|
1691
1699
|
};
|
|
1692
|
-
function
|
|
1693
|
-
if (t.inlineContent) return
|
|
1700
|
+
function H(e, t, n, r, i, a = !1) {
|
|
1701
|
+
if (t.inlineContent) return z.create(e, n);
|
|
1694
1702
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
1695
1703
|
let r = t.child(o);
|
|
1696
1704
|
if (!r.isAtom) {
|
|
1697
|
-
let t =
|
|
1705
|
+
let t = H(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
1698
1706
|
if (t) return t;
|
|
1699
|
-
} else if (!a &&
|
|
1707
|
+
} else if (!a && B.isSelectable(r)) return B.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
1700
1708
|
n += r.nodeSize * i;
|
|
1701
1709
|
}
|
|
1702
1710
|
return null;
|
|
1703
1711
|
}
|
|
1704
|
-
function
|
|
1712
|
+
function wt(e, t, n) {
|
|
1705
1713
|
let r = e.steps.length - 1;
|
|
1706
1714
|
if (r < t) return;
|
|
1707
1715
|
let i = e.steps[r];
|
|
1708
|
-
if (!(i instanceof
|
|
1716
|
+
if (!(i instanceof ft || i instanceof pt)) return;
|
|
1709
1717
|
let a = e.mapping.maps[r], o;
|
|
1710
1718
|
a.forEach((e, t, n, r) => {
|
|
1711
1719
|
o ??= r;
|
|
1712
|
-
}), e.setSelection(
|
|
1720
|
+
}), e.setSelection(R.near(e.doc.resolve(o), n));
|
|
1713
1721
|
}
|
|
1714
|
-
function
|
|
1722
|
+
function Tt(e, t) {
|
|
1715
1723
|
return !t || !e ? e : e.bind(t);
|
|
1716
1724
|
}
|
|
1717
|
-
var
|
|
1725
|
+
var U = class {
|
|
1718
1726
|
constructor(e, t, n) {
|
|
1719
|
-
this.name = e, this.init =
|
|
1727
|
+
this.name = e, this.init = Tt(t.init, n), this.apply = Tt(t.apply, n);
|
|
1720
1728
|
}
|
|
1721
1729
|
};
|
|
1722
|
-
new
|
|
1730
|
+
new U("doc", {
|
|
1723
1731
|
init(e) {
|
|
1724
1732
|
return e.doc || e.schema.topNodeType.createAndFill();
|
|
1725
1733
|
},
|
|
1726
1734
|
apply(e) {
|
|
1727
1735
|
return e.doc;
|
|
1728
1736
|
}
|
|
1729
|
-
}), new
|
|
1737
|
+
}), new U("selection", {
|
|
1730
1738
|
init(e, t) {
|
|
1731
|
-
return e.selection ||
|
|
1739
|
+
return e.selection || R.atStart(t.doc);
|
|
1732
1740
|
},
|
|
1733
1741
|
apply(e) {
|
|
1734
1742
|
return e.selection;
|
|
1735
1743
|
}
|
|
1736
|
-
}), new
|
|
1744
|
+
}), new U("storedMarks", {
|
|
1737
1745
|
init(e) {
|
|
1738
1746
|
return e.storedMarks || null;
|
|
1739
1747
|
},
|
|
1740
1748
|
apply(e, t, n, r) {
|
|
1741
1749
|
return r.selection.$cursor ? e.storedMarks : null;
|
|
1742
1750
|
}
|
|
1743
|
-
}), new
|
|
1751
|
+
}), new U("scrollToSelection", {
|
|
1744
1752
|
init() {
|
|
1745
1753
|
return 0;
|
|
1746
1754
|
},
|
|
@@ -1748,7 +1756,7 @@ new G("doc", {
|
|
|
1748
1756
|
return e.scrolledIntoView ? t + 1 : t;
|
|
1749
1757
|
}
|
|
1750
1758
|
});
|
|
1751
|
-
var
|
|
1759
|
+
var Et = (e, t) => {
|
|
1752
1760
|
let { state: n, view: r } = e, { selection: i } = n;
|
|
1753
1761
|
if (!i.empty) return !1;
|
|
1754
1762
|
let { $from: a } = i;
|
|
@@ -1759,8 +1767,8 @@ var xt = (e, t) => {
|
|
|
1759
1767
|
let l = s.child(c - 1);
|
|
1760
1768
|
if (l.type !== t || !l.lastChild?.isTextblock) return !1;
|
|
1761
1769
|
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
|
-
},
|
|
1770
|
+
return f.delete(u, a.after()).insert(d, a.parent.content), f.setSelection(z.create(f.doc, d)), r.dispatch(f.scrollIntoView()), !0;
|
|
1771
|
+
}, Dt = /^\s*>\s$/, Ot = x.create({
|
|
1764
1772
|
name: "blockquote",
|
|
1765
1773
|
addOptions() {
|
|
1766
1774
|
return { HTMLAttributes: {} };
|
|
@@ -1772,9 +1780,9 @@ var xt = (e, t) => {
|
|
|
1772
1780
|
return [{ tag: "blockquote" }];
|
|
1773
1781
|
},
|
|
1774
1782
|
renderHTML({ HTMLAttributes: e }) {
|
|
1775
|
-
return /* @__PURE__ */
|
|
1783
|
+
return /* @__PURE__ */ fe("blockquote", {
|
|
1776
1784
|
...b(this.options.HTMLAttributes, e),
|
|
1777
|
-
children: /* @__PURE__ */
|
|
1785
|
+
children: /* @__PURE__ */ fe("slot", {})
|
|
1778
1786
|
});
|
|
1779
1787
|
},
|
|
1780
1788
|
parseMarkdown: (e, t) => {
|
|
@@ -1799,16 +1807,16 @@ var xt = (e, t) => {
|
|
|
1799
1807
|
addKeyboardShortcuts() {
|
|
1800
1808
|
return {
|
|
1801
1809
|
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
|
|
1802
|
-
Backspace: () =>
|
|
1810
|
+
Backspace: () => Et(this.editor, this.type)
|
|
1803
1811
|
};
|
|
1804
1812
|
},
|
|
1805
1813
|
addInputRules() {
|
|
1806
1814
|
return [v({
|
|
1807
|
-
find:
|
|
1815
|
+
find: Dt,
|
|
1808
1816
|
type: this.type
|
|
1809
1817
|
})];
|
|
1810
1818
|
}
|
|
1811
|
-
}),
|
|
1819
|
+
}), kt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, At = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, jt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Mt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, Nt = ee.create({
|
|
1812
1820
|
name: "bold",
|
|
1813
1821
|
addOptions() {
|
|
1814
1822
|
return { HTMLAttributes: {} };
|
|
@@ -1831,9 +1839,9 @@ var xt = (e, t) => {
|
|
|
1831
1839
|
];
|
|
1832
1840
|
},
|
|
1833
1841
|
renderHTML({ HTMLAttributes: e }) {
|
|
1834
|
-
return /* @__PURE__ */
|
|
1842
|
+
return /* @__PURE__ */ fe("strong", {
|
|
1835
1843
|
...b(this.options.HTMLAttributes, e),
|
|
1836
|
-
children: /* @__PURE__ */
|
|
1844
|
+
children: /* @__PURE__ */ fe("slot", {})
|
|
1837
1845
|
});
|
|
1838
1846
|
},
|
|
1839
1847
|
markdownTokenName: "strong",
|
|
@@ -1858,30 +1866,30 @@ var xt = (e, t) => {
|
|
|
1858
1866
|
},
|
|
1859
1867
|
addInputRules() {
|
|
1860
1868
|
return [u({
|
|
1861
|
-
find:
|
|
1869
|
+
find: kt,
|
|
1862
1870
|
type: this.type
|
|
1863
1871
|
}), u({
|
|
1864
|
-
find:
|
|
1872
|
+
find: jt,
|
|
1865
1873
|
type: this.type
|
|
1866
1874
|
})];
|
|
1867
1875
|
},
|
|
1868
1876
|
addPasteRules() {
|
|
1869
1877
|
return [d({
|
|
1870
|
-
find:
|
|
1878
|
+
find: At,
|
|
1871
1879
|
type: this.type
|
|
1872
1880
|
}), d({
|
|
1873
|
-
find:
|
|
1881
|
+
find: Mt,
|
|
1874
1882
|
type: this.type
|
|
1875
1883
|
})];
|
|
1876
1884
|
}
|
|
1877
|
-
}),
|
|
1885
|
+
}), Pt = (e) => {
|
|
1878
1886
|
let t = /`([^`]+)`(?!`)$/.exec(e);
|
|
1879
1887
|
return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
|
|
1880
1888
|
index: t.index,
|
|
1881
1889
|
text: t[0],
|
|
1882
1890
|
replaceWith: t[1]
|
|
1883
1891
|
};
|
|
1884
|
-
},
|
|
1892
|
+
}, Ft = (e) => {
|
|
1885
1893
|
let t = /`([^`]+)`(?!`)/g, n = [], r;
|
|
1886
1894
|
for (; (r = t.exec(e)) !== null;) r.index > 0 && e[r.index - 1] === "`" || n.push({
|
|
1887
1895
|
index: r.index,
|
|
@@ -1889,7 +1897,7 @@ var xt = (e, t) => {
|
|
|
1889
1897
|
replaceWith: r[1]
|
|
1890
1898
|
});
|
|
1891
1899
|
return n;
|
|
1892
|
-
},
|
|
1900
|
+
}, It = ee.create({
|
|
1893
1901
|
name: "code",
|
|
1894
1902
|
addOptions() {
|
|
1895
1903
|
return { HTMLAttributes: {} };
|
|
@@ -1925,17 +1933,17 @@ var xt = (e, t) => {
|
|
|
1925
1933
|
},
|
|
1926
1934
|
addInputRules() {
|
|
1927
1935
|
return [u({
|
|
1928
|
-
find:
|
|
1936
|
+
find: Pt,
|
|
1929
1937
|
type: this.type
|
|
1930
1938
|
})];
|
|
1931
1939
|
},
|
|
1932
1940
|
addPasteRules() {
|
|
1933
1941
|
return [d({
|
|
1934
|
-
find:
|
|
1942
|
+
find: Ft,
|
|
1935
1943
|
type: this.type
|
|
1936
1944
|
})];
|
|
1937
1945
|
}
|
|
1938
|
-
}),
|
|
1946
|
+
}), Lt = 4, Rt = /^```([a-z]+)?[\s\n]$/, zt = /^~~~([a-z]+)?[\s\n]$/, Bt = x.create({
|
|
1939
1947
|
name: "codeBlock",
|
|
1940
1948
|
addOptions() {
|
|
1941
1949
|
return {
|
|
@@ -1944,7 +1952,7 @@ var xt = (e, t) => {
|
|
|
1944
1952
|
exitOnArrowDown: !0,
|
|
1945
1953
|
defaultLanguage: null,
|
|
1946
1954
|
enableTabIndentation: !1,
|
|
1947
|
-
tabSize:
|
|
1955
|
+
tabSize: Lt,
|
|
1948
1956
|
HTMLAttributes: {}
|
|
1949
1957
|
};
|
|
1950
1958
|
},
|
|
@@ -2007,7 +2015,7 @@ var xt = (e, t) => {
|
|
|
2007
2015
|
},
|
|
2008
2016
|
Tab: ({ editor: e }) => {
|
|
2009
2017
|
if (!this.options.enableTabIndentation) return !1;
|
|
2010
|
-
let t = this.options.tabSize ??
|
|
2018
|
+
let t = this.options.tabSize ?? Lt, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
|
|
2011
2019
|
if (i.parent.type !== this.type) return !1;
|
|
2012
2020
|
let o = " ".repeat(t);
|
|
2013
2021
|
return a ? e.commands.insertContent(o) : e.commands.command(({ tr: e }) => {
|
|
@@ -2017,7 +2025,7 @@ var xt = (e, t) => {
|
|
|
2017
2025
|
},
|
|
2018
2026
|
"Shift-Tab": ({ editor: e }) => {
|
|
2019
2027
|
if (!this.options.enableTabIndentation) return !1;
|
|
2020
|
-
let t = this.options.tabSize ??
|
|
2028
|
+
let t = this.options.tabSize ?? Lt, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
|
|
2021
2029
|
return i.parent.type === this.type ? a ? e.commands.command(({ tr: e }) => {
|
|
2022
2030
|
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
2031
|
for (let e = 0; e < s.length; e += 1) {
|
|
@@ -2057,12 +2065,12 @@ var xt = (e, t) => {
|
|
|
2057
2065
|
};
|
|
2058
2066
|
},
|
|
2059
2067
|
addInputRules() {
|
|
2060
|
-
return [
|
|
2061
|
-
find:
|
|
2068
|
+
return [ie({
|
|
2069
|
+
find: Rt,
|
|
2062
2070
|
type: this.type,
|
|
2063
2071
|
getAttributes: (e) => ({ language: e[1] })
|
|
2064
|
-
}),
|
|
2065
|
-
find:
|
|
2072
|
+
}), ie({
|
|
2073
|
+
find: zt,
|
|
2066
2074
|
type: this.type,
|
|
2067
2075
|
getAttributes: (e) => ({ language: e[1] })
|
|
2068
2076
|
})];
|
|
@@ -2079,12 +2087,12 @@ var xt = (e, t) => {
|
|
|
2079
2087
|
} }
|
|
2080
2088
|
})];
|
|
2081
2089
|
}
|
|
2082
|
-
}),
|
|
2090
|
+
}), Vt = x.create({
|
|
2083
2091
|
name: "doc",
|
|
2084
2092
|
topNode: !0,
|
|
2085
2093
|
content: "block+",
|
|
2086
2094
|
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n\n") : ""
|
|
2087
|
-
}),
|
|
2095
|
+
}), Ht = x.create({
|
|
2088
2096
|
name: "hardBreak",
|
|
2089
2097
|
markdownTokenName: "br",
|
|
2090
2098
|
addOptions() {
|
|
@@ -2128,7 +2136,7 @@ var xt = (e, t) => {
|
|
|
2128
2136
|
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
2129
2137
|
};
|
|
2130
2138
|
}
|
|
2131
|
-
}),
|
|
2139
|
+
}), Ut = x.create({
|
|
2132
2140
|
name: "heading",
|
|
2133
2141
|
addOptions() {
|
|
2134
2142
|
return {
|
|
@@ -2183,13 +2191,13 @@ var xt = (e, t) => {
|
|
|
2183
2191
|
}), {});
|
|
2184
2192
|
},
|
|
2185
2193
|
addInputRules() {
|
|
2186
|
-
return this.options.levels.map((e) =>
|
|
2194
|
+
return this.options.levels.map((e) => ie({
|
|
2187
2195
|
find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
2188
2196
|
type: this.type,
|
|
2189
2197
|
getAttributes: { level: e }
|
|
2190
2198
|
}));
|
|
2191
2199
|
}
|
|
2192
|
-
}),
|
|
2200
|
+
}), Wt = x.create({
|
|
2193
2201
|
name: "horizontalRule",
|
|
2194
2202
|
addOptions() {
|
|
2195
2203
|
return {
|
|
@@ -2209,12 +2217,12 @@ var xt = (e, t) => {
|
|
|
2209
2217
|
renderMarkdown: () => "---",
|
|
2210
2218
|
addCommands() {
|
|
2211
2219
|
return { setHorizontalRule: () => ({ chain: e, state: t }) => {
|
|
2212
|
-
if (!
|
|
2220
|
+
if (!le(t, t.schema.nodes[this.name])) return !1;
|
|
2213
2221
|
let { selection: n } = t, { $to: r } = n, i = e();
|
|
2214
2222
|
return s(n) ? i.insertContentAt(r.pos, { type: this.name }) : i.insertContent({ type: this.name }), i.command(({ state: e, tr: t, dispatch: n }) => {
|
|
2215
2223
|
if (n) {
|
|
2216
2224
|
let { $to: n } = t.selection, r = n.end();
|
|
2217
|
-
if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(C.create(t.doc, n.pos + 1)) : n.nodeAfter.isBlock ? t.setSelection(
|
|
2225
|
+
if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(C.create(t.doc, n.pos + 1)) : n.nodeAfter.isBlock ? t.setSelection(_.create(t.doc, n.pos)) : t.setSelection(C.create(t.doc, n.pos));
|
|
2218
2226
|
else {
|
|
2219
2227
|
let i = (e.schema.nodes[this.options.nextNodeType] || n.parent.type.contentMatch.defaultType)?.create();
|
|
2220
2228
|
i && (t.insert(r, i), t.setSelection(C.create(t.doc, r + 1)));
|
|
@@ -2231,7 +2239,7 @@ var xt = (e, t) => {
|
|
|
2231
2239
|
type: this.type
|
|
2232
2240
|
})];
|
|
2233
2241
|
}
|
|
2234
|
-
}),
|
|
2242
|
+
}), Gt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Kt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, qt = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Jt = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Yt = ee.create({
|
|
2235
2243
|
name: "italic",
|
|
2236
2244
|
addOptions() {
|
|
2237
2245
|
return { HTMLAttributes: {} };
|
|
@@ -2279,28 +2287,28 @@ var xt = (e, t) => {
|
|
|
2279
2287
|
},
|
|
2280
2288
|
addInputRules() {
|
|
2281
2289
|
return [u({
|
|
2282
|
-
find:
|
|
2290
|
+
find: Gt,
|
|
2283
2291
|
type: this.type
|
|
2284
2292
|
}), u({
|
|
2285
|
-
find:
|
|
2293
|
+
find: qt,
|
|
2286
2294
|
type: this.type
|
|
2287
2295
|
})];
|
|
2288
2296
|
},
|
|
2289
2297
|
addPasteRules() {
|
|
2290
2298
|
return [d({
|
|
2291
|
-
find:
|
|
2299
|
+
find: Kt,
|
|
2292
2300
|
type: this.type
|
|
2293
2301
|
}), d({
|
|
2294
|
-
find:
|
|
2302
|
+
find: Jt,
|
|
2295
2303
|
type: this.type
|
|
2296
2304
|
})];
|
|
2297
2305
|
}
|
|
2298
|
-
}),
|
|
2299
|
-
for (var n in t)
|
|
2306
|
+
}), Xt = Object.defineProperty, Zt = (e, t) => {
|
|
2307
|
+
for (var n in t) Xt(e, n, {
|
|
2300
2308
|
get: t[n],
|
|
2301
2309
|
enumerable: !0
|
|
2302
2310
|
});
|
|
2303
|
-
},
|
|
2311
|
+
}, Qt = "listItem", $t = "textStyle", en = /^\s*([-+*])\s$/, tn = x.create({
|
|
2304
2312
|
name: "bulletList",
|
|
2305
2313
|
addOptions() {
|
|
2306
2314
|
return {
|
|
@@ -2332,26 +2340,26 @@ var xt = (e, t) => {
|
|
|
2332
2340
|
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
|
|
2333
2341
|
markdownOptions: { indentsContent: !0 },
|
|
2334
2342
|
addCommands() {
|
|
2335
|
-
return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
2343
|
+
return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Qt, this.editor.getAttributes($t)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
2336
2344
|
},
|
|
2337
2345
|
addKeyboardShortcuts() {
|
|
2338
2346
|
return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
|
|
2339
2347
|
},
|
|
2340
2348
|
addInputRules() {
|
|
2341
2349
|
let e = v({
|
|
2342
|
-
find:
|
|
2350
|
+
find: en,
|
|
2343
2351
|
type: this.type
|
|
2344
2352
|
});
|
|
2345
2353
|
return (this.options.keepMarks || this.options.keepAttributes) && (e = v({
|
|
2346
|
-
find:
|
|
2354
|
+
find: en,
|
|
2347
2355
|
type: this.type,
|
|
2348
2356
|
keepMarks: this.options.keepMarks,
|
|
2349
2357
|
keepAttributes: this.options.keepAttributes,
|
|
2350
|
-
getAttributes: () => this.editor.getAttributes(
|
|
2358
|
+
getAttributes: () => this.editor.getAttributes($t),
|
|
2351
2359
|
editor: this.editor
|
|
2352
2360
|
})), [e];
|
|
2353
2361
|
}
|
|
2354
|
-
}),
|
|
2362
|
+
}), nn = (e, t, n) => {
|
|
2355
2363
|
let { selection: r } = e;
|
|
2356
2364
|
if (!r.empty) return null;
|
|
2357
2365
|
let { $from: i } = r;
|
|
@@ -2382,24 +2390,24 @@ var xt = (e, t) => {
|
|
|
2382
2390
|
insertPos: i.after(a),
|
|
2383
2391
|
items: f
|
|
2384
2392
|
};
|
|
2385
|
-
},
|
|
2386
|
-
let a =
|
|
2393
|
+
}, rn = (e, t, r, i) => {
|
|
2394
|
+
let a = nn(e, r, i);
|
|
2387
2395
|
if (!a) return !1;
|
|
2388
2396
|
let { selection: o } = e, { nestedList: s, nestedListPos: c, insertPos: l, items: u } = a, d = e.tr;
|
|
2389
2397
|
d.delete(c, c + s.nodeSize);
|
|
2390
2398
|
let f = d.mapping.map(l);
|
|
2391
2399
|
return d.insert(f, n.from(u)), d.setSelection(o.map(d.doc, d.mapping)), t && t(d), !0;
|
|
2392
|
-
},
|
|
2400
|
+
}, an = (e, t, n) => rn(e.state, e.view.dispatch, t, n), on = (e, t) => y.create({
|
|
2393
2401
|
name: `${e}BranchingDeleteKeymap`,
|
|
2394
2402
|
priority: 101,
|
|
2395
2403
|
addKeyboardShortcuts() {
|
|
2396
|
-
let n = () =>
|
|
2404
|
+
let n = () => an(this.editor, e, t);
|
|
2397
2405
|
return {
|
|
2398
2406
|
Delete: n,
|
|
2399
2407
|
"Mod-Delete": n
|
|
2400
2408
|
};
|
|
2401
2409
|
}
|
|
2402
|
-
}),
|
|
2410
|
+
}), sn = [
|
|
2403
2411
|
[1e3, "m"],
|
|
2404
2412
|
[900, "cm"],
|
|
2405
2413
|
[500, "d"],
|
|
@@ -2413,20 +2421,20 @@ var xt = (e, t) => {
|
|
|
2413
2421
|
[5, "v"],
|
|
2414
2422
|
[4, "iv"],
|
|
2415
2423
|
[1, "i"]
|
|
2416
|
-
],
|
|
2417
|
-
function
|
|
2424
|
+
], W = "abcdefghijklmnopqrstuvwxyz", cn = String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;
|
|
2425
|
+
function ln(e) {
|
|
2418
2426
|
let t = e, n = "";
|
|
2419
|
-
for (let [e, r] of
|
|
2427
|
+
for (let [e, r] of sn) for (; t >= e;) n += r, t -= e;
|
|
2420
2428
|
return n;
|
|
2421
2429
|
}
|
|
2422
|
-
function
|
|
2423
|
-
return
|
|
2430
|
+
function un(e) {
|
|
2431
|
+
return ln(e).toUpperCase();
|
|
2424
2432
|
}
|
|
2425
|
-
function
|
|
2433
|
+
function dn(e) {
|
|
2426
2434
|
let t = e.toLowerCase(), n = 0, r = 0;
|
|
2427
2435
|
for (; n < t.length;) {
|
|
2428
2436
|
let e = !1;
|
|
2429
|
-
for (let [i, a] of
|
|
2437
|
+
for (let [i, a] of sn) if (t.startsWith(a, n)) {
|
|
2430
2438
|
r += i, n += a.length, e = !0;
|
|
2431
2439
|
break;
|
|
2432
2440
|
}
|
|
@@ -2434,12 +2442,12 @@ function on(e) {
|
|
|
2434
2442
|
}
|
|
2435
2443
|
return r;
|
|
2436
2444
|
}
|
|
2437
|
-
function
|
|
2445
|
+
function fn(e) {
|
|
2438
2446
|
if (!/^[ivxlcdmIVXLCDM]+$/.test(e)) return !1;
|
|
2439
|
-
let t =
|
|
2440
|
-
return t <= 0 ? !1 : (e === e.toLowerCase() ?
|
|
2447
|
+
let t = dn(e);
|
|
2448
|
+
return t <= 0 ? !1 : (e === e.toLowerCase() ? ln(t) : un(t)) === e;
|
|
2441
2449
|
}
|
|
2442
|
-
function
|
|
2450
|
+
function pn(e) {
|
|
2443
2451
|
let t = e.toLowerCase();
|
|
2444
2452
|
if (t.length === 1) return t.charCodeAt(0) - 97 + 1;
|
|
2445
2453
|
if (t.length === 2) {
|
|
@@ -2448,82 +2456,82 @@ function cn(e) {
|
|
|
2448
2456
|
}
|
|
2449
2457
|
return 0;
|
|
2450
2458
|
}
|
|
2451
|
-
function
|
|
2452
|
-
if (e <= 26) return
|
|
2459
|
+
function mn(e) {
|
|
2460
|
+
if (e <= 26) return W[e - 1];
|
|
2453
2461
|
let t = Math.floor((e - 1) / 26) - 1, n = (e - 1) % 26;
|
|
2454
|
-
return t < 0 ?
|
|
2462
|
+
return t < 0 ? W[n] : W[t] + W[n];
|
|
2455
2463
|
}
|
|
2456
|
-
function
|
|
2464
|
+
function hn(e) {
|
|
2457
2465
|
if (!(!e || /^\d+$/.test(e))) {
|
|
2458
|
-
if (
|
|
2466
|
+
if (fn(e)) return e === e.toLowerCase() ? "i" : "I";
|
|
2459
2467
|
if (/^[a-z]{1,2}$/.test(e)) return "a";
|
|
2460
2468
|
if (/^[A-Z]{1,2}$/.test(e)) return "A";
|
|
2461
2469
|
}
|
|
2462
2470
|
}
|
|
2463
|
-
function
|
|
2471
|
+
function gn(e) {
|
|
2464
2472
|
if (/^\d+$/.test(e)) return parseInt(e, 10);
|
|
2465
|
-
let t =
|
|
2466
|
-
if (t === "i" || t === "I") return
|
|
2473
|
+
let t = hn(e);
|
|
2474
|
+
if (t === "i" || t === "I") return dn(e);
|
|
2467
2475
|
if (t === "a" || t === "A") {
|
|
2468
|
-
let t =
|
|
2476
|
+
let t = pn(e);
|
|
2469
2477
|
return t > 0 ? t : 1;
|
|
2470
2478
|
}
|
|
2471
2479
|
let n = parseInt(e, 10);
|
|
2472
2480
|
return Number.isNaN(n) ? 1 : n;
|
|
2473
2481
|
}
|
|
2474
|
-
function
|
|
2482
|
+
function _n(e, t) {
|
|
2475
2483
|
if (e === "numeric") return String(t);
|
|
2476
2484
|
switch (e) {
|
|
2477
|
-
case "a": return
|
|
2478
|
-
case "A": return
|
|
2479
|
-
case "i": return
|
|
2480
|
-
case "I": return
|
|
2485
|
+
case "a": return mn(t);
|
|
2486
|
+
case "A": return mn(t).toUpperCase();
|
|
2487
|
+
case "i": return ln(t);
|
|
2488
|
+
case "I": return un(t);
|
|
2481
2489
|
default: return String(t);
|
|
2482
2490
|
}
|
|
2483
2491
|
}
|
|
2484
|
-
function
|
|
2492
|
+
function vn(e) {
|
|
2485
2493
|
if (e.length === 0) return !1;
|
|
2486
|
-
let t =
|
|
2494
|
+
let t = hn(e[0]) ?? "numeric", n = gn(e[0]);
|
|
2487
2495
|
if (n < 1) return !1;
|
|
2488
2496
|
for (let r = 0; r < e.length; r++) {
|
|
2489
|
-
let i =
|
|
2497
|
+
let i = _n(t, n + r);
|
|
2490
2498
|
if (e[r] !== i) return !1;
|
|
2491
2499
|
}
|
|
2492
2500
|
return !0;
|
|
2493
2501
|
}
|
|
2494
|
-
function
|
|
2502
|
+
function yn(e) {
|
|
2495
2503
|
return {
|
|
2496
|
-
type:
|
|
2497
|
-
start:
|
|
2504
|
+
type: hn(e),
|
|
2505
|
+
start: gn(e)
|
|
2498
2506
|
};
|
|
2499
2507
|
}
|
|
2500
|
-
function
|
|
2501
|
-
let { type: t, start: n } =
|
|
2508
|
+
function bn(e) {
|
|
2509
|
+
let { type: t, start: n } = yn(e), r = {};
|
|
2502
2510
|
return t && (r.type = t), n !== 1 && (r.start = n), r;
|
|
2503
2511
|
}
|
|
2504
|
-
function
|
|
2512
|
+
function xn(e, t, n = ". ") {
|
|
2505
2513
|
let r = t + 1;
|
|
2506
2514
|
if (!e || e === "1") return `${r}${n}`;
|
|
2507
2515
|
switch (e) {
|
|
2508
|
-
case "a": return `${
|
|
2509
|
-
case "A": return `${
|
|
2510
|
-
case "i": return `${
|
|
2511
|
-
case "I": return `${
|
|
2516
|
+
case "a": return `${mn(r)}${n}`;
|
|
2517
|
+
case "A": return `${mn(r).toUpperCase()}${n}`;
|
|
2518
|
+
case "i": return `${ln(r)}${n}`;
|
|
2519
|
+
case "I": return `${un(r)}${n}`;
|
|
2512
2520
|
default: return `${r}${n}`;
|
|
2513
2521
|
}
|
|
2514
2522
|
}
|
|
2515
|
-
function
|
|
2523
|
+
function Sn(e) {
|
|
2516
2524
|
let t = e.tokens?.[0];
|
|
2517
2525
|
return !!(e.text && e.tokens?.length === 1 && t?.type === "list" && t.ordered && t.raw === e.text);
|
|
2518
2526
|
}
|
|
2519
|
-
function
|
|
2527
|
+
function Cn(e, t) {
|
|
2520
2528
|
return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([{
|
|
2521
2529
|
type: "text",
|
|
2522
2530
|
raw: e,
|
|
2523
2531
|
text: e
|
|
2524
2532
|
}]);
|
|
2525
2533
|
}
|
|
2526
|
-
var
|
|
2534
|
+
var wn = x.create({
|
|
2527
2535
|
name: "listItem",
|
|
2528
2536
|
addOptions() {
|
|
2529
2537
|
return {
|
|
@@ -2549,11 +2557,11 @@ var yn = x.create({
|
|
|
2549
2557
|
if (e.type !== "list_item") return [];
|
|
2550
2558
|
let n = t.parseBlockChildren ?? t.parseChildren, r = [];
|
|
2551
2559
|
if (e.tokens && e.tokens.length > 0) {
|
|
2552
|
-
if (
|
|
2560
|
+
if (Sn(e)) return {
|
|
2553
2561
|
type: "listItem",
|
|
2554
2562
|
content: [{
|
|
2555
2563
|
type: "paragraph",
|
|
2556
|
-
content:
|
|
2564
|
+
content: Cn(e.text || "", t)
|
|
2557
2565
|
}]
|
|
2558
2566
|
};
|
|
2559
2567
|
if (e.tokens.some((e) => e.type === "paragraph")) r = n(e.tokens);
|
|
@@ -2578,16 +2586,16 @@ var yn = x.create({
|
|
|
2578
2586
|
content: r
|
|
2579
2587
|
};
|
|
2580
2588
|
},
|
|
2581
|
-
renderMarkdown: (e, t, n) =>
|
|
2589
|
+
renderMarkdown: (e, t, n) => ne(e, t, (e) => {
|
|
2582
2590
|
if (e.parentType === "bulletList") return "- ";
|
|
2583
2591
|
if (e.parentType === "orderedList") {
|
|
2584
2592
|
let t = e.meta?.parentAttrs?.start || 1;
|
|
2585
|
-
return
|
|
2593
|
+
return xn(e.meta?.parentAttrs?.type, t - 1 + (e.index || 0), ". ");
|
|
2586
2594
|
}
|
|
2587
2595
|
return "- ";
|
|
2588
2596
|
}, n),
|
|
2589
2597
|
addExtensions() {
|
|
2590
|
-
return [
|
|
2598
|
+
return [on(this.name, [this.options.bulletListTypeName, this.options.orderedListTypeName])];
|
|
2591
2599
|
},
|
|
2592
2600
|
addKeyboardShortcuts() {
|
|
2593
2601
|
return {
|
|
@@ -2597,37 +2605,37 @@ var yn = x.create({
|
|
|
2597
2605
|
};
|
|
2598
2606
|
}
|
|
2599
2607
|
});
|
|
2600
|
-
|
|
2601
|
-
findListItemPos: () =>
|
|
2602
|
-
getNextListDepth: () =>
|
|
2603
|
-
handleBackspace: () =>
|
|
2604
|
-
handleDelete: () =>
|
|
2605
|
-
hasListBefore: () =>
|
|
2606
|
-
hasListItemAfter: () =>
|
|
2607
|
-
hasListItemBefore: () =>
|
|
2608
|
-
listItemHasSubList: () =>
|
|
2609
|
-
nextListIsDeeper: () =>
|
|
2610
|
-
nextListIsHigher: () =>
|
|
2608
|
+
Zt({}, {
|
|
2609
|
+
findListItemPos: () => Tn,
|
|
2610
|
+
getNextListDepth: () => En,
|
|
2611
|
+
handleBackspace: () => On,
|
|
2612
|
+
handleDelete: () => jn,
|
|
2613
|
+
hasListBefore: () => Dn,
|
|
2614
|
+
hasListItemAfter: () => Mn,
|
|
2615
|
+
hasListItemBefore: () => Nn,
|
|
2616
|
+
listItemHasSubList: () => Pn,
|
|
2617
|
+
nextListIsDeeper: () => kn,
|
|
2618
|
+
nextListIsHigher: () => An
|
|
2611
2619
|
});
|
|
2612
|
-
var
|
|
2613
|
-
let { $from: n } = t.selection, r =
|
|
2620
|
+
var Tn = (e, t) => {
|
|
2621
|
+
let { $from: n } = t.selection, r = g(e, t.schema), i = null, a = n.depth, o = n.pos, s = null;
|
|
2614
2622
|
for (; a > 0 && s === null;) i = n.node(a), i.type === r ? s = a : (--a, --o);
|
|
2615
2623
|
return s === null ? null : {
|
|
2616
2624
|
$pos: t.doc.resolve(o),
|
|
2617
2625
|
depth: s
|
|
2618
2626
|
};
|
|
2619
|
-
},
|
|
2620
|
-
let n =
|
|
2627
|
+
}, En = (e, t) => {
|
|
2628
|
+
let n = Tn(e, t);
|
|
2621
2629
|
if (!n) return !1;
|
|
2622
|
-
let [, r] =
|
|
2630
|
+
let [, r] = oe(t, e, n.$pos.pos + 4);
|
|
2623
2631
|
return r;
|
|
2624
|
-
},
|
|
2632
|
+
}, Dn = (e, t, n) => {
|
|
2625
2633
|
let { $anchor: r } = e.selection, i = Math.max(0, r.pos - 2), a = e.doc.resolve(i).node();
|
|
2626
2634
|
return !(!a || !n.includes(a.type.name));
|
|
2627
|
-
},
|
|
2635
|
+
}, On = (e, t, n) => {
|
|
2628
2636
|
if (e.commands.undoInputRule()) return !0;
|
|
2629
2637
|
if (e.state.selection.from !== e.state.selection.to) return !1;
|
|
2630
|
-
if (!i(e.state, t) &&
|
|
2638
|
+
if (!i(e.state, t) && Dn(e.state, t, n)) {
|
|
2631
2639
|
let { $anchor: n } = e.state.selection, r = e.state.doc.resolve(n.before() - 1), i = [];
|
|
2632
2640
|
r.node().descendants((e, n) => {
|
|
2633
2641
|
e.type.name === t && i.push({
|
|
@@ -2643,30 +2651,30 @@ var bn = (e, t) => {
|
|
|
2643
2651
|
to: n.end() + 1
|
|
2644
2652
|
}, o.end()).joinForward().run();
|
|
2645
2653
|
}
|
|
2646
|
-
return !i(e.state, t) || !
|
|
2647
|
-
},
|
|
2648
|
-
let n =
|
|
2654
|
+
return !i(e.state, t) || !ce(e.state) ? !1 : e.chain().liftListItem(t).run();
|
|
2655
|
+
}, kn = (e, t) => {
|
|
2656
|
+
let n = En(e, t), r = Tn(e, t);
|
|
2649
2657
|
return !r || !n ? !1 : n > r.depth;
|
|
2650
|
-
},
|
|
2651
|
-
let n =
|
|
2658
|
+
}, An = (e, t) => {
|
|
2659
|
+
let n = En(e, t), r = Tn(e, t);
|
|
2652
2660
|
return !r || !n ? !1 : n < r.depth;
|
|
2653
|
-
},
|
|
2661
|
+
}, jn = (e, n) => {
|
|
2654
2662
|
if (!i(e.state, n) || !t(e.state, n)) return !1;
|
|
2655
2663
|
let { selection: r } = e.state, { $from: a, $to: o } = r;
|
|
2656
|
-
return !r.empty && a.sameParent(o) ? !1 :
|
|
2657
|
-
},
|
|
2664
|
+
return !r.empty && a.sameParent(o) ? !1 : kn(n, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(n).joinBackward().run() : An(n, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
|
|
2665
|
+
}, Mn = (e, t) => {
|
|
2658
2666
|
let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - n.parentOffset - 2);
|
|
2659
2667
|
return !(r.index() === r.parent.childCount - 1 || r.nodeAfter?.type.name !== e);
|
|
2660
|
-
},
|
|
2668
|
+
}, Nn = (e, t) => {
|
|
2661
2669
|
let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - 2);
|
|
2662
2670
|
return !(r.index() === 0 || r.nodeBefore?.type.name !== e);
|
|
2663
|
-
},
|
|
2671
|
+
}, Pn = (e, t, n) => {
|
|
2664
2672
|
if (!n) return !1;
|
|
2665
|
-
let r =
|
|
2673
|
+
let r = g(e, t.schema), i = !1;
|
|
2666
2674
|
return n.descendants((e) => {
|
|
2667
2675
|
e.type === r && (i = !0);
|
|
2668
2676
|
}), i;
|
|
2669
|
-
},
|
|
2677
|
+
}, Fn = y.create({
|
|
2670
2678
|
name: "listKeymap",
|
|
2671
2679
|
addOptions() {
|
|
2672
2680
|
return { listTypes: [{
|
|
@@ -2682,38 +2690,46 @@ var bn = (e, t) => {
|
|
|
2682
2690
|
Delete: ({ editor: e }) => {
|
|
2683
2691
|
let t = !1;
|
|
2684
2692
|
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
2685
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2693
|
+
e.state.schema.nodes[n] !== void 0 && jn(e, n) && (t = !0);
|
|
2686
2694
|
}), t;
|
|
2687
2695
|
},
|
|
2688
2696
|
"Mod-Delete": ({ editor: e }) => {
|
|
2689
2697
|
let t = !1;
|
|
2690
2698
|
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
2691
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2699
|
+
e.state.schema.nodes[n] !== void 0 && jn(e, n) && (t = !0);
|
|
2692
2700
|
}), t;
|
|
2693
2701
|
},
|
|
2694
2702
|
Backspace: ({ editor: e }) => {
|
|
2695
2703
|
let t = !1;
|
|
2696
2704
|
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
2697
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2705
|
+
e.state.schema.nodes[n] !== void 0 && On(e, n, r) && (t = !0);
|
|
2698
2706
|
}), t;
|
|
2699
2707
|
},
|
|
2700
2708
|
"Mod-Backspace": ({ editor: e }) => {
|
|
2701
2709
|
let t = !1;
|
|
2702
2710
|
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
2703
|
-
e.state.schema.nodes[n] !== void 0 &&
|
|
2711
|
+
e.state.schema.nodes[n] !== void 0 && On(e, n, r) && (t = !0);
|
|
2704
2712
|
}), t;
|
|
2705
2713
|
}
|
|
2706
2714
|
};
|
|
2707
2715
|
}
|
|
2708
|
-
}),
|
|
2709
|
-
|
|
2710
|
-
|
|
2716
|
+
}), In = RegExp(`^(\\s*)(${cn})([.)])\\s+(.*)$`), Ln = RegExp(`^(\\s*)(${cn})([.)])\\s+`), Rn = /^\s/, G = {
|
|
2717
|
+
heading: /^#{1,6}(?:\s|$)/,
|
|
2718
|
+
bulletItem: /^[-+*]\s+/,
|
|
2719
|
+
codeFence: /^(?:```|~~~)/,
|
|
2720
|
+
thematicBreak: /^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/
|
|
2721
|
+
};
|
|
2722
|
+
function zn(e) {
|
|
2723
|
+
return In.test(e.trimStart());
|
|
2711
2724
|
}
|
|
2712
|
-
function
|
|
2725
|
+
function Bn(e) {
|
|
2713
2726
|
let t = e.trimStart();
|
|
2714
|
-
return
|
|
2727
|
+
return G.bulletItem.test(t) || zn(t) || G.heading.test(t) || G.thematicBreak.test(t) && !t.startsWith("-") || /^>\s?/.test(t) || G.codeFence.test(t);
|
|
2715
2728
|
}
|
|
2716
|
-
function
|
|
2729
|
+
function Vn(e) {
|
|
2730
|
+
return Object.values(G).some((t) => t.test(e));
|
|
2731
|
+
}
|
|
2732
|
+
function Hn(e) {
|
|
2717
2733
|
let t = [], n = [], r = !1;
|
|
2718
2734
|
return e.forEach((e) => {
|
|
2719
2735
|
if (r) {
|
|
@@ -2724,7 +2740,7 @@ function In(e) {
|
|
|
2724
2740
|
r = !0, n.push(e);
|
|
2725
2741
|
return;
|
|
2726
2742
|
}
|
|
2727
|
-
if (t.length > 0 &&
|
|
2743
|
+
if (t.length > 0 && Bn(e)) {
|
|
2728
2744
|
r = !0, n.push(e);
|
|
2729
2745
|
return;
|
|
2730
2746
|
}
|
|
@@ -2734,21 +2750,21 @@ function In(e) {
|
|
|
2734
2750
|
blockLines: n
|
|
2735
2751
|
};
|
|
2736
2752
|
}
|
|
2737
|
-
function
|
|
2753
|
+
function Un(e) {
|
|
2738
2754
|
let t = [], n = 0, r = 0;
|
|
2739
2755
|
for (; n < e.length;) {
|
|
2740
|
-
let i = e[n], a = i.match(
|
|
2756
|
+
let i = e[n], a = i.match(In);
|
|
2741
2757
|
if (!a) break;
|
|
2742
|
-
let [, o, s, c, l] = a, u = o.length, d = parseInt(s, 10), f = isNaN(d) ?
|
|
2758
|
+
let [, o, s, c, l] = a, u = o.length, d = parseInt(s, 10), f = isNaN(d) ? hn(s) : void 0, p = isNaN(d) ? gn(s) : d, m = [l], h = n + 1, g = [i], _ = !1;
|
|
2743
2759
|
for (; h < e.length;) {
|
|
2744
2760
|
let t = e[h];
|
|
2745
|
-
if (t.match(
|
|
2761
|
+
if (t.match(In)) break;
|
|
2746
2762
|
if (t.trim() === "") g.push(t), m.push(""), _ = !0, h += 1;
|
|
2747
|
-
else if (t.match(
|
|
2763
|
+
else if (t.match(Rn)) {
|
|
2748
2764
|
let e = t.length - t.trimStart().length, n = u + s.length + 1;
|
|
2749
2765
|
g.push(t), m.push(t.slice(Math.min(e, n))), h += 1;
|
|
2750
2766
|
} else {
|
|
2751
|
-
if (_) break;
|
|
2767
|
+
if (_ || Vn(t)) break;
|
|
2752
2768
|
g.push(t), m.push(t), h += 1;
|
|
2753
2769
|
}
|
|
2754
2770
|
}
|
|
@@ -2763,22 +2779,22 @@ function Ln(e) {
|
|
|
2763
2779
|
}
|
|
2764
2780
|
return [t, r];
|
|
2765
2781
|
}
|
|
2766
|
-
var
|
|
2767
|
-
function
|
|
2782
|
+
var Wn = RegExp(`^(${cn})([.)])\\s+(.+)$`);
|
|
2783
|
+
function Gn(e) {
|
|
2768
2784
|
let t = e.split("\n").filter((e) => e.trim().length > 0);
|
|
2769
2785
|
if (t.length === 0) return null;
|
|
2770
2786
|
let n = [];
|
|
2771
2787
|
for (let e of t) {
|
|
2772
|
-
let t = e.trim().match(
|
|
2788
|
+
let t = e.trim().match(Wn);
|
|
2773
2789
|
if (!t) return null;
|
|
2774
2790
|
n.push({
|
|
2775
2791
|
marker: t[1],
|
|
2776
2792
|
content: t[3]
|
|
2777
2793
|
});
|
|
2778
2794
|
}
|
|
2779
|
-
return
|
|
2795
|
+
return vn(n.map((e) => e.marker)) ? {
|
|
2780
2796
|
type: "orderedList",
|
|
2781
|
-
attrs:
|
|
2797
|
+
attrs: bn(n[0].marker),
|
|
2782
2798
|
content: n.map((e) => ({
|
|
2783
2799
|
type: "listItem",
|
|
2784
2800
|
content: [{
|
|
@@ -2791,12 +2807,12 @@ function zn(e) {
|
|
|
2791
2807
|
}))
|
|
2792
2808
|
} : null;
|
|
2793
2809
|
}
|
|
2794
|
-
function
|
|
2810
|
+
function Kn(e, t, n) {
|
|
2795
2811
|
let r = [], i = 0;
|
|
2796
2812
|
for (; i < e.length;) {
|
|
2797
2813
|
let a = e[i];
|
|
2798
2814
|
if (a.indent === t) {
|
|
2799
|
-
let { paragraphLines: o, blockLines: s } =
|
|
2815
|
+
let { paragraphLines: o, blockLines: s } = Hn(a.contentLines), c = o.join("\n").trim(), l = [];
|
|
2800
2816
|
c && l.push({
|
|
2801
2817
|
type: "paragraph",
|
|
2802
2818
|
raw: c,
|
|
@@ -2810,7 +2826,7 @@ function Bn(e, t, n) {
|
|
|
2810
2826
|
let d = i + 1, f = [];
|
|
2811
2827
|
for (; d < e.length && e[d].indent > t;) f.push(e[d]), d += 1;
|
|
2812
2828
|
if (f.length > 0) {
|
|
2813
|
-
let e =
|
|
2829
|
+
let e = Kn(f, Math.min(...f.map((e) => e.indent)), n);
|
|
2814
2830
|
l.push({
|
|
2815
2831
|
type: "list",
|
|
2816
2832
|
ordered: !0,
|
|
@@ -2829,7 +2845,7 @@ function Bn(e, t, n) {
|
|
|
2829
2845
|
}
|
|
2830
2846
|
return r;
|
|
2831
2847
|
}
|
|
2832
|
-
function
|
|
2848
|
+
function qn(e, t) {
|
|
2833
2849
|
return e.map((e) => {
|
|
2834
2850
|
if (e.type !== "list_item") return t.parseChildren([e])[0];
|
|
2835
2851
|
let n = [];
|
|
@@ -2851,8 +2867,8 @@ function Vn(e, t) {
|
|
|
2851
2867
|
};
|
|
2852
2868
|
});
|
|
2853
2869
|
}
|
|
2854
|
-
var
|
|
2855
|
-
function
|
|
2870
|
+
var Jn = "listItem", Yn = "textStyle", Xn = /^(\d+)\.\s$/;
|
|
2871
|
+
function Zn(e) {
|
|
2856
2872
|
let t = e.match(/list-style-type\s*:\s*([^;]+)/i);
|
|
2857
2873
|
if (!t) return null;
|
|
2858
2874
|
switch (t[1].trim().toLowerCase()) {
|
|
@@ -2865,7 +2881,7 @@ function Gn(e) {
|
|
|
2865
2881
|
default: return null;
|
|
2866
2882
|
}
|
|
2867
2883
|
}
|
|
2868
|
-
var
|
|
2884
|
+
var Qn = x.create({
|
|
2869
2885
|
name: "orderedList",
|
|
2870
2886
|
addOptions() {
|
|
2871
2887
|
return {
|
|
@@ -2892,14 +2908,14 @@ var Kn = x.create({
|
|
|
2892
2908
|
if (t) return t;
|
|
2893
2909
|
let n = e.getAttribute("style");
|
|
2894
2910
|
if (n) {
|
|
2895
|
-
let e =
|
|
2911
|
+
let e = Zn(n);
|
|
2896
2912
|
if (e) return e;
|
|
2897
2913
|
}
|
|
2898
2914
|
let r = e.querySelector("li");
|
|
2899
2915
|
if (r) {
|
|
2900
2916
|
let e = r.getAttribute("style");
|
|
2901
2917
|
if (e) {
|
|
2902
|
-
let t =
|
|
2918
|
+
let t = Zn(e);
|
|
2903
2919
|
if (t) return t;
|
|
2904
2920
|
}
|
|
2905
2921
|
}
|
|
@@ -2922,7 +2938,7 @@ var Kn = x.create({
|
|
|
2922
2938
|
markdownTokenName: "list",
|
|
2923
2939
|
parseMarkdown: (e, t) => {
|
|
2924
2940
|
if (e.type !== "list" || !e.ordered) return [];
|
|
2925
|
-
let n = e.start || 1, r = e.typeMarker, i = e.items ?
|
|
2941
|
+
let n = e.start || 1, r = e.typeMarker, i = e.items ? qn(e.items, t) : [], a = {};
|
|
2926
2942
|
return n !== 1 && (a.start = n), r && (a.type = r), Object.keys(a).length > 0 ? {
|
|
2927
2943
|
type: "orderedList",
|
|
2928
2944
|
attrs: a,
|
|
@@ -2937,13 +2953,13 @@ var Kn = x.create({
|
|
|
2937
2953
|
name: "orderedList",
|
|
2938
2954
|
level: "block",
|
|
2939
2955
|
start: (e) => {
|
|
2940
|
-
let t = e.match(
|
|
2956
|
+
let t = e.match(Ln)?.index;
|
|
2941
2957
|
return t === void 0 ? -1 : t;
|
|
2942
2958
|
},
|
|
2943
2959
|
tokenize: (e, t, n) => {
|
|
2944
|
-
let r = e.split("\n"), [i, a] =
|
|
2960
|
+
let r = e.split("\n"), [i, a] = Un(r);
|
|
2945
2961
|
if (i.length === 0) return;
|
|
2946
|
-
let o =
|
|
2962
|
+
let o = Kn(i, i[0].indent, n);
|
|
2947
2963
|
if (o.length !== 0) return {
|
|
2948
2964
|
type: "list",
|
|
2949
2965
|
ordered: !0,
|
|
@@ -2956,7 +2972,7 @@ var Kn = x.create({
|
|
|
2956
2972
|
},
|
|
2957
2973
|
markdownOptions: { indentsContent: !0 },
|
|
2958
2974
|
addCommands() {
|
|
2959
|
-
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(
|
|
2975
|
+
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Jn, this.editor.getAttributes(Yn)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
2960
2976
|
},
|
|
2961
2977
|
addKeyboardShortcuts() {
|
|
2962
2978
|
return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
|
|
@@ -2966,7 +2982,7 @@ var Kn = x.create({
|
|
|
2966
2982
|
if ((t.clipboardData?.getData("text/html"))?.trim()) return !1;
|
|
2967
2983
|
let n = t.clipboardData?.getData("text/plain");
|
|
2968
2984
|
if (!n) return !1;
|
|
2969
|
-
let r =
|
|
2985
|
+
let r = Gn(n);
|
|
2970
2986
|
if (!r) return !1;
|
|
2971
2987
|
try {
|
|
2972
2988
|
let t = e.state.schema.nodeFromJSON(r), n = e.state.tr.replaceSelectionWith(t);
|
|
@@ -2978,25 +2994,25 @@ var Kn = x.create({
|
|
|
2978
2994
|
},
|
|
2979
2995
|
addInputRules() {
|
|
2980
2996
|
let e = (e, t) => (!t.attrs.type || t.attrs.type === "1") && t.childCount + t.attrs.start === +e[1], t = v({
|
|
2981
|
-
find:
|
|
2997
|
+
find: Xn,
|
|
2982
2998
|
type: this.type,
|
|
2983
2999
|
getAttributes: (e) => ({ start: +e[1] }),
|
|
2984
3000
|
joinPredicate: e
|
|
2985
3001
|
});
|
|
2986
3002
|
return (this.options.keepMarks || this.options.keepAttributes) && (t = v({
|
|
2987
|
-
find:
|
|
3003
|
+
find: Xn,
|
|
2988
3004
|
type: this.type,
|
|
2989
3005
|
keepMarks: this.options.keepMarks,
|
|
2990
3006
|
keepAttributes: this.options.keepAttributes,
|
|
2991
3007
|
getAttributes: (e) => ({
|
|
2992
3008
|
start: +e[1],
|
|
2993
|
-
...this.editor.getAttributes(
|
|
3009
|
+
...this.editor.getAttributes(Yn)
|
|
2994
3010
|
}),
|
|
2995
3011
|
joinPredicate: e,
|
|
2996
3012
|
editor: this.editor
|
|
2997
3013
|
})), [t];
|
|
2998
3014
|
}
|
|
2999
|
-
}),
|
|
3015
|
+
}), $n = /^\s*(\[([( |x])?\])\s$/, er = x.create({
|
|
3000
3016
|
name: "taskItem",
|
|
3001
3017
|
addOptions() {
|
|
3002
3018
|
return {
|
|
@@ -3050,9 +3066,9 @@ var Kn = x.create({
|
|
|
3050
3066
|
}
|
|
3051
3067
|
return t.createNode("taskItem", { checked: e.checked || !1 }, n);
|
|
3052
3068
|
},
|
|
3053
|
-
renderMarkdown: (e, t) =>
|
|
3069
|
+
renderMarkdown: (e, t) => ne(e, t, `- [${e.attrs?.checked ? "x" : " "}] `),
|
|
3054
3070
|
addExtensions() {
|
|
3055
|
-
return this.options.nested ? [
|
|
3071
|
+
return this.options.nested ? [on(this.name, [this.options.taskListTypeName])] : [];
|
|
3056
3072
|
},
|
|
3057
3073
|
addKeyboardShortcuts() {
|
|
3058
3074
|
let e = {
|
|
@@ -3097,7 +3113,7 @@ var Kn = x.create({
|
|
|
3097
3113
|
update: (e) => {
|
|
3098
3114
|
if (e.type !== this.type) return !1;
|
|
3099
3115
|
i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, l(e);
|
|
3100
|
-
let t = r.extensionManager.attributes, n =
|
|
3116
|
+
let t = r.extensionManager.attributes, n = ae(e, t), a = new Set(Object.keys(n)), o = this.options.HTMLAttributes;
|
|
3101
3117
|
return u.forEach((e) => {
|
|
3102
3118
|
a.has(e) || (e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e));
|
|
3103
3119
|
}), Object.entries(n).forEach(([e, t]) => {
|
|
@@ -3109,12 +3125,12 @@ var Kn = x.create({
|
|
|
3109
3125
|
},
|
|
3110
3126
|
addInputRules() {
|
|
3111
3127
|
return [v({
|
|
3112
|
-
find:
|
|
3128
|
+
find: $n,
|
|
3113
3129
|
type: this.type,
|
|
3114
3130
|
getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
|
|
3115
3131
|
})];
|
|
3116
3132
|
}
|
|
3117
|
-
}),
|
|
3133
|
+
}), tr = x.create({
|
|
3118
3134
|
name: "taskList",
|
|
3119
3135
|
addOptions() {
|
|
3120
3136
|
return {
|
|
@@ -3150,7 +3166,7 @@ var Kn = x.create({
|
|
|
3150
3166
|
},
|
|
3151
3167
|
tokenize(e, t, n) {
|
|
3152
3168
|
let r = (e) => {
|
|
3153
|
-
let t =
|
|
3169
|
+
let t = te(e, {
|
|
3154
3170
|
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
3155
3171
|
extractItemData: (e) => ({
|
|
3156
3172
|
indentLevel: e[1].length,
|
|
@@ -3174,7 +3190,7 @@ var Kn = x.create({
|
|
|
3174
3190
|
raw: t.raw,
|
|
3175
3191
|
items: t.items
|
|
3176
3192
|
}] : n.blockTokens(e);
|
|
3177
|
-
}, i =
|
|
3193
|
+
}, i = te(e, {
|
|
3178
3194
|
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
3179
3195
|
extractItemData: (e) => ({
|
|
3180
3196
|
indentLevel: e[1].length,
|
|
@@ -3212,12 +3228,12 @@ y.create({
|
|
|
3212
3228
|
name: "listKit",
|
|
3213
3229
|
addExtensions() {
|
|
3214
3230
|
let e = [];
|
|
3215
|
-
return this.options.bulletList !== !1 && e.push(
|
|
3231
|
+
return this.options.bulletList !== !1 && e.push(tn.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(wn.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Fn.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Qn.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(er.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(tr.configure(this.options.taskList)), e;
|
|
3216
3232
|
}
|
|
3217
3233
|
});
|
|
3218
3234
|
//#endregion
|
|
3219
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.27.
|
|
3220
|
-
var
|
|
3235
|
+
//#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.27.3_@tiptap+core@3.27.3_@tiptap+pm@3.27.3_/node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
3236
|
+
var nr = " ", rr = "\xA0", ir = x.create({
|
|
3221
3237
|
name: "paragraph",
|
|
3222
3238
|
priority: 1e3,
|
|
3223
3239
|
addOptions() {
|
|
@@ -3239,14 +3255,14 @@ var Xn = " ", Zn = "\xA0", Qn = x.create({
|
|
|
3239
3255
|
let n = e.tokens || [];
|
|
3240
3256
|
if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
|
|
3241
3257
|
let r = t.parseInline(n);
|
|
3242
|
-
return n.length === 1 && n[0].type === "text" && (n[0].raw ===
|
|
3258
|
+
return n.length === 1 && n[0].type === "text" && (n[0].raw === nr || n[0].text === nr || n[0].raw === rr || n[0].text === rr) && r.length === 1 && r[0].type === "text" && (r[0].text === nr || r[0].text === rr) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
|
|
3243
3259
|
},
|
|
3244
3260
|
renderMarkdown: (e, t, n) => {
|
|
3245
3261
|
if (!e) return "";
|
|
3246
3262
|
let r = Array.isArray(e.content) ? e.content : [];
|
|
3247
3263
|
if (r.length === 0) {
|
|
3248
3264
|
let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
|
|
3249
|
-
return n?.previousNode?.type === "paragraph" && e.length === 0 ?
|
|
3265
|
+
return n?.previousNode?.type === "paragraph" && e.length === 0 ? nr : "";
|
|
3250
3266
|
}
|
|
3251
3267
|
return t.renderChildren(r);
|
|
3252
3268
|
},
|
|
@@ -3256,7 +3272,7 @@ var Xn = " ", Zn = "\xA0", Qn = x.create({
|
|
|
3256
3272
|
addKeyboardShortcuts() {
|
|
3257
3273
|
return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
|
|
3258
3274
|
}
|
|
3259
|
-
}),
|
|
3275
|
+
}), ar = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, or = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, sr = ee.create({
|
|
3260
3276
|
name: "strike",
|
|
3261
3277
|
addOptions() {
|
|
3262
3278
|
return { HTMLAttributes: {} };
|
|
@@ -3295,17 +3311,17 @@ var Xn = " ", Zn = "\xA0", Qn = x.create({
|
|
|
3295
3311
|
},
|
|
3296
3312
|
addInputRules() {
|
|
3297
3313
|
return [u({
|
|
3298
|
-
find:
|
|
3314
|
+
find: ar,
|
|
3299
3315
|
type: this.type
|
|
3300
3316
|
})];
|
|
3301
3317
|
},
|
|
3302
3318
|
addPasteRules() {
|
|
3303
3319
|
return [d({
|
|
3304
|
-
find:
|
|
3320
|
+
find: or,
|
|
3305
3321
|
type: this.type
|
|
3306
3322
|
})];
|
|
3307
3323
|
}
|
|
3308
|
-
}),
|
|
3324
|
+
}), cr = x.create({
|
|
3309
3325
|
name: "text",
|
|
3310
3326
|
group: "inline",
|
|
3311
3327
|
parseMarkdown: (e) => ({
|
|
@@ -3316,12 +3332,12 @@ var Xn = " ", Zn = "\xA0", Qn = x.create({
|
|
|
3316
3332
|
});
|
|
3317
3333
|
//#endregion
|
|
3318
3334
|
//#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
|
|
3319
|
-
function
|
|
3335
|
+
function lr(e = {}) {
|
|
3320
3336
|
return new w({ view(t) {
|
|
3321
|
-
return new
|
|
3337
|
+
return new ur(t, e);
|
|
3322
3338
|
} });
|
|
3323
3339
|
}
|
|
3324
|
-
var
|
|
3340
|
+
var ur = class {
|
|
3325
3341
|
constructor(e, t) {
|
|
3326
3342
|
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 = [
|
|
3327
3343
|
"dragover",
|
|
@@ -3412,7 +3428,7 @@ var ir = class {
|
|
|
3412
3428
|
dragleave(e) {
|
|
3413
3429
|
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
3414
3430
|
}
|
|
3415
|
-
},
|
|
3431
|
+
}, K = class t extends e {
|
|
3416
3432
|
constructor(e) {
|
|
3417
3433
|
super(e, e);
|
|
3418
3434
|
}
|
|
@@ -3437,11 +3453,11 @@ var ir = class {
|
|
|
3437
3453
|
return new t(e.resolve(n.pos));
|
|
3438
3454
|
}
|
|
3439
3455
|
getBookmark() {
|
|
3440
|
-
return new
|
|
3456
|
+
return new dr(this.anchor);
|
|
3441
3457
|
}
|
|
3442
3458
|
static valid(e) {
|
|
3443
3459
|
let t = e.parent;
|
|
3444
|
-
if (t.inlineContent || !
|
|
3460
|
+
if (t.inlineContent || !pr(e) || !mr(e)) return !1;
|
|
3445
3461
|
let n = t.type.spec.allowGapCursor;
|
|
3446
3462
|
if (n != null) return n;
|
|
3447
3463
|
let r = t.contentMatchAt(e.index()).defaultType;
|
|
@@ -3464,7 +3480,7 @@ var ir = class {
|
|
|
3464
3480
|
for (;;) {
|
|
3465
3481
|
let o = n > 0 ? a.firstChild : a.lastChild;
|
|
3466
3482
|
if (!o) {
|
|
3467
|
-
if (a.isAtom && !a.isText && !
|
|
3483
|
+
if (a.isAtom && !a.isText && !_.isSelectable(a)) {
|
|
3468
3484
|
e = e.doc.resolve(i + a.nodeSize * n), r = !1;
|
|
3469
3485
|
continue search;
|
|
3470
3486
|
}
|
|
@@ -3478,8 +3494,8 @@ var ir = class {
|
|
|
3478
3494
|
}
|
|
3479
3495
|
}
|
|
3480
3496
|
};
|
|
3481
|
-
|
|
3482
|
-
var
|
|
3497
|
+
K.prototype.visible = !1, K.findFrom = K.findGapCursorFrom, e.jsonID("gapcursor", K);
|
|
3498
|
+
var dr = class t {
|
|
3483
3499
|
constructor(e) {
|
|
3484
3500
|
this.pos = e;
|
|
3485
3501
|
}
|
|
@@ -3488,13 +3504,13 @@ var ar = class t {
|
|
|
3488
3504
|
}
|
|
3489
3505
|
resolve(t) {
|
|
3490
3506
|
let n = t.resolve(this.pos);
|
|
3491
|
-
return
|
|
3507
|
+
return K.valid(n) ? new K(n) : e.near(n);
|
|
3492
3508
|
}
|
|
3493
3509
|
};
|
|
3494
|
-
function
|
|
3510
|
+
function fr(e) {
|
|
3495
3511
|
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
3496
3512
|
}
|
|
3497
|
-
function
|
|
3513
|
+
function pr(e) {
|
|
3498
3514
|
for (let t = e.depth; t >= 0; t--) {
|
|
3499
3515
|
let n = e.index(t), r = e.node(t);
|
|
3500
3516
|
if (n == 0) {
|
|
@@ -3502,13 +3518,13 @@ function sr(e) {
|
|
|
3502
3518
|
continue;
|
|
3503
3519
|
}
|
|
3504
3520
|
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
3505
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
3521
|
+
if (e.childCount == 0 && !e.inlineContent || fr(e.type)) return !0;
|
|
3506
3522
|
if (e.inlineContent) return !1;
|
|
3507
3523
|
}
|
|
3508
3524
|
}
|
|
3509
3525
|
return !0;
|
|
3510
3526
|
}
|
|
3511
|
-
function
|
|
3527
|
+
function mr(e) {
|
|
3512
3528
|
for (let t = e.depth; t >= 0; t--) {
|
|
3513
3529
|
let n = e.indexAfter(t), r = e.node(t);
|
|
3514
3530
|
if (n == r.childCount) {
|
|
@@ -3516,30 +3532,30 @@ function cr(e) {
|
|
|
3516
3532
|
continue;
|
|
3517
3533
|
}
|
|
3518
3534
|
for (let e = r.child(n);; e = e.firstChild) {
|
|
3519
|
-
if (e.childCount == 0 && !e.inlineContent ||
|
|
3535
|
+
if (e.childCount == 0 && !e.inlineContent || fr(e.type)) return !0;
|
|
3520
3536
|
if (e.inlineContent) return !1;
|
|
3521
3537
|
}
|
|
3522
3538
|
}
|
|
3523
3539
|
return !0;
|
|
3524
3540
|
}
|
|
3525
|
-
function
|
|
3541
|
+
function hr() {
|
|
3526
3542
|
return new w({ props: {
|
|
3527
|
-
decorations:
|
|
3543
|
+
decorations: br,
|
|
3528
3544
|
createSelectionBetween(e, t, n) {
|
|
3529
|
-
return t.pos == n.pos &&
|
|
3545
|
+
return t.pos == n.pos && K.valid(n) ? new K(n) : null;
|
|
3530
3546
|
},
|
|
3531
|
-
handleClick:
|
|
3532
|
-
handleKeyDown:
|
|
3533
|
-
handleDOMEvents: { beforeinput:
|
|
3547
|
+
handleClick: vr,
|
|
3548
|
+
handleKeyDown: gr,
|
|
3549
|
+
handleDOMEvents: { beforeinput: yr }
|
|
3534
3550
|
} });
|
|
3535
3551
|
}
|
|
3536
|
-
var
|
|
3537
|
-
ArrowLeft:
|
|
3538
|
-
ArrowRight:
|
|
3539
|
-
ArrowUp:
|
|
3540
|
-
ArrowDown:
|
|
3552
|
+
var gr = h({
|
|
3553
|
+
ArrowLeft: _r("horiz", -1),
|
|
3554
|
+
ArrowRight: _r("horiz", 1),
|
|
3555
|
+
ArrowUp: _r("vert", -1),
|
|
3556
|
+
ArrowDown: _r("vert", 1)
|
|
3541
3557
|
});
|
|
3542
|
-
function
|
|
3558
|
+
function _r(e, t) {
|
|
3543
3559
|
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
3544
3560
|
return function(e, r, i) {
|
|
3545
3561
|
let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
|
|
@@ -3547,22 +3563,22 @@ function dr(e, t) {
|
|
|
3547
3563
|
if (!i.endOfTextblock(n) || o.depth == 0) return !1;
|
|
3548
3564
|
s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
|
|
3549
3565
|
}
|
|
3550
|
-
let c =
|
|
3551
|
-
return c ? (r && r(e.tr.setSelection(new
|
|
3566
|
+
let c = K.findGapCursorFrom(o, t, s);
|
|
3567
|
+
return c ? (r && r(e.tr.setSelection(new K(c))), !0) : !1;
|
|
3552
3568
|
};
|
|
3553
3569
|
}
|
|
3554
|
-
function
|
|
3570
|
+
function vr(e, t, n) {
|
|
3555
3571
|
if (!e || !e.editable) return !1;
|
|
3556
3572
|
let r = e.state.doc.resolve(t);
|
|
3557
|
-
if (!
|
|
3573
|
+
if (!K.valid(r)) return !1;
|
|
3558
3574
|
let i = e.posAtCoords({
|
|
3559
3575
|
left: n.clientX,
|
|
3560
3576
|
top: n.clientY
|
|
3561
3577
|
});
|
|
3562
|
-
return i && i.inside > -1 &&
|
|
3578
|
+
return i && i.inside > -1 && _.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new K(r))), !0);
|
|
3563
3579
|
}
|
|
3564
|
-
function
|
|
3565
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof
|
|
3580
|
+
function yr(e, t) {
|
|
3581
|
+
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof K)) return !1;
|
|
3566
3582
|
let { $from: r } = e.state.selection, i = r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);
|
|
3567
3583
|
if (!i) return !1;
|
|
3568
3584
|
let a = n.empty;
|
|
@@ -3570,36 +3586,36 @@ function pr(e, t) {
|
|
|
3570
3586
|
let s = e.state.tr.replace(r.pos, r.pos, new o(a, 0, 0));
|
|
3571
3587
|
return s.setSelection(C.near(s.doc.resolve(r.pos + 1))), e.dispatch(s), !1;
|
|
3572
3588
|
}
|
|
3573
|
-
function
|
|
3574
|
-
if (!(e.selection instanceof
|
|
3589
|
+
function br(e) {
|
|
3590
|
+
if (!(e.selection instanceof K)) return null;
|
|
3575
3591
|
let t = document.createElement("div");
|
|
3576
3592
|
return t.className = "ProseMirror-gapcursor", T.create(e.doc, [S.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
3577
3593
|
}
|
|
3578
3594
|
//#endregion
|
|
3579
3595
|
//#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
|
|
3580
|
-
var
|
|
3581
|
-
|
|
3582
|
-
return e.length ? (e =
|
|
3583
|
-
},
|
|
3584
|
-
return e.length ?
|
|
3585
|
-
},
|
|
3586
|
-
return new
|
|
3587
|
-
},
|
|
3588
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ?
|
|
3589
|
-
},
|
|
3596
|
+
var xr = 200, q = function() {};
|
|
3597
|
+
q.prototype.append = function(e) {
|
|
3598
|
+
return e.length ? (e = q.from(e), !this.length && e || e.length < xr && this.leafAppend(e) || this.length < xr && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
3599
|
+
}, q.prototype.prepend = function(e) {
|
|
3600
|
+
return e.length ? q.from(e).append(this) : this;
|
|
3601
|
+
}, q.prototype.appendInner = function(e) {
|
|
3602
|
+
return new Cr(this, e);
|
|
3603
|
+
}, q.prototype.slice = function(e, t) {
|
|
3604
|
+
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? q.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
3605
|
+
}, q.prototype.get = function(e) {
|
|
3590
3606
|
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
3591
|
-
},
|
|
3607
|
+
}, q.prototype.forEach = function(e, t, n) {
|
|
3592
3608
|
t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
|
|
3593
|
-
},
|
|
3609
|
+
}, q.prototype.map = function(e, t, n) {
|
|
3594
3610
|
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
3595
3611
|
var r = [];
|
|
3596
3612
|
return this.forEach(function(t, n) {
|
|
3597
3613
|
return r.push(e(t, n));
|
|
3598
3614
|
}, t, n), r;
|
|
3599
|
-
},
|
|
3600
|
-
return e instanceof
|
|
3615
|
+
}, q.from = function(e) {
|
|
3616
|
+
return e instanceof q ? e : e && e.length ? new Sr(e) : q.empty;
|
|
3601
3617
|
};
|
|
3602
|
-
var
|
|
3618
|
+
var Sr = /* @__PURE__ */ function(e) {
|
|
3603
3619
|
function t(t) {
|
|
3604
3620
|
e.call(this), this.values = t;
|
|
3605
3621
|
}
|
|
@@ -3619,17 +3635,17 @@ var gr = /* @__PURE__ */ function(e) {
|
|
|
3619
3635
|
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
3620
3636
|
for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
|
|
3621
3637
|
}, t.prototype.leafAppend = function(e) {
|
|
3622
|
-
if (this.length + e.length <=
|
|
3638
|
+
if (this.length + e.length <= xr) return new t(this.values.concat(e.flatten()));
|
|
3623
3639
|
}, t.prototype.leafPrepend = function(e) {
|
|
3624
|
-
if (this.length + e.length <=
|
|
3640
|
+
if (this.length + e.length <= xr) return new t(e.flatten().concat(this.values));
|
|
3625
3641
|
}, n.length.get = function() {
|
|
3626
3642
|
return this.values.length;
|
|
3627
3643
|
}, n.depth.get = function() {
|
|
3628
3644
|
return 0;
|
|
3629
3645
|
}, Object.defineProperties(t.prototype, n), t;
|
|
3630
|
-
}(
|
|
3631
|
-
|
|
3632
|
-
var
|
|
3646
|
+
}(q);
|
|
3647
|
+
q.empty = new Sr([]);
|
|
3648
|
+
var Cr = /* @__PURE__ */ function(e) {
|
|
3633
3649
|
function t(t, n) {
|
|
3634
3650
|
e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
3635
3651
|
}
|
|
@@ -3656,7 +3672,7 @@ var _r = /* @__PURE__ */ function(e) {
|
|
|
3656
3672
|
}, t.prototype.appendInner = function(e) {
|
|
3657
3673
|
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);
|
|
3658
3674
|
}, t;
|
|
3659
|
-
}(
|
|
3675
|
+
}(q), wr = 500, J = class e {
|
|
3660
3676
|
constructor(e, t) {
|
|
3661
3677
|
this.items = e, this.eventCount = t;
|
|
3662
3678
|
}
|
|
@@ -3676,9 +3692,9 @@ var _r = /* @__PURE__ */ function(e) {
|
|
|
3676
3692
|
return;
|
|
3677
3693
|
}
|
|
3678
3694
|
if (i) {
|
|
3679
|
-
u.push(new
|
|
3695
|
+
u.push(new Y(t.map));
|
|
3680
3696
|
let e = t.step.map(i.slice(a)), n;
|
|
3681
|
-
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new
|
|
3697
|
+
e && o.maybeStep(e).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new Y(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
|
|
3682
3698
|
} else o.maybeStep(t.step);
|
|
3683
3699
|
if (t.selection) return s = i ? t.selection.map(i.slice(a)) : t.selection, c = new e(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
|
|
3684
3700
|
}, this.items.length, 0), {
|
|
@@ -3690,11 +3706,11 @@ var _r = /* @__PURE__ */ function(e) {
|
|
|
3690
3706
|
addTransform(t, n, r, i) {
|
|
3691
3707
|
let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
|
|
3692
3708
|
for (let e = 0; e < t.steps.length; e++) {
|
|
3693
|
-
let r = t.steps[e].invert(t.docs[e]), l = new
|
|
3709
|
+
let r = t.steps[e].invert(t.docs[e]), l = new Y(t.mapping.maps[e], r, n), u;
|
|
3694
3710
|
(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);
|
|
3695
3711
|
}
|
|
3696
3712
|
let l = o - r.depth;
|
|
3697
|
-
return l >
|
|
3713
|
+
return l > Er && (s = Tr(s, l), o -= l), new e(s.append(a), o);
|
|
3698
3714
|
}
|
|
3699
3715
|
remapping(e, t) {
|
|
3700
3716
|
let n = new l();
|
|
@@ -3704,7 +3720,7 @@ var _r = /* @__PURE__ */ function(e) {
|
|
|
3704
3720
|
}, e, t), n;
|
|
3705
3721
|
}
|
|
3706
3722
|
addMaps(t) {
|
|
3707
|
-
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new
|
|
3723
|
+
return this.eventCount == 0 ? this : new e(this.items.append(t.map((e) => new Y(e))), this.eventCount);
|
|
3708
3724
|
}
|
|
3709
3725
|
rebased(t, n) {
|
|
3710
3726
|
if (!this.eventCount) return this;
|
|
@@ -3720,13 +3736,13 @@ var _r = /* @__PURE__ */ function(e) {
|
|
|
3720
3736
|
let i = a.maps[n];
|
|
3721
3737
|
if (e.step) {
|
|
3722
3738
|
let o = t.steps[n].invert(t.docs[n]), l = e.selection && e.selection.map(a.slice(c + 1, n));
|
|
3723
|
-
l && s++, r.push(new
|
|
3724
|
-
} else r.push(new
|
|
3739
|
+
l && s++, r.push(new Y(i, o, l));
|
|
3740
|
+
} else r.push(new Y(i));
|
|
3725
3741
|
}, i);
|
|
3726
3742
|
let l = [];
|
|
3727
|
-
for (let e = n; e < o; e++) l.push(new
|
|
3728
|
-
let u =
|
|
3729
|
-
return
|
|
3743
|
+
for (let e = n; e < o; e++) l.push(new Y(a.maps[e]));
|
|
3744
|
+
let u = this.items.slice(0, i).append(l).append(r), d = new e(u, s);
|
|
3745
|
+
return d.emptyItemCount() > wr && (d = d.compress(this.items.length - r.length)), d;
|
|
3730
3746
|
}
|
|
3731
3747
|
emptyItemCount() {
|
|
3732
3748
|
let e = 0;
|
|
@@ -3743,21 +3759,21 @@ var _r = /* @__PURE__ */ function(e) {
|
|
|
3743
3759
|
if (r--, o && n.appendMap(o, r), t) {
|
|
3744
3760
|
let s = e.selection && e.selection.map(n.slice(r));
|
|
3745
3761
|
s && a++;
|
|
3746
|
-
let c = new
|
|
3762
|
+
let c = new Y(o.invert(), t, s), l, u = i.length - 1;
|
|
3747
3763
|
(l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
|
|
3748
3764
|
}
|
|
3749
3765
|
} else e.map && r--;
|
|
3750
|
-
}, this.items.length, 0), new e(
|
|
3766
|
+
}, this.items.length, 0), new e(q.from(i.reverse()), a);
|
|
3751
3767
|
}
|
|
3752
3768
|
};
|
|
3753
|
-
|
|
3754
|
-
function
|
|
3769
|
+
J.empty = new J(q.empty, 0);
|
|
3770
|
+
function Tr(e, t) {
|
|
3755
3771
|
let n;
|
|
3756
3772
|
return e.forEach((e, r) => {
|
|
3757
3773
|
if (e.selection && t-- == 0) return n = r, !1;
|
|
3758
3774
|
}), e.slice(n);
|
|
3759
3775
|
}
|
|
3760
|
-
var
|
|
3776
|
+
var Y = class e {
|
|
3761
3777
|
constructor(e, t, n, r) {
|
|
3762
3778
|
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
|
|
3763
3779
|
}
|
|
@@ -3767,25 +3783,25 @@ var X = class e {
|
|
|
3767
3783
|
if (n) return new e(n.getMap().invert(), n, this.selection);
|
|
3768
3784
|
}
|
|
3769
3785
|
}
|
|
3770
|
-
},
|
|
3786
|
+
}, X = class {
|
|
3771
3787
|
constructor(e, t, n, r, i) {
|
|
3772
3788
|
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
|
|
3773
3789
|
}
|
|
3774
|
-
},
|
|
3775
|
-
function
|
|
3776
|
-
let i = n.getMeta(
|
|
3790
|
+
}, Er = 20;
|
|
3791
|
+
function Dr(e, t, n, r) {
|
|
3792
|
+
let i = n.getMeta(Z), a;
|
|
3777
3793
|
if (i) return i.historyState;
|
|
3778
|
-
n.getMeta(
|
|
3794
|
+
n.getMeta(Fr) && (e = new X(e.done, e.undone, null, 0, -1));
|
|
3779
3795
|
let o = n.getMeta("appendedTransaction");
|
|
3780
3796
|
if (n.steps.length == 0) return e;
|
|
3781
|
-
if (o && o.getMeta(
|
|
3797
|
+
if (o && o.getMeta(Z)) return o.getMeta(Z).redo ? new X(e.done.addTransform(n, void 0, r, Pr(t)), e.undone, kr(n.mapping.maps), e.prevTime, e.prevComposition) : new X(e.done, e.undone.addTransform(n, void 0, r, Pr(t)), null, e.prevTime, e.prevComposition);
|
|
3782
3798
|
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
3783
|
-
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !
|
|
3784
|
-
return new
|
|
3785
|
-
} else if (a = n.getMeta("rebased")) return new
|
|
3786
|
-
else return new
|
|
3799
|
+
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !Or(n, e.prevRanges)), s = o ? Ar(e.prevRanges, n.mapping) : kr(n.mapping.maps);
|
|
3800
|
+
return new X(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, Pr(t)), J.empty, s, n.time, i ?? e.prevComposition);
|
|
3801
|
+
} else if (a = n.getMeta("rebased")) return new X(e.done.rebased(n, a), e.undone.rebased(n, a), Ar(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
3802
|
+
else return new X(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), Ar(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
3787
3803
|
}
|
|
3788
|
-
function
|
|
3804
|
+
function Or(e, t) {
|
|
3789
3805
|
if (!t) return !1;
|
|
3790
3806
|
if (!e.docChanged) return !0;
|
|
3791
3807
|
let n = !1;
|
|
@@ -3793,12 +3809,12 @@ function Sr(e, t) {
|
|
|
3793
3809
|
for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
|
|
3794
3810
|
}), n;
|
|
3795
3811
|
}
|
|
3796
|
-
function
|
|
3812
|
+
function kr(e) {
|
|
3797
3813
|
let t = [];
|
|
3798
3814
|
for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
|
|
3799
3815
|
return t;
|
|
3800
3816
|
}
|
|
3801
|
-
function
|
|
3817
|
+
function Ar(e, t) {
|
|
3802
3818
|
if (!e) return null;
|
|
3803
3819
|
let n = [];
|
|
3804
3820
|
for (let r = 0; r < e.length; r += 2) {
|
|
@@ -3807,61 +3823,61 @@ function wr(e, t) {
|
|
|
3807
3823
|
}
|
|
3808
3824
|
return n;
|
|
3809
3825
|
}
|
|
3810
|
-
function
|
|
3811
|
-
let r =
|
|
3826
|
+
function jr(e, t, n) {
|
|
3827
|
+
let r = Pr(t), i = Z.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
3812
3828
|
if (!a) return null;
|
|
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
|
|
3814
|
-
return a.transform.setSelection(o).setMeta(
|
|
3829
|
+
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new X(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
3830
|
+
return a.transform.setSelection(o).setMeta(Z, {
|
|
3815
3831
|
redo: n,
|
|
3816
3832
|
historyState: c
|
|
3817
3833
|
});
|
|
3818
3834
|
}
|
|
3819
|
-
var
|
|
3820
|
-
function
|
|
3835
|
+
var Mr = !1, Nr = null;
|
|
3836
|
+
function Pr(e) {
|
|
3821
3837
|
let t = e.plugins;
|
|
3822
|
-
if (
|
|
3823
|
-
|
|
3838
|
+
if (Nr != t) {
|
|
3839
|
+
Mr = !1, Nr = t;
|
|
3824
3840
|
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
3825
|
-
|
|
3841
|
+
Mr = !0;
|
|
3826
3842
|
break;
|
|
3827
3843
|
}
|
|
3828
3844
|
}
|
|
3829
|
-
return
|
|
3845
|
+
return Mr;
|
|
3830
3846
|
}
|
|
3831
|
-
var
|
|
3832
|
-
function
|
|
3847
|
+
var Z = new c("history"), Fr = new c("closeHistory");
|
|
3848
|
+
function Ir(e = {}) {
|
|
3833
3849
|
return e = {
|
|
3834
3850
|
depth: e.depth || 100,
|
|
3835
3851
|
newGroupDelay: e.newGroupDelay || 500
|
|
3836
3852
|
}, new w({
|
|
3837
|
-
key:
|
|
3853
|
+
key: Z,
|
|
3838
3854
|
state: {
|
|
3839
3855
|
init() {
|
|
3840
|
-
return new
|
|
3856
|
+
return new X(J.empty, J.empty, null, 0, -1);
|
|
3841
3857
|
},
|
|
3842
3858
|
apply(t, n, r) {
|
|
3843
|
-
return
|
|
3859
|
+
return Dr(n, r, t, e);
|
|
3844
3860
|
}
|
|
3845
3861
|
},
|
|
3846
3862
|
config: e,
|
|
3847
3863
|
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
3848
|
-
let n = t.inputType, r = n == "historyUndo" ?
|
|
3864
|
+
let n = t.inputType, r = n == "historyUndo" ? Rr : n == "historyRedo" ? zr : null;
|
|
3849
3865
|
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
3850
3866
|
} } }
|
|
3851
3867
|
});
|
|
3852
3868
|
}
|
|
3853
|
-
function
|
|
3869
|
+
function Lr(e, t) {
|
|
3854
3870
|
return (n, r) => {
|
|
3855
|
-
let i =
|
|
3871
|
+
let i = Z.getState(n);
|
|
3856
3872
|
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
3857
3873
|
if (r) {
|
|
3858
|
-
let a =
|
|
3874
|
+
let a = jr(i, n, e);
|
|
3859
3875
|
a && r(t ? a.scrollIntoView() : a);
|
|
3860
3876
|
}
|
|
3861
3877
|
return !0;
|
|
3862
3878
|
};
|
|
3863
3879
|
}
|
|
3864
|
-
var
|
|
3880
|
+
var Rr = Lr(!1, !0), zr = Lr(!0, !0);
|
|
3865
3881
|
y.create({
|
|
3866
3882
|
name: "characterCount",
|
|
3867
3883
|
addOptions() {
|
|
@@ -3924,7 +3940,7 @@ y.create({
|
|
|
3924
3940
|
})];
|
|
3925
3941
|
}
|
|
3926
3942
|
});
|
|
3927
|
-
var
|
|
3943
|
+
var Br = y.create({
|
|
3928
3944
|
name: "dropCursor",
|
|
3929
3945
|
addOptions() {
|
|
3930
3946
|
return {
|
|
@@ -3934,7 +3950,7 @@ var Pr = y.create({
|
|
|
3934
3950
|
};
|
|
3935
3951
|
},
|
|
3936
3952
|
addProseMirrorPlugins() {
|
|
3937
|
-
return [
|
|
3953
|
+
return [lr(this.options)];
|
|
3938
3954
|
}
|
|
3939
3955
|
});
|
|
3940
3956
|
y.create({
|
|
@@ -3968,20 +3984,20 @@ y.create({
|
|
|
3968
3984
|
})];
|
|
3969
3985
|
}
|
|
3970
3986
|
});
|
|
3971
|
-
var
|
|
3987
|
+
var Vr = y.create({
|
|
3972
3988
|
name: "gapCursor",
|
|
3973
3989
|
addProseMirrorPlugins() {
|
|
3974
|
-
return [
|
|
3990
|
+
return [hr()];
|
|
3975
3991
|
},
|
|
3976
3992
|
extendNodeSchema(e) {
|
|
3977
|
-
return { allowGapCursor:
|
|
3993
|
+
return { allowGapCursor: se(m(e, "allowGapCursor", {
|
|
3978
3994
|
name: e.name,
|
|
3979
3995
|
options: e.options,
|
|
3980
3996
|
storage: e.storage
|
|
3981
3997
|
})) ?? null };
|
|
3982
3998
|
}
|
|
3983
|
-
}),
|
|
3984
|
-
function
|
|
3999
|
+
}), Hr = "placeholder", Ur = new c("tiptap__placeholder");
|
|
4000
|
+
function Wr(e) {
|
|
3985
4001
|
let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
|
|
3986
4002
|
return o && u.push(l), S.node(i, i + a.nodeSize, {
|
|
3987
4003
|
class: u.join(" "),
|
|
@@ -3993,17 +4009,41 @@ function Rr(e) {
|
|
|
3993
4009
|
}) : n
|
|
3994
4010
|
});
|
|
3995
4011
|
}
|
|
3996
|
-
function
|
|
4012
|
+
function Gr(e, t) {
|
|
3997
4013
|
return typeof e == "function" ? e(t) : e;
|
|
3998
4014
|
}
|
|
3999
|
-
function
|
|
4015
|
+
function Kr({ editor: e, options: t, dataAttribute: n, doc: r, selection: i, from: o, to: s }) {
|
|
4016
|
+
let { anchor: c } = i, l = [], u = e.isEmpty;
|
|
4017
|
+
return r.nodesBetween(o, s, (r, i) => {
|
|
4018
|
+
let o = c >= i && c <= i + r.nodeSize, s = !r.isLeaf && a(r);
|
|
4019
|
+
return r.type.isTextblock && (o || !t.showOnlyCurrent) && s && l.push(Wr({
|
|
4020
|
+
editor: e,
|
|
4021
|
+
isEmptyDoc: u,
|
|
4022
|
+
dataAttribute: n,
|
|
4023
|
+
hasAnchor: o,
|
|
4024
|
+
placeholder: t.placeholder,
|
|
4025
|
+
classes: {
|
|
4026
|
+
emptyEditor: t.emptyEditorClass,
|
|
4027
|
+
emptyNode: Gr(t.emptyNodeClass, {
|
|
4028
|
+
editor: e,
|
|
4029
|
+
node: r,
|
|
4030
|
+
pos: i,
|
|
4031
|
+
hasAnchor: o
|
|
4032
|
+
})
|
|
4033
|
+
},
|
|
4034
|
+
node: r,
|
|
4035
|
+
pos: i
|
|
4036
|
+
})), t.includeChildren;
|
|
4037
|
+
}), l;
|
|
4038
|
+
}
|
|
4039
|
+
function qr({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
4000
4040
|
if (!(e.isEditable || !t.showOnlyWhenEditable)) return null;
|
|
4001
4041
|
let { anchor: o } = i, s = [], c = e.isEmpty;
|
|
4002
4042
|
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
4003
4043
|
let i = r.resolve(o), l = i.depth > 0 ? i.node(1) : i.nodeAfter, u = i.depth > 0 ? i.before(1) : o;
|
|
4004
4044
|
if (l && l.type.isTextblock && a(l)) {
|
|
4005
4045
|
let r = o >= u && o <= u + l.nodeSize;
|
|
4006
|
-
s.push(
|
|
4046
|
+
s.push(Wr({
|
|
4007
4047
|
editor: e,
|
|
4008
4048
|
isEmptyDoc: c,
|
|
4009
4049
|
dataAttribute: n,
|
|
@@ -4011,7 +4051,7 @@ function Br({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
4011
4051
|
placeholder: t.placeholder,
|
|
4012
4052
|
classes: {
|
|
4013
4053
|
emptyEditor: t.emptyEditorClass,
|
|
4014
|
-
emptyNode:
|
|
4054
|
+
emptyNode: Gr(t.emptyNodeClass, {
|
|
4015
4055
|
editor: e,
|
|
4016
4056
|
node: l,
|
|
4017
4057
|
pos: u,
|
|
@@ -4022,148 +4062,142 @@ function Br({ editor: e, options: t, dataAttribute: n, doc: r, selection: i }) {
|
|
|
4022
4062
|
pos: u
|
|
4023
4063
|
}));
|
|
4024
4064
|
}
|
|
4025
|
-
} else {
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
placeholder: t.placeholder,
|
|
4035
|
-
classes: {
|
|
4036
|
-
emptyEditor: t.emptyEditorClass,
|
|
4037
|
-
emptyNode: zr(t.emptyNodeClass, {
|
|
4038
|
-
editor: e,
|
|
4039
|
-
node: r,
|
|
4040
|
-
pos: i,
|
|
4041
|
-
hasAnchor: l
|
|
4042
|
-
})
|
|
4043
|
-
},
|
|
4044
|
-
node: r,
|
|
4045
|
-
pos: i
|
|
4046
|
-
})), t.includeChildren;
|
|
4047
|
-
});
|
|
4048
|
-
}
|
|
4065
|
+
} else s.push(...Kr({
|
|
4066
|
+
editor: e,
|
|
4067
|
+
options: t,
|
|
4068
|
+
dataAttribute: n,
|
|
4069
|
+
doc: r,
|
|
4070
|
+
selection: i,
|
|
4071
|
+
from: 0,
|
|
4072
|
+
to: r.content.size
|
|
4073
|
+
}));
|
|
4049
4074
|
return T.create(r, s);
|
|
4050
4075
|
}
|
|
4051
|
-
function
|
|
4052
|
-
|
|
4076
|
+
function Q(e, t) {
|
|
4077
|
+
let n = e.resolve(t);
|
|
4078
|
+
if (n.depth === 0) {
|
|
4079
|
+
let e = n.nodeAfter ?? n.nodeBefore;
|
|
4080
|
+
if (!e) return {
|
|
4081
|
+
from: t,
|
|
4082
|
+
to: t
|
|
4083
|
+
};
|
|
4084
|
+
let r = n.nodeAfter ? t : t - e.nodeSize;
|
|
4085
|
+
return {
|
|
4086
|
+
from: r,
|
|
4087
|
+
to: r + e.nodeSize
|
|
4088
|
+
};
|
|
4089
|
+
}
|
|
4090
|
+
let r = n.before(1);
|
|
4091
|
+
return {
|
|
4092
|
+
from: r,
|
|
4093
|
+
to: r + n.node(1).nodeSize
|
|
4094
|
+
};
|
|
4053
4095
|
}
|
|
4054
|
-
function
|
|
4055
|
-
|
|
4056
|
-
|
|
4096
|
+
function $(e, t) {
|
|
4097
|
+
return {
|
|
4098
|
+
from: Math.max(0, t.from - 1),
|
|
4099
|
+
to: Math.min(e.content.size, t.to - 1)
|
|
4100
|
+
};
|
|
4057
4101
|
}
|
|
4058
|
-
function
|
|
4059
|
-
let
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4102
|
+
function Jr(e, t, n) {
|
|
4103
|
+
let r = [];
|
|
4104
|
+
return e.forEach((e, i) => {
|
|
4105
|
+
let a = i, o = a + e.nodeSize, s = a + 1, c = o + 1;
|
|
4106
|
+
s < n && c > t && r.push({
|
|
4107
|
+
from: a,
|
|
4108
|
+
to: o
|
|
4109
|
+
});
|
|
4110
|
+
}), r;
|
|
4111
|
+
}
|
|
4112
|
+
function Yr(e) {
|
|
4113
|
+
if (e.length === 0) return [];
|
|
4114
|
+
let t = [...e].sort((e, t) => e.from - t.from), n = [{ ...t[0] }];
|
|
4115
|
+
for (let e = 1; e < t.length; e += 1) {
|
|
4116
|
+
let r = n[n.length - 1], i = t[e];
|
|
4117
|
+
i.from <= r.to ? r.to = Math.max(r.to, i.to) : n.push({ ...i });
|
|
4072
4118
|
}
|
|
4073
|
-
return
|
|
4119
|
+
return n;
|
|
4074
4120
|
}
|
|
4075
|
-
function
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
bottom: window.innerHeight
|
|
4079
|
-
} : e.getBoundingClientRect();
|
|
4121
|
+
function Xr(e, t) {
|
|
4122
|
+
let n = Jr(e, t.from, t.to);
|
|
4123
|
+
return n.push($(e, Q(e, t.from))), t.to > t.from ? n.push($(e, Q(e, Math.min(t.to, e.content.size + 1) - 1))) : t.from < e.content.size + 1 && n.push($(e, Q(e, Math.min(t.from + 1, e.content.size)))), n;
|
|
4080
4124
|
}
|
|
4081
|
-
function
|
|
4082
|
-
let
|
|
4083
|
-
if (
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
left: l,
|
|
4095
|
-
top: u
|
|
4096
|
-
}), p = e.posAtCoords({
|
|
4097
|
-
left: l,
|
|
4098
|
-
top: d
|
|
4099
|
-
});
|
|
4100
|
-
return !f || !p ? null : {
|
|
4101
|
-
top: f.pos,
|
|
4102
|
-
bottom: p.pos
|
|
4125
|
+
function Zr(e, t, n) {
|
|
4126
|
+
let r = [];
|
|
4127
|
+
if (e.docChanged) {
|
|
4128
|
+
let t = p(e);
|
|
4129
|
+
for (let e of t) r.push(...Xr(n.doc, e.newRange));
|
|
4130
|
+
}
|
|
4131
|
+
return e.selectionSet && (r.push($(n.doc, Q(n.doc, e.mapping.map(t.selection.anchor)))), r.push($(n.doc, Q(n.doc, n.selection.anchor)))), Yr(r);
|
|
4132
|
+
}
|
|
4133
|
+
function Qr(e, t, n) {
|
|
4134
|
+
let r = Math.max(0, Math.min(e, n.content.size));
|
|
4135
|
+
return {
|
|
4136
|
+
from: r,
|
|
4137
|
+
to: Math.max(r, Math.min(t, n.content.size))
|
|
4103
4138
|
};
|
|
4104
4139
|
}
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
topPos: t.topPos === null ? null : e.mapping.map(t.topPos),
|
|
4119
|
-
bottomPos: t.bottomPos === null ? null : e.mapping.map(t.bottomPos)
|
|
4120
|
-
} : t;
|
|
4121
|
-
}
|
|
4122
|
-
};
|
|
4123
|
-
function qr(e) {
|
|
4124
|
-
let t = Ur(e.dom), n = () => {
|
|
4125
|
-
let n = Gr({
|
|
4126
|
-
view: e,
|
|
4127
|
-
scrollContainer: t
|
|
4140
|
+
function $r({ decorations: e, ranges: t, editor: n, options: r, dataAttribute: i, doc: a, selection: o }) {
|
|
4141
|
+
let s = e;
|
|
4142
|
+
for (let e of t) {
|
|
4143
|
+
let { from: t, to: c } = Qr(e.from, e.to, a), l = s.find(t, c).filter((e) => e.from >= t && e.to <= c);
|
|
4144
|
+
l.length && (s = s.remove(l));
|
|
4145
|
+
let u = Kr({
|
|
4146
|
+
editor: n,
|
|
4147
|
+
options: r,
|
|
4148
|
+
dataAttribute: i,
|
|
4149
|
+
doc: a,
|
|
4150
|
+
selection: o,
|
|
4151
|
+
from: t,
|
|
4152
|
+
to: c
|
|
4128
4153
|
});
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
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(), {
|
|
4146
|
-
update(t, n) {
|
|
4147
|
-
e.state.doc.content.size !== n.doc.content.size && a();
|
|
4154
|
+
u.length && (s = s.add(a, u));
|
|
4155
|
+
}
|
|
4156
|
+
return s;
|
|
4157
|
+
}
|
|
4158
|
+
function ei({ editor: e, options: t, dataAttribute: n }) {
|
|
4159
|
+
return {
|
|
4160
|
+
init(r, i) {
|
|
4161
|
+
return qr({
|
|
4162
|
+
editor: e,
|
|
4163
|
+
options: t,
|
|
4164
|
+
dataAttribute: n,
|
|
4165
|
+
doc: i.doc,
|
|
4166
|
+
selection: i.selection
|
|
4167
|
+
}) ?? T.empty;
|
|
4148
4168
|
},
|
|
4149
|
-
|
|
4150
|
-
r
|
|
4169
|
+
apply(r, i, a, o) {
|
|
4170
|
+
return !r.docChanged && !r.selectionSet ? i : $r({
|
|
4171
|
+
decorations: i.map(r.mapping, r.doc),
|
|
4172
|
+
ranges: Zr(r, a, o),
|
|
4173
|
+
editor: e,
|
|
4174
|
+
options: t,
|
|
4175
|
+
dataAttribute: n,
|
|
4176
|
+
doc: o.doc,
|
|
4177
|
+
selection: o.selection
|
|
4178
|
+
});
|
|
4151
4179
|
}
|
|
4152
4180
|
};
|
|
4153
4181
|
}
|
|
4154
|
-
function
|
|
4155
|
-
|
|
4182
|
+
function ti(e) {
|
|
4183
|
+
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
4184
|
+
}
|
|
4185
|
+
function ni({ editor: e, options: t }) {
|
|
4186
|
+
let n = t.dataAttribute ? `data-${ti(t.dataAttribute)}` : `data-${Hr}`, r = t.showOnlyCurrent && !t.includeChildren;
|
|
4156
4187
|
return new w({
|
|
4157
|
-
key:
|
|
4158
|
-
state:
|
|
4159
|
-
|
|
4160
|
-
|
|
4188
|
+
key: Ur,
|
|
4189
|
+
...r ? {} : { state: ei({
|
|
4190
|
+
editor: e,
|
|
4191
|
+
options: t,
|
|
4192
|
+
dataAttribute: n
|
|
4193
|
+
}) },
|
|
4194
|
+
props: { decorations: r ? ({ doc: r, selection: i }) => qr({
|
|
4161
4195
|
editor: e,
|
|
4162
4196
|
options: t,
|
|
4163
4197
|
dataAttribute: n,
|
|
4164
4198
|
doc: r,
|
|
4165
4199
|
selection: i
|
|
4166
|
-
}) }
|
|
4200
|
+
}) : (n) => t.showOnlyWhenEditable && !e.isEditable ? T.empty : Ur.getState(n) ?? T.empty }
|
|
4167
4201
|
});
|
|
4168
4202
|
}
|
|
4169
4203
|
y.create({
|
|
@@ -4172,7 +4206,7 @@ y.create({
|
|
|
4172
4206
|
return {
|
|
4173
4207
|
emptyEditorClass: "is-editor-empty",
|
|
4174
4208
|
emptyNodeClass: "is-empty",
|
|
4175
|
-
dataAttribute:
|
|
4209
|
+
dataAttribute: Hr,
|
|
4176
4210
|
placeholder: "Write something …",
|
|
4177
4211
|
showOnlyWhenEditable: !0,
|
|
4178
4212
|
showOnlyCurrent: !0,
|
|
@@ -4180,13 +4214,13 @@ y.create({
|
|
|
4180
4214
|
};
|
|
4181
4215
|
},
|
|
4182
4216
|
addProseMirrorPlugins() {
|
|
4183
|
-
return [
|
|
4217
|
+
return [ni({
|
|
4184
4218
|
editor: this.editor,
|
|
4185
4219
|
options: this.options
|
|
4186
4220
|
})];
|
|
4187
4221
|
}
|
|
4188
4222
|
});
|
|
4189
|
-
var
|
|
4223
|
+
var ri = ".ProseMirror:not(.ProseMirror-focused) *::selection {\n background: transparent;\n}\n\n.ProseMirror:not(.ProseMirror-focused) *::-moz-selection {\n background: transparent;\n}";
|
|
4190
4224
|
y.create({
|
|
4191
4225
|
name: "selection",
|
|
4192
4226
|
addOptions() {
|
|
@@ -4194,7 +4228,7 @@ y.create({
|
|
|
4194
4228
|
},
|
|
4195
4229
|
addProseMirrorPlugins() {
|
|
4196
4230
|
let { editor: e, options: t } = this;
|
|
4197
|
-
return e.options.injectCSS && typeof document < "u" &&
|
|
4231
|
+
return e.options.injectCSS && typeof document < "u" && re(ri, e.options.injectNonce, "selection"), [new w({
|
|
4198
4232
|
key: new c("selection"),
|
|
4199
4233
|
props: { decorations(n) {
|
|
4200
4234
|
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 })]);
|
|
@@ -4202,10 +4236,10 @@ y.create({
|
|
|
4202
4236
|
})];
|
|
4203
4237
|
}
|
|
4204
4238
|
});
|
|
4205
|
-
function
|
|
4239
|
+
function ii({ types: e, node: t }) {
|
|
4206
4240
|
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
4207
4241
|
}
|
|
4208
|
-
var
|
|
4242
|
+
var ai = y.create({
|
|
4209
4243
|
name: "trailingNode",
|
|
4210
4244
|
addOptions() {
|
|
4211
4245
|
return {
|
|
@@ -4224,7 +4258,7 @@ var Zr = y.create({
|
|
|
4224
4258
|
state: {
|
|
4225
4259
|
init: (e, t) => {
|
|
4226
4260
|
let r = t.tr.doc.lastChild;
|
|
4227
|
-
return !
|
|
4261
|
+
return !ii({
|
|
4228
4262
|
node: r,
|
|
4229
4263
|
types: n
|
|
4230
4264
|
});
|
|
@@ -4232,7 +4266,7 @@ var Zr = y.create({
|
|
|
4232
4266
|
apply: (e, t) => {
|
|
4233
4267
|
if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
|
|
4234
4268
|
let r = e.doc.lastChild;
|
|
4235
|
-
return !
|
|
4269
|
+
return !ii({
|
|
4236
4270
|
node: r,
|
|
4237
4271
|
types: n
|
|
4238
4272
|
});
|
|
@@ -4240,7 +4274,7 @@ var Zr = y.create({
|
|
|
4240
4274
|
}
|
|
4241
4275
|
})];
|
|
4242
4276
|
}
|
|
4243
|
-
}),
|
|
4277
|
+
}), oi = y.create({
|
|
4244
4278
|
name: "undoRedo",
|
|
4245
4279
|
addOptions() {
|
|
4246
4280
|
return {
|
|
@@ -4250,12 +4284,12 @@ var Zr = y.create({
|
|
|
4250
4284
|
},
|
|
4251
4285
|
addCommands() {
|
|
4252
4286
|
return {
|
|
4253
|
-
undo: () => ({ state: e, dispatch: t }) =>
|
|
4254
|
-
redo: () => ({ state: e, dispatch: t }) =>
|
|
4287
|
+
undo: () => ({ state: e, dispatch: t }) => Rr(e, t),
|
|
4288
|
+
redo: () => ({ state: e, dispatch: t }) => zr(e, t)
|
|
4255
4289
|
};
|
|
4256
4290
|
},
|
|
4257
4291
|
addProseMirrorPlugins() {
|
|
4258
|
-
return [
|
|
4292
|
+
return [Ir(this.options)];
|
|
4259
4293
|
},
|
|
4260
4294
|
addKeyboardShortcuts() {
|
|
4261
4295
|
return {
|
|
@@ -4266,12 +4300,12 @@ var Zr = y.create({
|
|
|
4266
4300
|
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
4267
4301
|
};
|
|
4268
4302
|
}
|
|
4269
|
-
}),
|
|
4303
|
+
}), si = y.create({
|
|
4270
4304
|
name: "starterKit",
|
|
4271
4305
|
addExtensions() {
|
|
4272
4306
|
let e = [];
|
|
4273
|
-
return this.options.bold !== !1 && e.push(
|
|
4307
|
+
return this.options.bold !== !1 && e.push(Nt.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(Ot.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(tn.configure(this.options.bulletList)), this.options.code !== !1 && e.push(It.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(Bt.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(Vt.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(Br.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(Vr.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Ht.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(Ut.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(oi.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(Wt.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(Yt.configure(this.options.italic)), this.options.listItem !== !1 && e.push(wn.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Fn.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(ue.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Qn.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(ir.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(sr.configure(this.options.strike)), this.options.text !== !1 && e.push(cr.configure(this.options.text)), this.options.underline !== !1 && e.push(de.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(ai.configure(this.options?.trailingNode)), e;
|
|
4274
4308
|
}
|
|
4275
|
-
}),
|
|
4309
|
+
}), ci = si;
|
|
4276
4310
|
//#endregion
|
|
4277
|
-
export {
|
|
4311
|
+
export { si as StarterKit, ci as default };
|