@milkdown/preset-commonmark 7.3.0 → 7.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__internal__/serialize-text.d.ts +1 -1
- package/lib/__internal__/serialize-text.d.ts.map +1 -1
- package/lib/__internal__/with-meta.d.ts +1 -1
- package/lib/__internal__/with-meta.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.es.js +106 -63
- package/lib/index.es.js.map +1 -1
- package/lib/mark/link.d.ts +2 -2
- package/lib/mark/link.d.ts.map +1 -1
- package/lib/node/hardbreak.d.ts.map +1 -1
- package/lib/node/heading.d.ts +3 -1
- package/lib/node/heading.d.ts.map +1 -1
- package/lib/node/hr.d.ts.map +1 -1
- package/lib/node/image.d.ts +2 -2
- package/lib/node/image.d.ts.map +1 -1
- package/lib/node/list-item.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/context.d.ts +1 -1
- package/lib/plugin/inline-sync-plugin/context.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/regexp.d.ts +1 -1
- package/lib/plugin/inline-sync-plugin/regexp.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/replacer.d.ts +1 -1
- package/lib/plugin/inline-sync-plugin/replacer.d.ts.map +1 -1
- package/lib/plugin/inline-sync-plugin/utils.d.ts +6 -6
- package/lib/plugin/inline-sync-plugin/utils.d.ts.map +1 -1
- package/package.json +9 -9
- package/src/__internal__/serialize-text.ts +1 -1
- package/src/__internal__/with-meta.ts +1 -4
- package/src/composed/plugins.ts +2 -1
- package/src/composed/schema.ts +2 -1
- package/src/mark/link.ts +1 -1
- package/src/node/code-block.ts +1 -1
- package/src/node/hardbreak.ts +5 -2
- package/src/node/heading.ts +3 -2
- package/src/node/hr.ts +2 -1
- package/src/node/image.ts +1 -1
- package/src/node/list-item.ts +24 -22
- package/src/plugin/hardbreak-clear-mark-plugin.ts +1 -1
- package/src/plugin/inline-sync-plugin/config.ts +5 -5
- package/src/plugin/inline-sync-plugin/context.ts +7 -7
- package/src/plugin/inline-sync-plugin/regexp.ts +3 -2
- package/src/plugin/inline-sync-plugin/replacer.ts +1 -7
- package/src/plugin/inline-sync-plugin/utils.ts +24 -20
- package/src/plugin/remark-html-transformer.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { SerializerState } from '@milkdown/transformer';
|
|
2
2
|
import type { Node } from '@milkdown/prose/model';
|
|
3
|
-
export declare
|
|
3
|
+
export declare function serializeText(state: SerializerState, node: Node): void;
|
|
4
4
|
//# sourceMappingURL=serialize-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialize-text.d.ts","sourceRoot":"","sources":["../../src/__internal__/serialize-text.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAGjD,
|
|
1
|
+
{"version":3,"file":"serialize-text.d.ts","sourceRoot":"","sources":["../../src/__internal__/serialize-text.ts"],"names":[],"mappings":"AACA,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,3 +1,3 @@
|
|
|
1
1
|
import type { Meta, MilkdownPlugin } from '@milkdown/ctx';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function withMeta<T extends MilkdownPlugin>(plugin: T, meta: Partial<Meta> & Pick<Meta, 'displayName'>): T;
|
|
3
3
|
//# sourceMappingURL=with-meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-meta.d.ts","sourceRoot":"","sources":["../../src/__internal__/with-meta.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAEzD,
|
|
1
|
+
{"version":3,"file":"with-meta.d.ts","sourceRoot":"","sources":["../../src/__internal__/with-meta.ts"],"names":[],"mappings":"AACA,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":"plugins.d.ts","sourceRoot":"","sources":["../../src/composed/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../src/composed/plugins.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAkBnD,eAAO,MAAM,OAAO,EAAE,cAAc,EAkB5B,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composed/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/composed/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AA+BnD,eAAO,MAAM,MAAM,EAAE,cAAc,EAkD3B,CAAA"}
|
package/lib/index.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { $markAttr as V, $markSchema as j, $command as y, $useKeymap as N, $node as ot, $nodeAttr as I, $nodeSchema as C, $ctx as ne, $inputRule as w, pipe as Tt, $prose as O, $remark as
|
|
1
|
+
import { $markAttr as V, $markSchema as j, $command as y, $useKeymap as N, $node as ot, $nodeAttr as I, $nodeSchema as C, $ctx as ne, $inputRule as w, pipe as Tt, $prose as O, $remark as q } from "@milkdown/utils";
|
|
2
2
|
import { remarkStringifyOptionsCtx as st, commandsCtx as h, editorViewCtx as X, serializerCtx as Rt, parserCtx as Kt } from "@milkdown/core";
|
|
3
3
|
import { toggleMark as oe, setBlockType as E, wrapIn as se } from "@milkdown/prose/commands";
|
|
4
4
|
import { Fragment as Dt } from "@milkdown/prose/model";
|
|
5
5
|
import { expectDomTypeError as A } from "@milkdown/exception";
|
|
6
6
|
import { textblockTypeInputRule as lt, wrappingInputRule as le, InputRule as it } from "@milkdown/prose/inputrules";
|
|
7
7
|
import Pt from "@sindresorhus/slugify";
|
|
8
|
-
import { TextSelection as
|
|
8
|
+
import { TextSelection as $, Selection as ct, PluginKey as T, Plugin as R } from "@milkdown/prose/state";
|
|
9
9
|
import { findSelectedNodeOfType as _t } from "@milkdown/prose";
|
|
10
10
|
import { sinkListItem as Et, liftListItem as dt, splitListItem as $t } from "@milkdown/prose/schema-list";
|
|
11
11
|
import { ReplaceStep as qt, AddMarkStep as Wt } from "@milkdown/prose/transform";
|
|
12
12
|
import { Decoration as at, DecorationSet as nt } from "@milkdown/prose/view";
|
|
13
13
|
import { visit as ie } from "unist-util-visit";
|
|
14
14
|
import Ft from "remark-inline-links";
|
|
15
|
-
|
|
15
|
+
function mt(t, e) {
|
|
16
16
|
var o;
|
|
17
17
|
if (!(e.childCount >= 1 && ((o = e.lastChild) == null ? void 0 : o.type.name) === "hardbreak")) {
|
|
18
18
|
t.next(e.content);
|
|
@@ -22,12 +22,16 @@ const mt = (t, e) => {
|
|
|
22
22
|
e.content.forEach((s, i, l) => {
|
|
23
23
|
l !== e.childCount - 1 && a.push(s);
|
|
24
24
|
}), t.next(Dt.fromArray(a));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
}
|
|
26
|
+
function n(t, e) {
|
|
27
|
+
return Object.assign(t, {
|
|
28
|
+
meta: {
|
|
29
|
+
package: "@milkdown/preset-commonmark",
|
|
30
|
+
...e
|
|
31
|
+
}
|
|
32
|
+
}), t;
|
|
33
|
+
}
|
|
34
|
+
const ce = V("emphasis");
|
|
31
35
|
n(ce, {
|
|
32
36
|
displayName: "Attr<emphasis>",
|
|
33
37
|
group: "Emphasis"
|
|
@@ -275,7 +279,7 @@ const pt = y("UpdateLink", (t) => (e = {}) => (r, a) => {
|
|
|
275
279
|
return !1;
|
|
276
280
|
const m = s, g = s + o.nodeSize, { tr: u } = r, k = B.type(t).create({ ...d.attrs, ...e });
|
|
277
281
|
return k ? (a(
|
|
278
|
-
u.removeMark(m, g, d).addMark(m, g, k).setSelection(new
|
|
282
|
+
u.removeMark(m, g, d).addMark(m, g, k).setSelection(new $(u.selection.$anchor)).scrollIntoView()
|
|
279
283
|
), !0) : !1;
|
|
280
284
|
});
|
|
281
285
|
n(pt, {
|
|
@@ -354,7 +358,11 @@ n(Ce.shortcuts, {
|
|
|
354
358
|
displayName: "Keymap<paragraph>",
|
|
355
359
|
group: "Paragraph"
|
|
356
360
|
});
|
|
357
|
-
const Gt = Array(6).fill(0).map((t, e) => e + 1)
|
|
361
|
+
const Gt = Array(6).fill(0).map((t, e) => e + 1);
|
|
362
|
+
function Vt(t) {
|
|
363
|
+
return Pt(t.textContent);
|
|
364
|
+
}
|
|
365
|
+
const Y = ne(Vt, "headingIdGenerator");
|
|
358
366
|
n(Y, {
|
|
359
367
|
displayName: "Ctx<HeadingIdGenerator>",
|
|
360
368
|
group: "Heading"
|
|
@@ -515,7 +523,7 @@ n(xe, {
|
|
|
515
523
|
displayName: "Attr<blockquote>",
|
|
516
524
|
group: "Blockquote"
|
|
517
525
|
});
|
|
518
|
-
const
|
|
526
|
+
const W = C("blockquote", (t) => ({
|
|
519
527
|
content: "block+",
|
|
520
528
|
group: "block",
|
|
521
529
|
defining: !0,
|
|
@@ -534,20 +542,20 @@ const q = C("blockquote", (t) => ({
|
|
|
534
542
|
}
|
|
535
543
|
}
|
|
536
544
|
}));
|
|
537
|
-
n(
|
|
545
|
+
n(W.node, {
|
|
538
546
|
displayName: "NodeSchema<blockquote>",
|
|
539
547
|
group: "Blockquote"
|
|
540
548
|
});
|
|
541
|
-
n(
|
|
549
|
+
n(W.ctx, {
|
|
542
550
|
displayName: "NodeSchemaCtx<blockquote>",
|
|
543
551
|
group: "Blockquote"
|
|
544
552
|
});
|
|
545
|
-
const ht = w((t) => le(/^\s*>\s$/,
|
|
553
|
+
const ht = w((t) => le(/^\s*>\s$/, W.type(t)));
|
|
546
554
|
n(ht, {
|
|
547
555
|
displayName: "InputRule<wrapInBlockquoteInputRule>",
|
|
548
556
|
group: "Blockquote"
|
|
549
557
|
});
|
|
550
|
-
const Se = y("WrapInBlockquote", (t) => () => se(
|
|
558
|
+
const Se = y("WrapInBlockquote", (t) => () => se(W.type(t)));
|
|
551
559
|
n(Se, {
|
|
552
560
|
displayName: "Command<wrapInBlockquoteCommand>",
|
|
553
561
|
group: "Blockquote"
|
|
@@ -577,7 +585,7 @@ n(Ae, {
|
|
|
577
585
|
displayName: "Attr<codeBlock>",
|
|
578
586
|
group: "CodeBlock"
|
|
579
587
|
});
|
|
580
|
-
const
|
|
588
|
+
const F = C("code_block", (t) => ({
|
|
581
589
|
content: "text*",
|
|
582
590
|
group: "block",
|
|
583
591
|
marks: "",
|
|
@@ -627,15 +635,15 @@ const W = C("code_block", (t) => ({
|
|
|
627
635
|
}
|
|
628
636
|
}
|
|
629
637
|
}));
|
|
630
|
-
n(
|
|
638
|
+
n(F.node, {
|
|
631
639
|
displayName: "NodeSchema<codeBlock>",
|
|
632
640
|
group: "CodeBlock"
|
|
633
641
|
});
|
|
634
|
-
n(
|
|
642
|
+
n(F.ctx, {
|
|
635
643
|
displayName: "NodeSchemaCtx<codeBlock>",
|
|
636
644
|
group: "CodeBlock"
|
|
637
645
|
});
|
|
638
|
-
const kt = w((t) => lt(/^```(?<language>[a-z]*)?[\s\n]$/,
|
|
646
|
+
const kt = w((t) => lt(/^```(?<language>[a-z]*)?[\s\n]$/, F.type(t), (e) => {
|
|
639
647
|
var r;
|
|
640
648
|
return {
|
|
641
649
|
language: ((r = e.groups) == null ? void 0 : r.language) ?? ""
|
|
@@ -645,7 +653,7 @@ n(kt, {
|
|
|
645
653
|
displayName: "InputRule<createCodeBlockInputRule>",
|
|
646
654
|
group: "CodeBlock"
|
|
647
655
|
});
|
|
648
|
-
const ve = y("CreateCodeBlock", (t) => (e = "") => E(
|
|
656
|
+
const ve = y("CreateCodeBlock", (t) => (e = "") => E(F.type(t), { language: e }));
|
|
649
657
|
n(ve, {
|
|
650
658
|
displayName: "Command<createCodeBlockCommand>",
|
|
651
659
|
group: "CodeBlock"
|
|
@@ -814,6 +822,8 @@ n(S.ctx, {
|
|
|
814
822
|
const Te = y("InsertHardbreak", (t) => () => (e, r) => {
|
|
815
823
|
var s;
|
|
816
824
|
const { selection: a, tr: o } = e;
|
|
825
|
+
if (!(a instanceof $))
|
|
826
|
+
return !1;
|
|
817
827
|
if (a.empty) {
|
|
818
828
|
const i = a.$from.node();
|
|
819
829
|
if (i.childCount > 0 && ((s = i.lastChild) == null ? void 0 : s.type.name) === "hardbreak")
|
|
@@ -849,7 +859,7 @@ n(Ke, {
|
|
|
849
859
|
displayName: "Attr<hr>",
|
|
850
860
|
group: "Hr"
|
|
851
861
|
});
|
|
852
|
-
const
|
|
862
|
+
const G = C("hr", (t) => ({
|
|
853
863
|
group: "block",
|
|
854
864
|
parseDOM: [{ tag: "hr" }],
|
|
855
865
|
toDOM: (e) => ["hr", t.get(Ke.key)(e)],
|
|
@@ -866,11 +876,11 @@ const F = C("hr", (t) => ({
|
|
|
866
876
|
}
|
|
867
877
|
}
|
|
868
878
|
}));
|
|
869
|
-
n(
|
|
879
|
+
n(G.node, {
|
|
870
880
|
displayName: "NodeSchema<hr>",
|
|
871
881
|
group: "Hr"
|
|
872
882
|
});
|
|
873
|
-
n(
|
|
883
|
+
n(G.ctx, {
|
|
874
884
|
displayName: "NodeSchemaCtx<hr>",
|
|
875
885
|
group: "Hr"
|
|
876
886
|
});
|
|
@@ -878,7 +888,7 @@ const It = w((t) => new it(
|
|
|
878
888
|
/^(?:---|___\s|\*\*\*\s)$/,
|
|
879
889
|
(e, r, a, o) => {
|
|
880
890
|
const { tr: s } = e;
|
|
881
|
-
return r[0] && s.replaceWith(a - 1, o,
|
|
891
|
+
return r[0] && s.replaceWith(a - 1, o, G.type(t).create()), s;
|
|
882
892
|
}
|
|
883
893
|
));
|
|
884
894
|
n(It, {
|
|
@@ -888,7 +898,7 @@ n(It, {
|
|
|
888
898
|
const Ct = y("InsertHr", (t) => () => (e, r) => {
|
|
889
899
|
if (!r)
|
|
890
900
|
return !0;
|
|
891
|
-
const a = v.node.type(t).create(), { tr: o, selection: s } = e, { from: i } = s, l =
|
|
901
|
+
const a = v.node.type(t).create(), { tr: o, selection: s } = e, { from: i } = s, l = G.type(t).create();
|
|
892
902
|
if (!l)
|
|
893
903
|
return !0;
|
|
894
904
|
const c = o.replaceSelectionWith(l).insert(i, a), d = ct.findFrom(c.doc.resolve(i), 1, !0);
|
|
@@ -1153,16 +1163,19 @@ n(Ve, {
|
|
|
1153
1163
|
displayName: "Command<splitListItemCommand>",
|
|
1154
1164
|
group: "ListItem"
|
|
1155
1165
|
});
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
+
function Ut(t) {
|
|
1167
|
+
return (e, r, a) => {
|
|
1168
|
+
const { selection: o } = e;
|
|
1169
|
+
if (!(o instanceof $))
|
|
1170
|
+
return !1;
|
|
1171
|
+
const { empty: s, $from: i } = o;
|
|
1172
|
+
if (!s || i.parentOffset !== 0)
|
|
1173
|
+
return !1;
|
|
1174
|
+
const l = i.node(-1);
|
|
1175
|
+
return l.type !== M.type(t) || l.firstChild !== i.node() || i.node(-2).childCount > 1 ? !1 : dt(M.type(t))(e, r, a);
|
|
1176
|
+
};
|
|
1177
|
+
}
|
|
1178
|
+
const je = y("LiftFirstListItem", (t) => () => Ut(t));
|
|
1166
1179
|
n(je, {
|
|
1167
1180
|
displayName: "Command<liftFirstListItemCommand>",
|
|
1168
1181
|
group: "ListItem"
|
|
@@ -1283,11 +1296,11 @@ const Yt = [
|
|
|
1283
1296
|
Oe,
|
|
1284
1297
|
S,
|
|
1285
1298
|
xe,
|
|
1286
|
-
q,
|
|
1287
|
-
Ae,
|
|
1288
1299
|
W,
|
|
1289
|
-
|
|
1300
|
+
Ae,
|
|
1290
1301
|
F,
|
|
1302
|
+
Ke,
|
|
1303
|
+
G,
|
|
1291
1304
|
Be,
|
|
1292
1305
|
K,
|
|
1293
1306
|
De,
|
|
@@ -1347,20 +1360,36 @@ const Yt = [
|
|
|
1347
1360
|
me,
|
|
1348
1361
|
ke,
|
|
1349
1362
|
ge
|
|
1350
|
-
].flat(), Xt = /\[([^\]]+)]\([^\s\]]+\)/, Q = /\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)
|
|
1363
|
+
].flat(), Xt = /\[([^\]]+)]\([^\s\]]+\)/, Q = /\[(?<span>((www|https:\/\/|http:\/\/)[^\s\]]+))]\((?<url>[^\s\]]+)\)/;
|
|
1364
|
+
function er(t) {
|
|
1365
|
+
return new RegExp(`\\\\(?=[^\\w\\s${t}\\\\]|_)`, "g");
|
|
1366
|
+
}
|
|
1367
|
+
const Z = "", ee = `${Z}*`, te = `${Z}*`, re = `${Z}_`, ae = `${Z}⎽`;
|
|
1368
|
+
function tr(t) {
|
|
1351
1369
|
let e = t, r = e.match(Q);
|
|
1352
1370
|
for (; r && r.groups; ) {
|
|
1353
1371
|
const { span: a } = r.groups;
|
|
1354
1372
|
e = e.replace(Q, a), r = e.match(Q);
|
|
1355
1373
|
}
|
|
1356
1374
|
return e;
|
|
1357
|
-
}
|
|
1375
|
+
}
|
|
1376
|
+
function rr(t) {
|
|
1377
|
+
return t.replaceAll(/\\\\\*/g, ee).replaceAll(/\\\\_/g, re).replaceAll(ee, te).replaceAll(re, ae);
|
|
1378
|
+
}
|
|
1379
|
+
function ar(t, e, r) {
|
|
1358
1380
|
const a = t.split(""), o = a[e];
|
|
1359
1381
|
return a[e] && a[r] && (a[e] = a[r], a[r] = o), a.join("").toString();
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1362
|
-
return
|
|
1363
|
-
}
|
|
1382
|
+
}
|
|
1383
|
+
function nr(t) {
|
|
1384
|
+
return (e) => e.replace(er(t), "");
|
|
1385
|
+
}
|
|
1386
|
+
function or(t) {
|
|
1387
|
+
return (e) => {
|
|
1388
|
+
const r = e.indexOf(t.hole), a = e.charAt(r - 1), o = e.charAt(r + 1), s = /[^\w]|_/;
|
|
1389
|
+
return o ? a && s.test(a) && s.test(o) ? t.punctuation : t.char : t.punctuation;
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
function sr(t, e, r) {
|
|
1364
1393
|
let a = e, o = !1;
|
|
1365
1394
|
return t.descendants((s) => {
|
|
1366
1395
|
var i;
|
|
@@ -1375,7 +1404,8 @@ const Yt = [
|
|
|
1375
1404
|
}
|
|
1376
1405
|
return a += 1, !0;
|
|
1377
1406
|
}), a;
|
|
1378
|
-
}
|
|
1407
|
+
}
|
|
1408
|
+
const lr = {
|
|
1379
1409
|
placeholderConfig: {
|
|
1380
1410
|
hole: "∅",
|
|
1381
1411
|
punctuation: "⁂",
|
|
@@ -1395,10 +1425,14 @@ n(_, {
|
|
|
1395
1425
|
displayName: "Ctx<inlineSyncConfig>",
|
|
1396
1426
|
group: "Prose"
|
|
1397
1427
|
});
|
|
1398
|
-
|
|
1428
|
+
function ir(t) {
|
|
1429
|
+
return t.selection.$from.node();
|
|
1430
|
+
}
|
|
1431
|
+
function cr(t, e, r, a) {
|
|
1399
1432
|
const o = t.get(Rt), s = e.schema.topNodeType.create(void 0, [r, ...a]);
|
|
1400
1433
|
return o(s);
|
|
1401
|
-
}
|
|
1434
|
+
}
|
|
1435
|
+
function dr(t, e) {
|
|
1402
1436
|
const r = t.get(_.key), a = r.placeholderConfig.hole, [o = "", ...s] = e.split(`
|
|
1403
1437
|
|
|
1404
1438
|
`), i = (m) => r.movePlaceholder(a, m);
|
|
@@ -1407,18 +1441,25 @@ const ir = (t) => t.selection.$from.node(), cr = (t, e, r, a) => {
|
|
|
1407
1441
|
return c = c.replace(a, d), c = [c, ...s].join(`
|
|
1408
1442
|
|
|
1409
1443
|
`), [c, d];
|
|
1410
|
-
}
|
|
1444
|
+
}
|
|
1445
|
+
function mr(t, e) {
|
|
1411
1446
|
const a = t.get(Kt)(e);
|
|
1412
1447
|
return a ? a.firstChild : null;
|
|
1413
|
-
}
|
|
1448
|
+
}
|
|
1449
|
+
function ur(t, e) {
|
|
1414
1450
|
const { globalNodes: r } = t.get(_.key), a = [];
|
|
1415
1451
|
return e.doc.descendants((o) => {
|
|
1416
1452
|
if (r.includes(o.type.name) || r.includes(o.type))
|
|
1417
1453
|
return a.push(o), !1;
|
|
1418
1454
|
}), a;
|
|
1419
|
-
}
|
|
1455
|
+
}
|
|
1456
|
+
const pr = (t) => t.split(`
|
|
1420
1457
|
|
|
1421
|
-
`)[0] || ""
|
|
1458
|
+
`)[0] || "";
|
|
1459
|
+
function gr(t) {
|
|
1460
|
+
return t.childCount === 1 && t.child(0).type.name === "html";
|
|
1461
|
+
}
|
|
1462
|
+
function xt(t, e) {
|
|
1422
1463
|
try {
|
|
1423
1464
|
const r = ur(t, e), a = ir(e), o = cr(t, e, a, r), [s, i] = dr(t, o), l = mr(t, s);
|
|
1424
1465
|
return !l || a.type !== l.type || gr(l) ? null : (l.attrs = { ...a.attrs }, l.descendants((c) => {
|
|
@@ -1434,7 +1475,8 @@ const ir = (t) => t.selection.$from.node(), cr = (t, e, r, a) => {
|
|
|
1434
1475
|
} catch {
|
|
1435
1476
|
return null;
|
|
1436
1477
|
}
|
|
1437
|
-
}
|
|
1478
|
+
}
|
|
1479
|
+
function yr(t, e, r, a, o) {
|
|
1438
1480
|
var L;
|
|
1439
1481
|
const { placeholderConfig: s } = t.get(_.key), i = s.hole;
|
|
1440
1482
|
let l = r.tr.setMeta(e, !0).insertText(i, r.selection.from);
|
|
@@ -1442,10 +1484,11 @@ const ir = (t) => t.selection.$from.node(), cr = (t, e, r, a) => {
|
|
|
1442
1484
|
if (!d)
|
|
1443
1485
|
return;
|
|
1444
1486
|
const m = d.text.slice(0, d.text.indexOf(d.placeholder)), { $from: g } = c.selection, u = g.before(), k = g.after(), p = sr(d.nextNode, u, d.placeholder);
|
|
1445
|
-
l = l.replaceWith(u, k, d.nextNode).setNodeMarkup(u, void 0, o).delete(p + 1, p + 2), l = l.setSelection(
|
|
1487
|
+
l = l.replaceWith(u, k, d.nextNode).setNodeMarkup(u, void 0, o).delete(p + 1, p + 2), l = l.setSelection($.near(l.doc.resolve(p + 1))), (Xt.test(m) || ["*", "_", "~"].includes(m.at(-1) || "")) && l.selection instanceof $ && (((L = l.selection.$cursor) == null ? void 0 : L.marks()) ?? []).forEach((J) => {
|
|
1446
1488
|
l = l.removeStoredMark(J.type);
|
|
1447
1489
|
}), a(l);
|
|
1448
|
-
}
|
|
1490
|
+
}
|
|
1491
|
+
const St = O((t) => {
|
|
1449
1492
|
let e = null;
|
|
1450
1493
|
const r = new T("MILKDOWN_INLINE_SYNC");
|
|
1451
1494
|
return new R({
|
|
@@ -1475,7 +1518,7 @@ n(St, {
|
|
|
1475
1518
|
displayName: "Prose<inlineSyncPlugin>",
|
|
1476
1519
|
group: "Prose"
|
|
1477
1520
|
});
|
|
1478
|
-
const Ze =
|
|
1521
|
+
const Ze = q("remarkAddOrderInList", () => () => (t) => {
|
|
1479
1522
|
ie(t, "list", (e) => {
|
|
1480
1523
|
if (e.ordered) {
|
|
1481
1524
|
const r = e.start ?? 1;
|
|
@@ -1493,7 +1536,7 @@ n(Ze.options, {
|
|
|
1493
1536
|
displayName: "RemarkConfig<remarkAddOrderInListPlugin>",
|
|
1494
1537
|
group: "Remark"
|
|
1495
1538
|
});
|
|
1496
|
-
const Je =
|
|
1539
|
+
const Je = q("remarkLineBreak", () => () => (t) => {
|
|
1497
1540
|
const e = /[\t ]*(?:\r?\n|\r)/g;
|
|
1498
1541
|
ie(t, "text", (r, a, o) => {
|
|
1499
1542
|
if (!r.value || typeof r.value != "string")
|
|
@@ -1518,7 +1561,7 @@ n(Je.options, {
|
|
|
1518
1561
|
displayName: "RemarkConfig<remarkLineBreak>",
|
|
1519
1562
|
group: "Remark"
|
|
1520
1563
|
});
|
|
1521
|
-
const Qe =
|
|
1564
|
+
const Qe = q("remarkInlineLink", () => Ft);
|
|
1522
1565
|
n(Qe.plugin, {
|
|
1523
1566
|
displayName: "Remark<remarkInlineLinkPlugin>",
|
|
1524
1567
|
group: "Remark"
|
|
@@ -1549,7 +1592,7 @@ function fr(t, e) {
|
|
|
1549
1592
|
return e(a, o, s);
|
|
1550
1593
|
}
|
|
1551
1594
|
}
|
|
1552
|
-
const Xe =
|
|
1595
|
+
const Xe = q("remarkHTMLTransformer", () => () => (t) => {
|
|
1553
1596
|
fr(t, (e, r, a) => kr(e) ? ((a == null ? void 0 : a.type) === "root" && (e.children = [{ ...e }], delete e.value, e.type = "paragraph"), [e]) : [e]);
|
|
1554
1597
|
});
|
|
1555
1598
|
n(Xe.plugin, {
|
|
@@ -1560,7 +1603,7 @@ n(Xe.options, {
|
|
|
1560
1603
|
displayName: "RemarkConfig<remarkHtmlTransformer>",
|
|
1561
1604
|
group: "Remark"
|
|
1562
1605
|
});
|
|
1563
|
-
const et =
|
|
1606
|
+
const et = q("remarkMarker", () => () => (t, e) => {
|
|
1564
1607
|
const r = (a) => e.value.charAt(a.position.start.offset);
|
|
1565
1608
|
ie(t, (a) => ["strong", "emphasis"].includes(a.type), (a) => {
|
|
1566
1609
|
a.marker = r(a);
|
|
@@ -1768,13 +1811,13 @@ const Nr = [
|
|
|
1768
1811
|
export {
|
|
1769
1812
|
xe as blockquoteAttr,
|
|
1770
1813
|
we as blockquoteKeymap,
|
|
1771
|
-
|
|
1814
|
+
W as blockquoteSchema,
|
|
1772
1815
|
De as bulletListAttr,
|
|
1773
1816
|
_e as bulletListKeymap,
|
|
1774
1817
|
D as bulletListSchema,
|
|
1775
1818
|
Ae as codeBlockAttr,
|
|
1776
1819
|
He as codeBlockKeymap,
|
|
1777
|
-
|
|
1820
|
+
F as codeBlockSchema,
|
|
1778
1821
|
Jt as commands,
|
|
1779
1822
|
Kr as commonmark,
|
|
1780
1823
|
ve as createCodeBlockCommand,
|
|
@@ -1796,7 +1839,7 @@ export {
|
|
|
1796
1839
|
Le as headingKeymap,
|
|
1797
1840
|
H as headingSchema,
|
|
1798
1841
|
Ke as hrAttr,
|
|
1799
|
-
|
|
1842
|
+
G as hrSchema,
|
|
1800
1843
|
Ue as htmlAttr,
|
|
1801
1844
|
Ye as htmlSchema,
|
|
1802
1845
|
Be as imageAttr,
|