zt-react-milkdown 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +88 -36
- package/dist/index.mjs +24636 -4871
- package/dist/src/core/createEditor.d.ts +42 -3
- package/dist/src/core/createEditor.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/plugins/custom/block-transform/block-transform.d.ts.map +1 -1
- package/dist/src/plugins/custom/image/image-resizable-schema.d.ts +3 -3
- package/dist/src/plugins/custom/image/image-resizable-schema.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu-commands.d.ts.map +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts +1 -1
- package/dist/src/plugins/custom/slash-menu/slash-menu.d.ts.map +1 -1
- package/dist/src/react/components/MilkdownEditor.d.ts.map +1 -1
- package/dist/src/react/hooks/useMilkdownEditor.d.ts +1 -3
- package/dist/src/react/hooks/useMilkdownEditor.d.ts.map +1 -1
- package/dist/src/types/editor.d.ts +0 -34
- package/dist/src/types/editor.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/commands-BJpevWrH.js +0 -409
- package/dist/commands-BmZHd6RL.js +0 -2
- package/dist/commands-CM7IuhpT.cjs +0 -2
- package/dist/commands-f4yOm8DQ.cjs +0 -1
- package/dist/debounce-C_TNzOFT.cjs +0 -1
- package/dist/debounce-Z8-khnlZ.js +0 -118
- package/dist/dist-BjfIurm0.js +0 -1584
- package/dist/dist-CLTsQjPD.js +0 -3500
- package/dist/dist-D7LE16E1.cjs +0 -1
- package/dist/dist-DQnWlYyo.cjs +0 -5
- package/dist/floating-ui.dom-B_oXwL6O.cjs +0 -1
- package/dist/floating-ui.dom-Cm9Ov61_.js +0 -883
- package/dist/lib-5lx86j_L.js +0 -21
- package/dist/lib-72N1aRae.js +0 -1884
- package/dist/lib-BIxqp3lX.js +0 -387
- package/dist/lib-BLTQkf4j.cjs +0 -39
- package/dist/lib-BzlEyehQ.cjs +0 -5
- package/dist/lib-C61-3fwS.cjs +0 -1
- package/dist/lib-C82poHMJ.cjs +0 -1
- package/dist/lib-CDhjYvDm.js +0 -74
- package/dist/lib-CHQUpMrL.cjs +0 -3
- package/dist/lib-CYWwNE4c.js +0 -8673
- package/dist/lib-Cixz93sP.js +0 -2222
- package/dist/lib-CqJFV3ME.cjs +0 -1
- package/dist/lib-D7VWCO2M.cjs +0 -4
- package/dist/lib-DaPs62nF.js +0 -28
- package/dist/lib-Dka_BhhQ.cjs +0 -1
- package/dist/lib-DrllUeuK.cjs +0 -1
- package/dist/lib-wpjVX5Vf.js +0 -80
- package/dist/lib-z6CKD87x.js +0 -331
- package/dist/schema-list-CFEw5DQ8.cjs +0 -1
- package/dist/schema-list-CiFfAlj-.js +0 -110
- package/dist/state-BC1dqWPQ.cjs +0 -1
- package/dist/state-BvRk9kiK.cjs +0 -0
- package/dist/state-BvRk9kiK.js +0 -0
- package/dist/state-rTW_1XVf.js +0 -3
package/dist/lib-72N1aRae.js
DELETED
|
@@ -1,1884 +0,0 @@
|
|
|
1
|
-
import { D as e, G as t, H as n, I as r, K as i, M as a, W as o, X as s, Y as c, Z as l, f as u, j as ee, s as d, vt as f, xt as te, z as ne } from "./lib-CYWwNE4c.js";
|
|
2
|
-
import { E as re, a as p, c as ie, i as m, o as ae, p as oe, u as se, v as ce, w as le } from "./dist-CLTsQjPD.js";
|
|
3
|
-
import { O as ue, k as de, s as fe, w as h } from "./commands-BJpevWrH.js";
|
|
4
|
-
import { a as pe, c as g, d as _, i as me, n as he, o as ge, p as v, r as y, s as b, t as x, u as S } from "./lib-BIxqp3lX.js";
|
|
5
|
-
import { i as _e, n as ve, r as ye } from "./schema-list-CiFfAlj-.js";
|
|
6
|
-
//#region node_modules/.pnpm/mdast-util-definitions@6.0.0/node_modules/mdast-util-definitions/lib/index.js
|
|
7
|
-
function be(e) {
|
|
8
|
-
let t = /* @__PURE__ */ new Map();
|
|
9
|
-
if (!e || !e.type) throw Error("mdast-util-definitions expected node");
|
|
10
|
-
return c(e, "definition", function(e) {
|
|
11
|
-
let n = xe(e.identifier);
|
|
12
|
-
n && !t.get(n) && t.set(n, e);
|
|
13
|
-
}), n;
|
|
14
|
-
function n(e) {
|
|
15
|
-
let n = xe(e);
|
|
16
|
-
return t.get(n);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function xe(e) {
|
|
20
|
-
return String(e || "").toUpperCase();
|
|
21
|
-
}
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region node_modules/.pnpm/remark-inline-links@7.0.0/node_modules/remark-inline-links/lib/index.js
|
|
24
|
-
function Se() {
|
|
25
|
-
return function(e) {
|
|
26
|
-
let t = be(e);
|
|
27
|
-
c(e, function(e, n, r) {
|
|
28
|
-
if (e.type === "definition" && r !== void 0 && typeof n == "number") return r.children.splice(n, 1), [s, n];
|
|
29
|
-
if (e.type === "imageReference" || e.type === "linkReference") {
|
|
30
|
-
let i = t(e.identifier);
|
|
31
|
-
if (i && r && typeof n == "number") return r.children[n] = e.type === "imageReference" ? {
|
|
32
|
-
type: "image",
|
|
33
|
-
url: i.url,
|
|
34
|
-
title: i.title,
|
|
35
|
-
alt: e.alt
|
|
36
|
-
} : {
|
|
37
|
-
type: "link",
|
|
38
|
-
url: i.url,
|
|
39
|
-
title: i.title,
|
|
40
|
-
children: e.children
|
|
41
|
-
}, [s, n];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region node_modules/.pnpm/@milkdown+preset-commonmark@7.21.1/node_modules/@milkdown/preset-commonmark/lib/index.js
|
|
48
|
-
var Ce = /* @__PURE__ */ te({
|
|
49
|
-
addBlockTypeCommand: () => jt,
|
|
50
|
-
blockquoteAttr: () => Ve,
|
|
51
|
-
blockquoteKeymap: () => We,
|
|
52
|
-
blockquoteSchema: () => G,
|
|
53
|
-
bulletListAttr: () => at,
|
|
54
|
-
bulletListKeymap: () => ct,
|
|
55
|
-
bulletListSchema: () => Z,
|
|
56
|
-
clearTextInCurrentBlockCommand: () => Ot,
|
|
57
|
-
codeBlockAttr: () => Ge,
|
|
58
|
-
codeBlockKeymap: () => Ye,
|
|
59
|
-
codeBlockSchema: () => K,
|
|
60
|
-
commands: () => Nt,
|
|
61
|
-
commonmark: () => Zt,
|
|
62
|
-
createCodeBlockCommand: () => qe,
|
|
63
|
-
createCodeBlockInputRule: () => Ke,
|
|
64
|
-
docSchema: () => je,
|
|
65
|
-
downgradeHeadingCommand: () => ze,
|
|
66
|
-
emphasisAttr: () => w,
|
|
67
|
-
emphasisKeymap: () => D,
|
|
68
|
-
emphasisSchema: () => T,
|
|
69
|
-
emphasisStarInputRule: () => Te,
|
|
70
|
-
emphasisUnderscoreInputRule: () => Ee,
|
|
71
|
-
hardbreakAttr: () => J,
|
|
72
|
-
hardbreakClearMarkPlugin: () => Gt,
|
|
73
|
-
hardbreakFilterNodes: () => Kt,
|
|
74
|
-
hardbreakFilterPlugin: () => qt,
|
|
75
|
-
hardbreakKeymap: () => tt,
|
|
76
|
-
hardbreakSchema: () => Y,
|
|
77
|
-
headingAttr: () => H,
|
|
78
|
-
headingIdGenerator: () => V,
|
|
79
|
-
headingKeymap: () => Be,
|
|
80
|
-
headingSchema: () => U,
|
|
81
|
-
hrAttr: () => nt,
|
|
82
|
-
hrSchema: () => X,
|
|
83
|
-
htmlAttr: () => xt,
|
|
84
|
-
htmlSchema: () => St,
|
|
85
|
-
imageAttr: () => Xe,
|
|
86
|
-
imageSchema: () => q,
|
|
87
|
-
inlineCodeAttr: () => M,
|
|
88
|
-
inlineCodeInputRule: () => Oe,
|
|
89
|
-
inlineCodeKeymap: () => F,
|
|
90
|
-
inlineCodeSchema: () => N,
|
|
91
|
-
inlineNodesCursorPlugin: () => Wt,
|
|
92
|
-
inputRules: () => wt,
|
|
93
|
-
insertHardbreakCommand: () => et,
|
|
94
|
-
insertHrCommand: () => it,
|
|
95
|
-
insertHrInputRule: () => rt,
|
|
96
|
-
insertImageCommand: () => Ze,
|
|
97
|
-
insertImageInputRule: () => $e,
|
|
98
|
-
isMarkSelectedCommand: () => Et,
|
|
99
|
-
isNodeSelectedCommand: () => Dt,
|
|
100
|
-
keymap: () => Pt,
|
|
101
|
-
liftFirstListItemCommand: () => vt,
|
|
102
|
-
liftListItemCommand: () => ht,
|
|
103
|
-
linkAttr: () => I,
|
|
104
|
-
linkSchema: () => L,
|
|
105
|
-
listItemAttr: () => pt,
|
|
106
|
-
listItemKeymap: () => yt,
|
|
107
|
-
listItemSchema: () => $,
|
|
108
|
-
markInputRules: () => Tt,
|
|
109
|
-
orderedListAttr: () => lt,
|
|
110
|
-
orderedListKeymap: () => ft,
|
|
111
|
-
orderedListSchema: () => Q,
|
|
112
|
-
paragraphAttr: () => z,
|
|
113
|
-
paragraphKeymap: () => Fe,
|
|
114
|
-
paragraphSchema: () => B,
|
|
115
|
-
plugins: () => Xt,
|
|
116
|
-
remarkAddOrderInListPlugin: () => Ft,
|
|
117
|
-
remarkHtmlTransformer: () => Ht,
|
|
118
|
-
remarkInlineLinkPlugin: () => Lt,
|
|
119
|
-
remarkLineBreak: () => It,
|
|
120
|
-
remarkMarker: () => Ut,
|
|
121
|
-
remarkPreserveEmptyLinePlugin: () => R,
|
|
122
|
-
schema: () => Ct,
|
|
123
|
-
selectTextNearPosCommand: () => Mt,
|
|
124
|
-
setBlockTypeCommand: () => kt,
|
|
125
|
-
sinkListItemCommand: () => mt,
|
|
126
|
-
splitListItemCommand: () => gt,
|
|
127
|
-
strongAttr: () => O,
|
|
128
|
-
strongInputRule: () => De,
|
|
129
|
-
strongKeymap: () => j,
|
|
130
|
-
strongSchema: () => k,
|
|
131
|
-
syncHeadingIdPlugin: () => Jt,
|
|
132
|
-
syncListOrderPlugin: () => Yt,
|
|
133
|
-
textSchema: () => bt,
|
|
134
|
-
toggleEmphasisCommand: () => E,
|
|
135
|
-
toggleInlineCodeCommand: () => P,
|
|
136
|
-
toggleLinkCommand: () => ke,
|
|
137
|
-
toggleStrongCommand: () => A,
|
|
138
|
-
turnIntoTextCommand: () => Pe,
|
|
139
|
-
updateCodeBlockLanguageCommand: () => Je,
|
|
140
|
-
updateImageCommand: () => Qe,
|
|
141
|
-
updateLinkCommand: () => Ae,
|
|
142
|
-
wrapInBlockTypeCommand: () => At,
|
|
143
|
-
wrapInBlockquoteCommand: () => Ue,
|
|
144
|
-
wrapInBlockquoteInputRule: () => He,
|
|
145
|
-
wrapInBulletListCommand: () => st,
|
|
146
|
-
wrapInBulletListInputRule: () => ot,
|
|
147
|
-
wrapInHeadingCommand: () => W,
|
|
148
|
-
wrapInHeadingInputRule: () => Re,
|
|
149
|
-
wrapInOrderedListCommand: () => dt,
|
|
150
|
-
wrapInOrderedListInputRule: () => ut
|
|
151
|
-
});
|
|
152
|
-
function we(e, t) {
|
|
153
|
-
if (!(t.childCount >= 1 && t.lastChild?.type.name === "hardbreak")) {
|
|
154
|
-
e.next(t.content);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
let n = [];
|
|
158
|
-
t.content.forEach((e, r, i) => {
|
|
159
|
-
i !== t.childCount - 1 && n.push(e);
|
|
160
|
-
}), e.next(le.fromArray(n));
|
|
161
|
-
}
|
|
162
|
-
function C(e, t) {
|
|
163
|
-
return Object.assign(e, { meta: {
|
|
164
|
-
package: "@milkdown/preset-commonmark",
|
|
165
|
-
...t
|
|
166
|
-
} }), e;
|
|
167
|
-
}
|
|
168
|
-
var w = me("emphasis");
|
|
169
|
-
C(w, {
|
|
170
|
-
displayName: "Attr<emphasis>",
|
|
171
|
-
group: "Emphasis"
|
|
172
|
-
});
|
|
173
|
-
var T = pe("emphasis", (t) => ({
|
|
174
|
-
attrs: { marker: {
|
|
175
|
-
default: t.get(e).emphasis || "*",
|
|
176
|
-
validate: "string"
|
|
177
|
-
} },
|
|
178
|
-
parseDOM: [
|
|
179
|
-
{ tag: "i" },
|
|
180
|
-
{ tag: "em" },
|
|
181
|
-
{
|
|
182
|
-
style: "font-style",
|
|
183
|
-
getAttrs: (e) => e === "italic"
|
|
184
|
-
}
|
|
185
|
-
],
|
|
186
|
-
toDOM: (e) => ["em", t.get(w.key)(e)],
|
|
187
|
-
parseMarkdown: {
|
|
188
|
-
match: (e) => e.type === "emphasis",
|
|
189
|
-
runner: (e, t, n) => {
|
|
190
|
-
e.openMark(n, { marker: t.marker }), e.next(t.children), e.closeMark(n);
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
toMarkdown: {
|
|
194
|
-
match: (e) => e.type.name === "emphasis",
|
|
195
|
-
runner: (e, t) => {
|
|
196
|
-
e.withMark(t, "emphasis", void 0, { marker: t.attrs.marker });
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}));
|
|
200
|
-
C(T.mark, {
|
|
201
|
-
displayName: "MarkSchema<emphasis>",
|
|
202
|
-
group: "Emphasis"
|
|
203
|
-
}), C(T.ctx, {
|
|
204
|
-
displayName: "MarkSchemaCtx<emphasis>",
|
|
205
|
-
group: "Emphasis"
|
|
206
|
-
});
|
|
207
|
-
var E = x("ToggleEmphasis", (e) => () => ue(T.type(e)));
|
|
208
|
-
C(E, {
|
|
209
|
-
displayName: "Command<toggleEmphasisCommand>",
|
|
210
|
-
group: "Emphasis"
|
|
211
|
-
});
|
|
212
|
-
var Te = y((e) => n(/(?:^|[^*])\*([^*]+)\*$/, T.type(e), {
|
|
213
|
-
getAttr: () => ({ marker: "*" }),
|
|
214
|
-
updateCaptured: ({ fullMatch: e, start: t }) => e.startsWith("*") ? {} : {
|
|
215
|
-
fullMatch: e.slice(1),
|
|
216
|
-
start: t + 1
|
|
217
|
-
}
|
|
218
|
-
}));
|
|
219
|
-
C(Te, {
|
|
220
|
-
displayName: "InputRule<emphasis>|Star",
|
|
221
|
-
group: "Emphasis"
|
|
222
|
-
});
|
|
223
|
-
var Ee = y((e) => n(/\b_(?![_\s])(.*?[^_\s])_\b/, T.type(e), {
|
|
224
|
-
getAttr: () => ({ marker: "_" }),
|
|
225
|
-
updateCaptured: ({ fullMatch: e, start: t }) => e.startsWith("_") ? {} : {
|
|
226
|
-
fullMatch: e.slice(1),
|
|
227
|
-
start: t + 1
|
|
228
|
-
}
|
|
229
|
-
}));
|
|
230
|
-
C(Ee, {
|
|
231
|
-
displayName: "InputRule<emphasis>|Underscore",
|
|
232
|
-
group: "Emphasis"
|
|
233
|
-
});
|
|
234
|
-
var D = v("emphasisKeymap", { ToggleEmphasis: {
|
|
235
|
-
shortcuts: "Mod-i",
|
|
236
|
-
command: (e) => {
|
|
237
|
-
let t = e.get(d);
|
|
238
|
-
return () => t.call(E.key);
|
|
239
|
-
}
|
|
240
|
-
} });
|
|
241
|
-
C(D.ctx, {
|
|
242
|
-
displayName: "KeymapCtx<emphasis>",
|
|
243
|
-
group: "Emphasis"
|
|
244
|
-
}), C(D.shortcuts, {
|
|
245
|
-
displayName: "Keymap<emphasis>",
|
|
246
|
-
group: "Emphasis"
|
|
247
|
-
});
|
|
248
|
-
var O = me("strong");
|
|
249
|
-
C(O, {
|
|
250
|
-
displayName: "Attr<strong>",
|
|
251
|
-
group: "Strong"
|
|
252
|
-
});
|
|
253
|
-
var k = pe("strong", (t) => ({
|
|
254
|
-
attrs: { marker: {
|
|
255
|
-
default: t.get(e).strong || "*",
|
|
256
|
-
validate: "string"
|
|
257
|
-
} },
|
|
258
|
-
parseDOM: [
|
|
259
|
-
{
|
|
260
|
-
tag: "b",
|
|
261
|
-
getAttrs: (e) => e.style.fontWeight != "normal" && null
|
|
262
|
-
},
|
|
263
|
-
{ tag: "strong" },
|
|
264
|
-
{
|
|
265
|
-
style: "font-style",
|
|
266
|
-
getAttrs: (e) => e === "bold"
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
style: "font-weight=400",
|
|
270
|
-
clearMark: (e) => e.type.name == "strong"
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
style: "font-weight",
|
|
274
|
-
getAttrs: (e) => /^(bold(er)?|[5-9]\d{2,})$/.test(e) && null
|
|
275
|
-
}
|
|
276
|
-
],
|
|
277
|
-
toDOM: (e) => ["strong", t.get(O.key)(e)],
|
|
278
|
-
parseMarkdown: {
|
|
279
|
-
match: (e) => e.type === "strong",
|
|
280
|
-
runner: (e, t, n) => {
|
|
281
|
-
e.openMark(n, { marker: t.marker }), e.next(t.children), e.closeMark(n);
|
|
282
|
-
}
|
|
283
|
-
},
|
|
284
|
-
toMarkdown: {
|
|
285
|
-
match: (e) => e.type.name === "strong",
|
|
286
|
-
runner: (e, t) => {
|
|
287
|
-
e.withMark(t, "strong", void 0, { marker: t.attrs.marker });
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}));
|
|
291
|
-
C(k.mark, {
|
|
292
|
-
displayName: "MarkSchema<strong>",
|
|
293
|
-
group: "Strong"
|
|
294
|
-
}), C(k.ctx, {
|
|
295
|
-
displayName: "MarkSchemaCtx<strong>",
|
|
296
|
-
group: "Strong"
|
|
297
|
-
});
|
|
298
|
-
var A = x("ToggleStrong", (e) => () => ue(k.type(e)));
|
|
299
|
-
C(A, {
|
|
300
|
-
displayName: "Command<toggleStrongCommand>",
|
|
301
|
-
group: "Strong"
|
|
302
|
-
});
|
|
303
|
-
var De = y((e) => n(/(?<![\w:/])(?:\*\*|__)([^*_]+?)(?:\*\*|__)(?![\w/])$/, k.type(e), { getAttr: (e) => ({ marker: e[0].startsWith("*") ? "*" : "_" }) }));
|
|
304
|
-
C(De, {
|
|
305
|
-
displayName: "InputRule<strong>",
|
|
306
|
-
group: "Strong"
|
|
307
|
-
});
|
|
308
|
-
var j = v("strongKeymap", { ToggleBold: {
|
|
309
|
-
shortcuts: ["Mod-b"],
|
|
310
|
-
command: (e) => {
|
|
311
|
-
let t = e.get(d);
|
|
312
|
-
return () => t.call(A.key);
|
|
313
|
-
}
|
|
314
|
-
} });
|
|
315
|
-
C(j.ctx, {
|
|
316
|
-
displayName: "KeymapCtx<strong>",
|
|
317
|
-
group: "Strong"
|
|
318
|
-
}), C(j.shortcuts, {
|
|
319
|
-
displayName: "Keymap<strong>",
|
|
320
|
-
group: "Strong"
|
|
321
|
-
});
|
|
322
|
-
var M = me("inlineCode");
|
|
323
|
-
C(M, {
|
|
324
|
-
displayName: "Attr<inlineCode>",
|
|
325
|
-
group: "InlineCode"
|
|
326
|
-
});
|
|
327
|
-
var N = pe("inlineCode", (e) => ({
|
|
328
|
-
priority: 100,
|
|
329
|
-
code: !0,
|
|
330
|
-
parseDOM: [{ tag: "code" }],
|
|
331
|
-
toDOM: (t) => ["code", e.get(M.key)(t)],
|
|
332
|
-
parseMarkdown: {
|
|
333
|
-
match: (e) => e.type === "inlineCode",
|
|
334
|
-
runner: (e, t, n) => {
|
|
335
|
-
e.openMark(n), e.addText(t.value), e.closeMark(n);
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
toMarkdown: {
|
|
339
|
-
match: (e) => e.type.name === "inlineCode",
|
|
340
|
-
runner: (e, t, n) => (e.withMark(t, "inlineCode", n.text || ""), !0)
|
|
341
|
-
}
|
|
342
|
-
}));
|
|
343
|
-
C(N.mark, {
|
|
344
|
-
displayName: "MarkSchema<inlineCode>",
|
|
345
|
-
group: "InlineCode"
|
|
346
|
-
}), C(N.ctx, {
|
|
347
|
-
displayName: "MarkSchemaCtx<inlineCode>",
|
|
348
|
-
group: "InlineCode"
|
|
349
|
-
});
|
|
350
|
-
var P = x("ToggleInlineCode", (e) => () => (t, n) => {
|
|
351
|
-
let { selection: r, tr: i } = t;
|
|
352
|
-
if (r.empty) return !1;
|
|
353
|
-
let { from: a, to: o } = r;
|
|
354
|
-
return t.doc.rangeHasMark(a, o, N.type(e)) ? (n?.(i.removeMark(a, o, N.type(e))), !0) : (Object.keys(t.schema.marks).filter((e) => e !== N.type.name).map((e) => t.schema.marks[e]).forEach((e) => {
|
|
355
|
-
i.removeMark(a, o, e);
|
|
356
|
-
}), n?.(i.addMark(a, o, N.type(e).create())), !0);
|
|
357
|
-
});
|
|
358
|
-
C(P, {
|
|
359
|
-
displayName: "Command<toggleInlineCodeCommand>",
|
|
360
|
-
group: "InlineCode"
|
|
361
|
-
});
|
|
362
|
-
var Oe = y((e) => n(/(?:`)([^`]+)(?:`)$/, N.type(e)));
|
|
363
|
-
C(Oe, {
|
|
364
|
-
displayName: "InputRule<inlineCodeInputRule>",
|
|
365
|
-
group: "InlineCode"
|
|
366
|
-
});
|
|
367
|
-
var F = v("inlineCodeKeymap", { ToggleInlineCode: {
|
|
368
|
-
shortcuts: "Mod-e",
|
|
369
|
-
command: (e) => {
|
|
370
|
-
let t = e.get(d);
|
|
371
|
-
return () => t.call(P.key);
|
|
372
|
-
}
|
|
373
|
-
} });
|
|
374
|
-
C(F.ctx, {
|
|
375
|
-
displayName: "KeymapCtx<inlineCode>",
|
|
376
|
-
group: "InlineCode"
|
|
377
|
-
}), C(F.shortcuts, {
|
|
378
|
-
displayName: "Keymap<inlineCode>",
|
|
379
|
-
group: "InlineCode"
|
|
380
|
-
});
|
|
381
|
-
var I = me("link");
|
|
382
|
-
C(I, {
|
|
383
|
-
displayName: "Attr<link>",
|
|
384
|
-
group: "Link"
|
|
385
|
-
});
|
|
386
|
-
var L = pe("link", (e) => ({
|
|
387
|
-
attrs: {
|
|
388
|
-
href: { validate: "string" },
|
|
389
|
-
title: {
|
|
390
|
-
default: null,
|
|
391
|
-
validate: "string|null"
|
|
392
|
-
}
|
|
393
|
-
},
|
|
394
|
-
parseDOM: [{
|
|
395
|
-
tag: "a[href]",
|
|
396
|
-
getAttrs: (e) => {
|
|
397
|
-
if (!(e instanceof HTMLElement)) throw f(e);
|
|
398
|
-
return {
|
|
399
|
-
href: e.getAttribute("href"),
|
|
400
|
-
title: e.getAttribute("title")
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
}],
|
|
404
|
-
toDOM: (t) => ["a", {
|
|
405
|
-
...e.get(I.key)(t),
|
|
406
|
-
...t.attrs
|
|
407
|
-
}],
|
|
408
|
-
parseMarkdown: {
|
|
409
|
-
match: (e) => e.type === "link",
|
|
410
|
-
runner: (e, t, n) => {
|
|
411
|
-
let r = t.url, i = t.title;
|
|
412
|
-
e.openMark(n, {
|
|
413
|
-
href: r,
|
|
414
|
-
title: i
|
|
415
|
-
}), e.next(t.children), e.closeMark(n);
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
toMarkdown: {
|
|
419
|
-
match: (e) => e.type.name === "link",
|
|
420
|
-
runner: (e, t) => {
|
|
421
|
-
e.withMark(t, "link", void 0, {
|
|
422
|
-
title: t.attrs.title,
|
|
423
|
-
url: t.attrs.href
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}));
|
|
428
|
-
C(L.mark, {
|
|
429
|
-
displayName: "MarkSchema<link>",
|
|
430
|
-
group: "Link"
|
|
431
|
-
});
|
|
432
|
-
var ke = x("ToggleLink", (e) => (t = {}) => ue(L.type(e), t));
|
|
433
|
-
C(ke, {
|
|
434
|
-
displayName: "Command<toggleLinkCommand>",
|
|
435
|
-
group: "Link"
|
|
436
|
-
});
|
|
437
|
-
var Ae = x("UpdateLink", (e) => (t = {}) => (n, r) => {
|
|
438
|
-
if (!r) return !1;
|
|
439
|
-
let i, a = -1, { selection: o } = n, { from: s, to: c } = o;
|
|
440
|
-
if (n.doc.nodesBetween(s, s === c ? c + 1 : c, (t, n) => {
|
|
441
|
-
if (L.type(e).isInSet(t.marks)) return i = t, a = n, !1;
|
|
442
|
-
}), !i) return !1;
|
|
443
|
-
let l = i.marks.find(({ type: t }) => t === L.type(e));
|
|
444
|
-
if (!l) return !1;
|
|
445
|
-
let u = a, ee = a + i.nodeSize, { tr: d } = n, f = L.type(e).create({
|
|
446
|
-
...l.attrs,
|
|
447
|
-
...t
|
|
448
|
-
});
|
|
449
|
-
return f ? (r(d.removeMark(u, ee, l).addMark(u, ee, f).setSelection(new ie(d.selection.$anchor)).scrollIntoView()), !0) : !1;
|
|
450
|
-
});
|
|
451
|
-
C(Ae, {
|
|
452
|
-
displayName: "Command<updateLinkCommand>",
|
|
453
|
-
group: "Link"
|
|
454
|
-
});
|
|
455
|
-
var je = ge("doc", () => ({
|
|
456
|
-
content: "block+",
|
|
457
|
-
parseMarkdown: {
|
|
458
|
-
match: ({ type: e }) => e === "root",
|
|
459
|
-
runner: (e, t, n) => {
|
|
460
|
-
e.injectRoot(t, n);
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
toMarkdown: {
|
|
464
|
-
match: (e) => e.type.name === "doc",
|
|
465
|
-
runner: (e, t) => {
|
|
466
|
-
e.openNode("root"), e.next(t.content);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}));
|
|
470
|
-
C(je, {
|
|
471
|
-
displayName: "NodeSchema<doc>",
|
|
472
|
-
group: "Doc"
|
|
473
|
-
});
|
|
474
|
-
function Me(e) {
|
|
475
|
-
return l(e, (e) => e.type === "html" && [
|
|
476
|
-
"<br />",
|
|
477
|
-
"<br>",
|
|
478
|
-
"<br >",
|
|
479
|
-
"<br/>"
|
|
480
|
-
].includes(e.value?.trim()), (e, t) => {
|
|
481
|
-
if (!t.length) return;
|
|
482
|
-
let n = t[t.length - 1];
|
|
483
|
-
if (!n) return;
|
|
484
|
-
let r = n.children.indexOf(e);
|
|
485
|
-
r !== -1 && n.children.splice(r, 1);
|
|
486
|
-
}, !0);
|
|
487
|
-
}
|
|
488
|
-
var R = _("remark-preserve-empty-line", () => () => Me);
|
|
489
|
-
C(R.plugin, {
|
|
490
|
-
displayName: "Remark<remarkPreserveEmptyLine>",
|
|
491
|
-
group: "Remark"
|
|
492
|
-
}), C(R.options, {
|
|
493
|
-
displayName: "RemarkConfig<remarkPreserveEmptyLine>",
|
|
494
|
-
group: "Remark"
|
|
495
|
-
});
|
|
496
|
-
var z = b("paragraph");
|
|
497
|
-
C(z, {
|
|
498
|
-
displayName: "Attr<paragraph>",
|
|
499
|
-
group: "Paragraph"
|
|
500
|
-
});
|
|
501
|
-
var B = g("paragraph", (e) => ({
|
|
502
|
-
content: "inline*",
|
|
503
|
-
group: "block",
|
|
504
|
-
parseDOM: [{ tag: "p" }],
|
|
505
|
-
toDOM: (t) => [
|
|
506
|
-
"p",
|
|
507
|
-
e.get(z.key)(t),
|
|
508
|
-
0
|
|
509
|
-
],
|
|
510
|
-
parseMarkdown: {
|
|
511
|
-
match: (e) => e.type === "paragraph",
|
|
512
|
-
runner: (e, t, n) => {
|
|
513
|
-
e.openNode(n), t.children ? e.next(t.children) : e.addText(t.value || ""), e.closeNode();
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
toMarkdown: {
|
|
517
|
-
match: (e) => e.type.name === "paragraph",
|
|
518
|
-
runner: (t, n) => {
|
|
519
|
-
let r = e.get(u).state?.doc.lastChild;
|
|
520
|
-
t.openNode("paragraph"), (!n.content || n.content.size === 0) && n !== r && Ne(e) ? t.addNode("html", void 0, "<br />") : we(t, n), t.closeNode();
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}));
|
|
524
|
-
function Ne(e) {
|
|
525
|
-
let t = !1;
|
|
526
|
-
try {
|
|
527
|
-
e.get(R.id), t = !0;
|
|
528
|
-
} catch {
|
|
529
|
-
t = !1;
|
|
530
|
-
}
|
|
531
|
-
return t;
|
|
532
|
-
}
|
|
533
|
-
C(B.node, {
|
|
534
|
-
displayName: "NodeSchema<paragraph>",
|
|
535
|
-
group: "Paragraph"
|
|
536
|
-
}), C(B.ctx, {
|
|
537
|
-
displayName: "NodeSchemaCtx<paragraph>",
|
|
538
|
-
group: "Paragraph"
|
|
539
|
-
});
|
|
540
|
-
var Pe = x("TurnIntoText", (e) => () => h(B.type(e)));
|
|
541
|
-
C(Pe, {
|
|
542
|
-
displayName: "Command<turnIntoTextCommand>",
|
|
543
|
-
group: "Paragraph"
|
|
544
|
-
});
|
|
545
|
-
var Fe = v("paragraphKeymap", { TurnIntoText: {
|
|
546
|
-
shortcuts: "Mod-Alt-0",
|
|
547
|
-
command: (e) => {
|
|
548
|
-
let t = e.get(d);
|
|
549
|
-
return () => t.call(Pe.key);
|
|
550
|
-
}
|
|
551
|
-
} });
|
|
552
|
-
C(Fe.ctx, {
|
|
553
|
-
displayName: "KeymapCtx<paragraph>",
|
|
554
|
-
group: "Paragraph"
|
|
555
|
-
}), C(Fe.shortcuts, {
|
|
556
|
-
displayName: "Keymap<paragraph>",
|
|
557
|
-
group: "Paragraph"
|
|
558
|
-
});
|
|
559
|
-
var Ie = [
|
|
560
|
-
,
|
|
561
|
-
,
|
|
562
|
-
,
|
|
563
|
-
,
|
|
564
|
-
,
|
|
565
|
-
,
|
|
566
|
-
].fill(0).map((e, t) => t + 1);
|
|
567
|
-
function Le(e) {
|
|
568
|
-
return e.textContent.toLowerCase().trim().replace(/\s+/g, "-");
|
|
569
|
-
}
|
|
570
|
-
var V = he(Le, "headingIdGenerator");
|
|
571
|
-
C(V, {
|
|
572
|
-
displayName: "Ctx<HeadingIdGenerator>",
|
|
573
|
-
group: "Heading"
|
|
574
|
-
});
|
|
575
|
-
var H = b("heading");
|
|
576
|
-
C(H, {
|
|
577
|
-
displayName: "Attr<heading>",
|
|
578
|
-
group: "Heading"
|
|
579
|
-
});
|
|
580
|
-
var U = g("heading", (e) => {
|
|
581
|
-
let t = e.get(V.key);
|
|
582
|
-
return {
|
|
583
|
-
content: "inline*",
|
|
584
|
-
group: "block",
|
|
585
|
-
defining: !0,
|
|
586
|
-
attrs: {
|
|
587
|
-
id: {
|
|
588
|
-
default: "",
|
|
589
|
-
validate: "string"
|
|
590
|
-
},
|
|
591
|
-
level: {
|
|
592
|
-
default: 1,
|
|
593
|
-
validate: "number"
|
|
594
|
-
}
|
|
595
|
-
},
|
|
596
|
-
parseDOM: Ie.map((e) => ({
|
|
597
|
-
tag: `h${e}`,
|
|
598
|
-
getAttrs: (t) => {
|
|
599
|
-
if (!(t instanceof HTMLElement)) throw f(t);
|
|
600
|
-
return {
|
|
601
|
-
level: e,
|
|
602
|
-
id: t.id
|
|
603
|
-
};
|
|
604
|
-
}
|
|
605
|
-
})),
|
|
606
|
-
toDOM: (n) => [
|
|
607
|
-
`h${n.attrs.level}`,
|
|
608
|
-
{
|
|
609
|
-
...e.get(H.key)(n),
|
|
610
|
-
id: n.attrs.id || t(n)
|
|
611
|
-
},
|
|
612
|
-
0
|
|
613
|
-
],
|
|
614
|
-
parseMarkdown: {
|
|
615
|
-
match: ({ type: e }) => e === "heading",
|
|
616
|
-
runner: (e, t, n) => {
|
|
617
|
-
let r = t.depth;
|
|
618
|
-
e.openNode(n, { level: r }), e.next(t.children), e.closeNode();
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
toMarkdown: {
|
|
622
|
-
match: (e) => e.type.name === "heading",
|
|
623
|
-
runner: (e, t) => {
|
|
624
|
-
e.openNode("heading", void 0, { depth: t.attrs.level }), we(e, t), e.closeNode();
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
});
|
|
629
|
-
C(U.node, {
|
|
630
|
-
displayName: "NodeSchema<heading>",
|
|
631
|
-
group: "Heading"
|
|
632
|
-
}), C(U.ctx, {
|
|
633
|
-
displayName: "NodeSchemaCtx<heading>",
|
|
634
|
-
group: "Heading"
|
|
635
|
-
});
|
|
636
|
-
var Re = y((e) => t(/^(?<hashes>#+)\s$/, U.type(e), (t) => {
|
|
637
|
-
let n = t.groups?.hashes?.length || 0, { $from: r } = e.get(u).state.selection, i = r.node();
|
|
638
|
-
if (i.type.name === "heading") {
|
|
639
|
-
let e = Number(i.attrs.level) + Number(n);
|
|
640
|
-
return e > 6 && (e = 6), { level: e };
|
|
641
|
-
}
|
|
642
|
-
return { level: n };
|
|
643
|
-
}));
|
|
644
|
-
C(Re, {
|
|
645
|
-
displayName: "InputRule<wrapInHeadingInputRule>",
|
|
646
|
-
group: "Heading"
|
|
647
|
-
});
|
|
648
|
-
var W = x("WrapInHeading", (e) => (t) => (t ??= 1, t < 1 ? h(B.type(e)) : h(U.type(e), { level: t })));
|
|
649
|
-
C(W, {
|
|
650
|
-
displayName: "Command<wrapInHeadingCommand>",
|
|
651
|
-
group: "Heading"
|
|
652
|
-
});
|
|
653
|
-
var ze = x("DowngradeHeading", (e) => () => (t, n, r) => {
|
|
654
|
-
let { $from: i } = t.selection, a = i.node();
|
|
655
|
-
if (a.type !== U.type(e) || !t.selection.empty || i.parentOffset !== 0) return !1;
|
|
656
|
-
let o = a.attrs.level - 1;
|
|
657
|
-
return o ? (n?.(t.tr.setNodeMarkup(t.selection.$from.before(), void 0, {
|
|
658
|
-
...a.attrs,
|
|
659
|
-
level: o
|
|
660
|
-
})), !0) : h(B.type(e))(t, n, r);
|
|
661
|
-
});
|
|
662
|
-
C(ze, {
|
|
663
|
-
displayName: "Command<downgradeHeadingCommand>",
|
|
664
|
-
group: "Heading"
|
|
665
|
-
});
|
|
666
|
-
var Be = v("headingKeymap", {
|
|
667
|
-
TurnIntoH1: {
|
|
668
|
-
shortcuts: "Mod-Alt-1",
|
|
669
|
-
command: (e) => {
|
|
670
|
-
let t = e.get(d);
|
|
671
|
-
return () => t.call(W.key, 1);
|
|
672
|
-
}
|
|
673
|
-
},
|
|
674
|
-
TurnIntoH2: {
|
|
675
|
-
shortcuts: "Mod-Alt-2",
|
|
676
|
-
command: (e) => {
|
|
677
|
-
let t = e.get(d);
|
|
678
|
-
return () => t.call(W.key, 2);
|
|
679
|
-
}
|
|
680
|
-
},
|
|
681
|
-
TurnIntoH3: {
|
|
682
|
-
shortcuts: "Mod-Alt-3",
|
|
683
|
-
command: (e) => {
|
|
684
|
-
let t = e.get(d);
|
|
685
|
-
return () => t.call(W.key, 3);
|
|
686
|
-
}
|
|
687
|
-
},
|
|
688
|
-
TurnIntoH4: {
|
|
689
|
-
shortcuts: "Mod-Alt-4",
|
|
690
|
-
command: (e) => {
|
|
691
|
-
let t = e.get(d);
|
|
692
|
-
return () => t.call(W.key, 4);
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
TurnIntoH5: {
|
|
696
|
-
shortcuts: "Mod-Alt-5",
|
|
697
|
-
command: (e) => {
|
|
698
|
-
let t = e.get(d);
|
|
699
|
-
return () => t.call(W.key, 5);
|
|
700
|
-
}
|
|
701
|
-
},
|
|
702
|
-
TurnIntoH6: {
|
|
703
|
-
shortcuts: "Mod-Alt-6",
|
|
704
|
-
command: (e) => {
|
|
705
|
-
let t = e.get(d);
|
|
706
|
-
return () => t.call(W.key, 6);
|
|
707
|
-
}
|
|
708
|
-
},
|
|
709
|
-
DowngradeHeading: {
|
|
710
|
-
shortcuts: ["Delete", "Backspace"],
|
|
711
|
-
command: (e) => {
|
|
712
|
-
let t = e.get(d);
|
|
713
|
-
return () => t.call(ze.key);
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
|
-
});
|
|
717
|
-
C(Be.ctx, {
|
|
718
|
-
displayName: "KeymapCtx<heading>",
|
|
719
|
-
group: "Heading"
|
|
720
|
-
}), C(Be.shortcuts, {
|
|
721
|
-
displayName: "Keymap<heading>",
|
|
722
|
-
group: "Heading"
|
|
723
|
-
});
|
|
724
|
-
var Ve = b("blockquote");
|
|
725
|
-
C(Ve, {
|
|
726
|
-
displayName: "Attr<blockquote>",
|
|
727
|
-
group: "Blockquote"
|
|
728
|
-
});
|
|
729
|
-
var G = g("blockquote", (e) => ({
|
|
730
|
-
content: "block+",
|
|
731
|
-
group: "block",
|
|
732
|
-
defining: !0,
|
|
733
|
-
parseDOM: [{ tag: "blockquote" }],
|
|
734
|
-
toDOM: (t) => [
|
|
735
|
-
"blockquote",
|
|
736
|
-
e.get(Ve.key)(t),
|
|
737
|
-
0
|
|
738
|
-
],
|
|
739
|
-
parseMarkdown: {
|
|
740
|
-
match: ({ type: e }) => e === "blockquote",
|
|
741
|
-
runner: (e, t, n) => {
|
|
742
|
-
e.openNode(n).next(t.children).closeNode();
|
|
743
|
-
}
|
|
744
|
-
},
|
|
745
|
-
toMarkdown: {
|
|
746
|
-
match: (e) => e.type.name === "blockquote",
|
|
747
|
-
runner: (e, t) => {
|
|
748
|
-
e.openNode("blockquote").next(t.content).closeNode();
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
}));
|
|
752
|
-
C(G.node, {
|
|
753
|
-
displayName: "NodeSchema<blockquote>",
|
|
754
|
-
group: "Blockquote"
|
|
755
|
-
}), C(G.ctx, {
|
|
756
|
-
displayName: "NodeSchemaCtx<blockquote>",
|
|
757
|
-
group: "Blockquote"
|
|
758
|
-
});
|
|
759
|
-
var He = y((e) => i(/^\s*>\s$/, G.type(e)));
|
|
760
|
-
C(He, {
|
|
761
|
-
displayName: "InputRule<wrapInBlockquoteInputRule>",
|
|
762
|
-
group: "Blockquote"
|
|
763
|
-
});
|
|
764
|
-
var Ue = x("WrapInBlockquote", (e) => () => de(G.type(e)));
|
|
765
|
-
C(Ue, {
|
|
766
|
-
displayName: "Command<wrapInBlockquoteCommand>",
|
|
767
|
-
group: "Blockquote"
|
|
768
|
-
});
|
|
769
|
-
var We = v("blockquoteKeymap", { WrapInBlockquote: {
|
|
770
|
-
shortcuts: "Mod-Shift-b",
|
|
771
|
-
command: (e) => {
|
|
772
|
-
let t = e.get(d);
|
|
773
|
-
return () => t.call(Ue.key);
|
|
774
|
-
}
|
|
775
|
-
} });
|
|
776
|
-
C(We.ctx, {
|
|
777
|
-
displayName: "KeymapCtx<blockquote>",
|
|
778
|
-
group: "Blockquote"
|
|
779
|
-
}), C(We.shortcuts, {
|
|
780
|
-
displayName: "Keymap<blockquote>",
|
|
781
|
-
group: "Blockquote"
|
|
782
|
-
});
|
|
783
|
-
var Ge = b("codeBlock", () => ({
|
|
784
|
-
pre: {},
|
|
785
|
-
code: {}
|
|
786
|
-
}));
|
|
787
|
-
C(Ge, {
|
|
788
|
-
displayName: "Attr<codeBlock>",
|
|
789
|
-
group: "CodeBlock"
|
|
790
|
-
});
|
|
791
|
-
var K = g("code_block", (e) => ({
|
|
792
|
-
content: "text*",
|
|
793
|
-
group: "block",
|
|
794
|
-
marks: "",
|
|
795
|
-
defining: !0,
|
|
796
|
-
code: !0,
|
|
797
|
-
attrs: { language: {
|
|
798
|
-
default: "",
|
|
799
|
-
validate: "string"
|
|
800
|
-
} },
|
|
801
|
-
parseDOM: [{
|
|
802
|
-
tag: "pre",
|
|
803
|
-
preserveWhitespace: "full",
|
|
804
|
-
getAttrs: (e) => {
|
|
805
|
-
if (!(e instanceof HTMLElement)) throw f(e);
|
|
806
|
-
return { language: e.dataset.language };
|
|
807
|
-
}
|
|
808
|
-
}],
|
|
809
|
-
toDOM: (t) => {
|
|
810
|
-
let n = e.get(Ge.key)(t), r = t.attrs.language, i = r && r.length > 0 ? { "data-language": r } : void 0;
|
|
811
|
-
return [
|
|
812
|
-
"pre",
|
|
813
|
-
{
|
|
814
|
-
...n.pre,
|
|
815
|
-
...i
|
|
816
|
-
},
|
|
817
|
-
[
|
|
818
|
-
"code",
|
|
819
|
-
n.code,
|
|
820
|
-
0
|
|
821
|
-
]
|
|
822
|
-
];
|
|
823
|
-
},
|
|
824
|
-
parseMarkdown: {
|
|
825
|
-
match: ({ type: e }) => e === "code",
|
|
826
|
-
runner: (e, t, n) => {
|
|
827
|
-
let r = t.lang ?? "", i = t.value;
|
|
828
|
-
e.openNode(n, { language: r }), i && e.addText(i), e.closeNode();
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
toMarkdown: {
|
|
832
|
-
match: (e) => e.type.name === "code_block",
|
|
833
|
-
runner: (e, t) => {
|
|
834
|
-
e.addNode("code", void 0, t.content.firstChild?.text || "", { lang: t.attrs.language });
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
}));
|
|
838
|
-
C(K.node, {
|
|
839
|
-
displayName: "NodeSchema<codeBlock>",
|
|
840
|
-
group: "CodeBlock"
|
|
841
|
-
}), C(K.ctx, {
|
|
842
|
-
displayName: "NodeSchemaCtx<codeBlock>",
|
|
843
|
-
group: "CodeBlock"
|
|
844
|
-
});
|
|
845
|
-
var Ke = y((e) => t(/^```(?<language>[a-z]*)?[\s\n]$/, K.type(e), (e) => ({ language: e.groups?.language ?? "" })));
|
|
846
|
-
C(Ke, {
|
|
847
|
-
displayName: "InputRule<createCodeBlockInputRule>",
|
|
848
|
-
group: "CodeBlock"
|
|
849
|
-
});
|
|
850
|
-
var qe = x("CreateCodeBlock", (e) => (t = "") => h(K.type(e), { language: t }));
|
|
851
|
-
C(qe, {
|
|
852
|
-
displayName: "Command<createCodeBlockCommand>",
|
|
853
|
-
group: "CodeBlock"
|
|
854
|
-
});
|
|
855
|
-
var Je = x("UpdateCodeBlockLanguage", () => ({ pos: e, language: t } = {
|
|
856
|
-
pos: -1,
|
|
857
|
-
language: ""
|
|
858
|
-
}) => (n, r) => e >= 0 ? (r?.(n.tr.setNodeAttribute(e, "language", t)), !0) : !1);
|
|
859
|
-
C(Je, {
|
|
860
|
-
displayName: "Command<updateCodeBlockLanguageCommand>",
|
|
861
|
-
group: "CodeBlock"
|
|
862
|
-
});
|
|
863
|
-
var Ye = v("codeBlockKeymap", { CreateCodeBlock: {
|
|
864
|
-
shortcuts: "Mod-Alt-c",
|
|
865
|
-
command: (e) => {
|
|
866
|
-
let t = e.get(d);
|
|
867
|
-
return () => t.call(qe.key);
|
|
868
|
-
}
|
|
869
|
-
} });
|
|
870
|
-
C(Ye.ctx, {
|
|
871
|
-
displayName: "KeymapCtx<codeBlock>",
|
|
872
|
-
group: "CodeBlock"
|
|
873
|
-
}), C(Ye.shortcuts, {
|
|
874
|
-
displayName: "Keymap<codeBlock>",
|
|
875
|
-
group: "CodeBlock"
|
|
876
|
-
});
|
|
877
|
-
var Xe = b("image");
|
|
878
|
-
C(Xe, {
|
|
879
|
-
displayName: "Attr<image>",
|
|
880
|
-
group: "Image"
|
|
881
|
-
});
|
|
882
|
-
var q = g("image", (e) => ({
|
|
883
|
-
inline: !0,
|
|
884
|
-
group: "inline",
|
|
885
|
-
selectable: !0,
|
|
886
|
-
draggable: !0,
|
|
887
|
-
marks: "",
|
|
888
|
-
atom: !0,
|
|
889
|
-
defining: !0,
|
|
890
|
-
isolating: !0,
|
|
891
|
-
attrs: {
|
|
892
|
-
src: {
|
|
893
|
-
default: "",
|
|
894
|
-
validate: "string"
|
|
895
|
-
},
|
|
896
|
-
alt: {
|
|
897
|
-
default: "",
|
|
898
|
-
validate: "string"
|
|
899
|
-
},
|
|
900
|
-
title: {
|
|
901
|
-
default: "",
|
|
902
|
-
validate: "string"
|
|
903
|
-
}
|
|
904
|
-
},
|
|
905
|
-
parseDOM: [{
|
|
906
|
-
tag: "img[src]",
|
|
907
|
-
getAttrs: (e) => {
|
|
908
|
-
if (!(e instanceof HTMLElement)) throw f(e);
|
|
909
|
-
return {
|
|
910
|
-
src: e.getAttribute("src") || "",
|
|
911
|
-
alt: e.getAttribute("alt") || "",
|
|
912
|
-
title: e.getAttribute("title") || e.getAttribute("alt") || ""
|
|
913
|
-
};
|
|
914
|
-
}
|
|
915
|
-
}],
|
|
916
|
-
toDOM: (t) => ["img", {
|
|
917
|
-
...e.get(Xe.key)(t),
|
|
918
|
-
...t.attrs
|
|
919
|
-
}],
|
|
920
|
-
parseMarkdown: {
|
|
921
|
-
match: ({ type: e }) => e === "image",
|
|
922
|
-
runner: (e, t, n) => {
|
|
923
|
-
let r = t.url, i = t.alt, a = t.title;
|
|
924
|
-
e.addNode(n, {
|
|
925
|
-
src: r,
|
|
926
|
-
alt: i,
|
|
927
|
-
title: a
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
},
|
|
931
|
-
toMarkdown: {
|
|
932
|
-
match: (e) => e.type.name === "image",
|
|
933
|
-
runner: (e, t) => {
|
|
934
|
-
e.addNode("image", void 0, void 0, {
|
|
935
|
-
title: t.attrs.title,
|
|
936
|
-
url: t.attrs.src,
|
|
937
|
-
alt: t.attrs.alt
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
}));
|
|
942
|
-
C(q.node, {
|
|
943
|
-
displayName: "NodeSchema<image>",
|
|
944
|
-
group: "Image"
|
|
945
|
-
}), C(q.ctx, {
|
|
946
|
-
displayName: "NodeSchemaCtx<image>",
|
|
947
|
-
group: "Image"
|
|
948
|
-
});
|
|
949
|
-
var Ze = x("InsertImage", (e) => (t = {}) => (n, r) => {
|
|
950
|
-
if (!r) return !0;
|
|
951
|
-
let { src: i = "", alt: a = "", title: o = "" } = t, s = q.type(e).create({
|
|
952
|
-
src: i,
|
|
953
|
-
alt: a,
|
|
954
|
-
title: o
|
|
955
|
-
});
|
|
956
|
-
return s && r(n.tr.replaceSelectionWith(s).scrollIntoView()), !0;
|
|
957
|
-
});
|
|
958
|
-
C(Ze, {
|
|
959
|
-
displayName: "Command<insertImageCommand>",
|
|
960
|
-
group: "Image"
|
|
961
|
-
});
|
|
962
|
-
var Qe = x("UpdateImage", (e) => (t = {}) => (n, r) => {
|
|
963
|
-
let i = ne(n.selection, q.type(e));
|
|
964
|
-
if (!i) return !1;
|
|
965
|
-
let { node: a, pos: o } = i, s = { ...a.attrs }, { src: c, alt: l, title: u } = t;
|
|
966
|
-
return c !== void 0 && (s.src = c), l !== void 0 && (s.alt = l), u !== void 0 && (s.title = u), r?.(n.tr.setNodeMarkup(o, void 0, s).scrollIntoView()), !0;
|
|
967
|
-
});
|
|
968
|
-
C(Qe, {
|
|
969
|
-
displayName: "Command<updateImageCommand>",
|
|
970
|
-
group: "Image"
|
|
971
|
-
});
|
|
972
|
-
var $e = y((e) => new o(/!\[(?<alt>.*?)]\((?<filename>.*?)\s*(?="|\))"?(?<title>[^"]+)?"?\)/, (t, n, r, i) => {
|
|
973
|
-
let [a, o, s = "", c] = n;
|
|
974
|
-
return a ? t.tr.replaceWith(r, i, q.type(e).create({
|
|
975
|
-
src: s,
|
|
976
|
-
alt: o,
|
|
977
|
-
title: c
|
|
978
|
-
})) : null;
|
|
979
|
-
}));
|
|
980
|
-
C($e, {
|
|
981
|
-
displayName: "InputRule<insertImageInputRule>",
|
|
982
|
-
group: "Image"
|
|
983
|
-
});
|
|
984
|
-
var J = b("hardbreak", (e) => ({
|
|
985
|
-
"data-type": "hardbreak",
|
|
986
|
-
"data-is-inline": e.attrs.isInline
|
|
987
|
-
}));
|
|
988
|
-
C(J, {
|
|
989
|
-
displayName: "Attr<hardbreak>",
|
|
990
|
-
group: "Hardbreak"
|
|
991
|
-
});
|
|
992
|
-
var Y = g("hardbreak", (e) => ({
|
|
993
|
-
inline: !0,
|
|
994
|
-
group: "inline",
|
|
995
|
-
attrs: { isInline: {
|
|
996
|
-
default: !1,
|
|
997
|
-
validate: "boolean"
|
|
998
|
-
} },
|
|
999
|
-
selectable: !1,
|
|
1000
|
-
parseDOM: [{ tag: "br" }, {
|
|
1001
|
-
tag: "span[data-type=\"hardbreak\"]",
|
|
1002
|
-
getAttrs: () => ({ isInline: !0 })
|
|
1003
|
-
}],
|
|
1004
|
-
toDOM: (t) => t.attrs.isInline ? [
|
|
1005
|
-
"span",
|
|
1006
|
-
e.get(J.key)(t),
|
|
1007
|
-
" "
|
|
1008
|
-
] : ["br", e.get(J.key)(t)],
|
|
1009
|
-
parseMarkdown: {
|
|
1010
|
-
match: ({ type: e }) => e === "break",
|
|
1011
|
-
runner: (e, t, n) => {
|
|
1012
|
-
e.addNode(n, { isInline: !!t.data?.isInline });
|
|
1013
|
-
}
|
|
1014
|
-
},
|
|
1015
|
-
leafText: () => "\n",
|
|
1016
|
-
toMarkdown: {
|
|
1017
|
-
match: (e) => e.type.name === "hardbreak",
|
|
1018
|
-
runner: (e, t) => {
|
|
1019
|
-
t.attrs.isInline ? e.addNode("text", void 0, "\n") : e.addNode("break");
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
}));
|
|
1023
|
-
C(Y.node, {
|
|
1024
|
-
displayName: "NodeSchema<hardbreak>",
|
|
1025
|
-
group: "Hardbreak"
|
|
1026
|
-
}), C(Y.ctx, {
|
|
1027
|
-
displayName: "NodeSchemaCtx<hardbreak>",
|
|
1028
|
-
group: "Hardbreak"
|
|
1029
|
-
});
|
|
1030
|
-
var et = x("InsertHardbreak", (e) => () => (t, n) => {
|
|
1031
|
-
let { selection: r, tr: i } = t;
|
|
1032
|
-
if (!(r instanceof ie)) return !1;
|
|
1033
|
-
if (r.empty) {
|
|
1034
|
-
let e = r.$from.node();
|
|
1035
|
-
if (e.childCount > 0 && e.lastChild?.type.name === "hardbreak") return n?.(i.replaceRangeWith(r.to - 1, r.to, t.schema.node("paragraph")).setSelection(ae.near(i.doc.resolve(r.to))).scrollIntoView()), !0;
|
|
1036
|
-
}
|
|
1037
|
-
return n?.(i.setMeta("hardbreak", !0).replaceSelectionWith(Y.type(e).create()).scrollIntoView()), !0;
|
|
1038
|
-
});
|
|
1039
|
-
C(et, {
|
|
1040
|
-
displayName: "Command<insertHardbreakCommand>",
|
|
1041
|
-
group: "Hardbreak"
|
|
1042
|
-
});
|
|
1043
|
-
var tt = v("hardbreakKeymap", { InsertHardbreak: {
|
|
1044
|
-
shortcuts: "Shift-Enter",
|
|
1045
|
-
command: (e) => {
|
|
1046
|
-
let t = e.get(d);
|
|
1047
|
-
return () => t.call(et.key);
|
|
1048
|
-
}
|
|
1049
|
-
} });
|
|
1050
|
-
C(tt.ctx, {
|
|
1051
|
-
displayName: "KeymapCtx<hardbreak>",
|
|
1052
|
-
group: "Hardbreak"
|
|
1053
|
-
}), C(tt.shortcuts, {
|
|
1054
|
-
displayName: "Keymap<hardbreak>",
|
|
1055
|
-
group: "Hardbreak"
|
|
1056
|
-
});
|
|
1057
|
-
var nt = b("hr");
|
|
1058
|
-
C(nt, {
|
|
1059
|
-
displayName: "Attr<hr>",
|
|
1060
|
-
group: "Hr"
|
|
1061
|
-
});
|
|
1062
|
-
var X = g("hr", (e) => ({
|
|
1063
|
-
group: "block",
|
|
1064
|
-
parseDOM: [{ tag: "hr" }],
|
|
1065
|
-
toDOM: (t) => ["hr", e.get(nt.key)(t)],
|
|
1066
|
-
parseMarkdown: {
|
|
1067
|
-
match: ({ type: e }) => e === "thematicBreak",
|
|
1068
|
-
runner: (e, t, n) => {
|
|
1069
|
-
e.addNode(n);
|
|
1070
|
-
}
|
|
1071
|
-
},
|
|
1072
|
-
toMarkdown: {
|
|
1073
|
-
match: (e) => e.type.name === "hr",
|
|
1074
|
-
runner: (e) => {
|
|
1075
|
-
e.addNode("thematicBreak");
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
}));
|
|
1079
|
-
C(X.node, {
|
|
1080
|
-
displayName: "NodeSchema<hr>",
|
|
1081
|
-
group: "Hr"
|
|
1082
|
-
}), C(X.ctx, {
|
|
1083
|
-
displayName: "NodeSchemaCtx<hr>",
|
|
1084
|
-
group: "Hr"
|
|
1085
|
-
});
|
|
1086
|
-
var rt = y((e) => new o(/^(?:---|___\s|\*\*\*\s)$/, (t, n, r, i) => {
|
|
1087
|
-
let { tr: a } = t;
|
|
1088
|
-
return n[0] && a.replaceWith(r - 1, i, X.type(e).create()), a;
|
|
1089
|
-
}));
|
|
1090
|
-
C(rt, {
|
|
1091
|
-
displayName: "InputRule<insertHrInputRule>",
|
|
1092
|
-
group: "Hr"
|
|
1093
|
-
});
|
|
1094
|
-
var it = x("InsertHr", (e) => () => (t, n) => {
|
|
1095
|
-
if (!n) return !0;
|
|
1096
|
-
let r = B.node.type(e).create(), { tr: i, selection: a } = t, { from: o } = a, s = X.type(e).create();
|
|
1097
|
-
if (!s) return !0;
|
|
1098
|
-
let c = i.replaceSelectionWith(s).insert(o, r), l = ae.findFrom(c.doc.resolve(o), 1, !0);
|
|
1099
|
-
return l && n(c.setSelection(l).scrollIntoView()), !0;
|
|
1100
|
-
});
|
|
1101
|
-
C(it, {
|
|
1102
|
-
displayName: "Command<insertHrCommand>",
|
|
1103
|
-
group: "Hr"
|
|
1104
|
-
});
|
|
1105
|
-
var at = b("bulletList");
|
|
1106
|
-
C(at, {
|
|
1107
|
-
displayName: "Attr<bulletList>",
|
|
1108
|
-
group: "BulletList"
|
|
1109
|
-
});
|
|
1110
|
-
var Z = g("bullet_list", (e) => ({
|
|
1111
|
-
content: "listItem+",
|
|
1112
|
-
group: "block",
|
|
1113
|
-
attrs: { spread: {
|
|
1114
|
-
default: !1,
|
|
1115
|
-
validate: "boolean"
|
|
1116
|
-
} },
|
|
1117
|
-
parseDOM: [{
|
|
1118
|
-
tag: "ul",
|
|
1119
|
-
getAttrs: (e) => {
|
|
1120
|
-
if (!(e instanceof HTMLElement)) throw f(e);
|
|
1121
|
-
return { spread: e.dataset.spread === "true" };
|
|
1122
|
-
}
|
|
1123
|
-
}],
|
|
1124
|
-
toDOM: (t) => [
|
|
1125
|
-
"ul",
|
|
1126
|
-
{
|
|
1127
|
-
...e.get(at.key)(t),
|
|
1128
|
-
"data-spread": t.attrs.spread
|
|
1129
|
-
},
|
|
1130
|
-
0
|
|
1131
|
-
],
|
|
1132
|
-
parseMarkdown: {
|
|
1133
|
-
match: ({ type: e, ordered: t }) => e === "list" && !t,
|
|
1134
|
-
runner: (e, t, n) => {
|
|
1135
|
-
let r = t.spread == null ? "false" : `${t.spread}`;
|
|
1136
|
-
e.openNode(n, { spread: r }).next(t.children).closeNode();
|
|
1137
|
-
}
|
|
1138
|
-
},
|
|
1139
|
-
toMarkdown: {
|
|
1140
|
-
match: (e) => e.type.name === "bullet_list",
|
|
1141
|
-
runner: (e, t) => {
|
|
1142
|
-
e.openNode("list", void 0, {
|
|
1143
|
-
ordered: !1,
|
|
1144
|
-
spread: t.attrs.spread
|
|
1145
|
-
}).next(t.content).closeNode();
|
|
1146
|
-
}
|
|
1147
|
-
}
|
|
1148
|
-
}));
|
|
1149
|
-
C(Z.node, {
|
|
1150
|
-
displayName: "NodeSchema<bulletList>",
|
|
1151
|
-
group: "BulletList"
|
|
1152
|
-
}), C(Z.ctx, {
|
|
1153
|
-
displayName: "NodeSchemaCtx<bulletList>",
|
|
1154
|
-
group: "BulletList"
|
|
1155
|
-
});
|
|
1156
|
-
var ot = y((e) => i(/^\s*([-+*])\s$/, Z.type(e)));
|
|
1157
|
-
C(ot, {
|
|
1158
|
-
displayName: "InputRule<wrapInBulletListInputRule>",
|
|
1159
|
-
group: "BulletList"
|
|
1160
|
-
});
|
|
1161
|
-
var st = x("WrapInBulletList", (e) => () => de(Z.type(e)));
|
|
1162
|
-
C(st, {
|
|
1163
|
-
displayName: "Command<wrapInBulletListCommand>",
|
|
1164
|
-
group: "BulletList"
|
|
1165
|
-
});
|
|
1166
|
-
var ct = v("bulletListKeymap", { WrapInBulletList: {
|
|
1167
|
-
shortcuts: "Mod-Alt-8",
|
|
1168
|
-
command: (e) => {
|
|
1169
|
-
let t = e.get(d);
|
|
1170
|
-
return () => t.call(st.key);
|
|
1171
|
-
}
|
|
1172
|
-
} });
|
|
1173
|
-
C(ct.ctx, {
|
|
1174
|
-
displayName: "KeymapCtx<bulletListKeymap>",
|
|
1175
|
-
group: "BulletList"
|
|
1176
|
-
}), C(ct.shortcuts, {
|
|
1177
|
-
displayName: "Keymap<bulletListKeymap>",
|
|
1178
|
-
group: "BulletList"
|
|
1179
|
-
});
|
|
1180
|
-
var lt = b("orderedList");
|
|
1181
|
-
C(lt, {
|
|
1182
|
-
displayName: "Attr<orderedList>",
|
|
1183
|
-
group: "OrderedList"
|
|
1184
|
-
});
|
|
1185
|
-
var Q = g("ordered_list", (e) => ({
|
|
1186
|
-
content: "listItem+",
|
|
1187
|
-
group: "block",
|
|
1188
|
-
attrs: {
|
|
1189
|
-
order: {
|
|
1190
|
-
default: 1,
|
|
1191
|
-
validate: "number"
|
|
1192
|
-
},
|
|
1193
|
-
spread: {
|
|
1194
|
-
default: !1,
|
|
1195
|
-
validate: "boolean"
|
|
1196
|
-
}
|
|
1197
|
-
},
|
|
1198
|
-
parseDOM: [{
|
|
1199
|
-
tag: "ol",
|
|
1200
|
-
getAttrs: (e) => {
|
|
1201
|
-
if (!(e instanceof HTMLElement)) throw f(e);
|
|
1202
|
-
return {
|
|
1203
|
-
spread: e.dataset.spread,
|
|
1204
|
-
order: e.hasAttribute("start") ? Number(e.getAttribute("start")) : 1
|
|
1205
|
-
};
|
|
1206
|
-
}
|
|
1207
|
-
}],
|
|
1208
|
-
toDOM: (t) => [
|
|
1209
|
-
"ol",
|
|
1210
|
-
{
|
|
1211
|
-
...e.get(lt.key)(t),
|
|
1212
|
-
...t.attrs.order === 1 ? {} : { start: t.attrs.order },
|
|
1213
|
-
"data-spread": t.attrs.spread
|
|
1214
|
-
},
|
|
1215
|
-
0
|
|
1216
|
-
],
|
|
1217
|
-
parseMarkdown: {
|
|
1218
|
-
match: ({ type: e, ordered: t }) => e === "list" && !!t,
|
|
1219
|
-
runner: (e, t, n) => {
|
|
1220
|
-
let r = t.spread == null ? "true" : `${t.spread}`;
|
|
1221
|
-
e.openNode(n, {
|
|
1222
|
-
spread: r,
|
|
1223
|
-
order: t.start ?? 1
|
|
1224
|
-
}).next(t.children).closeNode();
|
|
1225
|
-
}
|
|
1226
|
-
},
|
|
1227
|
-
toMarkdown: {
|
|
1228
|
-
match: (e) => e.type.name === "ordered_list",
|
|
1229
|
-
runner: (e, t) => {
|
|
1230
|
-
e.openNode("list", void 0, {
|
|
1231
|
-
ordered: !0,
|
|
1232
|
-
start: t.attrs.order ?? 1,
|
|
1233
|
-
spread: t.attrs.spread === "true"
|
|
1234
|
-
}), e.next(t.content), e.closeNode();
|
|
1235
|
-
}
|
|
1236
|
-
}
|
|
1237
|
-
}));
|
|
1238
|
-
C(Q.node, {
|
|
1239
|
-
displayName: "NodeSchema<orderedList>",
|
|
1240
|
-
group: "OrderedList"
|
|
1241
|
-
}), C(Q.ctx, {
|
|
1242
|
-
displayName: "NodeSchemaCtx<orderedList>",
|
|
1243
|
-
group: "OrderedList"
|
|
1244
|
-
});
|
|
1245
|
-
var ut = y((e) => i(/^\s*(\d+)\.\s$/, Q.type(e), (e) => ({ order: Number(e[1]) }), (e, t) => t.childCount + t.attrs.order === Number(e[1])));
|
|
1246
|
-
C(ut, {
|
|
1247
|
-
displayName: "InputRule<wrapInOrderedListInputRule>",
|
|
1248
|
-
group: "OrderedList"
|
|
1249
|
-
});
|
|
1250
|
-
var dt = x("WrapInOrderedList", (e) => () => de(Q.type(e)));
|
|
1251
|
-
C(dt, {
|
|
1252
|
-
displayName: "Command<wrapInOrderedListCommand>",
|
|
1253
|
-
group: "OrderedList"
|
|
1254
|
-
});
|
|
1255
|
-
var ft = v("orderedListKeymap", { WrapInOrderedList: {
|
|
1256
|
-
shortcuts: "Mod-Alt-7",
|
|
1257
|
-
command: (e) => {
|
|
1258
|
-
let t = e.get(d);
|
|
1259
|
-
return () => t.call(dt.key);
|
|
1260
|
-
}
|
|
1261
|
-
} });
|
|
1262
|
-
C(ft.ctx, {
|
|
1263
|
-
displayName: "KeymapCtx<orderedList>",
|
|
1264
|
-
group: "OrderedList"
|
|
1265
|
-
}), C(ft.shortcuts, {
|
|
1266
|
-
displayName: "Keymap<orderedList>",
|
|
1267
|
-
group: "OrderedList"
|
|
1268
|
-
});
|
|
1269
|
-
var pt = b("listItem");
|
|
1270
|
-
C(pt, {
|
|
1271
|
-
displayName: "Attr<listItem>",
|
|
1272
|
-
group: "ListItem"
|
|
1273
|
-
});
|
|
1274
|
-
var $ = g("list_item", (e) => ({
|
|
1275
|
-
group: "listItem",
|
|
1276
|
-
content: "paragraph block*",
|
|
1277
|
-
attrs: {
|
|
1278
|
-
label: {
|
|
1279
|
-
default: "•",
|
|
1280
|
-
validate: "string"
|
|
1281
|
-
},
|
|
1282
|
-
listType: {
|
|
1283
|
-
default: "bullet",
|
|
1284
|
-
validate: "string"
|
|
1285
|
-
},
|
|
1286
|
-
spread: {
|
|
1287
|
-
default: !0,
|
|
1288
|
-
validate: "boolean"
|
|
1289
|
-
}
|
|
1290
|
-
},
|
|
1291
|
-
defining: !0,
|
|
1292
|
-
parseDOM: [{
|
|
1293
|
-
tag: "li",
|
|
1294
|
-
getAttrs: (e) => {
|
|
1295
|
-
if (!(e instanceof HTMLElement)) throw f(e);
|
|
1296
|
-
return {
|
|
1297
|
-
label: e.dataset.label,
|
|
1298
|
-
listType: e.dataset.listType,
|
|
1299
|
-
spread: e.dataset.spread === "true"
|
|
1300
|
-
};
|
|
1301
|
-
}
|
|
1302
|
-
}],
|
|
1303
|
-
toDOM: (t) => [
|
|
1304
|
-
"li",
|
|
1305
|
-
{
|
|
1306
|
-
...e.get(pt.key)(t),
|
|
1307
|
-
"data-label": t.attrs.label,
|
|
1308
|
-
"data-list-type": t.attrs.listType,
|
|
1309
|
-
"data-spread": t.attrs.spread
|
|
1310
|
-
},
|
|
1311
|
-
0
|
|
1312
|
-
],
|
|
1313
|
-
parseMarkdown: {
|
|
1314
|
-
match: ({ type: e }) => e === "listItem",
|
|
1315
|
-
runner: (e, t, n) => {
|
|
1316
|
-
let r = t.label == null ? "•" : `${t.label}.`, i = t.label == null ? "bullet" : "ordered", a = t.spread == null ? "true" : `${t.spread}`;
|
|
1317
|
-
e.openNode(n, {
|
|
1318
|
-
label: r,
|
|
1319
|
-
listType: i,
|
|
1320
|
-
spread: a
|
|
1321
|
-
}), e.next(t.children), e.closeNode();
|
|
1322
|
-
}
|
|
1323
|
-
},
|
|
1324
|
-
toMarkdown: {
|
|
1325
|
-
match: (e) => e.type.name === "list_item",
|
|
1326
|
-
runner: (e, t) => {
|
|
1327
|
-
e.openNode("listItem", void 0, { spread: t.attrs.spread }), e.next(t.content), e.closeNode();
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
}));
|
|
1331
|
-
C($.node, {
|
|
1332
|
-
displayName: "NodeSchema<listItem>",
|
|
1333
|
-
group: "ListItem"
|
|
1334
|
-
}), C($.ctx, {
|
|
1335
|
-
displayName: "NodeSchemaCtx<listItem>",
|
|
1336
|
-
group: "ListItem"
|
|
1337
|
-
});
|
|
1338
|
-
var mt = x("SinkListItem", (e) => () => ye($.type(e)));
|
|
1339
|
-
C(mt, {
|
|
1340
|
-
displayName: "Command<sinkListItemCommand>",
|
|
1341
|
-
group: "ListItem"
|
|
1342
|
-
});
|
|
1343
|
-
var ht = x("LiftListItem", (e) => () => ve($.type(e)));
|
|
1344
|
-
C(ht, {
|
|
1345
|
-
displayName: "Command<liftListItemCommand>",
|
|
1346
|
-
group: "ListItem"
|
|
1347
|
-
});
|
|
1348
|
-
var gt = x("SplitListItem", (e) => () => _e($.type(e)));
|
|
1349
|
-
C(gt, {
|
|
1350
|
-
displayName: "Command<splitListItemCommand>",
|
|
1351
|
-
group: "ListItem"
|
|
1352
|
-
});
|
|
1353
|
-
function _t(e) {
|
|
1354
|
-
return (t, n, r) => {
|
|
1355
|
-
let { selection: i } = t;
|
|
1356
|
-
if (!(i instanceof ie)) return !1;
|
|
1357
|
-
let { empty: a, $from: o } = i;
|
|
1358
|
-
return !a || o.parentOffset !== 0 || o.node(-1).type !== $.type(e) ? !1 : fe(t, n, r);
|
|
1359
|
-
};
|
|
1360
|
-
}
|
|
1361
|
-
var vt = x("LiftFirstListItem", (e) => () => _t(e));
|
|
1362
|
-
C(vt, {
|
|
1363
|
-
displayName: "Command<liftFirstListItemCommand>",
|
|
1364
|
-
group: "ListItem"
|
|
1365
|
-
});
|
|
1366
|
-
var yt = v("listItemKeymap", {
|
|
1367
|
-
NextListItem: {
|
|
1368
|
-
shortcuts: "Enter",
|
|
1369
|
-
command: (e) => {
|
|
1370
|
-
let t = e.get(d);
|
|
1371
|
-
return () => t.call(gt.key);
|
|
1372
|
-
}
|
|
1373
|
-
},
|
|
1374
|
-
SinkListItem: {
|
|
1375
|
-
shortcuts: ["Tab", "Mod-]"],
|
|
1376
|
-
command: (e) => {
|
|
1377
|
-
let t = e.get(d);
|
|
1378
|
-
return () => t.call(mt.key);
|
|
1379
|
-
}
|
|
1380
|
-
},
|
|
1381
|
-
LiftListItem: {
|
|
1382
|
-
shortcuts: ["Shift-Tab", "Mod-["],
|
|
1383
|
-
command: (e) => {
|
|
1384
|
-
let t = e.get(d);
|
|
1385
|
-
return () => t.call(ht.key);
|
|
1386
|
-
}
|
|
1387
|
-
},
|
|
1388
|
-
LiftFirstListItem: {
|
|
1389
|
-
shortcuts: ["Backspace", "Delete"],
|
|
1390
|
-
command: (e) => {
|
|
1391
|
-
let t = e.get(d);
|
|
1392
|
-
return () => t.call(vt.key);
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
});
|
|
1396
|
-
C(yt.ctx, {
|
|
1397
|
-
displayName: "KeymapCtx<listItem>",
|
|
1398
|
-
group: "ListItem"
|
|
1399
|
-
}), C(yt.shortcuts, {
|
|
1400
|
-
displayName: "Keymap<listItem>",
|
|
1401
|
-
group: "ListItem"
|
|
1402
|
-
});
|
|
1403
|
-
var bt = ge("text", () => ({
|
|
1404
|
-
group: "inline",
|
|
1405
|
-
parseMarkdown: {
|
|
1406
|
-
match: ({ type: e }) => e === "text",
|
|
1407
|
-
runner: (e, t) => {
|
|
1408
|
-
e.addText(t.value);
|
|
1409
|
-
}
|
|
1410
|
-
},
|
|
1411
|
-
toMarkdown: {
|
|
1412
|
-
match: (e) => e.type.name === "text",
|
|
1413
|
-
runner: (e, t) => {
|
|
1414
|
-
e.addNode("text", void 0, t.text);
|
|
1415
|
-
}
|
|
1416
|
-
}
|
|
1417
|
-
}));
|
|
1418
|
-
C(bt, {
|
|
1419
|
-
displayName: "NodeSchema<text>",
|
|
1420
|
-
group: "Text"
|
|
1421
|
-
});
|
|
1422
|
-
var xt = b("html");
|
|
1423
|
-
C(xt, {
|
|
1424
|
-
displayName: "Attr<html>",
|
|
1425
|
-
group: "Html"
|
|
1426
|
-
});
|
|
1427
|
-
var St = g("html", (e) => ({
|
|
1428
|
-
atom: !0,
|
|
1429
|
-
group: "inline",
|
|
1430
|
-
inline: !0,
|
|
1431
|
-
attrs: { value: {
|
|
1432
|
-
default: "",
|
|
1433
|
-
validate: "string"
|
|
1434
|
-
} },
|
|
1435
|
-
toDOM: (t) => {
|
|
1436
|
-
let n = document.createElement("span"), r = {
|
|
1437
|
-
...e.get(xt.key)(t),
|
|
1438
|
-
"data-value": t.attrs.value,
|
|
1439
|
-
"data-type": "html"
|
|
1440
|
-
};
|
|
1441
|
-
return n.textContent = t.attrs.value, [
|
|
1442
|
-
"span",
|
|
1443
|
-
r,
|
|
1444
|
-
t.attrs.value
|
|
1445
|
-
];
|
|
1446
|
-
},
|
|
1447
|
-
parseDOM: [{
|
|
1448
|
-
tag: "span[data-type=\"html\"]",
|
|
1449
|
-
getAttrs: (e) => ({ value: e.dataset.value ?? "" })
|
|
1450
|
-
}],
|
|
1451
|
-
parseMarkdown: {
|
|
1452
|
-
match: ({ type: e }) => e === "html",
|
|
1453
|
-
runner: (e, t, n) => {
|
|
1454
|
-
e.addNode(n, { value: t.value });
|
|
1455
|
-
}
|
|
1456
|
-
},
|
|
1457
|
-
toMarkdown: {
|
|
1458
|
-
match: (e) => e.type.name === "html",
|
|
1459
|
-
runner: (e, t) => {
|
|
1460
|
-
e.addNode("html", void 0, t.attrs.value);
|
|
1461
|
-
}
|
|
1462
|
-
}
|
|
1463
|
-
}));
|
|
1464
|
-
C(St.node, {
|
|
1465
|
-
displayName: "NodeSchema<html>",
|
|
1466
|
-
group: "Html"
|
|
1467
|
-
}), C(St.ctx, {
|
|
1468
|
-
displayName: "NodeSchemaCtx<html>",
|
|
1469
|
-
group: "Html"
|
|
1470
|
-
});
|
|
1471
|
-
var Ct = [
|
|
1472
|
-
je,
|
|
1473
|
-
z,
|
|
1474
|
-
B,
|
|
1475
|
-
V,
|
|
1476
|
-
H,
|
|
1477
|
-
U,
|
|
1478
|
-
J,
|
|
1479
|
-
Y,
|
|
1480
|
-
Ve,
|
|
1481
|
-
G,
|
|
1482
|
-
Ge,
|
|
1483
|
-
K,
|
|
1484
|
-
nt,
|
|
1485
|
-
X,
|
|
1486
|
-
Xe,
|
|
1487
|
-
q,
|
|
1488
|
-
at,
|
|
1489
|
-
Z,
|
|
1490
|
-
lt,
|
|
1491
|
-
Q,
|
|
1492
|
-
pt,
|
|
1493
|
-
$,
|
|
1494
|
-
w,
|
|
1495
|
-
T,
|
|
1496
|
-
O,
|
|
1497
|
-
k,
|
|
1498
|
-
M,
|
|
1499
|
-
N,
|
|
1500
|
-
I,
|
|
1501
|
-
L,
|
|
1502
|
-
xt,
|
|
1503
|
-
St,
|
|
1504
|
-
bt
|
|
1505
|
-
].flat(), wt = [
|
|
1506
|
-
He,
|
|
1507
|
-
ot,
|
|
1508
|
-
ut,
|
|
1509
|
-
Ke,
|
|
1510
|
-
rt,
|
|
1511
|
-
Re
|
|
1512
|
-
].flat(), Tt = [
|
|
1513
|
-
Te,
|
|
1514
|
-
Ee,
|
|
1515
|
-
Oe,
|
|
1516
|
-
De
|
|
1517
|
-
], Et = x("IsMarkSelected", () => (e) => (t) => {
|
|
1518
|
-
if (!e) return !1;
|
|
1519
|
-
let { doc: n, selection: r } = t;
|
|
1520
|
-
return n.rangeHasMark(r.from, r.to, e);
|
|
1521
|
-
}), Dt = x("IsNoteSelected", () => (e) => (t) => e ? r(t, e).hasNode : !1), Ot = x("ClearTextInCurrentBlock", () => () => (e, t) => {
|
|
1522
|
-
let n = e.tr, { $from: r, $to: i } = n.selection, { pos: a } = r, { pos: o } = i, s = a - r.node().content.size;
|
|
1523
|
-
return s < 0 ? !1 : (n = n.deleteRange(s, o), t?.(n), !0);
|
|
1524
|
-
}), kt = x("SetBlockType", () => (e) => (t, n) => {
|
|
1525
|
-
let { nodeType: r, attrs: i = null } = e ?? {};
|
|
1526
|
-
if (!r) return !1;
|
|
1527
|
-
let a = t.tr, { from: o, to: s } = a.selection;
|
|
1528
|
-
try {
|
|
1529
|
-
a.setBlockType(o, s, r, i);
|
|
1530
|
-
} catch {
|
|
1531
|
-
return !1;
|
|
1532
|
-
}
|
|
1533
|
-
return n?.(a), !0;
|
|
1534
|
-
}), At = x("WrapInBlockType", () => (e) => (t, n) => {
|
|
1535
|
-
let { nodeType: r, attrs: i = null } = e ?? {};
|
|
1536
|
-
if (!r) return !1;
|
|
1537
|
-
let a = t.tr;
|
|
1538
|
-
try {
|
|
1539
|
-
let { $from: e, $to: t } = a.selection, n = e.blockRange(t), o = n && ce(n, r, i);
|
|
1540
|
-
if (!o) return !1;
|
|
1541
|
-
a = a.wrap(n, o);
|
|
1542
|
-
} catch {
|
|
1543
|
-
return !1;
|
|
1544
|
-
}
|
|
1545
|
-
return n?.(a), !0;
|
|
1546
|
-
}), jt = x("AddBlockType", () => (e) => (t, n) => {
|
|
1547
|
-
let { nodeType: r, attrs: i = null } = e ?? {};
|
|
1548
|
-
if (!r) return !1;
|
|
1549
|
-
let a = t.tr;
|
|
1550
|
-
try {
|
|
1551
|
-
let e = r instanceof re ? r : r.createAndFill(i);
|
|
1552
|
-
if (!e) return !1;
|
|
1553
|
-
a.replaceSelectionWith(e);
|
|
1554
|
-
} catch {
|
|
1555
|
-
return !1;
|
|
1556
|
-
}
|
|
1557
|
-
return n?.(a), !0;
|
|
1558
|
-
}), Mt = x("SelectTextNearPos", () => (e) => (t, n) => {
|
|
1559
|
-
let { pos: r } = e ?? {};
|
|
1560
|
-
if (r == null) return !1;
|
|
1561
|
-
let i = (e, t, n) => Math.min(Math.max(e, t), n), a = t.tr;
|
|
1562
|
-
try {
|
|
1563
|
-
let e = t.doc.resolve(i(r, 0, t.doc.content.size));
|
|
1564
|
-
a.setSelection(ie.near(e));
|
|
1565
|
-
} catch {
|
|
1566
|
-
return !1;
|
|
1567
|
-
}
|
|
1568
|
-
return n?.(a.scrollIntoView()), !0;
|
|
1569
|
-
}), Nt = [
|
|
1570
|
-
Pe,
|
|
1571
|
-
Ue,
|
|
1572
|
-
W,
|
|
1573
|
-
ze,
|
|
1574
|
-
qe,
|
|
1575
|
-
et,
|
|
1576
|
-
it,
|
|
1577
|
-
Ze,
|
|
1578
|
-
Qe,
|
|
1579
|
-
dt,
|
|
1580
|
-
st,
|
|
1581
|
-
mt,
|
|
1582
|
-
gt,
|
|
1583
|
-
ht,
|
|
1584
|
-
vt,
|
|
1585
|
-
E,
|
|
1586
|
-
P,
|
|
1587
|
-
A,
|
|
1588
|
-
ke,
|
|
1589
|
-
Ae,
|
|
1590
|
-
Et,
|
|
1591
|
-
Dt,
|
|
1592
|
-
Ot,
|
|
1593
|
-
kt,
|
|
1594
|
-
At,
|
|
1595
|
-
jt,
|
|
1596
|
-
Mt
|
|
1597
|
-
], Pt = [
|
|
1598
|
-
We,
|
|
1599
|
-
Ye,
|
|
1600
|
-
tt,
|
|
1601
|
-
Be,
|
|
1602
|
-
yt,
|
|
1603
|
-
ft,
|
|
1604
|
-
ct,
|
|
1605
|
-
Fe,
|
|
1606
|
-
D,
|
|
1607
|
-
F,
|
|
1608
|
-
j
|
|
1609
|
-
].flat(), Ft = _("remarkAddOrderInList", () => () => (e) => {
|
|
1610
|
-
c(e, "list", (e) => {
|
|
1611
|
-
if (e.ordered) {
|
|
1612
|
-
let t = e.start ?? 1;
|
|
1613
|
-
e.children.forEach((e, n) => {
|
|
1614
|
-
e.label = n + t;
|
|
1615
|
-
});
|
|
1616
|
-
}
|
|
1617
|
-
});
|
|
1618
|
-
});
|
|
1619
|
-
C(Ft.plugin, {
|
|
1620
|
-
displayName: "Remark<remarkAddOrderInListPlugin>",
|
|
1621
|
-
group: "Remark"
|
|
1622
|
-
}), C(Ft.options, {
|
|
1623
|
-
displayName: "RemarkConfig<remarkAddOrderInListPlugin>",
|
|
1624
|
-
group: "Remark"
|
|
1625
|
-
});
|
|
1626
|
-
var It = _("remarkLineBreak", () => () => (e) => {
|
|
1627
|
-
let t = /[\t ]*(?:\r?\n|\r)/g;
|
|
1628
|
-
c(e, "text", (e, n, r) => {
|
|
1629
|
-
if (!e.value || typeof e.value != "string") return;
|
|
1630
|
-
let i = [], a = 0;
|
|
1631
|
-
t.lastIndex = 0;
|
|
1632
|
-
let o = t.exec(e.value);
|
|
1633
|
-
for (; o;) {
|
|
1634
|
-
let n = o.index;
|
|
1635
|
-
a !== n && i.push({
|
|
1636
|
-
type: "text",
|
|
1637
|
-
value: e.value.slice(a, n)
|
|
1638
|
-
}), i.push({
|
|
1639
|
-
type: "break",
|
|
1640
|
-
data: { isInline: !0 }
|
|
1641
|
-
}), a = n + o[0].length, o = t.exec(e.value);
|
|
1642
|
-
}
|
|
1643
|
-
if (i.length > 0 && r && typeof n == "number") return a < e.value.length && i.push({
|
|
1644
|
-
type: "text",
|
|
1645
|
-
value: e.value.slice(a)
|
|
1646
|
-
}), r.children.splice(n, 1, ...i), n + i.length;
|
|
1647
|
-
});
|
|
1648
|
-
});
|
|
1649
|
-
C(It.plugin, {
|
|
1650
|
-
displayName: "Remark<remarkLineBreak>",
|
|
1651
|
-
group: "Remark"
|
|
1652
|
-
}), C(It.options, {
|
|
1653
|
-
displayName: "RemarkConfig<remarkLineBreak>",
|
|
1654
|
-
group: "Remark"
|
|
1655
|
-
});
|
|
1656
|
-
var Lt = _("remarkInlineLink", () => Se);
|
|
1657
|
-
C(Lt.plugin, {
|
|
1658
|
-
displayName: "Remark<remarkInlineLinkPlugin>",
|
|
1659
|
-
group: "Remark"
|
|
1660
|
-
}), C(Lt.options, {
|
|
1661
|
-
displayName: "RemarkConfig<remarkInlineLinkPlugin>",
|
|
1662
|
-
group: "Remark"
|
|
1663
|
-
});
|
|
1664
|
-
var Rt = (e) => !!e.children, zt = (e) => e.type === "html";
|
|
1665
|
-
function Bt(e, t) {
|
|
1666
|
-
return n(e, 0, null)[0];
|
|
1667
|
-
function n(e, r, i) {
|
|
1668
|
-
if (Rt(e)) {
|
|
1669
|
-
let t = [];
|
|
1670
|
-
for (let r = 0, i = e.children.length; r < i; r++) {
|
|
1671
|
-
let i = e.children[r];
|
|
1672
|
-
if (i) {
|
|
1673
|
-
let a = n(i, r, e);
|
|
1674
|
-
if (a) for (let e = 0, n = a.length; e < n; e++) {
|
|
1675
|
-
let n = a[e];
|
|
1676
|
-
n && t.push(n);
|
|
1677
|
-
}
|
|
1678
|
-
}
|
|
1679
|
-
}
|
|
1680
|
-
e.children = t;
|
|
1681
|
-
}
|
|
1682
|
-
return t(e, r, i);
|
|
1683
|
-
}
|
|
1684
|
-
}
|
|
1685
|
-
var Vt = [
|
|
1686
|
-
"root",
|
|
1687
|
-
"blockquote",
|
|
1688
|
-
"listItem"
|
|
1689
|
-
], Ht = _("remarkHTMLTransformer", () => () => (e) => {
|
|
1690
|
-
Bt(e, (e, t, n) => (zt(e) && n && Vt.includes(n.type) && (e.children = [{ ...e }], delete e.value, e.type = "paragraph"), [e]));
|
|
1691
|
-
});
|
|
1692
|
-
C(Ht.plugin, {
|
|
1693
|
-
displayName: "Remark<remarkHtmlTransformer>",
|
|
1694
|
-
group: "Remark"
|
|
1695
|
-
}), C(Ht.options, {
|
|
1696
|
-
displayName: "RemarkConfig<remarkHtmlTransformer>",
|
|
1697
|
-
group: "Remark"
|
|
1698
|
-
});
|
|
1699
|
-
var Ut = _("remarkMarker", () => () => (e, t) => {
|
|
1700
|
-
let n = (e) => t.value.charAt(e.position.start.offset);
|
|
1701
|
-
c(e, (e) => ["strong", "emphasis"].includes(e.type), (e) => {
|
|
1702
|
-
e.marker = n(e);
|
|
1703
|
-
});
|
|
1704
|
-
});
|
|
1705
|
-
C(Ut.plugin, {
|
|
1706
|
-
displayName: "Remark<remarkMarker>",
|
|
1707
|
-
group: "Remark"
|
|
1708
|
-
}), C(Ut.options, {
|
|
1709
|
-
displayName: "RemarkConfig<remarkMarker>",
|
|
1710
|
-
group: "Remark"
|
|
1711
|
-
});
|
|
1712
|
-
var Wt = S(() => {
|
|
1713
|
-
let e = !1, t = new m({
|
|
1714
|
-
key: new p("MILKDOWN_INLINE_NODES_CURSOR"),
|
|
1715
|
-
state: {
|
|
1716
|
-
init() {
|
|
1717
|
-
return !1;
|
|
1718
|
-
},
|
|
1719
|
-
apply(e) {
|
|
1720
|
-
if (!e.selection.empty) return !1;
|
|
1721
|
-
let t = e.selection.$from, n = t.nodeBefore, r = t.nodeAfter;
|
|
1722
|
-
return !!(n && r && n.isInline && !n.isText && r.isInline && !r.isText);
|
|
1723
|
-
}
|
|
1724
|
-
},
|
|
1725
|
-
props: {
|
|
1726
|
-
handleDOMEvents: {
|
|
1727
|
-
compositionend: (n, r) => e ? (e = !1, requestAnimationFrame(() => {
|
|
1728
|
-
if (t.getState(n.state)) {
|
|
1729
|
-
let e = n.state.selection.from;
|
|
1730
|
-
r.preventDefault(), n.dispatch(n.state.tr.insertText(r.data || "", e));
|
|
1731
|
-
}
|
|
1732
|
-
}), !0) : !1,
|
|
1733
|
-
compositionstart: (n) => (t.getState(n.state) && (e = !0), !1),
|
|
1734
|
-
beforeinput: (n, r) => {
|
|
1735
|
-
if (t.getState(n.state) && r instanceof InputEvent && r.data && !e) {
|
|
1736
|
-
let e = n.state.selection.from;
|
|
1737
|
-
return r.preventDefault(), n.dispatch(n.state.tr.insertText(r.data || "", e)), !0;
|
|
1738
|
-
}
|
|
1739
|
-
return !1;
|
|
1740
|
-
}
|
|
1741
|
-
},
|
|
1742
|
-
decorations(e) {
|
|
1743
|
-
if (t.getState(e)) {
|
|
1744
|
-
let t = e.selection.$from.pos, n = document.createElement("span"), r = ee.widget(t, n, { side: -1 }), i = document.createElement("span"), o = ee.widget(t, i);
|
|
1745
|
-
return setTimeout(() => {
|
|
1746
|
-
n.contentEditable = "true", i.contentEditable = "true";
|
|
1747
|
-
}), a.create(e.doc, [r, o]);
|
|
1748
|
-
}
|
|
1749
|
-
return a.empty;
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
});
|
|
1753
|
-
return t;
|
|
1754
|
-
});
|
|
1755
|
-
C(Wt, {
|
|
1756
|
-
displayName: "Prose<inlineNodesCursorPlugin>",
|
|
1757
|
-
group: "Prose"
|
|
1758
|
-
});
|
|
1759
|
-
var Gt = S((e) => new m({
|
|
1760
|
-
key: new p("MILKDOWN_HARDBREAK_MARKS"),
|
|
1761
|
-
appendTransaction: (t, n, r) => {
|
|
1762
|
-
if (!t.length) return;
|
|
1763
|
-
let [i] = t;
|
|
1764
|
-
if (!i) return;
|
|
1765
|
-
let [a] = i.steps;
|
|
1766
|
-
if (i.getMeta("hardbreak")) {
|
|
1767
|
-
if (!(a instanceof oe)) return;
|
|
1768
|
-
let { from: t } = a;
|
|
1769
|
-
return r.tr.setNodeMarkup(t, Y.type(e), void 0, []);
|
|
1770
|
-
}
|
|
1771
|
-
if (a instanceof se) {
|
|
1772
|
-
let t = r.tr, { from: n, to: i } = a;
|
|
1773
|
-
return r.doc.nodesBetween(n, i, (n, r) => {
|
|
1774
|
-
n.type === Y.type(e) && (t = t.setNodeMarkup(r, Y.type(e), void 0, []));
|
|
1775
|
-
}), t;
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
}));
|
|
1779
|
-
C(Gt, {
|
|
1780
|
-
displayName: "Prose<hardbreakClearMarkPlugin>",
|
|
1781
|
-
group: "Prose"
|
|
1782
|
-
});
|
|
1783
|
-
var Kt = he(["table", "code_block"], "hardbreakFilterNodes");
|
|
1784
|
-
C(Kt, {
|
|
1785
|
-
displayName: "Ctx<hardbreakFilterNodes>",
|
|
1786
|
-
group: "Prose"
|
|
1787
|
-
});
|
|
1788
|
-
var qt = S((e) => {
|
|
1789
|
-
let t = e.get(Kt.key);
|
|
1790
|
-
return new m({
|
|
1791
|
-
key: new p("MILKDOWN_HARDBREAK_FILTER"),
|
|
1792
|
-
filterTransaction: (e, n) => {
|
|
1793
|
-
let r = e.getMeta("hardbreak"), [i] = e.steps;
|
|
1794
|
-
if (r && i) {
|
|
1795
|
-
let { from: e } = i, r = n.doc.resolve(e), a = r.depth, o = !0;
|
|
1796
|
-
for (; a > 0;) t.includes(r.node(a).type.name) && (o = !1), a--;
|
|
1797
|
-
return o;
|
|
1798
|
-
}
|
|
1799
|
-
return !0;
|
|
1800
|
-
}
|
|
1801
|
-
});
|
|
1802
|
-
});
|
|
1803
|
-
C(qt, {
|
|
1804
|
-
displayName: "Prose<hardbreakFilterPlugin>",
|
|
1805
|
-
group: "Prose"
|
|
1806
|
-
});
|
|
1807
|
-
var Jt = S((e) => {
|
|
1808
|
-
let t = new p("MILKDOWN_HEADING_ID"), n = (n) => {
|
|
1809
|
-
if (n.composing) return;
|
|
1810
|
-
let r = e.get(V.key), i = n.state.tr.setMeta("addToHistory", !1), a = !1, o = {};
|
|
1811
|
-
n.state.doc.descendants((n, s) => {
|
|
1812
|
-
if (n.type === U.type(e)) {
|
|
1813
|
-
if (n.textContent.trim().length === 0) return;
|
|
1814
|
-
let e = n.attrs, c = r(n);
|
|
1815
|
-
o[c] ? (o[c] += 1, c += `-#${o[c]}`) : o[c] = 1, e.id !== c && (a = !0, i.setMeta(t, !0).setNodeMarkup(s, void 0, {
|
|
1816
|
-
...e,
|
|
1817
|
-
id: c
|
|
1818
|
-
}));
|
|
1819
|
-
}
|
|
1820
|
-
}), a && n.dispatch(i);
|
|
1821
|
-
};
|
|
1822
|
-
return new m({
|
|
1823
|
-
key: t,
|
|
1824
|
-
view: (e) => (n(e), { update: (e, t) => {
|
|
1825
|
-
e.state.doc.eq(t.doc) || n(e);
|
|
1826
|
-
} })
|
|
1827
|
-
});
|
|
1828
|
-
});
|
|
1829
|
-
C(Jt, {
|
|
1830
|
-
displayName: "Prose<syncHeadingIdPlugin>",
|
|
1831
|
-
group: "Prose"
|
|
1832
|
-
});
|
|
1833
|
-
var Yt = S((e) => new m({
|
|
1834
|
-
key: new p("MILKDOWN_KEEP_LIST_ORDER"),
|
|
1835
|
-
appendTransaction: (t, n, r) => {
|
|
1836
|
-
if (!r.selection || t.some((e) => e.getMeta("addToHistory") === !1 || !e.isGeneric)) return null;
|
|
1837
|
-
let i = Q.type(e), a = Z.type(e), o = $.type(e), s = (e, t, n = 1) => {
|
|
1838
|
-
let r = !1, i = `${t + n}.`;
|
|
1839
|
-
return e.label !== i && (e.label = i, r = !0), r;
|
|
1840
|
-
}, c = r.tr, l = !1;
|
|
1841
|
-
return r.doc.descendants((e, t, n, r) => {
|
|
1842
|
-
if (e.type === a) {
|
|
1843
|
-
let n = e.maybeChild(0);
|
|
1844
|
-
n?.type === o && n.attrs.listType === "ordered" && (l = !0, c.setNodeMarkup(t, i, { spread: "true" }), e.descendants((e, t, n, r) => {
|
|
1845
|
-
if (e.type === o) {
|
|
1846
|
-
let n = { ...e.attrs };
|
|
1847
|
-
s(n, r) && (c = c.setNodeMarkup(t, void 0, n));
|
|
1848
|
-
}
|
|
1849
|
-
return !1;
|
|
1850
|
-
}));
|
|
1851
|
-
} else if (e.type === o && n?.type === i) {
|
|
1852
|
-
let i = { ...e.attrs }, a = !1;
|
|
1853
|
-
i.listType !== "ordered" && (i.listType = "ordered", a = !0), n?.maybeChild(0) && (a = s(i, r, n?.attrs.order ?? 1)), a && (c = c.setNodeMarkup(t, void 0, i), l = !0);
|
|
1854
|
-
}
|
|
1855
|
-
}), l ? c.setMeta("addToHistory", !1) : null;
|
|
1856
|
-
}
|
|
1857
|
-
}));
|
|
1858
|
-
C(Yt, {
|
|
1859
|
-
displayName: "Prose<syncListOrderPlugin>",
|
|
1860
|
-
group: "Prose"
|
|
1861
|
-
});
|
|
1862
|
-
var Xt = [
|
|
1863
|
-
Gt,
|
|
1864
|
-
Kt,
|
|
1865
|
-
qt,
|
|
1866
|
-
Wt,
|
|
1867
|
-
Ft,
|
|
1868
|
-
Lt,
|
|
1869
|
-
It,
|
|
1870
|
-
Ht,
|
|
1871
|
-
Ut,
|
|
1872
|
-
R,
|
|
1873
|
-
Jt,
|
|
1874
|
-
Yt
|
|
1875
|
-
].flat(), Zt = [
|
|
1876
|
-
Ct,
|
|
1877
|
-
wt,
|
|
1878
|
-
Tt,
|
|
1879
|
-
Nt,
|
|
1880
|
-
Pt,
|
|
1881
|
-
Xt
|
|
1882
|
-
].flat();
|
|
1883
|
-
//#endregion
|
|
1884
|
-
export { B as i, Ce as n, $ as r, q as t };
|