md-editor-v3 4.3.0-beta.7 → 4.3.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 +11 -11
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +108 -110
- 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 Jt, EditorView as ie } from "codemirror";
|
|
|
13
13
|
import { EditorView as be, placeholder as Qt, keymap as el } from "@codemirror/view";
|
|
14
14
|
import { languages as tl } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as ll } from "@codemirror/lang-markdown";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as cl } from "@codemirror/language";
|
|
16
|
+
import { deleteLine as ol, indentWithTab as al, undo as nl, redo as rl } from "@codemirror/commands";
|
|
17
|
+
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as il } from "@codemirror/language";
|
|
19
18
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as q, EditorState as ue, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
19
|
+
import { EditorSelection as q, EditorState as ue, Compartment as sl, StateEffect as cl } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as dl } from "@codemirror/autocomplete";
|
|
22
21
|
import Tt from "./MdCatalog.mjs";
|
|
23
22
|
import { g as rt } from "./chunks/vue-tsx.mjs";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
23
|
+
import ul from "./NormalToolbar.mjs";
|
|
24
|
+
import ml 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 gl = /* @__PURE__ */ V({
|
|
33
32
|
setup() {
|
|
34
33
|
return () => t("div", {
|
|
35
34
|
class: `${o}-divider`
|
|
36
35
|
}, null);
|
|
37
36
|
}
|
|
38
|
-
}),
|
|
37
|
+
}), hl = {
|
|
39
38
|
noPrettier: {
|
|
40
39
|
type: Boolean
|
|
41
40
|
},
|
|
@@ -84,7 +83,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
84
83
|
showToolbarName: {
|
|
85
84
|
type: Boolean
|
|
86
85
|
}
|
|
87
|
-
},
|
|
86
|
+
}, fl = (e) => {
|
|
88
87
|
var c, g, m, b;
|
|
89
88
|
const a = A("editorId");
|
|
90
89
|
let l = (g = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
|
|
@@ -115,7 +114,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
115
114
|
callback: i
|
|
116
115
|
});
|
|
117
116
|
}), { fullscreenHandler: i };
|
|
118
|
-
},
|
|
117
|
+
}, bl = {
|
|
119
118
|
tableShape: {
|
|
120
119
|
type: Array,
|
|
121
120
|
default: () => [6, 4]
|
|
@@ -125,9 +124,9 @@ const fl = /* @__PURE__ */ V({
|
|
|
125
124
|
default: () => {
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
},
|
|
127
|
+
}, vl = /* @__PURE__ */ V({
|
|
129
128
|
name: "TableShape",
|
|
130
|
-
props:
|
|
129
|
+
props: bl,
|
|
131
130
|
setup(e) {
|
|
132
131
|
const a = Z({
|
|
133
132
|
x: -1,
|
|
@@ -154,7 +153,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
154
153
|
class: [`${o}-table-shape-col-default`, n <= a.x && i <= a.y && `${o}-table-shape-col-include`]
|
|
155
154
|
}, null)]))]))]);
|
|
156
155
|
}
|
|
157
|
-
}),
|
|
156
|
+
}), kl = vl, pl = {
|
|
158
157
|
type: {
|
|
159
158
|
type: String,
|
|
160
159
|
default: "link"
|
|
@@ -173,8 +172,8 @@ const fl = /* @__PURE__ */ V({
|
|
|
173
172
|
default: () => {
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
|
-
},
|
|
177
|
-
props:
|
|
175
|
+
}, Cl = /* @__PURE__ */ V({
|
|
176
|
+
props: pl,
|
|
178
177
|
setup(e) {
|
|
179
178
|
const a = A("usedLanguageText"), l = A("editorId"), n = fe(() => {
|
|
180
179
|
var i, u;
|
|
@@ -243,7 +242,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
243
242
|
}
|
|
244
243
|
});
|
|
245
244
|
}
|
|
246
|
-
}),
|
|
245
|
+
}), $l = {
|
|
247
246
|
visible: {
|
|
248
247
|
type: Boolean,
|
|
249
248
|
default: !1
|
|
@@ -258,8 +257,8 @@ const fl = /* @__PURE__ */ V({
|
|
|
258
257
|
default: () => {
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
},
|
|
262
|
-
props:
|
|
260
|
+
}, yl = /* @__PURE__ */ V({
|
|
261
|
+
props: $l,
|
|
263
262
|
setup(e) {
|
|
264
263
|
var m, b, $;
|
|
265
264
|
const a = A("usedLanguageText"), l = A("editorId");
|
|
@@ -386,7 +385,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
386
385
|
});
|
|
387
386
|
};
|
|
388
387
|
}
|
|
389
|
-
}),
|
|
388
|
+
}), Tl = {
|
|
390
389
|
type: {
|
|
391
390
|
type: String,
|
|
392
391
|
default: "link"
|
|
@@ -409,27 +408,27 @@ const fl = /* @__PURE__ */ V({
|
|
|
409
408
|
default: () => {
|
|
410
409
|
}
|
|
411
410
|
}
|
|
412
|
-
},
|
|
413
|
-
props:
|
|
411
|
+
}, wl = /* @__PURE__ */ V({
|
|
412
|
+
props: Tl,
|
|
414
413
|
setup(e) {
|
|
415
|
-
return () => t(kt, null, [t(
|
|
414
|
+
return () => t(kt, null, [t(Cl, {
|
|
416
415
|
type: e.type,
|
|
417
416
|
visible: e.linkVisible,
|
|
418
417
|
onOk: e.onOk,
|
|
419
418
|
onCancel: e.onCancel
|
|
420
|
-
}, null), t(
|
|
419
|
+
}, null), t(yl, {
|
|
421
420
|
visible: e.clipVisible,
|
|
422
421
|
onOk: e.onOk,
|
|
423
422
|
onCancel: e.onCancel
|
|
424
423
|
}, null)]);
|
|
425
424
|
}
|
|
426
|
-
}),
|
|
425
|
+
}), xl = /* @__PURE__ */ V({
|
|
427
426
|
name: "MDEditorToolbar",
|
|
428
|
-
props:
|
|
427
|
+
props: hl,
|
|
429
428
|
setup(e) {
|
|
430
429
|
const a = A("editorId"), l = A("usedLanguageText"), {
|
|
431
430
|
fullscreenHandler: n
|
|
432
|
-
} =
|
|
431
|
+
} = fl(e), r = `${a}-toolbar-wrapper`, i = U(), u = Z({
|
|
433
432
|
title: !1,
|
|
434
433
|
catalog: !1,
|
|
435
434
|
// 图片上传下拉
|
|
@@ -468,7 +467,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
468
467
|
if (Lt.includes(v))
|
|
469
468
|
switch (v) {
|
|
470
469
|
case "-":
|
|
471
|
-
return t(
|
|
470
|
+
return t(gl, null, null);
|
|
472
471
|
case "bold":
|
|
473
472
|
return t("div", {
|
|
474
473
|
class: `${o}-toolbar-item`,
|
|
@@ -788,7 +787,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
788
787
|
u.table = p;
|
|
789
788
|
},
|
|
790
789
|
key: "bar-table",
|
|
791
|
-
overlay: t(
|
|
790
|
+
overlay: t(kl, {
|
|
792
791
|
tableShape: e.tableShape,
|
|
793
792
|
onSelected: (p) => {
|
|
794
793
|
d("table", {
|
|
@@ -1120,7 +1119,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1120
1119
|
style: {
|
|
1121
1120
|
display: "none"
|
|
1122
1121
|
}
|
|
1123
|
-
}, null), t(
|
|
1122
|
+
}, null), t(wl, {
|
|
1124
1123
|
linkVisible: c.linkVisible,
|
|
1125
1124
|
clipVisible: c.clipVisible,
|
|
1126
1125
|
type: c.type,
|
|
@@ -1136,7 +1135,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1136
1135
|
}, null)]);
|
|
1137
1136
|
};
|
|
1138
1137
|
}
|
|
1139
|
-
}),
|
|
1138
|
+
}), Sl = (e, a) => {
|
|
1140
1139
|
const l = Nt(() => {
|
|
1141
1140
|
e.removeEventListener("scroll", n), e.addEventListener("scroll", n), a.removeEventListener("scroll", n), a.addEventListener("scroll", n);
|
|
1142
1141
|
}, 50), n = (r) => {
|
|
@@ -1159,7 +1158,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1159
1158
|
e.removeEventListener("scroll", n), a.removeEventListener("scroll", n);
|
|
1160
1159
|
}
|
|
1161
1160
|
];
|
|
1162
|
-
},
|
|
1161
|
+
}, Al = (e, a, l) => {
|
|
1163
1162
|
const { view: n } = l, r = (b) => n.lineBlockAt(n.state.doc.line(b).from).top, i = (b) => n.lineBlockAt(n.state.doc.line(b).from).height;
|
|
1164
1163
|
let u = [];
|
|
1165
1164
|
const d = () => {
|
|
@@ -1262,7 +1261,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1262
1261
|
u = [], e.removeEventListener("scroll", m), a.removeEventListener("scroll", m);
|
|
1263
1262
|
}
|
|
1264
1263
|
];
|
|
1265
|
-
},
|
|
1264
|
+
}, Ml = (e, a, l) => {
|
|
1266
1265
|
const n = A("editorId");
|
|
1267
1266
|
let r = () => {
|
|
1268
1267
|
}, i = () => {
|
|
@@ -1274,7 +1273,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1274
1273
|
), g = document.querySelector(
|
|
1275
1274
|
`[id="${n}-html-wrapper"][data-show="true"]`
|
|
1276
1275
|
);
|
|
1277
|
-
(c || g) && ([i, r] = (c ?
|
|
1276
|
+
(c || g) && ([i, r] = (c ? Al : Sl)(
|
|
1278
1277
|
d,
|
|
1279
1278
|
c || g,
|
|
1280
1279
|
l.value
|
|
@@ -1297,7 +1296,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1297
1296
|
d ? i() : r();
|
|
1298
1297
|
}
|
|
1299
1298
|
), X(u);
|
|
1300
|
-
},
|
|
1299
|
+
}, Ll = Ml, Il = (e, a, l) => {
|
|
1301
1300
|
var m, b, $, T, v, h;
|
|
1302
1301
|
let n = "", r = 0, i = 0, u = !0, d = !1;
|
|
1303
1302
|
const c = a.getSelectedText(), g = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
@@ -1509,7 +1508,7 @@ $$
|
|
|
1509
1508
|
replaceAll: d
|
|
1510
1509
|
}
|
|
1511
1510
|
};
|
|
1512
|
-
},
|
|
1511
|
+
}, Dl = "#e5c07b", it = "var(--md-color)", El = "#56b6c2", Nl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Hl = "#e5c07b", Fl = "var(--md-color)", ct = "#d19a66", Bl = "#c678dd", Vl = "#21252b", Ol = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", Rl = "#ceedfa33", ut = "#528bff", Pl = be.theme(
|
|
1513
1512
|
{
|
|
1514
1513
|
"&": {
|
|
1515
1514
|
color: oe,
|
|
@@ -1519,8 +1518,8 @@ $$
|
|
|
1519
1518
|
caretColor: ut
|
|
1520
1519
|
},
|
|
1521
1520
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: ut },
|
|
1522
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1523
|
-
".cm-panels": { backgroundColor:
|
|
1521
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Rl },
|
|
1522
|
+
".cm-panels": { backgroundColor: Vl, color: oe },
|
|
1524
1523
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1525
1524
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1526
1525
|
".cm-searchMatch": {
|
|
@@ -1542,7 +1541,7 @@ $$
|
|
|
1542
1541
|
borderColor: "var(--md-border-color)"
|
|
1543
1542
|
},
|
|
1544
1543
|
".cm-activeLineGutter": {
|
|
1545
|
-
backgroundColor:
|
|
1544
|
+
backgroundColor: Ol
|
|
1546
1545
|
},
|
|
1547
1546
|
".cm-foldPlaceholder": {
|
|
1548
1547
|
backgroundColor: "transparent",
|
|
@@ -1568,10 +1567,10 @@ $$
|
|
|
1568
1567
|
}
|
|
1569
1568
|
},
|
|
1570
1569
|
{ dark: !0 }
|
|
1571
|
-
),
|
|
1572
|
-
{ tag: s.keyword, color:
|
|
1570
|
+
), ql = $t.define([
|
|
1571
|
+
{ tag: s.keyword, color: Bl },
|
|
1573
1572
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: it },
|
|
1574
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1573
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Hl },
|
|
1575
1574
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ct },
|
|
1576
1575
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1577
1576
|
{
|
|
@@ -1585,7 +1584,7 @@ $$
|
|
|
1585
1584
|
s.self,
|
|
1586
1585
|
s.namespace
|
|
1587
1586
|
],
|
|
1588
|
-
color:
|
|
1587
|
+
color: Dl
|
|
1589
1588
|
},
|
|
1590
1589
|
{
|
|
1591
1590
|
tag: [
|
|
@@ -1597,7 +1596,7 @@ $$
|
|
|
1597
1596
|
s.link,
|
|
1598
1597
|
s.special(s.string)
|
|
1599
1598
|
],
|
|
1600
|
-
color:
|
|
1599
|
+
color: El
|
|
1601
1600
|
},
|
|
1602
1601
|
{ tag: [s.meta, s.comment], color: st },
|
|
1603
1602
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1606,12 +1605,12 @@ $$
|
|
|
1606
1605
|
{ tag: s.link, color: st, textDecoration: "underline" },
|
|
1607
1606
|
{ tag: s.heading, fontWeight: "bold", color: it },
|
|
1608
1607
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ct },
|
|
1609
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1610
|
-
{ tag: s.invalid, color:
|
|
1611
|
-
]),
|
|
1612
|
-
|
|
1613
|
-
yt(
|
|
1614
|
-
],
|
|
1608
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Fl },
|
|
1609
|
+
{ tag: s.invalid, color: Nl }
|
|
1610
|
+
]), Ul = [
|
|
1611
|
+
Pl,
|
|
1612
|
+
yt(ql)
|
|
1613
|
+
], Gl = "#e5c07b", mt = "#3f4a54", Kl = "#56b6c2", jl = "#fff", ae = "#3f4a54", gt = "#2d8cf0", _l = "#2d8cf0", Wl = "#3f4a54", ht = "#d19a66", zl = "#c678dd", Xl = "#21252b", Yl = "#ceedfa33", ft = "var(--md-bk-color)", ge = "var(--md-bk-color)", Zl = "#bad5fa", bt = "#3f4a54", Jl = be.theme(
|
|
1615
1614
|
{
|
|
1616
1615
|
"&": {
|
|
1617
1616
|
color: ae,
|
|
@@ -1621,8 +1620,8 @@ $$
|
|
|
1621
1620
|
caretColor: bt
|
|
1622
1621
|
},
|
|
1623
1622
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
|
|
1624
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1625
|
-
".cm-panels": { backgroundColor:
|
|
1623
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Zl },
|
|
1624
|
+
".cm-panels": { backgroundColor: Xl, color: ae },
|
|
1626
1625
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1627
1626
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1628
1627
|
".cm-searchMatch": {
|
|
@@ -1644,7 +1643,7 @@ $$
|
|
|
1644
1643
|
borderColor: "var(--md-border-color)"
|
|
1645
1644
|
},
|
|
1646
1645
|
".cm-activeLineGutter": {
|
|
1647
|
-
backgroundColor:
|
|
1646
|
+
backgroundColor: Yl
|
|
1648
1647
|
},
|
|
1649
1648
|
".cm-foldPlaceholder": {
|
|
1650
1649
|
backgroundColor: "transparent",
|
|
@@ -1670,10 +1669,10 @@ $$
|
|
|
1670
1669
|
}
|
|
1671
1670
|
}
|
|
1672
1671
|
// { dark: true }
|
|
1673
|
-
),
|
|
1674
|
-
{ tag: s.keyword, color:
|
|
1672
|
+
), Ql = $t.define([
|
|
1673
|
+
{ tag: s.keyword, color: zl },
|
|
1675
1674
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: mt },
|
|
1676
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1675
|
+
{ tag: [s.function(s.variableName), s.labelName], color: _l },
|
|
1677
1676
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ht },
|
|
1678
1677
|
{ tag: [s.definition(s.name), s.separator], color: ae },
|
|
1679
1678
|
{
|
|
@@ -1687,7 +1686,7 @@ $$
|
|
|
1687
1686
|
s.self,
|
|
1688
1687
|
s.namespace
|
|
1689
1688
|
],
|
|
1690
|
-
color:
|
|
1689
|
+
color: Gl
|
|
1691
1690
|
},
|
|
1692
1691
|
{
|
|
1693
1692
|
tag: [
|
|
@@ -1699,7 +1698,7 @@ $$
|
|
|
1699
1698
|
s.link,
|
|
1700
1699
|
s.special(s.string)
|
|
1701
1700
|
],
|
|
1702
|
-
color:
|
|
1701
|
+
color: Kl
|
|
1703
1702
|
},
|
|
1704
1703
|
{ tag: [s.meta, s.comment], color: gt },
|
|
1705
1704
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1708,11 +1707,11 @@ $$
|
|
|
1708
1707
|
{ tag: s.link, color: gt, textDecoration: "underline" },
|
|
1709
1708
|
{ tag: s.heading, fontWeight: "bold", color: mt },
|
|
1710
1709
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ht },
|
|
1711
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1712
|
-
{ tag: s.invalid, color:
|
|
1713
|
-
]),
|
|
1714
|
-
|
|
1715
|
-
yt(
|
|
1710
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Wl },
|
|
1711
|
+
{ tag: s.invalid, color: jl }
|
|
1712
|
+
]), eo = [
|
|
1713
|
+
Jl,
|
|
1714
|
+
yt(Ql)
|
|
1716
1715
|
], se = (e, a, l, n, r) => (i, u, d, c) => {
|
|
1717
1716
|
const g = `${e}${a}`.slice(c - d);
|
|
1718
1717
|
i.dispatch(i.state.replaceSelection(`${g}${l}${n}`));
|
|
@@ -1732,7 +1731,7 @@ $$
|
|
|
1732
1731
|
}, vt = (e) => (a, l, n, r) => {
|
|
1733
1732
|
const i = e.slice(r - n);
|
|
1734
1733
|
a.dispatch(a.state.replaceSelection(`${i} `));
|
|
1735
|
-
},
|
|
1734
|
+
}, to = (e) => {
|
|
1736
1735
|
const a = (l) => {
|
|
1737
1736
|
const n = l.matchBefore(
|
|
1738
1737
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1828,16 +1827,16 @@ $$`, "title")
|
|
|
1828
1827
|
]
|
|
1829
1828
|
};
|
|
1830
1829
|
};
|
|
1831
|
-
return
|
|
1832
|
-
override: e ? [a,
|
|
1830
|
+
return dl({
|
|
1831
|
+
override: e ? [a, ...e] : [a]
|
|
1833
1832
|
});
|
|
1834
|
-
},
|
|
1835
|
-
const a = new
|
|
1833
|
+
}, lo = to, Y = (e) => {
|
|
1834
|
+
const a = new sl();
|
|
1836
1835
|
return (n) => (a.get(e.state) ? e.dispatch({ effects: a.reconfigure(n) }) : e.dispatch({
|
|
1837
|
-
effects:
|
|
1836
|
+
effects: cl.appendConfig.of(a.of(n))
|
|
1838
1837
|
}), !0);
|
|
1839
1838
|
};
|
|
1840
|
-
class
|
|
1839
|
+
class oo {
|
|
1841
1840
|
constructor(a) {
|
|
1842
1841
|
P(this, "view");
|
|
1843
1842
|
P(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
@@ -1936,7 +1935,7 @@ class no {
|
|
|
1936
1935
|
setTabSize(a) {
|
|
1937
1936
|
this.toggleTabSize([
|
|
1938
1937
|
ue.tabSize.of(a),
|
|
1939
|
-
|
|
1938
|
+
il.of(" ".repeat(a))
|
|
1940
1939
|
]);
|
|
1941
1940
|
}
|
|
1942
1941
|
/**
|
|
@@ -1981,7 +1980,7 @@ class no {
|
|
|
1981
1980
|
]);
|
|
1982
1981
|
}
|
|
1983
1982
|
}
|
|
1984
|
-
const
|
|
1983
|
+
const ao = (e) => {
|
|
1985
1984
|
const a = A("editorId");
|
|
1986
1985
|
return (n) => {
|
|
1987
1986
|
if (!n.clipboardData)
|
|
@@ -2010,7 +2009,7 @@ const ro = (e) => {
|
|
|
2010
2009
|
data: r
|
|
2011
2010
|
});
|
|
2012
2011
|
};
|
|
2013
|
-
},
|
|
2012
|
+
}, no = ao, ro = (e) => {
|
|
2014
2013
|
const a = A("editorId");
|
|
2015
2014
|
X(() => {
|
|
2016
2015
|
f.on(a, {
|
|
@@ -2021,7 +2020,7 @@ const ro = (e) => {
|
|
|
2021
2020
|
}
|
|
2022
2021
|
});
|
|
2023
2022
|
});
|
|
2024
|
-
},
|
|
2023
|
+
}, io = ro, so = (e, a) => [
|
|
2025
2024
|
{
|
|
2026
2025
|
key: "Ctrl-b",
|
|
2027
2026
|
mac: "Cmd-b",
|
|
@@ -2030,7 +2029,7 @@ const ro = (e) => {
|
|
|
2030
2029
|
{
|
|
2031
2030
|
key: "Ctrl-d",
|
|
2032
2031
|
mac: "Cmd-d",
|
|
2033
|
-
run:
|
|
2032
|
+
run: ol,
|
|
2034
2033
|
preventDefault: !0
|
|
2035
2034
|
},
|
|
2036
2035
|
{
|
|
@@ -2117,11 +2116,10 @@ const ro = (e) => {
|
|
|
2117
2116
|
{
|
|
2118
2117
|
any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (f.emit(e, "replace", "table"), !0) : !1
|
|
2119
2118
|
}
|
|
2120
|
-
],
|
|
2121
|
-
const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r = U(), i = St(), u =
|
|
2122
|
-
el.of([...u,
|
|
2119
|
+
], co = so, uo = (e) => {
|
|
2120
|
+
const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r = U(), i = St(), u = co(l, e), d = no(e), c = [
|
|
2121
|
+
el.of([...u, al]),
|
|
2123
2122
|
Jt,
|
|
2124
|
-
al(),
|
|
2125
2123
|
ll({ codeLanguages: tl }),
|
|
2126
2124
|
// 横向换行
|
|
2127
2125
|
ie.lineWrapping,
|
|
@@ -2145,8 +2143,8 @@ const ro = (e) => {
|
|
|
2145
2143
|
], g = () => {
|
|
2146
2144
|
const m = [
|
|
2147
2145
|
...c,
|
|
2148
|
-
n.value === "light" ?
|
|
2149
|
-
|
|
2146
|
+
n.value === "light" ? eo : Ul,
|
|
2147
|
+
lo(e.completions)
|
|
2150
2148
|
];
|
|
2151
2149
|
return z.codeMirrorExtensions(n.value, m, [
|
|
2152
2150
|
...u
|
|
@@ -2156,24 +2154,24 @@ const ro = (e) => {
|
|
|
2156
2154
|
const m = new ie({
|
|
2157
2155
|
doc: e.value,
|
|
2158
2156
|
parent: r.value
|
|
2159
|
-
}), b = new
|
|
2157
|
+
}), b = new oo(m);
|
|
2160
2158
|
i.value = b, setTimeout(() => {
|
|
2161
2159
|
b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(g()), e.placeholder && b.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && b.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2162
2160
|
}, 0), f.on(l, {
|
|
2163
2161
|
name: "ctrlZ",
|
|
2164
2162
|
callback() {
|
|
2165
|
-
|
|
2163
|
+
nl(m);
|
|
2166
2164
|
}
|
|
2167
2165
|
}), f.on(l, {
|
|
2168
2166
|
name: "ctrlShiftZ",
|
|
2169
2167
|
callback() {
|
|
2170
|
-
|
|
2168
|
+
rl(m);
|
|
2171
2169
|
}
|
|
2172
2170
|
}), f.on(l, {
|
|
2173
2171
|
name: "replace",
|
|
2174
2172
|
callback($, T = {}) {
|
|
2175
2173
|
var k;
|
|
2176
|
-
const { text: v, options: h } =
|
|
2174
|
+
const { text: v, options: h } = Il($, i.value, T);
|
|
2177
2175
|
(k = i.value) == null || k.replaceSelectedText(v, h, l);
|
|
2178
2176
|
}
|
|
2179
2177
|
});
|
|
@@ -2216,11 +2214,11 @@ const ro = (e) => {
|
|
|
2216
2214
|
var m;
|
|
2217
2215
|
e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
|
|
2218
2216
|
}
|
|
2219
|
-
),
|
|
2217
|
+
), io(i), {
|
|
2220
2218
|
inputWrapperRef: r,
|
|
2221
2219
|
codeMirrorUt: i
|
|
2222
2220
|
};
|
|
2223
|
-
},
|
|
2221
|
+
}, mo = uo, go = {
|
|
2224
2222
|
value: {
|
|
2225
2223
|
type: String,
|
|
2226
2224
|
default: ""
|
|
@@ -2323,15 +2321,15 @@ const ro = (e) => {
|
|
|
2323
2321
|
onInput: {
|
|
2324
2322
|
type: Function
|
|
2325
2323
|
}
|
|
2326
|
-
},
|
|
2324
|
+
}, ho = /* @__PURE__ */ V({
|
|
2327
2325
|
name: "MDEditorContent",
|
|
2328
|
-
props:
|
|
2326
|
+
props: go,
|
|
2329
2327
|
setup(e) {
|
|
2330
2328
|
const a = A("editorId"), l = U(""), {
|
|
2331
2329
|
inputWrapperRef: n,
|
|
2332
2330
|
codeMirrorUt: r
|
|
2333
|
-
} =
|
|
2334
|
-
return
|
|
2331
|
+
} = mo(e);
|
|
2332
|
+
return Ll(e, l, r), () => t("div", {
|
|
2335
2333
|
class: `${o}-content`
|
|
2336
2334
|
}, [t("div", {
|
|
2337
2335
|
class: `${o}-input-wrapper`,
|
|
@@ -2357,7 +2355,7 @@ const ro = (e) => {
|
|
|
2357
2355
|
key: "internal-catalog"
|
|
2358
2356
|
}, null)]);
|
|
2359
2357
|
}
|
|
2360
|
-
}),
|
|
2358
|
+
}), fo = /* @__PURE__ */ V({
|
|
2361
2359
|
props: {
|
|
2362
2360
|
modelValue: {
|
|
2363
2361
|
type: String,
|
|
@@ -2375,7 +2373,7 @@ const ro = (e) => {
|
|
|
2375
2373
|
}, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((n = e.modelValue) == null ? void 0 : n.length) || 0])]);
|
|
2376
2374
|
};
|
|
2377
2375
|
}
|
|
2378
|
-
}),
|
|
2376
|
+
}), bo = {
|
|
2379
2377
|
checked: {
|
|
2380
2378
|
type: Boolean,
|
|
2381
2379
|
default: !1
|
|
@@ -2385,8 +2383,8 @@ const ro = (e) => {
|
|
|
2385
2383
|
default: () => {
|
|
2386
2384
|
}
|
|
2387
2385
|
}
|
|
2388
|
-
},
|
|
2389
|
-
props:
|
|
2386
|
+
}, vo = /* @__PURE__ */ V({
|
|
2387
|
+
props: bo,
|
|
2390
2388
|
setup(e) {
|
|
2391
2389
|
return () => t("div", {
|
|
2392
2390
|
class: [`${o}-checkbox`, e.checked && `${o}-checkbox-checked`],
|
|
@@ -2395,7 +2393,7 @@ const ro = (e) => {
|
|
|
2395
2393
|
}
|
|
2396
2394
|
}, null);
|
|
2397
2395
|
}
|
|
2398
|
-
}),
|
|
2396
|
+
}), ko = {
|
|
2399
2397
|
scrollAuto: {
|
|
2400
2398
|
type: Boolean
|
|
2401
2399
|
},
|
|
@@ -2404,8 +2402,8 @@ const ro = (e) => {
|
|
|
2404
2402
|
default: () => {
|
|
2405
2403
|
}
|
|
2406
2404
|
}
|
|
2407
|
-
},
|
|
2408
|
-
props:
|
|
2405
|
+
}, po = /* @__PURE__ */ V({
|
|
2406
|
+
props: ko,
|
|
2409
2407
|
setup(e) {
|
|
2410
2408
|
const a = A("usedLanguageText");
|
|
2411
2409
|
return () => {
|
|
@@ -2417,13 +2415,13 @@ const ro = (e) => {
|
|
|
2417
2415
|
onClick: () => {
|
|
2418
2416
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2419
2417
|
}
|
|
2420
|
-
}, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(
|
|
2418
|
+
}, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(vo, {
|
|
2421
2419
|
checked: e.scrollAuto,
|
|
2422
2420
|
onChange: e.onScrollAutoChange
|
|
2423
2421
|
}, null)]);
|
|
2424
2422
|
};
|
|
2425
2423
|
}
|
|
2426
|
-
}),
|
|
2424
|
+
}), Co = {
|
|
2427
2425
|
modelValue: {
|
|
2428
2426
|
type: String,
|
|
2429
2427
|
default: ""
|
|
@@ -2443,9 +2441,9 @@ const ro = (e) => {
|
|
|
2443
2441
|
defFooters: {
|
|
2444
2442
|
type: Object
|
|
2445
2443
|
}
|
|
2446
|
-
},
|
|
2444
|
+
}, $o = /* @__PURE__ */ V({
|
|
2447
2445
|
name: "MDEditorFooter",
|
|
2448
|
-
props:
|
|
2446
|
+
props: Co,
|
|
2449
2447
|
setup(e) {
|
|
2450
2448
|
const a = fe(() => {
|
|
2451
2449
|
const n = e.footers.indexOf("="), r = n === -1 ? e.footers : e.footers.slice(0, n), i = n === -1 ? [] : e.footers.slice(n, Number.MAX_SAFE_INTEGER);
|
|
@@ -2454,11 +2452,11 @@ const ro = (e) => {
|
|
|
2454
2452
|
if (It.includes(n))
|
|
2455
2453
|
switch (n) {
|
|
2456
2454
|
case "markdownTotal":
|
|
2457
|
-
return t(
|
|
2455
|
+
return t(fo, {
|
|
2458
2456
|
modelValue: e.modelValue
|
|
2459
2457
|
}, null);
|
|
2460
2458
|
case "scrollSwitch":
|
|
2461
|
-
return t(
|
|
2459
|
+
return t(po, {
|
|
2462
2460
|
scrollAuto: e.scrollAuto,
|
|
2463
2461
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2464
2462
|
}, null);
|
|
@@ -2477,7 +2475,7 @@ const ro = (e) => {
|
|
|
2477
2475
|
}, [r])]);
|
|
2478
2476
|
};
|
|
2479
2477
|
}
|
|
2480
|
-
}),
|
|
2478
|
+
}), yo = /* @__PURE__ */ V({
|
|
2481
2479
|
name: "MdEditorV3",
|
|
2482
2480
|
props: qt,
|
|
2483
2481
|
emits: Ut,
|
|
@@ -2509,7 +2507,7 @@ const ro = (e) => {
|
|
|
2509
2507
|
id: l,
|
|
2510
2508
|
class: [o, e.class, e.theme === "dark" && `${o}-dark`, g.fullscreen || g.pageFullscreen ? `${o}-fullscreen` : ""],
|
|
2511
2509
|
style: e.style
|
|
2512
|
-
}, [t(
|
|
2510
|
+
}, [t(xl, {
|
|
2513
2511
|
noPrettier: i,
|
|
2514
2512
|
toolbars: e.toolbars,
|
|
2515
2513
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2519,7 +2517,7 @@ const ro = (e) => {
|
|
|
2519
2517
|
defToolbars: $,
|
|
2520
2518
|
noUploadImg: u,
|
|
2521
2519
|
showToolbarName: e.showToolbarName
|
|
2522
|
-
}, null), t(
|
|
2520
|
+
}, null), t(ho, {
|
|
2523
2521
|
value: e.modelValue,
|
|
2524
2522
|
setting: g,
|
|
2525
2523
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2557,7 +2555,7 @@ const ro = (e) => {
|
|
|
2557
2555
|
completions: e.completions,
|
|
2558
2556
|
catalogVisible: b.value,
|
|
2559
2557
|
theme: e.theme
|
|
2560
|
-
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(
|
|
2558
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t($o, {
|
|
2561
2559
|
modelValue: e.modelValue,
|
|
2562
2560
|
footers: e.footers,
|
|
2563
2561
|
defFooters: T,
|
|
@@ -2566,8 +2564,8 @@ const ro = (e) => {
|
|
|
2566
2564
|
}, null)]);
|
|
2567
2565
|
};
|
|
2568
2566
|
}
|
|
2569
|
-
}), he =
|
|
2570
|
-
he.install = (e) => (e.component(he.name, he), e.use(
|
|
2567
|
+
}), he = yo;
|
|
2568
|
+
he.install = (e) => (e.component(he.name, he), e.use(ul).use(Ft).use(ml).use(Tt).use(Yt), e);
|
|
2571
2569
|
export {
|
|
2572
2570
|
he as default
|
|
2573
2571
|
};
|