@templatical/editor 0.10.0 → 0.10.2
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-D30WPhbv.js → AiChatSidebar-BMwpZx-6.js} +14 -14
- package/dist/{AiFeatureMenu-B5CJX5zr.js → AiFeatureMenu-xgaIGUCo.js} +8 -8
- package/dist/{BlockIssueBadge-CkB4Yyz2.js → BlockIssueBadge-3kNs6WoD.js} +5 -5
- package/dist/{CloudEditor-nT-R769W.js → CloudEditor-Dm9hiaui.js} +159 -156
- package/dist/{CollaboratorBar-CwhlXODK.js → CollaboratorBar-Cz_evoU4.js} +4 -4
- package/dist/{CommentsSidebar-gpZMMI5w.js → CommentsSidebar-jFZj_CTo.js} +13 -13
- package/dist/{CountdownBlock-BNvuXucv.js → CountdownBlock-S-SCyVye.js} +4 -4
- package/dist/{CountdownToolbar-Dl82DAmI.js → CountdownToolbar-Ckdo-3P-.js} +3 -3
- package/dist/{DesignReferenceSidebar-Bs5AMxVd.js → DesignReferenceSidebar-B9QNPZNV.js} +10 -10
- package/dist/{IssuesPanel-CqQa2BtU.js → IssuesPanel-_E_fbSM8.js} +8 -8
- package/dist/{LoadingTrack-xCOLUR3o.js → LoadingTrack-BZ5KJyZ_.js} +2 -2
- package/dist/{ModuleBrowserModal-BWWgF0LC.js → ModuleBrowserModal-BB22urqi.js} +10 -10
- package/dist/{ModulePreviewCanvas-D7Tk5HOt.js → ModulePreviewCanvas-CH5OdXv8.js} +3 -3
- package/dist/{NumberWithSuffix-DVy5HxMi.js → NumberWithSuffix-BHDXHMpo.js} +3 -3
- package/dist/{ParagraphEditor-DVSGdMOo.js → ParagraphEditor-BmY7LLgN.js} +26 -26
- package/dist/{RichTextEditorContent-DN-fRjMa.js → RichTextEditorContent-COijbaWp.js} +8 -8
- package/dist/{SaveModuleDialog-CkEYkyVD.js → SaveModuleDialog-D5WN-je_.js} +7 -7
- package/dist/{SnapshotHistory-Nx9wrlbF.js → SnapshotHistory-BQ55Rhri.js} +9 -9
- package/dist/{TemplateScoringPanel-BG9M-29t.js → TemplateScoringPanel-Dhf_Qgr7.js} +15 -15
- package/dist/{TestEmailModal-CRjtEs6S.js → TestEmailModal-DH_Viz_m.js} +5 -5
- package/dist/{TitleEditor-CvtV4pCA.js → TitleEditor-Dn613K8o.js} +12 -12
- package/dist/{TplModal-BudEYVcJ.js → TplModal-Dxa3rhHI.js} +4 -4
- package/dist/{blockTypeIcons-Dd-UvfnC.js → blockTypeIcons-CrcSCTD6.js} +2 -2
- package/dist/bundle-stats.json +6 -6
- package/dist/cdn/chunks/{AiFeatureMenu-DKOv8VnB.js → AiFeatureMenu-CCsgxyN9.js} +4 -4
- package/dist/cdn/chunks/{AiFeatureMenu-DKOv8VnB.js.map → AiFeatureMenu-CCsgxyN9.js.map} +1 -1
- package/dist/cdn/chunks/{BlockIssueBadge-DpiSTwM7.js → BlockIssueBadge-Lc3NWFV8.js} +3 -3
- package/dist/cdn/chunks/{BlockIssueBadge-DpiSTwM7.js.map → BlockIssueBadge-Lc3NWFV8.js.map} +1 -1
- package/dist/cdn/chunks/{CloudEditor-xc_uOEgn.js → CloudEditor-KkwvBhyt.js} +131 -128
- package/dist/cdn/chunks/CloudEditor-KkwvBhyt.js.map +1 -0
- package/dist/cdn/chunks/{CollaboratorBar-VWfPri_h.js → CollaboratorBar-BGIGiFSm.js} +4 -4
- package/dist/cdn/chunks/{CollaboratorBar-VWfPri_h.js.map → CollaboratorBar-BGIGiFSm.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownBlock-BKsCWboK.js → CountdownBlock-gqnpxKp_.js} +4 -4
- package/dist/cdn/chunks/{CountdownBlock-BKsCWboK.js.map → CountdownBlock-gqnpxKp_.js.map} +1 -1
- package/dist/cdn/chunks/{CountdownToolbar-BLtECDNb.js → CountdownToolbar-xHpaWQE2.js} +4 -4
- package/dist/cdn/chunks/{CountdownToolbar-BLtECDNb.js.map → CountdownToolbar-xHpaWQE2.js.map} +1 -1
- package/dist/cdn/chunks/{IssuesPanel-BW2piyvs.js → IssuesPanel-DHTTHu65.js} +4 -4
- package/dist/cdn/chunks/{IssuesPanel-BW2piyvs.js.map → IssuesPanel-DHTTHu65.js.map} +1 -1
- package/dist/cdn/chunks/{ModuleBrowserModal-TLlKpvjX.js → ModuleBrowserModal-DDTjrKph.js} +6 -6
- package/dist/cdn/chunks/{ModuleBrowserModal-TLlKpvjX.js.map → ModuleBrowserModal-DDTjrKph.js.map} +1 -1
- package/dist/cdn/chunks/{ModulePreviewCanvas-wu7y-vrh.js → ModulePreviewCanvas-DeFq0hVi.js} +3 -3
- package/dist/cdn/chunks/{ModulePreviewCanvas-wu7y-vrh.js.map → ModulePreviewCanvas-DeFq0hVi.js.map} +1 -1
- package/dist/cdn/chunks/{NumberWithSuffix-DxoUtTMr.js → NumberWithSuffix-D4wtmU9O.js} +3 -3
- package/dist/cdn/chunks/{NumberWithSuffix-DxoUtTMr.js.map → NumberWithSuffix-D4wtmU9O.js.map} +1 -1
- package/dist/cdn/chunks/{ParagraphEditor-DvxIO2LN.js → ParagraphEditor-CwY8GeWa.js} +20 -20
- package/dist/cdn/chunks/{ParagraphEditor-DvxIO2LN.js.map → ParagraphEditor-CwY8GeWa.js.map} +1 -1
- package/dist/cdn/chunks/{RichTextEditorContent-Dm9GXJmo.js → RichTextEditorContent-C_bMURGF.js} +5 -5
- package/dist/cdn/chunks/{RichTextEditorContent-Dm9GXJmo.js.map → RichTextEditorContent-C_bMURGF.js.map} +1 -1
- package/dist/cdn/chunks/{SaveModuleDialog-BRAdVcYM.js → SaveModuleDialog-DEi8PSP6.js} +3 -3
- package/dist/cdn/chunks/{SaveModuleDialog-BRAdVcYM.js.map → SaveModuleDialog-DEi8PSP6.js.map} +1 -1
- package/dist/cdn/chunks/{TitleEditor-D3gPRd0x.js → TitleEditor-Betpo8AZ.js} +9 -9
- package/dist/cdn/chunks/{TitleEditor-D3gPRd0x.js.map → TitleEditor-Betpo8AZ.js.map} +1 -1
- package/dist/cdn/chunks/{blockTypeIcons-C2cm4RjU.js → blockTypeIcons-Xz6OBq3U.js} +3 -3
- package/dist/cdn/chunks/{blockTypeIcons-C2cm4RjU.js.map → blockTypeIcons-Xz6OBq3U.js.map} +1 -1
- package/dist/cdn/chunks/{draggable-BwWMFq33.js → draggable-BTGr7_-X.js} +1271 -1270
- package/dist/cdn/chunks/draggable-BTGr7_-X.js.map +1 -0
- package/dist/cdn/chunks/{extensions-SS1ywPUR.js → extensions-D_j4UWxi.js} +108 -105
- package/dist/cdn/chunks/{extensions-SS1ywPUR.js.map → extensions-D_j4UWxi.js.map} +1 -1
- package/dist/cdn/chunks/{features-CwZTdcbt.js → features-A28DQtjE.js} +831 -820
- package/dist/cdn/chunks/features-A28DQtjE.js.map +1 -0
- package/dist/cdn/chunks/{icons-CbNEr1kc.js → icons-C9D3N0-J.js} +12 -12
- package/dist/cdn/chunks/{icons-CbNEr1kc.js.map → icons-C9D3N0-J.js.map} +1 -1
- package/dist/cdn/chunks/{liquid.browser-rMoPo2t_.js → liquid.browser-DUDc3U21.js} +10 -10
- package/dist/cdn/chunks/{liquid.browser-rMoPo2t_.js.map → liquid.browser-DUDc3U21.js.map} +1 -1
- package/dist/cdn/chunks/{media-library-BRpHZOl7.js → media-library-CH1Wx5wP.js} +13 -9
- package/dist/cdn/chunks/media-library-CH1Wx5wP.js.map +1 -0
- package/dist/cdn/chunks/pusher-CHo5Cua0.js.map +1 -1
- package/dist/cdn/chunks/{quality-BqJqIPRU.js → quality-D4NeyFej.js} +530 -530
- package/dist/cdn/chunks/{quality-BqJqIPRU.js.map → quality-D4NeyFej.js.map} +1 -1
- package/dist/cdn/chunks/{renderer-CGVYkdUi.js → renderer-BQnGfLhL.js} +62 -61
- package/dist/cdn/chunks/renderer-BQnGfLhL.js.map +1 -0
- package/dist/cdn/chunks/{src-CvzfrFlT.js → src-BkKEyLw1.js} +6 -6
- package/dist/cdn/chunks/{src-CvzfrFlT.js.map → src-BkKEyLw1.js.map} +1 -1
- package/dist/cdn/chunks/{styles-2P5yvfsS.js → styles-BDVaiw3K.js} +150 -150
- package/dist/cdn/chunks/{styles-2P5yvfsS.js.map → styles-BDVaiw3K.js.map} +1 -1
- package/dist/cdn/chunks/{tiptap-BBbH3IT9.js → tiptap-P5abGB13.js} +4437 -2580
- package/dist/cdn/chunks/tiptap-P5abGB13.js.map +1 -0
- package/dist/cdn/editor.css +1 -1
- package/dist/cdn/editor.js +100 -100
- package/dist/cdn/editor.js.map +1 -1
- package/dist/{check-ChQyfxJ3.js → check-KooI2jyS.js} +1 -1
- package/dist/{chevron-down-DJjo0jSV.js → chevron-down-mnlFgueW.js} +1 -1
- package/dist/{circle-alert-CPH6l3Lc.js → circle-alert-D89_hB8j.js} +1 -1
- package/dist/{clock-DHl_BIkU.js → clock-BaadyUrg.js} +1 -1
- package/dist/{cloud-BBC7bv8q.js → cloud-D-FScaHx.js} +80 -74
- package/dist/{createLucideIcon-XgXOJ05E.js → createLucideIcon-D-6fpD2L.js} +3 -3
- package/dist/{dist-DXaxGLsw.js → dist-BttO3Zdx.js} +44 -44
- package/dist/{dist-C8wMh_gi.js → dist-C1WcikEF.js} +5 -5
- package/dist/dist-CjULgTep.js +4072 -0
- package/dist/{dist-GAmhYvUK.js → dist-D6L_WdRL.js} +96 -86
- package/dist/{dist-DYO-w_Jf.js → dist-DaajG7Fo.js} +5 -5
- package/dist/dist-Df4eV6Zi.js +5 -0
- package/dist/{dist-D8C6jIXM.js → dist-Dnqx5UF3.js} +171 -158
- package/dist/{dist-CUpJmrjt.js → dist-Drp5bNAu.js} +5 -5
- package/dist/dist-WJ1fVd5b.js +5 -0
- package/dist/{dist-BxP6TB0l.js → dist-XA2i70J5.js} +8 -8
- package/dist/{dist-UK-lbEBc.js → dist-b52vYHb5.js} +2 -2
- package/dist/{dist-CNLAS2v2.js → dist-cl33Ip6W.js} +3 -3
- package/dist/{dist-C0jo8wtG.js → dist-sqf7pq5q.js} +16 -16
- package/dist/{dist-BzuC8o3y.js → dist-zInT3Lf6.js} +78 -60
- package/dist/{extensions-C87ZSllQ.js → extensions-DA-w1gVg.js} +128 -125
- package/dist/{image-up-CPBCOMit.js → image-up-DjwfAom6.js} +1 -1
- package/dist/{info-DIY9mguM.js → info-Db3HlTr8.js} +1 -1
- package/dist/{keys-Vt3XipJl.js → keys-BjmL5YCT.js} +1 -1
- package/dist/{liquid.browser-IgQrXHPQ.js → liquid.browser--qtl1Fqy.js} +9 -9
- package/dist/{list-checks-CSCyu3fH.js → list-checks-BlAB0X8a.js} +1 -1
- package/dist/{loader-circle-Rz_4vJLH.js → loader-circle-EVqyIxjU.js} +1 -1
- package/dist/{message-circle-D-umK_MU.js → message-circle-BuI5pBVG.js} +1 -1
- package/dist/{refresh-cw-CvWF4jfR.js → refresh-cw-C2vM_6zQ.js} +1 -1
- package/dist/{scan-line-wanvAFDr.js → scan-line-AUIh_SHI.js} +1 -1
- package/dist/{send-BhbhbIFT.js → send-nrbwF7xg.js} +1 -1
- package/dist/{shield-check-CXPPMWth.js → shield-check-B55Ozmva.js} +1 -1
- package/dist/{sparkles-CrUN0KWY.js → sparkles-oh1NUSFq.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{styles-DOjWbqA9.js → styles-Byhh107n.js} +41 -41
- package/dist/templatical-editor.js +81 -80
- package/dist/{text-align-end-Bkq8oBrD.js → text-align-start-B2MqzZwU.js} +11 -11
- package/dist/{trash-2-BpY5BCLT.js → trash-2-DH8RBwAx.js} +1 -1
- package/dist/{triangle-alert-MwJBKR2e.js → triangle-alert-BQHjCt3B.js} +1 -1
- package/dist/{useAliveFlag-BLyG8L4d.js → useAliveFlag-B_b9ubwD.js} +1 -1
- package/dist/{useCloudI18n-sRfoQCZY.js → useCloudI18n-BHCrmQgj.js} +2 -2
- package/dist/{useEditorCore-DxApq2hZ.js → useEditorCore-BEgc3KFu.js} +370 -377
- package/dist/{useI18n-lF6hYgZu.js → useI18n-Bb9-ha9X.js} +2 -2
- package/dist/{useMergeTag-CZVI7Xe5.js → useMergeTag-HykzEtBn.js} +3 -3
- package/dist/usePopoverRoot-BZDkRRry.js +8 -0
- package/dist/{vue.runtime.esm-bundler-BDSGA5hA.js → vue.runtime.esm-bundler-MzYCkFSH.js} +1306 -1305
- package/dist/{x-rcnxRG8Y.js → x-DgCCENgP.js} +1 -1
- package/package.json +27 -27
- package/dist/cdn/chunks/CloudEditor-xc_uOEgn.js.map +0 -1
- package/dist/cdn/chunks/draggable-BwWMFq33.js.map +0 -1
- package/dist/cdn/chunks/features-CwZTdcbt.js.map +0 -1
- package/dist/cdn/chunks/media-library-BRpHZOl7.js.map +0 -1
- package/dist/cdn/chunks/renderer-CGVYkdUi.js.map +0 -1
- package/dist/cdn/chunks/tiptap-BBbH3IT9.js.map +0 -1
- package/dist/dist-BDgf2G-V.js +0 -2243
- package/dist/dist-D5lmdi1F.js +0 -5
- package/dist/dist-DILjuzSv.js +0 -5
- package/dist/usePopoverRoot-p2BanBI7.js +0 -8
package/dist/dist-BDgf2G-V.js
DELETED
|
@@ -1,2243 +0,0 @@
|
|
|
1
|
-
import { Cn as e, Ct as t, En as n, Gt as r, Ht as i, Jt as a, Mt as o, Nt as s, Qt as c, Sn as l, St as u, Tn as d, Ut as f, X as p, _ as m, _n as h, at as ee, bn as g, c as _, fn as v, gn as y, hn as te, i as b, it as ne, jt as x, mn as S, nn as re, nt as ie, u as C, v as ae, vn as w, wn as oe, xn as T, yn as E } from "./dist-BzuC8o3y.js";
|
|
2
|
-
import { Link as se } from "./dist-DXaxGLsw.js";
|
|
3
|
-
import { Underline as ce } from "./dist-DYO-w_Jf.js";
|
|
4
|
-
//#region ../../node_modules/.pnpm/@tiptap+core@3.23.6_@tiptap+pm@3.23.6/node_modules/@tiptap/core/dist/jsx-runtime/jsx-runtime.js
|
|
5
|
-
var D = (e, t) => {
|
|
6
|
-
if (e === "slot") return 0;
|
|
7
|
-
if (e instanceof Function) return e(t);
|
|
8
|
-
let { children: n, ...r } = t ?? {};
|
|
9
|
-
if (e === "svg") throw Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");
|
|
10
|
-
return [
|
|
11
|
-
e,
|
|
12
|
-
r,
|
|
13
|
-
n
|
|
14
|
-
];
|
|
15
|
-
}, le = /^\s*>\s$/, ue = C.create({
|
|
16
|
-
name: "blockquote",
|
|
17
|
-
addOptions() {
|
|
18
|
-
return { HTMLAttributes: {} };
|
|
19
|
-
},
|
|
20
|
-
content: "block+",
|
|
21
|
-
group: "block",
|
|
22
|
-
defining: !0,
|
|
23
|
-
parseHTML() {
|
|
24
|
-
return [{ tag: "blockquote" }];
|
|
25
|
-
},
|
|
26
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
27
|
-
return /* @__PURE__ */ D("blockquote", {
|
|
28
|
-
...r(this.options.HTMLAttributes, e),
|
|
29
|
-
children: /* @__PURE__ */ D("slot", {})
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
parseMarkdown: (e, t) => {
|
|
33
|
-
let n = t.parseBlockChildren ?? t.parseChildren;
|
|
34
|
-
return t.createNode("blockquote", void 0, n(e.tokens || []));
|
|
35
|
-
},
|
|
36
|
-
renderMarkdown: (e, t) => {
|
|
37
|
-
if (!e.content) return "";
|
|
38
|
-
let n = [];
|
|
39
|
-
return e.content.forEach((e, r) => {
|
|
40
|
-
let i = (t.renderChild?.call(t, e, r) ?? t.renderChildren([e])).split("\n").map((e) => e.trim() === "" ? ">" : `> ${e}`);
|
|
41
|
-
n.push(i.join("\n"));
|
|
42
|
-
}), n.join("\n>\n");
|
|
43
|
-
},
|
|
44
|
-
addCommands() {
|
|
45
|
-
return {
|
|
46
|
-
setBlockquote: () => ({ commands: e }) => e.wrapIn(this.name),
|
|
47
|
-
toggleBlockquote: () => ({ commands: e }) => e.toggleWrap(this.name),
|
|
48
|
-
unsetBlockquote: () => ({ commands: e }) => e.lift(this.name)
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
addKeyboardShortcuts() {
|
|
52
|
-
return { "Mod-Shift-b": () => this.editor.commands.toggleBlockquote() };
|
|
53
|
-
},
|
|
54
|
-
addInputRules() {
|
|
55
|
-
return [S({
|
|
56
|
-
find: le,
|
|
57
|
-
type: this.type
|
|
58
|
-
})];
|
|
59
|
-
}
|
|
60
|
-
}), de = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, fe = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, pe = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, me = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, he = _.create({
|
|
61
|
-
name: "bold",
|
|
62
|
-
addOptions() {
|
|
63
|
-
return { HTMLAttributes: {} };
|
|
64
|
-
},
|
|
65
|
-
parseHTML() {
|
|
66
|
-
return [
|
|
67
|
-
{ tag: "strong" },
|
|
68
|
-
{
|
|
69
|
-
tag: "b",
|
|
70
|
-
getAttrs: (e) => e.style.fontWeight !== "normal" && null
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
style: "font-weight=400",
|
|
74
|
-
clearMark: (e) => e.type.name === this.name
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
style: "font-weight",
|
|
78
|
-
getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
|
|
79
|
-
}
|
|
80
|
-
];
|
|
81
|
-
},
|
|
82
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
83
|
-
return /* @__PURE__ */ D("strong", {
|
|
84
|
-
...r(this.options.HTMLAttributes, e),
|
|
85
|
-
children: /* @__PURE__ */ D("slot", {})
|
|
86
|
-
});
|
|
87
|
-
},
|
|
88
|
-
markdownTokenName: "strong",
|
|
89
|
-
parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
|
|
90
|
-
markdownOptions: { htmlReopen: {
|
|
91
|
-
open: "<strong>",
|
|
92
|
-
close: "</strong>"
|
|
93
|
-
} },
|
|
94
|
-
renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
|
|
95
|
-
addCommands() {
|
|
96
|
-
return {
|
|
97
|
-
setBold: () => ({ commands: e }) => e.setMark(this.name),
|
|
98
|
-
toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
99
|
-
unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
addKeyboardShortcuts() {
|
|
103
|
-
return {
|
|
104
|
-
"Mod-b": () => this.editor.commands.toggleBold(),
|
|
105
|
-
"Mod-B": () => this.editor.commands.toggleBold()
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
addInputRules() {
|
|
109
|
-
return [i({
|
|
110
|
-
find: de,
|
|
111
|
-
type: this.type
|
|
112
|
-
}), i({
|
|
113
|
-
find: pe,
|
|
114
|
-
type: this.type
|
|
115
|
-
})];
|
|
116
|
-
},
|
|
117
|
-
addPasteRules() {
|
|
118
|
-
return [f({
|
|
119
|
-
find: fe,
|
|
120
|
-
type: this.type
|
|
121
|
-
}), f({
|
|
122
|
-
find: me,
|
|
123
|
-
type: this.type
|
|
124
|
-
})];
|
|
125
|
-
}
|
|
126
|
-
}), ge = /(^|[^`])`([^`]+)`(?!`)$/, _e = /(^|[^`])`([^`]+)`(?!`)/g, ve = _.create({
|
|
127
|
-
name: "code",
|
|
128
|
-
addOptions() {
|
|
129
|
-
return { HTMLAttributes: {} };
|
|
130
|
-
},
|
|
131
|
-
excludes: "_",
|
|
132
|
-
code: !0,
|
|
133
|
-
exitable: !0,
|
|
134
|
-
parseHTML() {
|
|
135
|
-
return [{ tag: "code" }];
|
|
136
|
-
},
|
|
137
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
138
|
-
return [
|
|
139
|
-
"code",
|
|
140
|
-
r(this.options.HTMLAttributes, e),
|
|
141
|
-
0
|
|
142
|
-
];
|
|
143
|
-
},
|
|
144
|
-
markdownTokenName: "codespan",
|
|
145
|
-
parseMarkdown: (e, t) => t.applyMark("code", [{
|
|
146
|
-
type: "text",
|
|
147
|
-
text: e.text || ""
|
|
148
|
-
}]),
|
|
149
|
-
renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
|
|
150
|
-
addCommands() {
|
|
151
|
-
return {
|
|
152
|
-
setCode: () => ({ commands: e }) => e.setMark(this.name),
|
|
153
|
-
toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
154
|
-
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
155
|
-
};
|
|
156
|
-
},
|
|
157
|
-
addKeyboardShortcuts() {
|
|
158
|
-
return { "Mod-e": () => this.editor.commands.toggleCode() };
|
|
159
|
-
},
|
|
160
|
-
addInputRules() {
|
|
161
|
-
return [i({
|
|
162
|
-
find: ge,
|
|
163
|
-
type: this.type
|
|
164
|
-
})];
|
|
165
|
-
},
|
|
166
|
-
addPasteRules() {
|
|
167
|
-
return [f({
|
|
168
|
-
find: _e,
|
|
169
|
-
type: this.type
|
|
170
|
-
})];
|
|
171
|
-
}
|
|
172
|
-
}), O = 4, ye = /^```([a-z]+)?[\s\n]$/, be = /^~~~([a-z]+)?[\s\n]$/, xe = C.create({
|
|
173
|
-
name: "codeBlock",
|
|
174
|
-
addOptions() {
|
|
175
|
-
return {
|
|
176
|
-
languageClassPrefix: "language-",
|
|
177
|
-
exitOnTripleEnter: !0,
|
|
178
|
-
exitOnArrowDown: !0,
|
|
179
|
-
defaultLanguage: null,
|
|
180
|
-
enableTabIndentation: !1,
|
|
181
|
-
tabSize: O,
|
|
182
|
-
HTMLAttributes: {}
|
|
183
|
-
};
|
|
184
|
-
},
|
|
185
|
-
content: "text*",
|
|
186
|
-
marks: "",
|
|
187
|
-
group: "block",
|
|
188
|
-
code: !0,
|
|
189
|
-
defining: !0,
|
|
190
|
-
addAttributes() {
|
|
191
|
-
return { language: {
|
|
192
|
-
default: this.options.defaultLanguage,
|
|
193
|
-
parseHTML: (e) => {
|
|
194
|
-
let { languageClassPrefix: t } = this.options;
|
|
195
|
-
return t && [...e.firstElementChild?.classList || []].filter((e) => e.startsWith(t)).map((e) => e.replace(t, ""))[0] || null;
|
|
196
|
-
},
|
|
197
|
-
rendered: !1
|
|
198
|
-
} };
|
|
199
|
-
},
|
|
200
|
-
parseHTML() {
|
|
201
|
-
return [{
|
|
202
|
-
tag: "pre",
|
|
203
|
-
preserveWhitespace: "full"
|
|
204
|
-
}];
|
|
205
|
-
},
|
|
206
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
207
|
-
return [
|
|
208
|
-
"pre",
|
|
209
|
-
r(this.options.HTMLAttributes, t),
|
|
210
|
-
[
|
|
211
|
-
"code",
|
|
212
|
-
{ class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null },
|
|
213
|
-
0
|
|
214
|
-
]
|
|
215
|
-
];
|
|
216
|
-
},
|
|
217
|
-
markdownTokenName: "code",
|
|
218
|
-
parseMarkdown: (e, t) => e.raw?.startsWith("```") === !1 && e.raw?.startsWith("~~~") === !1 && e.codeBlockStyle !== "indented" ? [] : t.createNode("codeBlock", { language: e.lang || null }, e.text ? [t.createTextNode(e.text)] : []),
|
|
219
|
-
renderMarkdown: (e, t) => {
|
|
220
|
-
let n = "", r = e.attrs?.language || "";
|
|
221
|
-
return n = e.content ? [
|
|
222
|
-
`\`\`\`${r}`,
|
|
223
|
-
t.renderChildren(e.content),
|
|
224
|
-
"```"
|
|
225
|
-
].join("\n") : `\`\`\`${r}
|
|
226
|
-
|
|
227
|
-
\`\`\``, n;
|
|
228
|
-
},
|
|
229
|
-
addCommands() {
|
|
230
|
-
return {
|
|
231
|
-
setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
|
|
232
|
-
toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
|
|
233
|
-
};
|
|
234
|
-
},
|
|
235
|
-
addKeyboardShortcuts() {
|
|
236
|
-
return {
|
|
237
|
-
"Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
|
|
238
|
-
Backspace: () => {
|
|
239
|
-
let { empty: e, $anchor: t } = this.editor.state.selection, n = t.pos === 1;
|
|
240
|
-
return !e || t.parent.type.name !== this.name ? !1 : n || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
|
|
241
|
-
},
|
|
242
|
-
Tab: ({ editor: e }) => {
|
|
243
|
-
if (!this.options.enableTabIndentation) return !1;
|
|
244
|
-
let t = this.options.tabSize ?? O, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
|
|
245
|
-
if (i.parent.type !== this.type) return !1;
|
|
246
|
-
let o = " ".repeat(t);
|
|
247
|
-
return a ? e.commands.insertContent(o) : e.commands.command(({ tr: e }) => {
|
|
248
|
-
let { from: t, to: i } = r, a = n.doc.textBetween(t, i, "\n", "\n").split("\n").map((e) => o + e).join("\n");
|
|
249
|
-
return e.replaceWith(t, i, n.schema.text(a)), !0;
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
"Shift-Tab": ({ editor: e }) => {
|
|
253
|
-
if (!this.options.enableTabIndentation) return !1;
|
|
254
|
-
let t = this.options.tabSize ?? O, { state: n } = e, { selection: r } = n, { $from: i, empty: a } = r;
|
|
255
|
-
return i.parent.type === this.type ? a ? e.commands.command(({ tr: e }) => {
|
|
256
|
-
let { pos: r } = i, a = i.start(), o = i.end(), s = n.doc.textBetween(a, o, "\n", "\n").split("\n"), c = 0, u = 0, d = r - a;
|
|
257
|
-
for (let e = 0; e < s.length; e += 1) {
|
|
258
|
-
if (u + s[e].length >= d) {
|
|
259
|
-
c = e;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
u += s[e].length + 1;
|
|
263
|
-
}
|
|
264
|
-
let f = s[c].match(/^ */)?.[0] || "", p = Math.min(f.length, t);
|
|
265
|
-
if (p === 0) return !0;
|
|
266
|
-
let m = a;
|
|
267
|
-
for (let e = 0; e < c; e += 1) m += s[e].length + 1;
|
|
268
|
-
return e.delete(m, m + p), r - m <= p && e.setSelection(l.create(e.doc, m)), !0;
|
|
269
|
-
}) : e.commands.command(({ tr: e }) => {
|
|
270
|
-
let { from: i, to: a } = r, o = n.doc.textBetween(i, a, "\n", "\n").split("\n").map((e) => {
|
|
271
|
-
let n = e.match(/^ */)?.[0] || "", r = Math.min(n.length, t);
|
|
272
|
-
return e.slice(r);
|
|
273
|
-
}).join("\n");
|
|
274
|
-
return e.replaceWith(i, a, n.schema.text(o)), !0;
|
|
275
|
-
}) : !1;
|
|
276
|
-
},
|
|
277
|
-
Enter: ({ editor: e }) => {
|
|
278
|
-
if (!this.options.exitOnTripleEnter) return !1;
|
|
279
|
-
let { state: t } = e, { selection: n } = t, { $from: r, empty: i } = n;
|
|
280
|
-
if (!i || r.parent.type !== this.type) return !1;
|
|
281
|
-
let a = r.parentOffset === r.parent.nodeSize - 2, o = r.parent.textContent.endsWith("\n\n");
|
|
282
|
-
return !a || !o ? !1 : e.chain().command(({ tr: e }) => (e.delete(r.pos - 2, r.pos), !0)).exitCode().run();
|
|
283
|
-
},
|
|
284
|
-
ArrowDown: ({ editor: e }) => {
|
|
285
|
-
if (!this.options.exitOnArrowDown) return !1;
|
|
286
|
-
let { state: t } = e, { selection: n, doc: r } = t, { $from: i, empty: a } = n;
|
|
287
|
-
if (!a || i.parent.type !== this.type || i.parentOffset !== i.parent.nodeSize - 2) return !1;
|
|
288
|
-
let o = i.after();
|
|
289
|
-
return o === void 0 ? !1 : r.nodeAt(o) ? e.commands.command(({ tr: e }) => (e.setSelection(T.near(r.resolve(o))), !0)) : e.commands.exitCode();
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
},
|
|
293
|
-
addInputRules() {
|
|
294
|
-
return [v({
|
|
295
|
-
find: ye,
|
|
296
|
-
type: this.type,
|
|
297
|
-
getAttributes: (e) => ({ language: e[1] })
|
|
298
|
-
}), v({
|
|
299
|
-
find: be,
|
|
300
|
-
type: this.type,
|
|
301
|
-
getAttributes: (e) => ({ language: e[1] })
|
|
302
|
-
})];
|
|
303
|
-
},
|
|
304
|
-
addProseMirrorPlugins() {
|
|
305
|
-
return [new E({
|
|
306
|
-
key: new g("codeBlockVSCodeHandler"),
|
|
307
|
-
props: { handlePaste: (e, t) => {
|
|
308
|
-
if (!t.clipboardData || this.editor.isActive(this.type.name)) return !1;
|
|
309
|
-
let n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), i = (r ? JSON.parse(r) : void 0)?.mode;
|
|
310
|
-
if (!n || !i) return !1;
|
|
311
|
-
let { tr: a, schema: o } = e.state, s = o.text(n.replace(/\r\n?/g, "\n"));
|
|
312
|
-
return a.replaceSelectionWith(this.type.create({ language: i }, s)), a.selection.$from.parent.type !== this.type && a.setSelection(l.near(a.doc.resolve(Math.max(0, a.selection.from - 2)))), a.setMeta("paste", !0), e.dispatch(a), !0;
|
|
313
|
-
} }
|
|
314
|
-
})];
|
|
315
|
-
}
|
|
316
|
-
}), Se = C.create({
|
|
317
|
-
name: "doc",
|
|
318
|
-
topNode: !0,
|
|
319
|
-
content: "block+",
|
|
320
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n\n") : ""
|
|
321
|
-
}), Ce = C.create({
|
|
322
|
-
name: "hardBreak",
|
|
323
|
-
markdownTokenName: "br",
|
|
324
|
-
addOptions() {
|
|
325
|
-
return {
|
|
326
|
-
keepMarks: !0,
|
|
327
|
-
HTMLAttributes: {}
|
|
328
|
-
};
|
|
329
|
-
},
|
|
330
|
-
inline: !0,
|
|
331
|
-
group: "inline",
|
|
332
|
-
selectable: !1,
|
|
333
|
-
linebreakReplacement: !0,
|
|
334
|
-
parseHTML() {
|
|
335
|
-
return [{ tag: "br" }];
|
|
336
|
-
},
|
|
337
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
338
|
-
return ["br", r(this.options.HTMLAttributes, e)];
|
|
339
|
-
},
|
|
340
|
-
renderText() {
|
|
341
|
-
return "\n";
|
|
342
|
-
},
|
|
343
|
-
renderMarkdown: () => " \n",
|
|
344
|
-
parseMarkdown: () => ({ type: "hardBreak" }),
|
|
345
|
-
addCommands() {
|
|
346
|
-
return { setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([() => e.exitCode(), () => e.command(() => {
|
|
347
|
-
let { selection: e, storedMarks: i } = n;
|
|
348
|
-
if (e.$from.parent.type.spec.isolating) return !1;
|
|
349
|
-
let { keepMarks: a } = this.options, { splittableMarks: o } = r.extensionManager, s = i || e.$to.parentOffset && e.$from.marks();
|
|
350
|
-
return t().insertContent({ type: this.name }).command(({ tr: e, dispatch: t }) => {
|
|
351
|
-
if (t && s && a) {
|
|
352
|
-
let t = s.filter((e) => o.includes(e.type.name));
|
|
353
|
-
e.ensureMarks(t);
|
|
354
|
-
}
|
|
355
|
-
return !0;
|
|
356
|
-
}).run();
|
|
357
|
-
})]) };
|
|
358
|
-
},
|
|
359
|
-
addKeyboardShortcuts() {
|
|
360
|
-
return {
|
|
361
|
-
"Mod-Enter": () => this.editor.commands.setHardBreak(),
|
|
362
|
-
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
363
|
-
};
|
|
364
|
-
}
|
|
365
|
-
}), we = C.create({
|
|
366
|
-
name: "heading",
|
|
367
|
-
addOptions() {
|
|
368
|
-
return {
|
|
369
|
-
levels: [
|
|
370
|
-
1,
|
|
371
|
-
2,
|
|
372
|
-
3,
|
|
373
|
-
4,
|
|
374
|
-
5,
|
|
375
|
-
6
|
|
376
|
-
],
|
|
377
|
-
HTMLAttributes: {}
|
|
378
|
-
};
|
|
379
|
-
},
|
|
380
|
-
content: "inline*",
|
|
381
|
-
group: "block",
|
|
382
|
-
defining: !0,
|
|
383
|
-
addAttributes() {
|
|
384
|
-
return { level: {
|
|
385
|
-
default: 1,
|
|
386
|
-
rendered: !1
|
|
387
|
-
} };
|
|
388
|
-
},
|
|
389
|
-
parseHTML() {
|
|
390
|
-
return this.options.levels.map((e) => ({
|
|
391
|
-
tag: `h${e}`,
|
|
392
|
-
attrs: { level: e }
|
|
393
|
-
}));
|
|
394
|
-
},
|
|
395
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
396
|
-
return [
|
|
397
|
-
`h${this.options.levels.includes(e.attrs.level) ? e.attrs.level : this.options.levels[0]}`,
|
|
398
|
-
r(this.options.HTMLAttributes, t),
|
|
399
|
-
0
|
|
400
|
-
];
|
|
401
|
-
},
|
|
402
|
-
parseMarkdown: (e, t) => t.createNode("heading", { level: e.depth || 1 }, t.parseInline(e.tokens || [])),
|
|
403
|
-
renderMarkdown: (e, t) => {
|
|
404
|
-
let n = e.attrs?.level ? parseInt(e.attrs.level, 10) : 1, r = "#".repeat(n);
|
|
405
|
-
return e.content ? `${r} ${t.renderChildren(e.content)}` : "";
|
|
406
|
-
},
|
|
407
|
-
addCommands() {
|
|
408
|
-
return {
|
|
409
|
-
setHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.setNode(this.name, e) : !1,
|
|
410
|
-
toggleHeading: (e) => ({ commands: t }) => this.options.levels.includes(e.level) ? t.toggleNode(this.name, "paragraph", e) : !1
|
|
411
|
-
};
|
|
412
|
-
},
|
|
413
|
-
addKeyboardShortcuts() {
|
|
414
|
-
return this.options.levels.reduce((e, t) => ({
|
|
415
|
-
...e,
|
|
416
|
-
[`Mod-Alt-${t}`]: () => this.editor.commands.toggleHeading({ level: t })
|
|
417
|
-
}), {});
|
|
418
|
-
},
|
|
419
|
-
addInputRules() {
|
|
420
|
-
return this.options.levels.map((e) => v({
|
|
421
|
-
find: RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),
|
|
422
|
-
type: this.type,
|
|
423
|
-
getAttributes: { level: e }
|
|
424
|
-
}));
|
|
425
|
-
}
|
|
426
|
-
}), Te = C.create({
|
|
427
|
-
name: "horizontalRule",
|
|
428
|
-
addOptions() {
|
|
429
|
-
return {
|
|
430
|
-
HTMLAttributes: {},
|
|
431
|
-
nextNodeType: "paragraph"
|
|
432
|
-
};
|
|
433
|
-
},
|
|
434
|
-
group: "block",
|
|
435
|
-
parseHTML() {
|
|
436
|
-
return [{ tag: "hr" }];
|
|
437
|
-
},
|
|
438
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
439
|
-
return ["hr", r(this.options.HTMLAttributes, e)];
|
|
440
|
-
},
|
|
441
|
-
markdownTokenName: "hr",
|
|
442
|
-
parseMarkdown: (e, t) => t.createNode("horizontalRule"),
|
|
443
|
-
renderMarkdown: () => "---",
|
|
444
|
-
addCommands() {
|
|
445
|
-
return { setHorizontalRule: () => ({ chain: e, state: t }) => {
|
|
446
|
-
if (!ae(t, t.schema.nodes[this.name])) return !1;
|
|
447
|
-
let { selection: n } = t, { $to: r } = n, i = e();
|
|
448
|
-
return s(n) ? i.insertContentAt(r.pos, { type: this.name }) : i.insertContent({ type: this.name }), i.command(({ state: e, tr: t, dispatch: n }) => {
|
|
449
|
-
if (n) {
|
|
450
|
-
let { $to: n } = t.selection, r = n.end();
|
|
451
|
-
if (n.nodeAfter) n.nodeAfter.isTextblock ? t.setSelection(l.create(t.doc, n.pos + 1)) : n.nodeAfter.isBlock ? t.setSelection(w.create(t.doc, n.pos)) : t.setSelection(l.create(t.doc, n.pos));
|
|
452
|
-
else {
|
|
453
|
-
let i = (e.schema.nodes[this.options.nextNodeType] || n.parent.type.contentMatch.defaultType)?.create();
|
|
454
|
-
i && (t.insert(r, i), t.setSelection(l.create(t.doc, r + 1)));
|
|
455
|
-
}
|
|
456
|
-
t.scrollIntoView();
|
|
457
|
-
}
|
|
458
|
-
return !0;
|
|
459
|
-
}).run();
|
|
460
|
-
} };
|
|
461
|
-
},
|
|
462
|
-
addInputRules() {
|
|
463
|
-
return [a({
|
|
464
|
-
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
465
|
-
type: this.type
|
|
466
|
-
})];
|
|
467
|
-
}
|
|
468
|
-
}), Ee = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, De = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, Oe = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, ke = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Ae = _.create({
|
|
469
|
-
name: "italic",
|
|
470
|
-
addOptions() {
|
|
471
|
-
return { HTMLAttributes: {} };
|
|
472
|
-
},
|
|
473
|
-
parseHTML() {
|
|
474
|
-
return [
|
|
475
|
-
{ tag: "em" },
|
|
476
|
-
{
|
|
477
|
-
tag: "i",
|
|
478
|
-
getAttrs: (e) => e.style.fontStyle !== "normal" && null
|
|
479
|
-
},
|
|
480
|
-
{
|
|
481
|
-
style: "font-style=normal",
|
|
482
|
-
clearMark: (e) => e.type.name === this.name
|
|
483
|
-
},
|
|
484
|
-
{ style: "font-style=italic" }
|
|
485
|
-
];
|
|
486
|
-
},
|
|
487
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
488
|
-
return [
|
|
489
|
-
"em",
|
|
490
|
-
r(this.options.HTMLAttributes, e),
|
|
491
|
-
0
|
|
492
|
-
];
|
|
493
|
-
},
|
|
494
|
-
addCommands() {
|
|
495
|
-
return {
|
|
496
|
-
setItalic: () => ({ commands: e }) => e.setMark(this.name),
|
|
497
|
-
toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
498
|
-
unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
499
|
-
};
|
|
500
|
-
},
|
|
501
|
-
markdownTokenName: "em",
|
|
502
|
-
parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
|
|
503
|
-
markdownOptions: { htmlReopen: {
|
|
504
|
-
open: "<em>",
|
|
505
|
-
close: "</em>"
|
|
506
|
-
} },
|
|
507
|
-
renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
|
|
508
|
-
addKeyboardShortcuts() {
|
|
509
|
-
return {
|
|
510
|
-
"Mod-i": () => this.editor.commands.toggleItalic(),
|
|
511
|
-
"Mod-I": () => this.editor.commands.toggleItalic()
|
|
512
|
-
};
|
|
513
|
-
},
|
|
514
|
-
addInputRules() {
|
|
515
|
-
return [i({
|
|
516
|
-
find: Ee,
|
|
517
|
-
type: this.type
|
|
518
|
-
}), i({
|
|
519
|
-
find: Oe,
|
|
520
|
-
type: this.type
|
|
521
|
-
})];
|
|
522
|
-
},
|
|
523
|
-
addPasteRules() {
|
|
524
|
-
return [f({
|
|
525
|
-
find: De,
|
|
526
|
-
type: this.type
|
|
527
|
-
}), f({
|
|
528
|
-
find: ke,
|
|
529
|
-
type: this.type
|
|
530
|
-
})];
|
|
531
|
-
}
|
|
532
|
-
}), je = Object.defineProperty, Me = (e, t) => {
|
|
533
|
-
for (var n in t) je(e, n, {
|
|
534
|
-
get: t[n],
|
|
535
|
-
enumerable: !0
|
|
536
|
-
});
|
|
537
|
-
}, Ne = "listItem", k = "textStyle", A = /^\s*([-+*])\s$/, j = C.create({
|
|
538
|
-
name: "bulletList",
|
|
539
|
-
addOptions() {
|
|
540
|
-
return {
|
|
541
|
-
itemTypeName: "listItem",
|
|
542
|
-
HTMLAttributes: {},
|
|
543
|
-
keepMarks: !1,
|
|
544
|
-
keepAttributes: !1
|
|
545
|
-
};
|
|
546
|
-
},
|
|
547
|
-
group: "block list",
|
|
548
|
-
content() {
|
|
549
|
-
return `${this.options.itemTypeName}+`;
|
|
550
|
-
},
|
|
551
|
-
parseHTML() {
|
|
552
|
-
return [{ tag: "ul" }];
|
|
553
|
-
},
|
|
554
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
555
|
-
return [
|
|
556
|
-
"ul",
|
|
557
|
-
r(this.options.HTMLAttributes, e),
|
|
558
|
-
0
|
|
559
|
-
];
|
|
560
|
-
},
|
|
561
|
-
markdownTokenName: "list",
|
|
562
|
-
parseMarkdown: (e, t) => e.type !== "list" || e.ordered ? [] : {
|
|
563
|
-
type: "bulletList",
|
|
564
|
-
content: e.items ? t.parseChildren(e.items) : []
|
|
565
|
-
},
|
|
566
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
|
|
567
|
-
markdownOptions: { indentsContent: !0 },
|
|
568
|
-
addCommands() {
|
|
569
|
-
return { toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Ne, this.editor.getAttributes(k)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
570
|
-
},
|
|
571
|
-
addKeyboardShortcuts() {
|
|
572
|
-
return { "Mod-Shift-8": () => this.editor.commands.toggleBulletList() };
|
|
573
|
-
},
|
|
574
|
-
addInputRules() {
|
|
575
|
-
let e = S({
|
|
576
|
-
find: A,
|
|
577
|
-
type: this.type
|
|
578
|
-
});
|
|
579
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (e = S({
|
|
580
|
-
find: A,
|
|
581
|
-
type: this.type,
|
|
582
|
-
keepMarks: this.options.keepMarks,
|
|
583
|
-
keepAttributes: this.options.keepAttributes,
|
|
584
|
-
getAttributes: () => this.editor.getAttributes(k),
|
|
585
|
-
editor: this.editor
|
|
586
|
-
})), [e];
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
function Pe(e) {
|
|
590
|
-
let t = e.tokens?.[0];
|
|
591
|
-
return !!(e.text && e.tokens?.length === 1 && t?.type === "list" && t.ordered && t.raw === e.text);
|
|
592
|
-
}
|
|
593
|
-
function Fe(e, t) {
|
|
594
|
-
return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([{
|
|
595
|
-
type: "text",
|
|
596
|
-
raw: e,
|
|
597
|
-
text: e
|
|
598
|
-
}]);
|
|
599
|
-
}
|
|
600
|
-
var M = C.create({
|
|
601
|
-
name: "listItem",
|
|
602
|
-
addOptions() {
|
|
603
|
-
return {
|
|
604
|
-
HTMLAttributes: {},
|
|
605
|
-
bulletListTypeName: "bulletList",
|
|
606
|
-
orderedListTypeName: "orderedList"
|
|
607
|
-
};
|
|
608
|
-
},
|
|
609
|
-
content: "paragraph block*",
|
|
610
|
-
defining: !0,
|
|
611
|
-
parseHTML() {
|
|
612
|
-
return [{ tag: "li" }];
|
|
613
|
-
},
|
|
614
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
615
|
-
return [
|
|
616
|
-
"li",
|
|
617
|
-
r(this.options.HTMLAttributes, e),
|
|
618
|
-
0
|
|
619
|
-
];
|
|
620
|
-
},
|
|
621
|
-
markdownTokenName: "list_item",
|
|
622
|
-
parseMarkdown: (e, t) => {
|
|
623
|
-
if (e.type !== "list_item") return [];
|
|
624
|
-
let n = t.parseBlockChildren ?? t.parseChildren, r = [];
|
|
625
|
-
if (e.tokens && e.tokens.length > 0) {
|
|
626
|
-
if (Pe(e)) return {
|
|
627
|
-
type: "listItem",
|
|
628
|
-
content: [{
|
|
629
|
-
type: "paragraph",
|
|
630
|
-
content: Fe(e.text || "", t)
|
|
631
|
-
}]
|
|
632
|
-
};
|
|
633
|
-
if (e.tokens.some((e) => e.type === "paragraph")) r = n(e.tokens);
|
|
634
|
-
else {
|
|
635
|
-
let i = e.tokens[0];
|
|
636
|
-
if (i && i.type === "text" && i.tokens && i.tokens.length > 0) {
|
|
637
|
-
if (r = [{
|
|
638
|
-
type: "paragraph",
|
|
639
|
-
content: t.parseInline(i.tokens)
|
|
640
|
-
}], e.tokens.length > 1) {
|
|
641
|
-
let t = n(e.tokens.slice(1));
|
|
642
|
-
r.push(...t);
|
|
643
|
-
}
|
|
644
|
-
} else r = n(e.tokens);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
return r.length === 0 && (r = [{
|
|
648
|
-
type: "paragraph",
|
|
649
|
-
content: []
|
|
650
|
-
}]), {
|
|
651
|
-
type: "listItem",
|
|
652
|
-
content: r
|
|
653
|
-
};
|
|
654
|
-
},
|
|
655
|
-
renderMarkdown: (e, t, n) => re(e, t, (e) => e.parentType === "bulletList" ? "- " : e.parentType === "orderedList" ? `${(e.meta?.parentAttrs?.start || 1) + e.index}. ` : "- ", n),
|
|
656
|
-
addKeyboardShortcuts() {
|
|
657
|
-
return {
|
|
658
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
659
|
-
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
660
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
661
|
-
};
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
Me({}, {
|
|
665
|
-
findListItemPos: () => N,
|
|
666
|
-
getNextListDepth: () => P,
|
|
667
|
-
handleBackspace: () => I,
|
|
668
|
-
handleDelete: () => R,
|
|
669
|
-
hasListBefore: () => F,
|
|
670
|
-
hasListItemAfter: () => ze,
|
|
671
|
-
hasListItemBefore: () => Ie,
|
|
672
|
-
listItemHasSubList: () => Le,
|
|
673
|
-
nextListIsDeeper: () => Re,
|
|
674
|
-
nextListIsHigher: () => L
|
|
675
|
-
});
|
|
676
|
-
var N = (e, t) => {
|
|
677
|
-
let { $from: n } = t.selection, r = ne(e, t.schema), i = null, a = n.depth, o = n.pos, s = null;
|
|
678
|
-
for (; a > 0 && s === null;) i = n.node(a), i.type === r ? s = a : (--a, --o);
|
|
679
|
-
return s === null ? null : {
|
|
680
|
-
$pos: t.doc.resolve(o),
|
|
681
|
-
depth: s
|
|
682
|
-
};
|
|
683
|
-
}, P = (e, t) => {
|
|
684
|
-
let n = N(e, t);
|
|
685
|
-
if (!n) return !1;
|
|
686
|
-
let [, r] = ie(t, e, n.$pos.pos + 4);
|
|
687
|
-
return r;
|
|
688
|
-
}, F = (e, t, n) => {
|
|
689
|
-
let { $anchor: r } = e.selection, i = Math.max(0, r.pos - 2), a = e.doc.resolve(i).node();
|
|
690
|
-
return !(!a || !n.includes(a.type.name));
|
|
691
|
-
}, Ie = (e, t) => {
|
|
692
|
-
let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - 2);
|
|
693
|
-
return !(r.index() === 0 || r.nodeBefore?.type.name !== e);
|
|
694
|
-
}, Le = (e, t, n) => {
|
|
695
|
-
if (!n) return !1;
|
|
696
|
-
let r = ne(e, t.schema), i = !1;
|
|
697
|
-
return n.descendants((e) => {
|
|
698
|
-
e.type === r && (i = !0);
|
|
699
|
-
}), i;
|
|
700
|
-
}, I = (e, n, r) => {
|
|
701
|
-
if (e.commands.undoInputRule()) return !0;
|
|
702
|
-
if (e.state.selection.from !== e.state.selection.to) return !1;
|
|
703
|
-
if (!x(e.state, n) && F(e.state, n, r)) {
|
|
704
|
-
let { $anchor: t } = e.state.selection, r = e.state.doc.resolve(t.before() - 1), i = [];
|
|
705
|
-
r.node().descendants((e, t) => {
|
|
706
|
-
e.type.name === n && i.push({
|
|
707
|
-
node: e,
|
|
708
|
-
pos: t
|
|
709
|
-
});
|
|
710
|
-
});
|
|
711
|
-
let a = i.at(-1);
|
|
712
|
-
if (!a) return !1;
|
|
713
|
-
let o = e.state.doc.resolve(r.start() + a.pos + 1);
|
|
714
|
-
return e.chain().cut({
|
|
715
|
-
from: t.start() - 1,
|
|
716
|
-
to: t.end() + 1
|
|
717
|
-
}, o.end()).joinForward().run();
|
|
718
|
-
}
|
|
719
|
-
if (!x(e.state, n) || !t(e.state)) return !1;
|
|
720
|
-
let i = N(n, e.state);
|
|
721
|
-
if (!i) return !1;
|
|
722
|
-
let a = e.state.doc.resolve(i.$pos.pos - 2).node(i.depth), o = Le(n, e.state, a);
|
|
723
|
-
return Ie(n, e.state) && !o ? e.commands.joinItemBackward() : e.chain().liftListItem(n).run();
|
|
724
|
-
}, Re = (e, t) => {
|
|
725
|
-
let n = P(e, t), r = N(e, t);
|
|
726
|
-
return !r || !n ? !1 : n > r.depth;
|
|
727
|
-
}, L = (e, t) => {
|
|
728
|
-
let n = P(e, t), r = N(e, t);
|
|
729
|
-
return !r || !n ? !1 : n < r.depth;
|
|
730
|
-
}, R = (e, t) => {
|
|
731
|
-
if (!x(e.state, t) || !u(e.state, t)) return !1;
|
|
732
|
-
let { selection: n } = e.state, { $from: r, $to: i } = n;
|
|
733
|
-
return !n.empty && r.sameParent(i) ? !1 : Re(t, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(t).joinBackward().run() : L(t, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
|
|
734
|
-
}, ze = (e, t) => {
|
|
735
|
-
let { $anchor: n } = t.selection, r = t.doc.resolve(n.pos - n.parentOffset - 2);
|
|
736
|
-
return !(r.index() === r.parent.childCount - 1 || r.nodeAfter?.type.name !== e);
|
|
737
|
-
}, Be = b.create({
|
|
738
|
-
name: "listKeymap",
|
|
739
|
-
addOptions() {
|
|
740
|
-
return { listTypes: [{
|
|
741
|
-
itemName: "listItem",
|
|
742
|
-
wrapperNames: ["bulletList", "orderedList"]
|
|
743
|
-
}, {
|
|
744
|
-
itemName: "taskItem",
|
|
745
|
-
wrapperNames: ["taskList"]
|
|
746
|
-
}] };
|
|
747
|
-
},
|
|
748
|
-
addKeyboardShortcuts() {
|
|
749
|
-
return {
|
|
750
|
-
Delete: ({ editor: e }) => {
|
|
751
|
-
let t = !1;
|
|
752
|
-
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
753
|
-
e.state.schema.nodes[n] !== void 0 && R(e, n) && (t = !0);
|
|
754
|
-
}), t;
|
|
755
|
-
},
|
|
756
|
-
"Mod-Delete": ({ editor: e }) => {
|
|
757
|
-
let t = !1;
|
|
758
|
-
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
759
|
-
e.state.schema.nodes[n] !== void 0 && R(e, n) && (t = !0);
|
|
760
|
-
}), t;
|
|
761
|
-
},
|
|
762
|
-
Backspace: ({ editor: e }) => {
|
|
763
|
-
let t = !1;
|
|
764
|
-
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
765
|
-
e.state.schema.nodes[n] !== void 0 && I(e, n, r) && (t = !0);
|
|
766
|
-
}), t;
|
|
767
|
-
},
|
|
768
|
-
"Mod-Backspace": ({ editor: e }) => {
|
|
769
|
-
let t = !1;
|
|
770
|
-
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
771
|
-
e.state.schema.nodes[n] !== void 0 && I(e, n, r) && (t = !0);
|
|
772
|
-
}), t;
|
|
773
|
-
}
|
|
774
|
-
};
|
|
775
|
-
}
|
|
776
|
-
}), Ve = /^(\s*)(\d+)\.\s+(.*)$/, He = /^\s/;
|
|
777
|
-
function Ue(e) {
|
|
778
|
-
let t = e.trimStart();
|
|
779
|
-
return /^[-+*]\s+/.test(t) || /^\d+\.\s+/.test(t) || /^>\s?/.test(t) || /^```/.test(t) || /^~~~/.test(t);
|
|
780
|
-
}
|
|
781
|
-
function We(e) {
|
|
782
|
-
let t = [], n = [], r = !1;
|
|
783
|
-
return e.forEach((e) => {
|
|
784
|
-
if (r) {
|
|
785
|
-
n.push(e);
|
|
786
|
-
return;
|
|
787
|
-
}
|
|
788
|
-
if (e.trim() === "") {
|
|
789
|
-
r = !0, n.push(e);
|
|
790
|
-
return;
|
|
791
|
-
}
|
|
792
|
-
if (t.length > 0 && Ue(e)) {
|
|
793
|
-
r = !0, n.push(e);
|
|
794
|
-
return;
|
|
795
|
-
}
|
|
796
|
-
t.push(e);
|
|
797
|
-
}), {
|
|
798
|
-
paragraphLines: t,
|
|
799
|
-
blockLines: n
|
|
800
|
-
};
|
|
801
|
-
}
|
|
802
|
-
function Ge(e) {
|
|
803
|
-
let t = [], n = 0, r = 0;
|
|
804
|
-
for (; n < e.length;) {
|
|
805
|
-
let i = e[n], a = i.match(Ve);
|
|
806
|
-
if (!a) break;
|
|
807
|
-
let [, o, s, c] = a, l = o.length, u = [c], d = n + 1, f = [i], p = !1;
|
|
808
|
-
for (; d < e.length;) {
|
|
809
|
-
let t = e[d];
|
|
810
|
-
if (t.match(Ve)) break;
|
|
811
|
-
if (t.trim() === "") f.push(t), u.push(""), p = !0, d += 1;
|
|
812
|
-
else if (t.match(He)) f.push(t), u.push(t.slice(l + 2)), d += 1;
|
|
813
|
-
else {
|
|
814
|
-
if (p) break;
|
|
815
|
-
f.push(t), u.push(t), d += 1;
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
t.push({
|
|
819
|
-
indent: l,
|
|
820
|
-
number: parseInt(s, 10),
|
|
821
|
-
content: u.join("\n").trim(),
|
|
822
|
-
contentLines: u,
|
|
823
|
-
raw: f.join("\n")
|
|
824
|
-
}), r = d, n = d;
|
|
825
|
-
}
|
|
826
|
-
return [t, r];
|
|
827
|
-
}
|
|
828
|
-
function Ke(e, t, n) {
|
|
829
|
-
let r = [], i = 0;
|
|
830
|
-
for (; i < e.length;) {
|
|
831
|
-
let a = e[i];
|
|
832
|
-
if (a.indent === t) {
|
|
833
|
-
let { paragraphLines: o, blockLines: s } = We(a.contentLines), c = o.join("\n").trim(), l = [];
|
|
834
|
-
c && l.push({
|
|
835
|
-
type: "paragraph",
|
|
836
|
-
raw: c,
|
|
837
|
-
tokens: n.inlineTokens(c)
|
|
838
|
-
});
|
|
839
|
-
let u = s.join("\n").trim();
|
|
840
|
-
if (u) {
|
|
841
|
-
let e = n.blockTokens(u);
|
|
842
|
-
l.push(...e);
|
|
843
|
-
}
|
|
844
|
-
let d = i + 1, f = [];
|
|
845
|
-
for (; d < e.length && e[d].indent > t;) f.push(e[d]), d += 1;
|
|
846
|
-
if (f.length > 0) {
|
|
847
|
-
let e = Ke(f, Math.min(...f.map((e) => e.indent)), n);
|
|
848
|
-
l.push({
|
|
849
|
-
type: "list",
|
|
850
|
-
ordered: !0,
|
|
851
|
-
start: f[0].number,
|
|
852
|
-
items: e,
|
|
853
|
-
raw: f.map((e) => e.raw).join("\n")
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
r.push({
|
|
857
|
-
type: "list_item",
|
|
858
|
-
raw: a.raw,
|
|
859
|
-
tokens: l
|
|
860
|
-
}), i = d;
|
|
861
|
-
} else i += 1;
|
|
862
|
-
}
|
|
863
|
-
return r;
|
|
864
|
-
}
|
|
865
|
-
function qe(e, t) {
|
|
866
|
-
return e.map((e) => {
|
|
867
|
-
if (e.type !== "list_item") return t.parseChildren([e])[0];
|
|
868
|
-
let n = [];
|
|
869
|
-
return e.tokens && e.tokens.length > 0 && e.tokens.forEach((e) => {
|
|
870
|
-
if (e.type === "paragraph" || e.type === "list" || e.type === "blockquote" || e.type === "code") n.push(...t.parseChildren([e]));
|
|
871
|
-
else if (e.type === "text" && e.tokens) {
|
|
872
|
-
let r = t.parseChildren([e]);
|
|
873
|
-
n.push({
|
|
874
|
-
type: "paragraph",
|
|
875
|
-
content: r
|
|
876
|
-
});
|
|
877
|
-
} else {
|
|
878
|
-
let r = t.parseChildren([e]);
|
|
879
|
-
r.length > 0 && n.push(...r);
|
|
880
|
-
}
|
|
881
|
-
}), {
|
|
882
|
-
type: "listItem",
|
|
883
|
-
content: n
|
|
884
|
-
};
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
|
-
var Je = "listItem", Ye = "textStyle", Xe = /^(\d+)\.\s$/, Ze = C.create({
|
|
888
|
-
name: "orderedList",
|
|
889
|
-
addOptions() {
|
|
890
|
-
return {
|
|
891
|
-
itemTypeName: "listItem",
|
|
892
|
-
HTMLAttributes: {},
|
|
893
|
-
keepMarks: !1,
|
|
894
|
-
keepAttributes: !1
|
|
895
|
-
};
|
|
896
|
-
},
|
|
897
|
-
group: "block list",
|
|
898
|
-
content() {
|
|
899
|
-
return `${this.options.itemTypeName}+`;
|
|
900
|
-
},
|
|
901
|
-
addAttributes() {
|
|
902
|
-
return {
|
|
903
|
-
start: {
|
|
904
|
-
default: 1,
|
|
905
|
-
parseHTML: (e) => e.hasAttribute("start") ? parseInt(e.getAttribute("start") || "", 10) : 1
|
|
906
|
-
},
|
|
907
|
-
type: {
|
|
908
|
-
default: null,
|
|
909
|
-
parseHTML: (e) => e.getAttribute("type")
|
|
910
|
-
}
|
|
911
|
-
};
|
|
912
|
-
},
|
|
913
|
-
parseHTML() {
|
|
914
|
-
return [{ tag: "ol" }];
|
|
915
|
-
},
|
|
916
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
917
|
-
let { start: t, ...n } = e;
|
|
918
|
-
return t === 1 ? [
|
|
919
|
-
"ol",
|
|
920
|
-
r(this.options.HTMLAttributes, n),
|
|
921
|
-
0
|
|
922
|
-
] : [
|
|
923
|
-
"ol",
|
|
924
|
-
r(this.options.HTMLAttributes, e),
|
|
925
|
-
0
|
|
926
|
-
];
|
|
927
|
-
},
|
|
928
|
-
markdownTokenName: "list",
|
|
929
|
-
parseMarkdown: (e, t) => {
|
|
930
|
-
if (e.type !== "list" || !e.ordered) return [];
|
|
931
|
-
let n = e.start || 1, r = e.items ? qe(e.items, t) : [];
|
|
932
|
-
return n === 1 ? {
|
|
933
|
-
type: "orderedList",
|
|
934
|
-
content: r
|
|
935
|
-
} : {
|
|
936
|
-
type: "orderedList",
|
|
937
|
-
attrs: { start: n },
|
|
938
|
-
content: r
|
|
939
|
-
};
|
|
940
|
-
},
|
|
941
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
|
|
942
|
-
markdownTokenizer: {
|
|
943
|
-
name: "orderedList",
|
|
944
|
-
level: "block",
|
|
945
|
-
start: (e) => {
|
|
946
|
-
let t = e.match(/^(\s*)(\d+)\.\s+/)?.index;
|
|
947
|
-
return t === void 0 ? -1 : t;
|
|
948
|
-
},
|
|
949
|
-
tokenize: (e, t, n) => {
|
|
950
|
-
let r = e.split("\n"), [i, a] = Ge(r);
|
|
951
|
-
if (i.length === 0) return;
|
|
952
|
-
let o = Ke(i, 0, n);
|
|
953
|
-
if (o.length !== 0) return {
|
|
954
|
-
type: "list",
|
|
955
|
-
ordered: !0,
|
|
956
|
-
start: i[0]?.number || 1,
|
|
957
|
-
items: o,
|
|
958
|
-
raw: r.slice(0, a).join("\n")
|
|
959
|
-
};
|
|
960
|
-
}
|
|
961
|
-
},
|
|
962
|
-
markdownOptions: { indentsContent: !0 },
|
|
963
|
-
addCommands() {
|
|
964
|
-
return { toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(Je, this.editor.getAttributes(Ye)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks) };
|
|
965
|
-
},
|
|
966
|
-
addKeyboardShortcuts() {
|
|
967
|
-
return { "Mod-Shift-7": () => this.editor.commands.toggleOrderedList() };
|
|
968
|
-
},
|
|
969
|
-
addInputRules() {
|
|
970
|
-
let e = S({
|
|
971
|
-
find: Xe,
|
|
972
|
-
type: this.type,
|
|
973
|
-
getAttributes: (e) => ({ start: +e[1] }),
|
|
974
|
-
joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1]
|
|
975
|
-
});
|
|
976
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (e = S({
|
|
977
|
-
find: Xe,
|
|
978
|
-
type: this.type,
|
|
979
|
-
keepMarks: this.options.keepMarks,
|
|
980
|
-
keepAttributes: this.options.keepAttributes,
|
|
981
|
-
getAttributes: (e) => ({
|
|
982
|
-
start: +e[1],
|
|
983
|
-
...this.editor.getAttributes(Ye)
|
|
984
|
-
}),
|
|
985
|
-
joinPredicate: (e, t) => t.childCount + t.attrs.start === +e[1],
|
|
986
|
-
editor: this.editor
|
|
987
|
-
})), [e];
|
|
988
|
-
}
|
|
989
|
-
}), Qe = /^\s*(\[([( |x])?\])\s$/, $e = C.create({
|
|
990
|
-
name: "taskItem",
|
|
991
|
-
addOptions() {
|
|
992
|
-
return {
|
|
993
|
-
nested: !1,
|
|
994
|
-
HTMLAttributes: {},
|
|
995
|
-
taskListTypeName: "taskList",
|
|
996
|
-
a11y: void 0
|
|
997
|
-
};
|
|
998
|
-
},
|
|
999
|
-
content() {
|
|
1000
|
-
return this.options.nested ? "paragraph block*" : "paragraph+";
|
|
1001
|
-
},
|
|
1002
|
-
defining: !0,
|
|
1003
|
-
addAttributes() {
|
|
1004
|
-
return { checked: {
|
|
1005
|
-
default: !1,
|
|
1006
|
-
keepOnSplit: !1,
|
|
1007
|
-
parseHTML: (e) => {
|
|
1008
|
-
let t = e.getAttribute("data-checked");
|
|
1009
|
-
return t === "" || t === "true";
|
|
1010
|
-
},
|
|
1011
|
-
renderHTML: (e) => ({ "data-checked": e.checked })
|
|
1012
|
-
} };
|
|
1013
|
-
},
|
|
1014
|
-
parseHTML() {
|
|
1015
|
-
return [{
|
|
1016
|
-
tag: `li[data-type="${this.name}"]`,
|
|
1017
|
-
priority: 51
|
|
1018
|
-
}];
|
|
1019
|
-
},
|
|
1020
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
1021
|
-
return [
|
|
1022
|
-
"li",
|
|
1023
|
-
r(this.options.HTMLAttributes, t, { "data-type": this.name }),
|
|
1024
|
-
[
|
|
1025
|
-
"label",
|
|
1026
|
-
["input", {
|
|
1027
|
-
type: "checkbox",
|
|
1028
|
-
checked: e.attrs.checked ? "checked" : null
|
|
1029
|
-
}],
|
|
1030
|
-
["span"]
|
|
1031
|
-
],
|
|
1032
|
-
["div", 0]
|
|
1033
|
-
];
|
|
1034
|
-
},
|
|
1035
|
-
parseMarkdown: (e, t) => {
|
|
1036
|
-
let n = [];
|
|
1037
|
-
if (e.tokens && e.tokens.length > 0 ? n.push(t.createNode("paragraph", {}, t.parseInline(e.tokens))) : e.text ? n.push(t.createNode("paragraph", {}, [t.createNode("text", { text: e.text })])) : n.push(t.createNode("paragraph", {}, [])), e.nestedTokens && e.nestedTokens.length > 0) {
|
|
1038
|
-
let r = t.parseChildren(e.nestedTokens);
|
|
1039
|
-
n.push(...r);
|
|
1040
|
-
}
|
|
1041
|
-
return t.createNode("taskItem", { checked: e.checked || !1 }, n);
|
|
1042
|
-
},
|
|
1043
|
-
renderMarkdown: (e, t) => re(e, t, `- [${e.attrs?.checked ? "x" : " "}] `),
|
|
1044
|
-
addKeyboardShortcuts() {
|
|
1045
|
-
let e = {
|
|
1046
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
1047
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
1048
|
-
};
|
|
1049
|
-
return this.options.nested ? {
|
|
1050
|
-
...e,
|
|
1051
|
-
Tab: () => this.editor.commands.sinkListItem(this.name)
|
|
1052
|
-
} : e;
|
|
1053
|
-
},
|
|
1054
|
-
addNodeView() {
|
|
1055
|
-
return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
|
|
1056
|
-
let i = document.createElement("li"), a = document.createElement("label"), o = document.createElement("span"), s = document.createElement("input"), c = document.createElement("div"), l = (e) => {
|
|
1057
|
-
var t;
|
|
1058
|
-
s.ariaLabel = ((t = this.options.a11y)?.checkboxLabel)?.call(t, e, s.checked) || `Task item checkbox for ${e.textContent || "empty task item"}`;
|
|
1059
|
-
};
|
|
1060
|
-
l(e), a.contentEditable = "false", s.type = "checkbox", s.addEventListener("mousedown", (e) => e.preventDefault()), s.addEventListener("change", (t) => {
|
|
1061
|
-
if (!r.isEditable && !this.options.onReadOnlyChecked) {
|
|
1062
|
-
s.checked = !s.checked;
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
let { checked: i } = t.target;
|
|
1066
|
-
r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: e }) => {
|
|
1067
|
-
let t = n();
|
|
1068
|
-
if (typeof t != "number") return !1;
|
|
1069
|
-
let r = e.doc.nodeAt(t);
|
|
1070
|
-
return e.setNodeMarkup(t, void 0, {
|
|
1071
|
-
...r?.attrs,
|
|
1072
|
-
checked: i
|
|
1073
|
-
}), !0;
|
|
1074
|
-
}).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, i) || (s.checked = !s.checked));
|
|
1075
|
-
}), Object.entries(this.options.HTMLAttributes).forEach(([e, t]) => {
|
|
1076
|
-
i.setAttribute(e, t);
|
|
1077
|
-
}), i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, a.append(s, o), i.append(a, c), Object.entries(t).forEach(([e, t]) => {
|
|
1078
|
-
i.setAttribute(e, t);
|
|
1079
|
-
});
|
|
1080
|
-
let u = new Set(Object.keys(t));
|
|
1081
|
-
return {
|
|
1082
|
-
dom: i,
|
|
1083
|
-
contentDOM: c,
|
|
1084
|
-
update: (e) => {
|
|
1085
|
-
if (e.type !== this.type) return !1;
|
|
1086
|
-
i.dataset.checked = e.attrs.checked, s.checked = e.attrs.checked, l(e);
|
|
1087
|
-
let t = r.extensionManager.attributes, n = ee(e, t), a = new Set(Object.keys(n)), o = this.options.HTMLAttributes;
|
|
1088
|
-
return u.forEach((e) => {
|
|
1089
|
-
a.has(e) || (e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e));
|
|
1090
|
-
}), Object.entries(n).forEach(([e, t]) => {
|
|
1091
|
-
t == null ? e in o ? i.setAttribute(e, o[e]) : i.removeAttribute(e) : i.setAttribute(e, t);
|
|
1092
|
-
}), u = a, !0;
|
|
1093
|
-
}
|
|
1094
|
-
};
|
|
1095
|
-
};
|
|
1096
|
-
},
|
|
1097
|
-
addInputRules() {
|
|
1098
|
-
return [S({
|
|
1099
|
-
find: Qe,
|
|
1100
|
-
type: this.type,
|
|
1101
|
-
getAttributes: (e) => ({ checked: e[e.length - 1] === "x" })
|
|
1102
|
-
})];
|
|
1103
|
-
}
|
|
1104
|
-
}), et = C.create({
|
|
1105
|
-
name: "taskList",
|
|
1106
|
-
addOptions() {
|
|
1107
|
-
return {
|
|
1108
|
-
itemTypeName: "taskItem",
|
|
1109
|
-
HTMLAttributes: {}
|
|
1110
|
-
};
|
|
1111
|
-
},
|
|
1112
|
-
group: "block list",
|
|
1113
|
-
content() {
|
|
1114
|
-
return `${this.options.itemTypeName}+`;
|
|
1115
|
-
},
|
|
1116
|
-
parseHTML() {
|
|
1117
|
-
return [{
|
|
1118
|
-
tag: `ul[data-type="${this.name}"]`,
|
|
1119
|
-
priority: 51
|
|
1120
|
-
}];
|
|
1121
|
-
},
|
|
1122
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1123
|
-
return [
|
|
1124
|
-
"ul",
|
|
1125
|
-
r(this.options.HTMLAttributes, e, { "data-type": this.name }),
|
|
1126
|
-
0
|
|
1127
|
-
];
|
|
1128
|
-
},
|
|
1129
|
-
parseMarkdown: (e, t) => t.createNode("taskList", {}, t.parseChildren(e.items || [])),
|
|
1130
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, "\n") : "",
|
|
1131
|
-
markdownTokenizer: {
|
|
1132
|
-
name: "taskList",
|
|
1133
|
-
level: "block",
|
|
1134
|
-
start(e) {
|
|
1135
|
-
let t = e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)?.index;
|
|
1136
|
-
return t === void 0 ? -1 : t;
|
|
1137
|
-
},
|
|
1138
|
-
tokenize(e, t, n) {
|
|
1139
|
-
let r = (e) => {
|
|
1140
|
-
let t = c(e, {
|
|
1141
|
-
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
1142
|
-
extractItemData: (e) => ({
|
|
1143
|
-
indentLevel: e[1].length,
|
|
1144
|
-
mainContent: e[4],
|
|
1145
|
-
checked: e[3].toLowerCase() === "x"
|
|
1146
|
-
}),
|
|
1147
|
-
createToken: (e, t) => ({
|
|
1148
|
-
type: "taskItem",
|
|
1149
|
-
raw: "",
|
|
1150
|
-
mainContent: e.mainContent,
|
|
1151
|
-
indentLevel: e.indentLevel,
|
|
1152
|
-
checked: e.checked,
|
|
1153
|
-
text: e.mainContent,
|
|
1154
|
-
tokens: n.inlineTokens(e.mainContent),
|
|
1155
|
-
nestedTokens: t
|
|
1156
|
-
}),
|
|
1157
|
-
customNestedParser: r
|
|
1158
|
-
}, n);
|
|
1159
|
-
return t ? [{
|
|
1160
|
-
type: "taskList",
|
|
1161
|
-
raw: t.raw,
|
|
1162
|
-
items: t.items
|
|
1163
|
-
}] : n.blockTokens(e);
|
|
1164
|
-
}, i = c(e, {
|
|
1165
|
-
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
1166
|
-
extractItemData: (e) => ({
|
|
1167
|
-
indentLevel: e[1].length,
|
|
1168
|
-
mainContent: e[4],
|
|
1169
|
-
checked: e[3].toLowerCase() === "x"
|
|
1170
|
-
}),
|
|
1171
|
-
createToken: (e, t) => ({
|
|
1172
|
-
type: "taskItem",
|
|
1173
|
-
raw: "",
|
|
1174
|
-
mainContent: e.mainContent,
|
|
1175
|
-
indentLevel: e.indentLevel,
|
|
1176
|
-
checked: e.checked,
|
|
1177
|
-
text: e.mainContent,
|
|
1178
|
-
tokens: n.inlineTokens(e.mainContent),
|
|
1179
|
-
nestedTokens: t
|
|
1180
|
-
}),
|
|
1181
|
-
customNestedParser: r
|
|
1182
|
-
}, n);
|
|
1183
|
-
if (i) return {
|
|
1184
|
-
type: "taskList",
|
|
1185
|
-
raw: i.raw,
|
|
1186
|
-
items: i.items
|
|
1187
|
-
};
|
|
1188
|
-
}
|
|
1189
|
-
},
|
|
1190
|
-
markdownOptions: { indentsContent: !0 },
|
|
1191
|
-
addCommands() {
|
|
1192
|
-
return { toggleTaskList: () => ({ commands: e }) => e.toggleList(this.name, this.options.itemTypeName) };
|
|
1193
|
-
},
|
|
1194
|
-
addKeyboardShortcuts() {
|
|
1195
|
-
return { "Mod-Shift-9": () => this.editor.commands.toggleTaskList() };
|
|
1196
|
-
}
|
|
1197
|
-
});
|
|
1198
|
-
b.create({
|
|
1199
|
-
name: "listKit",
|
|
1200
|
-
addExtensions() {
|
|
1201
|
-
let e = [];
|
|
1202
|
-
return this.options.bulletList !== !1 && e.push(j.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(M.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Be.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Ze.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push($e.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(et.configure(this.options.taskList)), e;
|
|
1203
|
-
}
|
|
1204
|
-
});
|
|
1205
|
-
//#endregion
|
|
1206
|
-
//#region ../../node_modules/.pnpm/@tiptap+extension-paragraph@3.23.6_@tiptap+core@3.23.6_@tiptap+pm@3.23.6_/node_modules/@tiptap/extension-paragraph/dist/index.js
|
|
1207
|
-
var z = " ", B = "\xA0", tt = C.create({
|
|
1208
|
-
name: "paragraph",
|
|
1209
|
-
priority: 1e3,
|
|
1210
|
-
addOptions() {
|
|
1211
|
-
return { HTMLAttributes: {} };
|
|
1212
|
-
},
|
|
1213
|
-
group: "block",
|
|
1214
|
-
content: "inline*",
|
|
1215
|
-
parseHTML() {
|
|
1216
|
-
return [{ tag: "p" }];
|
|
1217
|
-
},
|
|
1218
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1219
|
-
return [
|
|
1220
|
-
"p",
|
|
1221
|
-
r(this.options.HTMLAttributes, e),
|
|
1222
|
-
0
|
|
1223
|
-
];
|
|
1224
|
-
},
|
|
1225
|
-
parseMarkdown: (e, t) => {
|
|
1226
|
-
let n = e.tokens || [];
|
|
1227
|
-
if (n.length === 1 && n[0].type === "image") return t.parseChildren([n[0]]);
|
|
1228
|
-
let r = t.parseInline(n);
|
|
1229
|
-
return n.length === 1 && n[0].type === "text" && (n[0].raw === z || n[0].text === z || n[0].raw === B || n[0].text === B) && r.length === 1 && r[0].type === "text" && (r[0].text === z || r[0].text === B) ? t.createNode("paragraph", void 0, []) : t.createNode("paragraph", void 0, r);
|
|
1230
|
-
},
|
|
1231
|
-
renderMarkdown: (e, t, n) => {
|
|
1232
|
-
if (!e) return "";
|
|
1233
|
-
let r = Array.isArray(e.content) ? e.content : [];
|
|
1234
|
-
if (r.length === 0) {
|
|
1235
|
-
let e = Array.isArray(n?.previousNode?.content) ? n.previousNode.content : [];
|
|
1236
|
-
return n?.previousNode?.type === "paragraph" && e.length === 0 ? z : "";
|
|
1237
|
-
}
|
|
1238
|
-
return t.renderChildren(r);
|
|
1239
|
-
},
|
|
1240
|
-
addCommands() {
|
|
1241
|
-
return { setParagraph: () => ({ commands: e }) => e.setNode(this.name) };
|
|
1242
|
-
},
|
|
1243
|
-
addKeyboardShortcuts() {
|
|
1244
|
-
return { "Mod-Alt-0": () => this.editor.commands.setParagraph() };
|
|
1245
|
-
}
|
|
1246
|
-
}), nt = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, rt = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, it = _.create({
|
|
1247
|
-
name: "strike",
|
|
1248
|
-
addOptions() {
|
|
1249
|
-
return { HTMLAttributes: {} };
|
|
1250
|
-
},
|
|
1251
|
-
parseHTML() {
|
|
1252
|
-
return [
|
|
1253
|
-
{ tag: "s" },
|
|
1254
|
-
{ tag: "del" },
|
|
1255
|
-
{ tag: "strike" },
|
|
1256
|
-
{
|
|
1257
|
-
style: "text-decoration",
|
|
1258
|
-
consuming: !1,
|
|
1259
|
-
getAttrs: (e) => e.includes("line-through") ? {} : !1
|
|
1260
|
-
}
|
|
1261
|
-
];
|
|
1262
|
-
},
|
|
1263
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1264
|
-
return [
|
|
1265
|
-
"s",
|
|
1266
|
-
r(this.options.HTMLAttributes, e),
|
|
1267
|
-
0
|
|
1268
|
-
];
|
|
1269
|
-
},
|
|
1270
|
-
markdownTokenName: "del",
|
|
1271
|
-
parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
|
|
1272
|
-
renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
|
|
1273
|
-
addCommands() {
|
|
1274
|
-
return {
|
|
1275
|
-
setStrike: () => ({ commands: e }) => e.setMark(this.name),
|
|
1276
|
-
toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
1277
|
-
unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
1278
|
-
};
|
|
1279
|
-
},
|
|
1280
|
-
addKeyboardShortcuts() {
|
|
1281
|
-
return { "Mod-Shift-s": () => this.editor.commands.toggleStrike() };
|
|
1282
|
-
},
|
|
1283
|
-
addInputRules() {
|
|
1284
|
-
return [i({
|
|
1285
|
-
find: nt,
|
|
1286
|
-
type: this.type
|
|
1287
|
-
})];
|
|
1288
|
-
},
|
|
1289
|
-
addPasteRules() {
|
|
1290
|
-
return [f({
|
|
1291
|
-
find: rt,
|
|
1292
|
-
type: this.type
|
|
1293
|
-
})];
|
|
1294
|
-
}
|
|
1295
|
-
}), at = C.create({
|
|
1296
|
-
name: "text",
|
|
1297
|
-
group: "inline",
|
|
1298
|
-
parseMarkdown: (e) => ({
|
|
1299
|
-
type: "text",
|
|
1300
|
-
text: e.text || ""
|
|
1301
|
-
}),
|
|
1302
|
-
renderMarkdown: (e) => e.text || ""
|
|
1303
|
-
});
|
|
1304
|
-
//#endregion
|
|
1305
|
-
//#region ../../node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.js
|
|
1306
|
-
function ot(e = {}) {
|
|
1307
|
-
return new E({ view(t) {
|
|
1308
|
-
return new st(t, e);
|
|
1309
|
-
} });
|
|
1310
|
-
}
|
|
1311
|
-
var st = class {
|
|
1312
|
-
constructor(e, t) {
|
|
1313
|
-
this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = t.width ?? 1, this.color = t.color === !1 ? void 0 : t.color || "black", this.class = t.class, this.handlers = [
|
|
1314
|
-
"dragover",
|
|
1315
|
-
"dragend",
|
|
1316
|
-
"drop",
|
|
1317
|
-
"dragleave"
|
|
1318
|
-
].map((t) => {
|
|
1319
|
-
let n = (e) => {
|
|
1320
|
-
this[t](e);
|
|
1321
|
-
};
|
|
1322
|
-
return e.dom.addEventListener(t, n), {
|
|
1323
|
-
name: t,
|
|
1324
|
-
handler: n
|
|
1325
|
-
};
|
|
1326
|
-
});
|
|
1327
|
-
}
|
|
1328
|
-
destroy() {
|
|
1329
|
-
this.handlers.forEach(({ name: e, handler: t }) => this.editorView.dom.removeEventListener(e, t));
|
|
1330
|
-
}
|
|
1331
|
-
update(e, t) {
|
|
1332
|
-
this.cursorPos != null && t.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
|
|
1333
|
-
}
|
|
1334
|
-
setCursor(e) {
|
|
1335
|
-
e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
1336
|
-
}
|
|
1337
|
-
updateOverlay() {
|
|
1338
|
-
let e = this.editorView.state.doc.resolve(this.cursorPos), t = !e.parent.inlineContent, n, r = this.editorView.dom, i = r.getBoundingClientRect(), a = i.width / r.offsetWidth, o = i.height / r.offsetHeight;
|
|
1339
|
-
if (t) {
|
|
1340
|
-
let t = e.nodeBefore, r = e.nodeAfter;
|
|
1341
|
-
if (t || r) {
|
|
1342
|
-
let e = this.editorView.nodeDOM(this.cursorPos - (t ? t.nodeSize : 0));
|
|
1343
|
-
if (e) {
|
|
1344
|
-
let i = e.getBoundingClientRect(), a = t ? i.bottom : i.top;
|
|
1345
|
-
t && r && (a = (a + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
1346
|
-
let s = this.width / 2 * o;
|
|
1347
|
-
n = {
|
|
1348
|
-
left: i.left,
|
|
1349
|
-
right: i.right,
|
|
1350
|
-
top: a - s,
|
|
1351
|
-
bottom: a + s
|
|
1352
|
-
};
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
if (!n) {
|
|
1357
|
-
let e = this.editorView.coordsAtPos(this.cursorPos), t = this.width / 2 * a;
|
|
1358
|
-
n = {
|
|
1359
|
-
left: e.left - t,
|
|
1360
|
-
right: e.left + t,
|
|
1361
|
-
top: e.top,
|
|
1362
|
-
bottom: e.bottom
|
|
1363
|
-
};
|
|
1364
|
-
}
|
|
1365
|
-
let s = this.editorView.dom.offsetParent;
|
|
1366
|
-
this.element || (this.element = s.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", t), this.element.classList.toggle("prosemirror-dropcursor-inline", !t);
|
|
1367
|
-
let c, l;
|
|
1368
|
-
if (!s || s == document.body && getComputedStyle(s).position == "static") c = -pageXOffset, l = -pageYOffset;
|
|
1369
|
-
else {
|
|
1370
|
-
let e = s.getBoundingClientRect(), t = e.width / s.offsetWidth, n = e.height / s.offsetHeight;
|
|
1371
|
-
c = e.left - s.scrollLeft * t, l = e.top - s.scrollTop * n;
|
|
1372
|
-
}
|
|
1373
|
-
this.element.style.left = (n.left - c) / a + "px", this.element.style.top = (n.top - l) / o + "px", this.element.style.width = (n.right - n.left) / a + "px", this.element.style.height = (n.bottom - n.top) / o + "px";
|
|
1374
|
-
}
|
|
1375
|
-
scheduleRemoval(e) {
|
|
1376
|
-
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
|
|
1377
|
-
}
|
|
1378
|
-
dragover(e) {
|
|
1379
|
-
if (!this.editorView.editable) return;
|
|
1380
|
-
let t = this.editorView.posAtCoords({
|
|
1381
|
-
left: e.clientX,
|
|
1382
|
-
top: e.clientY
|
|
1383
|
-
}), n = t && t.inside >= 0 && this.editorView.state.doc.nodeAt(t.inside), r = n && n.type.spec.disableDropCursor, i = typeof r == "function" ? r(this.editorView, t, e) : r;
|
|
1384
|
-
if (t && !i) {
|
|
1385
|
-
let e = t.pos;
|
|
1386
|
-
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
1387
|
-
let t = oe(this.editorView.state.doc, e, this.editorView.dragging.slice);
|
|
1388
|
-
t != null && (e = t);
|
|
1389
|
-
}
|
|
1390
|
-
this.setCursor(e), this.scheduleRemoval(5e3);
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
dragend() {
|
|
1394
|
-
this.scheduleRemoval(20);
|
|
1395
|
-
}
|
|
1396
|
-
drop() {
|
|
1397
|
-
this.scheduleRemoval(20);
|
|
1398
|
-
}
|
|
1399
|
-
dragleave(e) {
|
|
1400
|
-
this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
|
|
1401
|
-
}
|
|
1402
|
-
}, V = class e extends T {
|
|
1403
|
-
constructor(e) {
|
|
1404
|
-
super(e, e);
|
|
1405
|
-
}
|
|
1406
|
-
map(t, n) {
|
|
1407
|
-
let r = t.resolve(n.map(this.head));
|
|
1408
|
-
return e.valid(r) ? new e(r) : T.near(r);
|
|
1409
|
-
}
|
|
1410
|
-
content() {
|
|
1411
|
-
return n.empty;
|
|
1412
|
-
}
|
|
1413
|
-
eq(t) {
|
|
1414
|
-
return t instanceof e && t.head == this.head;
|
|
1415
|
-
}
|
|
1416
|
-
toJSON() {
|
|
1417
|
-
return {
|
|
1418
|
-
type: "gapcursor",
|
|
1419
|
-
pos: this.head
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
static fromJSON(t, n) {
|
|
1423
|
-
if (typeof n.pos != "number") throw RangeError("Invalid input for GapCursor.fromJSON");
|
|
1424
|
-
return new e(t.resolve(n.pos));
|
|
1425
|
-
}
|
|
1426
|
-
getBookmark() {
|
|
1427
|
-
return new ct(this.anchor);
|
|
1428
|
-
}
|
|
1429
|
-
static valid(e) {
|
|
1430
|
-
let t = e.parent;
|
|
1431
|
-
if (t.inlineContent || !ut(e) || !dt(e)) return !1;
|
|
1432
|
-
let n = t.type.spec.allowGapCursor;
|
|
1433
|
-
if (n != null) return n;
|
|
1434
|
-
let r = t.contentMatchAt(e.index()).defaultType;
|
|
1435
|
-
return r && r.isTextblock;
|
|
1436
|
-
}
|
|
1437
|
-
static findGapCursorFrom(t, n, r = !1) {
|
|
1438
|
-
search: for (;;) {
|
|
1439
|
-
if (!r && e.valid(t)) return t;
|
|
1440
|
-
let i = t.pos, a = null;
|
|
1441
|
-
for (let r = t.depth;; r--) {
|
|
1442
|
-
let o = t.node(r);
|
|
1443
|
-
if (n > 0 ? t.indexAfter(r) < o.childCount : t.index(r) > 0) {
|
|
1444
|
-
a = o.child(n > 0 ? t.indexAfter(r) : t.index(r) - 1);
|
|
1445
|
-
break;
|
|
1446
|
-
} else if (r == 0) return null;
|
|
1447
|
-
i += n;
|
|
1448
|
-
let s = t.doc.resolve(i);
|
|
1449
|
-
if (e.valid(s)) return s;
|
|
1450
|
-
}
|
|
1451
|
-
for (;;) {
|
|
1452
|
-
let o = n > 0 ? a.firstChild : a.lastChild;
|
|
1453
|
-
if (!o) {
|
|
1454
|
-
if (a.isAtom && !a.isText && !w.isSelectable(a)) {
|
|
1455
|
-
t = t.doc.resolve(i + a.nodeSize * n), r = !1;
|
|
1456
|
-
continue search;
|
|
1457
|
-
}
|
|
1458
|
-
break;
|
|
1459
|
-
}
|
|
1460
|
-
a = o, i += n;
|
|
1461
|
-
let s = t.doc.resolve(i);
|
|
1462
|
-
if (e.valid(s)) return s;
|
|
1463
|
-
}
|
|
1464
|
-
return null;
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
};
|
|
1468
|
-
V.prototype.visible = !1, V.findFrom = V.findGapCursorFrom, T.jsonID("gapcursor", V);
|
|
1469
|
-
var ct = class e {
|
|
1470
|
-
constructor(e) {
|
|
1471
|
-
this.pos = e;
|
|
1472
|
-
}
|
|
1473
|
-
map(t) {
|
|
1474
|
-
return new e(t.map(this.pos));
|
|
1475
|
-
}
|
|
1476
|
-
resolve(e) {
|
|
1477
|
-
let t = e.resolve(this.pos);
|
|
1478
|
-
return V.valid(t) ? new V(t) : T.near(t);
|
|
1479
|
-
}
|
|
1480
|
-
};
|
|
1481
|
-
function lt(e) {
|
|
1482
|
-
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
1483
|
-
}
|
|
1484
|
-
function ut(e) {
|
|
1485
|
-
for (let t = e.depth; t >= 0; t--) {
|
|
1486
|
-
let n = e.index(t), r = e.node(t);
|
|
1487
|
-
if (n == 0) {
|
|
1488
|
-
if (r.type.spec.isolating) return !0;
|
|
1489
|
-
continue;
|
|
1490
|
-
}
|
|
1491
|
-
for (let e = r.child(n - 1);; e = e.lastChild) {
|
|
1492
|
-
if (e.childCount == 0 && !e.inlineContent || lt(e.type)) return !0;
|
|
1493
|
-
if (e.inlineContent) return !1;
|
|
1494
|
-
}
|
|
1495
|
-
}
|
|
1496
|
-
return !0;
|
|
1497
|
-
}
|
|
1498
|
-
function dt(e) {
|
|
1499
|
-
for (let t = e.depth; t >= 0; t--) {
|
|
1500
|
-
let n = e.indexAfter(t), r = e.node(t);
|
|
1501
|
-
if (n == r.childCount) {
|
|
1502
|
-
if (r.type.spec.isolating) return !0;
|
|
1503
|
-
continue;
|
|
1504
|
-
}
|
|
1505
|
-
for (let e = r.child(n);; e = e.firstChild) {
|
|
1506
|
-
if (e.childCount == 0 && !e.inlineContent || lt(e.type)) return !0;
|
|
1507
|
-
if (e.inlineContent) return !1;
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
return !0;
|
|
1511
|
-
}
|
|
1512
|
-
function ft() {
|
|
1513
|
-
return new E({ props: {
|
|
1514
|
-
decorations: gt,
|
|
1515
|
-
createSelectionBetween(e, t, n) {
|
|
1516
|
-
return t.pos == n.pos && V.valid(n) ? new V(n) : null;
|
|
1517
|
-
},
|
|
1518
|
-
handleClick: mt,
|
|
1519
|
-
handleKeyDown: pt,
|
|
1520
|
-
handleDOMEvents: { beforeinput: ht }
|
|
1521
|
-
} });
|
|
1522
|
-
}
|
|
1523
|
-
var pt = te({
|
|
1524
|
-
ArrowLeft: H("horiz", -1),
|
|
1525
|
-
ArrowRight: H("horiz", 1),
|
|
1526
|
-
ArrowUp: H("vert", -1),
|
|
1527
|
-
ArrowDown: H("vert", 1)
|
|
1528
|
-
});
|
|
1529
|
-
function H(e, t) {
|
|
1530
|
-
let n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
1531
|
-
return function(e, r, i) {
|
|
1532
|
-
let a = e.selection, o = t > 0 ? a.$to : a.$from, s = a.empty;
|
|
1533
|
-
if (a instanceof l) {
|
|
1534
|
-
if (!i.endOfTextblock(n) || o.depth == 0) return !1;
|
|
1535
|
-
s = !1, o = e.doc.resolve(t > 0 ? o.after() : o.before());
|
|
1536
|
-
}
|
|
1537
|
-
let c = V.findGapCursorFrom(o, t, s);
|
|
1538
|
-
return c ? (r && r(e.tr.setSelection(new V(c))), !0) : !1;
|
|
1539
|
-
};
|
|
1540
|
-
}
|
|
1541
|
-
function mt(e, t, n) {
|
|
1542
|
-
if (!e || !e.editable) return !1;
|
|
1543
|
-
let r = e.state.doc.resolve(t);
|
|
1544
|
-
if (!V.valid(r)) return !1;
|
|
1545
|
-
let i = e.posAtCoords({
|
|
1546
|
-
left: n.clientX,
|
|
1547
|
-
top: n.clientY
|
|
1548
|
-
});
|
|
1549
|
-
return i && i.inside > -1 && w.isSelectable(e.state.doc.nodeAt(i.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new V(r))), !0);
|
|
1550
|
-
}
|
|
1551
|
-
function ht(e, t) {
|
|
1552
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof V)) return !1;
|
|
1553
|
-
let { $from: r } = e.state.selection, i = r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);
|
|
1554
|
-
if (!i) return !1;
|
|
1555
|
-
let a = d.empty;
|
|
1556
|
-
for (let e = i.length - 1; e >= 0; e--) a = d.from(i[e].createAndFill(null, a));
|
|
1557
|
-
let o = e.state.tr.replace(r.pos, r.pos, new n(a, 0, 0));
|
|
1558
|
-
return o.setSelection(l.near(o.doc.resolve(r.pos + 1))), e.dispatch(o), !1;
|
|
1559
|
-
}
|
|
1560
|
-
function gt(e) {
|
|
1561
|
-
if (!(e.selection instanceof V)) return null;
|
|
1562
|
-
let t = document.createElement("div");
|
|
1563
|
-
return t.className = "ProseMirror-gapcursor", h.create(e.doc, [y.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
1564
|
-
}
|
|
1565
|
-
//#endregion
|
|
1566
|
-
//#region ../../node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.js
|
|
1567
|
-
var U = 200, W = function() {};
|
|
1568
|
-
W.prototype.append = function(e) {
|
|
1569
|
-
return e.length ? (e = W.from(e), !this.length && e || e.length < U && this.leafAppend(e) || this.length < U && e.leafPrepend(this) || this.appendInner(e)) : this;
|
|
1570
|
-
}, W.prototype.prepend = function(e) {
|
|
1571
|
-
return e.length ? W.from(e).append(this) : this;
|
|
1572
|
-
}, W.prototype.appendInner = function(e) {
|
|
1573
|
-
return new vt(this, e);
|
|
1574
|
-
}, W.prototype.slice = function(e, t) {
|
|
1575
|
-
return e === void 0 && (e = 0), t === void 0 && (t = this.length), e >= t ? W.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, t));
|
|
1576
|
-
}, W.prototype.get = function(e) {
|
|
1577
|
-
if (!(e < 0 || e >= this.length)) return this.getInner(e);
|
|
1578
|
-
}, W.prototype.forEach = function(e, t, n) {
|
|
1579
|
-
t === void 0 && (t = 0), n === void 0 && (n = this.length), t <= n ? this.forEachInner(e, t, n, 0) : this.forEachInvertedInner(e, t, n, 0);
|
|
1580
|
-
}, W.prototype.map = function(e, t, n) {
|
|
1581
|
-
t === void 0 && (t = 0), n === void 0 && (n = this.length);
|
|
1582
|
-
var r = [];
|
|
1583
|
-
return this.forEach(function(t, n) {
|
|
1584
|
-
return r.push(e(t, n));
|
|
1585
|
-
}, t, n), r;
|
|
1586
|
-
}, W.from = function(e) {
|
|
1587
|
-
return e instanceof W ? e : e && e.length ? new _t(e) : W.empty;
|
|
1588
|
-
};
|
|
1589
|
-
var _t = /* @__PURE__ */ function(e) {
|
|
1590
|
-
function t(t) {
|
|
1591
|
-
e.call(this), this.values = t;
|
|
1592
|
-
}
|
|
1593
|
-
e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
|
|
1594
|
-
var n = {
|
|
1595
|
-
length: { configurable: !0 },
|
|
1596
|
-
depth: { configurable: !0 }
|
|
1597
|
-
};
|
|
1598
|
-
return t.prototype.flatten = function() {
|
|
1599
|
-
return this.values;
|
|
1600
|
-
}, t.prototype.sliceInner = function(e, n) {
|
|
1601
|
-
return e == 0 && n == this.length ? this : new t(this.values.slice(e, n));
|
|
1602
|
-
}, t.prototype.getInner = function(e) {
|
|
1603
|
-
return this.values[e];
|
|
1604
|
-
}, t.prototype.forEachInner = function(e, t, n, r) {
|
|
1605
|
-
for (var i = t; i < n; i++) if (e(this.values[i], r + i) === !1) return !1;
|
|
1606
|
-
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
1607
|
-
for (var i = t - 1; i >= n; i--) if (e(this.values[i], r + i) === !1) return !1;
|
|
1608
|
-
}, t.prototype.leafAppend = function(e) {
|
|
1609
|
-
if (this.length + e.length <= U) return new t(this.values.concat(e.flatten()));
|
|
1610
|
-
}, t.prototype.leafPrepend = function(e) {
|
|
1611
|
-
if (this.length + e.length <= U) return new t(e.flatten().concat(this.values));
|
|
1612
|
-
}, n.length.get = function() {
|
|
1613
|
-
return this.values.length;
|
|
1614
|
-
}, n.depth.get = function() {
|
|
1615
|
-
return 0;
|
|
1616
|
-
}, Object.defineProperties(t.prototype, n), t;
|
|
1617
|
-
}(W);
|
|
1618
|
-
W.empty = new _t([]);
|
|
1619
|
-
var vt = /* @__PURE__ */ function(e) {
|
|
1620
|
-
function t(t, n) {
|
|
1621
|
-
e.call(this), this.left = t, this.right = n, this.length = t.length + n.length, this.depth = Math.max(t.depth, n.depth) + 1;
|
|
1622
|
-
}
|
|
1623
|
-
return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
|
|
1624
|
-
return this.left.flatten().concat(this.right.flatten());
|
|
1625
|
-
}, t.prototype.getInner = function(e) {
|
|
1626
|
-
return e < this.left.length ? this.left.get(e) : this.right.get(e - this.left.length);
|
|
1627
|
-
}, t.prototype.forEachInner = function(e, t, n, r) {
|
|
1628
|
-
var i = this.left.length;
|
|
1629
|
-
if (t < i && this.left.forEachInner(e, t, Math.min(n, i), r) === !1 || n > i && this.right.forEachInner(e, Math.max(t - i, 0), Math.min(this.length, n) - i, r + i) === !1) return !1;
|
|
1630
|
-
}, t.prototype.forEachInvertedInner = function(e, t, n, r) {
|
|
1631
|
-
var i = this.left.length;
|
|
1632
|
-
if (t > i && this.right.forEachInvertedInner(e, t - i, Math.max(n, i) - i, r + i) === !1 || n < i && this.left.forEachInvertedInner(e, Math.min(t, i), n, r) === !1) return !1;
|
|
1633
|
-
}, t.prototype.sliceInner = function(e, t) {
|
|
1634
|
-
if (e == 0 && t == this.length) return this;
|
|
1635
|
-
var n = this.left.length;
|
|
1636
|
-
return t <= n ? this.left.slice(e, t) : e >= n ? this.right.slice(e - n, t - n) : this.left.slice(e, n).append(this.right.slice(0, t - n));
|
|
1637
|
-
}, t.prototype.leafAppend = function(e) {
|
|
1638
|
-
var n = this.right.leafAppend(e);
|
|
1639
|
-
if (n) return new t(this.left, n);
|
|
1640
|
-
}, t.prototype.leafPrepend = function(e) {
|
|
1641
|
-
var n = this.left.leafPrepend(e);
|
|
1642
|
-
if (n) return new t(n, this.right);
|
|
1643
|
-
}, t.prototype.appendInner = function(e) {
|
|
1644
|
-
return this.left.depth >= Math.max(this.right.depth, e.depth) + 1 ? new t(this.left, new t(this.right, e)) : new t(this, e);
|
|
1645
|
-
}, t;
|
|
1646
|
-
}(W), yt = 500, G = class t {
|
|
1647
|
-
constructor(e, t) {
|
|
1648
|
-
this.items = e, this.eventCount = t;
|
|
1649
|
-
}
|
|
1650
|
-
popEvent(e, n) {
|
|
1651
|
-
if (this.eventCount == 0) return null;
|
|
1652
|
-
let r = this.items.length;
|
|
1653
|
-
for (;; r--) if (this.items.get(r - 1).selection) {
|
|
1654
|
-
--r;
|
|
1655
|
-
break;
|
|
1656
|
-
}
|
|
1657
|
-
let i, a;
|
|
1658
|
-
n && (i = this.remapping(r, this.items.length), a = i.maps.length);
|
|
1659
|
-
let o = e.tr, s, c, l = [], u = [];
|
|
1660
|
-
return this.items.forEach((e, n) => {
|
|
1661
|
-
if (!e.step) {
|
|
1662
|
-
i || (i = this.remapping(r, n + 1), a = i.maps.length), a--, u.push(e);
|
|
1663
|
-
return;
|
|
1664
|
-
}
|
|
1665
|
-
if (i) {
|
|
1666
|
-
u.push(new K(e.map));
|
|
1667
|
-
let t = e.step.map(i.slice(a)), n;
|
|
1668
|
-
t && o.maybeStep(t).doc && (n = o.mapping.maps[o.mapping.maps.length - 1], l.push(new K(n, void 0, void 0, l.length + u.length))), a--, n && i.appendMap(n, a);
|
|
1669
|
-
} else o.maybeStep(e.step);
|
|
1670
|
-
if (e.selection) return s = i ? e.selection.map(i.slice(a)) : e.selection, c = new t(this.items.slice(0, r).append(u.reverse().concat(l)), this.eventCount - 1), !1;
|
|
1671
|
-
}, this.items.length, 0), {
|
|
1672
|
-
remaining: c,
|
|
1673
|
-
transform: o,
|
|
1674
|
-
selection: s
|
|
1675
|
-
};
|
|
1676
|
-
}
|
|
1677
|
-
addTransform(e, n, r, i) {
|
|
1678
|
-
let a = [], o = this.eventCount, s = this.items, c = !i && s.length ? s.get(s.length - 1) : null;
|
|
1679
|
-
for (let t = 0; t < e.steps.length; t++) {
|
|
1680
|
-
let r = e.steps[t].invert(e.docs[t]), l = new K(e.mapping.maps[t], r, n), u;
|
|
1681
|
-
(u = c && c.merge(l)) && (l = u, t ? a.pop() : s = s.slice(0, s.length - 1)), a.push(l), n &&= (o++, void 0), i || (c = l);
|
|
1682
|
-
}
|
|
1683
|
-
let l = o - r.depth;
|
|
1684
|
-
return l > xt && (s = bt(s, l), o -= l), new t(s.append(a), o);
|
|
1685
|
-
}
|
|
1686
|
-
remapping(t, n) {
|
|
1687
|
-
let r = new e();
|
|
1688
|
-
return this.items.forEach((e, n) => {
|
|
1689
|
-
let i = e.mirrorOffset != null && n - e.mirrorOffset >= t ? r.maps.length - e.mirrorOffset : void 0;
|
|
1690
|
-
r.appendMap(e.map, i);
|
|
1691
|
-
}, t, n), r;
|
|
1692
|
-
}
|
|
1693
|
-
addMaps(e) {
|
|
1694
|
-
return this.eventCount == 0 ? this : new t(this.items.append(e.map((e) => new K(e))), this.eventCount);
|
|
1695
|
-
}
|
|
1696
|
-
rebased(e, n) {
|
|
1697
|
-
if (!this.eventCount) return this;
|
|
1698
|
-
let r = [], i = Math.max(0, this.items.length - n), a = e.mapping, o = e.steps.length, s = this.eventCount;
|
|
1699
|
-
this.items.forEach((e) => {
|
|
1700
|
-
e.selection && s--;
|
|
1701
|
-
}, i);
|
|
1702
|
-
let c = n;
|
|
1703
|
-
this.items.forEach((t) => {
|
|
1704
|
-
let n = a.getMirror(--c);
|
|
1705
|
-
if (n == null) return;
|
|
1706
|
-
o = Math.min(o, n);
|
|
1707
|
-
let i = a.maps[n];
|
|
1708
|
-
if (t.step) {
|
|
1709
|
-
let o = e.steps[n].invert(e.docs[n]), l = t.selection && t.selection.map(a.slice(c + 1, n));
|
|
1710
|
-
l && s++, r.push(new K(i, o, l));
|
|
1711
|
-
} else r.push(new K(i));
|
|
1712
|
-
}, i);
|
|
1713
|
-
let l = [];
|
|
1714
|
-
for (let e = n; e < o; e++) l.push(new K(a.maps[e]));
|
|
1715
|
-
let u = new t(this.items.slice(0, i).append(l).append(r), s);
|
|
1716
|
-
return u.emptyItemCount() > yt && (u = u.compress(this.items.length - r.length)), u;
|
|
1717
|
-
}
|
|
1718
|
-
emptyItemCount() {
|
|
1719
|
-
let e = 0;
|
|
1720
|
-
return this.items.forEach((t) => {
|
|
1721
|
-
t.step || e++;
|
|
1722
|
-
}), e;
|
|
1723
|
-
}
|
|
1724
|
-
compress(e = this.items.length) {
|
|
1725
|
-
let n = this.remapping(0, e), r = n.maps.length, i = [], a = 0;
|
|
1726
|
-
return this.items.forEach((t, o) => {
|
|
1727
|
-
if (o >= e) i.push(t), t.selection && a++;
|
|
1728
|
-
else if (t.step) {
|
|
1729
|
-
let e = t.step.map(n.slice(r)), o = e && e.getMap();
|
|
1730
|
-
if (r--, o && n.appendMap(o, r), e) {
|
|
1731
|
-
let s = t.selection && t.selection.map(n.slice(r));
|
|
1732
|
-
s && a++;
|
|
1733
|
-
let c = new K(o.invert(), e, s), l, u = i.length - 1;
|
|
1734
|
-
(l = i.length && i[u].merge(c)) ? i[u] = l : i.push(c);
|
|
1735
|
-
}
|
|
1736
|
-
} else t.map && r--;
|
|
1737
|
-
}, this.items.length, 0), new t(W.from(i.reverse()), a);
|
|
1738
|
-
}
|
|
1739
|
-
};
|
|
1740
|
-
G.empty = new G(W.empty, 0);
|
|
1741
|
-
function bt(e, t) {
|
|
1742
|
-
let n;
|
|
1743
|
-
return e.forEach((e, r) => {
|
|
1744
|
-
if (e.selection && t-- == 0) return n = r, !1;
|
|
1745
|
-
}), e.slice(n);
|
|
1746
|
-
}
|
|
1747
|
-
var K = class e {
|
|
1748
|
-
constructor(e, t, n, r) {
|
|
1749
|
-
this.map = e, this.step = t, this.selection = n, this.mirrorOffset = r;
|
|
1750
|
-
}
|
|
1751
|
-
merge(t) {
|
|
1752
|
-
if (this.step && t.step && !t.selection) {
|
|
1753
|
-
let n = t.step.merge(this.step);
|
|
1754
|
-
if (n) return new e(n.getMap().invert(), n, this.selection);
|
|
1755
|
-
}
|
|
1756
|
-
}
|
|
1757
|
-
}, q = class {
|
|
1758
|
-
constructor(e, t, n, r, i) {
|
|
1759
|
-
this.done = e, this.undone = t, this.prevRanges = n, this.prevTime = r, this.prevComposition = i;
|
|
1760
|
-
}
|
|
1761
|
-
}, xt = 20;
|
|
1762
|
-
function St(e, t, n, r) {
|
|
1763
|
-
let i = n.getMeta(Z), a;
|
|
1764
|
-
if (i) return i.historyState;
|
|
1765
|
-
n.getMeta(Dt) && (e = new q(e.done, e.undone, null, 0, -1));
|
|
1766
|
-
let o = n.getMeta("appendedTransaction");
|
|
1767
|
-
if (n.steps.length == 0) return e;
|
|
1768
|
-
if (o && o.getMeta(Z)) return o.getMeta(Z).redo ? new q(e.done.addTransform(n, void 0, r, X(t)), e.undone, wt(n.mapping.maps), e.prevTime, e.prevComposition) : new q(e.done, e.undone.addTransform(n, void 0, r, X(t)), null, e.prevTime, e.prevComposition);
|
|
1769
|
-
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
1770
|
-
let i = n.getMeta("composition"), a = e.prevTime == 0 || !o && e.prevComposition != i && (e.prevTime < (n.time || 0) - r.newGroupDelay || !Ct(n, e.prevRanges)), s = o ? J(e.prevRanges, n.mapping) : wt(n.mapping.maps);
|
|
1771
|
-
return new q(e.done.addTransform(n, a ? t.selection.getBookmark() : void 0, r, X(t)), G.empty, s, n.time, i ?? e.prevComposition);
|
|
1772
|
-
} else if (a = n.getMeta("rebased")) return new q(e.done.rebased(n, a), e.undone.rebased(n, a), J(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
1773
|
-
else return new q(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), J(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
1774
|
-
}
|
|
1775
|
-
function Ct(e, t) {
|
|
1776
|
-
if (!t) return !1;
|
|
1777
|
-
if (!e.docChanged) return !0;
|
|
1778
|
-
let n = !1;
|
|
1779
|
-
return e.mapping.maps[0].forEach((e, r) => {
|
|
1780
|
-
for (let i = 0; i < t.length; i += 2) e <= t[i + 1] && r >= t[i] && (n = !0);
|
|
1781
|
-
}), n;
|
|
1782
|
-
}
|
|
1783
|
-
function wt(e) {
|
|
1784
|
-
let t = [];
|
|
1785
|
-
for (let n = e.length - 1; n >= 0 && t.length == 0; n--) e[n].forEach((e, n, r, i) => t.push(r, i));
|
|
1786
|
-
return t;
|
|
1787
|
-
}
|
|
1788
|
-
function J(e, t) {
|
|
1789
|
-
if (!e) return null;
|
|
1790
|
-
let n = [];
|
|
1791
|
-
for (let r = 0; r < e.length; r += 2) {
|
|
1792
|
-
let i = t.map(e[r], 1), a = t.map(e[r + 1], -1);
|
|
1793
|
-
i <= a && n.push(i, a);
|
|
1794
|
-
}
|
|
1795
|
-
return n;
|
|
1796
|
-
}
|
|
1797
|
-
function Tt(e, t, n) {
|
|
1798
|
-
let r = X(t), i = Z.get(t).spec.config, a = (n ? e.undone : e.done).popEvent(t, r);
|
|
1799
|
-
if (!a) return null;
|
|
1800
|
-
let o = a.selection.resolve(a.transform.doc), s = (n ? e.done : e.undone).addTransform(a.transform, t.selection.getBookmark(), i, r), c = new q(n ? s : a.remaining, n ? a.remaining : s, null, 0, -1);
|
|
1801
|
-
return a.transform.setSelection(o).setMeta(Z, {
|
|
1802
|
-
redo: n,
|
|
1803
|
-
historyState: c
|
|
1804
|
-
});
|
|
1805
|
-
}
|
|
1806
|
-
var Y = !1, Et = null;
|
|
1807
|
-
function X(e) {
|
|
1808
|
-
let t = e.plugins;
|
|
1809
|
-
if (Et != t) {
|
|
1810
|
-
Y = !1, Et = t;
|
|
1811
|
-
for (let e = 0; e < t.length; e++) if (t[e].spec.historyPreserveItems) {
|
|
1812
|
-
Y = !0;
|
|
1813
|
-
break;
|
|
1814
|
-
}
|
|
1815
|
-
}
|
|
1816
|
-
return Y;
|
|
1817
|
-
}
|
|
1818
|
-
var Z = new g("history"), Dt = new g("closeHistory");
|
|
1819
|
-
function Ot(e = {}) {
|
|
1820
|
-
return e = {
|
|
1821
|
-
depth: e.depth || 100,
|
|
1822
|
-
newGroupDelay: e.newGroupDelay || 500
|
|
1823
|
-
}, new E({
|
|
1824
|
-
key: Z,
|
|
1825
|
-
state: {
|
|
1826
|
-
init() {
|
|
1827
|
-
return new q(G.empty, G.empty, null, 0, -1);
|
|
1828
|
-
},
|
|
1829
|
-
apply(t, n, r) {
|
|
1830
|
-
return St(n, r, t, e);
|
|
1831
|
-
}
|
|
1832
|
-
},
|
|
1833
|
-
config: e,
|
|
1834
|
-
props: { handleDOMEvents: { beforeinput(e, t) {
|
|
1835
|
-
let n = t.inputType, r = n == "historyUndo" ? At : n == "historyRedo" ? jt : null;
|
|
1836
|
-
return !r || !e.editable ? !1 : (t.preventDefault(), r(e.state, e.dispatch));
|
|
1837
|
-
} } }
|
|
1838
|
-
});
|
|
1839
|
-
}
|
|
1840
|
-
function kt(e, t) {
|
|
1841
|
-
return (n, r) => {
|
|
1842
|
-
let i = Z.getState(n);
|
|
1843
|
-
if (!i || (e ? i.undone : i.done).eventCount == 0) return !1;
|
|
1844
|
-
if (r) {
|
|
1845
|
-
let a = Tt(i, n, e);
|
|
1846
|
-
a && r(t ? a.scrollIntoView() : a);
|
|
1847
|
-
}
|
|
1848
|
-
return !0;
|
|
1849
|
-
};
|
|
1850
|
-
}
|
|
1851
|
-
var At = kt(!1, !0), jt = kt(!0, !0);
|
|
1852
|
-
b.create({
|
|
1853
|
-
name: "characterCount",
|
|
1854
|
-
addOptions() {
|
|
1855
|
-
return {
|
|
1856
|
-
limit: null,
|
|
1857
|
-
autoTrim: !0,
|
|
1858
|
-
mode: "textSize",
|
|
1859
|
-
textCounter: (e) => e.length,
|
|
1860
|
-
wordCounter: (e) => e.split(" ").filter((e) => e !== "").length
|
|
1861
|
-
};
|
|
1862
|
-
},
|
|
1863
|
-
addStorage() {
|
|
1864
|
-
return {
|
|
1865
|
-
characters: () => 0,
|
|
1866
|
-
words: () => 0
|
|
1867
|
-
};
|
|
1868
|
-
},
|
|
1869
|
-
onBeforeCreate() {
|
|
1870
|
-
this.storage.characters = (e) => {
|
|
1871
|
-
let t = e?.node || this.editor.state.doc;
|
|
1872
|
-
if ((e?.mode || this.options.mode) === "textSize") {
|
|
1873
|
-
let e = t.textBetween(0, t.content.size, void 0, " ");
|
|
1874
|
-
return this.options.textCounter(e);
|
|
1875
|
-
}
|
|
1876
|
-
return t.nodeSize;
|
|
1877
|
-
}, this.storage.words = (e) => {
|
|
1878
|
-
let t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
|
|
1879
|
-
return this.options.wordCounter(n);
|
|
1880
|
-
};
|
|
1881
|
-
},
|
|
1882
|
-
addProseMirrorPlugins() {
|
|
1883
|
-
let e = !1;
|
|
1884
|
-
return [new E({
|
|
1885
|
-
key: new g("characterCount"),
|
|
1886
|
-
appendTransaction: (t, n, r) => {
|
|
1887
|
-
if (e) return;
|
|
1888
|
-
let i = this.options.limit, a = this.options.autoTrim;
|
|
1889
|
-
if (i == null || i === 0 || a === !1) {
|
|
1890
|
-
e = !0;
|
|
1891
|
-
return;
|
|
1892
|
-
}
|
|
1893
|
-
let o = this.storage.characters({ node: r.doc });
|
|
1894
|
-
if (o > i) {
|
|
1895
|
-
let t = o - i;
|
|
1896
|
-
console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);
|
|
1897
|
-
let n = r.tr.deleteRange(0, t);
|
|
1898
|
-
return e = !0, n;
|
|
1899
|
-
}
|
|
1900
|
-
e = !0;
|
|
1901
|
-
},
|
|
1902
|
-
filterTransaction: (e, t) => {
|
|
1903
|
-
let n = this.options.limit;
|
|
1904
|
-
if (!e.docChanged || n === 0 || n == null) return !0;
|
|
1905
|
-
let r = this.storage.characters({ node: t.doc }), i = this.storage.characters({ node: e.doc });
|
|
1906
|
-
if (i <= n || r > n && i > n && i <= r) return !0;
|
|
1907
|
-
if (r > n && i > n && i > r || !e.getMeta("paste")) return !1;
|
|
1908
|
-
let a = e.selection.$head.pos, o = a - (i - n), s = a;
|
|
1909
|
-
return e.deleteRange(o, s), !(this.storage.characters({ node: e.doc }) > n);
|
|
1910
|
-
}
|
|
1911
|
-
})];
|
|
1912
|
-
}
|
|
1913
|
-
});
|
|
1914
|
-
var Mt = b.create({
|
|
1915
|
-
name: "dropCursor",
|
|
1916
|
-
addOptions() {
|
|
1917
|
-
return {
|
|
1918
|
-
color: "currentColor",
|
|
1919
|
-
width: 1,
|
|
1920
|
-
class: void 0
|
|
1921
|
-
};
|
|
1922
|
-
},
|
|
1923
|
-
addProseMirrorPlugins() {
|
|
1924
|
-
return [ot(this.options)];
|
|
1925
|
-
}
|
|
1926
|
-
});
|
|
1927
|
-
b.create({
|
|
1928
|
-
name: "focus",
|
|
1929
|
-
addOptions() {
|
|
1930
|
-
return {
|
|
1931
|
-
className: "has-focus",
|
|
1932
|
-
mode: "all"
|
|
1933
|
-
};
|
|
1934
|
-
},
|
|
1935
|
-
addProseMirrorPlugins() {
|
|
1936
|
-
return [new E({
|
|
1937
|
-
key: new g("focus"),
|
|
1938
|
-
props: { decorations: ({ doc: e, selection: t }) => {
|
|
1939
|
-
let { isEditable: n, isFocused: r } = this.editor, { anchor: i } = t, a = [];
|
|
1940
|
-
if (!n || !r) return h.create(e, []);
|
|
1941
|
-
let o = 0;
|
|
1942
|
-
this.options.mode === "deepest" && e.descendants((e, t) => {
|
|
1943
|
-
if (!e.isText) {
|
|
1944
|
-
if (!(i >= t && i <= t + e.nodeSize - 1)) return !1;
|
|
1945
|
-
o += 1;
|
|
1946
|
-
}
|
|
1947
|
-
});
|
|
1948
|
-
let s = 0;
|
|
1949
|
-
return e.descendants((e, t) => {
|
|
1950
|
-
if (e.isText || !(i >= t && i <= t + e.nodeSize - 1)) return !1;
|
|
1951
|
-
if (s += 1, this.options.mode === "deepest" && o - s > 0 || this.options.mode === "shallowest" && s > 1) return this.options.mode === "deepest";
|
|
1952
|
-
a.push(y.node(t, t + e.nodeSize, { class: this.options.className }));
|
|
1953
|
-
}), h.create(e, a);
|
|
1954
|
-
} }
|
|
1955
|
-
})];
|
|
1956
|
-
}
|
|
1957
|
-
});
|
|
1958
|
-
var Nt = b.create({
|
|
1959
|
-
name: "gapCursor",
|
|
1960
|
-
addProseMirrorPlugins() {
|
|
1961
|
-
return [ft()];
|
|
1962
|
-
},
|
|
1963
|
-
extendNodeSchema(e) {
|
|
1964
|
-
return { allowGapCursor: m(p(e, "allowGapCursor", {
|
|
1965
|
-
name: e.name,
|
|
1966
|
-
options: e.options,
|
|
1967
|
-
storage: e.storage
|
|
1968
|
-
})) ?? null };
|
|
1969
|
-
}
|
|
1970
|
-
});
|
|
1971
|
-
function Pt(e) {
|
|
1972
|
-
let { editor: t, placeholder: n, dataAttribute: r, pos: i, node: a, isEmptyDoc: o, hasAnchor: s, classes: { emptyNode: c, emptyEditor: l } } = e, u = [c];
|
|
1973
|
-
return o && u.push(l), y.node(i, i + a.nodeSize, {
|
|
1974
|
-
class: u.join(" "),
|
|
1975
|
-
[r]: typeof n == "function" ? n({
|
|
1976
|
-
editor: t,
|
|
1977
|
-
node: a,
|
|
1978
|
-
pos: i,
|
|
1979
|
-
hasAnchor: s
|
|
1980
|
-
}) : n
|
|
1981
|
-
});
|
|
1982
|
-
}
|
|
1983
|
-
function Ft(e) {
|
|
1984
|
-
let t = getComputedStyle(e), n = `${t.overflow} ${t.overflowY} ${t.overflowX}`;
|
|
1985
|
-
return /auto|scroll|overlay/.test(n);
|
|
1986
|
-
}
|
|
1987
|
-
function It(e) {
|
|
1988
|
-
let t = e;
|
|
1989
|
-
for (; t;) {
|
|
1990
|
-
if (Ft(t)) return t;
|
|
1991
|
-
let e = t.parentElement;
|
|
1992
|
-
if (!e) {
|
|
1993
|
-
let e = t.getRootNode();
|
|
1994
|
-
if (e instanceof ShadowRoot) {
|
|
1995
|
-
t = e.host;
|
|
1996
|
-
continue;
|
|
1997
|
-
}
|
|
1998
|
-
return window;
|
|
1999
|
-
}
|
|
2000
|
-
t = e;
|
|
2001
|
-
}
|
|
2002
|
-
return window;
|
|
2003
|
-
}
|
|
2004
|
-
function Lt(e) {
|
|
2005
|
-
return e === window ? {
|
|
2006
|
-
top: 0,
|
|
2007
|
-
bottom: window.innerHeight
|
|
2008
|
-
} : e.getBoundingClientRect();
|
|
2009
|
-
}
|
|
2010
|
-
function Rt({ doc: e, view: t, scrollContainer: n }) {
|
|
2011
|
-
let r = t.dom.getBoundingClientRect(), i = n ? Lt(n) : {
|
|
2012
|
-
top: 0,
|
|
2013
|
-
bottom: window.innerHeight
|
|
2014
|
-
}, a = Math.max(r.top, i.top), o = Math.min(r.bottom, i.bottom);
|
|
2015
|
-
if (a >= o) return {
|
|
2016
|
-
top: 0,
|
|
2017
|
-
bottom: e.content.size
|
|
2018
|
-
};
|
|
2019
|
-
let s = getComputedStyle(t.dom).direction === "rtl" ? Math.max(r.right - 2, r.left + 2) : r.left + 2, c = t.posAtCoords({
|
|
2020
|
-
left: s,
|
|
2021
|
-
top: a + 2
|
|
2022
|
-
}), l = t.posAtCoords({
|
|
2023
|
-
left: s,
|
|
2024
|
-
top: o - 2
|
|
2025
|
-
});
|
|
2026
|
-
return {
|
|
2027
|
-
top: c ? c.pos : 0,
|
|
2028
|
-
bottom: l ? l.pos : e.content.size
|
|
2029
|
-
};
|
|
2030
|
-
}
|
|
2031
|
-
function zt(e, t) {
|
|
2032
|
-
let n = null;
|
|
2033
|
-
return {
|
|
2034
|
-
call: ((...r) => {
|
|
2035
|
-
n ||= (e(...r), setTimeout(() => {
|
|
2036
|
-
n = null;
|
|
2037
|
-
}, t));
|
|
2038
|
-
}),
|
|
2039
|
-
cancel: () => {
|
|
2040
|
-
n &&= (clearTimeout(n), null);
|
|
2041
|
-
}
|
|
2042
|
-
};
|
|
2043
|
-
}
|
|
2044
|
-
var Bt = "placeholder";
|
|
2045
|
-
function Vt(e) {
|
|
2046
|
-
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
2047
|
-
}
|
|
2048
|
-
var Q = new g("tiptap__placeholder");
|
|
2049
|
-
b.create({
|
|
2050
|
-
name: "placeholder",
|
|
2051
|
-
addOptions() {
|
|
2052
|
-
return {
|
|
2053
|
-
emptyEditorClass: "is-editor-empty",
|
|
2054
|
-
emptyNodeClass: "is-empty",
|
|
2055
|
-
dataAttribute: Bt,
|
|
2056
|
-
placeholder: "Write something …",
|
|
2057
|
-
showOnlyWhenEditable: !0,
|
|
2058
|
-
showOnlyCurrent: !0,
|
|
2059
|
-
includeChildren: !1
|
|
2060
|
-
};
|
|
2061
|
-
},
|
|
2062
|
-
addProseMirrorPlugins() {
|
|
2063
|
-
let e = this.options.dataAttribute ? `data-${Vt(this.options.dataAttribute)}` : `data-${Bt}`;
|
|
2064
|
-
return [new E({
|
|
2065
|
-
state: {
|
|
2066
|
-
init() {
|
|
2067
|
-
return {
|
|
2068
|
-
topPos: null,
|
|
2069
|
-
bottomPos: null
|
|
2070
|
-
};
|
|
2071
|
-
},
|
|
2072
|
-
apply(e, t) {
|
|
2073
|
-
let n = e.getMeta(Q);
|
|
2074
|
-
return n?.positions ? {
|
|
2075
|
-
topPos: n.positions.top,
|
|
2076
|
-
bottomPos: n.positions.bottom
|
|
2077
|
-
} : e.docChanged ? {
|
|
2078
|
-
topPos: t.topPos === null ? null : e.mapping.map(t.topPos),
|
|
2079
|
-
bottomPos: t.bottomPos === null ? null : e.mapping.map(t.bottomPos)
|
|
2080
|
-
} : t;
|
|
2081
|
-
}
|
|
2082
|
-
},
|
|
2083
|
-
key: Q,
|
|
2084
|
-
view(e) {
|
|
2085
|
-
let t = It(e.dom), n = () => {
|
|
2086
|
-
let n = Rt({
|
|
2087
|
-
view: e,
|
|
2088
|
-
doc: e.state.doc,
|
|
2089
|
-
scrollContainer: t
|
|
2090
|
-
}), r = Q.getState(e.state);
|
|
2091
|
-
if (r.topPos === n.top && r.bottomPos === n.bottom) return;
|
|
2092
|
-
let i = e.state.tr.setMeta(Q, { positions: n }).setMeta("tiptap__viewportUpdate", !0);
|
|
2093
|
-
e.dispatch(i);
|
|
2094
|
-
}, { call: r, cancel: i } = zt(n, 250), a = t;
|
|
2095
|
-
return a.addEventListener("scroll", r, { passive: !0 }), n(), {
|
|
2096
|
-
update(t, r) {
|
|
2097
|
-
e.state.doc.content.size !== r.doc.content.size && n();
|
|
2098
|
-
},
|
|
2099
|
-
destroy: () => {
|
|
2100
|
-
i(), a.removeEventListener("scroll", r);
|
|
2101
|
-
}
|
|
2102
|
-
};
|
|
2103
|
-
},
|
|
2104
|
-
props: { decorations: ({ doc: t, selection: n }) => {
|
|
2105
|
-
if (!(this.editor.isEditable || !this.options.showOnlyWhenEditable)) return null;
|
|
2106
|
-
let { anchor: r } = n, i = [], a = this.editor.isEmpty;
|
|
2107
|
-
if (this.options.showOnlyCurrent && !this.options.includeChildren) {
|
|
2108
|
-
let n = t.resolve(r);
|
|
2109
|
-
if (n.depth > 0) {
|
|
2110
|
-
let t = n.node(1), s = n.before(1);
|
|
2111
|
-
if (t.type.isTextblock && o(t)) {
|
|
2112
|
-
let o = Pt({
|
|
2113
|
-
node: t,
|
|
2114
|
-
dataAttribute: e,
|
|
2115
|
-
hasAnchor: r >= s && r <= s + t.nodeSize,
|
|
2116
|
-
placeholder: this.options.placeholder,
|
|
2117
|
-
classes: {
|
|
2118
|
-
emptyEditor: this.options.emptyEditorClass,
|
|
2119
|
-
emptyNode: this.options.emptyNodeClass
|
|
2120
|
-
},
|
|
2121
|
-
editor: this.editor,
|
|
2122
|
-
isEmptyDoc: a,
|
|
2123
|
-
pos: n.before(1)
|
|
2124
|
-
});
|
|
2125
|
-
i.push(o);
|
|
2126
|
-
}
|
|
2127
|
-
}
|
|
2128
|
-
} else {
|
|
2129
|
-
let n = Q.getState(this.editor.state), s = n.topPos ?? 0, c = n.bottomPos ?? t.content.size;
|
|
2130
|
-
t.nodesBetween(s, c, (t, n) => {
|
|
2131
|
-
let s = r >= n && r <= n + t.nodeSize, c = !t.isLeaf && o(t);
|
|
2132
|
-
if (!t.type.isTextblock) return this.options.includeChildren;
|
|
2133
|
-
if ((s || !this.options.showOnlyCurrent) && c) {
|
|
2134
|
-
let r = Pt({
|
|
2135
|
-
classes: {
|
|
2136
|
-
emptyEditor: this.options.emptyEditorClass,
|
|
2137
|
-
emptyNode: this.options.emptyNodeClass
|
|
2138
|
-
},
|
|
2139
|
-
editor: this.editor,
|
|
2140
|
-
isEmptyDoc: a,
|
|
2141
|
-
dataAttribute: e,
|
|
2142
|
-
hasAnchor: s,
|
|
2143
|
-
placeholder: this.options.placeholder,
|
|
2144
|
-
node: t,
|
|
2145
|
-
pos: n
|
|
2146
|
-
});
|
|
2147
|
-
i.push(r);
|
|
2148
|
-
}
|
|
2149
|
-
return this.options.includeChildren;
|
|
2150
|
-
});
|
|
2151
|
-
}
|
|
2152
|
-
return h.create(t, i);
|
|
2153
|
-
} }
|
|
2154
|
-
})];
|
|
2155
|
-
}
|
|
2156
|
-
}), b.create({
|
|
2157
|
-
name: "selection",
|
|
2158
|
-
addOptions() {
|
|
2159
|
-
return { className: "selection" };
|
|
2160
|
-
},
|
|
2161
|
-
addProseMirrorPlugins() {
|
|
2162
|
-
let { editor: e, options: t } = this;
|
|
2163
|
-
return [new E({
|
|
2164
|
-
key: new g("selection"),
|
|
2165
|
-
props: { decorations(n) {
|
|
2166
|
-
return n.selection.empty || e.isFocused || !e.isEditable || s(n.selection) || e.view.dragging ? null : h.create(n.doc, [y.inline(n.selection.from, n.selection.to, { class: t.className })]);
|
|
2167
|
-
} }
|
|
2168
|
-
})];
|
|
2169
|
-
}
|
|
2170
|
-
});
|
|
2171
|
-
function Ht({ types: e, node: t }) {
|
|
2172
|
-
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
2173
|
-
}
|
|
2174
|
-
var Ut = b.create({
|
|
2175
|
-
name: "trailingNode",
|
|
2176
|
-
addOptions() {
|
|
2177
|
-
return {
|
|
2178
|
-
node: void 0,
|
|
2179
|
-
notAfter: []
|
|
2180
|
-
};
|
|
2181
|
-
},
|
|
2182
|
-
addProseMirrorPlugins() {
|
|
2183
|
-
let e = new g(this.name), t = this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || "paragraph", n = Object.entries(this.editor.schema.nodes).map(([, e]) => e).filter((e) => (this.options.notAfter || []).concat(t).includes(e.name));
|
|
2184
|
-
return [new E({
|
|
2185
|
-
key: e,
|
|
2186
|
-
appendTransaction: (n, r, i) => {
|
|
2187
|
-
let { doc: a, tr: o, schema: s } = i, c = e.getState(i), l = a.content.size, u = s.nodes[t];
|
|
2188
|
-
if (!n.some((e) => e.getMeta("skipTrailingNode")) && c) return o.insert(l, u.create());
|
|
2189
|
-
},
|
|
2190
|
-
state: {
|
|
2191
|
-
init: (e, t) => {
|
|
2192
|
-
let r = t.tr.doc.lastChild;
|
|
2193
|
-
return !Ht({
|
|
2194
|
-
node: r,
|
|
2195
|
-
types: n
|
|
2196
|
-
});
|
|
2197
|
-
},
|
|
2198
|
-
apply: (e, t) => {
|
|
2199
|
-
if (!e.docChanged || e.getMeta("__uniqueIDTransaction")) return t;
|
|
2200
|
-
let r = e.doc.lastChild;
|
|
2201
|
-
return !Ht({
|
|
2202
|
-
node: r,
|
|
2203
|
-
types: n
|
|
2204
|
-
});
|
|
2205
|
-
}
|
|
2206
|
-
}
|
|
2207
|
-
})];
|
|
2208
|
-
}
|
|
2209
|
-
}), Wt = b.create({
|
|
2210
|
-
name: "undoRedo",
|
|
2211
|
-
addOptions() {
|
|
2212
|
-
return {
|
|
2213
|
-
depth: 100,
|
|
2214
|
-
newGroupDelay: 500
|
|
2215
|
-
};
|
|
2216
|
-
},
|
|
2217
|
-
addCommands() {
|
|
2218
|
-
return {
|
|
2219
|
-
undo: () => ({ state: e, dispatch: t }) => At(e, t),
|
|
2220
|
-
redo: () => ({ state: e, dispatch: t }) => jt(e, t)
|
|
2221
|
-
};
|
|
2222
|
-
},
|
|
2223
|
-
addProseMirrorPlugins() {
|
|
2224
|
-
return [Ot(this.options)];
|
|
2225
|
-
},
|
|
2226
|
-
addKeyboardShortcuts() {
|
|
2227
|
-
return {
|
|
2228
|
-
"Mod-z": () => this.editor.commands.undo(),
|
|
2229
|
-
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
2230
|
-
"Mod-y": () => this.editor.commands.redo(),
|
|
2231
|
-
"Mod-я": () => this.editor.commands.undo(),
|
|
2232
|
-
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
2233
|
-
};
|
|
2234
|
-
}
|
|
2235
|
-
}), $ = b.create({
|
|
2236
|
-
name: "starterKit",
|
|
2237
|
-
addExtensions() {
|
|
2238
|
-
let e = [];
|
|
2239
|
-
return this.options.bold !== !1 && e.push(he.configure(this.options.bold)), this.options.blockquote !== !1 && e.push(ue.configure(this.options.blockquote)), this.options.bulletList !== !1 && e.push(j.configure(this.options.bulletList)), this.options.code !== !1 && e.push(ve.configure(this.options.code)), this.options.codeBlock !== !1 && e.push(xe.configure(this.options.codeBlock)), this.options.document !== !1 && e.push(Se.configure(this.options.document)), this.options.dropcursor !== !1 && e.push(Mt.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && e.push(Nt.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && e.push(Ce.configure(this.options.hardBreak)), this.options.heading !== !1 && e.push(we.configure(this.options.heading)), this.options.undoRedo !== !1 && e.push(Wt.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && e.push(Te.configure(this.options.horizontalRule)), this.options.italic !== !1 && e.push(Ae.configure(this.options.italic)), this.options.listItem !== !1 && e.push(M.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(Be.configure(this.options?.listKeymap)), this.options.link !== !1 && e.push(se.configure(this.options?.link)), this.options.orderedList !== !1 && e.push(Ze.configure(this.options.orderedList)), this.options.paragraph !== !1 && e.push(tt.configure(this.options.paragraph)), this.options.strike !== !1 && e.push(it.configure(this.options.strike)), this.options.text !== !1 && e.push(at.configure(this.options.text)), this.options.underline !== !1 && e.push(ce.configure(this.options?.underline)), this.options.trailingNode !== !1 && e.push(Ut.configure(this.options?.trailingNode)), e;
|
|
2240
|
-
}
|
|
2241
|
-
}), Gt = $;
|
|
2242
|
-
//#endregion
|
|
2243
|
-
export { $ as StarterKit, Gt as default };
|