md-editor-v3 4.5.0-beta.0 → 4.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/cjs/MdEditor.cjs +10 -10
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +513 -512
- package/lib/es/index.mjs +16 -17
- package/lib/types/MdEditor/type.d.ts +2 -4
- package/lib/umd/index.js +35 -35
- package/package.json +2 -2
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
1
1
|
var xt = Object.defineProperty;
|
|
2
2
|
var St = (e, o, l) => o in e ? xt(e, o, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[o] = l;
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { p as n, a as
|
|
6
|
-
import { draggingScroll as
|
|
7
|
-
import { a as
|
|
8
|
-
import { b
|
|
9
|
-
import { C as
|
|
3
|
+
var U = (e, o, l) => (St(e, typeof o != "symbol" ? o + "" : o, l), l);
|
|
4
|
+
import { defineComponent as R, createVNode as t, inject as L, ref as K, onMounted as Y, reactive as Q, computed as ke, watch as B, nextTick as me, Fragment as pt, cloneVNode as nt, toRef as ne, shallowRef as At, onBeforeUnmount as Mt } from "vue";
|
|
5
|
+
import { p as n, a as X, s as It, b as Lt, d as Dt } from "./chunks/config.mjs";
|
|
6
|
+
import { draggingScroll as Et, linkTo as Ht, debounce as Nt, throttle as Vt, smoothScroll as rt } from "@vavt/util";
|
|
7
|
+
import { a as ae, D as Ot } from "./chunks/index2.mjs";
|
|
8
|
+
import { b, a as Bt } from "./chunks/index4.mjs";
|
|
9
|
+
import { C as Ft, a as Rt, O as Ct, T as Pt, c as qt, b as Ut, e as Gt, d as Kt, u as _t, f as jt, g as Wt, h as zt, i as Zt, j as Xt, k as Yt, M as Jt } from "./chunks/index.mjs";
|
|
10
10
|
import { a as Qt } from "./chunks/dom.mjs";
|
|
11
|
-
import { M as $t, I as
|
|
12
|
-
import { minimalSetup as el, EditorView as
|
|
13
|
-
import { EditorView as
|
|
11
|
+
import { M as $t, I as C } from "./chunks/index3.mjs";
|
|
12
|
+
import { minimalSetup as el, EditorView as ue } from "codemirror";
|
|
13
|
+
import { EditorView as pe, placeholder as tl, keymap as ll } from "@codemirror/view";
|
|
14
14
|
import { languages as ol } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as al } from "@codemirror/lang-markdown";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { HighlightStyle as yt, syntaxHighlighting as Tt, indentUnit as dl } from "@codemirror/language";
|
|
16
|
+
import { deleteLine as nl, indentWithTab as rl, undo as il, redo as sl } from "@codemirror/commands";
|
|
17
|
+
import { HighlightStyle as yt, syntaxHighlighting as Tt, indentUnit as cl } from "@codemirror/language";
|
|
19
18
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as
|
|
21
|
-
import { autocompletion as
|
|
19
|
+
import { EditorSelection as G, EditorState as fe, Compartment as ul, StateEffect as dl } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as ml } from "@codemirror/autocomplete";
|
|
22
21
|
import wt from "./MdCatalog.mjs";
|
|
23
22
|
import { g as it } from "./chunks/vue-tsx.mjs";
|
|
24
|
-
import
|
|
25
|
-
import
|
|
23
|
+
import gl from "./NormalToolbar.mjs";
|
|
24
|
+
import fl from "./ModalToolbar.mjs";
|
|
26
25
|
import "medium-zoom";
|
|
27
26
|
import "copy-to-clipboard";
|
|
28
27
|
import "markdown-it";
|
|
29
28
|
import "markdown-it-image-figures";
|
|
30
29
|
import "markdown-it-task-lists";
|
|
31
30
|
import "lru-cache";
|
|
32
|
-
const
|
|
31
|
+
const bl = /* @__PURE__ */ R({
|
|
33
32
|
setup() {
|
|
34
33
|
return () => t("div", {
|
|
35
34
|
class: `${n}-divider`
|
|
36
35
|
}, null);
|
|
37
36
|
}
|
|
38
|
-
}),
|
|
37
|
+
}), hl = {
|
|
39
38
|
noPrettier: {
|
|
40
39
|
type: Boolean
|
|
41
40
|
},
|
|
@@ -84,19 +83,19 @@ const vl = /* @__PURE__ */ O({
|
|
|
84
83
|
showToolbarName: {
|
|
85
84
|
type: Boolean
|
|
86
85
|
}
|
|
87
|
-
},
|
|
86
|
+
}, vl = (e) => {
|
|
88
87
|
var c, g, m, h;
|
|
89
|
-
const o =
|
|
90
|
-
let l = (g = (c =
|
|
91
|
-
const a = (h = (m =
|
|
88
|
+
const o = L("editorId");
|
|
89
|
+
let l = (g = (c = X.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
|
|
90
|
+
const a = (h = (m = X.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : h.js, r = K(!1), i = ($) => {
|
|
92
91
|
if (!l) {
|
|
93
|
-
|
|
92
|
+
b.emit(o, "errorCatcher", {
|
|
94
93
|
name: "fullscreen",
|
|
95
94
|
message: "fullscreen is undefined"
|
|
96
95
|
});
|
|
97
96
|
return;
|
|
98
97
|
}
|
|
99
|
-
l.isEnabled ? (r.value = !0, (
|
|
98
|
+
l.isEnabled ? (r.value = !0, ($ === void 0 ? !l.isFullscreen : $) ? l.request() : l.exit()) : console.error("browser does not support screenfull!");
|
|
100
99
|
}, d = () => {
|
|
101
100
|
l && l.isEnabled && l.on("change", () => {
|
|
102
101
|
(r.value || e.setting.fullscreen) && (r.value = !1, e.updateSetting("fullscreen"));
|
|
@@ -104,18 +103,18 @@ const vl = /* @__PURE__ */ O({
|
|
|
104
103
|
}, u = () => {
|
|
105
104
|
l = window.screenfull, d();
|
|
106
105
|
};
|
|
107
|
-
return
|
|
106
|
+
return Y(() => {
|
|
108
107
|
if (d(), !l) {
|
|
109
|
-
const
|
|
110
|
-
|
|
108
|
+
const $ = document.createElement("script");
|
|
109
|
+
$.src = a || It, $.onload = u, $.id = `${n}-screenfull`, Qt($, "screenfull");
|
|
111
110
|
}
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
name:
|
|
111
|
+
}), Y(() => {
|
|
112
|
+
b.on(o, {
|
|
113
|
+
name: Ft,
|
|
115
114
|
callback: i
|
|
116
115
|
});
|
|
117
116
|
}), { fullscreenHandler: i };
|
|
118
|
-
},
|
|
117
|
+
}, kl = {
|
|
119
118
|
tableShape: {
|
|
120
119
|
type: Array,
|
|
121
120
|
default: () => [6, 4]
|
|
@@ -125,11 +124,11 @@ const vl = /* @__PURE__ */ O({
|
|
|
125
124
|
default: () => {
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
},
|
|
127
|
+
}, pl = /* @__PURE__ */ R({
|
|
129
128
|
name: "TableShape",
|
|
130
|
-
props:
|
|
129
|
+
props: kl,
|
|
131
130
|
setup(e) {
|
|
132
|
-
const o =
|
|
131
|
+
const o = Q({
|
|
133
132
|
x: -1,
|
|
134
133
|
y: -1
|
|
135
134
|
});
|
|
@@ -154,7 +153,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
154
153
|
class: [`${n}-table-shape-col-default`, a <= o.x && i <= o.y && `${n}-table-shape-col-include`]
|
|
155
154
|
}, null)]))]))]);
|
|
156
155
|
}
|
|
157
|
-
}),
|
|
156
|
+
}), Cl = pl, $l = {
|
|
158
157
|
type: {
|
|
159
158
|
type: String,
|
|
160
159
|
default: "link"
|
|
@@ -173,10 +172,10 @@ const vl = /* @__PURE__ */ O({
|
|
|
173
172
|
default: () => {
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
|
-
},
|
|
177
|
-
props:
|
|
175
|
+
}, yl = /* @__PURE__ */ R({
|
|
176
|
+
props: $l,
|
|
178
177
|
setup(e) {
|
|
179
|
-
const o =
|
|
178
|
+
const o = L("usedLanguageText"), l = L("editorId"), a = ke(() => {
|
|
180
179
|
var i, d;
|
|
181
180
|
switch (e.type) {
|
|
182
181
|
case "link":
|
|
@@ -186,11 +185,11 @@ const vl = /* @__PURE__ */ O({
|
|
|
186
185
|
default:
|
|
187
186
|
return "";
|
|
188
187
|
}
|
|
189
|
-
}), r =
|
|
188
|
+
}), r = Q({
|
|
190
189
|
desc: "",
|
|
191
190
|
url: ""
|
|
192
191
|
});
|
|
193
|
-
return
|
|
192
|
+
return B(() => e.visible, (i) => {
|
|
194
193
|
i || setTimeout(() => {
|
|
195
194
|
r.desc = "", r.url = "";
|
|
196
195
|
}, 200);
|
|
@@ -243,7 +242,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
243
242
|
}
|
|
244
243
|
});
|
|
245
244
|
}
|
|
246
|
-
}),
|
|
245
|
+
}), Tl = {
|
|
247
246
|
visible: {
|
|
248
247
|
type: Boolean,
|
|
249
248
|
default: !1
|
|
@@ -258,13 +257,13 @@ const vl = /* @__PURE__ */ O({
|
|
|
258
257
|
default: () => {
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
},
|
|
262
|
-
props:
|
|
260
|
+
}, wl = /* @__PURE__ */ R({
|
|
261
|
+
props: Tl,
|
|
263
262
|
setup(e) {
|
|
264
|
-
var m, h,
|
|
265
|
-
const o =
|
|
266
|
-
let a = (
|
|
267
|
-
const r =
|
|
263
|
+
var m, h, $;
|
|
264
|
+
const o = L("usedLanguageText"), l = L("editorId");
|
|
265
|
+
let a = ($ = (h = (m = X) == null ? void 0 : m.editorExtensions) == null ? void 0 : h.cropper) == null ? void 0 : $.instance;
|
|
266
|
+
const r = K(), i = K(), d = K(), u = Q({
|
|
268
267
|
cropperInited: !1,
|
|
269
268
|
imgSelected: !1,
|
|
270
269
|
imgSrc: "",
|
|
@@ -272,33 +271,33 @@ const vl = /* @__PURE__ */ O({
|
|
|
272
271
|
isFullscreen: !1
|
|
273
272
|
});
|
|
274
273
|
let c = null;
|
|
275
|
-
|
|
274
|
+
B(() => e.visible, () => {
|
|
276
275
|
e.visible && !u.cropperInited && (a = a || window.Cropper, r.value.onchange = () => {
|
|
277
276
|
if (!a) {
|
|
278
|
-
|
|
277
|
+
b.emit(l, "errorCatcher", {
|
|
279
278
|
name: "Cropper",
|
|
280
279
|
message: "Cropper is undefined"
|
|
281
280
|
});
|
|
282
281
|
return;
|
|
283
282
|
}
|
|
284
|
-
const
|
|
285
|
-
if (u.imgSelected = !0, (
|
|
283
|
+
const T = r.value.files || [];
|
|
284
|
+
if (u.imgSelected = !0, (T == null ? void 0 : T.length) > 0) {
|
|
286
285
|
const v = new FileReader();
|
|
287
|
-
v.onload = (
|
|
288
|
-
u.imgSrc =
|
|
286
|
+
v.onload = (f) => {
|
|
287
|
+
u.imgSrc = f.target.result, me(() => {
|
|
289
288
|
c = new a(i.value, {
|
|
290
289
|
viewMode: 2,
|
|
291
290
|
preview: `.${n}-clip-preview-target`
|
|
292
291
|
// aspectRatio: 16 / 9,
|
|
293
292
|
});
|
|
294
293
|
});
|
|
295
|
-
}, v.readAsDataURL(
|
|
294
|
+
}, v.readAsDataURL(T[0]);
|
|
296
295
|
}
|
|
297
296
|
});
|
|
298
|
-
}),
|
|
297
|
+
}), B(() => [u.imgSelected], () => {
|
|
299
298
|
d.value.style = "";
|
|
300
|
-
}),
|
|
301
|
-
|
|
299
|
+
}), B(() => u.isFullscreen, () => {
|
|
300
|
+
me(() => {
|
|
302
301
|
c == null || c.destroy(), d.value.style = "", i.value && (c = new a(i.value, {
|
|
303
302
|
viewMode: 2,
|
|
304
303
|
preview: `.${n}-clip-preview-target`
|
|
@@ -310,10 +309,10 @@ const vl = /* @__PURE__ */ O({
|
|
|
310
309
|
c.clear(), c.destroy(), c = null, r.value.value = "", u.imgSelected = !1;
|
|
311
310
|
};
|
|
312
311
|
return () => {
|
|
313
|
-
var
|
|
312
|
+
var T;
|
|
314
313
|
return t($t, {
|
|
315
314
|
class: `${n}-modal-clip`,
|
|
316
|
-
title: (
|
|
315
|
+
title: (T = o.value.clipModalTips) == null ? void 0 : T.title,
|
|
317
316
|
visible: e.visible,
|
|
318
317
|
onClose: e.onCancel,
|
|
319
318
|
showAdjust: !0,
|
|
@@ -325,7 +324,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
325
324
|
height: "421px"
|
|
326
325
|
}, {
|
|
327
326
|
default: () => {
|
|
328
|
-
var v,
|
|
327
|
+
var v, f;
|
|
329
328
|
return [t("div", {
|
|
330
329
|
class: `${n}-form-item ${n}-clip`
|
|
331
330
|
}, [t("div", {
|
|
@@ -342,14 +341,14 @@ const vl = /* @__PURE__ */ O({
|
|
|
342
341
|
}, null), t("div", {
|
|
343
342
|
class: `${n}-clip-delete`,
|
|
344
343
|
onClick: g
|
|
345
|
-
}, [t(
|
|
344
|
+
}, [t(C, {
|
|
346
345
|
name: "delete"
|
|
347
346
|
}, null)])]) : t("div", {
|
|
348
347
|
class: `${n}-clip-upload`,
|
|
349
348
|
onClick: () => {
|
|
350
349
|
r.value.click();
|
|
351
350
|
}
|
|
352
|
-
}, [t(
|
|
351
|
+
}, [t(C, {
|
|
353
352
|
name: "upload"
|
|
354
353
|
}, null)])]), t("div", {
|
|
355
354
|
class: `${n}-clip-preview`
|
|
@@ -364,10 +363,10 @@ const vl = /* @__PURE__ */ O({
|
|
|
364
363
|
onClick: () => {
|
|
365
364
|
if (c) {
|
|
366
365
|
const k = c.getCroppedCanvas();
|
|
367
|
-
|
|
366
|
+
b.emit(l, "uploadImage", [Bt(k.toDataURL("image/png"))], e.onOk), g();
|
|
368
367
|
}
|
|
369
368
|
}
|
|
370
|
-
}, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((
|
|
369
|
+
}, [((v = o.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((f = o.value.linkModalTips) == null ? void 0 : f.buttonOK)])]), t("input", {
|
|
371
370
|
ref: r,
|
|
372
371
|
accept: "image/*",
|
|
373
372
|
type: "file",
|
|
@@ -380,7 +379,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
380
379
|
});
|
|
381
380
|
};
|
|
382
381
|
}
|
|
383
|
-
}),
|
|
382
|
+
}), xl = {
|
|
384
383
|
type: {
|
|
385
384
|
type: String,
|
|
386
385
|
default: "link"
|
|
@@ -403,27 +402,27 @@ const vl = /* @__PURE__ */ O({
|
|
|
403
402
|
default: () => {
|
|
404
403
|
}
|
|
405
404
|
}
|
|
406
|
-
},
|
|
407
|
-
props:
|
|
405
|
+
}, Sl = /* @__PURE__ */ R({
|
|
406
|
+
props: xl,
|
|
408
407
|
setup(e) {
|
|
409
|
-
return () => t(
|
|
408
|
+
return () => t(pt, null, [t(yl, {
|
|
410
409
|
type: e.type,
|
|
411
410
|
visible: e.linkVisible,
|
|
412
411
|
onOk: e.onOk,
|
|
413
412
|
onCancel: e.onCancel
|
|
414
|
-
}, null), t(
|
|
413
|
+
}, null), t(wl, {
|
|
415
414
|
visible: e.clipVisible,
|
|
416
415
|
onOk: e.onOk,
|
|
417
416
|
onCancel: e.onCancel
|
|
418
417
|
}, null)]);
|
|
419
418
|
}
|
|
420
|
-
}),
|
|
419
|
+
}), Al = /* @__PURE__ */ R({
|
|
421
420
|
name: "MDEditorToolbar",
|
|
422
|
-
props:
|
|
421
|
+
props: hl,
|
|
423
422
|
setup(e) {
|
|
424
|
-
const o =
|
|
423
|
+
const o = L("editorId"), l = L("usedLanguageText"), {
|
|
425
424
|
fullscreenHandler: a
|
|
426
|
-
} =
|
|
425
|
+
} = vl(e), r = `${o}-toolbar-wrapper`, i = K(), d = Q({
|
|
427
426
|
title: !1,
|
|
428
427
|
catalog: !1,
|
|
429
428
|
// 图片上传下拉
|
|
@@ -433,44 +432,44 @@ const vl = /* @__PURE__ */ O({
|
|
|
433
432
|
// mermaid
|
|
434
433
|
mermaid: !1,
|
|
435
434
|
katex: !1
|
|
436
|
-
}), u = (v,
|
|
437
|
-
|
|
438
|
-
}, c =
|
|
435
|
+
}), u = (v, f) => {
|
|
436
|
+
b.emit(o, "replace", v, f);
|
|
437
|
+
}, c = Q({
|
|
439
438
|
type: "link",
|
|
440
439
|
linkVisible: !1,
|
|
441
440
|
clipVisible: !1
|
|
442
|
-
}), g =
|
|
443
|
-
|
|
444
|
-
|
|
441
|
+
}), g = K();
|
|
442
|
+
Y(() => {
|
|
443
|
+
b.on(o, {
|
|
445
444
|
name: "openModals",
|
|
446
445
|
callback(v) {
|
|
447
446
|
c.type = v, c.linkVisible = !0;
|
|
448
447
|
}
|
|
449
448
|
});
|
|
450
449
|
});
|
|
451
|
-
const m =
|
|
452
|
-
const v = e.toolbars.filter((
|
|
453
|
-
return [k,
|
|
454
|
-
}), h =
|
|
455
|
-
|
|
450
|
+
const m = ke(() => {
|
|
451
|
+
const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)), f = v.indexOf("="), k = f === -1 ? v : v.slice(0, f + 1), y = f === -1 ? [] : v.slice(f, Number.MAX_SAFE_INTEGER);
|
|
452
|
+
return [k, y];
|
|
453
|
+
}), h = K(), $ = () => {
|
|
454
|
+
b.emit(o, "uploadImage", Array.from(h.value.files || [])), h.value.value = "";
|
|
456
455
|
};
|
|
457
|
-
|
|
458
|
-
h.value.addEventListener("change",
|
|
456
|
+
Y(() => {
|
|
457
|
+
h.value.addEventListener("change", $);
|
|
459
458
|
});
|
|
460
|
-
const
|
|
461
|
-
var
|
|
459
|
+
const T = (v) => {
|
|
460
|
+
var f, k, y, w, x, H, M, ee, S, A, q, P, N, D, E, V, _, j, se, te, Z, W, le, z, O, F, oe, ce, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Ie, Le, De, Ee, He, Ne, Ve, Oe, Be, Fe, Re, Pe, qe, Ue, Ge, Ke, _e, je, We, ze, Ze, Xe, Ye, Je, Qe, et, tt, lt, ot, at;
|
|
462
461
|
if (Lt.includes(v))
|
|
463
462
|
switch (v) {
|
|
464
463
|
case "-":
|
|
465
|
-
return t(
|
|
464
|
+
return t(bl, null, null);
|
|
466
465
|
case "bold":
|
|
467
466
|
return t("div", {
|
|
468
467
|
class: `${n}-toolbar-item`,
|
|
469
|
-
title: (
|
|
468
|
+
title: (f = l.value.toolbarTips) == null ? void 0 : f.bold,
|
|
470
469
|
onClick: () => {
|
|
471
470
|
u("bold");
|
|
472
471
|
}
|
|
473
|
-
}, [t(
|
|
472
|
+
}, [t(C, {
|
|
474
473
|
name: "bold"
|
|
475
474
|
}, null), e.showToolbarName && t("div", {
|
|
476
475
|
class: `${n}-toolbar-item-name`
|
|
@@ -478,45 +477,45 @@ const vl = /* @__PURE__ */ O({
|
|
|
478
477
|
case "underline":
|
|
479
478
|
return t("div", {
|
|
480
479
|
class: `${n}-toolbar-item`,
|
|
481
|
-
title: (
|
|
480
|
+
title: (y = l.value.toolbarTips) == null ? void 0 : y.underline,
|
|
482
481
|
onClick: () => {
|
|
483
482
|
u("underline");
|
|
484
483
|
}
|
|
485
|
-
}, [t(
|
|
484
|
+
}, [t(C, {
|
|
486
485
|
name: "underline"
|
|
487
486
|
}, null), e.showToolbarName && t("div", {
|
|
488
487
|
class: `${n}-toolbar-item-name`
|
|
489
|
-
}, [(
|
|
488
|
+
}, [(w = l.value.toolbarTips) == null ? void 0 : w.underline])]);
|
|
490
489
|
case "italic":
|
|
491
490
|
return t("div", {
|
|
492
491
|
class: `${n}-toolbar-item`,
|
|
493
|
-
title: (
|
|
492
|
+
title: (x = l.value.toolbarTips) == null ? void 0 : x.italic,
|
|
494
493
|
onClick: () => {
|
|
495
494
|
u("italic");
|
|
496
495
|
}
|
|
497
|
-
}, [t(
|
|
496
|
+
}, [t(C, {
|
|
498
497
|
name: "italic"
|
|
499
498
|
}, null), e.showToolbarName && t("div", {
|
|
500
499
|
class: `${n}-toolbar-item-name`
|
|
501
|
-
}, [(
|
|
500
|
+
}, [(H = l.value.toolbarTips) == null ? void 0 : H.italic])]);
|
|
502
501
|
case "strikeThrough":
|
|
503
502
|
return t("div", {
|
|
504
503
|
class: `${n}-toolbar-item`,
|
|
505
|
-
title: (
|
|
504
|
+
title: (M = l.value.toolbarTips) == null ? void 0 : M.strikeThrough,
|
|
506
505
|
onClick: () => {
|
|
507
506
|
u("strikeThrough");
|
|
508
507
|
}
|
|
509
|
-
}, [t(
|
|
508
|
+
}, [t(C, {
|
|
510
509
|
name: "strike-through"
|
|
511
510
|
}, null), e.showToolbarName && t("div", {
|
|
512
511
|
class: `${n}-toolbar-item-name`
|
|
513
|
-
}, [(
|
|
512
|
+
}, [(ee = l.value.toolbarTips) == null ? void 0 : ee.strikeThrough])]);
|
|
514
513
|
case "title":
|
|
515
|
-
return t(
|
|
514
|
+
return t(ae, {
|
|
516
515
|
relative: `#${r}`,
|
|
517
516
|
visible: d.title,
|
|
518
|
-
onChange: (
|
|
519
|
-
d.title =
|
|
517
|
+
onChange: (p) => {
|
|
518
|
+
d.title = p;
|
|
520
519
|
},
|
|
521
520
|
overlay: t("ul", {
|
|
522
521
|
class: `${n}-menu`,
|
|
@@ -528,137 +527,137 @@ const vl = /* @__PURE__ */ O({
|
|
|
528
527
|
onClick: () => {
|
|
529
528
|
u("h1");
|
|
530
529
|
}
|
|
531
|
-
}, [(
|
|
530
|
+
}, [(S = l.value.titleItem) == null ? void 0 : S.h1]), t("li", {
|
|
532
531
|
class: `${n}-menu-item`,
|
|
533
532
|
onClick: () => {
|
|
534
533
|
u("h2");
|
|
535
534
|
}
|
|
536
|
-
}, [(
|
|
535
|
+
}, [(A = l.value.titleItem) == null ? void 0 : A.h2]), t("li", {
|
|
537
536
|
class: `${n}-menu-item`,
|
|
538
537
|
onClick: () => {
|
|
539
538
|
u("h3");
|
|
540
539
|
}
|
|
541
|
-
}, [(
|
|
540
|
+
}, [(q = l.value.titleItem) == null ? void 0 : q.h3]), t("li", {
|
|
542
541
|
class: `${n}-menu-item`,
|
|
543
542
|
onClick: () => {
|
|
544
543
|
u("h4");
|
|
545
544
|
}
|
|
546
|
-
}, [(
|
|
545
|
+
}, [(P = l.value.titleItem) == null ? void 0 : P.h4]), t("li", {
|
|
547
546
|
class: `${n}-menu-item`,
|
|
548
547
|
onClick: () => {
|
|
549
548
|
u("h5");
|
|
550
549
|
}
|
|
551
|
-
}, [(
|
|
550
|
+
}, [(N = l.value.titleItem) == null ? void 0 : N.h5]), t("li", {
|
|
552
551
|
class: `${n}-menu-item`,
|
|
553
552
|
onClick: () => {
|
|
554
553
|
u("h6");
|
|
555
554
|
}
|
|
556
|
-
}, [(
|
|
555
|
+
}, [(D = l.value.titleItem) == null ? void 0 : D.h6])])
|
|
557
556
|
}, {
|
|
558
557
|
default: () => {
|
|
559
|
-
var
|
|
558
|
+
var p, I;
|
|
560
559
|
return [t("div", {
|
|
561
560
|
class: `${n}-toolbar-item`,
|
|
562
|
-
title: (
|
|
563
|
-
}, [t(
|
|
561
|
+
title: (p = l.value.toolbarTips) == null ? void 0 : p.title
|
|
562
|
+
}, [t(C, {
|
|
564
563
|
name: "title"
|
|
565
564
|
}, null), e.showToolbarName && t("div", {
|
|
566
565
|
class: `${n}-toolbar-item-name`
|
|
567
|
-
}, [(
|
|
566
|
+
}, [(I = l.value.toolbarTips) == null ? void 0 : I.title])])];
|
|
568
567
|
}
|
|
569
568
|
});
|
|
570
569
|
case "sub":
|
|
571
570
|
return t("div", {
|
|
572
571
|
class: `${n}-toolbar-item`,
|
|
573
|
-
title: (
|
|
572
|
+
title: (E = l.value.toolbarTips) == null ? void 0 : E.sub,
|
|
574
573
|
onClick: () => {
|
|
575
574
|
u("sub");
|
|
576
575
|
}
|
|
577
|
-
}, [t(
|
|
576
|
+
}, [t(C, {
|
|
578
577
|
name: "sub"
|
|
579
578
|
}, null), e.showToolbarName && t("div", {
|
|
580
579
|
class: `${n}-toolbar-item-name`
|
|
581
|
-
}, [(
|
|
580
|
+
}, [(V = l.value.toolbarTips) == null ? void 0 : V.sub])]);
|
|
582
581
|
case "sup":
|
|
583
582
|
return t("div", {
|
|
584
583
|
class: `${n}-toolbar-item`,
|
|
585
|
-
title: (
|
|
584
|
+
title: (_ = l.value.toolbarTips) == null ? void 0 : _.sup,
|
|
586
585
|
onClick: () => {
|
|
587
586
|
u("sup");
|
|
588
587
|
}
|
|
589
|
-
}, [t(
|
|
588
|
+
}, [t(C, {
|
|
590
589
|
name: "sup"
|
|
591
590
|
}, null), e.showToolbarName && t("div", {
|
|
592
591
|
class: `${n}-toolbar-item-name`
|
|
593
|
-
}, [(
|
|
592
|
+
}, [(j = l.value.toolbarTips) == null ? void 0 : j.sup])]);
|
|
594
593
|
case "quote":
|
|
595
594
|
return t("div", {
|
|
596
595
|
class: `${n}-toolbar-item`,
|
|
597
|
-
title: (
|
|
596
|
+
title: (se = l.value.toolbarTips) == null ? void 0 : se.quote,
|
|
598
597
|
onClick: () => {
|
|
599
598
|
u("quote");
|
|
600
599
|
}
|
|
601
|
-
}, [t(
|
|
600
|
+
}, [t(C, {
|
|
602
601
|
name: "quote"
|
|
603
602
|
}, null), e.showToolbarName && t("div", {
|
|
604
603
|
class: `${n}-toolbar-item-name`
|
|
605
|
-
}, [(
|
|
604
|
+
}, [(te = l.value.toolbarTips) == null ? void 0 : te.quote])]);
|
|
606
605
|
case "unorderedList":
|
|
607
606
|
return t("div", {
|
|
608
607
|
class: `${n}-toolbar-item`,
|
|
609
|
-
title: (
|
|
608
|
+
title: (Z = l.value.toolbarTips) == null ? void 0 : Z.unorderedList,
|
|
610
609
|
onClick: () => {
|
|
611
610
|
u("unorderedList");
|
|
612
611
|
}
|
|
613
|
-
}, [t(
|
|
612
|
+
}, [t(C, {
|
|
614
613
|
name: "unordered-list"
|
|
615
614
|
}, null), e.showToolbarName && t("div", {
|
|
616
615
|
class: `${n}-toolbar-item-name`
|
|
617
|
-
}, [(
|
|
616
|
+
}, [(W = l.value.toolbarTips) == null ? void 0 : W.unorderedList])]);
|
|
618
617
|
case "orderedList":
|
|
619
618
|
return t("div", {
|
|
620
619
|
class: `${n}-toolbar-item`,
|
|
621
|
-
title: (
|
|
620
|
+
title: (le = l.value.toolbarTips) == null ? void 0 : le.orderedList,
|
|
622
621
|
onClick: () => {
|
|
623
622
|
u("orderedList");
|
|
624
623
|
}
|
|
625
|
-
}, [t(
|
|
624
|
+
}, [t(C, {
|
|
626
625
|
name: "ordered-list"
|
|
627
626
|
}, null), e.showToolbarName && t("div", {
|
|
628
627
|
class: `${n}-toolbar-item-name`
|
|
629
|
-
}, [(
|
|
628
|
+
}, [(z = l.value.toolbarTips) == null ? void 0 : z.orderedList])]);
|
|
630
629
|
case "task":
|
|
631
630
|
return t("div", {
|
|
632
631
|
class: `${n}-toolbar-item`,
|
|
633
|
-
title: (
|
|
632
|
+
title: (O = l.value.toolbarTips) == null ? void 0 : O.task,
|
|
634
633
|
onClick: () => {
|
|
635
634
|
u("task");
|
|
636
635
|
}
|
|
637
|
-
}, [t(
|
|
636
|
+
}, [t(C, {
|
|
638
637
|
name: "task"
|
|
639
638
|
}, null), e.showToolbarName && t("div", {
|
|
640
639
|
class: `${n}-toolbar-item-name`
|
|
641
|
-
}, [(
|
|
640
|
+
}, [(F = l.value.toolbarTips) == null ? void 0 : F.task])]);
|
|
642
641
|
case "codeRow":
|
|
643
642
|
return t("div", {
|
|
644
643
|
class: `${n}-toolbar-item`,
|
|
645
|
-
title: (
|
|
644
|
+
title: (oe = l.value.toolbarTips) == null ? void 0 : oe.codeRow,
|
|
646
645
|
onClick: () => {
|
|
647
646
|
u("codeRow");
|
|
648
647
|
}
|
|
649
|
-
}, [t(
|
|
648
|
+
}, [t(C, {
|
|
650
649
|
name: "code-row"
|
|
651
650
|
}, null), e.showToolbarName && t("div", {
|
|
652
651
|
class: `${n}-toolbar-item-name`
|
|
653
|
-
}, [(
|
|
652
|
+
}, [(ce = l.value.toolbarTips) == null ? void 0 : ce.codeRow])]);
|
|
654
653
|
case "code":
|
|
655
654
|
return t("div", {
|
|
656
655
|
class: `${n}-toolbar-item`,
|
|
657
|
-
title: (
|
|
656
|
+
title: (Ce = l.value.toolbarTips) == null ? void 0 : Ce.code,
|
|
658
657
|
onClick: () => {
|
|
659
658
|
u("code");
|
|
660
659
|
}
|
|
661
|
-
}, [t(
|
|
660
|
+
}, [t(C, {
|
|
662
661
|
name: "code"
|
|
663
662
|
}, null), e.showToolbarName && t("div", {
|
|
664
663
|
class: `${n}-toolbar-item-name`
|
|
@@ -670,7 +669,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
670
669
|
onClick: () => {
|
|
671
670
|
c.type = "link", c.linkVisible = !0;
|
|
672
671
|
}
|
|
673
|
-
}, [t(
|
|
672
|
+
}, [t(C, {
|
|
674
673
|
name: "link"
|
|
675
674
|
}, null), e.showToolbarName && t("div", {
|
|
676
675
|
class: `${n}-toolbar-item-name`
|
|
@@ -682,15 +681,15 @@ const vl = /* @__PURE__ */ O({
|
|
|
682
681
|
onClick: () => {
|
|
683
682
|
c.type = "image", c.linkVisible = !0;
|
|
684
683
|
}
|
|
685
|
-
}, [t(
|
|
684
|
+
}, [t(C, {
|
|
686
685
|
name: "image"
|
|
687
686
|
}, null), e.showToolbarName && t("div", {
|
|
688
687
|
class: `${n}-toolbar-item-name`
|
|
689
|
-
}, [(xe = l.value.toolbarTips) == null ? void 0 : xe.image])]) : t(
|
|
688
|
+
}, [(xe = l.value.toolbarTips) == null ? void 0 : xe.image])]) : t(ae, {
|
|
690
689
|
relative: `#${r}`,
|
|
691
690
|
visible: d.image,
|
|
692
|
-
onChange: (
|
|
693
|
-
d.image =
|
|
691
|
+
onChange: (p) => {
|
|
692
|
+
d.image = p;
|
|
694
693
|
},
|
|
695
694
|
overlay: t("ul", {
|
|
696
695
|
class: `${n}-menu`,
|
|
@@ -715,44 +714,44 @@ const vl = /* @__PURE__ */ O({
|
|
|
715
714
|
}, [(Me = l.value.imgTitleItem) == null ? void 0 : Me.clip2upload])])
|
|
716
715
|
}, {
|
|
717
716
|
default: () => {
|
|
718
|
-
var
|
|
717
|
+
var p, I;
|
|
719
718
|
return [t("div", {
|
|
720
719
|
class: `${n}-toolbar-item`,
|
|
721
|
-
title: (
|
|
722
|
-
}, [t(
|
|
720
|
+
title: (p = l.value.toolbarTips) == null ? void 0 : p.image
|
|
721
|
+
}, [t(C, {
|
|
723
722
|
name: "image"
|
|
724
723
|
}, null), e.showToolbarName && t("div", {
|
|
725
724
|
class: `${n}-toolbar-item-name`
|
|
726
|
-
}, [(
|
|
725
|
+
}, [(I = l.value.toolbarTips) == null ? void 0 : I.image])])];
|
|
727
726
|
}
|
|
728
727
|
});
|
|
729
728
|
case "table":
|
|
730
|
-
return t(
|
|
729
|
+
return t(ae, {
|
|
731
730
|
relative: `#${r}`,
|
|
732
731
|
visible: d.table,
|
|
733
|
-
onChange: (
|
|
734
|
-
d.table =
|
|
732
|
+
onChange: (p) => {
|
|
733
|
+
d.table = p;
|
|
735
734
|
},
|
|
736
735
|
key: "bar-table",
|
|
737
|
-
overlay: t(
|
|
736
|
+
overlay: t(Cl, {
|
|
738
737
|
tableShape: e.tableShape,
|
|
739
|
-
onSelected: (
|
|
738
|
+
onSelected: (p) => {
|
|
740
739
|
u("table", {
|
|
741
|
-
selectedShape:
|
|
740
|
+
selectedShape: p
|
|
742
741
|
});
|
|
743
742
|
}
|
|
744
743
|
}, null)
|
|
745
744
|
}, {
|
|
746
745
|
default: () => {
|
|
747
|
-
var
|
|
746
|
+
var p, I;
|
|
748
747
|
return [t("div", {
|
|
749
748
|
class: `${n}-toolbar-item`,
|
|
750
|
-
title: (
|
|
751
|
-
}, [t(
|
|
749
|
+
title: (p = l.value.toolbarTips) == null ? void 0 : p.table
|
|
750
|
+
}, [t(C, {
|
|
752
751
|
name: "table"
|
|
753
752
|
}, null), e.showToolbarName && t("div", {
|
|
754
753
|
class: `${n}-toolbar-item-name`
|
|
755
|
-
}, [(
|
|
754
|
+
}, [(I = l.value.toolbarTips) == null ? void 0 : I.table])])];
|
|
756
755
|
}
|
|
757
756
|
});
|
|
758
757
|
case "revoke":
|
|
@@ -760,9 +759,9 @@ const vl = /* @__PURE__ */ O({
|
|
|
760
759
|
class: `${n}-toolbar-item`,
|
|
761
760
|
title: (Ie = l.value.toolbarTips) == null ? void 0 : Ie.revoke,
|
|
762
761
|
onClick: () => {
|
|
763
|
-
|
|
762
|
+
b.emit(o, "ctrlZ");
|
|
764
763
|
}
|
|
765
|
-
}, [t(
|
|
764
|
+
}, [t(C, {
|
|
766
765
|
name: "revoke"
|
|
767
766
|
}, null), e.showToolbarName && t("div", {
|
|
768
767
|
class: `${n}-toolbar-item-name`
|
|
@@ -770,27 +769,27 @@ const vl = /* @__PURE__ */ O({
|
|
|
770
769
|
case "next":
|
|
771
770
|
return t("div", {
|
|
772
771
|
class: `${n}-toolbar-item`,
|
|
773
|
-
title: (
|
|
772
|
+
title: (De = l.value.toolbarTips) == null ? void 0 : De.next,
|
|
774
773
|
onClick: () => {
|
|
775
|
-
|
|
774
|
+
b.emit(o, "ctrlShiftZ");
|
|
776
775
|
}
|
|
777
|
-
}, [t(
|
|
776
|
+
}, [t(C, {
|
|
778
777
|
name: "next"
|
|
779
778
|
}, null), e.showToolbarName && t("div", {
|
|
780
779
|
class: `${n}-toolbar-item-name`
|
|
781
|
-
}, [(
|
|
780
|
+
}, [(Ee = l.value.toolbarTips) == null ? void 0 : Ee.next])]);
|
|
782
781
|
case "save":
|
|
783
782
|
return t("div", {
|
|
784
783
|
class: `${n}-toolbar-item`,
|
|
785
|
-
title: (
|
|
784
|
+
title: (He = l.value.toolbarTips) == null ? void 0 : He.save,
|
|
786
785
|
onClick: () => {
|
|
787
|
-
|
|
786
|
+
b.emit(o, Ct);
|
|
788
787
|
}
|
|
789
|
-
}, [t(
|
|
788
|
+
}, [t(C, {
|
|
790
789
|
name: "baocun"
|
|
791
790
|
}, null), e.showToolbarName && t("div", {
|
|
792
791
|
class: `${n}-toolbar-item-name`
|
|
793
|
-
}, [(
|
|
792
|
+
}, [(Ne = l.value.toolbarTips) == null ? void 0 : Ne.save])]);
|
|
794
793
|
case "prettier":
|
|
795
794
|
return e.noPrettier ? "" : t("div", {
|
|
796
795
|
class: `${n}-toolbar-item`,
|
|
@@ -798,11 +797,11 @@ const vl = /* @__PURE__ */ O({
|
|
|
798
797
|
onClick: () => {
|
|
799
798
|
u("prettier");
|
|
800
799
|
}
|
|
801
|
-
}, [t(
|
|
800
|
+
}, [t(C, {
|
|
802
801
|
name: "prettier"
|
|
803
802
|
}, null), e.showToolbarName && t("div", {
|
|
804
803
|
class: `${n}-toolbar-item-name`
|
|
805
|
-
}, [(
|
|
804
|
+
}, [(Oe = l.value.toolbarTips) == null ? void 0 : Oe.prettier])]);
|
|
806
805
|
case "pageFullscreen":
|
|
807
806
|
return !e.setting.fullscreen && t("div", {
|
|
808
807
|
class: `${n}-toolbar-item`,
|
|
@@ -810,11 +809,11 @@ const vl = /* @__PURE__ */ O({
|
|
|
810
809
|
onClick: () => {
|
|
811
810
|
e.updateSetting("pageFullscreen");
|
|
812
811
|
}
|
|
813
|
-
}, [t(
|
|
812
|
+
}, [t(C, {
|
|
814
813
|
name: e.setting.pageFullscreen ? "suoxiao" : "fangda"
|
|
815
814
|
}, null), e.showToolbarName && t("div", {
|
|
816
815
|
class: `${n}-toolbar-item-name`
|
|
817
|
-
}, [(
|
|
816
|
+
}, [(Fe = l.value.toolbarTips) == null ? void 0 : Fe.pageFullscreen])]);
|
|
818
817
|
case "fullscreen":
|
|
819
818
|
return t("div", {
|
|
820
819
|
class: `${n}-toolbar-item`,
|
|
@@ -822,7 +821,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
822
821
|
onClick: () => {
|
|
823
822
|
a();
|
|
824
823
|
}
|
|
825
|
-
}, [t(
|
|
824
|
+
}, [t(C, {
|
|
826
825
|
name: e.setting.fullscreen ? "fullscreen-exit" : "fullscreen"
|
|
827
826
|
}, null), e.showToolbarName && t("div", {
|
|
828
827
|
class: `${n}-toolbar-item-name`
|
|
@@ -834,7 +833,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
834
833
|
onClick: () => {
|
|
835
834
|
e.updateSetting("preview");
|
|
836
835
|
}
|
|
837
|
-
}, [t(
|
|
836
|
+
}, [t(C, {
|
|
838
837
|
name: "preview"
|
|
839
838
|
}, null), e.showToolbarName && t("div", {
|
|
840
839
|
class: `${n}-toolbar-item-name`
|
|
@@ -846,7 +845,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
846
845
|
onClick: () => {
|
|
847
846
|
e.updateSetting("htmlPreview");
|
|
848
847
|
}
|
|
849
|
-
}, [t(
|
|
848
|
+
}, [t(C, {
|
|
850
849
|
name: "coding"
|
|
851
850
|
}, null), e.showToolbarName && t("div", {
|
|
852
851
|
class: `${n}-toolbar-item-name`
|
|
@@ -856,10 +855,10 @@ const vl = /* @__PURE__ */ O({
|
|
|
856
855
|
class: `${n}-toolbar-item`,
|
|
857
856
|
title: (_e = l.value.toolbarTips) == null ? void 0 : _e.catalog,
|
|
858
857
|
onClick: () => {
|
|
859
|
-
|
|
858
|
+
b.emit(o, Rt);
|
|
860
859
|
},
|
|
861
860
|
key: "bar-catalog"
|
|
862
|
-
}, [t(
|
|
861
|
+
}, [t(C, {
|
|
863
862
|
name: "catalog"
|
|
864
863
|
}, null), e.showToolbarName && t("div", {
|
|
865
864
|
class: `${n}-toolbar-item-name`
|
|
@@ -868,18 +867,18 @@ const vl = /* @__PURE__ */ O({
|
|
|
868
867
|
return t("div", {
|
|
869
868
|
class: `${n}-toolbar-item`,
|
|
870
869
|
title: (We = l.value.toolbarTips) == null ? void 0 : We.github,
|
|
871
|
-
onClick: () =>
|
|
872
|
-
}, [t(
|
|
870
|
+
onClick: () => Ht("https://github.com/imzbf/md-editor-v3")
|
|
871
|
+
}, [t(C, {
|
|
873
872
|
name: "github"
|
|
874
873
|
}, null), e.showToolbarName && t("div", {
|
|
875
874
|
class: `${n}-toolbar-item-name`
|
|
876
875
|
}, [(ze = l.value.toolbarTips) == null ? void 0 : ze.github])]);
|
|
877
876
|
case "mermaid":
|
|
878
|
-
return t(
|
|
877
|
+
return t(ae, {
|
|
879
878
|
relative: `#${r}`,
|
|
880
879
|
visible: d.mermaid,
|
|
881
|
-
onChange: (
|
|
882
|
-
d.mermaid =
|
|
880
|
+
onChange: (p) => {
|
|
881
|
+
d.mermaid = p;
|
|
883
882
|
},
|
|
884
883
|
overlay: t("ul", {
|
|
885
884
|
class: `${n}-menu`,
|
|
@@ -930,23 +929,23 @@ const vl = /* @__PURE__ */ O({
|
|
|
930
929
|
key: "bar-mermaid"
|
|
931
930
|
}, {
|
|
932
931
|
default: () => {
|
|
933
|
-
var
|
|
932
|
+
var p, I;
|
|
934
933
|
return [t("div", {
|
|
935
934
|
class: `${n}-toolbar-item`,
|
|
936
|
-
title: (
|
|
937
|
-
}, [t(
|
|
935
|
+
title: (p = l.value.toolbarTips) == null ? void 0 : p.mermaid
|
|
936
|
+
}, [t(C, {
|
|
938
937
|
name: "mermaid"
|
|
939
938
|
}, null), e.showToolbarName && t("div", {
|
|
940
939
|
class: `${n}-toolbar-item-name`
|
|
941
|
-
}, [(
|
|
940
|
+
}, [(I = l.value.toolbarTips) == null ? void 0 : I.mermaid])])];
|
|
942
941
|
}
|
|
943
942
|
});
|
|
944
943
|
case "katex":
|
|
945
|
-
return t(
|
|
944
|
+
return t(ae, {
|
|
946
945
|
relative: `#${r}`,
|
|
947
946
|
visible: d.katex,
|
|
948
|
-
onChange: (
|
|
949
|
-
d.katex =
|
|
947
|
+
onChange: (p) => {
|
|
948
|
+
d.katex = p;
|
|
950
949
|
},
|
|
951
950
|
overlay: t("ul", {
|
|
952
951
|
class: `${n}-menu`,
|
|
@@ -967,48 +966,48 @@ const vl = /* @__PURE__ */ O({
|
|
|
967
966
|
key: "bar-katex"
|
|
968
967
|
}, {
|
|
969
968
|
default: () => {
|
|
970
|
-
var
|
|
969
|
+
var p, I;
|
|
971
970
|
return [t("div", {
|
|
972
971
|
class: `${n}-toolbar-item`,
|
|
973
|
-
title: (
|
|
974
|
-
}, [t(
|
|
972
|
+
title: (p = l.value.toolbarTips) == null ? void 0 : p.katex
|
|
973
|
+
}, [t(C, {
|
|
975
974
|
name: "formula"
|
|
976
975
|
}, null), e.showToolbarName && t("div", {
|
|
977
976
|
class: `${n}-toolbar-item-name`
|
|
978
|
-
}, [(
|
|
977
|
+
}, [(I = l.value.toolbarTips) == null ? void 0 : I.katex])])];
|
|
979
978
|
}
|
|
980
979
|
});
|
|
981
980
|
}
|
|
982
981
|
else if (e.defToolbars instanceof Array) {
|
|
983
|
-
const
|
|
984
|
-
return
|
|
985
|
-
insert(
|
|
986
|
-
|
|
987
|
-
generate:
|
|
982
|
+
const p = e.defToolbars[v];
|
|
983
|
+
return p ? nt(p, {
|
|
984
|
+
insert(ge) {
|
|
985
|
+
b.emit(o, "replace", "universal", {
|
|
986
|
+
generate: ge
|
|
988
987
|
});
|
|
989
988
|
}
|
|
990
989
|
}) : "";
|
|
991
990
|
} else if (e.defToolbars && e.defToolbars.children instanceof Array) {
|
|
992
|
-
const
|
|
993
|
-
return
|
|
994
|
-
insert(
|
|
995
|
-
|
|
996
|
-
generate:
|
|
991
|
+
const p = e.defToolbars.children[v];
|
|
992
|
+
return p ? nt(p, {
|
|
993
|
+
insert(ge) {
|
|
994
|
+
b.emit(o, "replace", "universal", {
|
|
995
|
+
generate: ge
|
|
997
996
|
});
|
|
998
997
|
}
|
|
999
998
|
}) : "";
|
|
1000
999
|
} else
|
|
1001
1000
|
return "";
|
|
1002
1001
|
};
|
|
1003
|
-
return
|
|
1004
|
-
|
|
1005
|
-
i.value &&
|
|
1002
|
+
return B(() => e.toolbars, () => {
|
|
1003
|
+
me(() => {
|
|
1004
|
+
i.value && Et(i.value);
|
|
1006
1005
|
});
|
|
1007
1006
|
}, {
|
|
1008
1007
|
immediate: !0
|
|
1009
1008
|
}), () => {
|
|
1010
|
-
const v = m.value[0].map((k) =>
|
|
1011
|
-
return t(
|
|
1009
|
+
const v = m.value[0].map((k) => T(k)), f = m.value[1].map((k) => T(k));
|
|
1010
|
+
return t(pt, null, [e.toolbars.length > 0 && t("div", {
|
|
1012
1011
|
class: `${n}-toolbar-wrapper`,
|
|
1013
1012
|
ref: i,
|
|
1014
1013
|
id: r
|
|
@@ -1019,7 +1018,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
1019
1018
|
ref: g
|
|
1020
1019
|
}, [v]), t("div", {
|
|
1021
1020
|
class: `${n}-toolbar-right`
|
|
1022
|
-
}, [
|
|
1021
|
+
}, [f])])]), t("input", {
|
|
1023
1022
|
ref: h,
|
|
1024
1023
|
accept: "image/*",
|
|
1025
1024
|
type: "file",
|
|
@@ -1027,7 +1026,7 @@ const vl = /* @__PURE__ */ O({
|
|
|
1027
1026
|
style: {
|
|
1028
1027
|
display: "none"
|
|
1029
1028
|
}
|
|
1030
|
-
}, null), t(
|
|
1029
|
+
}, null), t(Sl, {
|
|
1031
1030
|
linkVisible: c.linkVisible,
|
|
1032
1031
|
clipVisible: c.clipVisible,
|
|
1033
1032
|
type: c.type,
|
|
@@ -1043,8 +1042,8 @@ const vl = /* @__PURE__ */ O({
|
|
|
1043
1042
|
}, null)]);
|
|
1044
1043
|
};
|
|
1045
1044
|
}
|
|
1046
|
-
}),
|
|
1047
|
-
const l =
|
|
1045
|
+
}), Ml = (e, o) => {
|
|
1046
|
+
const l = Nt(() => {
|
|
1048
1047
|
e.removeEventListener("scroll", a), e.addEventListener("scroll", a), o.removeEventListener("scroll", a), o.addEventListener("scroll", a);
|
|
1049
1048
|
}, 50), a = (r) => {
|
|
1050
1049
|
const i = e.clientHeight, d = o.clientHeight, u = e.scrollHeight, c = o.scrollHeight, g = (u - i) / (c - d);
|
|
@@ -1066,100 +1065,103 @@ const vl = /* @__PURE__ */ O({
|
|
|
1066
1065
|
e.removeEventListener("scroll", a), o.removeEventListener("scroll", a);
|
|
1067
1066
|
}
|
|
1068
1067
|
];
|
|
1069
|
-
},
|
|
1068
|
+
}, Il = (e, o, l) => {
|
|
1070
1069
|
const { view: a } = l, r = (h) => a.lineBlockAt(a.state.doc.line(h).from).top, i = (h) => a.lineBlockAt(a.state.doc.line(h).from).height;
|
|
1071
1070
|
let d = [];
|
|
1072
1071
|
const u = () => {
|
|
1073
1072
|
d = [];
|
|
1074
1073
|
const h = Array.from(o.querySelectorAll("[data-line]")).map(
|
|
1075
|
-
(
|
|
1076
|
-
), { lines:
|
|
1077
|
-
let
|
|
1078
|
-
for (let
|
|
1079
|
-
|
|
1080
|
-
start:
|
|
1074
|
+
(f) => Number(f.dataset.line) + 1
|
|
1075
|
+
), { lines: $ } = a.state.doc;
|
|
1076
|
+
let T = 1, v = h.shift() ?? $;
|
|
1077
|
+
for (let f = 1; f <= $; f++)
|
|
1078
|
+
f === v && (T = f, v = h.shift() || $ + 1), d.push({
|
|
1079
|
+
start: T,
|
|
1081
1080
|
end: v - 1
|
|
1082
1081
|
});
|
|
1083
1082
|
};
|
|
1084
1083
|
let c = 0, g = 0;
|
|
1085
1084
|
const m = Vt((h) => {
|
|
1086
|
-
var
|
|
1087
|
-
if (!((
|
|
1085
|
+
var k, y, w, x, H, M, ee;
|
|
1086
|
+
if (!((k = o.firstElementChild) != null && k.firstElementChild))
|
|
1088
1087
|
return;
|
|
1089
|
-
const
|
|
1090
|
-
if (
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1088
|
+
const $ = a.lineBlockAtHeight(a.scrollDOM.scrollTop), { number: T } = a.state.doc.lineAt($.from);
|
|
1089
|
+
if (T > d.length || a.state.doc.lines < d[d.length - 1].end)
|
|
1090
|
+
return;
|
|
1091
|
+
let v = +getComputedStyle(o).paddingTop.replace("px", "");
|
|
1092
|
+
const f = +getComputedStyle(o).paddingBottom.replace("px", "");
|
|
1093
|
+
if (h.target === e) {
|
|
1094
|
+
if (g !== 0)
|
|
1095
|
+
return;
|
|
1096
|
+
c++;
|
|
1097
|
+
const S = d[T - 1];
|
|
1098
|
+
let A = r(S.end) + i(S.end), q = 0;
|
|
1099
|
+
const P = r(S.start), N = o.querySelector(`[data-line="${S.start - 1}"]`) || ((y = o.firstElementChild) == null ? void 0 : y.firstElementChild), D = o.querySelector(`[data-line="${S.end}"]`) || ((w = o.lastElementChild) == null ? void 0 : w.lastElementChild);
|
|
1100
|
+
let E = 0, V = 0;
|
|
1101
|
+
P === 0 ? N === D ? (v = 0, A = a.contentDOM.offsetHeight - a.scrollDOM.offsetHeight, q = a.scrollDOM.scrollTop / A, E = D.offsetTop + D.offsetHeight - o.clientHeight) : (q = a.scrollDOM.scrollTop / A, E = D.offsetTop) : A > a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight ? (q = (a.scrollDOM.scrollTop - P) / (a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight - P), V = N.offsetTop, E = o.scrollHeight - o.clientHeight - V + 10) : (q = (a.scrollDOM.scrollTop - P) / (A - P), V = N.offsetTop, E = D.offsetTop - V);
|
|
1102
|
+
const _ = V - v + E * q;
|
|
1103
|
+
rt(o, _, () => {
|
|
1104
|
+
c--;
|
|
1105
|
+
});
|
|
1106
|
+
} else {
|
|
1107
|
+
if (c !== 0)
|
|
1108
|
+
return;
|
|
1109
|
+
g++;
|
|
1110
|
+
const S = Array.from(
|
|
1111
|
+
o.querySelectorAll("[data-line]")
|
|
1112
|
+
), A = o.scrollTop, q = o.scrollHeight;
|
|
1113
|
+
let P = S.length === 0 ? 1 : Math.ceil(
|
|
1114
|
+
Number(S[S.length - 1].dataset.line) * (A / q)
|
|
1115
|
+
), N = (x = o.firstElementChild) == null ? void 0 : x.firstElementChild;
|
|
1116
|
+
for (let O = P; O >= 0; O--) {
|
|
1117
|
+
const F = o.querySelector(`[data-line="${O}"]`);
|
|
1118
|
+
if (F && F.offsetTop <= A) {
|
|
1119
|
+
N = F, P = O;
|
|
1120
|
+
break;
|
|
1120
1121
|
}
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
}
|
|
1137
|
-
D = $[H - 1];
|
|
1138
|
-
continue;
|
|
1139
|
-
}
|
|
1140
|
-
const ie = B.offsetTop;
|
|
1141
|
-
if (te <= I && ie > I) {
|
|
1142
|
-
R = D, F = B;
|
|
1122
|
+
}
|
|
1123
|
+
let D = (H = o.firstElementChild) == null ? void 0 : H.firstElementChild, E = (M = o.firstElementChild) == null ? void 0 : M.lastElementChild;
|
|
1124
|
+
for (; S.length > 0; ) {
|
|
1125
|
+
const O = S.indexOf(N);
|
|
1126
|
+
if (O + 1 >= S.length)
|
|
1127
|
+
break;
|
|
1128
|
+
const F = S[O + 1];
|
|
1129
|
+
if (O === -1) {
|
|
1130
|
+
E = F;
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
const oe = N.offsetTop;
|
|
1134
|
+
if (oe > A) {
|
|
1135
|
+
if (O === 0) {
|
|
1136
|
+
D = N, E = F;
|
|
1143
1137
|
break;
|
|
1144
1138
|
}
|
|
1145
|
-
|
|
1139
|
+
N = S[O - 1];
|
|
1140
|
+
continue;
|
|
1146
1141
|
}
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
R === ((L = o.firstElementChild) == null ? void 0 : L.firstElementChild) ? (K = Math.max(I / j, 0), z = _ + ee - W) : _ > a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight ? (K = Math.max(
|
|
1154
|
-
(I - N) / (o.scrollHeight - N - o.clientHeight),
|
|
1155
|
-
0
|
|
1156
|
-
), _ = r(a.state.doc.lines) + i(a.state.doc.lines), z = 8 + _ - W - e.clientHeight) : (K = Math.max(
|
|
1157
|
-
(I - N) / (j - N),
|
|
1158
|
-
0
|
|
1159
|
-
), z = _ + ee - W), rt(e, W + z * K, () => {
|
|
1160
|
-
g--;
|
|
1161
|
-
});
|
|
1142
|
+
const ce = F.offsetTop;
|
|
1143
|
+
if (oe <= A && ce > A) {
|
|
1144
|
+
D = N, E = F;
|
|
1145
|
+
break;
|
|
1146
|
+
}
|
|
1147
|
+
N = F;
|
|
1162
1148
|
}
|
|
1149
|
+
const V = D.offsetTop;
|
|
1150
|
+
let _ = E.offsetTop, j = 0;
|
|
1151
|
+
const { start: se, end: te } = d[Number(D.dataset.line || 0)], Z = r(se);
|
|
1152
|
+
let W = r(te);
|
|
1153
|
+
const le = i(te);
|
|
1154
|
+
let z = 0;
|
|
1155
|
+
D === ((ee = o.firstElementChild) == null ? void 0 : ee.firstElementChild) ? (D === E ? (_ = E.offsetHeight - o.offsetHeight + v + f, z = a.contentDOM.offsetHeight - a.scrollDOM.offsetHeight) : z = W + le - Z, j = Math.max(A / _, 0)) : W > a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight ? (j = Math.max(
|
|
1156
|
+
(A - V) / (o.scrollHeight - V - o.clientHeight),
|
|
1157
|
+
0
|
|
1158
|
+
), W = r(a.state.doc.lines) + i(a.state.doc.lines), z = 8 + W - Z - e.clientHeight) : (j = Math.max(
|
|
1159
|
+
(A - V) / (_ - V),
|
|
1160
|
+
0
|
|
1161
|
+
), z = W + le - Z), rt(e, Z + z * j, () => {
|
|
1162
|
+
g--;
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1163
1165
|
}, 10);
|
|
1164
1166
|
return [
|
|
1165
1167
|
() => {
|
|
@@ -1169,8 +1171,8 @@ const vl = /* @__PURE__ */ O({
|
|
|
1169
1171
|
d = [], e.removeEventListener("scroll", m), o.removeEventListener("scroll", m);
|
|
1170
1172
|
}
|
|
1171
1173
|
];
|
|
1172
|
-
},
|
|
1173
|
-
const a =
|
|
1174
|
+
}, Ll = (e, o, l) => {
|
|
1175
|
+
const a = L("editorId");
|
|
1174
1176
|
let r = () => {
|
|
1175
1177
|
}, i = () => {
|
|
1176
1178
|
};
|
|
@@ -1181,46 +1183,46 @@ const vl = /* @__PURE__ */ O({
|
|
|
1181
1183
|
), g = document.querySelector(
|
|
1182
1184
|
`[id="${a}-html-wrapper"][data-show="true"]`
|
|
1183
1185
|
);
|
|
1184
|
-
(c || g) && ([i, r] = (c ?
|
|
1186
|
+
(c || g) && ([i, r] = (c ? Il : Ml)(
|
|
1185
1187
|
u,
|
|
1186
1188
|
c || g,
|
|
1187
1189
|
l.value
|
|
1188
1190
|
)), e.scrollAuto && i();
|
|
1189
1191
|
};
|
|
1190
|
-
|
|
1192
|
+
B(
|
|
1191
1193
|
[
|
|
1192
1194
|
o,
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1195
|
+
ne(e.setting, "preview"),
|
|
1196
|
+
ne(e.setting, "htmlPreview"),
|
|
1197
|
+
ne(e.setting, "fullscreen"),
|
|
1198
|
+
ne(e.setting, "pageFullscreen")
|
|
1197
1199
|
],
|
|
1198
1200
|
() => {
|
|
1199
|
-
|
|
1201
|
+
me(d);
|
|
1200
1202
|
}
|
|
1201
|
-
),
|
|
1203
|
+
), B(
|
|
1202
1204
|
() => e.scrollAuto,
|
|
1203
1205
|
(u) => {
|
|
1204
1206
|
u ? i() : r();
|
|
1205
1207
|
}
|
|
1206
|
-
),
|
|
1207
|
-
},
|
|
1208
|
-
var m, h,
|
|
1208
|
+
), Y(d);
|
|
1209
|
+
}, Dl = Ll, El = (e, o, l) => {
|
|
1210
|
+
var m, h, $, T, v, f;
|
|
1209
1211
|
let a = "", r = 0, i = 0, d = !0, u = !1;
|
|
1210
|
-
const c = o.getSelectedText(), g = (m =
|
|
1212
|
+
const c = o.getSelectedText(), g = (m = X.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
1211
1213
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1212
|
-
const k = e.replace(/^h(\d)/, (
|
|
1214
|
+
const k = e.replace(/^h(\d)/, (y, w) => new Array(Number(w)).fill("#", 0, w).join(""));
|
|
1213
1215
|
a = `${k} ${c}`, r = k.length + 1;
|
|
1214
1216
|
} else if (e === "prettier") {
|
|
1215
|
-
const k = window.prettier || ((
|
|
1216
|
-
((
|
|
1217
|
+
const k = window.prettier || (($ = (h = X.editorExtensions) == null ? void 0 : h.prettier) == null ? void 0 : $.prettierInstance), y = [
|
|
1218
|
+
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((f = (v = X.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : f.parserMarkdownInstance)
|
|
1217
1219
|
];
|
|
1218
|
-
!k ||
|
|
1220
|
+
!k || y[0] === void 0 ? (b.emit(l.editorId, "errorCatcher", {
|
|
1219
1221
|
name: "prettier",
|
|
1220
1222
|
message: "prettier is undefined"
|
|
1221
1223
|
}), a = o.getValue()) : a = k.format(o.getValue(), {
|
|
1222
1224
|
parser: "markdown",
|
|
1223
|
-
plugins:
|
|
1225
|
+
plugins: y
|
|
1224
1226
|
}), d = !1, u = !0;
|
|
1225
1227
|
} else
|
|
1226
1228
|
switch (e) {
|
|
@@ -1269,40 +1271,40 @@ const vl = /* @__PURE__ */ O({
|
|
|
1269
1271
|
break;
|
|
1270
1272
|
}
|
|
1271
1273
|
case "code": {
|
|
1272
|
-
const k = l.text || c || "",
|
|
1273
|
-
a = `\`\`\`${
|
|
1274
|
+
const k = l.text || c || "", y = l.mode || "language";
|
|
1275
|
+
a = `\`\`\`${y}
|
|
1274
1276
|
${k}
|
|
1275
1277
|
\`\`\`
|
|
1276
|
-
`, r = 3, i = 3 +
|
|
1278
|
+
`, r = 3, i = 3 + y.length - a.length;
|
|
1277
1279
|
break;
|
|
1278
1280
|
}
|
|
1279
1281
|
case "table": {
|
|
1280
1282
|
a = "|";
|
|
1281
|
-
const { selectedShape: k = { x: 1, y: 1 } } = l, { x:
|
|
1282
|
-
for (let
|
|
1283
|
+
const { selectedShape: k = { x: 1, y: 1 } } = l, { x: y, y: w } = k;
|
|
1284
|
+
for (let x = 0; x <= w; x++)
|
|
1283
1285
|
a += " col |";
|
|
1284
1286
|
a += `
|
|
1285
1287
|
|`;
|
|
1286
|
-
for (let
|
|
1288
|
+
for (let x = 0; x <= w; x++)
|
|
1287
1289
|
a += " - |";
|
|
1288
|
-
for (let
|
|
1290
|
+
for (let x = 0; x <= y; x++) {
|
|
1289
1291
|
a += `
|
|
1290
1292
|
|`;
|
|
1291
|
-
for (let
|
|
1293
|
+
for (let H = 0; H <= w; H++)
|
|
1292
1294
|
a += " content |";
|
|
1293
1295
|
}
|
|
1294
1296
|
r = 2, i = 5 - a.length;
|
|
1295
1297
|
break;
|
|
1296
1298
|
}
|
|
1297
1299
|
case "link": {
|
|
1298
|
-
const { desc: k, url:
|
|
1299
|
-
a = `[${k}](${
|
|
1300
|
+
const { desc: k, url: y } = l;
|
|
1301
|
+
a = `[${k}](${y})`, d = !1;
|
|
1300
1302
|
break;
|
|
1301
1303
|
}
|
|
1302
1304
|
case "image": {
|
|
1303
|
-
const { desc: k, url:
|
|
1304
|
-
|
|
1305
|
-
`, "") : a = ` => x + `
|
|
1307
|
+
`, "") : a = `
|
|
1306
1308
|
`, d = !1;
|
|
1307
1309
|
break;
|
|
1308
1310
|
}
|
|
@@ -1399,8 +1401,8 @@ $$
|
|
|
1399
1401
|
break;
|
|
1400
1402
|
}
|
|
1401
1403
|
case "universal": {
|
|
1402
|
-
const { generate: k } = l,
|
|
1403
|
-
a =
|
|
1404
|
+
const { generate: k } = l, y = k(c);
|
|
1405
|
+
a = y.targetValue, d = y.select, r = y.deviationStart, i = y.deviationEnd;
|
|
1404
1406
|
}
|
|
1405
1407
|
}
|
|
1406
1408
|
return {
|
|
@@ -1416,18 +1418,18 @@ $$
|
|
|
1416
1418
|
replaceAll: u
|
|
1417
1419
|
}
|
|
1418
1420
|
};
|
|
1419
|
-
},
|
|
1421
|
+
}, Hl = "#e5c07b", st = "var(--md-color)", Nl = "#56b6c2", Vl = "#ffffff", re = "var(--md-color)", ct = "#e5c07b", Ol = "#e5c07b", Bl = "var(--md-color)", ut = "#d19a66", Fl = "#c678dd", Rl = "#21252b", Pl = "#2c313a", dt = "var(--md-bk-color)", be = "var(--md-bk-color)", ql = "#ceedfa33", mt = "#528bff", Ul = pe.theme(
|
|
1420
1422
|
{
|
|
1421
1423
|
"&": {
|
|
1422
|
-
color:
|
|
1424
|
+
color: re,
|
|
1423
1425
|
backgroundColor: dt
|
|
1424
1426
|
},
|
|
1425
1427
|
".cm-content": {
|
|
1426
1428
|
caretColor: mt
|
|
1427
1429
|
},
|
|
1428
1430
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: mt },
|
|
1429
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1430
|
-
".cm-panels": { backgroundColor:
|
|
1431
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: ql },
|
|
1432
|
+
".cm-panels": { backgroundColor: Rl, color: re },
|
|
1431
1433
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1432
1434
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1433
1435
|
".cm-searchMatch": {
|
|
@@ -1444,12 +1446,12 @@ $$
|
|
|
1444
1446
|
},
|
|
1445
1447
|
".cm-gutters": {
|
|
1446
1448
|
backgroundColor: dt,
|
|
1447
|
-
color:
|
|
1449
|
+
color: re,
|
|
1448
1450
|
borderRight: "1px solid",
|
|
1449
1451
|
borderColor: "var(--md-border-color)"
|
|
1450
1452
|
},
|
|
1451
1453
|
".cm-activeLineGutter": {
|
|
1452
|
-
backgroundColor:
|
|
1454
|
+
backgroundColor: Pl
|
|
1453
1455
|
},
|
|
1454
1456
|
".cm-foldPlaceholder": {
|
|
1455
1457
|
backgroundColor: "transparent",
|
|
@@ -1458,29 +1460,29 @@ $$
|
|
|
1458
1460
|
},
|
|
1459
1461
|
".cm-tooltip": {
|
|
1460
1462
|
border: "1px solid var(--md-border-color)",
|
|
1461
|
-
backgroundColor:
|
|
1463
|
+
backgroundColor: be
|
|
1462
1464
|
},
|
|
1463
1465
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1464
1466
|
borderTopColor: "transparent",
|
|
1465
1467
|
borderBottomColor: "transparent"
|
|
1466
1468
|
},
|
|
1467
1469
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1468
|
-
borderTopColor:
|
|
1469
|
-
borderBottomColor:
|
|
1470
|
+
borderTopColor: be,
|
|
1471
|
+
borderBottomColor: be
|
|
1470
1472
|
},
|
|
1471
1473
|
".cm-tooltip-autocomplete": {
|
|
1472
1474
|
"& > ul > li[aria-selected]": {
|
|
1473
|
-
color:
|
|
1475
|
+
color: re
|
|
1474
1476
|
}
|
|
1475
1477
|
}
|
|
1476
1478
|
},
|
|
1477
1479
|
{ dark: !0 }
|
|
1478
|
-
),
|
|
1479
|
-
{ tag: s.keyword, color:
|
|
1480
|
+
), Gl = yt.define([
|
|
1481
|
+
{ tag: s.keyword, color: Fl },
|
|
1480
1482
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: st },
|
|
1481
1483
|
{ tag: [s.function(s.variableName), s.labelName], color: Ol },
|
|
1482
1484
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ut },
|
|
1483
|
-
{ tag: [s.definition(s.name), s.separator], color:
|
|
1485
|
+
{ tag: [s.definition(s.name), s.separator], color: re },
|
|
1484
1486
|
{
|
|
1485
1487
|
tag: [
|
|
1486
1488
|
s.typeName,
|
|
@@ -1492,7 +1494,7 @@ $$
|
|
|
1492
1494
|
s.self,
|
|
1493
1495
|
s.namespace
|
|
1494
1496
|
],
|
|
1495
|
-
color:
|
|
1497
|
+
color: Hl
|
|
1496
1498
|
},
|
|
1497
1499
|
{
|
|
1498
1500
|
tag: [
|
|
@@ -1504,7 +1506,7 @@ $$
|
|
|
1504
1506
|
s.link,
|
|
1505
1507
|
s.special(s.string)
|
|
1506
1508
|
],
|
|
1507
|
-
color:
|
|
1509
|
+
color: Nl
|
|
1508
1510
|
},
|
|
1509
1511
|
{ tag: [s.meta, s.comment], color: ct },
|
|
1510
1512
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1513,23 +1515,23 @@ $$
|
|
|
1513
1515
|
{ tag: s.link, color: ct, textDecoration: "underline" },
|
|
1514
1516
|
{ tag: s.heading, fontWeight: "bold", color: st },
|
|
1515
1517
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ut },
|
|
1516
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1517
|
-
{ tag: s.invalid, color:
|
|
1518
|
-
]),
|
|
1519
|
-
|
|
1520
|
-
Tt(
|
|
1521
|
-
],
|
|
1518
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Bl },
|
|
1519
|
+
{ tag: s.invalid, color: Vl }
|
|
1520
|
+
]), Kl = [
|
|
1521
|
+
Ul,
|
|
1522
|
+
Tt(Gl)
|
|
1523
|
+
], _l = "#e5c07b", gt = "#3f4a54", jl = "#56b6c2", Wl = "#fff", ie = "#3f4a54", ft = "#2d8cf0", zl = "#2d8cf0", Zl = "#3f4a54", bt = "#d19a66", Xl = "#c678dd", Yl = "#21252b", Jl = "#ceedfa33", ht = "var(--md-bk-color)", he = "var(--md-bk-color)", Ql = "#bad5fa", vt = "#3f4a54", eo = pe.theme(
|
|
1522
1524
|
{
|
|
1523
1525
|
"&": {
|
|
1524
|
-
color:
|
|
1526
|
+
color: ie,
|
|
1525
1527
|
backgroundColor: ht
|
|
1526
1528
|
},
|
|
1527
1529
|
".cm-content": {
|
|
1528
1530
|
caretColor: vt
|
|
1529
1531
|
},
|
|
1530
1532
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: vt },
|
|
1531
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1532
|
-
".cm-panels": { backgroundColor:
|
|
1533
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ql },
|
|
1534
|
+
".cm-panels": { backgroundColor: Yl, color: ie },
|
|
1533
1535
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1534
1536
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1535
1537
|
".cm-searchMatch": {
|
|
@@ -1546,12 +1548,12 @@ $$
|
|
|
1546
1548
|
},
|
|
1547
1549
|
".cm-gutters": {
|
|
1548
1550
|
backgroundColor: ht,
|
|
1549
|
-
color:
|
|
1551
|
+
color: ie,
|
|
1550
1552
|
borderRight: "1px solid",
|
|
1551
1553
|
borderColor: "var(--md-border-color)"
|
|
1552
1554
|
},
|
|
1553
1555
|
".cm-activeLineGutter": {
|
|
1554
|
-
backgroundColor:
|
|
1556
|
+
backgroundColor: Jl
|
|
1555
1557
|
},
|
|
1556
1558
|
".cm-foldPlaceholder": {
|
|
1557
1559
|
backgroundColor: "transparent",
|
|
@@ -1560,29 +1562,29 @@ $$
|
|
|
1560
1562
|
},
|
|
1561
1563
|
".cm-tooltip": {
|
|
1562
1564
|
border: "1px solid var(--md-border-color)",
|
|
1563
|
-
backgroundColor:
|
|
1565
|
+
backgroundColor: he
|
|
1564
1566
|
},
|
|
1565
1567
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1566
1568
|
borderTopColor: "transparent",
|
|
1567
1569
|
borderBottomColor: "transparent"
|
|
1568
1570
|
},
|
|
1569
1571
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1570
|
-
borderTopColor:
|
|
1571
|
-
borderBottomColor:
|
|
1572
|
+
borderTopColor: he,
|
|
1573
|
+
borderBottomColor: he
|
|
1572
1574
|
},
|
|
1573
1575
|
".cm-tooltip-autocomplete": {
|
|
1574
1576
|
"& > ul > li[aria-selected]": {
|
|
1575
|
-
color:
|
|
1577
|
+
color: ie
|
|
1576
1578
|
}
|
|
1577
1579
|
}
|
|
1578
1580
|
}
|
|
1579
1581
|
// { dark: true }
|
|
1580
|
-
),
|
|
1581
|
-
{ tag: s.keyword, color:
|
|
1582
|
+
), to = yt.define([
|
|
1583
|
+
{ tag: s.keyword, color: Xl },
|
|
1582
1584
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: gt },
|
|
1583
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1584
|
-
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color:
|
|
1585
|
-
{ tag: [s.definition(s.name), s.separator], color:
|
|
1585
|
+
{ tag: [s.function(s.variableName), s.labelName], color: zl },
|
|
1586
|
+
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: bt },
|
|
1587
|
+
{ tag: [s.definition(s.name), s.separator], color: ie },
|
|
1586
1588
|
{
|
|
1587
1589
|
tag: [
|
|
1588
1590
|
s.typeName,
|
|
@@ -1594,7 +1596,7 @@ $$
|
|
|
1594
1596
|
s.self,
|
|
1595
1597
|
s.namespace
|
|
1596
1598
|
],
|
|
1597
|
-
color:
|
|
1599
|
+
color: _l
|
|
1598
1600
|
},
|
|
1599
1601
|
{
|
|
1600
1602
|
tag: [
|
|
@@ -1606,32 +1608,32 @@ $$
|
|
|
1606
1608
|
s.link,
|
|
1607
1609
|
s.special(s.string)
|
|
1608
1610
|
],
|
|
1609
|
-
color:
|
|
1611
|
+
color: jl
|
|
1610
1612
|
},
|
|
1611
|
-
{ tag: [s.meta, s.comment], color:
|
|
1613
|
+
{ tag: [s.meta, s.comment], color: ft },
|
|
1612
1614
|
{ tag: s.strong, fontWeight: "bold" },
|
|
1613
1615
|
{ tag: s.emphasis, fontStyle: "italic" },
|
|
1614
1616
|
{ tag: s.strikethrough, textDecoration: "line-through" },
|
|
1615
|
-
{ tag: s.link, color:
|
|
1617
|
+
{ tag: s.link, color: ft, textDecoration: "underline" },
|
|
1616
1618
|
{ tag: s.heading, fontWeight: "bold", color: gt },
|
|
1617
|
-
{ tag: [s.atom, s.bool, s.special(s.variableName)], color:
|
|
1618
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1619
|
-
{ tag: s.invalid, color:
|
|
1620
|
-
]),
|
|
1621
|
-
|
|
1622
|
-
Tt(
|
|
1623
|
-
],
|
|
1619
|
+
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: bt },
|
|
1620
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Zl },
|
|
1621
|
+
{ tag: s.invalid, color: Wl }
|
|
1622
|
+
]), lo = [
|
|
1623
|
+
eo,
|
|
1624
|
+
Tt(to)
|
|
1625
|
+
], de = (e, o, l, a, r) => (i, d, u, c) => {
|
|
1624
1626
|
const g = `${e}${o}`.slice(c - u);
|
|
1625
1627
|
i.dispatch(i.state.replaceSelection(`${g}${l}${a}`));
|
|
1626
1628
|
const m = u + d.label.length + (r === "title" ? l.length : 0);
|
|
1627
1629
|
i.dispatch({
|
|
1628
|
-
selection:
|
|
1630
|
+
selection: G.create(
|
|
1629
1631
|
[
|
|
1630
|
-
|
|
1632
|
+
G.range(
|
|
1631
1633
|
u + d.label.length + (r === "title" ? 1 : -o.length),
|
|
1632
1634
|
m
|
|
1633
1635
|
),
|
|
1634
|
-
|
|
1636
|
+
G.cursor(m)
|
|
1635
1637
|
],
|
|
1636
1638
|
1
|
|
1637
1639
|
)
|
|
@@ -1639,7 +1641,7 @@ $$
|
|
|
1639
1641
|
}, kt = (e) => (o, l, a, r) => {
|
|
1640
1642
|
const i = e.slice(r - a);
|
|
1641
1643
|
o.dispatch(o.state.replaceSelection(`${i} `));
|
|
1642
|
-
},
|
|
1644
|
+
}, oo = (e) => {
|
|
1643
1645
|
const o = (l) => {
|
|
1644
1646
|
const a = l.matchBefore(
|
|
1645
1647
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1673,7 +1675,7 @@ $$
|
|
|
1673
1675
|
].map((r) => ({
|
|
1674
1676
|
label: `${r[0]}${r[1]}`,
|
|
1675
1677
|
type: "text",
|
|
1676
|
-
apply:
|
|
1678
|
+
apply: de(r[0], r[1], "", r[0] === "`" ? "`" : "\n```", "type")
|
|
1677
1679
|
})),
|
|
1678
1680
|
// 链接
|
|
1679
1681
|
{
|
|
@@ -1698,12 +1700,12 @@ $$
|
|
|
1698
1700
|
{
|
|
1699
1701
|
label: "$",
|
|
1700
1702
|
type: "text",
|
|
1701
|
-
apply:
|
|
1703
|
+
apply: de("$", "", "", "$", "type")
|
|
1702
1704
|
},
|
|
1703
1705
|
{
|
|
1704
1706
|
label: "$$",
|
|
1705
1707
|
type: "text",
|
|
1706
|
-
apply:
|
|
1708
|
+
apply: de("$$", "", `
|
|
1707
1709
|
`, `
|
|
1708
1710
|
$$`, "title")
|
|
1709
1711
|
},
|
|
@@ -1728,37 +1730,37 @@ $$`, "title")
|
|
|
1728
1730
|
].map((r) => ({
|
|
1729
1731
|
label: `!!! ${r}`,
|
|
1730
1732
|
type: "text",
|
|
1731
|
-
apply:
|
|
1733
|
+
apply: de("!!!", ` ${r}`, " Title", `
|
|
1732
1734
|
|
|
1733
1735
|
!!!`, "title")
|
|
1734
1736
|
}))
|
|
1735
1737
|
]
|
|
1736
1738
|
};
|
|
1737
1739
|
};
|
|
1738
|
-
return
|
|
1739
|
-
override: e ? [o,
|
|
1740
|
+
return ml({
|
|
1741
|
+
override: e ? [o, ...e] : [o]
|
|
1740
1742
|
});
|
|
1741
|
-
},
|
|
1742
|
-
const o = new
|
|
1743
|
+
}, ao = oo, J = (e) => {
|
|
1744
|
+
const o = new ul();
|
|
1743
1745
|
return (a) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(a) }) : e.dispatch({
|
|
1744
|
-
effects:
|
|
1746
|
+
effects: dl.appendConfig.of(o.of(a))
|
|
1745
1747
|
}), !0);
|
|
1746
1748
|
};
|
|
1747
|
-
class
|
|
1749
|
+
class no {
|
|
1748
1750
|
constructor(o) {
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
+
U(this, "view");
|
|
1752
|
+
U(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
1751
1753
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
+
U(this, "toggleTabSize");
|
|
1755
|
+
U(this, "togglePlaceholder");
|
|
1754
1756
|
/**
|
|
1755
1757
|
* 设置全部的扩展
|
|
1756
1758
|
*/
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
this.view = o, this.toggleTabSize =
|
|
1759
|
+
U(this, "setExtensions");
|
|
1760
|
+
U(this, "toggleDisabled");
|
|
1761
|
+
U(this, "toggleReadOnly");
|
|
1762
|
+
U(this, "toggleMaxlength");
|
|
1763
|
+
this.view = o, this.toggleTabSize = J(this.view), this.togglePlaceholder = J(this.view), this.setExtensions = J(this.view), this.toggleDisabled = J(this.view), this.toggleReadOnly = J(this.view), this.toggleMaxlength = J(this.view);
|
|
1762
1764
|
}
|
|
1763
1765
|
getValue() {
|
|
1764
1766
|
return this.view.state.doc.toString();
|
|
@@ -1814,10 +1816,10 @@ class io {
|
|
|
1814
1816
|
if (this.view.dispatch(this.view.state.replaceSelection(o)), l.select) {
|
|
1815
1817
|
const i = r + o.length + l.deviationEnd;
|
|
1816
1818
|
this.view.dispatch({
|
|
1817
|
-
selection:
|
|
1819
|
+
selection: G.create(
|
|
1818
1820
|
[
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
+
G.range(r + l.deviationStart, i),
|
|
1822
|
+
G.cursor(i)
|
|
1821
1823
|
],
|
|
1822
1824
|
1
|
|
1823
1825
|
)
|
|
@@ -1826,7 +1828,7 @@ class io {
|
|
|
1826
1828
|
this.view.focus();
|
|
1827
1829
|
} catch (r) {
|
|
1828
1830
|
if (r.message === "The input text is too long")
|
|
1829
|
-
|
|
1831
|
+
b.emit(a, "errorCatcher", {
|
|
1830
1832
|
name: "overlength",
|
|
1831
1833
|
message: r.message,
|
|
1832
1834
|
data: o
|
|
@@ -1842,8 +1844,8 @@ class io {
|
|
|
1842
1844
|
*/
|
|
1843
1845
|
setTabSize(o) {
|
|
1844
1846
|
this.toggleTabSize([
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
+
fe.tabSize.of(o),
|
|
1848
|
+
cl.of(" ".repeat(o))
|
|
1847
1849
|
]);
|
|
1848
1850
|
}
|
|
1849
1851
|
/**
|
|
@@ -1870,32 +1872,32 @@ class io {
|
|
|
1870
1872
|
}
|
|
1871
1873
|
this.view.dispatch({
|
|
1872
1874
|
scrollIntoView: !0,
|
|
1873
|
-
selection:
|
|
1874
|
-
[
|
|
1875
|
+
selection: G.create(
|
|
1876
|
+
[G.range(l, a), G.cursor(r)],
|
|
1875
1877
|
1
|
|
1876
1878
|
)
|
|
1877
1879
|
});
|
|
1878
1880
|
}
|
|
1879
1881
|
setDisabled(o) {
|
|
1880
|
-
this.toggleDisabled([
|
|
1882
|
+
this.toggleDisabled([pe.editable.of(!o)]);
|
|
1881
1883
|
}
|
|
1882
1884
|
setReadOnly(o) {
|
|
1883
|
-
this.toggleReadOnly([
|
|
1885
|
+
this.toggleReadOnly([fe.readOnly.of(o)]);
|
|
1884
1886
|
}
|
|
1885
1887
|
setMaxLength(o) {
|
|
1886
1888
|
this.maxLength = o, this.toggleMaxlength([
|
|
1887
|
-
|
|
1889
|
+
fe.changeFilter.of((l) => l.newDoc.length <= o)
|
|
1888
1890
|
]);
|
|
1889
1891
|
}
|
|
1890
1892
|
}
|
|
1891
|
-
const
|
|
1892
|
-
const o =
|
|
1893
|
+
const ro = (e) => {
|
|
1894
|
+
const o = L("editorId");
|
|
1893
1895
|
return (a) => {
|
|
1894
1896
|
if (!a.clipboardData)
|
|
1895
1897
|
return;
|
|
1896
1898
|
if (a.clipboardData.files.length > 0) {
|
|
1897
1899
|
const { files: i } = a.clipboardData;
|
|
1898
|
-
|
|
1900
|
+
b.emit(
|
|
1899
1901
|
o,
|
|
1900
1902
|
"uploadImage",
|
|
1901
1903
|
Array.from(i).filter((d) => /image\/.*/.test(d.type))
|
|
@@ -1904,23 +1906,23 @@ const so = (e) => {
|
|
|
1904
1906
|
}
|
|
1905
1907
|
if (e.autoDetectCode && a.clipboardData.types.includes("vscode-editor-data")) {
|
|
1906
1908
|
const i = JSON.parse(a.clipboardData.getData("vscode-editor-data"));
|
|
1907
|
-
|
|
1909
|
+
b.emit(o, "replace", "code", {
|
|
1908
1910
|
mode: i.mode,
|
|
1909
1911
|
text: a.clipboardData.getData("text/plain")
|
|
1910
1912
|
}), a.preventDefault();
|
|
1911
1913
|
return;
|
|
1912
1914
|
}
|
|
1913
1915
|
const r = a.clipboardData.getData("text/plain");
|
|
1914
|
-
e.maxlength && r.length + e.modelValue.length > e.maxlength &&
|
|
1916
|
+
e.maxlength && r.length + e.modelValue.length > e.maxlength && b.emit(o, "errorCatcher", {
|
|
1915
1917
|
name: "overlength",
|
|
1916
1918
|
message: "The input text is too long",
|
|
1917
1919
|
data: r
|
|
1918
1920
|
});
|
|
1919
1921
|
};
|
|
1920
|
-
},
|
|
1921
|
-
const o =
|
|
1922
|
-
|
|
1923
|
-
|
|
1922
|
+
}, io = ro, so = (e) => {
|
|
1923
|
+
const o = L("editorId");
|
|
1924
|
+
Y(() => {
|
|
1925
|
+
b.on(o, {
|
|
1924
1926
|
name: Pt,
|
|
1925
1927
|
callback(l) {
|
|
1926
1928
|
var a;
|
|
@@ -1928,121 +1930,120 @@ const so = (e) => {
|
|
|
1928
1930
|
}
|
|
1929
1931
|
});
|
|
1930
1932
|
});
|
|
1931
|
-
},
|
|
1933
|
+
}, co = so, uo = (e, o) => [
|
|
1932
1934
|
{
|
|
1933
1935
|
key: "Ctrl-b",
|
|
1934
1936
|
mac: "Cmd-b",
|
|
1935
|
-
run: () => (
|
|
1937
|
+
run: () => (b.emit(e, "replace", "bold"), !0)
|
|
1936
1938
|
},
|
|
1937
1939
|
{
|
|
1938
1940
|
key: "Ctrl-d",
|
|
1939
1941
|
mac: "Cmd-d",
|
|
1940
|
-
run:
|
|
1942
|
+
run: nl,
|
|
1941
1943
|
preventDefault: !0
|
|
1942
1944
|
},
|
|
1943
1945
|
{
|
|
1944
1946
|
key: "Ctrl-s",
|
|
1945
1947
|
mac: "Cmd-s",
|
|
1946
|
-
run: (
|
|
1947
|
-
shift: () => (
|
|
1948
|
+
run: (H) => (b.emit(e, Ct, H.state.doc.toString()), !0),
|
|
1949
|
+
shift: () => (b.emit(e, "replace", "strikeThrough"), !0)
|
|
1948
1950
|
},
|
|
1949
1951
|
{
|
|
1950
1952
|
key: "Ctrl-u",
|
|
1951
1953
|
mac: "Cmd-u",
|
|
1952
|
-
run: () => (
|
|
1953
|
-
shift: () => (
|
|
1954
|
+
run: () => (b.emit(e, "replace", "underline"), !0),
|
|
1955
|
+
shift: () => (b.emit(e, "replace", "unorderedList"), !0)
|
|
1954
1956
|
},
|
|
1955
1957
|
{
|
|
1956
1958
|
key: "Ctrl-i",
|
|
1957
1959
|
mac: "Cmd-i",
|
|
1958
|
-
run: () => (
|
|
1959
|
-
shift: () => (
|
|
1960
|
+
run: () => (b.emit(e, "replace", "italic"), !0),
|
|
1961
|
+
shift: () => (b.emit(e, "openModals", "image"), !0)
|
|
1960
1962
|
},
|
|
1961
1963
|
{
|
|
1962
1964
|
key: "Ctrl-1",
|
|
1963
1965
|
mac: "Cmd-1",
|
|
1964
|
-
run: () => (
|
|
1966
|
+
run: () => (b.emit(e, "replace", "h1"), !0)
|
|
1965
1967
|
},
|
|
1966
1968
|
{
|
|
1967
1969
|
key: "Ctrl-2",
|
|
1968
1970
|
mac: "Cmd-2",
|
|
1969
|
-
run: () => (
|
|
1971
|
+
run: () => (b.emit(e, "replace", "h2"), !0)
|
|
1970
1972
|
},
|
|
1971
1973
|
{
|
|
1972
1974
|
key: "Ctrl-3",
|
|
1973
1975
|
mac: "Cmd-3",
|
|
1974
|
-
run: () => (
|
|
1976
|
+
run: () => (b.emit(e, "replace", "h3"), !0)
|
|
1975
1977
|
},
|
|
1976
1978
|
{
|
|
1977
1979
|
key: "Ctrl-4",
|
|
1978
1980
|
mac: "Cmd-4",
|
|
1979
|
-
run: () => (
|
|
1981
|
+
run: () => (b.emit(e, "replace", "h4"), !0)
|
|
1980
1982
|
},
|
|
1981
1983
|
{
|
|
1982
1984
|
key: "Ctrl-5",
|
|
1983
1985
|
mac: "Cmd-5",
|
|
1984
|
-
run: () => (
|
|
1986
|
+
run: () => (b.emit(e, "replace", "h5"), !0)
|
|
1985
1987
|
},
|
|
1986
1988
|
{
|
|
1987
1989
|
key: "Ctrl-6",
|
|
1988
1990
|
mac: "Cmd-6",
|
|
1989
|
-
run: () => (
|
|
1991
|
+
run: () => (b.emit(e, "replace", "h6"), !0)
|
|
1990
1992
|
},
|
|
1991
1993
|
{
|
|
1992
1994
|
key: "Ctrl-ArrowUp",
|
|
1993
1995
|
mac: "Cmd-ArrowUp",
|
|
1994
|
-
run: () => (
|
|
1996
|
+
run: () => (b.emit(e, "replace", "sup"), !0)
|
|
1995
1997
|
},
|
|
1996
1998
|
{
|
|
1997
1999
|
key: "Ctrl-ArrowDown",
|
|
1998
2000
|
mac: "Cmd-ArrowDown",
|
|
1999
|
-
run: () => (
|
|
2001
|
+
run: () => (b.emit(e, "replace", "sub"), !0)
|
|
2000
2002
|
},
|
|
2001
2003
|
{
|
|
2002
2004
|
key: "Ctrl-o",
|
|
2003
2005
|
mac: "Cmd-o",
|
|
2004
|
-
run: () => (
|
|
2006
|
+
run: () => (b.emit(e, "replace", "orderedList"), !0)
|
|
2005
2007
|
},
|
|
2006
2008
|
{
|
|
2007
2009
|
key: "Ctrl-c",
|
|
2008
2010
|
mac: "Cmd-c",
|
|
2009
|
-
shift: () => (
|
|
2010
|
-
any(
|
|
2011
|
-
return (
|
|
2011
|
+
shift: () => (b.emit(e, "replace", "code"), !0),
|
|
2012
|
+
any(H, M) {
|
|
2013
|
+
return (M.ctrlKey || M.metaKey) && M.altKey && M.code === "KeyC" ? (b.emit(e, "replace", "codeRow"), !0) : !1;
|
|
2012
2014
|
}
|
|
2013
2015
|
},
|
|
2014
2016
|
{
|
|
2015
2017
|
key: "Ctrl-l",
|
|
2016
2018
|
mac: "Cmd-l",
|
|
2017
|
-
run: () => (
|
|
2019
|
+
run: () => (b.emit(e, "openModals", "link"), !0)
|
|
2018
2020
|
},
|
|
2019
2021
|
{
|
|
2020
2022
|
key: "Ctrl-f",
|
|
2021
2023
|
mac: "Cmd-f",
|
|
2022
|
-
shift: () => o.noPrettier ? !1 : (
|
|
2024
|
+
shift: () => o.noPrettier ? !1 : (b.emit(e, "replace", "prettier"), !0)
|
|
2023
2025
|
},
|
|
2024
2026
|
{
|
|
2025
|
-
any: (
|
|
2027
|
+
any: (H, M) => (M.ctrlKey || M.metaKey) && M.altKey && M.shiftKey && M.code === "KeyT" ? (b.emit(e, "replace", "table"), !0) : !1
|
|
2026
2028
|
}
|
|
2027
|
-
],
|
|
2028
|
-
const o =
|
|
2029
|
-
ll.of([...d,
|
|
2029
|
+
], mo = uo, go = (e) => {
|
|
2030
|
+
const o = L("tabWidth"), l = L("editorId"), a = L("theme"), r = K(), i = At(), d = mo(l, e), u = io(e), c = [
|
|
2031
|
+
ll.of([...d, rl]),
|
|
2030
2032
|
el,
|
|
2031
|
-
rl(),
|
|
2032
2033
|
al({ codeLanguages: ol }),
|
|
2033
2034
|
// 横向换行
|
|
2034
|
-
|
|
2035
|
-
|
|
2035
|
+
ue.lineWrapping,
|
|
2036
|
+
ue.updateListener.of((m) => {
|
|
2036
2037
|
m.docChanged && e.onChange(m.state.doc.toString());
|
|
2037
2038
|
}),
|
|
2038
|
-
|
|
2039
|
+
ue.domEventHandlers({
|
|
2039
2040
|
paste: u,
|
|
2040
2041
|
blur: e.onBlur,
|
|
2041
2042
|
focus: e.onFocus,
|
|
2042
2043
|
input: (m) => {
|
|
2043
2044
|
e.onInput && e.onInput(m);
|
|
2044
2045
|
const { data: h } = m;
|
|
2045
|
-
e.maxlength && e.modelValue.length + h.length > e.maxlength &&
|
|
2046
|
+
e.maxlength && e.modelValue.length + h.length > e.maxlength && b.emit(l, "errorCatcher", {
|
|
2046
2047
|
name: "overlength",
|
|
2047
2048
|
message: "The input text is too long",
|
|
2048
2049
|
data: h
|
|
@@ -2052,40 +2053,40 @@ const so = (e) => {
|
|
|
2052
2053
|
], g = () => {
|
|
2053
2054
|
const m = [
|
|
2054
2055
|
...c,
|
|
2055
|
-
a.value === "light" ?
|
|
2056
|
-
|
|
2056
|
+
a.value === "light" ? lo : Kl,
|
|
2057
|
+
ao(e.completions)
|
|
2057
2058
|
];
|
|
2058
|
-
return
|
|
2059
|
+
return X.codeMirrorExtensions(a.value, m, [
|
|
2059
2060
|
...d
|
|
2060
2061
|
]);
|
|
2061
2062
|
};
|
|
2062
|
-
return
|
|
2063
|
-
const m = new
|
|
2063
|
+
return Y(() => {
|
|
2064
|
+
const m = new ue({
|
|
2064
2065
|
doc: e.modelValue,
|
|
2065
2066
|
parent: r.value
|
|
2066
|
-
}), h = new
|
|
2067
|
+
}), h = new no(m);
|
|
2067
2068
|
i.value = h, setTimeout(() => {
|
|
2068
2069
|
h.setTabSize(o), h.setDisabled(e.disabled), h.setReadOnly(e.readonly), h.setExtensions(g()), e.placeholder && h.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && h.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2069
|
-
}, 0),
|
|
2070
|
+
}, 0), b.on(l, {
|
|
2070
2071
|
name: "ctrlZ",
|
|
2071
2072
|
callback() {
|
|
2072
|
-
|
|
2073
|
+
il(m);
|
|
2073
2074
|
}
|
|
2074
|
-
}),
|
|
2075
|
+
}), b.on(l, {
|
|
2075
2076
|
name: "ctrlShiftZ",
|
|
2076
2077
|
callback() {
|
|
2077
|
-
|
|
2078
|
+
sl(m);
|
|
2078
2079
|
}
|
|
2079
|
-
}),
|
|
2080
|
+
}), b.on(l, {
|
|
2080
2081
|
name: "replace",
|
|
2081
|
-
callback(
|
|
2082
|
+
callback($, T = {}) {
|
|
2082
2083
|
var k;
|
|
2083
|
-
const { text: v, options:
|
|
2084
|
-
(k = i.value) == null || k.replaceSelectedText(v,
|
|
2084
|
+
const { text: v, options: f } = El($, i.value, T);
|
|
2085
|
+
(k = i.value) == null || k.replaceSelectedText(v, f, l);
|
|
2085
2086
|
}
|
|
2086
2087
|
});
|
|
2087
|
-
}),
|
|
2088
|
-
[a,
|
|
2088
|
+
}), B(
|
|
2089
|
+
[a, ne(e, "completions")],
|
|
2089
2090
|
() => {
|
|
2090
2091
|
var m;
|
|
2091
2092
|
(m = i.value) == null || m.setExtensions(g());
|
|
@@ -2093,49 +2094,49 @@ const so = (e) => {
|
|
|
2093
2094
|
{
|
|
2094
2095
|
deep: !0
|
|
2095
2096
|
}
|
|
2096
|
-
),
|
|
2097
|
+
), B(
|
|
2097
2098
|
() => e.modelValue,
|
|
2098
2099
|
() => {
|
|
2099
2100
|
var m, h;
|
|
2100
2101
|
((m = i.value) == null ? void 0 : m.getValue()) !== e.modelValue && ((h = i.value) == null || h.setValue(e.modelValue));
|
|
2101
2102
|
}
|
|
2102
|
-
),
|
|
2103
|
+
), B(
|
|
2103
2104
|
() => e.placeholder,
|
|
2104
2105
|
() => {
|
|
2105
2106
|
var m;
|
|
2106
2107
|
(m = i.value) == null || m.setPlaceholder(e.placeholder);
|
|
2107
2108
|
}
|
|
2108
|
-
),
|
|
2109
|
+
), B(
|
|
2109
2110
|
() => e.disabled,
|
|
2110
2111
|
() => {
|
|
2111
2112
|
var m;
|
|
2112
2113
|
(m = i.value) == null || m.setDisabled(e.disabled);
|
|
2113
2114
|
}
|
|
2114
|
-
),
|
|
2115
|
+
), B(
|
|
2115
2116
|
() => e.readonly,
|
|
2116
2117
|
() => {
|
|
2117
2118
|
var m;
|
|
2118
2119
|
(m = i.value) == null || m.setDisabled(e.readonly);
|
|
2119
2120
|
}
|
|
2120
|
-
),
|
|
2121
|
+
), B(
|
|
2121
2122
|
() => e.maxlength,
|
|
2122
2123
|
() => {
|
|
2123
2124
|
var m;
|
|
2124
2125
|
e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
|
|
2125
2126
|
}
|
|
2126
|
-
),
|
|
2127
|
+
), co(i), {
|
|
2127
2128
|
inputWrapperRef: r,
|
|
2128
2129
|
codeMirrorUt: i
|
|
2129
2130
|
};
|
|
2130
|
-
},
|
|
2131
|
+
}, fo = go, bo = /* @__PURE__ */ R({
|
|
2131
2132
|
name: "MDEditorContent",
|
|
2132
2133
|
props: qt,
|
|
2133
2134
|
setup(e) {
|
|
2134
|
-
const o =
|
|
2135
|
+
const o = L("editorId"), l = K(""), {
|
|
2135
2136
|
inputWrapperRef: a,
|
|
2136
2137
|
codeMirrorUt: r
|
|
2137
|
-
} =
|
|
2138
|
-
return
|
|
2138
|
+
} = fo(e);
|
|
2139
|
+
return Dl(e, l, r), () => t("div", {
|
|
2139
2140
|
class: `${n}-content`
|
|
2140
2141
|
}, [t("div", {
|
|
2141
2142
|
class: `${n}-input-wrapper`,
|
|
@@ -2162,7 +2163,7 @@ const so = (e) => {
|
|
|
2162
2163
|
key: "internal-catalog"
|
|
2163
2164
|
}, null)]);
|
|
2164
2165
|
}
|
|
2165
|
-
}),
|
|
2166
|
+
}), ho = /* @__PURE__ */ R({
|
|
2166
2167
|
props: {
|
|
2167
2168
|
modelValue: {
|
|
2168
2169
|
type: String,
|
|
@@ -2170,7 +2171,7 @@ const so = (e) => {
|
|
|
2170
2171
|
}
|
|
2171
2172
|
},
|
|
2172
2173
|
setup(e) {
|
|
2173
|
-
const o =
|
|
2174
|
+
const o = L("usedLanguageText");
|
|
2174
2175
|
return () => {
|
|
2175
2176
|
var l, a;
|
|
2176
2177
|
return t("div", {
|
|
@@ -2180,7 +2181,7 @@ const so = (e) => {
|
|
|
2180
2181
|
}, [`${(l = o.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((a = e.modelValue) == null ? void 0 : a.length) || 0])]);
|
|
2181
2182
|
};
|
|
2182
2183
|
}
|
|
2183
|
-
}),
|
|
2184
|
+
}), vo = {
|
|
2184
2185
|
checked: {
|
|
2185
2186
|
type: Boolean,
|
|
2186
2187
|
default: !1
|
|
@@ -2190,8 +2191,8 @@ const so = (e) => {
|
|
|
2190
2191
|
default: () => {
|
|
2191
2192
|
}
|
|
2192
2193
|
}
|
|
2193
|
-
},
|
|
2194
|
-
props:
|
|
2194
|
+
}, ko = /* @__PURE__ */ R({
|
|
2195
|
+
props: vo,
|
|
2195
2196
|
setup(e) {
|
|
2196
2197
|
return () => t("div", {
|
|
2197
2198
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2200,7 +2201,7 @@ const so = (e) => {
|
|
|
2200
2201
|
}
|
|
2201
2202
|
}, null);
|
|
2202
2203
|
}
|
|
2203
|
-
}),
|
|
2204
|
+
}), po = {
|
|
2204
2205
|
scrollAuto: {
|
|
2205
2206
|
type: Boolean
|
|
2206
2207
|
},
|
|
@@ -2209,10 +2210,10 @@ const so = (e) => {
|
|
|
2209
2210
|
default: () => {
|
|
2210
2211
|
}
|
|
2211
2212
|
}
|
|
2212
|
-
},
|
|
2213
|
-
props:
|
|
2213
|
+
}, Co = /* @__PURE__ */ R({
|
|
2214
|
+
props: po,
|
|
2214
2215
|
setup(e) {
|
|
2215
|
-
const o =
|
|
2216
|
+
const o = L("usedLanguageText");
|
|
2216
2217
|
return () => {
|
|
2217
2218
|
var l;
|
|
2218
2219
|
return t("div", {
|
|
@@ -2222,13 +2223,13 @@ const so = (e) => {
|
|
|
2222
2223
|
onClick: () => {
|
|
2223
2224
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2224
2225
|
}
|
|
2225
|
-
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(
|
|
2226
|
+
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(ko, {
|
|
2226
2227
|
checked: e.scrollAuto,
|
|
2227
2228
|
onChange: e.onScrollAutoChange
|
|
2228
2229
|
}, null)]);
|
|
2229
2230
|
};
|
|
2230
2231
|
}
|
|
2231
|
-
}),
|
|
2232
|
+
}), $o = {
|
|
2232
2233
|
modelValue: {
|
|
2233
2234
|
type: String,
|
|
2234
2235
|
default: ""
|
|
@@ -2248,22 +2249,22 @@ const so = (e) => {
|
|
|
2248
2249
|
defFooters: {
|
|
2249
2250
|
type: Object
|
|
2250
2251
|
}
|
|
2251
|
-
},
|
|
2252
|
+
}, yo = /* @__PURE__ */ R({
|
|
2252
2253
|
name: "MDEditorFooter",
|
|
2253
|
-
props:
|
|
2254
|
+
props: $o,
|
|
2254
2255
|
setup(e) {
|
|
2255
|
-
const o =
|
|
2256
|
+
const o = ke(() => {
|
|
2256
2257
|
const a = e.footers.indexOf("="), r = a === -1 ? e.footers : e.footers.slice(0, a), i = a === -1 ? [] : e.footers.slice(a, Number.MAX_SAFE_INTEGER);
|
|
2257
2258
|
return [r, i];
|
|
2258
2259
|
}), l = (a) => {
|
|
2259
|
-
if (
|
|
2260
|
+
if (Dt.includes(a))
|
|
2260
2261
|
switch (a) {
|
|
2261
2262
|
case "markdownTotal":
|
|
2262
|
-
return t(
|
|
2263
|
+
return t(ho, {
|
|
2263
2264
|
modelValue: e.modelValue
|
|
2264
2265
|
}, null);
|
|
2265
2266
|
case "scrollSwitch":
|
|
2266
|
-
return t(
|
|
2267
|
+
return t(Co, {
|
|
2267
2268
|
scrollAuto: e.scrollAuto,
|
|
2268
2269
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2269
2270
|
}, null);
|
|
@@ -2282,7 +2283,7 @@ const so = (e) => {
|
|
|
2282
2283
|
}, [r])]);
|
|
2283
2284
|
};
|
|
2284
2285
|
}
|
|
2285
|
-
}),
|
|
2286
|
+
}), To = /* @__PURE__ */ R({
|
|
2286
2287
|
name: "MdEditorV3",
|
|
2287
2288
|
props: Gt,
|
|
2288
2289
|
emits: Kt,
|
|
@@ -2294,19 +2295,19 @@ const so = (e) => {
|
|
|
2294
2295
|
noPrettier: i,
|
|
2295
2296
|
noUploadImg: d,
|
|
2296
2297
|
noHighlight: u
|
|
2297
|
-
} = e, c =
|
|
2298
|
+
} = e, c = Q({
|
|
2298
2299
|
scrollAuto: e.scrollAuto
|
|
2299
2300
|
});
|
|
2300
2301
|
_t(e, o), jt(e), Wt(e), zt(e, o);
|
|
2301
2302
|
const [g, m] = Zt(e, o), h = Xt(e);
|
|
2302
2303
|
return Mt(() => {
|
|
2303
|
-
|
|
2304
|
+
b.clear(l);
|
|
2304
2305
|
}), Yt(e, o, h, g, m), () => {
|
|
2305
2306
|
var v;
|
|
2306
|
-
const
|
|
2307
|
+
const $ = it({
|
|
2307
2308
|
props: e,
|
|
2308
2309
|
ctx: o
|
|
2309
|
-
}, "defToolbars"),
|
|
2310
|
+
}, "defToolbars"), T = it({
|
|
2310
2311
|
props: e,
|
|
2311
2312
|
ctx: o
|
|
2312
2313
|
}, "defFooters");
|
|
@@ -2314,17 +2315,17 @@ const so = (e) => {
|
|
|
2314
2315
|
id: l,
|
|
2315
2316
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, g.fullscreen || g.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2316
2317
|
style: e.style
|
|
2317
|
-
}, [t(
|
|
2318
|
+
}, [t(Al, {
|
|
2318
2319
|
noPrettier: i,
|
|
2319
2320
|
toolbars: e.toolbars,
|
|
2320
2321
|
toolbarsExclude: e.toolbarsExclude,
|
|
2321
2322
|
setting: g,
|
|
2322
2323
|
updateSetting: m,
|
|
2323
2324
|
tableShape: e.tableShape,
|
|
2324
|
-
defToolbars:
|
|
2325
|
+
defToolbars: $,
|
|
2325
2326
|
noUploadImg: d,
|
|
2326
2327
|
showToolbarName: e.showToolbarName
|
|
2327
|
-
}, null), t(
|
|
2328
|
+
}, null), t(bo, {
|
|
2328
2329
|
modelValue: e.modelValue,
|
|
2329
2330
|
setting: g,
|
|
2330
2331
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2341,39 +2342,39 @@ const so = (e) => {
|
|
|
2341
2342
|
maxlength: e.maxLength,
|
|
2342
2343
|
autoDetectCode: e.autoDetectCode,
|
|
2343
2344
|
noHighlight: u,
|
|
2344
|
-
onChange: (
|
|
2345
|
-
e.onChange ? e.onChange(
|
|
2345
|
+
onChange: (f) => {
|
|
2346
|
+
e.onChange ? e.onChange(f) : (o.emit("update:modelValue", f), o.emit("onChange", f));
|
|
2346
2347
|
},
|
|
2347
|
-
onHtmlChanged: (
|
|
2348
|
-
e.onHtmlChanged ? e.onHtmlChanged(
|
|
2348
|
+
onHtmlChanged: (f) => {
|
|
2349
|
+
e.onHtmlChanged ? e.onHtmlChanged(f) : o.emit("onHtmlChanged", f);
|
|
2349
2350
|
},
|
|
2350
|
-
onGetCatalog: (
|
|
2351
|
-
e.onGetCatalog ? e.onGetCatalog(
|
|
2351
|
+
onGetCatalog: (f) => {
|
|
2352
|
+
e.onGetCatalog ? e.onGetCatalog(f) : o.emit("onGetCatalog", f);
|
|
2352
2353
|
},
|
|
2353
|
-
onBlur: (
|
|
2354
|
-
e.onBlur ? e.onBlur(
|
|
2354
|
+
onBlur: (f) => {
|
|
2355
|
+
e.onBlur ? e.onBlur(f) : o.emit("onBlur", f);
|
|
2355
2356
|
},
|
|
2356
|
-
onFocus: (
|
|
2357
|
-
e.onFocus ? e.onFocus(
|
|
2357
|
+
onFocus: (f) => {
|
|
2358
|
+
e.onFocus ? e.onFocus(f) : o.emit("onFocus", f);
|
|
2358
2359
|
},
|
|
2359
|
-
onInput: (
|
|
2360
|
-
e.onInput ? e.onInput(
|
|
2360
|
+
onInput: (f) => {
|
|
2361
|
+
e.onInput ? e.onInput(f) : o.emit("onInput", f);
|
|
2361
2362
|
},
|
|
2362
2363
|
completions: e.completions,
|
|
2363
2364
|
catalogVisible: h.value,
|
|
2364
2365
|
theme: e.theme,
|
|
2365
2366
|
noImgZoomIn: e.noImgZoomIn
|
|
2366
|
-
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(
|
|
2367
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t(yo, {
|
|
2367
2368
|
modelValue: e.modelValue,
|
|
2368
2369
|
footers: e.footers,
|
|
2369
|
-
defFooters:
|
|
2370
|
+
defFooters: T,
|
|
2370
2371
|
scrollAuto: c.scrollAuto,
|
|
2371
|
-
onScrollAutoChange: (
|
|
2372
|
+
onScrollAutoChange: (f) => c.scrollAuto = f
|
|
2372
2373
|
}, null)]);
|
|
2373
2374
|
};
|
|
2374
2375
|
}
|
|
2375
|
-
}),
|
|
2376
|
-
|
|
2376
|
+
}), ve = To;
|
|
2377
|
+
ve.install = (e) => (e.component(ve.name, ve), e.use(gl).use(Ot).use(fl).use(wt).use(Jt), e);
|
|
2377
2378
|
export {
|
|
2378
|
-
|
|
2379
|
+
ve as default
|
|
2379
2380
|
};
|