md-editor-v3 4.3.0-beta.6 → 4.3.0-beta.7
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/es/MdEditor.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
var wt = Object.defineProperty;
|
|
2
2
|
var xt = (e, a, l) => a in e ? wt(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l;
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as V, createVNode as t, inject as A, ref as
|
|
5
|
-
import { p as o, a as z, s as Mt, b as Lt, d as
|
|
6
|
-
import { draggingScroll as
|
|
7
|
-
import { a as te, D as
|
|
8
|
-
import { b as
|
|
9
|
-
import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as
|
|
10
|
-
import { a as
|
|
3
|
+
var P = (e, a, l) => (xt(e, typeof a != "symbol" ? a + "" : a, l), l);
|
|
4
|
+
import { defineComponent as V, createVNode as t, inject as A, ref as U, onMounted as X, reactive as Z, computed as fe, watch as H, nextTick as ce, Fragment as kt, cloneVNode as at, toRef as le, shallowRef as St, onBeforeUnmount as At } from "vue";
|
|
5
|
+
import { p as o, a as z, s as Mt, b as Lt, d as It } from "./chunks/config.mjs";
|
|
6
|
+
import { draggingScroll as Dt, linkTo as Et, debounce as Nt, throttle as Ht, smoothScroll as nt } from "@vavt/util";
|
|
7
|
+
import { a as te, D as Ft } from "./chunks/index2.mjs";
|
|
8
|
+
import { b as f, a as Bt } from "./chunks/index3.mjs";
|
|
9
|
+
import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as Xt, M as Yt } from "./chunks/index.mjs";
|
|
10
|
+
import { a as Zt } from "./chunks/dom.mjs";
|
|
11
11
|
import Ct from "./MdModal.mjs";
|
|
12
|
-
import { minimalSetup as
|
|
12
|
+
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";
|
|
@@ -17,19 +17,19 @@ import { htmlCompletionSource as ol, html as al } from "@codemirror/lang-html";
|
|
|
17
17
|
import { deleteLine as nl, indentWithTab as rl, undo as il, redo as sl } from "@codemirror/commands";
|
|
18
18
|
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as cl } from "@codemirror/language";
|
|
19
19
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as
|
|
20
|
+
import { EditorSelection as q, EditorState as ue, Compartment as dl, StateEffect as ul } from "@codemirror/state";
|
|
21
21
|
import { autocompletion as ml } from "@codemirror/autocomplete";
|
|
22
22
|
import Tt from "./MdCatalog.mjs";
|
|
23
23
|
import { g as rt } from "./chunks/vue-tsx.mjs";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
24
|
+
import gl from "./NormalToolbar.mjs";
|
|
25
|
+
import hl from "./ModalToolbar.mjs";
|
|
26
26
|
import "medium-zoom";
|
|
27
27
|
import "copy-to-clipboard";
|
|
28
28
|
import "markdown-it";
|
|
29
29
|
import "markdown-it-image-figures";
|
|
30
30
|
import "markdown-it-task-lists";
|
|
31
31
|
import "lru-cache";
|
|
32
|
-
const
|
|
32
|
+
const fl = /* @__PURE__ */ V({
|
|
33
33
|
setup() {
|
|
34
34
|
return () => t("div", {
|
|
35
35
|
class: `${o}-divider`
|
|
@@ -85,12 +85,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
85
85
|
type: Boolean
|
|
86
86
|
}
|
|
87
87
|
}, vl = (e) => {
|
|
88
|
-
var c,
|
|
88
|
+
var c, g, m, b;
|
|
89
89
|
const a = A("editorId");
|
|
90
|
-
let l = (
|
|
91
|
-
const n = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, r =
|
|
90
|
+
let l = (g = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
|
|
91
|
+
const n = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, r = U(!1), i = ($) => {
|
|
92
92
|
if (!l) {
|
|
93
|
-
|
|
93
|
+
f.emit(a, "errorCatcher", {
|
|
94
94
|
name: "fullscreen",
|
|
95
95
|
message: "fullscreen is undefined"
|
|
96
96
|
});
|
|
@@ -104,13 +104,13 @@ const hl = /* @__PURE__ */ V({
|
|
|
104
104
|
}, d = () => {
|
|
105
105
|
l = window.screenfull, u();
|
|
106
106
|
};
|
|
107
|
-
return
|
|
107
|
+
return X(() => {
|
|
108
108
|
if (u(), !l) {
|
|
109
109
|
const $ = document.createElement("script");
|
|
110
|
-
$.src = n || Mt, $.onload = d, $.id = `${o}-screenfull`,
|
|
110
|
+
$.src = n || Mt, $.onload = d, $.id = `${o}-screenfull`, Zt($, "screenfull");
|
|
111
111
|
}
|
|
112
|
-
}),
|
|
113
|
-
|
|
112
|
+
}), X(() => {
|
|
113
|
+
f.on(a, {
|
|
114
114
|
name: Vt,
|
|
115
115
|
callback: i
|
|
116
116
|
});
|
|
@@ -129,7 +129,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
129
129
|
name: "TableShape",
|
|
130
130
|
props: kl,
|
|
131
131
|
setup(e) {
|
|
132
|
-
const a =
|
|
132
|
+
const a = Z({
|
|
133
133
|
x: -1,
|
|
134
134
|
y: -1
|
|
135
135
|
});
|
|
@@ -176,7 +176,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
176
176
|
}, yl = /* @__PURE__ */ V({
|
|
177
177
|
props: $l,
|
|
178
178
|
setup(e) {
|
|
179
|
-
const a = A("usedLanguageText"), l = A("editorId"), n =
|
|
179
|
+
const a = A("usedLanguageText"), l = A("editorId"), n = fe(() => {
|
|
180
180
|
var i, u;
|
|
181
181
|
switch (e.type) {
|
|
182
182
|
case "link":
|
|
@@ -186,7 +186,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
186
186
|
default:
|
|
187
187
|
return "";
|
|
188
188
|
}
|
|
189
|
-
}), r =
|
|
189
|
+
}), r = Z({
|
|
190
190
|
desc: "",
|
|
191
191
|
url: ""
|
|
192
192
|
});
|
|
@@ -200,7 +200,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
200
200
|
onClose: e.onCancel
|
|
201
201
|
}, {
|
|
202
202
|
default: () => {
|
|
203
|
-
var i, u, d, c,
|
|
203
|
+
var i, u, d, c, g;
|
|
204
204
|
return [t("div", {
|
|
205
205
|
class: `${o}-form-item`
|
|
206
206
|
}, [t("label", {
|
|
@@ -239,7 +239,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
239
239
|
onClick: () => {
|
|
240
240
|
e.onOk(r), r.desc = "", r.url = "";
|
|
241
241
|
}
|
|
242
|
-
}, [(
|
|
242
|
+
}, [(g = a.value.linkModalTips) == null ? void 0 : g.buttonOK])])];
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
}
|
|
@@ -264,7 +264,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
264
264
|
var m, b, $;
|
|
265
265
|
const a = A("usedLanguageText"), l = A("editorId");
|
|
266
266
|
let n = ($ = (b = (m = z) == null ? void 0 : m.editorExtensions) == null ? void 0 : b.cropper) == null ? void 0 : $.instance;
|
|
267
|
-
const r =
|
|
267
|
+
const r = U(), i = U(), u = U(), d = Z({
|
|
268
268
|
cropperInited: !1,
|
|
269
269
|
imgSelected: !1,
|
|
270
270
|
imgSrc: "",
|
|
@@ -275,7 +275,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
275
275
|
H(() => e.visible, () => {
|
|
276
276
|
e.visible && !d.cropperInited && (n = n || window.Cropper, r.value.onchange = () => {
|
|
277
277
|
if (!n) {
|
|
278
|
-
|
|
278
|
+
f.emit(l, "errorCatcher", {
|
|
279
279
|
name: "Cropper",
|
|
280
280
|
message: "Cropper is undefined"
|
|
281
281
|
});
|
|
@@ -284,8 +284,8 @@ const hl = /* @__PURE__ */ V({
|
|
|
284
284
|
const T = r.value.files || [];
|
|
285
285
|
if (d.imgSelected = !0, (T == null ? void 0 : T.length) > 0) {
|
|
286
286
|
const v = new FileReader();
|
|
287
|
-
v.onload = (
|
|
288
|
-
d.imgSrc =
|
|
287
|
+
v.onload = (h) => {
|
|
288
|
+
d.imgSrc = h.target.result, ce(() => {
|
|
289
289
|
c = new n(i.value, {
|
|
290
290
|
viewMode: 2,
|
|
291
291
|
preview: `.${o}-clip-preview-target`
|
|
@@ -306,7 +306,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
306
306
|
}));
|
|
307
307
|
});
|
|
308
308
|
});
|
|
309
|
-
const
|
|
309
|
+
const g = () => {
|
|
310
310
|
c.clear(), c.destroy(), c = null, r.value.value = "", d.imgSelected = !1;
|
|
311
311
|
};
|
|
312
312
|
return () => {
|
|
@@ -325,7 +325,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
325
325
|
height: "421px"
|
|
326
326
|
}, {
|
|
327
327
|
default: () => {
|
|
328
|
-
var v,
|
|
328
|
+
var v, h;
|
|
329
329
|
return [t("div", {
|
|
330
330
|
class: `${o}-form-item ${o}-clip`
|
|
331
331
|
}, [t("div", {
|
|
@@ -341,7 +341,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
341
341
|
alt: ""
|
|
342
342
|
}, null), t("div", {
|
|
343
343
|
class: `${o}-clip-delete`,
|
|
344
|
-
onClick:
|
|
344
|
+
onClick: g
|
|
345
345
|
}, [t("svg", {
|
|
346
346
|
class: `${o}-icon`,
|
|
347
347
|
"aria-hidden": "true"
|
|
@@ -370,10 +370,10 @@ const hl = /* @__PURE__ */ V({
|
|
|
370
370
|
onClick: () => {
|
|
371
371
|
if (c) {
|
|
372
372
|
const k = c.getCroppedCanvas();
|
|
373
|
-
|
|
373
|
+
f.emit(l, "uploadImage", [Bt(k.toDataURL("image/png"))], e.onOk), g();
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
}, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((
|
|
376
|
+
}, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((h = a.value.linkModalTips) == null ? void 0 : h.buttonOK)])]), t("input", {
|
|
377
377
|
ref: r,
|
|
378
378
|
accept: "image/*",
|
|
379
379
|
type: "file",
|
|
@@ -429,7 +429,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
429
429
|
setup(e) {
|
|
430
430
|
const a = A("editorId"), l = A("usedLanguageText"), {
|
|
431
431
|
fullscreenHandler: n
|
|
432
|
-
} = vl(e), r = `${a}-toolbar-wrapper`, i =
|
|
432
|
+
} = vl(e), r = `${a}-toolbar-wrapper`, i = U(), u = Z({
|
|
433
433
|
title: !1,
|
|
434
434
|
catalog: !1,
|
|
435
435
|
// 图片上传下拉
|
|
@@ -439,40 +439,40 @@ const hl = /* @__PURE__ */ V({
|
|
|
439
439
|
// mermaid
|
|
440
440
|
mermaid: !1,
|
|
441
441
|
katex: !1
|
|
442
|
-
}), d = (v,
|
|
443
|
-
|
|
444
|
-
}, c =
|
|
442
|
+
}), d = (v, h) => {
|
|
443
|
+
f.emit(a, "replace", v, h);
|
|
444
|
+
}, c = Z({
|
|
445
445
|
type: "link",
|
|
446
446
|
linkVisible: !1,
|
|
447
447
|
clipVisible: !1
|
|
448
|
-
}),
|
|
449
|
-
|
|
450
|
-
|
|
448
|
+
}), g = U();
|
|
449
|
+
X(() => {
|
|
450
|
+
f.on(a, {
|
|
451
451
|
name: "openModals",
|
|
452
452
|
callback(v) {
|
|
453
453
|
c.type = v, c.linkVisible = !0;
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
});
|
|
457
|
-
const m =
|
|
458
|
-
const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)),
|
|
457
|
+
const m = fe(() => {
|
|
458
|
+
const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)), h = v.indexOf("="), k = h === -1 ? v : v.slice(0, h + 1), y = h === -1 ? [] : v.slice(h, Number.MAX_SAFE_INTEGER);
|
|
459
459
|
return [k, y];
|
|
460
|
-
}), b =
|
|
461
|
-
|
|
460
|
+
}), b = U(), $ = () => {
|
|
461
|
+
f.emit(a, "uploadImage", Array.from(b.value.files || [])), b.value.value = "";
|
|
462
462
|
};
|
|
463
|
-
|
|
463
|
+
X(() => {
|
|
464
464
|
b.value.addEventListener("change", $);
|
|
465
465
|
});
|
|
466
466
|
const T = (v) => {
|
|
467
|
-
var
|
|
467
|
+
var h, k, y, w, x, L, C, M, R, I, D, O, F, E, j, G, ne, J, _, K, Q, W, N, B, ee, re, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, Ie, De, Ee, Ne, He, Fe, Be, Ve, Oe, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Xe, Ye, Ze, Je, Qe, et, tt, lt, ot;
|
|
468
468
|
if (Lt.includes(v))
|
|
469
469
|
switch (v) {
|
|
470
470
|
case "-":
|
|
471
|
-
return t(
|
|
471
|
+
return t(fl, null, null);
|
|
472
472
|
case "bold":
|
|
473
473
|
return t("div", {
|
|
474
474
|
class: `${o}-toolbar-item`,
|
|
475
|
-
title: (
|
|
475
|
+
title: (h = l.value.toolbarTips) == null ? void 0 : h.bold,
|
|
476
476
|
onClick: () => {
|
|
477
477
|
d("bold");
|
|
478
478
|
}
|
|
@@ -551,12 +551,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
551
551
|
onClick: () => {
|
|
552
552
|
d("h2");
|
|
553
553
|
}
|
|
554
|
-
}, [(
|
|
554
|
+
}, [(I = l.value.titleItem) == null ? void 0 : I.h2]), t("li", {
|
|
555
555
|
class: `${o}-menu-item`,
|
|
556
556
|
onClick: () => {
|
|
557
557
|
d("h3");
|
|
558
558
|
}
|
|
559
|
-
}, [(
|
|
559
|
+
}, [(D = l.value.titleItem) == null ? void 0 : D.h3]), t("li", {
|
|
560
560
|
class: `${o}-menu-item`,
|
|
561
561
|
onClick: () => {
|
|
562
562
|
d("h4");
|
|
@@ -566,12 +566,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
566
566
|
onClick: () => {
|
|
567
567
|
d("h5");
|
|
568
568
|
}
|
|
569
|
-
}, [(
|
|
569
|
+
}, [(F = l.value.titleItem) == null ? void 0 : F.h5]), t("li", {
|
|
570
570
|
class: `${o}-menu-item`,
|
|
571
571
|
onClick: () => {
|
|
572
572
|
d("h6");
|
|
573
573
|
}
|
|
574
|
-
}, [(
|
|
574
|
+
}, [(E = l.value.titleItem) == null ? void 0 : E.h6])])
|
|
575
575
|
}, {
|
|
576
576
|
default: () => {
|
|
577
577
|
var p, S;
|
|
@@ -602,7 +602,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
602
602
|
"xlink:href": "#md-editor-icon-sub"
|
|
603
603
|
}, null)]), e.showToolbarName && t("div", {
|
|
604
604
|
class: `${o}-toolbar-item-name`
|
|
605
|
-
}, [(
|
|
605
|
+
}, [(G = l.value.toolbarTips) == null ? void 0 : G.sub])]);
|
|
606
606
|
case "sup":
|
|
607
607
|
return t("div", {
|
|
608
608
|
class: `${o}-toolbar-item`,
|
|
@@ -617,7 +617,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
617
617
|
"xlink:href": "#md-editor-icon-sup"
|
|
618
618
|
}, null)]), e.showToolbarName && t("div", {
|
|
619
619
|
class: `${o}-toolbar-item-name`
|
|
620
|
-
}, [(
|
|
620
|
+
}, [(J = l.value.toolbarTips) == null ? void 0 : J.sup])]);
|
|
621
621
|
case "quote":
|
|
622
622
|
return t("div", {
|
|
623
623
|
class: `${o}-toolbar-item`,
|
|
@@ -632,7 +632,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
632
632
|
"xlink:href": "#md-editor-icon-quote"
|
|
633
633
|
}, null)]), e.showToolbarName && t("div", {
|
|
634
634
|
class: `${o}-toolbar-item-name`
|
|
635
|
-
}, [(
|
|
635
|
+
}, [(K = l.value.toolbarTips) == null ? void 0 : K.quote])]);
|
|
636
636
|
case "unorderedList":
|
|
637
637
|
return t("div", {
|
|
638
638
|
class: `${o}-toolbar-item`,
|
|
@@ -651,7 +651,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
651
651
|
case "orderedList":
|
|
652
652
|
return t("div", {
|
|
653
653
|
class: `${o}-toolbar-item`,
|
|
654
|
-
title: (
|
|
654
|
+
title: (N = l.value.toolbarTips) == null ? void 0 : N.orderedList,
|
|
655
655
|
onClick: () => {
|
|
656
656
|
d("orderedList");
|
|
657
657
|
}
|
|
@@ -662,7 +662,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
662
662
|
"xlink:href": "#md-editor-icon-ordered-list"
|
|
663
663
|
}, null)]), e.showToolbarName && t("div", {
|
|
664
664
|
class: `${o}-toolbar-item-name`
|
|
665
|
-
}, [(
|
|
665
|
+
}, [(B = l.value.toolbarTips) == null ? void 0 : B.orderedList])]);
|
|
666
666
|
case "task":
|
|
667
667
|
return t("div", {
|
|
668
668
|
class: `${o}-toolbar-item`,
|
|
@@ -817,7 +817,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
817
817
|
class: `${o}-toolbar-item`,
|
|
818
818
|
title: (Me = l.value.toolbarTips) == null ? void 0 : Me.revoke,
|
|
819
819
|
onClick: () => {
|
|
820
|
-
|
|
820
|
+
f.emit(a, "ctrlZ");
|
|
821
821
|
}
|
|
822
822
|
}, [t("svg", {
|
|
823
823
|
class: `${o}-icon`,
|
|
@@ -830,9 +830,9 @@ const hl = /* @__PURE__ */ V({
|
|
|
830
830
|
case "next":
|
|
831
831
|
return t("div", {
|
|
832
832
|
class: `${o}-toolbar-item`,
|
|
833
|
-
title: (
|
|
833
|
+
title: (Ie = l.value.toolbarTips) == null ? void 0 : Ie.next,
|
|
834
834
|
onClick: () => {
|
|
835
|
-
|
|
835
|
+
f.emit(a, "ctrlShiftZ");
|
|
836
836
|
}
|
|
837
837
|
}, [t("svg", {
|
|
838
838
|
class: `${o}-icon`,
|
|
@@ -841,13 +841,13 @@ const hl = /* @__PURE__ */ V({
|
|
|
841
841
|
"xlink:href": "#md-editor-icon-next"
|
|
842
842
|
}, null)]), e.showToolbarName && t("div", {
|
|
843
843
|
class: `${o}-toolbar-item-name`
|
|
844
|
-
}, [(
|
|
844
|
+
}, [(De = l.value.toolbarTips) == null ? void 0 : De.next])]);
|
|
845
845
|
case "save":
|
|
846
846
|
return t("div", {
|
|
847
847
|
class: `${o}-toolbar-item`,
|
|
848
|
-
title: (
|
|
848
|
+
title: (Ee = l.value.toolbarTips) == null ? void 0 : Ee.save,
|
|
849
849
|
onClick: () => {
|
|
850
|
-
|
|
850
|
+
f.emit(a, pt);
|
|
851
851
|
}
|
|
852
852
|
}, [t("svg", {
|
|
853
853
|
class: `${o}-icon`,
|
|
@@ -856,7 +856,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
856
856
|
"xlink:href": "#md-editor-icon-baocun"
|
|
857
857
|
}, null)]), e.showToolbarName && t("div", {
|
|
858
858
|
class: `${o}-toolbar-item-name`
|
|
859
|
-
}, [(
|
|
859
|
+
}, [(Ne = l.value.toolbarTips) == null ? void 0 : Ne.save])]);
|
|
860
860
|
case "prettier":
|
|
861
861
|
return e.noPrettier ? "" : t("div", {
|
|
862
862
|
class: `${o}-toolbar-item`,
|
|
@@ -871,11 +871,11 @@ const hl = /* @__PURE__ */ V({
|
|
|
871
871
|
"xlink:href": "#md-editor-icon-prettier"
|
|
872
872
|
}, null)]), e.showToolbarName && t("div", {
|
|
873
873
|
class: `${o}-toolbar-item-name`
|
|
874
|
-
}, [(
|
|
874
|
+
}, [(Fe = l.value.toolbarTips) == null ? void 0 : Fe.prettier])]);
|
|
875
875
|
case "pageFullscreen":
|
|
876
876
|
return !e.setting.fullscreen && t("div", {
|
|
877
877
|
class: `${o}-toolbar-item`,
|
|
878
|
-
title: (
|
|
878
|
+
title: (Be = l.value.toolbarTips) == null ? void 0 : Be.pageFullscreen,
|
|
879
879
|
onClick: () => {
|
|
880
880
|
e.updateSetting("pageFullscreen");
|
|
881
881
|
}
|
|
@@ -937,7 +937,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
937
937
|
class: `${o}-toolbar-item`,
|
|
938
938
|
title: (Ke = l.value.toolbarTips) == null ? void 0 : Ke.catalog,
|
|
939
939
|
onClick: () => {
|
|
940
|
-
|
|
940
|
+
f.emit(a, Ot);
|
|
941
941
|
},
|
|
942
942
|
key: "bar-catalog"
|
|
943
943
|
}, [t("svg", {
|
|
@@ -952,7 +952,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
952
952
|
return t("div", {
|
|
953
953
|
class: `${o}-toolbar-item`,
|
|
954
954
|
title: (_e = l.value.toolbarTips) == null ? void 0 : _e.github,
|
|
955
|
-
onClick: () =>
|
|
955
|
+
onClick: () => Et("https://github.com/imzbf/md-editor-v3")
|
|
956
956
|
}, [t("svg", {
|
|
957
957
|
class: `${o}-icon`,
|
|
958
958
|
"aria-hidden": "true"
|
|
@@ -983,22 +983,22 @@ const hl = /* @__PURE__ */ V({
|
|
|
983
983
|
onClick: () => {
|
|
984
984
|
d("sequence");
|
|
985
985
|
}
|
|
986
|
-
}, [(
|
|
986
|
+
}, [(Xe = l.value.mermaid) == null ? void 0 : Xe.sequence]), t("li", {
|
|
987
987
|
class: `${o}-menu-item`,
|
|
988
988
|
onClick: () => {
|
|
989
989
|
d("gantt");
|
|
990
990
|
}
|
|
991
|
-
}, [(
|
|
991
|
+
}, [(Ye = l.value.mermaid) == null ? void 0 : Ye.gantt]), t("li", {
|
|
992
992
|
class: `${o}-menu-item`,
|
|
993
993
|
onClick: () => {
|
|
994
994
|
d("class");
|
|
995
995
|
}
|
|
996
|
-
}, [(
|
|
996
|
+
}, [(Ze = l.value.mermaid) == null ? void 0 : Ze.class]), t("li", {
|
|
997
997
|
class: `${o}-menu-item`,
|
|
998
998
|
onClick: () => {
|
|
999
999
|
d("state");
|
|
1000
1000
|
}
|
|
1001
|
-
}, [(
|
|
1001
|
+
}, [(Je = l.value.mermaid) == null ? void 0 : Je.state]), t("li", {
|
|
1002
1002
|
class: `${o}-menu-item`,
|
|
1003
1003
|
onClick: () => {
|
|
1004
1004
|
d("pie");
|
|
@@ -1076,7 +1076,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
1076
1076
|
const p = e.defToolbars[v];
|
|
1077
1077
|
return p ? at(p, {
|
|
1078
1078
|
insert(de) {
|
|
1079
|
-
|
|
1079
|
+
f.emit(a, "replace", "universal", {
|
|
1080
1080
|
generate: de
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
@@ -1085,7 +1085,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
1085
1085
|
const p = e.defToolbars.children[v];
|
|
1086
1086
|
return p ? at(p, {
|
|
1087
1087
|
insert(de) {
|
|
1088
|
-
|
|
1088
|
+
f.emit(a, "replace", "universal", {
|
|
1089
1089
|
generate: de
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
@@ -1095,12 +1095,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
1095
1095
|
};
|
|
1096
1096
|
return H(() => e.toolbars, () => {
|
|
1097
1097
|
ce(() => {
|
|
1098
|
-
i.value &&
|
|
1098
|
+
i.value && Dt(i.value);
|
|
1099
1099
|
});
|
|
1100
1100
|
}, {
|
|
1101
1101
|
immediate: !0
|
|
1102
1102
|
}), () => {
|
|
1103
|
-
const v = m.value[0].map((k) => T(k)),
|
|
1103
|
+
const v = m.value[0].map((k) => T(k)), h = m.value[1].map((k) => T(k));
|
|
1104
1104
|
return t(kt, null, [e.toolbars.length > 0 && t("div", {
|
|
1105
1105
|
class: `${o}-toolbar-wrapper`,
|
|
1106
1106
|
ref: i,
|
|
@@ -1109,10 +1109,10 @@ const hl = /* @__PURE__ */ V({
|
|
|
1109
1109
|
class: [`${o}-toolbar`, e.showToolbarName && `${o}-stn`]
|
|
1110
1110
|
}, [t("div", {
|
|
1111
1111
|
class: `${o}-toolbar-left`,
|
|
1112
|
-
ref:
|
|
1112
|
+
ref: g
|
|
1113
1113
|
}, [v]), t("div", {
|
|
1114
1114
|
class: `${o}-toolbar-right`
|
|
1115
|
-
}, [
|
|
1115
|
+
}, [h])])]), t("input", {
|
|
1116
1116
|
ref: b,
|
|
1117
1117
|
accept: "image/*",
|
|
1118
1118
|
type: "file",
|
|
@@ -1137,15 +1137,15 @@ const hl = /* @__PURE__ */ V({
|
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
}), Ml = (e, a) => {
|
|
1140
|
-
const l =
|
|
1140
|
+
const l = Nt(() => {
|
|
1141
1141
|
e.removeEventListener("scroll", n), e.addEventListener("scroll", n), a.removeEventListener("scroll", n), a.addEventListener("scroll", n);
|
|
1142
1142
|
}, 50), n = (r) => {
|
|
1143
|
-
const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight,
|
|
1143
|
+
const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight, g = (d - i) / (c - u);
|
|
1144
1144
|
r.target === e ? (a.removeEventListener("scroll", n), a.scrollTo({
|
|
1145
|
-
top: e.scrollTop /
|
|
1145
|
+
top: e.scrollTop / g
|
|
1146
1146
|
// behavior: 'smooth'
|
|
1147
1147
|
}), l()) : (e.removeEventListener("scroll", n), e.scrollTo({
|
|
1148
|
-
top: a.scrollTop *
|
|
1148
|
+
top: a.scrollTop * g
|
|
1149
1149
|
// behavior: 'smooth'
|
|
1150
1150
|
}), l());
|
|
1151
1151
|
};
|
|
@@ -1165,92 +1165,92 @@ const hl = /* @__PURE__ */ V({
|
|
|
1165
1165
|
const d = () => {
|
|
1166
1166
|
u = [];
|
|
1167
1167
|
const b = Array.from(a.querySelectorAll("[data-line]")).map(
|
|
1168
|
-
(
|
|
1168
|
+
(h) => Number(h.dataset.line) + 1
|
|
1169
1169
|
), { lines: $ } = n.state.doc;
|
|
1170
1170
|
let T = 1, v = b.shift() ?? $;
|
|
1171
|
-
for (let
|
|
1172
|
-
|
|
1171
|
+
for (let h = 1; h <= $; h++)
|
|
1172
|
+
h === v && (T = h, v = b.shift() || $ + 1), u.push({
|
|
1173
1173
|
start: T,
|
|
1174
1174
|
end: v - 1
|
|
1175
1175
|
});
|
|
1176
1176
|
};
|
|
1177
|
-
let c = 0,
|
|
1177
|
+
let c = 0, g = 0;
|
|
1178
1178
|
const m = Ht((b) => {
|
|
1179
|
-
var v,
|
|
1179
|
+
var v, h, k, y, w, x, L;
|
|
1180
1180
|
if (!((v = a.firstElementChild) != null && v.firstElementChild))
|
|
1181
1181
|
return;
|
|
1182
1182
|
const $ = n.lineBlockAtHeight(n.scrollDOM.scrollTop), { number: T } = n.state.doc.lineAt($.from);
|
|
1183
1183
|
if (!(T > u.length) && !(n.state.doc.lines < u[u.length - 1].end))
|
|
1184
1184
|
if (b.target === e) {
|
|
1185
|
-
if (
|
|
1185
|
+
if (g !== 0)
|
|
1186
1186
|
return;
|
|
1187
1187
|
c++;
|
|
1188
1188
|
const C = u[T - 1], M = r(C.end) + i(C.end);
|
|
1189
1189
|
let R = 0;
|
|
1190
|
-
const
|
|
1191
|
-
let
|
|
1192
|
-
|
|
1193
|
-
const j =
|
|
1190
|
+
const I = r(C.start), D = a.querySelector(`[data-line="${C.start - 1}"]`) || ((h = a.firstElementChild) == null ? void 0 : h.firstElementChild), O = a.querySelector(`[data-line="${C.end}"]`) || ((k = a.lastElementChild) == null ? void 0 : k.lastElementChild);
|
|
1191
|
+
let F = 0, E = 0;
|
|
1192
|
+
I === 0 ? (R = (n.scrollDOM.scrollTop - I) / (M - I), F = O.offsetTop) : M > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (R = (n.scrollDOM.scrollTop - I) / (n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight - I), E = D.offsetTop, F = a.scrollHeight - a.clientHeight - E + 10) : (R = (n.scrollDOM.scrollTop - I) / (M - I), E = D.offsetTop, F = O.offsetTop - E);
|
|
1193
|
+
const j = E - 10 + F * R;
|
|
1194
1194
|
nt(a, j, () => {
|
|
1195
1195
|
c--;
|
|
1196
1196
|
});
|
|
1197
1197
|
} else {
|
|
1198
1198
|
if (c !== 0)
|
|
1199
1199
|
return;
|
|
1200
|
-
|
|
1200
|
+
g++;
|
|
1201
1201
|
const C = Array.from(
|
|
1202
1202
|
a.querySelectorAll("[data-line]")
|
|
1203
1203
|
), M = a.scrollTop, R = a.scrollHeight;
|
|
1204
|
-
let
|
|
1204
|
+
let I = C.length === 0 ? 1 : Math.ceil(
|
|
1205
1205
|
Number(C[C.length - 1].dataset.line) * (M / R)
|
|
1206
|
-
),
|
|
1207
|
-
for (let
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1206
|
+
), D = (y = a.firstElementChild) == null ? void 0 : y.firstElementChild;
|
|
1207
|
+
for (let N = I; N >= 0; N--) {
|
|
1208
|
+
const B = a.querySelector(`[data-line="${N}"]`);
|
|
1209
|
+
if (B && B.offsetTop <= M) {
|
|
1210
|
+
D = B, I = N;
|
|
1211
1211
|
break;
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
|
-
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild,
|
|
1214
|
+
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild, F = (x = a.firstElementChild) == null ? void 0 : x.lastElementChild;
|
|
1215
1215
|
for (; C.length > 0; ) {
|
|
1216
|
-
const
|
|
1217
|
-
if (
|
|
1216
|
+
const N = C.indexOf(D);
|
|
1217
|
+
if (N + 1 >= C.length)
|
|
1218
1218
|
break;
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1219
|
+
const B = C[N + 1];
|
|
1220
|
+
if (N === -1) {
|
|
1221
|
+
F = B;
|
|
1222
1222
|
break;
|
|
1223
1223
|
}
|
|
1224
|
-
const ee =
|
|
1224
|
+
const ee = D.offsetTop;
|
|
1225
1225
|
if (ee > M) {
|
|
1226
|
-
if (
|
|
1227
|
-
O =
|
|
1226
|
+
if (N === 0) {
|
|
1227
|
+
O = D, F = B;
|
|
1228
1228
|
break;
|
|
1229
1229
|
}
|
|
1230
|
-
|
|
1230
|
+
D = C[N - 1];
|
|
1231
1231
|
continue;
|
|
1232
1232
|
}
|
|
1233
|
-
const re =
|
|
1233
|
+
const re = B.offsetTop;
|
|
1234
1234
|
if (ee <= M && re > M) {
|
|
1235
|
-
O =
|
|
1235
|
+
O = D, F = B;
|
|
1236
1236
|
break;
|
|
1237
1237
|
}
|
|
1238
|
-
|
|
1238
|
+
D = B;
|
|
1239
1239
|
}
|
|
1240
|
-
const
|
|
1241
|
-
let
|
|
1242
|
-
const { start: ne, end:
|
|
1243
|
-
let
|
|
1244
|
-
const Q = i(
|
|
1240
|
+
const E = O.offsetTop, j = F.offsetTop;
|
|
1241
|
+
let G = 0;
|
|
1242
|
+
const { start: ne, end: J } = u[Number(O.dataset.line || 0)], _ = r(ne);
|
|
1243
|
+
let K = r(J);
|
|
1244
|
+
const Q = i(J);
|
|
1245
1245
|
let W = 0;
|
|
1246
|
-
O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (
|
|
1247
|
-
(M -
|
|
1246
|
+
O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (G = Math.max(M / j, 0), W = K + Q - _) : K > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (G = Math.max(
|
|
1247
|
+
(M - E) / (a.scrollHeight - E - a.clientHeight),
|
|
1248
1248
|
0
|
|
1249
|
-
),
|
|
1250
|
-
(M -
|
|
1249
|
+
), K = r(n.state.doc.lines) + i(n.state.doc.lines), W = 8 + K - _ - e.clientHeight) : (G = Math.max(
|
|
1250
|
+
(M - E) / (j - E),
|
|
1251
1251
|
0
|
|
1252
|
-
), W =
|
|
1253
|
-
|
|
1252
|
+
), W = K + Q - _), nt(e, _ + W * G, () => {
|
|
1253
|
+
g--;
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
}, 10);
|
|
@@ -1262,7 +1262,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
1262
1262
|
u = [], e.removeEventListener("scroll", m), a.removeEventListener("scroll", m);
|
|
1263
1263
|
}
|
|
1264
1264
|
];
|
|
1265
|
-
},
|
|
1265
|
+
}, Il = (e, a, l) => {
|
|
1266
1266
|
const n = A("editorId");
|
|
1267
1267
|
let r = () => {
|
|
1268
1268
|
}, i = () => {
|
|
@@ -1271,12 +1271,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
1271
1271
|
r();
|
|
1272
1272
|
const d = document.querySelector(".cm-scroller"), c = document.querySelector(
|
|
1273
1273
|
`[id="${n}-preview-wrapper"][data-show="true"]`
|
|
1274
|
-
),
|
|
1274
|
+
), g = document.querySelector(
|
|
1275
1275
|
`[id="${n}-html-wrapper"][data-show="true"]`
|
|
1276
1276
|
);
|
|
1277
|
-
(c ||
|
|
1277
|
+
(c || g) && ([i, r] = (c ? Ll : Ml)(
|
|
1278
1278
|
d,
|
|
1279
|
-
c ||
|
|
1279
|
+
c || g,
|
|
1280
1280
|
l.value
|
|
1281
1281
|
)), e.scrollAuto && i();
|
|
1282
1282
|
};
|
|
@@ -1296,19 +1296,19 @@ const hl = /* @__PURE__ */ V({
|
|
|
1296
1296
|
(d) => {
|
|
1297
1297
|
d ? i() : r();
|
|
1298
1298
|
}
|
|
1299
|
-
),
|
|
1300
|
-
},
|
|
1301
|
-
var m, b, $, T, v,
|
|
1299
|
+
), X(u);
|
|
1300
|
+
}, Dl = Il, El = (e, a, l) => {
|
|
1301
|
+
var m, b, $, T, v, h;
|
|
1302
1302
|
let n = "", r = 0, i = 0, u = !0, d = !1;
|
|
1303
|
-
const c = a.getSelectedText(),
|
|
1303
|
+
const c = a.getSelectedText(), g = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
1304
1304
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1305
1305
|
const k = e.replace(/^h(\d)/, (y, w) => new Array(Number(w)).fill("#", 0, w).join(""));
|
|
1306
1306
|
n = `${k} ${c}`, r = k.length + 1;
|
|
1307
1307
|
} else if (e === "prettier") {
|
|
1308
1308
|
const k = window.prettier || (($ = (b = z.editorExtensions) == null ? void 0 : b.prettier) == null ? void 0 : $.prettierInstance), y = [
|
|
1309
|
-
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((
|
|
1309
|
+
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((h = (v = z.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : h.parserMarkdownInstance)
|
|
1310
1310
|
];
|
|
1311
|
-
!k || y[0] === void 0 ? (
|
|
1311
|
+
!k || y[0] === void 0 ? (f.emit(l.editorId, "errorCatcher", {
|
|
1312
1312
|
name: "prettier",
|
|
1313
1313
|
message: "prettier is undefined"
|
|
1314
1314
|
}), n = a.getValue()) : n = k.format(a.getValue(), {
|
|
@@ -1401,7 +1401,7 @@ ${k}
|
|
|
1401
1401
|
}
|
|
1402
1402
|
case "flow": {
|
|
1403
1403
|
n = `\`\`\`mermaid
|
|
1404
|
-
${(
|
|
1404
|
+
${(g == null ? void 0 : g.flow) || `flowchart TD
|
|
1405
1405
|
Start --> Stop`}
|
|
1406
1406
|
\`\`\`
|
|
1407
1407
|
`, r = 3, i = 10 - n.length;
|
|
@@ -1409,7 +1409,7 @@ ${(f == null ? void 0 : f.flow) || `flowchart TD
|
|
|
1409
1409
|
}
|
|
1410
1410
|
case "sequence": {
|
|
1411
1411
|
n = `\`\`\`mermaid
|
|
1412
|
-
${(
|
|
1412
|
+
${(g == null ? void 0 : g.sequence) || `sequenceDiagram
|
|
1413
1413
|
A->>B: hello!
|
|
1414
1414
|
B-->>A: hi!
|
|
1415
1415
|
A-)B: bye!`}
|
|
@@ -1419,7 +1419,7 @@ ${(f == null ? void 0 : f.sequence) || `sequenceDiagram
|
|
|
1419
1419
|
}
|
|
1420
1420
|
case "gantt": {
|
|
1421
1421
|
n = `\`\`\`mermaid
|
|
1422
|
-
${(
|
|
1422
|
+
${(g == null ? void 0 : g.gantt) || `gantt
|
|
1423
1423
|
title A Gantt Diagram
|
|
1424
1424
|
dateFormat YYYY-MM-DD
|
|
1425
1425
|
section Section
|
|
@@ -1431,7 +1431,7 @@ Another task :after a1, 20d`}
|
|
|
1431
1431
|
}
|
|
1432
1432
|
case "class": {
|
|
1433
1433
|
n = `\`\`\`mermaid
|
|
1434
|
-
${(
|
|
1434
|
+
${(g == null ? void 0 : g.class) || `classDiagram
|
|
1435
1435
|
class Animal
|
|
1436
1436
|
Vehicle <|-- Car`}
|
|
1437
1437
|
\`\`\`
|
|
@@ -1440,7 +1440,7 @@ ${(f == null ? void 0 : f.class) || `classDiagram
|
|
|
1440
1440
|
}
|
|
1441
1441
|
case "state": {
|
|
1442
1442
|
n = `\`\`\`mermaid
|
|
1443
|
-
${(
|
|
1443
|
+
${(g == null ? void 0 : g.state) || `stateDiagram-v2
|
|
1444
1444
|
s1 --> s2`}
|
|
1445
1445
|
\`\`\`
|
|
1446
1446
|
`, r = 3, i = 10 - n.length;
|
|
@@ -1448,7 +1448,7 @@ ${(f == null ? void 0 : f.state) || `stateDiagram-v2
|
|
|
1448
1448
|
}
|
|
1449
1449
|
case "pie": {
|
|
1450
1450
|
n = `\`\`\`mermaid
|
|
1451
|
-
${(
|
|
1451
|
+
${(g == null ? void 0 : g.pie) || `pie title Pets adopted by volunteers
|
|
1452
1452
|
"Dogs" : 386
|
|
1453
1453
|
"Cats" : 85
|
|
1454
1454
|
"Rats" : 15`}
|
|
@@ -1458,7 +1458,7 @@ ${(f == null ? void 0 : f.pie) || `pie title Pets adopted by volunteers
|
|
|
1458
1458
|
}
|
|
1459
1459
|
case "relationship": {
|
|
1460
1460
|
n = `\`\`\`mermaid
|
|
1461
|
-
${(
|
|
1461
|
+
${(g == null ? void 0 : g.relationship) || `erDiagram
|
|
1462
1462
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1463
1463
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1464
1464
|
\`\`\`
|
|
@@ -1467,7 +1467,7 @@ ${(f == null ? void 0 : f.relationship) || `erDiagram
|
|
|
1467
1467
|
}
|
|
1468
1468
|
case "journey": {
|
|
1469
1469
|
n = `\`\`\`mermaid
|
|
1470
|
-
${(
|
|
1470
|
+
${(g == null ? void 0 : g.journey) || `journey
|
|
1471
1471
|
title My working day
|
|
1472
1472
|
section Go to work
|
|
1473
1473
|
Make tea: 5: Me
|
|
@@ -1509,7 +1509,7 @@ $$
|
|
|
1509
1509
|
replaceAll: d
|
|
1510
1510
|
}
|
|
1511
1511
|
};
|
|
1512
|
-
},
|
|
1512
|
+
}, Nl = "#e5c07b", it = "var(--md-color)", Hl = "#56b6c2", Fl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Bl = "#e5c07b", Vl = "var(--md-color)", ct = "#d19a66", Ol = "#c678dd", Rl = "#21252b", Pl = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", ql = "#ceedfa33", ut = "#528bff", Ul = be.theme(
|
|
1513
1513
|
{
|
|
1514
1514
|
"&": {
|
|
1515
1515
|
color: oe,
|
|
@@ -1571,7 +1571,7 @@ $$
|
|
|
1571
1571
|
), Gl = $t.define([
|
|
1572
1572
|
{ tag: s.keyword, color: Ol },
|
|
1573
1573
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: it },
|
|
1574
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1574
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Bl },
|
|
1575
1575
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ct },
|
|
1576
1576
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1577
1577
|
{
|
|
@@ -1585,7 +1585,7 @@ $$
|
|
|
1585
1585
|
s.self,
|
|
1586
1586
|
s.namespace
|
|
1587
1587
|
],
|
|
1588
|
-
color:
|
|
1588
|
+
color: Nl
|
|
1589
1589
|
},
|
|
1590
1590
|
{
|
|
1591
1591
|
tag: [
|
|
@@ -1607,22 +1607,22 @@ $$
|
|
|
1607
1607
|
{ tag: s.heading, fontWeight: "bold", color: it },
|
|
1608
1608
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ct },
|
|
1609
1609
|
{ tag: [s.processingInstruction, s.string, s.inserted], color: Vl },
|
|
1610
|
-
{ tag: s.invalid, color:
|
|
1610
|
+
{ tag: s.invalid, color: Fl }
|
|
1611
1611
|
]), Kl = [
|
|
1612
1612
|
Ul,
|
|
1613
1613
|
yt(Gl)
|
|
1614
|
-
], jl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", Wl = "#fff", ae = "#3f4a54",
|
|
1614
|
+
], jl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", Wl = "#fff", ae = "#3f4a54", gt = "#2d8cf0", zl = "#2d8cf0", Xl = "#3f4a54", ht = "#d19a66", Yl = "#c678dd", Zl = "#21252b", Jl = "#ceedfa33", ft = "var(--md-bk-color)", ge = "var(--md-bk-color)", Ql = "#bad5fa", bt = "#3f4a54", eo = be.theme(
|
|
1615
1615
|
{
|
|
1616
1616
|
"&": {
|
|
1617
1617
|
color: ae,
|
|
1618
|
-
backgroundColor:
|
|
1618
|
+
backgroundColor: ft
|
|
1619
1619
|
},
|
|
1620
1620
|
".cm-content": {
|
|
1621
1621
|
caretColor: bt
|
|
1622
1622
|
},
|
|
1623
1623
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
|
|
1624
1624
|
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ql },
|
|
1625
|
-
".cm-panels": { backgroundColor:
|
|
1625
|
+
".cm-panels": { backgroundColor: Zl, color: ae },
|
|
1626
1626
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1627
1627
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1628
1628
|
".cm-searchMatch": {
|
|
@@ -1638,13 +1638,13 @@ $$
|
|
|
1638
1638
|
backgroundColor: "#bad0f847"
|
|
1639
1639
|
},
|
|
1640
1640
|
".cm-gutters": {
|
|
1641
|
-
backgroundColor:
|
|
1641
|
+
backgroundColor: ft,
|
|
1642
1642
|
color: ae,
|
|
1643
1643
|
borderRight: "1px solid",
|
|
1644
1644
|
borderColor: "var(--md-border-color)"
|
|
1645
1645
|
},
|
|
1646
1646
|
".cm-activeLineGutter": {
|
|
1647
|
-
backgroundColor:
|
|
1647
|
+
backgroundColor: Jl
|
|
1648
1648
|
},
|
|
1649
1649
|
".cm-foldPlaceholder": {
|
|
1650
1650
|
backgroundColor: "transparent",
|
|
@@ -1653,15 +1653,15 @@ $$
|
|
|
1653
1653
|
},
|
|
1654
1654
|
".cm-tooltip": {
|
|
1655
1655
|
border: "1px solid var(--md-border-color)",
|
|
1656
|
-
backgroundColor:
|
|
1656
|
+
backgroundColor: ge
|
|
1657
1657
|
},
|
|
1658
1658
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1659
1659
|
borderTopColor: "transparent",
|
|
1660
1660
|
borderBottomColor: "transparent"
|
|
1661
1661
|
},
|
|
1662
1662
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1663
|
-
borderTopColor:
|
|
1664
|
-
borderBottomColor:
|
|
1663
|
+
borderTopColor: ge,
|
|
1664
|
+
borderBottomColor: ge
|
|
1665
1665
|
},
|
|
1666
1666
|
".cm-tooltip-autocomplete": {
|
|
1667
1667
|
"& > ul > li[aria-selected]": {
|
|
@@ -1671,10 +1671,10 @@ $$
|
|
|
1671
1671
|
}
|
|
1672
1672
|
// { dark: true }
|
|
1673
1673
|
), to = $t.define([
|
|
1674
|
-
{ tag: s.keyword, color:
|
|
1674
|
+
{ tag: s.keyword, color: Yl },
|
|
1675
1675
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: mt },
|
|
1676
1676
|
{ tag: [s.function(s.variableName), s.labelName], color: zl },
|
|
1677
|
-
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color:
|
|
1677
|
+
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ht },
|
|
1678
1678
|
{ tag: [s.definition(s.name), s.separator], color: ae },
|
|
1679
1679
|
{
|
|
1680
1680
|
tag: [
|
|
@@ -1701,30 +1701,30 @@ $$
|
|
|
1701
1701
|
],
|
|
1702
1702
|
color: _l
|
|
1703
1703
|
},
|
|
1704
|
-
{ tag: [s.meta, s.comment], color:
|
|
1704
|
+
{ tag: [s.meta, s.comment], color: gt },
|
|
1705
1705
|
{ tag: s.strong, fontWeight: "bold" },
|
|
1706
1706
|
{ tag: s.emphasis, fontStyle: "italic" },
|
|
1707
1707
|
{ tag: s.strikethrough, textDecoration: "line-through" },
|
|
1708
|
-
{ tag: s.link, color:
|
|
1708
|
+
{ tag: s.link, color: gt, textDecoration: "underline" },
|
|
1709
1709
|
{ tag: s.heading, fontWeight: "bold", color: mt },
|
|
1710
|
-
{ tag: [s.atom, s.bool, s.special(s.variableName)], color:
|
|
1711
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1710
|
+
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ht },
|
|
1711
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Xl },
|
|
1712
1712
|
{ tag: s.invalid, color: Wl }
|
|
1713
1713
|
]), lo = [
|
|
1714
1714
|
eo,
|
|
1715
1715
|
yt(to)
|
|
1716
1716
|
], se = (e, a, l, n, r) => (i, u, d, c) => {
|
|
1717
|
-
const
|
|
1718
|
-
i.dispatch(i.state.replaceSelection(`${
|
|
1717
|
+
const g = `${e}${a}`.slice(c - d);
|
|
1718
|
+
i.dispatch(i.state.replaceSelection(`${g}${l}${n}`));
|
|
1719
1719
|
const m = d + u.label.length + (r === "title" ? l.length : 0);
|
|
1720
1720
|
i.dispatch({
|
|
1721
|
-
selection:
|
|
1721
|
+
selection: q.create(
|
|
1722
1722
|
[
|
|
1723
|
-
|
|
1723
|
+
q.range(
|
|
1724
1724
|
d + u.label.length + (r === "title" ? 1 : -a.length),
|
|
1725
1725
|
m
|
|
1726
1726
|
),
|
|
1727
|
-
|
|
1727
|
+
q.cursor(m)
|
|
1728
1728
|
],
|
|
1729
1729
|
1
|
|
1730
1730
|
)
|
|
@@ -1831,7 +1831,7 @@ $$`, "title")
|
|
|
1831
1831
|
return ml({
|
|
1832
1832
|
override: e ? [a, ol, ...e] : [a]
|
|
1833
1833
|
});
|
|
1834
|
-
}, ao = oo,
|
|
1834
|
+
}, ao = oo, Y = (e) => {
|
|
1835
1835
|
const a = new dl();
|
|
1836
1836
|
return (n) => (a.get(e.state) ? e.dispatch({ effects: a.reconfigure(n) }) : e.dispatch({
|
|
1837
1837
|
effects: ul.appendConfig.of(a.of(n))
|
|
@@ -1839,18 +1839,19 @@ $$`, "title")
|
|
|
1839
1839
|
};
|
|
1840
1840
|
class no {
|
|
1841
1841
|
constructor(a) {
|
|
1842
|
-
|
|
1842
|
+
P(this, "view");
|
|
1843
|
+
P(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
1843
1844
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
1844
|
-
|
|
1845
|
-
|
|
1845
|
+
P(this, "toggleTabSize");
|
|
1846
|
+
P(this, "togglePlaceholder");
|
|
1846
1847
|
/**
|
|
1847
1848
|
* 设置全部的扩展
|
|
1848
1849
|
*/
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
this.view = a, this.toggleTabSize =
|
|
1850
|
+
P(this, "setExtensions");
|
|
1851
|
+
P(this, "toggleDisabled");
|
|
1852
|
+
P(this, "toggleReadOnly");
|
|
1853
|
+
P(this, "toggleMaxlength");
|
|
1854
|
+
this.view = a, this.toggleTabSize = Y(this.view), this.togglePlaceholder = Y(this.view), this.setExtensions = Y(this.view), this.toggleDisabled = Y(this.view), this.toggleReadOnly = Y(this.view), this.toggleMaxlength = Y(this.view);
|
|
1854
1855
|
}
|
|
1855
1856
|
getValue() {
|
|
1856
1857
|
return this.view.state.doc.toString();
|
|
@@ -1894,35 +1895,37 @@ class no {
|
|
|
1894
1895
|
// 直接替换所有文本
|
|
1895
1896
|
replaceAll: !1
|
|
1896
1897
|
}, n) {
|
|
1897
|
-
var r;
|
|
1898
1898
|
try {
|
|
1899
1899
|
if (l.replaceAll) {
|
|
1900
|
-
this.setValue(a)
|
|
1900
|
+
if (this.setValue(a), a.length > this.maxLength)
|
|
1901
|
+
throw new Error("The input text is too long");
|
|
1901
1902
|
return;
|
|
1902
1903
|
}
|
|
1903
|
-
|
|
1904
|
+
if (this.view.state.doc.length - this.getSelectedText().length + a.length > this.maxLength)
|
|
1905
|
+
throw new Error("The input text is too long");
|
|
1906
|
+
const { from: r } = this.view.state.selection.main;
|
|
1904
1907
|
if (this.view.dispatch(this.view.state.replaceSelection(a)), l.select) {
|
|
1905
|
-
const
|
|
1908
|
+
const i = r + a.length + l.deviationEnd;
|
|
1906
1909
|
this.view.dispatch({
|
|
1907
|
-
selection:
|
|
1910
|
+
selection: q.create(
|
|
1908
1911
|
[
|
|
1909
|
-
|
|
1910
|
-
|
|
1912
|
+
q.range(r + l.deviationStart, i),
|
|
1913
|
+
q.cursor(i)
|
|
1911
1914
|
],
|
|
1912
1915
|
1
|
|
1913
1916
|
)
|
|
1914
1917
|
});
|
|
1915
1918
|
}
|
|
1916
1919
|
this.view.focus();
|
|
1917
|
-
} catch (
|
|
1918
|
-
if (
|
|
1919
|
-
|
|
1920
|
+
} catch (r) {
|
|
1921
|
+
if (r.message === "The input text is too long")
|
|
1922
|
+
f.emit(n, "errorCatcher", {
|
|
1920
1923
|
name: "overlength",
|
|
1921
|
-
message:
|
|
1924
|
+
message: r.message,
|
|
1922
1925
|
data: a
|
|
1923
1926
|
});
|
|
1924
1927
|
else
|
|
1925
|
-
throw
|
|
1928
|
+
throw r;
|
|
1926
1929
|
}
|
|
1927
1930
|
}
|
|
1928
1931
|
/**
|
|
@@ -1960,8 +1963,8 @@ class no {
|
|
|
1960
1963
|
}
|
|
1961
1964
|
this.view.dispatch({
|
|
1962
1965
|
scrollIntoView: !0,
|
|
1963
|
-
selection:
|
|
1964
|
-
[
|
|
1966
|
+
selection: q.create(
|
|
1967
|
+
[q.range(l, n), q.cursor(r)],
|
|
1965
1968
|
1
|
|
1966
1969
|
)
|
|
1967
1970
|
});
|
|
@@ -1973,7 +1976,7 @@ class no {
|
|
|
1973
1976
|
this.toggleReadOnly([ue.readOnly.of(a)]);
|
|
1974
1977
|
}
|
|
1975
1978
|
setMaxLength(a) {
|
|
1976
|
-
this.toggleMaxlength([
|
|
1979
|
+
this.maxLength = a, this.toggleMaxlength([
|
|
1977
1980
|
ue.changeFilter.of((l) => l.newDoc.length <= a)
|
|
1978
1981
|
]);
|
|
1979
1982
|
}
|
|
@@ -1985,7 +1988,7 @@ const ro = (e) => {
|
|
|
1985
1988
|
return;
|
|
1986
1989
|
if (n.clipboardData.files.length > 0) {
|
|
1987
1990
|
const { files: i } = n.clipboardData;
|
|
1988
|
-
|
|
1991
|
+
f.emit(
|
|
1989
1992
|
a,
|
|
1990
1993
|
"uploadImage",
|
|
1991
1994
|
Array.from(i).filter((u) => /image\/.*/.test(u.type))
|
|
@@ -1994,14 +1997,14 @@ const ro = (e) => {
|
|
|
1994
1997
|
}
|
|
1995
1998
|
if (e.autoDetectCode && n.clipboardData.types.includes("vscode-editor-data")) {
|
|
1996
1999
|
const i = JSON.parse(n.clipboardData.getData("vscode-editor-data"));
|
|
1997
|
-
|
|
2000
|
+
f.emit(a, "replace", "code", {
|
|
1998
2001
|
mode: i.mode,
|
|
1999
2002
|
text: n.clipboardData.getData("text/plain")
|
|
2000
2003
|
}), n.preventDefault();
|
|
2001
2004
|
return;
|
|
2002
2005
|
}
|
|
2003
2006
|
const r = n.clipboardData.getData("text/plain");
|
|
2004
|
-
e.maxlength && r.length + e.value.length > e.maxlength &&
|
|
2007
|
+
e.maxlength && r.length + e.value.length > e.maxlength && f.emit(a, "errorCatcher", {
|
|
2005
2008
|
name: "overlength",
|
|
2006
2009
|
message: "The input text is too long",
|
|
2007
2010
|
data: r
|
|
@@ -2009,8 +2012,8 @@ const ro = (e) => {
|
|
|
2009
2012
|
};
|
|
2010
2013
|
}, io = ro, so = (e) => {
|
|
2011
2014
|
const a = A("editorId");
|
|
2012
|
-
|
|
2013
|
-
|
|
2015
|
+
X(() => {
|
|
2016
|
+
f.on(a, {
|
|
2014
2017
|
name: Rt,
|
|
2015
2018
|
callback(l) {
|
|
2016
2019
|
var n;
|
|
@@ -2022,7 +2025,7 @@ const ro = (e) => {
|
|
|
2022
2025
|
{
|
|
2023
2026
|
key: "Ctrl-b",
|
|
2024
2027
|
mac: "Cmd-b",
|
|
2025
|
-
run: () => (
|
|
2028
|
+
run: () => (f.emit(e, "replace", "bold"), !0)
|
|
2026
2029
|
},
|
|
2027
2030
|
{
|
|
2028
2031
|
key: "Ctrl-d",
|
|
@@ -2033,91 +2036,91 @@ const ro = (e) => {
|
|
|
2033
2036
|
{
|
|
2034
2037
|
key: "Ctrl-s",
|
|
2035
2038
|
mac: "Cmd-s",
|
|
2036
|
-
run: (L) => (
|
|
2037
|
-
shift: () => (
|
|
2039
|
+
run: (L) => (f.emit(e, pt, L.state.doc.toString()), !0),
|
|
2040
|
+
shift: () => (f.emit(e, "replace", "strikeThrough"), !0)
|
|
2038
2041
|
},
|
|
2039
2042
|
{
|
|
2040
2043
|
key: "Ctrl-u",
|
|
2041
2044
|
mac: "Cmd-u",
|
|
2042
|
-
run: () => (
|
|
2043
|
-
shift: () => (
|
|
2045
|
+
run: () => (f.emit(e, "replace", "underline"), !0),
|
|
2046
|
+
shift: () => (f.emit(e, "replace", "unorderedList"), !0)
|
|
2044
2047
|
},
|
|
2045
2048
|
{
|
|
2046
2049
|
key: "Ctrl-i",
|
|
2047
2050
|
mac: "Cmd-i",
|
|
2048
|
-
run: () => (
|
|
2049
|
-
shift: () => (
|
|
2051
|
+
run: () => (f.emit(e, "replace", "italic"), !0),
|
|
2052
|
+
shift: () => (f.emit(e, "openModals", "image"), !0)
|
|
2050
2053
|
},
|
|
2051
2054
|
{
|
|
2052
2055
|
key: "Ctrl-1",
|
|
2053
2056
|
mac: "Cmd-1",
|
|
2054
|
-
run: () => (
|
|
2057
|
+
run: () => (f.emit(e, "replace", "h1"), !0)
|
|
2055
2058
|
},
|
|
2056
2059
|
{
|
|
2057
2060
|
key: "Ctrl-2",
|
|
2058
2061
|
mac: "Cmd-2",
|
|
2059
|
-
run: () => (
|
|
2062
|
+
run: () => (f.emit(e, "replace", "h2"), !0)
|
|
2060
2063
|
},
|
|
2061
2064
|
{
|
|
2062
2065
|
key: "Ctrl-3",
|
|
2063
2066
|
mac: "Cmd-3",
|
|
2064
|
-
run: () => (
|
|
2067
|
+
run: () => (f.emit(e, "replace", "h3"), !0)
|
|
2065
2068
|
},
|
|
2066
2069
|
{
|
|
2067
2070
|
key: "Ctrl-4",
|
|
2068
2071
|
mac: "Cmd-4",
|
|
2069
|
-
run: () => (
|
|
2072
|
+
run: () => (f.emit(e, "replace", "h4"), !0)
|
|
2070
2073
|
},
|
|
2071
2074
|
{
|
|
2072
2075
|
key: "Ctrl-5",
|
|
2073
2076
|
mac: "Cmd-5",
|
|
2074
|
-
run: () => (
|
|
2077
|
+
run: () => (f.emit(e, "replace", "h5"), !0)
|
|
2075
2078
|
},
|
|
2076
2079
|
{
|
|
2077
2080
|
key: "Ctrl-6",
|
|
2078
2081
|
mac: "Cmd-6",
|
|
2079
|
-
run: () => (
|
|
2082
|
+
run: () => (f.emit(e, "replace", "h6"), !0)
|
|
2080
2083
|
},
|
|
2081
2084
|
{
|
|
2082
2085
|
key: "Ctrl-ArrowUp",
|
|
2083
2086
|
mac: "Cmd-ArrowUp",
|
|
2084
|
-
run: () => (
|
|
2087
|
+
run: () => (f.emit(e, "replace", "sup"), !0)
|
|
2085
2088
|
},
|
|
2086
2089
|
{
|
|
2087
2090
|
key: "Ctrl-ArrowDown",
|
|
2088
2091
|
mac: "Cmd-ArrowDown",
|
|
2089
|
-
run: () => (
|
|
2092
|
+
run: () => (f.emit(e, "replace", "sub"), !0)
|
|
2090
2093
|
},
|
|
2091
2094
|
{
|
|
2092
2095
|
key: "Ctrl-o",
|
|
2093
2096
|
mac: "Cmd-o",
|
|
2094
|
-
run: () => (
|
|
2097
|
+
run: () => (f.emit(e, "replace", "orderedList"), !0)
|
|
2095
2098
|
},
|
|
2096
2099
|
{
|
|
2097
2100
|
key: "Ctrl-c",
|
|
2098
2101
|
mac: "Cmd-c",
|
|
2099
|
-
shift: () => (
|
|
2102
|
+
shift: () => (f.emit(e, "replace", "code"), !0),
|
|
2100
2103
|
any(L, C) {
|
|
2101
|
-
return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (
|
|
2104
|
+
return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (f.emit(e, "replace", "codeRow"), !0) : !1;
|
|
2102
2105
|
}
|
|
2103
2106
|
},
|
|
2104
2107
|
{
|
|
2105
2108
|
key: "Ctrl-l",
|
|
2106
2109
|
mac: "Cmd-l",
|
|
2107
|
-
run: () => (
|
|
2110
|
+
run: () => (f.emit(e, "openModals", "link"), !0)
|
|
2108
2111
|
},
|
|
2109
2112
|
{
|
|
2110
2113
|
key: "Ctrl-f",
|
|
2111
2114
|
mac: "Cmd-f",
|
|
2112
|
-
shift: () => a.noPrettier ? !1 : (
|
|
2115
|
+
shift: () => a.noPrettier ? !1 : (f.emit(e, "replace", "prettier"), !0)
|
|
2113
2116
|
},
|
|
2114
2117
|
{
|
|
2115
|
-
any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (
|
|
2118
|
+
any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (f.emit(e, "replace", "table"), !0) : !1
|
|
2116
2119
|
}
|
|
2117
|
-
], mo = uo,
|
|
2118
|
-
const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r =
|
|
2120
|
+
], mo = uo, go = (e) => {
|
|
2121
|
+
const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r = U(), i = St(), u = mo(l, e), d = io(e), c = [
|
|
2119
2122
|
el.of([...u, rl]),
|
|
2120
|
-
|
|
2123
|
+
Jt,
|
|
2121
2124
|
al(),
|
|
2122
2125
|
ll({ codeLanguages: tl }),
|
|
2123
2126
|
// 横向换行
|
|
@@ -2132,14 +2135,14 @@ const ro = (e) => {
|
|
|
2132
2135
|
input: (m) => {
|
|
2133
2136
|
e.onInput && e.onInput(m);
|
|
2134
2137
|
const { data: b } = m;
|
|
2135
|
-
e.maxlength && e.value.length + b.length > e.maxlength &&
|
|
2138
|
+
e.maxlength && e.value.length + b.length > e.maxlength && f.emit(l, "errorCatcher", {
|
|
2136
2139
|
name: "overlength",
|
|
2137
2140
|
message: "The input text is too long",
|
|
2138
2141
|
data: b
|
|
2139
2142
|
});
|
|
2140
2143
|
}
|
|
2141
2144
|
})
|
|
2142
|
-
],
|
|
2145
|
+
], g = () => {
|
|
2143
2146
|
const m = [
|
|
2144
2147
|
...c,
|
|
2145
2148
|
n.value === "light" ? lo : Kl,
|
|
@@ -2149,36 +2152,36 @@ const ro = (e) => {
|
|
|
2149
2152
|
...u
|
|
2150
2153
|
]);
|
|
2151
2154
|
};
|
|
2152
|
-
return
|
|
2155
|
+
return X(() => {
|
|
2153
2156
|
const m = new ie({
|
|
2154
2157
|
doc: e.value,
|
|
2155
2158
|
parent: r.value
|
|
2156
2159
|
}), b = new no(m);
|
|
2157
2160
|
i.value = b, setTimeout(() => {
|
|
2158
|
-
b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(
|
|
2159
|
-
}, 0),
|
|
2161
|
+
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
|
+
}, 0), f.on(l, {
|
|
2160
2163
|
name: "ctrlZ",
|
|
2161
2164
|
callback() {
|
|
2162
2165
|
il(m);
|
|
2163
2166
|
}
|
|
2164
|
-
}),
|
|
2167
|
+
}), f.on(l, {
|
|
2165
2168
|
name: "ctrlShiftZ",
|
|
2166
2169
|
callback() {
|
|
2167
2170
|
sl(m);
|
|
2168
2171
|
}
|
|
2169
|
-
}),
|
|
2172
|
+
}), f.on(l, {
|
|
2170
2173
|
name: "replace",
|
|
2171
2174
|
callback($, T = {}) {
|
|
2172
2175
|
var k;
|
|
2173
|
-
const { text: v, options:
|
|
2174
|
-
(k = i.value) == null || k.replaceSelectedText(v,
|
|
2176
|
+
const { text: v, options: h } = El($, i.value, T);
|
|
2177
|
+
(k = i.value) == null || k.replaceSelectedText(v, h, l);
|
|
2175
2178
|
}
|
|
2176
2179
|
});
|
|
2177
2180
|
}), H(
|
|
2178
2181
|
[n, le(e, "completions")],
|
|
2179
2182
|
() => {
|
|
2180
2183
|
var m;
|
|
2181
|
-
(m = i.value) == null || m.setExtensions(
|
|
2184
|
+
(m = i.value) == null || m.setExtensions(g());
|
|
2182
2185
|
},
|
|
2183
2186
|
{
|
|
2184
2187
|
deep: !0
|
|
@@ -2217,7 +2220,7 @@ const ro = (e) => {
|
|
|
2217
2220
|
inputWrapperRef: r,
|
|
2218
2221
|
codeMirrorUt: i
|
|
2219
2222
|
};
|
|
2220
|
-
},
|
|
2223
|
+
}, ho = go, fo = {
|
|
2221
2224
|
value: {
|
|
2222
2225
|
type: String,
|
|
2223
2226
|
default: ""
|
|
@@ -2322,13 +2325,13 @@ const ro = (e) => {
|
|
|
2322
2325
|
}
|
|
2323
2326
|
}, bo = /* @__PURE__ */ V({
|
|
2324
2327
|
name: "MDEditorContent",
|
|
2325
|
-
props:
|
|
2328
|
+
props: fo,
|
|
2326
2329
|
setup(e) {
|
|
2327
|
-
const a = A("editorId"), l =
|
|
2330
|
+
const a = A("editorId"), l = U(""), {
|
|
2328
2331
|
inputWrapperRef: n,
|
|
2329
2332
|
codeMirrorUt: r
|
|
2330
|
-
} =
|
|
2331
|
-
return
|
|
2333
|
+
} = ho(e);
|
|
2334
|
+
return Dl(e, l, r), () => t("div", {
|
|
2332
2335
|
class: `${o}-content`
|
|
2333
2336
|
}, [t("div", {
|
|
2334
2337
|
class: `${o}-input-wrapper`,
|
|
@@ -2444,11 +2447,11 @@ const ro = (e) => {
|
|
|
2444
2447
|
name: "MDEditorFooter",
|
|
2445
2448
|
props: yo,
|
|
2446
2449
|
setup(e) {
|
|
2447
|
-
const a =
|
|
2450
|
+
const a = fe(() => {
|
|
2448
2451
|
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);
|
|
2449
2452
|
return [r, i];
|
|
2450
2453
|
}), l = (n) => {
|
|
2451
|
-
if (
|
|
2454
|
+
if (It.includes(n))
|
|
2452
2455
|
switch (n) {
|
|
2453
2456
|
case "markdownTotal":
|
|
2454
2457
|
return t(vo, {
|
|
@@ -2486,14 +2489,14 @@ const ro = (e) => {
|
|
|
2486
2489
|
noPrettier: i,
|
|
2487
2490
|
noUploadImg: u,
|
|
2488
2491
|
noHighlight: d
|
|
2489
|
-
} = e, c =
|
|
2492
|
+
} = e, c = Z({
|
|
2490
2493
|
scrollAuto: e.scrollAuto
|
|
2491
2494
|
});
|
|
2492
2495
|
Gt(e, a), Kt(e), jt(e), _t(e, a);
|
|
2493
|
-
const [
|
|
2496
|
+
const [g, m] = Wt(e, a), b = zt(e);
|
|
2494
2497
|
return At(() => {
|
|
2495
|
-
|
|
2496
|
-
}),
|
|
2498
|
+
f.clear(l);
|
|
2499
|
+
}), Xt(e, a, b, g, m), () => {
|
|
2497
2500
|
var v;
|
|
2498
2501
|
const $ = rt({
|
|
2499
2502
|
props: e,
|
|
@@ -2504,13 +2507,13 @@ const ro = (e) => {
|
|
|
2504
2507
|
}, "defFooters");
|
|
2505
2508
|
return t("div", {
|
|
2506
2509
|
id: l,
|
|
2507
|
-
class: [o, e.class, e.theme === "dark" && `${o}-dark`,
|
|
2510
|
+
class: [o, e.class, e.theme === "dark" && `${o}-dark`, g.fullscreen || g.pageFullscreen ? `${o}-fullscreen` : ""],
|
|
2508
2511
|
style: e.style
|
|
2509
2512
|
}, [t(Al, {
|
|
2510
2513
|
noPrettier: i,
|
|
2511
2514
|
toolbars: e.toolbars,
|
|
2512
2515
|
toolbarsExclude: e.toolbarsExclude,
|
|
2513
|
-
setting:
|
|
2516
|
+
setting: g,
|
|
2514
2517
|
updateSetting: m,
|
|
2515
2518
|
tableShape: e.tableShape,
|
|
2516
2519
|
defToolbars: $,
|
|
@@ -2518,7 +2521,7 @@ const ro = (e) => {
|
|
|
2518
2521
|
showToolbarName: e.showToolbarName
|
|
2519
2522
|
}, null), t(bo, {
|
|
2520
2523
|
value: e.modelValue,
|
|
2521
|
-
setting:
|
|
2524
|
+
setting: g,
|
|
2522
2525
|
mdHeadingId: e.mdHeadingId,
|
|
2523
2526
|
noMermaid: r,
|
|
2524
2527
|
noPrettier: i,
|
|
@@ -2533,23 +2536,23 @@ const ro = (e) => {
|
|
|
2533
2536
|
maxlength: e.maxLength,
|
|
2534
2537
|
autoDetectCode: e.autoDetectCode,
|
|
2535
2538
|
noHighlight: d,
|
|
2536
|
-
onChange: (
|
|
2537
|
-
e.onChange ? e.onChange(
|
|
2539
|
+
onChange: (h) => {
|
|
2540
|
+
e.onChange ? e.onChange(h) : (a.emit("update:modelValue", h), a.emit("onChange", h));
|
|
2538
2541
|
},
|
|
2539
|
-
onHtmlChanged: (
|
|
2540
|
-
e.onHtmlChanged ? e.onHtmlChanged(
|
|
2542
|
+
onHtmlChanged: (h) => {
|
|
2543
|
+
e.onHtmlChanged ? e.onHtmlChanged(h) : a.emit("onHtmlChanged", h);
|
|
2541
2544
|
},
|
|
2542
|
-
onGetCatalog: (
|
|
2543
|
-
e.onGetCatalog ? e.onGetCatalog(
|
|
2545
|
+
onGetCatalog: (h) => {
|
|
2546
|
+
e.onGetCatalog ? e.onGetCatalog(h) : a.emit("onGetCatalog", h);
|
|
2544
2547
|
},
|
|
2545
|
-
onBlur: (
|
|
2546
|
-
e.onBlur ? e.onBlur(
|
|
2548
|
+
onBlur: (h) => {
|
|
2549
|
+
e.onBlur ? e.onBlur(h) : a.emit("onBlur", h);
|
|
2547
2550
|
},
|
|
2548
|
-
onFocus: (
|
|
2549
|
-
e.onFocus ? e.onFocus(
|
|
2551
|
+
onFocus: (h) => {
|
|
2552
|
+
e.onFocus ? e.onFocus(h) : a.emit("onFocus", h);
|
|
2550
2553
|
},
|
|
2551
|
-
onInput: (
|
|
2552
|
-
e.onInput ? e.onInput(
|
|
2554
|
+
onInput: (h) => {
|
|
2555
|
+
e.onInput ? e.onInput(h) : a.emit("onInput", h);
|
|
2553
2556
|
},
|
|
2554
2557
|
completions: e.completions,
|
|
2555
2558
|
catalogVisible: b.value,
|
|
@@ -2559,12 +2562,12 @@ const ro = (e) => {
|
|
|
2559
2562
|
footers: e.footers,
|
|
2560
2563
|
defFooters: T,
|
|
2561
2564
|
scrollAuto: c.scrollAuto,
|
|
2562
|
-
onScrollAutoChange: (
|
|
2565
|
+
onScrollAutoChange: (h) => c.scrollAuto = h
|
|
2563
2566
|
}, null)]);
|
|
2564
2567
|
};
|
|
2565
2568
|
}
|
|
2566
|
-
}),
|
|
2567
|
-
|
|
2569
|
+
}), he = wo;
|
|
2570
|
+
he.install = (e) => (e.component(he.name, he), e.use(gl).use(Ft).use(hl).use(Tt).use(Yt), e);
|
|
2568
2571
|
export {
|
|
2569
|
-
|
|
2572
|
+
he as default
|
|
2570
2573
|
};
|