md-editor-v3 4.3.0-beta.7 → 4.4.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 +4 -4
- package/lib/cjs/MdEditor.cjs +8 -8
- package/lib/cjs/chunks/index.cjs +6 -6
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +416 -519
- package/lib/es/chunks/index.mjs +359 -282
- package/lib/es/index.mjs +16 -17
- package/lib/types/MdEditor/Editor.d.ts +9 -0
- package/lib/types/MdEditor/index.d.ts +20 -1
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +33 -73
- package/lib/types/MdEditor/layouts/Content/index.d.ts +73 -58
- package/lib/types/MdEditor/layouts/Content/props.d.ts +73 -17
- package/lib/types/MdEditor/props.d.ts +14 -0
- package/lib/types/MdEditor/type.d.ts +1 -3
- package/lib/types/MdPreview/MdPreview.d.ts +9 -0
- package/lib/types/MdPreview/index.d.ts +20 -1
- package/lib/umd/index.js +31 -31
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,41 +1,40 @@
|
|
|
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
3
|
var P = (e, a, l) => (xt(e, typeof a != "symbol" ? a + "" : a, l), l);
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { p as o, a as z, s as Mt, b as
|
|
6
|
-
import { draggingScroll as
|
|
7
|
-
import { a as te, D as
|
|
8
|
-
import { b as f, a as
|
|
9
|
-
import { C as
|
|
10
|
-
import { a as
|
|
11
|
-
import
|
|
12
|
-
import { minimalSetup as
|
|
13
|
-
import { EditorView as be, placeholder as
|
|
14
|
-
import { languages as
|
|
15
|
-
import { markdown as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as cl } from "@codemirror/language";
|
|
4
|
+
import { defineComponent as B, createVNode as t, inject as A, ref as U, onMounted as Z, reactive as Y, 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 It, d as Lt } from "./chunks/config.mjs";
|
|
6
|
+
import { draggingScroll as Et, linkTo as Dt, debounce as Nt, throttle as Ht, smoothScroll as rt } from "@vavt/util";
|
|
7
|
+
import { a as te, D as Vt } from "./chunks/index2.mjs";
|
|
8
|
+
import { b as f, a as Ft } from "./chunks/index3.mjs";
|
|
9
|
+
import { C as Bt, a as Ot, O as Ct, T as Rt, c as Pt, b as qt, e as Ut, d as Gt, u as Kt, f as _t, g as jt, h as Wt, i as zt, j as Zt, k as Xt, M as Yt } from "./chunks/index.mjs";
|
|
10
|
+
import { a as Jt } from "./chunks/dom.mjs";
|
|
11
|
+
import pt from "./MdModal.mjs";
|
|
12
|
+
import { minimalSetup as Qt, EditorView as ie } from "codemirror";
|
|
13
|
+
import { EditorView as be, placeholder as el, keymap as tl } from "@codemirror/view";
|
|
14
|
+
import { languages as ll } from "@codemirror/language-data";
|
|
15
|
+
import { markdown as ol } from "@codemirror/lang-markdown";
|
|
16
|
+
import { deleteLine as al, indentWithTab as rl, undo as nl, redo as il } from "@codemirror/commands";
|
|
17
|
+
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as sl } from "@codemirror/language";
|
|
19
18
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as q, EditorState as ue, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
19
|
+
import { EditorSelection as q, EditorState as ue, Compartment as cl, StateEffect as dl } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as ul } from "@codemirror/autocomplete";
|
|
22
21
|
import Tt from "./MdCatalog.mjs";
|
|
23
|
-
import { g as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
22
|
+
import { g as nt } from "./chunks/vue-tsx.mjs";
|
|
23
|
+
import ml from "./NormalToolbar.mjs";
|
|
24
|
+
import gl 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 hl = /* @__PURE__ */ B({
|
|
33
32
|
setup() {
|
|
34
33
|
return () => t("div", {
|
|
35
34
|
class: `${o}-divider`
|
|
36
35
|
}, null);
|
|
37
36
|
}
|
|
38
|
-
}),
|
|
37
|
+
}), fl = {
|
|
39
38
|
noPrettier: {
|
|
40
39
|
type: Boolean
|
|
41
40
|
},
|
|
@@ -84,11 +83,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
84
83
|
showToolbarName: {
|
|
85
84
|
type: Boolean
|
|
86
85
|
}
|
|
87
|
-
},
|
|
86
|
+
}, bl = (e) => {
|
|
88
87
|
var c, g, m, b;
|
|
89
88
|
const a = A("editorId");
|
|
90
89
|
let l = (g = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
|
|
91
|
-
const
|
|
90
|
+
const r = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, n = U(!1), i = ($) => {
|
|
92
91
|
if (!l) {
|
|
93
92
|
f.emit(a, "errorCatcher", {
|
|
94
93
|
name: "fullscreen",
|
|
@@ -96,26 +95,26 @@ const fl = /* @__PURE__ */ V({
|
|
|
96
95
|
});
|
|
97
96
|
return;
|
|
98
97
|
}
|
|
99
|
-
l.isEnabled ? (
|
|
98
|
+
l.isEnabled ? (n.value = !0, ($ === void 0 ? !l.isFullscreen : $) ? l.request() : l.exit()) : console.error("browser does not support screenfull!");
|
|
100
99
|
}, u = () => {
|
|
101
100
|
l && l.isEnabled && l.on("change", () => {
|
|
102
|
-
(
|
|
101
|
+
(n.value || e.setting.fullscreen) && (n.value = !1, e.updateSetting("fullscreen"));
|
|
103
102
|
});
|
|
104
103
|
}, d = () => {
|
|
105
104
|
l = window.screenfull, u();
|
|
106
105
|
};
|
|
107
|
-
return
|
|
106
|
+
return Z(() => {
|
|
108
107
|
if (u(), !l) {
|
|
109
108
|
const $ = document.createElement("script");
|
|
110
|
-
$.src =
|
|
109
|
+
$.src = r || Mt, $.onload = d, $.id = `${o}-screenfull`, Jt($, "screenfull");
|
|
111
110
|
}
|
|
112
|
-
}),
|
|
111
|
+
}), Z(() => {
|
|
113
112
|
f.on(a, {
|
|
114
|
-
name:
|
|
113
|
+
name: Bt,
|
|
115
114
|
callback: i
|
|
116
115
|
});
|
|
117
116
|
}), { fullscreenHandler: i };
|
|
118
|
-
},
|
|
117
|
+
}, vl = {
|
|
119
118
|
tableShape: {
|
|
120
119
|
type: Array,
|
|
121
120
|
default: () => [6, 4]
|
|
@@ -125,11 +124,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
125
124
|
default: () => {
|
|
126
125
|
}
|
|
127
126
|
}
|
|
128
|
-
},
|
|
127
|
+
}, kl = /* @__PURE__ */ B({
|
|
129
128
|
name: "TableShape",
|
|
130
|
-
props:
|
|
129
|
+
props: vl,
|
|
131
130
|
setup(e) {
|
|
132
|
-
const a =
|
|
131
|
+
const a = Y({
|
|
133
132
|
x: -1,
|
|
134
133
|
y: -1
|
|
135
134
|
});
|
|
@@ -138,23 +137,23 @@ const fl = /* @__PURE__ */ V({
|
|
|
138
137
|
onMouseleave: () => {
|
|
139
138
|
a.x = -1, a.y = -1;
|
|
140
139
|
}
|
|
141
|
-
}, [new Array(e.tableShape[1]).fill("").map((l,
|
|
140
|
+
}, [new Array(e.tableShape[1]).fill("").map((l, r) => t("div", {
|
|
142
141
|
class: `${o}-table-shape-row`,
|
|
143
|
-
key: `table-shape-row-${
|
|
144
|
-
}, [new Array(e.tableShape[0]).fill("").map((
|
|
142
|
+
key: `table-shape-row-${r}`
|
|
143
|
+
}, [new Array(e.tableShape[0]).fill("").map((n, i) => t("div", {
|
|
145
144
|
class: `${o}-table-shape-col`,
|
|
146
145
|
key: `table-shape-col-${i}`,
|
|
147
146
|
onMouseenter: () => {
|
|
148
|
-
a.x =
|
|
147
|
+
a.x = r, a.y = i;
|
|
149
148
|
},
|
|
150
149
|
onClick: () => {
|
|
151
150
|
e.onSelected(a);
|
|
152
151
|
}
|
|
153
152
|
}, [t("div", {
|
|
154
|
-
class: [`${o}-table-shape-col-default`,
|
|
153
|
+
class: [`${o}-table-shape-col-default`, r <= a.x && i <= a.y && `${o}-table-shape-col-include`]
|
|
155
154
|
}, null)]))]))]);
|
|
156
155
|
}
|
|
157
|
-
}), Cl =
|
|
156
|
+
}), Cl = kl, pl = {
|
|
158
157
|
type: {
|
|
159
158
|
type: String,
|
|
160
159
|
default: "link"
|
|
@@ -173,10 +172,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
173
172
|
default: () => {
|
|
174
173
|
}
|
|
175
174
|
}
|
|
176
|
-
},
|
|
177
|
-
props:
|
|
175
|
+
}, $l = /* @__PURE__ */ B({
|
|
176
|
+
props: pl,
|
|
178
177
|
setup(e) {
|
|
179
|
-
const a = A("usedLanguageText"), l = A("editorId"),
|
|
178
|
+
const a = A("usedLanguageText"), l = A("editorId"), r = fe(() => {
|
|
180
179
|
var i, u;
|
|
181
180
|
switch (e.type) {
|
|
182
181
|
case "link":
|
|
@@ -186,16 +185,16 @@ const fl = /* @__PURE__ */ V({
|
|
|
186
185
|
default:
|
|
187
186
|
return "";
|
|
188
187
|
}
|
|
189
|
-
}),
|
|
188
|
+
}), n = Y({
|
|
190
189
|
desc: "",
|
|
191
190
|
url: ""
|
|
192
191
|
});
|
|
193
192
|
return H(() => e.visible, (i) => {
|
|
194
193
|
i || setTimeout(() => {
|
|
195
|
-
|
|
194
|
+
n.desc = "", n.url = "";
|
|
196
195
|
}, 200);
|
|
197
|
-
}), () => t(
|
|
198
|
-
title:
|
|
196
|
+
}), () => t(pt, {
|
|
197
|
+
title: r.value,
|
|
199
198
|
visible: e.visible,
|
|
200
199
|
onClose: e.onCancel
|
|
201
200
|
}, {
|
|
@@ -211,9 +210,9 @@ const fl = /* @__PURE__ */ V({
|
|
|
211
210
|
class: `${o}-input`,
|
|
212
211
|
id: `link-desc-${l}`,
|
|
213
212
|
type: "text",
|
|
214
|
-
value:
|
|
213
|
+
value: n.desc,
|
|
215
214
|
onChange: (m) => {
|
|
216
|
-
|
|
215
|
+
n.desc = m.target.value;
|
|
217
216
|
},
|
|
218
217
|
autocomplete: "off"
|
|
219
218
|
}, null)]), t("div", {
|
|
@@ -226,9 +225,9 @@ const fl = /* @__PURE__ */ V({
|
|
|
226
225
|
class: `${o}-input`,
|
|
227
226
|
id: `link-url-${l}`,
|
|
228
227
|
type: "text",
|
|
229
|
-
value:
|
|
228
|
+
value: n.url,
|
|
230
229
|
onChange: (m) => {
|
|
231
|
-
|
|
230
|
+
n.url = m.target.value;
|
|
232
231
|
},
|
|
233
232
|
autocomplete: "off"
|
|
234
233
|
}, null)]), t("div", {
|
|
@@ -237,13 +236,13 @@ const fl = /* @__PURE__ */ V({
|
|
|
237
236
|
class: [`${o}-btn`, `${o}-btn-row`],
|
|
238
237
|
type: "button",
|
|
239
238
|
onClick: () => {
|
|
240
|
-
e.onOk(
|
|
239
|
+
e.onOk(n), n.desc = "", n.url = "";
|
|
241
240
|
}
|
|
242
241
|
}, [(g = a.value.linkModalTips) == null ? void 0 : g.buttonOK])])];
|
|
243
242
|
}
|
|
244
243
|
});
|
|
245
244
|
}
|
|
246
|
-
}),
|
|
245
|
+
}), yl = {
|
|
247
246
|
visible: {
|
|
248
247
|
type: Boolean,
|
|
249
248
|
default: !1
|
|
@@ -258,13 +257,13 @@ const fl = /* @__PURE__ */ V({
|
|
|
258
257
|
default: () => {
|
|
259
258
|
}
|
|
260
259
|
}
|
|
261
|
-
},
|
|
262
|
-
props:
|
|
260
|
+
}, Tl = /* @__PURE__ */ B({
|
|
261
|
+
props: yl,
|
|
263
262
|
setup(e) {
|
|
264
263
|
var m, b, $;
|
|
265
264
|
const a = A("usedLanguageText"), l = A("editorId");
|
|
266
|
-
let
|
|
267
|
-
const
|
|
265
|
+
let r = ($ = (b = (m = z) == null ? void 0 : m.editorExtensions) == null ? void 0 : b.cropper) == null ? void 0 : $.instance;
|
|
266
|
+
const n = U(), i = U(), u = U(), d = Y({
|
|
268
267
|
cropperInited: !1,
|
|
269
268
|
imgSelected: !1,
|
|
270
269
|
imgSrc: "",
|
|
@@ -273,20 +272,20 @@ const fl = /* @__PURE__ */ V({
|
|
|
273
272
|
});
|
|
274
273
|
let c = null;
|
|
275
274
|
H(() => e.visible, () => {
|
|
276
|
-
e.visible && !d.cropperInited && (
|
|
277
|
-
if (!
|
|
275
|
+
e.visible && !d.cropperInited && (r = r || window.Cropper, n.value.onchange = () => {
|
|
276
|
+
if (!r) {
|
|
278
277
|
f.emit(l, "errorCatcher", {
|
|
279
278
|
name: "Cropper",
|
|
280
279
|
message: "Cropper is undefined"
|
|
281
280
|
});
|
|
282
281
|
return;
|
|
283
282
|
}
|
|
284
|
-
const T =
|
|
283
|
+
const T = n.value.files || [];
|
|
285
284
|
if (d.imgSelected = !0, (T == null ? void 0 : T.length) > 0) {
|
|
286
285
|
const v = new FileReader();
|
|
287
286
|
v.onload = (h) => {
|
|
288
287
|
d.imgSrc = h.target.result, ce(() => {
|
|
289
|
-
c = new
|
|
288
|
+
c = new r(i.value, {
|
|
290
289
|
viewMode: 2,
|
|
291
290
|
preview: `.${o}-clip-preview-target`
|
|
292
291
|
// aspectRatio: 16 / 9,
|
|
@@ -299,7 +298,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
299
298
|
u.value.style = "";
|
|
300
299
|
}), H(() => d.isFullscreen, () => {
|
|
301
300
|
ce(() => {
|
|
302
|
-
c == null || c.destroy(), u.value.style = "", i.value && (c = new
|
|
301
|
+
c == null || c.destroy(), u.value.style = "", i.value && (c = new r(i.value, {
|
|
303
302
|
viewMode: 2,
|
|
304
303
|
preview: `.${o}-clip-preview-target`
|
|
305
304
|
// aspectRatio: 16 / 9,
|
|
@@ -307,11 +306,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
307
306
|
});
|
|
308
307
|
});
|
|
309
308
|
const g = () => {
|
|
310
|
-
c.clear(), c.destroy(), c = null,
|
|
309
|
+
c.clear(), c.destroy(), c = null, n.value.value = "", d.imgSelected = !1;
|
|
311
310
|
};
|
|
312
311
|
return () => {
|
|
313
312
|
var T;
|
|
314
|
-
return t(
|
|
313
|
+
return t(pt, {
|
|
315
314
|
class: `${o}-modal-clip`,
|
|
316
315
|
title: (T = a.value.clipModalTips) == null ? void 0 : T.title,
|
|
317
316
|
visible: e.visible,
|
|
@@ -350,7 +349,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
350
349
|
}, null)])])]) : t("div", {
|
|
351
350
|
class: `${o}-clip-upload`,
|
|
352
351
|
onClick: () => {
|
|
353
|
-
|
|
352
|
+
n.value.click();
|
|
354
353
|
}
|
|
355
354
|
}, [t("svg", {
|
|
356
355
|
class: `${o}-icon`,
|
|
@@ -370,11 +369,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
370
369
|
onClick: () => {
|
|
371
370
|
if (c) {
|
|
372
371
|
const k = c.getCroppedCanvas();
|
|
373
|
-
f.emit(l, "uploadImage", [
|
|
372
|
+
f.emit(l, "uploadImage", [Ft(k.toDataURL("image/png"))], e.onOk), g();
|
|
374
373
|
}
|
|
375
374
|
}
|
|
376
375
|
}, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((h = a.value.linkModalTips) == null ? void 0 : h.buttonOK)])]), t("input", {
|
|
377
|
-
ref:
|
|
376
|
+
ref: n,
|
|
378
377
|
accept: "image/*",
|
|
379
378
|
type: "file",
|
|
380
379
|
multiple: !1,
|
|
@@ -386,7 +385,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
386
385
|
});
|
|
387
386
|
};
|
|
388
387
|
}
|
|
389
|
-
}),
|
|
388
|
+
}), wl = {
|
|
390
389
|
type: {
|
|
391
390
|
type: String,
|
|
392
391
|
default: "link"
|
|
@@ -409,27 +408,27 @@ const fl = /* @__PURE__ */ V({
|
|
|
409
408
|
default: () => {
|
|
410
409
|
}
|
|
411
410
|
}
|
|
412
|
-
},
|
|
413
|
-
props:
|
|
411
|
+
}, xl = /* @__PURE__ */ B({
|
|
412
|
+
props: wl,
|
|
414
413
|
setup(e) {
|
|
415
|
-
return () => t(kt, null, [t(
|
|
414
|
+
return () => t(kt, null, [t($l, {
|
|
416
415
|
type: e.type,
|
|
417
416
|
visible: e.linkVisible,
|
|
418
417
|
onOk: e.onOk,
|
|
419
418
|
onCancel: e.onCancel
|
|
420
|
-
}, null), t(
|
|
419
|
+
}, null), t(Tl, {
|
|
421
420
|
visible: e.clipVisible,
|
|
422
421
|
onOk: e.onOk,
|
|
423
422
|
onCancel: e.onCancel
|
|
424
423
|
}, null)]);
|
|
425
424
|
}
|
|
426
|
-
}),
|
|
425
|
+
}), Sl = /* @__PURE__ */ B({
|
|
427
426
|
name: "MDEditorToolbar",
|
|
428
|
-
props:
|
|
427
|
+
props: fl,
|
|
429
428
|
setup(e) {
|
|
430
429
|
const a = A("editorId"), l = A("usedLanguageText"), {
|
|
431
|
-
fullscreenHandler:
|
|
432
|
-
} =
|
|
430
|
+
fullscreenHandler: r
|
|
431
|
+
} = bl(e), n = `${a}-toolbar-wrapper`, i = U(), u = Y({
|
|
433
432
|
title: !1,
|
|
434
433
|
catalog: !1,
|
|
435
434
|
// 图片上传下拉
|
|
@@ -441,12 +440,12 @@ const fl = /* @__PURE__ */ V({
|
|
|
441
440
|
katex: !1
|
|
442
441
|
}), d = (v, h) => {
|
|
443
442
|
f.emit(a, "replace", v, h);
|
|
444
|
-
}, c =
|
|
443
|
+
}, c = Y({
|
|
445
444
|
type: "link",
|
|
446
445
|
linkVisible: !1,
|
|
447
446
|
clipVisible: !1
|
|
448
447
|
}), g = U();
|
|
449
|
-
|
|
448
|
+
Z(() => {
|
|
450
449
|
f.on(a, {
|
|
451
450
|
name: "openModals",
|
|
452
451
|
callback(v) {
|
|
@@ -460,15 +459,15 @@ const fl = /* @__PURE__ */ V({
|
|
|
460
459
|
}), b = U(), $ = () => {
|
|
461
460
|
f.emit(a, "uploadImage", Array.from(b.value.files || [])), b.value.value = "";
|
|
462
461
|
};
|
|
463
|
-
|
|
462
|
+
Z(() => {
|
|
464
463
|
b.value.addEventListener("change", $);
|
|
465
464
|
});
|
|
466
465
|
const T = (v) => {
|
|
467
|
-
var h, k, y, w, x,
|
|
468
|
-
if (
|
|
466
|
+
var h, k, y, w, x, I, p, M, R, L, E, O, V, D, _, G, re, J, j, K, Q, W, N, F, ee, ne, ve, ke, Ce, pe, $e, ye, Te, we, xe, Se, Ae, Me, Ie, Le, Ee, De, Ne, He, Ve, Fe, Be, Oe, Re, Pe, qe, Ue, Ge, Ke, _e, je, We, ze, Ze, Xe, Ye, Je, Qe, et, tt, lt, ot;
|
|
467
|
+
if (It.includes(v))
|
|
469
468
|
switch (v) {
|
|
470
469
|
case "-":
|
|
471
|
-
return t(
|
|
470
|
+
return t(hl, null, null);
|
|
472
471
|
case "bold":
|
|
473
472
|
return t("div", {
|
|
474
473
|
class: `${o}-toolbar-item`,
|
|
@@ -513,11 +512,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
513
512
|
"xlink:href": "#md-editor-icon-italic"
|
|
514
513
|
}, null)]), e.showToolbarName && t("div", {
|
|
515
514
|
class: `${o}-toolbar-item-name`
|
|
516
|
-
}, [(
|
|
515
|
+
}, [(I = l.value.toolbarTips) == null ? void 0 : I.italic])]);
|
|
517
516
|
case "strikeThrough":
|
|
518
517
|
return t("div", {
|
|
519
518
|
class: `${o}-toolbar-item`,
|
|
520
|
-
title: (
|
|
519
|
+
title: (p = l.value.toolbarTips) == null ? void 0 : p.strikeThrough,
|
|
521
520
|
onClick: () => {
|
|
522
521
|
d("strikeThrough");
|
|
523
522
|
}
|
|
@@ -531,10 +530,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
531
530
|
}, [(M = l.value.toolbarTips) == null ? void 0 : M.strikeThrough])]);
|
|
532
531
|
case "title":
|
|
533
532
|
return t(te, {
|
|
534
|
-
relative: `#${
|
|
533
|
+
relative: `#${n}`,
|
|
535
534
|
visible: u.title,
|
|
536
|
-
onChange: (
|
|
537
|
-
u.title =
|
|
535
|
+
onChange: (C) => {
|
|
536
|
+
u.title = C;
|
|
538
537
|
},
|
|
539
538
|
overlay: t("ul", {
|
|
540
539
|
class: `${o}-menu`,
|
|
@@ -551,12 +550,12 @@ const fl = /* @__PURE__ */ V({
|
|
|
551
550
|
onClick: () => {
|
|
552
551
|
d("h2");
|
|
553
552
|
}
|
|
554
|
-
}, [(
|
|
553
|
+
}, [(L = l.value.titleItem) == null ? void 0 : L.h2]), t("li", {
|
|
555
554
|
class: `${o}-menu-item`,
|
|
556
555
|
onClick: () => {
|
|
557
556
|
d("h3");
|
|
558
557
|
}
|
|
559
|
-
}, [(
|
|
558
|
+
}, [(E = l.value.titleItem) == null ? void 0 : E.h3]), t("li", {
|
|
560
559
|
class: `${o}-menu-item`,
|
|
561
560
|
onClick: () => {
|
|
562
561
|
d("h4");
|
|
@@ -566,18 +565,18 @@ const fl = /* @__PURE__ */ V({
|
|
|
566
565
|
onClick: () => {
|
|
567
566
|
d("h5");
|
|
568
567
|
}
|
|
569
|
-
}, [(
|
|
568
|
+
}, [(V = l.value.titleItem) == null ? void 0 : V.h5]), t("li", {
|
|
570
569
|
class: `${o}-menu-item`,
|
|
571
570
|
onClick: () => {
|
|
572
571
|
d("h6");
|
|
573
572
|
}
|
|
574
|
-
}, [(
|
|
573
|
+
}, [(D = l.value.titleItem) == null ? void 0 : D.h6])])
|
|
575
574
|
}, {
|
|
576
575
|
default: () => {
|
|
577
|
-
var
|
|
576
|
+
var C, S;
|
|
578
577
|
return [t("div", {
|
|
579
578
|
class: `${o}-toolbar-item`,
|
|
580
|
-
title: (
|
|
579
|
+
title: (C = l.value.toolbarTips) == null ? void 0 : C.title
|
|
581
580
|
}, [t("svg", {
|
|
582
581
|
class: `${o}-icon`,
|
|
583
582
|
"aria-hidden": "true"
|
|
@@ -591,7 +590,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
591
590
|
case "sub":
|
|
592
591
|
return t("div", {
|
|
593
592
|
class: `${o}-toolbar-item`,
|
|
594
|
-
title: (
|
|
593
|
+
title: (_ = l.value.toolbarTips) == null ? void 0 : _.sub,
|
|
595
594
|
onClick: () => {
|
|
596
595
|
d("sub");
|
|
597
596
|
}
|
|
@@ -606,7 +605,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
606
605
|
case "sup":
|
|
607
606
|
return t("div", {
|
|
608
607
|
class: `${o}-toolbar-item`,
|
|
609
|
-
title: (
|
|
608
|
+
title: (re = l.value.toolbarTips) == null ? void 0 : re.sup,
|
|
610
609
|
onClick: () => {
|
|
611
610
|
d("sup");
|
|
612
611
|
}
|
|
@@ -621,7 +620,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
621
620
|
case "quote":
|
|
622
621
|
return t("div", {
|
|
623
622
|
class: `${o}-toolbar-item`,
|
|
624
|
-
title: (
|
|
623
|
+
title: (j = l.value.toolbarTips) == null ? void 0 : j.quote,
|
|
625
624
|
onClick: () => {
|
|
626
625
|
d("quote");
|
|
627
626
|
}
|
|
@@ -662,7 +661,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
662
661
|
"xlink:href": "#md-editor-icon-ordered-list"
|
|
663
662
|
}, null)]), e.showToolbarName && t("div", {
|
|
664
663
|
class: `${o}-toolbar-item-name`
|
|
665
|
-
}, [(
|
|
664
|
+
}, [(F = l.value.toolbarTips) == null ? void 0 : F.orderedList])]);
|
|
666
665
|
case "task":
|
|
667
666
|
return t("div", {
|
|
668
667
|
class: `${o}-toolbar-item`,
|
|
@@ -677,7 +676,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
677
676
|
"xlink:href": "#md-editor-icon-task"
|
|
678
677
|
}, null)]), e.showToolbarName && t("div", {
|
|
679
678
|
class: `${o}-toolbar-item-name`
|
|
680
|
-
}, [(
|
|
679
|
+
}, [(ne = l.value.toolbarTips) == null ? void 0 : ne.task])]);
|
|
681
680
|
case "codeRow":
|
|
682
681
|
return t("div", {
|
|
683
682
|
class: `${o}-toolbar-item`,
|
|
@@ -696,7 +695,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
696
695
|
case "code":
|
|
697
696
|
return t("div", {
|
|
698
697
|
class: `${o}-toolbar-item`,
|
|
699
|
-
title: (
|
|
698
|
+
title: (Ce = l.value.toolbarTips) == null ? void 0 : Ce.code,
|
|
700
699
|
onClick: () => {
|
|
701
700
|
d("code");
|
|
702
701
|
}
|
|
@@ -707,7 +706,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
707
706
|
"xlink:href": "#md-editor-icon-code"
|
|
708
707
|
}, null)]), e.showToolbarName && t("div", {
|
|
709
708
|
class: `${o}-toolbar-item-name`
|
|
710
|
-
}, [(
|
|
709
|
+
}, [(pe = l.value.toolbarTips) == null ? void 0 : pe.code])]);
|
|
711
710
|
case "link":
|
|
712
711
|
return t("div", {
|
|
713
712
|
class: `${o}-toolbar-item`,
|
|
@@ -738,10 +737,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
738
737
|
}, null)]), e.showToolbarName && t("div", {
|
|
739
738
|
class: `${o}-toolbar-item-name`
|
|
740
739
|
}, [(we = l.value.toolbarTips) == null ? void 0 : we.image])]) : t(te, {
|
|
741
|
-
relative: `#${
|
|
740
|
+
relative: `#${n}`,
|
|
742
741
|
visible: u.image,
|
|
743
|
-
onChange: (
|
|
744
|
-
u.image =
|
|
742
|
+
onChange: (C) => {
|
|
743
|
+
u.image = C;
|
|
745
744
|
},
|
|
746
745
|
overlay: t("ul", {
|
|
747
746
|
class: `${o}-menu`,
|
|
@@ -766,10 +765,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
766
765
|
}, [(Ae = l.value.imgTitleItem) == null ? void 0 : Ae.clip2upload])])
|
|
767
766
|
}, {
|
|
768
767
|
default: () => {
|
|
769
|
-
var
|
|
768
|
+
var C, S;
|
|
770
769
|
return [t("div", {
|
|
771
770
|
class: `${o}-toolbar-item`,
|
|
772
|
-
title: (
|
|
771
|
+
title: (C = l.value.toolbarTips) == null ? void 0 : C.image
|
|
773
772
|
}, [t("svg", {
|
|
774
773
|
class: `${o}-icon`,
|
|
775
774
|
"aria-hidden": "true"
|
|
@@ -782,26 +781,26 @@ const fl = /* @__PURE__ */ V({
|
|
|
782
781
|
});
|
|
783
782
|
case "table":
|
|
784
783
|
return t(te, {
|
|
785
|
-
relative: `#${
|
|
784
|
+
relative: `#${n}`,
|
|
786
785
|
visible: u.table,
|
|
787
|
-
onChange: (
|
|
788
|
-
u.table =
|
|
786
|
+
onChange: (C) => {
|
|
787
|
+
u.table = C;
|
|
789
788
|
},
|
|
790
789
|
key: "bar-table",
|
|
791
790
|
overlay: t(Cl, {
|
|
792
791
|
tableShape: e.tableShape,
|
|
793
|
-
onSelected: (
|
|
792
|
+
onSelected: (C) => {
|
|
794
793
|
d("table", {
|
|
795
|
-
selectedShape:
|
|
794
|
+
selectedShape: C
|
|
796
795
|
});
|
|
797
796
|
}
|
|
798
797
|
}, null)
|
|
799
798
|
}, {
|
|
800
799
|
default: () => {
|
|
801
|
-
var
|
|
800
|
+
var C, S;
|
|
802
801
|
return [t("div", {
|
|
803
802
|
class: `${o}-toolbar-item`,
|
|
804
|
-
title: (
|
|
803
|
+
title: (C = l.value.toolbarTips) == null ? void 0 : C.table
|
|
805
804
|
}, [t("svg", {
|
|
806
805
|
class: `${o}-icon`,
|
|
807
806
|
"aria-hidden": "true"
|
|
@@ -826,11 +825,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
826
825
|
"xlink:href": "#md-editor-icon-revoke"
|
|
827
826
|
}, null)]), e.showToolbarName && t("div", {
|
|
828
827
|
class: `${o}-toolbar-item-name`
|
|
829
|
-
}, [(
|
|
828
|
+
}, [(Ie = l.value.toolbarTips) == null ? void 0 : Ie.revoke])]);
|
|
830
829
|
case "next":
|
|
831
830
|
return t("div", {
|
|
832
831
|
class: `${o}-toolbar-item`,
|
|
833
|
-
title: (
|
|
832
|
+
title: (Le = l.value.toolbarTips) == null ? void 0 : Le.next,
|
|
834
833
|
onClick: () => {
|
|
835
834
|
f.emit(a, "ctrlShiftZ");
|
|
836
835
|
}
|
|
@@ -841,13 +840,13 @@ const fl = /* @__PURE__ */ V({
|
|
|
841
840
|
"xlink:href": "#md-editor-icon-next"
|
|
842
841
|
}, null)]), e.showToolbarName && t("div", {
|
|
843
842
|
class: `${o}-toolbar-item-name`
|
|
844
|
-
}, [(
|
|
843
|
+
}, [(Ee = l.value.toolbarTips) == null ? void 0 : Ee.next])]);
|
|
845
844
|
case "save":
|
|
846
845
|
return t("div", {
|
|
847
846
|
class: `${o}-toolbar-item`,
|
|
848
|
-
title: (
|
|
847
|
+
title: (De = l.value.toolbarTips) == null ? void 0 : De.save,
|
|
849
848
|
onClick: () => {
|
|
850
|
-
f.emit(a,
|
|
849
|
+
f.emit(a, Ct);
|
|
851
850
|
}
|
|
852
851
|
}, [t("svg", {
|
|
853
852
|
class: `${o}-icon`,
|
|
@@ -871,11 +870,11 @@ const fl = /* @__PURE__ */ V({
|
|
|
871
870
|
"xlink:href": "#md-editor-icon-prettier"
|
|
872
871
|
}, null)]), e.showToolbarName && t("div", {
|
|
873
872
|
class: `${o}-toolbar-item-name`
|
|
874
|
-
}, [(
|
|
873
|
+
}, [(Ve = l.value.toolbarTips) == null ? void 0 : Ve.prettier])]);
|
|
875
874
|
case "pageFullscreen":
|
|
876
875
|
return !e.setting.fullscreen && t("div", {
|
|
877
876
|
class: `${o}-toolbar-item`,
|
|
878
|
-
title: (
|
|
877
|
+
title: (Fe = l.value.toolbarTips) == null ? void 0 : Fe.pageFullscreen,
|
|
879
878
|
onClick: () => {
|
|
880
879
|
e.updateSetting("pageFullscreen");
|
|
881
880
|
}
|
|
@@ -886,13 +885,13 @@ const fl = /* @__PURE__ */ V({
|
|
|
886
885
|
"xlink:href": `#md-editor-icon-${e.setting.pageFullscreen ? "suoxiao" : "fangda"}`
|
|
887
886
|
}, null)]), e.showToolbarName && t("div", {
|
|
888
887
|
class: `${o}-toolbar-item-name`
|
|
889
|
-
}, [(
|
|
888
|
+
}, [(Be = l.value.toolbarTips) == null ? void 0 : Be.pageFullscreen])]);
|
|
890
889
|
case "fullscreen":
|
|
891
890
|
return t("div", {
|
|
892
891
|
class: `${o}-toolbar-item`,
|
|
893
892
|
title: (Oe = l.value.toolbarTips) == null ? void 0 : Oe.fullscreen,
|
|
894
893
|
onClick: () => {
|
|
895
|
-
|
|
894
|
+
r();
|
|
896
895
|
}
|
|
897
896
|
}, [t("svg", {
|
|
898
897
|
class: `${o}-icon`,
|
|
@@ -947,12 +946,12 @@ const fl = /* @__PURE__ */ V({
|
|
|
947
946
|
"xlink:href": "#md-editor-icon-catalog"
|
|
948
947
|
}, null)]), e.showToolbarName && t("div", {
|
|
949
948
|
class: `${o}-toolbar-item-name`
|
|
950
|
-
}, [(
|
|
949
|
+
}, [(_e = l.value.toolbarTips) == null ? void 0 : _e.catalog])]);
|
|
951
950
|
case "github":
|
|
952
951
|
return t("div", {
|
|
953
952
|
class: `${o}-toolbar-item`,
|
|
954
|
-
title: (
|
|
955
|
-
onClick: () =>
|
|
953
|
+
title: (je = l.value.toolbarTips) == null ? void 0 : je.github,
|
|
954
|
+
onClick: () => Dt("https://github.com/imzbf/md-editor-v3")
|
|
956
955
|
}, [t("svg", {
|
|
957
956
|
class: `${o}-icon`,
|
|
958
957
|
"aria-hidden": "true"
|
|
@@ -963,10 +962,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
963
962
|
}, [(We = l.value.toolbarTips) == null ? void 0 : We.github])]);
|
|
964
963
|
case "mermaid":
|
|
965
964
|
return t(te, {
|
|
966
|
-
relative: `#${
|
|
965
|
+
relative: `#${n}`,
|
|
967
966
|
visible: u.mermaid,
|
|
968
|
-
onChange: (
|
|
969
|
-
u.mermaid =
|
|
967
|
+
onChange: (C) => {
|
|
968
|
+
u.mermaid = C;
|
|
970
969
|
},
|
|
971
970
|
overlay: t("ul", {
|
|
972
971
|
class: `${o}-menu`,
|
|
@@ -983,17 +982,17 @@ const fl = /* @__PURE__ */ V({
|
|
|
983
982
|
onClick: () => {
|
|
984
983
|
d("sequence");
|
|
985
984
|
}
|
|
986
|
-
}, [(
|
|
985
|
+
}, [(Ze = l.value.mermaid) == null ? void 0 : Ze.sequence]), t("li", {
|
|
987
986
|
class: `${o}-menu-item`,
|
|
988
987
|
onClick: () => {
|
|
989
988
|
d("gantt");
|
|
990
989
|
}
|
|
991
|
-
}, [(
|
|
990
|
+
}, [(Xe = l.value.mermaid) == null ? void 0 : Xe.gantt]), t("li", {
|
|
992
991
|
class: `${o}-menu-item`,
|
|
993
992
|
onClick: () => {
|
|
994
993
|
d("class");
|
|
995
994
|
}
|
|
996
|
-
}, [(
|
|
995
|
+
}, [(Ye = l.value.mermaid) == null ? void 0 : Ye.class]), t("li", {
|
|
997
996
|
class: `${o}-menu-item`,
|
|
998
997
|
onClick: () => {
|
|
999
998
|
d("state");
|
|
@@ -1017,10 +1016,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
1017
1016
|
key: "bar-mermaid"
|
|
1018
1017
|
}, {
|
|
1019
1018
|
default: () => {
|
|
1020
|
-
var
|
|
1019
|
+
var C, S;
|
|
1021
1020
|
return [t("div", {
|
|
1022
1021
|
class: `${o}-toolbar-item`,
|
|
1023
|
-
title: (
|
|
1022
|
+
title: (C = l.value.toolbarTips) == null ? void 0 : C.mermaid
|
|
1024
1023
|
}, [t("svg", {
|
|
1025
1024
|
class: `${o}-icon`,
|
|
1026
1025
|
"aria-hidden": "true"
|
|
@@ -1033,10 +1032,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
1033
1032
|
});
|
|
1034
1033
|
case "katex":
|
|
1035
1034
|
return t(te, {
|
|
1036
|
-
relative: `#${
|
|
1035
|
+
relative: `#${n}`,
|
|
1037
1036
|
visible: u.katex,
|
|
1038
|
-
onChange: (
|
|
1039
|
-
u.katex =
|
|
1037
|
+
onChange: (C) => {
|
|
1038
|
+
u.katex = C;
|
|
1040
1039
|
},
|
|
1041
1040
|
overlay: t("ul", {
|
|
1042
1041
|
class: `${o}-menu`,
|
|
@@ -1057,10 +1056,10 @@ const fl = /* @__PURE__ */ V({
|
|
|
1057
1056
|
key: "bar-katex"
|
|
1058
1057
|
}, {
|
|
1059
1058
|
default: () => {
|
|
1060
|
-
var
|
|
1059
|
+
var C, S;
|
|
1061
1060
|
return [t("div", {
|
|
1062
1061
|
class: `${o}-toolbar-item`,
|
|
1063
|
-
title: (
|
|
1062
|
+
title: (C = l.value.toolbarTips) == null ? void 0 : C.katex
|
|
1064
1063
|
}, [t("svg", {
|
|
1065
1064
|
class: `${o}-icon`,
|
|
1066
1065
|
"aria-hidden": "true"
|
|
@@ -1073,8 +1072,8 @@ const fl = /* @__PURE__ */ V({
|
|
|
1073
1072
|
});
|
|
1074
1073
|
}
|
|
1075
1074
|
else if (e.defToolbars instanceof Array) {
|
|
1076
|
-
const
|
|
1077
|
-
return
|
|
1075
|
+
const C = e.defToolbars[v];
|
|
1076
|
+
return C ? at(C, {
|
|
1078
1077
|
insert(de) {
|
|
1079
1078
|
f.emit(a, "replace", "universal", {
|
|
1080
1079
|
generate: de
|
|
@@ -1082,8 +1081,8 @@ const fl = /* @__PURE__ */ V({
|
|
|
1082
1081
|
}
|
|
1083
1082
|
}) : "";
|
|
1084
1083
|
} else if (e.defToolbars && e.defToolbars.children instanceof Array) {
|
|
1085
|
-
const
|
|
1086
|
-
return
|
|
1084
|
+
const C = e.defToolbars.children[v];
|
|
1085
|
+
return C ? at(C, {
|
|
1087
1086
|
insert(de) {
|
|
1088
1087
|
f.emit(a, "replace", "universal", {
|
|
1089
1088
|
generate: de
|
|
@@ -1095,7 +1094,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1095
1094
|
};
|
|
1096
1095
|
return H(() => e.toolbars, () => {
|
|
1097
1096
|
ce(() => {
|
|
1098
|
-
i.value &&
|
|
1097
|
+
i.value && Et(i.value);
|
|
1099
1098
|
});
|
|
1100
1099
|
}, {
|
|
1101
1100
|
immediate: !0
|
|
@@ -1104,7 +1103,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1104
1103
|
return t(kt, null, [e.toolbars.length > 0 && t("div", {
|
|
1105
1104
|
class: `${o}-toolbar-wrapper`,
|
|
1106
1105
|
ref: i,
|
|
1107
|
-
id:
|
|
1106
|
+
id: n
|
|
1108
1107
|
}, [t("div", {
|
|
1109
1108
|
class: [`${o}-toolbar`, e.showToolbarName && `${o}-stn`]
|
|
1110
1109
|
}, [t("div", {
|
|
@@ -1120,7 +1119,7 @@ const fl = /* @__PURE__ */ V({
|
|
|
1120
1119
|
style: {
|
|
1121
1120
|
display: "none"
|
|
1122
1121
|
}
|
|
1123
|
-
}, null), t(
|
|
1122
|
+
}, null), t(xl, {
|
|
1124
1123
|
linkVisible: c.linkVisible,
|
|
1125
1124
|
clipVisible: c.clipVisible,
|
|
1126
1125
|
type: c.type,
|
|
@@ -1136,15 +1135,15 @@ const fl = /* @__PURE__ */ V({
|
|
|
1136
1135
|
}, null)]);
|
|
1137
1136
|
};
|
|
1138
1137
|
}
|
|
1139
|
-
}),
|
|
1138
|
+
}), Al = (e, a) => {
|
|
1140
1139
|
const l = Nt(() => {
|
|
1141
|
-
e.removeEventListener("scroll",
|
|
1142
|
-
}, 50),
|
|
1140
|
+
e.removeEventListener("scroll", r), e.addEventListener("scroll", r), a.removeEventListener("scroll", r), a.addEventListener("scroll", r);
|
|
1141
|
+
}, 50), r = (n) => {
|
|
1143
1142
|
const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight, g = (d - i) / (c - u);
|
|
1144
|
-
|
|
1143
|
+
n.target === e ? (a.removeEventListener("scroll", r), a.scrollTo({
|
|
1145
1144
|
top: e.scrollTop / g
|
|
1146
1145
|
// behavior: 'smooth'
|
|
1147
|
-
}), l()) : (e.removeEventListener("scroll",
|
|
1146
|
+
}), l()) : (e.removeEventListener("scroll", r), e.scrollTo({
|
|
1148
1147
|
top: a.scrollTop * g
|
|
1149
1148
|
// behavior: 'smooth'
|
|
1150
1149
|
}), l());
|
|
@@ -1156,17 +1155,17 @@ const fl = /* @__PURE__ */ V({
|
|
|
1156
1155
|
});
|
|
1157
1156
|
},
|
|
1158
1157
|
() => {
|
|
1159
|
-
e.removeEventListener("scroll",
|
|
1158
|
+
e.removeEventListener("scroll", r), a.removeEventListener("scroll", r);
|
|
1160
1159
|
}
|
|
1161
1160
|
];
|
|
1162
|
-
},
|
|
1163
|
-
const { view:
|
|
1161
|
+
}, Ml = (e, a, l) => {
|
|
1162
|
+
const { view: r } = l, n = (b) => r.lineBlockAt(r.state.doc.line(b).from).top, i = (b) => r.lineBlockAt(r.state.doc.line(b).from).height;
|
|
1164
1163
|
let u = [];
|
|
1165
1164
|
const d = () => {
|
|
1166
1165
|
u = [];
|
|
1167
1166
|
const b = Array.from(a.querySelectorAll("[data-line]")).map(
|
|
1168
1167
|
(h) => Number(h.dataset.line) + 1
|
|
1169
|
-
), { lines: $ } =
|
|
1168
|
+
), { lines: $ } = r.state.doc;
|
|
1170
1169
|
let T = 1, v = b.shift() ?? $;
|
|
1171
1170
|
for (let h = 1; h <= $; h++)
|
|
1172
1171
|
h === v && (T = h, v = b.shift() || $ + 1), u.push({
|
|
@@ -1176,80 +1175,80 @@ const fl = /* @__PURE__ */ V({
|
|
|
1176
1175
|
};
|
|
1177
1176
|
let c = 0, g = 0;
|
|
1178
1177
|
const m = Ht((b) => {
|
|
1179
|
-
var v, h, k, y, w, x,
|
|
1178
|
+
var v, h, k, y, w, x, I;
|
|
1180
1179
|
if (!((v = a.firstElementChild) != null && v.firstElementChild))
|
|
1181
1180
|
return;
|
|
1182
|
-
const $ =
|
|
1183
|
-
if (!(T > u.length) && !(
|
|
1181
|
+
const $ = r.lineBlockAtHeight(r.scrollDOM.scrollTop), { number: T } = r.state.doc.lineAt($.from);
|
|
1182
|
+
if (!(T > u.length) && !(r.state.doc.lines < u[u.length - 1].end))
|
|
1184
1183
|
if (b.target === e) {
|
|
1185
1184
|
if (g !== 0)
|
|
1186
1185
|
return;
|
|
1187
1186
|
c++;
|
|
1188
|
-
const
|
|
1187
|
+
const p = u[T - 1], M = n(p.end) + i(p.end);
|
|
1189
1188
|
let R = 0;
|
|
1190
|
-
const
|
|
1191
|
-
let
|
|
1192
|
-
|
|
1193
|
-
const
|
|
1194
|
-
|
|
1189
|
+
const L = n(p.start), E = a.querySelector(`[data-line="${p.start - 1}"]`) || ((h = a.firstElementChild) == null ? void 0 : h.firstElementChild), O = a.querySelector(`[data-line="${p.end}"]`) || ((k = a.lastElementChild) == null ? void 0 : k.lastElementChild);
|
|
1190
|
+
let V = 0, D = 0;
|
|
1191
|
+
L === 0 ? (R = (r.scrollDOM.scrollTop - L) / (M - L), V = O.offsetTop) : M > r.scrollDOM.scrollHeight - r.scrollDOM.clientHeight ? (R = (r.scrollDOM.scrollTop - L) / (r.scrollDOM.scrollHeight - r.scrollDOM.clientHeight - L), D = E.offsetTop, V = a.scrollHeight - a.clientHeight - D + 10) : (R = (r.scrollDOM.scrollTop - L) / (M - L), D = E.offsetTop, V = O.offsetTop - D);
|
|
1192
|
+
const _ = D - 10 + V * R;
|
|
1193
|
+
rt(a, _, () => {
|
|
1195
1194
|
c--;
|
|
1196
1195
|
});
|
|
1197
1196
|
} else {
|
|
1198
1197
|
if (c !== 0)
|
|
1199
1198
|
return;
|
|
1200
1199
|
g++;
|
|
1201
|
-
const
|
|
1200
|
+
const p = Array.from(
|
|
1202
1201
|
a.querySelectorAll("[data-line]")
|
|
1203
1202
|
), M = a.scrollTop, R = a.scrollHeight;
|
|
1204
|
-
let
|
|
1205
|
-
Number(
|
|
1206
|
-
),
|
|
1207
|
-
for (let N =
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1203
|
+
let L = p.length === 0 ? 1 : Math.ceil(
|
|
1204
|
+
Number(p[p.length - 1].dataset.line) * (M / R)
|
|
1205
|
+
), E = (y = a.firstElementChild) == null ? void 0 : y.firstElementChild;
|
|
1206
|
+
for (let N = L; N >= 0; N--) {
|
|
1207
|
+
const F = a.querySelector(`[data-line="${N}"]`);
|
|
1208
|
+
if (F && F.offsetTop <= M) {
|
|
1209
|
+
E = F, L = N;
|
|
1211
1210
|
break;
|
|
1212
1211
|
}
|
|
1213
1212
|
}
|
|
1214
|
-
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild,
|
|
1215
|
-
for (;
|
|
1216
|
-
const N =
|
|
1217
|
-
if (N + 1 >=
|
|
1213
|
+
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild, V = (x = a.firstElementChild) == null ? void 0 : x.lastElementChild;
|
|
1214
|
+
for (; p.length > 0; ) {
|
|
1215
|
+
const N = p.indexOf(E);
|
|
1216
|
+
if (N + 1 >= p.length)
|
|
1218
1217
|
break;
|
|
1219
|
-
const
|
|
1218
|
+
const F = p[N + 1];
|
|
1220
1219
|
if (N === -1) {
|
|
1221
|
-
|
|
1220
|
+
V = F;
|
|
1222
1221
|
break;
|
|
1223
1222
|
}
|
|
1224
|
-
const ee =
|
|
1223
|
+
const ee = E.offsetTop;
|
|
1225
1224
|
if (ee > M) {
|
|
1226
1225
|
if (N === 0) {
|
|
1227
|
-
O =
|
|
1226
|
+
O = E, V = F;
|
|
1228
1227
|
break;
|
|
1229
1228
|
}
|
|
1230
|
-
|
|
1229
|
+
E = p[N - 1];
|
|
1231
1230
|
continue;
|
|
1232
1231
|
}
|
|
1233
|
-
const
|
|
1234
|
-
if (ee <= M &&
|
|
1235
|
-
O =
|
|
1232
|
+
const ne = F.offsetTop;
|
|
1233
|
+
if (ee <= M && ne > M) {
|
|
1234
|
+
O = E, V = F;
|
|
1236
1235
|
break;
|
|
1237
1236
|
}
|
|
1238
|
-
|
|
1237
|
+
E = F;
|
|
1239
1238
|
}
|
|
1240
|
-
const
|
|
1239
|
+
const D = O.offsetTop, _ = V.offsetTop;
|
|
1241
1240
|
let G = 0;
|
|
1242
|
-
const { start:
|
|
1243
|
-
let K =
|
|
1241
|
+
const { start: re, end: J } = u[Number(O.dataset.line || 0)], j = n(re);
|
|
1242
|
+
let K = n(J);
|
|
1244
1243
|
const Q = i(J);
|
|
1245
1244
|
let W = 0;
|
|
1246
|
-
O === ((
|
|
1247
|
-
(M -
|
|
1245
|
+
O === ((I = a.firstElementChild) == null ? void 0 : I.firstElementChild) ? (G = Math.max(M / _, 0), W = K + Q - j) : K > r.scrollDOM.scrollHeight - r.scrollDOM.clientHeight ? (G = Math.max(
|
|
1246
|
+
(M - D) / (a.scrollHeight - D - a.clientHeight),
|
|
1248
1247
|
0
|
|
1249
|
-
), K = r
|
|
1250
|
-
(M -
|
|
1248
|
+
), K = n(r.state.doc.lines) + i(r.state.doc.lines), W = 8 + K - j - e.clientHeight) : (G = Math.max(
|
|
1249
|
+
(M - D) / (_ - D),
|
|
1251
1250
|
0
|
|
1252
|
-
), W = K + Q -
|
|
1251
|
+
), W = K + Q - j), rt(e, j + W * G, () => {
|
|
1253
1252
|
g--;
|
|
1254
1253
|
});
|
|
1255
1254
|
}
|
|
@@ -1263,18 +1262,18 @@ const fl = /* @__PURE__ */ V({
|
|
|
1263
1262
|
}
|
|
1264
1263
|
];
|
|
1265
1264
|
}, Il = (e, a, l) => {
|
|
1266
|
-
const
|
|
1267
|
-
let
|
|
1265
|
+
const r = A("editorId");
|
|
1266
|
+
let n = () => {
|
|
1268
1267
|
}, i = () => {
|
|
1269
1268
|
};
|
|
1270
1269
|
const u = () => {
|
|
1271
|
-
|
|
1270
|
+
n();
|
|
1272
1271
|
const d = document.querySelector(".cm-scroller"), c = document.querySelector(
|
|
1273
|
-
`[id="${
|
|
1272
|
+
`[id="${r}-preview-wrapper"][data-show="true"]`
|
|
1274
1273
|
), g = document.querySelector(
|
|
1275
|
-
`[id="${
|
|
1274
|
+
`[id="${r}-html-wrapper"][data-show="true"]`
|
|
1276
1275
|
);
|
|
1277
|
-
(c || g) && ([i,
|
|
1276
|
+
(c || g) && ([i, n] = (c ? Ml : Al)(
|
|
1278
1277
|
d,
|
|
1279
1278
|
c || g,
|
|
1280
1279
|
l.value
|
|
@@ -1294,16 +1293,16 @@ const fl = /* @__PURE__ */ V({
|
|
|
1294
1293
|
), H(
|
|
1295
1294
|
() => e.scrollAuto,
|
|
1296
1295
|
(d) => {
|
|
1297
|
-
d ? i() :
|
|
1296
|
+
d ? i() : n();
|
|
1298
1297
|
}
|
|
1299
|
-
),
|
|
1300
|
-
},
|
|
1298
|
+
), Z(u);
|
|
1299
|
+
}, Ll = Il, El = (e, a, l) => {
|
|
1301
1300
|
var m, b, $, T, v, h;
|
|
1302
|
-
let
|
|
1301
|
+
let r = "", n = 0, i = 0, u = !0, d = !1;
|
|
1303
1302
|
const c = a.getSelectedText(), g = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
1304
1303
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1305
1304
|
const k = e.replace(/^h(\d)/, (y, w) => new Array(Number(w)).fill("#", 0, w).join(""));
|
|
1306
|
-
|
|
1305
|
+
r = `${k} ${c}`, n = k.length + 1;
|
|
1307
1306
|
} else if (e === "prettier") {
|
|
1308
1307
|
const k = window.prettier || (($ = (b = z.editorExtensions) == null ? void 0 : b.prettier) == null ? void 0 : $.prettierInstance), y = [
|
|
1309
1308
|
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((h = (v = z.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : h.parserMarkdownInstance)
|
|
@@ -1311,114 +1310,114 @@ const fl = /* @__PURE__ */ V({
|
|
|
1311
1310
|
!k || y[0] === void 0 ? (f.emit(l.editorId, "errorCatcher", {
|
|
1312
1311
|
name: "prettier",
|
|
1313
1312
|
message: "prettier is undefined"
|
|
1314
|
-
}),
|
|
1313
|
+
}), r = a.getValue()) : r = k.format(a.getValue(), {
|
|
1315
1314
|
parser: "markdown",
|
|
1316
1315
|
plugins: y
|
|
1317
1316
|
}), u = !1, d = !0;
|
|
1318
1317
|
} else
|
|
1319
1318
|
switch (e) {
|
|
1320
1319
|
case "bold": {
|
|
1321
|
-
|
|
1320
|
+
r = `**${c}**`, n = 2, i = -2;
|
|
1322
1321
|
break;
|
|
1323
1322
|
}
|
|
1324
1323
|
case "underline": {
|
|
1325
|
-
|
|
1324
|
+
r = `<u>${c}</u>`, n = 3, i = -4;
|
|
1326
1325
|
break;
|
|
1327
1326
|
}
|
|
1328
1327
|
case "italic": {
|
|
1329
|
-
|
|
1328
|
+
r = `*${c}*`, n = 1, i = -1;
|
|
1330
1329
|
break;
|
|
1331
1330
|
}
|
|
1332
1331
|
case "strikeThrough": {
|
|
1333
|
-
|
|
1332
|
+
r = `~~${c}~~`, n = 2, i = -2;
|
|
1334
1333
|
break;
|
|
1335
1334
|
}
|
|
1336
1335
|
case "sub": {
|
|
1337
|
-
|
|
1336
|
+
r = `<sub>${c}</sub>`, n = 5, i = -6;
|
|
1338
1337
|
break;
|
|
1339
1338
|
}
|
|
1340
1339
|
case "sup": {
|
|
1341
|
-
|
|
1340
|
+
r = `<sup>${c}</sup>`, n = 5, i = -6;
|
|
1342
1341
|
break;
|
|
1343
1342
|
}
|
|
1344
1343
|
case "codeRow": {
|
|
1345
|
-
|
|
1344
|
+
r = "`" + c + "`", n = 1, i = -1;
|
|
1346
1345
|
break;
|
|
1347
1346
|
}
|
|
1348
1347
|
case "quote": {
|
|
1349
|
-
|
|
1348
|
+
r = `> ${c}`, n = 2;
|
|
1350
1349
|
break;
|
|
1351
1350
|
}
|
|
1352
1351
|
case "orderedList": {
|
|
1353
|
-
|
|
1352
|
+
r = `1. ${c}`, n = 3;
|
|
1354
1353
|
break;
|
|
1355
1354
|
}
|
|
1356
1355
|
case "unorderedList": {
|
|
1357
|
-
|
|
1356
|
+
r = `- ${c}`, n = 2;
|
|
1358
1357
|
break;
|
|
1359
1358
|
}
|
|
1360
1359
|
case "task": {
|
|
1361
|
-
|
|
1360
|
+
r = `- [ ] ${c}`, n = 6;
|
|
1362
1361
|
break;
|
|
1363
1362
|
}
|
|
1364
1363
|
case "code": {
|
|
1365
1364
|
const k = l.text || c || "", y = l.mode || "language";
|
|
1366
|
-
|
|
1365
|
+
r = `\`\`\`${y}
|
|
1367
1366
|
${k}
|
|
1368
1367
|
\`\`\`
|
|
1369
|
-
`,
|
|
1368
|
+
`, n = 3, i = 3 + y.length - r.length;
|
|
1370
1369
|
break;
|
|
1371
1370
|
}
|
|
1372
1371
|
case "table": {
|
|
1373
|
-
|
|
1372
|
+
r = "|";
|
|
1374
1373
|
const { selectedShape: k = { x: 1, y: 1 } } = l, { x: y, y: w } = k;
|
|
1375
1374
|
for (let x = 0; x <= w; x++)
|
|
1376
|
-
|
|
1377
|
-
|
|
1375
|
+
r += " col |";
|
|
1376
|
+
r += `
|
|
1378
1377
|
|`;
|
|
1379
1378
|
for (let x = 0; x <= w; x++)
|
|
1380
|
-
|
|
1379
|
+
r += " - |";
|
|
1381
1380
|
for (let x = 0; x <= y; x++) {
|
|
1382
|
-
|
|
1381
|
+
r += `
|
|
1383
1382
|
|`;
|
|
1384
|
-
for (let
|
|
1385
|
-
|
|
1383
|
+
for (let I = 0; I <= w; I++)
|
|
1384
|
+
r += " content |";
|
|
1386
1385
|
}
|
|
1387
|
-
|
|
1386
|
+
n = 2, i = 5 - r.length;
|
|
1388
1387
|
break;
|
|
1389
1388
|
}
|
|
1390
1389
|
case "link": {
|
|
1391
1390
|
const { desc: k, url: y } = l;
|
|
1392
|
-
|
|
1391
|
+
r = `[${k}](${y})`, u = !1;
|
|
1393
1392
|
break;
|
|
1394
1393
|
}
|
|
1395
1394
|
case "image": {
|
|
1396
1395
|
const { desc: k, url: y, urls: w } = l;
|
|
1397
|
-
w instanceof Array ?
|
|
1398
|
-
`, "") :
|
|
1396
|
+
w instanceof Array ? r = w.reduce((x, I) => x + `
|
|
1397
|
+
`, "") : r = `
|
|
1399
1398
|
`, u = !1;
|
|
1400
1399
|
break;
|
|
1401
1400
|
}
|
|
1402
1401
|
case "flow": {
|
|
1403
|
-
|
|
1402
|
+
r = `\`\`\`mermaid
|
|
1404
1403
|
${(g == null ? void 0 : g.flow) || `flowchart TD
|
|
1405
1404
|
Start --> Stop`}
|
|
1406
1405
|
\`\`\`
|
|
1407
|
-
`,
|
|
1406
|
+
`, n = 3, i = 10 - r.length;
|
|
1408
1407
|
break;
|
|
1409
1408
|
}
|
|
1410
1409
|
case "sequence": {
|
|
1411
|
-
|
|
1410
|
+
r = `\`\`\`mermaid
|
|
1412
1411
|
${(g == null ? void 0 : g.sequence) || `sequenceDiagram
|
|
1413
1412
|
A->>B: hello!
|
|
1414
1413
|
B-->>A: hi!
|
|
1415
1414
|
A-)B: bye!`}
|
|
1416
1415
|
\`\`\`
|
|
1417
|
-
`,
|
|
1416
|
+
`, n = 3, i = 10 - r.length;
|
|
1418
1417
|
break;
|
|
1419
1418
|
}
|
|
1420
1419
|
case "gantt": {
|
|
1421
|
-
|
|
1420
|
+
r = `\`\`\`mermaid
|
|
1422
1421
|
${(g == null ? void 0 : g.gantt) || `gantt
|
|
1423
1422
|
title A Gantt Diagram
|
|
1424
1423
|
dateFormat YYYY-MM-DD
|
|
@@ -1426,47 +1425,47 @@ section Section
|
|
|
1426
1425
|
A task :a1, 2014-01-01, 30d
|
|
1427
1426
|
Another task :after a1, 20d`}
|
|
1428
1427
|
\`\`\`
|
|
1429
|
-
`,
|
|
1428
|
+
`, n = 3, i = 10 - r.length;
|
|
1430
1429
|
break;
|
|
1431
1430
|
}
|
|
1432
1431
|
case "class": {
|
|
1433
|
-
|
|
1432
|
+
r = `\`\`\`mermaid
|
|
1434
1433
|
${(g == null ? void 0 : g.class) || `classDiagram
|
|
1435
1434
|
class Animal
|
|
1436
1435
|
Vehicle <|-- Car`}
|
|
1437
1436
|
\`\`\`
|
|
1438
|
-
`,
|
|
1437
|
+
`, n = 3, i = 10 - r.length;
|
|
1439
1438
|
break;
|
|
1440
1439
|
}
|
|
1441
1440
|
case "state": {
|
|
1442
|
-
|
|
1441
|
+
r = `\`\`\`mermaid
|
|
1443
1442
|
${(g == null ? void 0 : g.state) || `stateDiagram-v2
|
|
1444
1443
|
s1 --> s2`}
|
|
1445
1444
|
\`\`\`
|
|
1446
|
-
`,
|
|
1445
|
+
`, n = 3, i = 10 - r.length;
|
|
1447
1446
|
break;
|
|
1448
1447
|
}
|
|
1449
1448
|
case "pie": {
|
|
1450
|
-
|
|
1449
|
+
r = `\`\`\`mermaid
|
|
1451
1450
|
${(g == null ? void 0 : g.pie) || `pie title Pets adopted by volunteers
|
|
1452
1451
|
"Dogs" : 386
|
|
1453
1452
|
"Cats" : 85
|
|
1454
1453
|
"Rats" : 15`}
|
|
1455
1454
|
\`\`\`
|
|
1456
|
-
`,
|
|
1455
|
+
`, n = 3, i = 10 - r.length;
|
|
1457
1456
|
break;
|
|
1458
1457
|
}
|
|
1459
1458
|
case "relationship": {
|
|
1460
|
-
|
|
1459
|
+
r = `\`\`\`mermaid
|
|
1461
1460
|
${(g == null ? void 0 : g.relationship) || `erDiagram
|
|
1462
1461
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1463
1462
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1464
1463
|
\`\`\`
|
|
1465
|
-
`,
|
|
1464
|
+
`, n = 3, i = 10 - r.length;
|
|
1466
1465
|
break;
|
|
1467
1466
|
}
|
|
1468
1467
|
case "journey": {
|
|
1469
|
-
|
|
1468
|
+
r = `\`\`\`mermaid
|
|
1470
1469
|
${(g == null ? void 0 : g.journey) || `journey
|
|
1471
1470
|
title My working day
|
|
1472
1471
|
section Go to work
|
|
@@ -1477,39 +1476,39 @@ ${(g == null ? void 0 : g.journey) || `journey
|
|
|
1477
1476
|
Go downstairs: 5: Me
|
|
1478
1477
|
Sit down: 5: Me`}
|
|
1479
1478
|
\`\`\`
|
|
1480
|
-
`,
|
|
1479
|
+
`, n = 3, i = 10 - r.length;
|
|
1481
1480
|
break;
|
|
1482
1481
|
}
|
|
1483
1482
|
case "katexInline": {
|
|
1484
|
-
|
|
1483
|
+
r = "$$", n = 1, i = -1;
|
|
1485
1484
|
break;
|
|
1486
1485
|
}
|
|
1487
1486
|
case "katexBlock": {
|
|
1488
|
-
|
|
1487
|
+
r = `$$
|
|
1489
1488
|
|
|
1490
1489
|
$$
|
|
1491
|
-
`,
|
|
1490
|
+
`, n = 3, i = -4;
|
|
1492
1491
|
break;
|
|
1493
1492
|
}
|
|
1494
1493
|
case "universal": {
|
|
1495
1494
|
const { generate: k } = l, y = k(c);
|
|
1496
|
-
|
|
1495
|
+
r = y.targetValue, u = y.select, n = y.deviationStart, i = y.deviationEnd;
|
|
1497
1496
|
}
|
|
1498
1497
|
}
|
|
1499
1498
|
return {
|
|
1500
|
-
text:
|
|
1499
|
+
text: r,
|
|
1501
1500
|
options: {
|
|
1502
1501
|
// 是否选中
|
|
1503
1502
|
select: u,
|
|
1504
1503
|
// 选中时,开始位置的偏移量
|
|
1505
|
-
deviationStart:
|
|
1504
|
+
deviationStart: n,
|
|
1506
1505
|
// 结束的偏移量
|
|
1507
1506
|
deviationEnd: i,
|
|
1508
1507
|
// 是否整个替换
|
|
1509
1508
|
replaceAll: d
|
|
1510
1509
|
}
|
|
1511
1510
|
};
|
|
1512
|
-
},
|
|
1511
|
+
}, Dl = "#e5c07b", it = "var(--md-color)", Nl = "#56b6c2", Hl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Vl = "#e5c07b", Fl = "var(--md-color)", ct = "#d19a66", Bl = "#c678dd", Ol = "#21252b", Rl = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", Pl = "#ceedfa33", ut = "#528bff", ql = be.theme(
|
|
1513
1512
|
{
|
|
1514
1513
|
"&": {
|
|
1515
1514
|
color: oe,
|
|
@@ -1519,8 +1518,8 @@ $$
|
|
|
1519
1518
|
caretColor: ut
|
|
1520
1519
|
},
|
|
1521
1520
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: ut },
|
|
1522
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1523
|
-
".cm-panels": { backgroundColor:
|
|
1521
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Pl },
|
|
1522
|
+
".cm-panels": { backgroundColor: Ol, color: oe },
|
|
1524
1523
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1525
1524
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1526
1525
|
".cm-searchMatch": {
|
|
@@ -1542,7 +1541,7 @@ $$
|
|
|
1542
1541
|
borderColor: "var(--md-border-color)"
|
|
1543
1542
|
},
|
|
1544
1543
|
".cm-activeLineGutter": {
|
|
1545
|
-
backgroundColor:
|
|
1544
|
+
backgroundColor: Rl
|
|
1546
1545
|
},
|
|
1547
1546
|
".cm-foldPlaceholder": {
|
|
1548
1547
|
backgroundColor: "transparent",
|
|
@@ -1568,10 +1567,10 @@ $$
|
|
|
1568
1567
|
}
|
|
1569
1568
|
},
|
|
1570
1569
|
{ dark: !0 }
|
|
1571
|
-
),
|
|
1572
|
-
{ tag: s.keyword, color:
|
|
1570
|
+
), Ul = $t.define([
|
|
1571
|
+
{ tag: s.keyword, color: Bl },
|
|
1573
1572
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: it },
|
|
1574
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1573
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Vl },
|
|
1575
1574
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ct },
|
|
1576
1575
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1577
1576
|
{
|
|
@@ -1585,7 +1584,7 @@ $$
|
|
|
1585
1584
|
s.self,
|
|
1586
1585
|
s.namespace
|
|
1587
1586
|
],
|
|
1588
|
-
color:
|
|
1587
|
+
color: Dl
|
|
1589
1588
|
},
|
|
1590
1589
|
{
|
|
1591
1590
|
tag: [
|
|
@@ -1597,7 +1596,7 @@ $$
|
|
|
1597
1596
|
s.link,
|
|
1598
1597
|
s.special(s.string)
|
|
1599
1598
|
],
|
|
1600
|
-
color:
|
|
1599
|
+
color: Nl
|
|
1601
1600
|
},
|
|
1602
1601
|
{ tag: [s.meta, s.comment], color: st },
|
|
1603
1602
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1606,12 +1605,12 @@ $$
|
|
|
1606
1605
|
{ tag: s.link, color: st, textDecoration: "underline" },
|
|
1607
1606
|
{ tag: s.heading, fontWeight: "bold", color: it },
|
|
1608
1607
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ct },
|
|
1609
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1610
|
-
{ tag: s.invalid, color:
|
|
1611
|
-
]),
|
|
1612
|
-
|
|
1613
|
-
yt(
|
|
1614
|
-
],
|
|
1608
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Fl },
|
|
1609
|
+
{ tag: s.invalid, color: Hl }
|
|
1610
|
+
]), Gl = [
|
|
1611
|
+
ql,
|
|
1612
|
+
yt(Ul)
|
|
1613
|
+
], Kl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", jl = "#fff", ae = "#3f4a54", gt = "#2d8cf0", Wl = "#2d8cf0", zl = "#3f4a54", ht = "#d19a66", Zl = "#c678dd", Xl = "#21252b", Yl = "#ceedfa33", ft = "var(--md-bk-color)", ge = "var(--md-bk-color)", Jl = "#bad5fa", bt = "#3f4a54", Ql = be.theme(
|
|
1615
1614
|
{
|
|
1616
1615
|
"&": {
|
|
1617
1616
|
color: ae,
|
|
@@ -1621,8 +1620,8 @@ $$
|
|
|
1621
1620
|
caretColor: bt
|
|
1622
1621
|
},
|
|
1623
1622
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
|
|
1624
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1625
|
-
".cm-panels": { backgroundColor:
|
|
1623
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Jl },
|
|
1624
|
+
".cm-panels": { backgroundColor: Xl, color: ae },
|
|
1626
1625
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1627
1626
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1628
1627
|
".cm-searchMatch": {
|
|
@@ -1644,7 +1643,7 @@ $$
|
|
|
1644
1643
|
borderColor: "var(--md-border-color)"
|
|
1645
1644
|
},
|
|
1646
1645
|
".cm-activeLineGutter": {
|
|
1647
|
-
backgroundColor:
|
|
1646
|
+
backgroundColor: Yl
|
|
1648
1647
|
},
|
|
1649
1648
|
".cm-foldPlaceholder": {
|
|
1650
1649
|
backgroundColor: "transparent",
|
|
@@ -1670,10 +1669,10 @@ $$
|
|
|
1670
1669
|
}
|
|
1671
1670
|
}
|
|
1672
1671
|
// { dark: true }
|
|
1673
|
-
),
|
|
1674
|
-
{ tag: s.keyword, color:
|
|
1672
|
+
), eo = $t.define([
|
|
1673
|
+
{ tag: s.keyword, color: Zl },
|
|
1675
1674
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: mt },
|
|
1676
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1675
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Wl },
|
|
1677
1676
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ht },
|
|
1678
1677
|
{ tag: [s.definition(s.name), s.separator], color: ae },
|
|
1679
1678
|
{
|
|
@@ -1687,7 +1686,7 @@ $$
|
|
|
1687
1686
|
s.self,
|
|
1688
1687
|
s.namespace
|
|
1689
1688
|
],
|
|
1690
|
-
color:
|
|
1689
|
+
color: Kl
|
|
1691
1690
|
},
|
|
1692
1691
|
{
|
|
1693
1692
|
tag: [
|
|
@@ -1708,20 +1707,20 @@ $$
|
|
|
1708
1707
|
{ tag: s.link, color: gt, textDecoration: "underline" },
|
|
1709
1708
|
{ tag: s.heading, fontWeight: "bold", color: mt },
|
|
1710
1709
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ht },
|
|
1711
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1712
|
-
{ tag: s.invalid, color:
|
|
1713
|
-
]),
|
|
1714
|
-
|
|
1715
|
-
yt(
|
|
1716
|
-
], se = (e, a, l,
|
|
1710
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: zl },
|
|
1711
|
+
{ tag: s.invalid, color: jl }
|
|
1712
|
+
]), to = [
|
|
1713
|
+
Ql,
|
|
1714
|
+
yt(eo)
|
|
1715
|
+
], se = (e, a, l, r, n) => (i, u, d, c) => {
|
|
1717
1716
|
const g = `${e}${a}`.slice(c - d);
|
|
1718
|
-
i.dispatch(i.state.replaceSelection(`${g}${l}${
|
|
1719
|
-
const m = d + u.label.length + (
|
|
1717
|
+
i.dispatch(i.state.replaceSelection(`${g}${l}${r}`));
|
|
1718
|
+
const m = d + u.label.length + (n === "title" ? l.length : 0);
|
|
1720
1719
|
i.dispatch({
|
|
1721
1720
|
selection: q.create(
|
|
1722
1721
|
[
|
|
1723
1722
|
q.range(
|
|
1724
|
-
d + u.label.length + (
|
|
1723
|
+
d + u.label.length + (n === "title" ? 1 : -a.length),
|
|
1725
1724
|
m
|
|
1726
1725
|
),
|
|
1727
1726
|
q.cursor(m)
|
|
@@ -1729,19 +1728,19 @@ $$
|
|
|
1729
1728
|
1
|
|
1730
1729
|
)
|
|
1731
1730
|
}), i.focus();
|
|
1732
|
-
}, vt = (e) => (a, l,
|
|
1733
|
-
const i = e.slice(
|
|
1731
|
+
}, vt = (e) => (a, l, r, n) => {
|
|
1732
|
+
const i = e.slice(n - r);
|
|
1734
1733
|
a.dispatch(a.state.replaceSelection(`${i} `));
|
|
1735
|
-
},
|
|
1734
|
+
}, lo = (e) => {
|
|
1736
1735
|
const a = (l) => {
|
|
1737
|
-
const
|
|
1736
|
+
const r = l.matchBefore(
|
|
1738
1737
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
1739
1738
|
);
|
|
1740
|
-
return
|
|
1741
|
-
from:
|
|
1739
|
+
return r === null || r.from == r.to && l.explicit ? null : {
|
|
1740
|
+
from: r.from,
|
|
1742
1741
|
options: [
|
|
1743
1742
|
// 标题
|
|
1744
|
-
...["h1", "h2", "h3", "h4", "h5", "h6"].map((
|
|
1743
|
+
...["h1", "h2", "h3", "h4", "h5", "h6"].map((n, i) => {
|
|
1745
1744
|
const u = new Array(i + 1).fill("#").join("");
|
|
1746
1745
|
return {
|
|
1747
1746
|
label: u,
|
|
@@ -1750,8 +1749,8 @@ $$
|
|
|
1750
1749
|
};
|
|
1751
1750
|
}),
|
|
1752
1751
|
// 任务列表
|
|
1753
|
-
...["unchecked", "checked"].map((
|
|
1754
|
-
const i =
|
|
1752
|
+
...["unchecked", "checked"].map((n) => {
|
|
1753
|
+
const i = n === "checked" ? "- [x]" : "- [ ]";
|
|
1755
1754
|
return {
|
|
1756
1755
|
label: i,
|
|
1757
1756
|
type: "text",
|
|
@@ -1763,10 +1762,10 @@ $$
|
|
|
1763
1762
|
["`", ""],
|
|
1764
1763
|
["```", "language"],
|
|
1765
1764
|
["```mermaid\n", ""]
|
|
1766
|
-
].map((
|
|
1767
|
-
label: `${
|
|
1765
|
+
].map((n) => ({
|
|
1766
|
+
label: `${n[0]}${n[1]}`,
|
|
1768
1767
|
type: "text",
|
|
1769
|
-
apply: se(
|
|
1768
|
+
apply: se(n[0], n[1], "", n[0] === "`" ? "`" : "\n```", "type")
|
|
1770
1769
|
})),
|
|
1771
1770
|
// 链接
|
|
1772
1771
|
{
|
|
@@ -1818,26 +1817,26 @@ $$`, "title")
|
|
|
1818
1817
|
"caution",
|
|
1819
1818
|
"error",
|
|
1820
1819
|
"attention"
|
|
1821
|
-
].map((
|
|
1822
|
-
label: `!!! ${
|
|
1820
|
+
].map((n) => ({
|
|
1821
|
+
label: `!!! ${n}`,
|
|
1823
1822
|
type: "text",
|
|
1824
|
-
apply: se("!!!", ` ${
|
|
1823
|
+
apply: se("!!!", ` ${n}`, " Title", `
|
|
1825
1824
|
|
|
1826
1825
|
!!!`, "title")
|
|
1827
1826
|
}))
|
|
1828
1827
|
]
|
|
1829
1828
|
};
|
|
1830
1829
|
};
|
|
1831
|
-
return
|
|
1832
|
-
override: e ? [a,
|
|
1830
|
+
return ul({
|
|
1831
|
+
override: e ? [a, ...e] : [a]
|
|
1833
1832
|
});
|
|
1834
|
-
},
|
|
1835
|
-
const a = new
|
|
1836
|
-
return (
|
|
1837
|
-
effects:
|
|
1833
|
+
}, oo = lo, X = (e) => {
|
|
1834
|
+
const a = new cl();
|
|
1835
|
+
return (r) => (a.get(e.state) ? e.dispatch({ effects: a.reconfigure(r) }) : e.dispatch({
|
|
1836
|
+
effects: dl.appendConfig.of(a.of(r))
|
|
1838
1837
|
}), !0);
|
|
1839
1838
|
};
|
|
1840
|
-
class
|
|
1839
|
+
class ao {
|
|
1841
1840
|
constructor(a) {
|
|
1842
1841
|
P(this, "view");
|
|
1843
1842
|
P(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
@@ -1851,7 +1850,7 @@ class no {
|
|
|
1851
1850
|
P(this, "toggleDisabled");
|
|
1852
1851
|
P(this, "toggleReadOnly");
|
|
1853
1852
|
P(this, "toggleMaxlength");
|
|
1854
|
-
this.view = a, this.toggleTabSize =
|
|
1853
|
+
this.view = a, this.toggleTabSize = X(this.view), this.togglePlaceholder = X(this.view), this.setExtensions = X(this.view), this.toggleDisabled = X(this.view), this.toggleReadOnly = X(this.view), this.toggleMaxlength = X(this.view);
|
|
1855
1854
|
}
|
|
1856
1855
|
getValue() {
|
|
1857
1856
|
return this.view.state.doc.toString();
|
|
@@ -1863,11 +1862,11 @@ class no {
|
|
|
1863
1862
|
* @param from 插入开始位置
|
|
1864
1863
|
* @param to 插入结束位置
|
|
1865
1864
|
*/
|
|
1866
|
-
setValue(a, l = 0,
|
|
1865
|
+
setValue(a, l = 0, r = this.view.state.doc.length) {
|
|
1867
1866
|
this.view.dispatch({
|
|
1868
1867
|
changes: {
|
|
1869
1868
|
from: l,
|
|
1870
|
-
to:
|
|
1869
|
+
to: r,
|
|
1871
1870
|
insert: a
|
|
1872
1871
|
}
|
|
1873
1872
|
});
|
|
@@ -1894,7 +1893,7 @@ class no {
|
|
|
1894
1893
|
deviationEnd: 0,
|
|
1895
1894
|
// 直接替换所有文本
|
|
1896
1895
|
replaceAll: !1
|
|
1897
|
-
},
|
|
1896
|
+
}, r) {
|
|
1898
1897
|
try {
|
|
1899
1898
|
if (l.replaceAll) {
|
|
1900
1899
|
if (this.setValue(a), a.length > this.maxLength)
|
|
@@ -1903,13 +1902,13 @@ class no {
|
|
|
1903
1902
|
}
|
|
1904
1903
|
if (this.view.state.doc.length - this.getSelectedText().length + a.length > this.maxLength)
|
|
1905
1904
|
throw new Error("The input text is too long");
|
|
1906
|
-
const { from:
|
|
1905
|
+
const { from: n } = this.view.state.selection.main;
|
|
1907
1906
|
if (this.view.dispatch(this.view.state.replaceSelection(a)), l.select) {
|
|
1908
|
-
const i =
|
|
1907
|
+
const i = n + a.length + l.deviationEnd;
|
|
1909
1908
|
this.view.dispatch({
|
|
1910
1909
|
selection: q.create(
|
|
1911
1910
|
[
|
|
1912
|
-
q.range(
|
|
1911
|
+
q.range(n + l.deviationStart, i),
|
|
1913
1912
|
q.cursor(i)
|
|
1914
1913
|
],
|
|
1915
1914
|
1
|
|
@@ -1917,15 +1916,15 @@ class no {
|
|
|
1917
1916
|
});
|
|
1918
1917
|
}
|
|
1919
1918
|
this.view.focus();
|
|
1920
|
-
} catch (
|
|
1921
|
-
if (
|
|
1922
|
-
f.emit(
|
|
1919
|
+
} catch (n) {
|
|
1920
|
+
if (n.message === "The input text is too long")
|
|
1921
|
+
f.emit(r, "errorCatcher", {
|
|
1923
1922
|
name: "overlength",
|
|
1924
|
-
message:
|
|
1923
|
+
message: n.message,
|
|
1925
1924
|
data: a
|
|
1926
1925
|
});
|
|
1927
1926
|
else
|
|
1928
|
-
throw
|
|
1927
|
+
throw n;
|
|
1929
1928
|
}
|
|
1930
1929
|
}
|
|
1931
1930
|
/**
|
|
@@ -1936,7 +1935,7 @@ class no {
|
|
|
1936
1935
|
setTabSize(a) {
|
|
1937
1936
|
this.toggleTabSize([
|
|
1938
1937
|
ue.tabSize.of(a),
|
|
1939
|
-
|
|
1938
|
+
sl.of(" ".repeat(a))
|
|
1940
1939
|
]);
|
|
1941
1940
|
}
|
|
1942
1941
|
/**
|
|
@@ -1945,26 +1944,26 @@ class no {
|
|
|
1945
1944
|
* @param t 目标内容
|
|
1946
1945
|
*/
|
|
1947
1946
|
setPlaceholder(a) {
|
|
1948
|
-
this.togglePlaceholder(
|
|
1947
|
+
this.togglePlaceholder(el(a));
|
|
1949
1948
|
}
|
|
1950
1949
|
focus(a) {
|
|
1951
1950
|
if (this.view.focus(), !a)
|
|
1952
1951
|
return;
|
|
1953
|
-
let l = 0,
|
|
1952
|
+
let l = 0, r = 0, n = 0;
|
|
1954
1953
|
switch (a) {
|
|
1955
1954
|
case "start":
|
|
1956
1955
|
break;
|
|
1957
1956
|
case "end": {
|
|
1958
|
-
l =
|
|
1957
|
+
l = r = n = this.getValue().length;
|
|
1959
1958
|
break;
|
|
1960
1959
|
}
|
|
1961
1960
|
default:
|
|
1962
|
-
l = a.rangeAnchor || a.cursorPos,
|
|
1961
|
+
l = a.rangeAnchor || a.cursorPos, r = a.rangeHead || a.cursorPos, n = a.cursorPos;
|
|
1963
1962
|
}
|
|
1964
1963
|
this.view.dispatch({
|
|
1965
1964
|
scrollIntoView: !0,
|
|
1966
1965
|
selection: q.create(
|
|
1967
|
-
[q.range(l,
|
|
1966
|
+
[q.range(l, r), q.cursor(n)],
|
|
1968
1967
|
1
|
|
1969
1968
|
)
|
|
1970
1969
|
});
|
|
@@ -1983,45 +1982,45 @@ class no {
|
|
|
1983
1982
|
}
|
|
1984
1983
|
const ro = (e) => {
|
|
1985
1984
|
const a = A("editorId");
|
|
1986
|
-
return (
|
|
1987
|
-
if (!
|
|
1985
|
+
return (r) => {
|
|
1986
|
+
if (!r.clipboardData)
|
|
1988
1987
|
return;
|
|
1989
|
-
if (
|
|
1990
|
-
const { files: i } =
|
|
1988
|
+
if (r.clipboardData.files.length > 0) {
|
|
1989
|
+
const { files: i } = r.clipboardData;
|
|
1991
1990
|
f.emit(
|
|
1992
1991
|
a,
|
|
1993
1992
|
"uploadImage",
|
|
1994
1993
|
Array.from(i).filter((u) => /image\/.*/.test(u.type))
|
|
1995
|
-
),
|
|
1994
|
+
), r.preventDefault();
|
|
1996
1995
|
return;
|
|
1997
1996
|
}
|
|
1998
|
-
if (e.autoDetectCode &&
|
|
1999
|
-
const i = JSON.parse(
|
|
1997
|
+
if (e.autoDetectCode && r.clipboardData.types.includes("vscode-editor-data")) {
|
|
1998
|
+
const i = JSON.parse(r.clipboardData.getData("vscode-editor-data"));
|
|
2000
1999
|
f.emit(a, "replace", "code", {
|
|
2001
2000
|
mode: i.mode,
|
|
2002
|
-
text:
|
|
2003
|
-
}),
|
|
2001
|
+
text: r.clipboardData.getData("text/plain")
|
|
2002
|
+
}), r.preventDefault();
|
|
2004
2003
|
return;
|
|
2005
2004
|
}
|
|
2006
|
-
const
|
|
2007
|
-
e.maxlength &&
|
|
2005
|
+
const n = r.clipboardData.getData("text/plain");
|
|
2006
|
+
e.maxlength && n.length + e.modelValue.length > e.maxlength && f.emit(a, "errorCatcher", {
|
|
2008
2007
|
name: "overlength",
|
|
2009
2008
|
message: "The input text is too long",
|
|
2010
|
-
data:
|
|
2009
|
+
data: n
|
|
2011
2010
|
});
|
|
2012
2011
|
};
|
|
2013
|
-
},
|
|
2012
|
+
}, no = ro, io = (e) => {
|
|
2014
2013
|
const a = A("editorId");
|
|
2015
|
-
|
|
2014
|
+
Z(() => {
|
|
2016
2015
|
f.on(a, {
|
|
2017
2016
|
name: Rt,
|
|
2018
2017
|
callback(l) {
|
|
2019
|
-
var
|
|
2020
|
-
(
|
|
2018
|
+
var r;
|
|
2019
|
+
(r = e.value) == null || r.focus(l);
|
|
2021
2020
|
}
|
|
2022
2021
|
});
|
|
2023
2022
|
});
|
|
2024
|
-
},
|
|
2023
|
+
}, so = io, co = (e, a) => [
|
|
2025
2024
|
{
|
|
2026
2025
|
key: "Ctrl-b",
|
|
2027
2026
|
mac: "Cmd-b",
|
|
@@ -2030,13 +2029,13 @@ const ro = (e) => {
|
|
|
2030
2029
|
{
|
|
2031
2030
|
key: "Ctrl-d",
|
|
2032
2031
|
mac: "Cmd-d",
|
|
2033
|
-
run:
|
|
2032
|
+
run: al,
|
|
2034
2033
|
preventDefault: !0
|
|
2035
2034
|
},
|
|
2036
2035
|
{
|
|
2037
2036
|
key: "Ctrl-s",
|
|
2038
2037
|
mac: "Cmd-s",
|
|
2039
|
-
run: (
|
|
2038
|
+
run: (I) => (f.emit(e, Ct, I.state.doc.toString()), !0),
|
|
2040
2039
|
shift: () => (f.emit(e, "replace", "strikeThrough"), !0)
|
|
2041
2040
|
},
|
|
2042
2041
|
{
|
|
@@ -2100,8 +2099,8 @@ const ro = (e) => {
|
|
|
2100
2099
|
key: "Ctrl-c",
|
|
2101
2100
|
mac: "Cmd-c",
|
|
2102
2101
|
shift: () => (f.emit(e, "replace", "code"), !0),
|
|
2103
|
-
any(
|
|
2104
|
-
return (
|
|
2102
|
+
any(I, p) {
|
|
2103
|
+
return (p.ctrlKey || p.metaKey) && p.altKey && p.code === "KeyC" ? (f.emit(e, "replace", "codeRow"), !0) : !1;
|
|
2105
2104
|
}
|
|
2106
2105
|
},
|
|
2107
2106
|
{
|
|
@@ -2115,14 +2114,13 @@ const ro = (e) => {
|
|
|
2115
2114
|
shift: () => a.noPrettier ? !1 : (f.emit(e, "replace", "prettier"), !0)
|
|
2116
2115
|
},
|
|
2117
2116
|
{
|
|
2118
|
-
any: (
|
|
2117
|
+
any: (I, p) => (p.ctrlKey || p.metaKey) && p.altKey && p.shiftKey && p.code === "KeyT" ? (f.emit(e, "replace", "table"), !0) : !1
|
|
2119
2118
|
}
|
|
2120
|
-
],
|
|
2121
|
-
const a = A("tabWidth"), l = A("editorId"),
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
ll({ codeLanguages: tl }),
|
|
2119
|
+
], uo = co, mo = (e) => {
|
|
2120
|
+
const a = A("tabWidth"), l = A("editorId"), r = A("theme"), n = U(), i = St(), u = uo(l, e), d = no(e), c = [
|
|
2121
|
+
tl.of([...u, rl]),
|
|
2122
|
+
Qt,
|
|
2123
|
+
ol({ codeLanguages: ll }),
|
|
2126
2124
|
// 横向换行
|
|
2127
2125
|
ie.lineWrapping,
|
|
2128
2126
|
ie.updateListener.of((m) => {
|
|
@@ -2135,7 +2133,7 @@ const ro = (e) => {
|
|
|
2135
2133
|
input: (m) => {
|
|
2136
2134
|
e.onInput && e.onInput(m);
|
|
2137
2135
|
const { data: b } = m;
|
|
2138
|
-
e.maxlength && e.
|
|
2136
|
+
e.maxlength && e.modelValue.length + b.length > e.maxlength && f.emit(l, "errorCatcher", {
|
|
2139
2137
|
name: "overlength",
|
|
2140
2138
|
message: "The input text is too long",
|
|
2141
2139
|
data: b
|
|
@@ -2145,29 +2143,29 @@ const ro = (e) => {
|
|
|
2145
2143
|
], g = () => {
|
|
2146
2144
|
const m = [
|
|
2147
2145
|
...c,
|
|
2148
|
-
|
|
2149
|
-
|
|
2146
|
+
r.value === "light" ? to : Gl,
|
|
2147
|
+
oo(e.completions)
|
|
2150
2148
|
];
|
|
2151
|
-
return z.codeMirrorExtensions(
|
|
2149
|
+
return z.codeMirrorExtensions(r.value, m, [
|
|
2152
2150
|
...u
|
|
2153
2151
|
]);
|
|
2154
2152
|
};
|
|
2155
|
-
return
|
|
2153
|
+
return Z(() => {
|
|
2156
2154
|
const m = new ie({
|
|
2157
|
-
doc: e.
|
|
2158
|
-
parent:
|
|
2159
|
-
}), b = new
|
|
2155
|
+
doc: e.modelValue,
|
|
2156
|
+
parent: n.value
|
|
2157
|
+
}), b = new ao(m);
|
|
2160
2158
|
i.value = b, setTimeout(() => {
|
|
2161
2159
|
b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(g()), e.placeholder && b.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && b.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2162
2160
|
}, 0), f.on(l, {
|
|
2163
2161
|
name: "ctrlZ",
|
|
2164
2162
|
callback() {
|
|
2165
|
-
|
|
2163
|
+
nl(m);
|
|
2166
2164
|
}
|
|
2167
2165
|
}), f.on(l, {
|
|
2168
2166
|
name: "ctrlShiftZ",
|
|
2169
2167
|
callback() {
|
|
2170
|
-
|
|
2168
|
+
il(m);
|
|
2171
2169
|
}
|
|
2172
2170
|
}), f.on(l, {
|
|
2173
2171
|
name: "replace",
|
|
@@ -2178,7 +2176,7 @@ const ro = (e) => {
|
|
|
2178
2176
|
}
|
|
2179
2177
|
});
|
|
2180
2178
|
}), H(
|
|
2181
|
-
[
|
|
2179
|
+
[r, le(e, "completions")],
|
|
2182
2180
|
() => {
|
|
2183
2181
|
var m;
|
|
2184
2182
|
(m = i.value) == null || m.setExtensions(g());
|
|
@@ -2187,10 +2185,10 @@ const ro = (e) => {
|
|
|
2187
2185
|
deep: !0
|
|
2188
2186
|
}
|
|
2189
2187
|
), H(
|
|
2190
|
-
() => e.
|
|
2188
|
+
() => e.modelValue,
|
|
2191
2189
|
() => {
|
|
2192
2190
|
var m, b;
|
|
2193
|
-
((m = i.value) == null ? void 0 : m.getValue()) !== e.
|
|
2191
|
+
((m = i.value) == null ? void 0 : m.getValue()) !== e.modelValue && ((b = i.value) == null || b.setValue(e.modelValue));
|
|
2194
2192
|
}
|
|
2195
2193
|
), H(
|
|
2196
2194
|
() => e.placeholder,
|
|
@@ -2216,128 +2214,25 @@ const ro = (e) => {
|
|
|
2216
2214
|
var m;
|
|
2217
2215
|
e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
|
|
2218
2216
|
}
|
|
2219
|
-
),
|
|
2220
|
-
inputWrapperRef:
|
|
2217
|
+
), so(i), {
|
|
2218
|
+
inputWrapperRef: n,
|
|
2221
2219
|
codeMirrorUt: i
|
|
2222
2220
|
};
|
|
2223
|
-
},
|
|
2224
|
-
value: {
|
|
2225
|
-
type: String,
|
|
2226
|
-
default: ""
|
|
2227
|
-
},
|
|
2228
|
-
onChange: {
|
|
2229
|
-
type: Function,
|
|
2230
|
-
default: () => {
|
|
2231
|
-
}
|
|
2232
|
-
},
|
|
2233
|
-
setting: {
|
|
2234
|
-
type: Object,
|
|
2235
|
-
default: () => ({})
|
|
2236
|
-
},
|
|
2237
|
-
onHtmlChanged: {
|
|
2238
|
-
type: Function,
|
|
2239
|
-
default: () => {
|
|
2240
|
-
}
|
|
2241
|
-
},
|
|
2242
|
-
onGetCatalog: {
|
|
2243
|
-
type: Function,
|
|
2244
|
-
default: () => {
|
|
2245
|
-
}
|
|
2246
|
-
},
|
|
2247
|
-
mdHeadingId: {
|
|
2248
|
-
type: Function,
|
|
2249
|
-
default: () => ""
|
|
2250
|
-
},
|
|
2251
|
-
noMermaid: {
|
|
2252
|
-
type: Boolean,
|
|
2253
|
-
default: !1
|
|
2254
|
-
},
|
|
2255
|
-
sanitize: {
|
|
2256
|
-
type: Function,
|
|
2257
|
-
default: (e) => e
|
|
2258
|
-
},
|
|
2259
|
-
placeholder: {
|
|
2260
|
-
type: String,
|
|
2261
|
-
default: ""
|
|
2262
|
-
},
|
|
2263
|
-
// 不使用该函数功能
|
|
2264
|
-
noKatex: {
|
|
2265
|
-
type: Boolean,
|
|
2266
|
-
default: !1
|
|
2267
|
-
},
|
|
2268
|
-
scrollAuto: {
|
|
2269
|
-
type: Boolean
|
|
2270
|
-
},
|
|
2271
|
-
formatCopiedText: {
|
|
2272
|
-
type: Function,
|
|
2273
|
-
default: (e) => e
|
|
2274
|
-
},
|
|
2275
|
-
autofocus: {
|
|
2276
|
-
type: Boolean
|
|
2277
|
-
},
|
|
2278
|
-
disabled: {
|
|
2279
|
-
type: Boolean
|
|
2280
|
-
},
|
|
2281
|
-
readonly: {
|
|
2282
|
-
type: Boolean
|
|
2283
|
-
},
|
|
2284
|
-
maxlength: {
|
|
2285
|
-
type: Number
|
|
2286
|
-
},
|
|
2287
|
-
autoDetectCode: {
|
|
2288
|
-
type: Boolean
|
|
2289
|
-
},
|
|
2290
|
-
/**
|
|
2291
|
-
* 输入框失去焦点时触发事件
|
|
2292
|
-
*/
|
|
2293
|
-
onBlur: {
|
|
2294
|
-
type: Function,
|
|
2295
|
-
default: () => {
|
|
2296
|
-
}
|
|
2297
|
-
},
|
|
2298
|
-
/**
|
|
2299
|
-
* 输入框获得焦点时触发事件
|
|
2300
|
-
*/
|
|
2301
|
-
onFocus: {
|
|
2302
|
-
type: Function,
|
|
2303
|
-
default: () => {
|
|
2304
|
-
}
|
|
2305
|
-
},
|
|
2306
|
-
noPrettier: {
|
|
2307
|
-
type: Boolean
|
|
2308
|
-
},
|
|
2309
|
-
noHighlight: {
|
|
2310
|
-
type: Boolean,
|
|
2311
|
-
default: !1
|
|
2312
|
-
},
|
|
2313
|
-
completions: {
|
|
2314
|
-
type: Array
|
|
2315
|
-
},
|
|
2316
|
-
catalogVisible: {
|
|
2317
|
-
type: Boolean
|
|
2318
|
-
},
|
|
2319
|
-
theme: {
|
|
2320
|
-
type: String,
|
|
2321
|
-
default: "light"
|
|
2322
|
-
},
|
|
2323
|
-
onInput: {
|
|
2324
|
-
type: Function
|
|
2325
|
-
}
|
|
2326
|
-
}, bo = /* @__PURE__ */ V({
|
|
2221
|
+
}, go = mo, ho = /* @__PURE__ */ B({
|
|
2327
2222
|
name: "MDEditorContent",
|
|
2328
|
-
props:
|
|
2223
|
+
props: Pt,
|
|
2329
2224
|
setup(e) {
|
|
2330
2225
|
const a = A("editorId"), l = U(""), {
|
|
2331
|
-
inputWrapperRef:
|
|
2332
|
-
codeMirrorUt:
|
|
2333
|
-
} =
|
|
2334
|
-
return
|
|
2226
|
+
inputWrapperRef: r,
|
|
2227
|
+
codeMirrorUt: n
|
|
2228
|
+
} = go(e);
|
|
2229
|
+
return Ll(e, l, n), () => t("div", {
|
|
2335
2230
|
class: `${o}-content`
|
|
2336
2231
|
}, [t("div", {
|
|
2337
2232
|
class: `${o}-input-wrapper`,
|
|
2338
|
-
ref:
|
|
2339
|
-
}, null), t(
|
|
2340
|
-
modelValue: e.
|
|
2233
|
+
ref: r
|
|
2234
|
+
}, null), t(qt, {
|
|
2235
|
+
modelValue: e.modelValue,
|
|
2341
2236
|
setting: e.setting,
|
|
2342
2237
|
onHtmlChanged: (i) => {
|
|
2343
2238
|
l.value = i, e.onHtmlChanged(i);
|
|
@@ -2348,7 +2243,8 @@ const ro = (e) => {
|
|
|
2348
2243
|
sanitize: e.sanitize,
|
|
2349
2244
|
noKatex: e.noKatex,
|
|
2350
2245
|
formatCopiedText: e.formatCopiedText,
|
|
2351
|
-
noHighlight: e.noHighlight
|
|
2246
|
+
noHighlight: e.noHighlight,
|
|
2247
|
+
noImgZoomIn: e.noImgZoomIn
|
|
2352
2248
|
}, null), e.catalogVisible && t(Tt, {
|
|
2353
2249
|
theme: e.theme,
|
|
2354
2250
|
class: `${o}-catalog-editor`,
|
|
@@ -2357,7 +2253,7 @@ const ro = (e) => {
|
|
|
2357
2253
|
key: "internal-catalog"
|
|
2358
2254
|
}, null)]);
|
|
2359
2255
|
}
|
|
2360
|
-
}),
|
|
2256
|
+
}), fo = /* @__PURE__ */ B({
|
|
2361
2257
|
props: {
|
|
2362
2258
|
modelValue: {
|
|
2363
2259
|
type: String,
|
|
@@ -2367,15 +2263,15 @@ const ro = (e) => {
|
|
|
2367
2263
|
setup(e) {
|
|
2368
2264
|
const a = A("usedLanguageText");
|
|
2369
2265
|
return () => {
|
|
2370
|
-
var l,
|
|
2266
|
+
var l, r;
|
|
2371
2267
|
return t("div", {
|
|
2372
2268
|
class: `${o}-footer-item`
|
|
2373
2269
|
}, [t("label", {
|
|
2374
2270
|
class: `${o}-footer-label`
|
|
2375
|
-
}, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((
|
|
2271
|
+
}, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((r = e.modelValue) == null ? void 0 : r.length) || 0])]);
|
|
2376
2272
|
};
|
|
2377
2273
|
}
|
|
2378
|
-
}),
|
|
2274
|
+
}), bo = {
|
|
2379
2275
|
checked: {
|
|
2380
2276
|
type: Boolean,
|
|
2381
2277
|
default: !1
|
|
@@ -2385,8 +2281,8 @@ const ro = (e) => {
|
|
|
2385
2281
|
default: () => {
|
|
2386
2282
|
}
|
|
2387
2283
|
}
|
|
2388
|
-
},
|
|
2389
|
-
props:
|
|
2284
|
+
}, vo = /* @__PURE__ */ B({
|
|
2285
|
+
props: bo,
|
|
2390
2286
|
setup(e) {
|
|
2391
2287
|
return () => t("div", {
|
|
2392
2288
|
class: [`${o}-checkbox`, e.checked && `${o}-checkbox-checked`],
|
|
@@ -2395,7 +2291,7 @@ const ro = (e) => {
|
|
|
2395
2291
|
}
|
|
2396
2292
|
}, null);
|
|
2397
2293
|
}
|
|
2398
|
-
}),
|
|
2294
|
+
}), ko = {
|
|
2399
2295
|
scrollAuto: {
|
|
2400
2296
|
type: Boolean
|
|
2401
2297
|
},
|
|
@@ -2404,8 +2300,8 @@ const ro = (e) => {
|
|
|
2404
2300
|
default: () => {
|
|
2405
2301
|
}
|
|
2406
2302
|
}
|
|
2407
|
-
},
|
|
2408
|
-
props:
|
|
2303
|
+
}, Co = /* @__PURE__ */ B({
|
|
2304
|
+
props: ko,
|
|
2409
2305
|
setup(e) {
|
|
2410
2306
|
const a = A("usedLanguageText");
|
|
2411
2307
|
return () => {
|
|
@@ -2417,13 +2313,13 @@ const ro = (e) => {
|
|
|
2417
2313
|
onClick: () => {
|
|
2418
2314
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2419
2315
|
}
|
|
2420
|
-
}, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(
|
|
2316
|
+
}, [(l = a.value.footer) == null ? void 0 : l.scrollAuto]), t(vo, {
|
|
2421
2317
|
checked: e.scrollAuto,
|
|
2422
2318
|
onChange: e.onScrollAutoChange
|
|
2423
2319
|
}, null)]);
|
|
2424
2320
|
};
|
|
2425
2321
|
}
|
|
2426
|
-
}),
|
|
2322
|
+
}), po = {
|
|
2427
2323
|
modelValue: {
|
|
2428
2324
|
type: String,
|
|
2429
2325
|
default: ""
|
|
@@ -2443,65 +2339,65 @@ const ro = (e) => {
|
|
|
2443
2339
|
defFooters: {
|
|
2444
2340
|
type: Object
|
|
2445
2341
|
}
|
|
2446
|
-
},
|
|
2342
|
+
}, $o = /* @__PURE__ */ B({
|
|
2447
2343
|
name: "MDEditorFooter",
|
|
2448
|
-
props:
|
|
2344
|
+
props: po,
|
|
2449
2345
|
setup(e) {
|
|
2450
2346
|
const a = fe(() => {
|
|
2451
|
-
const
|
|
2452
|
-
return [
|
|
2453
|
-
}), l = (
|
|
2454
|
-
if (
|
|
2455
|
-
switch (
|
|
2347
|
+
const r = e.footers.indexOf("="), n = r === -1 ? e.footers : e.footers.slice(0, r), i = r === -1 ? [] : e.footers.slice(r, Number.MAX_SAFE_INTEGER);
|
|
2348
|
+
return [n, i];
|
|
2349
|
+
}), l = (r) => {
|
|
2350
|
+
if (Lt.includes(r))
|
|
2351
|
+
switch (r) {
|
|
2456
2352
|
case "markdownTotal":
|
|
2457
|
-
return t(
|
|
2353
|
+
return t(fo, {
|
|
2458
2354
|
modelValue: e.modelValue
|
|
2459
2355
|
}, null);
|
|
2460
2356
|
case "scrollSwitch":
|
|
2461
|
-
return t(
|
|
2357
|
+
return t(Co, {
|
|
2462
2358
|
scrollAuto: e.scrollAuto,
|
|
2463
2359
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2464
2360
|
}, null);
|
|
2465
2361
|
}
|
|
2466
2362
|
else
|
|
2467
|
-
return e.defFooters instanceof Array ? e.defFooters[
|
|
2363
|
+
return e.defFooters instanceof Array ? e.defFooters[r] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[r] || "";
|
|
2468
2364
|
};
|
|
2469
2365
|
return () => {
|
|
2470
|
-
const
|
|
2366
|
+
const r = a.value[0].map((i) => l(i)), n = a.value[1].map((i) => l(i));
|
|
2471
2367
|
return t("div", {
|
|
2472
2368
|
class: `${o}-footer`
|
|
2473
2369
|
}, [t("div", {
|
|
2474
2370
|
class: `${o}-footer-left`
|
|
2475
|
-
}, [
|
|
2371
|
+
}, [r]), t("div", {
|
|
2476
2372
|
class: `${o}-footer-right`
|
|
2477
|
-
}, [
|
|
2373
|
+
}, [n])]);
|
|
2478
2374
|
};
|
|
2479
2375
|
}
|
|
2480
|
-
}),
|
|
2376
|
+
}), yo = /* @__PURE__ */ B({
|
|
2481
2377
|
name: "MdEditorV3",
|
|
2482
|
-
props:
|
|
2483
|
-
emits:
|
|
2378
|
+
props: Ut,
|
|
2379
|
+
emits: Gt,
|
|
2484
2380
|
setup(e, a) {
|
|
2485
2381
|
const {
|
|
2486
2382
|
editorId: l,
|
|
2487
|
-
noKatex:
|
|
2488
|
-
noMermaid:
|
|
2383
|
+
noKatex: r,
|
|
2384
|
+
noMermaid: n,
|
|
2489
2385
|
noPrettier: i,
|
|
2490
2386
|
noUploadImg: u,
|
|
2491
2387
|
noHighlight: d
|
|
2492
|
-
} = e, c =
|
|
2388
|
+
} = e, c = Y({
|
|
2493
2389
|
scrollAuto: e.scrollAuto
|
|
2494
2390
|
});
|
|
2495
|
-
|
|
2496
|
-
const [g, m] =
|
|
2391
|
+
Kt(e, a), _t(e), jt(e), Wt(e, a);
|
|
2392
|
+
const [g, m] = zt(e, a), b = Zt(e);
|
|
2497
2393
|
return At(() => {
|
|
2498
2394
|
f.clear(l);
|
|
2499
2395
|
}), Xt(e, a, b, g, m), () => {
|
|
2500
2396
|
var v;
|
|
2501
|
-
const $ =
|
|
2397
|
+
const $ = nt({
|
|
2502
2398
|
props: e,
|
|
2503
2399
|
ctx: a
|
|
2504
|
-
}, "defToolbars"), T =
|
|
2400
|
+
}, "defToolbars"), T = nt({
|
|
2505
2401
|
props: e,
|
|
2506
2402
|
ctx: a
|
|
2507
2403
|
}, "defFooters");
|
|
@@ -2509,7 +2405,7 @@ const ro = (e) => {
|
|
|
2509
2405
|
id: l,
|
|
2510
2406
|
class: [o, e.class, e.theme === "dark" && `${o}-dark`, g.fullscreen || g.pageFullscreen ? `${o}-fullscreen` : ""],
|
|
2511
2407
|
style: e.style
|
|
2512
|
-
}, [t(
|
|
2408
|
+
}, [t(Sl, {
|
|
2513
2409
|
noPrettier: i,
|
|
2514
2410
|
toolbars: e.toolbars,
|
|
2515
2411
|
toolbarsExclude: e.toolbarsExclude,
|
|
@@ -2519,15 +2415,15 @@ const ro = (e) => {
|
|
|
2519
2415
|
defToolbars: $,
|
|
2520
2416
|
noUploadImg: u,
|
|
2521
2417
|
showToolbarName: e.showToolbarName
|
|
2522
|
-
}, null), t(
|
|
2523
|
-
|
|
2418
|
+
}, null), t(ho, {
|
|
2419
|
+
modelValue: e.modelValue,
|
|
2524
2420
|
setting: g,
|
|
2525
2421
|
mdHeadingId: e.mdHeadingId,
|
|
2526
|
-
noMermaid:
|
|
2422
|
+
noMermaid: n,
|
|
2527
2423
|
noPrettier: i,
|
|
2528
2424
|
sanitize: e.sanitize,
|
|
2529
2425
|
placeholder: e.placeholder,
|
|
2530
|
-
noKatex:
|
|
2426
|
+
noKatex: r,
|
|
2531
2427
|
scrollAuto: c.scrollAuto,
|
|
2532
2428
|
formatCopiedText: e.formatCopiedText,
|
|
2533
2429
|
autofocus: e.autoFocus,
|
|
@@ -2556,8 +2452,9 @@ const ro = (e) => {
|
|
|
2556
2452
|
},
|
|
2557
2453
|
completions: e.completions,
|
|
2558
2454
|
catalogVisible: b.value,
|
|
2559
|
-
theme: e.theme
|
|
2560
|
-
|
|
2455
|
+
theme: e.theme,
|
|
2456
|
+
noImgZoomIn: e.noImgZoomIn
|
|
2457
|
+
}, null), ((v = e.footers) == null ? void 0 : v.length) > 0 && t($o, {
|
|
2561
2458
|
modelValue: e.modelValue,
|
|
2562
2459
|
footers: e.footers,
|
|
2563
2460
|
defFooters: T,
|
|
@@ -2566,8 +2463,8 @@ const ro = (e) => {
|
|
|
2566
2463
|
}, null)]);
|
|
2567
2464
|
};
|
|
2568
2465
|
}
|
|
2569
|
-
}), he =
|
|
2570
|
-
he.install = (e) => (e.component(he.name, he), e.use(
|
|
2466
|
+
}), he = yo;
|
|
2467
|
+
he.install = (e) => (e.component(he.name, he), e.use(ml).use(Vt).use(gl).use(Tt).use(Yt), e);
|
|
2571
2468
|
export {
|
|
2572
2469
|
he as default
|
|
2573
2470
|
};
|