md-editor-v3 4.2.0-beta.1 → 4.2.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/cjs/MdEditor.cjs +5 -5
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +107 -109
- package/lib/es/index.mjs +14 -15
- package/lib/types/MdEditor/type.d.ts +1 -3
- package/lib/umd/index.js +28 -28
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -13,28 +13,27 @@ import { minimalSetup as xt, EditorView as re } from "codemirror";
|
|
|
13
13
|
import { EditorView as ge, placeholder as wt, keymap as Tt } from "@codemirror/view";
|
|
14
14
|
import { languages as St } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as At } from "@codemirror/lang-markdown";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Bt } from "@codemirror/language";
|
|
16
|
+
import { deleteLine as Mt, indentWithTab as Lt, undo as Dt, redo as Et } from "@codemirror/commands";
|
|
17
|
+
import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ht } from "@codemirror/language";
|
|
19
18
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as P, EditorState as se, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
19
|
+
import { EditorSelection as P, EditorState as se, Compartment as It, StateEffect as Bt } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as Ft } from "@codemirror/autocomplete";
|
|
22
21
|
import { g as He } from "./chunks/vue-tsx.mjs";
|
|
23
22
|
import Ye from "./MdCatalog.mjs";
|
|
24
|
-
import
|
|
23
|
+
import Ot from "./NormalToolbar.mjs";
|
|
25
24
|
import "medium-zoom";
|
|
26
25
|
import "copy-to-clipboard";
|
|
27
26
|
import "markdown-it";
|
|
28
27
|
import "markdown-it-image-figures";
|
|
29
28
|
import "markdown-it-task-lists";
|
|
30
29
|
import "lru-cache";
|
|
31
|
-
const
|
|
30
|
+
const Vt = /* @__PURE__ */ O({
|
|
32
31
|
setup() {
|
|
33
32
|
return () => t("div", {
|
|
34
33
|
class: `${n}-divider`
|
|
35
34
|
}, null);
|
|
36
35
|
}
|
|
37
|
-
}),
|
|
36
|
+
}), Rt = {
|
|
38
37
|
noPrettier: {
|
|
39
38
|
type: Boolean
|
|
40
39
|
},
|
|
@@ -75,7 +74,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
75
74
|
noUploadImg: {
|
|
76
75
|
type: Boolean
|
|
77
76
|
}
|
|
78
|
-
},
|
|
77
|
+
}, Pt = (e) => {
|
|
79
78
|
var f, u, d, v;
|
|
80
79
|
const o = A("editorId");
|
|
81
80
|
let a = (u = (f = W.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
|
|
@@ -106,7 +105,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
106
105
|
callback: i
|
|
107
106
|
});
|
|
108
107
|
}), { fullscreenHandler: i };
|
|
109
|
-
},
|
|
108
|
+
}, Nt = {
|
|
110
109
|
tableShape: {
|
|
111
110
|
type: Array,
|
|
112
111
|
default: () => [6, 4]
|
|
@@ -116,9 +115,9 @@ const Pt = /* @__PURE__ */ O({
|
|
|
116
115
|
default: () => {
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
},
|
|
118
|
+
}, qt = /* @__PURE__ */ O({
|
|
120
119
|
name: "TableShape",
|
|
121
|
-
props:
|
|
120
|
+
props: Nt,
|
|
122
121
|
setup(e) {
|
|
123
122
|
const o = Z({
|
|
124
123
|
x: -1,
|
|
@@ -145,7 +144,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
145
144
|
class: [`${n}-table-shape-col-default`, l <= o.x && i <= o.y && `${n}-table-shape-col-include`]
|
|
146
145
|
}, null)]))]))]);
|
|
147
146
|
}
|
|
148
|
-
}),
|
|
147
|
+
}), Ut = qt, Gt = {
|
|
149
148
|
type: {
|
|
150
149
|
type: String,
|
|
151
150
|
default: "link"
|
|
@@ -164,8 +163,8 @@ const Pt = /* @__PURE__ */ O({
|
|
|
164
163
|
default: () => {
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
|
-
},
|
|
168
|
-
props:
|
|
166
|
+
}, Kt = /* @__PURE__ */ O({
|
|
167
|
+
props: Gt,
|
|
169
168
|
setup(e) {
|
|
170
169
|
const o = A("usedLanguageText"), a = A("editorId"), l = fe(() => {
|
|
171
170
|
var i, c;
|
|
@@ -234,7 +233,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
234
233
|
}
|
|
235
234
|
});
|
|
236
235
|
}
|
|
237
|
-
}),
|
|
236
|
+
}), jt = {
|
|
238
237
|
visible: {
|
|
239
238
|
type: Boolean,
|
|
240
239
|
default: !1
|
|
@@ -249,8 +248,8 @@ const Pt = /* @__PURE__ */ O({
|
|
|
249
248
|
default: () => {
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
|
-
},
|
|
253
|
-
props:
|
|
251
|
+
}, _t = /* @__PURE__ */ O({
|
|
252
|
+
props: jt,
|
|
254
253
|
setup(e) {
|
|
255
254
|
var d, v, y;
|
|
256
255
|
const o = A("usedLanguageText"), a = A("editorId");
|
|
@@ -377,7 +376,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
377
376
|
});
|
|
378
377
|
};
|
|
379
378
|
}
|
|
380
|
-
}),
|
|
379
|
+
}), Wt = {
|
|
381
380
|
type: {
|
|
382
381
|
type: String,
|
|
383
382
|
default: "link"
|
|
@@ -400,27 +399,27 @@ const Pt = /* @__PURE__ */ O({
|
|
|
400
399
|
default: () => {
|
|
401
400
|
}
|
|
402
401
|
}
|
|
403
|
-
},
|
|
404
|
-
props:
|
|
402
|
+
}, zt = /* @__PURE__ */ O({
|
|
403
|
+
props: Wt,
|
|
405
404
|
setup(e) {
|
|
406
|
-
return () => t(Ke, null, [t(
|
|
405
|
+
return () => t(Ke, null, [t(Kt, {
|
|
407
406
|
type: e.type,
|
|
408
407
|
visible: e.linkVisible,
|
|
409
408
|
onOk: e.onOk,
|
|
410
409
|
onCancel: e.onCancel
|
|
411
|
-
}, null), t(
|
|
410
|
+
}, null), t(_t, {
|
|
412
411
|
visible: e.clipVisible,
|
|
413
412
|
onOk: e.onOk,
|
|
414
413
|
onCancel: e.onCancel
|
|
415
414
|
}, null)]);
|
|
416
415
|
}
|
|
417
|
-
}),
|
|
416
|
+
}), Yt = /* @__PURE__ */ O({
|
|
418
417
|
name: "MDEditorToolbar",
|
|
419
|
-
props:
|
|
418
|
+
props: Rt,
|
|
420
419
|
setup(e) {
|
|
421
420
|
const o = A("editorId"), a = A("usedLanguageText"), {
|
|
422
421
|
fullscreenHandler: l
|
|
423
|
-
} =
|
|
422
|
+
} = Pt(e), r = `${o}-toolbar-wrapper`, i = Z({
|
|
424
423
|
title: !1,
|
|
425
424
|
catalog: !1,
|
|
426
425
|
// 图片上传下拉
|
|
@@ -459,7 +458,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
459
458
|
if (tt.includes(b))
|
|
460
459
|
switch (b) {
|
|
461
460
|
case "-":
|
|
462
|
-
return t(
|
|
461
|
+
return t(Vt, null, null);
|
|
463
462
|
case "bold":
|
|
464
463
|
return t("div", {
|
|
465
464
|
class: `${n}-toolbar-item`,
|
|
@@ -747,7 +746,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
747
746
|
i.table = $;
|
|
748
747
|
},
|
|
749
748
|
key: "bar-table",
|
|
750
|
-
overlay: t(
|
|
749
|
+
overlay: t(Ut, {
|
|
751
750
|
tableShape: e.tableShape,
|
|
752
751
|
onSelected: ($) => {
|
|
753
752
|
c("table", {
|
|
@@ -1028,7 +1027,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1028
1027
|
style: {
|
|
1029
1028
|
display: "none"
|
|
1030
1029
|
}
|
|
1031
|
-
}, null), t(
|
|
1030
|
+
}, null), t(zt, {
|
|
1032
1031
|
linkVisible: m.linkVisible,
|
|
1033
1032
|
clipVisible: m.clipVisible,
|
|
1034
1033
|
type: m.type,
|
|
@@ -1044,7 +1043,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1044
1043
|
}, null)]);
|
|
1045
1044
|
};
|
|
1046
1045
|
}
|
|
1047
|
-
}),
|
|
1046
|
+
}), Zt = (e, o) => {
|
|
1048
1047
|
const a = rt(() => {
|
|
1049
1048
|
e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
|
|
1050
1049
|
}, 50), l = (r) => {
|
|
@@ -1067,7 +1066,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1067
1066
|
e.removeEventListener("scroll", l), o.removeEventListener("scroll", l);
|
|
1068
1067
|
}
|
|
1069
1068
|
];
|
|
1070
|
-
},
|
|
1069
|
+
}, Jt = (e, o, a) => {
|
|
1071
1070
|
const { view: l } = a, r = (v) => l.lineBlockAt(l.state.doc.line(v).from).top, i = (v) => l.lineBlockAt(l.state.doc.line(v).from).height;
|
|
1072
1071
|
let c = [];
|
|
1073
1072
|
const m = () => {
|
|
@@ -1170,7 +1169,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1170
1169
|
c = [], e.removeEventListener("scroll", d), o.removeEventListener("scroll", d);
|
|
1171
1170
|
}
|
|
1172
1171
|
];
|
|
1173
|
-
},
|
|
1172
|
+
}, Xt = (e, o, a) => {
|
|
1174
1173
|
const l = A("editorId");
|
|
1175
1174
|
let r = () => {
|
|
1176
1175
|
}, i = () => {
|
|
@@ -1182,7 +1181,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1182
1181
|
), u = document.querySelector(
|
|
1183
1182
|
`[id="${l}-html-wrapper"][data-show="true"]`
|
|
1184
1183
|
);
|
|
1185
|
-
(f || u) && ([i, r] = (f ?
|
|
1184
|
+
(f || u) && ([i, r] = (f ? Jt : Zt)(
|
|
1186
1185
|
m,
|
|
1187
1186
|
f || u,
|
|
1188
1187
|
a.value
|
|
@@ -1205,7 +1204,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1205
1204
|
m ? i() : r();
|
|
1206
1205
|
}
|
|
1207
1206
|
), z(c);
|
|
1208
|
-
},
|
|
1207
|
+
}, Qt = Xt, el = (e, o, a) => {
|
|
1209
1208
|
var d, v, y, b, p, g;
|
|
1210
1209
|
let l = "", r = 0, i = 0, c = !0, m = !1;
|
|
1211
1210
|
const f = o.getSelectedText(), u = (d = W.editorConfig) == null ? void 0 : d.mermaidTemplate;
|
|
@@ -1417,7 +1416,7 @@ $$
|
|
|
1417
1416
|
replaceAll: m
|
|
1418
1417
|
}
|
|
1419
1418
|
};
|
|
1420
|
-
},
|
|
1419
|
+
}, tl = "#e5c07b", Ie = "var(--md-color)", ll = "#56b6c2", ol = "#ffffff", le = "var(--md-color)", Be = "#e5c07b", al = "#e5c07b", nl = "var(--md-color)", Fe = "#d19a66", rl = "#c678dd", il = "#21252b", sl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", cl = "#ceedfa33", Ve = "#528bff", dl = ge.theme(
|
|
1421
1420
|
{
|
|
1422
1421
|
"&": {
|
|
1423
1422
|
color: le,
|
|
@@ -1427,8 +1426,8 @@ $$
|
|
|
1427
1426
|
caretColor: Ve
|
|
1428
1427
|
},
|
|
1429
1428
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Ve },
|
|
1430
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1431
|
-
".cm-panels": { backgroundColor:
|
|
1429
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: cl },
|
|
1430
|
+
".cm-panels": { backgroundColor: il, color: le },
|
|
1432
1431
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1433
1432
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1434
1433
|
".cm-searchMatch": {
|
|
@@ -1450,7 +1449,7 @@ $$
|
|
|
1450
1449
|
borderColor: "var(--md-border-color)"
|
|
1451
1450
|
},
|
|
1452
1451
|
".cm-activeLineGutter": {
|
|
1453
|
-
backgroundColor:
|
|
1452
|
+
backgroundColor: sl
|
|
1454
1453
|
},
|
|
1455
1454
|
".cm-foldPlaceholder": {
|
|
1456
1455
|
backgroundColor: "transparent",
|
|
@@ -1476,10 +1475,10 @@ $$
|
|
|
1476
1475
|
}
|
|
1477
1476
|
},
|
|
1478
1477
|
{ dark: !0 }
|
|
1479
|
-
),
|
|
1480
|
-
{ tag: s.keyword, color:
|
|
1478
|
+
), ul = We.define([
|
|
1479
|
+
{ tag: s.keyword, color: rl },
|
|
1481
1480
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Ie },
|
|
1482
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1481
|
+
{ tag: [s.function(s.variableName), s.labelName], color: al },
|
|
1483
1482
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Fe },
|
|
1484
1483
|
{ tag: [s.definition(s.name), s.separator], color: le },
|
|
1485
1484
|
{
|
|
@@ -1493,7 +1492,7 @@ $$
|
|
|
1493
1492
|
s.self,
|
|
1494
1493
|
s.namespace
|
|
1495
1494
|
],
|
|
1496
|
-
color:
|
|
1495
|
+
color: tl
|
|
1497
1496
|
},
|
|
1498
1497
|
{
|
|
1499
1498
|
tag: [
|
|
@@ -1505,7 +1504,7 @@ $$
|
|
|
1505
1504
|
s.link,
|
|
1506
1505
|
s.special(s.string)
|
|
1507
1506
|
],
|
|
1508
|
-
color:
|
|
1507
|
+
color: ll
|
|
1509
1508
|
},
|
|
1510
1509
|
{ tag: [s.meta, s.comment], color: Be },
|
|
1511
1510
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1514,12 +1513,12 @@ $$
|
|
|
1514
1513
|
{ tag: s.link, color: Be, textDecoration: "underline" },
|
|
1515
1514
|
{ tag: s.heading, fontWeight: "bold", color: Ie },
|
|
1516
1515
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Fe },
|
|
1517
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1518
|
-
{ tag: s.invalid, color:
|
|
1519
|
-
]),
|
|
1520
|
-
|
|
1521
|
-
ze(
|
|
1522
|
-
],
|
|
1516
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: nl },
|
|
1517
|
+
{ tag: s.invalid, color: ol }
|
|
1518
|
+
]), ml = [
|
|
1519
|
+
dl,
|
|
1520
|
+
ze(ul)
|
|
1521
|
+
], fl = "#e5c07b", Re = "#3f4a54", gl = "#56b6c2", hl = "#fff", oe = "#3f4a54", Pe = "#2d8cf0", bl = "#2d8cf0", vl = "#3f4a54", Ne = "#d19a66", pl = "#c678dd", kl = "#21252b", Cl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", $l = "#bad5fa", Ue = "#3f4a54", yl = ge.theme(
|
|
1523
1522
|
{
|
|
1524
1523
|
"&": {
|
|
1525
1524
|
color: oe,
|
|
@@ -1529,8 +1528,8 @@ $$
|
|
|
1529
1528
|
caretColor: Ue
|
|
1530
1529
|
},
|
|
1531
1530
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Ue },
|
|
1532
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1533
|
-
".cm-panels": { backgroundColor:
|
|
1531
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: $l },
|
|
1532
|
+
".cm-panels": { backgroundColor: kl, color: oe },
|
|
1534
1533
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1535
1534
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1536
1535
|
".cm-searchMatch": {
|
|
@@ -1552,7 +1551,7 @@ $$
|
|
|
1552
1551
|
borderColor: "var(--md-border-color)"
|
|
1553
1552
|
},
|
|
1554
1553
|
".cm-activeLineGutter": {
|
|
1555
|
-
backgroundColor:
|
|
1554
|
+
backgroundColor: Cl
|
|
1556
1555
|
},
|
|
1557
1556
|
".cm-foldPlaceholder": {
|
|
1558
1557
|
backgroundColor: "transparent",
|
|
@@ -1578,10 +1577,10 @@ $$
|
|
|
1578
1577
|
}
|
|
1579
1578
|
}
|
|
1580
1579
|
// { dark: true }
|
|
1581
|
-
),
|
|
1582
|
-
{ tag: s.keyword, color:
|
|
1580
|
+
), xl = We.define([
|
|
1581
|
+
{ tag: s.keyword, color: pl },
|
|
1583
1582
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Re },
|
|
1584
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1583
|
+
{ tag: [s.function(s.variableName), s.labelName], color: bl },
|
|
1585
1584
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ne },
|
|
1586
1585
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1587
1586
|
{
|
|
@@ -1595,7 +1594,7 @@ $$
|
|
|
1595
1594
|
s.self,
|
|
1596
1595
|
s.namespace
|
|
1597
1596
|
],
|
|
1598
|
-
color:
|
|
1597
|
+
color: fl
|
|
1599
1598
|
},
|
|
1600
1599
|
{
|
|
1601
1600
|
tag: [
|
|
@@ -1607,7 +1606,7 @@ $$
|
|
|
1607
1606
|
s.link,
|
|
1608
1607
|
s.special(s.string)
|
|
1609
1608
|
],
|
|
1610
|
-
color:
|
|
1609
|
+
color: gl
|
|
1611
1610
|
},
|
|
1612
1611
|
{ tag: [s.meta, s.comment], color: Pe },
|
|
1613
1612
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1616,11 +1615,11 @@ $$
|
|
|
1616
1615
|
{ tag: s.link, color: Pe, textDecoration: "underline" },
|
|
1617
1616
|
{ tag: s.heading, fontWeight: "bold", color: Re },
|
|
1618
1617
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Ne },
|
|
1619
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1620
|
-
{ tag: s.invalid, color:
|
|
1621
|
-
]),
|
|
1622
|
-
|
|
1623
|
-
ze(
|
|
1618
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: vl },
|
|
1619
|
+
{ tag: s.invalid, color: hl }
|
|
1620
|
+
]), wl = [
|
|
1621
|
+
yl,
|
|
1622
|
+
ze(xl)
|
|
1624
1623
|
], ie = (e, o, a, l, r) => (i, c, m, f) => {
|
|
1625
1624
|
const u = `${e}${o}`.slice(f - m);
|
|
1626
1625
|
i.dispatch(i.state.replaceSelection(`${u}${a}${l}`));
|
|
@@ -1640,7 +1639,7 @@ $$
|
|
|
1640
1639
|
}, Ge = (e) => (o, a, l, r) => {
|
|
1641
1640
|
const i = e.slice(r - l);
|
|
1642
1641
|
o.dispatch(o.state.replaceSelection(`${i} `));
|
|
1643
|
-
},
|
|
1642
|
+
}, Tl = (e) => {
|
|
1644
1643
|
const o = (a) => {
|
|
1645
1644
|
const l = a.matchBefore(
|
|
1646
1645
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1736,16 +1735,16 @@ $$`, "title")
|
|
|
1736
1735
|
]
|
|
1737
1736
|
};
|
|
1738
1737
|
};
|
|
1739
|
-
return
|
|
1740
|
-
override: e ? [o,
|
|
1738
|
+
return Ft({
|
|
1739
|
+
override: e ? [o, ...e] : [o]
|
|
1741
1740
|
});
|
|
1742
|
-
},
|
|
1743
|
-
const o = new
|
|
1741
|
+
}, Sl = Tl, Y = (e) => {
|
|
1742
|
+
const o = new It();
|
|
1744
1743
|
return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
|
|
1745
|
-
effects:
|
|
1744
|
+
effects: Bt.appendConfig.of(o.of(l))
|
|
1746
1745
|
}), !0);
|
|
1747
1746
|
};
|
|
1748
|
-
class
|
|
1747
|
+
class Al {
|
|
1749
1748
|
constructor(o) {
|
|
1750
1749
|
U(this, "view");
|
|
1751
1750
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -1829,7 +1828,7 @@ class Ll {
|
|
|
1829
1828
|
setTabSize(o) {
|
|
1830
1829
|
this.toggleTabSize([
|
|
1831
1830
|
se.tabSize.of(o),
|
|
1832
|
-
|
|
1831
|
+
Ht.of(" ".repeat(o))
|
|
1833
1832
|
]);
|
|
1834
1833
|
}
|
|
1835
1834
|
/**
|
|
@@ -1874,7 +1873,7 @@ class Ll {
|
|
|
1874
1873
|
]);
|
|
1875
1874
|
}
|
|
1876
1875
|
}
|
|
1877
|
-
const
|
|
1876
|
+
const Ml = (e) => {
|
|
1878
1877
|
const o = A("editorId");
|
|
1879
1878
|
return (l) => {
|
|
1880
1879
|
if (l.clipboardData) {
|
|
@@ -1895,7 +1894,7 @@ const Dl = (e) => {
|
|
|
1895
1894
|
}
|
|
1896
1895
|
}
|
|
1897
1896
|
};
|
|
1898
|
-
},
|
|
1897
|
+
}, Ll = Ml, Dl = (e) => {
|
|
1899
1898
|
const o = A("editorId");
|
|
1900
1899
|
z(() => {
|
|
1901
1900
|
h.on(o, {
|
|
@@ -1906,7 +1905,7 @@ const Dl = (e) => {
|
|
|
1906
1905
|
}
|
|
1907
1906
|
});
|
|
1908
1907
|
});
|
|
1909
|
-
},
|
|
1908
|
+
}, El = Dl, Hl = (e, o) => [
|
|
1910
1909
|
{
|
|
1911
1910
|
key: "Ctrl-b",
|
|
1912
1911
|
mac: "Cmd-b",
|
|
@@ -1915,7 +1914,7 @@ const Dl = (e) => {
|
|
|
1915
1914
|
{
|
|
1916
1915
|
key: "Ctrl-d",
|
|
1917
1916
|
mac: "Cmd-d",
|
|
1918
|
-
run:
|
|
1917
|
+
run: Mt,
|
|
1919
1918
|
preventDefault: !0
|
|
1920
1919
|
},
|
|
1921
1920
|
{
|
|
@@ -2002,11 +2001,10 @@ const Dl = (e) => {
|
|
|
2002
2001
|
{
|
|
2003
2002
|
any: (M, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
|
|
2004
2003
|
}
|
|
2005
|
-
],
|
|
2006
|
-
const o = A("tabWidth"), a = A("editorId"), l = A("theme"), r = G(), i = Xe(), c =
|
|
2007
|
-
Tt.of([...c,
|
|
2004
|
+
], Il = Hl, Bl = (e) => {
|
|
2005
|
+
const o = A("tabWidth"), a = A("editorId"), l = A("theme"), r = G(), i = Xe(), c = Il(a, e), m = Ll(e), f = [
|
|
2006
|
+
Tt.of([...c, Lt]),
|
|
2008
2007
|
xt,
|
|
2009
|
-
Lt(),
|
|
2010
2008
|
At({ codeLanguages: St }),
|
|
2011
2009
|
// 横向换行
|
|
2012
2010
|
re.lineWrapping,
|
|
@@ -2021,8 +2019,8 @@ const Dl = (e) => {
|
|
|
2021
2019
|
], u = () => {
|
|
2022
2020
|
const d = [
|
|
2023
2021
|
...f,
|
|
2024
|
-
l.value === "light" ?
|
|
2025
|
-
|
|
2022
|
+
l.value === "light" ? wl : ml,
|
|
2023
|
+
Sl(e.completions)
|
|
2026
2024
|
];
|
|
2027
2025
|
return W.codeMirrorExtensions(l.value, d, [
|
|
2028
2026
|
...c
|
|
@@ -2032,24 +2030,24 @@ const Dl = (e) => {
|
|
|
2032
2030
|
const d = new re({
|
|
2033
2031
|
doc: e.value,
|
|
2034
2032
|
parent: r.value
|
|
2035
|
-
}), v = new
|
|
2033
|
+
}), v = new Al(d);
|
|
2036
2034
|
i.value = v, setTimeout(() => {
|
|
2037
2035
|
v.setTabSize(o), v.setDisabled(e.disabled), v.setReadOnly(e.readonly), v.setExtensions(u()), e.placeholder && v.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && v.setMaxLength(e.maxlength), e.autofocus && d.focus();
|
|
2038
2036
|
}, 0), h.on(a, {
|
|
2039
2037
|
name: "ctrlZ",
|
|
2040
2038
|
callback() {
|
|
2041
|
-
|
|
2039
|
+
Dt(d);
|
|
2042
2040
|
}
|
|
2043
2041
|
}), h.on(a, {
|
|
2044
2042
|
name: "ctrlShiftZ",
|
|
2045
2043
|
callback() {
|
|
2046
|
-
|
|
2044
|
+
Et(d);
|
|
2047
2045
|
}
|
|
2048
2046
|
}), h.on(a, {
|
|
2049
2047
|
name: "replace",
|
|
2050
2048
|
callback(y, b = {}) {
|
|
2051
2049
|
var k;
|
|
2052
|
-
const { text: p, options: g } =
|
|
2050
|
+
const { text: p, options: g } = el(y, i.value, b);
|
|
2053
2051
|
(k = i.value) == null || k.replaceSelectedText(p, g);
|
|
2054
2052
|
}
|
|
2055
2053
|
});
|
|
@@ -2092,11 +2090,11 @@ const Dl = (e) => {
|
|
|
2092
2090
|
var d;
|
|
2093
2091
|
e.maxlength && ((d = i.value) == null || d.setMaxLength(e.maxlength));
|
|
2094
2092
|
}
|
|
2095
|
-
),
|
|
2093
|
+
), El(i), {
|
|
2096
2094
|
inputWrapperRef: r,
|
|
2097
2095
|
codeMirrorUt: i
|
|
2098
2096
|
};
|
|
2099
|
-
},
|
|
2097
|
+
}, Fl = Bl, Ol = {
|
|
2100
2098
|
value: {
|
|
2101
2099
|
type: String,
|
|
2102
2100
|
default: ""
|
|
@@ -2189,15 +2187,15 @@ const Dl = (e) => {
|
|
|
2189
2187
|
completions: {
|
|
2190
2188
|
type: Array
|
|
2191
2189
|
}
|
|
2192
|
-
},
|
|
2190
|
+
}, Vl = /* @__PURE__ */ O({
|
|
2193
2191
|
name: "MDEditorContent",
|
|
2194
|
-
props:
|
|
2192
|
+
props: Ol,
|
|
2195
2193
|
setup(e) {
|
|
2196
2194
|
const o = G(""), {
|
|
2197
2195
|
inputWrapperRef: a,
|
|
2198
2196
|
codeMirrorUt: l
|
|
2199
|
-
} =
|
|
2200
|
-
return
|
|
2197
|
+
} = Fl(e);
|
|
2198
|
+
return Qt(e, o, l), () => t("div", {
|
|
2201
2199
|
class: `${n}-content`
|
|
2202
2200
|
}, [t("div", {
|
|
2203
2201
|
class: `${n}-input-wrapper`,
|
|
@@ -2217,7 +2215,7 @@ const Dl = (e) => {
|
|
|
2217
2215
|
noHighlight: e.noHighlight
|
|
2218
2216
|
}, null)]);
|
|
2219
2217
|
}
|
|
2220
|
-
}),
|
|
2218
|
+
}), Rl = /* @__PURE__ */ O({
|
|
2221
2219
|
props: {
|
|
2222
2220
|
modelValue: {
|
|
2223
2221
|
type: String,
|
|
@@ -2235,7 +2233,7 @@ const Dl = (e) => {
|
|
|
2235
2233
|
}, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
|
|
2236
2234
|
};
|
|
2237
2235
|
}
|
|
2238
|
-
}),
|
|
2236
|
+
}), Pl = {
|
|
2239
2237
|
checked: {
|
|
2240
2238
|
type: Boolean,
|
|
2241
2239
|
default: !1
|
|
@@ -2245,8 +2243,8 @@ const Dl = (e) => {
|
|
|
2245
2243
|
default: () => {
|
|
2246
2244
|
}
|
|
2247
2245
|
}
|
|
2248
|
-
},
|
|
2249
|
-
props:
|
|
2246
|
+
}, Nl = /* @__PURE__ */ O({
|
|
2247
|
+
props: Pl,
|
|
2250
2248
|
setup(e) {
|
|
2251
2249
|
return () => t("div", {
|
|
2252
2250
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2255,7 +2253,7 @@ const Dl = (e) => {
|
|
|
2255
2253
|
}
|
|
2256
2254
|
}, null);
|
|
2257
2255
|
}
|
|
2258
|
-
}),
|
|
2256
|
+
}), ql = {
|
|
2259
2257
|
scrollAuto: {
|
|
2260
2258
|
type: Boolean
|
|
2261
2259
|
},
|
|
@@ -2264,8 +2262,8 @@ const Dl = (e) => {
|
|
|
2264
2262
|
default: () => {
|
|
2265
2263
|
}
|
|
2266
2264
|
}
|
|
2267
|
-
},
|
|
2268
|
-
props:
|
|
2265
|
+
}, Ul = /* @__PURE__ */ O({
|
|
2266
|
+
props: ql,
|
|
2269
2267
|
setup(e) {
|
|
2270
2268
|
const o = A("usedLanguageText");
|
|
2271
2269
|
return () => {
|
|
@@ -2277,13 +2275,13 @@ const Dl = (e) => {
|
|
|
2277
2275
|
onClick: () => {
|
|
2278
2276
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2279
2277
|
}
|
|
2280
|
-
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(
|
|
2278
|
+
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Nl, {
|
|
2281
2279
|
checked: e.scrollAuto,
|
|
2282
2280
|
onChange: e.onScrollAutoChange
|
|
2283
2281
|
}, null)]);
|
|
2284
2282
|
};
|
|
2285
2283
|
}
|
|
2286
|
-
}),
|
|
2284
|
+
}), Gl = {
|
|
2287
2285
|
modelValue: {
|
|
2288
2286
|
type: String,
|
|
2289
2287
|
default: ""
|
|
@@ -2303,9 +2301,9 @@ const Dl = (e) => {
|
|
|
2303
2301
|
defFooters: {
|
|
2304
2302
|
type: Object
|
|
2305
2303
|
}
|
|
2306
|
-
},
|
|
2304
|
+
}, Kl = /* @__PURE__ */ O({
|
|
2307
2305
|
name: "MDEditorFooter",
|
|
2308
|
-
props:
|
|
2306
|
+
props: Gl,
|
|
2309
2307
|
setup(e) {
|
|
2310
2308
|
const o = fe(() => {
|
|
2311
2309
|
const l = e.footers.indexOf("="), r = l === -1 ? e.footers : e.footers.slice(0, l), i = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
|
|
@@ -2314,11 +2312,11 @@ const Dl = (e) => {
|
|
|
2314
2312
|
if (lt.includes(l))
|
|
2315
2313
|
switch (l) {
|
|
2316
2314
|
case "markdownTotal":
|
|
2317
|
-
return t(
|
|
2315
|
+
return t(Rl, {
|
|
2318
2316
|
modelValue: e.modelValue
|
|
2319
2317
|
}, null);
|
|
2320
2318
|
case "scrollSwitch":
|
|
2321
|
-
return t(
|
|
2319
|
+
return t(Ul, {
|
|
2322
2320
|
scrollAuto: e.scrollAuto,
|
|
2323
2321
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2324
2322
|
}, null);
|
|
@@ -2337,7 +2335,7 @@ const Dl = (e) => {
|
|
|
2337
2335
|
}, [r])]);
|
|
2338
2336
|
};
|
|
2339
2337
|
}
|
|
2340
|
-
}),
|
|
2338
|
+
}), jl = /* @__PURE__ */ O({
|
|
2341
2339
|
name: "MdEditorV3",
|
|
2342
2340
|
props: mt,
|
|
2343
2341
|
emits: ft,
|
|
@@ -2369,7 +2367,7 @@ const Dl = (e) => {
|
|
|
2369
2367
|
id: a,
|
|
2370
2368
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2371
2369
|
style: e.style
|
|
2372
|
-
}, [t(
|
|
2370
|
+
}, [t(Yt, {
|
|
2373
2371
|
noPrettier: i,
|
|
2374
2372
|
toolbars: e.toolbars,
|
|
2375
2373
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2378,7 +2376,7 @@ const Dl = (e) => {
|
|
|
2378
2376
|
tableShape: e.tableShape,
|
|
2379
2377
|
defToolbars: y,
|
|
2380
2378
|
noUploadImg: c
|
|
2381
|
-
}, null), t(
|
|
2379
|
+
}, null), t(Vl, {
|
|
2382
2380
|
value: e.modelValue,
|
|
2383
2381
|
setting: u,
|
|
2384
2382
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2411,7 +2409,7 @@ const Dl = (e) => {
|
|
|
2411
2409
|
e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
|
|
2412
2410
|
},
|
|
2413
2411
|
completions: e.completions
|
|
2414
|
-
}, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(
|
|
2412
|
+
}, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(Kl, {
|
|
2415
2413
|
modelValue: e.modelValue,
|
|
2416
2414
|
footers: e.footers,
|
|
2417
2415
|
defFooters: b,
|
|
@@ -2426,8 +2424,8 @@ const Dl = (e) => {
|
|
|
2426
2424
|
}, null)]);
|
|
2427
2425
|
};
|
|
2428
2426
|
}
|
|
2429
|
-
}), ue =
|
|
2430
|
-
ue.install = (e) => (e.component(ue.name, ue), e.use(
|
|
2427
|
+
}), ue = jl;
|
|
2428
|
+
ue.install = (e) => (e.component(ue.name, ue), e.use(Ot).use(ot).use(yt).use(Ye).use(Ct), e);
|
|
2431
2429
|
export {
|
|
2432
2430
|
ue as default
|
|
2433
2431
|
};
|