md-editor-v3 4.6.0-beta.0 → 4.6.1
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 +114 -116
- package/lib/es/index.mjs +16 -17
- package/lib/style.css +1 -1
- 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
|
@@ -12,30 +12,29 @@ import { minimalSetup as zt, EditorView as ge } from "codemirror";
|
|
|
12
12
|
import { EditorView as we, placeholder as Zt, keymap as Xt } from "@codemirror/view";
|
|
13
13
|
import { languages as Yt } from "@codemirror/language-data";
|
|
14
14
|
import { markdown as Jt } from "@codemirror/lang-markdown";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { HighlightStyle as At, syntaxHighlighting as Mt, indentUnit as nl } from "@codemirror/language";
|
|
15
|
+
import { deleteLine as Qt, indentWithTab as el, undo as tl, redo as ll } from "@codemirror/commands";
|
|
16
|
+
import { HighlightStyle as At, syntaxHighlighting as Mt, indentUnit as ol } from "@codemirror/language";
|
|
18
17
|
import { tags as s } from "@lezer/highlight";
|
|
19
|
-
import { EditorSelection as G, EditorState as ve, Compartment as
|
|
20
|
-
import { autocompletion as
|
|
21
|
-
import { c as
|
|
18
|
+
import { EditorSelection as G, EditorState as ve, Compartment as al, StateEffect as nl } from "@codemirror/state";
|
|
19
|
+
import { autocompletion as rl } from "@codemirror/autocomplete";
|
|
20
|
+
import { c as il, C as sl, e as cl, a as ul, u as dl, b as ml, d as gl, f as fl, g as bl, h as hl, i as vl, M as kl } from "./chunks/index.mjs";
|
|
22
21
|
import Lt from "./MdCatalog.mjs";
|
|
23
22
|
import { g as ut } from "./chunks/vue-tsx.mjs";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
23
|
+
import Cl from "./NormalToolbar.mjs";
|
|
24
|
+
import pl 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 $l = /* @__PURE__ */ P({
|
|
33
32
|
setup() {
|
|
34
33
|
return () => t("div", {
|
|
35
34
|
class: `${n}-divider`
|
|
36
35
|
}, null);
|
|
37
36
|
}
|
|
38
|
-
}),
|
|
37
|
+
}), yl = {
|
|
39
38
|
noPrettier: {
|
|
40
39
|
type: Boolean
|
|
41
40
|
},
|
|
@@ -84,7 +83,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
84
83
|
showToolbarName: {
|
|
85
84
|
type: Boolean
|
|
86
85
|
}
|
|
87
|
-
},
|
|
86
|
+
}, Tl = (e) => {
|
|
88
87
|
var u, m, d, v;
|
|
89
88
|
const o = I("editorId");
|
|
90
89
|
let l = (m = (u = Y.editorExtensions) == null ? void 0 : u.screenfull) == null ? void 0 : m.instance;
|
|
@@ -115,7 +114,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
115
114
|
callback: i
|
|
116
115
|
});
|
|
117
116
|
}), { fullscreenHandler: i };
|
|
118
|
-
},
|
|
117
|
+
}, wl = {
|
|
119
118
|
tableShape: {
|
|
120
119
|
type: Array,
|
|
121
120
|
default: () => [6, 4]
|
|
@@ -125,9 +124,9 @@ const Tl = /* @__PURE__ */ P({
|
|
|
125
124
|
default: () => {
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
},
|
|
127
|
+
}, xl = /* @__PURE__ */ P({
|
|
129
128
|
name: "TableShape",
|
|
130
|
-
props:
|
|
129
|
+
props: wl,
|
|
131
130
|
setup(e) {
|
|
132
131
|
const o = ee({
|
|
133
132
|
x: -1,
|
|
@@ -154,7 +153,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
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
|
+
}), Sl = xl, Al = {
|
|
158
157
|
type: {
|
|
159
158
|
type: String,
|
|
160
159
|
default: "link"
|
|
@@ -173,8 +172,8 @@ const Tl = /* @__PURE__ */ P({
|
|
|
173
172
|
default: () => {
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
|
-
},
|
|
177
|
-
props:
|
|
175
|
+
}, Ml = /* @__PURE__ */ P({
|
|
176
|
+
props: Al,
|
|
178
177
|
setup(e) {
|
|
179
178
|
const o = I("usedLanguageText"), l = I("editorId"), a = ye(() => {
|
|
180
179
|
var i, g;
|
|
@@ -243,7 +242,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
243
242
|
}
|
|
244
243
|
});
|
|
245
244
|
}
|
|
246
|
-
}),
|
|
245
|
+
}), Ll = {
|
|
247
246
|
visible: {
|
|
248
247
|
type: Boolean,
|
|
249
248
|
default: !1
|
|
@@ -258,8 +257,8 @@ const Tl = /* @__PURE__ */ P({
|
|
|
258
257
|
default: () => {
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
},
|
|
262
|
-
props:
|
|
260
|
+
}, Dl = /* @__PURE__ */ P({
|
|
261
|
+
props: Ll,
|
|
263
262
|
setup(e) {
|
|
264
263
|
var d, v, $;
|
|
265
264
|
const o = I("usedLanguageText"), l = I("editorId");
|
|
@@ -380,7 +379,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
380
379
|
});
|
|
381
380
|
};
|
|
382
381
|
}
|
|
383
|
-
}),
|
|
382
|
+
}), Il = {
|
|
384
383
|
type: {
|
|
385
384
|
type: String,
|
|
386
385
|
default: "link"
|
|
@@ -403,27 +402,27 @@ const Tl = /* @__PURE__ */ P({
|
|
|
403
402
|
default: () => {
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
|
-
},
|
|
407
|
-
props:
|
|
405
|
+
}, El = /* @__PURE__ */ P({
|
|
406
|
+
props: Il,
|
|
408
407
|
setup(e) {
|
|
409
|
-
return () => t(yt, null, [t(
|
|
408
|
+
return () => t(yt, null, [t(Ml, {
|
|
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(Dl, {
|
|
415
414
|
visible: e.clipVisible,
|
|
416
415
|
onOk: e.onOk,
|
|
417
416
|
onCancel: e.onCancel
|
|
418
417
|
}, null)]);
|
|
419
418
|
}
|
|
420
|
-
}),
|
|
419
|
+
}), Hl = /* @__PURE__ */ P({
|
|
421
420
|
name: "MDEditorToolbar",
|
|
422
|
-
props:
|
|
421
|
+
props: yl,
|
|
423
422
|
setup(e) {
|
|
424
423
|
const o = I("editorId"), l = I("usedLanguageText"), {
|
|
425
424
|
fullscreenHandler: a
|
|
426
|
-
} =
|
|
425
|
+
} = Tl(e), r = `${o}-toolbar-wrapper`, i = K(), g = ee({
|
|
427
426
|
title: !1,
|
|
428
427
|
catalog: !1,
|
|
429
428
|
// 图片上传下拉
|
|
@@ -462,7 +461,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
462
461
|
if (Ot.includes(k))
|
|
463
462
|
switch (k) {
|
|
464
463
|
case "-":
|
|
465
|
-
return t(
|
|
464
|
+
return t($l, null, null);
|
|
466
465
|
case "bold":
|
|
467
466
|
return t("div", {
|
|
468
467
|
class: `${n}-toolbar-item`,
|
|
@@ -734,7 +733,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
734
733
|
g.table = C;
|
|
735
734
|
},
|
|
736
735
|
key: "bar-table",
|
|
737
|
-
overlay: t(
|
|
736
|
+
overlay: t(Sl, {
|
|
738
737
|
tableShape: e.tableShape,
|
|
739
738
|
onSelected: (C) => {
|
|
740
739
|
c("table", {
|
|
@@ -1027,7 +1026,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
1027
1026
|
style: {
|
|
1028
1027
|
display: "none"
|
|
1029
1028
|
}
|
|
1030
|
-
}, null), t(
|
|
1029
|
+
}, null), t(El, {
|
|
1031
1030
|
linkVisible: u.linkVisible,
|
|
1032
1031
|
clipVisible: u.clipVisible,
|
|
1033
1032
|
type: u.type,
|
|
@@ -1043,7 +1042,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
1043
1042
|
}, null)]);
|
|
1044
1043
|
};
|
|
1045
1044
|
}
|
|
1046
|
-
}),
|
|
1045
|
+
}), Nl = (e, o) => {
|
|
1047
1046
|
const l = Rt(() => {
|
|
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 Tl = /* @__PURE__ */ P({
|
|
|
1066
1065
|
e.removeEventListener("scroll", a), o.removeEventListener("scroll", a);
|
|
1067
1066
|
}
|
|
1068
1067
|
];
|
|
1069
|
-
},
|
|
1068
|
+
}, Ol = (e, o, l) => {
|
|
1070
1069
|
const { view: a } = l, r = Pt(), i = ($) => a.lineBlockAt(a.state.doc.line($).from).top, g = ($) => a.lineBlockAt(a.state.doc.line($).from).height;
|
|
1071
1070
|
let c = [];
|
|
1072
1071
|
const u = () => {
|
|
@@ -1172,7 +1171,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
1172
1171
|
c = [], e.removeEventListener("scroll", v), o.removeEventListener("scroll", v);
|
|
1173
1172
|
}
|
|
1174
1173
|
];
|
|
1175
|
-
},
|
|
1174
|
+
}, Vl = (e, o, l) => {
|
|
1176
1175
|
const a = I("editorId");
|
|
1177
1176
|
let r = () => {
|
|
1178
1177
|
}, i = () => {
|
|
@@ -1186,7 +1185,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
1186
1185
|
), m = document.querySelector(
|
|
1187
1186
|
`[id="${a}-html-wrapper"][data-show="true"]`
|
|
1188
1187
|
);
|
|
1189
|
-
(u || m) && ([i, r] = (u ?
|
|
1188
|
+
(u || m) && ([i, r] = (u ? Ol : Nl)(
|
|
1190
1189
|
c,
|
|
1191
1190
|
u || m,
|
|
1192
1191
|
l.value
|
|
@@ -1209,7 +1208,7 @@ const Tl = /* @__PURE__ */ P({
|
|
|
1209
1208
|
c ? i() : r();
|
|
1210
1209
|
}
|
|
1211
1210
|
), J(g);
|
|
1212
|
-
},
|
|
1211
|
+
}, Fl = Vl, Bl = (e, o, l) => {
|
|
1213
1212
|
var d, v, $, T, k, f;
|
|
1214
1213
|
let a = "", r = 0, i = 0, g = !0, c = !1;
|
|
1215
1214
|
const u = o.getSelectedText(), m = (d = Y.editorConfig) == null ? void 0 : d.mermaidTemplate;
|
|
@@ -1421,7 +1420,7 @@ $$
|
|
|
1421
1420
|
replaceAll: c
|
|
1422
1421
|
}
|
|
1423
1422
|
};
|
|
1424
|
-
},
|
|
1423
|
+
}, Rl = "#e5c07b", dt = "var(--md-color)", Pl = "#56b6c2", Ul = "#ffffff", ce = "var(--md-color)", mt = "#e5c07b", _l = "#e5c07b", ql = "var(--md-color)", gt = "#d19a66", Gl = "#c678dd", Kl = "#21252b", jl = "#2c313a", ft = "var(--md-bk-color)", ke = "var(--md-bk-color)", Wl = "#ceedfa33", bt = "#528bff", zl = we.theme(
|
|
1425
1424
|
{
|
|
1426
1425
|
"&": {
|
|
1427
1426
|
color: ce,
|
|
@@ -1431,8 +1430,8 @@ $$
|
|
|
1431
1430
|
caretColor: bt
|
|
1432
1431
|
},
|
|
1433
1432
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
|
|
1434
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1435
|
-
".cm-panels": { backgroundColor:
|
|
1433
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Wl },
|
|
1434
|
+
".cm-panels": { backgroundColor: Kl, color: ce },
|
|
1436
1435
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1437
1436
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1438
1437
|
".cm-searchMatch": {
|
|
@@ -1454,7 +1453,7 @@ $$
|
|
|
1454
1453
|
borderColor: "var(--md-border-color)"
|
|
1455
1454
|
},
|
|
1456
1455
|
".cm-activeLineGutter": {
|
|
1457
|
-
backgroundColor:
|
|
1456
|
+
backgroundColor: jl
|
|
1458
1457
|
},
|
|
1459
1458
|
".cm-foldPlaceholder": {
|
|
1460
1459
|
backgroundColor: "transparent",
|
|
@@ -1480,10 +1479,10 @@ $$
|
|
|
1480
1479
|
}
|
|
1481
1480
|
},
|
|
1482
1481
|
{ dark: !0 }
|
|
1483
|
-
),
|
|
1484
|
-
{ tag: s.keyword, color:
|
|
1482
|
+
), Zl = At.define([
|
|
1483
|
+
{ tag: s.keyword, color: Gl },
|
|
1485
1484
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: dt },
|
|
1486
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1485
|
+
{ tag: [s.function(s.variableName), s.labelName], color: _l },
|
|
1487
1486
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: gt },
|
|
1488
1487
|
{ tag: [s.definition(s.name), s.separator], color: ce },
|
|
1489
1488
|
{
|
|
@@ -1497,7 +1496,7 @@ $$
|
|
|
1497
1496
|
s.self,
|
|
1498
1497
|
s.namespace
|
|
1499
1498
|
],
|
|
1500
|
-
color:
|
|
1499
|
+
color: Rl
|
|
1501
1500
|
},
|
|
1502
1501
|
{
|
|
1503
1502
|
tag: [
|
|
@@ -1509,7 +1508,7 @@ $$
|
|
|
1509
1508
|
s.link,
|
|
1510
1509
|
s.special(s.string)
|
|
1511
1510
|
],
|
|
1512
|
-
color:
|
|
1511
|
+
color: Pl
|
|
1513
1512
|
},
|
|
1514
1513
|
{ tag: [s.meta, s.comment], color: mt },
|
|
1515
1514
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1518,12 +1517,12 @@ $$
|
|
|
1518
1517
|
{ tag: s.link, color: mt, textDecoration: "underline" },
|
|
1519
1518
|
{ tag: s.heading, fontWeight: "bold", color: dt },
|
|
1520
1519
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: gt },
|
|
1521
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1522
|
-
{ tag: s.invalid, color:
|
|
1523
|
-
]),
|
|
1524
|
-
|
|
1525
|
-
Mt(
|
|
1526
|
-
],
|
|
1520
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: ql },
|
|
1521
|
+
{ tag: s.invalid, color: Ul }
|
|
1522
|
+
]), Xl = [
|
|
1523
|
+
zl,
|
|
1524
|
+
Mt(Zl)
|
|
1525
|
+
], Yl = "#e5c07b", ht = "#3f4a54", Jl = "#56b6c2", Ql = "#fff", ue = "#3f4a54", vt = "#2d8cf0", eo = "#2d8cf0", to = "#3f4a54", kt = "#d19a66", lo = "#c678dd", oo = "#21252b", ao = "#ceedfa33", Ct = "var(--md-bk-color)", Ce = "var(--md-bk-color)", no = "#bad5fa", pt = "#3f4a54", ro = we.theme(
|
|
1527
1526
|
{
|
|
1528
1527
|
"&": {
|
|
1529
1528
|
color: ue,
|
|
@@ -1533,8 +1532,8 @@ $$
|
|
|
1533
1532
|
caretColor: pt
|
|
1534
1533
|
},
|
|
1535
1534
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: pt },
|
|
1536
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1537
|
-
".cm-panels": { backgroundColor:
|
|
1535
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: no },
|
|
1536
|
+
".cm-panels": { backgroundColor: oo, color: ue },
|
|
1538
1537
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1539
1538
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1540
1539
|
".cm-searchMatch": {
|
|
@@ -1556,7 +1555,7 @@ $$
|
|
|
1556
1555
|
borderColor: "var(--md-border-color)"
|
|
1557
1556
|
},
|
|
1558
1557
|
".cm-activeLineGutter": {
|
|
1559
|
-
backgroundColor:
|
|
1558
|
+
backgroundColor: ao
|
|
1560
1559
|
},
|
|
1561
1560
|
".cm-foldPlaceholder": {
|
|
1562
1561
|
backgroundColor: "transparent",
|
|
@@ -1582,10 +1581,10 @@ $$
|
|
|
1582
1581
|
}
|
|
1583
1582
|
}
|
|
1584
1583
|
// { dark: true }
|
|
1585
|
-
),
|
|
1586
|
-
{ tag: s.keyword, color:
|
|
1584
|
+
), io = At.define([
|
|
1585
|
+
{ tag: s.keyword, color: lo },
|
|
1587
1586
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: ht },
|
|
1588
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1587
|
+
{ tag: [s.function(s.variableName), s.labelName], color: eo },
|
|
1589
1588
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: kt },
|
|
1590
1589
|
{ tag: [s.definition(s.name), s.separator], color: ue },
|
|
1591
1590
|
{
|
|
@@ -1599,7 +1598,7 @@ $$
|
|
|
1599
1598
|
s.self,
|
|
1600
1599
|
s.namespace
|
|
1601
1600
|
],
|
|
1602
|
-
color:
|
|
1601
|
+
color: Yl
|
|
1603
1602
|
},
|
|
1604
1603
|
{
|
|
1605
1604
|
tag: [
|
|
@@ -1611,7 +1610,7 @@ $$
|
|
|
1611
1610
|
s.link,
|
|
1612
1611
|
s.special(s.string)
|
|
1613
1612
|
],
|
|
1614
|
-
color:
|
|
1613
|
+
color: Jl
|
|
1615
1614
|
},
|
|
1616
1615
|
{ tag: [s.meta, s.comment], color: vt },
|
|
1617
1616
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1620,11 +1619,11 @@ $$
|
|
|
1620
1619
|
{ tag: s.link, color: vt, textDecoration: "underline" },
|
|
1621
1620
|
{ tag: s.heading, fontWeight: "bold", color: ht },
|
|
1622
1621
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: kt },
|
|
1623
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1624
|
-
{ tag: s.invalid, color:
|
|
1625
|
-
]),
|
|
1626
|
-
|
|
1627
|
-
Mt(
|
|
1622
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: to },
|
|
1623
|
+
{ tag: s.invalid, color: Ql }
|
|
1624
|
+
]), so = [
|
|
1625
|
+
ro,
|
|
1626
|
+
Mt(io)
|
|
1628
1627
|
], fe = (e, o, l, a, r) => (i, g, c, u) => {
|
|
1629
1628
|
const m = `${e}${o}`.slice(u - c);
|
|
1630
1629
|
i.dispatch(i.state.replaceSelection(`${m}${l}${a}`));
|
|
@@ -1644,7 +1643,7 @@ $$
|
|
|
1644
1643
|
}, $t = (e) => (o, l, a, r) => {
|
|
1645
1644
|
const i = e.slice(r - a);
|
|
1646
1645
|
o.dispatch(o.state.replaceSelection(`${i} `));
|
|
1647
|
-
},
|
|
1646
|
+
}, co = (e) => {
|
|
1648
1647
|
const o = (l) => {
|
|
1649
1648
|
const a = l.matchBefore(
|
|
1650
1649
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1740,16 +1739,16 @@ $$`, "title")
|
|
|
1740
1739
|
]
|
|
1741
1740
|
};
|
|
1742
1741
|
};
|
|
1743
|
-
return
|
|
1744
|
-
override: e ? [o,
|
|
1742
|
+
return rl({
|
|
1743
|
+
override: e ? [o, ...e] : [o]
|
|
1745
1744
|
});
|
|
1746
|
-
},
|
|
1747
|
-
const o = new
|
|
1745
|
+
}, uo = co, Q = (e) => {
|
|
1746
|
+
const o = new al();
|
|
1748
1747
|
return (a) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(a) }) : e.dispatch({
|
|
1749
|
-
effects:
|
|
1748
|
+
effects: nl.appendConfig.of(o.of(a))
|
|
1750
1749
|
}), !0);
|
|
1751
1750
|
};
|
|
1752
|
-
class
|
|
1751
|
+
class mo {
|
|
1753
1752
|
constructor(o) {
|
|
1754
1753
|
q(this, "view");
|
|
1755
1754
|
q(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
@@ -1848,7 +1847,7 @@ class fo {
|
|
|
1848
1847
|
setTabSize(o) {
|
|
1849
1848
|
this.toggleTabSize([
|
|
1850
1849
|
ve.tabSize.of(o),
|
|
1851
|
-
|
|
1850
|
+
ol.of(" ".repeat(o))
|
|
1852
1851
|
]);
|
|
1853
1852
|
}
|
|
1854
1853
|
/**
|
|
@@ -1893,7 +1892,7 @@ class fo {
|
|
|
1893
1892
|
]);
|
|
1894
1893
|
}
|
|
1895
1894
|
}
|
|
1896
|
-
const
|
|
1895
|
+
const go = (e) => {
|
|
1897
1896
|
const o = I("editorId");
|
|
1898
1897
|
return (a) => {
|
|
1899
1898
|
if (!a.clipboardData)
|
|
@@ -1922,7 +1921,7 @@ const bo = (e) => {
|
|
|
1922
1921
|
data: r
|
|
1923
1922
|
});
|
|
1924
1923
|
};
|
|
1925
|
-
},
|
|
1924
|
+
}, fo = go, bo = (e) => {
|
|
1926
1925
|
const o = I("editorId");
|
|
1927
1926
|
J(() => {
|
|
1928
1927
|
b.on(o, {
|
|
@@ -1933,7 +1932,7 @@ const bo = (e) => {
|
|
|
1933
1932
|
}
|
|
1934
1933
|
});
|
|
1935
1934
|
});
|
|
1936
|
-
},
|
|
1935
|
+
}, ho = bo, vo = (e, o) => [
|
|
1937
1936
|
{
|
|
1938
1937
|
key: "Ctrl-b",
|
|
1939
1938
|
mac: "Cmd-b",
|
|
@@ -1942,7 +1941,7 @@ const bo = (e) => {
|
|
|
1942
1941
|
{
|
|
1943
1942
|
key: "Ctrl-d",
|
|
1944
1943
|
mac: "Cmd-d",
|
|
1945
|
-
run:
|
|
1944
|
+
run: Qt,
|
|
1946
1945
|
preventDefault: !0
|
|
1947
1946
|
},
|
|
1948
1947
|
{
|
|
@@ -2029,11 +2028,10 @@ const bo = (e) => {
|
|
|
2029
2028
|
{
|
|
2030
2029
|
any: (N, L) => (L.ctrlKey || L.metaKey) && L.altKey && L.shiftKey && L.code === "KeyT" ? (b.emit(e, w, "table"), !0) : !1
|
|
2031
2030
|
}
|
|
2032
|
-
],
|
|
2033
|
-
const o = I("tabWidth"), l = I("editorId"), a = I("theme"), r = K(), i = Et(), g =
|
|
2034
|
-
Xt.of([...g,
|
|
2031
|
+
], ko = vo, Co = (e) => {
|
|
2032
|
+
const o = I("tabWidth"), l = I("editorId"), a = I("theme"), r = K(), i = Et(), g = ko(l, e), c = fo(e), u = [
|
|
2033
|
+
Xt.of([...g, el]),
|
|
2035
2034
|
zt,
|
|
2036
|
-
el(),
|
|
2037
2035
|
Jt({ codeLanguages: Yt }),
|
|
2038
2036
|
// 横向换行
|
|
2039
2037
|
ge.lineWrapping,
|
|
@@ -2058,8 +2056,8 @@ const bo = (e) => {
|
|
|
2058
2056
|
], m = () => {
|
|
2059
2057
|
const d = [
|
|
2060
2058
|
...u,
|
|
2061
|
-
a.value === "light" ?
|
|
2062
|
-
|
|
2059
|
+
a.value === "light" ? so : Xl,
|
|
2060
|
+
uo(e.completions)
|
|
2063
2061
|
];
|
|
2064
2062
|
return Y.codeMirrorExtensions(a.value, d, [
|
|
2065
2063
|
...g
|
|
@@ -2069,24 +2067,24 @@ const bo = (e) => {
|
|
|
2069
2067
|
const d = new ge({
|
|
2070
2068
|
doc: e.modelValue,
|
|
2071
2069
|
parent: r.value
|
|
2072
|
-
}), v = new
|
|
2070
|
+
}), v = new mo(d);
|
|
2073
2071
|
i.value = v, setTimeout(() => {
|
|
2074
2072
|
v.setTabSize(o), v.setDisabled(e.disabled), v.setReadOnly(e.readonly), v.setExtensions(m()), e.placeholder && v.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && v.setMaxLength(e.maxlength), e.autofocus && d.focus();
|
|
2075
2073
|
}, 0), b.on(l, {
|
|
2076
2074
|
name: xt,
|
|
2077
2075
|
callback() {
|
|
2078
|
-
|
|
2076
|
+
tl(d);
|
|
2079
2077
|
}
|
|
2080
2078
|
}), b.on(l, {
|
|
2081
2079
|
name: wt,
|
|
2082
2080
|
callback() {
|
|
2083
|
-
|
|
2081
|
+
ll(d);
|
|
2084
2082
|
}
|
|
2085
2083
|
}), b.on(l, {
|
|
2086
2084
|
name: w,
|
|
2087
2085
|
callback($, T = {}) {
|
|
2088
2086
|
var h;
|
|
2089
|
-
const { text: k, options: f } =
|
|
2087
|
+
const { text: k, options: f } = Bl($, i.value, T);
|
|
2090
2088
|
(h = i.value) == null || h.replaceSelectedText(k, f, l);
|
|
2091
2089
|
}
|
|
2092
2090
|
});
|
|
@@ -2129,24 +2127,24 @@ const bo = (e) => {
|
|
|
2129
2127
|
var d;
|
|
2130
2128
|
e.maxlength && ((d = i.value) == null || d.setMaxLength(e.maxlength));
|
|
2131
2129
|
}
|
|
2132
|
-
),
|
|
2130
|
+
), ho(i), {
|
|
2133
2131
|
inputWrapperRef: r,
|
|
2134
2132
|
codeMirrorUt: i
|
|
2135
2133
|
};
|
|
2136
|
-
},
|
|
2134
|
+
}, po = Co, $o = /* @__PURE__ */ P({
|
|
2137
2135
|
name: "MDEditorContent",
|
|
2138
|
-
props:
|
|
2136
|
+
props: il,
|
|
2139
2137
|
setup(e) {
|
|
2140
2138
|
const o = I("editorId"), l = K(""), {
|
|
2141
2139
|
inputWrapperRef: a,
|
|
2142
2140
|
codeMirrorUt: r
|
|
2143
|
-
} =
|
|
2144
|
-
return
|
|
2141
|
+
} = po(e);
|
|
2142
|
+
return Fl(e, l, r), () => t("div", {
|
|
2145
2143
|
class: `${n}-content`
|
|
2146
2144
|
}, [t("div", {
|
|
2147
2145
|
class: `${n}-input-wrapper`,
|
|
2148
2146
|
ref: a
|
|
2149
|
-
}, null), t(
|
|
2147
|
+
}, null), t(sl, {
|
|
2150
2148
|
modelValue: e.modelValue,
|
|
2151
2149
|
setting: e.setting,
|
|
2152
2150
|
onHtmlChanged: (i) => {
|
|
@@ -2168,7 +2166,7 @@ const bo = (e) => {
|
|
|
2168
2166
|
key: "internal-catalog"
|
|
2169
2167
|
}, null)]);
|
|
2170
2168
|
}
|
|
2171
|
-
}),
|
|
2169
|
+
}), yo = /* @__PURE__ */ P({
|
|
2172
2170
|
props: {
|
|
2173
2171
|
modelValue: {
|
|
2174
2172
|
type: String,
|
|
@@ -2186,7 +2184,7 @@ const bo = (e) => {
|
|
|
2186
2184
|
}, [`${(l = o.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((a = e.modelValue) == null ? void 0 : a.length) || 0])]);
|
|
2187
2185
|
};
|
|
2188
2186
|
}
|
|
2189
|
-
}),
|
|
2187
|
+
}), To = {
|
|
2190
2188
|
checked: {
|
|
2191
2189
|
type: Boolean,
|
|
2192
2190
|
default: !1
|
|
@@ -2196,8 +2194,8 @@ const bo = (e) => {
|
|
|
2196
2194
|
default: () => {
|
|
2197
2195
|
}
|
|
2198
2196
|
}
|
|
2199
|
-
},
|
|
2200
|
-
props:
|
|
2197
|
+
}, wo = /* @__PURE__ */ P({
|
|
2198
|
+
props: To,
|
|
2201
2199
|
setup(e) {
|
|
2202
2200
|
return () => t("div", {
|
|
2203
2201
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2206,7 +2204,7 @@ const bo = (e) => {
|
|
|
2206
2204
|
}
|
|
2207
2205
|
}, null);
|
|
2208
2206
|
}
|
|
2209
|
-
}),
|
|
2207
|
+
}), xo = {
|
|
2210
2208
|
scrollAuto: {
|
|
2211
2209
|
type: Boolean
|
|
2212
2210
|
},
|
|
@@ -2215,8 +2213,8 @@ const bo = (e) => {
|
|
|
2215
2213
|
default: () => {
|
|
2216
2214
|
}
|
|
2217
2215
|
}
|
|
2218
|
-
},
|
|
2219
|
-
props:
|
|
2216
|
+
}, So = /* @__PURE__ */ P({
|
|
2217
|
+
props: xo,
|
|
2220
2218
|
setup(e) {
|
|
2221
2219
|
const o = I("usedLanguageText");
|
|
2222
2220
|
return () => {
|
|
@@ -2228,13 +2226,13 @@ const bo = (e) => {
|
|
|
2228
2226
|
onClick: () => {
|
|
2229
2227
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2230
2228
|
}
|
|
2231
|
-
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(
|
|
2229
|
+
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(wo, {
|
|
2232
2230
|
checked: e.scrollAuto,
|
|
2233
2231
|
onChange: e.onScrollAutoChange
|
|
2234
2232
|
}, null)]);
|
|
2235
2233
|
};
|
|
2236
2234
|
}
|
|
2237
|
-
}),
|
|
2235
|
+
}), Ao = {
|
|
2238
2236
|
modelValue: {
|
|
2239
2237
|
type: String,
|
|
2240
2238
|
default: ""
|
|
@@ -2254,9 +2252,9 @@ const bo = (e) => {
|
|
|
2254
2252
|
defFooters: {
|
|
2255
2253
|
type: Object
|
|
2256
2254
|
}
|
|
2257
|
-
},
|
|
2255
|
+
}, Mo = /* @__PURE__ */ P({
|
|
2258
2256
|
name: "MDEditorFooter",
|
|
2259
|
-
props:
|
|
2257
|
+
props: Ao,
|
|
2260
2258
|
setup(e) {
|
|
2261
2259
|
const o = ye(() => {
|
|
2262
2260
|
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);
|
|
@@ -2265,11 +2263,11 @@ const bo = (e) => {
|
|
|
2265
2263
|
if (Vt.includes(a))
|
|
2266
2264
|
switch (a) {
|
|
2267
2265
|
case "markdownTotal":
|
|
2268
|
-
return t(
|
|
2266
|
+
return t(yo, {
|
|
2269
2267
|
modelValue: e.modelValue
|
|
2270
2268
|
}, null);
|
|
2271
2269
|
case "scrollSwitch":
|
|
2272
|
-
return t(
|
|
2270
|
+
return t(So, {
|
|
2273
2271
|
scrollAuto: e.scrollAuto,
|
|
2274
2272
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2275
2273
|
}, null);
|
|
@@ -2288,10 +2286,10 @@ const bo = (e) => {
|
|
|
2288
2286
|
}, [r])]);
|
|
2289
2287
|
};
|
|
2290
2288
|
}
|
|
2291
|
-
}),
|
|
2289
|
+
}), Lo = /* @__PURE__ */ P({
|
|
2292
2290
|
name: "MdEditorV3",
|
|
2293
|
-
props:
|
|
2294
|
-
emits:
|
|
2291
|
+
props: cl,
|
|
2292
|
+
emits: ul,
|
|
2295
2293
|
setup(e, o) {
|
|
2296
2294
|
const {
|
|
2297
2295
|
editorId: l,
|
|
@@ -2303,11 +2301,11 @@ const bo = (e) => {
|
|
|
2303
2301
|
} = e, u = ee({
|
|
2304
2302
|
scrollAuto: e.scrollAuto
|
|
2305
2303
|
});
|
|
2306
|
-
|
|
2307
|
-
const [m, d] =
|
|
2304
|
+
dl(e, o), ml(e), gl(e), fl(e, o);
|
|
2305
|
+
const [m, d] = bl(e, o), v = hl(e);
|
|
2308
2306
|
return Ht(() => {
|
|
2309
2307
|
b.clear(l);
|
|
2310
|
-
}),
|
|
2308
|
+
}), vl(e, o, v, m, d), () => {
|
|
2311
2309
|
var k;
|
|
2312
2310
|
const $ = ut({
|
|
2313
2311
|
props: e,
|
|
@@ -2320,7 +2318,7 @@ const bo = (e) => {
|
|
|
2320
2318
|
id: l,
|
|
2321
2319
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, m.fullscreen || m.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2322
2320
|
style: e.style
|
|
2323
|
-
}, [t(
|
|
2321
|
+
}, [t(Hl, {
|
|
2324
2322
|
noPrettier: i,
|
|
2325
2323
|
toolbars: e.toolbars,
|
|
2326
2324
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2330,7 +2328,7 @@ const bo = (e) => {
|
|
|
2330
2328
|
defToolbars: $,
|
|
2331
2329
|
noUploadImg: g,
|
|
2332
2330
|
showToolbarName: e.showToolbarName
|
|
2333
|
-
}, null), t(
|
|
2331
|
+
}, null), t($o, {
|
|
2334
2332
|
modelValue: e.modelValue,
|
|
2335
2333
|
setting: m,
|
|
2336
2334
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2372,7 +2370,7 @@ const bo = (e) => {
|
|
|
2372
2370
|
onDrop: (f) => {
|
|
2373
2371
|
e.onDrop ? e.onDrop(f) : o.emit("onDrop", f);
|
|
2374
2372
|
}
|
|
2375
|
-
}, null), ((k = e.footers) == null ? void 0 : k.length) > 0 && t(
|
|
2373
|
+
}, null), ((k = e.footers) == null ? void 0 : k.length) > 0 && t(Mo, {
|
|
2376
2374
|
modelValue: e.modelValue,
|
|
2377
2375
|
footers: e.footers,
|
|
2378
2376
|
defFooters: T,
|
|
@@ -2381,8 +2379,8 @@ const bo = (e) => {
|
|
|
2381
2379
|
}, null)]);
|
|
2382
2380
|
};
|
|
2383
2381
|
}
|
|
2384
|
-
}), pe =
|
|
2385
|
-
pe.install = (e) => (e.component(pe.name, pe), e.use(
|
|
2382
|
+
}), pe = Lo;
|
|
2383
|
+
pe.install = (e) => (e.component(pe.name, pe), e.use(Cl).use(_t).use(pl).use(Lt).use(kl), e);
|
|
2386
2384
|
export {
|
|
2387
2385
|
pe as default
|
|
2388
2386
|
};
|