md-editor-v3 4.1.0-beta.1 → 4.1.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 +2 -2
- package/lib/cjs/MdEditor.cjs +3 -3
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +127 -129
- 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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ze = Object.defineProperty;
|
|
2
2
|
var Je = (e, o, a) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[o] = a;
|
|
3
3
|
var q = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
|
|
4
|
-
import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as
|
|
4
|
+
import { defineComponent as O, createVNode as t, inject as A, ref as U, onMounted as W, reactive as Z, computed as fe, watch as I, nextTick as me, Fragment as Ke, toRef as te, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
|
|
5
5
|
import { p as n, a as _, s as et, b as tt, d as lt } from "./chunks/config.mjs";
|
|
6
6
|
import { a as ee, D as ot } from "./chunks/index2.mjs";
|
|
7
7
|
import { b as h, a as at } from "./chunks/index4.mjs";
|
|
@@ -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 Ft } 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 Y, EditorState as se, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
19
|
+
import { EditorSelection as Y, EditorState as se, Compartment as Bt, StateEffect as Ft } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as It } 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 Nt = /* @__PURE__ */ O({
|
|
|
75
74
|
noUploadImg: {
|
|
76
75
|
type: Boolean
|
|
77
76
|
}
|
|
78
|
-
},
|
|
77
|
+
}, Nt = (e) => {
|
|
79
78
|
var f, u, d, p;
|
|
80
79
|
const o = A("editorId");
|
|
81
80
|
let a = (u = (f = _.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
|
|
@@ -106,7 +105,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
106
105
|
callback: r
|
|
107
106
|
});
|
|
108
107
|
}), { fullscreenHandler: r };
|
|
109
|
-
},
|
|
108
|
+
}, Pt = {
|
|
110
109
|
tableShape: {
|
|
111
110
|
type: Array,
|
|
112
111
|
default: () => [6, 4]
|
|
@@ -116,9 +115,9 @@ const Nt = /* @__PURE__ */ O({
|
|
|
116
115
|
default: () => {
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
},
|
|
118
|
+
}, qt = /* @__PURE__ */ O({
|
|
120
119
|
name: "TableShape",
|
|
121
|
-
props:
|
|
120
|
+
props: Pt,
|
|
122
121
|
setup(e) {
|
|
123
122
|
const o = Z({
|
|
124
123
|
x: -1,
|
|
@@ -145,7 +144,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
145
144
|
class: [`${n}-table-shape-col-default`, l <= o.x && r <= 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 Nt = /* @__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 r, c;
|
|
@@ -234,7 +233,7 @@ const Nt = /* @__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 Nt = /* @__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, p, $;
|
|
256
255
|
const o = A("usedLanguageText"), a = A("editorId");
|
|
@@ -377,7 +376,7 @@ const Nt = /* @__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 Nt = /* @__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
|
+
} = Nt(e), i = `${o}-toolbar-wrapper`, r = Z({
|
|
424
423
|
title: !1,
|
|
425
424
|
catalog: !1,
|
|
426
425
|
// 图片上传下拉
|
|
@@ -455,11 +454,11 @@ const Nt = /* @__PURE__ */ O({
|
|
|
455
454
|
d.value.addEventListener("change", p);
|
|
456
455
|
});
|
|
457
456
|
const $ = (b) => {
|
|
458
|
-
var v, g, y, x, T, w, M, k, S, R, L, D, V, B, E, G, N,
|
|
457
|
+
var v, g, y, x, T, w, M, k, S, R, L, D, V, B, E, G, N, ae, J, K, P, X, j, H, F, Q, ne, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
|
|
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`,
|
|
@@ -663,7 +662,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
663
662
|
case "code":
|
|
664
663
|
return t("div", {
|
|
665
664
|
class: `${n}-toolbar-item`,
|
|
666
|
-
title: (
|
|
665
|
+
title: (ae = a.value.toolbarTips) == null ? void 0 : ae.code,
|
|
667
666
|
onClick: () => {
|
|
668
667
|
c("code");
|
|
669
668
|
}
|
|
@@ -747,7 +746,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
747
746
|
r.table = C;
|
|
748
747
|
},
|
|
749
748
|
key: "bar-table",
|
|
750
|
-
overlay: t(
|
|
749
|
+
overlay: t(Ut, {
|
|
751
750
|
tableShape: e.tableShape,
|
|
752
751
|
onSelected: (C) => {
|
|
753
752
|
c("table", {
|
|
@@ -811,7 +810,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
811
810
|
case "prettier":
|
|
812
811
|
return e.noPrettier ? "" : t("div", {
|
|
813
812
|
class: `${n}-toolbar-item`,
|
|
814
|
-
title: (
|
|
813
|
+
title: (ne = a.value.toolbarTips) == null ? void 0 : ne.prettier,
|
|
815
814
|
onClick: () => {
|
|
816
815
|
c("prettier");
|
|
817
816
|
}
|
|
@@ -1028,7 +1027,7 @@ const Nt = /* @__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 Nt = /* @__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 = (i) => {
|
|
@@ -1067,7 +1066,7 @@ const Nt = /* @__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, i = (p) => l.lineBlockAt(l.state.doc.line(p).from).top, r = (p) => l.lineBlockAt(l.state.doc.line(p).from).height;
|
|
1072
1071
|
let c = [];
|
|
1073
1072
|
const m = () => {
|
|
@@ -1138,8 +1137,8 @@ const Nt = /* @__PURE__ */ O({
|
|
|
1138
1137
|
D = k[H - 1];
|
|
1139
1138
|
continue;
|
|
1140
1139
|
}
|
|
1141
|
-
const
|
|
1142
|
-
if (Q <= S &&
|
|
1140
|
+
const ne = F.offsetTop;
|
|
1141
|
+
if (Q <= S && ne > S) {
|
|
1143
1142
|
V = D, B = F;
|
|
1144
1143
|
break;
|
|
1145
1144
|
}
|
|
@@ -1147,7 +1146,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
1147
1146
|
}
|
|
1148
1147
|
const E = V.offsetTop, G = B.offsetTop;
|
|
1149
1148
|
let N = 0;
|
|
1150
|
-
const { start:
|
|
1149
|
+
const { start: ae, end: J } = c[Number(V.dataset.line || 0)], K = i(ae);
|
|
1151
1150
|
let P = i(J);
|
|
1152
1151
|
const X = r(J);
|
|
1153
1152
|
let j = 0;
|
|
@@ -1170,7 +1169,7 @@ const Nt = /* @__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 i = () => {
|
|
1176
1175
|
}, r = () => {
|
|
@@ -1182,7 +1181,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
1182
1181
|
), u = document.querySelector(
|
|
1183
1182
|
`[id="${l}-html-wrapper"][data-show="true"]`
|
|
1184
1183
|
);
|
|
1185
|
-
(f || u) && ([r, i] = (f ?
|
|
1184
|
+
(f || u) && ([r, i] = (f ? Jt : Zt)(
|
|
1186
1185
|
m,
|
|
1187
1186
|
f || u,
|
|
1188
1187
|
a.value
|
|
@@ -1191,10 +1190,10 @@ const Nt = /* @__PURE__ */ O({
|
|
|
1191
1190
|
I(
|
|
1192
1191
|
[
|
|
1193
1192
|
o,
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1193
|
+
te(e.setting, "preview"),
|
|
1194
|
+
te(e.setting, "htmlPreview"),
|
|
1195
|
+
te(e.setting, "fullscreen"),
|
|
1196
|
+
te(e.setting, "pageFullscreen")
|
|
1198
1197
|
],
|
|
1199
1198
|
() => {
|
|
1200
1199
|
me(c);
|
|
@@ -1205,7 +1204,7 @@ const Nt = /* @__PURE__ */ O({
|
|
|
1205
1204
|
m ? r() : i();
|
|
1206
1205
|
}
|
|
1207
1206
|
), W(c);
|
|
1208
|
-
},
|
|
1207
|
+
}, Qt = Xt, el = (e, o, a) => {
|
|
1209
1208
|
var d, p, $, b, v, g;
|
|
1210
1209
|
let l = "", i = 0, r = 0, c = !0, m = !1;
|
|
1211
1210
|
const f = o.getSelectedText(), u = (d = _.editorConfig) == null ? void 0 : d.mermaidTemplate;
|
|
@@ -1417,18 +1416,18 @@ $$
|
|
|
1417
1416
|
replaceAll: m
|
|
1418
1417
|
}
|
|
1419
1418
|
};
|
|
1420
|
-
},
|
|
1419
|
+
}, tl = "#e5c07b", Be = "var(--md-color)", ll = "#56b6c2", ol = "#ffffff", le = "var(--md-color)", Fe = "#e5c07b", al = "#e5c07b", nl = "var(--md-color)", Ie = "#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
|
-
color:
|
|
1422
|
+
color: le,
|
|
1424
1423
|
backgroundColor: Oe
|
|
1425
1424
|
},
|
|
1426
1425
|
".cm-content": {
|
|
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": {
|
|
@@ -1445,12 +1444,12 @@ $$
|
|
|
1445
1444
|
},
|
|
1446
1445
|
".cm-gutters": {
|
|
1447
1446
|
backgroundColor: Oe,
|
|
1448
|
-
color:
|
|
1447
|
+
color: le,
|
|
1449
1448
|
borderRight: "1px solid",
|
|
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",
|
|
@@ -1471,17 +1470,17 @@ $$
|
|
|
1471
1470
|
},
|
|
1472
1471
|
".cm-tooltip-autocomplete": {
|
|
1473
1472
|
"& > ul > li[aria-selected]": {
|
|
1474
|
-
color:
|
|
1473
|
+
color: le
|
|
1475
1474
|
}
|
|
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: Be },
|
|
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: Ie },
|
|
1484
|
-
{ tag: [s.definition(s.name), s.separator], color:
|
|
1483
|
+
{ tag: [s.definition(s.name), s.separator], color: le },
|
|
1485
1484
|
{
|
|
1486
1485
|
tag: [
|
|
1487
1486
|
s.typeName,
|
|
@@ -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: Fe },
|
|
1511
1510
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1514,23 +1513,23 @@ $$
|
|
|
1514
1513
|
{ tag: s.link, color: Fe, textDecoration: "underline" },
|
|
1515
1514
|
{ tag: s.heading, fontWeight: "bold", color: Be },
|
|
1516
1515
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Ie },
|
|
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", Ne = "#2d8cf0", bl = "#2d8cf0", vl = "#3f4a54", Pe = "#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
|
-
color:
|
|
1524
|
+
color: oe,
|
|
1526
1525
|
backgroundColor: qe
|
|
1527
1526
|
},
|
|
1528
1527
|
".cm-content": {
|
|
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": {
|
|
@@ -1547,12 +1546,12 @@ $$
|
|
|
1547
1546
|
},
|
|
1548
1547
|
".cm-gutters": {
|
|
1549
1548
|
backgroundColor: qe,
|
|
1550
|
-
color:
|
|
1549
|
+
color: oe,
|
|
1551
1550
|
borderRight: "1px solid",
|
|
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",
|
|
@@ -1573,17 +1572,17 @@ $$
|
|
|
1573
1572
|
},
|
|
1574
1573
|
".cm-tooltip-autocomplete": {
|
|
1575
1574
|
"& > ul > li[aria-selected]": {
|
|
1576
|
-
color:
|
|
1575
|
+
color: oe
|
|
1577
1576
|
}
|
|
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: Pe },
|
|
1586
|
-
{ tag: [s.definition(s.name), s.separator], color:
|
|
1585
|
+
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1587
1586
|
{
|
|
1588
1587
|
tag: [
|
|
1589
1588
|
s.typeName,
|
|
@@ -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: Ne },
|
|
1613
1612
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1616,11 +1615,11 @@ $$
|
|
|
1616
1615
|
{ tag: s.link, color: Ne, textDecoration: "underline" },
|
|
1617
1616
|
{ tag: s.heading, fontWeight: "bold", color: Re },
|
|
1618
1617
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Pe },
|
|
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, i) => (r, c, m, f) => {
|
|
1625
1624
|
const u = `${e}${o}`.slice(f - m);
|
|
1626
1625
|
r.dispatch(r.state.replaceSelection(`${u}${a}${l}`));
|
|
@@ -1640,7 +1639,7 @@ $$
|
|
|
1640
1639
|
}, Ge = (e) => (o, a, l, i) => {
|
|
1641
1640
|
const r = e.slice(i - l);
|
|
1642
1641
|
o.dispatch(o.state.replaceSelection(`${r} `));
|
|
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 It({
|
|
1739
|
+
override: e ? [o, ...e] : [o]
|
|
1741
1740
|
});
|
|
1742
|
-
},
|
|
1743
|
-
const o = new
|
|
1741
|
+
}, Sl = Tl, z = (e) => {
|
|
1742
|
+
const o = new Bt();
|
|
1744
1743
|
return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
|
|
1745
|
-
effects:
|
|
1744
|
+
effects: Ft.appendConfig.of(o.of(l))
|
|
1746
1745
|
}), !0);
|
|
1747
1746
|
};
|
|
1748
|
-
class
|
|
1747
|
+
class Al {
|
|
1749
1748
|
constructor(o) {
|
|
1750
1749
|
q(this, "view");
|
|
1751
1750
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -1828,7 +1827,7 @@ class Ll {
|
|
|
1828
1827
|
setTabSize(o) {
|
|
1829
1828
|
this.toggleTabSize([
|
|
1830
1829
|
se.tabSize.of(o),
|
|
1831
|
-
|
|
1830
|
+
Ht.of(" ".repeat(o))
|
|
1832
1831
|
]);
|
|
1833
1832
|
}
|
|
1834
1833
|
/**
|
|
@@ -1854,7 +1853,7 @@ class Ll {
|
|
|
1854
1853
|
]);
|
|
1855
1854
|
}
|
|
1856
1855
|
}
|
|
1857
|
-
const
|
|
1856
|
+
const Ml = (e) => {
|
|
1858
1857
|
const o = A("editorId");
|
|
1859
1858
|
return (l) => {
|
|
1860
1859
|
if (l.clipboardData) {
|
|
@@ -1875,7 +1874,7 @@ const Dl = (e) => {
|
|
|
1875
1874
|
}
|
|
1876
1875
|
}
|
|
1877
1876
|
};
|
|
1878
|
-
},
|
|
1877
|
+
}, Ll = Ml, Dl = (e) => {
|
|
1879
1878
|
const o = A("editorId");
|
|
1880
1879
|
W(() => {
|
|
1881
1880
|
h.on(o, {
|
|
@@ -1886,7 +1885,7 @@ const Dl = (e) => {
|
|
|
1886
1885
|
}
|
|
1887
1886
|
});
|
|
1888
1887
|
});
|
|
1889
|
-
},
|
|
1888
|
+
}, El = Dl, Hl = (e, o) => [
|
|
1890
1889
|
{
|
|
1891
1890
|
key: "Ctrl-b",
|
|
1892
1891
|
mac: "Cmd-b",
|
|
@@ -1895,7 +1894,7 @@ const Dl = (e) => {
|
|
|
1895
1894
|
{
|
|
1896
1895
|
key: "Ctrl-d",
|
|
1897
1896
|
mac: "Cmd-d",
|
|
1898
|
-
run:
|
|
1897
|
+
run: Mt,
|
|
1899
1898
|
preventDefault: !0
|
|
1900
1899
|
},
|
|
1901
1900
|
{
|
|
@@ -1982,11 +1981,10 @@ const Dl = (e) => {
|
|
|
1982
1981
|
{
|
|
1983
1982
|
any: (M, k) => (k.ctrlKey || k.metaKey) && k.altKey && k.shiftKey && k.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
|
|
1984
1983
|
}
|
|
1985
|
-
],
|
|
1986
|
-
const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c =
|
|
1987
|
-
Tt.of([...c,
|
|
1984
|
+
], Bl = Hl, Fl = (e) => {
|
|
1985
|
+
const o = A("tabWidth"), a = A("editorId"), l = A("theme"), i = U(), r = Xe(), c = Bl(a, e), m = Ll(e), f = [
|
|
1986
|
+
Tt.of([...c, Lt]),
|
|
1988
1987
|
xt,
|
|
1989
|
-
Lt(),
|
|
1990
1988
|
At({ codeLanguages: St }),
|
|
1991
1989
|
// 横向换行
|
|
1992
1990
|
re.lineWrapping,
|
|
@@ -2001,8 +1999,8 @@ const Dl = (e) => {
|
|
|
2001
1999
|
], u = () => {
|
|
2002
2000
|
const d = [
|
|
2003
2001
|
...f,
|
|
2004
|
-
l.value === "light" ?
|
|
2005
|
-
|
|
2002
|
+
l.value === "light" ? wl : ml,
|
|
2003
|
+
Sl(e.completions)
|
|
2006
2004
|
];
|
|
2007
2005
|
return _.codeMirrorExtensions(l.value, d, [
|
|
2008
2006
|
...c
|
|
@@ -2013,26 +2011,26 @@ const Dl = (e) => {
|
|
|
2013
2011
|
doc: e.value,
|
|
2014
2012
|
parent: i.value
|
|
2015
2013
|
});
|
|
2016
|
-
r.value = new
|
|
2014
|
+
r.value = new Al(d), r.value.setTabSize(o), r.value.setExtensions(u()), r.value.setDisabled(e.disabled), r.value.setReadOnly(e.readonly), e.placeholder && r.value.setPlaceholder(e.placeholder), e.autofocus && d.focus(), e.maxlength && r.value.setMaxLength(e.maxlength), h.on(a, {
|
|
2017
2015
|
name: "ctrlZ",
|
|
2018
2016
|
callback() {
|
|
2019
|
-
|
|
2017
|
+
Dt(d);
|
|
2020
2018
|
}
|
|
2021
2019
|
}), h.on(a, {
|
|
2022
2020
|
name: "ctrlShiftZ",
|
|
2023
2021
|
callback() {
|
|
2024
|
-
|
|
2022
|
+
Et(d);
|
|
2025
2023
|
}
|
|
2026
2024
|
}), h.on(a, {
|
|
2027
2025
|
name: "replace",
|
|
2028
2026
|
callback(p, $ = {}) {
|
|
2029
2027
|
var g;
|
|
2030
|
-
const { text: b, options: v } =
|
|
2028
|
+
const { text: b, options: v } = el(p, r.value, $);
|
|
2031
2029
|
(g = r.value) == null || g.replaceSelectedText(b, v);
|
|
2032
2030
|
}
|
|
2033
2031
|
});
|
|
2034
2032
|
}), I(
|
|
2035
|
-
[
|
|
2033
|
+
[l, te(e, "completions")],
|
|
2036
2034
|
() => {
|
|
2037
2035
|
var d;
|
|
2038
2036
|
(d = r.value) == null || d.setExtensions(u());
|
|
@@ -2070,11 +2068,11 @@ const Dl = (e) => {
|
|
|
2070
2068
|
var d;
|
|
2071
2069
|
e.maxlength && ((d = r.value) == null || d.setMaxLength(e.maxlength));
|
|
2072
2070
|
}
|
|
2073
|
-
),
|
|
2071
|
+
), El(r), {
|
|
2074
2072
|
inputWrapperRef: i,
|
|
2075
2073
|
codeMirrorUt: r
|
|
2076
2074
|
};
|
|
2077
|
-
},
|
|
2075
|
+
}, Il = Fl, Ol = {
|
|
2078
2076
|
value: {
|
|
2079
2077
|
type: String,
|
|
2080
2078
|
default: ""
|
|
@@ -2167,15 +2165,15 @@ const Dl = (e) => {
|
|
|
2167
2165
|
completions: {
|
|
2168
2166
|
type: Array
|
|
2169
2167
|
}
|
|
2170
|
-
},
|
|
2168
|
+
}, Vl = /* @__PURE__ */ O({
|
|
2171
2169
|
name: "MDEditorContent",
|
|
2172
|
-
props:
|
|
2170
|
+
props: Ol,
|
|
2173
2171
|
setup(e) {
|
|
2174
2172
|
const o = U(""), {
|
|
2175
2173
|
inputWrapperRef: a,
|
|
2176
2174
|
codeMirrorUt: l
|
|
2177
|
-
} =
|
|
2178
|
-
return
|
|
2175
|
+
} = Il(e);
|
|
2176
|
+
return Qt(e, o, l), () => t("div", {
|
|
2179
2177
|
class: `${n}-content`
|
|
2180
2178
|
}, [t("div", {
|
|
2181
2179
|
class: `${n}-input-wrapper`,
|
|
@@ -2195,7 +2193,7 @@ const Dl = (e) => {
|
|
|
2195
2193
|
noHighlight: e.noHighlight
|
|
2196
2194
|
}, null)]);
|
|
2197
2195
|
}
|
|
2198
|
-
}),
|
|
2196
|
+
}), Rl = /* @__PURE__ */ O({
|
|
2199
2197
|
props: {
|
|
2200
2198
|
modelValue: {
|
|
2201
2199
|
type: String,
|
|
@@ -2213,7 +2211,7 @@ const Dl = (e) => {
|
|
|
2213
2211
|
}, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
|
|
2214
2212
|
};
|
|
2215
2213
|
}
|
|
2216
|
-
}),
|
|
2214
|
+
}), Nl = {
|
|
2217
2215
|
checked: {
|
|
2218
2216
|
type: Boolean,
|
|
2219
2217
|
default: !1
|
|
@@ -2223,8 +2221,8 @@ const Dl = (e) => {
|
|
|
2223
2221
|
default: () => {
|
|
2224
2222
|
}
|
|
2225
2223
|
}
|
|
2226
|
-
},
|
|
2227
|
-
props:
|
|
2224
|
+
}, Pl = /* @__PURE__ */ O({
|
|
2225
|
+
props: Nl,
|
|
2228
2226
|
setup(e) {
|
|
2229
2227
|
return () => t("div", {
|
|
2230
2228
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2233,7 +2231,7 @@ const Dl = (e) => {
|
|
|
2233
2231
|
}
|
|
2234
2232
|
}, null);
|
|
2235
2233
|
}
|
|
2236
|
-
}),
|
|
2234
|
+
}), ql = {
|
|
2237
2235
|
scrollAuto: {
|
|
2238
2236
|
type: Boolean
|
|
2239
2237
|
},
|
|
@@ -2242,8 +2240,8 @@ const Dl = (e) => {
|
|
|
2242
2240
|
default: () => {
|
|
2243
2241
|
}
|
|
2244
2242
|
}
|
|
2245
|
-
},
|
|
2246
|
-
props:
|
|
2243
|
+
}, Ul = /* @__PURE__ */ O({
|
|
2244
|
+
props: ql,
|
|
2247
2245
|
setup(e) {
|
|
2248
2246
|
const o = A("usedLanguageText");
|
|
2249
2247
|
return () => {
|
|
@@ -2255,13 +2253,13 @@ const Dl = (e) => {
|
|
|
2255
2253
|
onClick: () => {
|
|
2256
2254
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2257
2255
|
}
|
|
2258
|
-
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(
|
|
2256
|
+
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Pl, {
|
|
2259
2257
|
checked: e.scrollAuto,
|
|
2260
2258
|
onChange: e.onScrollAutoChange
|
|
2261
2259
|
}, null)]);
|
|
2262
2260
|
};
|
|
2263
2261
|
}
|
|
2264
|
-
}),
|
|
2262
|
+
}), Gl = {
|
|
2265
2263
|
modelValue: {
|
|
2266
2264
|
type: String,
|
|
2267
2265
|
default: ""
|
|
@@ -2281,9 +2279,9 @@ const Dl = (e) => {
|
|
|
2281
2279
|
defFooters: {
|
|
2282
2280
|
type: Object
|
|
2283
2281
|
}
|
|
2284
|
-
},
|
|
2282
|
+
}, Kl = /* @__PURE__ */ O({
|
|
2285
2283
|
name: "MDEditorFooter",
|
|
2286
|
-
props:
|
|
2284
|
+
props: Gl,
|
|
2287
2285
|
setup(e) {
|
|
2288
2286
|
const o = fe(() => {
|
|
2289
2287
|
const l = e.footers.indexOf("="), i = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
|
|
@@ -2292,11 +2290,11 @@ const Dl = (e) => {
|
|
|
2292
2290
|
if (lt.includes(l))
|
|
2293
2291
|
switch (l) {
|
|
2294
2292
|
case "markdownTotal":
|
|
2295
|
-
return t(
|
|
2293
|
+
return t(Rl, {
|
|
2296
2294
|
modelValue: e.modelValue
|
|
2297
2295
|
}, null);
|
|
2298
2296
|
case "scrollSwitch":
|
|
2299
|
-
return t(
|
|
2297
|
+
return t(Ul, {
|
|
2300
2298
|
scrollAuto: e.scrollAuto,
|
|
2301
2299
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2302
2300
|
}, null);
|
|
@@ -2315,7 +2313,7 @@ const Dl = (e) => {
|
|
|
2315
2313
|
}, [i])]);
|
|
2316
2314
|
};
|
|
2317
2315
|
}
|
|
2318
|
-
}),
|
|
2316
|
+
}), jl = /* @__PURE__ */ O({
|
|
2319
2317
|
name: "MdEditorV3",
|
|
2320
2318
|
props: mt,
|
|
2321
2319
|
emits: ft,
|
|
@@ -2347,7 +2345,7 @@ const Dl = (e) => {
|
|
|
2347
2345
|
id: a,
|
|
2348
2346
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2349
2347
|
style: e.style
|
|
2350
|
-
}, [t(
|
|
2348
|
+
}, [t(Yt, {
|
|
2351
2349
|
noPrettier: r,
|
|
2352
2350
|
toolbars: e.toolbars,
|
|
2353
2351
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2356,7 +2354,7 @@ const Dl = (e) => {
|
|
|
2356
2354
|
tableShape: e.tableShape,
|
|
2357
2355
|
defToolbars: $,
|
|
2358
2356
|
noUploadImg: c
|
|
2359
|
-
}, null), t(
|
|
2357
|
+
}, null), t(Vl, {
|
|
2360
2358
|
value: e.modelValue,
|
|
2361
2359
|
setting: u,
|
|
2362
2360
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2389,7 +2387,7 @@ const Dl = (e) => {
|
|
|
2389
2387
|
e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
|
|
2390
2388
|
},
|
|
2391
2389
|
completions: e.completions
|
|
2392
|
-
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(
|
|
2390
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(Kl, {
|
|
2393
2391
|
modelValue: e.modelValue,
|
|
2394
2392
|
footers: e.footers,
|
|
2395
2393
|
defFooters: b,
|
|
@@ -2404,8 +2402,8 @@ const Dl = (e) => {
|
|
|
2404
2402
|
}, null)]);
|
|
2405
2403
|
};
|
|
2406
2404
|
}
|
|
2407
|
-
}), ue =
|
|
2408
|
-
ue.install = (e) => (e.component(ue.name, ue), e.use(
|
|
2405
|
+
}), ue = jl;
|
|
2406
|
+
ue.install = (e) => (e.component(ue.name, ue), e.use(Ot).use(ot).use(yt).use(Ye).use(Ct), e);
|
|
2409
2407
|
export {
|
|
2410
2408
|
ue as default
|
|
2411
2409
|
};
|