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