@milkdown/preset-commonmark 7.3.5 → 7.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__internal__/index.d.ts.map +1 -1
- package/lib/__internal__/serialize-text.d.ts.map +1 -1
- package/lib/__internal__/with-meta.d.ts.map +1 -1
- package/lib/composed/commands.d.ts.map +1 -1
- package/lib/composed/index.d.ts.map +1 -1
- package/lib/composed/inputrules.d.ts.map +1 -1
- package/lib/composed/keymap.d.ts.map +1 -1
- package/lib/composed/plugins.d.ts.map +1 -1
- package/lib/composed/schema.d.ts.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.es.js +81 -71
- package/lib/index.es.js.map +1 -1
- package/lib/mark/emphasis.d.ts.map +1 -1
- package/lib/mark/index.d.ts.map +1 -1
- package/lib/mark/inline-code.d.ts.map +1 -1
- package/lib/mark/link.d.ts.map +1 -1
- package/lib/mark/strong.d.ts.map +1 -1
- package/lib/node/blockquote.d.ts.map +1 -1
- package/lib/node/bullet-list.d.ts.map +1 -1
- package/lib/node/code-block.d.ts.map +1 -1
- package/lib/node/doc.d.ts.map +1 -1
- package/lib/node/hardbreak.d.ts.map +1 -1
- package/lib/node/heading.d.ts.map +1 -1
- package/lib/node/hr.d.ts.map +1 -1
- package/lib/node/html.d.ts.map +1 -1
- package/lib/node/image.d.ts.map +1 -1
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/list-item.d.ts +1 -1
- package/lib/node/list-item.d.ts.map +1 -1
- package/lib/node/ordered-list.d.ts.map +1 -1
- package/lib/node/paragraph.d.ts.map +1 -1
- package/lib/node/text.d.ts.map +1 -1
- package/lib/plugin/hardbreak-clear-mark-plugin.d.ts.map +1 -1
- package/lib/plugin/hardbreak-filter-plugin.d.ts.map +1 -1
- package/lib/plugin/index.d.ts.map +1 -1
- package/lib/plugin/inline-nodes-cursor-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-add-order-in-list-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-html-transformer.d.ts.map +1 -1
- package/lib/plugin/remark-inline-link-plugin.d.ts.map +1 -1
- package/lib/plugin/remark-line-break.d.ts.map +1 -1
- package/lib/plugin/remark-marker-plugin.d.ts.map +1 -1
- package/lib/plugin/sync-heading-id-plugin.d.ts.map +1 -1
- package/lib/plugin/sync-list-order-plugin.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/__internal__/index.ts +0 -1
- package/src/__internal__/serialize-text.ts +0 -1
- package/src/__internal__/with-meta.ts +0 -1
- package/src/composed/commands.ts +0 -1
- package/src/composed/index.ts +0 -1
- package/src/composed/inputrules.ts +0 -1
- package/src/composed/keymap.ts +0 -1
- package/src/composed/plugins.ts +0 -2
- package/src/composed/schema.ts +0 -2
- package/src/index.ts +0 -2
- package/src/mark/emphasis.ts +6 -1
- package/src/mark/index.ts +0 -1
- package/src/mark/inline-code.ts +0 -1
- package/src/mark/link.ts +0 -1
- package/src/mark/strong.ts +7 -2
- package/src/node/blockquote.ts +0 -1
- package/src/node/bullet-list.ts +0 -1
- package/src/node/code-block.ts +0 -1
- package/src/node/doc.ts +0 -1
- package/src/node/hardbreak.ts +0 -1
- package/src/node/heading.ts +0 -1
- package/src/node/hr.ts +0 -1
- package/src/node/html.ts +0 -1
- package/src/node/image.ts +0 -1
- package/src/node/index.ts +0 -2
- package/src/node/list-item.ts +3 -4
- package/src/node/ordered-list.ts +0 -1
- package/src/node/paragraph.ts +0 -1
- package/src/node/text.ts +0 -1
- package/src/plugin/hardbreak-clear-mark-plugin.ts +0 -1
- package/src/plugin/hardbreak-filter-plugin.ts +0 -1
- package/src/plugin/index.ts +0 -2
- package/src/plugin/inline-nodes-cursor-plugin.ts +0 -1
- package/src/plugin/remark-add-order-in-list-plugin.ts +0 -1
- package/src/plugin/remark-html-transformer.ts +0 -1
- package/src/plugin/remark-inline-link-plugin.ts +0 -1
- package/src/plugin/remark-line-break.ts +0 -1
- package/src/plugin/remark-marker-plugin.ts +0 -1
- package/src/plugin/sync-heading-id-plugin.ts +1 -2
- package/src/plugin/sync-list-order-plugin.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/__internal__/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/__internal__/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-text.d.ts","sourceRoot":"","sources":["../../src/__internal__/serialize-text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serialize-text.d.ts","sourceRoot":"","sources":["../../src/__internal__/serialize-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAGjD,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,QAgB/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-meta.d.ts","sourceRoot":"","sources":["../../src/__internal__/with-meta.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"with-meta.d.ts","sourceRoot":"","sources":["../../src/__internal__/with-meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEzD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,cAAc,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,CAShH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/composed/commands.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/composed/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAqBnD,eAAO,MAAM,QAAQ,EAAE,cAAc,EAyBpC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composed/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composed/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputrules.d.ts","sourceRoot":"","sources":["../../src/composed/inputrules.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inputrules.d.ts","sourceRoot":"","sources":["../../src/composed/inputrules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,eAAO,MAAM,UAAU,EAAE,cAAc,EAO/B,CAAA;AAGR,eAAO,MAAM,cAAc,EAAE,cAAc,EAK1C,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/composed/keymap.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keymap.d.ts","sourceRoot":"","sources":["../../src/composed/keymap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAKnD,eAAO,MAAM,MAAM,EAAE,cAAc,EAa3B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/composed/plugins.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/composed/plugins.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAgBnD,eAAO,MAAM,OAAO,EAAE,cAAc,EAe5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composed/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composed/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AA+BnD,eAAO,MAAM,MAAM,EAAE,cAAc,EAkD3B,CAAA"}
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAGnD,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAG1B,eAAO,MAAM,UAAU,EAAE,cAAc,EAA2E,CAAA"}
|
package/lib/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { $markAttr as V, $markSchema as U, $command as c, $inputRule as h, $useKeymap as f, $node as Qe, $nodeAttr as N, $nodeSchema as I, $ctx as Xe, $remark as D, $prose as _ } from "@milkdown/utils";
|
|
2
|
-
import { remarkStringifyOptionsCtx as Ye, commandsCtx as u, editorViewCtx as
|
|
2
|
+
import { remarkStringifyOptionsCtx as Ye, commandsCtx as u, editorViewCtx as At } from "@milkdown/core";
|
|
3
3
|
import { toggleMark as z, setBlockType as K, wrapIn as J } from "@milkdown/prose/commands";
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { expectDomTypeError as
|
|
4
|
+
import { Fragment as wt } from "@milkdown/prose/model";
|
|
5
|
+
import { expectDomTypeError as A } from "@milkdown/exception";
|
|
6
6
|
import { textblockTypeInputRule as Ze, wrappingInputRule as Q, InputRule as et } from "@milkdown/prose/inputrules";
|
|
7
7
|
import Ht from "@sindresorhus/slugify";
|
|
8
8
|
import { TextSelection as X, Selection as tt, PluginKey as E, Plugin as P } from "@milkdown/prose/state";
|
|
@@ -21,7 +21,7 @@ function at(t, e) {
|
|
|
21
21
|
const a = [];
|
|
22
22
|
e.content.forEach((s, l, i) => {
|
|
23
23
|
i !== e.childCount - 1 && a.push(s);
|
|
24
|
-
}), t.next(
|
|
24
|
+
}), t.next(wt.fromArray(a));
|
|
25
25
|
}
|
|
26
26
|
function n(t, e) {
|
|
27
27
|
return Object.assign(t, {
|
|
@@ -77,6 +77,9 @@ n(ee, {
|
|
|
77
77
|
group: "Emphasis"
|
|
78
78
|
});
|
|
79
79
|
const nt = h((t) => G(/(?:^|[^*])\*([^*]+)\*$/, R.type(t), {
|
|
80
|
+
getAttr: () => ({
|
|
81
|
+
marker: "*"
|
|
82
|
+
}),
|
|
80
83
|
updateCaptured: ({ fullMatch: e, start: r }) => e.startsWith("*") ? {} : { fullMatch: e.slice(1), start: r + 1 }
|
|
81
84
|
}));
|
|
82
85
|
n(nt, {
|
|
@@ -84,6 +87,9 @@ n(nt, {
|
|
|
84
87
|
group: "Emphasis"
|
|
85
88
|
});
|
|
86
89
|
const ot = h((t) => G(/(?:^|[^_])_([^_]+)_$/, R.type(t), {
|
|
90
|
+
getAttr: () => ({
|
|
91
|
+
marker: "_"
|
|
92
|
+
}),
|
|
87
93
|
updateCaptured: ({ fullMatch: e, start: r }) => e.startsWith("_") ? {} : { fullMatch: e.slice(1), start: r + 1 }
|
|
88
94
|
}));
|
|
89
95
|
n(ot, {
|
|
@@ -152,7 +158,11 @@ n(ae, {
|
|
|
152
158
|
displayName: "Command<toggleStrongCommand>",
|
|
153
159
|
group: "Strong"
|
|
154
160
|
});
|
|
155
|
-
const st = h((t) => G(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, $.type(t)
|
|
161
|
+
const st = h((t) => G(/(?:\*\*|__)([^*_]+)(?:\*\*|__)$/, $.type(t), {
|
|
162
|
+
getAttr: (e) => ({
|
|
163
|
+
marker: e[0].startsWith("*") ? "*" : "_"
|
|
164
|
+
})
|
|
165
|
+
}));
|
|
156
166
|
n(st, {
|
|
157
167
|
displayName: "InputRule<strong>",
|
|
158
168
|
group: "Strong"
|
|
@@ -256,7 +266,7 @@ const B = U("link", (t) => ({
|
|
|
256
266
|
tag: "a[href]",
|
|
257
267
|
getAttrs: (e) => {
|
|
258
268
|
if (!(e instanceof HTMLElement))
|
|
259
|
-
throw
|
|
269
|
+
throw A(e);
|
|
260
270
|
return { href: e.getAttribute("href"), title: e.getAttribute("title") };
|
|
261
271
|
}
|
|
262
272
|
}
|
|
@@ -293,17 +303,17 @@ const dt = c("UpdateLink", (t) => (e = {}) => (r, a) => {
|
|
|
293
303
|
return !1;
|
|
294
304
|
let o, s = -1;
|
|
295
305
|
const { selection: l } = r, { from: i, to: d } = l;
|
|
296
|
-
if (r.doc.nodesBetween(i, i === d ? d + 1 : d, (
|
|
297
|
-
if (B.type(t).isInSet(
|
|
298
|
-
return o =
|
|
306
|
+
if (r.doc.nodesBetween(i, i === d ? d + 1 : d, (k, b) => {
|
|
307
|
+
if (B.type(t).isInSet(k.marks))
|
|
308
|
+
return o = k, s = b, !1;
|
|
299
309
|
}), !o)
|
|
300
310
|
return !1;
|
|
301
|
-
const m = o.marks.find(({ type:
|
|
311
|
+
const m = o.marks.find(({ type: k }) => k === B.type(t));
|
|
302
312
|
if (!m)
|
|
303
313
|
return !1;
|
|
304
|
-
const p = s,
|
|
314
|
+
const p = s, y = s + o.nodeSize, { tr: g } = r, C = B.type(t).create({ ...m.attrs, ...e });
|
|
305
315
|
return C ? (a(
|
|
306
|
-
g.removeMark(p,
|
|
316
|
+
g.removeMark(p, y, m).addMark(p, y, C).setSelection(new X(g.selection.$anchor)).scrollIntoView()
|
|
307
317
|
), !0) : !1;
|
|
308
318
|
});
|
|
309
319
|
n(dt, {
|
|
@@ -334,7 +344,7 @@ n(de, {
|
|
|
334
344
|
displayName: "Attr<paragraph>",
|
|
335
345
|
group: "Paragraph"
|
|
336
346
|
});
|
|
337
|
-
const
|
|
347
|
+
const w = I("paragraph", (t) => ({
|
|
338
348
|
content: "inline*",
|
|
339
349
|
group: "block",
|
|
340
350
|
parseDOM: [{ tag: "p" }],
|
|
@@ -352,15 +362,15 @@ const A = I("paragraph", (t) => ({
|
|
|
352
362
|
}
|
|
353
363
|
}
|
|
354
364
|
}));
|
|
355
|
-
n(
|
|
365
|
+
n(w.node, {
|
|
356
366
|
displayName: "NodeSchema<paragraph>",
|
|
357
367
|
group: "Paragraph"
|
|
358
368
|
});
|
|
359
|
-
n(
|
|
369
|
+
n(w.ctx, {
|
|
360
370
|
displayName: "NodeSchemaCtx<paragraph>",
|
|
361
371
|
group: "Paragraph"
|
|
362
372
|
});
|
|
363
|
-
const me = c("TurnIntoText", (t) => () => K(
|
|
373
|
+
const me = c("TurnIntoText", (t) => () => K(w.type(t)));
|
|
364
374
|
n(me, {
|
|
365
375
|
displayName: "Command<turnIntoTextCommand>",
|
|
366
376
|
group: "Paragraph"
|
|
@@ -414,7 +424,7 @@ const H = I("heading", (t) => {
|
|
|
414
424
|
tag: `h${r}`,
|
|
415
425
|
getAttrs: (a) => {
|
|
416
426
|
if (!(a instanceof HTMLElement))
|
|
417
|
-
throw
|
|
427
|
+
throw A(a);
|
|
418
428
|
return { level: r, id: a.id };
|
|
419
429
|
}
|
|
420
430
|
})),
|
|
@@ -451,7 +461,7 @@ n(H.ctx, {
|
|
|
451
461
|
});
|
|
452
462
|
const pt = h((t) => Ze(/^(?<hashes>#+)\s$/, H.type(t), (e) => {
|
|
453
463
|
var l, i;
|
|
454
|
-
const r = ((i = (l = e.groups) == null ? void 0 : l.hashes) == null ? void 0 : i.length) || 0, a = t.get(
|
|
464
|
+
const r = ((i = (l = e.groups) == null ? void 0 : l.hashes) == null ? void 0 : i.length) || 0, a = t.get(At), { $from: o } = a.state.selection, s = o.node();
|
|
455
465
|
if (s.type.name === "heading") {
|
|
456
466
|
let d = Number(s.attrs.level) + Number(r);
|
|
457
467
|
return d > 6 && (d = 6), { level: d };
|
|
@@ -462,7 +472,7 @@ n(pt, {
|
|
|
462
472
|
displayName: "InputRule<wrapInHeadingInputRule>",
|
|
463
473
|
group: "Heading"
|
|
464
474
|
});
|
|
465
|
-
const L = c("WrapInHeading", (t) => (e) => (e ?? (e = 1), e < 1 ? K(
|
|
475
|
+
const L = c("WrapInHeading", (t) => (e) => (e ?? (e = 1), e < 1 ? K(w.type(t)) : K(H.type(t), { level: e })));
|
|
466
476
|
n(L, {
|
|
467
477
|
displayName: "Command<wrapInHeadingCommand>",
|
|
468
478
|
group: "Heading"
|
|
@@ -477,7 +487,7 @@ const ue = c("DowngradeHeading", (t) => () => (e, r, a) => {
|
|
|
477
487
|
...s.attrs,
|
|
478
488
|
level: l
|
|
479
489
|
})
|
|
480
|
-
), !0) : K(
|
|
490
|
+
), !0) : K(w.type(t))(e, r, a);
|
|
481
491
|
});
|
|
482
492
|
n(ue, {
|
|
483
493
|
displayName: "Command<downgradeHeadingCommand>",
|
|
@@ -542,8 +552,8 @@ n(ge.shortcuts, {
|
|
|
542
552
|
displayName: "Keymap<heading>",
|
|
543
553
|
group: "Heading"
|
|
544
554
|
});
|
|
545
|
-
const
|
|
546
|
-
n(
|
|
555
|
+
const ke = N("blockquote");
|
|
556
|
+
n(ke, {
|
|
547
557
|
displayName: "Attr<blockquote>",
|
|
548
558
|
group: "Blockquote"
|
|
549
559
|
});
|
|
@@ -552,7 +562,7 @@ const q = I("blockquote", (t) => ({
|
|
|
552
562
|
group: "block",
|
|
553
563
|
defining: !0,
|
|
554
564
|
parseDOM: [{ tag: "blockquote" }],
|
|
555
|
-
toDOM: (e) => ["blockquote", t.get(
|
|
565
|
+
toDOM: (e) => ["blockquote", t.get(ke.key)(e), 0],
|
|
556
566
|
parseMarkdown: {
|
|
557
567
|
match: ({ type: e }) => e === "blockquote",
|
|
558
568
|
runner: (e, r, a) => {
|
|
@@ -579,8 +589,8 @@ n(ct, {
|
|
|
579
589
|
displayName: "InputRule<wrapInBlockquoteInputRule>",
|
|
580
590
|
group: "Blockquote"
|
|
581
591
|
});
|
|
582
|
-
const
|
|
583
|
-
n(
|
|
592
|
+
const ye = c("WrapInBlockquote", (t) => () => J(q.type(t)));
|
|
593
|
+
n(ye, {
|
|
584
594
|
displayName: "Command<wrapInBlockquoteCommand>",
|
|
585
595
|
group: "Blockquote"
|
|
586
596
|
});
|
|
@@ -589,7 +599,7 @@ const he = f("blockquoteKeymap", {
|
|
|
589
599
|
shortcuts: "Mod-Shift-b",
|
|
590
600
|
command: (t) => {
|
|
591
601
|
const e = t.get(u);
|
|
592
|
-
return () => e.call(
|
|
602
|
+
return () => e.call(ye.key);
|
|
593
603
|
}
|
|
594
604
|
}
|
|
595
605
|
});
|
|
@@ -626,7 +636,7 @@ const W = I("code_block", (t) => ({
|
|
|
626
636
|
preserveWhitespace: "full",
|
|
627
637
|
getAttrs: (e) => {
|
|
628
638
|
if (!(e instanceof HTMLElement))
|
|
629
|
-
throw
|
|
639
|
+
throw A(e);
|
|
630
640
|
return { language: e.dataset.language };
|
|
631
641
|
}
|
|
632
642
|
}
|
|
@@ -728,7 +738,7 @@ const v = I("image", (t) => ({
|
|
|
728
738
|
tag: "img[src]",
|
|
729
739
|
getAttrs: (e) => {
|
|
730
740
|
if (!(e instanceof HTMLElement))
|
|
731
|
-
throw
|
|
741
|
+
throw A(e);
|
|
732
742
|
return {
|
|
733
743
|
src: e.getAttribute("src") || "",
|
|
734
744
|
alt: e.getAttribute("alt") || "",
|
|
@@ -778,14 +788,14 @@ n(gt, {
|
|
|
778
788
|
displayName: "Command<insertImageCommand>",
|
|
779
789
|
group: "Image"
|
|
780
790
|
});
|
|
781
|
-
const
|
|
791
|
+
const kt = c("UpdateImage", (t) => (e = {}) => (r, a) => {
|
|
782
792
|
const o = Bt(r.selection, v.type(t));
|
|
783
793
|
if (!o)
|
|
784
794
|
return !1;
|
|
785
795
|
const { node: s, pos: l } = o, i = { ...s.attrs }, { src: d, alt: m, title: p } = e;
|
|
786
796
|
return d !== void 0 && (i.src = d), m !== void 0 && (i.alt = m), p !== void 0 && (i.title = p), a == null || a(r.tr.setNodeMarkup(l, void 0, i).scrollIntoView()), !0;
|
|
787
797
|
});
|
|
788
|
-
n(
|
|
798
|
+
n(kt, {
|
|
789
799
|
displayName: "Command<updateImageCommand>",
|
|
790
800
|
group: "Image"
|
|
791
801
|
});
|
|
@@ -908,21 +918,21 @@ n(F.ctx, {
|
|
|
908
918
|
displayName: "NodeSchemaCtx<hr>",
|
|
909
919
|
group: "Hr"
|
|
910
920
|
});
|
|
911
|
-
const
|
|
921
|
+
const yt = h((t) => new et(
|
|
912
922
|
/^(?:---|___\s|\*\*\*\s)$/,
|
|
913
923
|
(e, r, a, o) => {
|
|
914
924
|
const { tr: s } = e;
|
|
915
925
|
return r[0] && s.replaceWith(a - 1, o, F.type(t).create()), s;
|
|
916
926
|
}
|
|
917
927
|
));
|
|
918
|
-
n(
|
|
928
|
+
n(yt, {
|
|
919
929
|
displayName: "InputRule<insertHrInputRule>",
|
|
920
930
|
group: "Hr"
|
|
921
931
|
});
|
|
922
932
|
const ht = c("InsertHr", (t) => () => (e, r) => {
|
|
923
933
|
if (!r)
|
|
924
934
|
return !0;
|
|
925
|
-
const a =
|
|
935
|
+
const a = w.node.type(t).create(), { tr: o, selection: s } = e, { from: l } = s, i = F.type(t).create();
|
|
926
936
|
if (!i)
|
|
927
937
|
return !0;
|
|
928
938
|
const d = o.replaceSelectionWith(i).insert(l, a), m = tt.findFrom(d.doc.resolve(l), 1, !0);
|
|
@@ -950,7 +960,7 @@ const O = I("bullet_list", (t) => ({
|
|
|
950
960
|
tag: "ul",
|
|
951
961
|
getAttrs: (e) => {
|
|
952
962
|
if (!(e instanceof HTMLElement))
|
|
953
|
-
throw
|
|
963
|
+
throw A(e);
|
|
954
964
|
return {
|
|
955
965
|
spread: e.dataset.spread
|
|
956
966
|
};
|
|
@@ -992,25 +1002,25 @@ n(ft, {
|
|
|
992
1002
|
displayName: "InputRule<wrapInBulletListInputRule>",
|
|
993
1003
|
group: "BulletList"
|
|
994
1004
|
});
|
|
995
|
-
const
|
|
996
|
-
n(
|
|
1005
|
+
const Ae = c("WrapInBulletList", (t) => () => J(O.type(t)));
|
|
1006
|
+
n(Ae, {
|
|
997
1007
|
displayName: "Command<wrapInBulletListCommand>",
|
|
998
1008
|
group: "BulletList"
|
|
999
1009
|
});
|
|
1000
|
-
const
|
|
1010
|
+
const we = f("bulletListKeymap", {
|
|
1001
1011
|
WrapInBulletList: {
|
|
1002
1012
|
shortcuts: "Mod-Alt-8",
|
|
1003
1013
|
command: (t) => {
|
|
1004
1014
|
const e = t.get(u);
|
|
1005
|
-
return () => e.call(
|
|
1015
|
+
return () => e.call(Ae.key);
|
|
1006
1016
|
}
|
|
1007
1017
|
}
|
|
1008
1018
|
});
|
|
1009
|
-
n(
|
|
1019
|
+
n(we.ctx, {
|
|
1010
1020
|
displayName: "KeymapCtx<bulletListKeymap>",
|
|
1011
1021
|
group: "BulletList"
|
|
1012
1022
|
});
|
|
1013
|
-
n(
|
|
1023
|
+
n(we.shortcuts, {
|
|
1014
1024
|
displayName: "Keymap<bulletListKeymap>",
|
|
1015
1025
|
group: "BulletList"
|
|
1016
1026
|
});
|
|
@@ -1035,7 +1045,7 @@ const T = I("ordered_list", (t) => ({
|
|
|
1035
1045
|
tag: "ol",
|
|
1036
1046
|
getAttrs: (e) => {
|
|
1037
1047
|
if (!(e instanceof HTMLElement))
|
|
1038
|
-
throw
|
|
1048
|
+
throw A(e);
|
|
1039
1049
|
return {
|
|
1040
1050
|
spread: e.dataset.spread,
|
|
1041
1051
|
order: e.hasAttribute("start") ? Number(e.getAttribute("start")) : 1
|
|
@@ -1113,7 +1123,7 @@ n(ve, {
|
|
|
1113
1123
|
});
|
|
1114
1124
|
const M = I("list_item", (t) => ({
|
|
1115
1125
|
group: "listItem",
|
|
1116
|
-
content: "paragraph block*",
|
|
1126
|
+
content: "(paragraph|blockquote) block*",
|
|
1117
1127
|
attrs: {
|
|
1118
1128
|
label: {
|
|
1119
1129
|
default: "•"
|
|
@@ -1131,10 +1141,10 @@ const M = I("list_item", (t) => ({
|
|
|
1131
1141
|
tag: "li",
|
|
1132
1142
|
getAttrs: (e) => {
|
|
1133
1143
|
if (!(e instanceof HTMLElement))
|
|
1134
|
-
throw
|
|
1144
|
+
throw A(e);
|
|
1135
1145
|
return {
|
|
1136
1146
|
label: e.dataset.label,
|
|
1137
|
-
listType: e.dataset
|
|
1147
|
+
listType: e.dataset.listType,
|
|
1138
1148
|
spread: e.dataset.spread
|
|
1139
1149
|
};
|
|
1140
1150
|
}
|
|
@@ -1177,7 +1187,7 @@ n(Oe, {
|
|
|
1177
1187
|
displayName: "Command<sinkListItemCommand>",
|
|
1178
1188
|
group: "ListItem"
|
|
1179
1189
|
});
|
|
1180
|
-
const Te = c("
|
|
1190
|
+
const Te = c("LiftListItem", (t) => () => rt(M.type(t)));
|
|
1181
1191
|
n(Te, {
|
|
1182
1192
|
displayName: "Command<liftListItemCommand>",
|
|
1183
1193
|
group: "ListItem"
|
|
@@ -1313,13 +1323,13 @@ n(Pe.ctx, {
|
|
|
1313
1323
|
const qt = [
|
|
1314
1324
|
mt,
|
|
1315
1325
|
de,
|
|
1316
|
-
|
|
1326
|
+
w,
|
|
1317
1327
|
j,
|
|
1318
1328
|
ce,
|
|
1319
1329
|
H,
|
|
1320
1330
|
Me,
|
|
1321
1331
|
S,
|
|
1322
|
-
|
|
1332
|
+
ke,
|
|
1323
1333
|
q,
|
|
1324
1334
|
fe,
|
|
1325
1335
|
W,
|
|
@@ -1349,7 +1359,7 @@ const qt = [
|
|
|
1349
1359
|
ft,
|
|
1350
1360
|
Nt,
|
|
1351
1361
|
ut,
|
|
1352
|
-
|
|
1362
|
+
yt,
|
|
1353
1363
|
pt
|
|
1354
1364
|
].flat(), Ft = [
|
|
1355
1365
|
nt,
|
|
@@ -1358,16 +1368,16 @@ const qt = [
|
|
|
1358
1368
|
st
|
|
1359
1369
|
], Vt = [
|
|
1360
1370
|
me,
|
|
1361
|
-
|
|
1371
|
+
ye,
|
|
1362
1372
|
L,
|
|
1363
1373
|
ue,
|
|
1364
1374
|
Ne,
|
|
1365
1375
|
be,
|
|
1366
1376
|
ht,
|
|
1367
1377
|
gt,
|
|
1368
|
-
|
|
1378
|
+
kt,
|
|
1369
1379
|
Be,
|
|
1370
|
-
|
|
1380
|
+
Ae,
|
|
1371
1381
|
Oe,
|
|
1372
1382
|
Ke,
|
|
1373
1383
|
Te,
|
|
@@ -1384,7 +1394,7 @@ const qt = [
|
|
|
1384
1394
|
ge,
|
|
1385
1395
|
_e,
|
|
1386
1396
|
Re,
|
|
1387
|
-
|
|
1397
|
+
we,
|
|
1388
1398
|
pe,
|
|
1389
1399
|
te,
|
|
1390
1400
|
le,
|
|
@@ -1452,8 +1462,8 @@ function zt(t, e) {
|
|
|
1452
1462
|
if (m) {
|
|
1453
1463
|
const p = r(m, i, a);
|
|
1454
1464
|
if (p)
|
|
1455
|
-
for (let
|
|
1456
|
-
const C = p[
|
|
1465
|
+
for (let y = 0, g = p.length; y < g; y++) {
|
|
1466
|
+
const C = p[y];
|
|
1457
1467
|
C && l.push(C);
|
|
1458
1468
|
}
|
|
1459
1469
|
}
|
|
@@ -1557,8 +1567,8 @@ const Mt = _((t) => new P({
|
|
|
1557
1567
|
if (s instanceof Tt) {
|
|
1558
1568
|
let d = a.tr;
|
|
1559
1569
|
const { from: m, to: p } = s;
|
|
1560
|
-
return a.doc.nodesBetween(m, p, (
|
|
1561
|
-
|
|
1570
|
+
return a.doc.nodesBetween(m, p, (y, g) => {
|
|
1571
|
+
y.type === S.type(t) && (d = d.setNodeMarkup(g, S.type(t), void 0, []));
|
|
1562
1572
|
}), d;
|
|
1563
1573
|
}
|
|
1564
1574
|
}
|
|
@@ -1595,7 +1605,7 @@ n(bt, {
|
|
|
1595
1605
|
});
|
|
1596
1606
|
const Lt = _((t) => {
|
|
1597
1607
|
const e = new E("MILKDOWN_HEADING_ID"), r = (a) => {
|
|
1598
|
-
if (a.composing
|
|
1608
|
+
if (a.composing)
|
|
1599
1609
|
return;
|
|
1600
1610
|
const o = t.get(j.key), s = a.state.tr.setMeta("addToHistory", !1);
|
|
1601
1611
|
let l = !1;
|
|
@@ -1628,16 +1638,16 @@ const xt = _((t) => {
|
|
|
1628
1638
|
const e = (r) => {
|
|
1629
1639
|
if (r.composing || !r.editable)
|
|
1630
1640
|
return;
|
|
1631
|
-
const a = T.type(t), o = O.type(t), s = M.type(t), l = r.state, i = (p,
|
|
1641
|
+
const a = T.type(t), o = O.type(t), s = M.type(t), l = r.state, i = (p, y) => {
|
|
1632
1642
|
let g = !1;
|
|
1633
|
-
const C = `${
|
|
1643
|
+
const C = `${y + 1}.`;
|
|
1634
1644
|
return p.label !== C && (p.label = C, g = !0), g;
|
|
1635
1645
|
};
|
|
1636
1646
|
let d = l.tr, m = !1;
|
|
1637
|
-
l.doc.descendants((p,
|
|
1647
|
+
l.doc.descendants((p, y, g, C) => {
|
|
1638
1648
|
if (p.type === o) {
|
|
1639
|
-
const
|
|
1640
|
-
(
|
|
1649
|
+
const k = p.maybeChild(0);
|
|
1650
|
+
(k == null ? void 0 : k.type) === s && k.attrs.listType === "ordered" && (m = !0, d.setNodeMarkup(y, a, { spread: "true" }), p.descendants((b, Ge, Qt, St) => {
|
|
1641
1651
|
if (b.type === s) {
|
|
1642
1652
|
const je = { ...b.attrs };
|
|
1643
1653
|
i(je, St) && (d = d.setNodeMarkup(Ge, void 0, je));
|
|
@@ -1645,9 +1655,9 @@ const xt = _((t) => {
|
|
|
1645
1655
|
return !1;
|
|
1646
1656
|
}));
|
|
1647
1657
|
} else if (p.type === s && (g == null ? void 0 : g.type) === a) {
|
|
1648
|
-
const
|
|
1658
|
+
const k = { ...p.attrs };
|
|
1649
1659
|
let b = !1;
|
|
1650
|
-
|
|
1660
|
+
k.listType !== "ordered" && (k.listType = "ordered", b = !0), (g == null ? void 0 : g.maybeChild(0)) && (b = i(k, C)), b && (d = d.setNodeMarkup(y, void 0, k), m = !0);
|
|
1651
1661
|
}
|
|
1652
1662
|
}), m && r.dispatch(d.setMeta("addToHistory", !1));
|
|
1653
1663
|
};
|
|
@@ -1678,11 +1688,11 @@ const Jt = [
|
|
|
1678
1688
|
xt
|
|
1679
1689
|
].flat(), cr = [qt, Wt, Ft, Vt, Ut, Jt].flat();
|
|
1680
1690
|
export {
|
|
1681
|
-
|
|
1691
|
+
ke as blockquoteAttr,
|
|
1682
1692
|
he as blockquoteKeymap,
|
|
1683
1693
|
q as blockquoteSchema,
|
|
1684
1694
|
Se as bulletListAttr,
|
|
1685
|
-
|
|
1695
|
+
we as bulletListKeymap,
|
|
1686
1696
|
O as bulletListSchema,
|
|
1687
1697
|
fe as codeBlockAttr,
|
|
1688
1698
|
Ie as codeBlockKeymap,
|
|
@@ -1722,7 +1732,7 @@ export {
|
|
|
1722
1732
|
Wt as inputRules,
|
|
1723
1733
|
be as insertHardbreakCommand,
|
|
1724
1734
|
ht as insertHrCommand,
|
|
1725
|
-
|
|
1735
|
+
yt as insertHrInputRule,
|
|
1726
1736
|
gt as insertImageCommand,
|
|
1727
1737
|
Pt as insertImageInputRule,
|
|
1728
1738
|
Ut as keymap,
|
|
@@ -1739,7 +1749,7 @@ export {
|
|
|
1739
1749
|
T as orderedListSchema,
|
|
1740
1750
|
de as paragraphAttr,
|
|
1741
1751
|
pe as paragraphKeymap,
|
|
1742
|
-
|
|
1752
|
+
w as paragraphSchema,
|
|
1743
1753
|
Jt as plugins,
|
|
1744
1754
|
$e as remarkAddOrderInListPlugin,
|
|
1745
1755
|
Fe as remarkHtmlTransformer,
|
|
@@ -1762,11 +1772,11 @@ export {
|
|
|
1762
1772
|
ae as toggleStrongCommand,
|
|
1763
1773
|
me as turnIntoTextCommand,
|
|
1764
1774
|
Et as updateCodeBlockLanguageCommand,
|
|
1765
|
-
|
|
1775
|
+
kt as updateImageCommand,
|
|
1766
1776
|
dt as updateLinkCommand,
|
|
1767
|
-
|
|
1777
|
+
ye as wrapInBlockquoteCommand,
|
|
1768
1778
|
ct as wrapInBlockquoteInputRule,
|
|
1769
|
-
|
|
1779
|
+
Ae as wrapInBulletListCommand,
|
|
1770
1780
|
ft as wrapInBulletListInputRule,
|
|
1771
1781
|
L as wrapInHeadingCommand,
|
|
1772
1782
|
pt as wrapInHeadingInputRule,
|