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