md-editor-v3 4.5.0-beta.1 → 4.5.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 +3 -3
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +106 -108
- package/lib/es/index.mjs +16 -17
- 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,29 +13,28 @@ import { minimalSetup as el, EditorView as ue } from "codemirror";
|
|
|
13
13
|
import { EditorView as pe, placeholder as tl, keymap as ll } from "@codemirror/view";
|
|
14
14
|
import { languages as ol } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as al } from "@codemirror/lang-markdown";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { HighlightStyle as yt, syntaxHighlighting as Tt, indentUnit as dl } from "@codemirror/language";
|
|
16
|
+
import { deleteLine as nl, indentWithTab as rl, undo as il, redo as sl } from "@codemirror/commands";
|
|
17
|
+
import { HighlightStyle as yt, syntaxHighlighting as Tt, indentUnit as cl } from "@codemirror/language";
|
|
19
18
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as G, EditorState as fe, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
19
|
+
import { EditorSelection as G, EditorState as fe, Compartment as ul, StateEffect as dl } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as ml } from "@codemirror/autocomplete";
|
|
22
21
|
import wt from "./MdCatalog.mjs";
|
|
23
22
|
import { g as it } from "./chunks/vue-tsx.mjs";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
23
|
+
import gl from "./NormalToolbar.mjs";
|
|
24
|
+
import fl from "./ModalToolbar.mjs";
|
|
26
25
|
import "medium-zoom";
|
|
27
26
|
import "copy-to-clipboard";
|
|
28
27
|
import "markdown-it";
|
|
29
28
|
import "markdown-it-image-figures";
|
|
30
29
|
import "markdown-it-task-lists";
|
|
31
30
|
import "lru-cache";
|
|
32
|
-
const
|
|
31
|
+
const bl = /* @__PURE__ */ R({
|
|
33
32
|
setup() {
|
|
34
33
|
return () => t("div", {
|
|
35
34
|
class: `${n}-divider`
|
|
36
35
|
}, null);
|
|
37
36
|
}
|
|
38
|
-
}),
|
|
37
|
+
}), hl = {
|
|
39
38
|
noPrettier: {
|
|
40
39
|
type: Boolean
|
|
41
40
|
},
|
|
@@ -84,7 +83,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
84
83
|
showToolbarName: {
|
|
85
84
|
type: Boolean
|
|
86
85
|
}
|
|
87
|
-
},
|
|
86
|
+
}, vl = (e) => {
|
|
88
87
|
var c, g, m, h;
|
|
89
88
|
const o = L("editorId");
|
|
90
89
|
let l = (g = (c = X.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
|
|
@@ -115,7 +114,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
115
114
|
callback: i
|
|
116
115
|
});
|
|
117
116
|
}), { fullscreenHandler: i };
|
|
118
|
-
},
|
|
117
|
+
}, kl = {
|
|
119
118
|
tableShape: {
|
|
120
119
|
type: Array,
|
|
121
120
|
default: () => [6, 4]
|
|
@@ -125,9 +124,9 @@ const vl = /* @__PURE__ */ R({
|
|
|
125
124
|
default: () => {
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
},
|
|
127
|
+
}, pl = /* @__PURE__ */ R({
|
|
129
128
|
name: "TableShape",
|
|
130
|
-
props:
|
|
129
|
+
props: kl,
|
|
131
130
|
setup(e) {
|
|
132
131
|
const o = Q({
|
|
133
132
|
x: -1,
|
|
@@ -154,7 +153,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
154
153
|
class: [`${n}-table-shape-col-default`, a <= o.x && i <= o.y && `${n}-table-shape-col-include`]
|
|
155
154
|
}, null)]))]))]);
|
|
156
155
|
}
|
|
157
|
-
}),
|
|
156
|
+
}), Cl = pl, $l = {
|
|
158
157
|
type: {
|
|
159
158
|
type: String,
|
|
160
159
|
default: "link"
|
|
@@ -173,8 +172,8 @@ const vl = /* @__PURE__ */ R({
|
|
|
173
172
|
default: () => {
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
|
-
},
|
|
177
|
-
props:
|
|
175
|
+
}, yl = /* @__PURE__ */ R({
|
|
176
|
+
props: $l,
|
|
178
177
|
setup(e) {
|
|
179
178
|
const o = L("usedLanguageText"), l = L("editorId"), a = ke(() => {
|
|
180
179
|
var i, d;
|
|
@@ -243,7 +242,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
243
242
|
}
|
|
244
243
|
});
|
|
245
244
|
}
|
|
246
|
-
}),
|
|
245
|
+
}), Tl = {
|
|
247
246
|
visible: {
|
|
248
247
|
type: Boolean,
|
|
249
248
|
default: !1
|
|
@@ -258,8 +257,8 @@ const vl = /* @__PURE__ */ R({
|
|
|
258
257
|
default: () => {
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
},
|
|
262
|
-
props:
|
|
260
|
+
}, wl = /* @__PURE__ */ R({
|
|
261
|
+
props: Tl,
|
|
263
262
|
setup(e) {
|
|
264
263
|
var m, h, $;
|
|
265
264
|
const o = L("usedLanguageText"), l = L("editorId");
|
|
@@ -380,7 +379,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
380
379
|
});
|
|
381
380
|
};
|
|
382
381
|
}
|
|
383
|
-
}),
|
|
382
|
+
}), xl = {
|
|
384
383
|
type: {
|
|
385
384
|
type: String,
|
|
386
385
|
default: "link"
|
|
@@ -403,27 +402,27 @@ const vl = /* @__PURE__ */ R({
|
|
|
403
402
|
default: () => {
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
|
-
},
|
|
407
|
-
props:
|
|
405
|
+
}, Sl = /* @__PURE__ */ R({
|
|
406
|
+
props: xl,
|
|
408
407
|
setup(e) {
|
|
409
|
-
return () => t(pt, null, [t(
|
|
408
|
+
return () => t(pt, null, [t(yl, {
|
|
410
409
|
type: e.type,
|
|
411
410
|
visible: e.linkVisible,
|
|
412
411
|
onOk: e.onOk,
|
|
413
412
|
onCancel: e.onCancel
|
|
414
|
-
}, null), t(
|
|
413
|
+
}, null), t(wl, {
|
|
415
414
|
visible: e.clipVisible,
|
|
416
415
|
onOk: e.onOk,
|
|
417
416
|
onCancel: e.onCancel
|
|
418
417
|
}, null)]);
|
|
419
418
|
}
|
|
420
|
-
}),
|
|
419
|
+
}), Al = /* @__PURE__ */ R({
|
|
421
420
|
name: "MDEditorToolbar",
|
|
422
|
-
props:
|
|
421
|
+
props: hl,
|
|
423
422
|
setup(e) {
|
|
424
423
|
const o = L("editorId"), l = L("usedLanguageText"), {
|
|
425
424
|
fullscreenHandler: a
|
|
426
|
-
} =
|
|
425
|
+
} = vl(e), r = `${o}-toolbar-wrapper`, i = K(), d = Q({
|
|
427
426
|
title: !1,
|
|
428
427
|
catalog: !1,
|
|
429
428
|
// 图片上传下拉
|
|
@@ -462,7 +461,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
462
461
|
if (Lt.includes(v))
|
|
463
462
|
switch (v) {
|
|
464
463
|
case "-":
|
|
465
|
-
return t(
|
|
464
|
+
return t(bl, null, null);
|
|
466
465
|
case "bold":
|
|
467
466
|
return t("div", {
|
|
468
467
|
class: `${n}-toolbar-item`,
|
|
@@ -734,7 +733,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
734
733
|
d.table = p;
|
|
735
734
|
},
|
|
736
735
|
key: "bar-table",
|
|
737
|
-
overlay: t(
|
|
736
|
+
overlay: t(Cl, {
|
|
738
737
|
tableShape: e.tableShape,
|
|
739
738
|
onSelected: (p) => {
|
|
740
739
|
u("table", {
|
|
@@ -1027,7 +1026,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
1027
1026
|
style: {
|
|
1028
1027
|
display: "none"
|
|
1029
1028
|
}
|
|
1030
|
-
}, null), t(
|
|
1029
|
+
}, null), t(Sl, {
|
|
1031
1030
|
linkVisible: c.linkVisible,
|
|
1032
1031
|
clipVisible: c.clipVisible,
|
|
1033
1032
|
type: c.type,
|
|
@@ -1043,7 +1042,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
1043
1042
|
}, null)]);
|
|
1044
1043
|
};
|
|
1045
1044
|
}
|
|
1046
|
-
}),
|
|
1045
|
+
}), Ml = (e, o) => {
|
|
1047
1046
|
const l = Nt(() => {
|
|
1048
1047
|
e.removeEventListener("scroll", a), e.addEventListener("scroll", a), o.removeEventListener("scroll", a), o.addEventListener("scroll", a);
|
|
1049
1048
|
}, 50), a = (r) => {
|
|
@@ -1066,7 +1065,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
1066
1065
|
e.removeEventListener("scroll", a), o.removeEventListener("scroll", a);
|
|
1067
1066
|
}
|
|
1068
1067
|
];
|
|
1069
|
-
},
|
|
1068
|
+
}, Il = (e, o, l) => {
|
|
1070
1069
|
const { view: a } = l, r = (h) => a.lineBlockAt(a.state.doc.line(h).from).top, i = (h) => a.lineBlockAt(a.state.doc.line(h).from).height;
|
|
1071
1070
|
let d = [];
|
|
1072
1071
|
const u = () => {
|
|
@@ -1172,7 +1171,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
1172
1171
|
d = [], e.removeEventListener("scroll", m), o.removeEventListener("scroll", m);
|
|
1173
1172
|
}
|
|
1174
1173
|
];
|
|
1175
|
-
},
|
|
1174
|
+
}, Ll = (e, o, l) => {
|
|
1176
1175
|
const a = L("editorId");
|
|
1177
1176
|
let r = () => {
|
|
1178
1177
|
}, i = () => {
|
|
@@ -1184,7 +1183,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
1184
1183
|
), g = document.querySelector(
|
|
1185
1184
|
`[id="${a}-html-wrapper"][data-show="true"]`
|
|
1186
1185
|
);
|
|
1187
|
-
(c || g) && ([i, r] = (c ?
|
|
1186
|
+
(c || g) && ([i, r] = (c ? Il : Ml)(
|
|
1188
1187
|
u,
|
|
1189
1188
|
c || g,
|
|
1190
1189
|
l.value
|
|
@@ -1207,7 +1206,7 @@ const vl = /* @__PURE__ */ R({
|
|
|
1207
1206
|
u ? i() : r();
|
|
1208
1207
|
}
|
|
1209
1208
|
), Y(d);
|
|
1210
|
-
},
|
|
1209
|
+
}, Dl = Ll, El = (e, o, l) => {
|
|
1211
1210
|
var m, h, $, T, v, f;
|
|
1212
1211
|
let a = "", r = 0, i = 0, d = !0, u = !1;
|
|
1213
1212
|
const c = o.getSelectedText(), g = (m = X.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
@@ -1419,7 +1418,7 @@ $$
|
|
|
1419
1418
|
replaceAll: u
|
|
1420
1419
|
}
|
|
1421
1420
|
};
|
|
1422
|
-
},
|
|
1421
|
+
}, Hl = "#e5c07b", st = "var(--md-color)", Nl = "#56b6c2", Vl = "#ffffff", re = "var(--md-color)", ct = "#e5c07b", Ol = "#e5c07b", Bl = "var(--md-color)", ut = "#d19a66", Fl = "#c678dd", Rl = "#21252b", Pl = "#2c313a", dt = "var(--md-bk-color)", be = "var(--md-bk-color)", ql = "#ceedfa33", mt = "#528bff", Ul = pe.theme(
|
|
1423
1422
|
{
|
|
1424
1423
|
"&": {
|
|
1425
1424
|
color: re,
|
|
@@ -1429,8 +1428,8 @@ $$
|
|
|
1429
1428
|
caretColor: mt
|
|
1430
1429
|
},
|
|
1431
1430
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: mt },
|
|
1432
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1433
|
-
".cm-panels": { backgroundColor:
|
|
1431
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ql },
|
|
1432
|
+
".cm-panels": { backgroundColor: Rl, color: re },
|
|
1434
1433
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1435
1434
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1436
1435
|
".cm-searchMatch": {
|
|
@@ -1452,7 +1451,7 @@ $$
|
|
|
1452
1451
|
borderColor: "var(--md-border-color)"
|
|
1453
1452
|
},
|
|
1454
1453
|
".cm-activeLineGutter": {
|
|
1455
|
-
backgroundColor:
|
|
1454
|
+
backgroundColor: Pl
|
|
1456
1455
|
},
|
|
1457
1456
|
".cm-foldPlaceholder": {
|
|
1458
1457
|
backgroundColor: "transparent",
|
|
@@ -1478,10 +1477,10 @@ $$
|
|
|
1478
1477
|
}
|
|
1479
1478
|
},
|
|
1480
1479
|
{ dark: !0 }
|
|
1481
|
-
),
|
|
1482
|
-
{ tag: s.keyword, color:
|
|
1480
|
+
), Gl = yt.define([
|
|
1481
|
+
{ tag: s.keyword, color: Fl },
|
|
1483
1482
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: st },
|
|
1484
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1483
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Ol },
|
|
1485
1484
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ut },
|
|
1486
1485
|
{ tag: [s.definition(s.name), s.separator], color: re },
|
|
1487
1486
|
{
|
|
@@ -1495,7 +1494,7 @@ $$
|
|
|
1495
1494
|
s.self,
|
|
1496
1495
|
s.namespace
|
|
1497
1496
|
],
|
|
1498
|
-
color:
|
|
1497
|
+
color: Hl
|
|
1499
1498
|
},
|
|
1500
1499
|
{
|
|
1501
1500
|
tag: [
|
|
@@ -1507,7 +1506,7 @@ $$
|
|
|
1507
1506
|
s.link,
|
|
1508
1507
|
s.special(s.string)
|
|
1509
1508
|
],
|
|
1510
|
-
color:
|
|
1509
|
+
color: Nl
|
|
1511
1510
|
},
|
|
1512
1511
|
{ tag: [s.meta, s.comment], color: ct },
|
|
1513
1512
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1516,12 +1515,12 @@ $$
|
|
|
1516
1515
|
{ tag: s.link, color: ct, textDecoration: "underline" },
|
|
1517
1516
|
{ tag: s.heading, fontWeight: "bold", color: st },
|
|
1518
1517
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ut },
|
|
1519
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1520
|
-
{ tag: s.invalid, color:
|
|
1521
|
-
]),
|
|
1522
|
-
|
|
1523
|
-
Tt(
|
|
1524
|
-
],
|
|
1518
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Bl },
|
|
1519
|
+
{ tag: s.invalid, color: Vl }
|
|
1520
|
+
]), Kl = [
|
|
1521
|
+
Ul,
|
|
1522
|
+
Tt(Gl)
|
|
1523
|
+
], _l = "#e5c07b", gt = "#3f4a54", jl = "#56b6c2", Wl = "#fff", ie = "#3f4a54", ft = "#2d8cf0", zl = "#2d8cf0", Zl = "#3f4a54", bt = "#d19a66", Xl = "#c678dd", Yl = "#21252b", Jl = "#ceedfa33", ht = "var(--md-bk-color)", he = "var(--md-bk-color)", Ql = "#bad5fa", vt = "#3f4a54", eo = pe.theme(
|
|
1525
1524
|
{
|
|
1526
1525
|
"&": {
|
|
1527
1526
|
color: ie,
|
|
@@ -1531,8 +1530,8 @@ $$
|
|
|
1531
1530
|
caretColor: vt
|
|
1532
1531
|
},
|
|
1533
1532
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: vt },
|
|
1534
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1535
|
-
".cm-panels": { backgroundColor:
|
|
1533
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ql },
|
|
1534
|
+
".cm-panels": { backgroundColor: Yl, color: ie },
|
|
1536
1535
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1537
1536
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1538
1537
|
".cm-searchMatch": {
|
|
@@ -1554,7 +1553,7 @@ $$
|
|
|
1554
1553
|
borderColor: "var(--md-border-color)"
|
|
1555
1554
|
},
|
|
1556
1555
|
".cm-activeLineGutter": {
|
|
1557
|
-
backgroundColor:
|
|
1556
|
+
backgroundColor: Jl
|
|
1558
1557
|
},
|
|
1559
1558
|
".cm-foldPlaceholder": {
|
|
1560
1559
|
backgroundColor: "transparent",
|
|
@@ -1580,10 +1579,10 @@ $$
|
|
|
1580
1579
|
}
|
|
1581
1580
|
}
|
|
1582
1581
|
// { dark: true }
|
|
1583
|
-
),
|
|
1584
|
-
{ tag: s.keyword, color:
|
|
1582
|
+
), to = yt.define([
|
|
1583
|
+
{ tag: s.keyword, color: Xl },
|
|
1585
1584
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: gt },
|
|
1586
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1585
|
+
{ tag: [s.function(s.variableName), s.labelName], color: zl },
|
|
1587
1586
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: bt },
|
|
1588
1587
|
{ tag: [s.definition(s.name), s.separator], color: ie },
|
|
1589
1588
|
{
|
|
@@ -1597,7 +1596,7 @@ $$
|
|
|
1597
1596
|
s.self,
|
|
1598
1597
|
s.namespace
|
|
1599
1598
|
],
|
|
1600
|
-
color:
|
|
1599
|
+
color: _l
|
|
1601
1600
|
},
|
|
1602
1601
|
{
|
|
1603
1602
|
tag: [
|
|
@@ -1609,7 +1608,7 @@ $$
|
|
|
1609
1608
|
s.link,
|
|
1610
1609
|
s.special(s.string)
|
|
1611
1610
|
],
|
|
1612
|
-
color:
|
|
1611
|
+
color: jl
|
|
1613
1612
|
},
|
|
1614
1613
|
{ tag: [s.meta, s.comment], color: ft },
|
|
1615
1614
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1618,11 +1617,11 @@ $$
|
|
|
1618
1617
|
{ tag: s.link, color: ft, textDecoration: "underline" },
|
|
1619
1618
|
{ tag: s.heading, fontWeight: "bold", color: gt },
|
|
1620
1619
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: bt },
|
|
1621
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1622
|
-
{ tag: s.invalid, color:
|
|
1623
|
-
]),
|
|
1624
|
-
|
|
1625
|
-
Tt(
|
|
1620
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Zl },
|
|
1621
|
+
{ tag: s.invalid, color: Wl }
|
|
1622
|
+
]), lo = [
|
|
1623
|
+
eo,
|
|
1624
|
+
Tt(to)
|
|
1626
1625
|
], de = (e, o, l, a, r) => (i, d, u, c) => {
|
|
1627
1626
|
const g = `${e}${o}`.slice(c - u);
|
|
1628
1627
|
i.dispatch(i.state.replaceSelection(`${g}${l}${a}`));
|
|
@@ -1642,7 +1641,7 @@ $$
|
|
|
1642
1641
|
}, kt = (e) => (o, l, a, r) => {
|
|
1643
1642
|
const i = e.slice(r - a);
|
|
1644
1643
|
o.dispatch(o.state.replaceSelection(`${i} `));
|
|
1645
|
-
},
|
|
1644
|
+
}, oo = (e) => {
|
|
1646
1645
|
const o = (l) => {
|
|
1647
1646
|
const a = l.matchBefore(
|
|
1648
1647
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1738,16 +1737,16 @@ $$`, "title")
|
|
|
1738
1737
|
]
|
|
1739
1738
|
};
|
|
1740
1739
|
};
|
|
1741
|
-
return
|
|
1742
|
-
override: e ? [o,
|
|
1740
|
+
return ml({
|
|
1741
|
+
override: e ? [o, ...e] : [o]
|
|
1743
1742
|
});
|
|
1744
|
-
},
|
|
1745
|
-
const o = new
|
|
1743
|
+
}, ao = oo, J = (e) => {
|
|
1744
|
+
const o = new ul();
|
|
1746
1745
|
return (a) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(a) }) : e.dispatch({
|
|
1747
|
-
effects:
|
|
1746
|
+
effects: dl.appendConfig.of(o.of(a))
|
|
1748
1747
|
}), !0);
|
|
1749
1748
|
};
|
|
1750
|
-
class
|
|
1749
|
+
class no {
|
|
1751
1750
|
constructor(o) {
|
|
1752
1751
|
U(this, "view");
|
|
1753
1752
|
U(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
@@ -1846,7 +1845,7 @@ class io {
|
|
|
1846
1845
|
setTabSize(o) {
|
|
1847
1846
|
this.toggleTabSize([
|
|
1848
1847
|
fe.tabSize.of(o),
|
|
1849
|
-
|
|
1848
|
+
cl.of(" ".repeat(o))
|
|
1850
1849
|
]);
|
|
1851
1850
|
}
|
|
1852
1851
|
/**
|
|
@@ -1891,7 +1890,7 @@ class io {
|
|
|
1891
1890
|
]);
|
|
1892
1891
|
}
|
|
1893
1892
|
}
|
|
1894
|
-
const
|
|
1893
|
+
const ro = (e) => {
|
|
1895
1894
|
const o = L("editorId");
|
|
1896
1895
|
return (a) => {
|
|
1897
1896
|
if (!a.clipboardData)
|
|
@@ -1920,7 +1919,7 @@ const so = (e) => {
|
|
|
1920
1919
|
data: r
|
|
1921
1920
|
});
|
|
1922
1921
|
};
|
|
1923
|
-
},
|
|
1922
|
+
}, io = ro, so = (e) => {
|
|
1924
1923
|
const o = L("editorId");
|
|
1925
1924
|
Y(() => {
|
|
1926
1925
|
b.on(o, {
|
|
@@ -1931,7 +1930,7 @@ const so = (e) => {
|
|
|
1931
1930
|
}
|
|
1932
1931
|
});
|
|
1933
1932
|
});
|
|
1934
|
-
},
|
|
1933
|
+
}, co = so, uo = (e, o) => [
|
|
1935
1934
|
{
|
|
1936
1935
|
key: "Ctrl-b",
|
|
1937
1936
|
mac: "Cmd-b",
|
|
@@ -1940,7 +1939,7 @@ const so = (e) => {
|
|
|
1940
1939
|
{
|
|
1941
1940
|
key: "Ctrl-d",
|
|
1942
1941
|
mac: "Cmd-d",
|
|
1943
|
-
run:
|
|
1942
|
+
run: nl,
|
|
1944
1943
|
preventDefault: !0
|
|
1945
1944
|
},
|
|
1946
1945
|
{
|
|
@@ -2027,11 +2026,10 @@ const so = (e) => {
|
|
|
2027
2026
|
{
|
|
2028
2027
|
any: (H, M) => (M.ctrlKey || M.metaKey) && M.altKey && M.shiftKey && M.code === "KeyT" ? (b.emit(e, "replace", "table"), !0) : !1
|
|
2029
2028
|
}
|
|
2030
|
-
],
|
|
2031
|
-
const o = L("tabWidth"), l = L("editorId"), a = L("theme"), r = K(), i = At(), d =
|
|
2032
|
-
ll.of([...d,
|
|
2029
|
+
], mo = uo, go = (e) => {
|
|
2030
|
+
const o = L("tabWidth"), l = L("editorId"), a = L("theme"), r = K(), i = At(), d = mo(l, e), u = io(e), c = [
|
|
2031
|
+
ll.of([...d, rl]),
|
|
2033
2032
|
el,
|
|
2034
|
-
rl(),
|
|
2035
2033
|
al({ codeLanguages: ol }),
|
|
2036
2034
|
// 横向换行
|
|
2037
2035
|
ue.lineWrapping,
|
|
@@ -2055,8 +2053,8 @@ const so = (e) => {
|
|
|
2055
2053
|
], g = () => {
|
|
2056
2054
|
const m = [
|
|
2057
2055
|
...c,
|
|
2058
|
-
a.value === "light" ?
|
|
2059
|
-
|
|
2056
|
+
a.value === "light" ? lo : Kl,
|
|
2057
|
+
ao(e.completions)
|
|
2060
2058
|
];
|
|
2061
2059
|
return X.codeMirrorExtensions(a.value, m, [
|
|
2062
2060
|
...d
|
|
@@ -2066,24 +2064,24 @@ const so = (e) => {
|
|
|
2066
2064
|
const m = new ue({
|
|
2067
2065
|
doc: e.modelValue,
|
|
2068
2066
|
parent: r.value
|
|
2069
|
-
}), h = new
|
|
2067
|
+
}), h = new no(m);
|
|
2070
2068
|
i.value = h, setTimeout(() => {
|
|
2071
2069
|
h.setTabSize(o), h.setDisabled(e.disabled), h.setReadOnly(e.readonly), h.setExtensions(g()), e.placeholder && h.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && h.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2072
2070
|
}, 0), b.on(l, {
|
|
2073
2071
|
name: "ctrlZ",
|
|
2074
2072
|
callback() {
|
|
2075
|
-
|
|
2073
|
+
il(m);
|
|
2076
2074
|
}
|
|
2077
2075
|
}), b.on(l, {
|
|
2078
2076
|
name: "ctrlShiftZ",
|
|
2079
2077
|
callback() {
|
|
2080
|
-
|
|
2078
|
+
sl(m);
|
|
2081
2079
|
}
|
|
2082
2080
|
}), b.on(l, {
|
|
2083
2081
|
name: "replace",
|
|
2084
2082
|
callback($, T = {}) {
|
|
2085
2083
|
var k;
|
|
2086
|
-
const { text: v, options: f } =
|
|
2084
|
+
const { text: v, options: f } = El($, i.value, T);
|
|
2087
2085
|
(k = i.value) == null || k.replaceSelectedText(v, f, l);
|
|
2088
2086
|
}
|
|
2089
2087
|
});
|
|
@@ -2126,19 +2124,19 @@ const so = (e) => {
|
|
|
2126
2124
|
var m;
|
|
2127
2125
|
e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
|
|
2128
2126
|
}
|
|
2129
|
-
),
|
|
2127
|
+
), co(i), {
|
|
2130
2128
|
inputWrapperRef: r,
|
|
2131
2129
|
codeMirrorUt: i
|
|
2132
2130
|
};
|
|
2133
|
-
},
|
|
2131
|
+
}, fo = go, bo = /* @__PURE__ */ R({
|
|
2134
2132
|
name: "MDEditorContent",
|
|
2135
2133
|
props: qt,
|
|
2136
2134
|
setup(e) {
|
|
2137
2135
|
const o = L("editorId"), l = K(""), {
|
|
2138
2136
|
inputWrapperRef: a,
|
|
2139
2137
|
codeMirrorUt: r
|
|
2140
|
-
} =
|
|
2141
|
-
return
|
|
2138
|
+
} = fo(e);
|
|
2139
|
+
return Dl(e, l, r), () => t("div", {
|
|
2142
2140
|
class: `${n}-content`
|
|
2143
2141
|
}, [t("div", {
|
|
2144
2142
|
class: `${n}-input-wrapper`,
|
|
@@ -2165,7 +2163,7 @@ const so = (e) => {
|
|
|
2165
2163
|
key: "internal-catalog"
|
|
2166
2164
|
}, null)]);
|
|
2167
2165
|
}
|
|
2168
|
-
}),
|
|
2166
|
+
}), ho = /* @__PURE__ */ R({
|
|
2169
2167
|
props: {
|
|
2170
2168
|
modelValue: {
|
|
2171
2169
|
type: String,
|
|
@@ -2183,7 +2181,7 @@ const so = (e) => {
|
|
|
2183
2181
|
}, [`${(l = o.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((a = e.modelValue) == null ? void 0 : a.length) || 0])]);
|
|
2184
2182
|
};
|
|
2185
2183
|
}
|
|
2186
|
-
}),
|
|
2184
|
+
}), vo = {
|
|
2187
2185
|
checked: {
|
|
2188
2186
|
type: Boolean,
|
|
2189
2187
|
default: !1
|
|
@@ -2193,8 +2191,8 @@ const so = (e) => {
|
|
|
2193
2191
|
default: () => {
|
|
2194
2192
|
}
|
|
2195
2193
|
}
|
|
2196
|
-
},
|
|
2197
|
-
props:
|
|
2194
|
+
}, ko = /* @__PURE__ */ R({
|
|
2195
|
+
props: vo,
|
|
2198
2196
|
setup(e) {
|
|
2199
2197
|
return () => t("div", {
|
|
2200
2198
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2203,7 +2201,7 @@ const so = (e) => {
|
|
|
2203
2201
|
}
|
|
2204
2202
|
}, null);
|
|
2205
2203
|
}
|
|
2206
|
-
}),
|
|
2204
|
+
}), po = {
|
|
2207
2205
|
scrollAuto: {
|
|
2208
2206
|
type: Boolean
|
|
2209
2207
|
},
|
|
@@ -2212,8 +2210,8 @@ const so = (e) => {
|
|
|
2212
2210
|
default: () => {
|
|
2213
2211
|
}
|
|
2214
2212
|
}
|
|
2215
|
-
},
|
|
2216
|
-
props:
|
|
2213
|
+
}, Co = /* @__PURE__ */ R({
|
|
2214
|
+
props: po,
|
|
2217
2215
|
setup(e) {
|
|
2218
2216
|
const o = L("usedLanguageText");
|
|
2219
2217
|
return () => {
|
|
@@ -2225,13 +2223,13 @@ const so = (e) => {
|
|
|
2225
2223
|
onClick: () => {
|
|
2226
2224
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2227
2225
|
}
|
|
2228
|
-
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(
|
|
2226
|
+
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(ko, {
|
|
2229
2227
|
checked: e.scrollAuto,
|
|
2230
2228
|
onChange: e.onScrollAutoChange
|
|
2231
2229
|
}, null)]);
|
|
2232
2230
|
};
|
|
2233
2231
|
}
|
|
2234
|
-
}),
|
|
2232
|
+
}), $o = {
|
|
2235
2233
|
modelValue: {
|
|
2236
2234
|
type: String,
|
|
2237
2235
|
default: ""
|
|
@@ -2251,9 +2249,9 @@ const so = (e) => {
|
|
|
2251
2249
|
defFooters: {
|
|
2252
2250
|
type: Object
|
|
2253
2251
|
}
|
|
2254
|
-
},
|
|
2252
|
+
}, yo = /* @__PURE__ */ R({
|
|
2255
2253
|
name: "MDEditorFooter",
|
|
2256
|
-
props:
|
|
2254
|
+
props: $o,
|
|
2257
2255
|
setup(e) {
|
|
2258
2256
|
const o = ke(() => {
|
|
2259
2257
|
const a = e.footers.indexOf("="), r = a === -1 ? e.footers : e.footers.slice(0, a), i = a === -1 ? [] : e.footers.slice(a, Number.MAX_SAFE_INTEGER);
|
|
@@ -2262,11 +2260,11 @@ const so = (e) => {
|
|
|
2262
2260
|
if (Dt.includes(a))
|
|
2263
2261
|
switch (a) {
|
|
2264
2262
|
case "markdownTotal":
|
|
2265
|
-
return t(
|
|
2263
|
+
return t(ho, {
|
|
2266
2264
|
modelValue: e.modelValue
|
|
2267
2265
|
}, null);
|
|
2268
2266
|
case "scrollSwitch":
|
|
2269
|
-
return t(
|
|
2267
|
+
return t(Co, {
|
|
2270
2268
|
scrollAuto: e.scrollAuto,
|
|
2271
2269
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2272
2270
|
}, null);
|
|
@@ -2285,7 +2283,7 @@ const so = (e) => {
|
|
|
2285
2283
|
}, [r])]);
|
|
2286
2284
|
};
|
|
2287
2285
|
}
|
|
2288
|
-
}),
|
|
2286
|
+
}), To = /* @__PURE__ */ R({
|
|
2289
2287
|
name: "MdEditorV3",
|
|
2290
2288
|
props: Gt,
|
|
2291
2289
|
emits: Kt,
|
|
@@ -2317,7 +2315,7 @@ const so = (e) => {
|
|
|
2317
2315
|
id: l,
|
|
2318
2316
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, g.fullscreen || g.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2319
2317
|
style: e.style
|
|
2320
|
-
}, [t(
|
|
2318
|
+
}, [t(Al, {
|
|
2321
2319
|
noPrettier: i,
|
|
2322
2320
|
toolbars: e.toolbars,
|
|
2323
2321
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2327,7 +2325,7 @@ const so = (e) => {
|
|
|
2327
2325
|
defToolbars: $,
|
|
2328
2326
|
noUploadImg: d,
|
|
2329
2327
|
showToolbarName: e.showToolbarName
|
|
2330
|
-
}, null), t(
|
|
2328
|
+
}, null), t(bo, {
|
|
2331
2329
|
modelValue: e.modelValue,
|
|
2332
2330
|
setting: g,
|
|
2333
2331
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2366,7 +2364,7 @@ const so = (e) => {
|
|
|
2366
2364
|
catalogVisible: h.value,
|
|
2367
2365
|
theme: e.theme,
|
|
2368
2366
|
noImgZoomIn: e.noImgZoomIn
|
|
2369
|
-
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(
|
|
2367
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(yo, {
|
|
2370
2368
|
modelValue: e.modelValue,
|
|
2371
2369
|
footers: e.footers,
|
|
2372
2370
|
defFooters: T,
|
|
@@ -2375,8 +2373,8 @@ const so = (e) => {
|
|
|
2375
2373
|
}, null)]);
|
|
2376
2374
|
};
|
|
2377
2375
|
}
|
|
2378
|
-
}), ve =
|
|
2379
|
-
ve.install = (e) => (e.component(ve.name, ve), e.use(
|
|
2376
|
+
}), ve = To;
|
|
2377
|
+
ve.install = (e) => (e.component(ve.name, ve), e.use(gl).use(Ot).use(fl).use(wt).use(Jt), e);
|
|
2380
2378
|
export {
|
|
2381
2379
|
ve as default
|
|
2382
2380
|
};
|