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