@opengis/form 0.1.41 → 0.1.42
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/README.md +61 -61
- package/dist/api/suggest/suggestions_list.json +7 -7
- package/dist/index-B9CEJ-PZ.js +187 -0
- package/dist/{index-B1zV9Aax.js → index-Bh8_Wx51.js} +434 -477
- package/dist/index-CHHagWDa.js +2794 -0
- package/dist/{index-W4UOw8lU.js → index-CMmJu2Ql.js} +428 -505
- package/dist/{index-RwV1hx3A.js → index-CQZi4RyF.js} +21 -19
- package/dist/index-C_6bjz0U.js +138 -0
- package/dist/index-D3gVZYzr.js +78 -0
- package/dist/index-DJVijc0x.js +47 -0
- package/dist/{index-B3op5uFx.js → index-DQur75TQ.js} +29 -28
- package/dist/{index-sFkGqyu8.js → index-DsT4tZvp.js} +16 -20
- package/dist/{index-qhd_7MCX.js → index-DspmCbXc.js} +16 -20
- package/dist/index-NlD0ozZg.js +13074 -0
- package/dist/index-z-RdtcIQ.js +11862 -0
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +87 -87
- package/dist/src/components/inputs/array-select/vs-input-array-select.vue.d.ts.map +1 -1
- package/dist/src/components/inputs/date/datepicker/Datepicker.vue.d.ts.map +1 -1
- package/dist/src/components/inputs/table/vs-input-datatable.vue.d.ts.map +1 -1
- package/dist/src/components/inputs/vs-input-inline-select.vue.d.ts.map +1 -1
- package/dist/src/components/inputs/vs-input-select.vue.d.ts.map +1 -1
- package/dist/src/composables/useInputOptions.d.ts +6 -2
- package/dist/src/composables/useInputOptions.d.ts.map +1 -1
- package/dist/src/utils/appendQueryParams.d.ts +2 -0
- package/dist/src/utils/appendQueryParams.d.ts.map +1 -0
- package/dist/{vs-richtext-CffyYtAj.js → vs-richtext-kH3lTqMI.js} +22 -22
- package/locales/en.json +39 -39
- package/locales/uk.json +39 -39
- package/package.json +96 -96
- package/dist/index-BIES3-my.js +0 -3085
- package/dist/index-CeRz4jd4.js +0 -13046
- package/dist/index-CkUvn8lm.js +0 -153
- package/dist/index-D49VHc9h.js +0 -237
- package/dist/index-DZ7xh8lh.js +0 -50
- package/dist/index-MfTTOwHR.js +0 -89
- package/dist/index-pYkcVgEL.js +0 -12134
package/dist/index-BIES3-my.js
DELETED
|
@@ -1,3085 +0,0 @@
|
|
|
1
|
-
import { N as L, w as O, m as v, T as I, M as F, a as D, b as B, P as x, d as E, t as me, S as z, n as Qe, x as et, y as Ce, h as le, E as M, z as Ie, A as G, B as tt, C as nt, F as rt, G as st, H as Ae, c as it, J as ge, K as ot, k as at, D as S, f as Y, L as lt, j as ut, l as ct, O as Se, q as dt } from "./index-pYkcVgEL.js";
|
|
2
|
-
import { Slice as ue, Fragment as K } from "./index-ietpNeqa.js";
|
|
3
|
-
import { Heading as pt } from "./index-B3op5uFx.js";
|
|
4
|
-
import { Link as ht } from "./index-W4UOw8lU.js";
|
|
5
|
-
import { Paragraph as ft } from "./index-DZ7xh8lh.js";
|
|
6
|
-
var q = (e, t) => {
|
|
7
|
-
if (e === "slot")
|
|
8
|
-
return 0;
|
|
9
|
-
if (e instanceof Function)
|
|
10
|
-
return e(t);
|
|
11
|
-
const { children: n, ...r } = t ?? {};
|
|
12
|
-
if (e === "svg")
|
|
13
|
-
throw new Error(
|
|
14
|
-
"SVG elements are not supported in the JSX syntax, use the array syntax instead"
|
|
15
|
-
);
|
|
16
|
-
return [e, r, n];
|
|
17
|
-
}, mt = (e, t) => {
|
|
18
|
-
var n;
|
|
19
|
-
const { state: r } = e, { selection: s } = r;
|
|
20
|
-
if (!s.empty) return !1;
|
|
21
|
-
const { $from: i } = s;
|
|
22
|
-
if (i.parentOffset !== 0) return !1;
|
|
23
|
-
const o = i.depth - 1;
|
|
24
|
-
if (o < 0) return !1;
|
|
25
|
-
const a = i.node(o), l = i.index(o);
|
|
26
|
-
if (l === 0) return !1;
|
|
27
|
-
if (a.type === t)
|
|
28
|
-
return e.commands.lift(t.name);
|
|
29
|
-
const c = a.child(l - 1);
|
|
30
|
-
if (c.type !== t || !((n = c.lastChild) != null && n.isTextblock))
|
|
31
|
-
return !1;
|
|
32
|
-
const p = i.before() - 1 - 1;
|
|
33
|
-
return e.commands.command(({ tr: h, dispatch: f }) => {
|
|
34
|
-
if (!f)
|
|
35
|
-
return !0;
|
|
36
|
-
const m = i.parent.content, g = new ue(m, 0, 0);
|
|
37
|
-
return h.replace(p, i.after(), g), h.setSelection(I.create(h.doc, p + m.size)), h.scrollIntoView(), f(h), !0;
|
|
38
|
-
});
|
|
39
|
-
}, gt = /^\s*>\s$/, yt = L.create({
|
|
40
|
-
name: "blockquote",
|
|
41
|
-
addOptions() {
|
|
42
|
-
return {
|
|
43
|
-
HTMLAttributes: {}
|
|
44
|
-
};
|
|
45
|
-
},
|
|
46
|
-
content: "block+",
|
|
47
|
-
group: "block",
|
|
48
|
-
defining: !0,
|
|
49
|
-
parseHTML() {
|
|
50
|
-
return [{ tag: "blockquote" }];
|
|
51
|
-
},
|
|
52
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
53
|
-
return /* @__PURE__ */ q("blockquote", { ...v(this.options.HTMLAttributes, e), children: /* @__PURE__ */ q("slot", {}) });
|
|
54
|
-
},
|
|
55
|
-
parseMarkdown: (e, t) => {
|
|
56
|
-
var n;
|
|
57
|
-
const r = (n = t.parseBlockChildren) != null ? n : t.parseChildren;
|
|
58
|
-
return t.createNode("blockquote", void 0, r(e.tokens || []));
|
|
59
|
-
},
|
|
60
|
-
renderMarkdown: (e, t) => {
|
|
61
|
-
if (!e.content)
|
|
62
|
-
return "";
|
|
63
|
-
const n = ">", r = [];
|
|
64
|
-
return e.content.forEach((s, i) => {
|
|
65
|
-
var o, a;
|
|
66
|
-
const d = ((a = (o = t.renderChild) == null ? void 0 : o.call(t, s, i)) != null ? a : t.renderChildren([s])).split(`
|
|
67
|
-
`).map((u) => u.trim() === "" ? n : `${n} ${u}`);
|
|
68
|
-
r.push(d.join(`
|
|
69
|
-
`));
|
|
70
|
-
}), r.join(`
|
|
71
|
-
${n}
|
|
72
|
-
`);
|
|
73
|
-
},
|
|
74
|
-
addCommands() {
|
|
75
|
-
return {
|
|
76
|
-
setBlockquote: () => ({ commands: e }) => e.wrapIn(this.name),
|
|
77
|
-
toggleBlockquote: () => ({ commands: e }) => e.toggleWrap(this.name),
|
|
78
|
-
unsetBlockquote: () => ({ commands: e }) => e.lift(this.name)
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
addKeyboardShortcuts() {
|
|
82
|
-
return {
|
|
83
|
-
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote(),
|
|
84
|
-
Backspace: () => mt(this.editor, this.type)
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
addInputRules() {
|
|
88
|
-
return [
|
|
89
|
-
O({
|
|
90
|
-
find: gt,
|
|
91
|
-
type: this.type
|
|
92
|
-
})
|
|
93
|
-
];
|
|
94
|
-
}
|
|
95
|
-
}), kt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, vt = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, bt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, Mt = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, wt = F.create({
|
|
96
|
-
name: "bold",
|
|
97
|
-
addOptions() {
|
|
98
|
-
return {
|
|
99
|
-
HTMLAttributes: {}
|
|
100
|
-
};
|
|
101
|
-
},
|
|
102
|
-
parseHTML() {
|
|
103
|
-
return [
|
|
104
|
-
{
|
|
105
|
-
tag: "strong"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
tag: "b",
|
|
109
|
-
getAttrs: (e) => e.style.fontWeight !== "normal" && null
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
style: "font-weight=400",
|
|
113
|
-
clearMark: (e) => e.type.name === this.name
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
style: "font-weight",
|
|
117
|
-
getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
|
|
118
|
-
}
|
|
119
|
-
];
|
|
120
|
-
},
|
|
121
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
122
|
-
return /* @__PURE__ */ q("strong", { ...v(this.options.HTMLAttributes, e), children: /* @__PURE__ */ q("slot", {}) });
|
|
123
|
-
},
|
|
124
|
-
markdownTokenName: "strong",
|
|
125
|
-
parseMarkdown: (e, t) => t.applyMark("bold", t.parseInline(e.tokens || [])),
|
|
126
|
-
markdownOptions: {
|
|
127
|
-
htmlReopen: {
|
|
128
|
-
open: "<strong>",
|
|
129
|
-
close: "</strong>"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
renderMarkdown: (e, t) => `**${t.renderChildren(e)}**`,
|
|
133
|
-
addCommands() {
|
|
134
|
-
return {
|
|
135
|
-
setBold: () => ({ commands: e }) => e.setMark(this.name),
|
|
136
|
-
toggleBold: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
137
|
-
unsetBold: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
138
|
-
};
|
|
139
|
-
},
|
|
140
|
-
addKeyboardShortcuts() {
|
|
141
|
-
return {
|
|
142
|
-
"Mod-b": () => this.editor.commands.toggleBold(),
|
|
143
|
-
"Mod-B": () => this.editor.commands.toggleBold()
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
addInputRules() {
|
|
147
|
-
return [
|
|
148
|
-
B({
|
|
149
|
-
find: kt,
|
|
150
|
-
type: this.type
|
|
151
|
-
}),
|
|
152
|
-
B({
|
|
153
|
-
find: bt,
|
|
154
|
-
type: this.type
|
|
155
|
-
})
|
|
156
|
-
];
|
|
157
|
-
},
|
|
158
|
-
addPasteRules() {
|
|
159
|
-
return [
|
|
160
|
-
D({
|
|
161
|
-
find: vt,
|
|
162
|
-
type: this.type
|
|
163
|
-
}),
|
|
164
|
-
D({
|
|
165
|
-
find: Mt,
|
|
166
|
-
type: this.type
|
|
167
|
-
})
|
|
168
|
-
];
|
|
169
|
-
}
|
|
170
|
-
}), Lt = (e) => {
|
|
171
|
-
const t = /`([^`]+)`(?!`)$/.exec(e);
|
|
172
|
-
return !t || t.index > 0 && e[t.index - 1] === "`" ? null : {
|
|
173
|
-
index: t.index,
|
|
174
|
-
text: t[0],
|
|
175
|
-
replaceWith: t[1]
|
|
176
|
-
};
|
|
177
|
-
}, Tt = (e) => {
|
|
178
|
-
const t = /`([^`]+)`(?!`)/g, n = [];
|
|
179
|
-
let r;
|
|
180
|
-
for (; (r = t.exec(e)) !== null; )
|
|
181
|
-
r.index > 0 && e[r.index - 1] === "`" || n.push({
|
|
182
|
-
index: r.index,
|
|
183
|
-
text: r[0],
|
|
184
|
-
replaceWith: r[1]
|
|
185
|
-
});
|
|
186
|
-
return n;
|
|
187
|
-
}, xt = F.create({
|
|
188
|
-
name: "code",
|
|
189
|
-
addOptions() {
|
|
190
|
-
return {
|
|
191
|
-
HTMLAttributes: {}
|
|
192
|
-
};
|
|
193
|
-
},
|
|
194
|
-
excludes: "_",
|
|
195
|
-
code: !0,
|
|
196
|
-
exitable: !0,
|
|
197
|
-
parseHTML() {
|
|
198
|
-
return [{ tag: "code" }];
|
|
199
|
-
},
|
|
200
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
201
|
-
return ["code", v(this.options.HTMLAttributes, e), 0];
|
|
202
|
-
},
|
|
203
|
-
markdownTokenName: "codespan",
|
|
204
|
-
parseMarkdown: (e, t) => t.applyMark("code", [{ type: "text", text: e.text || "" }]),
|
|
205
|
-
renderMarkdown: (e, t) => e.content ? `\`${t.renderChildren(e.content)}\`` : "",
|
|
206
|
-
addCommands() {
|
|
207
|
-
return {
|
|
208
|
-
setCode: () => ({ commands: e }) => e.setMark(this.name),
|
|
209
|
-
toggleCode: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
210
|
-
unsetCode: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
211
|
-
};
|
|
212
|
-
},
|
|
213
|
-
addKeyboardShortcuts() {
|
|
214
|
-
return {
|
|
215
|
-
"Mod-e": () => this.editor.commands.toggleCode()
|
|
216
|
-
};
|
|
217
|
-
},
|
|
218
|
-
addInputRules() {
|
|
219
|
-
return [
|
|
220
|
-
B({
|
|
221
|
-
find: Lt,
|
|
222
|
-
type: this.type
|
|
223
|
-
})
|
|
224
|
-
];
|
|
225
|
-
},
|
|
226
|
-
addPasteRules() {
|
|
227
|
-
return [
|
|
228
|
-
D({
|
|
229
|
-
find: Tt,
|
|
230
|
-
type: this.type
|
|
231
|
-
})
|
|
232
|
-
];
|
|
233
|
-
}
|
|
234
|
-
}), te = 4, Ct = /^```([a-z]+)?[\s\n]$/, It = /^~~~([a-z]+)?[\s\n]$/, At = L.create({
|
|
235
|
-
name: "codeBlock",
|
|
236
|
-
addOptions() {
|
|
237
|
-
return {
|
|
238
|
-
languageClassPrefix: "language-",
|
|
239
|
-
exitOnTripleEnter: !0,
|
|
240
|
-
exitOnArrowDown: !0,
|
|
241
|
-
exitOnArrowUp: !0,
|
|
242
|
-
defaultLanguage: null,
|
|
243
|
-
enableTabIndentation: !1,
|
|
244
|
-
tabSize: te,
|
|
245
|
-
HTMLAttributes: {}
|
|
246
|
-
};
|
|
247
|
-
},
|
|
248
|
-
content: "text*",
|
|
249
|
-
marks: "",
|
|
250
|
-
group: "block",
|
|
251
|
-
code: !0,
|
|
252
|
-
defining: !0,
|
|
253
|
-
addAttributes() {
|
|
254
|
-
return {
|
|
255
|
-
language: {
|
|
256
|
-
default: this.options.defaultLanguage,
|
|
257
|
-
parseHTML: (e) => {
|
|
258
|
-
var t;
|
|
259
|
-
const { languageClassPrefix: n } = this.options;
|
|
260
|
-
if (!n)
|
|
261
|
-
return null;
|
|
262
|
-
const i = [...((t = e.firstElementChild) == null ? void 0 : t.classList) || []].filter((o) => o.startsWith(n)).map((o) => o.replace(n, ""))[0];
|
|
263
|
-
return i || null;
|
|
264
|
-
},
|
|
265
|
-
rendered: !1
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
},
|
|
269
|
-
parseHTML() {
|
|
270
|
-
return [
|
|
271
|
-
{
|
|
272
|
-
tag: "pre",
|
|
273
|
-
preserveWhitespace: "full"
|
|
274
|
-
}
|
|
275
|
-
];
|
|
276
|
-
},
|
|
277
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
278
|
-
return [
|
|
279
|
-
"pre",
|
|
280
|
-
v(this.options.HTMLAttributes, t),
|
|
281
|
-
[
|
|
282
|
-
"code",
|
|
283
|
-
{
|
|
284
|
-
class: e.attrs.language ? this.options.languageClassPrefix + e.attrs.language : null
|
|
285
|
-
},
|
|
286
|
-
0
|
|
287
|
-
]
|
|
288
|
-
];
|
|
289
|
-
},
|
|
290
|
-
markdownTokenName: "code",
|
|
291
|
-
parseMarkdown: (e, t) => {
|
|
292
|
-
var n, r;
|
|
293
|
-
return ((n = e.raw) == null ? void 0 : n.startsWith("```")) === !1 && ((r = e.raw) == null ? void 0 : r.startsWith("~~~")) === !1 && e.codeBlockStyle !== "indented" ? [] : t.createNode(
|
|
294
|
-
"codeBlock",
|
|
295
|
-
{ language: e.lang || null },
|
|
296
|
-
e.text ? [t.createTextNode(e.text)] : []
|
|
297
|
-
);
|
|
298
|
-
},
|
|
299
|
-
renderMarkdown: (e, t) => {
|
|
300
|
-
var n;
|
|
301
|
-
let r = "";
|
|
302
|
-
const s = ((n = e.attrs) == null ? void 0 : n.language) || "";
|
|
303
|
-
return e.content ? r = [`\`\`\`${s}`, t.renderChildren(e.content), "```"].join(`
|
|
304
|
-
`) : r = `\`\`\`${s}
|
|
305
|
-
|
|
306
|
-
\`\`\``, r;
|
|
307
|
-
},
|
|
308
|
-
addCommands() {
|
|
309
|
-
return {
|
|
310
|
-
setCodeBlock: (e) => ({ commands: t }) => t.setNode(this.name, e),
|
|
311
|
-
toggleCodeBlock: (e) => ({ commands: t }) => t.toggleNode(this.name, "paragraph", e)
|
|
312
|
-
};
|
|
313
|
-
},
|
|
314
|
-
addKeyboardShortcuts() {
|
|
315
|
-
return {
|
|
316
|
-
"Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
|
|
317
|
-
// remove code block when at start of document or code block is empty
|
|
318
|
-
Backspace: () => {
|
|
319
|
-
const { empty: e, $anchor: t } = this.editor.state.selection, n = t.pos === 1;
|
|
320
|
-
return !e || t.parent.type.name !== this.name ? !1 : n || !t.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
|
|
321
|
-
},
|
|
322
|
-
// handle tab indentation
|
|
323
|
-
Tab: ({ editor: e }) => {
|
|
324
|
-
var t;
|
|
325
|
-
if (!this.options.enableTabIndentation)
|
|
326
|
-
return !1;
|
|
327
|
-
const n = (t = this.options.tabSize) != null ? t : te, { state: r } = e, { selection: s } = r, { $from: i, empty: o } = s;
|
|
328
|
-
if (i.parent.type !== this.type)
|
|
329
|
-
return !1;
|
|
330
|
-
const a = " ".repeat(n);
|
|
331
|
-
return o ? e.commands.insertContent(a) : e.commands.command(({ tr: l }) => {
|
|
332
|
-
const { from: c, to: d } = s, h = r.doc.textBetween(c, d, `
|
|
333
|
-
`, `
|
|
334
|
-
`).split(`
|
|
335
|
-
`).map((f) => a + f).join(`
|
|
336
|
-
`);
|
|
337
|
-
return l.replaceWith(c, d, r.schema.text(h)), !0;
|
|
338
|
-
});
|
|
339
|
-
},
|
|
340
|
-
// handle shift+tab reverse indentation
|
|
341
|
-
"Shift-Tab": ({ editor: e }) => {
|
|
342
|
-
var t;
|
|
343
|
-
if (!this.options.enableTabIndentation)
|
|
344
|
-
return !1;
|
|
345
|
-
const n = (t = this.options.tabSize) != null ? t : te, { state: r } = e, { selection: s } = r, { $from: i, empty: o } = s;
|
|
346
|
-
return i.parent.type !== this.type ? !1 : o ? e.commands.command(({ tr: a }) => {
|
|
347
|
-
var l;
|
|
348
|
-
const { pos: c } = i, d = i.start(), u = i.end(), h = r.doc.textBetween(d, u, `
|
|
349
|
-
`, `
|
|
350
|
-
`).split(`
|
|
351
|
-
`);
|
|
352
|
-
let f = 0, m = 0;
|
|
353
|
-
const g = c - d;
|
|
354
|
-
for (let C = 0; C < h.length; C += 1) {
|
|
355
|
-
if (m + h[C].length >= g) {
|
|
356
|
-
f = C;
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
m += h[C].length + 1;
|
|
360
|
-
}
|
|
361
|
-
const b = ((l = h[f].match(/^ */)) == null ? void 0 : l[0]) || "", V = Math.min(b.length, n);
|
|
362
|
-
if (V === 0)
|
|
363
|
-
return !0;
|
|
364
|
-
let P = d;
|
|
365
|
-
for (let C = 0; C < f; C += 1)
|
|
366
|
-
P += h[C].length + 1;
|
|
367
|
-
return a.delete(P, P + V), c - P <= V && a.setSelection(I.create(a.doc, P)), !0;
|
|
368
|
-
}) : e.commands.command(({ tr: a }) => {
|
|
369
|
-
const { from: l, to: c } = s, p = r.doc.textBetween(l, c, `
|
|
370
|
-
`, `
|
|
371
|
-
`).split(`
|
|
372
|
-
`).map((h) => {
|
|
373
|
-
var f;
|
|
374
|
-
const m = ((f = h.match(/^ */)) == null ? void 0 : f[0]) || "", g = Math.min(m.length, n);
|
|
375
|
-
return h.slice(g);
|
|
376
|
-
}).join(`
|
|
377
|
-
`);
|
|
378
|
-
return a.replaceWith(l, c, r.schema.text(p)), !0;
|
|
379
|
-
});
|
|
380
|
-
},
|
|
381
|
-
// exit node on triple enter
|
|
382
|
-
Enter: ({ editor: e }) => {
|
|
383
|
-
if (!this.options.exitOnTripleEnter)
|
|
384
|
-
return !1;
|
|
385
|
-
const { state: t } = e, { selection: n } = t, { $from: r, empty: s } = n;
|
|
386
|
-
if (!s || r.parent.type !== this.type)
|
|
387
|
-
return !1;
|
|
388
|
-
const i = r.parentOffset === r.parent.nodeSize - 2, o = r.parent.textContent.endsWith(`
|
|
389
|
-
|
|
390
|
-
`);
|
|
391
|
-
return !i || !o ? !1 : e.chain().command(({ tr: a }) => (a.delete(r.pos - 2, r.pos), !0)).exitCode().run();
|
|
392
|
-
},
|
|
393
|
-
// exit node on arrow up if there is no node before it
|
|
394
|
-
ArrowUp: ({ editor: e }) => {
|
|
395
|
-
if (!this.options.exitOnArrowUp)
|
|
396
|
-
return !1;
|
|
397
|
-
const { state: t } = e, { selection: n } = t, { $from: r, empty: s } = n;
|
|
398
|
-
if (!s || r.parent.type !== this.type || r.parentOffset !== 0)
|
|
399
|
-
return !1;
|
|
400
|
-
const i = r.before();
|
|
401
|
-
return i > 0 ? !1 : e.commands.insertDefaultBlock({ pos: i });
|
|
402
|
-
},
|
|
403
|
-
// exit node on arrow down
|
|
404
|
-
ArrowDown: ({ editor: e }) => {
|
|
405
|
-
if (!this.options.exitOnArrowDown)
|
|
406
|
-
return !1;
|
|
407
|
-
const { state: t } = e, { selection: n, doc: r } = t, { $from: s, empty: i } = n;
|
|
408
|
-
if (!i || s.parent.type !== this.type || !(s.parentOffset === s.parent.nodeSize - 2))
|
|
409
|
-
return !1;
|
|
410
|
-
const a = s.after();
|
|
411
|
-
return a === void 0 ? !1 : r.nodeAt(a) ? e.commands.command(({ tr: c }) => (c.setSelection(z.near(r.resolve(a))), !0)) : e.commands.exitCode();
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
},
|
|
415
|
-
addInputRules() {
|
|
416
|
-
return [
|
|
417
|
-
me({
|
|
418
|
-
find: Ct,
|
|
419
|
-
type: this.type,
|
|
420
|
-
getAttributes: (e) => ({
|
|
421
|
-
language: e[1]
|
|
422
|
-
})
|
|
423
|
-
}),
|
|
424
|
-
me({
|
|
425
|
-
find: It,
|
|
426
|
-
type: this.type,
|
|
427
|
-
getAttributes: (e) => ({
|
|
428
|
-
language: e[1]
|
|
429
|
-
})
|
|
430
|
-
})
|
|
431
|
-
];
|
|
432
|
-
},
|
|
433
|
-
addProseMirrorPlugins() {
|
|
434
|
-
return [
|
|
435
|
-
// this plugin creates a code block for pasted content from VS Code
|
|
436
|
-
// we can also detect the copied code language
|
|
437
|
-
new x({
|
|
438
|
-
key: new E("codeBlockVSCodeHandler"),
|
|
439
|
-
props: {
|
|
440
|
-
handlePaste: (e, t) => {
|
|
441
|
-
if (!t.clipboardData || this.editor.isActive(this.type.name))
|
|
442
|
-
return !1;
|
|
443
|
-
const n = t.clipboardData.getData("text/plain"), r = t.clipboardData.getData("vscode-editor-data"), s = r ? JSON.parse(r) : void 0, i = s?.mode;
|
|
444
|
-
if (!n || !i)
|
|
445
|
-
return !1;
|
|
446
|
-
const { tr: o, schema: a } = e.state, l = a.text(n.replace(/\r\n?/g, `
|
|
447
|
-
`));
|
|
448
|
-
return o.replaceSelectionWith(this.type.create({ language: i }, l)), o.selection.$from.parent.type !== this.type && o.setSelection(
|
|
449
|
-
I.near(o.doc.resolve(Math.max(0, o.selection.from - 2)))
|
|
450
|
-
), o.setMeta("paste", !0), e.dispatch(o), !0;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
})
|
|
454
|
-
];
|
|
455
|
-
}
|
|
456
|
-
}), St = L.create({
|
|
457
|
-
name: "doc",
|
|
458
|
-
topNode: !0,
|
|
459
|
-
content: "block+",
|
|
460
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
|
|
461
|
-
|
|
462
|
-
`) : ""
|
|
463
|
-
}), Et = L.create({
|
|
464
|
-
name: "hardBreak",
|
|
465
|
-
markdownTokenName: "br",
|
|
466
|
-
addOptions() {
|
|
467
|
-
return {
|
|
468
|
-
keepMarks: !0,
|
|
469
|
-
HTMLAttributes: {}
|
|
470
|
-
};
|
|
471
|
-
},
|
|
472
|
-
inline: !0,
|
|
473
|
-
group: "inline",
|
|
474
|
-
selectable: !1,
|
|
475
|
-
linebreakReplacement: !0,
|
|
476
|
-
parseHTML() {
|
|
477
|
-
return [{ tag: "br" }];
|
|
478
|
-
},
|
|
479
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
480
|
-
return ["br", v(this.options.HTMLAttributes, e)];
|
|
481
|
-
},
|
|
482
|
-
renderText() {
|
|
483
|
-
return `
|
|
484
|
-
`;
|
|
485
|
-
},
|
|
486
|
-
renderMarkdown: () => `
|
|
487
|
-
`,
|
|
488
|
-
parseMarkdown: () => ({
|
|
489
|
-
type: "hardBreak"
|
|
490
|
-
}),
|
|
491
|
-
addCommands() {
|
|
492
|
-
return {
|
|
493
|
-
setHardBreak: () => ({ commands: e, chain: t, state: n, editor: r }) => e.first([
|
|
494
|
-
() => e.exitCode(),
|
|
495
|
-
() => e.command(() => {
|
|
496
|
-
const { selection: s, storedMarks: i } = n;
|
|
497
|
-
if (s.$from.parent.type.spec.isolating)
|
|
498
|
-
return !1;
|
|
499
|
-
const { keepMarks: o } = this.options, { splittableMarks: a } = r.extensionManager, l = i || s.$to.parentOffset && s.$from.marks();
|
|
500
|
-
return t().insertContent({ type: this.name }).command(({ tr: c, dispatch: d }) => {
|
|
501
|
-
if (d && l && o) {
|
|
502
|
-
const u = l.filter(
|
|
503
|
-
(p) => a.includes(p.type.name)
|
|
504
|
-
);
|
|
505
|
-
c.ensureMarks(u);
|
|
506
|
-
}
|
|
507
|
-
return !0;
|
|
508
|
-
}).scrollIntoView().run();
|
|
509
|
-
})
|
|
510
|
-
])
|
|
511
|
-
};
|
|
512
|
-
},
|
|
513
|
-
addKeyboardShortcuts() {
|
|
514
|
-
return {
|
|
515
|
-
"Mod-Enter": () => this.editor.commands.setHardBreak(),
|
|
516
|
-
"Shift-Enter": () => this.editor.commands.setHardBreak()
|
|
517
|
-
};
|
|
518
|
-
}
|
|
519
|
-
}), Rt = L.create({
|
|
520
|
-
name: "horizontalRule",
|
|
521
|
-
addOptions() {
|
|
522
|
-
return {
|
|
523
|
-
HTMLAttributes: {},
|
|
524
|
-
nextNodeType: "paragraph"
|
|
525
|
-
};
|
|
526
|
-
},
|
|
527
|
-
group: "block",
|
|
528
|
-
parseHTML() {
|
|
529
|
-
return [{ tag: "hr" }];
|
|
530
|
-
},
|
|
531
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
532
|
-
return ["hr", v(this.options.HTMLAttributes, e)];
|
|
533
|
-
},
|
|
534
|
-
markdownTokenName: "hr",
|
|
535
|
-
parseMarkdown: (e, t) => t.createNode("horizontalRule"),
|
|
536
|
-
renderMarkdown: () => "---",
|
|
537
|
-
addCommands() {
|
|
538
|
-
return {
|
|
539
|
-
setHorizontalRule: () => ({ chain: e, state: t }) => {
|
|
540
|
-
if (!et(t, t.schema.nodes[this.name]))
|
|
541
|
-
return !1;
|
|
542
|
-
const { selection: n } = t, { $to: r } = n, s = e();
|
|
543
|
-
return Ce(n) ? s.insertContentAt(r.pos, {
|
|
544
|
-
type: this.name
|
|
545
|
-
}) : s.insertContent({ type: this.name }), s.command(({ state: i, tr: o, dispatch: a }) => {
|
|
546
|
-
if (a) {
|
|
547
|
-
const { $to: l } = o.selection, c = l.end();
|
|
548
|
-
if (l.nodeAfter)
|
|
549
|
-
l.nodeAfter.isTextblock ? o.setSelection(I.create(o.doc, l.pos + 1)) : l.nodeAfter.isBlock ? o.setSelection(le.create(o.doc, l.pos)) : o.setSelection(I.create(o.doc, l.pos));
|
|
550
|
-
else {
|
|
551
|
-
const d = i.schema.nodes[this.options.nextNodeType] || l.parent.type.contentMatch.defaultType, u = d?.create();
|
|
552
|
-
u && (o.insert(c, u), o.setSelection(I.create(o.doc, c + 1)));
|
|
553
|
-
}
|
|
554
|
-
o.scrollIntoView();
|
|
555
|
-
}
|
|
556
|
-
return !0;
|
|
557
|
-
}).run();
|
|
558
|
-
}
|
|
559
|
-
};
|
|
560
|
-
},
|
|
561
|
-
addInputRules() {
|
|
562
|
-
return [
|
|
563
|
-
Qe({
|
|
564
|
-
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
|
565
|
-
type: this.type
|
|
566
|
-
})
|
|
567
|
-
];
|
|
568
|
-
}
|
|
569
|
-
}), Pt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, Nt = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, _t = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, Ot = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, Dt = F.create({
|
|
570
|
-
name: "italic",
|
|
571
|
-
addOptions() {
|
|
572
|
-
return {
|
|
573
|
-
HTMLAttributes: {}
|
|
574
|
-
};
|
|
575
|
-
},
|
|
576
|
-
parseHTML() {
|
|
577
|
-
return [
|
|
578
|
-
{
|
|
579
|
-
tag: "em"
|
|
580
|
-
},
|
|
581
|
-
{
|
|
582
|
-
tag: "i",
|
|
583
|
-
getAttrs: (e) => e.style.fontStyle !== "normal" && null
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
style: "font-style=normal",
|
|
587
|
-
clearMark: (e) => e.type.name === this.name
|
|
588
|
-
},
|
|
589
|
-
{
|
|
590
|
-
style: "font-style=italic"
|
|
591
|
-
}
|
|
592
|
-
];
|
|
593
|
-
},
|
|
594
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
595
|
-
return ["em", v(this.options.HTMLAttributes, e), 0];
|
|
596
|
-
},
|
|
597
|
-
addCommands() {
|
|
598
|
-
return {
|
|
599
|
-
setItalic: () => ({ commands: e }) => e.setMark(this.name),
|
|
600
|
-
toggleItalic: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
601
|
-
unsetItalic: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
602
|
-
};
|
|
603
|
-
},
|
|
604
|
-
markdownTokenName: "em",
|
|
605
|
-
parseMarkdown: (e, t) => t.applyMark("italic", t.parseInline(e.tokens || [])),
|
|
606
|
-
markdownOptions: {
|
|
607
|
-
htmlReopen: {
|
|
608
|
-
open: "<em>",
|
|
609
|
-
close: "</em>"
|
|
610
|
-
}
|
|
611
|
-
},
|
|
612
|
-
renderMarkdown: (e, t) => `*${t.renderChildren(e)}*`,
|
|
613
|
-
addKeyboardShortcuts() {
|
|
614
|
-
return {
|
|
615
|
-
"Mod-i": () => this.editor.commands.toggleItalic(),
|
|
616
|
-
"Mod-I": () => this.editor.commands.toggleItalic()
|
|
617
|
-
};
|
|
618
|
-
},
|
|
619
|
-
addInputRules() {
|
|
620
|
-
return [
|
|
621
|
-
B({
|
|
622
|
-
find: Pt,
|
|
623
|
-
type: this.type
|
|
624
|
-
}),
|
|
625
|
-
B({
|
|
626
|
-
find: _t,
|
|
627
|
-
type: this.type
|
|
628
|
-
})
|
|
629
|
-
];
|
|
630
|
-
},
|
|
631
|
-
addPasteRules() {
|
|
632
|
-
return [
|
|
633
|
-
D({
|
|
634
|
-
find: Nt,
|
|
635
|
-
type: this.type
|
|
636
|
-
}),
|
|
637
|
-
D({
|
|
638
|
-
find: Ot,
|
|
639
|
-
type: this.type
|
|
640
|
-
})
|
|
641
|
-
];
|
|
642
|
-
}
|
|
643
|
-
}), Bt = Object.defineProperty, Ht = (e, t) => {
|
|
644
|
-
for (var n in t)
|
|
645
|
-
Bt(e, n, { get: t[n], enumerable: !0 });
|
|
646
|
-
}, $t = "listItem", ye = "textStyle", ke = /^\s*([-+*])\s$/, Ee = L.create({
|
|
647
|
-
name: "bulletList",
|
|
648
|
-
addOptions() {
|
|
649
|
-
return {
|
|
650
|
-
itemTypeName: "listItem",
|
|
651
|
-
HTMLAttributes: {},
|
|
652
|
-
keepMarks: !1,
|
|
653
|
-
keepAttributes: !1
|
|
654
|
-
};
|
|
655
|
-
},
|
|
656
|
-
group: "block list",
|
|
657
|
-
content() {
|
|
658
|
-
return `${this.options.itemTypeName}+`;
|
|
659
|
-
},
|
|
660
|
-
parseHTML() {
|
|
661
|
-
return [{ tag: "ul" }];
|
|
662
|
-
},
|
|
663
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
664
|
-
return ["ul", v(this.options.HTMLAttributes, e), 0];
|
|
665
|
-
},
|
|
666
|
-
markdownTokenName: "list",
|
|
667
|
-
parseMarkdown: (e, t) => e.type !== "list" || e.ordered ? [] : {
|
|
668
|
-
type: "bulletList",
|
|
669
|
-
content: e.items ? t.parseChildren(e.items) : []
|
|
670
|
-
},
|
|
671
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
|
|
672
|
-
`) : "",
|
|
673
|
-
markdownOptions: {
|
|
674
|
-
indentsContent: !0
|
|
675
|
-
},
|
|
676
|
-
addCommands() {
|
|
677
|
-
return {
|
|
678
|
-
toggleBulletList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes($t, this.editor.getAttributes(ye)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
679
|
-
};
|
|
680
|
-
},
|
|
681
|
-
addKeyboardShortcuts() {
|
|
682
|
-
return {
|
|
683
|
-
"Mod-Shift-8": () => this.editor.commands.toggleBulletList()
|
|
684
|
-
};
|
|
685
|
-
},
|
|
686
|
-
addInputRules() {
|
|
687
|
-
let e = O({
|
|
688
|
-
find: ke,
|
|
689
|
-
type: this.type
|
|
690
|
-
});
|
|
691
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (e = O({
|
|
692
|
-
find: ke,
|
|
693
|
-
type: this.type,
|
|
694
|
-
keepMarks: this.options.keepMarks,
|
|
695
|
-
keepAttributes: this.options.keepAttributes,
|
|
696
|
-
getAttributes: () => this.editor.getAttributes(ye),
|
|
697
|
-
editor: this.editor
|
|
698
|
-
})), [e];
|
|
699
|
-
}
|
|
700
|
-
}), zt = (e, t, n) => {
|
|
701
|
-
const { selection: r } = e;
|
|
702
|
-
if (!r.empty)
|
|
703
|
-
return null;
|
|
704
|
-
const { $from: s } = r;
|
|
705
|
-
if (!s.parent.isTextblock || s.parentOffset !== s.parent.content.size)
|
|
706
|
-
return null;
|
|
707
|
-
let i = -1;
|
|
708
|
-
for (let h = s.depth; h > 0; h -= 1)
|
|
709
|
-
if (s.node(h).type.name === t) {
|
|
710
|
-
i = h;
|
|
711
|
-
break;
|
|
712
|
-
}
|
|
713
|
-
if (i < 0)
|
|
714
|
-
return null;
|
|
715
|
-
const o = s.node(i), a = s.index(i);
|
|
716
|
-
if (a + 1 >= o.childCount)
|
|
717
|
-
return null;
|
|
718
|
-
const l = o.child(a + 1);
|
|
719
|
-
if (!n.includes(l.type.name))
|
|
720
|
-
return null;
|
|
721
|
-
const c = e.schema.nodes[t];
|
|
722
|
-
let d = !1;
|
|
723
|
-
if (l.forEach((h) => {
|
|
724
|
-
h.type === c && h.childCount > 1 && (d = !0);
|
|
725
|
-
}), !d)
|
|
726
|
-
return null;
|
|
727
|
-
const u = e.doc.resolve(s.after()).nodeAfter;
|
|
728
|
-
if (!u || !n.includes(u.type.name))
|
|
729
|
-
return null;
|
|
730
|
-
const p = [];
|
|
731
|
-
return u.forEach((h) => {
|
|
732
|
-
p.push(h);
|
|
733
|
-
}), p.length === 0 ? null : {
|
|
734
|
-
listItemDepth: i,
|
|
735
|
-
nestedList: u,
|
|
736
|
-
nestedListPos: s.after(),
|
|
737
|
-
insertPos: s.after(i),
|
|
738
|
-
items: p
|
|
739
|
-
};
|
|
740
|
-
}, Kt = (e, t, n, r) => {
|
|
741
|
-
const s = zt(e, n, r);
|
|
742
|
-
if (!s)
|
|
743
|
-
return !1;
|
|
744
|
-
const { selection: i } = e, { nestedList: o, nestedListPos: a, insertPos: l, items: c } = s, d = e.tr;
|
|
745
|
-
d.delete(a, a + o.nodeSize);
|
|
746
|
-
const u = d.mapping.map(l);
|
|
747
|
-
return d.insert(u, K.from(c)), d.setSelection(i.map(d.doc, d.mapping)), t && t(d), !0;
|
|
748
|
-
}, Ft = (e, t, n) => Kt(e.state, e.view.dispatch, t, n), Re = (e, t) => M.create({
|
|
749
|
-
name: `${e}BranchingDeleteKeymap`,
|
|
750
|
-
priority: 101,
|
|
751
|
-
addKeyboardShortcuts() {
|
|
752
|
-
const n = () => Ft(this.editor, e, t);
|
|
753
|
-
return {
|
|
754
|
-
Delete: n,
|
|
755
|
-
"Mod-Delete": n
|
|
756
|
-
};
|
|
757
|
-
}
|
|
758
|
-
}), Pe = [
|
|
759
|
-
[1e3, "m"],
|
|
760
|
-
[900, "cm"],
|
|
761
|
-
[500, "d"],
|
|
762
|
-
[400, "cd"],
|
|
763
|
-
[100, "c"],
|
|
764
|
-
[90, "xc"],
|
|
765
|
-
[50, "l"],
|
|
766
|
-
[40, "xl"],
|
|
767
|
-
[10, "x"],
|
|
768
|
-
[9, "ix"],
|
|
769
|
-
[5, "v"],
|
|
770
|
-
[4, "iv"],
|
|
771
|
-
[1, "i"]
|
|
772
|
-
], j = "abcdefghijklmnopqrstuvwxyz", Vt = "[a-zA-Z]{1,2}", Ne = String.raw`\d+|[ivxlcdmIVXLCDM]+|${Vt}`;
|
|
773
|
-
function Z(e) {
|
|
774
|
-
let t = e, n = "";
|
|
775
|
-
for (const [r, s] of Pe)
|
|
776
|
-
for (; t >= r; )
|
|
777
|
-
n += s, t -= r;
|
|
778
|
-
return n;
|
|
779
|
-
}
|
|
780
|
-
function ce(e) {
|
|
781
|
-
return Z(e).toUpperCase();
|
|
782
|
-
}
|
|
783
|
-
function _e(e) {
|
|
784
|
-
const t = e.toLowerCase();
|
|
785
|
-
let n = 0, r = 0;
|
|
786
|
-
for (; n < t.length; ) {
|
|
787
|
-
let s = !1;
|
|
788
|
-
for (const [i, o] of Pe)
|
|
789
|
-
if (t.startsWith(o, n)) {
|
|
790
|
-
r += i, n += o.length, s = !0;
|
|
791
|
-
break;
|
|
792
|
-
}
|
|
793
|
-
if (!s)
|
|
794
|
-
return 0;
|
|
795
|
-
}
|
|
796
|
-
return r;
|
|
797
|
-
}
|
|
798
|
-
function jt(e) {
|
|
799
|
-
if (!/^[ivxlcdmIVXLCDM]+$/.test(e))
|
|
800
|
-
return !1;
|
|
801
|
-
const t = _e(e);
|
|
802
|
-
return t <= 0 ? !1 : (e === e.toLowerCase() ? Z(t) : ce(t)) === e;
|
|
803
|
-
}
|
|
804
|
-
function Wt(e) {
|
|
805
|
-
const t = e.toLowerCase();
|
|
806
|
-
if (t.length === 1)
|
|
807
|
-
return t.charCodeAt(0) - 97 + 1;
|
|
808
|
-
if (t.length === 2) {
|
|
809
|
-
const n = t.charCodeAt(0) - 97, r = t.charCodeAt(1) - 97;
|
|
810
|
-
return (n + 1) * 26 + r + 1;
|
|
811
|
-
}
|
|
812
|
-
return 0;
|
|
813
|
-
}
|
|
814
|
-
function X(e) {
|
|
815
|
-
if (e <= 26)
|
|
816
|
-
return j[e - 1];
|
|
817
|
-
const t = Math.floor((e - 1) / 26) - 1, n = (e - 1) % 26;
|
|
818
|
-
return t < 0 ? j[n] : j[t] + j[n];
|
|
819
|
-
}
|
|
820
|
-
function Q(e) {
|
|
821
|
-
if (!(!e || /^\d+$/.test(e))) {
|
|
822
|
-
if (jt(e))
|
|
823
|
-
return e === e.toLowerCase() ? "i" : "I";
|
|
824
|
-
if (/^[a-z]{1,2}$/.test(e))
|
|
825
|
-
return "a";
|
|
826
|
-
if (/^[A-Z]{1,2}$/.test(e))
|
|
827
|
-
return "A";
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
function de(e) {
|
|
831
|
-
if (/^\d+$/.test(e))
|
|
832
|
-
return parseInt(e, 10);
|
|
833
|
-
const t = Q(e);
|
|
834
|
-
if (t === "i" || t === "I")
|
|
835
|
-
return _e(e);
|
|
836
|
-
if (t === "a" || t === "A") {
|
|
837
|
-
const r = Wt(e);
|
|
838
|
-
return r > 0 ? r : 1;
|
|
839
|
-
}
|
|
840
|
-
const n = parseInt(e, 10);
|
|
841
|
-
return Number.isNaN(n) ? 1 : n;
|
|
842
|
-
}
|
|
843
|
-
function Ut(e, t) {
|
|
844
|
-
if (e === "numeric")
|
|
845
|
-
return String(t);
|
|
846
|
-
switch (e) {
|
|
847
|
-
case "a":
|
|
848
|
-
return X(t);
|
|
849
|
-
case "A":
|
|
850
|
-
return X(t).toUpperCase();
|
|
851
|
-
case "i":
|
|
852
|
-
return Z(t);
|
|
853
|
-
case "I":
|
|
854
|
-
return ce(t);
|
|
855
|
-
default:
|
|
856
|
-
return String(t);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
function Gt(e) {
|
|
860
|
-
var t;
|
|
861
|
-
if (e.length === 0)
|
|
862
|
-
return !1;
|
|
863
|
-
const n = (t = Q(e[0])) != null ? t : "numeric", r = de(e[0]);
|
|
864
|
-
if (r < 1)
|
|
865
|
-
return !1;
|
|
866
|
-
for (let s = 0; s < e.length; s++) {
|
|
867
|
-
const i = Ut(n, r + s);
|
|
868
|
-
if (e[s] !== i)
|
|
869
|
-
return !1;
|
|
870
|
-
}
|
|
871
|
-
return !0;
|
|
872
|
-
}
|
|
873
|
-
function qt(e) {
|
|
874
|
-
return {
|
|
875
|
-
type: Q(e),
|
|
876
|
-
start: de(e)
|
|
877
|
-
};
|
|
878
|
-
}
|
|
879
|
-
function Xt(e) {
|
|
880
|
-
const { type: t, start: n } = qt(e), r = {};
|
|
881
|
-
return t && (r.type = t), n !== 1 && (r.start = n), r;
|
|
882
|
-
}
|
|
883
|
-
function Jt(e, t, n = ". ") {
|
|
884
|
-
const r = t + 1;
|
|
885
|
-
if (!e || e === "1")
|
|
886
|
-
return `${r}${n}`;
|
|
887
|
-
switch (e) {
|
|
888
|
-
case "a":
|
|
889
|
-
return `${X(r)}${n}`;
|
|
890
|
-
case "A":
|
|
891
|
-
return `${X(r).toUpperCase()}${n}`;
|
|
892
|
-
case "i":
|
|
893
|
-
return `${Z(r)}${n}`;
|
|
894
|
-
case "I":
|
|
895
|
-
return `${ce(r)}${n}`;
|
|
896
|
-
default:
|
|
897
|
-
return `${r}${n}`;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
function Yt(e) {
|
|
901
|
-
var t, n;
|
|
902
|
-
const r = (t = e.tokens) == null ? void 0 : t[0];
|
|
903
|
-
return !!(e.text && ((n = e.tokens) == null ? void 0 : n.length) === 1 && r?.type === "list" && r.ordered && r.raw === e.text);
|
|
904
|
-
}
|
|
905
|
-
function Zt(e, t) {
|
|
906
|
-
return t.tokenizeInline ? t.parseInline(t.tokenizeInline(e)) : t.parseInline([
|
|
907
|
-
{
|
|
908
|
-
type: "text",
|
|
909
|
-
raw: e,
|
|
910
|
-
text: e
|
|
911
|
-
}
|
|
912
|
-
]);
|
|
913
|
-
}
|
|
914
|
-
var Oe = L.create({
|
|
915
|
-
name: "listItem",
|
|
916
|
-
addOptions() {
|
|
917
|
-
return {
|
|
918
|
-
HTMLAttributes: {},
|
|
919
|
-
bulletListTypeName: "bulletList",
|
|
920
|
-
orderedListTypeName: "orderedList"
|
|
921
|
-
};
|
|
922
|
-
},
|
|
923
|
-
content: "paragraph block*",
|
|
924
|
-
defining: !0,
|
|
925
|
-
parseHTML() {
|
|
926
|
-
return [
|
|
927
|
-
{
|
|
928
|
-
tag: "li"
|
|
929
|
-
}
|
|
930
|
-
];
|
|
931
|
-
},
|
|
932
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
933
|
-
return ["li", v(this.options.HTMLAttributes, e), 0];
|
|
934
|
-
},
|
|
935
|
-
markdownTokenName: "list_item",
|
|
936
|
-
parseMarkdown: (e, t) => {
|
|
937
|
-
var n;
|
|
938
|
-
if (e.type !== "list_item")
|
|
939
|
-
return [];
|
|
940
|
-
const r = (n = t.parseBlockChildren) != null ? n : t.parseChildren;
|
|
941
|
-
let s = [];
|
|
942
|
-
if (e.tokens && e.tokens.length > 0) {
|
|
943
|
-
if (Yt(e))
|
|
944
|
-
return {
|
|
945
|
-
type: "listItem",
|
|
946
|
-
content: [
|
|
947
|
-
{
|
|
948
|
-
type: "paragraph",
|
|
949
|
-
content: Zt(e.text || "", t)
|
|
950
|
-
}
|
|
951
|
-
]
|
|
952
|
-
};
|
|
953
|
-
if (e.tokens.some((o) => o.type === "paragraph"))
|
|
954
|
-
s = r(e.tokens);
|
|
955
|
-
else {
|
|
956
|
-
const o = e.tokens[0];
|
|
957
|
-
if (o && o.type === "text" && o.tokens && o.tokens.length > 0) {
|
|
958
|
-
if (s = [
|
|
959
|
-
{
|
|
960
|
-
type: "paragraph",
|
|
961
|
-
content: t.parseInline(o.tokens)
|
|
962
|
-
}
|
|
963
|
-
], e.tokens.length > 1) {
|
|
964
|
-
const l = e.tokens.slice(1), c = r(l);
|
|
965
|
-
s.push(...c);
|
|
966
|
-
}
|
|
967
|
-
} else
|
|
968
|
-
s = r(e.tokens);
|
|
969
|
-
}
|
|
970
|
-
}
|
|
971
|
-
return s.length === 0 && (s = [
|
|
972
|
-
{
|
|
973
|
-
type: "paragraph",
|
|
974
|
-
content: []
|
|
975
|
-
}
|
|
976
|
-
]), {
|
|
977
|
-
type: "listItem",
|
|
978
|
-
content: s
|
|
979
|
-
};
|
|
980
|
-
},
|
|
981
|
-
renderMarkdown: (e, t, n) => Ie(
|
|
982
|
-
e,
|
|
983
|
-
t,
|
|
984
|
-
(r) => {
|
|
985
|
-
var s, i, o, a;
|
|
986
|
-
if (r.parentType === "bulletList")
|
|
987
|
-
return "- ";
|
|
988
|
-
if (r.parentType === "orderedList") {
|
|
989
|
-
const l = ((i = (s = r.meta) == null ? void 0 : s.parentAttrs) == null ? void 0 : i.start) || 1, c = (a = (o = r.meta) == null ? void 0 : o.parentAttrs) == null ? void 0 : a.type, d = l - 1 + (r.index || 0);
|
|
990
|
-
return Jt(c, d, ". ");
|
|
991
|
-
}
|
|
992
|
-
return "- ";
|
|
993
|
-
},
|
|
994
|
-
n
|
|
995
|
-
),
|
|
996
|
-
addExtensions() {
|
|
997
|
-
return [
|
|
998
|
-
Re(this.name, [
|
|
999
|
-
this.options.bulletListTypeName,
|
|
1000
|
-
this.options.orderedListTypeName
|
|
1001
|
-
])
|
|
1002
|
-
];
|
|
1003
|
-
},
|
|
1004
|
-
addKeyboardShortcuts() {
|
|
1005
|
-
return {
|
|
1006
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
1007
|
-
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
1008
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
1009
|
-
};
|
|
1010
|
-
}
|
|
1011
|
-
}), Qt = {};
|
|
1012
|
-
Ht(Qt, {
|
|
1013
|
-
findListItemPos: () => ee,
|
|
1014
|
-
getNextListDepth: () => pe,
|
|
1015
|
-
handleBackspace: () => se,
|
|
1016
|
-
handleDelete: () => ie,
|
|
1017
|
-
handleTab: () => $e,
|
|
1018
|
-
hasListBefore: () => De,
|
|
1019
|
-
hasListItemAfter: () => en,
|
|
1020
|
-
hasListItemBefore: () => tn,
|
|
1021
|
-
listItemHasSubList: () => nn,
|
|
1022
|
-
nextListIsDeeper: () => Be,
|
|
1023
|
-
nextListIsHigher: () => He
|
|
1024
|
-
});
|
|
1025
|
-
var ee = (e, t) => {
|
|
1026
|
-
const { $from: n } = t.selection, r = Ae(e, t.schema);
|
|
1027
|
-
let s = null, i = n.depth, o = n.pos, a = null;
|
|
1028
|
-
for (; i > 0 && a === null; )
|
|
1029
|
-
s = n.node(i), s.type === r ? a = i : (i -= 1, o -= 1);
|
|
1030
|
-
return a === null ? null : { $pos: t.doc.resolve(o), depth: a };
|
|
1031
|
-
}, pe = (e, t) => {
|
|
1032
|
-
const n = ee(e, t);
|
|
1033
|
-
if (!n)
|
|
1034
|
-
return !1;
|
|
1035
|
-
const [, r] = st(t, e, n.$pos.pos + 4);
|
|
1036
|
-
return r;
|
|
1037
|
-
}, De = (e, t, n) => {
|
|
1038
|
-
const { $anchor: r } = e.selection, s = Math.max(0, r.pos - 2), i = e.doc.resolve(s).node();
|
|
1039
|
-
return !(!i || !n.includes(i.type.name));
|
|
1040
|
-
}, se = (e, t, n) => {
|
|
1041
|
-
if (e.commands.undoInputRule())
|
|
1042
|
-
return !0;
|
|
1043
|
-
if (e.state.selection.from !== e.state.selection.to)
|
|
1044
|
-
return !1;
|
|
1045
|
-
if (!G(e.state, t) && De(e.state, t, n)) {
|
|
1046
|
-
const { $anchor: i } = e.state.selection, o = e.state.doc.resolve(i.before() - 1), a = [];
|
|
1047
|
-
o.node().descendants((d, u) => {
|
|
1048
|
-
d.type.name === t && a.push({ node: d, pos: u });
|
|
1049
|
-
});
|
|
1050
|
-
const l = a.at(-1);
|
|
1051
|
-
if (!l)
|
|
1052
|
-
return !1;
|
|
1053
|
-
const c = e.state.doc.resolve(o.start() + l.pos + 1);
|
|
1054
|
-
return e.chain().cut({ from: i.start() - 1, to: i.end() + 1 }, c.end()).joinForward().run();
|
|
1055
|
-
}
|
|
1056
|
-
if (!G(e.state, t) || !nt(e.state))
|
|
1057
|
-
return !1;
|
|
1058
|
-
const { $from: r } = e.state.selection, s = r.depth - 1;
|
|
1059
|
-
return r.node(s).type !== e.schema.nodes[t] || r.index(s) !== 0 ? !1 : e.chain().liftListItem(t).run();
|
|
1060
|
-
}, Be = (e, t) => {
|
|
1061
|
-
const n = pe(e, t), r = ee(e, t);
|
|
1062
|
-
return !r || !n ? !1 : n > r.depth;
|
|
1063
|
-
}, He = (e, t) => {
|
|
1064
|
-
const n = pe(e, t), r = ee(e, t);
|
|
1065
|
-
return !r || !n ? !1 : n < r.depth;
|
|
1066
|
-
}, ie = (e, t) => {
|
|
1067
|
-
if (!G(e.state, t) || !rt(e.state, t))
|
|
1068
|
-
return !1;
|
|
1069
|
-
const { selection: n } = e.state, { $from: r, $to: s } = n;
|
|
1070
|
-
return !n.empty && r.sameParent(s) ? !1 : Be(t, e.state) ? e.chain().focus(e.state.selection.from + 4).lift(t).joinBackward().run() : He(t, e.state) ? e.chain().joinForward().joinBackward().run() : e.commands.joinItemForward();
|
|
1071
|
-
}, $e = (e, t, n) => {
|
|
1072
|
-
const { state: r } = e, { selection: s } = r;
|
|
1073
|
-
if (!s.empty) return !1;
|
|
1074
|
-
const { $from: i } = s;
|
|
1075
|
-
if (i.parentOffset !== 0 || !i.parent.isTextblock || G(r, t)) return !1;
|
|
1076
|
-
const o = tt(i);
|
|
1077
|
-
if (!o || !n.includes(o.type.name)) return !1;
|
|
1078
|
-
const a = o.lastChild;
|
|
1079
|
-
if (!a || a.type.name !== t) return !1;
|
|
1080
|
-
const l = i.parent;
|
|
1081
|
-
if (!a.canReplace(a.childCount, a.childCount, K.from(l)))
|
|
1082
|
-
return !1;
|
|
1083
|
-
const c = i.before(), d = i.after(), u = c - 2;
|
|
1084
|
-
return e.commands.command(({ tr: p, dispatch: h }) => (h && (p.delete(c, d).insert(u, K.from(l)), p.setSelection(I.create(p.doc, u + 1)), p.scrollIntoView()), !0));
|
|
1085
|
-
}, en = (e, t) => {
|
|
1086
|
-
var n;
|
|
1087
|
-
const { $anchor: r } = t.selection, s = t.doc.resolve(r.pos - r.parentOffset - 2);
|
|
1088
|
-
return !(s.index() === s.parent.childCount - 1 || ((n = s.nodeAfter) == null ? void 0 : n.type.name) !== e);
|
|
1089
|
-
}, tn = (e, t) => {
|
|
1090
|
-
var n;
|
|
1091
|
-
const { $anchor: r } = t.selection, s = t.doc.resolve(r.pos - 2);
|
|
1092
|
-
return !(s.index() === 0 || ((n = s.nodeBefore) == null ? void 0 : n.type.name) !== e);
|
|
1093
|
-
}, nn = (e, t, n) => {
|
|
1094
|
-
if (!n)
|
|
1095
|
-
return !1;
|
|
1096
|
-
const r = Ae(e, t.schema);
|
|
1097
|
-
let s = !1;
|
|
1098
|
-
return n.descendants((i) => {
|
|
1099
|
-
i.type === r && (s = !0);
|
|
1100
|
-
}), s;
|
|
1101
|
-
}, ze = M.create({
|
|
1102
|
-
name: "listKeymap",
|
|
1103
|
-
addOptions() {
|
|
1104
|
-
return {
|
|
1105
|
-
listTypes: [
|
|
1106
|
-
{
|
|
1107
|
-
itemName: "listItem",
|
|
1108
|
-
wrapperNames: ["bulletList", "orderedList"]
|
|
1109
|
-
},
|
|
1110
|
-
{
|
|
1111
|
-
itemName: "taskItem",
|
|
1112
|
-
wrapperNames: ["taskList"]
|
|
1113
|
-
}
|
|
1114
|
-
]
|
|
1115
|
-
};
|
|
1116
|
-
},
|
|
1117
|
-
addKeyboardShortcuts() {
|
|
1118
|
-
return {
|
|
1119
|
-
Delete: ({ editor: e }) => {
|
|
1120
|
-
let t = !1;
|
|
1121
|
-
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
1122
|
-
e.state.schema.nodes[n] !== void 0 && ie(e, n) && (t = !0);
|
|
1123
|
-
}), t;
|
|
1124
|
-
},
|
|
1125
|
-
"Mod-Delete": ({ editor: e }) => {
|
|
1126
|
-
let t = !1;
|
|
1127
|
-
return this.options.listTypes.forEach(({ itemName: n }) => {
|
|
1128
|
-
e.state.schema.nodes[n] !== void 0 && ie(e, n) && (t = !0);
|
|
1129
|
-
}), t;
|
|
1130
|
-
},
|
|
1131
|
-
Backspace: ({ editor: e }) => {
|
|
1132
|
-
let t = !1;
|
|
1133
|
-
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
1134
|
-
e.state.schema.nodes[n] !== void 0 && se(e, n, r) && (t = !0);
|
|
1135
|
-
}), t;
|
|
1136
|
-
},
|
|
1137
|
-
"Mod-Backspace": ({ editor: e }) => {
|
|
1138
|
-
let t = !1;
|
|
1139
|
-
return this.options.listTypes.forEach(({ itemName: n, wrapperNames: r }) => {
|
|
1140
|
-
e.state.schema.nodes[n] !== void 0 && se(e, n, r) && (t = !0);
|
|
1141
|
-
}), t;
|
|
1142
|
-
},
|
|
1143
|
-
Tab: ({ editor: e }) => {
|
|
1144
|
-
for (const { itemName: t, wrapperNames: n } of this.options.listTypes)
|
|
1145
|
-
if (e.state.schema.nodes[t] !== void 0 && $e(e, t, n))
|
|
1146
|
-
return !0;
|
|
1147
|
-
return !1;
|
|
1148
|
-
}
|
|
1149
|
-
};
|
|
1150
|
-
}
|
|
1151
|
-
}), oe = new RegExp(
|
|
1152
|
-
`^(\\s*)(${Ne})([.)])\\s+(.*)$`
|
|
1153
|
-
), rn = /^\s/, _ = {
|
|
1154
|
-
heading: /^#{1,6}(?:\s|$)/,
|
|
1155
|
-
bulletItem: /^[-+*]\s+/,
|
|
1156
|
-
codeFence: /^(?:```|~~~)/,
|
|
1157
|
-
blockMath: /^\$\$/,
|
|
1158
|
-
thematicBreak: /^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/
|
|
1159
|
-
};
|
|
1160
|
-
function sn(e) {
|
|
1161
|
-
return oe.test(e.trimStart());
|
|
1162
|
-
}
|
|
1163
|
-
function on(e) {
|
|
1164
|
-
const t = e.trimStart();
|
|
1165
|
-
return _.bulletItem.test(t) || sn(t) || _.heading.test(t) || // dash breaks are excluded: "---" directly below paragraph text is a
|
|
1166
|
-
// setext heading underline, not a thematic break
|
|
1167
|
-
_.thematicBreak.test(t) && !t.startsWith("-") || // oxlint-disable-next-line prefer-string-starts-ends-with
|
|
1168
|
-
/^>\s?/.test(t) || _.codeFence.test(t) || _.blockMath.test(t);
|
|
1169
|
-
}
|
|
1170
|
-
function an(e) {
|
|
1171
|
-
return Object.values(_).some((t) => t.test(e));
|
|
1172
|
-
}
|
|
1173
|
-
function ln(e) {
|
|
1174
|
-
const t = [], n = [];
|
|
1175
|
-
let r = !1;
|
|
1176
|
-
return e.forEach((s) => {
|
|
1177
|
-
if (r) {
|
|
1178
|
-
n.push(s);
|
|
1179
|
-
return;
|
|
1180
|
-
}
|
|
1181
|
-
if (s.trim() === "") {
|
|
1182
|
-
r = !0, n.push(s);
|
|
1183
|
-
return;
|
|
1184
|
-
}
|
|
1185
|
-
if (t.length > 0 && on(s)) {
|
|
1186
|
-
r = !0, n.push(s);
|
|
1187
|
-
return;
|
|
1188
|
-
}
|
|
1189
|
-
t.push(s);
|
|
1190
|
-
}), {
|
|
1191
|
-
paragraphLines: t,
|
|
1192
|
-
blockLines: n
|
|
1193
|
-
};
|
|
1194
|
-
}
|
|
1195
|
-
function un(e) {
|
|
1196
|
-
const t = [];
|
|
1197
|
-
let n = 0, r = 0;
|
|
1198
|
-
for (; n < e.length; ) {
|
|
1199
|
-
const s = e[n], i = s.match(oe);
|
|
1200
|
-
if (!i)
|
|
1201
|
-
break;
|
|
1202
|
-
const [, o, a, l, c] = i, d = o.length, u = parseInt(a, 10), p = isNaN(u) ? Q(a) : void 0, h = isNaN(u) ? de(a) : u, f = [c];
|
|
1203
|
-
let m = n + 1;
|
|
1204
|
-
const g = [s];
|
|
1205
|
-
let R = !1;
|
|
1206
|
-
for (; m < e.length; ) {
|
|
1207
|
-
const b = e[m];
|
|
1208
|
-
if (b.match(oe))
|
|
1209
|
-
break;
|
|
1210
|
-
if (b.trim() === "")
|
|
1211
|
-
g.push(b), f.push(""), R = !0, m += 1;
|
|
1212
|
-
else if (b.match(rn)) {
|
|
1213
|
-
const P = b.length - b.trimStart().length, fe = d + a.length + 1;
|
|
1214
|
-
g.push(b), f.push(b.slice(Math.min(P, fe))), m += 1;
|
|
1215
|
-
} else {
|
|
1216
|
-
if (R || an(b))
|
|
1217
|
-
break;
|
|
1218
|
-
g.push(b), f.push(b), m += 1;
|
|
1219
|
-
}
|
|
1220
|
-
}
|
|
1221
|
-
t.push({
|
|
1222
|
-
indent: d,
|
|
1223
|
-
number: h,
|
|
1224
|
-
type: p,
|
|
1225
|
-
content: f.join(`
|
|
1226
|
-
`).trim(),
|
|
1227
|
-
contentLines: f,
|
|
1228
|
-
raw: g.join(`
|
|
1229
|
-
`)
|
|
1230
|
-
}), r = m, n = m;
|
|
1231
|
-
}
|
|
1232
|
-
return [t, r];
|
|
1233
|
-
}
|
|
1234
|
-
var cn = new RegExp(
|
|
1235
|
-
`^(${Ne})([.)])\\s+(.+)$`
|
|
1236
|
-
);
|
|
1237
|
-
function dn(e) {
|
|
1238
|
-
const t = e.split(`
|
|
1239
|
-
`).filter((i) => i.trim().length > 0);
|
|
1240
|
-
if (t.length === 0)
|
|
1241
|
-
return null;
|
|
1242
|
-
const n = [];
|
|
1243
|
-
for (const i of t) {
|
|
1244
|
-
const o = i.trim().match(cn);
|
|
1245
|
-
if (!o)
|
|
1246
|
-
return null;
|
|
1247
|
-
n.push({
|
|
1248
|
-
marker: o[1],
|
|
1249
|
-
content: o[3]
|
|
1250
|
-
});
|
|
1251
|
-
}
|
|
1252
|
-
const r = n.map((i) => i.marker);
|
|
1253
|
-
return Gt(r) ? {
|
|
1254
|
-
type: "orderedList",
|
|
1255
|
-
attrs: Xt(n[0].marker),
|
|
1256
|
-
content: n.map((i) => ({
|
|
1257
|
-
type: "listItem",
|
|
1258
|
-
content: [
|
|
1259
|
-
{
|
|
1260
|
-
type: "paragraph",
|
|
1261
|
-
content: [{ type: "text", text: i.content }]
|
|
1262
|
-
}
|
|
1263
|
-
]
|
|
1264
|
-
}))
|
|
1265
|
-
} : null;
|
|
1266
|
-
}
|
|
1267
|
-
function Ke(e, t, n) {
|
|
1268
|
-
const r = [];
|
|
1269
|
-
let s = 0;
|
|
1270
|
-
for (; s < e.length; ) {
|
|
1271
|
-
const i = e[s];
|
|
1272
|
-
if (i.indent === t) {
|
|
1273
|
-
const { paragraphLines: o, blockLines: a } = ln(i.contentLines), l = o.join(`
|
|
1274
|
-
`).trim(), c = [];
|
|
1275
|
-
l && c.push({
|
|
1276
|
-
type: "paragraph",
|
|
1277
|
-
raw: l,
|
|
1278
|
-
tokens: n.inlineTokens(l)
|
|
1279
|
-
});
|
|
1280
|
-
const d = a.join(`
|
|
1281
|
-
`).trim();
|
|
1282
|
-
if (d) {
|
|
1283
|
-
const h = n.blockTokens(d);
|
|
1284
|
-
c.push(...h);
|
|
1285
|
-
}
|
|
1286
|
-
let u = s + 1;
|
|
1287
|
-
const p = [];
|
|
1288
|
-
for (; u < e.length && e[u].indent > t; )
|
|
1289
|
-
p.push(e[u]), u += 1;
|
|
1290
|
-
if (p.length > 0) {
|
|
1291
|
-
const h = Math.min(...p.map((m) => m.indent)), f = Ke(p, h, n);
|
|
1292
|
-
c.push({
|
|
1293
|
-
type: "list",
|
|
1294
|
-
ordered: !0,
|
|
1295
|
-
start: p[0].number,
|
|
1296
|
-
typeMarker: p[0].type,
|
|
1297
|
-
items: f,
|
|
1298
|
-
raw: p.map((m) => m.raw).join(`
|
|
1299
|
-
`)
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1302
|
-
r.push({
|
|
1303
|
-
type: "list_item",
|
|
1304
|
-
raw: i.raw,
|
|
1305
|
-
tokens: c
|
|
1306
|
-
}), s = u;
|
|
1307
|
-
} else
|
|
1308
|
-
s += 1;
|
|
1309
|
-
}
|
|
1310
|
-
return r;
|
|
1311
|
-
}
|
|
1312
|
-
function pn(e, t) {
|
|
1313
|
-
return e.map((n) => {
|
|
1314
|
-
if (n.type !== "list_item")
|
|
1315
|
-
return t.parseChildren([n])[0];
|
|
1316
|
-
const r = [];
|
|
1317
|
-
return n.tokens && n.tokens.length > 0 && n.tokens.forEach((s) => {
|
|
1318
|
-
if (s.type === "paragraph" || s.type === "list" || s.type === "blockquote" || s.type === "code")
|
|
1319
|
-
r.push(...t.parseChildren([s]));
|
|
1320
|
-
else if (s.type === "text" && s.tokens) {
|
|
1321
|
-
const i = t.parseChildren([s]);
|
|
1322
|
-
r.push({
|
|
1323
|
-
type: "paragraph",
|
|
1324
|
-
content: i
|
|
1325
|
-
});
|
|
1326
|
-
} else {
|
|
1327
|
-
const i = t.parseChildren([s]);
|
|
1328
|
-
i.length > 0 && r.push(...i);
|
|
1329
|
-
}
|
|
1330
|
-
}), {
|
|
1331
|
-
type: "listItem",
|
|
1332
|
-
content: r
|
|
1333
|
-
};
|
|
1334
|
-
});
|
|
1335
|
-
}
|
|
1336
|
-
var hn = "listItem", ve = "textStyle", be = /^(\d+)\.\s$/;
|
|
1337
|
-
function Me(e) {
|
|
1338
|
-
const t = e.match(/list-style-type\s*:\s*([^;]+)/i);
|
|
1339
|
-
if (!t)
|
|
1340
|
-
return null;
|
|
1341
|
-
switch (t[1].trim().toLowerCase()) {
|
|
1342
|
-
case "upper-roman":
|
|
1343
|
-
return "I";
|
|
1344
|
-
case "lower-roman":
|
|
1345
|
-
return "i";
|
|
1346
|
-
case "upper-alpha":
|
|
1347
|
-
case "upper-latin":
|
|
1348
|
-
return "A";
|
|
1349
|
-
case "lower-alpha":
|
|
1350
|
-
case "lower-latin":
|
|
1351
|
-
return "a";
|
|
1352
|
-
default:
|
|
1353
|
-
return null;
|
|
1354
|
-
}
|
|
1355
|
-
}
|
|
1356
|
-
var Fe = L.create({
|
|
1357
|
-
name: "orderedList",
|
|
1358
|
-
addOptions() {
|
|
1359
|
-
return {
|
|
1360
|
-
itemTypeName: "listItem",
|
|
1361
|
-
HTMLAttributes: {},
|
|
1362
|
-
keepMarks: !1,
|
|
1363
|
-
keepAttributes: !1
|
|
1364
|
-
};
|
|
1365
|
-
},
|
|
1366
|
-
group: "block list",
|
|
1367
|
-
content() {
|
|
1368
|
-
return `${this.options.itemTypeName}+`;
|
|
1369
|
-
},
|
|
1370
|
-
addAttributes() {
|
|
1371
|
-
return {
|
|
1372
|
-
start: {
|
|
1373
|
-
default: 1,
|
|
1374
|
-
parseHTML: (e) => e.hasAttribute("start") ? parseInt(e.getAttribute("start") || "", 10) : 1
|
|
1375
|
-
},
|
|
1376
|
-
type: {
|
|
1377
|
-
default: null,
|
|
1378
|
-
parseHTML: (e) => {
|
|
1379
|
-
const t = e.getAttribute("type");
|
|
1380
|
-
if (t)
|
|
1381
|
-
return t;
|
|
1382
|
-
const n = e.getAttribute("style");
|
|
1383
|
-
if (n) {
|
|
1384
|
-
const s = Me(n);
|
|
1385
|
-
if (s)
|
|
1386
|
-
return s;
|
|
1387
|
-
}
|
|
1388
|
-
const r = e.querySelector("li");
|
|
1389
|
-
if (r) {
|
|
1390
|
-
const s = r.getAttribute("style");
|
|
1391
|
-
if (s) {
|
|
1392
|
-
const i = Me(s);
|
|
1393
|
-
if (i)
|
|
1394
|
-
return i;
|
|
1395
|
-
}
|
|
1396
|
-
}
|
|
1397
|
-
return null;
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
};
|
|
1401
|
-
},
|
|
1402
|
-
parseHTML() {
|
|
1403
|
-
return [
|
|
1404
|
-
{
|
|
1405
|
-
tag: "ol"
|
|
1406
|
-
}
|
|
1407
|
-
];
|
|
1408
|
-
},
|
|
1409
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1410
|
-
const { start: t, type: n, ...r } = e, s = v(this.options.HTMLAttributes, r);
|
|
1411
|
-
return t !== 1 && (s.start = t), n && n !== "1" && (s.type = n), ["ol", s, 0];
|
|
1412
|
-
},
|
|
1413
|
-
markdownTokenName: "list",
|
|
1414
|
-
parseMarkdown: (e, t) => {
|
|
1415
|
-
if (e.type !== "list" || !e.ordered)
|
|
1416
|
-
return [];
|
|
1417
|
-
const n = e.start || 1, r = e.typeMarker, s = e.items ? pn(e.items, t) : [], i = {};
|
|
1418
|
-
return n !== 1 && (i.start = n), r && (i.type = r), Object.keys(i).length > 0 ? {
|
|
1419
|
-
type: "orderedList",
|
|
1420
|
-
attrs: i,
|
|
1421
|
-
content: s
|
|
1422
|
-
} : {
|
|
1423
|
-
type: "orderedList",
|
|
1424
|
-
content: s
|
|
1425
|
-
};
|
|
1426
|
-
},
|
|
1427
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
|
|
1428
|
-
`) : "",
|
|
1429
|
-
markdownTokenizer: {
|
|
1430
|
-
name: "orderedList",
|
|
1431
|
-
level: "block",
|
|
1432
|
-
// marked already breaks paragraphs before a start-of-line list marker. It
|
|
1433
|
-
// probes this with `src.slice(1)`, so any marker it surfaces here is
|
|
1434
|
-
// mid-line (like the "216)" in "(216) 555-1234") and must not start a list.
|
|
1435
|
-
// We still define the callback so marked does not fall back to probing
|
|
1436
|
-
// `tokenize`, which would re-introduce the mid-line split.
|
|
1437
|
-
start: () => -1,
|
|
1438
|
-
tokenize: (e, t, n) => {
|
|
1439
|
-
var r, s;
|
|
1440
|
-
const i = e.split(`
|
|
1441
|
-
`), [o, a] = un(i);
|
|
1442
|
-
if (o.length === 0)
|
|
1443
|
-
return;
|
|
1444
|
-
const l = Ke(o, o[0].indent, n);
|
|
1445
|
-
if (l.length === 0)
|
|
1446
|
-
return;
|
|
1447
|
-
const c = ((r = o[0]) == null ? void 0 : r.number) || 1, d = (s = o[0]) == null ? void 0 : s.type;
|
|
1448
|
-
return {
|
|
1449
|
-
type: "list",
|
|
1450
|
-
ordered: !0,
|
|
1451
|
-
start: c,
|
|
1452
|
-
typeMarker: d,
|
|
1453
|
-
items: l,
|
|
1454
|
-
raw: i.slice(0, a).join(`
|
|
1455
|
-
`)
|
|
1456
|
-
};
|
|
1457
|
-
}
|
|
1458
|
-
},
|
|
1459
|
-
markdownOptions: {
|
|
1460
|
-
indentsContent: !0
|
|
1461
|
-
},
|
|
1462
|
-
addCommands() {
|
|
1463
|
-
return {
|
|
1464
|
-
toggleOrderedList: () => ({ commands: e, chain: t }) => this.options.keepAttributes ? t().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(hn, this.editor.getAttributes(ve)).run() : e.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
|
|
1465
|
-
};
|
|
1466
|
-
},
|
|
1467
|
-
addKeyboardShortcuts() {
|
|
1468
|
-
return {
|
|
1469
|
-
"Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
|
|
1470
|
-
};
|
|
1471
|
-
},
|
|
1472
|
-
addProseMirrorPlugins() {
|
|
1473
|
-
return [
|
|
1474
|
-
new x({
|
|
1475
|
-
props: {
|
|
1476
|
-
handlePaste: (e, t) => {
|
|
1477
|
-
var n, r;
|
|
1478
|
-
const s = (n = t.clipboardData) == null ? void 0 : n.getData("text/html");
|
|
1479
|
-
if (s?.trim())
|
|
1480
|
-
return !1;
|
|
1481
|
-
const i = (r = t.clipboardData) == null ? void 0 : r.getData("text/plain");
|
|
1482
|
-
if (!i)
|
|
1483
|
-
return !1;
|
|
1484
|
-
const o = dn(i);
|
|
1485
|
-
if (!o)
|
|
1486
|
-
return !1;
|
|
1487
|
-
try {
|
|
1488
|
-
const a = e.state.schema.nodeFromJSON(o), l = e.state.tr.replaceSelectionWith(a);
|
|
1489
|
-
return e.dispatch(l), !0;
|
|
1490
|
-
} catch {
|
|
1491
|
-
return !1;
|
|
1492
|
-
}
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
})
|
|
1496
|
-
];
|
|
1497
|
-
},
|
|
1498
|
-
addInputRules() {
|
|
1499
|
-
const e = (n, r) => (!r.attrs.type || r.attrs.type === "1") && r.childCount + r.attrs.start === +n[1];
|
|
1500
|
-
let t = O({
|
|
1501
|
-
find: be,
|
|
1502
|
-
type: this.type,
|
|
1503
|
-
getAttributes: (n) => ({ start: +n[1] }),
|
|
1504
|
-
joinPredicate: e
|
|
1505
|
-
});
|
|
1506
|
-
return (this.options.keepMarks || this.options.keepAttributes) && (t = O({
|
|
1507
|
-
find: be,
|
|
1508
|
-
type: this.type,
|
|
1509
|
-
keepMarks: this.options.keepMarks,
|
|
1510
|
-
keepAttributes: this.options.keepAttributes,
|
|
1511
|
-
getAttributes: (n) => ({ start: +n[1], ...this.editor.getAttributes(ve) }),
|
|
1512
|
-
joinPredicate: e,
|
|
1513
|
-
editor: this.editor
|
|
1514
|
-
})), [t];
|
|
1515
|
-
}
|
|
1516
|
-
}), fn = /^\s*(\[([( |x])?\])\s$/, mn = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0", gn = (e, t, n) => {
|
|
1517
|
-
var r;
|
|
1518
|
-
return ((r = n?.checkboxLabel) == null ? void 0 : r.call(n, e, t)) || `Task item checkbox for ${e.textContent || "empty task item"}`;
|
|
1519
|
-
}, yn = L.create({
|
|
1520
|
-
name: "taskItem",
|
|
1521
|
-
addOptions() {
|
|
1522
|
-
return {
|
|
1523
|
-
nested: !1,
|
|
1524
|
-
HTMLAttributes: {},
|
|
1525
|
-
taskListTypeName: "taskList",
|
|
1526
|
-
a11y: void 0
|
|
1527
|
-
};
|
|
1528
|
-
},
|
|
1529
|
-
content() {
|
|
1530
|
-
return this.options.nested ? "paragraph block*" : "paragraph+";
|
|
1531
|
-
},
|
|
1532
|
-
defining: !0,
|
|
1533
|
-
addAttributes() {
|
|
1534
|
-
return {
|
|
1535
|
-
checked: {
|
|
1536
|
-
default: !1,
|
|
1537
|
-
keepOnSplit: !1,
|
|
1538
|
-
parseHTML: (e) => {
|
|
1539
|
-
const t = e.getAttribute("data-checked");
|
|
1540
|
-
return t === "" || t === "true";
|
|
1541
|
-
},
|
|
1542
|
-
renderHTML: (e) => ({
|
|
1543
|
-
"data-checked": e.checked
|
|
1544
|
-
})
|
|
1545
|
-
}
|
|
1546
|
-
};
|
|
1547
|
-
},
|
|
1548
|
-
parseHTML() {
|
|
1549
|
-
return [
|
|
1550
|
-
{
|
|
1551
|
-
tag: `li[data-type="${this.name}"]`,
|
|
1552
|
-
priority: 51,
|
|
1553
|
-
contentElement: (e) => {
|
|
1554
|
-
var t;
|
|
1555
|
-
return (t = e.querySelector("div")) != null ? t : e;
|
|
1556
|
-
}
|
|
1557
|
-
}
|
|
1558
|
-
];
|
|
1559
|
-
},
|
|
1560
|
-
renderHTML({ node: e, HTMLAttributes: t }) {
|
|
1561
|
-
return [
|
|
1562
|
-
"li",
|
|
1563
|
-
v(this.options.HTMLAttributes, t, {
|
|
1564
|
-
"data-type": this.name
|
|
1565
|
-
}),
|
|
1566
|
-
[
|
|
1567
|
-
"label",
|
|
1568
|
-
[
|
|
1569
|
-
"input",
|
|
1570
|
-
{
|
|
1571
|
-
type: "checkbox",
|
|
1572
|
-
checked: e.attrs.checked ? "checked" : null
|
|
1573
|
-
}
|
|
1574
|
-
],
|
|
1575
|
-
["span"]
|
|
1576
|
-
],
|
|
1577
|
-
["div", 0]
|
|
1578
|
-
];
|
|
1579
|
-
},
|
|
1580
|
-
parseMarkdown: (e, t) => {
|
|
1581
|
-
const n = [];
|
|
1582
|
-
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) {
|
|
1583
|
-
const r = t.parseChildren(e.nestedTokens);
|
|
1584
|
-
n.push(...r);
|
|
1585
|
-
}
|
|
1586
|
-
return t.createNode("taskItem", { checked: e.checked || !1 }, n);
|
|
1587
|
-
},
|
|
1588
|
-
renderMarkdown: (e, t) => {
|
|
1589
|
-
var n;
|
|
1590
|
-
const s = `- [${(n = e.attrs) != null && n.checked ? "x" : " "}] `;
|
|
1591
|
-
return Ie(e, t, s);
|
|
1592
|
-
},
|
|
1593
|
-
addExtensions() {
|
|
1594
|
-
return this.options.nested ? [Re(this.name, [this.options.taskListTypeName])] : [];
|
|
1595
|
-
},
|
|
1596
|
-
addKeyboardShortcuts() {
|
|
1597
|
-
const e = {
|
|
1598
|
-
Enter: () => this.editor.commands.splitListItem(this.name),
|
|
1599
|
-
"Shift-Tab": () => this.editor.commands.liftListItem(this.name)
|
|
1600
|
-
};
|
|
1601
|
-
return this.options.nested ? {
|
|
1602
|
-
...e,
|
|
1603
|
-
Tab: () => this.editor.commands.sinkListItem(this.name)
|
|
1604
|
-
} : e;
|
|
1605
|
-
},
|
|
1606
|
-
addNodeView() {
|
|
1607
|
-
return ({ node: e, HTMLAttributes: t, getPos: n, editor: r }) => {
|
|
1608
|
-
const s = document.createElement("li"), i = document.createElement("label"), o = document.createElement("span"), a = document.createElement("input"), l = document.createElement("div");
|
|
1609
|
-
o.style.cssText = mn;
|
|
1610
|
-
const c = (u) => {
|
|
1611
|
-
const p = gn(u, u.attrs.checked, this.options.a11y);
|
|
1612
|
-
a.setAttribute("aria-label", p), o.textContent = p;
|
|
1613
|
-
};
|
|
1614
|
-
c(e), i.contentEditable = "false", a.type = "checkbox", a.addEventListener("mousedown", (u) => u.preventDefault()), a.addEventListener("change", (u) => {
|
|
1615
|
-
if (!r.isEditable && !this.options.onReadOnlyChecked) {
|
|
1616
|
-
a.checked = !a.checked;
|
|
1617
|
-
return;
|
|
1618
|
-
}
|
|
1619
|
-
const { checked: p } = u.target;
|
|
1620
|
-
r.isEditable && typeof n == "function" && r.chain().focus(void 0, { scrollIntoView: !1 }).command(({ tr: h }) => {
|
|
1621
|
-
const f = n();
|
|
1622
|
-
if (typeof f != "number")
|
|
1623
|
-
return !1;
|
|
1624
|
-
const m = h.doc.nodeAt(f);
|
|
1625
|
-
return h.setNodeMarkup(f, void 0, {
|
|
1626
|
-
...m?.attrs,
|
|
1627
|
-
checked: p
|
|
1628
|
-
}), !0;
|
|
1629
|
-
}).run(), !r.isEditable && this.options.onReadOnlyChecked && (this.options.onReadOnlyChecked(e, p) || (a.checked = !a.checked));
|
|
1630
|
-
}), Object.entries(this.options.HTMLAttributes).forEach(([u, p]) => {
|
|
1631
|
-
s.setAttribute(u, p);
|
|
1632
|
-
}), s.dataset.checked = e.attrs.checked, a.checked = e.attrs.checked, i.append(a, o), s.append(i, l), Object.entries(t).forEach(([u, p]) => {
|
|
1633
|
-
s.setAttribute(u, p);
|
|
1634
|
-
});
|
|
1635
|
-
let d = new Set(Object.keys(t));
|
|
1636
|
-
return {
|
|
1637
|
-
dom: s,
|
|
1638
|
-
contentDOM: l,
|
|
1639
|
-
update: (u) => {
|
|
1640
|
-
if (u.type !== this.type)
|
|
1641
|
-
return !1;
|
|
1642
|
-
s.dataset.checked = u.attrs.checked, a.checked = u.attrs.checked, c(u);
|
|
1643
|
-
const p = r.extensionManager.attributes, h = it(u, p), f = new Set(Object.keys(h)), m = this.options.HTMLAttributes;
|
|
1644
|
-
return d.forEach((g) => {
|
|
1645
|
-
f.has(g) || (g in m ? s.setAttribute(g, m[g]) : s.removeAttribute(g));
|
|
1646
|
-
}), Object.entries(h).forEach(([g, R]) => {
|
|
1647
|
-
R == null ? g in m ? s.setAttribute(g, m[g]) : s.removeAttribute(g) : s.setAttribute(g, R);
|
|
1648
|
-
}), d = f, !0;
|
|
1649
|
-
}
|
|
1650
|
-
};
|
|
1651
|
-
};
|
|
1652
|
-
},
|
|
1653
|
-
addInputRules() {
|
|
1654
|
-
return [
|
|
1655
|
-
O({
|
|
1656
|
-
find: fn,
|
|
1657
|
-
type: this.type,
|
|
1658
|
-
getAttributes: (e) => ({
|
|
1659
|
-
checked: e[e.length - 1] === "x"
|
|
1660
|
-
})
|
|
1661
|
-
})
|
|
1662
|
-
];
|
|
1663
|
-
}
|
|
1664
|
-
}), kn = L.create({
|
|
1665
|
-
name: "taskList",
|
|
1666
|
-
addOptions() {
|
|
1667
|
-
return {
|
|
1668
|
-
itemTypeName: "taskItem",
|
|
1669
|
-
HTMLAttributes: {}
|
|
1670
|
-
};
|
|
1671
|
-
},
|
|
1672
|
-
group: "block list",
|
|
1673
|
-
content() {
|
|
1674
|
-
return `${this.options.itemTypeName}+`;
|
|
1675
|
-
},
|
|
1676
|
-
parseHTML() {
|
|
1677
|
-
return [
|
|
1678
|
-
{
|
|
1679
|
-
tag: `ul[data-type="${this.name}"]`,
|
|
1680
|
-
priority: 51
|
|
1681
|
-
}
|
|
1682
|
-
];
|
|
1683
|
-
},
|
|
1684
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1685
|
-
return [
|
|
1686
|
-
"ul",
|
|
1687
|
-
v(this.options.HTMLAttributes, e, { "data-type": this.name }),
|
|
1688
|
-
0
|
|
1689
|
-
];
|
|
1690
|
-
},
|
|
1691
|
-
parseMarkdown: (e, t) => t.createNode("taskList", {}, t.parseChildren(e.items || [])),
|
|
1692
|
-
renderMarkdown: (e, t) => e.content ? t.renderChildren(e.content, `
|
|
1693
|
-
`) : "",
|
|
1694
|
-
markdownTokenizer: {
|
|
1695
|
-
name: "taskList",
|
|
1696
|
-
level: "block",
|
|
1697
|
-
start(e) {
|
|
1698
|
-
var t;
|
|
1699
|
-
const n = (t = e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/)) == null ? void 0 : t.index;
|
|
1700
|
-
return n !== void 0 ? n : -1;
|
|
1701
|
-
},
|
|
1702
|
-
tokenize(e, t, n) {
|
|
1703
|
-
const r = (i) => {
|
|
1704
|
-
const o = ge(
|
|
1705
|
-
i,
|
|
1706
|
-
{
|
|
1707
|
-
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
1708
|
-
extractItemData: (a) => ({
|
|
1709
|
-
indentLevel: a[1].length,
|
|
1710
|
-
mainContent: a[4],
|
|
1711
|
-
checked: a[3].toLowerCase() === "x"
|
|
1712
|
-
}),
|
|
1713
|
-
createToken: (a, l) => ({
|
|
1714
|
-
type: "taskItem",
|
|
1715
|
-
raw: "",
|
|
1716
|
-
mainContent: a.mainContent,
|
|
1717
|
-
indentLevel: a.indentLevel,
|
|
1718
|
-
checked: a.checked,
|
|
1719
|
-
text: a.mainContent,
|
|
1720
|
-
tokens: n.inlineTokens(a.mainContent),
|
|
1721
|
-
nestedTokens: l
|
|
1722
|
-
}),
|
|
1723
|
-
// Allow recursive nesting
|
|
1724
|
-
customNestedParser: r
|
|
1725
|
-
},
|
|
1726
|
-
n
|
|
1727
|
-
);
|
|
1728
|
-
if (o) {
|
|
1729
|
-
const a = {
|
|
1730
|
-
type: "taskList",
|
|
1731
|
-
raw: o.raw,
|
|
1732
|
-
items: o.items
|
|
1733
|
-
}, l = i.slice(o.raw.length);
|
|
1734
|
-
return l.trim() ? [a, ...n.blockTokens(l)] : [a];
|
|
1735
|
-
}
|
|
1736
|
-
return n.blockTokens(i);
|
|
1737
|
-
}, s = ge(
|
|
1738
|
-
e,
|
|
1739
|
-
{
|
|
1740
|
-
itemPattern: /^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,
|
|
1741
|
-
extractItemData: (i) => ({
|
|
1742
|
-
indentLevel: i[1].length,
|
|
1743
|
-
mainContent: i[4],
|
|
1744
|
-
checked: i[3].toLowerCase() === "x"
|
|
1745
|
-
}),
|
|
1746
|
-
createToken: (i, o) => ({
|
|
1747
|
-
type: "taskItem",
|
|
1748
|
-
raw: "",
|
|
1749
|
-
mainContent: i.mainContent,
|
|
1750
|
-
indentLevel: i.indentLevel,
|
|
1751
|
-
checked: i.checked,
|
|
1752
|
-
text: i.mainContent,
|
|
1753
|
-
tokens: n.inlineTokens(i.mainContent),
|
|
1754
|
-
nestedTokens: o
|
|
1755
|
-
}),
|
|
1756
|
-
// Use the recursive parser for nested content
|
|
1757
|
-
customNestedParser: r
|
|
1758
|
-
},
|
|
1759
|
-
n
|
|
1760
|
-
);
|
|
1761
|
-
if (s)
|
|
1762
|
-
return {
|
|
1763
|
-
type: "taskList",
|
|
1764
|
-
raw: s.raw,
|
|
1765
|
-
items: s.items
|
|
1766
|
-
};
|
|
1767
|
-
}
|
|
1768
|
-
},
|
|
1769
|
-
markdownOptions: {
|
|
1770
|
-
indentsContent: !0
|
|
1771
|
-
},
|
|
1772
|
-
addCommands() {
|
|
1773
|
-
return {
|
|
1774
|
-
toggleTaskList: () => ({ commands: e }) => e.toggleList(this.name, this.options.itemTypeName)
|
|
1775
|
-
};
|
|
1776
|
-
},
|
|
1777
|
-
addKeyboardShortcuts() {
|
|
1778
|
-
return {
|
|
1779
|
-
"Mod-Shift-9": () => this.editor.commands.toggleTaskList()
|
|
1780
|
-
};
|
|
1781
|
-
}
|
|
1782
|
-
});
|
|
1783
|
-
M.create({
|
|
1784
|
-
name: "listKit",
|
|
1785
|
-
addExtensions() {
|
|
1786
|
-
const e = [];
|
|
1787
|
-
return this.options.bulletList !== !1 && e.push(Ee.configure(this.options.bulletList)), this.options.listItem !== !1 && e.push(Oe.configure(this.options.listItem)), this.options.listKeymap !== !1 && e.push(ze.configure(this.options.listKeymap)), this.options.orderedList !== !1 && e.push(Fe.configure(this.options.orderedList)), this.options.taskItem !== !1 && e.push(yn.configure(this.options.taskItem)), this.options.taskList !== !1 && e.push(kn.configure(this.options.taskList)), e;
|
|
1788
|
-
}
|
|
1789
|
-
});
|
|
1790
|
-
var vn = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, bn = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, Mn = F.create({
|
|
1791
|
-
name: "strike",
|
|
1792
|
-
addOptions() {
|
|
1793
|
-
return {
|
|
1794
|
-
HTMLAttributes: {}
|
|
1795
|
-
};
|
|
1796
|
-
},
|
|
1797
|
-
parseHTML() {
|
|
1798
|
-
return [
|
|
1799
|
-
{
|
|
1800
|
-
tag: "s"
|
|
1801
|
-
},
|
|
1802
|
-
{
|
|
1803
|
-
tag: "del"
|
|
1804
|
-
},
|
|
1805
|
-
{
|
|
1806
|
-
tag: "strike"
|
|
1807
|
-
},
|
|
1808
|
-
{
|
|
1809
|
-
style: "text-decoration",
|
|
1810
|
-
consuming: !1,
|
|
1811
|
-
getAttrs: (e) => e.includes("line-through") ? {} : !1
|
|
1812
|
-
}
|
|
1813
|
-
];
|
|
1814
|
-
},
|
|
1815
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1816
|
-
return ["s", v(this.options.HTMLAttributes, e), 0];
|
|
1817
|
-
},
|
|
1818
|
-
markdownTokenName: "del",
|
|
1819
|
-
parseMarkdown: (e, t) => t.applyMark("strike", t.parseInline(e.tokens || [])),
|
|
1820
|
-
renderMarkdown: (e, t) => `~~${t.renderChildren(e)}~~`,
|
|
1821
|
-
addCommands() {
|
|
1822
|
-
return {
|
|
1823
|
-
setStrike: () => ({ commands: e }) => e.setMark(this.name),
|
|
1824
|
-
toggleStrike: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
1825
|
-
unsetStrike: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
1826
|
-
};
|
|
1827
|
-
},
|
|
1828
|
-
addKeyboardShortcuts() {
|
|
1829
|
-
return {
|
|
1830
|
-
"Mod-Shift-s": () => this.editor.commands.toggleStrike()
|
|
1831
|
-
};
|
|
1832
|
-
},
|
|
1833
|
-
addInputRules() {
|
|
1834
|
-
return [
|
|
1835
|
-
B({
|
|
1836
|
-
find: vn,
|
|
1837
|
-
type: this.type
|
|
1838
|
-
})
|
|
1839
|
-
];
|
|
1840
|
-
},
|
|
1841
|
-
addPasteRules() {
|
|
1842
|
-
return [
|
|
1843
|
-
D({
|
|
1844
|
-
find: bn,
|
|
1845
|
-
type: this.type
|
|
1846
|
-
})
|
|
1847
|
-
];
|
|
1848
|
-
}
|
|
1849
|
-
}), wn = L.create({
|
|
1850
|
-
name: "text",
|
|
1851
|
-
group: "inline",
|
|
1852
|
-
parseMarkdown: (e) => ({
|
|
1853
|
-
type: "text",
|
|
1854
|
-
text: e.text || ""
|
|
1855
|
-
}),
|
|
1856
|
-
renderMarkdown: (e) => e.text || ""
|
|
1857
|
-
}), Ln = F.create({
|
|
1858
|
-
name: "underline",
|
|
1859
|
-
addOptions() {
|
|
1860
|
-
return {
|
|
1861
|
-
HTMLAttributes: {}
|
|
1862
|
-
};
|
|
1863
|
-
},
|
|
1864
|
-
parseHTML() {
|
|
1865
|
-
return [
|
|
1866
|
-
{
|
|
1867
|
-
tag: "u"
|
|
1868
|
-
},
|
|
1869
|
-
{
|
|
1870
|
-
style: "text-decoration",
|
|
1871
|
-
consuming: !1,
|
|
1872
|
-
getAttrs: (e) => e.includes("underline") ? {} : !1
|
|
1873
|
-
}
|
|
1874
|
-
];
|
|
1875
|
-
},
|
|
1876
|
-
renderHTML({ HTMLAttributes: e }) {
|
|
1877
|
-
return ["u", v(this.options.HTMLAttributes, e), 0];
|
|
1878
|
-
},
|
|
1879
|
-
parseMarkdown(e, t) {
|
|
1880
|
-
return t.applyMark(this.name || "underline", t.parseInline(e.tokens || []));
|
|
1881
|
-
},
|
|
1882
|
-
renderMarkdown(e, t) {
|
|
1883
|
-
return `++${t.renderChildren(e)}++`;
|
|
1884
|
-
},
|
|
1885
|
-
markdownTokenizer: {
|
|
1886
|
-
name: "underline",
|
|
1887
|
-
level: "inline",
|
|
1888
|
-
start(e) {
|
|
1889
|
-
return e.indexOf("++");
|
|
1890
|
-
},
|
|
1891
|
-
tokenize(e, t, n) {
|
|
1892
|
-
const s = /^(\+\+)([\s\S]+?)(\+\+)/.exec(e);
|
|
1893
|
-
if (!s)
|
|
1894
|
-
return;
|
|
1895
|
-
const i = s[2].trim();
|
|
1896
|
-
return {
|
|
1897
|
-
type: "underline",
|
|
1898
|
-
raw: s[0],
|
|
1899
|
-
text: i,
|
|
1900
|
-
tokens: n.inlineTokens(i)
|
|
1901
|
-
};
|
|
1902
|
-
}
|
|
1903
|
-
},
|
|
1904
|
-
addCommands() {
|
|
1905
|
-
return {
|
|
1906
|
-
setUnderline: () => ({ commands: e }) => e.setMark(this.name),
|
|
1907
|
-
toggleUnderline: () => ({ commands: e }) => e.toggleMark(this.name),
|
|
1908
|
-
unsetUnderline: () => ({ commands: e }) => e.unsetMark(this.name)
|
|
1909
|
-
};
|
|
1910
|
-
},
|
|
1911
|
-
addKeyboardShortcuts() {
|
|
1912
|
-
return {
|
|
1913
|
-
"Mod-u": () => this.editor.commands.toggleUnderline(),
|
|
1914
|
-
"Mod-U": () => this.editor.commands.toggleUnderline()
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
});
|
|
1918
|
-
function Tn(e = {}) {
|
|
1919
|
-
return new x({
|
|
1920
|
-
view(t) {
|
|
1921
|
-
return new xn(t, e);
|
|
1922
|
-
}
|
|
1923
|
-
});
|
|
1924
|
-
}
|
|
1925
|
-
class xn {
|
|
1926
|
-
constructor(t, n) {
|
|
1927
|
-
var r;
|
|
1928
|
-
this.editorView = t, this.cursorPos = null, this.element = null, this.timeout = -1, this.lastDragEvent = null, this.width = (r = n.width) !== null && r !== void 0 ? r : 1, this.color = n.color === !1 ? void 0 : n.color || "black", this.class = n.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((s) => {
|
|
1929
|
-
let i = (o) => {
|
|
1930
|
-
this[s](o);
|
|
1931
|
-
};
|
|
1932
|
-
return t.dom.addEventListener(s, i), { name: s, handler: i };
|
|
1933
|
-
});
|
|
1934
|
-
}
|
|
1935
|
-
destroy() {
|
|
1936
|
-
this.handlers.forEach(({ name: t, handler: n }) => this.editorView.dom.removeEventListener(t, n));
|
|
1937
|
-
}
|
|
1938
|
-
update(t, n) {
|
|
1939
|
-
if (this.cursorPos != null && n.doc != t.state.doc)
|
|
1940
|
-
if (this.lastDragEvent) {
|
|
1941
|
-
let r = this.computeTarget(this.lastDragEvent);
|
|
1942
|
-
r == this.cursorPos ? this.updateOverlay() : this.setCursor(r);
|
|
1943
|
-
} else
|
|
1944
|
-
this.updateOverlay();
|
|
1945
|
-
}
|
|
1946
|
-
setCursor(t) {
|
|
1947
|
-
t != this.cursorPos && (this.cursorPos = t, t == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
|
|
1948
|
-
}
|
|
1949
|
-
updateOverlay() {
|
|
1950
|
-
let t = this.editorView.state.doc.resolve(this.cursorPos), n = !t.parent.inlineContent, r, s = this.editorView.dom, i = s.getBoundingClientRect(), o = i.width / s.offsetWidth, a = i.height / s.offsetHeight;
|
|
1951
|
-
if (n) {
|
|
1952
|
-
let u = t.nodeBefore, p = t.nodeAfter;
|
|
1953
|
-
if (u || p) {
|
|
1954
|
-
let h = this.editorView.nodeDOM(this.cursorPos - (u ? u.nodeSize : 0));
|
|
1955
|
-
if (h) {
|
|
1956
|
-
let f = h.getBoundingClientRect(), m = u ? f.bottom : f.top;
|
|
1957
|
-
u && p && (m = (m + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
|
|
1958
|
-
let g = this.width / 2 * a;
|
|
1959
|
-
r = { left: f.left, right: f.right, top: m - g, bottom: m + g };
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
if (!r) {
|
|
1964
|
-
let u = this.editorView.coordsAtPos(this.cursorPos), p = this.width / 2 * o;
|
|
1965
|
-
r = { left: u.left - p, right: u.left + p, top: u.top, bottom: u.bottom };
|
|
1966
|
-
}
|
|
1967
|
-
let l = this.editorView.dom.offsetParent;
|
|
1968
|
-
this.element || (this.element = l.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", n), this.element.classList.toggle("prosemirror-dropcursor-inline", !n);
|
|
1969
|
-
let c, d;
|
|
1970
|
-
if (!l || l == document.body && getComputedStyle(l).position == "static")
|
|
1971
|
-
c = -pageXOffset, d = -pageYOffset;
|
|
1972
|
-
else {
|
|
1973
|
-
let u = l.getBoundingClientRect(), p = u.width / l.offsetWidth, h = u.height / l.offsetHeight;
|
|
1974
|
-
c = u.left - l.scrollLeft * p, d = u.top - l.scrollTop * h;
|
|
1975
|
-
}
|
|
1976
|
-
this.element.style.left = (r.left - c) / o + "px", this.element.style.top = (r.top - d) / a + "px", this.element.style.width = (r.right - r.left) / o + "px", this.element.style.height = (r.bottom - r.top) / a + "px";
|
|
1977
|
-
}
|
|
1978
|
-
scheduleRemoval(t) {
|
|
1979
|
-
clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), t);
|
|
1980
|
-
}
|
|
1981
|
-
computeTarget(t) {
|
|
1982
|
-
let n = this.editorView.posAtCoords({ left: t.clientX, top: t.clientY }), r = n && n.inside >= 0 && this.editorView.state.doc.nodeAt(n.inside), s = r && r.type.spec.disableDropCursor, i = typeof s == "function" ? s(this.editorView, n, t) : s;
|
|
1983
|
-
if (!n || i)
|
|
1984
|
-
return null;
|
|
1985
|
-
let o = n.pos;
|
|
1986
|
-
if (this.editorView.dragging && this.editorView.dragging.slice) {
|
|
1987
|
-
let a = ot(this.editorView.state.doc, o, this.editorView.dragging.slice);
|
|
1988
|
-
a != null && (o = a);
|
|
1989
|
-
}
|
|
1990
|
-
return o;
|
|
1991
|
-
}
|
|
1992
|
-
dragover(t) {
|
|
1993
|
-
if (!this.editorView.editable)
|
|
1994
|
-
return;
|
|
1995
|
-
this.lastDragEvent = t;
|
|
1996
|
-
let n = this.computeTarget(t);
|
|
1997
|
-
n != null && (this.setCursor(n), this.scheduleRemoval(5e3));
|
|
1998
|
-
}
|
|
1999
|
-
dragend() {
|
|
2000
|
-
this.scheduleRemoval(20);
|
|
2001
|
-
}
|
|
2002
|
-
drop() {
|
|
2003
|
-
this.scheduleRemoval(20);
|
|
2004
|
-
}
|
|
2005
|
-
dragleave(t) {
|
|
2006
|
-
this.editorView.dom.contains(t.relatedTarget) || this.setCursor(null);
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
class y extends z {
|
|
2010
|
-
/**
|
|
2011
|
-
Create a gap cursor.
|
|
2012
|
-
*/
|
|
2013
|
-
constructor(t) {
|
|
2014
|
-
super(t, t);
|
|
2015
|
-
}
|
|
2016
|
-
map(t, n) {
|
|
2017
|
-
let r = t.resolve(n.map(this.head));
|
|
2018
|
-
return y.valid(r) ? new y(r) : z.near(r);
|
|
2019
|
-
}
|
|
2020
|
-
content() {
|
|
2021
|
-
return ue.empty;
|
|
2022
|
-
}
|
|
2023
|
-
eq(t) {
|
|
2024
|
-
return t instanceof y && t.head == this.head;
|
|
2025
|
-
}
|
|
2026
|
-
toJSON() {
|
|
2027
|
-
return { type: "gapcursor", pos: this.head };
|
|
2028
|
-
}
|
|
2029
|
-
/**
|
|
2030
|
-
@internal
|
|
2031
|
-
*/
|
|
2032
|
-
static fromJSON(t, n) {
|
|
2033
|
-
if (typeof n.pos != "number")
|
|
2034
|
-
throw new RangeError("Invalid input for GapCursor.fromJSON");
|
|
2035
|
-
return new y(t.resolve(n.pos));
|
|
2036
|
-
}
|
|
2037
|
-
/**
|
|
2038
|
-
@internal
|
|
2039
|
-
*/
|
|
2040
|
-
getBookmark() {
|
|
2041
|
-
return new he(this.anchor);
|
|
2042
|
-
}
|
|
2043
|
-
/**
|
|
2044
|
-
@internal
|
|
2045
|
-
*/
|
|
2046
|
-
static valid(t) {
|
|
2047
|
-
let n = t.parent;
|
|
2048
|
-
if (n.inlineContent || !Cn(t) || !In(t))
|
|
2049
|
-
return !1;
|
|
2050
|
-
let r = n.type.spec.allowGapCursor;
|
|
2051
|
-
if (r != null)
|
|
2052
|
-
return r;
|
|
2053
|
-
let s = n.contentMatchAt(t.index()).defaultType;
|
|
2054
|
-
return s && s.isTextblock;
|
|
2055
|
-
}
|
|
2056
|
-
/**
|
|
2057
|
-
@internal
|
|
2058
|
-
*/
|
|
2059
|
-
static findGapCursorFrom(t, n, r = !1) {
|
|
2060
|
-
e: for (; ; ) {
|
|
2061
|
-
if (!r && y.valid(t))
|
|
2062
|
-
return t;
|
|
2063
|
-
let s = t.pos, i = null;
|
|
2064
|
-
for (let o = t.depth; ; o--) {
|
|
2065
|
-
let a = t.node(o);
|
|
2066
|
-
if (n > 0 ? t.indexAfter(o) < a.childCount : t.index(o) > 0) {
|
|
2067
|
-
i = a.child(n > 0 ? t.indexAfter(o) : t.index(o) - 1);
|
|
2068
|
-
break;
|
|
2069
|
-
} else if (o == 0)
|
|
2070
|
-
return null;
|
|
2071
|
-
s += n;
|
|
2072
|
-
let l = t.doc.resolve(s);
|
|
2073
|
-
if (y.valid(l))
|
|
2074
|
-
return l;
|
|
2075
|
-
}
|
|
2076
|
-
for (; ; ) {
|
|
2077
|
-
let o = n > 0 ? i.firstChild : i.lastChild;
|
|
2078
|
-
if (!o) {
|
|
2079
|
-
if (i.isAtom && !i.isText && !le.isSelectable(i)) {
|
|
2080
|
-
t = t.doc.resolve(s + i.nodeSize * n), r = !1;
|
|
2081
|
-
continue e;
|
|
2082
|
-
}
|
|
2083
|
-
break;
|
|
2084
|
-
}
|
|
2085
|
-
i = o, s += n;
|
|
2086
|
-
let a = t.doc.resolve(s);
|
|
2087
|
-
if (y.valid(a))
|
|
2088
|
-
return a;
|
|
2089
|
-
}
|
|
2090
|
-
return null;
|
|
2091
|
-
}
|
|
2092
|
-
}
|
|
2093
|
-
}
|
|
2094
|
-
y.prototype.visible = !1;
|
|
2095
|
-
y.findFrom = y.findGapCursorFrom;
|
|
2096
|
-
z.jsonID("gapcursor", y);
|
|
2097
|
-
class he {
|
|
2098
|
-
constructor(t) {
|
|
2099
|
-
this.pos = t;
|
|
2100
|
-
}
|
|
2101
|
-
map(t) {
|
|
2102
|
-
return new he(t.map(this.pos));
|
|
2103
|
-
}
|
|
2104
|
-
resolve(t) {
|
|
2105
|
-
let n = t.resolve(this.pos);
|
|
2106
|
-
return y.valid(n) ? new y(n) : z.near(n);
|
|
2107
|
-
}
|
|
2108
|
-
}
|
|
2109
|
-
function Ve(e) {
|
|
2110
|
-
return e.isAtom || e.spec.isolating || e.spec.createGapCursor;
|
|
2111
|
-
}
|
|
2112
|
-
function Cn(e) {
|
|
2113
|
-
for (let t = e.depth; t >= 0; t--) {
|
|
2114
|
-
let n = e.index(t), r = e.node(t);
|
|
2115
|
-
if (n == 0) {
|
|
2116
|
-
if (r.type.spec.isolating)
|
|
2117
|
-
return !0;
|
|
2118
|
-
continue;
|
|
2119
|
-
}
|
|
2120
|
-
for (let s = r.child(n - 1); ; s = s.lastChild) {
|
|
2121
|
-
if (s.childCount == 0 && !s.inlineContent || Ve(s.type))
|
|
2122
|
-
return !0;
|
|
2123
|
-
if (s.inlineContent)
|
|
2124
|
-
return !1;
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
return !0;
|
|
2128
|
-
}
|
|
2129
|
-
function In(e) {
|
|
2130
|
-
for (let t = e.depth; t >= 0; t--) {
|
|
2131
|
-
let n = e.indexAfter(t), r = e.node(t);
|
|
2132
|
-
if (n == r.childCount) {
|
|
2133
|
-
if (r.type.spec.isolating)
|
|
2134
|
-
return !0;
|
|
2135
|
-
continue;
|
|
2136
|
-
}
|
|
2137
|
-
for (let s = r.child(n); ; s = s.firstChild) {
|
|
2138
|
-
if (s.childCount == 0 && !s.inlineContent || Ve(s.type))
|
|
2139
|
-
return !0;
|
|
2140
|
-
if (s.inlineContent)
|
|
2141
|
-
return !1;
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
return !0;
|
|
2145
|
-
}
|
|
2146
|
-
function An() {
|
|
2147
|
-
return new x({
|
|
2148
|
-
props: {
|
|
2149
|
-
decorations: Pn,
|
|
2150
|
-
createSelectionBetween(e, t, n) {
|
|
2151
|
-
return t.pos == n.pos && y.valid(n) ? new y(n) : null;
|
|
2152
|
-
},
|
|
2153
|
-
handleClick: En,
|
|
2154
|
-
handleKeyDown: Sn,
|
|
2155
|
-
handleDOMEvents: { beforeinput: Rn }
|
|
2156
|
-
}
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
const Sn = at({
|
|
2160
|
-
ArrowLeft: W("horiz", -1),
|
|
2161
|
-
ArrowRight: W("horiz", 1),
|
|
2162
|
-
ArrowUp: W("vert", -1),
|
|
2163
|
-
ArrowDown: W("vert", 1)
|
|
2164
|
-
});
|
|
2165
|
-
function W(e, t) {
|
|
2166
|
-
const n = e == "vert" ? t > 0 ? "down" : "up" : t > 0 ? "right" : "left";
|
|
2167
|
-
return function(r, s, i) {
|
|
2168
|
-
let o = r.selection, a = t > 0 ? o.$to : o.$from, l = o.empty;
|
|
2169
|
-
if (o instanceof I) {
|
|
2170
|
-
if (!i.endOfTextblock(n) || a.depth == 0)
|
|
2171
|
-
return !1;
|
|
2172
|
-
l = !1, a = r.doc.resolve(t > 0 ? a.after() : a.before());
|
|
2173
|
-
}
|
|
2174
|
-
let c = y.findGapCursorFrom(a, t, l);
|
|
2175
|
-
return c ? (s && s(r.tr.setSelection(new y(c))), !0) : !1;
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
function En(e, t, n) {
|
|
2179
|
-
if (!e || !e.editable)
|
|
2180
|
-
return !1;
|
|
2181
|
-
let r = e.state.doc.resolve(t);
|
|
2182
|
-
if (!y.valid(r))
|
|
2183
|
-
return !1;
|
|
2184
|
-
let s = e.posAtCoords({ left: n.clientX, top: n.clientY });
|
|
2185
|
-
return s && s.inside > -1 && le.isSelectable(e.state.doc.nodeAt(s.inside)) ? !1 : (e.dispatch(e.state.tr.setSelection(new y(r))), !0);
|
|
2186
|
-
}
|
|
2187
|
-
function Rn(e, t) {
|
|
2188
|
-
if (t.inputType != "insertCompositionText" || !(e.state.selection instanceof y))
|
|
2189
|
-
return !1;
|
|
2190
|
-
let { $from: n } = e.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);
|
|
2191
|
-
if (!r)
|
|
2192
|
-
return !1;
|
|
2193
|
-
let s = K.empty;
|
|
2194
|
-
for (let o = r.length - 1; o >= 0; o--)
|
|
2195
|
-
s = K.from(r[o].createAndFill(null, s));
|
|
2196
|
-
let i = e.state.tr.replace(n.pos, n.pos, new ue(s, 0, 0));
|
|
2197
|
-
return i.setSelection(I.near(i.doc.resolve(n.pos + 1))), e.dispatch(i), !1;
|
|
2198
|
-
}
|
|
2199
|
-
function Pn(e) {
|
|
2200
|
-
if (!(e.selection instanceof y))
|
|
2201
|
-
return null;
|
|
2202
|
-
let t = document.createElement("div");
|
|
2203
|
-
return t.className = "ProseMirror-gapcursor", S.create(e.doc, [Y.widget(e.selection.head, t, { key: "gapcursor" })]);
|
|
2204
|
-
}
|
|
2205
|
-
var J = 200, k = function() {
|
|
2206
|
-
};
|
|
2207
|
-
k.prototype.append = function(t) {
|
|
2208
|
-
return t.length ? (t = k.from(t), !this.length && t || t.length < J && this.leafAppend(t) || this.length < J && t.leafPrepend(this) || this.appendInner(t)) : this;
|
|
2209
|
-
};
|
|
2210
|
-
k.prototype.prepend = function(t) {
|
|
2211
|
-
return t.length ? k.from(t).append(this) : this;
|
|
2212
|
-
};
|
|
2213
|
-
k.prototype.appendInner = function(t) {
|
|
2214
|
-
return new Nn(this, t);
|
|
2215
|
-
};
|
|
2216
|
-
k.prototype.slice = function(t, n) {
|
|
2217
|
-
return t === void 0 && (t = 0), n === void 0 && (n = this.length), t >= n ? k.empty : this.sliceInner(Math.max(0, t), Math.min(this.length, n));
|
|
2218
|
-
};
|
|
2219
|
-
k.prototype.get = function(t) {
|
|
2220
|
-
if (!(t < 0 || t >= this.length))
|
|
2221
|
-
return this.getInner(t);
|
|
2222
|
-
};
|
|
2223
|
-
k.prototype.forEach = function(t, n, r) {
|
|
2224
|
-
n === void 0 && (n = 0), r === void 0 && (r = this.length), n <= r ? this.forEachInner(t, n, r, 0) : this.forEachInvertedInner(t, n, r, 0);
|
|
2225
|
-
};
|
|
2226
|
-
k.prototype.map = function(t, n, r) {
|
|
2227
|
-
n === void 0 && (n = 0), r === void 0 && (r = this.length);
|
|
2228
|
-
var s = [];
|
|
2229
|
-
return this.forEach(function(i, o) {
|
|
2230
|
-
return s.push(t(i, o));
|
|
2231
|
-
}, n, r), s;
|
|
2232
|
-
};
|
|
2233
|
-
k.from = function(t) {
|
|
2234
|
-
return t instanceof k ? t : t && t.length ? new je(t) : k.empty;
|
|
2235
|
-
};
|
|
2236
|
-
var je = /* @__PURE__ */ function(e) {
|
|
2237
|
-
function t(r) {
|
|
2238
|
-
e.call(this), this.values = r;
|
|
2239
|
-
}
|
|
2240
|
-
e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t;
|
|
2241
|
-
var n = { length: { configurable: !0 }, depth: { configurable: !0 } };
|
|
2242
|
-
return t.prototype.flatten = function() {
|
|
2243
|
-
return this.values;
|
|
2244
|
-
}, t.prototype.sliceInner = function(s, i) {
|
|
2245
|
-
return s == 0 && i == this.length ? this : new t(this.values.slice(s, i));
|
|
2246
|
-
}, t.prototype.getInner = function(s) {
|
|
2247
|
-
return this.values[s];
|
|
2248
|
-
}, t.prototype.forEachInner = function(s, i, o, a) {
|
|
2249
|
-
for (var l = i; l < o; l++)
|
|
2250
|
-
if (s(this.values[l], a + l) === !1)
|
|
2251
|
-
return !1;
|
|
2252
|
-
}, t.prototype.forEachInvertedInner = function(s, i, o, a) {
|
|
2253
|
-
for (var l = i - 1; l >= o; l--)
|
|
2254
|
-
if (s(this.values[l], a + l) === !1)
|
|
2255
|
-
return !1;
|
|
2256
|
-
}, t.prototype.leafAppend = function(s) {
|
|
2257
|
-
if (this.length + s.length <= J)
|
|
2258
|
-
return new t(this.values.concat(s.flatten()));
|
|
2259
|
-
}, t.prototype.leafPrepend = function(s) {
|
|
2260
|
-
if (this.length + s.length <= J)
|
|
2261
|
-
return new t(s.flatten().concat(this.values));
|
|
2262
|
-
}, n.length.get = function() {
|
|
2263
|
-
return this.values.length;
|
|
2264
|
-
}, n.depth.get = function() {
|
|
2265
|
-
return 0;
|
|
2266
|
-
}, Object.defineProperties(t.prototype, n), t;
|
|
2267
|
-
}(k);
|
|
2268
|
-
k.empty = new je([]);
|
|
2269
|
-
var Nn = /* @__PURE__ */ function(e) {
|
|
2270
|
-
function t(n, r) {
|
|
2271
|
-
e.call(this), this.left = n, this.right = r, this.length = n.length + r.length, this.depth = Math.max(n.depth, r.depth) + 1;
|
|
2272
|
-
}
|
|
2273
|
-
return e && (t.__proto__ = e), t.prototype = Object.create(e && e.prototype), t.prototype.constructor = t, t.prototype.flatten = function() {
|
|
2274
|
-
return this.left.flatten().concat(this.right.flatten());
|
|
2275
|
-
}, t.prototype.getInner = function(r) {
|
|
2276
|
-
return r < this.left.length ? this.left.get(r) : this.right.get(r - this.left.length);
|
|
2277
|
-
}, t.prototype.forEachInner = function(r, s, i, o) {
|
|
2278
|
-
var a = this.left.length;
|
|
2279
|
-
if (s < a && this.left.forEachInner(r, s, Math.min(i, a), o) === !1 || i > a && this.right.forEachInner(r, Math.max(s - a, 0), Math.min(this.length, i) - a, o + a) === !1)
|
|
2280
|
-
return !1;
|
|
2281
|
-
}, t.prototype.forEachInvertedInner = function(r, s, i, o) {
|
|
2282
|
-
var a = this.left.length;
|
|
2283
|
-
if (s > a && this.right.forEachInvertedInner(r, s - a, Math.max(i, a) - a, o + a) === !1 || i < a && this.left.forEachInvertedInner(r, Math.min(s, a), i, o) === !1)
|
|
2284
|
-
return !1;
|
|
2285
|
-
}, t.prototype.sliceInner = function(r, s) {
|
|
2286
|
-
if (r == 0 && s == this.length)
|
|
2287
|
-
return this;
|
|
2288
|
-
var i = this.left.length;
|
|
2289
|
-
return s <= i ? this.left.slice(r, s) : r >= i ? this.right.slice(r - i, s - i) : this.left.slice(r, i).append(this.right.slice(0, s - i));
|
|
2290
|
-
}, t.prototype.leafAppend = function(r) {
|
|
2291
|
-
var s = this.right.leafAppend(r);
|
|
2292
|
-
if (s)
|
|
2293
|
-
return new t(this.left, s);
|
|
2294
|
-
}, t.prototype.leafPrepend = function(r) {
|
|
2295
|
-
var s = this.left.leafPrepend(r);
|
|
2296
|
-
if (s)
|
|
2297
|
-
return new t(s, this.right);
|
|
2298
|
-
}, t.prototype.appendInner = function(r) {
|
|
2299
|
-
return this.left.depth >= Math.max(this.right.depth, r.depth) + 1 ? new t(this.left, new t(this.right, r)) : new t(this, r);
|
|
2300
|
-
}, t;
|
|
2301
|
-
}(k);
|
|
2302
|
-
const _n = 500;
|
|
2303
|
-
class w {
|
|
2304
|
-
constructor(t, n) {
|
|
2305
|
-
this.items = t, this.eventCount = n;
|
|
2306
|
-
}
|
|
2307
|
-
// Pop the latest event off the branch's history and apply it
|
|
2308
|
-
// to a document transform.
|
|
2309
|
-
popEvent(t, n) {
|
|
2310
|
-
if (this.eventCount == 0)
|
|
2311
|
-
return null;
|
|
2312
|
-
let r = this.items.length;
|
|
2313
|
-
for (; ; r--)
|
|
2314
|
-
if (this.items.get(r - 1).selection) {
|
|
2315
|
-
--r;
|
|
2316
|
-
break;
|
|
2317
|
-
}
|
|
2318
|
-
let s, i;
|
|
2319
|
-
n && (s = this.remapping(r, this.items.length), i = s.maps.length);
|
|
2320
|
-
let o = t.tr, a, l, c = [], d = [];
|
|
2321
|
-
return this.items.forEach((u, p) => {
|
|
2322
|
-
if (!u.step) {
|
|
2323
|
-
s || (s = this.remapping(r, p + 1), i = s.maps.length), i--, d.push(u);
|
|
2324
|
-
return;
|
|
2325
|
-
}
|
|
2326
|
-
if (s) {
|
|
2327
|
-
d.push(new T(u.map));
|
|
2328
|
-
let h = u.step.map(s.slice(i)), f;
|
|
2329
|
-
h && o.maybeStep(h).doc && (f = o.mapping.maps[o.mapping.maps.length - 1], c.push(new T(f, void 0, void 0, c.length + d.length))), i--, f && s.appendMap(f, i);
|
|
2330
|
-
} else
|
|
2331
|
-
o.maybeStep(u.step);
|
|
2332
|
-
if (u.selection)
|
|
2333
|
-
return a = s ? u.selection.map(s.slice(i)) : u.selection, l = new w(this.items.slice(0, r).append(d.reverse().concat(c)), this.eventCount - 1), !1;
|
|
2334
|
-
}, this.items.length, 0), { remaining: l, transform: o, selection: a };
|
|
2335
|
-
}
|
|
2336
|
-
// Create a new branch with the given transform added.
|
|
2337
|
-
addTransform(t, n, r, s) {
|
|
2338
|
-
let i = [], o = this.eventCount, a = this.items, l = !s && a.length ? a.get(a.length - 1) : null;
|
|
2339
|
-
for (let d = 0; d < t.steps.length; d++) {
|
|
2340
|
-
let u = t.steps[d].invert(t.docs[d]), p = new T(t.mapping.maps[d], u, n), h;
|
|
2341
|
-
(h = l && l.merge(p)) && (p = h, d ? i.pop() : a = a.slice(0, a.length - 1)), i.push(p), n && (o++, n = void 0), s || (l = p);
|
|
2342
|
-
}
|
|
2343
|
-
let c = o - r.depth;
|
|
2344
|
-
return c > Dn && (a = On(a, c), o -= c), new w(a.append(i), o);
|
|
2345
|
-
}
|
|
2346
|
-
remapping(t, n) {
|
|
2347
|
-
let r = new lt();
|
|
2348
|
-
return this.items.forEach((s, i) => {
|
|
2349
|
-
let o = s.mirrorOffset != null && i - s.mirrorOffset >= t ? r.maps.length - s.mirrorOffset : void 0;
|
|
2350
|
-
r.appendMap(s.map, o);
|
|
2351
|
-
}, t, n), r;
|
|
2352
|
-
}
|
|
2353
|
-
addMaps(t) {
|
|
2354
|
-
return this.eventCount == 0 ? this : new w(this.items.append(t.map((n) => new T(n))), this.eventCount);
|
|
2355
|
-
}
|
|
2356
|
-
// When the collab module receives remote changes, the history has
|
|
2357
|
-
// to know about those, so that it can adjust the steps that were
|
|
2358
|
-
// rebased on top of the remote changes, and include the position
|
|
2359
|
-
// maps for the remote changes in its array of items.
|
|
2360
|
-
rebased(t, n) {
|
|
2361
|
-
if (!this.eventCount)
|
|
2362
|
-
return this;
|
|
2363
|
-
let r = [], s = Math.max(0, this.items.length - n), i = t.mapping, o = t.steps.length, a = this.eventCount;
|
|
2364
|
-
this.items.forEach((p) => {
|
|
2365
|
-
p.selection && a--;
|
|
2366
|
-
}, s);
|
|
2367
|
-
let l = n;
|
|
2368
|
-
this.items.forEach((p) => {
|
|
2369
|
-
let h = i.getMirror(--l);
|
|
2370
|
-
if (h == null)
|
|
2371
|
-
return;
|
|
2372
|
-
o = Math.min(o, h);
|
|
2373
|
-
let f = i.maps[h];
|
|
2374
|
-
if (p.step) {
|
|
2375
|
-
let m = t.steps[h].invert(t.docs[h]), g = p.selection && p.selection.map(i.slice(l + 1, h));
|
|
2376
|
-
g && a++, r.push(new T(f, m, g));
|
|
2377
|
-
} else
|
|
2378
|
-
r.push(new T(f));
|
|
2379
|
-
}, s);
|
|
2380
|
-
let c = [];
|
|
2381
|
-
for (let p = n; p < o; p++)
|
|
2382
|
-
c.push(new T(i.maps[p]));
|
|
2383
|
-
let d = this.items.slice(0, s).append(c).append(r), u = new w(d, a);
|
|
2384
|
-
return u.emptyItemCount() > _n && (u = u.compress(this.items.length - r.length)), u;
|
|
2385
|
-
}
|
|
2386
|
-
emptyItemCount() {
|
|
2387
|
-
let t = 0;
|
|
2388
|
-
return this.items.forEach((n) => {
|
|
2389
|
-
n.step || t++;
|
|
2390
|
-
}), t;
|
|
2391
|
-
}
|
|
2392
|
-
// Compressing a branch means rewriting it to push the air (map-only
|
|
2393
|
-
// items) out. During collaboration, these naturally accumulate
|
|
2394
|
-
// because each remote change adds one. The `upto` argument is used
|
|
2395
|
-
// to ensure that only the items below a given level are compressed,
|
|
2396
|
-
// because `rebased` relies on a clean, untouched set of items in
|
|
2397
|
-
// order to associate old items with rebased steps.
|
|
2398
|
-
compress(t = this.items.length) {
|
|
2399
|
-
let n = this.remapping(0, t), r = n.maps.length, s = [], i = 0;
|
|
2400
|
-
return this.items.forEach((o, a) => {
|
|
2401
|
-
if (a >= t)
|
|
2402
|
-
s.push(o), o.selection && i++;
|
|
2403
|
-
else if (o.step) {
|
|
2404
|
-
let l = o.step.map(n.slice(r)), c = l && l.getMap();
|
|
2405
|
-
if (r--, c && n.appendMap(c, r), l) {
|
|
2406
|
-
let d = o.selection && o.selection.map(n.slice(r));
|
|
2407
|
-
d && i++;
|
|
2408
|
-
let u = new T(c.invert(), l, d), p, h = s.length - 1;
|
|
2409
|
-
(p = s.length && s[h].merge(u)) ? s[h] = p : s.push(u);
|
|
2410
|
-
}
|
|
2411
|
-
} else o.map && r--;
|
|
2412
|
-
}, this.items.length, 0), new w(k.from(s.reverse()), i);
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
w.empty = new w(k.empty, 0);
|
|
2416
|
-
function On(e, t) {
|
|
2417
|
-
let n;
|
|
2418
|
-
return e.forEach((r, s) => {
|
|
2419
|
-
if (r.selection && t-- == 0)
|
|
2420
|
-
return n = s, !1;
|
|
2421
|
-
}), e.slice(n);
|
|
2422
|
-
}
|
|
2423
|
-
class T {
|
|
2424
|
-
constructor(t, n, r, s) {
|
|
2425
|
-
this.map = t, this.step = n, this.selection = r, this.mirrorOffset = s;
|
|
2426
|
-
}
|
|
2427
|
-
merge(t) {
|
|
2428
|
-
if (this.step && t.step && !t.selection) {
|
|
2429
|
-
let n = t.step.merge(this.step);
|
|
2430
|
-
if (n)
|
|
2431
|
-
return new T(n.getMap().invert(), n, this.selection);
|
|
2432
|
-
}
|
|
2433
|
-
}
|
|
2434
|
-
}
|
|
2435
|
-
class A {
|
|
2436
|
-
constructor(t, n, r, s, i) {
|
|
2437
|
-
this.done = t, this.undone = n, this.prevRanges = r, this.prevTime = s, this.prevComposition = i;
|
|
2438
|
-
}
|
|
2439
|
-
}
|
|
2440
|
-
const Dn = 20;
|
|
2441
|
-
function Bn(e, t, n, r) {
|
|
2442
|
-
let s = n.getMeta(N), i;
|
|
2443
|
-
if (s)
|
|
2444
|
-
return s.historyState;
|
|
2445
|
-
n.getMeta(zn) && (e = new A(e.done, e.undone, null, 0, -1));
|
|
2446
|
-
let o = n.getMeta("appendedTransaction");
|
|
2447
|
-
if (n.steps.length == 0)
|
|
2448
|
-
return e;
|
|
2449
|
-
if (o && o.getMeta(N))
|
|
2450
|
-
return o.getMeta(N).redo ? new A(e.done.addTransform(n, void 0, r, U(t)), e.undone, we(n.mapping.maps), e.prevTime, e.prevComposition) : new A(e.done, e.undone.addTransform(n, void 0, r, U(t)), null, e.prevTime, e.prevComposition);
|
|
2451
|
-
if (n.getMeta("addToHistory") !== !1 && !(o && o.getMeta("addToHistory") === !1)) {
|
|
2452
|
-
let a = n.getMeta("composition"), l = e.prevTime == 0 || !o && e.prevComposition != a && (e.prevTime < (n.time || 0) - r.newGroupDelay || !Hn(n, e.prevRanges)), c = o ? ne(e.prevRanges, n.mapping) : we(n.mapping.maps);
|
|
2453
|
-
return new A(e.done.addTransform(n, l ? t.selection.getBookmark() : void 0, r, U(t)), w.empty, c, n.time, a ?? e.prevComposition);
|
|
2454
|
-
} else return (i = n.getMeta("rebased")) ? new A(e.done.rebased(n, i), e.undone.rebased(n, i), ne(e.prevRanges, n.mapping), e.prevTime, e.prevComposition) : new A(e.done.addMaps(n.mapping.maps), e.undone.addMaps(n.mapping.maps), ne(e.prevRanges, n.mapping), e.prevTime, e.prevComposition);
|
|
2455
|
-
}
|
|
2456
|
-
function Hn(e, t) {
|
|
2457
|
-
if (!t)
|
|
2458
|
-
return !1;
|
|
2459
|
-
if (!e.docChanged)
|
|
2460
|
-
return !0;
|
|
2461
|
-
let n = !1;
|
|
2462
|
-
return e.mapping.maps[0].forEach((r, s) => {
|
|
2463
|
-
for (let i = 0; i < t.length; i += 2)
|
|
2464
|
-
r <= t[i + 1] && s >= t[i] && (n = !0);
|
|
2465
|
-
}), n;
|
|
2466
|
-
}
|
|
2467
|
-
function we(e) {
|
|
2468
|
-
let t = [];
|
|
2469
|
-
for (let n = e.length - 1; n >= 0 && t.length == 0; n--)
|
|
2470
|
-
e[n].forEach((r, s, i, o) => t.push(i, o));
|
|
2471
|
-
return t;
|
|
2472
|
-
}
|
|
2473
|
-
function ne(e, t) {
|
|
2474
|
-
if (!e)
|
|
2475
|
-
return null;
|
|
2476
|
-
let n = [];
|
|
2477
|
-
for (let r = 0; r < e.length; r += 2) {
|
|
2478
|
-
let s = t.map(e[r], 1), i = t.map(e[r + 1], -1);
|
|
2479
|
-
s <= i && n.push(s, i);
|
|
2480
|
-
}
|
|
2481
|
-
return n;
|
|
2482
|
-
}
|
|
2483
|
-
function $n(e, t, n) {
|
|
2484
|
-
let r = U(t), s = N.get(t).spec.config, i = (n ? e.undone : e.done).popEvent(t, r);
|
|
2485
|
-
if (!i)
|
|
2486
|
-
return null;
|
|
2487
|
-
let o = i.selection.resolve(i.transform.doc), a = (n ? e.done : e.undone).addTransform(i.transform, t.selection.getBookmark(), s, r), l = new A(n ? a : i.remaining, n ? i.remaining : a, null, 0, -1);
|
|
2488
|
-
return i.transform.setSelection(o).setMeta(N, { redo: n, historyState: l });
|
|
2489
|
-
}
|
|
2490
|
-
let re = !1, Le = null;
|
|
2491
|
-
function U(e) {
|
|
2492
|
-
let t = e.plugins;
|
|
2493
|
-
if (Le != t) {
|
|
2494
|
-
re = !1, Le = t;
|
|
2495
|
-
for (let n = 0; n < t.length; n++)
|
|
2496
|
-
if (t[n].spec.historyPreserveItems) {
|
|
2497
|
-
re = !0;
|
|
2498
|
-
break;
|
|
2499
|
-
}
|
|
2500
|
-
}
|
|
2501
|
-
return re;
|
|
2502
|
-
}
|
|
2503
|
-
const N = new E("history"), zn = new E("closeHistory");
|
|
2504
|
-
function Kn(e = {}) {
|
|
2505
|
-
return e = {
|
|
2506
|
-
depth: e.depth || 100,
|
|
2507
|
-
newGroupDelay: e.newGroupDelay || 500
|
|
2508
|
-
}, new x({
|
|
2509
|
-
key: N,
|
|
2510
|
-
state: {
|
|
2511
|
-
init() {
|
|
2512
|
-
return new A(w.empty, w.empty, null, 0, -1);
|
|
2513
|
-
},
|
|
2514
|
-
apply(t, n, r) {
|
|
2515
|
-
return Bn(n, r, t, e);
|
|
2516
|
-
}
|
|
2517
|
-
},
|
|
2518
|
-
config: e,
|
|
2519
|
-
props: {
|
|
2520
|
-
handleDOMEvents: {
|
|
2521
|
-
beforeinput(t, n) {
|
|
2522
|
-
let r = n.inputType, s = r == "historyUndo" ? Ue : r == "historyRedo" ? Ge : null;
|
|
2523
|
-
return !s || !t.editable ? !1 : (n.preventDefault(), s(t.state, t.dispatch));
|
|
2524
|
-
}
|
|
2525
|
-
}
|
|
2526
|
-
}
|
|
2527
|
-
});
|
|
2528
|
-
}
|
|
2529
|
-
function We(e, t) {
|
|
2530
|
-
return (n, r) => {
|
|
2531
|
-
let s = N.getState(n);
|
|
2532
|
-
if (!s || (e ? s.undone : s.done).eventCount == 0)
|
|
2533
|
-
return !1;
|
|
2534
|
-
if (r) {
|
|
2535
|
-
let i = $n(s, n, e);
|
|
2536
|
-
i && r(t ? i.scrollIntoView() : i);
|
|
2537
|
-
}
|
|
2538
|
-
return !0;
|
|
2539
|
-
};
|
|
2540
|
-
}
|
|
2541
|
-
const Ue = We(!1, !0), Ge = We(!0, !0);
|
|
2542
|
-
M.create({
|
|
2543
|
-
name: "characterCount",
|
|
2544
|
-
addOptions() {
|
|
2545
|
-
return {
|
|
2546
|
-
limit: null,
|
|
2547
|
-
autoTrim: !0,
|
|
2548
|
-
mode: "textSize",
|
|
2549
|
-
textCounter: (e) => e.length,
|
|
2550
|
-
wordCounter: (e) => e.split(" ").filter((t) => t !== "").length
|
|
2551
|
-
};
|
|
2552
|
-
},
|
|
2553
|
-
addStorage() {
|
|
2554
|
-
return {
|
|
2555
|
-
characters: () => 0,
|
|
2556
|
-
words: () => 0
|
|
2557
|
-
};
|
|
2558
|
-
},
|
|
2559
|
-
onBeforeCreate() {
|
|
2560
|
-
this.storage.characters = (e) => {
|
|
2561
|
-
const t = e?.node || this.editor.state.doc;
|
|
2562
|
-
if ((e?.mode || this.options.mode) === "textSize") {
|
|
2563
|
-
const r = t.textBetween(0, t.content.size, void 0, " ");
|
|
2564
|
-
return this.options.textCounter(r);
|
|
2565
|
-
}
|
|
2566
|
-
return t.nodeSize;
|
|
2567
|
-
}, this.storage.words = (e) => {
|
|
2568
|
-
const t = e?.node || this.editor.state.doc, n = t.textBetween(0, t.content.size, " ", " ");
|
|
2569
|
-
return this.options.wordCounter(n);
|
|
2570
|
-
};
|
|
2571
|
-
},
|
|
2572
|
-
addProseMirrorPlugins() {
|
|
2573
|
-
let e = !1;
|
|
2574
|
-
return [
|
|
2575
|
-
new x({
|
|
2576
|
-
key: new E("characterCount"),
|
|
2577
|
-
appendTransaction: (t, n, r) => {
|
|
2578
|
-
if (e)
|
|
2579
|
-
return;
|
|
2580
|
-
const s = this.options.limit, i = this.options.autoTrim;
|
|
2581
|
-
if (s == null || s === 0 || i === !1) {
|
|
2582
|
-
e = !0;
|
|
2583
|
-
return;
|
|
2584
|
-
}
|
|
2585
|
-
const o = this.storage.characters({ node: r.doc });
|
|
2586
|
-
if (o > s) {
|
|
2587
|
-
const a = o - s, l = 0, c = a;
|
|
2588
|
-
console.warn(
|
|
2589
|
-
`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`
|
|
2590
|
-
);
|
|
2591
|
-
const d = r.tr.deleteRange(l, c);
|
|
2592
|
-
return e = !0, d;
|
|
2593
|
-
}
|
|
2594
|
-
e = !0;
|
|
2595
|
-
},
|
|
2596
|
-
filterTransaction: (t, n) => {
|
|
2597
|
-
const r = this.options.limit;
|
|
2598
|
-
if (!t.docChanged || r === 0 || r === null || r === void 0)
|
|
2599
|
-
return !0;
|
|
2600
|
-
const s = this.storage.characters({ node: n.doc }), i = this.storage.characters({ node: t.doc });
|
|
2601
|
-
if (i <= r || s > r && i > r && i <= s)
|
|
2602
|
-
return !0;
|
|
2603
|
-
if (s > r && i > r && i > s || !t.getMeta("paste"))
|
|
2604
|
-
return !1;
|
|
2605
|
-
const a = t.selection.$head.pos, l = i - r, c = a - l, d = a;
|
|
2606
|
-
return t.deleteRange(c, d), !(this.storage.characters({ node: t.doc }) > r);
|
|
2607
|
-
}
|
|
2608
|
-
})
|
|
2609
|
-
];
|
|
2610
|
-
}
|
|
2611
|
-
});
|
|
2612
|
-
var Fn = M.create({
|
|
2613
|
-
name: "dropCursor",
|
|
2614
|
-
addOptions() {
|
|
2615
|
-
return {
|
|
2616
|
-
color: "currentColor",
|
|
2617
|
-
width: 1,
|
|
2618
|
-
class: void 0
|
|
2619
|
-
};
|
|
2620
|
-
},
|
|
2621
|
-
addProseMirrorPlugins() {
|
|
2622
|
-
return [Tn(this.options)];
|
|
2623
|
-
}
|
|
2624
|
-
});
|
|
2625
|
-
M.create({
|
|
2626
|
-
name: "focus",
|
|
2627
|
-
addOptions() {
|
|
2628
|
-
return {
|
|
2629
|
-
className: "has-focus",
|
|
2630
|
-
mode: "all"
|
|
2631
|
-
};
|
|
2632
|
-
},
|
|
2633
|
-
addProseMirrorPlugins() {
|
|
2634
|
-
return [
|
|
2635
|
-
new x({
|
|
2636
|
-
key: new E("focus"),
|
|
2637
|
-
props: {
|
|
2638
|
-
decorations: ({ doc: e, selection: t }) => {
|
|
2639
|
-
const { isEditable: n, isFocused: r } = this.editor, { anchor: s } = t, i = [];
|
|
2640
|
-
if (!n || !r)
|
|
2641
|
-
return S.create(e, []);
|
|
2642
|
-
let o = 0;
|
|
2643
|
-
this.options.mode === "deepest" && e.descendants((l, c) => {
|
|
2644
|
-
if (l.isText)
|
|
2645
|
-
return;
|
|
2646
|
-
if (!(s >= c && s <= c + l.nodeSize - 1))
|
|
2647
|
-
return !1;
|
|
2648
|
-
o += 1;
|
|
2649
|
-
});
|
|
2650
|
-
let a = 0;
|
|
2651
|
-
return e.descendants((l, c) => {
|
|
2652
|
-
if (l.isText || !(s >= c && s <= c + l.nodeSize - 1))
|
|
2653
|
-
return !1;
|
|
2654
|
-
if (a += 1, this.options.mode === "deepest" && o - a > 0 || this.options.mode === "shallowest" && a > 1)
|
|
2655
|
-
return this.options.mode === "deepest";
|
|
2656
|
-
i.push(
|
|
2657
|
-
Y.node(c, c + l.nodeSize, {
|
|
2658
|
-
class: this.options.className
|
|
2659
|
-
})
|
|
2660
|
-
);
|
|
2661
|
-
}), S.create(e, i);
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
})
|
|
2665
|
-
];
|
|
2666
|
-
}
|
|
2667
|
-
});
|
|
2668
|
-
var Vn = M.create({
|
|
2669
|
-
name: "gapCursor",
|
|
2670
|
-
addProseMirrorPlugins() {
|
|
2671
|
-
return [An()];
|
|
2672
|
-
},
|
|
2673
|
-
extendNodeSchema(e) {
|
|
2674
|
-
var t;
|
|
2675
|
-
const n = {
|
|
2676
|
-
name: e.name,
|
|
2677
|
-
options: e.options,
|
|
2678
|
-
storage: e.storage
|
|
2679
|
-
};
|
|
2680
|
-
return {
|
|
2681
|
-
allowGapCursor: (t = ut(ct(e, "allowGapCursor", n))) != null ? t : null
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
}), qe = "placeholder", Te = new E("tiptap__placeholder");
|
|
2685
|
-
function Xe(e) {
|
|
2686
|
-
const {
|
|
2687
|
-
editor: t,
|
|
2688
|
-
placeholder: n,
|
|
2689
|
-
dataAttribute: r,
|
|
2690
|
-
pos: s,
|
|
2691
|
-
node: i,
|
|
2692
|
-
isEmptyDoc: o,
|
|
2693
|
-
hasAnchor: a,
|
|
2694
|
-
classes: { emptyNode: l, emptyEditor: c }
|
|
2695
|
-
} = e, d = [l];
|
|
2696
|
-
return o && d.push(c), Y.node(s, s + i.nodeSize, {
|
|
2697
|
-
class: d.join(" "),
|
|
2698
|
-
[r]: typeof n == "function" ? n({
|
|
2699
|
-
editor: t,
|
|
2700
|
-
node: i,
|
|
2701
|
-
pos: s,
|
|
2702
|
-
hasAnchor: a
|
|
2703
|
-
}) : n
|
|
2704
|
-
});
|
|
2705
|
-
}
|
|
2706
|
-
function Je(e, t) {
|
|
2707
|
-
return typeof e == "function" ? e(t) : e;
|
|
2708
|
-
}
|
|
2709
|
-
function Ye({
|
|
2710
|
-
editor: e,
|
|
2711
|
-
options: t,
|
|
2712
|
-
dataAttribute: n,
|
|
2713
|
-
doc: r,
|
|
2714
|
-
selection: s,
|
|
2715
|
-
from: i,
|
|
2716
|
-
to: o
|
|
2717
|
-
}) {
|
|
2718
|
-
const { anchor: a } = s, l = [], c = e.isEmpty;
|
|
2719
|
-
return r.nodesBetween(i, o, (d, u) => {
|
|
2720
|
-
const p = a >= u && a <= u + d.nodeSize, h = !d.isLeaf && Se(d);
|
|
2721
|
-
return d.type.isTextblock && (p || !t.showOnlyCurrent) && h && l.push(
|
|
2722
|
-
Xe({
|
|
2723
|
-
editor: e,
|
|
2724
|
-
isEmptyDoc: c,
|
|
2725
|
-
dataAttribute: n,
|
|
2726
|
-
hasAnchor: p,
|
|
2727
|
-
placeholder: t.placeholder,
|
|
2728
|
-
classes: {
|
|
2729
|
-
emptyEditor: t.emptyEditorClass,
|
|
2730
|
-
emptyNode: Je(t.emptyNodeClass, {
|
|
2731
|
-
editor: e,
|
|
2732
|
-
node: d,
|
|
2733
|
-
pos: u,
|
|
2734
|
-
hasAnchor: p
|
|
2735
|
-
})
|
|
2736
|
-
},
|
|
2737
|
-
node: d,
|
|
2738
|
-
pos: u
|
|
2739
|
-
})
|
|
2740
|
-
), t.includeChildren;
|
|
2741
|
-
}), l;
|
|
2742
|
-
}
|
|
2743
|
-
function Ze({
|
|
2744
|
-
editor: e,
|
|
2745
|
-
options: t,
|
|
2746
|
-
dataAttribute: n,
|
|
2747
|
-
doc: r,
|
|
2748
|
-
selection: s
|
|
2749
|
-
}) {
|
|
2750
|
-
if (!(e.isEditable || !t.showOnlyWhenEditable))
|
|
2751
|
-
return null;
|
|
2752
|
-
const { anchor: o } = s, a = [], l = e.isEmpty;
|
|
2753
|
-
if (t.showOnlyCurrent && !t.includeChildren) {
|
|
2754
|
-
const d = r.resolve(o), u = d.depth > 0 ? d.node(1) : d.nodeAfter, p = d.depth > 0 ? d.before(1) : o;
|
|
2755
|
-
if (u && u.type.isTextblock && Se(u)) {
|
|
2756
|
-
const h = o >= p && o <= p + u.nodeSize;
|
|
2757
|
-
a.push(
|
|
2758
|
-
Xe({
|
|
2759
|
-
editor: e,
|
|
2760
|
-
isEmptyDoc: l,
|
|
2761
|
-
dataAttribute: n,
|
|
2762
|
-
hasAnchor: h,
|
|
2763
|
-
placeholder: t.placeholder,
|
|
2764
|
-
classes: {
|
|
2765
|
-
emptyEditor: t.emptyEditorClass,
|
|
2766
|
-
emptyNode: Je(t.emptyNodeClass, {
|
|
2767
|
-
editor: e,
|
|
2768
|
-
node: u,
|
|
2769
|
-
pos: p,
|
|
2770
|
-
hasAnchor: h
|
|
2771
|
-
})
|
|
2772
|
-
},
|
|
2773
|
-
node: u,
|
|
2774
|
-
pos: p
|
|
2775
|
-
})
|
|
2776
|
-
);
|
|
2777
|
-
}
|
|
2778
|
-
} else
|
|
2779
|
-
a.push(
|
|
2780
|
-
...Ye({
|
|
2781
|
-
editor: e,
|
|
2782
|
-
options: t,
|
|
2783
|
-
dataAttribute: n,
|
|
2784
|
-
doc: r,
|
|
2785
|
-
selection: s,
|
|
2786
|
-
from: 0,
|
|
2787
|
-
to: r.content.size
|
|
2788
|
-
})
|
|
2789
|
-
);
|
|
2790
|
-
return S.create(r, a);
|
|
2791
|
-
}
|
|
2792
|
-
function H(e, t) {
|
|
2793
|
-
var n;
|
|
2794
|
-
const r = e.resolve(t);
|
|
2795
|
-
if (r.depth === 0) {
|
|
2796
|
-
const o = (n = r.nodeAfter) != null ? n : r.nodeBefore;
|
|
2797
|
-
if (!o)
|
|
2798
|
-
return { from: t, to: t };
|
|
2799
|
-
const a = r.nodeAfter ? t : t - o.nodeSize;
|
|
2800
|
-
return { from: a, to: a + o.nodeSize };
|
|
2801
|
-
}
|
|
2802
|
-
const s = r.before(1), i = r.node(1);
|
|
2803
|
-
return { from: s, to: s + i.nodeSize };
|
|
2804
|
-
}
|
|
2805
|
-
function $(e, t) {
|
|
2806
|
-
return {
|
|
2807
|
-
from: Math.max(0, t.from - 1),
|
|
2808
|
-
to: Math.min(e.content.size, t.to - 1)
|
|
2809
|
-
};
|
|
2810
|
-
}
|
|
2811
|
-
function jn(e, t, n) {
|
|
2812
|
-
const r = [];
|
|
2813
|
-
return e.forEach((s, i) => {
|
|
2814
|
-
const o = i, a = o + s.nodeSize, l = o + 1, c = a + 1;
|
|
2815
|
-
l < n && c > t && r.push({ from: o, to: a });
|
|
2816
|
-
}), r;
|
|
2817
|
-
}
|
|
2818
|
-
function Wn(e) {
|
|
2819
|
-
if (e.length === 0)
|
|
2820
|
-
return [];
|
|
2821
|
-
const t = [...e].sort((r, s) => r.from - s.from), n = [{ ...t[0] }];
|
|
2822
|
-
for (let r = 1; r < t.length; r += 1) {
|
|
2823
|
-
const s = n[n.length - 1], i = t[r];
|
|
2824
|
-
i.from <= s.to ? s.to = Math.max(s.to, i.to) : n.push({ ...i });
|
|
2825
|
-
}
|
|
2826
|
-
return n;
|
|
2827
|
-
}
|
|
2828
|
-
function Un(e, t) {
|
|
2829
|
-
const n = jn(e, t.from, t.to);
|
|
2830
|
-
return n.push($(e, H(e, t.from))), t.to > t.from ? n.push(
|
|
2831
|
-
$(
|
|
2832
|
-
e,
|
|
2833
|
-
H(e, Math.min(t.to, e.content.size + 1) - 1)
|
|
2834
|
-
)
|
|
2835
|
-
) : t.from < e.content.size + 1 && n.push(
|
|
2836
|
-
$(
|
|
2837
|
-
e,
|
|
2838
|
-
H(e, Math.min(t.from + 1, e.content.size))
|
|
2839
|
-
)
|
|
2840
|
-
), n;
|
|
2841
|
-
}
|
|
2842
|
-
function Gn(e, t, n) {
|
|
2843
|
-
const r = [];
|
|
2844
|
-
if (e.docChanged) {
|
|
2845
|
-
const s = dt(e);
|
|
2846
|
-
for (const i of s)
|
|
2847
|
-
r.push(...Un(n.doc, i.newRange));
|
|
2848
|
-
}
|
|
2849
|
-
return e.selectionSet && (r.push(
|
|
2850
|
-
$(
|
|
2851
|
-
n.doc,
|
|
2852
|
-
H(n.doc, e.mapping.map(t.selection.anchor))
|
|
2853
|
-
)
|
|
2854
|
-
), r.push(
|
|
2855
|
-
$(
|
|
2856
|
-
n.doc,
|
|
2857
|
-
H(n.doc, n.selection.anchor)
|
|
2858
|
-
)
|
|
2859
|
-
)), Wn(r);
|
|
2860
|
-
}
|
|
2861
|
-
function qn(e, t, n) {
|
|
2862
|
-
const r = Math.max(0, Math.min(e, n.content.size)), s = Math.max(r, Math.min(t, n.content.size));
|
|
2863
|
-
return { from: r, to: s };
|
|
2864
|
-
}
|
|
2865
|
-
function Xn({
|
|
2866
|
-
decorations: e,
|
|
2867
|
-
ranges: t,
|
|
2868
|
-
editor: n,
|
|
2869
|
-
options: r,
|
|
2870
|
-
dataAttribute: s,
|
|
2871
|
-
doc: i,
|
|
2872
|
-
selection: o
|
|
2873
|
-
}) {
|
|
2874
|
-
let a = e;
|
|
2875
|
-
for (const l of t) {
|
|
2876
|
-
const { from: c, to: d } = qn(l.from, l.to, i), u = a.find(c, d).filter((h) => h.from >= c && h.to <= d);
|
|
2877
|
-
u.length && (a = a.remove(u));
|
|
2878
|
-
const p = Ye({
|
|
2879
|
-
editor: n,
|
|
2880
|
-
options: r,
|
|
2881
|
-
dataAttribute: s,
|
|
2882
|
-
doc: i,
|
|
2883
|
-
selection: o,
|
|
2884
|
-
from: c,
|
|
2885
|
-
to: d
|
|
2886
|
-
});
|
|
2887
|
-
p.length && (a = a.add(i, p));
|
|
2888
|
-
}
|
|
2889
|
-
return a;
|
|
2890
|
-
}
|
|
2891
|
-
function Jn({
|
|
2892
|
-
editor: e,
|
|
2893
|
-
options: t,
|
|
2894
|
-
dataAttribute: n
|
|
2895
|
-
}) {
|
|
2896
|
-
return {
|
|
2897
|
-
init(r, s) {
|
|
2898
|
-
const i = Ze({
|
|
2899
|
-
editor: e,
|
|
2900
|
-
options: t,
|
|
2901
|
-
dataAttribute: n,
|
|
2902
|
-
doc: s.doc,
|
|
2903
|
-
selection: s.selection
|
|
2904
|
-
});
|
|
2905
|
-
return i ?? S.empty;
|
|
2906
|
-
},
|
|
2907
|
-
apply(r, s, i, o) {
|
|
2908
|
-
if (!r.docChanged && !r.selectionSet)
|
|
2909
|
-
return s;
|
|
2910
|
-
const a = s.map(r.mapping, r.doc), l = Gn(r, i, o);
|
|
2911
|
-
return Xn({
|
|
2912
|
-
decorations: a,
|
|
2913
|
-
ranges: l,
|
|
2914
|
-
editor: e,
|
|
2915
|
-
options: t,
|
|
2916
|
-
dataAttribute: n,
|
|
2917
|
-
doc: o.doc,
|
|
2918
|
-
selection: o.selection
|
|
2919
|
-
});
|
|
2920
|
-
}
|
|
2921
|
-
};
|
|
2922
|
-
}
|
|
2923
|
-
function Yn(e) {
|
|
2924
|
-
return e.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-]/g, "").replace(/^[0-9-]+/, "").replace(/^-+/, "").toLowerCase();
|
|
2925
|
-
}
|
|
2926
|
-
function Zn({ editor: e, options: t }) {
|
|
2927
|
-
const n = t.dataAttribute ? `data-${Yn(t.dataAttribute)}` : `data-${qe}`, r = t.showOnlyCurrent && !t.includeChildren;
|
|
2928
|
-
return new x({
|
|
2929
|
-
key: Te,
|
|
2930
|
-
...r ? {} : {
|
|
2931
|
-
state: Jn({ editor: e, options: t, dataAttribute: n })
|
|
2932
|
-
},
|
|
2933
|
-
props: {
|
|
2934
|
-
decorations: r ? ({ doc: s, selection: i }) => Ze({ editor: e, options: t, dataAttribute: n, doc: s, selection: i }) : (s) => {
|
|
2935
|
-
var i;
|
|
2936
|
-
return t.showOnlyWhenEditable && !e.isEditable ? S.empty : (i = Te.getState(s)) != null ? i : S.empty;
|
|
2937
|
-
}
|
|
2938
|
-
}
|
|
2939
|
-
});
|
|
2940
|
-
}
|
|
2941
|
-
M.create({
|
|
2942
|
-
name: "placeholder",
|
|
2943
|
-
addOptions() {
|
|
2944
|
-
return {
|
|
2945
|
-
emptyEditorClass: "is-editor-empty",
|
|
2946
|
-
emptyNodeClass: "is-empty",
|
|
2947
|
-
dataAttribute: qe,
|
|
2948
|
-
placeholder: "Write something …",
|
|
2949
|
-
showOnlyWhenEditable: !0,
|
|
2950
|
-
showOnlyCurrent: !0,
|
|
2951
|
-
includeChildren: !1
|
|
2952
|
-
};
|
|
2953
|
-
},
|
|
2954
|
-
addProseMirrorPlugins() {
|
|
2955
|
-
return [Zn({ editor: this.editor, options: this.options })];
|
|
2956
|
-
}
|
|
2957
|
-
});
|
|
2958
|
-
function ae(e, t) {
|
|
2959
|
-
return !e.selection.empty && !Ce(e.selection) && t.isEditable;
|
|
2960
|
-
}
|
|
2961
|
-
function Qn(e, t) {
|
|
2962
|
-
return ae(e, t) && !t.isFocused && !t.view.dragging;
|
|
2963
|
-
}
|
|
2964
|
-
function er() {
|
|
2965
|
-
var e;
|
|
2966
|
-
(e = window.getSelection()) == null || e.removeAllRanges();
|
|
2967
|
-
}
|
|
2968
|
-
function tr(e) {
|
|
2969
|
-
e.focus();
|
|
2970
|
-
}
|
|
2971
|
-
M.create({
|
|
2972
|
-
name: "selection",
|
|
2973
|
-
addOptions() {
|
|
2974
|
-
return {
|
|
2975
|
-
className: "selection"
|
|
2976
|
-
};
|
|
2977
|
-
},
|
|
2978
|
-
addProseMirrorPlugins() {
|
|
2979
|
-
const { editor: e, options: t } = this;
|
|
2980
|
-
return [
|
|
2981
|
-
new x({
|
|
2982
|
-
key: new E("selection"),
|
|
2983
|
-
props: {
|
|
2984
|
-
decorations(n) {
|
|
2985
|
-
return Qn(n, e) ? S.create(n.doc, [
|
|
2986
|
-
Y.inline(n.selection.from, n.selection.to, {
|
|
2987
|
-
class: t.className
|
|
2988
|
-
})
|
|
2989
|
-
]) : null;
|
|
2990
|
-
},
|
|
2991
|
-
handleDOMEvents: {
|
|
2992
|
-
blur(n) {
|
|
2993
|
-
return ae(n.state, e) && er(), !1;
|
|
2994
|
-
},
|
|
2995
|
-
focus(n) {
|
|
2996
|
-
return ae(n.state, e) && requestAnimationFrame(() => {
|
|
2997
|
-
!e.isDestroyed && n.hasFocus() && tr(n);
|
|
2998
|
-
}), !1;
|
|
2999
|
-
}
|
|
3000
|
-
}
|
|
3001
|
-
}
|
|
3002
|
-
})
|
|
3003
|
-
];
|
|
3004
|
-
}
|
|
3005
|
-
});
|
|
3006
|
-
var nr = "skipTrailingNode";
|
|
3007
|
-
function xe({
|
|
3008
|
-
types: e,
|
|
3009
|
-
node: t
|
|
3010
|
-
}) {
|
|
3011
|
-
return t && Array.isArray(e) && e.includes(t.type) || t?.type === e;
|
|
3012
|
-
}
|
|
3013
|
-
var rr = M.create({
|
|
3014
|
-
name: "trailingNode",
|
|
3015
|
-
addOptions() {
|
|
3016
|
-
return {
|
|
3017
|
-
node: void 0,
|
|
3018
|
-
notAfter: []
|
|
3019
|
-
};
|
|
3020
|
-
},
|
|
3021
|
-
addProseMirrorPlugins() {
|
|
3022
|
-
var e;
|
|
3023
|
-
const t = new E(this.name), n = this.options.node || ((e = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : e.name) || "paragraph", r = Object.entries(this.editor.schema.nodes).map(([, s]) => s).filter((s) => (this.options.notAfter || []).concat(n).includes(s.name));
|
|
3024
|
-
return [
|
|
3025
|
-
new x({
|
|
3026
|
-
key: t,
|
|
3027
|
-
appendTransaction: (s, i, o) => {
|
|
3028
|
-
const { doc: a, tr: l, schema: c } = o, d = t.getState(o), u = a.content.size, p = c.nodes[n];
|
|
3029
|
-
if (!s.some((h) => h.getMeta(nr)) && d)
|
|
3030
|
-
return l.insert(u, p.create());
|
|
3031
|
-
},
|
|
3032
|
-
state: {
|
|
3033
|
-
init: (s, i) => {
|
|
3034
|
-
const o = i.tr.doc.lastChild;
|
|
3035
|
-
return !xe({ node: o, types: r });
|
|
3036
|
-
},
|
|
3037
|
-
apply: (s, i) => {
|
|
3038
|
-
if (!s.docChanged || s.getMeta("__uniqueIDTransaction"))
|
|
3039
|
-
return i;
|
|
3040
|
-
const o = s.doc.lastChild;
|
|
3041
|
-
return !xe({ node: o, types: r });
|
|
3042
|
-
}
|
|
3043
|
-
}
|
|
3044
|
-
})
|
|
3045
|
-
];
|
|
3046
|
-
}
|
|
3047
|
-
}), sr = M.create({
|
|
3048
|
-
name: "undoRedo",
|
|
3049
|
-
addOptions() {
|
|
3050
|
-
return {
|
|
3051
|
-
depth: 100,
|
|
3052
|
-
newGroupDelay: 500
|
|
3053
|
-
};
|
|
3054
|
-
},
|
|
3055
|
-
addCommands() {
|
|
3056
|
-
return {
|
|
3057
|
-
undo: () => ({ state: e, dispatch: t }) => Ue(e, t),
|
|
3058
|
-
redo: () => ({ state: e, dispatch: t }) => Ge(e, t)
|
|
3059
|
-
};
|
|
3060
|
-
},
|
|
3061
|
-
addProseMirrorPlugins() {
|
|
3062
|
-
return [Kn(this.options)];
|
|
3063
|
-
},
|
|
3064
|
-
addKeyboardShortcuts() {
|
|
3065
|
-
return {
|
|
3066
|
-
"Mod-z": () => this.editor.commands.undo(),
|
|
3067
|
-
"Shift-Mod-z": () => this.editor.commands.redo(),
|
|
3068
|
-
"Mod-y": () => this.editor.commands.redo(),
|
|
3069
|
-
// Russian keyboard layouts
|
|
3070
|
-
"Mod-я": () => this.editor.commands.undo(),
|
|
3071
|
-
"Shift-Mod-я": () => this.editor.commands.redo()
|
|
3072
|
-
};
|
|
3073
|
-
}
|
|
3074
|
-
}), ir = M.create({
|
|
3075
|
-
name: "starterKit",
|
|
3076
|
-
addExtensions() {
|
|
3077
|
-
var e, t, n, r;
|
|
3078
|
-
const s = [];
|
|
3079
|
-
return this.options.bold !== !1 && s.push(wt.configure(this.options.bold)), this.options.blockquote !== !1 && s.push(yt.configure(this.options.blockquote)), this.options.bulletList !== !1 && s.push(Ee.configure(this.options.bulletList)), this.options.code !== !1 && s.push(xt.configure(this.options.code)), this.options.codeBlock !== !1 && s.push(At.configure(this.options.codeBlock)), this.options.document !== !1 && s.push(St.configure(this.options.document)), this.options.dropcursor !== !1 && s.push(Fn.configure(this.options.dropcursor)), this.options.gapcursor !== !1 && s.push(Vn.configure(this.options.gapcursor)), this.options.hardBreak !== !1 && s.push(Et.configure(this.options.hardBreak)), this.options.heading !== !1 && s.push(pt.configure(this.options.heading)), this.options.undoRedo !== !1 && s.push(sr.configure(this.options.undoRedo)), this.options.horizontalRule !== !1 && s.push(Rt.configure(this.options.horizontalRule)), this.options.italic !== !1 && s.push(Dt.configure(this.options.italic)), this.options.listItem !== !1 && s.push(Oe.configure(this.options.listItem)), this.options.listKeymap !== !1 && s.push(ze.configure((e = this.options) == null ? void 0 : e.listKeymap)), this.options.link !== !1 && s.push(ht.configure((t = this.options) == null ? void 0 : t.link)), this.options.orderedList !== !1 && s.push(Fe.configure(this.options.orderedList)), this.options.paragraph !== !1 && s.push(ft.configure(this.options.paragraph)), this.options.strike !== !1 && s.push(Mn.configure(this.options.strike)), this.options.text !== !1 && s.push(wn.configure(this.options.text)), this.options.underline !== !1 && s.push(Ln.configure((n = this.options) == null ? void 0 : n.underline)), this.options.trailingNode !== !1 && s.push(rr.configure((r = this.options) == null ? void 0 : r.trailingNode)), s;
|
|
3080
|
-
}
|
|
3081
|
-
}), dr = ir;
|
|
3082
|
-
export {
|
|
3083
|
-
ir as StarterKit,
|
|
3084
|
-
dr as default
|
|
3085
|
-
};
|