md-editor-v3 4.2.0-beta.0 → 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/README.md +13 -8
- package/lib/cjs/MdEditor.cjs +5 -5
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +109 -110
- 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实例需要相同
|
|
@@ -1817,8 +1816,9 @@ class Ll {
|
|
|
1817
1816
|
],
|
|
1818
1817
|
1
|
|
1819
1818
|
)
|
|
1820
|
-
})
|
|
1819
|
+
});
|
|
1821
1820
|
}
|
|
1821
|
+
this.view.focus();
|
|
1822
1822
|
}
|
|
1823
1823
|
/**
|
|
1824
1824
|
* 设置tabSize
|
|
@@ -1828,7 +1828,7 @@ class Ll {
|
|
|
1828
1828
|
setTabSize(o) {
|
|
1829
1829
|
this.toggleTabSize([
|
|
1830
1830
|
se.tabSize.of(o),
|
|
1831
|
-
|
|
1831
|
+
Ht.of(" ".repeat(o))
|
|
1832
1832
|
]);
|
|
1833
1833
|
}
|
|
1834
1834
|
/**
|
|
@@ -1873,7 +1873,7 @@ class Ll {
|
|
|
1873
1873
|
]);
|
|
1874
1874
|
}
|
|
1875
1875
|
}
|
|
1876
|
-
const
|
|
1876
|
+
const Ml = (e) => {
|
|
1877
1877
|
const o = A("editorId");
|
|
1878
1878
|
return (l) => {
|
|
1879
1879
|
if (l.clipboardData) {
|
|
@@ -1894,7 +1894,7 @@ const Dl = (e) => {
|
|
|
1894
1894
|
}
|
|
1895
1895
|
}
|
|
1896
1896
|
};
|
|
1897
|
-
},
|
|
1897
|
+
}, Ll = Ml, Dl = (e) => {
|
|
1898
1898
|
const o = A("editorId");
|
|
1899
1899
|
z(() => {
|
|
1900
1900
|
h.on(o, {
|
|
@@ -1905,7 +1905,7 @@ const Dl = (e) => {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
});
|
|
1907
1907
|
});
|
|
1908
|
-
},
|
|
1908
|
+
}, El = Dl, Hl = (e, o) => [
|
|
1909
1909
|
{
|
|
1910
1910
|
key: "Ctrl-b",
|
|
1911
1911
|
mac: "Cmd-b",
|
|
@@ -1914,7 +1914,7 @@ const Dl = (e) => {
|
|
|
1914
1914
|
{
|
|
1915
1915
|
key: "Ctrl-d",
|
|
1916
1916
|
mac: "Cmd-d",
|
|
1917
|
-
run:
|
|
1917
|
+
run: Mt,
|
|
1918
1918
|
preventDefault: !0
|
|
1919
1919
|
},
|
|
1920
1920
|
{
|
|
@@ -2001,11 +2001,10 @@ const Dl = (e) => {
|
|
|
2001
2001
|
{
|
|
2002
2002
|
any: (M, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
|
|
2003
2003
|
}
|
|
2004
|
-
],
|
|
2005
|
-
const o = A("tabWidth"), a = A("editorId"), l = A("theme"), r = G(), i = Xe(), c =
|
|
2006
|
-
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]),
|
|
2007
2007
|
xt,
|
|
2008
|
-
Lt(),
|
|
2009
2008
|
At({ codeLanguages: St }),
|
|
2010
2009
|
// 横向换行
|
|
2011
2010
|
re.lineWrapping,
|
|
@@ -2020,8 +2019,8 @@ const Dl = (e) => {
|
|
|
2020
2019
|
], u = () => {
|
|
2021
2020
|
const d = [
|
|
2022
2021
|
...f,
|
|
2023
|
-
l.value === "light" ?
|
|
2024
|
-
|
|
2022
|
+
l.value === "light" ? wl : ml,
|
|
2023
|
+
Sl(e.completions)
|
|
2025
2024
|
];
|
|
2026
2025
|
return W.codeMirrorExtensions(l.value, d, [
|
|
2027
2026
|
...c
|
|
@@ -2031,24 +2030,24 @@ const Dl = (e) => {
|
|
|
2031
2030
|
const d = new re({
|
|
2032
2031
|
doc: e.value,
|
|
2033
2032
|
parent: r.value
|
|
2034
|
-
}), v = new
|
|
2033
|
+
}), v = new Al(d);
|
|
2035
2034
|
i.value = v, setTimeout(() => {
|
|
2036
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();
|
|
2037
2036
|
}, 0), h.on(a, {
|
|
2038
2037
|
name: "ctrlZ",
|
|
2039
2038
|
callback() {
|
|
2040
|
-
|
|
2039
|
+
Dt(d);
|
|
2041
2040
|
}
|
|
2042
2041
|
}), h.on(a, {
|
|
2043
2042
|
name: "ctrlShiftZ",
|
|
2044
2043
|
callback() {
|
|
2045
|
-
|
|
2044
|
+
Et(d);
|
|
2046
2045
|
}
|
|
2047
2046
|
}), h.on(a, {
|
|
2048
2047
|
name: "replace",
|
|
2049
2048
|
callback(y, b = {}) {
|
|
2050
2049
|
var k;
|
|
2051
|
-
const { text: p, options: g } =
|
|
2050
|
+
const { text: p, options: g } = el(y, i.value, b);
|
|
2052
2051
|
(k = i.value) == null || k.replaceSelectedText(p, g);
|
|
2053
2052
|
}
|
|
2054
2053
|
});
|
|
@@ -2091,11 +2090,11 @@ const Dl = (e) => {
|
|
|
2091
2090
|
var d;
|
|
2092
2091
|
e.maxlength && ((d = i.value) == null || d.setMaxLength(e.maxlength));
|
|
2093
2092
|
}
|
|
2094
|
-
),
|
|
2093
|
+
), El(i), {
|
|
2095
2094
|
inputWrapperRef: r,
|
|
2096
2095
|
codeMirrorUt: i
|
|
2097
2096
|
};
|
|
2098
|
-
},
|
|
2097
|
+
}, Fl = Bl, Ol = {
|
|
2099
2098
|
value: {
|
|
2100
2099
|
type: String,
|
|
2101
2100
|
default: ""
|
|
@@ -2188,15 +2187,15 @@ const Dl = (e) => {
|
|
|
2188
2187
|
completions: {
|
|
2189
2188
|
type: Array
|
|
2190
2189
|
}
|
|
2191
|
-
},
|
|
2190
|
+
}, Vl = /* @__PURE__ */ O({
|
|
2192
2191
|
name: "MDEditorContent",
|
|
2193
|
-
props:
|
|
2192
|
+
props: Ol,
|
|
2194
2193
|
setup(e) {
|
|
2195
2194
|
const o = G(""), {
|
|
2196
2195
|
inputWrapperRef: a,
|
|
2197
2196
|
codeMirrorUt: l
|
|
2198
|
-
} =
|
|
2199
|
-
return
|
|
2197
|
+
} = Fl(e);
|
|
2198
|
+
return Qt(e, o, l), () => t("div", {
|
|
2200
2199
|
class: `${n}-content`
|
|
2201
2200
|
}, [t("div", {
|
|
2202
2201
|
class: `${n}-input-wrapper`,
|
|
@@ -2216,7 +2215,7 @@ const Dl = (e) => {
|
|
|
2216
2215
|
noHighlight: e.noHighlight
|
|
2217
2216
|
}, null)]);
|
|
2218
2217
|
}
|
|
2219
|
-
}),
|
|
2218
|
+
}), Rl = /* @__PURE__ */ O({
|
|
2220
2219
|
props: {
|
|
2221
2220
|
modelValue: {
|
|
2222
2221
|
type: String,
|
|
@@ -2234,7 +2233,7 @@ const Dl = (e) => {
|
|
|
2234
2233
|
}, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
|
|
2235
2234
|
};
|
|
2236
2235
|
}
|
|
2237
|
-
}),
|
|
2236
|
+
}), Pl = {
|
|
2238
2237
|
checked: {
|
|
2239
2238
|
type: Boolean,
|
|
2240
2239
|
default: !1
|
|
@@ -2244,8 +2243,8 @@ const Dl = (e) => {
|
|
|
2244
2243
|
default: () => {
|
|
2245
2244
|
}
|
|
2246
2245
|
}
|
|
2247
|
-
},
|
|
2248
|
-
props:
|
|
2246
|
+
}, Nl = /* @__PURE__ */ O({
|
|
2247
|
+
props: Pl,
|
|
2249
2248
|
setup(e) {
|
|
2250
2249
|
return () => t("div", {
|
|
2251
2250
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2254,7 +2253,7 @@ const Dl = (e) => {
|
|
|
2254
2253
|
}
|
|
2255
2254
|
}, null);
|
|
2256
2255
|
}
|
|
2257
|
-
}),
|
|
2256
|
+
}), ql = {
|
|
2258
2257
|
scrollAuto: {
|
|
2259
2258
|
type: Boolean
|
|
2260
2259
|
},
|
|
@@ -2263,8 +2262,8 @@ const Dl = (e) => {
|
|
|
2263
2262
|
default: () => {
|
|
2264
2263
|
}
|
|
2265
2264
|
}
|
|
2266
|
-
},
|
|
2267
|
-
props:
|
|
2265
|
+
}, Ul = /* @__PURE__ */ O({
|
|
2266
|
+
props: ql,
|
|
2268
2267
|
setup(e) {
|
|
2269
2268
|
const o = A("usedLanguageText");
|
|
2270
2269
|
return () => {
|
|
@@ -2276,13 +2275,13 @@ const Dl = (e) => {
|
|
|
2276
2275
|
onClick: () => {
|
|
2277
2276
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2278
2277
|
}
|
|
2279
|
-
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(
|
|
2278
|
+
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Nl, {
|
|
2280
2279
|
checked: e.scrollAuto,
|
|
2281
2280
|
onChange: e.onScrollAutoChange
|
|
2282
2281
|
}, null)]);
|
|
2283
2282
|
};
|
|
2284
2283
|
}
|
|
2285
|
-
}),
|
|
2284
|
+
}), Gl = {
|
|
2286
2285
|
modelValue: {
|
|
2287
2286
|
type: String,
|
|
2288
2287
|
default: ""
|
|
@@ -2302,9 +2301,9 @@ const Dl = (e) => {
|
|
|
2302
2301
|
defFooters: {
|
|
2303
2302
|
type: Object
|
|
2304
2303
|
}
|
|
2305
|
-
},
|
|
2304
|
+
}, Kl = /* @__PURE__ */ O({
|
|
2306
2305
|
name: "MDEditorFooter",
|
|
2307
|
-
props:
|
|
2306
|
+
props: Gl,
|
|
2308
2307
|
setup(e) {
|
|
2309
2308
|
const o = fe(() => {
|
|
2310
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);
|
|
@@ -2313,11 +2312,11 @@ const Dl = (e) => {
|
|
|
2313
2312
|
if (lt.includes(l))
|
|
2314
2313
|
switch (l) {
|
|
2315
2314
|
case "markdownTotal":
|
|
2316
|
-
return t(
|
|
2315
|
+
return t(Rl, {
|
|
2317
2316
|
modelValue: e.modelValue
|
|
2318
2317
|
}, null);
|
|
2319
2318
|
case "scrollSwitch":
|
|
2320
|
-
return t(
|
|
2319
|
+
return t(Ul, {
|
|
2321
2320
|
scrollAuto: e.scrollAuto,
|
|
2322
2321
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2323
2322
|
}, null);
|
|
@@ -2336,7 +2335,7 @@ const Dl = (e) => {
|
|
|
2336
2335
|
}, [r])]);
|
|
2337
2336
|
};
|
|
2338
2337
|
}
|
|
2339
|
-
}),
|
|
2338
|
+
}), jl = /* @__PURE__ */ O({
|
|
2340
2339
|
name: "MdEditorV3",
|
|
2341
2340
|
props: mt,
|
|
2342
2341
|
emits: ft,
|
|
@@ -2368,7 +2367,7 @@ const Dl = (e) => {
|
|
|
2368
2367
|
id: a,
|
|
2369
2368
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2370
2369
|
style: e.style
|
|
2371
|
-
}, [t(
|
|
2370
|
+
}, [t(Yt, {
|
|
2372
2371
|
noPrettier: i,
|
|
2373
2372
|
toolbars: e.toolbars,
|
|
2374
2373
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2377,7 +2376,7 @@ const Dl = (e) => {
|
|
|
2377
2376
|
tableShape: e.tableShape,
|
|
2378
2377
|
defToolbars: y,
|
|
2379
2378
|
noUploadImg: c
|
|
2380
|
-
}, null), t(
|
|
2379
|
+
}, null), t(Vl, {
|
|
2381
2380
|
value: e.modelValue,
|
|
2382
2381
|
setting: u,
|
|
2383
2382
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2410,7 +2409,7 @@ const Dl = (e) => {
|
|
|
2410
2409
|
e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
|
|
2411
2410
|
},
|
|
2412
2411
|
completions: e.completions
|
|
2413
|
-
}, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(
|
|
2412
|
+
}, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(Kl, {
|
|
2414
2413
|
modelValue: e.modelValue,
|
|
2415
2414
|
footers: e.footers,
|
|
2416
2415
|
defFooters: b,
|
|
@@ -2425,8 +2424,8 @@ const Dl = (e) => {
|
|
|
2425
2424
|
}, null)]);
|
|
2426
2425
|
};
|
|
2427
2426
|
}
|
|
2428
|
-
}), ue =
|
|
2429
|
-
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);
|
|
2430
2429
|
export {
|
|
2431
2430
|
ue as default
|
|
2432
2431
|
};
|