@templatical/editor 0.8.3 → 0.8.4
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-CXpsSTbt.js → AiChatSidebar-CnRXeK77.js} +14 -14
- package/dist/{AiFeatureMenu-De9ow6Ej.js → AiFeatureMenu-BYDDrpj6.js} +8 -8
- package/dist/{BlockIssueBadge-FEuyG1p0.js → BlockIssueBadge-DM-vXeD6.js} +5 -5
- package/dist/{CloudEditor-Ccoru8Up.js → CloudEditor-B9a_K6Cm.js} +23 -23
- package/dist/{CollaboratorBar-CmHq6XiL.js → CollaboratorBar-HN4whzM-.js} +5 -5
- package/dist/{CommentsSidebar-DaWP5ZGl.js → CommentsSidebar-_llWQ4VT.js} +14 -14
- package/dist/{CountdownBlock-C51M6s-J.js → CountdownBlock-I99sC0C5.js} +4 -4
- package/dist/{CountdownToolbar-C2QkG8S0.js → CountdownToolbar-BUhOUiQ9.js} +4 -4
- package/dist/{DesignReferenceSidebar-BwIRFmpA.js → DesignReferenceSidebar-0GwjUn2V.js} +11 -11
- package/dist/{IssuesPanel-B6ukjc1i.js → IssuesPanel-4MKZe8yP.js} +8 -8
- package/dist/{LoadingTrack-CZ6tO326.js → LoadingTrack-xCOLUR3o.js} +2 -2
- package/dist/{ModuleBrowserModal-0n6DoZtA.js → ModuleBrowserModal-DPZBsvqk.js} +11 -11
- package/dist/{ModulePreviewCanvas-DEtTEvMM.js → ModulePreviewCanvas-CK4j11-e.js} +3 -3
- package/dist/{NumberWithSuffix-wOM0319c.js → NumberWithSuffix-CxMFy_j3.js} +4 -4
- package/dist/{ParagraphEditor-PQZp1plL.js → ParagraphEditor-DBus_iHH.js} +28 -28
- package/dist/{RichTextEditorContent-C02UzFoS.js → RichTextEditorContent-B_KCY6T1.js} +6 -6
- package/dist/{SaveModuleDialog-WWMn87Oi.js → SaveModuleDialog-DORRSbBo.js} +7 -7
- package/dist/{SnapshotHistory-Dy_Iy7VG.js → SnapshotHistory-DTMVEk03.js} +10 -10
- package/dist/{TemplateScoringPanel-BpQgtaDl.js → TemplateScoringPanel-BIwEwFxD.js} +15 -15
- package/dist/{TestEmailModal--4EVFj1A.js → TestEmailModal-DJmYp0Qi.js} +5 -5
- package/dist/{TitleEditor-C6z6Jzeg.js → TitleEditor-70d9AF1V.js} +15 -15
- package/dist/{TplModal-D5xlYbls.js → TplModal-BEfwlvPC.js} +4 -4
- package/dist/{blockTypeIcons-jZR-IBPY.js → blockTypeIcons-2DRoPa3K.js} +2 -2
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AiFeatureMenu-8gbvVwXD.js → AiFeatureMenu-CcuKnisc.js} +3 -3
- package/dist/cdn/chunks/{AiFeatureMenu-8gbvVwXD.js.map → AiFeatureMenu-CcuKnisc.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-CYoY-wyI.js → BlockIssueBadge-Sr3is7Wr.js} +3 -3
- package/dist/cdn/chunks/{BlockIssueBadge-CYoY-wyI.js.map → BlockIssueBadge-Sr3is7Wr.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-DGAV0qxk.js → CloudEditor-Bi10d2Gq.js} +9 -9
- package/dist/cdn/chunks/{CloudEditor-DGAV0qxk.js.map → CloudEditor-Bi10d2Gq.js.map} +1 -1
- package/dist/cdn/chunks/{CollaboratorBar-BrzkrQJM.js → CollaboratorBar-C0zeecvl.js} +5 -5
- package/dist/cdn/chunks/{CollaboratorBar-BrzkrQJM.js.map → CollaboratorBar-C0zeecvl.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-BSEKrpZY.js → CountdownBlock-CpSUUDDs.js} +4 -4
- package/dist/cdn/chunks/{CountdownBlock-BSEKrpZY.js.map → CountdownBlock-CpSUUDDs.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-DME9toD5.js → CountdownToolbar-BBzdR-00.js} +5 -5
- package/dist/cdn/chunks/{CountdownToolbar-DME9toD5.js.map → CountdownToolbar-BBzdR-00.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-BqGOXisb.js → IssuesPanel-Bthq6qoZ.js} +4 -4
- package/dist/cdn/chunks/{IssuesPanel-BqGOXisb.js.map → IssuesPanel-Bthq6qoZ.js.map} +1 -1
- package/dist/cdn/chunks/{ModuleBrowserModal-Bz2oCRS9.js → ModuleBrowserModal-CFMd6M7E.js} +6 -6
- package/dist/cdn/chunks/{ModuleBrowserModal-Bz2oCRS9.js.map → ModuleBrowserModal-CFMd6M7E.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-8i2U3rd6.js → ModulePreviewCanvas-BkcPcF5C.js} +3 -3
- package/dist/cdn/chunks/{ModulePreviewCanvas-8i2U3rd6.js.map → ModulePreviewCanvas-BkcPcF5C.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-C6HZCvvh.js → NumberWithSuffix-C2hH_ZIK.js} +4 -4
- package/dist/cdn/chunks/{NumberWithSuffix-C6HZCvvh.js.map → NumberWithSuffix-C2hH_ZIK.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-DfKVmv1W.js → ParagraphEditor-BIWXLPfu.js} +21 -21
- package/dist/cdn/chunks/ParagraphEditor-BIWXLPfu.js.map +1 -0
- package/dist/cdn/chunks/{RichTextEditorContent-B-HY9asd.js → RichTextEditorContent-DU0gc4bi.js} +3 -3
- package/dist/cdn/chunks/{RichTextEditorContent-B-HY9asd.js.map → RichTextEditorContent-DU0gc4bi.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-BgwBxW_S.js → SaveModuleDialog-DR9EZlWe.js} +3 -3
- package/dist/cdn/chunks/{SaveModuleDialog-BgwBxW_S.js.map → SaveModuleDialog-DR9EZlWe.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-C2p3SosJ.js → TitleEditor-DZcx2N4R.js} +12 -12
- package/dist/cdn/chunks/TitleEditor-DZcx2N4R.js.map +1 -0
- package/dist/cdn/chunks/{blockTypeIcons-Bck6aYVw.js → blockTypeIcons-eVGGIdne.js} +3 -3
- package/dist/cdn/chunks/{blockTypeIcons-Bck6aYVw.js.map → blockTypeIcons-eVGGIdne.js.map} +1 -1
- package/dist/cdn/chunks/{de-RQrZR56a.js → de-CTYXVU9v.js} +1 -1
- package/dist/cdn/chunks/{de-RQrZR56a.js.map → de-CTYXVU9v.js.map} +1 -1
- package/dist/cdn/chunks/{de-DG1WWVXM.js → de-DFYCT4QU.js} +1 -1
- package/dist/cdn/chunks/{de-DG1WWVXM.js.map → de-DFYCT4QU.js.map} +1 -1
- package/dist/cdn/chunks/{de-BBEGQDsd.js → de-ED7c5RpG.js} +1 -2
- package/dist/cdn/chunks/{de-BBEGQDsd.js.map → de-ED7c5RpG.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-CLpL3kf8.js → draggable-BwWMFq33.js} +2 -2
- package/dist/cdn/chunks/{draggable-CLpL3kf8.js.map → draggable-BwWMFq33.js.map} +1 -1
- package/dist/cdn/chunks/{emojiData-EMFlj6FJ.js → emojiData-6m0DBh7O.js} +1 -1
- package/dist/cdn/chunks/{emojiData-EMFlj6FJ.js.map → emojiData-6m0DBh7O.js.map} +1 -1
- package/dist/cdn/chunks/{en-Bl1ecfRF.js → en-BtmIaJeb.js} +1 -1
- package/dist/cdn/chunks/{en-Bl1ecfRF.js.map → en-BtmIaJeb.js.map} +1 -1
- package/dist/cdn/chunks/{en-BE6OV83-.js → en-DE_y1YWU.js} +1 -1
- package/dist/cdn/chunks/{en-BE6OV83-.js.map → en-DE_y1YWU.js.map} +1 -1
- package/dist/cdn/chunks/{en-CHha-_ta.js → en-ivilDUn0.js} +1 -2
- package/dist/cdn/chunks/{en-CHha-_ta.js.map → en-ivilDUn0.js.map} +1 -1
- package/dist/cdn/chunks/{extensions-DdH6DxVo.js → extensions-CvCoOuWB.js} +4 -4
- package/dist/cdn/chunks/{extensions-DdH6DxVo.js.map → extensions-CvCoOuWB.js.map} +1 -1
- package/dist/cdn/chunks/{features-BOcQhi9B.js → features-CUYy5kZQ.js} +720 -720
- package/dist/cdn/chunks/{features-BOcQhi9B.js.map → features-CUYy5kZQ.js.map} +1 -1
- package/dist/cdn/chunks/{icons-BVyDCkxF.js → icons-C4zY5-I3.js} +2 -2
- package/dist/cdn/chunks/{icons-BVyDCkxF.js.map → icons-C4zY5-I3.js.map} +1 -1
- package/dist/cdn/chunks/{liquid.browser-cpFt-Vmw.js → liquid.browser-rMoPo2t_.js} +1 -1
- package/dist/cdn/chunks/{liquid.browser-cpFt-Vmw.js.map → liquid.browser-rMoPo2t_.js.map} +1 -1
- package/dist/cdn/chunks/{media-library-CPZI4Yxq.js → media-library-BNt3msId.js} +5 -5
- package/dist/cdn/chunks/{media-library-CPZI4Yxq.js.map → media-library-BNt3msId.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-CQl2JxRp.js → pt-BR-B2ZvFlRL.js} +1 -1
- package/dist/cdn/chunks/{pt-BR-CQl2JxRp.js.map → pt-BR-B2ZvFlRL.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-CFomv2R8.js → pt-BR-B5tm2iBl.js} +1 -2
- package/dist/cdn/chunks/{pt-BR-CFomv2R8.js.map → pt-BR-B5tm2iBl.js.map} +1 -1
- package/dist/cdn/chunks/{pt-BR-BYRTP5Ww.js → pt-BR-BibOQm-o.js} +1 -1
- package/dist/cdn/chunks/{pt-BR-BYRTP5Ww.js.map → pt-BR-BibOQm-o.js.map} +1 -1
- package/dist/cdn/chunks/{pusher-bjpcqCZG.js → pusher-CHo5Cua0.js} +2 -2
- package/dist/cdn/chunks/{pusher-bjpcqCZG.js.map → pusher-CHo5Cua0.js.map} +1 -1
- package/dist/cdn/chunks/{quality-Cytz80Z5.js → quality-BTPRPGB-.js} +3 -3
- package/dist/cdn/chunks/{quality-Cytz80Z5.js.map → quality-BTPRPGB-.js.map} +1 -1
- package/dist/cdn/chunks/{readableTextColor-DhoK4XiZ.js → readableTextColor-f8Kykfnh.js} +1 -1
- package/dist/cdn/chunks/{readableTextColor-DhoK4XiZ.js.map → readableTextColor-f8Kykfnh.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-Bsqzjvsr.js → renderer-IOmuuZjJ.js} +6 -6
- package/dist/cdn/chunks/{renderer-Bsqzjvsr.js.map → renderer-IOmuuZjJ.js.map} +1 -1
- package/dist/cdn/chunks/{src-BRhJ_W0W.js → src-Dp0ZFQ4-.js} +8 -8
- package/dist/cdn/chunks/{src-BRhJ_W0W.js.map → src-Dp0ZFQ4-.js.map} +1 -1
- package/dist/cdn/chunks/{styleConstants-DP1VOca8.js → styleConstants-lGobwiLH.js} +1 -1
- package/dist/cdn/chunks/{styleConstants-DP1VOca8.js.map → styleConstants-lGobwiLH.js.map} +1 -1
- package/dist/cdn/chunks/{styles-MrOGXwzJ.js → styles-DtgjgsBH.js} +11 -11
- package/dist/cdn/chunks/{styles-MrOGXwzJ.js.map → styles-DtgjgsBH.js.map} +1 -1
- package/dist/cdn/chunks/{tiptap-BCvhHXDe.js → tiptap-BErAJEvo.js} +8 -8
- package/dist/cdn/chunks/{tiptap-BCvhHXDe.js.map → tiptap-BErAJEvo.js.map} +1 -1
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +13 -13
- package/dist/{check-DwVS7v3N.js → check-ChQyfxJ3.js} +1 -1
- package/dist/{chevron-down-CytfFjil.js → chevron-down-DJjo0jSV.js} +1 -1
- package/dist/{circle-alert-9J8Q4fwU.js → circle-alert-CPH6l3Lc.js} +1 -1
- package/dist/{clock-CL2fYWmc.js → clock-DHl_BIkU.js} +1 -1
- package/dist/{cloud-DHsOqOnH.js → cloud-Dz8Ay2FM.js} +2 -2
- package/dist/{createLucideIcon-DTECxBv6.js → createLucideIcon-XgXOJ05E.js} +1 -1
- package/dist/{de-KFqjrxG3.js → de-ED7c5RpG.js} +0 -1
- package/dist/{dist-BjSjVZRA.js → dist-BS5Oi67L.js} +1 -1
- package/dist/{dist-3RAjjDZq.js → dist-BTgujVMy.js} +1 -1
- package/dist/{dist-BoGj0ys1.js → dist-BtDBsF3N.js} +1 -1
- package/dist/{dist-UekZXGFH.js → dist-BySzGkeC.js} +1 -1
- package/dist/{dist-B5FKze93.js → dist-BygsE-n3.js} +3 -3
- package/dist/{dist-DgD8K8y0.js → dist-CDZCyoRy.js} +1 -1
- package/dist/{dist-DPiqL9q5.js → dist-CDtcJMB2.js} +1 -1
- package/dist/{dist-BWVK8w_m.js → dist-D7JUZ2Kd.js} +1 -1
- package/dist/{dist-DpF3BN6Y.js → dist-DWhP3Dp2.js} +780 -780
- package/dist/{dist-qFGe50Kc.js → dist-DnGTaPRX.js} +1 -1
- package/dist/{dist-CkhqaMca.js → dist-HO0vjY5Z.js} +1 -1
- package/dist/{dist-D8IxYzaU.js → dist-T-ORzNfM.js} +3 -3
- package/dist/{dist-DiYYRj9J.js → dist-v-O2Subd.js} +1 -1
- package/dist/{en-CNm94YYD.js → en-ivilDUn0.js} +0 -1
- package/dist/{extensions-BTheidN4.js → extensions-BmGiz8Oo.js} +6 -6
- package/dist/{formatRelativeTime-bvx5sFh5.js → formatRelativeTime-CyDg5cDD.js} +1 -1
- package/dist/{image-up-YgXg9o1y.js → image-up-CPBCOMit.js} +1 -1
- package/dist/{info-W-213KLD.js → info-DIY9mguM.js} +1 -1
- package/dist/{keys-XS_XrjqL.js → keys-B8K7Z7Ef.js} +1 -1
- package/dist/{list-checks-BQrZlWzC.js → list-checks-CSCyu3fH.js} +1 -1
- package/dist/{loader-circle-BQPHssrF.js → loader-circle-Rz_4vJLH.js} +1 -1
- package/dist/{message-circle-iMgHXBeH.js → message-circle-D-umK_MU.js} +1 -1
- package/dist/{pt-BR-gxZZAUWp.js → pt-BR-B5tm2iBl.js} +0 -1
- package/dist/{refresh-cw-DFozdLYp.js → refresh-cw-CvWF4jfR.js} +1 -1
- package/dist/{scan-line-D3NN0Gre.js → scan-line-wanvAFDr.js} +1 -1
- package/dist/{send-DBhq0GU2.js → send-BhbhbIFT.js} +1 -1
- package/dist/{shield-check-DquM3-E5.js → shield-check-CXPPMWth.js} +1 -1
- package/dist/{sparkles-CTGknLJy.js → sparkles-CrUN0KWY.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-DfdDKEGV.js → styles-DFeOGKa_.js} +29 -29
- package/dist/templatical-editor.js +13 -13
- package/dist/{text-align-end-BPOHCD7K.js → text-align-end-Bkq8oBrD.js} +1 -1
- package/dist/{trash-2-VyX2kcG0.js → trash-2-BpY5BCLT.js} +1 -1
- package/dist/{triangle-alert-HIqW9Hwv.js → triangle-alert-MwJBKR2e.js} +1 -1
- package/dist/{useAliveFlag-t3e0dokQ.js → useAliveFlag-BLyG8L4d.js} +1 -1
- package/dist/{useCloudI18n-oETj4WiF.js → useCloudI18n-DFzVgYhJ.js} +2 -2
- package/dist/{useEditorCore-YaOoz7QB.js → useEditorCore-BXz-UXPd.js} +20 -20
- package/dist/{useI18n-tMHqPsE4.js → useI18n-CBbStVlD.js} +2 -2
- package/dist/{useMergeTag-Bv8ASt6n.js → useMergeTag-CS2bmWA0.js} +3 -3
- package/dist/usePopoverRoot-62PlZQQ3.js +8 -0
- package/dist/{vue.runtime.esm-bundler-xiAB6UTz.js → vue.runtime.esm-bundler-BDSGA5hA.js} +1 -1
- package/dist/{x-C1j-AamY.js → x-rcnxRG8Y.js} +1 -1
- package/package.json +9 -9
- package/dist/cdn/chunks/ParagraphEditor-DfKVmv1W.js.map +0 -1
- package/dist/cdn/chunks/TitleEditor-C2p3SosJ.js.map +0 -1
- package/dist/usePopoverRoot-Bs6kLsI3.js +0 -8
- /package/dist/{_plugin-vue_export-helper-B0hnzhyu.js → _plugin-vue_export-helper-B3ysoDQm.js} +0 -0
- /package/dist/cdn/chunks/{rolldown-runtime-C266TIVP.js → rolldown-runtime-Dqa2HsxW.js} +0 -0
- /package/dist/{de-GOtR9DwW.js → de-CTYXVU9v.js} +0 -0
- /package/dist/{dist-DJmnUmW9.js → dist-Cipw2HFH.js} +0 -0
- /package/dist/{emojiData-DrBuvEoP.js → emojiData-6m0DBh7O.js} +0 -0
- /package/dist/{en-dFFQVzNn.js → en-BtmIaJeb.js} +0 -0
- /package/dist/{liquid.browser-Dc30h4PN.js → liquid.browser-IgQrXHPQ.js} +0 -0
- /package/dist/{pt-BR-iOr79aDg.js → pt-BR-B2ZvFlRL.js} +0 -0
- /package/dist/{readableTextColor-CXzrEnNb.js → readableTextColor-f8Kykfnh.js} +0 -0
- /package/dist/{rolldown-runtime-CAFD8bLK.js → rolldown-runtime-Dy4uBu1J.js} +0 -0
- /package/dist/{styleConstants-DkfOPzGu.js → styleConstants-lGobwiLH.js} +0 -0
- /package/dist/{timeouts-BSGxjuUF.js → timeouts-Bmi_yePw.js} +0 -0
|
@@ -512,7 +512,7 @@ var te = class e {
|
|
|
512
512
|
}
|
|
513
513
|
blockRange(e = this, t) {
|
|
514
514
|
if (e.pos < this.pos) return e.blockRange(this);
|
|
515
|
-
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
|
|
515
|
+
for (let n = this.depth - (this.parent.inlineContent || this.pos == e.pos ? 1 : 0); n >= 0; n--) if (e.pos <= this.end(n) && (!t || t(this.node(n)))) return new ae(this, e, n);
|
|
516
516
|
return null;
|
|
517
517
|
}
|
|
518
518
|
sameParent(e) {
|
|
@@ -553,7 +553,7 @@ var te = class e {
|
|
|
553
553
|
constructor() {
|
|
554
554
|
this.elts = [], this.i = 0;
|
|
555
555
|
}
|
|
556
|
-
}, re = 12, ie = /* @__PURE__ */ new WeakMap(),
|
|
556
|
+
}, re = 12, ie = /* @__PURE__ */ new WeakMap(), ae = class {
|
|
557
557
|
constructor(e, t, n) {
|
|
558
558
|
this.$from = e, this.$to = t, this.depth = n;
|
|
559
559
|
}
|
|
@@ -572,7 +572,7 @@ var te = class e {
|
|
|
572
572
|
get endIndex() {
|
|
573
573
|
return this.$to.indexAfter(this.depth);
|
|
574
574
|
}
|
|
575
|
-
},
|
|
575
|
+
}, oe = Object.create(null), x = class e {
|
|
576
576
|
constructor(e, t, n, i = s.none) {
|
|
577
577
|
this.type = e, this.attrs = t, this.marks = i, this.content = n || r.empty;
|
|
578
578
|
}
|
|
@@ -619,7 +619,7 @@ var te = class e {
|
|
|
619
619
|
return this.hasMarkup(e.type, e.attrs, e.marks);
|
|
620
620
|
}
|
|
621
621
|
hasMarkup(e, t, n) {
|
|
622
|
-
return this.type == e && o(this.attrs, t || e.defaultAttrs ||
|
|
622
|
+
return this.type == e && o(this.attrs, t || e.defaultAttrs || oe) && s.sameSet(this.marks, n || s.none);
|
|
623
623
|
}
|
|
624
624
|
copy(t = null) {
|
|
625
625
|
return t == this.content ? this : new e(this.type, this.attrs, t, this.marks);
|
|
@@ -707,7 +707,7 @@ var te = class e {
|
|
|
707
707
|
toString() {
|
|
708
708
|
if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);
|
|
709
709
|
let e = this.type.name;
|
|
710
|
-
return this.content.size && (e += "(" + this.content.toStringInner() + ")"),
|
|
710
|
+
return this.content.size && (e += "(" + this.content.toStringInner() + ")"), ce(this.marks, e);
|
|
711
711
|
}
|
|
712
712
|
contentMatchAt(e) {
|
|
713
713
|
let t = this.type.contentMatch.matchFragment(this.content, 0, e);
|
|
@@ -761,14 +761,14 @@ var te = class e {
|
|
|
761
761
|
return a.type.checkAttrs(a.attrs), a;
|
|
762
762
|
}
|
|
763
763
|
};
|
|
764
|
-
|
|
765
|
-
var
|
|
764
|
+
x.prototype.text = void 0;
|
|
765
|
+
var se = class e extends x {
|
|
766
766
|
constructor(e, t, n, r) {
|
|
767
767
|
if (super(e, t, null, r), !n) throw RangeError("Empty text nodes are not allowed");
|
|
768
768
|
this.text = n;
|
|
769
769
|
}
|
|
770
770
|
toString() {
|
|
771
|
-
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) :
|
|
771
|
+
return this.type.spec.toDebugString ? this.type.spec.toDebugString(this) : ce(this.marks, JSON.stringify(this.text));
|
|
772
772
|
}
|
|
773
773
|
get textContent() {
|
|
774
774
|
return this.text;
|
|
@@ -796,21 +796,21 @@ var oe = class e extends S {
|
|
|
796
796
|
return e.text = this.text, e;
|
|
797
797
|
}
|
|
798
798
|
};
|
|
799
|
-
function
|
|
799
|
+
function ce(e, t) {
|
|
800
800
|
for (let n = e.length - 1; n >= 0; n--) t = e[n].type.name + "(" + t + ")";
|
|
801
801
|
return t;
|
|
802
802
|
}
|
|
803
|
-
var
|
|
803
|
+
var le = class e {
|
|
804
804
|
constructor(e) {
|
|
805
805
|
this.validEnd = e, this.next = [], this.wrapCache = [];
|
|
806
806
|
}
|
|
807
807
|
static parse(t, n) {
|
|
808
|
-
let r = new
|
|
808
|
+
let r = new ue(t, n);
|
|
809
809
|
if (r.next == null) return e.empty;
|
|
810
|
-
let i =
|
|
810
|
+
let i = de(r);
|
|
811
811
|
r.next && r.err("Unexpected trailing text");
|
|
812
|
-
let a =
|
|
813
|
-
return
|
|
812
|
+
let a = xe(ve(i));
|
|
813
|
+
return Se(a, r), a;
|
|
814
814
|
}
|
|
815
815
|
matchType(e) {
|
|
816
816
|
for (let t = 0; t < this.next.length; t++) if (this.next[t].type == e) return this.next[t].next;
|
|
@@ -901,8 +901,8 @@ var ce = class e {
|
|
|
901
901
|
}).join("\n");
|
|
902
902
|
}
|
|
903
903
|
};
|
|
904
|
-
|
|
905
|
-
var
|
|
904
|
+
le.empty = new le(!0);
|
|
905
|
+
var ue = class {
|
|
906
906
|
constructor(e, t) {
|
|
907
907
|
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();
|
|
908
908
|
}
|
|
@@ -916,28 +916,28 @@ var le = class {
|
|
|
916
916
|
throw SyntaxError(e + " (in content expression '" + this.string + "')");
|
|
917
917
|
}
|
|
918
918
|
};
|
|
919
|
-
function
|
|
919
|
+
function de(e) {
|
|
920
920
|
let t = [];
|
|
921
921
|
do
|
|
922
|
-
t.push(
|
|
922
|
+
t.push(fe(e));
|
|
923
923
|
while (e.eat("|"));
|
|
924
924
|
return t.length == 1 ? t[0] : {
|
|
925
925
|
type: "choice",
|
|
926
926
|
exprs: t
|
|
927
927
|
};
|
|
928
928
|
}
|
|
929
|
-
function
|
|
929
|
+
function fe(e) {
|
|
930
930
|
let t = [];
|
|
931
931
|
do
|
|
932
|
-
t.push(
|
|
932
|
+
t.push(pe(e));
|
|
933
933
|
while (e.next && e.next != ")" && e.next != "|");
|
|
934
934
|
return t.length == 1 ? t[0] : {
|
|
935
935
|
type: "seq",
|
|
936
936
|
exprs: t
|
|
937
937
|
};
|
|
938
938
|
}
|
|
939
|
-
function
|
|
940
|
-
let t =
|
|
939
|
+
function pe(e) {
|
|
940
|
+
let t = _e(e);
|
|
941
941
|
for (;;) if (e.eat("+")) t = {
|
|
942
942
|
type: "plus",
|
|
943
943
|
expr: t
|
|
@@ -950,25 +950,25 @@ function fe(e) {
|
|
|
950
950
|
type: "opt",
|
|
951
951
|
expr: t
|
|
952
952
|
};
|
|
953
|
-
else if (e.eat("{")) t =
|
|
953
|
+
else if (e.eat("{")) t = he(e, t);
|
|
954
954
|
else break;
|
|
955
955
|
return t;
|
|
956
956
|
}
|
|
957
|
-
function
|
|
957
|
+
function me(e) {
|
|
958
958
|
/\D/.test(e.next) && e.err("Expected number, got '" + e.next + "'");
|
|
959
959
|
let t = Number(e.next);
|
|
960
960
|
return e.pos++, t;
|
|
961
961
|
}
|
|
962
|
-
function
|
|
963
|
-
let n =
|
|
964
|
-
return e.eat(",") && (r = e.next == "}" ? -1 :
|
|
962
|
+
function he(e, t) {
|
|
963
|
+
let n = me(e), r = n;
|
|
964
|
+
return e.eat(",") && (r = e.next == "}" ? -1 : me(e)), e.eat("}") || e.err("Unclosed braced range"), {
|
|
965
965
|
type: "range",
|
|
966
966
|
min: n,
|
|
967
967
|
max: r,
|
|
968
968
|
expr: t
|
|
969
969
|
};
|
|
970
970
|
}
|
|
971
|
-
function
|
|
971
|
+
function ge(e, t) {
|
|
972
972
|
let n = e.nodeTypes, r = n[t];
|
|
973
973
|
if (r) return [r];
|
|
974
974
|
let i = [];
|
|
@@ -978,13 +978,13 @@ function he(e, t) {
|
|
|
978
978
|
}
|
|
979
979
|
return i.length == 0 && e.err("No node type or group '" + t + "' found"), i;
|
|
980
980
|
}
|
|
981
|
-
function
|
|
981
|
+
function _e(e) {
|
|
982
982
|
if (e.eat("(")) {
|
|
983
|
-
let t =
|
|
983
|
+
let t = de(e);
|
|
984
984
|
return e.eat(")") || e.err("Missing closing paren"), t;
|
|
985
985
|
} else if (/\W/.test(e.next)) e.err("Unexpected token '" + e.next + "'");
|
|
986
986
|
else {
|
|
987
|
-
let t =
|
|
987
|
+
let t = ge(e, e.next).map((t) => (e.inline == null ? e.inline = t.isInline : e.inline != t.isInline && e.err("Mixing inline and block content"), {
|
|
988
988
|
type: "name",
|
|
989
989
|
value: t
|
|
990
990
|
}));
|
|
@@ -994,7 +994,7 @@ function ge(e) {
|
|
|
994
994
|
};
|
|
995
995
|
}
|
|
996
996
|
}
|
|
997
|
-
function
|
|
997
|
+
function ve(e) {
|
|
998
998
|
let t = [[]];
|
|
999
999
|
return i(a(e, 0), n()), t;
|
|
1000
1000
|
function n() {
|
|
@@ -1040,12 +1040,12 @@ function _e(e) {
|
|
|
1040
1040
|
else throw Error("Unknown expr type");
|
|
1041
1041
|
}
|
|
1042
1042
|
}
|
|
1043
|
-
function
|
|
1043
|
+
function ye(e, t) {
|
|
1044
1044
|
return t - e;
|
|
1045
1045
|
}
|
|
1046
|
-
function
|
|
1046
|
+
function be(e, t) {
|
|
1047
1047
|
let n = [];
|
|
1048
|
-
return r(t), n.sort(
|
|
1048
|
+
return r(t), n.sort(ye);
|
|
1049
1049
|
function r(t) {
|
|
1050
1050
|
let i = e[t];
|
|
1051
1051
|
if (i.length == 1 && !i[0].term) return r(i[0].to);
|
|
@@ -1056,9 +1056,9 @@ function ye(e, t) {
|
|
|
1056
1056
|
}
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
|
-
function
|
|
1059
|
+
function xe(e) {
|
|
1060
1060
|
let t = Object.create(null);
|
|
1061
|
-
return n(
|
|
1061
|
+
return n(be(e, 0));
|
|
1062
1062
|
function n(r) {
|
|
1063
1063
|
let i = [];
|
|
1064
1064
|
r.forEach((t) => {
|
|
@@ -1066,14 +1066,14 @@ function be(e) {
|
|
|
1066
1066
|
if (!t) return;
|
|
1067
1067
|
let r;
|
|
1068
1068
|
for (let e = 0; e < i.length; e++) i[e][0] == t && (r = i[e][1]);
|
|
1069
|
-
|
|
1069
|
+
be(e, n).forEach((e) => {
|
|
1070
1070
|
r || i.push([t, r = []]), r.indexOf(e) == -1 && r.push(e);
|
|
1071
1071
|
});
|
|
1072
1072
|
});
|
|
1073
1073
|
});
|
|
1074
|
-
let a = t[r.join(",")] = new
|
|
1074
|
+
let a = t[r.join(",")] = new le(r.indexOf(e.length - 1) > -1);
|
|
1075
1075
|
for (let e = 0; e < i.length; e++) {
|
|
1076
|
-
let r = i[e][1].sort(
|
|
1076
|
+
let r = i[e][1].sort(ye);
|
|
1077
1077
|
a.next.push({
|
|
1078
1078
|
type: i[e][0],
|
|
1079
1079
|
next: t[r.join(",")] || n(r)
|
|
@@ -1082,7 +1082,7 @@ function be(e) {
|
|
|
1082
1082
|
return a;
|
|
1083
1083
|
}
|
|
1084
1084
|
}
|
|
1085
|
-
function
|
|
1085
|
+
function Se(e, t) {
|
|
1086
1086
|
for (let n = 0, r = [e]; n < r.length; n++) {
|
|
1087
1087
|
let e = r[n], i = !e.validEnd, a = [];
|
|
1088
1088
|
for (let t = 0; t < e.next.length; t++) {
|
|
@@ -1092,7 +1092,7 @@ function xe(e, t) {
|
|
|
1092
1092
|
i && t.err("Only non-generatable nodes (" + a.join(", ") + ") in a required position (see https://prosemirror.net/docs/guide/#generatable)");
|
|
1093
1093
|
}
|
|
1094
1094
|
}
|
|
1095
|
-
function
|
|
1095
|
+
function Ce(e) {
|
|
1096
1096
|
let t = Object.create(null);
|
|
1097
1097
|
for (let n in e) {
|
|
1098
1098
|
let r = e[n];
|
|
@@ -1101,7 +1101,7 @@ function Se(e) {
|
|
|
1101
1101
|
}
|
|
1102
1102
|
return t;
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function we(e, t) {
|
|
1105
1105
|
let n = Object.create(null);
|
|
1106
1106
|
for (let r in e) {
|
|
1107
1107
|
let i = t && t[r];
|
|
@@ -1114,21 +1114,21 @@ function Ce(e, t) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
return n;
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1117
|
+
function Te(e, t, n, r) {
|
|
1118
1118
|
for (let r in t) if (!(r in e)) throw RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);
|
|
1119
1119
|
for (let n in e) {
|
|
1120
1120
|
let r = e[n];
|
|
1121
1121
|
r.validate && r.validate(t[n]);
|
|
1122
1122
|
}
|
|
1123
1123
|
}
|
|
1124
|
-
function
|
|
1124
|
+
function Ee(e, t) {
|
|
1125
1125
|
let n = Object.create(null);
|
|
1126
|
-
if (t) for (let r in t) n[r] = new
|
|
1126
|
+
if (t) for (let r in t) n[r] = new ke(e, r, t[r]);
|
|
1127
1127
|
return n;
|
|
1128
1128
|
}
|
|
1129
|
-
var
|
|
1129
|
+
var De = class e {
|
|
1130
1130
|
constructor(e, t, n) {
|
|
1131
|
-
this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs =
|
|
1131
|
+
this.name = e, this.schema = t, this.spec = n, this.markSet = null, this.groups = n.group ? n.group.split(" ") : [], this.attrs = Ee(e, n.attrs), this.defaultAttrs = Ce(this.attrs), this.contentMatch = null, this.inlineContent = null, this.isBlock = !(n.inline || e == "text"), this.isText = e == "text";
|
|
1132
1132
|
}
|
|
1133
1133
|
get isInline() {
|
|
1134
1134
|
return !this.isBlock;
|
|
@@ -1137,7 +1137,7 @@ var Ee = class e {
|
|
|
1137
1137
|
return this.isBlock && this.inlineContent;
|
|
1138
1138
|
}
|
|
1139
1139
|
get isLeaf() {
|
|
1140
|
-
return this.contentMatch ==
|
|
1140
|
+
return this.contentMatch == le.empty;
|
|
1141
1141
|
}
|
|
1142
1142
|
get isAtom() {
|
|
1143
1143
|
return this.isLeaf || !!this.spec.atom;
|
|
@@ -1156,14 +1156,14 @@ var Ee = class e {
|
|
|
1156
1156
|
return this == e || this.contentMatch.compatible(e.contentMatch);
|
|
1157
1157
|
}
|
|
1158
1158
|
computeAttrs(e) {
|
|
1159
|
-
return !e && this.defaultAttrs ? this.defaultAttrs :
|
|
1159
|
+
return !e && this.defaultAttrs ? this.defaultAttrs : we(this.attrs, e);
|
|
1160
1160
|
}
|
|
1161
1161
|
create(e = null, t, n) {
|
|
1162
1162
|
if (this.isText) throw Error("NodeType.create can't construct text nodes");
|
|
1163
|
-
return new
|
|
1163
|
+
return new x(this, this.computeAttrs(e), r.from(t), s.setFrom(n));
|
|
1164
1164
|
}
|
|
1165
1165
|
createChecked(e = null, t, n) {
|
|
1166
|
-
return t = r.from(t), this.checkContent(t), new
|
|
1166
|
+
return t = r.from(t), this.checkContent(t), new x(this, this.computeAttrs(e), t, s.setFrom(n));
|
|
1167
1167
|
}
|
|
1168
1168
|
createAndFill(e = null, t, n) {
|
|
1169
1169
|
if (e = this.computeAttrs(e), t = r.from(t), t.size) {
|
|
@@ -1172,7 +1172,7 @@ var Ee = class e {
|
|
|
1172
1172
|
t = e.append(t);
|
|
1173
1173
|
}
|
|
1174
1174
|
let i = this.contentMatch.matchFragment(t), a = i && i.fillBefore(r.empty, !0);
|
|
1175
|
-
return a ? new
|
|
1175
|
+
return a ? new x(this, e, t.append(a), s.setFrom(n)) : null;
|
|
1176
1176
|
}
|
|
1177
1177
|
validContent(e) {
|
|
1178
1178
|
let t = this.contentMatch.matchFragment(e);
|
|
@@ -1184,7 +1184,7 @@ var Ee = class e {
|
|
|
1184
1184
|
if (!this.validContent(e)) throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0, 50)}`);
|
|
1185
1185
|
}
|
|
1186
1186
|
checkAttrs(e) {
|
|
1187
|
-
|
|
1187
|
+
Te(this.attrs, e, "node", this.name);
|
|
1188
1188
|
}
|
|
1189
1189
|
allowsMarkType(e) {
|
|
1190
1190
|
return this.markSet == null || this.markSet.indexOf(e) > -1;
|
|
@@ -1210,28 +1210,28 @@ var Ee = class e {
|
|
|
1210
1210
|
return r;
|
|
1211
1211
|
}
|
|
1212
1212
|
};
|
|
1213
|
-
function
|
|
1213
|
+
function Oe(e, t, n) {
|
|
1214
1214
|
let r = n.split("|");
|
|
1215
1215
|
return (n) => {
|
|
1216
1216
|
let i = n === null ? "null" : typeof n;
|
|
1217
1217
|
if (r.indexOf(i) < 0) throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`);
|
|
1218
1218
|
};
|
|
1219
1219
|
}
|
|
1220
|
-
var
|
|
1220
|
+
var ke = class {
|
|
1221
1221
|
constructor(e, t, n) {
|
|
1222
|
-
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ?
|
|
1222
|
+
this.hasDefault = Object.prototype.hasOwnProperty.call(n, "default"), this.default = n.default, this.validate = typeof n.validate == "string" ? Oe(e, t, n.validate) : n.validate;
|
|
1223
1223
|
}
|
|
1224
1224
|
get isRequired() {
|
|
1225
1225
|
return !this.hasDefault;
|
|
1226
1226
|
}
|
|
1227
|
-
},
|
|
1227
|
+
}, Ae = class e {
|
|
1228
1228
|
constructor(e, t, n, r) {
|
|
1229
|
-
this.name = e, this.rank = t, this.schema = n, this.spec = r, this.attrs =
|
|
1230
|
-
let i =
|
|
1229
|
+
this.name = e, this.rank = t, this.schema = n, this.spec = r, this.attrs = Ee(e, r.attrs), this.excluded = null;
|
|
1230
|
+
let i = Ce(this.attrs);
|
|
1231
1231
|
this.instance = i ? new s(this, i) : null;
|
|
1232
1232
|
}
|
|
1233
1233
|
create(e = null) {
|
|
1234
|
-
return !e && this.instance ? this.instance : new s(this,
|
|
1234
|
+
return !e && this.instance ? this.instance : new s(this, we(this.attrs, e));
|
|
1235
1235
|
}
|
|
1236
1236
|
static compile(t, n) {
|
|
1237
1237
|
let r = Object.create(null), i = 0;
|
|
@@ -1245,43 +1245,43 @@ var Oe = class {
|
|
|
1245
1245
|
for (let t = 0; t < e.length; t++) if (e[t].type == this) return e[t];
|
|
1246
1246
|
}
|
|
1247
1247
|
checkAttrs(e) {
|
|
1248
|
-
|
|
1248
|
+
Te(this.attrs, e, "mark", this.name);
|
|
1249
1249
|
}
|
|
1250
1250
|
excludes(e) {
|
|
1251
1251
|
return this.excluded.indexOf(e) > -1;
|
|
1252
1252
|
}
|
|
1253
|
-
},
|
|
1253
|
+
}, je = class {
|
|
1254
1254
|
constructor(t) {
|
|
1255
1255
|
this.linebreakReplacement = null, this.cached = Object.create(null);
|
|
1256
1256
|
let n = this.spec = {};
|
|
1257
1257
|
for (let e in t) n[e] = t[e];
|
|
1258
|
-
n.nodes = e.from(t.nodes), n.marks = e.from(t.marks || {}), this.nodes =
|
|
1258
|
+
n.nodes = e.from(t.nodes), n.marks = e.from(t.marks || {}), this.nodes = De.compile(this.spec.nodes, this), this.marks = Ae.compile(this.spec.marks, this);
|
|
1259
1259
|
let r = Object.create(null);
|
|
1260
1260
|
for (let e in this.nodes) {
|
|
1261
1261
|
if (e in this.marks) throw RangeError(e + " can not be both a node and a mark");
|
|
1262
1262
|
let t = this.nodes[e], n = t.spec.content || "", i = t.spec.marks;
|
|
1263
|
-
if (t.contentMatch = r[n] || (r[n] =
|
|
1263
|
+
if (t.contentMatch = r[n] || (r[n] = le.parse(n, this.nodes)), t.inlineContent = t.contentMatch.inlineContent, t.spec.linebreakReplacement) {
|
|
1264
1264
|
if (this.linebreakReplacement) throw RangeError("Multiple linebreak nodes defined");
|
|
1265
1265
|
if (!t.isInline || !t.isLeaf) throw RangeError("Linebreak replacement nodes must be inline leaf nodes");
|
|
1266
1266
|
this.linebreakReplacement = t;
|
|
1267
1267
|
}
|
|
1268
|
-
t.markSet = i == "_" ? null : i ?
|
|
1268
|
+
t.markSet = i == "_" ? null : i ? Me(this, i.split(" ")) : i == "" || !t.inlineContent ? [] : null;
|
|
1269
1269
|
}
|
|
1270
1270
|
for (let e in this.marks) {
|
|
1271
1271
|
let t = this.marks[e], n = t.spec.excludes;
|
|
1272
|
-
t.excluded = n == null ? [t] : n == "" ? [] :
|
|
1272
|
+
t.excluded = n == null ? [t] : n == "" ? [] : Me(this, n.split(" "));
|
|
1273
1273
|
}
|
|
1274
|
-
this.nodeFromJSON = (e) =>
|
|
1274
|
+
this.nodeFromJSON = (e) => x.fromJSON(this, e), this.markFromJSON = (e) => s.fromJSON(this, e), this.topNodeType = this.nodes[this.spec.topNode || "doc"], this.cached.wrappings = Object.create(null);
|
|
1275
1275
|
}
|
|
1276
1276
|
node(e, t = null, n, r) {
|
|
1277
1277
|
if (typeof e == "string") e = this.nodeType(e);
|
|
1278
|
-
else if (!(e instanceof
|
|
1278
|
+
else if (!(e instanceof De)) throw RangeError("Invalid node type: " + e);
|
|
1279
1279
|
else if (e.schema != this) throw RangeError("Node type from different schema used (" + e.name + ")");
|
|
1280
1280
|
return e.createChecked(t, n, r);
|
|
1281
1281
|
}
|
|
1282
1282
|
text(e, t) {
|
|
1283
1283
|
let n = this.nodes.text;
|
|
1284
|
-
return new
|
|
1284
|
+
return new se(n, n.defaultAttrs, e, s.setFrom(t));
|
|
1285
1285
|
}
|
|
1286
1286
|
mark(e, t) {
|
|
1287
1287
|
return typeof e == "string" && (e = this.marks[e]), e.create(t);
|
|
@@ -1292,7 +1292,7 @@ var Oe = class {
|
|
|
1292
1292
|
return t;
|
|
1293
1293
|
}
|
|
1294
1294
|
};
|
|
1295
|
-
function
|
|
1295
|
+
function Me(e, t) {
|
|
1296
1296
|
let n = [];
|
|
1297
1297
|
for (let r = 0; r < t.length; r++) {
|
|
1298
1298
|
let i = t[r], a = e.marks[i], o = a;
|
|
@@ -1305,19 +1305,19 @@ function je(e, t) {
|
|
|
1305
1305
|
}
|
|
1306
1306
|
return n;
|
|
1307
1307
|
}
|
|
1308
|
-
function
|
|
1308
|
+
function Ne(e) {
|
|
1309
1309
|
return e.tag != null;
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1311
|
+
function Pe(e) {
|
|
1312
1312
|
return e.style != null;
|
|
1313
1313
|
}
|
|
1314
|
-
var
|
|
1314
|
+
var Fe = class e {
|
|
1315
1315
|
constructor(e, t) {
|
|
1316
1316
|
this.schema = e, this.rules = t, this.tags = [], this.styles = [];
|
|
1317
1317
|
let n = this.matchedStyles = [];
|
|
1318
1318
|
t.forEach((e) => {
|
|
1319
|
-
if (
|
|
1320
|
-
else if (
|
|
1319
|
+
if (Ne(e)) this.tags.push(e);
|
|
1320
|
+
else if (Pe(e)) {
|
|
1321
1321
|
let t = /[^=]*/.exec(e.style)[0];
|
|
1322
1322
|
n.indexOf(t) < 0 && n.push(t), this.styles.push(e);
|
|
1323
1323
|
}
|
|
@@ -1328,17 +1328,17 @@ var Pe = class e {
|
|
|
1328
1328
|
});
|
|
1329
1329
|
}
|
|
1330
1330
|
parse(e, t = {}) {
|
|
1331
|
-
let n = new
|
|
1331
|
+
let n = new We(this, t, !1);
|
|
1332
1332
|
return n.addAll(e, s.none, t.from, t.to), n.finish();
|
|
1333
1333
|
}
|
|
1334
1334
|
parseSlice(e, t = {}) {
|
|
1335
|
-
let n = new
|
|
1335
|
+
let n = new We(this, t, !0);
|
|
1336
1336
|
return n.addAll(e, s.none, t.from, t.to), l.maxOpen(n.finish());
|
|
1337
1337
|
}
|
|
1338
1338
|
matchTag(e, t, n) {
|
|
1339
1339
|
for (let r = n ? this.tags.indexOf(n) + 1 : 0; r < this.tags.length; r++) {
|
|
1340
1340
|
let n = this.tags[r];
|
|
1341
|
-
if (
|
|
1341
|
+
if (Ke(e, n.tag) && (n.namespace === void 0 || e.namespaceURI == n.namespace) && (!n.context || t.matchesContext(n.context))) {
|
|
1342
1342
|
if (n.getAttrs) {
|
|
1343
1343
|
let t = n.getAttrs(e);
|
|
1344
1344
|
if (t === !1) continue;
|
|
@@ -1374,13 +1374,13 @@ var Pe = class e {
|
|
|
1374
1374
|
for (let t in e.marks) {
|
|
1375
1375
|
let r = e.marks[t].spec.parseDOM;
|
|
1376
1376
|
r && r.forEach((e) => {
|
|
1377
|
-
n(e =
|
|
1377
|
+
n(e = qe(e)), e.mark || e.ignore || e.clearMark || (e.mark = t);
|
|
1378
1378
|
});
|
|
1379
1379
|
}
|
|
1380
1380
|
for (let t in e.nodes) {
|
|
1381
1381
|
let r = e.nodes[t].spec.parseDOM;
|
|
1382
1382
|
r && r.forEach((e) => {
|
|
1383
|
-
n(e =
|
|
1383
|
+
n(e = qe(e)), e.node || e.ignore || e.mark || (e.node = t);
|
|
1384
1384
|
});
|
|
1385
1385
|
}
|
|
1386
1386
|
return t;
|
|
@@ -1388,7 +1388,7 @@ var Pe = class e {
|
|
|
1388
1388
|
static fromSchema(t) {
|
|
1389
1389
|
return t.cached.domParser || (t.cached.domParser = new e(t, e.schemaRules(t)));
|
|
1390
1390
|
}
|
|
1391
|
-
},
|
|
1391
|
+
}, Ie = {
|
|
1392
1392
|
address: !0,
|
|
1393
1393
|
article: !0,
|
|
1394
1394
|
aside: !0,
|
|
@@ -1421,23 +1421,23 @@ var Pe = class e {
|
|
|
1421
1421
|
table: !0,
|
|
1422
1422
|
tfoot: !0,
|
|
1423
1423
|
ul: !0
|
|
1424
|
-
},
|
|
1424
|
+
}, Le = {
|
|
1425
1425
|
head: !0,
|
|
1426
1426
|
noscript: !0,
|
|
1427
1427
|
object: !0,
|
|
1428
1428
|
script: !0,
|
|
1429
1429
|
style: !0,
|
|
1430
1430
|
title: !0
|
|
1431
|
-
},
|
|
1431
|
+
}, Re = {
|
|
1432
1432
|
ol: !0,
|
|
1433
1433
|
ul: !0
|
|
1434
|
-
},
|
|
1435
|
-
function
|
|
1436
|
-
return t == null ? e && e.whitespace == "pre" ?
|
|
1434
|
+
}, ze = 1, Be = 2, Ve = 4;
|
|
1435
|
+
function He(e, t, n) {
|
|
1436
|
+
return t == null ? e && e.whitespace == "pre" ? 3 : n & -5 : (t ? ze : 0) | (t === "full" ? Be : 0);
|
|
1437
1437
|
}
|
|
1438
|
-
var
|
|
1438
|
+
var Ue = class {
|
|
1439
1439
|
constructor(e, t, n, r, i, a) {
|
|
1440
|
-
this.type = e, this.attrs = t, this.marks = n, this.solid = r, this.options = a, this.content = [], this.activeMarks = s.none, this.match = i || (a &
|
|
1440
|
+
this.type = e, this.attrs = t, this.marks = n, this.solid = r, this.options = a, this.content = [], this.activeMarks = s.none, this.match = i || (a & Ve ? null : e.contentMatch);
|
|
1441
1441
|
}
|
|
1442
1442
|
findWrapping(e) {
|
|
1443
1443
|
if (!this.match) {
|
|
@@ -1452,7 +1452,7 @@ var He = class {
|
|
|
1452
1452
|
return this.match.findWrapping(e.type);
|
|
1453
1453
|
}
|
|
1454
1454
|
finish(e) {
|
|
1455
|
-
if (!(this.options &
|
|
1455
|
+
if (!(this.options & ze)) {
|
|
1456
1456
|
let e = this.content[this.content.length - 1], t;
|
|
1457
1457
|
if (e && e.isText && (t = /[ \t\r\n\u000c]+$/.exec(e.text))) {
|
|
1458
1458
|
let n = e;
|
|
@@ -1463,13 +1463,13 @@ var He = class {
|
|
|
1463
1463
|
return !e && this.match && (t = t.append(this.match.fillBefore(r.empty, !0))), this.type ? this.type.create(this.attrs, t, this.marks) : t;
|
|
1464
1464
|
}
|
|
1465
1465
|
inlineContext(e) {
|
|
1466
|
-
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !
|
|
1466
|
+
return this.type ? this.type.inlineContent : this.content.length ? this.content[0].isInline : e.parentNode && !Ie.hasOwnProperty(e.parentNode.nodeName.toLowerCase());
|
|
1467
1467
|
}
|
|
1468
|
-
},
|
|
1468
|
+
}, We = class {
|
|
1469
1469
|
constructor(e, t, n) {
|
|
1470
1470
|
this.parser = e, this.options = t, this.isOpen = n, this.open = 0, this.localPreserveWS = !1;
|
|
1471
|
-
let r = t.topNode, i, a =
|
|
1472
|
-
i = r ? new
|
|
1471
|
+
let r = t.topNode, i, a = He(null, t.preserveWhitespace, 0) | (n ? Ve : 0);
|
|
1472
|
+
i = r ? new Ue(r.type, r.attrs, s.none, !0, t.topMatch || r.type.contentMatch, a) : n ? new Ue(null, null, s.none, !0, null, a) : new Ue(e.schema.topNodeType, null, s.none, !0, null, a), this.nodes = [i], this.find = t.findPositions, this.needsBlock = !1;
|
|
1473
1473
|
}
|
|
1474
1474
|
get top() {
|
|
1475
1475
|
return this.nodes[this.open];
|
|
@@ -1478,7 +1478,7 @@ var He = class {
|
|
|
1478
1478
|
e.nodeType == 3 ? this.addTextNode(e, t) : e.nodeType == 1 && this.addElement(e, t);
|
|
1479
1479
|
}
|
|
1480
1480
|
addTextNode(e, t) {
|
|
1481
|
-
let n = e.nodeValue, r = this.top, i = r.options &
|
|
1481
|
+
let n = e.nodeValue, r = this.top, i = r.options & Be ? "full" : this.localPreserveWS || (r.options & ze) > 0, { schema: a } = this.parser;
|
|
1482
1482
|
if (i === "full" || r.inlineContext(e) || /[^ \t\r\n\u000c]/.test(n)) {
|
|
1483
1483
|
if (!i) {
|
|
1484
1484
|
if (n = n.replace(/[ \t\r\n\u000c]+/g, " "), /^[ \t\r\n\u000c]/.test(n) && this.open == this.nodes.length - 1) {
|
|
@@ -1498,13 +1498,13 @@ var He = class {
|
|
|
1498
1498
|
let r = this.localPreserveWS, i = this.top;
|
|
1499
1499
|
(e.tagName == "PRE" || /pre/.test(e.style && e.style.whiteSpace)) && (this.localPreserveWS = !0);
|
|
1500
1500
|
let a = e.nodeName.toLowerCase(), o;
|
|
1501
|
-
|
|
1501
|
+
Re.hasOwnProperty(a) && this.parser.normalizeLists && Ge(e);
|
|
1502
1502
|
let s = this.options.ruleFromNode && this.options.ruleFromNode(e) || (o = this.parser.matchTag(e, this, n));
|
|
1503
|
-
out: if (s ? s.ignore :
|
|
1503
|
+
out: if (s ? s.ignore : Le.hasOwnProperty(a)) this.findInside(e), this.ignoreFallback(e, t);
|
|
1504
1504
|
else if (!s || s.skip || s.closeParent) {
|
|
1505
1505
|
s && s.closeParent ? this.open = Math.max(0, this.open - 1) : s && s.skip.nodeType && (e = s.skip);
|
|
1506
1506
|
let n, r = this.needsBlock;
|
|
1507
|
-
if (
|
|
1507
|
+
if (Ie.hasOwnProperty(a)) i.content.length && i.content[0].isInline && this.open && (this.open--, i = this.top), n = !0, i.type || (this.needsBlock = !0);
|
|
1508
1508
|
else if (!e.firstChild) {
|
|
1509
1509
|
this.leafFallback(e, t);
|
|
1510
1510
|
break out;
|
|
@@ -1589,7 +1589,7 @@ var He = class {
|
|
|
1589
1589
|
let t = this.top;
|
|
1590
1590
|
t.match &&= t.match.matchType(e.type);
|
|
1591
1591
|
let n = s.none;
|
|
1592
|
-
for (let i of r.concat(e.marks)) (t.type ? t.type.allowsMarkType(i.type) :
|
|
1592
|
+
for (let i of r.concat(e.marks)) (t.type ? t.type.allowsMarkType(i.type) : Je(i.type, e.type)) && (n = i.addToSet(n));
|
|
1593
1593
|
return t.content.push(e.mark(n)), !0;
|
|
1594
1594
|
}
|
|
1595
1595
|
return !1;
|
|
@@ -1602,10 +1602,10 @@ var He = class {
|
|
|
1602
1602
|
this.closeExtra();
|
|
1603
1603
|
let a = this.top;
|
|
1604
1604
|
a.match = a.match && a.match.matchType(e);
|
|
1605
|
-
let o =
|
|
1606
|
-
a.options &
|
|
1605
|
+
let o = He(e, i, a.options);
|
|
1606
|
+
a.options & Ve && a.content.length == 0 && (o |= Ve);
|
|
1607
1607
|
let c = s.none;
|
|
1608
|
-
return n = n.filter((t) => (a.type ? a.type.allowsMarkType(t.type) :
|
|
1608
|
+
return n = n.filter((t) => (a.type ? a.type.allowsMarkType(t.type) : Je(t.type, e)) ? (c = t.addToSet(c), !1) : !0), this.nodes.push(new Ue(e, t, c, r, null, o)), this.open++, n;
|
|
1609
1609
|
}
|
|
1610
1610
|
closeExtra(e = !1) {
|
|
1611
1611
|
let t = this.nodes.length - 1;
|
|
@@ -1619,7 +1619,7 @@ var He = class {
|
|
|
1619
1619
|
}
|
|
1620
1620
|
sync(e) {
|
|
1621
1621
|
for (let t = this.open; t >= 0; t--) if (this.nodes[t] == e) return this.open = t, !0;
|
|
1622
|
-
else this.localPreserveWS && (this.nodes[t].options |=
|
|
1622
|
+
else this.localPreserveWS && (this.nodes[t].options |= ze);
|
|
1623
1623
|
return !1;
|
|
1624
1624
|
}
|
|
1625
1625
|
get currentPos() {
|
|
@@ -1675,21 +1675,21 @@ var He = class {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
}
|
|
1677
1677
|
};
|
|
1678
|
-
function
|
|
1678
|
+
function Ge(e) {
|
|
1679
1679
|
for (let t = e.firstChild, n = null; t; t = t.nextSibling) {
|
|
1680
1680
|
let e = t.nodeType == 1 ? t.nodeName.toLowerCase() : null;
|
|
1681
|
-
e &&
|
|
1681
|
+
e && Re.hasOwnProperty(e) && n ? (n.appendChild(t), t = n) : e == "li" ? n = t : e && (n = null);
|
|
1682
1682
|
}
|
|
1683
1683
|
}
|
|
1684
|
-
function
|
|
1684
|
+
function Ke(e, t) {
|
|
1685
1685
|
return (e.matches || e.msMatchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector).call(e, t);
|
|
1686
1686
|
}
|
|
1687
|
-
function
|
|
1687
|
+
function qe(e) {
|
|
1688
1688
|
let t = {};
|
|
1689
1689
|
for (let n in e) t[n] = e[n];
|
|
1690
1690
|
return t;
|
|
1691
1691
|
}
|
|
1692
|
-
function
|
|
1692
|
+
function Je(e, t) {
|
|
1693
1693
|
let n = t.schema.nodes;
|
|
1694
1694
|
for (let r in n) {
|
|
1695
1695
|
let i = n[r];
|
|
@@ -1704,12 +1704,12 @@ function qe(e, t) {
|
|
|
1704
1704
|
if (o(i.contentMatch)) return !0;
|
|
1705
1705
|
}
|
|
1706
1706
|
}
|
|
1707
|
-
var
|
|
1707
|
+
var Ye = class e {
|
|
1708
1708
|
constructor(e, t) {
|
|
1709
1709
|
this.nodes = e, this.marks = t;
|
|
1710
1710
|
}
|
|
1711
1711
|
serializeFragment(e, t = {}, n) {
|
|
1712
|
-
n ||=
|
|
1712
|
+
n ||= Ze(t).createDocumentFragment();
|
|
1713
1713
|
let r = n, i = [];
|
|
1714
1714
|
return e.forEach((e) => {
|
|
1715
1715
|
if (i.length || e.marks.length) {
|
|
@@ -1733,8 +1733,8 @@ var Je = class e {
|
|
|
1733
1733
|
}), n;
|
|
1734
1734
|
}
|
|
1735
1735
|
serializeNodeInner(e, t) {
|
|
1736
|
-
if (e.isText) return
|
|
1737
|
-
let { dom: n, contentDOM: r } =
|
|
1736
|
+
if (e.isText) return Ze(t).createTextNode(e.text);
|
|
1737
|
+
let { dom: n, contentDOM: r } = tt(Ze(t), this.nodes[e.type.name](e), null, e.attrs);
|
|
1738
1738
|
if (r) {
|
|
1739
1739
|
if (e.isLeaf) throw RangeError("Content hole not allowed in a leaf node spec");
|
|
1740
1740
|
this.serializeFragment(e.content, t, r);
|
|
@@ -1751,23 +1751,23 @@ var Je = class e {
|
|
|
1751
1751
|
}
|
|
1752
1752
|
serializeMark(e, t, n = {}) {
|
|
1753
1753
|
let r = this.marks[e.type.name];
|
|
1754
|
-
return r &&
|
|
1754
|
+
return r && tt(Ze(n), r(e, t), null, e.attrs);
|
|
1755
1755
|
}
|
|
1756
1756
|
static renderSpec(e, t, n = null, r) {
|
|
1757
|
-
return typeof t == "string" ? { dom: e.createTextNode(t) } :
|
|
1757
|
+
return typeof t == "string" ? { dom: e.createTextNode(t) } : tt(e, t, n, r);
|
|
1758
1758
|
}
|
|
1759
1759
|
static fromSchema(t) {
|
|
1760
1760
|
return t.cached.domSerializer || (t.cached.domSerializer = new e(this.nodesFromSchema(t), this.marksFromSchema(t)));
|
|
1761
1761
|
}
|
|
1762
1762
|
static nodesFromSchema(e) {
|
|
1763
|
-
let t =
|
|
1763
|
+
let t = Xe(e.nodes);
|
|
1764
1764
|
return t.text ||= (e) => e.text, t;
|
|
1765
1765
|
}
|
|
1766
1766
|
static marksFromSchema(e) {
|
|
1767
|
-
return
|
|
1767
|
+
return Xe(e.marks);
|
|
1768
1768
|
}
|
|
1769
1769
|
};
|
|
1770
|
-
function
|
|
1770
|
+
function Xe(e) {
|
|
1771
1771
|
let t = {};
|
|
1772
1772
|
for (let n in e) {
|
|
1773
1773
|
let r = e[n].spec.toDOM;
|
|
@@ -1775,15 +1775,15 @@ function Ye(e) {
|
|
|
1775
1775
|
}
|
|
1776
1776
|
return t;
|
|
1777
1777
|
}
|
|
1778
|
-
function
|
|
1778
|
+
function Ze(e) {
|
|
1779
1779
|
return e.document || window.document;
|
|
1780
1780
|
}
|
|
1781
|
-
var
|
|
1782
|
-
function Qe(e) {
|
|
1783
|
-
let t = Ze.get(e);
|
|
1784
|
-
return t === void 0 && Ze.set(e, t = $e(e)), t;
|
|
1785
|
-
}
|
|
1781
|
+
var Qe = /* @__PURE__ */ new WeakMap();
|
|
1786
1782
|
function $e(e) {
|
|
1783
|
+
let t = Qe.get(e);
|
|
1784
|
+
return t === void 0 && Qe.set(e, t = et(e)), t;
|
|
1785
|
+
}
|
|
1786
|
+
function et(e) {
|
|
1787
1787
|
let t = null;
|
|
1788
1788
|
function n(e) {
|
|
1789
1789
|
if (e && typeof e == "object") if (Array.isArray(e)) if (typeof e[0] == "string") t ||= [], t.push(e);
|
|
@@ -1792,12 +1792,12 @@ function $e(e) {
|
|
|
1792
1792
|
}
|
|
1793
1793
|
return n(e), t;
|
|
1794
1794
|
}
|
|
1795
|
-
function
|
|
1795
|
+
function tt(e, t, n, r) {
|
|
1796
1796
|
if (t.nodeType == 3) return { dom: t };
|
|
1797
1797
|
if (t.dom && t.dom.nodeType == 3) return t;
|
|
1798
1798
|
let i = t[0], a;
|
|
1799
1799
|
if (typeof i != "string") throw RangeError("Invalid array passed to renderSpec");
|
|
1800
|
-
if (r && (a =
|
|
1800
|
+
if (r && (a = $e(r)) && a.indexOf(t) > -1) throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");
|
|
1801
1801
|
let o = i.indexOf(" ");
|
|
1802
1802
|
o > 0 && (n = i.slice(0, o), i = i.slice(o + 1));
|
|
1803
1803
|
let s, c = n ? e.createElementNS(n, i) : e.createElement(i), l = t[1], u = 1;
|
|
@@ -1818,7 +1818,7 @@ function et(e, t, n, r) {
|
|
|
1818
1818
|
};
|
|
1819
1819
|
} else if (typeof a == "string") c.appendChild(e.createTextNode(a));
|
|
1820
1820
|
else {
|
|
1821
|
-
let { dom: t, contentDOM: i } =
|
|
1821
|
+
let { dom: t, contentDOM: i } = tt(e, a, n, r);
|
|
1822
1822
|
if (c.appendChild(t), i) {
|
|
1823
1823
|
if (s) throw RangeError("Multiple content holes");
|
|
1824
1824
|
s = i;
|
|
@@ -1832,40 +1832,40 @@ function et(e, t, n, r) {
|
|
|
1832
1832
|
}
|
|
1833
1833
|
//#endregion
|
|
1834
1834
|
//#region ../../node_modules/.pnpm/prosemirror-transform@1.12.0/node_modules/prosemirror-transform/dist/index.js
|
|
1835
|
-
var
|
|
1836
|
-
function
|
|
1837
|
-
return e + t *
|
|
1838
|
-
}
|
|
1839
|
-
function it(e) {
|
|
1840
|
-
return e & tt;
|
|
1835
|
+
var nt = 65535, rt = 2 ** 16;
|
|
1836
|
+
function it(e, t) {
|
|
1837
|
+
return e + t * rt;
|
|
1841
1838
|
}
|
|
1842
1839
|
function at(e) {
|
|
1843
|
-
return
|
|
1840
|
+
return e & nt;
|
|
1844
1841
|
}
|
|
1845
|
-
|
|
1842
|
+
function ot(e) {
|
|
1843
|
+
return (e - (e & nt)) / rt;
|
|
1844
|
+
}
|
|
1845
|
+
var st = 1, ct = 2, lt = 4, ut = 8, dt = class {
|
|
1846
1846
|
constructor(e, t, n) {
|
|
1847
1847
|
this.pos = e, this.delInfo = t, this.recover = n;
|
|
1848
1848
|
}
|
|
1849
1849
|
get deleted() {
|
|
1850
|
-
return (this.delInfo &
|
|
1850
|
+
return (this.delInfo & ut) > 0;
|
|
1851
1851
|
}
|
|
1852
1852
|
get deletedBefore() {
|
|
1853
|
-
return (this.delInfo &
|
|
1853
|
+
return (this.delInfo & 5) > 0;
|
|
1854
1854
|
}
|
|
1855
1855
|
get deletedAfter() {
|
|
1856
|
-
return (this.delInfo &
|
|
1856
|
+
return (this.delInfo & 6) > 0;
|
|
1857
1857
|
}
|
|
1858
1858
|
get deletedAcross() {
|
|
1859
|
-
return (this.delInfo &
|
|
1859
|
+
return (this.delInfo & lt) > 0;
|
|
1860
1860
|
}
|
|
1861
|
-
},
|
|
1861
|
+
}, ft = class e {
|
|
1862
1862
|
constructor(t, n = !1) {
|
|
1863
1863
|
if (this.ranges = t, this.inverted = n, !t.length && e.empty) return e.empty;
|
|
1864
1864
|
}
|
|
1865
1865
|
recover(e) {
|
|
1866
|
-
let t = 0, n =
|
|
1866
|
+
let t = 0, n = at(e);
|
|
1867
1867
|
if (!this.inverted) for (let e = 0; e < n; e++) t += this.ranges[e * 3 + 2] - this.ranges[e * 3 + 1];
|
|
1868
|
-
return this.ranges[n * 3] + t +
|
|
1868
|
+
return this.ranges[n * 3] + t + ot(e);
|
|
1869
1869
|
}
|
|
1870
1870
|
mapResult(e, t = 1) {
|
|
1871
1871
|
return this._map(e, t, !1);
|
|
@@ -1882,15 +1882,15 @@ var ot = 1, st = 2, ct = 4, lt = 8, ut = class {
|
|
|
1882
1882
|
if (e <= u) {
|
|
1883
1883
|
let i = c ? e == s ? -1 : e == u ? 1 : t : t, a = s + r + (i < 0 ? 0 : l);
|
|
1884
1884
|
if (n) return a;
|
|
1885
|
-
let d = e == (t < 0 ? s : u) ? null :
|
|
1886
|
-
return (t < 0 ? e != s : e != u) && (f |=
|
|
1885
|
+
let d = e == (t < 0 ? s : u) ? null : it(o / 3, e - s), f = e == s ? ct : e == u ? st : lt;
|
|
1886
|
+
return (t < 0 ? e != s : e != u) && (f |= ut), new dt(a, f, d);
|
|
1887
1887
|
}
|
|
1888
1888
|
r += l - c;
|
|
1889
1889
|
}
|
|
1890
|
-
return n ? e + r : new
|
|
1890
|
+
return n ? e + r : new dt(e + r, 0, null);
|
|
1891
1891
|
}
|
|
1892
1892
|
touches(e, t) {
|
|
1893
|
-
let n = 0, r =
|
|
1893
|
+
let n = 0, r = at(t), i = this.inverted ? 2 : 1, a = this.inverted ? 1 : 2;
|
|
1894
1894
|
for (let t = 0; t < this.ranges.length; t += 3) {
|
|
1895
1895
|
let o = this.ranges[t] - (this.inverted ? n : 0);
|
|
1896
1896
|
if (o > e) break;
|
|
@@ -1925,8 +1925,8 @@ var ot = 1, st = 2, ct = 4, lt = 8, ut = class {
|
|
|
1925
1925
|
]);
|
|
1926
1926
|
}
|
|
1927
1927
|
};
|
|
1928
|
-
|
|
1929
|
-
var
|
|
1928
|
+
ft.empty = new ft([]);
|
|
1929
|
+
var pt = class e {
|
|
1930
1930
|
constructor(e, t, n = 0, r = e ? e.length : 0) {
|
|
1931
1931
|
this.mirror = t, this.from = n, this.to = r, this._maps = e || [], this.ownData = !(e || t);
|
|
1932
1932
|
}
|
|
@@ -1984,26 +1984,26 @@ var ft = class e {
|
|
|
1984
1984
|
}
|
|
1985
1985
|
r |= i.delInfo, e = i.pos;
|
|
1986
1986
|
}
|
|
1987
|
-
return n ? e : new
|
|
1987
|
+
return n ? e : new dt(e, r, null);
|
|
1988
1988
|
}
|
|
1989
|
-
},
|
|
1989
|
+
}, mt = Object.create(null), S = class {
|
|
1990
1990
|
getMap() {
|
|
1991
|
-
return
|
|
1991
|
+
return ft.empty;
|
|
1992
1992
|
}
|
|
1993
1993
|
merge(e) {
|
|
1994
1994
|
return null;
|
|
1995
1995
|
}
|
|
1996
1996
|
static fromJSON(e, t) {
|
|
1997
1997
|
if (!t || !t.stepType) throw RangeError("Invalid input for Step.fromJSON");
|
|
1998
|
-
let n =
|
|
1998
|
+
let n = mt[t.stepType];
|
|
1999
1999
|
if (!n) throw RangeError(`No step type ${t.stepType} defined`);
|
|
2000
2000
|
return n.fromJSON(e, t);
|
|
2001
2001
|
}
|
|
2002
2002
|
static jsonID(e, t) {
|
|
2003
|
-
if (e in
|
|
2004
|
-
return
|
|
2003
|
+
if (e in mt) throw RangeError("Duplicate use of step JSON ID " + e);
|
|
2004
|
+
return mt[e] = t, t.prototype.jsonID = e, t;
|
|
2005
2005
|
}
|
|
2006
|
-
},
|
|
2006
|
+
}, C = class e {
|
|
2007
2007
|
constructor(e, t) {
|
|
2008
2008
|
this.doc = e, this.failed = t;
|
|
2009
2009
|
}
|
|
@@ -2022,24 +2022,24 @@ var ft = class e {
|
|
|
2022
2022
|
}
|
|
2023
2023
|
}
|
|
2024
2024
|
};
|
|
2025
|
-
function
|
|
2025
|
+
function ht(e, t, n) {
|
|
2026
2026
|
let i = [];
|
|
2027
2027
|
for (let r = 0; r < e.childCount; r++) {
|
|
2028
2028
|
let a = e.child(r);
|
|
2029
|
-
a.content.size && (a = a.copy(
|
|
2029
|
+
a.content.size && (a = a.copy(ht(a.content, t, a))), a.isInline && (a = t(a, n, r)), i.push(a);
|
|
2030
2030
|
}
|
|
2031
2031
|
return r.fromArray(i);
|
|
2032
2032
|
}
|
|
2033
|
-
var
|
|
2033
|
+
var gt = class e extends S {
|
|
2034
2034
|
constructor(e, t, n) {
|
|
2035
2035
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
2036
2036
|
}
|
|
2037
2037
|
apply(e) {
|
|
2038
|
-
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new l(
|
|
2039
|
-
return
|
|
2038
|
+
let t = e.slice(this.from, this.to), n = e.resolve(this.from), r = n.node(n.sharedDepth(this.to)), i = new l(ht(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);
|
|
2039
|
+
return C.fromReplace(e, this.from, this.to, i);
|
|
2040
2040
|
}
|
|
2041
2041
|
invert() {
|
|
2042
|
-
return new
|
|
2042
|
+
return new _t(this.from, this.to, this.mark);
|
|
2043
2043
|
}
|
|
2044
2044
|
map(t) {
|
|
2045
2045
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -2061,17 +2061,17 @@ var ht = class e extends C {
|
|
|
2061
2061
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
2062
2062
|
}
|
|
2063
2063
|
};
|
|
2064
|
-
|
|
2065
|
-
var
|
|
2064
|
+
S.jsonID("addMark", gt);
|
|
2065
|
+
var _t = class e extends S {
|
|
2066
2066
|
constructor(e, t, n) {
|
|
2067
2067
|
super(), this.from = e, this.to = t, this.mark = n;
|
|
2068
2068
|
}
|
|
2069
2069
|
apply(e) {
|
|
2070
|
-
let t = e.slice(this.from, this.to), n = new l(
|
|
2071
|
-
return
|
|
2070
|
+
let t = e.slice(this.from, this.to), n = new l(ht(t.content, (e) => e.mark(this.mark.removeFromSet(e.marks)), e), t.openStart, t.openEnd);
|
|
2071
|
+
return C.fromReplace(e, this.from, this.to, n);
|
|
2072
2072
|
}
|
|
2073
2073
|
invert() {
|
|
2074
|
-
return new
|
|
2074
|
+
return new gt(this.from, this.to, this.mark);
|
|
2075
2075
|
}
|
|
2076
2076
|
map(t) {
|
|
2077
2077
|
let n = t.mapResult(this.from, 1), r = t.mapResult(this.to, -1);
|
|
@@ -2093,16 +2093,16 @@ var gt = class e extends C {
|
|
|
2093
2093
|
return new e(n.from, n.to, t.markFromJSON(n.mark));
|
|
2094
2094
|
}
|
|
2095
2095
|
};
|
|
2096
|
-
|
|
2097
|
-
var
|
|
2096
|
+
S.jsonID("removeMark", _t);
|
|
2097
|
+
var vt = class e extends S {
|
|
2098
2098
|
constructor(e, t) {
|
|
2099
2099
|
super(), this.pos = e, this.mark = t;
|
|
2100
2100
|
}
|
|
2101
2101
|
apply(e) {
|
|
2102
2102
|
let t = e.nodeAt(this.pos);
|
|
2103
|
-
if (!t) return
|
|
2103
|
+
if (!t) return C.fail("No node at mark step's position");
|
|
2104
2104
|
let n = t.type.create(t.attrs, null, this.mark.addToSet(t.marks));
|
|
2105
|
-
return
|
|
2105
|
+
return C.fromReplace(e, this.pos, this.pos + 1, new l(r.from(n), 0, +!t.isLeaf));
|
|
2106
2106
|
}
|
|
2107
2107
|
invert(t) {
|
|
2108
2108
|
let n = t.nodeAt(this.pos);
|
|
@@ -2113,7 +2113,7 @@ var _t = class e extends C {
|
|
|
2113
2113
|
return new e(this.pos, this.mark);
|
|
2114
2114
|
}
|
|
2115
2115
|
}
|
|
2116
|
-
return new
|
|
2116
|
+
return new yt(this.pos, this.mark);
|
|
2117
2117
|
}
|
|
2118
2118
|
map(t) {
|
|
2119
2119
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -2131,20 +2131,20 @@ var _t = class e extends C {
|
|
|
2131
2131
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
2132
2132
|
}
|
|
2133
2133
|
};
|
|
2134
|
-
|
|
2135
|
-
var
|
|
2134
|
+
S.jsonID("addNodeMark", vt);
|
|
2135
|
+
var yt = class e extends S {
|
|
2136
2136
|
constructor(e, t) {
|
|
2137
2137
|
super(), this.pos = e, this.mark = t;
|
|
2138
2138
|
}
|
|
2139
2139
|
apply(e) {
|
|
2140
2140
|
let t = e.nodeAt(this.pos);
|
|
2141
|
-
if (!t) return
|
|
2141
|
+
if (!t) return C.fail("No node at mark step's position");
|
|
2142
2142
|
let n = t.type.create(t.attrs, null, this.mark.removeFromSet(t.marks));
|
|
2143
|
-
return
|
|
2143
|
+
return C.fromReplace(e, this.pos, this.pos + 1, new l(r.from(n), 0, +!t.isLeaf));
|
|
2144
2144
|
}
|
|
2145
2145
|
invert(e) {
|
|
2146
2146
|
let t = e.nodeAt(this.pos);
|
|
2147
|
-
return !t || !this.mark.isInSet(t.marks) ? this : new
|
|
2147
|
+
return !t || !this.mark.isInSet(t.marks) ? this : new vt(this.pos, this.mark);
|
|
2148
2148
|
}
|
|
2149
2149
|
map(t) {
|
|
2150
2150
|
let n = t.mapResult(this.pos, 1);
|
|
@@ -2162,16 +2162,16 @@ var vt = class e extends C {
|
|
|
2162
2162
|
return new e(n.pos, t.markFromJSON(n.mark));
|
|
2163
2163
|
}
|
|
2164
2164
|
};
|
|
2165
|
-
|
|
2166
|
-
var
|
|
2165
|
+
S.jsonID("removeNodeMark", yt);
|
|
2166
|
+
var w = class e extends S {
|
|
2167
2167
|
constructor(e, t, n, r = !1) {
|
|
2168
2168
|
super(), this.from = e, this.to = t, this.slice = n, this.structure = r;
|
|
2169
2169
|
}
|
|
2170
2170
|
apply(e) {
|
|
2171
|
-
return this.structure &&
|
|
2171
|
+
return this.structure && bt(e, this.from, this.to) ? C.fail("Structure replace would overwrite content") : C.fromReplace(e, this.from, this.to, this.slice);
|
|
2172
2172
|
}
|
|
2173
2173
|
getMap() {
|
|
2174
|
-
return new
|
|
2174
|
+
return new ft([
|
|
2175
2175
|
this.from,
|
|
2176
2176
|
this.to - this.from,
|
|
2177
2177
|
this.slice.size
|
|
@@ -2207,20 +2207,20 @@ var T = class e extends C {
|
|
|
2207
2207
|
return new e(n.from, n.to, l.fromJSON(t, n.slice), !!n.structure);
|
|
2208
2208
|
}
|
|
2209
2209
|
};
|
|
2210
|
-
|
|
2211
|
-
var
|
|
2210
|
+
w.MAP_BIAS = 1, S.jsonID("replace", w);
|
|
2211
|
+
var T = class e extends S {
|
|
2212
2212
|
constructor(e, t, n, r, i, a, o = !1) {
|
|
2213
2213
|
super(), this.from = e, this.to = t, this.gapFrom = n, this.gapTo = r, this.slice = i, this.insert = a, this.structure = o;
|
|
2214
2214
|
}
|
|
2215
2215
|
apply(e) {
|
|
2216
|
-
if (this.structure && (
|
|
2216
|
+
if (this.structure && (bt(e, this.from, this.gapFrom) || bt(e, this.gapTo, this.to))) return C.fail("Structure gap-replace would overwrite content");
|
|
2217
2217
|
let t = e.slice(this.gapFrom, this.gapTo);
|
|
2218
|
-
if (t.openStart || t.openEnd) return
|
|
2218
|
+
if (t.openStart || t.openEnd) return C.fail("Gap is not a flat range");
|
|
2219
2219
|
let n = this.slice.insertAt(this.insert, t.content);
|
|
2220
|
-
return n ?
|
|
2220
|
+
return n ? C.fromReplace(e, this.from, this.to, n) : C.fail("Content does not fit in gap");
|
|
2221
2221
|
}
|
|
2222
2222
|
getMap() {
|
|
2223
|
-
return new
|
|
2223
|
+
return new ft([
|
|
2224
2224
|
this.from,
|
|
2225
2225
|
this.gapFrom - this.from,
|
|
2226
2226
|
this.insert,
|
|
@@ -2253,8 +2253,8 @@ var E = class e extends C {
|
|
|
2253
2253
|
return new e(n.from, n.to, n.gapFrom, n.gapTo, l.fromJSON(t, n.slice), n.insert, !!n.structure);
|
|
2254
2254
|
}
|
|
2255
2255
|
};
|
|
2256
|
-
|
|
2257
|
-
function
|
|
2256
|
+
S.jsonID("replaceAround", T);
|
|
2257
|
+
function bt(e, t, n) {
|
|
2258
2258
|
let r = e.resolve(t), i = n - t, a = r.depth;
|
|
2259
2259
|
for (; i > 0 && a > 0 && r.indexAfter(a) == r.node(a).childCount;) a--, i--;
|
|
2260
2260
|
if (i > 0) {
|
|
@@ -2266,25 +2266,25 @@ function yt(e, t, n) {
|
|
|
2266
2266
|
}
|
|
2267
2267
|
return !1;
|
|
2268
2268
|
}
|
|
2269
|
-
function
|
|
2269
|
+
function xt(e, t, n, r) {
|
|
2270
2270
|
let i = [], a = [], o, s;
|
|
2271
2271
|
e.doc.nodesBetween(t, n, (e, c, l) => {
|
|
2272
2272
|
if (!e.isInline) return;
|
|
2273
2273
|
let u = e.marks;
|
|
2274
2274
|
if (!r.isInSet(u) && l.type.allowsMarkType(r.type)) {
|
|
2275
2275
|
let l = Math.max(c, t), d = Math.min(c + e.nodeSize, n), f = r.addToSet(u);
|
|
2276
|
-
for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (o && o.to == l && o.mark.eq(u[e]) ? o.to = d : i.push(o = new
|
|
2277
|
-
s && s.to == l ? s.to = d : a.push(s = new
|
|
2276
|
+
for (let e = 0; e < u.length; e++) u[e].isInSet(f) || (o && o.to == l && o.mark.eq(u[e]) ? o.to = d : i.push(o = new _t(l, d, u[e])));
|
|
2277
|
+
s && s.to == l ? s.to = d : a.push(s = new gt(l, d, r));
|
|
2278
2278
|
}
|
|
2279
2279
|
}), i.forEach((t) => e.step(t)), a.forEach((t) => e.step(t));
|
|
2280
2280
|
}
|
|
2281
|
-
function
|
|
2281
|
+
function St(e, t, n, r) {
|
|
2282
2282
|
let i = [], a = 0;
|
|
2283
2283
|
e.doc.nodesBetween(t, n, (e, o) => {
|
|
2284
2284
|
if (!e.isInline) return;
|
|
2285
2285
|
a++;
|
|
2286
2286
|
let s = null;
|
|
2287
|
-
if (r instanceof
|
|
2287
|
+
if (r instanceof Ae) {
|
|
2288
2288
|
let t = e.marks, n;
|
|
2289
2289
|
for (; n = r.isInSet(t);) (s ||= []).push(n), t = n.removeFromSet(t);
|
|
2290
2290
|
} else r ? r.isInSet(e.marks) && (s = [r]) : s = e.marks;
|
|
@@ -2304,19 +2304,19 @@ function xt(e, t, n, r) {
|
|
|
2304
2304
|
});
|
|
2305
2305
|
}
|
|
2306
2306
|
}
|
|
2307
|
-
}), i.forEach((t) => e.step(new
|
|
2307
|
+
}), i.forEach((t) => e.step(new _t(t.from, t.to, t.style)));
|
|
2308
2308
|
}
|
|
2309
|
-
function
|
|
2309
|
+
function Ct(e, t, n, i = n.contentMatch, a = !0) {
|
|
2310
2310
|
let o = e.doc.nodeAt(t), s = [], c = t + 1;
|
|
2311
2311
|
for (let t = 0; t < o.childCount; t++) {
|
|
2312
2312
|
let u = o.child(t), d = c + u.nodeSize, f = i.matchType(u.type);
|
|
2313
|
-
if (!f) s.push(new
|
|
2313
|
+
if (!f) s.push(new w(c, d, l.empty));
|
|
2314
2314
|
else {
|
|
2315
2315
|
i = f;
|
|
2316
|
-
for (let t = 0; t < u.marks.length; t++) n.allowsMarkType(u.marks[t].type) || e.step(new
|
|
2316
|
+
for (let t = 0; t < u.marks.length; t++) n.allowsMarkType(u.marks[t].type) || e.step(new _t(c, d, u.marks[t]));
|
|
2317
2317
|
if (a && u.isText && n.whitespace != "pre") {
|
|
2318
2318
|
let e, t = /\r?\n|\r/g, i;
|
|
2319
|
-
for (; e = t.exec(u.text);) i ||= new l(r.from(n.schema.text(" ", n.allowedMarks(u.marks))), 0, 0), s.push(new
|
|
2319
|
+
for (; e = t.exec(u.text);) i ||= new l(r.from(n.schema.text(" ", n.allowedMarks(u.marks))), 0, 0), s.push(new w(c + e.index, c + e.index + e[0].length, i));
|
|
2320
2320
|
}
|
|
2321
2321
|
}
|
|
2322
2322
|
c = d;
|
|
@@ -2327,53 +2327,53 @@ function St(e, t, n, i = n.contentMatch, a = !0) {
|
|
|
2327
2327
|
}
|
|
2328
2328
|
for (let t = s.length - 1; t >= 0; t--) e.step(s[t]);
|
|
2329
2329
|
}
|
|
2330
|
-
function
|
|
2330
|
+
function wt(e, t, n) {
|
|
2331
2331
|
return (t == 0 || e.canReplace(t, e.childCount)) && (n == e.childCount || e.canReplace(0, n));
|
|
2332
2332
|
}
|
|
2333
|
-
function
|
|
2333
|
+
function Tt(e) {
|
|
2334
2334
|
let t = e.parent.content.cutByIndex(e.startIndex, e.endIndex);
|
|
2335
2335
|
for (let n = e.depth, r = 0, i = 0;; --n) {
|
|
2336
2336
|
let a = e.$from.node(n), o = e.$from.index(n) + r, s = e.$to.indexAfter(n) - i;
|
|
2337
2337
|
if (n < e.depth && a.canReplace(o, s, t)) return n;
|
|
2338
|
-
if (n == 0 || a.type.spec.isolating || !
|
|
2338
|
+
if (n == 0 || a.type.spec.isolating || !wt(a, o, s)) break;
|
|
2339
2339
|
o && (r = 1), s < a.childCount && (i = 1);
|
|
2340
2340
|
}
|
|
2341
2341
|
return null;
|
|
2342
2342
|
}
|
|
2343
|
-
function
|
|
2343
|
+
function Et(e, t, n) {
|
|
2344
2344
|
let { $from: i, $to: a, depth: o } = t, s = i.before(o + 1), c = a.after(o + 1), u = s, d = c, f = r.empty, p = 0;
|
|
2345
2345
|
for (let e = o, t = !1; e > n; e--) t || i.index(e) > 0 ? (t = !0, f = r.from(i.node(e).copy(f)), p++) : u--;
|
|
2346
2346
|
let m = r.empty, h = 0;
|
|
2347
2347
|
for (let e = o, t = !1; e > n; e--) t || a.after(e + 1) < a.end(e) ? (t = !0, m = r.from(a.node(e).copy(m)), h++) : d++;
|
|
2348
|
-
e.step(new
|
|
2348
|
+
e.step(new T(u, d, s, c, new l(f.append(m), p, h), f.size - p, !0));
|
|
2349
2349
|
}
|
|
2350
|
-
function
|
|
2351
|
-
let i =
|
|
2352
|
-
return a ? i.map(
|
|
2350
|
+
function Dt(e, t, n = null, r = e) {
|
|
2351
|
+
let i = kt(e, t), a = i && At(r, t);
|
|
2352
|
+
return a ? i.map(Ot).concat({
|
|
2353
2353
|
type: t,
|
|
2354
2354
|
attrs: n
|
|
2355
|
-
}).concat(a.map(
|
|
2355
|
+
}).concat(a.map(Ot)) : null;
|
|
2356
2356
|
}
|
|
2357
|
-
function
|
|
2357
|
+
function Ot(e) {
|
|
2358
2358
|
return {
|
|
2359
2359
|
type: e,
|
|
2360
2360
|
attrs: null
|
|
2361
2361
|
};
|
|
2362
2362
|
}
|
|
2363
|
-
function
|
|
2363
|
+
function kt(e, t) {
|
|
2364
2364
|
let { parent: n, startIndex: r, endIndex: i } = e, a = n.contentMatchAt(r).findWrapping(t);
|
|
2365
2365
|
if (!a) return null;
|
|
2366
2366
|
let o = a.length ? a[0] : t;
|
|
2367
2367
|
return n.canReplaceWith(r, i, o) ? a : null;
|
|
2368
2368
|
}
|
|
2369
|
-
function
|
|
2369
|
+
function At(e, t) {
|
|
2370
2370
|
let { parent: n, startIndex: r, endIndex: i } = e, a = n.child(r), o = t.contentMatch.findWrapping(a.type);
|
|
2371
2371
|
if (!o) return null;
|
|
2372
2372
|
let s = (o.length ? o[o.length - 1] : t).contentMatch;
|
|
2373
2373
|
for (let e = r; s && e < i; e++) s = s.matchType(n.child(e).type);
|
|
2374
2374
|
return !s || !s.validEnd ? null : o;
|
|
2375
2375
|
}
|
|
2376
|
-
function
|
|
2376
|
+
function jt(e, t, n) {
|
|
2377
2377
|
let i = r.empty;
|
|
2378
2378
|
for (let e = n.length - 1; e >= 0; e--) {
|
|
2379
2379
|
if (i.size) {
|
|
@@ -2383,26 +2383,26 @@ function At(e, t, n) {
|
|
|
2383
2383
|
i = r.from(n[e].type.create(n[e].attrs, i));
|
|
2384
2384
|
}
|
|
2385
2385
|
let a = t.start, o = t.end;
|
|
2386
|
-
e.step(new
|
|
2386
|
+
e.step(new T(a, o, a, o, new l(i, 0, 0), n.length, !0));
|
|
2387
2387
|
}
|
|
2388
|
-
function
|
|
2388
|
+
function Mt(e, t, n, i, a) {
|
|
2389
2389
|
if (!i.isTextblock) throw RangeError("Type given to setBlockType should be a textblock");
|
|
2390
2390
|
let o = e.steps.length;
|
|
2391
2391
|
e.doc.nodesBetween(t, n, (t, n) => {
|
|
2392
2392
|
let s = typeof a == "function" ? a(t) : a;
|
|
2393
|
-
if (t.isTextblock && !t.hasMarkup(i, s) &&
|
|
2393
|
+
if (t.isTextblock && !t.hasMarkup(i, s) && Ft(e.doc, e.mapping.slice(o).map(n), i)) {
|
|
2394
2394
|
let a = null;
|
|
2395
2395
|
if (i.schema.linebreakReplacement) {
|
|
2396
2396
|
let e = i.whitespace == "pre", t = !!i.contentMatch.matchType(i.schema.linebreakReplacement);
|
|
2397
2397
|
e && !t ? a = !1 : !e && t && (a = !0);
|
|
2398
2398
|
}
|
|
2399
|
-
a === !1 &&
|
|
2399
|
+
a === !1 && Pt(e, t, n, o), Ct(e, e.mapping.slice(o).map(n, 1), i, void 0, a === null);
|
|
2400
2400
|
let c = e.mapping.slice(o), u = c.map(n, 1), d = c.map(n + t.nodeSize, 1);
|
|
2401
|
-
return e.step(new
|
|
2401
|
+
return e.step(new T(u, d, u + 1, d - 1, new l(r.from(i.create(s, null, t.marks)), 0, 0), 1, !0)), a === !0 && Nt(e, t, n, o), !1;
|
|
2402
2402
|
}
|
|
2403
2403
|
});
|
|
2404
2404
|
}
|
|
2405
|
-
function
|
|
2405
|
+
function Nt(e, t, n, r) {
|
|
2406
2406
|
t.forEach((i, a) => {
|
|
2407
2407
|
if (i.isText) {
|
|
2408
2408
|
let o, s = /\r?\n|\r/g;
|
|
@@ -2413,7 +2413,7 @@ function Mt(e, t, n, r) {
|
|
|
2413
2413
|
}
|
|
2414
2414
|
});
|
|
2415
2415
|
}
|
|
2416
|
-
function
|
|
2416
|
+
function Pt(e, t, n, r) {
|
|
2417
2417
|
t.forEach((i, a) => {
|
|
2418
2418
|
if (i.type == i.type.schema.linebreakReplacement) {
|
|
2419
2419
|
let i = e.mapping.slice(r).map(n + 1 + a);
|
|
@@ -2421,20 +2421,20 @@ function Nt(e, t, n, r) {
|
|
|
2421
2421
|
}
|
|
2422
2422
|
});
|
|
2423
2423
|
}
|
|
2424
|
-
function
|
|
2424
|
+
function Ft(e, t, n) {
|
|
2425
2425
|
let r = e.resolve(t), i = r.index();
|
|
2426
2426
|
return r.parent.canReplaceWith(i, i + 1, n);
|
|
2427
2427
|
}
|
|
2428
|
-
function
|
|
2428
|
+
function It(e, t, n, i, a) {
|
|
2429
2429
|
let o = e.doc.nodeAt(t);
|
|
2430
2430
|
if (!o) throw RangeError("No node at given position");
|
|
2431
2431
|
n ||= o.type;
|
|
2432
2432
|
let s = n.create(i, null, a || o.marks);
|
|
2433
2433
|
if (o.isLeaf) return e.replaceWith(t, t + o.nodeSize, s);
|
|
2434
2434
|
if (!n.validContent(o.content)) throw RangeError("Invalid content for node type " + n.name);
|
|
2435
|
-
e.step(new
|
|
2435
|
+
e.step(new T(t, t + o.nodeSize, t + 1, t + o.nodeSize - 1, new l(r.from(s), 0, 0), 1, !0));
|
|
2436
2436
|
}
|
|
2437
|
-
function
|
|
2437
|
+
function E(e, t, n = 1, r) {
|
|
2438
2438
|
let i = e.resolve(t), a = i.depth - n, o = r && r[r.length - 1] || i.parent;
|
|
2439
2439
|
if (a < 0 || i.parent.type.spec.isolating || !i.parent.canReplace(i.index(), i.parent.childCount) || !o.type.validContent(i.parent.content.cutByIndex(i.index(), i.parent.childCount))) return !1;
|
|
2440
2440
|
for (let e = i.depth - 1, t = n - 2; e > a; e--, t--) {
|
|
@@ -2448,20 +2448,20 @@ function D(e, t, n = 1, r) {
|
|
|
2448
2448
|
let s = i.indexAfter(a), c = r && r[0];
|
|
2449
2449
|
return i.node(a).canReplaceWith(s, s, c ? c.type : i.node(a + 1).type);
|
|
2450
2450
|
}
|
|
2451
|
-
function
|
|
2451
|
+
function Lt(e, t, n = 1, i) {
|
|
2452
2452
|
let a = e.doc.resolve(t), o = r.empty, s = r.empty;
|
|
2453
2453
|
for (let e = a.depth, t = a.depth - n, c = n - 1; e > t; e--, c--) {
|
|
2454
2454
|
o = r.from(a.node(e).copy(o));
|
|
2455
2455
|
let t = i && i[c];
|
|
2456
2456
|
s = r.from(t ? t.type.create(t.attrs, s) : a.node(e).copy(s));
|
|
2457
2457
|
}
|
|
2458
|
-
e.step(new
|
|
2458
|
+
e.step(new w(t, t, new l(o.append(s), n, n), !0));
|
|
2459
2459
|
}
|
|
2460
|
-
function
|
|
2460
|
+
function Rt(e, t) {
|
|
2461
2461
|
let n = e.resolve(t), r = n.index();
|
|
2462
|
-
return
|
|
2462
|
+
return Bt(n.nodeBefore, n.nodeAfter) && n.parent.canReplace(r, r + 1);
|
|
2463
2463
|
}
|
|
2464
|
-
function
|
|
2464
|
+
function zt(e, t) {
|
|
2465
2465
|
t.content.size || e.type.compatibleContent(t.type);
|
|
2466
2466
|
let n = e.contentMatchAt(e.childCount), { linebreakReplacement: r } = e.type.schema;
|
|
2467
2467
|
for (let i = 0; i < t.childCount; i++) {
|
|
@@ -2470,19 +2470,19 @@ function Rt(e, t) {
|
|
|
2470
2470
|
}
|
|
2471
2471
|
return n.validEnd;
|
|
2472
2472
|
}
|
|
2473
|
-
function
|
|
2474
|
-
return !!(e && t && !e.isLeaf &&
|
|
2473
|
+
function Bt(e, t) {
|
|
2474
|
+
return !!(e && t && !e.isLeaf && zt(e, t));
|
|
2475
2475
|
}
|
|
2476
|
-
function
|
|
2476
|
+
function Vt(e, t, n = -1) {
|
|
2477
2477
|
let r = e.resolve(t);
|
|
2478
2478
|
for (let e = r.depth;; e--) {
|
|
2479
2479
|
let i, a, o = r.index(e);
|
|
2480
|
-
if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock &&
|
|
2480
|
+
if (e == r.depth ? (i = r.nodeBefore, a = r.nodeAfter) : n > 0 ? (i = r.node(e + 1), o++, a = r.node(e).maybeChild(o)) : (i = r.node(e).maybeChild(o - 1), a = r.node(e + 1)), i && !i.isTextblock && Bt(i, a) && r.node(e).canReplace(o, o + 1)) return t;
|
|
2481
2481
|
if (e == 0) break;
|
|
2482
2482
|
t = n < 0 ? r.before(e) : r.after(e);
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
2485
|
-
function
|
|
2485
|
+
function Ht(e, t, n) {
|
|
2486
2486
|
let r = null, { linebreakReplacement: i } = e.doc.type.schema, a = e.doc.resolve(t - n), o = a.node().type;
|
|
2487
2487
|
if (i && o.inlineContent) {
|
|
2488
2488
|
let e = o.whitespace == "pre", t = !!o.contentMatch.matchType(i);
|
|
@@ -2491,17 +2491,17 @@ function Vt(e, t, n) {
|
|
|
2491
2491
|
let s = e.steps.length;
|
|
2492
2492
|
if (r === !1) {
|
|
2493
2493
|
let r = e.doc.resolve(t + n);
|
|
2494
|
-
|
|
2494
|
+
Pt(e, r.node(), r.before(), s);
|
|
2495
2495
|
}
|
|
2496
|
-
o.inlineContent &&
|
|
2496
|
+
o.inlineContent && Ct(e, t + n - 1, o, a.node().contentMatchAt(a.index()), r == null);
|
|
2497
2497
|
let c = e.mapping.slice(s), u = c.map(t - n);
|
|
2498
|
-
if (e.step(new
|
|
2498
|
+
if (e.step(new w(u, c.map(t + n, -1), l.empty, !0)), r === !0) {
|
|
2499
2499
|
let t = e.doc.resolve(u);
|
|
2500
|
-
|
|
2500
|
+
Nt(e, t.node(), t.before(), e.steps.length);
|
|
2501
2501
|
}
|
|
2502
2502
|
return e;
|
|
2503
2503
|
}
|
|
2504
|
-
function
|
|
2504
|
+
function Ut(e, t, n) {
|
|
2505
2505
|
let r = e.resolve(t);
|
|
2506
2506
|
if (r.parent.canReplaceWith(r.index(), r.index(), n)) return t;
|
|
2507
2507
|
if (r.parentOffset == 0) for (let e = r.depth - 1; e >= 0; e--) {
|
|
@@ -2516,7 +2516,7 @@ function Ht(e, t, n) {
|
|
|
2516
2516
|
}
|
|
2517
2517
|
return null;
|
|
2518
2518
|
}
|
|
2519
|
-
function
|
|
2519
|
+
function Wt(e, t, n) {
|
|
2520
2520
|
let r = e.resolve(t);
|
|
2521
2521
|
if (!n.content.size) return t;
|
|
2522
2522
|
let i = n.content;
|
|
@@ -2532,15 +2532,15 @@ function Ut(e, t, n) {
|
|
|
2532
2532
|
}
|
|
2533
2533
|
return null;
|
|
2534
2534
|
}
|
|
2535
|
-
function
|
|
2535
|
+
function Gt(e, t, n = t, r = l.empty) {
|
|
2536
2536
|
if (t == n && !r.size) return null;
|
|
2537
2537
|
let i = e.resolve(t), a = e.resolve(n);
|
|
2538
|
-
return
|
|
2538
|
+
return Kt(i, a, r) ? new w(t, n, r) : new qt(i, a, r).fit();
|
|
2539
2539
|
}
|
|
2540
|
-
function
|
|
2540
|
+
function Kt(e, t, n) {
|
|
2541
2541
|
return !n.openStart && !n.openEnd && e.start() == t.start() && e.parent.canReplace(e.index(), t.index(), n.content);
|
|
2542
2542
|
}
|
|
2543
|
-
var
|
|
2543
|
+
var qt = class {
|
|
2544
2544
|
constructor(e, t, n) {
|
|
2545
2545
|
this.$from = e, this.$to = t, this.unplaced = n, this.frontier = [], this.placed = r.empty;
|
|
2546
2546
|
for (let t = 0; t <= e.depth; t++) {
|
|
@@ -2565,7 +2565,7 @@ var Kt = class {
|
|
|
2565
2565
|
let i = this.placed, a = n.depth, o = r.depth;
|
|
2566
2566
|
for (; a && o && i.childCount == 1;) i = i.firstChild.content, a--, o--;
|
|
2567
2567
|
let s = new l(i, a, o);
|
|
2568
|
-
return e > -1 ? new
|
|
2568
|
+
return e > -1 ? new T(n.pos, e, this.$to.pos, this.$to.end(), s, t) : s.size || n.pos != this.$to.pos ? new w(n.pos, r.pos, s) : null;
|
|
2569
2569
|
}
|
|
2570
2570
|
findFittable() {
|
|
2571
2571
|
let e = this.unplaced.openStart;
|
|
@@ -2579,7 +2579,7 @@ var Kt = class {
|
|
|
2579
2579
|
}
|
|
2580
2580
|
for (let t = 1; t <= 2; t++) for (let n = t == 1 ? e : this.unplaced.openStart; n >= 0; n--) {
|
|
2581
2581
|
let e, i = null;
|
|
2582
|
-
n ? (i =
|
|
2582
|
+
n ? (i = Xt(this.unplaced.content, n - 1).firstChild, e = i.content) : e = this.unplaced.content;
|
|
2583
2583
|
let a = e.firstChild;
|
|
2584
2584
|
for (let e = this.depth; e >= 0; e--) {
|
|
2585
2585
|
let { type: o, match: s } = this.frontier[e], c, l = null;
|
|
@@ -2600,15 +2600,15 @@ var Kt = class {
|
|
|
2600
2600
|
}
|
|
2601
2601
|
}
|
|
2602
2602
|
openMore() {
|
|
2603
|
-
let { content: e, openStart: t, openEnd: n } = this.unplaced, r =
|
|
2603
|
+
let { content: e, openStart: t, openEnd: n } = this.unplaced, r = Xt(e, t);
|
|
2604
2604
|
return !r.childCount || r.firstChild.isLeaf ? !1 : (this.unplaced = new l(e, t + 1, Math.max(n, r.size + t >= e.size - n ? t + 1 : 0)), !0);
|
|
2605
2605
|
}
|
|
2606
2606
|
dropNode() {
|
|
2607
|
-
let { content: e, openStart: t, openEnd: n } = this.unplaced, r =
|
|
2607
|
+
let { content: e, openStart: t, openEnd: n } = this.unplaced, r = Xt(e, t);
|
|
2608
2608
|
if (r.childCount <= 1 && t > 0) {
|
|
2609
2609
|
let i = e.size - t <= t + r.size;
|
|
2610
|
-
this.unplaced = new l(
|
|
2611
|
-
} else this.unplaced = new l(
|
|
2610
|
+
this.unplaced = new l(Jt(e, t - 1, 1), t - 1, i ? t - 1 : n);
|
|
2611
|
+
} else this.unplaced = new l(Jt(e, t, 1), t, n);
|
|
2612
2612
|
}
|
|
2613
2613
|
placeNodes({ sliceDepth: e, frontierDepth: t, parent: n, inject: i, wrap: a }) {
|
|
2614
2614
|
for (; this.depth > t;) this.closeFrontierNode();
|
|
@@ -2622,10 +2622,10 @@ var Kt = class {
|
|
|
2622
2622
|
for (; u < s.childCount;) {
|
|
2623
2623
|
let e = s.child(u), t = f.matchType(e.type);
|
|
2624
2624
|
if (!t) break;
|
|
2625
|
-
u++, (u > 1 || c == 0 || e.content.size) && (f = t, d.push(
|
|
2625
|
+
u++, (u > 1 || c == 0 || e.content.size) && (f = t, d.push(Zt(e.mark(p.allowedMarks(e.marks)), u == 1 ? c : 0, u == s.childCount ? m : -1)));
|
|
2626
2626
|
}
|
|
2627
2627
|
let h = u == s.childCount;
|
|
2628
|
-
h || (m = -1), this.placed =
|
|
2628
|
+
h || (m = -1), this.placed = Yt(this.placed, t, r.from(d)), this.frontier[t].match = f, h && m < 0 && n && n.type == this.frontier[this.depth].type && this.frontier.length > 1 && this.closeFrontierNode();
|
|
2629
2629
|
for (let e = 0, t = s; e < m; e++) {
|
|
2630
2630
|
let e = t.lastChild;
|
|
2631
2631
|
this.frontier.push({
|
|
@@ -2633,22 +2633,22 @@ var Kt = class {
|
|
|
2633
2633
|
match: e.contentMatchAt(e.childCount)
|
|
2634
2634
|
}), t = e.content;
|
|
2635
2635
|
}
|
|
2636
|
-
this.unplaced = h ? e == 0 ? l.empty : new l(
|
|
2636
|
+
this.unplaced = h ? e == 0 ? l.empty : new l(Jt(o.content, e - 1, 1), e - 1, m < 0 ? o.openEnd : e - 1) : new l(Jt(o.content, e, u), o.openStart, o.openEnd);
|
|
2637
2637
|
}
|
|
2638
2638
|
mustMoveInline() {
|
|
2639
2639
|
if (!this.$to.parent.isTextblock) return -1;
|
|
2640
2640
|
let e = this.frontier[this.depth], t;
|
|
2641
|
-
if (!e.type.isTextblock || !
|
|
2641
|
+
if (!e.type.isTextblock || !Qt(this.$to, this.$to.depth, e.type, e.match, !1) || this.$to.depth == this.depth && (t = this.findCloseLevel(this.$to)) && t.depth == this.depth) return -1;
|
|
2642
2642
|
let { depth: n } = this.$to, r = this.$to.after(n);
|
|
2643
2643
|
for (; n > 1 && r == this.$to.end(--n);) ++r;
|
|
2644
2644
|
return r;
|
|
2645
2645
|
}
|
|
2646
2646
|
findCloseLevel(e) {
|
|
2647
2647
|
scan: for (let t = Math.min(this.depth, e.depth); t >= 0; t--) {
|
|
2648
|
-
let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a =
|
|
2648
|
+
let { match: n, type: r } = this.frontier[t], i = t < e.depth && e.end(t + 1) == e.pos + (e.depth - (t + 1)), a = Qt(e, t, r, n, i);
|
|
2649
2649
|
if (a) {
|
|
2650
2650
|
for (let n = t - 1; n >= 0; n--) {
|
|
2651
|
-
let { match: t, type: r } = this.frontier[n], i =
|
|
2651
|
+
let { match: t, type: r } = this.frontier[n], i = Qt(e, n, r, t, !0);
|
|
2652
2652
|
if (!i || i.childCount) continue scan;
|
|
2653
2653
|
}
|
|
2654
2654
|
return {
|
|
@@ -2663,7 +2663,7 @@ var Kt = class {
|
|
|
2663
2663
|
let t = this.findCloseLevel(e);
|
|
2664
2664
|
if (!t) return null;
|
|
2665
2665
|
for (; this.depth > t.depth;) this.closeFrontierNode();
|
|
2666
|
-
t.fit.childCount && (this.placed =
|
|
2666
|
+
t.fit.childCount && (this.placed = Yt(this.placed, t.depth, t.fit)), e = t.move;
|
|
2667
2667
|
for (let n = t.depth + 1; n <= e.depth; n++) {
|
|
2668
2668
|
let t = e.node(n), r = t.type.contentMatch.fillBefore(t.content, !0, e.index(n));
|
|
2669
2669
|
this.openFrontierNode(t.type, t.attrs, r);
|
|
@@ -2672,49 +2672,49 @@ var Kt = class {
|
|
|
2672
2672
|
}
|
|
2673
2673
|
openFrontierNode(e, t = null, n) {
|
|
2674
2674
|
let i = this.frontier[this.depth];
|
|
2675
|
-
i.match = i.match.matchType(e), this.placed =
|
|
2675
|
+
i.match = i.match.matchType(e), this.placed = Yt(this.placed, this.depth, r.from(e.create(t, n))), this.frontier.push({
|
|
2676
2676
|
type: e,
|
|
2677
2677
|
match: e.contentMatch
|
|
2678
2678
|
});
|
|
2679
2679
|
}
|
|
2680
2680
|
closeFrontierNode() {
|
|
2681
2681
|
let e = this.frontier.pop().match.fillBefore(r.empty, !0);
|
|
2682
|
-
e.childCount && (this.placed =
|
|
2682
|
+
e.childCount && (this.placed = Yt(this.placed, this.frontier.length, e));
|
|
2683
2683
|
}
|
|
2684
2684
|
};
|
|
2685
|
-
function qt(e, t, n) {
|
|
2686
|
-
return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(qt(e.firstChild.content, t - 1, n)));
|
|
2687
|
-
}
|
|
2688
2685
|
function Jt(e, t, n) {
|
|
2689
|
-
return t == 0 ? e.
|
|
2686
|
+
return t == 0 ? e.cutByIndex(n, e.childCount) : e.replaceChild(0, e.firstChild.copy(Jt(e.firstChild.content, t - 1, n)));
|
|
2687
|
+
}
|
|
2688
|
+
function Yt(e, t, n) {
|
|
2689
|
+
return t == 0 ? e.append(n) : e.replaceChild(e.childCount - 1, e.lastChild.copy(Yt(e.lastChild.content, t - 1, n)));
|
|
2690
2690
|
}
|
|
2691
|
-
function
|
|
2691
|
+
function Xt(e, t) {
|
|
2692
2692
|
for (let n = 0; n < t; n++) e = e.firstChild.content;
|
|
2693
2693
|
return e;
|
|
2694
2694
|
}
|
|
2695
|
-
function
|
|
2695
|
+
function Zt(e, t, n) {
|
|
2696
2696
|
if (t <= 0) return e;
|
|
2697
2697
|
let i = e.content;
|
|
2698
|
-
return t > 1 && (i = i.replaceChild(0,
|
|
2698
|
+
return t > 1 && (i = i.replaceChild(0, Zt(i.firstChild, t - 1, i.childCount == 1 ? n - 1 : 0))), t > 0 && (i = e.type.contentMatch.fillBefore(i).append(i), n <= 0 && (i = i.append(e.type.contentMatch.matchFragment(i).fillBefore(r.empty, !0)))), e.copy(i);
|
|
2699
2699
|
}
|
|
2700
|
-
function
|
|
2700
|
+
function Qt(e, t, n, r, i) {
|
|
2701
2701
|
let a = e.node(t), o = i ? e.indexAfter(t) : e.index(t);
|
|
2702
2702
|
if (o == a.childCount && !n.compatibleContent(a.type)) return null;
|
|
2703
2703
|
let s = r.fillBefore(a.content, !0, o);
|
|
2704
|
-
return s &&
|
|
2704
|
+
return s && !$t(n, a.content, o) ? s : null;
|
|
2705
2705
|
}
|
|
2706
|
-
function
|
|
2706
|
+
function $t(e, t, n) {
|
|
2707
2707
|
for (let r = n; r < t.childCount; r++) if (!e.allowsMarks(t.child(r).marks)) return !0;
|
|
2708
2708
|
return !1;
|
|
2709
2709
|
}
|
|
2710
|
-
function
|
|
2710
|
+
function en(e) {
|
|
2711
2711
|
return e.spec.defining || e.spec.definingForContent;
|
|
2712
2712
|
}
|
|
2713
|
-
function
|
|
2713
|
+
function tn(e, t, n, r) {
|
|
2714
2714
|
if (!r.size) return e.deleteRange(t, n);
|
|
2715
2715
|
let i = e.doc.resolve(t), a = e.doc.resolve(n);
|
|
2716
|
-
if (
|
|
2717
|
-
let o =
|
|
2716
|
+
if (Kt(i, a, r)) return e.step(new w(t, n, r));
|
|
2717
|
+
let o = on(i, a);
|
|
2718
2718
|
o[o.length - 1] == 0 && o.pop();
|
|
2719
2719
|
let s = -(i.depth + 1);
|
|
2720
2720
|
o.unshift(s);
|
|
@@ -2730,7 +2730,7 @@ function en(e, t, n, r) {
|
|
|
2730
2730
|
e = n.content;
|
|
2731
2731
|
}
|
|
2732
2732
|
for (let e = d - 1; e >= 0; e--) {
|
|
2733
|
-
let t = u[e], n =
|
|
2733
|
+
let t = u[e], n = en(t.type);
|
|
2734
2734
|
if (n && !t.sameMarkup(i.node(Math.abs(s) - 1))) d = e;
|
|
2735
2735
|
else if (n || !t.type.isTextblock) break;
|
|
2736
2736
|
}
|
|
@@ -2740,7 +2740,7 @@ function en(e, t, n, r) {
|
|
|
2740
2740
|
let u = o[(t + c) % o.length], d = !0;
|
|
2741
2741
|
u < 0 && (d = !1, u = -u);
|
|
2742
2742
|
let p = i.node(u - 1), m = i.index(u - 1);
|
|
2743
|
-
if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(i.before(u), d ? a.after(u) : n, new l(
|
|
2743
|
+
if (p.canReplaceWith(m, m, f.type, f.marks)) return e.replace(i.before(u), d ? a.after(u) : n, new l(nn(r.content, 0, r.openStart, s), s, r.openEnd));
|
|
2744
2744
|
}
|
|
2745
2745
|
}
|
|
2746
2746
|
let f = e.steps.length;
|
|
@@ -2749,10 +2749,10 @@ function en(e, t, n, r) {
|
|
|
2749
2749
|
e < 0 || (t = i.before(e), n = a.after(e));
|
|
2750
2750
|
}
|
|
2751
2751
|
}
|
|
2752
|
-
function
|
|
2752
|
+
function nn(e, t, n, i, a) {
|
|
2753
2753
|
if (t < n) {
|
|
2754
2754
|
let r = e.firstChild;
|
|
2755
|
-
e = e.replaceChild(0, r.copy(
|
|
2755
|
+
e = e.replaceChild(0, r.copy(nn(r.content, t + 1, n, i, r)));
|
|
2756
2756
|
}
|
|
2757
2757
|
if (t > i) {
|
|
2758
2758
|
let t = a.contentMatchAt(0), n = t.fillBefore(e).append(e);
|
|
@@ -2760,14 +2760,14 @@ function tn(e, t, n, i, a) {
|
|
|
2760
2760
|
}
|
|
2761
2761
|
return e;
|
|
2762
2762
|
}
|
|
2763
|
-
function
|
|
2763
|
+
function rn(e, t, n, i) {
|
|
2764
2764
|
if (!i.isInline && t == n && e.doc.resolve(t).parent.content.size) {
|
|
2765
|
-
let r =
|
|
2765
|
+
let r = Ut(e.doc, t, i.type);
|
|
2766
2766
|
r != null && (t = n = r);
|
|
2767
2767
|
}
|
|
2768
2768
|
e.replaceRange(t, n, new l(r.from(i), 0, 0));
|
|
2769
2769
|
}
|
|
2770
|
-
function
|
|
2770
|
+
function an(e, t, n) {
|
|
2771
2771
|
let r = e.doc.resolve(t), i = e.doc.resolve(n);
|
|
2772
2772
|
if (r.parent.isTextblock && i.parent.isTextblock && r.start() != i.start() && r.parentOffset == 0 && i.parentOffset == 0) {
|
|
2773
2773
|
let a = r.sharedDepth(n), o = !1;
|
|
@@ -2779,7 +2779,7 @@ function rn(e, t, n) {
|
|
|
2779
2779
|
r = e.doc.resolve(t), i = e.doc.resolve(n);
|
|
2780
2780
|
}
|
|
2781
2781
|
}
|
|
2782
|
-
let a =
|
|
2782
|
+
let a = on(r, i);
|
|
2783
2783
|
for (let t = 0; t < a.length; t++) {
|
|
2784
2784
|
let n = a[t], o = t == a.length - 1;
|
|
2785
2785
|
if (o && n == 0 || r.node(n).type.contentMatch.validEnd) return e.delete(r.start(n), i.end(n));
|
|
@@ -2788,7 +2788,7 @@ function rn(e, t, n) {
|
|
|
2788
2788
|
for (let a = 1; a <= r.depth && a <= i.depth; a++) if (t - r.start(a) == r.depth - a && n > r.end(a) && i.end(a) - n != i.depth - a && r.start(a - 1) == i.start(a - 1) && r.node(a - 1).canReplace(r.index(a - 1), i.index(a - 1))) return e.delete(r.before(a), n);
|
|
2789
2789
|
e.delete(t, n);
|
|
2790
2790
|
}
|
|
2791
|
-
function
|
|
2791
|
+
function on(e, t) {
|
|
2792
2792
|
let n = [], r = Math.min(e.depth, t.depth);
|
|
2793
2793
|
for (let i = r; i >= 0; i--) {
|
|
2794
2794
|
let r = e.start(i);
|
|
@@ -2797,21 +2797,21 @@ function an(e, t) {
|
|
|
2797
2797
|
}
|
|
2798
2798
|
return n;
|
|
2799
2799
|
}
|
|
2800
|
-
var
|
|
2800
|
+
var sn = class e extends S {
|
|
2801
2801
|
constructor(e, t, n) {
|
|
2802
2802
|
super(), this.pos = e, this.attr = t, this.value = n;
|
|
2803
2803
|
}
|
|
2804
2804
|
apply(e) {
|
|
2805
2805
|
let t = e.nodeAt(this.pos);
|
|
2806
|
-
if (!t) return
|
|
2806
|
+
if (!t) return C.fail("No node at attribute step's position");
|
|
2807
2807
|
let n = Object.create(null);
|
|
2808
2808
|
for (let e in t.attrs) n[e] = t.attrs[e];
|
|
2809
2809
|
n[this.attr] = this.value;
|
|
2810
2810
|
let i = t.type.create(n, null, t.marks);
|
|
2811
|
-
return
|
|
2811
|
+
return C.fromReplace(e, this.pos, this.pos + 1, new l(r.from(i), 0, +!t.isLeaf));
|
|
2812
2812
|
}
|
|
2813
2813
|
getMap() {
|
|
2814
|
-
return
|
|
2814
|
+
return ft.empty;
|
|
2815
2815
|
}
|
|
2816
2816
|
invert(t) {
|
|
2817
2817
|
return new e(this.pos, this.attr, t.nodeAt(this.pos).attrs[this.attr]);
|
|
@@ -2833,8 +2833,8 @@ var on = class e extends C {
|
|
|
2833
2833
|
return new e(n.pos, n.attr, n.value);
|
|
2834
2834
|
}
|
|
2835
2835
|
};
|
|
2836
|
-
|
|
2837
|
-
var
|
|
2836
|
+
S.jsonID("attr", sn);
|
|
2837
|
+
var cn = class e extends S {
|
|
2838
2838
|
constructor(e, t) {
|
|
2839
2839
|
super(), this.attr = e, this.value = t;
|
|
2840
2840
|
}
|
|
@@ -2843,10 +2843,10 @@ var sn = class e extends C {
|
|
|
2843
2843
|
for (let n in e.attrs) t[n] = e.attrs[n];
|
|
2844
2844
|
t[this.attr] = this.value;
|
|
2845
2845
|
let n = e.type.create(t, e.content, e.marks);
|
|
2846
|
-
return
|
|
2846
|
+
return C.ok(n);
|
|
2847
2847
|
}
|
|
2848
2848
|
getMap() {
|
|
2849
|
-
return
|
|
2849
|
+
return ft.empty;
|
|
2850
2850
|
}
|
|
2851
2851
|
invert(t) {
|
|
2852
2852
|
return new e(this.attr, t.attrs[this.attr]);
|
|
@@ -2866,22 +2866,22 @@ var sn = class e extends C {
|
|
|
2866
2866
|
return new e(n.attr, n.value);
|
|
2867
2867
|
}
|
|
2868
2868
|
};
|
|
2869
|
-
|
|
2870
|
-
var
|
|
2871
|
-
|
|
2869
|
+
S.jsonID("docAttr", cn);
|
|
2870
|
+
var ln = class extends Error {};
|
|
2871
|
+
ln = function e(t) {
|
|
2872
2872
|
let n = Error.call(this, t);
|
|
2873
2873
|
return n.__proto__ = e.prototype, n;
|
|
2874
|
-
},
|
|
2875
|
-
var
|
|
2874
|
+
}, ln.prototype = Object.create(Error.prototype), ln.prototype.constructor = ln, ln.prototype.name = "TransformError";
|
|
2875
|
+
var un = class {
|
|
2876
2876
|
constructor(e) {
|
|
2877
|
-
this.doc = e, this.steps = [], this.docs = [], this.mapping = new
|
|
2877
|
+
this.doc = e, this.steps = [], this.docs = [], this.mapping = new pt();
|
|
2878
2878
|
}
|
|
2879
2879
|
get before() {
|
|
2880
2880
|
return this.docs.length ? this.docs[0] : this.doc;
|
|
2881
2881
|
}
|
|
2882
2882
|
step(e) {
|
|
2883
2883
|
let t = this.maybeStep(e);
|
|
2884
|
-
if (t.failed) throw new
|
|
2884
|
+
if (t.failed) throw new ln(t.failed);
|
|
2885
2885
|
return this;
|
|
2886
2886
|
}
|
|
2887
2887
|
maybeStep(e) {
|
|
@@ -2908,7 +2908,7 @@ var ln = class {
|
|
|
2908
2908
|
this.docs.push(this.doc), this.steps.push(e), this.mapping.appendMap(e.getMap()), this.doc = t;
|
|
2909
2909
|
}
|
|
2910
2910
|
replace(e, t = e, n = l.empty) {
|
|
2911
|
-
let r =
|
|
2911
|
+
let r = Gt(this.doc, e, t, n);
|
|
2912
2912
|
return r && this.step(r), this;
|
|
2913
2913
|
}
|
|
2914
2914
|
replaceWith(e, t, n) {
|
|
@@ -2921,64 +2921,64 @@ var ln = class {
|
|
|
2921
2921
|
return this.replaceWith(e, e, t);
|
|
2922
2922
|
}
|
|
2923
2923
|
replaceRange(e, t, n) {
|
|
2924
|
-
return
|
|
2924
|
+
return tn(this, e, t, n), this;
|
|
2925
2925
|
}
|
|
2926
2926
|
replaceRangeWith(e, t, n) {
|
|
2927
|
-
return
|
|
2927
|
+
return rn(this, e, t, n), this;
|
|
2928
2928
|
}
|
|
2929
2929
|
deleteRange(e, t) {
|
|
2930
|
-
return
|
|
2930
|
+
return an(this, e, t), this;
|
|
2931
2931
|
}
|
|
2932
2932
|
lift(e, t) {
|
|
2933
|
-
return
|
|
2933
|
+
return Et(this, e, t), this;
|
|
2934
2934
|
}
|
|
2935
2935
|
join(e, t = 1) {
|
|
2936
|
-
return
|
|
2936
|
+
return Ht(this, e, t), this;
|
|
2937
2937
|
}
|
|
2938
2938
|
wrap(e, t) {
|
|
2939
|
-
return
|
|
2939
|
+
return jt(this, e, t), this;
|
|
2940
2940
|
}
|
|
2941
2941
|
setBlockType(e, t = e, n, r = null) {
|
|
2942
|
-
return
|
|
2942
|
+
return Mt(this, e, t, n, r), this;
|
|
2943
2943
|
}
|
|
2944
2944
|
setNodeMarkup(e, t, n = null, r) {
|
|
2945
|
-
return
|
|
2945
|
+
return It(this, e, t, n, r), this;
|
|
2946
2946
|
}
|
|
2947
2947
|
setNodeAttribute(e, t, n) {
|
|
2948
|
-
return this.step(new
|
|
2948
|
+
return this.step(new sn(e, t, n)), this;
|
|
2949
2949
|
}
|
|
2950
2950
|
setDocAttribute(e, t) {
|
|
2951
|
-
return this.step(new
|
|
2951
|
+
return this.step(new cn(e, t)), this;
|
|
2952
2952
|
}
|
|
2953
2953
|
addNodeMark(e, t) {
|
|
2954
|
-
return this.step(new
|
|
2954
|
+
return this.step(new vt(e, t)), this;
|
|
2955
2955
|
}
|
|
2956
2956
|
removeNodeMark(e, t) {
|
|
2957
2957
|
let n = this.doc.nodeAt(e);
|
|
2958
2958
|
if (!n) throw RangeError("No node at position " + e);
|
|
2959
|
-
if (t instanceof s) t.isInSet(n.marks) && this.step(new
|
|
2959
|
+
if (t instanceof s) t.isInSet(n.marks) && this.step(new yt(e, t));
|
|
2960
2960
|
else {
|
|
2961
2961
|
let r = n.marks, i, a = [];
|
|
2962
|
-
for (; i = t.isInSet(r);) a.push(new
|
|
2962
|
+
for (; i = t.isInSet(r);) a.push(new yt(e, i)), r = i.removeFromSet(r);
|
|
2963
2963
|
for (let e = a.length - 1; e >= 0; e--) this.step(a[e]);
|
|
2964
2964
|
}
|
|
2965
2965
|
return this;
|
|
2966
2966
|
}
|
|
2967
2967
|
split(e, t = 1, n) {
|
|
2968
|
-
return
|
|
2968
|
+
return Lt(this, e, t, n), this;
|
|
2969
2969
|
}
|
|
2970
2970
|
addMark(e, t, n) {
|
|
2971
|
-
return
|
|
2971
|
+
return xt(this, e, t, n), this;
|
|
2972
2972
|
}
|
|
2973
2973
|
removeMark(e, t, n) {
|
|
2974
|
-
return
|
|
2974
|
+
return St(this, e, t, n), this;
|
|
2975
2975
|
}
|
|
2976
2976
|
clearIncompatible(e, t, n) {
|
|
2977
|
-
return
|
|
2977
|
+
return Ct(this, e, t, n), this;
|
|
2978
2978
|
}
|
|
2979
|
-
},
|
|
2979
|
+
}, dn = Object.create(null), D = class {
|
|
2980
2980
|
constructor(e, t, n) {
|
|
2981
|
-
this.$anchor = e, this.$head = t, this.ranges = n || [new
|
|
2981
|
+
this.$anchor = e, this.$head = t, this.ranges = n || [new fn(e.min(t), e.max(t))];
|
|
2982
2982
|
}
|
|
2983
2983
|
get anchor() {
|
|
2984
2984
|
return this.$anchor.pos;
|
|
@@ -3012,67 +3012,67 @@ var ln = class {
|
|
|
3012
3012
|
let i = e.steps.length, a = this.ranges;
|
|
3013
3013
|
for (let o = 0; o < a.length; o++) {
|
|
3014
3014
|
let { $from: s, $to: c } = a[o], u = e.mapping.slice(i);
|
|
3015
|
-
e.replaceRange(u.map(s.pos), u.map(c.pos), o ? l.empty : t), o == 0 &&
|
|
3015
|
+
e.replaceRange(u.map(s.pos), u.map(c.pos), o ? l.empty : t), o == 0 && yn(e, i, (n ? n.isInline : r && r.isTextblock) ? -1 : 1);
|
|
3016
3016
|
}
|
|
3017
3017
|
}
|
|
3018
3018
|
replaceWith(e, t) {
|
|
3019
3019
|
let n = e.steps.length, r = this.ranges;
|
|
3020
3020
|
for (let i = 0; i < r.length; i++) {
|
|
3021
3021
|
let { $from: a, $to: o } = r[i], s = e.mapping.slice(n), c = s.map(a.pos), l = s.map(o.pos);
|
|
3022
|
-
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t),
|
|
3022
|
+
i ? e.deleteRange(c, l) : (e.replaceRangeWith(c, l, t), yn(e, n, t.isInline ? -1 : 1));
|
|
3023
3023
|
}
|
|
3024
3024
|
}
|
|
3025
3025
|
static findFrom(e, t, n = !1) {
|
|
3026
|
-
let r = e.parent.inlineContent ? new
|
|
3026
|
+
let r = e.parent.inlineContent ? new O(e) : vn(e.node(0), e.parent, e.pos, e.index(), t, n);
|
|
3027
3027
|
if (r) return r;
|
|
3028
3028
|
for (let r = e.depth - 1; r >= 0; r--) {
|
|
3029
|
-
let i = t < 0 ?
|
|
3029
|
+
let i = t < 0 ? vn(e.node(0), e.node(r), e.before(r + 1), e.index(r), t, n) : vn(e.node(0), e.node(r), e.after(r + 1), e.index(r) + 1, t, n);
|
|
3030
3030
|
if (i) return i;
|
|
3031
3031
|
}
|
|
3032
3032
|
return null;
|
|
3033
3033
|
}
|
|
3034
3034
|
static near(e, t = 1) {
|
|
3035
|
-
return this.findFrom(e, t) || this.findFrom(e, -t) || new
|
|
3035
|
+
return this.findFrom(e, t) || this.findFrom(e, -t) || new A(e.node(0));
|
|
3036
3036
|
}
|
|
3037
3037
|
static atStart(e) {
|
|
3038
|
-
return
|
|
3038
|
+
return vn(e, e, 0, 0, 1) || new A(e);
|
|
3039
3039
|
}
|
|
3040
3040
|
static atEnd(e) {
|
|
3041
|
-
return
|
|
3041
|
+
return vn(e, e, e.content.size, e.childCount, -1) || new A(e);
|
|
3042
3042
|
}
|
|
3043
3043
|
static fromJSON(e, t) {
|
|
3044
3044
|
if (!t || !t.type) throw RangeError("Invalid input for Selection.fromJSON");
|
|
3045
|
-
let n =
|
|
3045
|
+
let n = dn[t.type];
|
|
3046
3046
|
if (!n) throw RangeError(`No selection type ${t.type} defined`);
|
|
3047
3047
|
return n.fromJSON(e, t);
|
|
3048
3048
|
}
|
|
3049
3049
|
static jsonID(e, t) {
|
|
3050
|
-
if (e in
|
|
3051
|
-
return
|
|
3050
|
+
if (e in dn) throw RangeError("Duplicate use of selection JSON ID " + e);
|
|
3051
|
+
return dn[e] = t, t.prototype.jsonID = e, t;
|
|
3052
3052
|
}
|
|
3053
3053
|
getBookmark() {
|
|
3054
|
-
return
|
|
3054
|
+
return O.between(this.$anchor, this.$head).getBookmark();
|
|
3055
3055
|
}
|
|
3056
3056
|
};
|
|
3057
|
-
|
|
3058
|
-
var
|
|
3057
|
+
D.prototype.visible = !0;
|
|
3058
|
+
var fn = class {
|
|
3059
3059
|
constructor(e, t) {
|
|
3060
3060
|
this.$from = e, this.$to = t;
|
|
3061
3061
|
}
|
|
3062
|
-
},
|
|
3063
|
-
function
|
|
3064
|
-
!
|
|
3062
|
+
}, pn = !1;
|
|
3063
|
+
function mn(e) {
|
|
3064
|
+
!pn && !e.parent.inlineContent && (pn = !0, console.warn("TextSelection endpoint not pointing into a node with inline content (" + e.parent.type.name + ")"));
|
|
3065
3065
|
}
|
|
3066
|
-
var
|
|
3066
|
+
var O = class e extends D {
|
|
3067
3067
|
constructor(e, t = e) {
|
|
3068
|
-
|
|
3068
|
+
mn(e), mn(t), super(e, t);
|
|
3069
3069
|
}
|
|
3070
3070
|
get $cursor() {
|
|
3071
3071
|
return this.$anchor.pos == this.$head.pos ? this.$head : null;
|
|
3072
3072
|
}
|
|
3073
3073
|
map(t, n) {
|
|
3074
3074
|
let r = t.resolve(n.map(this.head));
|
|
3075
|
-
if (!r.parent.inlineContent) return
|
|
3075
|
+
if (!r.parent.inlineContent) return D.near(r);
|
|
3076
3076
|
let i = t.resolve(n.map(this.anchor));
|
|
3077
3077
|
return new e(i.parent.inlineContent ? i : r, r);
|
|
3078
3078
|
}
|
|
@@ -3086,7 +3086,7 @@ var k = class e extends O {
|
|
|
3086
3086
|
return t instanceof e && t.anchor == this.anchor && t.head == this.head;
|
|
3087
3087
|
}
|
|
3088
3088
|
getBookmark() {
|
|
3089
|
-
return new
|
|
3089
|
+
return new hn(this.anchor, this.head);
|
|
3090
3090
|
}
|
|
3091
3091
|
toJSON() {
|
|
3092
3092
|
return {
|
|
@@ -3106,15 +3106,15 @@ var k = class e extends O {
|
|
|
3106
3106
|
static between(t, n, r) {
|
|
3107
3107
|
let i = t.pos - n.pos;
|
|
3108
3108
|
if ((!r || i) && (r = i >= 0 ? 1 : -1), !n.parent.inlineContent) {
|
|
3109
|
-
let e =
|
|
3109
|
+
let e = D.findFrom(n, r, !0) || D.findFrom(n, -r, !0);
|
|
3110
3110
|
if (e) n = e.$head;
|
|
3111
|
-
else return
|
|
3111
|
+
else return D.near(n, r);
|
|
3112
3112
|
}
|
|
3113
|
-
return t.parent.inlineContent || (i == 0 ? t = n : (t = (
|
|
3113
|
+
return t.parent.inlineContent || (i == 0 ? t = n : (t = (D.findFrom(t, -r, !0) || D.findFrom(t, r, !0)).$anchor, t.pos < n.pos != i < 0 && (t = n))), new e(t, n);
|
|
3114
3114
|
}
|
|
3115
3115
|
};
|
|
3116
|
-
|
|
3117
|
-
var
|
|
3116
|
+
D.jsonID("text", O);
|
|
3117
|
+
var hn = class e {
|
|
3118
3118
|
constructor(e, t) {
|
|
3119
3119
|
this.anchor = e, this.head = t;
|
|
3120
3120
|
}
|
|
@@ -3122,16 +3122,16 @@ var mn = class e {
|
|
|
3122
3122
|
return new e(t.map(this.anchor), t.map(this.head));
|
|
3123
3123
|
}
|
|
3124
3124
|
resolve(e) {
|
|
3125
|
-
return
|
|
3125
|
+
return O.between(e.resolve(this.anchor), e.resolve(this.head));
|
|
3126
3126
|
}
|
|
3127
|
-
},
|
|
3127
|
+
}, k = class e extends D {
|
|
3128
3128
|
constructor(e) {
|
|
3129
3129
|
let t = e.nodeAfter, n = e.node(0).resolve(e.pos + t.nodeSize);
|
|
3130
3130
|
super(e, n), this.node = t;
|
|
3131
3131
|
}
|
|
3132
3132
|
map(t, n) {
|
|
3133
3133
|
let { deleted: r, pos: i } = n.mapResult(this.anchor), a = t.resolve(i);
|
|
3134
|
-
return r ?
|
|
3134
|
+
return r ? D.near(a) : new e(a);
|
|
3135
3135
|
}
|
|
3136
3136
|
content() {
|
|
3137
3137
|
return new l(r.from(this.node), 0, 0);
|
|
@@ -3146,7 +3146,7 @@ var mn = class e {
|
|
|
3146
3146
|
};
|
|
3147
3147
|
}
|
|
3148
3148
|
getBookmark() {
|
|
3149
|
-
return new
|
|
3149
|
+
return new gn(this.anchor);
|
|
3150
3150
|
}
|
|
3151
3151
|
static fromJSON(t, n) {
|
|
3152
3152
|
if (typeof n.anchor != "number") throw RangeError("Invalid input for NodeSelection.fromJSON");
|
|
@@ -3159,27 +3159,27 @@ var mn = class e {
|
|
|
3159
3159
|
return !e.isText && e.type.spec.selectable !== !1;
|
|
3160
3160
|
}
|
|
3161
3161
|
};
|
|
3162
|
-
|
|
3163
|
-
var
|
|
3162
|
+
k.prototype.visible = !1, D.jsonID("node", k);
|
|
3163
|
+
var gn = class e {
|
|
3164
3164
|
constructor(e) {
|
|
3165
3165
|
this.anchor = e;
|
|
3166
3166
|
}
|
|
3167
3167
|
map(t) {
|
|
3168
3168
|
let { deleted: n, pos: r } = t.mapResult(this.anchor);
|
|
3169
|
-
return n ? new
|
|
3169
|
+
return n ? new hn(r, r) : new e(r);
|
|
3170
3170
|
}
|
|
3171
3171
|
resolve(e) {
|
|
3172
3172
|
let t = e.resolve(this.anchor), n = t.nodeAfter;
|
|
3173
|
-
return n &&
|
|
3173
|
+
return n && k.isSelectable(n) ? new k(t) : D.near(t);
|
|
3174
3174
|
}
|
|
3175
|
-
},
|
|
3175
|
+
}, A = class e extends D {
|
|
3176
3176
|
constructor(e) {
|
|
3177
3177
|
super(e.resolve(0), e.resolve(e.content.size));
|
|
3178
3178
|
}
|
|
3179
3179
|
replace(e, t = l.empty) {
|
|
3180
3180
|
if (t == l.empty) {
|
|
3181
3181
|
e.delete(0, e.doc.content.size);
|
|
3182
|
-
let t =
|
|
3182
|
+
let t = D.atStart(e.doc);
|
|
3183
3183
|
t.eq(e.selection) || e.setSelection(t);
|
|
3184
3184
|
} else super.replace(e, t);
|
|
3185
3185
|
}
|
|
@@ -3196,41 +3196,41 @@ var hn = class e {
|
|
|
3196
3196
|
return t instanceof e;
|
|
3197
3197
|
}
|
|
3198
3198
|
getBookmark() {
|
|
3199
|
-
return
|
|
3199
|
+
return _n;
|
|
3200
3200
|
}
|
|
3201
3201
|
};
|
|
3202
|
-
|
|
3203
|
-
var
|
|
3202
|
+
D.jsonID("all", A);
|
|
3203
|
+
var _n = {
|
|
3204
3204
|
map() {
|
|
3205
3205
|
return this;
|
|
3206
3206
|
},
|
|
3207
3207
|
resolve(e) {
|
|
3208
|
-
return new
|
|
3208
|
+
return new A(e);
|
|
3209
3209
|
}
|
|
3210
3210
|
};
|
|
3211
|
-
function
|
|
3212
|
-
if (t.inlineContent) return
|
|
3211
|
+
function vn(e, t, n, r, i, a = !1) {
|
|
3212
|
+
if (t.inlineContent) return O.create(e, n);
|
|
3213
3213
|
for (let o = r - (i > 0 ? 0 : 1); i > 0 ? o < t.childCount : o >= 0; o += i) {
|
|
3214
3214
|
let r = t.child(o);
|
|
3215
3215
|
if (!r.isAtom) {
|
|
3216
|
-
let t =
|
|
3216
|
+
let t = vn(e, r, n + i, i < 0 ? r.childCount : 0, i, a);
|
|
3217
3217
|
if (t) return t;
|
|
3218
|
-
} else if (!a &&
|
|
3218
|
+
} else if (!a && k.isSelectable(r)) return k.create(e, n - (i < 0 ? r.nodeSize : 0));
|
|
3219
3219
|
n += r.nodeSize * i;
|
|
3220
3220
|
}
|
|
3221
3221
|
return null;
|
|
3222
3222
|
}
|
|
3223
|
-
function
|
|
3223
|
+
function yn(e, t, n) {
|
|
3224
3224
|
let r = e.steps.length - 1;
|
|
3225
3225
|
if (r < t) return;
|
|
3226
3226
|
let i = e.steps[r];
|
|
3227
|
-
if (!(i instanceof
|
|
3227
|
+
if (!(i instanceof w || i instanceof T)) return;
|
|
3228
3228
|
let a = e.mapping.maps[r], o;
|
|
3229
3229
|
a.forEach((e, t, n, r) => {
|
|
3230
3230
|
o ??= r;
|
|
3231
|
-
}), e.setSelection(
|
|
3231
|
+
}), e.setSelection(D.near(e.doc.resolve(o), n));
|
|
3232
3232
|
}
|
|
3233
|
-
var
|
|
3233
|
+
var bn = 1, xn = 2, Sn = 4, Cn = class extends un {
|
|
3234
3234
|
constructor(e) {
|
|
3235
3235
|
super(e.doc), this.curSelectionFor = 0, this.updated = 0, this.meta = Object.create(null), this.time = Date.now(), this.curSelection = e.selection, this.storedMarks = e.storedMarks;
|
|
3236
3236
|
}
|
|
@@ -3239,13 +3239,13 @@ var yn = 1, bn = 2, xn = 4, Sn = class extends ln {
|
|
|
3239
3239
|
}
|
|
3240
3240
|
setSelection(e) {
|
|
3241
3241
|
if (e.$from.doc != this.doc) throw RangeError("Selection passed to setSelection must point at the current document");
|
|
3242
|
-
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated |
|
|
3242
|
+
return this.curSelection = e, this.curSelectionFor = this.steps.length, this.updated = (this.updated | bn) & -3, this.storedMarks = null, this;
|
|
3243
3243
|
}
|
|
3244
3244
|
get selectionSet() {
|
|
3245
|
-
return (this.updated &
|
|
3245
|
+
return (this.updated & bn) > 0;
|
|
3246
3246
|
}
|
|
3247
3247
|
setStoredMarks(e) {
|
|
3248
|
-
return this.storedMarks = e, this.updated |=
|
|
3248
|
+
return this.storedMarks = e, this.updated |= xn, this;
|
|
3249
3249
|
}
|
|
3250
3250
|
ensureMarks(e) {
|
|
3251
3251
|
return s.sameSet(this.storedMarks || this.selection.$from.marks(), e) || this.setStoredMarks(e), this;
|
|
@@ -3257,10 +3257,10 @@ var yn = 1, bn = 2, xn = 4, Sn = class extends ln {
|
|
|
3257
3257
|
return this.ensureMarks(e.removeFromSet(this.storedMarks || this.selection.$head.marks()));
|
|
3258
3258
|
}
|
|
3259
3259
|
get storedMarksSet() {
|
|
3260
|
-
return (this.updated &
|
|
3260
|
+
return (this.updated & xn) > 0;
|
|
3261
3261
|
}
|
|
3262
3262
|
addStep(e, t) {
|
|
3263
|
-
super.addStep(e, t), this.updated &=
|
|
3263
|
+
super.addStep(e, t), this.updated &= -3, this.storedMarks = null;
|
|
3264
3264
|
}
|
|
3265
3265
|
setTime(e) {
|
|
3266
3266
|
return this.time = e, this;
|
|
@@ -3285,7 +3285,7 @@ var yn = 1, bn = 2, xn = 4, Sn = class extends ln {
|
|
|
3285
3285
|
let e = this.doc.resolve(t);
|
|
3286
3286
|
i = n == t ? e.marks() : e.marksAcross(this.doc.resolve(n));
|
|
3287
3287
|
}
|
|
3288
|
-
return this.replaceRangeWith(t, n, r.text(e, i)), !this.selection.empty && this.selection.to == t + e.length && this.setSelection(
|
|
3288
|
+
return this.replaceRangeWith(t, n, r.text(e, i)), !this.selection.empty && this.selection.to == t + e.length && this.setSelection(D.near(this.selection.$to)), this;
|
|
3289
3289
|
}
|
|
3290
3290
|
}
|
|
3291
3291
|
setMeta(e, t) {
|
|
@@ -3299,21 +3299,21 @@ var yn = 1, bn = 2, xn = 4, Sn = class extends ln {
|
|
|
3299
3299
|
return !0;
|
|
3300
3300
|
}
|
|
3301
3301
|
scrollIntoView() {
|
|
3302
|
-
return this.updated |=
|
|
3302
|
+
return this.updated |= Sn, this;
|
|
3303
3303
|
}
|
|
3304
3304
|
get scrolledIntoView() {
|
|
3305
|
-
return (this.updated &
|
|
3305
|
+
return (this.updated & Sn) > 0;
|
|
3306
3306
|
}
|
|
3307
3307
|
};
|
|
3308
|
-
function
|
|
3308
|
+
function wn(e, t) {
|
|
3309
3309
|
return !t || !e ? e : e.bind(t);
|
|
3310
3310
|
}
|
|
3311
|
-
var
|
|
3311
|
+
var Tn = class {
|
|
3312
3312
|
constructor(e, t, n) {
|
|
3313
|
-
this.name = e, this.init =
|
|
3313
|
+
this.name = e, this.init = wn(t.init, n), this.apply = wn(t.apply, n);
|
|
3314
3314
|
}
|
|
3315
|
-
},
|
|
3316
|
-
new
|
|
3315
|
+
}, En = [
|
|
3316
|
+
new Tn("doc", {
|
|
3317
3317
|
init(e) {
|
|
3318
3318
|
return e.doc || e.schema.topNodeType.createAndFill();
|
|
3319
3319
|
},
|
|
@@ -3321,15 +3321,15 @@ var wn = class {
|
|
|
3321
3321
|
return e.doc;
|
|
3322
3322
|
}
|
|
3323
3323
|
}),
|
|
3324
|
-
new
|
|
3324
|
+
new Tn("selection", {
|
|
3325
3325
|
init(e, t) {
|
|
3326
|
-
return e.selection ||
|
|
3326
|
+
return e.selection || D.atStart(t.doc);
|
|
3327
3327
|
},
|
|
3328
3328
|
apply(e) {
|
|
3329
3329
|
return e.selection;
|
|
3330
3330
|
}
|
|
3331
3331
|
}),
|
|
3332
|
-
new
|
|
3332
|
+
new Tn("storedMarks", {
|
|
3333
3333
|
init(e) {
|
|
3334
3334
|
return e.storedMarks || null;
|
|
3335
3335
|
},
|
|
@@ -3337,7 +3337,7 @@ var wn = class {
|
|
|
3337
3337
|
return r.selection.$cursor ? e.storedMarks : null;
|
|
3338
3338
|
}
|
|
3339
3339
|
}),
|
|
3340
|
-
new
|
|
3340
|
+
new Tn("scrollToSelection", {
|
|
3341
3341
|
init() {
|
|
3342
3342
|
return 0;
|
|
3343
3343
|
},
|
|
@@ -3345,14 +3345,14 @@ var wn = class {
|
|
|
3345
3345
|
return e.scrolledIntoView ? t + 1 : t;
|
|
3346
3346
|
}
|
|
3347
3347
|
})
|
|
3348
|
-
],
|
|
3348
|
+
], Dn = class {
|
|
3349
3349
|
constructor(e, t) {
|
|
3350
|
-
this.schema = e, this.plugins = [], this.pluginsByKey = Object.create(null), this.fields =
|
|
3350
|
+
this.schema = e, this.plugins = [], this.pluginsByKey = Object.create(null), this.fields = En.slice(), t && t.forEach((e) => {
|
|
3351
3351
|
if (this.pluginsByKey[e.key]) throw RangeError("Adding different instances of a keyed plugin (" + e.key + ")");
|
|
3352
|
-
this.plugins.push(e), this.pluginsByKey[e.key] = e, e.spec.state && this.fields.push(new
|
|
3352
|
+
this.plugins.push(e), this.pluginsByKey[e.key] = e, e.spec.state && this.fields.push(new Tn(e.key, e.spec.state, e));
|
|
3353
3353
|
});
|
|
3354
3354
|
}
|
|
3355
|
-
},
|
|
3355
|
+
}, On = class e {
|
|
3356
3356
|
constructor(e) {
|
|
3357
3357
|
this.config = e;
|
|
3358
3358
|
}
|
|
@@ -3419,15 +3419,15 @@ var wn = class {
|
|
|
3419
3419
|
return n;
|
|
3420
3420
|
}
|
|
3421
3421
|
get tr() {
|
|
3422
|
-
return new
|
|
3422
|
+
return new Cn(this);
|
|
3423
3423
|
}
|
|
3424
3424
|
static create(t) {
|
|
3425
|
-
let n = new
|
|
3425
|
+
let n = new Dn(t.doc ? t.doc.type.schema : t.schema, t.plugins), r = new e(n);
|
|
3426
3426
|
for (let e = 0; e < n.fields.length; e++) r[n.fields[e].name] = n.fields[e].init(t, r);
|
|
3427
3427
|
return r;
|
|
3428
3428
|
}
|
|
3429
3429
|
reconfigure(t) {
|
|
3430
|
-
let n = new
|
|
3430
|
+
let n = new Dn(this.schema, t.plugins), r = n.fields, i = new e(n);
|
|
3431
3431
|
for (let e = 0; e < r.length; e++) {
|
|
3432
3432
|
let n = r[e].name;
|
|
3433
3433
|
i[n] = this.hasOwnProperty(n) ? this[n] : r[e].init(t, i);
|
|
@@ -3449,10 +3449,10 @@ var wn = class {
|
|
|
3449
3449
|
static fromJSON(t, n, r) {
|
|
3450
3450
|
if (!n) throw RangeError("Invalid input for EditorState.fromJSON");
|
|
3451
3451
|
if (!t.schema) throw RangeError("Required config field 'schema' missing");
|
|
3452
|
-
let i = new
|
|
3452
|
+
let i = new Dn(t.schema, t.plugins), a = new e(i);
|
|
3453
3453
|
return i.fields.forEach((e) => {
|
|
3454
|
-
if (e.name == "doc") a.doc =
|
|
3455
|
-
else if (e.name == "selection") a.selection =
|
|
3454
|
+
if (e.name == "doc") a.doc = x.fromJSON(t.schema, n.doc);
|
|
3455
|
+
else if (e.name == "selection") a.selection = D.fromJSON(a.doc, n.selection);
|
|
3456
3456
|
else if (e.name == "storedMarks") n.storedMarks && (a.storedMarks = n.storedMarks.map(t.schema.markFromJSON));
|
|
3457
3457
|
else {
|
|
3458
3458
|
if (r) for (let i in r) {
|
|
@@ -3467,27 +3467,27 @@ var wn = class {
|
|
|
3467
3467
|
}), a;
|
|
3468
3468
|
}
|
|
3469
3469
|
};
|
|
3470
|
-
function
|
|
3470
|
+
function kn(e, t, n) {
|
|
3471
3471
|
for (let r in e) {
|
|
3472
3472
|
let i = e[r];
|
|
3473
|
-
i instanceof Function ? i = i.bind(t) : r == "handleDOMEvents" && (i =
|
|
3473
|
+
i instanceof Function ? i = i.bind(t) : r == "handleDOMEvents" && (i = kn(i, t, {})), n[r] = i;
|
|
3474
3474
|
}
|
|
3475
3475
|
return n;
|
|
3476
3476
|
}
|
|
3477
|
-
var
|
|
3477
|
+
var j = class {
|
|
3478
3478
|
constructor(e) {
|
|
3479
|
-
this.spec = e, this.props = {}, e.props &&
|
|
3479
|
+
this.spec = e, this.props = {}, e.props && kn(e.props, this, this.props), this.key = e.key ? e.key.key : jn("plugin");
|
|
3480
3480
|
}
|
|
3481
3481
|
getState(e) {
|
|
3482
3482
|
return e[this.key];
|
|
3483
3483
|
}
|
|
3484
|
-
},
|
|
3485
|
-
function
|
|
3486
|
-
return e in
|
|
3484
|
+
}, An = Object.create(null);
|
|
3485
|
+
function jn(e) {
|
|
3486
|
+
return e in An ? e + "$" + ++An[e] : (An[e] = 0, e + "$");
|
|
3487
3487
|
}
|
|
3488
|
-
var
|
|
3488
|
+
var Mn = class {
|
|
3489
3489
|
constructor(e = "key") {
|
|
3490
|
-
this.key =
|
|
3490
|
+
this.key = jn(e);
|
|
3491
3491
|
}
|
|
3492
3492
|
get(e) {
|
|
3493
3493
|
return e.config.pluginsByKey[this.key];
|
|
@@ -3495,45 +3495,45 @@ var jn = class {
|
|
|
3495
3495
|
getState(e) {
|
|
3496
3496
|
return e[this.key];
|
|
3497
3497
|
}
|
|
3498
|
-
},
|
|
3499
|
-
function
|
|
3498
|
+
}, Nn = (e, t) => e.selection.empty ? !1 : (t && t(e.tr.deleteSelection().scrollIntoView()), !0);
|
|
3499
|
+
function Pn(e, t) {
|
|
3500
3500
|
let { $cursor: n } = e.selection;
|
|
3501
3501
|
return !n || (t ? !t.endOfTextblock("backward", e) : n.parentOffset > 0) ? null : n;
|
|
3502
3502
|
}
|
|
3503
|
-
var
|
|
3504
|
-
let r =
|
|
3503
|
+
var Fn = (e, t, n) => {
|
|
3504
|
+
let r = Pn(e, n);
|
|
3505
3505
|
if (!r) return !1;
|
|
3506
|
-
let i =
|
|
3506
|
+
let i = Vn(r);
|
|
3507
3507
|
if (!i) {
|
|
3508
|
-
let n = r.blockRange(), i = n &&
|
|
3508
|
+
let n = r.blockRange(), i = n && Tt(n);
|
|
3509
3509
|
return i == null ? !1 : (t && t(e.tr.lift(n, i).scrollIntoView()), !0);
|
|
3510
3510
|
}
|
|
3511
3511
|
let a = i.nodeBefore;
|
|
3512
|
-
if (
|
|
3513
|
-
if (r.parent.content.size == 0 && (
|
|
3514
|
-
let o =
|
|
3512
|
+
if (ar(e, i, t, -1)) return !0;
|
|
3513
|
+
if (r.parent.content.size == 0 && (zn(a, "end") || k.isSelectable(a))) for (let n = r.depth;; n--) {
|
|
3514
|
+
let o = Gt(e.doc, r.before(n), r.after(n), l.empty);
|
|
3515
3515
|
if (o && o.slice.size < o.to - o.from) {
|
|
3516
3516
|
if (t) {
|
|
3517
3517
|
let n = e.tr.step(o);
|
|
3518
|
-
n.setSelection(
|
|
3518
|
+
n.setSelection(zn(a, "end") ? D.findFrom(n.doc.resolve(n.mapping.map(i.pos, -1)), -1) : k.create(n.doc, i.pos - a.nodeSize)), t(n.scrollIntoView());
|
|
3519
3519
|
}
|
|
3520
3520
|
return !0;
|
|
3521
3521
|
}
|
|
3522
3522
|
if (n == 1 || r.node(n - 1).childCount > 1) break;
|
|
3523
3523
|
}
|
|
3524
3524
|
return a.isAtom && i.depth == r.depth - 1 ? (t && t(e.tr.delete(i.pos - a.nodeSize, i.pos).scrollIntoView()), !0) : !1;
|
|
3525
|
-
}, Fn = (e, t, n) => {
|
|
3526
|
-
let r = Nn(e, n);
|
|
3527
|
-
if (!r) return !1;
|
|
3528
|
-
let i = Bn(r);
|
|
3529
|
-
return i ? Ln(e, i, t) : !1;
|
|
3530
3525
|
}, In = (e, t, n) => {
|
|
3531
|
-
let r =
|
|
3526
|
+
let r = Pn(e, n);
|
|
3527
|
+
if (!r) return !1;
|
|
3528
|
+
let i = Vn(r);
|
|
3529
|
+
return i ? Rn(e, i, t) : !1;
|
|
3530
|
+
}, Ln = (e, t, n) => {
|
|
3531
|
+
let r = Hn(e, n);
|
|
3532
3532
|
if (!r) return !1;
|
|
3533
|
-
let i =
|
|
3534
|
-
return i ?
|
|
3533
|
+
let i = Gn(r);
|
|
3534
|
+
return i ? Rn(e, i, t) : !1;
|
|
3535
3535
|
};
|
|
3536
|
-
function
|
|
3536
|
+
function Rn(e, t, n) {
|
|
3537
3537
|
let r = t.nodeBefore, i = t.pos - 1;
|
|
3538
3538
|
for (; !r.isTextblock; i--) {
|
|
3539
3539
|
if (r.type.spec.isolating) return !1;
|
|
@@ -3548,71 +3548,71 @@ function Ln(e, t, n) {
|
|
|
3548
3548
|
if (!e) return !1;
|
|
3549
3549
|
a = e;
|
|
3550
3550
|
}
|
|
3551
|
-
let s =
|
|
3552
|
-
if (!s || s.from != i || s instanceof
|
|
3551
|
+
let s = Gt(e.doc, i, o, l.empty);
|
|
3552
|
+
if (!s || s.from != i || s instanceof w && s.slice.size >= o - i) return !1;
|
|
3553
3553
|
if (n) {
|
|
3554
3554
|
let t = e.tr.step(s);
|
|
3555
|
-
t.setSelection(
|
|
3555
|
+
t.setSelection(O.create(t.doc, i)), n(t.scrollIntoView());
|
|
3556
3556
|
}
|
|
3557
3557
|
return !0;
|
|
3558
3558
|
}
|
|
3559
|
-
function
|
|
3559
|
+
function zn(e, t, n = !1) {
|
|
3560
3560
|
for (let r = e; r; r = t == "start" ? r.firstChild : r.lastChild) {
|
|
3561
3561
|
if (r.isTextblock) return !0;
|
|
3562
3562
|
if (n && r.childCount != 1) return !1;
|
|
3563
3563
|
}
|
|
3564
3564
|
return !1;
|
|
3565
3565
|
}
|
|
3566
|
-
var
|
|
3566
|
+
var Bn = (e, t, n) => {
|
|
3567
3567
|
let { $head: r, empty: i } = e.selection, a = r;
|
|
3568
3568
|
if (!i) return !1;
|
|
3569
3569
|
if (r.parent.isTextblock) {
|
|
3570
3570
|
if (n ? !n.endOfTextblock("backward", e) : r.parentOffset > 0) return !1;
|
|
3571
|
-
a =
|
|
3571
|
+
a = Vn(r);
|
|
3572
3572
|
}
|
|
3573
3573
|
let o = a && a.nodeBefore;
|
|
3574
|
-
return !o || !
|
|
3574
|
+
return !o || !k.isSelectable(o) ? !1 : (t && t(e.tr.setSelection(k.create(e.doc, a.pos - o.nodeSize)).scrollIntoView()), !0);
|
|
3575
3575
|
};
|
|
3576
|
-
function
|
|
3576
|
+
function Vn(e) {
|
|
3577
3577
|
if (!e.parent.type.spec.isolating) for (let t = e.depth - 1; t >= 0; t--) {
|
|
3578
3578
|
if (e.index(t) > 0) return e.doc.resolve(e.before(t + 1));
|
|
3579
3579
|
if (e.node(t).type.spec.isolating) break;
|
|
3580
3580
|
}
|
|
3581
3581
|
return null;
|
|
3582
3582
|
}
|
|
3583
|
-
function
|
|
3583
|
+
function Hn(e, t) {
|
|
3584
3584
|
let { $cursor: n } = e.selection;
|
|
3585
3585
|
return !n || (t ? !t.endOfTextblock("forward", e) : n.parentOffset < n.parent.content.size) ? null : n;
|
|
3586
3586
|
}
|
|
3587
|
-
var
|
|
3588
|
-
let r =
|
|
3587
|
+
var Un = (e, t, n) => {
|
|
3588
|
+
let r = Hn(e, n);
|
|
3589
3589
|
if (!r) return !1;
|
|
3590
|
-
let i =
|
|
3590
|
+
let i = Gn(r);
|
|
3591
3591
|
if (!i) return !1;
|
|
3592
3592
|
let a = i.nodeAfter;
|
|
3593
|
-
if (
|
|
3594
|
-
if (r.parent.content.size == 0 && (
|
|
3595
|
-
let n =
|
|
3593
|
+
if (ar(e, i, t, 1)) return !0;
|
|
3594
|
+
if (r.parent.content.size == 0 && (zn(a, "start") || k.isSelectable(a))) {
|
|
3595
|
+
let n = Gt(e.doc, r.before(), r.after(), l.empty);
|
|
3596
3596
|
if (n && n.slice.size < n.to - n.from) {
|
|
3597
3597
|
if (t) {
|
|
3598
3598
|
let r = e.tr.step(n);
|
|
3599
|
-
r.setSelection(
|
|
3599
|
+
r.setSelection(zn(a, "start") ? D.findFrom(r.doc.resolve(r.mapping.map(i.pos)), 1) : k.create(r.doc, r.mapping.map(i.pos))), t(r.scrollIntoView());
|
|
3600
3600
|
}
|
|
3601
3601
|
return !0;
|
|
3602
3602
|
}
|
|
3603
3603
|
}
|
|
3604
3604
|
return a.isAtom && i.depth == r.depth - 1 ? (t && t(e.tr.delete(i.pos, i.pos + a.nodeSize).scrollIntoView()), !0) : !1;
|
|
3605
|
-
},
|
|
3605
|
+
}, Wn = (e, t, n) => {
|
|
3606
3606
|
let { $head: r, empty: i } = e.selection, a = r;
|
|
3607
3607
|
if (!i) return !1;
|
|
3608
3608
|
if (r.parent.isTextblock) {
|
|
3609
3609
|
if (n ? !n.endOfTextblock("forward", e) : r.parentOffset < r.parent.content.size) return !1;
|
|
3610
|
-
a =
|
|
3610
|
+
a = Gn(r);
|
|
3611
3611
|
}
|
|
3612
3612
|
let o = a && a.nodeAfter;
|
|
3613
|
-
return !o || !
|
|
3613
|
+
return !o || !k.isSelectable(o) ? !1 : (t && t(e.tr.setSelection(k.create(e.doc, a.pos)).scrollIntoView()), !0);
|
|
3614
3614
|
};
|
|
3615
|
-
function
|
|
3615
|
+
function Gn(e) {
|
|
3616
3616
|
if (!e.parent.type.spec.isolating) for (let t = e.depth - 1; t >= 0; t--) {
|
|
3617
3617
|
let n = e.node(t);
|
|
3618
3618
|
if (e.index(t) + 1 < n.childCount) return e.doc.resolve(e.after(t + 1));
|
|
@@ -3620,76 +3620,76 @@ function Wn(e) {
|
|
|
3620
3620
|
}
|
|
3621
3621
|
return null;
|
|
3622
3622
|
}
|
|
3623
|
-
var
|
|
3624
|
-
let n = e.selection, r = n instanceof
|
|
3623
|
+
var Kn = (e, t) => {
|
|
3624
|
+
let n = e.selection, r = n instanceof k, i;
|
|
3625
3625
|
if (r) {
|
|
3626
|
-
if (n.node.isTextblock || !
|
|
3626
|
+
if (n.node.isTextblock || !Rt(e.doc, n.from)) return !1;
|
|
3627
3627
|
i = n.from;
|
|
3628
|
-
} else if (i =
|
|
3628
|
+
} else if (i = Vt(e.doc, n.from, -1), i == null) return !1;
|
|
3629
3629
|
if (t) {
|
|
3630
3630
|
let n = e.tr.join(i);
|
|
3631
|
-
r && n.setSelection(
|
|
3631
|
+
r && n.setSelection(k.create(n.doc, i - e.doc.resolve(i).nodeBefore.nodeSize)), t(n.scrollIntoView());
|
|
3632
3632
|
}
|
|
3633
3633
|
return !0;
|
|
3634
|
-
},
|
|
3634
|
+
}, qn = (e, t) => {
|
|
3635
3635
|
let n = e.selection, r;
|
|
3636
|
-
if (n instanceof
|
|
3637
|
-
if (n.node.isTextblock || !
|
|
3636
|
+
if (n instanceof k) {
|
|
3637
|
+
if (n.node.isTextblock || !Rt(e.doc, n.to)) return !1;
|
|
3638
3638
|
r = n.to;
|
|
3639
|
-
} else if (r =
|
|
3639
|
+
} else if (r = Vt(e.doc, n.to, 1), r == null) return !1;
|
|
3640
3640
|
return t && t(e.tr.join(r).scrollIntoView()), !0;
|
|
3641
|
-
}, qn = (e, t) => {
|
|
3642
|
-
let { $from: n, $to: r } = e.selection, i = n.blockRange(r), a = i && wt(i);
|
|
3643
|
-
return a == null ? !1 : (t && t(e.tr.lift(i, a).scrollIntoView()), !0);
|
|
3644
3641
|
}, Jn = (e, t) => {
|
|
3642
|
+
let { $from: n, $to: r } = e.selection, i = n.blockRange(r), a = i && Tt(i);
|
|
3643
|
+
return a == null ? !1 : (t && t(e.tr.lift(i, a).scrollIntoView()), !0);
|
|
3644
|
+
}, Yn = (e, t) => {
|
|
3645
3645
|
let { $head: n, $anchor: r } = e.selection;
|
|
3646
3646
|
return !n.parent.type.spec.code || !n.sameParent(r) ? !1 : (t && t(e.tr.insertText("\n").scrollIntoView()), !0);
|
|
3647
3647
|
};
|
|
3648
|
-
function
|
|
3648
|
+
function Xn(e) {
|
|
3649
3649
|
for (let t = 0; t < e.edgeCount; t++) {
|
|
3650
3650
|
let { type: n } = e.edge(t);
|
|
3651
3651
|
if (n.isTextblock && !n.hasRequiredAttrs()) return n;
|
|
3652
3652
|
}
|
|
3653
3653
|
return null;
|
|
3654
3654
|
}
|
|
3655
|
-
var
|
|
3655
|
+
var Zn = (e, t) => {
|
|
3656
3656
|
let { $head: n, $anchor: r } = e.selection;
|
|
3657
3657
|
if (!n.parent.type.spec.code || !n.sameParent(r)) return !1;
|
|
3658
|
-
let i = n.node(-1), a = n.indexAfter(-1), o =
|
|
3658
|
+
let i = n.node(-1), a = n.indexAfter(-1), o = Xn(i.contentMatchAt(a));
|
|
3659
3659
|
if (!o || !i.canReplaceWith(a, a, o)) return !1;
|
|
3660
3660
|
if (t) {
|
|
3661
3661
|
let r = n.after(), i = e.tr.replaceWith(r, r, o.createAndFill());
|
|
3662
|
-
i.setSelection(
|
|
3662
|
+
i.setSelection(D.near(i.doc.resolve(r), 1)), t(i.scrollIntoView());
|
|
3663
3663
|
}
|
|
3664
3664
|
return !0;
|
|
3665
|
-
},
|
|
3665
|
+
}, Qn = (e, t) => {
|
|
3666
3666
|
let n = e.selection, { $from: r, $to: i } = n;
|
|
3667
|
-
if (n instanceof
|
|
3668
|
-
let a =
|
|
3667
|
+
if (n instanceof A || r.parent.inlineContent || i.parent.inlineContent) return !1;
|
|
3668
|
+
let a = Xn(i.parent.contentMatchAt(i.indexAfter()));
|
|
3669
3669
|
if (!a || !a.isTextblock) return !1;
|
|
3670
3670
|
if (t) {
|
|
3671
3671
|
let n = (!r.parentOffset && i.index() < i.parent.childCount ? r : i).pos, o = e.tr.insert(n, a.createAndFill());
|
|
3672
|
-
o.setSelection(
|
|
3672
|
+
o.setSelection(O.create(o.doc, n + 1)), t(o.scrollIntoView());
|
|
3673
3673
|
}
|
|
3674
3674
|
return !0;
|
|
3675
|
-
},
|
|
3675
|
+
}, $n = (e, t) => {
|
|
3676
3676
|
let { $cursor: n } = e.selection;
|
|
3677
3677
|
if (!n || n.parent.content.size) return !1;
|
|
3678
3678
|
if (n.depth > 1 && n.after() != n.end(-1)) {
|
|
3679
3679
|
let r = n.before();
|
|
3680
|
-
if (
|
|
3680
|
+
if (E(e.doc, r)) return t && t(e.tr.split(r).scrollIntoView()), !0;
|
|
3681
3681
|
}
|
|
3682
|
-
let r = n.blockRange(), i = r &&
|
|
3682
|
+
let r = n.blockRange(), i = r && Tt(r);
|
|
3683
3683
|
return i == null ? !1 : (t && t(e.tr.lift(r, i).scrollIntoView()), !0);
|
|
3684
3684
|
};
|
|
3685
|
-
function
|
|
3685
|
+
function er(e) {
|
|
3686
3686
|
return (t, n) => {
|
|
3687
3687
|
let { $from: r, $to: i } = t.selection;
|
|
3688
|
-
if (t.selection instanceof
|
|
3688
|
+
if (t.selection instanceof k && t.selection.node.isBlock) return !r.parentOffset || !E(t.doc, r.pos) ? !1 : (n && n(t.tr.split(r.pos).scrollIntoView()), !0);
|
|
3689
3689
|
if (!r.depth) return !1;
|
|
3690
3690
|
let a = [], o, s, c = !1, l = !1;
|
|
3691
3691
|
for (let t = r.depth;; t--) if (r.node(t).isBlock) {
|
|
3692
|
-
c = r.end(t) == r.pos + (r.depth - t), l = r.start(t) == r.pos - (r.depth - t), s =
|
|
3692
|
+
c = r.end(t) == r.pos + (r.depth - t), l = r.start(t) == r.pos - (r.depth - t), s = Xn(r.node(t - 1).contentMatchAt(r.indexAfter(t - 1)));
|
|
3693
3693
|
let n = e && e(i.parent, c, r);
|
|
3694
3694
|
a.unshift(n || (c && s ? { type: s } : null)), o = t;
|
|
3695
3695
|
break;
|
|
@@ -3698,9 +3698,9 @@ function $n(e) {
|
|
|
3698
3698
|
a.unshift(null);
|
|
3699
3699
|
}
|
|
3700
3700
|
let u = t.tr;
|
|
3701
|
-
(t.selection instanceof
|
|
3702
|
-
let d = u.mapping.map(r.pos), f =
|
|
3703
|
-
if (f ||= (a[0] = s ? { type: s } : null,
|
|
3701
|
+
(t.selection instanceof O || t.selection instanceof A) && u.deleteSelection();
|
|
3702
|
+
let d = u.mapping.map(r.pos), f = E(u.doc, d, a.length, a);
|
|
3703
|
+
if (f ||= (a[0] = s ? { type: s } : null, E(u.doc, d, a.length, a)), !f) return !1;
|
|
3704
3704
|
if (u.split(d, a.length, a), !c && l && r.node(o).type != s) {
|
|
3705
3705
|
let e = u.mapping.map(r.before(o)), t = u.doc.resolve(e);
|
|
3706
3706
|
s && r.node(o - 1).canReplaceWith(t.index(), t.index() + 1, s) && u.setNodeMarkup(u.mapping.map(r.before(o)), s);
|
|
@@ -3708,31 +3708,31 @@ function $n(e) {
|
|
|
3708
3708
|
return n && n(u.scrollIntoView()), !0;
|
|
3709
3709
|
};
|
|
3710
3710
|
}
|
|
3711
|
-
var
|
|
3711
|
+
var tr = er(), nr = (e, t) => {
|
|
3712
3712
|
let { $from: n, to: r } = e.selection, i, a = n.sharedDepth(r);
|
|
3713
|
-
return a == 0 ? !1 : (i = n.before(a), t && t(e.tr.setSelection(
|
|
3714
|
-
},
|
|
3715
|
-
function
|
|
3713
|
+
return a == 0 ? !1 : (i = n.before(a), t && t(e.tr.setSelection(k.create(e.doc, i))), !0);
|
|
3714
|
+
}, rr = (e, t) => (t && t(e.tr.setSelection(new A(e.doc))), !0);
|
|
3715
|
+
function ir(e, t, n) {
|
|
3716
3716
|
let r = t.nodeBefore, i = t.nodeAfter, a = t.index();
|
|
3717
|
-
return !r || !i || !r.type.compatibleContent(i.type) ? !1 : !r.content.size && t.parent.canReplace(a - 1, a) ? (n && n(e.tr.delete(t.pos - r.nodeSize, t.pos).scrollIntoView()), !0) : !t.parent.canReplace(a, a + 1) || !(i.isTextblock ||
|
|
3717
|
+
return !r || !i || !r.type.compatibleContent(i.type) ? !1 : !r.content.size && t.parent.canReplace(a - 1, a) ? (n && n(e.tr.delete(t.pos - r.nodeSize, t.pos).scrollIntoView()), !0) : !t.parent.canReplace(a, a + 1) || !(i.isTextblock || Rt(e.doc, t.pos)) ? !1 : (n && n(e.tr.join(t.pos).scrollIntoView()), !0);
|
|
3718
3718
|
}
|
|
3719
|
-
function
|
|
3719
|
+
function ar(e, t, n, i) {
|
|
3720
3720
|
let a = t.nodeBefore, o = t.nodeAfter, s, c, u = a.type.spec.isolating || o.type.spec.isolating;
|
|
3721
|
-
if (!u &&
|
|
3721
|
+
if (!u && ir(e, t, n)) return !0;
|
|
3722
3722
|
let d = !u && t.parent.canReplace(t.index(), t.index() + 1);
|
|
3723
3723
|
if (d && (s = (c = a.contentMatchAt(a.childCount)).findWrapping(o.type)) && c.matchType(s[0] || o.type).validEnd) {
|
|
3724
3724
|
if (n) {
|
|
3725
3725
|
let i = t.pos + o.nodeSize, c = r.empty;
|
|
3726
3726
|
for (let e = s.length - 1; e >= 0; e--) c = r.from(s[e].create(null, c));
|
|
3727
3727
|
c = r.from(a.copy(c));
|
|
3728
|
-
let u = e.tr.step(new
|
|
3729
|
-
d.nodeAfter && d.nodeAfter.type == a.type &&
|
|
3728
|
+
let u = e.tr.step(new T(t.pos - 1, i, t.pos, i, new l(c, 1, 0), s.length, !0)), d = u.doc.resolve(i + 2 * s.length);
|
|
3729
|
+
d.nodeAfter && d.nodeAfter.type == a.type && Rt(u.doc, d.pos) && u.join(d.pos), n(u.scrollIntoView());
|
|
3730
3730
|
}
|
|
3731
3731
|
return !0;
|
|
3732
3732
|
}
|
|
3733
|
-
let f = o.type.spec.isolating || i > 0 && u ? null :
|
|
3733
|
+
let f = o.type.spec.isolating || i > 0 && u ? null : D.findFrom(t, 1), p = f && f.$from.blockRange(f.$to), m = p && Tt(p);
|
|
3734
3734
|
if (m != null && m >= t.depth) return n && n(e.tr.lift(p, m).scrollIntoView()), !0;
|
|
3735
|
-
if (d &&
|
|
3735
|
+
if (d && zn(o, "start", !0) && zn(a, "end")) {
|
|
3736
3736
|
let i = a, s = [];
|
|
3737
3737
|
for (; s.push(i), !i.isTextblock;) i = i.lastChild;
|
|
3738
3738
|
let c = o, u = 1;
|
|
@@ -3741,31 +3741,31 @@ function ir(e, t, n, i) {
|
|
|
3741
3741
|
if (n) {
|
|
3742
3742
|
let i = r.empty;
|
|
3743
3743
|
for (let e = s.length - 1; e >= 0; e--) i = r.from(s[e].copy(i));
|
|
3744
|
-
n(e.tr.step(new
|
|
3744
|
+
n(e.tr.step(new T(t.pos - s.length, t.pos + o.nodeSize, t.pos + u, t.pos + o.nodeSize - u, new l(i, s.length, 0), 0, !0)).scrollIntoView());
|
|
3745
3745
|
}
|
|
3746
3746
|
return !0;
|
|
3747
3747
|
}
|
|
3748
3748
|
}
|
|
3749
3749
|
return !1;
|
|
3750
3750
|
}
|
|
3751
|
-
function
|
|
3751
|
+
function or(e) {
|
|
3752
3752
|
return function(t, n) {
|
|
3753
3753
|
let r = t.selection, i = e < 0 ? r.$from : r.$to, a = i.depth;
|
|
3754
3754
|
for (; i.node(a).isInline;) {
|
|
3755
3755
|
if (!a) return !1;
|
|
3756
3756
|
a--;
|
|
3757
3757
|
}
|
|
3758
|
-
return i.node(a).isTextblock ? (n && n(t.tr.setSelection(
|
|
3758
|
+
return i.node(a).isTextblock ? (n && n(t.tr.setSelection(O.create(t.doc, e < 0 ? i.start(a) : i.end(a)))), !0) : !1;
|
|
3759
3759
|
};
|
|
3760
3760
|
}
|
|
3761
|
-
var
|
|
3762
|
-
function
|
|
3761
|
+
var sr = or(-1), cr = or(1);
|
|
3762
|
+
function lr(e, t = null) {
|
|
3763
3763
|
return function(n, r) {
|
|
3764
|
-
let { $from: i, $to: a } = n.selection, o = i.blockRange(a), s = o &&
|
|
3764
|
+
let { $from: i, $to: a } = n.selection, o = i.blockRange(a), s = o && Dt(o, e, t);
|
|
3765
3765
|
return s ? (r && r(n.tr.wrap(o, s).scrollIntoView()), !0) : !1;
|
|
3766
3766
|
};
|
|
3767
3767
|
}
|
|
3768
|
-
function
|
|
3768
|
+
function ur(e, t = null) {
|
|
3769
3769
|
return function(n, r) {
|
|
3770
3770
|
let i = !1;
|
|
3771
3771
|
for (let r = 0; r < n.selection.ranges.length && !i; r++) {
|
|
@@ -3791,79 +3791,79 @@ function lr(e, t = null) {
|
|
|
3791
3791
|
return !0;
|
|
3792
3792
|
};
|
|
3793
3793
|
}
|
|
3794
|
-
function
|
|
3794
|
+
function dr(...e) {
|
|
3795
3795
|
return function(t, n, r) {
|
|
3796
3796
|
for (let i = 0; i < e.length; i++) if (e[i](t, n, r)) return !0;
|
|
3797
3797
|
return !1;
|
|
3798
3798
|
};
|
|
3799
3799
|
}
|
|
3800
|
-
var
|
|
3801
|
-
Enter:
|
|
3802
|
-
"Mod-Enter":
|
|
3803
|
-
Backspace:
|
|
3804
|
-
"Mod-Backspace":
|
|
3805
|
-
"Shift-Backspace":
|
|
3806
|
-
Delete:
|
|
3807
|
-
"Mod-Delete":
|
|
3808
|
-
"Mod-a":
|
|
3809
|
-
},
|
|
3810
|
-
"Ctrl-h":
|
|
3811
|
-
"Alt-Backspace":
|
|
3812
|
-
"Ctrl-d":
|
|
3813
|
-
"Ctrl-Alt-Backspace":
|
|
3814
|
-
"Alt-Delete":
|
|
3815
|
-
"Alt-d":
|
|
3816
|
-
"Ctrl-a":
|
|
3817
|
-
"Ctrl-e":
|
|
3800
|
+
var fr = dr(Nn, Fn, Bn), pr = dr(Nn, Un, Wn), mr = {
|
|
3801
|
+
Enter: dr(Yn, Qn, $n, tr),
|
|
3802
|
+
"Mod-Enter": Zn,
|
|
3803
|
+
Backspace: fr,
|
|
3804
|
+
"Mod-Backspace": fr,
|
|
3805
|
+
"Shift-Backspace": fr,
|
|
3806
|
+
Delete: pr,
|
|
3807
|
+
"Mod-Delete": pr,
|
|
3808
|
+
"Mod-a": rr
|
|
3809
|
+
}, hr = {
|
|
3810
|
+
"Ctrl-h": mr.Backspace,
|
|
3811
|
+
"Alt-Backspace": mr["Mod-Backspace"],
|
|
3812
|
+
"Ctrl-d": mr.Delete,
|
|
3813
|
+
"Ctrl-Alt-Backspace": mr["Mod-Delete"],
|
|
3814
|
+
"Alt-Delete": mr["Mod-Delete"],
|
|
3815
|
+
"Alt-d": mr["Mod-Delete"],
|
|
3816
|
+
"Ctrl-a": sr,
|
|
3817
|
+
"Ctrl-e": cr
|
|
3818
3818
|
};
|
|
3819
|
-
for (let e in
|
|
3819
|
+
for (let e in mr) hr[e] = mr[e];
|
|
3820
3820
|
typeof navigator < "u" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : typeof os < "u" && os.platform && os.platform();
|
|
3821
3821
|
//#endregion
|
|
3822
3822
|
//#region ../../node_modules/.pnpm/prosemirror-schema-list@1.5.1/node_modules/prosemirror-schema-list/dist/index.js
|
|
3823
|
-
function
|
|
3823
|
+
function gr(e, t = null) {
|
|
3824
3824
|
return function(n, r) {
|
|
3825
3825
|
let { $from: i, $to: a } = n.selection, o = i.blockRange(a);
|
|
3826
3826
|
if (!o) return !1;
|
|
3827
3827
|
let s = r ? n.tr : null;
|
|
3828
|
-
return
|
|
3828
|
+
return _r(s, o, e, t) ? (r && r(s.scrollIntoView()), !0) : !1;
|
|
3829
3829
|
};
|
|
3830
3830
|
}
|
|
3831
|
-
function
|
|
3831
|
+
function _r(e, t, n, r = null) {
|
|
3832
3832
|
let i = !1, a = t, o = t.$from.doc;
|
|
3833
3833
|
if (t.depth >= 2 && t.$from.node(t.depth - 1).type.compatibleContent(n) && t.startIndex == 0) {
|
|
3834
3834
|
if (t.$from.index(t.depth - 1) == 0) return !1;
|
|
3835
3835
|
let e = o.resolve(t.start - 2);
|
|
3836
|
-
a = new
|
|
3836
|
+
a = new ae(e, e, t.depth), t.endIndex < t.parent.childCount && (t = new ae(t.$from, o.resolve(t.$to.end(t.depth)), t.depth)), i = !0;
|
|
3837
3837
|
}
|
|
3838
|
-
let s =
|
|
3839
|
-
return s ? (e &&
|
|
3838
|
+
let s = Dt(a, n, r, t);
|
|
3839
|
+
return s ? (e && vr(e, t, s, i, n), !0) : !1;
|
|
3840
3840
|
}
|
|
3841
|
-
function
|
|
3841
|
+
function vr(e, t, n, i, a) {
|
|
3842
3842
|
let o = r.empty;
|
|
3843
3843
|
for (let e = n.length - 1; e >= 0; e--) o = r.from(n[e].type.create(n[e].attrs, o));
|
|
3844
|
-
e.step(new
|
|
3844
|
+
e.step(new T(t.start - (i ? 2 : 0), t.end, t.start, t.end, new l(o, 0, 0), n.length, !0));
|
|
3845
3845
|
let s = 0;
|
|
3846
3846
|
for (let e = 0; e < n.length; e++) n[e].type == a && (s = e + 1);
|
|
3847
3847
|
let c = n.length - s, u = t.start + n.length - (i ? 2 : 0), d = t.parent;
|
|
3848
|
-
for (let n = t.startIndex, r = t.endIndex, i = !0; n < r; n++, i = !1) !i &&
|
|
3848
|
+
for (let n = t.startIndex, r = t.endIndex, i = !0; n < r; n++, i = !1) !i && E(e.doc, u, c) && (e.split(u, c), u += 2 * c), u += d.child(n).nodeSize;
|
|
3849
3849
|
return e;
|
|
3850
3850
|
}
|
|
3851
|
-
function
|
|
3851
|
+
function yr(e) {
|
|
3852
3852
|
return function(t, n) {
|
|
3853
3853
|
let { $from: r, $to: i } = t.selection, a = r.blockRange(i, (t) => t.childCount > 0 && t.firstChild.type == e);
|
|
3854
|
-
return a ? n ? r.node(a.depth - 1).type == e ?
|
|
3854
|
+
return a ? n ? r.node(a.depth - 1).type == e ? br(t, n, e, a) : xr(t, n, a) : !0 : !1;
|
|
3855
3855
|
};
|
|
3856
3856
|
}
|
|
3857
|
-
function
|
|
3857
|
+
function br(e, t, n, i) {
|
|
3858
3858
|
let a = e.tr, o = i.end, s = i.$to.end(i.depth);
|
|
3859
|
-
o < s && (a.step(new
|
|
3860
|
-
let c =
|
|
3859
|
+
o < s && (a.step(new T(o - 1, s, o, s, new l(r.from(n.create(null, i.parent.copy())), 1, 0), 1, !0)), i = new ae(a.doc.resolve(i.$from.pos), a.doc.resolve(s), i.depth));
|
|
3860
|
+
let c = Tt(i);
|
|
3861
3861
|
if (c == null) return !1;
|
|
3862
3862
|
a.lift(i, c);
|
|
3863
3863
|
let u = a.doc.resolve(a.mapping.map(o, -1) - 1);
|
|
3864
|
-
return
|
|
3864
|
+
return Rt(a.doc, u.pos) && u.nodeBefore.type == u.nodeAfter.type && a.join(u.pos), t(a.scrollIntoView()), !0;
|
|
3865
3865
|
}
|
|
3866
|
-
function
|
|
3866
|
+
function xr(e, t, n) {
|
|
3867
3867
|
let i = e.tr, a = n.parent;
|
|
3868
3868
|
for (let e = n.end, t = n.endIndex - 1, r = n.startIndex; t > r; t--) e -= a.child(t).nodeSize, i.delete(e - 1, e + 1);
|
|
3869
3869
|
let o = i.doc.resolve(n.start), s = o.nodeAfter;
|
|
@@ -3871,9 +3871,9 @@ function br(e, t, n) {
|
|
|
3871
3871
|
let c = n.startIndex == 0, u = n.endIndex == a.childCount, d = o.node(-1), f = o.index(-1);
|
|
3872
3872
|
if (!d.canReplace(f + +!c, f + 1, s.content.append(u ? r.empty : r.from(a)))) return !1;
|
|
3873
3873
|
let p = o.pos, m = p + s.nodeSize;
|
|
3874
|
-
return i.step(new
|
|
3874
|
+
return i.step(new T(p - +!!c, m + +!!u, p + 1, m - 1, new l((c ? r.empty : r.from(a.copy(r.empty))).append(u ? r.empty : r.from(a.copy(r.empty))), +!c, +!u), +!c)), t(i.scrollIntoView()), !0;
|
|
3875
3875
|
}
|
|
3876
|
-
function
|
|
3876
|
+
function Sr(e) {
|
|
3877
3877
|
return function(t, n) {
|
|
3878
3878
|
let { $from: i, $to: a } = t.selection, o = i.blockRange(a, (t) => t.childCount > 0 && t.firstChild.type == e);
|
|
3879
3879
|
if (!o) return !1;
|
|
@@ -3883,108 +3883,108 @@ function xr(e) {
|
|
|
3883
3883
|
if (u.type != e) return !1;
|
|
3884
3884
|
if (n) {
|
|
3885
3885
|
let i = u.lastChild && u.lastChild.type == c.type, a = r.from(i ? e.create() : null), s = new l(r.from(e.create(null, r.from(c.type.create(null, a)))), i ? 3 : 1, 0), d = o.start, f = o.end;
|
|
3886
|
-
n(t.tr.step(new
|
|
3886
|
+
n(t.tr.step(new T(d - (i ? 3 : 1), f, d, f, s, 1, !0)).scrollIntoView());
|
|
3887
3887
|
}
|
|
3888
3888
|
return !0;
|
|
3889
3889
|
};
|
|
3890
3890
|
}
|
|
3891
3891
|
//#endregion
|
|
3892
3892
|
//#region ../../node_modules/.pnpm/prosemirror-view@1.41.8/node_modules/prosemirror-view/dist/index.js
|
|
3893
|
-
var
|
|
3893
|
+
var M = function(e) {
|
|
3894
3894
|
for (var t = 0;; t++) if (e = e.previousSibling, !e) return t;
|
|
3895
|
-
},
|
|
3895
|
+
}, Cr = function(e) {
|
|
3896
3896
|
let t = e.assignedSlot || e.parentNode;
|
|
3897
3897
|
return t && t.nodeType == 11 ? t.host : t;
|
|
3898
|
-
},
|
|
3899
|
-
let r =
|
|
3898
|
+
}, wr = null, Tr = function(e, t, n) {
|
|
3899
|
+
let r = wr ||= document.createRange();
|
|
3900
3900
|
return r.setEnd(e, n ?? e.nodeValue.length), r.setStart(e, t || 0), r;
|
|
3901
|
-
},
|
|
3902
|
-
|
|
3903
|
-
},
|
|
3904
|
-
return n && (
|
|
3905
|
-
},
|
|
3906
|
-
function
|
|
3901
|
+
}, Er = function() {
|
|
3902
|
+
wr = null;
|
|
3903
|
+
}, Dr = function(e, t, n, r) {
|
|
3904
|
+
return n && (kr(e, t, n, r, -1) || kr(e, t, n, r, 1));
|
|
3905
|
+
}, Or = /^(img|br|input|textarea|hr)$/i;
|
|
3906
|
+
function kr(e, t, n, r, i) {
|
|
3907
3907
|
for (;;) {
|
|
3908
3908
|
if (e == n && t == r) return !0;
|
|
3909
|
-
if (t == (i < 0 ? 0 :
|
|
3909
|
+
if (t == (i < 0 ? 0 : N(e))) {
|
|
3910
3910
|
let n = e.parentNode;
|
|
3911
|
-
if (!n || n.nodeType != 1 ||
|
|
3912
|
-
t =
|
|
3911
|
+
if (!n || n.nodeType != 1 || Nr(e) || Or.test(e.nodeName) || e.contentEditable == "false") return !1;
|
|
3912
|
+
t = M(e) + (i < 0 ? 0 : 1), e = n;
|
|
3913
3913
|
} else if (e.nodeType == 1) {
|
|
3914
3914
|
let n = e.childNodes[t + (i < 0 ? -1 : 0)];
|
|
3915
3915
|
if (n.nodeType == 1 && n.contentEditable == "false") if (n.pmViewDesc?.ignoreForSelection) t += i;
|
|
3916
3916
|
else return !1;
|
|
3917
|
-
else e = n, t = i < 0 ?
|
|
3917
|
+
else e = n, t = i < 0 ? N(e) : 0;
|
|
3918
3918
|
} else return !1;
|
|
3919
3919
|
}
|
|
3920
3920
|
}
|
|
3921
|
-
function
|
|
3921
|
+
function N(e) {
|
|
3922
3922
|
return e.nodeType == 3 ? e.nodeValue.length : e.childNodes.length;
|
|
3923
3923
|
}
|
|
3924
|
-
function
|
|
3924
|
+
function Ar(e, t) {
|
|
3925
3925
|
for (;;) {
|
|
3926
3926
|
if (e.nodeType == 3 && t) return e;
|
|
3927
3927
|
if (e.nodeType == 1 && t > 0) {
|
|
3928
3928
|
if (e.contentEditable == "false") return null;
|
|
3929
|
-
e = e.childNodes[t - 1], t =
|
|
3930
|
-
} else if (e.parentNode && !
|
|
3929
|
+
e = e.childNodes[t - 1], t = N(e);
|
|
3930
|
+
} else if (e.parentNode && !Nr(e)) t = M(e), e = e.parentNode;
|
|
3931
3931
|
else return null;
|
|
3932
3932
|
}
|
|
3933
3933
|
}
|
|
3934
|
-
function
|
|
3934
|
+
function jr(e, t) {
|
|
3935
3935
|
for (;;) {
|
|
3936
3936
|
if (e.nodeType == 3 && t < e.nodeValue.length) return e;
|
|
3937
3937
|
if (e.nodeType == 1 && t < e.childNodes.length) {
|
|
3938
3938
|
if (e.contentEditable == "false") return null;
|
|
3939
3939
|
e = e.childNodes[t], t = 0;
|
|
3940
|
-
} else if (e.parentNode && !
|
|
3940
|
+
} else if (e.parentNode && !Nr(e)) t = M(e) + 1, e = e.parentNode;
|
|
3941
3941
|
else return null;
|
|
3942
3942
|
}
|
|
3943
3943
|
}
|
|
3944
|
-
function
|
|
3945
|
-
for (let r = t == 0, i = t ==
|
|
3944
|
+
function Mr(e, t, n) {
|
|
3945
|
+
for (let r = t == 0, i = t == N(e); r || i;) {
|
|
3946
3946
|
if (e == n) return !0;
|
|
3947
|
-
let t =
|
|
3947
|
+
let t = M(e);
|
|
3948
3948
|
if (e = e.parentNode, !e) return !1;
|
|
3949
|
-
r &&= t == 0, i &&= t ==
|
|
3949
|
+
r &&= t == 0, i &&= t == N(e);
|
|
3950
3950
|
}
|
|
3951
3951
|
}
|
|
3952
|
-
function
|
|
3952
|
+
function Nr(e) {
|
|
3953
3953
|
let t;
|
|
3954
3954
|
for (let n = e; n && !(t = n.pmViewDesc); n = n.parentNode);
|
|
3955
3955
|
return t && t.node && t.node.isBlock && (t.dom == e || t.contentDOM == e);
|
|
3956
3956
|
}
|
|
3957
|
-
var
|
|
3958
|
-
return e.focusNode &&
|
|
3957
|
+
var Pr = function(e) {
|
|
3958
|
+
return e.focusNode && Dr(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset);
|
|
3959
3959
|
};
|
|
3960
|
-
function
|
|
3960
|
+
function Fr(e, t) {
|
|
3961
3961
|
let n = document.createEvent("Event");
|
|
3962
3962
|
return n.initEvent("keydown", !0, !0), n.keyCode = e, n.key = n.code = t, n;
|
|
3963
3963
|
}
|
|
3964
|
-
function
|
|
3964
|
+
function Ir(e) {
|
|
3965
3965
|
let t = e.activeElement;
|
|
3966
3966
|
for (; t && t.shadowRoot;) t = t.shadowRoot.activeElement;
|
|
3967
3967
|
return t;
|
|
3968
3968
|
}
|
|
3969
|
-
function
|
|
3969
|
+
function Lr(e, t, n) {
|
|
3970
3970
|
if (e.caretPositionFromPoint) try {
|
|
3971
3971
|
let r = e.caretPositionFromPoint(t, n);
|
|
3972
3972
|
if (r) return {
|
|
3973
3973
|
node: r.offsetNode,
|
|
3974
|
-
offset: Math.min(
|
|
3974
|
+
offset: Math.min(N(r.offsetNode), r.offset)
|
|
3975
3975
|
};
|
|
3976
3976
|
} catch {}
|
|
3977
3977
|
if (e.caretRangeFromPoint) {
|
|
3978
3978
|
let r = e.caretRangeFromPoint(t, n);
|
|
3979
3979
|
if (r) return {
|
|
3980
3980
|
node: r.startContainer,
|
|
3981
|
-
offset: Math.min(
|
|
3981
|
+
offset: Math.min(N(r.startContainer), r.startOffset)
|
|
3982
3982
|
};
|
|
3983
3983
|
}
|
|
3984
3984
|
}
|
|
3985
|
-
var
|
|
3986
|
-
|
|
3987
|
-
var
|
|
3985
|
+
var P = typeof navigator < "u" ? navigator : null, Rr = typeof document < "u" ? document : null, zr = P && P.userAgent || "", Br = /Edge\/(\d+)/.exec(zr), Vr = /MSIE \d/.exec(zr), Hr = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(zr), F = !!(Vr || Hr || Br), Ur = Vr ? document.documentMode : Hr ? +Hr[1] : Br ? +Br[1] : 0, I = !F && /gecko\/(\d+)/i.test(zr);
|
|
3986
|
+
I && +(/Firefox\/(\d+)/.exec(zr) || [0, 0])[1];
|
|
3987
|
+
var Wr = !F && /Chrome\/(\d+)/.exec(zr), L = !!Wr, Gr = Wr ? +Wr[1] : 0, R = !F && !!P && /Apple Computer/.test(P.vendor), Kr = R && (/Mobile\/\w+/.test(zr) || !!P && P.maxTouchPoints > 2), z = Kr || (P ? /Mac/.test(P.platform) : !1), qr = P ? /Win/.test(P.platform) : !1, B = /Android \d/.test(zr), Jr = !!Rr && "webkitFontSmoothing" in Rr.documentElement.style, Yr = Jr ? +(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;
|
|
3988
3988
|
function Xr(e) {
|
|
3989
3989
|
let t = e.defaultView && e.defaultView.visualViewport;
|
|
3990
3990
|
return t ? {
|
|
@@ -4015,7 +4015,7 @@ function $r(e, t, n) {
|
|
|
4015
4015
|
let r = e.someProp("scrollThreshold") || 0, i = e.someProp("scrollMargin") || 5, a = e.dom.ownerDocument;
|
|
4016
4016
|
for (let o = n || e.dom; o;) {
|
|
4017
4017
|
if (o.nodeType != 1) {
|
|
4018
|
-
o =
|
|
4018
|
+
o = Cr(o);
|
|
4019
4019
|
continue;
|
|
4020
4020
|
}
|
|
4021
4021
|
let e = o, n = e == a.body, s = n ? Xr(a) : Qr(e), c = 0, l = 0;
|
|
@@ -4033,7 +4033,7 @@ function $r(e, t, n) {
|
|
|
4033
4033
|
}
|
|
4034
4034
|
let u = n ? "fixed" : getComputedStyle(o).position;
|
|
4035
4035
|
if (/^(fixed|sticky)$/.test(u)) break;
|
|
4036
|
-
o = u == "absolute" ? o.offsetParent :
|
|
4036
|
+
o = u == "absolute" ? o.offsetParent : Cr(o);
|
|
4037
4037
|
}
|
|
4038
4038
|
}
|
|
4039
4039
|
function ei(e) {
|
|
@@ -4059,7 +4059,7 @@ function ti(e) {
|
|
|
4059
4059
|
dom: r,
|
|
4060
4060
|
top: r.scrollTop,
|
|
4061
4061
|
left: r.scrollLeft
|
|
4062
|
-
}), e != n); r =
|
|
4062
|
+
}), e != n); r = Cr(r));
|
|
4063
4063
|
return t;
|
|
4064
4064
|
}
|
|
4065
4065
|
function ni({ refDOM: e, refTop: t, stack: n }) {
|
|
@@ -4086,7 +4086,7 @@ function oi(e, t) {
|
|
|
4086
4086
|
for (let u = e.firstChild, d = 0; u; u = u.nextSibling, d++) {
|
|
4087
4087
|
let e;
|
|
4088
4088
|
if (u.nodeType == 1) e = u.getClientRects();
|
|
4089
|
-
else if (u.nodeType == 3) e =
|
|
4089
|
+
else if (u.nodeType == 3) e = Tr(u).getClientRects();
|
|
4090
4090
|
else continue;
|
|
4091
4091
|
for (let f = 0; f < e.length; f++) {
|
|
4092
4092
|
let p = e[f];
|
|
@@ -4171,16 +4171,16 @@ function fi(e, t, n) {
|
|
|
4171
4171
|
return e;
|
|
4172
4172
|
}
|
|
4173
4173
|
function pi(e, t) {
|
|
4174
|
-
let n = e.dom.ownerDocument, r, i = 0, a =
|
|
4174
|
+
let n = e.dom.ownerDocument, r, i = 0, a = Lr(n, t.left, t.top);
|
|
4175
4175
|
a && ({node: r, offset: i} = a);
|
|
4176
4176
|
let o = (e.root.elementFromPoint ? e.root : n).elementFromPoint(t.left, t.top), s;
|
|
4177
4177
|
if (!o || !e.dom.contains(o.nodeType == 1 ? o : o.parentNode)) {
|
|
4178
4178
|
let n = e.dom.getBoundingClientRect();
|
|
4179
4179
|
if (!ci(t, n) || (o = fi(e.dom, t, n), !o)) return null;
|
|
4180
4180
|
}
|
|
4181
|
-
if (
|
|
4181
|
+
if (R) for (let e = o; r && e; e = Cr(e)) e.draggable && (r = void 0);
|
|
4182
4182
|
if (o = li(o, t), r) {
|
|
4183
|
-
if (
|
|
4183
|
+
if (I && r.nodeType == 1 && (i = Math.min(i, r.childNodes.length), i < r.childNodes.length)) {
|
|
4184
4184
|
let e = r.childNodes[i], n;
|
|
4185
4185
|
e.nodeName == "IMG" && (n = e.getBoundingClientRect()).right <= t.left && n.bottom > t.top && i++;
|
|
4186
4186
|
}
|
|
@@ -4207,43 +4207,43 @@ function hi(e, t) {
|
|
|
4207
4207
|
}
|
|
4208
4208
|
var gi = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
|
4209
4209
|
function _i(e, t, n) {
|
|
4210
|
-
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = Jr ||
|
|
4210
|
+
let { node: r, offset: i, atom: a } = e.docView.domFromPos(t, n < 0 ? -1 : 1), o = Jr || I;
|
|
4211
4211
|
if (r.nodeType == 3) if (o && (gi.test(r.nodeValue) || (n < 0 ? !i : i == r.nodeValue.length))) {
|
|
4212
|
-
let e = hi(
|
|
4213
|
-
if (
|
|
4214
|
-
let t = hi(
|
|
4212
|
+
let e = hi(Tr(r, i, i), n);
|
|
4213
|
+
if (I && i && /\s/.test(r.nodeValue[i - 1]) && i < r.nodeValue.length) {
|
|
4214
|
+
let t = hi(Tr(r, i - 1, i - 1), -1);
|
|
4215
4215
|
if (t.top == e.top) {
|
|
4216
|
-
let n = hi(
|
|
4216
|
+
let n = hi(Tr(r, i, i + 1), -1);
|
|
4217
4217
|
if (n.top != e.top) return vi(n, n.left < t.left);
|
|
4218
4218
|
}
|
|
4219
4219
|
}
|
|
4220
4220
|
return e;
|
|
4221
4221
|
} else {
|
|
4222
4222
|
let e = i, t = i, a = n < 0 ? 1 : -1;
|
|
4223
|
-
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, vi(hi(
|
|
4223
|
+
return n < 0 && !i ? (t++, a = -1) : n >= 0 && i == r.nodeValue.length ? (e--, a = 1) : n < 0 ? e-- : t++, vi(hi(Tr(r, e, t), a), a < 0);
|
|
4224
4224
|
}
|
|
4225
4225
|
if (!e.state.doc.resolve(t - (a || 0)).parent.inlineContent) {
|
|
4226
|
-
if (a == null && i && (n < 0 || i ==
|
|
4226
|
+
if (a == null && i && (n < 0 || i == N(r))) {
|
|
4227
4227
|
let e = r.childNodes[i - 1];
|
|
4228
4228
|
if (e.nodeType == 1) return yi(e.getBoundingClientRect(), !1);
|
|
4229
4229
|
}
|
|
4230
|
-
if (a == null && i <
|
|
4230
|
+
if (a == null && i < N(r)) {
|
|
4231
4231
|
let e = r.childNodes[i];
|
|
4232
4232
|
if (e.nodeType == 1) return yi(e.getBoundingClientRect(), !0);
|
|
4233
4233
|
}
|
|
4234
4234
|
return yi(r.getBoundingClientRect(), n >= 0);
|
|
4235
4235
|
}
|
|
4236
|
-
if (a == null && i && (n < 0 || i ==
|
|
4237
|
-
let e = r.childNodes[i - 1], t = e.nodeType == 3 ?
|
|
4236
|
+
if (a == null && i && (n < 0 || i == N(r))) {
|
|
4237
|
+
let e = r.childNodes[i - 1], t = e.nodeType == 3 ? Tr(e, N(e) - +!o) : e.nodeType == 1 && (e.nodeName != "BR" || !e.nextSibling) ? e : null;
|
|
4238
4238
|
if (t) return vi(hi(t, 1), !1);
|
|
4239
4239
|
}
|
|
4240
|
-
if (a == null && i <
|
|
4240
|
+
if (a == null && i < N(r)) {
|
|
4241
4241
|
let e = r.childNodes[i];
|
|
4242
4242
|
for (; e.pmViewDesc && e.pmViewDesc.ignoreForCoords;) e = e.nextSibling;
|
|
4243
|
-
let t = e ? e.nodeType == 3 ?
|
|
4243
|
+
let t = e ? e.nodeType == 3 ? Tr(e, 0, +!o) : e.nodeType == 1 ? e : null : null;
|
|
4244
4244
|
if (t) return vi(hi(t, -1), !0);
|
|
4245
4245
|
}
|
|
4246
|
-
return vi(hi(r.nodeType == 3 ?
|
|
4246
|
+
return vi(hi(r.nodeType == 3 ? Tr(r) : r, -n), n >= 0);
|
|
4247
4247
|
}
|
|
4248
4248
|
function vi(e, t) {
|
|
4249
4249
|
if (e.width == 0) return e;
|
|
@@ -4291,7 +4291,7 @@ function xi(e, t, n) {
|
|
|
4291
4291
|
for (let e = t.firstChild; e; e = e.nextSibling) {
|
|
4292
4292
|
let t;
|
|
4293
4293
|
if (e.nodeType == 1) t = e.getClientRects();
|
|
4294
|
-
else if (e.nodeType == 3) t =
|
|
4294
|
+
else if (e.nodeType == 3) t = Tr(e, 0, e.nodeValue.length).getClientRects();
|
|
4295
4295
|
else continue;
|
|
4296
4296
|
for (let e = 0; e < t.length; e++) {
|
|
4297
4297
|
let i = t[e];
|
|
@@ -4394,7 +4394,7 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4394
4394
|
return n ? this.posBeforeChild(r) : this.posAtEnd;
|
|
4395
4395
|
}
|
|
4396
4396
|
let r;
|
|
4397
|
-
if (e == this.dom && this.contentDOM) r = t >
|
|
4397
|
+
if (e == this.dom && this.contentDOM) r = t > M(this.contentDOM);
|
|
4398
4398
|
else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) r = e.compareDocumentPosition(this.contentDOM) & 2;
|
|
4399
4399
|
else if (this.dom.firstChild) {
|
|
4400
4400
|
if (t == 0) for (let t = e;; t = t.parentNode) {
|
|
@@ -4471,14 +4471,14 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4471
4471
|
for (; e = n ? this.children[n - 1] : null, !(!e || e.dom.parentNode == this.contentDOM); n--, r = !1);
|
|
4472
4472
|
return e && t && r && !e.border && !e.domAtom ? e.domFromPos(e.size, t) : {
|
|
4473
4473
|
node: this.contentDOM,
|
|
4474
|
-
offset: e ?
|
|
4474
|
+
offset: e ? M(e.dom) + 1 : 0
|
|
4475
4475
|
};
|
|
4476
4476
|
} else {
|
|
4477
4477
|
let e, r = !0;
|
|
4478
4478
|
for (; e = n < this.children.length ? this.children[n] : null, !(!e || e.dom.parentNode == this.contentDOM); n++, r = !1);
|
|
4479
4479
|
return e && r && !e.border && !e.domAtom ? e.domFromPos(0, t) : {
|
|
4480
4480
|
node: this.contentDOM,
|
|
4481
|
-
offset: e ?
|
|
4481
|
+
offset: e ? M(e.dom) : this.contentDOM.childNodes.length
|
|
4482
4482
|
};
|
|
4483
4483
|
}
|
|
4484
4484
|
}
|
|
@@ -4500,7 +4500,7 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4500
4500
|
for (let t = o; t > 0; t--) {
|
|
4501
4501
|
let n = this.children[t - 1];
|
|
4502
4502
|
if (n.size && n.dom.parentNode == this.contentDOM && !n.emptyChildAt(1)) {
|
|
4503
|
-
r =
|
|
4503
|
+
r = M(n.dom) + 1;
|
|
4504
4504
|
break;
|
|
4505
4505
|
}
|
|
4506
4506
|
e -= n.size;
|
|
@@ -4512,7 +4512,7 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4512
4512
|
for (let e = o + 1; e < this.children.length; e++) {
|
|
4513
4513
|
let n = this.children[e];
|
|
4514
4514
|
if (n.size && n.dom.parentNode == this.contentDOM && !n.emptyChildAt(-1)) {
|
|
4515
|
-
i =
|
|
4515
|
+
i = M(n.dom);
|
|
4516
4516
|
break;
|
|
4517
4517
|
}
|
|
4518
4518
|
t += n.size;
|
|
@@ -4548,14 +4548,14 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4548
4548
|
s = l;
|
|
4549
4549
|
}
|
|
4550
4550
|
let o = this.domFromPos(e, e ? -1 : 1), s = t == e ? o : this.domFromPos(t, t ? -1 : 1), c = n.root.getSelection(), l = n.domSelectionRange(), u = !1;
|
|
4551
|
-
if ((
|
|
4551
|
+
if ((I || R) && e == t) {
|
|
4552
4552
|
let { node: e, offset: t } = o;
|
|
4553
4553
|
if (e.nodeType == 3) {
|
|
4554
4554
|
if (u = !!(t && e.nodeValue[t - 1] == "\n"), u && t == e.nodeValue.length) for (let t = e, n; t; t = t.parentNode) {
|
|
4555
4555
|
if (n = t.nextSibling) {
|
|
4556
4556
|
n.nodeName == "BR" && (o = s = {
|
|
4557
4557
|
node: n.parentNode,
|
|
4558
|
-
offset:
|
|
4558
|
+
offset: M(n) + 1
|
|
4559
4559
|
});
|
|
4560
4560
|
break;
|
|
4561
4561
|
}
|
|
@@ -4567,13 +4567,13 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4567
4567
|
u = n && (n.nodeName == "BR" || n.contentEditable == "false");
|
|
4568
4568
|
}
|
|
4569
4569
|
}
|
|
4570
|
-
if (
|
|
4570
|
+
if (I && l.focusNode && l.focusNode != s.node && l.focusNode.nodeType == 1) {
|
|
4571
4571
|
let e = l.focusNode.childNodes[l.focusOffset];
|
|
4572
4572
|
e && e.contentEditable == "false" && (r = !0);
|
|
4573
4573
|
}
|
|
4574
|
-
if (!(r || u &&
|
|
4574
|
+
if (!(r || u && R) && Dr(o.node, o.offset, l.anchorNode, l.anchorOffset) && Dr(s.node, s.offset, l.focusNode, l.focusOffset)) return;
|
|
4575
4575
|
let d = !1;
|
|
4576
|
-
if ((c.extend || e == t) && !(u &&
|
|
4576
|
+
if ((c.extend || e == t) && !(u && I)) {
|
|
4577
4577
|
c.collapse(o.node, o.offset);
|
|
4578
4578
|
try {
|
|
4579
4579
|
e != t && c.extend(s.node, s.offset), d = !0;
|
|
@@ -4692,7 +4692,7 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4692
4692
|
}
|
|
4693
4693
|
static create(t, n, r, i) {
|
|
4694
4694
|
let a = i.nodeViews[n.type.name], o = a && a(n, i, r);
|
|
4695
|
-
return (!o || !o.dom) && (o =
|
|
4695
|
+
return (!o || !o.dom) && (o = Ye.renderSpec(document, n.type.spec.toDOM(n, r), null, n.attrs)), new e(t, n, o.dom, o.contentDOM || o.dom, o);
|
|
4696
4696
|
}
|
|
4697
4697
|
parseRule() {
|
|
4698
4698
|
return this.dirty & H || this.mark.type.spec.reparseInView ? null : {
|
|
@@ -4736,7 +4736,7 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4736
4736
|
if (!u) u = document.createTextNode(n.text);
|
|
4737
4737
|
else if (u.nodeType != 3) throw RangeError("Text must be rendered as a DOM text node");
|
|
4738
4738
|
} else if (!u) {
|
|
4739
|
-
let e =
|
|
4739
|
+
let e = Ye.renderSpec(document, n.type.spec.toDOM(n), null, n.attrs);
|
|
4740
4740
|
({dom: u, contentDOM: d} = e);
|
|
4741
4741
|
}
|
|
4742
4742
|
!d && !n.isText && u.nodeName != "BR" && (u.hasAttribute("contenteditable") || (u.contentEditable = "false"), n.type.spec.draggable && (u.draggable = !0));
|
|
@@ -4780,11 +4780,11 @@ var V = 0, Oi = 1, ki = 2, H = 3, Ai = class {
|
|
|
4780
4780
|
c.syncToMarks(t.marks, n, e, l);
|
|
4781
4781
|
let u;
|
|
4782
4782
|
c.findNodeMatch(t, a, s, l) || o && e.state.selection.from > r && e.state.selection.to < r + t.nodeSize && (u = c.findIndexWithChild(i.node)) > -1 && c.updateNodeAt(t, a, s, u, e) || c.updateNextNode(t, a, s, e, l, r) || c.addNode(t, a, s, e, r), r += t.nodeSize;
|
|
4783
|
-
}), c.syncToMarks([], n, e, 0), this.node.isTextblock && c.addTextblockHacks(), c.destroyRest(), (c.changed || this.dirty == ki) && (a && this.protectLocalComposition(e, a), zi(this.contentDOM, this.children, e),
|
|
4783
|
+
}), c.syncToMarks([], n, e, 0), this.node.isTextblock && c.addTextblockHacks(), c.destroyRest(), (c.changed || this.dirty == ki) && (a && this.protectLocalComposition(e, a), zi(this.contentDOM, this.children, e), Kr && Qi(this.dom));
|
|
4784
4784
|
}
|
|
4785
4785
|
localCompositionInfo(e, t) {
|
|
4786
4786
|
let { from: n, to: r } = e.state.selection;
|
|
4787
|
-
if (!(e.state.selection instanceof
|
|
4787
|
+
if (!(e.state.selection instanceof O) || n < t || r > t + this.node.content.size) return null;
|
|
4788
4788
|
let i = e.input.compositionNode;
|
|
4789
4789
|
if (!i || !this.dom.contains(i.parentNode)) return null;
|
|
4790
4790
|
if (this.node.inlineContent) {
|
|
@@ -5105,7 +5105,7 @@ var Ji = class {
|
|
|
5105
5105
|
addTextblockHacks() {
|
|
5106
5106
|
let e = this.top.children[this.index - 1], t = this.top;
|
|
5107
5107
|
for (; e instanceof Ni;) t = e, e = t.children[t.children.length - 1];
|
|
5108
|
-
(!e || !(e instanceof Ii) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((
|
|
5108
|
+
(!e || !(e instanceof Ii) || /\n$/.test(e.node.text) || this.view.requiresGeckoHackNode && /\s$/.test(e.node.text)) && ((R || L) && e && e.dom.contentEditable == "false" && this.addHackNode("IMG", t), this.addHackNode("BR", this.top));
|
|
5109
5109
|
}
|
|
5110
5110
|
addHackNode(e, t) {
|
|
5111
5111
|
if (t == this.top && this.index < t.children.length && t.children[this.index].matchesHack(e)) this.index++;
|
|
@@ -5224,12 +5224,12 @@ function ta(e, t = null) {
|
|
|
5224
5224
|
let i = e.docView.nearestDesc(n.focusNode), a = i && i.size == 0, o = e.docView.posFromDOM(n.focusNode, n.focusOffset, 1);
|
|
5225
5225
|
if (o < 0) return null;
|
|
5226
5226
|
let s = r.resolve(o), c, l;
|
|
5227
|
-
if (
|
|
5227
|
+
if (Pr(n)) {
|
|
5228
5228
|
for (c = o; i && !i.node;) i = i.parent;
|
|
5229
5229
|
let e = i.node;
|
|
5230
|
-
if (i && e.isAtom &&
|
|
5230
|
+
if (i && e.isAtom && k.isSelectable(e) && i.parent && !(e.isInline && Mr(n.focusNode, n.focusOffset, i.dom))) {
|
|
5231
5231
|
let e = i.posBefore;
|
|
5232
|
-
l = new
|
|
5232
|
+
l = new k(o == e ? s : r.resolve(e));
|
|
5233
5233
|
}
|
|
5234
5234
|
} else {
|
|
5235
5235
|
if (n instanceof e.dom.ownerDocument.defaultView.Selection && n.rangeCount > 1) {
|
|
@@ -5256,9 +5256,9 @@ function na(e) {
|
|
|
5256
5256
|
function ra(e, t = !1) {
|
|
5257
5257
|
let n = e.state.selection;
|
|
5258
5258
|
if (ua(e, n), na(e)) {
|
|
5259
|
-
if (!t && e.input.mouseDown && e.input.mouseDown.allowDefault &&
|
|
5259
|
+
if (!t && e.input.mouseDown && e.input.mouseDown.allowDefault && L) {
|
|
5260
5260
|
let t = e.domSelectionRange(), n = e.domObserver.currentSelection;
|
|
5261
|
-
if (t.anchorNode && n.anchorNode &&
|
|
5261
|
+
if (t.anchorNode && n.anchorNode && Dr(t.anchorNode, t.anchorOffset, n.anchorNode, n.anchorOffset)) {
|
|
5262
5262
|
e.input.mouseDown.delayedSelectionSync = !0, e.domObserver.setCurSelection();
|
|
5263
5263
|
return;
|
|
5264
5264
|
}
|
|
@@ -5266,22 +5266,22 @@ function ra(e, t = !1) {
|
|
|
5266
5266
|
if (e.domObserver.disconnectSelection(), e.cursorWrapper) la(e);
|
|
5267
5267
|
else {
|
|
5268
5268
|
let { anchor: r, head: i } = n, a, o;
|
|
5269
|
-
ia && !(n instanceof
|
|
5269
|
+
ia && !(n instanceof O) && (n.$from.parent.inlineContent || (a = aa(e, n.from)), !n.empty && !n.$from.parent.inlineContent && (o = aa(e, n.to))), e.docView.setSelection(r, i, e, t), ia && (a && sa(a), o && sa(o)), n.visible ? e.dom.classList.remove("ProseMirror-hideselection") : (e.dom.classList.add("ProseMirror-hideselection"), "onselectionchange" in document && ca(e));
|
|
5270
5270
|
}
|
|
5271
5271
|
e.domObserver.setCurSelection(), e.domObserver.connectSelection();
|
|
5272
5272
|
}
|
|
5273
5273
|
}
|
|
5274
|
-
var ia =
|
|
5274
|
+
var ia = R || L && Gr < 63;
|
|
5275
5275
|
function aa(e, t) {
|
|
5276
5276
|
let { node: n, offset: r } = e.docView.domFromPos(t, 0), i = r < n.childNodes.length ? n.childNodes[r] : null, a = r ? n.childNodes[r - 1] : null;
|
|
5277
|
-
if (
|
|
5277
|
+
if (R && i && i.contentEditable == "false") return oa(i);
|
|
5278
5278
|
if ((!i || i.contentEditable == "false") && (!a || a.contentEditable == "false")) {
|
|
5279
5279
|
if (i) return oa(i);
|
|
5280
5280
|
if (a) return oa(a);
|
|
5281
5281
|
}
|
|
5282
5282
|
}
|
|
5283
5283
|
function oa(e) {
|
|
5284
|
-
return e.contentEditable = "true",
|
|
5284
|
+
return e.contentEditable = "true", R && e.draggable && (e.draggable = !1, e.wasDraggable = !0), e;
|
|
5285
5285
|
}
|
|
5286
5286
|
function sa(e) {
|
|
5287
5287
|
e.contentEditable = "false", e.wasDraggable &&= (e.draggable = !0, null);
|
|
@@ -5300,10 +5300,10 @@ function la(e) {
|
|
|
5300
5300
|
let t = e.domSelection();
|
|
5301
5301
|
if (!t) return;
|
|
5302
5302
|
let n = e.cursorWrapper.dom, r = n.nodeName == "IMG";
|
|
5303
|
-
r ? t.collapse(n.parentNode,
|
|
5303
|
+
r ? t.collapse(n.parentNode, M(n) + 1) : t.collapse(n, 0), !r && !e.state.selection.visible && F && Ur <= 11 && (n.disabled = !0, n.disabled = !1);
|
|
5304
5304
|
}
|
|
5305
5305
|
function ua(e, t) {
|
|
5306
|
-
if (t instanceof
|
|
5306
|
+
if (t instanceof k) {
|
|
5307
5307
|
let n = e.docView.descAt(t.from);
|
|
5308
5308
|
n != e.lastSelectedViewDesc && (da(e), n && n.selectNode(), e.lastSelectedViewDesc = n);
|
|
5309
5309
|
} else da(e);
|
|
@@ -5312,7 +5312,7 @@ function da(e) {
|
|
|
5312
5312
|
e.lastSelectedViewDesc &&= (e.lastSelectedViewDesc.parent && e.lastSelectedViewDesc.deselectNode(), void 0);
|
|
5313
5313
|
}
|
|
5314
5314
|
function fa(e, t, n, r) {
|
|
5315
|
-
return e.someProp("createSelectionBetween", (r) => r(e, t, n)) ||
|
|
5315
|
+
return e.someProp("createSelectionBetween", (r) => r(e, t, n)) || O.between(t, n, r);
|
|
5316
5316
|
}
|
|
5317
5317
|
function pa(e) {
|
|
5318
5318
|
return e.editable && !e.hasFocus() ? !1 : ma(e);
|
|
@@ -5328,34 +5328,34 @@ function ma(e) {
|
|
|
5328
5328
|
}
|
|
5329
5329
|
function ha(e) {
|
|
5330
5330
|
let t = e.docView.domFromPos(e.state.selection.anchor, 0), n = e.domSelectionRange();
|
|
5331
|
-
return
|
|
5331
|
+
return Dr(t.node, t.offset, n.anchorNode, n.anchorOffset);
|
|
5332
5332
|
}
|
|
5333
5333
|
function ga(e, t) {
|
|
5334
5334
|
let { $anchor: n, $head: r } = e.selection, i = t > 0 ? n.max(r) : n.min(r), a = i.parent.inlineContent ? i.depth ? e.doc.resolve(t > 0 ? i.after() : i.before()) : null : i;
|
|
5335
|
-
return a &&
|
|
5335
|
+
return a && D.findFrom(a, t);
|
|
5336
5336
|
}
|
|
5337
5337
|
function _a(e, t) {
|
|
5338
5338
|
return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()), !0;
|
|
5339
5339
|
}
|
|
5340
5340
|
function va(e, t, n) {
|
|
5341
5341
|
let r = e.state.selection;
|
|
5342
|
-
if (r instanceof
|
|
5342
|
+
if (r instanceof O) {
|
|
5343
5343
|
if (n.indexOf("s") > -1) {
|
|
5344
5344
|
let { $head: n } = r, i = n.textOffset ? null : t < 0 ? n.nodeBefore : n.nodeAfter;
|
|
5345
5345
|
if (!i || i.isText || !i.isLeaf) return !1;
|
|
5346
5346
|
let a = e.state.doc.resolve(n.pos + i.nodeSize * (t < 0 ? -1 : 1));
|
|
5347
|
-
return _a(e, new
|
|
5347
|
+
return _a(e, new O(r.$anchor, a));
|
|
5348
5348
|
} else if (!r.empty) return !1;
|
|
5349
5349
|
else if (e.endOfTextblock(t > 0 ? "forward" : "backward")) {
|
|
5350
5350
|
let n = ga(e.state, t);
|
|
5351
|
-
return n && n instanceof
|
|
5352
|
-
} else if (!(
|
|
5351
|
+
return n && n instanceof k ? _a(e, n) : !1;
|
|
5352
|
+
} else if (!(z && n.indexOf("m") > -1)) {
|
|
5353
5353
|
let n = r.$head, i = n.textOffset ? null : t < 0 ? n.nodeBefore : n.nodeAfter, a;
|
|
5354
5354
|
if (!i || i.isText) return !1;
|
|
5355
5355
|
let o = t < 0 ? n.pos - i.nodeSize : n.pos;
|
|
5356
|
-
return i.isAtom || (a = e.docView.descAt(o)) && !a.contentDOM ?
|
|
5356
|
+
return i.isAtom || (a = e.docView.descAt(o)) && !a.contentDOM ? k.isSelectable(i) ? _a(e, new k(t < 0 ? e.state.doc.resolve(n.pos - i.nodeSize) : n)) : Jr ? _a(e, new O(e.state.doc.resolve(t < 0 ? o : o + i.nodeSize))) : !1 : !1;
|
|
5357
5357
|
}
|
|
5358
|
-
} else if (r instanceof
|
|
5358
|
+
} else if (r instanceof k && r.node.isInline) return _a(e, new O(t > 0 ? r.$to : r.$from));
|
|
5359
5359
|
else {
|
|
5360
5360
|
let n = ga(e.state, t);
|
|
5361
5361
|
return n ? _a(e, n) : !1;
|
|
@@ -5375,7 +5375,7 @@ function Sa(e) {
|
|
|
5375
5375
|
let t = e.domSelectionRange(), n = t.focusNode, r = t.focusOffset;
|
|
5376
5376
|
if (!n) return;
|
|
5377
5377
|
let i, a, o = !1;
|
|
5378
|
-
for (
|
|
5378
|
+
for (I && n.nodeType == 1 && r < ya(n) && ba(n.childNodes[r], -1) && (o = !0);;) if (r > 0) {
|
|
5379
5379
|
if (n.nodeType != 1) break;
|
|
5380
5380
|
{
|
|
5381
5381
|
let e = n.childNodes[r - 1];
|
|
@@ -5386,7 +5386,7 @@ function Sa(e) {
|
|
|
5386
5386
|
} else if (wa(n)) break;
|
|
5387
5387
|
else {
|
|
5388
5388
|
let t = n.previousSibling;
|
|
5389
|
-
for (; t && ba(t, -1);) i = n.parentNode, a =
|
|
5389
|
+
for (; t && ba(t, -1);) i = n.parentNode, a = M(t), t = t.previousSibling;
|
|
5390
5390
|
if (t) n = t, r = ya(n);
|
|
5391
5391
|
else {
|
|
5392
5392
|
if (n = n.parentNode, n == e.dom) break;
|
|
@@ -5407,7 +5407,7 @@ function Ca(e) {
|
|
|
5407
5407
|
} else if (wa(n)) break;
|
|
5408
5408
|
else {
|
|
5409
5409
|
let t = n.nextSibling;
|
|
5410
|
-
for (; t && ba(t, 1);) a = t.parentNode, o =
|
|
5410
|
+
for (; t && ba(t, 1);) a = t.parentNode, o = M(t) + 1, t = t.nextSibling;
|
|
5411
5411
|
if (t) n = t, r = 0, i = ya(n);
|
|
5412
5412
|
else {
|
|
5413
5413
|
if (n = n.parentNode, n == e.dom) break;
|
|
@@ -5421,7 +5421,7 @@ function wa(e) {
|
|
|
5421
5421
|
return t && t.node && t.node.isBlock;
|
|
5422
5422
|
}
|
|
5423
5423
|
function Ta(e, t) {
|
|
5424
|
-
for (; e && t == e.childNodes.length && !
|
|
5424
|
+
for (; e && t == e.childNodes.length && !Nr(e);) t = M(e) + 1, e = e.parentNode;
|
|
5425
5425
|
for (; e && t < e.childNodes.length;) {
|
|
5426
5426
|
let n = e.childNodes[t];
|
|
5427
5427
|
if (n.nodeType == 3) return n;
|
|
@@ -5430,7 +5430,7 @@ function Ta(e, t) {
|
|
|
5430
5430
|
}
|
|
5431
5431
|
}
|
|
5432
5432
|
function Ea(e, t) {
|
|
5433
|
-
for (; e && !t && !
|
|
5433
|
+
for (; e && !t && !Nr(e);) t = M(e), e = e.parentNode;
|
|
5434
5434
|
for (; e && t;) {
|
|
5435
5435
|
let n = e.childNodes[t - 1];
|
|
5436
5436
|
if (n.nodeType == 3) return n;
|
|
@@ -5445,7 +5445,7 @@ function Da(e, t, n) {
|
|
|
5445
5445
|
}
|
|
5446
5446
|
let r = e.domSelection();
|
|
5447
5447
|
if (!r) return;
|
|
5448
|
-
if (
|
|
5448
|
+
if (Pr(r)) {
|
|
5449
5449
|
let e = document.createRange();
|
|
5450
5450
|
e.setEnd(t, n), e.setStart(t, n), r.removeAllRanges(), r.addRange(e);
|
|
5451
5451
|
} else r.extend && r.extend(t, n);
|
|
@@ -5457,7 +5457,7 @@ function Da(e, t, n) {
|
|
|
5457
5457
|
}
|
|
5458
5458
|
function Oa(e, t) {
|
|
5459
5459
|
let n = e.state.doc.resolve(t);
|
|
5460
|
-
if (!(
|
|
5460
|
+
if (!(L || qr) && n.parent.inlineContent) {
|
|
5461
5461
|
let r = e.coordsAtPos(t);
|
|
5462
5462
|
if (t > n.start()) {
|
|
5463
5463
|
let n = e.coordsAtPos(t - 1), i = (n.top + n.bottom) / 2;
|
|
@@ -5472,20 +5472,20 @@ function Oa(e, t) {
|
|
|
5472
5472
|
}
|
|
5473
5473
|
function ka(e, t, n) {
|
|
5474
5474
|
let r = e.state.selection;
|
|
5475
|
-
if (r instanceof
|
|
5475
|
+
if (r instanceof O && !r.empty || n.indexOf("s") > -1 || z && n.indexOf("m") > -1) return !1;
|
|
5476
5476
|
let { $from: i, $to: a } = r;
|
|
5477
5477
|
if (!i.parent.inlineContent || e.endOfTextblock(t < 0 ? "up" : "down")) {
|
|
5478
5478
|
let n = ga(e.state, t);
|
|
5479
|
-
if (n && n instanceof
|
|
5479
|
+
if (n && n instanceof k) return _a(e, n);
|
|
5480
5480
|
}
|
|
5481
5481
|
if (!i.parent.inlineContent) {
|
|
5482
|
-
let n = t < 0 ? i : a, o = r instanceof
|
|
5482
|
+
let n = t < 0 ? i : a, o = r instanceof A ? D.near(n, t) : D.findFrom(n, t);
|
|
5483
5483
|
return o ? _a(e, o) : !1;
|
|
5484
5484
|
}
|
|
5485
5485
|
return !1;
|
|
5486
5486
|
}
|
|
5487
5487
|
function Aa(e, t) {
|
|
5488
|
-
if (!(e.state.selection instanceof
|
|
5488
|
+
if (!(e.state.selection instanceof O)) return !0;
|
|
5489
5489
|
let { $head: n, $anchor: r, empty: i } = e.state.selection;
|
|
5490
5490
|
if (!n.sameParent(r)) return !0;
|
|
5491
5491
|
if (!i) return !1;
|
|
@@ -5501,7 +5501,7 @@ function ja(e, t, n) {
|
|
|
5501
5501
|
e.domObserver.stop(), t.contentEditable = n, e.domObserver.start();
|
|
5502
5502
|
}
|
|
5503
5503
|
function Ma(e) {
|
|
5504
|
-
if (!
|
|
5504
|
+
if (!R || e.state.selection.$head.parentOffset > 0) return !1;
|
|
5505
5505
|
let { focusNode: t, focusOffset: n } = e.domSelectionRange();
|
|
5506
5506
|
if (t && t.nodeType == 1 && n == 0 && t.firstChild && t.firstChild.contentEditable == "false") {
|
|
5507
5507
|
let n = t.firstChild;
|
|
@@ -5515,18 +5515,18 @@ function Na(e) {
|
|
|
5515
5515
|
}
|
|
5516
5516
|
function Pa(e, t) {
|
|
5517
5517
|
let n = t.keyCode, r = Na(t);
|
|
5518
|
-
if (n == 8 ||
|
|
5519
|
-
if (n == 46 && !t.shiftKey ||
|
|
5518
|
+
if (n == 8 || z && n == 72 && r == "c") return Aa(e, -1) || xa(e, -1);
|
|
5519
|
+
if (n == 46 && !t.shiftKey || z && n == 68 && r == "c") return Aa(e, 1) || xa(e, 1);
|
|
5520
5520
|
if (n == 13 || n == 27) return !0;
|
|
5521
|
-
if (n == 37 ||
|
|
5521
|
+
if (n == 37 || z && n == 66 && r == "c") {
|
|
5522
5522
|
let t = n == 37 ? Oa(e, e.state.selection.from) == "ltr" ? -1 : 1 : -1;
|
|
5523
5523
|
return va(e, t, r) || xa(e, t);
|
|
5524
|
-
} else if (n == 39 ||
|
|
5524
|
+
} else if (n == 39 || z && n == 70 && r == "c") {
|
|
5525
5525
|
let t = n == 39 ? Oa(e, e.state.selection.from) == "ltr" ? 1 : -1 : 1;
|
|
5526
5526
|
return va(e, t, r) || xa(e, t);
|
|
5527
|
-
} else if (n == 38 ||
|
|
5528
|
-
else if (n == 40 ||
|
|
5529
|
-
else if (r == (
|
|
5527
|
+
} else if (n == 38 || z && n == 80 && r == "c") return ka(e, -1, r) || xa(e, -1);
|
|
5528
|
+
else if (n == 40 || z && n == 78 && r == "c") return Ma(e) || ka(e, 1, r) || xa(e, 1);
|
|
5529
|
+
else if (r == (z ? "m" : "c") && (n == 66 || n == 73 || n == 89 || n == 90)) return !0;
|
|
5530
5530
|
return !1;
|
|
5531
5531
|
}
|
|
5532
5532
|
function Fa(e, t) {
|
|
@@ -5539,7 +5539,7 @@ function Fa(e, t) {
|
|
|
5539
5539
|
let e = r.firstChild;
|
|
5540
5540
|
n.push(e.type.name, e.attrs == e.type.defaultAttrs ? null : e.attrs), r = e.content;
|
|
5541
5541
|
}
|
|
5542
|
-
let o = e.someProp("clipboardSerializer") ||
|
|
5542
|
+
let o = e.someProp("clipboardSerializer") || Ye.fromSchema(e.state.schema), s = Ka(), c = s.createElement("div");
|
|
5543
5543
|
c.appendChild(o.serializeFragment(r, { document: s }));
|
|
5544
5544
|
let l = c.firstChild, u, d = 0;
|
|
5545
5545
|
for (; l && l.nodeType == 1 && (u = Wa[l.nodeName.toLowerCase()]);) {
|
|
@@ -5569,7 +5569,7 @@ function Ia(e, t, n, i, a) {
|
|
|
5569
5569
|
let n = e.someProp("clipboardTextParser", (n) => n(t, a, i, e));
|
|
5570
5570
|
if (n) c = n;
|
|
5571
5571
|
else {
|
|
5572
|
-
let n = a.marks(), { schema: r } = e.state, i =
|
|
5572
|
+
let n = a.marks(), { schema: r } = e.state, i = Ye.fromSchema(r);
|
|
5573
5573
|
s = document.createElement("div"), t.split(/(?:\r\n?|\n)+/).forEach((e) => {
|
|
5574
5574
|
let t = s.appendChild(document.createElement("p"));
|
|
5575
5575
|
e && t.appendChild(i.serializeNode(r.text(e, n)));
|
|
@@ -5585,7 +5585,7 @@ function Ia(e, t, n, i, a) {
|
|
|
5585
5585
|
if (!e) break;
|
|
5586
5586
|
s = e;
|
|
5587
5587
|
}
|
|
5588
|
-
if (c ||= (e.someProp("clipboardParser") || e.someProp("domParser") ||
|
|
5588
|
+
if (c ||= (e.someProp("clipboardParser") || e.someProp("domParser") || Fe.fromSchema(e.state.schema)).parseSlice(s, {
|
|
5589
5589
|
preserveWhitespace: !!(u || f),
|
|
5590
5590
|
context: a,
|
|
5591
5591
|
ruleFromNode(e) {
|
|
@@ -5679,7 +5679,7 @@ function Ya(e) {
|
|
|
5679
5679
|
return n;
|
|
5680
5680
|
}
|
|
5681
5681
|
function Xa(e) {
|
|
5682
|
-
let t = e.querySelectorAll(
|
|
5682
|
+
let t = e.querySelectorAll(L ? "span:not([class]):not([style])" : "span.Apple-converted-space");
|
|
5683
5683
|
for (let n = 0; n < t.length; n++) {
|
|
5684
5684
|
let r = t[n];
|
|
5685
5685
|
r.childNodes.length == 1 && r.textContent == "\xA0" && r.parentNode && r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "), r);
|
|
@@ -5722,7 +5722,7 @@ function eo(e) {
|
|
|
5722
5722
|
ao(e, t) && !io(e, t) && (e.editable || !(t.type in W)) && n(e, t);
|
|
5723
5723
|
}, Qa[t] ? { passive: !0 } : void 0);
|
|
5724
5724
|
}
|
|
5725
|
-
|
|
5725
|
+
R && e.dom.addEventListener("input", () => null), ro(e);
|
|
5726
5726
|
}
|
|
5727
5727
|
function to(e, t) {
|
|
5728
5728
|
e.input.lastSelectionOrigin = t, e.input.lastSelectionTime = Date.now();
|
|
@@ -5754,23 +5754,23 @@ function oo(e, t) {
|
|
|
5754
5754
|
}
|
|
5755
5755
|
W.keydown = (e, t) => {
|
|
5756
5756
|
let n = t;
|
|
5757
|
-
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !xo(e, n) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !(
|
|
5757
|
+
if (e.input.shiftKey = n.keyCode == 16 || n.shiftKey, !xo(e, n) && (e.input.lastKeyCode = n.keyCode, e.input.lastKeyCodeTime = Date.now(), !(B && L && n.keyCode == 13))) if (n.keyCode != 229 && e.domObserver.forceFlush(), Kr && n.keyCode == 13 && !n.ctrlKey && !n.altKey && !n.metaKey) {
|
|
5758
5758
|
let t = Date.now();
|
|
5759
5759
|
e.input.lastIOSEnter = t, e.input.lastIOSEnterFallbackTimeout = setTimeout(() => {
|
|
5760
|
-
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t) => t(e,
|
|
5760
|
+
e.input.lastIOSEnter == t && (e.someProp("handleKeyDown", (t) => t(e, Fr(13, "Enter"))), e.input.lastIOSEnter = 0);
|
|
5761
5761
|
}, 200);
|
|
5762
5762
|
} else e.someProp("handleKeyDown", (t) => t(e, n)) || Pa(e, n) ? n.preventDefault() : to(e, "key");
|
|
5763
5763
|
}, W.keyup = (e, t) => {
|
|
5764
5764
|
t.keyCode == 16 && (e.input.shiftKey = !1);
|
|
5765
5765
|
}, W.keypress = (e, t) => {
|
|
5766
5766
|
let n = t;
|
|
5767
|
-
if (xo(e, n) || !n.charCode || n.ctrlKey && !n.altKey ||
|
|
5767
|
+
if (xo(e, n) || !n.charCode || n.ctrlKey && !n.altKey || z && n.metaKey) return;
|
|
5768
5768
|
if (e.someProp("handleKeyPress", (t) => t(e, n))) {
|
|
5769
5769
|
n.preventDefault();
|
|
5770
5770
|
return;
|
|
5771
5771
|
}
|
|
5772
5772
|
let r = e.state.selection;
|
|
5773
|
-
if (!(r instanceof
|
|
5773
|
+
if (!(r instanceof O) || !r.$from.sameParent(r.$to)) {
|
|
5774
5774
|
let t = String.fromCharCode(n.charCode), i = () => e.state.tr.insertText(t).scrollIntoView();
|
|
5775
5775
|
!/[\r\n]/.test(t) && !e.someProp("handleTextInput", (n) => n(e, r.$from.pos, r.$to.pos, t, i)) && e.dispatch(i()), n.preventDefault();
|
|
5776
5776
|
}
|
|
@@ -5799,21 +5799,21 @@ function uo(e, t, n) {
|
|
|
5799
5799
|
function fo(e, t) {
|
|
5800
5800
|
if (t == -1) return !1;
|
|
5801
5801
|
let n = e.state.doc.resolve(t), r = n.nodeAfter;
|
|
5802
|
-
return r && r.isAtom &&
|
|
5802
|
+
return r && r.isAtom && k.isSelectable(r) ? (uo(e, new k(n), "pointer"), !0) : !1;
|
|
5803
5803
|
}
|
|
5804
5804
|
function po(e, t) {
|
|
5805
5805
|
if (t == -1) return !1;
|
|
5806
5806
|
let n = e.state.selection, r, i;
|
|
5807
|
-
n instanceof
|
|
5807
|
+
n instanceof k && (r = n.node);
|
|
5808
5808
|
let a = e.state.doc.resolve(t);
|
|
5809
5809
|
for (let e = a.depth + 1; e > 0; e--) {
|
|
5810
5810
|
let t = e > a.depth ? a.nodeAfter : a.node(e);
|
|
5811
|
-
if (
|
|
5811
|
+
if (k.isSelectable(t)) {
|
|
5812
5812
|
i = r && n.$from.depth > 0 && e >= n.$from.depth && a.before(n.$from.depth + 1) == n.$from.pos ? a.before(n.$from.depth) : a.before(e);
|
|
5813
5813
|
break;
|
|
5814
5814
|
}
|
|
5815
5815
|
}
|
|
5816
|
-
return i == null ? !1 : (uo(e,
|
|
5816
|
+
return i == null ? !1 : (uo(e, k.create(e.state.doc, i), "pointer"), !0);
|
|
5817
5817
|
}
|
|
5818
5818
|
function mo(e, t, n, r, i) {
|
|
5819
5819
|
return lo(e, "handleClickOn", t, n, r) || e.someProp("handleClick", (n) => n(e, t, r)) || (i ? po(e, n) : fo(e, n));
|
|
@@ -5827,12 +5827,12 @@ function go(e, t, n, r) {
|
|
|
5827
5827
|
function _o(e, t, n) {
|
|
5828
5828
|
if (n.button != 0) return !1;
|
|
5829
5829
|
let r = e.state.doc;
|
|
5830
|
-
if (t == -1) return r.inlineContent ? (uo(e,
|
|
5830
|
+
if (t == -1) return r.inlineContent ? (uo(e, O.create(r, 0, r.content.size), "pointer"), !0) : !1;
|
|
5831
5831
|
let i = r.resolve(t);
|
|
5832
5832
|
for (let t = i.depth + 1; t > 0; t--) {
|
|
5833
5833
|
let n = t > i.depth ? i.nodeAfter : i.node(t), a = i.before(t);
|
|
5834
|
-
if (n.inlineContent) uo(e,
|
|
5835
|
-
else if (
|
|
5834
|
+
if (n.inlineContent) uo(e, O.create(r, a + 1, a + 1 + n.content.size), "pointer");
|
|
5835
|
+
else if (k.isSelectable(n)) uo(e, k.create(r, a), "pointer");
|
|
5836
5836
|
else continue;
|
|
5837
5837
|
return !0;
|
|
5838
5838
|
}
|
|
@@ -5840,7 +5840,7 @@ function _o(e, t, n) {
|
|
|
5840
5840
|
function vo(e) {
|
|
5841
5841
|
return Oo(e);
|
|
5842
5842
|
}
|
|
5843
|
-
var yo =
|
|
5843
|
+
var yo = z ? "metaKey" : "ctrlKey";
|
|
5844
5844
|
U.mousedown = (e, t) => {
|
|
5845
5845
|
let n = t;
|
|
5846
5846
|
e.input.shiftKey = n.shiftKey;
|
|
@@ -5867,11 +5867,11 @@ var bo = class {
|
|
|
5867
5867
|
let o = r ? null : n.target, s = o ? e.docView.nearestDesc(o, !0) : null;
|
|
5868
5868
|
this.target = s && s.nodeDOM.nodeType == 1 ? s.nodeDOM : null;
|
|
5869
5869
|
let { selection: c } = e.state;
|
|
5870
|
-
n.button == 0 && (i.type.spec.draggable && i.type.spec.selectable !== !1 || c instanceof
|
|
5870
|
+
n.button == 0 && (i.type.spec.draggable && i.type.spec.selectable !== !1 || c instanceof k && c.from <= a && c.to > a) && (this.mightDrag = {
|
|
5871
5871
|
node: i,
|
|
5872
5872
|
pos: a,
|
|
5873
5873
|
addAttr: !!(this.target && !this.target.draggable),
|
|
5874
|
-
setUneditable: !!(this.target &&
|
|
5874
|
+
setUneditable: !!(this.target && I && !this.target.hasAttribute("contentEditable"))
|
|
5875
5875
|
}), this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable) && (this.view.domObserver.stop(), this.mightDrag.addAttr && (this.target.draggable = !0), this.mightDrag.setUneditable && setTimeout(() => {
|
|
5876
5876
|
this.view.input.mouseDown == this && this.target.setAttribute("contentEditable", "false");
|
|
5877
5877
|
}, 20), this.view.domObserver.start()), e.root.addEventListener("mouseup", this.up = this.up.bind(this)), e.root.addEventListener("mousemove", this.move = this.move.bind(this)), to(e, "pointer");
|
|
@@ -5882,7 +5882,7 @@ var bo = class {
|
|
|
5882
5882
|
up(e) {
|
|
5883
5883
|
if (this.done(), !this.view.dom.contains(e.target)) return;
|
|
5884
5884
|
let t = this.pos;
|
|
5885
|
-
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(so(e))), this.updateAllowDefault(e), this.allowDefault || !t ? to(this.view, "pointer") : mo(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed ||
|
|
5885
|
+
this.view.state.doc != this.startDoc && (t = this.view.posAtCoords(so(e))), this.updateAllowDefault(e), this.allowDefault || !t ? to(this.view, "pointer") : mo(this.view, t.pos, t.inside, e, this.selectNode) ? e.preventDefault() : e.button == 0 && (this.flushed || R && this.mightDrag && !this.mightDrag.node.isAtom || L && !this.view.state.selection.visible && Math.min(Math.abs(t.pos - this.view.state.selection.from), Math.abs(t.pos - this.view.state.selection.to)) <= 2) ? (uo(this.view, D.near(this.view.state.doc.resolve(t.pos)), "pointer"), e.preventDefault()) : to(this.view, "pointer");
|
|
5886
5886
|
}
|
|
5887
5887
|
move(e) {
|
|
5888
5888
|
this.updateAllowDefault(e), to(this.view, "pointer"), e.buttons == 0 && this.done();
|
|
@@ -5897,15 +5897,15 @@ U.touchstart = (e) => {
|
|
|
5897
5897
|
e.input.lastTouch = Date.now(), to(e, "pointer");
|
|
5898
5898
|
}, U.contextmenu = (e) => vo(e);
|
|
5899
5899
|
function xo(e, t) {
|
|
5900
|
-
return e.composing ? !0 :
|
|
5900
|
+
return e.composing ? !0 : R && Math.abs(t.timeStamp - e.input.compositionEndedAt) < 500 ? (e.input.compositionEndedAt = -2e8, !0) : !1;
|
|
5901
5901
|
}
|
|
5902
|
-
var So =
|
|
5902
|
+
var So = B ? 5e3 : -1;
|
|
5903
5903
|
W.compositionstart = W.compositionupdate = (e) => {
|
|
5904
5904
|
if (!e.composing) {
|
|
5905
5905
|
e.domObserver.flush();
|
|
5906
5906
|
let { state: t } = e, n = t.selection.$to;
|
|
5907
|
-
if (t.selection instanceof
|
|
5908
|
-
else if (Oo(e, !t.selection.empty),
|
|
5907
|
+
if (t.selection instanceof O && (t.storedMarks || !n.textOffset && n.parentOffset && n.nodeBefore.marks.some((e) => e.type.spec.inclusive === !1) || L && qr && Co(e))) e.markCursor = e.state.storedMarks || n.marks(), Oo(e, !0), e.markCursor = null;
|
|
5908
|
+
else if (Oo(e, !t.selection.empty), I && t.selection.empty && n.parentOffset && !n.textOffset && n.nodeBefore.marks.length) {
|
|
5909
5909
|
let t = e.domSelectionRange();
|
|
5910
5910
|
for (let n = t.focusNode, r = t.focusOffset; n && n.nodeType == 1 && r != 0;) {
|
|
5911
5911
|
let t = r < 0 ? n.lastChild : n.childNodes[r - 1];
|
|
@@ -5939,7 +5939,7 @@ function To(e) {
|
|
|
5939
5939
|
function Eo(e) {
|
|
5940
5940
|
let t = e.domSelectionRange();
|
|
5941
5941
|
if (!t.focusNode) return null;
|
|
5942
|
-
let n =
|
|
5942
|
+
let n = Ar(t.focusNode, t.focusOffset), r = jr(t.focusNode, t.focusOffset);
|
|
5943
5943
|
if (n && r && n != r) {
|
|
5944
5944
|
let t = r.pmViewDesc, i = e.domObserver.lastChangedTextNode;
|
|
5945
5945
|
if (n == i || r == i) return i;
|
|
@@ -5956,7 +5956,7 @@ function Do() {
|
|
|
5956
5956
|
return e.initEvent("event", !0, !0), e.timeStamp;
|
|
5957
5957
|
}
|
|
5958
5958
|
function Oo(e, t = !1) {
|
|
5959
|
-
if (!(
|
|
5959
|
+
if (!(B && e.domObserver.flushingSoon >= 0)) {
|
|
5960
5960
|
if (e.domObserver.forceFlush(), To(e), t || e.docView && e.docView.dirty) {
|
|
5961
5961
|
let n = ta(e), r = e.state.selection;
|
|
5962
5962
|
return n && !n.eq(r) ? e.dispatch(e.state.tr.setSelection(n)) : (e.markCursor || t) && !r.$from.node(r.$from.sharedDepth(r.to)).inlineContent ? e.dispatch(e.state.tr.deleteSelection()) : e.updateState(e.state), !0;
|
|
@@ -5973,7 +5973,7 @@ function ko(e, t) {
|
|
|
5973
5973
|
n.parentNode && n.parentNode.removeChild(n), e.focus();
|
|
5974
5974
|
}, 50);
|
|
5975
5975
|
}
|
|
5976
|
-
var Ao =
|
|
5976
|
+
var Ao = F && Ur < 15 || Kr && Yr < 604;
|
|
5977
5977
|
U.copy = W.cut = (e, t) => {
|
|
5978
5978
|
let n = t, r = e.state.selection, i = n.type == "cut";
|
|
5979
5979
|
if (r.empty) return;
|
|
@@ -6007,7 +6007,7 @@ function Po(e) {
|
|
|
6007
6007
|
}
|
|
6008
6008
|
W.paste = (e, t) => {
|
|
6009
6009
|
let n = t;
|
|
6010
|
-
if (e.composing && !
|
|
6010
|
+
if (e.composing && !B) return;
|
|
6011
6011
|
let r = Ao ? null : n.clipboardData, i = e.input.shiftKey && e.input.lastKeyCode != 45;
|
|
6012
6012
|
r && No(e, Po(r), r.getData("text/html"), i, n) ? n.preventDefault() : Mo(e, n);
|
|
6013
6013
|
};
|
|
@@ -6015,7 +6015,7 @@ var Fo = class {
|
|
|
6015
6015
|
constructor(e, t, n) {
|
|
6016
6016
|
this.slice = e, this.move = t, this.node = n;
|
|
6017
6017
|
}
|
|
6018
|
-
}, Io =
|
|
6018
|
+
}, Io = z ? "altKey" : "ctrlKey";
|
|
6019
6019
|
function Lo(e, t) {
|
|
6020
6020
|
let n;
|
|
6021
6021
|
return e.someProp("dragCopies", (e) => {
|
|
@@ -6026,15 +6026,15 @@ U.dragstart = (e, t) => {
|
|
|
6026
6026
|
let n = t, r = e.input.mouseDown;
|
|
6027
6027
|
if (r && r.done(), !n.dataTransfer) return;
|
|
6028
6028
|
let i = e.state.selection, a = i.empty ? null : e.posAtCoords(so(n)), o;
|
|
6029
|
-
if (!(a && a.pos >= i.from && a.pos <= (i instanceof
|
|
6030
|
-
if (r && r.mightDrag) o =
|
|
6029
|
+
if (!(a && a.pos >= i.from && a.pos <= (i instanceof k ? i.to - 1 : i.to))) {
|
|
6030
|
+
if (r && r.mightDrag) o = k.create(e.state.doc, r.mightDrag.pos);
|
|
6031
6031
|
else if (n.target && n.target.nodeType == 1) {
|
|
6032
6032
|
let t = e.docView.nearestDesc(n.target, !0);
|
|
6033
|
-
t && t.node.type.spec.draggable && t != e.docView && (o =
|
|
6033
|
+
t && t.node.type.spec.draggable && t != e.docView && (o = k.create(e.state.doc, t.posBefore));
|
|
6034
6034
|
}
|
|
6035
6035
|
}
|
|
6036
6036
|
let { dom: s, text: c, slice: l } = Fa(e, (o || e.state.selection).content());
|
|
6037
|
-
(!n.dataTransfer.files.length || !
|
|
6037
|
+
(!n.dataTransfer.files.length || !L || Gr > 120) && n.dataTransfer.clearData(), n.dataTransfer.setData(Ao ? "Text" : "text/html", s.innerHTML), n.dataTransfer.effectAllowed = "copyMove", Ao || n.dataTransfer.setData("text/plain", c), e.dragging = new Fo(l, Lo(e, n), o);
|
|
6038
6038
|
}, U.dragend = (e) => {
|
|
6039
6039
|
let t = e.dragging;
|
|
6040
6040
|
window.setTimeout(() => {
|
|
@@ -6062,7 +6062,7 @@ function Ro(e, t, n) {
|
|
|
6062
6062
|
}
|
|
6063
6063
|
if (!a) return;
|
|
6064
6064
|
t.preventDefault();
|
|
6065
|
-
let s = a ?
|
|
6065
|
+
let s = a ? Wt(e.state.doc, i.pos, a) : i.pos;
|
|
6066
6066
|
s ??= i.pos;
|
|
6067
6067
|
let c = e.state.tr;
|
|
6068
6068
|
if (o) {
|
|
@@ -6072,7 +6072,7 @@ function Ro(e, t, n) {
|
|
|
6072
6072
|
let u = c.mapping.map(s), d = a.openStart == 0 && a.openEnd == 0 && a.content.childCount == 1, f = c.doc;
|
|
6073
6073
|
if (d ? c.replaceRangeWith(u, u, a.content.firstChild) : c.replaceRange(u, u, a), c.doc.eq(f)) return;
|
|
6074
6074
|
let p = c.doc.resolve(u);
|
|
6075
|
-
if (d &&
|
|
6075
|
+
if (d && k.isSelectable(a.content.firstChild) && p.nodeAfter && p.nodeAfter.sameMarkup(a.content.firstChild)) c.setSelection(new k(p));
|
|
6076
6076
|
else {
|
|
6077
6077
|
let t = c.mapping.map(s);
|
|
6078
6078
|
c.mapping.maps[c.mapping.maps.length - 1].forEach((e, n, r, i) => t = i), c.setSelection(fa(e, p, c.doc.resolve(t)));
|
|
@@ -6087,11 +6087,11 @@ U.focus = (e) => {
|
|
|
6087
6087
|
let n = t;
|
|
6088
6088
|
e.focused &&= (e.domObserver.stop(), e.dom.classList.remove("ProseMirror-focused"), e.domObserver.start(), n.relatedTarget && e.dom.contains(n.relatedTarget) && e.domObserver.currentSelection.clear(), !1);
|
|
6089
6089
|
}, U.beforeinput = (e, t) => {
|
|
6090
|
-
if (
|
|
6090
|
+
if (L && B && t.inputType == "deleteContentBackward") {
|
|
6091
6091
|
e.domObserver.flushSoon();
|
|
6092
6092
|
let { domChangeCount: t } = e.input;
|
|
6093
6093
|
setTimeout(() => {
|
|
6094
|
-
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", (t) => t(e,
|
|
6094
|
+
if (e.input.domChangeCount != t || (e.dom.blur(), e.focus(), e.someProp("handleKeyDown", (t) => t(e, Fr(8, "Backspace"))))) return;
|
|
6095
6095
|
let { $cursor: n } = e.state.selection;
|
|
6096
6096
|
n && n.pos > 0 && e.dispatch(e.state.tr.delete(n.pos - 1, n.pos).scrollIntoView());
|
|
6097
6097
|
}, 50);
|
|
@@ -6470,7 +6470,7 @@ var rs = {
|
|
|
6470
6470
|
attributes: !0,
|
|
6471
6471
|
attributeOldValue: !0,
|
|
6472
6472
|
subtree: !0
|
|
6473
|
-
}, is =
|
|
6473
|
+
}, is = F && Ur <= 11, as = class {
|
|
6474
6474
|
constructor() {
|
|
6475
6475
|
this.anchorNode = null, this.anchorOffset = 0, this.focusNode = null, this.focusOffset = 0;
|
|
6476
6476
|
}
|
|
@@ -6487,7 +6487,7 @@ var rs = {
|
|
|
6487
6487
|
constructor(e, t) {
|
|
6488
6488
|
this.view = e, this.handleDOMChange = t, this.queue = [], this.flushingSoon = -1, this.observer = null, this.currentSelection = new as(), this.onCharData = null, this.suppressingSelectionUpdates = !1, this.lastChangedTextNode = null, this.observer = window.MutationObserver && new window.MutationObserver((t) => {
|
|
6489
6489
|
for (let e = 0; e < t.length; e++) this.queue.push(t[e]);
|
|
6490
|
-
|
|
6490
|
+
F && Ur <= 11 && t.some((e) => e.type == "childList" && e.removedNodes.length || e.type == "characterData" && e.oldValue.length > e.target.nodeValue.length) ? this.flushSoon() : R && e.composing && t.some((e) => e.type == "childList" && e.target.nodeName == "TR") ? (e.input.badSafariComposition = !0, this.flushSoon()) : this.flush();
|
|
6491
6491
|
}), is && (this.onCharData = (e) => {
|
|
6492
6492
|
this.queue.push({
|
|
6493
6493
|
target: e.target,
|
|
@@ -6530,9 +6530,9 @@ var rs = {
|
|
|
6530
6530
|
onSelectionChange() {
|
|
6531
6531
|
if (pa(this.view)) {
|
|
6532
6532
|
if (this.suppressingSelectionUpdates) return ra(this.view);
|
|
6533
|
-
if (
|
|
6533
|
+
if (F && Ur <= 11 && !this.view.state.selection.empty) {
|
|
6534
6534
|
let e = this.view.domSelectionRange();
|
|
6535
|
-
if (e.focusNode &&
|
|
6535
|
+
if (e.focusNode && Dr(e.focusNode, e.focusOffset, e.anchorNode, e.anchorOffset)) return this.flushSoon();
|
|
6536
6536
|
}
|
|
6537
6537
|
this.flush();
|
|
6538
6538
|
}
|
|
@@ -6543,8 +6543,8 @@ var rs = {
|
|
|
6543
6543
|
ignoreSelectionChange(e) {
|
|
6544
6544
|
if (!e.focusNode) return !0;
|
|
6545
6545
|
let t = /* @__PURE__ */ new Set(), n;
|
|
6546
|
-
for (let n = e.focusNode; n; n =
|
|
6547
|
-
for (let r = e.anchorNode; r; r =
|
|
6546
|
+
for (let n = e.focusNode; n; n = Cr(n)) t.add(n);
|
|
6547
|
+
for (let r = e.anchorNode; r; r = Cr(r)) if (t.has(r)) {
|
|
6548
6548
|
n = r;
|
|
6549
6549
|
break;
|
|
6550
6550
|
}
|
|
@@ -6579,7 +6579,7 @@ var rs = {
|
|
|
6579
6579
|
t = t.firstChild;
|
|
6580
6580
|
}
|
|
6581
6581
|
}
|
|
6582
|
-
} else if (
|
|
6582
|
+
} else if (I && s.length) {
|
|
6583
6583
|
let t = s.filter((e) => e.nodeName == "BR");
|
|
6584
6584
|
if (t.length == 2) {
|
|
6585
6585
|
let [e, n] = t;
|
|
@@ -6593,7 +6593,7 @@ var rs = {
|
|
|
6593
6593
|
}
|
|
6594
6594
|
}
|
|
6595
6595
|
let c = null;
|
|
6596
|
-
i < 0 && r && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 &&
|
|
6596
|
+
i < 0 && r && e.input.lastFocus > Date.now() - 200 && Math.max(e.input.lastTouch, e.input.lastClick.time) < Date.now() - 300 && Pr(n) && (c = ta(e)) && c.eq(D.near(e.state.doc.resolve(0), 1)) ? (e.input.lastFocus = 0, ra(e), this.currentSelection.set(n), e.scrollToSelection()) : (i > -1 || r) && (i > -1 && (e.docView.markDirty(i, a), us(e)), e.input.badSafariComposition && (e.input.badSafariComposition = !1, ms(e, s)), this.handleDOMChange(i, a, o, s), e.docView && e.docView.dirty ? e.updateState(e.state) : this.currentSelection.eq(n) || ra(e), this.currentSelection.set(n));
|
|
6597
6597
|
}
|
|
6598
6598
|
registerMutation(e, t) {
|
|
6599
6599
|
if (t.indexOf(e.target) > -1) return null;
|
|
@@ -6609,11 +6609,11 @@ var rs = {
|
|
|
6609
6609
|
to: n.posAfter
|
|
6610
6610
|
};
|
|
6611
6611
|
let r = e.previousSibling, i = e.nextSibling;
|
|
6612
|
-
if (
|
|
6612
|
+
if (F && Ur <= 11 && e.addedNodes.length) for (let t = 0; t < e.addedNodes.length; t++) {
|
|
6613
6613
|
let { previousSibling: n, nextSibling: a } = e.addedNodes[t];
|
|
6614
6614
|
(!n || Array.prototype.indexOf.call(e.addedNodes, n) < 0) && (r = n), (!a || Array.prototype.indexOf.call(e.addedNodes, a) < 0) && (i = a);
|
|
6615
6615
|
}
|
|
6616
|
-
let a = r && r.parentNode == e.target ?
|
|
6616
|
+
let a = r && r.parentNode == e.target ? M(r) + 1 : 0, o = n.localPosFromDOM(e.target, a, -1), s = i && i.parentNode == e.target ? M(i) : e.target.childNodes.length;
|
|
6617
6617
|
return {
|
|
6618
6618
|
from: o,
|
|
6619
6619
|
to: n.localPosFromDOM(e.target, s, 1)
|
|
@@ -6635,13 +6635,13 @@ function us(e) {
|
|
|
6635
6635
|
"nowrap",
|
|
6636
6636
|
"pre-line"
|
|
6637
6637
|
].indexOf(getComputedStyle(e.dom).whiteSpace) !== -1)) {
|
|
6638
|
-
if (e.requiresGeckoHackNode =
|
|
6638
|
+
if (e.requiresGeckoHackNode = I, ls) return;
|
|
6639
6639
|
console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."), ls = !0;
|
|
6640
6640
|
}
|
|
6641
6641
|
}
|
|
6642
6642
|
function ds(e, t) {
|
|
6643
6643
|
let n = t.startContainer, r = t.startOffset, i = t.endContainer, a = t.endOffset, o = e.domAtPos(e.state.selection.anchor);
|
|
6644
|
-
return
|
|
6644
|
+
return Dr(o.node, o.offset, i, a) && ([n, r, i, a] = [
|
|
6645
6645
|
i,
|
|
6646
6646
|
a,
|
|
6647
6647
|
n,
|
|
@@ -6692,10 +6692,10 @@ function hs(e, t, n) {
|
|
|
6692
6692
|
if (u && e.dom.contains(u.nodeType == 1 ? u : u.parentNode) && (l = [{
|
|
6693
6693
|
node: u,
|
|
6694
6694
|
offset: c.anchorOffset
|
|
6695
|
-
}],
|
|
6695
|
+
}], Pr(c) || l.push({
|
|
6696
6696
|
node: c.focusNode,
|
|
6697
6697
|
offset: c.focusOffset
|
|
6698
|
-
})),
|
|
6698
|
+
})), L && e.input.lastKeyCode === 8) for (let e = a; e > i; e--) {
|
|
6699
6699
|
let t = r.childNodes[e - 1], n = t.pmViewDesc;
|
|
6700
6700
|
if (t.nodeName == "BR" && !n) {
|
|
6701
6701
|
a = e;
|
|
@@ -6703,7 +6703,7 @@ function hs(e, t, n) {
|
|
|
6703
6703
|
}
|
|
6704
6704
|
if (!n || n.size) break;
|
|
6705
6705
|
}
|
|
6706
|
-
let d = e.state.doc, f = e.someProp("domParser") ||
|
|
6706
|
+
let d = e.state.doc, f = e.someProp("domParser") || Fe.fromSchema(e.state.schema), p = d.resolve(o), m = null, h = f.parse(r, {
|
|
6707
6707
|
topNode: p.parent,
|
|
6708
6708
|
topMatch: p.parent.contentMatchAt(p.index()),
|
|
6709
6709
|
topOpen: !0,
|
|
@@ -6732,10 +6732,10 @@ function gs(e) {
|
|
|
6732
6732
|
let t = e.pmViewDesc;
|
|
6733
6733
|
if (t) return t.parseRule();
|
|
6734
6734
|
if (e.nodeName == "BR" && e.parentNode) {
|
|
6735
|
-
if (
|
|
6735
|
+
if (R && /^(ul|ol)$/i.test(e.parentNode.nodeName)) {
|
|
6736
6736
|
let e = document.createElement("div");
|
|
6737
6737
|
return e.appendChild(document.createElement("li")), { skip: e };
|
|
6738
|
-
} else if (e.parentNode.lastChild == e ||
|
|
6738
|
+
} else if (e.parentNode.lastChild == e || R && /^(tr|table)$/i.test(e.parentNode.nodeName)) return { ignore: !0 };
|
|
6739
6739
|
} else if (e.nodeName == "IMG" && e.getAttribute("mark-placeholder")) return { ignore: !0 };
|
|
6740
6740
|
return null;
|
|
6741
6741
|
}
|
|
@@ -6745,7 +6745,7 @@ function vs(e, t, n, r, i) {
|
|
|
6745
6745
|
if (e.input.compositionPendingChanges = 0, t < 0) {
|
|
6746
6746
|
let t = e.input.lastSelectionTime > Date.now() - 50 ? e.input.lastSelectionOrigin : null, n = ta(e, t);
|
|
6747
6747
|
if (n && !e.state.selection.eq(n)) {
|
|
6748
|
-
if (
|
|
6748
|
+
if (L && B && e.input.lastKeyCode === 13 && Date.now() - 100 < e.input.lastKeyCodeTime && e.someProp("handleKeyDown", (t) => t(e, Fr(13, "Enter")))) return;
|
|
6749
6749
|
let r = e.state.tr.setSelection(n);
|
|
6750
6750
|
t == "pointer" ? r.setMeta("pointer", !0) : t == "key" && r.scrollIntoView(), a && r.setMeta("composition", a), e.dispatch(r);
|
|
6751
6751
|
}
|
|
@@ -6756,11 +6756,11 @@ function vs(e, t, n, r, i) {
|
|
|
6756
6756
|
let c = e.state.selection, l = hs(e, t, n), u = e.state.doc, d = u.slice(l.from, l.to), f, p;
|
|
6757
6757
|
e.input.lastKeyCode === 8 && Date.now() - 100 < e.input.lastKeyCodeTime ? (f = e.state.selection.to, p = "end") : (f = e.state.selection.from, p = "start"), e.input.lastKeyCode = null;
|
|
6758
6758
|
let m = Cs(d.content, l.doc.content, l.from, f, p);
|
|
6759
|
-
if (m && e.input.domChangeCount++, (
|
|
6759
|
+
if (m && e.input.domChangeCount++, (Kr && e.input.lastIOSEnter > Date.now() - 225 || B) && i.some((e) => e.nodeType == 1 && !_s.test(e.nodeName)) && (!m || m.endA >= m.endB) && e.someProp("handleKeyDown", (t) => t(e, Fr(13, "Enter")))) {
|
|
6760
6760
|
e.input.lastIOSEnter = 0;
|
|
6761
6761
|
return;
|
|
6762
6762
|
}
|
|
6763
|
-
if (!m) if (r && c instanceof
|
|
6763
|
+
if (!m) if (r && c instanceof O && !c.empty && c.$head.sameParent(c.$anchor) && !e.composing && !(l.sel && l.sel.anchor != l.sel.head)) m = {
|
|
6764
6764
|
start: c.from,
|
|
6765
6765
|
endA: c.to,
|
|
6766
6766
|
endB: c.to
|
|
@@ -6775,31 +6775,31 @@ function vs(e, t, n, r, i) {
|
|
|
6775
6775
|
}
|
|
6776
6776
|
return;
|
|
6777
6777
|
}
|
|
6778
|
-
e.state.selection.from < e.state.selection.to && m.start == m.endB && e.state.selection instanceof
|
|
6778
|
+
e.state.selection.from < e.state.selection.to && m.start == m.endB && e.state.selection instanceof O && (m.start > e.state.selection.from && m.start <= e.state.selection.from + 2 && e.state.selection.from >= l.from ? m.start = e.state.selection.from : m.endA < e.state.selection.to && m.endA >= e.state.selection.to - 2 && e.state.selection.to <= l.to && (m.endB += e.state.selection.to - m.endA, m.endA = e.state.selection.to)), F && Ur <= 11 && m.endB == m.start + 1 && m.endA == m.start && m.start > l.from && l.doc.textBetween(m.start - l.from - 1, m.start - l.from + 1) == " \xA0" && (m.start--, m.endA--, m.endB--);
|
|
6779
6779
|
let h = l.doc.resolveNoCache(m.start - l.from), g = l.doc.resolveNoCache(m.endB - l.from), _ = u.resolve(m.start), v = h.sameParent(g) && h.parent.inlineContent && _.end() >= m.endA;
|
|
6780
|
-
if ((
|
|
6780
|
+
if ((Kr && e.input.lastIOSEnter > Date.now() - 225 && (!v || i.some((e) => e.nodeName == "DIV" || e.nodeName == "P")) || !v && h.pos < l.doc.content.size && (!h.sameParent(g) || !h.parent.inlineContent) && h.pos < g.pos && !/\S/.test(l.doc.textBetween(h.pos, g.pos, "", ""))) && e.someProp("handleKeyDown", (t) => t(e, Fr(13, "Enter")))) {
|
|
6781
6781
|
e.input.lastIOSEnter = 0;
|
|
6782
6782
|
return;
|
|
6783
6783
|
}
|
|
6784
|
-
if (e.state.selection.anchor > m.start && xs(u, m.start, m.endA, h, g) && e.someProp("handleKeyDown", (t) => t(e,
|
|
6785
|
-
|
|
6784
|
+
if (e.state.selection.anchor > m.start && xs(u, m.start, m.endA, h, g) && e.someProp("handleKeyDown", (t) => t(e, Fr(8, "Backspace")))) {
|
|
6785
|
+
B && L && e.domObserver.suppressSelectionUpdates();
|
|
6786
6786
|
return;
|
|
6787
6787
|
}
|
|
6788
|
-
|
|
6788
|
+
L && m.endB == m.start && (e.input.lastChromeDelete = Date.now()), B && !v && h.start() != g.start() && g.parentOffset == 0 && h.depth == g.depth && l.sel && l.sel.anchor == l.sel.head && l.sel.head == m.endA && (m.endB -= 2, g = l.doc.resolveNoCache(m.endB - l.from), setTimeout(() => {
|
|
6789
6789
|
e.someProp("handleKeyDown", function(t) {
|
|
6790
|
-
return t(e,
|
|
6790
|
+
return t(e, Fr(13, "Enter"));
|
|
6791
6791
|
});
|
|
6792
6792
|
}, 20));
|
|
6793
6793
|
let y = m.start, b = m.endA, ee = (t) => {
|
|
6794
6794
|
let n = t || e.state.tr.replace(y, b, l.doc.slice(m.start - l.from, m.endB - l.from));
|
|
6795
6795
|
if (l.sel) {
|
|
6796
6796
|
let t = ys(e, n.doc, l.sel);
|
|
6797
|
-
t && !(
|
|
6797
|
+
t && !(L && e.composing && t.empty && (m.start != m.endB || e.input.lastChromeDelete < Date.now() - 100) && (t.head == y || t.head == n.mapping.map(b) - 1) || F && t.empty && t.head == y) && n.setSelection(t);
|
|
6798
6798
|
}
|
|
6799
6799
|
return a && n.setMeta("composition", a), n.scrollIntoView();
|
|
6800
6800
|
}, te;
|
|
6801
6801
|
if (v) if (h.pos == g.pos) {
|
|
6802
|
-
|
|
6802
|
+
F && Ur <= 11 && h.parentOffset == 0 && (e.domObserver.suppressSelectionUpdates(), setTimeout(() => ra(e), 20));
|
|
6803
6803
|
let t = ee(e.state.tr.delete(y, b)), n = u.resolve(m.start).marksAcross(u.resolve(m.endA));
|
|
6804
6804
|
n && t.ensureMarks(n), e.dispatch(t);
|
|
6805
6805
|
} else if (m.endA == m.endB && (te = bs(h.parent.content.cut(h.parentOffset, g.parentOffset), _.parent.content.cut(_.parentOffset, m.endA - _.start())))) {
|
|
@@ -6919,9 +6919,9 @@ var Ts = class {
|
|
|
6919
6919
|
let u = c == "preserve" && i && this.dom.style.overflowAnchor == null && ei(this);
|
|
6920
6920
|
if (i) {
|
|
6921
6921
|
this.domObserver.stop();
|
|
6922
|
-
let t = l && (
|
|
6922
|
+
let t = l && (F || L) && !this.composing && !n.selection.empty && !e.selection.empty && ks(n.selection, e.selection);
|
|
6923
6923
|
if (l) {
|
|
6924
|
-
let n =
|
|
6924
|
+
let n = L ? this.trackWrites = this.domSelectionRange().focusNode : null;
|
|
6925
6925
|
this.composing && (this.input.compositionNode = Eo(this)), (r || !this.docView.update(e.doc, s, o, this)) && (this.docView.updateOuterDeco(s), this.docView.destroy(), this.docView = Fi(e.doc, s, o, this.dom, this)), n && (!this.trackWrites || !this.dom.contains(this.trackWrites)) && (t = !0);
|
|
6926
6926
|
}
|
|
6927
6927
|
t || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && ha(this)) ? ra(this, t) : (ua(this, e.selection), this.domObserver.setCurSelection()), this.domObserver.start();
|
|
@@ -6930,7 +6930,7 @@ var Ts = class {
|
|
|
6930
6930
|
}
|
|
6931
6931
|
scrollToSelection() {
|
|
6932
6932
|
let e = this.domSelectionRange().focusNode;
|
|
6933
|
-
if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode)) && !this.someProp("handleScrollToSelection", (e) => e(this))) if (this.state.selection instanceof
|
|
6933
|
+
if (!(!e || !this.dom.contains(e.nodeType == 1 ? e : e.parentNode)) && !this.someProp("handleScrollToSelection", (e) => e(this))) if (this.state.selection instanceof k) {
|
|
6934
6934
|
let t = this.docView.domAfterPos(this.state.selection.from);
|
|
6935
6935
|
t.nodeType == 1 && $r(this, t.getBoundingClientRect(), e);
|
|
6936
6936
|
} else $r(this, this.coordsAtPos(this.state.selection.head, 1), e);
|
|
@@ -6962,7 +6962,7 @@ var Ts = class {
|
|
|
6962
6962
|
let e = n.from + (this.state.doc.content.size - t.doc.content.size);
|
|
6963
6963
|
(e > 0 && e < this.state.doc.content.size && this.state.doc.nodeAt(e)) == n.node && (r = e);
|
|
6964
6964
|
}
|
|
6965
|
-
this.dragging = new Fo(e.slice, e.move, r < 0 ? void 0 :
|
|
6965
|
+
this.dragging = new Fo(e.slice, e.move, r < 0 ? void 0 : k.create(this.state.doc, r));
|
|
6966
6966
|
}
|
|
6967
6967
|
someProp(e, t) {
|
|
6968
6968
|
let n = this._props && this._props[e], r;
|
|
@@ -6978,7 +6978,7 @@ var Ts = class {
|
|
|
6978
6978
|
}
|
|
6979
6979
|
}
|
|
6980
6980
|
hasFocus() {
|
|
6981
|
-
if (
|
|
6981
|
+
if (F) {
|
|
6982
6982
|
let e = this.root.activeElement;
|
|
6983
6983
|
if (e == this.dom) return !0;
|
|
6984
6984
|
if (!e || !this.dom.contains(e)) return !1;
|
|
@@ -7034,7 +7034,7 @@ var Ts = class {
|
|
|
7034
7034
|
return Fa(this, e);
|
|
7035
7035
|
}
|
|
7036
7036
|
destroy() {
|
|
7037
|
-
this.docView && (no(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], ns(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null,
|
|
7037
|
+
this.docView && (no(this), this.destroyPluginViews(), this.mounted ? (this.docView.update(this.state.doc, [], ns(this), this), this.dom.textContent = "") : this.dom.parentNode && this.dom.parentNode.removeChild(this.dom), this.docView.destroy(), this.docView = null, Er());
|
|
7038
7038
|
}
|
|
7039
7039
|
get isDestroyed() {
|
|
7040
7040
|
return this.docView == null;
|
|
@@ -7044,7 +7044,7 @@ var Ts = class {
|
|
|
7044
7044
|
}
|
|
7045
7045
|
domSelectionRange() {
|
|
7046
7046
|
let e = this.domSelection();
|
|
7047
|
-
return e ?
|
|
7047
|
+
return e ? R && this.root.nodeType === 11 && Ir(this.dom.ownerDocument) == this.dom && fs(this, e) || e : {
|
|
7048
7048
|
focusNode: null,
|
|
7049
7049
|
focusOffset: 0,
|
|
7050
7050
|
anchorNode: null,
|
|
@@ -7216,7 +7216,7 @@ function Us(e, t, n = !0) {
|
|
|
7216
7216
|
return t.altKey && (e = "Alt-" + e), t.ctrlKey && (e = "Ctrl-" + e), t.metaKey && (e = "Meta-" + e), n && t.shiftKey && (e = "Shift-" + e), e;
|
|
7217
7217
|
}
|
|
7218
7218
|
function Ws(e) {
|
|
7219
|
-
return new
|
|
7219
|
+
return new j({ props: { handleKeyDown: Gs(e) } });
|
|
7220
7220
|
}
|
|
7221
7221
|
function Gs(e) {
|
|
7222
7222
|
let t = Hs(e);
|
|
@@ -7402,7 +7402,7 @@ var Zs = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
7402
7402
|
if (e.type.isText) return;
|
|
7403
7403
|
let { doc: r, mapping: i } = t, a = r.resolve(i.map(n)), o = r.resolve(i.map(n + e.nodeSize)), s = a.blockRange(o);
|
|
7404
7404
|
if (!s) return;
|
|
7405
|
-
let c =
|
|
7405
|
+
let c = Tt(s);
|
|
7406
7406
|
if (e.type.isTextblock) {
|
|
7407
7407
|
let { defaultType: e } = a.parent.contentMatchAt(a.index());
|
|
7408
7408
|
t.setNodeMarkup(s.start, e);
|
|
@@ -7410,11 +7410,11 @@ var Zs = () => ({ editor: e, view: t }) => (requestAnimationFrame(() => {
|
|
|
7410
7410
|
(c || c === 0) && t.lift(s, c);
|
|
7411
7411
|
});
|
|
7412
7412
|
}), !0;
|
|
7413
|
-
}, ec = (e) => (t) => e(t), tc = () => ({ state: e, dispatch: t }) =>
|
|
7413
|
+
}, ec = (e) => (t) => e(t), tc = () => ({ state: e, dispatch: t }) => Qn(e, t), nc = (e, t) => ({ editor: n, tr: r }) => {
|
|
7414
7414
|
let { state: i } = n, a = i.doc.slice(e.from, e.to);
|
|
7415
7415
|
r.deleteRange(e.from, e.to);
|
|
7416
7416
|
let o = r.mapping.map(t);
|
|
7417
|
-
return r.insert(o, a.content), r.setSelection(new
|
|
7417
|
+
return r.insert(o, a.content), r.setSelection(new O(r.doc.resolve(Math.max(o - 1, 0)))), !0;
|
|
7418
7418
|
}, rc = () => ({ tr: e, dispatch: t }) => {
|
|
7419
7419
|
let { selection: n } = e, r = n.$anchor.node();
|
|
7420
7420
|
if (r.content.size > 0) return !1;
|
|
@@ -7448,7 +7448,7 @@ var ic = (e) => ({ tr: t, state: n, dispatch: r }) => {
|
|
|
7448
7448
|
}, ac = (e) => ({ tr: t, dispatch: n }) => {
|
|
7449
7449
|
let { from: r, to: i } = e;
|
|
7450
7450
|
return n && t.delete(r, i), !0;
|
|
7451
|
-
}, oc = () => ({ state: e, dispatch: t }) =>
|
|
7451
|
+
}, oc = () => ({ state: e, dispatch: t }) => Nn(e, t), sc = () => ({ commands: e }) => e.keyboardShortcut("Enter"), cc = () => ({ state: e, dispatch: t }) => Zn(e, t);
|
|
7452
7452
|
function lc(e) {
|
|
7453
7453
|
return Object.prototype.toString.call(e) === "[object RegExp]";
|
|
7454
7454
|
}
|
|
@@ -7491,7 +7491,7 @@ var mc = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
7491
7491
|
if (i) {
|
|
7492
7492
|
let e = pc(c, a, t);
|
|
7493
7493
|
if (e && e.from <= l && e.to >= u) {
|
|
7494
|
-
let t =
|
|
7494
|
+
let t = O.create(o, e.from, e.to);
|
|
7495
7495
|
n.setSelection(t);
|
|
7496
7496
|
}
|
|
7497
7497
|
}
|
|
@@ -7502,18 +7502,18 @@ var mc = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
7502
7502
|
return !1;
|
|
7503
7503
|
};
|
|
7504
7504
|
function gc(e) {
|
|
7505
|
-
return e instanceof
|
|
7505
|
+
return e instanceof O;
|
|
7506
7506
|
}
|
|
7507
7507
|
function X(e = 0, t = 0, n = 0) {
|
|
7508
7508
|
return Math.min(Math.max(e, t), n);
|
|
7509
7509
|
}
|
|
7510
7510
|
function _c(e, t = null) {
|
|
7511
7511
|
if (!t) return null;
|
|
7512
|
-
let n =
|
|
7512
|
+
let n = D.atStart(e), r = D.atEnd(e);
|
|
7513
7513
|
if (t === "start" || t === !0) return n;
|
|
7514
7514
|
if (t === "end") return r;
|
|
7515
7515
|
let i = n.from, a = r.to;
|
|
7516
|
-
return t === "all" ?
|
|
7516
|
+
return t === "all" ? O.create(e, X(0, i, a), X(e.content.size, i, a)) : O.create(e, X(t, i, a), X(t, i, a));
|
|
7517
7517
|
}
|
|
7518
7518
|
function vc() {
|
|
7519
7519
|
return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
|
|
@@ -7569,7 +7569,7 @@ function Tc(e) {
|
|
|
7569
7569
|
return wc(n);
|
|
7570
7570
|
}
|
|
7571
7571
|
function Ec(e, t, n) {
|
|
7572
|
-
if (e instanceof
|
|
7572
|
+
if (e instanceof x || e instanceof r) return e;
|
|
7573
7573
|
n = {
|
|
7574
7574
|
slice: !0,
|
|
7575
7575
|
parseOptions: {},
|
|
@@ -7586,7 +7586,7 @@ function Ec(e, t, n) {
|
|
|
7586
7586
|
}
|
|
7587
7587
|
if (a) {
|
|
7588
7588
|
if (n.errorOnInvalidContent) {
|
|
7589
|
-
let r = !1, i = "", a = new
|
|
7589
|
+
let r = !1, i = "", a = new je({
|
|
7590
7590
|
topNode: t.spec.topNode,
|
|
7591
7591
|
marks: t.spec.marks,
|
|
7592
7592
|
nodes: t.spec.nodes.append({ __tiptap__private__unknown__catch__all__node: {
|
|
@@ -7598,9 +7598,9 @@ function Ec(e, t, n) {
|
|
|
7598
7598
|
}]
|
|
7599
7599
|
} })
|
|
7600
7600
|
});
|
|
7601
|
-
if (n.slice ?
|
|
7601
|
+
if (n.slice ? Fe.fromSchema(a).parseSlice(Tc(e), n.parseOptions) : Fe.fromSchema(a).parse(Tc(e), n.parseOptions), n.errorOnInvalidContent && r) throw Error("[tiptap error]: Invalid HTML content", { cause: /* @__PURE__ */ Error(`Invalid element found: ${i}`) });
|
|
7602
7602
|
}
|
|
7603
|
-
let r =
|
|
7603
|
+
let r = Fe.fromSchema(t);
|
|
7604
7604
|
return n.slice ? r.parseSlice(Tc(e), n.parseOptions).content : r.parse(Tc(e), n.parseOptions);
|
|
7605
7605
|
}
|
|
7606
7606
|
return Ec("", t, n);
|
|
@@ -7609,11 +7609,11 @@ function Dc(e, t, n) {
|
|
|
7609
7609
|
let r = e.steps.length - 1;
|
|
7610
7610
|
if (r < t) return;
|
|
7611
7611
|
let i = e.steps[r];
|
|
7612
|
-
if (!(i instanceof
|
|
7612
|
+
if (!(i instanceof w || i instanceof T)) return;
|
|
7613
7613
|
let a = e.mapping.maps[r], o = 0;
|
|
7614
7614
|
a.forEach((e, t, n, r) => {
|
|
7615
7615
|
o === 0 && (o = r);
|
|
7616
|
-
}), e.setSelection(
|
|
7616
|
+
}), e.setSelection(D.near(e.doc.resolve(o), n));
|
|
7617
7617
|
}
|
|
7618
7618
|
var Oc = (e) => !("type" in e), kc = (e, t, n) => ({ tr: i, dispatch: a, editor: o }) => {
|
|
7619
7619
|
if (a) {
|
|
@@ -7689,21 +7689,21 @@ var Oc = (e) => !("type" in e), kc = (e, t, n) => ({ tr: i, dispatch: a, editor:
|
|
|
7689
7689
|
});
|
|
7690
7690
|
}
|
|
7691
7691
|
return !0;
|
|
7692
|
-
}, Ac = () => ({ state: e, dispatch: t }) =>
|
|
7692
|
+
}, Ac = () => ({ state: e, dispatch: t }) => Kn(e, t), jc = () => ({ state: e, dispatch: t }) => qn(e, t), Mc = () => ({ state: e, dispatch: t }) => Fn(e, t), Nc = () => ({ state: e, dispatch: t }) => Un(e, t), Pc = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
7693
7693
|
try {
|
|
7694
|
-
let r =
|
|
7694
|
+
let r = Vt(e.doc, e.selection.$from.pos, -1);
|
|
7695
7695
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
7696
7696
|
} catch {
|
|
7697
7697
|
return !1;
|
|
7698
7698
|
}
|
|
7699
7699
|
}, Fc = () => ({ state: e, dispatch: t, tr: n }) => {
|
|
7700
7700
|
try {
|
|
7701
|
-
let r =
|
|
7701
|
+
let r = Vt(e.doc, e.selection.$from.pos, 1);
|
|
7702
7702
|
return r == null ? !1 : (n.join(r, 2), t && t(n), !0);
|
|
7703
7703
|
} catch {
|
|
7704
7704
|
return !1;
|
|
7705
7705
|
}
|
|
7706
|
-
}, Ic = () => ({ state: e, dispatch: t }) =>
|
|
7706
|
+
}, Ic = () => ({ state: e, dispatch: t }) => In(e, t), Lc = () => ({ state: e, dispatch: t }) => Ln(e, t);
|
|
7707
7707
|
function Rc() {
|
|
7708
7708
|
return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
|
|
7709
7709
|
}
|
|
@@ -7758,7 +7758,7 @@ function Vc(e, t, n = {}) {
|
|
|
7758
7758
|
let c = i - r, l = s.filter((e) => o ? o.name === e.node.type.name : !0).filter((e) => uc(e.node.attrs, n, { strict: !1 }));
|
|
7759
7759
|
return a ? !!l.length : l.reduce((e, t) => e + t.to - t.from, 0) >= c;
|
|
7760
7760
|
}
|
|
7761
|
-
var Hc = (e, t = {}) => ({ state: n, dispatch: r }) => Vc(n, J(e, n.schema), t) ?
|
|
7761
|
+
var Hc = (e, t = {}) => ({ state: n, dispatch: r }) => Vc(n, J(e, n.schema), t) ? Jn(n, r) : !1, Uc = () => ({ state: e, dispatch: t }) => $n(e, t), Wc = (e) => ({ state: t, dispatch: n }) => yr(J(e, t.schema))(t, n), Gc = () => ({ state: e, dispatch: t }) => Yn(e, t);
|
|
7762
7762
|
function Kc(e, t) {
|
|
7763
7763
|
return t.nodes[e] ? "node" : t.marks[e] ? "mark" : null;
|
|
7764
7764
|
}
|
|
@@ -7780,11 +7780,11 @@ var Jc = (e, t) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
7780
7780
|
}), c;
|
|
7781
7781
|
}, Yc = () => ({ tr: e, dispatch: t }) => (t && e.scrollIntoView(), !0), Xc = () => ({ tr: e, dispatch: t }) => {
|
|
7782
7782
|
if (t) {
|
|
7783
|
-
let t = new
|
|
7783
|
+
let t = new A(e.doc);
|
|
7784
7784
|
e.setSelection(t);
|
|
7785
7785
|
}
|
|
7786
7786
|
return !0;
|
|
7787
|
-
}, Zc = () => ({ state: e, dispatch: t }) =>
|
|
7787
|
+
}, Zc = () => ({ state: e, dispatch: t }) => Bn(e, t), Qc = () => ({ state: e, dispatch: t }) => Wn(e, t), $c = () => ({ state: e, dispatch: t }) => nr(e, t), el = () => ({ state: e, dispatch: t }) => cr(e, t), tl = () => ({ state: e, dispatch: t }) => sr(e, t);
|
|
7788
7788
|
function nl(e, t, n = {}, r = {}) {
|
|
7789
7789
|
return Ec(e, t, {
|
|
7790
7790
|
slice: !1,
|
|
@@ -7815,7 +7815,7 @@ function il(e, t) {
|
|
|
7815
7815
|
return s ? { ...s.attrs } : {};
|
|
7816
7816
|
}
|
|
7817
7817
|
function al(e, t) {
|
|
7818
|
-
let n = new
|
|
7818
|
+
let n = new un(e);
|
|
7819
7819
|
return t.forEach((e) => {
|
|
7820
7820
|
e.steps.forEach((e) => {
|
|
7821
7821
|
n.step(e);
|
|
@@ -7878,7 +7878,7 @@ function dl(e) {
|
|
|
7878
7878
|
}).flat(10);
|
|
7879
7879
|
}
|
|
7880
7880
|
function fl(e, t) {
|
|
7881
|
-
let n =
|
|
7881
|
+
let n = Ye.fromSchema(t).serializeFragment(e), r = document.implementation.createHTMLDocument().createElement("div");
|
|
7882
7882
|
return r.appendChild(n), r.innerHTML;
|
|
7883
7883
|
}
|
|
7884
7884
|
function pl(e) {
|
|
@@ -8043,7 +8043,7 @@ function wl(e) {
|
|
|
8043
8043
|
}
|
|
8044
8044
|
function Tl(e, t) {
|
|
8045
8045
|
let n = gl(e), { nodeExtensions: r, markExtensions: i } = hl(e);
|
|
8046
|
-
return new
|
|
8046
|
+
return new je({
|
|
8047
8047
|
topNode: r.find((e) => Z(e, "topNode"))?.name,
|
|
8048
8048
|
nodes: Object.fromEntries(r.map((r) => {
|
|
8049
8049
|
let i = n.filter((e) => e.type === r.name), a = {
|
|
@@ -8131,11 +8131,11 @@ function kl(e, t) {
|
|
|
8131
8131
|
}
|
|
8132
8132
|
function Al(e, t) {
|
|
8133
8133
|
let n = kl(t);
|
|
8134
|
-
return fl(
|
|
8134
|
+
return fl(x.fromJSON(n, e).content, n);
|
|
8135
8135
|
}
|
|
8136
8136
|
function jl(e, t) {
|
|
8137
8137
|
let n = kl(t), r = Tc(e);
|
|
8138
|
-
return
|
|
8138
|
+
return Fe.fromSchema(n).parse(r).toJSON();
|
|
8139
8139
|
}
|
|
8140
8140
|
function Ml(e, t, n) {
|
|
8141
8141
|
let { from: r, to: i } = t, { blockSeparator: a = "\n\n", textSerializers: o = {} } = n || {}, s = "";
|
|
@@ -8163,7 +8163,7 @@ function Pl(e) {
|
|
|
8163
8163
|
}
|
|
8164
8164
|
function Fl(e, t, n) {
|
|
8165
8165
|
let { blockSeparator: r = "\n\n", textSerializers: i = {} } = n || {}, a = kl(t);
|
|
8166
|
-
return Nl(
|
|
8166
|
+
return Nl(x.fromJSON(a, e), {
|
|
8167
8167
|
blockSeparator: r,
|
|
8168
8168
|
textSerializers: {
|
|
8169
8169
|
...Pl(a),
|
|
@@ -8358,7 +8358,7 @@ function $l(e, { checkChildren: t = !0, ignoreWhitespace: n = !1 } = {}) {
|
|
|
8358
8358
|
return !1;
|
|
8359
8359
|
}
|
|
8360
8360
|
function eu(e) {
|
|
8361
|
-
return e instanceof
|
|
8361
|
+
return e instanceof k;
|
|
8362
8362
|
}
|
|
8363
8363
|
function tu({ selection: e, pos: t, nodeSize: n, selectedOnTextSelection: r = !1 }) {
|
|
8364
8364
|
let { from: i, to: a } = e;
|
|
@@ -8478,16 +8478,16 @@ var lu = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
8478
8478
|
return cu(r, n, c);
|
|
8479
8479
|
}, uu = (e, t) => ({ tr: n }) => (n.setMeta(e, t), !0), du = (e, t = {}) => ({ state: n, dispatch: r, chain: i }) => {
|
|
8480
8480
|
let a = J(e, n.schema), o;
|
|
8481
|
-
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) =>
|
|
8481
|
+
return n.selection.$anchor.sameParent(n.selection.$head) && (o = n.selection.$anchor.parent.attrs), a.isTextblock ? i().command(({ commands: e }) => ur(a, {
|
|
8482
8482
|
...o,
|
|
8483
8483
|
...t
|
|
8484
|
-
})(n) ? !0 : e.clearNodes()).command(({ state: e }) =>
|
|
8484
|
+
})(n) ? !0 : e.clearNodes()).command(({ state: e }) => ur(a, {
|
|
8485
8485
|
...o,
|
|
8486
8486
|
...t
|
|
8487
8487
|
})(e, r)).run() : (console.warn("[tiptap warn]: Currently \"setNode()\" only supports text block nodes."), !1);
|
|
8488
8488
|
}, fu = (e) => ({ tr: t, dispatch: n }) => {
|
|
8489
8489
|
if (n) {
|
|
8490
|
-
let { doc: n } = t, r = X(e, 0, n.content.size), i =
|
|
8490
|
+
let { doc: n } = t, r = X(e, 0, n.content.size), i = k.create(n, r);
|
|
8491
8491
|
t.setSelection(i);
|
|
8492
8492
|
}
|
|
8493
8493
|
return !0;
|
|
@@ -8504,11 +8504,11 @@ var lu = (e, t = {}) => ({ tr: n, state: r, dispatch: i }) => {
|
|
|
8504
8504
|
let { doc: n } = t, { from: r, to: i } = typeof e == "number" ? {
|
|
8505
8505
|
from: e,
|
|
8506
8506
|
to: e
|
|
8507
|
-
} : e, a =
|
|
8507
|
+
} : e, a = O.atStart(n).from, o = O.atEnd(n).to, s = X(r, a, o), c = X(i, a, o), l = O.create(n, s, c);
|
|
8508
8508
|
t.setSelection(l);
|
|
8509
8509
|
}
|
|
8510
8510
|
return !0;
|
|
8511
|
-
}, hu = (e) => ({ state: t, dispatch: n }) =>
|
|
8511
|
+
}, hu = (e) => ({ state: t, dispatch: n }) => Sr(J(e, t.schema))(t, n);
|
|
8512
8512
|
function gu(e, t) {
|
|
8513
8513
|
let n = e.storedMarks || e.selection.$to.parentOffset && e.selection.$from.marks();
|
|
8514
8514
|
if (n) {
|
|
@@ -8518,17 +8518,17 @@ function gu(e, t) {
|
|
|
8518
8518
|
}
|
|
8519
8519
|
var _u = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor: i }) => {
|
|
8520
8520
|
let { selection: a, doc: o } = t, { $from: s, $to: c } = a, l = i.extensionManager.attributes, u = Gl(l, s.node().type.name, s.node().attrs);
|
|
8521
|
-
if (a instanceof
|
|
8521
|
+
if (a instanceof k && a.node.isBlock) return !s.parentOffset || !E(o, s.pos) ? !1 : (r && (e && gu(n, i.extensionManager.splittableMarks), t.split(s.pos).scrollIntoView()), !0);
|
|
8522
8522
|
if (!s.parent.isBlock) return !1;
|
|
8523
8523
|
let d = c.parentOffset === c.parent.content.size, f = s.depth === 0 ? void 0 : ol(s.node(-1).contentMatchAt(s.indexAfter(-1))), p = d && f ? [{
|
|
8524
8524
|
type: f,
|
|
8525
8525
|
attrs: u
|
|
8526
|
-
}] : void 0, m =
|
|
8527
|
-
if (!p && !m &&
|
|
8526
|
+
}] : void 0, m = E(t.doc, t.mapping.map(s.pos), 1, p);
|
|
8527
|
+
if (!p && !m && E(t.doc, t.mapping.map(s.pos), 1, f ? [{ type: f }] : void 0) && (m = !0, p = f ? [{
|
|
8528
8528
|
type: f,
|
|
8529
8529
|
attrs: u
|
|
8530
8530
|
}] : void 0), r) {
|
|
8531
|
-
if (m && (a instanceof
|
|
8531
|
+
if (m && (a instanceof O && t.deleteSelection(), t.split(t.mapping.map(s.pos), 1, p), f && !d && !s.parentOffset && s.parent.type !== f)) {
|
|
8532
8532
|
let e = t.mapping.map(s.before()), n = t.doc.resolve(e);
|
|
8533
8533
|
s.node(-1).canReplaceWith(n.index(), n.index() + 1, f) && t.setNodeMarkup(t.mapping.map(s.before()), f);
|
|
8534
8534
|
}
|
|
@@ -8557,7 +8557,7 @@ var _u = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
8557
8557
|
n.doc.nodesBetween(d, n.doc.content.size, (e, t) => {
|
|
8558
8558
|
if (f > -1) return !1;
|
|
8559
8559
|
e.isTextblock && e.content.size === 0 && (f = t + 1);
|
|
8560
|
-
}), f > -1 && n.setSelection(
|
|
8560
|
+
}), f > -1 && n.setSelection(O.near(n.doc.resolve(f))), n.scrollIntoView();
|
|
8561
8561
|
}
|
|
8562
8562
|
return !0;
|
|
8563
8563
|
}
|
|
@@ -8579,7 +8579,7 @@ var _u = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
8579
8579
|
type: s,
|
|
8580
8580
|
attrs: h
|
|
8581
8581
|
}];
|
|
8582
|
-
if (!
|
|
8582
|
+
if (!E(n.doc, c.pos, 2)) return !1;
|
|
8583
8583
|
if (a) {
|
|
8584
8584
|
let { selection: e, storedMarks: t } = i, { splittableMarks: r } = o.extensionManager, s = t || e.$to.parentOffset && e.$from.marks();
|
|
8585
8585
|
if (n.split(c.pos, 2, _).scrollIntoView(), !s || !a) return !0;
|
|
@@ -8593,20 +8593,20 @@ var _u = ({ keepMarks: e = !0 } = {}) => ({ tr: t, state: n, dispatch: r, editor
|
|
|
8593
8593
|
let r = e.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
|
|
8594
8594
|
if (r === void 0) return !0;
|
|
8595
8595
|
let i = e.doc.nodeAt(r);
|
|
8596
|
-
return n.node.type === i?.type &&
|
|
8596
|
+
return n.node.type === i?.type && Rt(e.doc, n.pos) && e.join(n.pos), !0;
|
|
8597
8597
|
}, bu = (e, t) => {
|
|
8598
8598
|
let n = ul((e) => e.type === t)(e.selection);
|
|
8599
8599
|
if (!n) return !0;
|
|
8600
8600
|
let r = e.doc.resolve(n.start).after(n.depth);
|
|
8601
8601
|
if (r === void 0) return !0;
|
|
8602
8602
|
let i = e.doc.nodeAt(r);
|
|
8603
|
-
return n.node.type === i?.type &&
|
|
8603
|
+
return n.node.type === i?.type && Rt(e.doc, r) && e.join(r), !0;
|
|
8604
8604
|
};
|
|
8605
8605
|
function xu(e) {
|
|
8606
8606
|
let t = e.doc, n = t.firstChild;
|
|
8607
8607
|
if (!n) return null;
|
|
8608
8608
|
let r = t.resolve(1), i = t.resolve(n.nodeSize - 1);
|
|
8609
|
-
return
|
|
8609
|
+
return O.between(r, i);
|
|
8610
8610
|
}
|
|
8611
8611
|
var Su = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain: c, commands: l, can: u }) => {
|
|
8612
8612
|
let { extensions: d, splittableMarks: f } = i.extensionManager, p = J(e, o.schema), m = J(t, o.schema), { selection: h, storedMarks: g } = o, { $from: _, $to: v } = h, y = _.blockRange(v), b = g || h.$to.parentOffset && h.$from.marks();
|
|
@@ -8615,13 +8615,13 @@ var Su = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
8615
8615
|
node: re,
|
|
8616
8616
|
pos: 0,
|
|
8617
8617
|
depth: 0
|
|
8618
|
-
} : null,
|
|
8619
|
-
if ((
|
|
8620
|
-
if (
|
|
8618
|
+
} : null, ae = ee ?? ie, oe = !!ee && y.depth >= 1 && y.depth - ee.depth <= 1, x = !!ie;
|
|
8619
|
+
if ((oe || x) && ae) {
|
|
8620
|
+
if (ae.node.type === p) return te && x ? c().command(({ tr: e, dispatch: t }) => {
|
|
8621
8621
|
let n = xu(e);
|
|
8622
8622
|
return n ? (e.setSelection(n), t && t(e), !0) : !1;
|
|
8623
8623
|
}).liftListItem(m).run() : l.liftListItem(m);
|
|
8624
|
-
if (Ql(
|
|
8624
|
+
if (Ql(ae.node.type.name, d) && p.validContent(ae.node.content)) return c().command(() => (a.setNodeMarkup(ae.pos, p), !0)).command(() => yu(a, p)).command(() => bu(a, p)).run();
|
|
8625
8625
|
}
|
|
8626
8626
|
return !n || !b || !s ? c().command(() => u().wrapInList(p, r) ? !0 : l.clearNodes()).wrapInList(p, r).command(() => yu(a, p)).command(() => bu(a, p)).run() : c().command(() => {
|
|
8627
8627
|
let e = u().wrapInList(p, r), t = b.filter((e) => f.includes(e.type.name));
|
|
@@ -8710,7 +8710,7 @@ var Su = (e, t, n, r = {}) => ({ editor: i, tr: a, state: o, dispatch: s, chain:
|
|
|
8710
8710
|
}));
|
|
8711
8711
|
}));
|
|
8712
8712
|
}), c;
|
|
8713
|
-
}, ju = (e, t = {}) => ({ state: n, dispatch: r }) =>
|
|
8713
|
+
}, ju = (e, t = {}) => ({ state: n, dispatch: r }) => lr(J(e, n.schema), t)(n, r), Mu = (e, t = {}) => ({ state: n, dispatch: r }) => gr(J(e, n.schema), t)(n, r), Nu = class {
|
|
8714
8714
|
constructor() {
|
|
8715
8715
|
this.callbacks = {};
|
|
8716
8716
|
}
|
|
@@ -8781,7 +8781,7 @@ function Iu(e) {
|
|
|
8781
8781
|
}), l;
|
|
8782
8782
|
}
|
|
8783
8783
|
function Lu(e) {
|
|
8784
|
-
let { editor: t, rules: n } = e, i = new
|
|
8784
|
+
let { editor: t, rules: n } = e, i = new j({
|
|
8785
8785
|
state: {
|
|
8786
8786
|
init() {
|
|
8787
8787
|
return null;
|
|
@@ -8987,7 +8987,7 @@ function Yu(e) {
|
|
|
8987
8987
|
return s = typeof ClipboardEvent < "u" ? new ClipboardEvent("paste") : null, o;
|
|
8988
8988
|
}
|
|
8989
8989
|
};
|
|
8990
|
-
return n.map((e) => new
|
|
8990
|
+
return n.map((e) => new j({
|
|
8991
8991
|
view(e) {
|
|
8992
8992
|
let n = (n) => {
|
|
8993
8993
|
i = e.dom.parentElement?.contains(n.target) ? e.dom.parentElement : null, i && (qu = t);
|
|
@@ -9261,8 +9261,8 @@ var $ = class e extends Vu {
|
|
|
9261
9261
|
return { blockSeparator: void 0 };
|
|
9262
9262
|
},
|
|
9263
9263
|
addProseMirrorPlugins() {
|
|
9264
|
-
return [new
|
|
9265
|
-
key: new
|
|
9264
|
+
return [new j({
|
|
9265
|
+
key: new Mn("clipboardTextSerializer"),
|
|
9266
9266
|
props: { clipboardTextSerializer: () => {
|
|
9267
9267
|
let { editor: e } = this, { state: t, schema: n } = e, { doc: r, selection: i } = t, { ranges: a } = i, o = Math.min(...a.map((e) => e.$from.pos)), s = Math.max(...a.map((e) => e.$to.pos)), c = Pl(n);
|
|
9268
9268
|
return Ml(r, {
|
|
@@ -9308,7 +9308,7 @@ var $ = class e extends Vu {
|
|
|
9308
9308
|
});
|
|
9309
9309
|
let i = r.mapping;
|
|
9310
9310
|
r.steps.forEach((t, n) => {
|
|
9311
|
-
if (t instanceof
|
|
9311
|
+
if (t instanceof _t) {
|
|
9312
9312
|
let a = i.slice(n).map(t.from, -1), o = i.slice(n).map(t.to), s = i.invert().map(a, -1), c = i.invert().map(o), l = a > 0 ? r.doc.nodeAt(a - 1)?.marks.some((e) => e.eq(t.mark)) : !1, u = r.doc.nodeAt(o)?.marks.some((e) => e.eq(t.mark));
|
|
9313
9313
|
this.editor.emit("delete", {
|
|
9314
9314
|
type: "mark",
|
|
@@ -9336,8 +9336,8 @@ var $ = class e extends Vu {
|
|
|
9336
9336
|
}), td = $.create({
|
|
9337
9337
|
name: "drop",
|
|
9338
9338
|
addProseMirrorPlugins() {
|
|
9339
|
-
return [new
|
|
9340
|
-
key: new
|
|
9339
|
+
return [new j({
|
|
9340
|
+
key: new Mn("tiptapDrop"),
|
|
9341
9341
|
props: { handleDrop: (e, t, n, r) => {
|
|
9342
9342
|
this.editor.emit("drop", {
|
|
9343
9343
|
editor: this.editor,
|
|
@@ -9351,16 +9351,16 @@ var $ = class e extends Vu {
|
|
|
9351
9351
|
}), nd = $.create({
|
|
9352
9352
|
name: "editable",
|
|
9353
9353
|
addProseMirrorPlugins() {
|
|
9354
|
-
return [new
|
|
9355
|
-
key: new
|
|
9354
|
+
return [new j({
|
|
9355
|
+
key: new Mn("editable"),
|
|
9356
9356
|
props: { editable: () => this.editor.options.editable }
|
|
9357
9357
|
})];
|
|
9358
9358
|
}
|
|
9359
|
-
}), rd = new
|
|
9359
|
+
}), rd = new Mn("focusEvents"), id = $.create({
|
|
9360
9360
|
name: "focusEvents",
|
|
9361
9361
|
addProseMirrorPlugins() {
|
|
9362
9362
|
let { editor: e } = this;
|
|
9363
|
-
return [new
|
|
9363
|
+
return [new j({
|
|
9364
9364
|
key: rd,
|
|
9365
9365
|
props: { handleDOMEvents: {
|
|
9366
9366
|
focus: (t, n) => {
|
|
@@ -9382,7 +9382,7 @@ var $ = class e extends Vu {
|
|
|
9382
9382
|
let e = () => this.editor.commands.first(({ commands: e }) => [
|
|
9383
9383
|
() => e.undoInputRule(),
|
|
9384
9384
|
() => e.command(({ tr: t }) => {
|
|
9385
|
-
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos :
|
|
9385
|
+
let { selection: n, doc: r } = t, { empty: i, $anchor: a } = n, { pos: o, parent: s } = a, c = a.parent.isTextblock && o > 0 ? t.doc.resolve(o - 1) : a, l = c.parent.type.spec.isolating, u = a.pos - a.parentOffset, d = l && c.parent.childCount === 1 ? u === a.pos : D.atStart(r).from === o;
|
|
9386
9386
|
return !i || !s.type.isTextblock || s.textContent.length || !d || d && a.parent.type.name === "paragraph" ? !1 : e.clearNodes();
|
|
9387
9387
|
}),
|
|
9388
9388
|
() => e.deleteSelection(),
|
|
@@ -9421,13 +9421,13 @@ var $ = class e extends Vu {
|
|
|
9421
9421
|
return yc() || Rc() ? i : r;
|
|
9422
9422
|
},
|
|
9423
9423
|
addProseMirrorPlugins() {
|
|
9424
|
-
return [new
|
|
9425
|
-
key: new
|
|
9424
|
+
return [new j({
|
|
9425
|
+
key: new Mn("clearDocument"),
|
|
9426
9426
|
appendTransaction: (e, t, n) => {
|
|
9427
9427
|
if (e.some((e) => e.getMeta("composition"))) return;
|
|
9428
9428
|
let r = e.some((e) => e.docChanged) && !t.doc.eq(n.doc), i = e.some((e) => e.getMeta("preventClearDocument"));
|
|
9429
9429
|
if (!r || i) return;
|
|
9430
|
-
let { empty: a, from: o, to: s } = t.selection, c =
|
|
9430
|
+
let { empty: a, from: o, to: s } = t.selection, c = D.atStart(t.doc).from, l = D.atEnd(t.doc).to;
|
|
9431
9431
|
if (a || !(o === c && s === l) || !$l(n.doc)) return;
|
|
9432
9432
|
let u = n.tr, d = Js({
|
|
9433
9433
|
state: n,
|
|
@@ -9443,8 +9443,8 @@ var $ = class e extends Vu {
|
|
|
9443
9443
|
}), od = $.create({
|
|
9444
9444
|
name: "paste",
|
|
9445
9445
|
addProseMirrorPlugins() {
|
|
9446
|
-
return [new
|
|
9447
|
-
key: new
|
|
9446
|
+
return [new j({
|
|
9447
|
+
key: new Mn("tiptapPaste"),
|
|
9448
9448
|
props: { handlePaste: (e, t, n) => {
|
|
9449
9449
|
this.editor.emit("paste", {
|
|
9450
9450
|
editor: this.editor,
|
|
@@ -9460,8 +9460,8 @@ var $ = class e extends Vu {
|
|
|
9460
9460
|
return { value: void 0 };
|
|
9461
9461
|
},
|
|
9462
9462
|
addProseMirrorPlugins() {
|
|
9463
|
-
return [new
|
|
9464
|
-
key: new
|
|
9463
|
+
return [new j({
|
|
9464
|
+
key: new Mn("tabindex"),
|
|
9465
9465
|
props: { attributes: () => !this.editor.isEditable && this.options.value === void 0 ? {} : { tabindex: this.options.value ?? "0" } }
|
|
9466
9466
|
})];
|
|
9467
9467
|
}
|
|
@@ -9486,8 +9486,8 @@ var $ = class e extends Vu {
|
|
|
9486
9486
|
}];
|
|
9487
9487
|
},
|
|
9488
9488
|
addProseMirrorPlugins() {
|
|
9489
|
-
return [new
|
|
9490
|
-
key: new
|
|
9489
|
+
return [new j({
|
|
9490
|
+
key: new Mn("textDirection"),
|
|
9491
9491
|
props: { attributes: () => {
|
|
9492
9492
|
let e = this.options.direction;
|
|
9493
9493
|
return e ? { dir: e } : {};
|
|
@@ -9662,7 +9662,7 @@ var fd = class extends Nu {
|
|
|
9662
9662
|
createMappablePosition: iu
|
|
9663
9663
|
}, this.setOptions(e), this.createExtensionManager(), this.createCommandManager(), this.createSchema(), this.on("beforeCreate", this.options.onBeforeCreate), this.emit("beforeCreate", { editor: this }), this.on("mount", this.options.onMount), this.on("unmount", this.options.onUnmount), this.on("contentError", this.options.onContentError), this.on("create", this.options.onCreate), this.on("update", this.options.onUpdate), this.on("selectionUpdate", this.options.onSelectionUpdate), this.on("transaction", this.options.onTransaction), this.on("focus", this.options.onFocus), this.on("blur", this.options.onBlur), this.on("destroy", this.options.onDestroy), this.on("drop", ({ event: e, slice: t, moved: n }) => this.options.onDrop(e, t, n)), this.on("paste", ({ event: e, slice: t }) => this.options.onPaste(e, t)), this.on("delete", this.options.onDelete);
|
|
9664
9664
|
let t = this.createDoc(), n = _c(t, this.options.autofocus);
|
|
9665
|
-
this.editorState =
|
|
9665
|
+
this.editorState = On.create({
|
|
9666
9666
|
doc: t,
|
|
9667
9667
|
schema: this.schema,
|
|
9668
9668
|
selection: n || void 0
|
|
@@ -9980,7 +9980,7 @@ function _d(e) {
|
|
|
9980
9980
|
return new Pu({
|
|
9981
9981
|
find: e.find,
|
|
9982
9982
|
handler: ({ state: t, range: n, match: r, chain: i }) => {
|
|
9983
|
-
let a = Q(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s &&
|
|
9983
|
+
let a = Q(e.getAttributes, void 0, r) || {}, o = t.tr.delete(n.from, n.to), s = o.doc.resolve(n.from).blockRange(), c = s && Dt(s, e.type, a);
|
|
9984
9984
|
if (!c) return null;
|
|
9985
9985
|
if (o.wrap(s, c), e.keepMarks && e.editor) {
|
|
9986
9986
|
let { selection: n, storedMarks: r } = t, { splittableMarks: i } = e.editor.extensionManager, a = r || n.$to.parentOffset && n.$from.marks();
|
|
@@ -9994,7 +9994,7 @@ function _d(e) {
|
|
|
9994
9994
|
i().updateAttributes(t, a).run();
|
|
9995
9995
|
}
|
|
9996
9996
|
let l = o.doc.resolve(n.from - 1).nodeBefore;
|
|
9997
|
-
l && l.type === e.type &&
|
|
9997
|
+
l && l.type === e.type && Rt(o.doc, n.from - 1) && (!e.joinPredicate || e.joinPredicate(r, l)) && o.join(n.from - 1);
|
|
9998
9998
|
},
|
|
9999
9999
|
undoable: e.undoable
|
|
10000
10000
|
});
|
|
@@ -10144,7 +10144,7 @@ var yd = (e, t) => {
|
|
|
10144
10144
|
}, Sd = xd;
|
|
10145
10145
|
function Cd(e, t) {
|
|
10146
10146
|
let { selection: n } = e, { $from: r } = n;
|
|
10147
|
-
if (n instanceof
|
|
10147
|
+
if (n instanceof k) {
|
|
10148
10148
|
let e = r.index();
|
|
10149
10149
|
return r.parent.canReplaceWith(e, e + 1, t);
|
|
10150
10150
|
}
|
|
@@ -10567,7 +10567,7 @@ var Wd = class {
|
|
|
10567
10567
|
}
|
|
10568
10568
|
let l = this.getPos();
|
|
10569
10569
|
if (typeof l != "number") return;
|
|
10570
|
-
let u =
|
|
10570
|
+
let u = k.create(n.state.doc, l), d = n.state.tr.setSelection(u);
|
|
10571
10571
|
n.dispatch(d);
|
|
10572
10572
|
}
|
|
10573
10573
|
stopEvent(e) {
|
|
@@ -10582,7 +10582,7 @@ var Wd = class {
|
|
|
10582
10582
|
"SELECT",
|
|
10583
10583
|
"TEXTAREA"
|
|
10584
10584
|
].includes(t.tagName) || t.isContentEditable) && !i && !n) return !0;
|
|
10585
|
-
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c =
|
|
10585
|
+
let { isEditable: a } = this.editor, { isDragging: o } = this, s = !!this.node.type.spec.draggable, c = k.isSelectable(this.node), l = e.type === "copy", u = e.type === "paste", d = e.type === "cut", f = e.type === "mousedown";
|
|
10586
10586
|
if (!s && c && n && e.target === this.dom && e.preventDefault(), s && n && !o && e.target === this.dom) return e.preventDefault(), !1;
|
|
10587
10587
|
if (s && a && !o && f) {
|
|
10588
10588
|
let e = t.closest("[data-drag-handle]");
|
|
@@ -10678,4 +10678,4 @@ var Xd = class {
|
|
|
10678
10678
|
}
|
|
10679
10679
|
};
|
|
10680
10680
|
//#endregion
|
|
10681
|
-
export { il as $, Rd as $t, Ed as A, Rc as At, ul as B, kd as Bt, Pd as C,
|
|
10681
|
+
export { il as $, Rd as $t, Ed as A, Rc as At, ul as B, kd as Bt, Pd as C, D as Cn, Yl as Ct, iu as D, r as Dn, Od as Dt, Ld as E, Wt as En, Zl as Et, wd as F, tu as Ft, jl as G, Ad as Gt, dl as H, yc as Ht, Zu as I, Uu as It, gl as J, X as Jt, Fl as K, yl as Kt, sl as L, zu as Lt, qc as M, Vc as Mt, Tc as N, $l as Nt, Ec as O, l as On, pl as Ot, Dd as P, eu as Pt, fl as Q, jd as Qt, cl as R, lc as Rt, Nd as S, Mn as Sn, vc as St, nl as T, pt as Tn, ml as Tt, xl as U, pd as Ut, ll as V, gc as Vt, Al as W, qd as Wt, Vl as X, Jd as Xt, Bl as Y, md as Yt, Z, uc as Zt, Q as _, Gs as _n, ru as _t, vd as a, _c as an, J as at, al as b, k as bn, Lu as bt, Hu as c, Dc as cn, Tl as ct, ld as d, hl as dn, Gl as dt, Yu as en, pc as et, Kd as f, gd as fn, Td as ft, Xd as g, _d as gn, Pl as gt, Sd as h, Ud as hn, Kl as ht, $ as i, Ol as in, Il as it, ol as j, ql as jt, dd as k, Ql as kt, Wd as l, Md as ln, Wl as lt, xd as m, hd as mn, Ml as mt, fd as n, Rl as nn, Hl as nt, Pu as o, su as on, bl as ot, Wu as p, Yd as pn, Nl as pt, Ll as q, Bu as qt, Vu as r, zd as rn, Ul as rt, nu as s, Vd as sn, kl as st, Ys as t, au as tn, Y as tt, Gd as u, Dl as un, Kc as ut, Cd as v, Uo as vn, yd as vt, Js as w, O as wn, Xl as wt, Xs as x, j as xn, Jl as xt, Hd as y, G as yn, Sl as yt, El as z, bc as zt };
|