md-editor-v3 4.2.1-beta.1 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/MdEditor.cjs +16 -16
- package/lib/cjs/chunks/index.cjs +4 -4
- package/lib/cjs/chunks/index2.cjs +1 -1
- package/lib/cjs/chunks/index4.cjs +2 -2
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +296 -289
- package/lib/es/chunks/index.mjs +27 -27
- package/lib/es/chunks/index2.mjs +4 -1
- package/lib/es/chunks/index4.mjs +21 -19
- package/lib/es/index.mjs +14 -15
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/layouts/Content/composition/useMermaid.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Content/index.d.ts +15 -0
- package/lib/types/MdEditor/layouts/Content/markdownIt/mermaid/index.d.ts +0 -1
- package/lib/types/MdEditor/layouts/Content/props.d.ts +8 -1
- package/lib/types/MdEditor/type.d.ts +1 -3
- package/lib/umd/index.js +28 -28
- package/package.json +2 -2
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var Ze = Object.defineProperty;
|
|
2
2
|
var Je = (e, o, a) => o in e ? Ze(e, o, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[o] = a;
|
|
3
3
|
var U = (e, o, a) => (Je(e, typeof o != "symbol" ? o + "" : o, a), a);
|
|
4
|
-
import { defineComponent as O, createVNode as t, inject as
|
|
4
|
+
import { defineComponent as O, createVNode as t, inject as S, ref as G, onMounted as z, reactive as Z, computed as fe, watch as F, nextTick as me, Fragment as Ke, toRef as te, shallowRef as Xe, onBeforeUnmount as Qe } from "vue";
|
|
5
5
|
import { p as n, a as W, s as et, b as tt, d as lt } from "./chunks/config.mjs";
|
|
6
6
|
import { a as ee, D as ot } from "./chunks/index2.mjs";
|
|
7
7
|
import { b as h, a as at } from "./chunks/index4.mjs";
|
|
@@ -13,28 +13,27 @@ import { minimalSetup as xt, EditorView as re } from "codemirror";
|
|
|
13
13
|
import { EditorView as ge, placeholder as wt, keymap as Tt } from "@codemirror/view";
|
|
14
14
|
import { languages as St } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as At } from "@codemirror/lang-markdown";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Bt } from "@codemirror/language";
|
|
16
|
+
import { deleteLine as Mt, indentWithTab as Lt, undo as Dt, redo as Et } from "@codemirror/commands";
|
|
17
|
+
import { HighlightStyle as We, syntaxHighlighting as ze, indentUnit as Ht } from "@codemirror/language";
|
|
19
18
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as P, EditorState as se, Compartment as
|
|
21
|
-
import { autocompletion as
|
|
22
|
-
import { g as He } from "./chunks/vue-tsx.mjs";
|
|
19
|
+
import { EditorSelection as P, EditorState as se, Compartment as It, StateEffect as Bt } from "@codemirror/state";
|
|
20
|
+
import { autocompletion as Ft } from "@codemirror/autocomplete";
|
|
23
21
|
import Ye from "./MdCatalog.mjs";
|
|
24
|
-
import
|
|
22
|
+
import { g as He } from "./chunks/vue-tsx.mjs";
|
|
23
|
+
import Ot from "./NormalToolbar.mjs";
|
|
25
24
|
import "medium-zoom";
|
|
26
25
|
import "copy-to-clipboard";
|
|
27
26
|
import "markdown-it";
|
|
28
27
|
import "markdown-it-image-figures";
|
|
29
28
|
import "markdown-it-task-lists";
|
|
30
29
|
import "lru-cache";
|
|
31
|
-
const
|
|
30
|
+
const Vt = /* @__PURE__ */ O({
|
|
32
31
|
setup() {
|
|
33
32
|
return () => t("div", {
|
|
34
33
|
class: `${n}-divider`
|
|
35
34
|
}, null);
|
|
36
35
|
}
|
|
37
|
-
}),
|
|
36
|
+
}), Rt = {
|
|
38
37
|
noPrettier: {
|
|
39
38
|
type: Boolean
|
|
40
39
|
},
|
|
@@ -75,11 +74,11 @@ const Pt = /* @__PURE__ */ O({
|
|
|
75
74
|
noUploadImg: {
|
|
76
75
|
type: Boolean
|
|
77
76
|
}
|
|
78
|
-
},
|
|
77
|
+
}, Pt = (e) => {
|
|
79
78
|
var f, u, d, v;
|
|
80
|
-
const o =
|
|
79
|
+
const o = S("editorId");
|
|
81
80
|
let a = (u = (f = W.editorExtensions) == null ? void 0 : f.screenfull) == null ? void 0 : u.instance;
|
|
82
|
-
const l = (v = (d = W.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : v.js,
|
|
81
|
+
const l = (v = (d = W.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : v.js, i = G(!1), r = (y) => {
|
|
83
82
|
if (!a) {
|
|
84
83
|
h.emit(o, "errorCatcher", {
|
|
85
84
|
name: "fullscreen",
|
|
@@ -87,10 +86,10 @@ const Pt = /* @__PURE__ */ O({
|
|
|
87
86
|
});
|
|
88
87
|
return;
|
|
89
88
|
}
|
|
90
|
-
a.isEnabled ? (
|
|
89
|
+
a.isEnabled ? (i.value = !0, (y === void 0 ? !a.isFullscreen : y) ? a.request() : a.exit()) : console.error("browser does not support screenfull!");
|
|
91
90
|
}, c = () => {
|
|
92
91
|
a && a.isEnabled && a.on("change", () => {
|
|
93
|
-
(
|
|
92
|
+
(i.value || e.setting.fullscreen) && (i.value = !1, e.updateSetting("fullscreen"));
|
|
94
93
|
});
|
|
95
94
|
}, m = () => {
|
|
96
95
|
a = window.screenfull, c();
|
|
@@ -103,10 +102,10 @@ const Pt = /* @__PURE__ */ O({
|
|
|
103
102
|
}), z(() => {
|
|
104
103
|
h.on(o, {
|
|
105
104
|
name: st,
|
|
106
|
-
callback:
|
|
105
|
+
callback: r
|
|
107
106
|
});
|
|
108
|
-
}), { fullscreenHandler:
|
|
109
|
-
},
|
|
107
|
+
}), { fullscreenHandler: r };
|
|
108
|
+
}, Nt = {
|
|
110
109
|
tableShape: {
|
|
111
110
|
type: Array,
|
|
112
111
|
default: () => [6, 4]
|
|
@@ -116,9 +115,9 @@ const Pt = /* @__PURE__ */ O({
|
|
|
116
115
|
default: () => {
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
},
|
|
118
|
+
}, qt = /* @__PURE__ */ O({
|
|
120
119
|
name: "TableShape",
|
|
121
|
-
props:
|
|
120
|
+
props: Nt,
|
|
122
121
|
setup(e) {
|
|
123
122
|
const o = Z({
|
|
124
123
|
x: -1,
|
|
@@ -132,20 +131,20 @@ const Pt = /* @__PURE__ */ O({
|
|
|
132
131
|
}, [new Array(e.tableShape[1]).fill("").map((a, l) => t("div", {
|
|
133
132
|
class: `${n}-table-shape-row`,
|
|
134
133
|
key: `table-shape-row-${l}`
|
|
135
|
-
}, [new Array(e.tableShape[0]).fill("").map((
|
|
134
|
+
}, [new Array(e.tableShape[0]).fill("").map((i, r) => t("div", {
|
|
136
135
|
class: `${n}-table-shape-col`,
|
|
137
|
-
key: `table-shape-col-${
|
|
136
|
+
key: `table-shape-col-${r}`,
|
|
138
137
|
onMouseenter: () => {
|
|
139
|
-
o.x = l, o.y =
|
|
138
|
+
o.x = l, o.y = r;
|
|
140
139
|
},
|
|
141
140
|
onClick: () => {
|
|
142
141
|
e.onSelected(o);
|
|
143
142
|
}
|
|
144
143
|
}, [t("div", {
|
|
145
|
-
class: [`${n}-table-shape-col-default`, l <= o.x &&
|
|
144
|
+
class: [`${n}-table-shape-col-default`, l <= o.x && r <= o.y && `${n}-table-shape-col-include`]
|
|
146
145
|
}, null)]))]))]);
|
|
147
146
|
}
|
|
148
|
-
}),
|
|
147
|
+
}), Ut = qt, Gt = {
|
|
149
148
|
type: {
|
|
150
149
|
type: String,
|
|
151
150
|
default: "link"
|
|
@@ -164,26 +163,26 @@ const Pt = /* @__PURE__ */ O({
|
|
|
164
163
|
default: () => {
|
|
165
164
|
}
|
|
166
165
|
}
|
|
167
|
-
},
|
|
168
|
-
props:
|
|
166
|
+
}, Kt = /* @__PURE__ */ O({
|
|
167
|
+
props: Gt,
|
|
169
168
|
setup(e) {
|
|
170
|
-
const o =
|
|
171
|
-
var
|
|
169
|
+
const o = S("usedLanguageText"), a = S("editorId"), l = fe(() => {
|
|
170
|
+
var r, c;
|
|
172
171
|
switch (e.type) {
|
|
173
172
|
case "link":
|
|
174
|
-
return (
|
|
173
|
+
return (r = o.value.linkModalTips) == null ? void 0 : r.linkTitle;
|
|
175
174
|
case "image":
|
|
176
175
|
return (c = o.value.linkModalTips) == null ? void 0 : c.imageTitle;
|
|
177
176
|
default:
|
|
178
177
|
return "";
|
|
179
178
|
}
|
|
180
|
-
}),
|
|
179
|
+
}), i = Z({
|
|
181
180
|
desc: "",
|
|
182
181
|
url: ""
|
|
183
182
|
});
|
|
184
|
-
return F(() => e.visible, (
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
return F(() => e.visible, (r) => {
|
|
184
|
+
r || setTimeout(() => {
|
|
185
|
+
i.desc = "", i.url = "";
|
|
187
186
|
}, 200);
|
|
188
187
|
}), () => t(_e, {
|
|
189
188
|
title: l.value,
|
|
@@ -191,20 +190,20 @@ const Pt = /* @__PURE__ */ O({
|
|
|
191
190
|
onClose: e.onCancel
|
|
192
191
|
}, {
|
|
193
192
|
default: () => {
|
|
194
|
-
var
|
|
193
|
+
var r, c, m, f, u;
|
|
195
194
|
return [t("div", {
|
|
196
195
|
class: `${n}-form-item`
|
|
197
196
|
}, [t("label", {
|
|
198
197
|
class: `${n}-label`,
|
|
199
198
|
for: `link-desc-${a}`
|
|
200
|
-
}, [(
|
|
199
|
+
}, [(r = o.value.linkModalTips) == null ? void 0 : r.descLabel]), t("input", {
|
|
201
200
|
placeholder: (c = o.value.linkModalTips) == null ? void 0 : c.descLabelPlaceHolder,
|
|
202
201
|
class: `${n}-input`,
|
|
203
202
|
id: `link-desc-${a}`,
|
|
204
203
|
type: "text",
|
|
205
|
-
value:
|
|
204
|
+
value: i.desc,
|
|
206
205
|
onChange: (d) => {
|
|
207
|
-
|
|
206
|
+
i.desc = d.target.value;
|
|
208
207
|
},
|
|
209
208
|
autocomplete: "off"
|
|
210
209
|
}, null)]), t("div", {
|
|
@@ -217,9 +216,9 @@ const Pt = /* @__PURE__ */ O({
|
|
|
217
216
|
class: `${n}-input`,
|
|
218
217
|
id: `link-url-${a}`,
|
|
219
218
|
type: "text",
|
|
220
|
-
value:
|
|
219
|
+
value: i.url,
|
|
221
220
|
onChange: (d) => {
|
|
222
|
-
|
|
221
|
+
i.url = d.target.value;
|
|
223
222
|
},
|
|
224
223
|
autocomplete: "off"
|
|
225
224
|
}, null)]), t("div", {
|
|
@@ -228,13 +227,13 @@ const Pt = /* @__PURE__ */ O({
|
|
|
228
227
|
class: [`${n}-btn`, `${n}-btn-row`],
|
|
229
228
|
type: "button",
|
|
230
229
|
onClick: () => {
|
|
231
|
-
e.onOk(
|
|
230
|
+
e.onOk(i), i.desc = "", i.url = "";
|
|
232
231
|
}
|
|
233
232
|
}, [(u = o.value.linkModalTips) == null ? void 0 : u.buttonOK])])];
|
|
234
233
|
}
|
|
235
234
|
});
|
|
236
235
|
}
|
|
237
|
-
}),
|
|
236
|
+
}), jt = {
|
|
238
237
|
visible: {
|
|
239
238
|
type: Boolean,
|
|
240
239
|
default: !1
|
|
@@ -249,13 +248,13 @@ const Pt = /* @__PURE__ */ O({
|
|
|
249
248
|
default: () => {
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
|
-
},
|
|
253
|
-
props:
|
|
251
|
+
}, _t = /* @__PURE__ */ O({
|
|
252
|
+
props: jt,
|
|
254
253
|
setup(e) {
|
|
255
254
|
var d, v, y;
|
|
256
|
-
const o =
|
|
255
|
+
const o = S("usedLanguageText"), a = S("editorId");
|
|
257
256
|
let l = (y = (v = (d = W) == null ? void 0 : d.editorExtensions) == null ? void 0 : v.cropper) == null ? void 0 : y.instance;
|
|
258
|
-
const
|
|
257
|
+
const i = G(), r = G(), c = G(), m = Z({
|
|
259
258
|
cropperInited: !1,
|
|
260
259
|
imgSelected: !1,
|
|
261
260
|
imgSrc: "",
|
|
@@ -264,7 +263,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
264
263
|
});
|
|
265
264
|
let f = null;
|
|
266
265
|
F(() => e.visible, () => {
|
|
267
|
-
e.visible && !m.cropperInited && (l = l || window.Cropper,
|
|
266
|
+
e.visible && !m.cropperInited && (l = l || window.Cropper, i.value.onchange = () => {
|
|
268
267
|
if (!l) {
|
|
269
268
|
h.emit(a, "errorCatcher", {
|
|
270
269
|
name: "Cropper",
|
|
@@ -272,12 +271,12 @@ const Pt = /* @__PURE__ */ O({
|
|
|
272
271
|
});
|
|
273
272
|
return;
|
|
274
273
|
}
|
|
275
|
-
const b =
|
|
274
|
+
const b = i.value.files || [];
|
|
276
275
|
if (m.imgSelected = !0, (b == null ? void 0 : b.length) > 0) {
|
|
277
276
|
const p = new FileReader();
|
|
278
277
|
p.onload = (g) => {
|
|
279
278
|
m.imgSrc = g.target.result, me(() => {
|
|
280
|
-
f = new l(
|
|
279
|
+
f = new l(r.value, {
|
|
281
280
|
viewMode: 2,
|
|
282
281
|
preview: `.${n}-clip-preview-target`
|
|
283
282
|
// aspectRatio: 16 / 9,
|
|
@@ -290,7 +289,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
290
289
|
c.value.style = "";
|
|
291
290
|
}), F(() => m.isFullscreen, () => {
|
|
292
291
|
me(() => {
|
|
293
|
-
f == null || f.destroy(), c.value.style = "",
|
|
292
|
+
f == null || f.destroy(), c.value.style = "", r.value && (f = new l(r.value, {
|
|
294
293
|
viewMode: 2,
|
|
295
294
|
preview: `.${n}-clip-preview-target`
|
|
296
295
|
// aspectRatio: 16 / 9,
|
|
@@ -298,7 +297,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
298
297
|
});
|
|
299
298
|
});
|
|
300
299
|
const u = () => {
|
|
301
|
-
f.clear(), f.destroy(), f = null,
|
|
300
|
+
f.clear(), f.destroy(), f = null, i.value.value = "", m.imgSelected = !1;
|
|
302
301
|
};
|
|
303
302
|
return () => {
|
|
304
303
|
var b;
|
|
@@ -325,7 +324,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
325
324
|
class: `${n}-clip-cropper`
|
|
326
325
|
}, [t("img", {
|
|
327
326
|
src: m.imgSrc,
|
|
328
|
-
ref:
|
|
327
|
+
ref: r,
|
|
329
328
|
style: {
|
|
330
329
|
display: "none"
|
|
331
330
|
},
|
|
@@ -341,7 +340,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
341
340
|
}, null)])])]) : t("div", {
|
|
342
341
|
class: `${n}-clip-upload`,
|
|
343
342
|
onClick: () => {
|
|
344
|
-
|
|
343
|
+
i.value.click();
|
|
345
344
|
}
|
|
346
345
|
}, [t("svg", {
|
|
347
346
|
class: `${n}-icon`,
|
|
@@ -365,7 +364,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
365
364
|
}
|
|
366
365
|
}
|
|
367
366
|
}, [((p = o.value.clipModalTips) == null ? void 0 : p.buttonUpload) || ((g = o.value.linkModalTips) == null ? void 0 : g.buttonOK)])]), t("input", {
|
|
368
|
-
ref:
|
|
367
|
+
ref: i,
|
|
369
368
|
accept: "image/*",
|
|
370
369
|
type: "file",
|
|
371
370
|
multiple: !1,
|
|
@@ -377,7 +376,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
377
376
|
});
|
|
378
377
|
};
|
|
379
378
|
}
|
|
380
|
-
}),
|
|
379
|
+
}), Wt = {
|
|
381
380
|
type: {
|
|
382
381
|
type: String,
|
|
383
382
|
default: "link"
|
|
@@ -400,27 +399,27 @@ const Pt = /* @__PURE__ */ O({
|
|
|
400
399
|
default: () => {
|
|
401
400
|
}
|
|
402
401
|
}
|
|
403
|
-
},
|
|
404
|
-
props:
|
|
402
|
+
}, zt = /* @__PURE__ */ O({
|
|
403
|
+
props: Wt,
|
|
405
404
|
setup(e) {
|
|
406
|
-
return () => t(Ke, null, [t(
|
|
405
|
+
return () => t(Ke, null, [t(Kt, {
|
|
407
406
|
type: e.type,
|
|
408
407
|
visible: e.linkVisible,
|
|
409
408
|
onOk: e.onOk,
|
|
410
409
|
onCancel: e.onCancel
|
|
411
|
-
}, null), t(
|
|
410
|
+
}, null), t(_t, {
|
|
412
411
|
visible: e.clipVisible,
|
|
413
412
|
onOk: e.onOk,
|
|
414
413
|
onCancel: e.onCancel
|
|
415
414
|
}, null)]);
|
|
416
415
|
}
|
|
417
|
-
}),
|
|
416
|
+
}), Yt = /* @__PURE__ */ O({
|
|
418
417
|
name: "MDEditorToolbar",
|
|
419
|
-
props:
|
|
418
|
+
props: Rt,
|
|
420
419
|
setup(e) {
|
|
421
|
-
const o =
|
|
420
|
+
const o = S("editorId"), a = S("usedLanguageText"), {
|
|
422
421
|
fullscreenHandler: l
|
|
423
|
-
} =
|
|
422
|
+
} = Pt(e), i = `${o}-toolbar-wrapper`, r = Z({
|
|
424
423
|
title: !1,
|
|
425
424
|
catalog: !1,
|
|
426
425
|
// 图片上传下拉
|
|
@@ -455,11 +454,11 @@ const Pt = /* @__PURE__ */ O({
|
|
|
455
454
|
d.value.addEventListener("change", v);
|
|
456
455
|
});
|
|
457
456
|
const y = (b) => {
|
|
458
|
-
var p, g, k, x, T, w, M, C,
|
|
457
|
+
var p, g, k, x, T, w, M, C, A, R, L, D, V, I, E, K, N, ae, J, j, q, X, _, H, B, Q, ne, he, be, ve, pe, ke, Ce, $e, ye, xe, we, Te, Se, Ae, Me, Le, De;
|
|
459
458
|
if (tt.includes(b))
|
|
460
459
|
switch (b) {
|
|
461
460
|
case "-":
|
|
462
|
-
return t(
|
|
461
|
+
return t(Vt, null, null);
|
|
463
462
|
case "bold":
|
|
464
463
|
return t("div", {
|
|
465
464
|
class: `${n}-toolbar-item`,
|
|
@@ -514,15 +513,15 @@ const Pt = /* @__PURE__ */ O({
|
|
|
514
513
|
}, null)])]);
|
|
515
514
|
case "title":
|
|
516
515
|
return t(ee, {
|
|
517
|
-
relative: `#${
|
|
518
|
-
visible:
|
|
516
|
+
relative: `#${i}`,
|
|
517
|
+
visible: r.title,
|
|
519
518
|
onChange: ($) => {
|
|
520
|
-
|
|
519
|
+
r.title = $;
|
|
521
520
|
},
|
|
522
521
|
overlay: t("ul", {
|
|
523
522
|
class: `${n}-menu`,
|
|
524
523
|
onClick: () => {
|
|
525
|
-
|
|
524
|
+
r.title = !1;
|
|
526
525
|
}
|
|
527
526
|
}, [t("li", {
|
|
528
527
|
class: `${n}-menu-item`,
|
|
@@ -549,7 +548,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
549
548
|
onClick: () => {
|
|
550
549
|
c("h5");
|
|
551
550
|
}
|
|
552
|
-
}, [(
|
|
551
|
+
}, [(A = a.value.titleItem) == null ? void 0 : A.h5]), t("li", {
|
|
553
552
|
class: `${n}-menu-item`,
|
|
554
553
|
onClick: () => {
|
|
555
554
|
c("h6");
|
|
@@ -699,15 +698,15 @@ const Pt = /* @__PURE__ */ O({
|
|
|
699
698
|
}, [t("use", {
|
|
700
699
|
"xlink:href": "#md-editor-icon-image"
|
|
701
700
|
}, null)])]) : t(ee, {
|
|
702
|
-
relative: `#${
|
|
703
|
-
visible:
|
|
701
|
+
relative: `#${i}`,
|
|
702
|
+
visible: r.image,
|
|
704
703
|
onChange: ($) => {
|
|
705
|
-
|
|
704
|
+
r.image = $;
|
|
706
705
|
},
|
|
707
706
|
overlay: t("ul", {
|
|
708
707
|
class: `${n}-menu`,
|
|
709
708
|
onClick: () => {
|
|
710
|
-
|
|
709
|
+
r.title = !1;
|
|
711
710
|
}
|
|
712
711
|
}, [t("li", {
|
|
713
712
|
class: `${n}-menu-item`,
|
|
@@ -741,13 +740,13 @@ const Pt = /* @__PURE__ */ O({
|
|
|
741
740
|
});
|
|
742
741
|
case "table":
|
|
743
742
|
return t(ee, {
|
|
744
|
-
relative: `#${
|
|
745
|
-
visible:
|
|
743
|
+
relative: `#${i}`,
|
|
744
|
+
visible: r.table,
|
|
746
745
|
onChange: ($) => {
|
|
747
|
-
|
|
746
|
+
r.table = $;
|
|
748
747
|
},
|
|
749
748
|
key: "bar-table",
|
|
750
|
-
overlay: t(
|
|
749
|
+
overlay: t(Ut, {
|
|
751
750
|
tableShape: e.tableShape,
|
|
752
751
|
onSelected: ($) => {
|
|
753
752
|
c("table", {
|
|
@@ -900,15 +899,15 @@ const Pt = /* @__PURE__ */ O({
|
|
|
900
899
|
}, null)])]);
|
|
901
900
|
case "mermaid":
|
|
902
901
|
return t(ee, {
|
|
903
|
-
relative: `#${
|
|
904
|
-
visible:
|
|
902
|
+
relative: `#${i}`,
|
|
903
|
+
visible: r.mermaid,
|
|
905
904
|
onChange: ($) => {
|
|
906
|
-
|
|
905
|
+
r.mermaid = $;
|
|
907
906
|
},
|
|
908
907
|
overlay: t("ul", {
|
|
909
908
|
class: `${n}-menu`,
|
|
910
909
|
onClick: () => {
|
|
911
|
-
|
|
910
|
+
r.mermaid = !1;
|
|
912
911
|
}
|
|
913
912
|
}, [t("li", {
|
|
914
913
|
class: `${n}-menu-item`,
|
|
@@ -968,15 +967,15 @@ const Pt = /* @__PURE__ */ O({
|
|
|
968
967
|
});
|
|
969
968
|
case "katex":
|
|
970
969
|
return t(ee, {
|
|
971
|
-
relative: `#${
|
|
972
|
-
visible:
|
|
970
|
+
relative: `#${i}`,
|
|
971
|
+
visible: r.katex,
|
|
973
972
|
onChange: ($) => {
|
|
974
|
-
|
|
973
|
+
r.katex = $;
|
|
975
974
|
},
|
|
976
975
|
overlay: t("ul", {
|
|
977
976
|
class: `${n}-menu`,
|
|
978
977
|
onClick: () => {
|
|
979
|
-
|
|
978
|
+
r.katex = !1;
|
|
980
979
|
}
|
|
981
980
|
}, [t("li", {
|
|
982
981
|
class: `${n}-menu-item`,
|
|
@@ -1012,7 +1011,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1012
1011
|
const b = u.value[0].map((g) => y(g)), p = u.value[1].map((g) => y(g));
|
|
1013
1012
|
return t(Ke, null, [e.toolbars.length > 0 && t("div", {
|
|
1014
1013
|
class: `${n}-toolbar-wrapper`,
|
|
1015
|
-
id:
|
|
1014
|
+
id: i
|
|
1016
1015
|
}, [t("div", {
|
|
1017
1016
|
class: `${n}-toolbar`
|
|
1018
1017
|
}, [t("div", {
|
|
@@ -1028,7 +1027,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1028
1027
|
style: {
|
|
1029
1028
|
display: "none"
|
|
1030
1029
|
}
|
|
1031
|
-
}, null), t(
|
|
1030
|
+
}, null), t(zt, {
|
|
1032
1031
|
linkVisible: m.linkVisible,
|
|
1033
1032
|
clipVisible: m.clipVisible,
|
|
1034
1033
|
type: m.type,
|
|
@@ -1044,12 +1043,12 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1044
1043
|
}, null)]);
|
|
1045
1044
|
};
|
|
1046
1045
|
}
|
|
1047
|
-
}),
|
|
1046
|
+
}), Zt = (e, o) => {
|
|
1048
1047
|
const a = rt(() => {
|
|
1049
1048
|
e.removeEventListener("scroll", l), e.addEventListener("scroll", l), o.removeEventListener("scroll", l), o.addEventListener("scroll", l);
|
|
1050
|
-
}, 50), l = (
|
|
1051
|
-
const
|
|
1052
|
-
|
|
1049
|
+
}, 50), l = (i) => {
|
|
1050
|
+
const r = e.clientHeight, c = o.clientHeight, m = e.scrollHeight, f = o.scrollHeight, u = (m - r) / (f - c);
|
|
1051
|
+
i.target === e ? (o.removeEventListener("scroll", l), o.scrollTo({
|
|
1053
1052
|
top: e.scrollTop / u
|
|
1054
1053
|
// behavior: 'smooth'
|
|
1055
1054
|
}), a()) : (e.removeEventListener("scroll", l), e.scrollTo({
|
|
@@ -1067,8 +1066,8 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1067
1066
|
e.removeEventListener("scroll", l), o.removeEventListener("scroll", l);
|
|
1068
1067
|
}
|
|
1069
1068
|
];
|
|
1070
|
-
},
|
|
1071
|
-
const { view: l } = a,
|
|
1069
|
+
}, Jt = (e, o, a) => {
|
|
1070
|
+
const { view: l } = a, i = (v) => l.lineBlockAt(l.state.doc.line(v).from).top, r = (v) => l.lineBlockAt(l.state.doc.line(v).from).height;
|
|
1072
1071
|
let c = [];
|
|
1073
1072
|
const m = () => {
|
|
1074
1073
|
c = [];
|
|
@@ -1093,11 +1092,11 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1093
1092
|
if (u !== 0)
|
|
1094
1093
|
return;
|
|
1095
1094
|
f++;
|
|
1096
|
-
const C = c[b - 1],
|
|
1095
|
+
const C = c[b - 1], A = i(C.end) + r(C.end);
|
|
1097
1096
|
let R = 0;
|
|
1098
|
-
const L =
|
|
1097
|
+
const L = i(C.start), D = o.querySelector(`[data-line="${C.start - 1}"]`) || ((g = o.firstElementChild) == null ? void 0 : g.firstElementChild), V = o.querySelector(`[data-line="${C.end}"]`) || ((k = o.lastElementChild) == null ? void 0 : k.lastElementChild);
|
|
1099
1098
|
let I = 0, E = 0;
|
|
1100
|
-
L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (
|
|
1099
|
+
L === 0 ? (R = (l.scrollDOM.scrollTop - L) / (A - L), I = V.offsetTop) : A > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (R = (l.scrollDOM.scrollTop - L) / (l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight - L), E = D.offsetTop, I = o.scrollHeight - o.clientHeight - E + 10) : (R = (l.scrollDOM.scrollTop - L) / (A - L), E = D.offsetTop, I = V.offsetTop - E);
|
|
1101
1100
|
const K = E - 10 + I * R;
|
|
1102
1101
|
Ee(o, K, () => {
|
|
1103
1102
|
f--;
|
|
@@ -1108,13 +1107,13 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1108
1107
|
u++;
|
|
1109
1108
|
const C = Array.from(
|
|
1110
1109
|
o.querySelectorAll("[data-line]")
|
|
1111
|
-
),
|
|
1110
|
+
), A = o.scrollTop, R = o.scrollHeight;
|
|
1112
1111
|
let L = C.length === 0 ? 1 : Math.ceil(
|
|
1113
|
-
Number(C[C.length - 1].dataset.line) * (
|
|
1112
|
+
Number(C[C.length - 1].dataset.line) * (A / R)
|
|
1114
1113
|
), D = (x = o.firstElementChild) == null ? void 0 : x.firstElementChild;
|
|
1115
1114
|
for (let H = L; H >= 0; H--) {
|
|
1116
1115
|
const B = o.querySelector(`[data-line="${H}"]`);
|
|
1117
|
-
if (B && B.offsetTop <=
|
|
1116
|
+
if (B && B.offsetTop <= A) {
|
|
1118
1117
|
D = B, L = H;
|
|
1119
1118
|
break;
|
|
1120
1119
|
}
|
|
@@ -1130,7 +1129,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1130
1129
|
break;
|
|
1131
1130
|
}
|
|
1132
1131
|
const Q = D.offsetTop;
|
|
1133
|
-
if (Q >
|
|
1132
|
+
if (Q > A) {
|
|
1134
1133
|
if (H === 0) {
|
|
1135
1134
|
V = D, I = B;
|
|
1136
1135
|
break;
|
|
@@ -1139,7 +1138,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1139
1138
|
continue;
|
|
1140
1139
|
}
|
|
1141
1140
|
const ne = B.offsetTop;
|
|
1142
|
-
if (Q <=
|
|
1141
|
+
if (Q <= A && ne > A) {
|
|
1143
1142
|
V = D, I = B;
|
|
1144
1143
|
break;
|
|
1145
1144
|
}
|
|
@@ -1147,15 +1146,15 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1147
1146
|
}
|
|
1148
1147
|
const E = V.offsetTop, K = I.offsetTop;
|
|
1149
1148
|
let N = 0;
|
|
1150
|
-
const { start: ae, end: J } = c[Number(V.dataset.line || 0)], j =
|
|
1151
|
-
let q =
|
|
1152
|
-
const X =
|
|
1149
|
+
const { start: ae, end: J } = c[Number(V.dataset.line || 0)], j = i(ae);
|
|
1150
|
+
let q = i(J);
|
|
1151
|
+
const X = r(J);
|
|
1153
1152
|
let _ = 0;
|
|
1154
|
-
V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(
|
|
1155
|
-
(
|
|
1153
|
+
V === ((M = o.firstElementChild) == null ? void 0 : M.firstElementChild) ? (N = Math.max(A / K, 0), _ = q + X - j) : q > l.scrollDOM.scrollHeight - l.scrollDOM.clientHeight ? (N = Math.max(
|
|
1154
|
+
(A - E) / (o.scrollHeight - E - o.clientHeight),
|
|
1156
1155
|
0
|
|
1157
|
-
), q =
|
|
1158
|
-
(
|
|
1156
|
+
), q = i(l.state.doc.lines) + r(l.state.doc.lines), _ = 8 + q - j - e.clientHeight) : (N = Math.max(
|
|
1157
|
+
(A - E) / (K - E),
|
|
1159
1158
|
0
|
|
1160
1159
|
), _ = q + X - j), Ee(e, j + _ * N, () => {
|
|
1161
1160
|
u--;
|
|
@@ -1170,23 +1169,23 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1170
1169
|
c = [], e.removeEventListener("scroll", d), o.removeEventListener("scroll", d);
|
|
1171
1170
|
}
|
|
1172
1171
|
];
|
|
1173
|
-
},
|
|
1174
|
-
const l =
|
|
1175
|
-
let
|
|
1176
|
-
},
|
|
1172
|
+
}, Xt = (e, o, a) => {
|
|
1173
|
+
const l = S("editorId");
|
|
1174
|
+
let i = () => {
|
|
1175
|
+
}, r = () => {
|
|
1177
1176
|
};
|
|
1178
1177
|
const c = () => {
|
|
1179
|
-
|
|
1178
|
+
i();
|
|
1180
1179
|
const m = document.querySelector(".cm-scroller"), f = document.querySelector(
|
|
1181
1180
|
`[id="${l}-preview-wrapper"][data-show="true"]`
|
|
1182
1181
|
), u = document.querySelector(
|
|
1183
1182
|
`[id="${l}-html-wrapper"][data-show="true"]`
|
|
1184
1183
|
);
|
|
1185
|
-
(f || u) && ([
|
|
1184
|
+
(f || u) && ([r, i] = (f ? Jt : Zt)(
|
|
1186
1185
|
m,
|
|
1187
1186
|
f || u,
|
|
1188
1187
|
a.value
|
|
1189
|
-
)), e.scrollAuto &&
|
|
1188
|
+
)), e.scrollAuto && r();
|
|
1190
1189
|
};
|
|
1191
1190
|
F(
|
|
1192
1191
|
[
|
|
@@ -1202,16 +1201,16 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1202
1201
|
), F(
|
|
1203
1202
|
() => e.scrollAuto,
|
|
1204
1203
|
(m) => {
|
|
1205
|
-
m ?
|
|
1204
|
+
m ? r() : i();
|
|
1206
1205
|
}
|
|
1207
1206
|
), z(c);
|
|
1208
|
-
},
|
|
1207
|
+
}, Qt = Xt, el = (e, o, a) => {
|
|
1209
1208
|
var d, v, y, b, p, g;
|
|
1210
|
-
let l = "",
|
|
1209
|
+
let l = "", i = 0, r = 0, c = !0, m = !1;
|
|
1211
1210
|
const f = o.getSelectedText(), u = (d = W.editorConfig) == null ? void 0 : d.mermaidTemplate;
|
|
1212
1211
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1213
1212
|
const k = e.replace(/^h(\d)/, (x, T) => new Array(Number(T)).fill("#", 0, T).join(""));
|
|
1214
|
-
l = `${k} ${f}`,
|
|
1213
|
+
l = `${k} ${f}`, i = k.length + 1;
|
|
1215
1214
|
} else if (e === "prettier") {
|
|
1216
1215
|
const k = window.prettier || ((y = (v = W.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : y.prettierInstance), x = [
|
|
1217
1216
|
((b = window.prettierPlugins) == null ? void 0 : b.markdown) || ((g = (p = W.editorExtensions) == null ? void 0 : p.prettier) == null ? void 0 : g.parserMarkdownInstance)
|
|
@@ -1226,47 +1225,47 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1226
1225
|
} else
|
|
1227
1226
|
switch (e) {
|
|
1228
1227
|
case "bold": {
|
|
1229
|
-
l = `**${f}**`,
|
|
1228
|
+
l = `**${f}**`, i = 2, r = -2;
|
|
1230
1229
|
break;
|
|
1231
1230
|
}
|
|
1232
1231
|
case "underline": {
|
|
1233
|
-
l = `<u>${f}</u>`,
|
|
1232
|
+
l = `<u>${f}</u>`, i = 3, r = -4;
|
|
1234
1233
|
break;
|
|
1235
1234
|
}
|
|
1236
1235
|
case "italic": {
|
|
1237
|
-
l = `*${f}*`,
|
|
1236
|
+
l = `*${f}*`, i = 1, r = -1;
|
|
1238
1237
|
break;
|
|
1239
1238
|
}
|
|
1240
1239
|
case "strikeThrough": {
|
|
1241
|
-
l = `~~${f}~~`,
|
|
1240
|
+
l = `~~${f}~~`, i = 2, r = -2;
|
|
1242
1241
|
break;
|
|
1243
1242
|
}
|
|
1244
1243
|
case "sub": {
|
|
1245
|
-
l = `<sub>${f}</sub>`,
|
|
1244
|
+
l = `<sub>${f}</sub>`, i = 5, r = -6;
|
|
1246
1245
|
break;
|
|
1247
1246
|
}
|
|
1248
1247
|
case "sup": {
|
|
1249
|
-
l = `<sup>${f}</sup>`,
|
|
1248
|
+
l = `<sup>${f}</sup>`, i = 5, r = -6;
|
|
1250
1249
|
break;
|
|
1251
1250
|
}
|
|
1252
1251
|
case "codeRow": {
|
|
1253
|
-
l = "`" + f + "`",
|
|
1252
|
+
l = "`" + f + "`", i = 1, r = -1;
|
|
1254
1253
|
break;
|
|
1255
1254
|
}
|
|
1256
1255
|
case "quote": {
|
|
1257
|
-
l = `> ${f}`,
|
|
1256
|
+
l = `> ${f}`, i = 2;
|
|
1258
1257
|
break;
|
|
1259
1258
|
}
|
|
1260
1259
|
case "orderedList": {
|
|
1261
|
-
l = `1. ${f}`,
|
|
1260
|
+
l = `1. ${f}`, i = 3;
|
|
1262
1261
|
break;
|
|
1263
1262
|
}
|
|
1264
1263
|
case "unorderedList": {
|
|
1265
|
-
l = `- ${f}`,
|
|
1264
|
+
l = `- ${f}`, i = 2;
|
|
1266
1265
|
break;
|
|
1267
1266
|
}
|
|
1268
1267
|
case "task": {
|
|
1269
|
-
l = `- [ ] ${f}`,
|
|
1268
|
+
l = `- [ ] ${f}`, i = 6;
|
|
1270
1269
|
break;
|
|
1271
1270
|
}
|
|
1272
1271
|
case "code": {
|
|
@@ -1274,7 +1273,7 @@ const Pt = /* @__PURE__ */ O({
|
|
|
1274
1273
|
l = `\`\`\`${x}
|
|
1275
1274
|
${k}
|
|
1276
1275
|
\`\`\`
|
|
1277
|
-
`,
|
|
1276
|
+
`, i = 3, r = 3 + x.length - l.length;
|
|
1278
1277
|
break;
|
|
1279
1278
|
}
|
|
1280
1279
|
case "table": {
|
|
@@ -1292,7 +1291,7 @@ ${k}
|
|
|
1292
1291
|
for (let M = 0; M <= T; M++)
|
|
1293
1292
|
l += " content |";
|
|
1294
1293
|
}
|
|
1295
|
-
|
|
1294
|
+
i = 2, r = 5 - l.length;
|
|
1296
1295
|
break;
|
|
1297
1296
|
}
|
|
1298
1297
|
case "link": {
|
|
@@ -1312,7 +1311,7 @@ ${k}
|
|
|
1312
1311
|
${(u == null ? void 0 : u.flow) || `flowchart TD
|
|
1313
1312
|
Start --> Stop`}
|
|
1314
1313
|
\`\`\`
|
|
1315
|
-
`,
|
|
1314
|
+
`, i = 3, r = 10 - l.length;
|
|
1316
1315
|
break;
|
|
1317
1316
|
}
|
|
1318
1317
|
case "sequence": {
|
|
@@ -1322,7 +1321,7 @@ ${(u == null ? void 0 : u.sequence) || `sequenceDiagram
|
|
|
1322
1321
|
B-->>A: hi!
|
|
1323
1322
|
A-)B: bye!`}
|
|
1324
1323
|
\`\`\`
|
|
1325
|
-
`,
|
|
1324
|
+
`, i = 3, r = 10 - l.length;
|
|
1326
1325
|
break;
|
|
1327
1326
|
}
|
|
1328
1327
|
case "gantt": {
|
|
@@ -1334,7 +1333,7 @@ section Section
|
|
|
1334
1333
|
A task :a1, 2014-01-01, 30d
|
|
1335
1334
|
Another task :after a1, 20d`}
|
|
1336
1335
|
\`\`\`
|
|
1337
|
-
`,
|
|
1336
|
+
`, i = 3, r = 10 - l.length;
|
|
1338
1337
|
break;
|
|
1339
1338
|
}
|
|
1340
1339
|
case "class": {
|
|
@@ -1343,7 +1342,7 @@ ${(u == null ? void 0 : u.class) || `classDiagram
|
|
|
1343
1342
|
class Animal
|
|
1344
1343
|
Vehicle <|-- Car`}
|
|
1345
1344
|
\`\`\`
|
|
1346
|
-
`,
|
|
1345
|
+
`, i = 3, r = 10 - l.length;
|
|
1347
1346
|
break;
|
|
1348
1347
|
}
|
|
1349
1348
|
case "state": {
|
|
@@ -1351,7 +1350,7 @@ ${(u == null ? void 0 : u.class) || `classDiagram
|
|
|
1351
1350
|
${(u == null ? void 0 : u.state) || `stateDiagram-v2
|
|
1352
1351
|
s1 --> s2`}
|
|
1353
1352
|
\`\`\`
|
|
1354
|
-
`,
|
|
1353
|
+
`, i = 3, r = 10 - l.length;
|
|
1355
1354
|
break;
|
|
1356
1355
|
}
|
|
1357
1356
|
case "pie": {
|
|
@@ -1361,7 +1360,7 @@ ${(u == null ? void 0 : u.pie) || `pie title Pets adopted by volunteers
|
|
|
1361
1360
|
"Cats" : 85
|
|
1362
1361
|
"Rats" : 15`}
|
|
1363
1362
|
\`\`\`
|
|
1364
|
-
`,
|
|
1363
|
+
`, i = 3, r = 10 - l.length;
|
|
1365
1364
|
break;
|
|
1366
1365
|
}
|
|
1367
1366
|
case "relationship": {
|
|
@@ -1370,7 +1369,7 @@ ${(u == null ? void 0 : u.relationship) || `erDiagram
|
|
|
1370
1369
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1371
1370
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1372
1371
|
\`\`\`
|
|
1373
|
-
`,
|
|
1372
|
+
`, i = 3, r = 10 - l.length;
|
|
1374
1373
|
break;
|
|
1375
1374
|
}
|
|
1376
1375
|
case "journey": {
|
|
@@ -1385,23 +1384,23 @@ ${(u == null ? void 0 : u.journey) || `journey
|
|
|
1385
1384
|
Go downstairs: 5: Me
|
|
1386
1385
|
Sit down: 5: Me`}
|
|
1387
1386
|
\`\`\`
|
|
1388
|
-
`,
|
|
1387
|
+
`, i = 3, r = 10 - l.length;
|
|
1389
1388
|
break;
|
|
1390
1389
|
}
|
|
1391
1390
|
case "katexInline": {
|
|
1392
|
-
l = "$$",
|
|
1391
|
+
l = "$$", i = 1, r = -1;
|
|
1393
1392
|
break;
|
|
1394
1393
|
}
|
|
1395
1394
|
case "katexBlock": {
|
|
1396
1395
|
l = `$$
|
|
1397
1396
|
|
|
1398
1397
|
$$
|
|
1399
|
-
`,
|
|
1398
|
+
`, i = 3, r = -4;
|
|
1400
1399
|
break;
|
|
1401
1400
|
}
|
|
1402
1401
|
case "universal": {
|
|
1403
1402
|
const { generate: k } = a, x = k(f);
|
|
1404
|
-
l = x.targetValue, c = x.select,
|
|
1403
|
+
l = x.targetValue, c = x.select, i = x.deviationStart, r = x.deviationEnd;
|
|
1405
1404
|
}
|
|
1406
1405
|
}
|
|
1407
1406
|
return {
|
|
@@ -1410,14 +1409,14 @@ $$
|
|
|
1410
1409
|
// 是否选中
|
|
1411
1410
|
select: c,
|
|
1412
1411
|
// 选中时,开始位置的偏移量
|
|
1413
|
-
deviationStart:
|
|
1412
|
+
deviationStart: i,
|
|
1414
1413
|
// 结束的偏移量
|
|
1415
|
-
deviationEnd:
|
|
1414
|
+
deviationEnd: r,
|
|
1416
1415
|
// 是否整个替换
|
|
1417
1416
|
replaceAll: m
|
|
1418
1417
|
}
|
|
1419
1418
|
};
|
|
1420
|
-
},
|
|
1419
|
+
}, tl = "#e5c07b", Ie = "var(--md-color)", ll = "#56b6c2", ol = "#ffffff", le = "var(--md-color)", Be = "#e5c07b", al = "#e5c07b", nl = "var(--md-color)", Fe = "#d19a66", rl = "#c678dd", il = "#21252b", sl = "#2c313a", Oe = "var(--md-bk-color)", ce = "var(--md-bk-color)", cl = "#ceedfa33", Ve = "#528bff", dl = ge.theme(
|
|
1421
1420
|
{
|
|
1422
1421
|
"&": {
|
|
1423
1422
|
color: le,
|
|
@@ -1427,8 +1426,8 @@ $$
|
|
|
1427
1426
|
caretColor: Ve
|
|
1428
1427
|
},
|
|
1429
1428
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Ve },
|
|
1430
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1431
|
-
".cm-panels": { backgroundColor:
|
|
1429
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: cl },
|
|
1430
|
+
".cm-panels": { backgroundColor: il, color: le },
|
|
1432
1431
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1433
1432
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1434
1433
|
".cm-searchMatch": {
|
|
@@ -1450,7 +1449,7 @@ $$
|
|
|
1450
1449
|
borderColor: "var(--md-border-color)"
|
|
1451
1450
|
},
|
|
1452
1451
|
".cm-activeLineGutter": {
|
|
1453
|
-
backgroundColor:
|
|
1452
|
+
backgroundColor: sl
|
|
1454
1453
|
},
|
|
1455
1454
|
".cm-foldPlaceholder": {
|
|
1456
1455
|
backgroundColor: "transparent",
|
|
@@ -1476,10 +1475,10 @@ $$
|
|
|
1476
1475
|
}
|
|
1477
1476
|
},
|
|
1478
1477
|
{ dark: !0 }
|
|
1479
|
-
),
|
|
1480
|
-
{ tag: s.keyword, color:
|
|
1478
|
+
), ul = We.define([
|
|
1479
|
+
{ tag: s.keyword, color: rl },
|
|
1481
1480
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Ie },
|
|
1482
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1481
|
+
{ tag: [s.function(s.variableName), s.labelName], color: al },
|
|
1483
1482
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Fe },
|
|
1484
1483
|
{ tag: [s.definition(s.name), s.separator], color: le },
|
|
1485
1484
|
{
|
|
@@ -1493,7 +1492,7 @@ $$
|
|
|
1493
1492
|
s.self,
|
|
1494
1493
|
s.namespace
|
|
1495
1494
|
],
|
|
1496
|
-
color:
|
|
1495
|
+
color: tl
|
|
1497
1496
|
},
|
|
1498
1497
|
{
|
|
1499
1498
|
tag: [
|
|
@@ -1505,7 +1504,7 @@ $$
|
|
|
1505
1504
|
s.link,
|
|
1506
1505
|
s.special(s.string)
|
|
1507
1506
|
],
|
|
1508
|
-
color:
|
|
1507
|
+
color: ll
|
|
1509
1508
|
},
|
|
1510
1509
|
{ tag: [s.meta, s.comment], color: Be },
|
|
1511
1510
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1514,12 +1513,12 @@ $$
|
|
|
1514
1513
|
{ tag: s.link, color: Be, textDecoration: "underline" },
|
|
1515
1514
|
{ tag: s.heading, fontWeight: "bold", color: Ie },
|
|
1516
1515
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Fe },
|
|
1517
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1518
|
-
{ tag: s.invalid, color:
|
|
1519
|
-
]),
|
|
1520
|
-
|
|
1521
|
-
ze(
|
|
1522
|
-
],
|
|
1516
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: nl },
|
|
1517
|
+
{ tag: s.invalid, color: ol }
|
|
1518
|
+
]), ml = [
|
|
1519
|
+
dl,
|
|
1520
|
+
ze(ul)
|
|
1521
|
+
], fl = "#e5c07b", Re = "#3f4a54", gl = "#56b6c2", hl = "#fff", oe = "#3f4a54", Pe = "#2d8cf0", bl = "#2d8cf0", vl = "#3f4a54", Ne = "#d19a66", pl = "#c678dd", kl = "#21252b", Cl = "#ceedfa33", qe = "var(--md-bk-color)", de = "var(--md-bk-color)", $l = "#bad5fa", Ue = "#3f4a54", yl = ge.theme(
|
|
1523
1522
|
{
|
|
1524
1523
|
"&": {
|
|
1525
1524
|
color: oe,
|
|
@@ -1529,8 +1528,8 @@ $$
|
|
|
1529
1528
|
caretColor: Ue
|
|
1530
1529
|
},
|
|
1531
1530
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: Ue },
|
|
1532
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1533
|
-
".cm-panels": { backgroundColor:
|
|
1531
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: $l },
|
|
1532
|
+
".cm-panels": { backgroundColor: kl, color: oe },
|
|
1534
1533
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1535
1534
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1536
1535
|
".cm-searchMatch": {
|
|
@@ -1552,7 +1551,7 @@ $$
|
|
|
1552
1551
|
borderColor: "var(--md-border-color)"
|
|
1553
1552
|
},
|
|
1554
1553
|
".cm-activeLineGutter": {
|
|
1555
|
-
backgroundColor:
|
|
1554
|
+
backgroundColor: Cl
|
|
1556
1555
|
},
|
|
1557
1556
|
".cm-foldPlaceholder": {
|
|
1558
1557
|
backgroundColor: "transparent",
|
|
@@ -1578,10 +1577,10 @@ $$
|
|
|
1578
1577
|
}
|
|
1579
1578
|
}
|
|
1580
1579
|
// { dark: true }
|
|
1581
|
-
),
|
|
1582
|
-
{ tag: s.keyword, color:
|
|
1580
|
+
), xl = We.define([
|
|
1581
|
+
{ tag: s.keyword, color: pl },
|
|
1583
1582
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: Re },
|
|
1584
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1583
|
+
{ tag: [s.function(s.variableName), s.labelName], color: bl },
|
|
1585
1584
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: Ne },
|
|
1586
1585
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1587
1586
|
{
|
|
@@ -1595,7 +1594,7 @@ $$
|
|
|
1595
1594
|
s.self,
|
|
1596
1595
|
s.namespace
|
|
1597
1596
|
],
|
|
1598
|
-
color:
|
|
1597
|
+
color: fl
|
|
1599
1598
|
},
|
|
1600
1599
|
{
|
|
1601
1600
|
tag: [
|
|
@@ -1607,7 +1606,7 @@ $$
|
|
|
1607
1606
|
s.link,
|
|
1608
1607
|
s.special(s.string)
|
|
1609
1608
|
],
|
|
1610
|
-
color:
|
|
1609
|
+
color: gl
|
|
1611
1610
|
},
|
|
1612
1611
|
{ tag: [s.meta, s.comment], color: Pe },
|
|
1613
1612
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1616,31 +1615,31 @@ $$
|
|
|
1616
1615
|
{ tag: s.link, color: Pe, textDecoration: "underline" },
|
|
1617
1616
|
{ tag: s.heading, fontWeight: "bold", color: Re },
|
|
1618
1617
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: Ne },
|
|
1619
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1620
|
-
{ tag: s.invalid, color:
|
|
1621
|
-
]),
|
|
1622
|
-
|
|
1623
|
-
ze(
|
|
1624
|
-
], ie = (e, o, a, l,
|
|
1618
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: vl },
|
|
1619
|
+
{ tag: s.invalid, color: hl }
|
|
1620
|
+
]), wl = [
|
|
1621
|
+
yl,
|
|
1622
|
+
ze(xl)
|
|
1623
|
+
], ie = (e, o, a, l, i) => (r, c, m, f) => {
|
|
1625
1624
|
const u = `${e}${o}`.slice(f - m);
|
|
1626
|
-
|
|
1627
|
-
const d = m + c.label.length + (
|
|
1628
|
-
|
|
1625
|
+
r.dispatch(r.state.replaceSelection(`${u}${a}${l}`));
|
|
1626
|
+
const d = m + c.label.length + (i === "title" ? a.length : 0);
|
|
1627
|
+
r.dispatch({
|
|
1629
1628
|
selection: P.create(
|
|
1630
1629
|
[
|
|
1631
1630
|
P.range(
|
|
1632
|
-
m + c.label.length + (
|
|
1631
|
+
m + c.label.length + (i === "title" ? 1 : -o.length),
|
|
1633
1632
|
d
|
|
1634
1633
|
),
|
|
1635
1634
|
P.cursor(d)
|
|
1636
1635
|
],
|
|
1637
1636
|
1
|
|
1638
1637
|
)
|
|
1639
|
-
}),
|
|
1640
|
-
}, Ge = (e) => (o, a, l,
|
|
1641
|
-
const
|
|
1642
|
-
o.dispatch(o.state.replaceSelection(`${
|
|
1643
|
-
},
|
|
1638
|
+
}), r.focus();
|
|
1639
|
+
}, Ge = (e) => (o, a, l, i) => {
|
|
1640
|
+
const r = e.slice(i - l);
|
|
1641
|
+
o.dispatch(o.state.replaceSelection(`${r} `));
|
|
1642
|
+
}, Tl = (e) => {
|
|
1644
1643
|
const o = (a) => {
|
|
1645
1644
|
const l = a.matchBefore(
|
|
1646
1645
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1649,8 +1648,8 @@ $$
|
|
|
1649
1648
|
from: l.from,
|
|
1650
1649
|
options: [
|
|
1651
1650
|
// 标题
|
|
1652
|
-
...["h1", "h2", "h3", "h4", "h5", "h6"].map((
|
|
1653
|
-
const c = new Array(
|
|
1651
|
+
...["h1", "h2", "h3", "h4", "h5", "h6"].map((i, r) => {
|
|
1652
|
+
const c = new Array(r + 1).fill("#").join("");
|
|
1654
1653
|
return {
|
|
1655
1654
|
label: c,
|
|
1656
1655
|
type: "text",
|
|
@@ -1658,12 +1657,12 @@ $$
|
|
|
1658
1657
|
};
|
|
1659
1658
|
}),
|
|
1660
1659
|
// 任务列表
|
|
1661
|
-
...["unchecked", "checked"].map((
|
|
1662
|
-
const
|
|
1660
|
+
...["unchecked", "checked"].map((i) => {
|
|
1661
|
+
const r = i === "checked" ? "- [x]" : "- [ ]";
|
|
1663
1662
|
return {
|
|
1664
|
-
label:
|
|
1663
|
+
label: r,
|
|
1665
1664
|
type: "text",
|
|
1666
|
-
apply: Ge(
|
|
1665
|
+
apply: Ge(r)
|
|
1667
1666
|
};
|
|
1668
1667
|
}),
|
|
1669
1668
|
// 代码
|
|
@@ -1671,10 +1670,10 @@ $$
|
|
|
1671
1670
|
["`", ""],
|
|
1672
1671
|
["```", "language"],
|
|
1673
1672
|
["```mermaid\n", ""]
|
|
1674
|
-
].map((
|
|
1675
|
-
label: `${
|
|
1673
|
+
].map((i) => ({
|
|
1674
|
+
label: `${i[0]}${i[1]}`,
|
|
1676
1675
|
type: "text",
|
|
1677
|
-
apply: ie(
|
|
1676
|
+
apply: ie(i[0], i[1], "", i[0] === "`" ? "`" : "\n```", "type")
|
|
1678
1677
|
})),
|
|
1679
1678
|
// 链接
|
|
1680
1679
|
{
|
|
@@ -1726,26 +1725,26 @@ $$`, "title")
|
|
|
1726
1725
|
"caution",
|
|
1727
1726
|
"error",
|
|
1728
1727
|
"attention"
|
|
1729
|
-
].map((
|
|
1730
|
-
label: `!!! ${
|
|
1728
|
+
].map((i) => ({
|
|
1729
|
+
label: `!!! ${i}`,
|
|
1731
1730
|
type: "text",
|
|
1732
|
-
apply: ie("!!!", ` ${
|
|
1731
|
+
apply: ie("!!!", ` ${i}`, " Title", `
|
|
1733
1732
|
|
|
1734
1733
|
!!!`, "title")
|
|
1735
1734
|
}))
|
|
1736
1735
|
]
|
|
1737
1736
|
};
|
|
1738
1737
|
};
|
|
1739
|
-
return
|
|
1740
|
-
override: e ? [o,
|
|
1738
|
+
return Ft({
|
|
1739
|
+
override: e ? [o, ...e] : [o]
|
|
1741
1740
|
});
|
|
1742
|
-
},
|
|
1743
|
-
const o = new
|
|
1741
|
+
}, Sl = Tl, Y = (e) => {
|
|
1742
|
+
const o = new It();
|
|
1744
1743
|
return (l) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(l) }) : e.dispatch({
|
|
1745
|
-
effects:
|
|
1744
|
+
effects: Bt.appendConfig.of(o.of(l))
|
|
1746
1745
|
}), !0);
|
|
1747
1746
|
};
|
|
1748
|
-
class
|
|
1747
|
+
class Al {
|
|
1749
1748
|
constructor(o) {
|
|
1750
1749
|
U(this, "view");
|
|
1751
1750
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
@@ -1808,12 +1807,12 @@ class Ll {
|
|
|
1808
1807
|
}
|
|
1809
1808
|
const { from: l } = this.view.state.selection.main;
|
|
1810
1809
|
if (this.view.dispatch(this.view.state.replaceSelection(o)), a.select) {
|
|
1811
|
-
const
|
|
1810
|
+
const i = l + o.length + a.deviationEnd;
|
|
1812
1811
|
this.view.dispatch({
|
|
1813
1812
|
selection: P.create(
|
|
1814
1813
|
[
|
|
1815
|
-
P.range(l + a.deviationStart,
|
|
1816
|
-
P.cursor(
|
|
1814
|
+
P.range(l + a.deviationStart, i),
|
|
1815
|
+
P.cursor(i)
|
|
1817
1816
|
],
|
|
1818
1817
|
1
|
|
1819
1818
|
)
|
|
@@ -1829,7 +1828,7 @@ class Ll {
|
|
|
1829
1828
|
setTabSize(o) {
|
|
1830
1829
|
this.toggleTabSize([
|
|
1831
1830
|
se.tabSize.of(o),
|
|
1832
|
-
|
|
1831
|
+
Ht.of(" ".repeat(o))
|
|
1833
1832
|
]);
|
|
1834
1833
|
}
|
|
1835
1834
|
/**
|
|
@@ -1843,21 +1842,21 @@ class Ll {
|
|
|
1843
1842
|
focus(o) {
|
|
1844
1843
|
if (this.view.focus(), !o)
|
|
1845
1844
|
return;
|
|
1846
|
-
let a = 0, l = 0,
|
|
1845
|
+
let a = 0, l = 0, i = 0;
|
|
1847
1846
|
switch (o) {
|
|
1848
1847
|
case "start":
|
|
1849
1848
|
break;
|
|
1850
1849
|
case "end": {
|
|
1851
|
-
a = l =
|
|
1850
|
+
a = l = i = this.getValue().length;
|
|
1852
1851
|
break;
|
|
1853
1852
|
}
|
|
1854
1853
|
default:
|
|
1855
|
-
a = o.rangeAnchor || o.cursorPos, l = o.rangeHead || o.cursorPos,
|
|
1854
|
+
a = o.rangeAnchor || o.cursorPos, l = o.rangeHead || o.cursorPos, i = o.cursorPos;
|
|
1856
1855
|
}
|
|
1857
1856
|
this.view.dispatch({
|
|
1858
1857
|
scrollIntoView: !0,
|
|
1859
1858
|
selection: P.create(
|
|
1860
|
-
[P.range(a, l), P.cursor(
|
|
1859
|
+
[P.range(a, l), P.cursor(i)],
|
|
1861
1860
|
1
|
|
1862
1861
|
)
|
|
1863
1862
|
});
|
|
@@ -1874,29 +1873,29 @@ class Ll {
|
|
|
1874
1873
|
]);
|
|
1875
1874
|
}
|
|
1876
1875
|
}
|
|
1877
|
-
const
|
|
1878
|
-
const o =
|
|
1876
|
+
const Ml = (e) => {
|
|
1877
|
+
const o = S("editorId");
|
|
1879
1878
|
return (l) => {
|
|
1880
1879
|
if (l.clipboardData) {
|
|
1881
1880
|
if (l.clipboardData.files.length > 0) {
|
|
1882
|
-
const { files:
|
|
1881
|
+
const { files: i } = l.clipboardData;
|
|
1883
1882
|
h.emit(
|
|
1884
1883
|
o,
|
|
1885
1884
|
"uploadImage",
|
|
1886
|
-
Array.from(
|
|
1885
|
+
Array.from(i).filter((r) => /image\/.*/.test(r.type))
|
|
1887
1886
|
), l.preventDefault();
|
|
1888
1887
|
}
|
|
1889
1888
|
if (e.autoDetectCode && l.clipboardData.types.includes("vscode-editor-data")) {
|
|
1890
|
-
const
|
|
1889
|
+
const i = JSON.parse(l.clipboardData.getData("vscode-editor-data"));
|
|
1891
1890
|
h.emit(o, "replace", "code", {
|
|
1892
|
-
mode:
|
|
1891
|
+
mode: i.mode,
|
|
1893
1892
|
text: l.clipboardData.getData("text/plain")
|
|
1894
1893
|
}), l.preventDefault();
|
|
1895
1894
|
}
|
|
1896
1895
|
}
|
|
1897
1896
|
};
|
|
1898
|
-
},
|
|
1899
|
-
const o =
|
|
1897
|
+
}, Ll = Ml, Dl = (e) => {
|
|
1898
|
+
const o = S("editorId");
|
|
1900
1899
|
z(() => {
|
|
1901
1900
|
h.on(o, {
|
|
1902
1901
|
name: dt,
|
|
@@ -1906,7 +1905,7 @@ const Dl = (e) => {
|
|
|
1906
1905
|
}
|
|
1907
1906
|
});
|
|
1908
1907
|
});
|
|
1909
|
-
},
|
|
1908
|
+
}, El = Dl, Hl = (e, o) => [
|
|
1910
1909
|
{
|
|
1911
1910
|
key: "Ctrl-b",
|
|
1912
1911
|
mac: "Cmd-b",
|
|
@@ -1915,7 +1914,7 @@ const Dl = (e) => {
|
|
|
1915
1914
|
{
|
|
1916
1915
|
key: "Ctrl-d",
|
|
1917
1916
|
mac: "Cmd-d",
|
|
1918
|
-
run:
|
|
1917
|
+
run: Mt,
|
|
1919
1918
|
preventDefault: !0
|
|
1920
1919
|
},
|
|
1921
1920
|
{
|
|
@@ -2002,11 +2001,10 @@ const Dl = (e) => {
|
|
|
2002
2001
|
{
|
|
2003
2002
|
any: (M, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (h.emit(e, "replace", "table"), !0) : !1
|
|
2004
2003
|
}
|
|
2005
|
-
],
|
|
2006
|
-
const o =
|
|
2007
|
-
Tt.of([...c,
|
|
2004
|
+
], Il = Hl, Bl = (e) => {
|
|
2005
|
+
const o = S("tabWidth"), a = S("editorId"), l = S("theme"), i = G(), r = Xe(), c = Il(a, e), m = Ll(e), f = [
|
|
2006
|
+
Tt.of([...c, Lt]),
|
|
2008
2007
|
xt,
|
|
2009
|
-
Lt(),
|
|
2010
2008
|
At({ codeLanguages: St }),
|
|
2011
2009
|
// 横向换行
|
|
2012
2010
|
re.lineWrapping,
|
|
@@ -2021,8 +2019,8 @@ const Dl = (e) => {
|
|
|
2021
2019
|
], u = () => {
|
|
2022
2020
|
const d = [
|
|
2023
2021
|
...f,
|
|
2024
|
-
l.value === "light" ?
|
|
2025
|
-
|
|
2022
|
+
l.value === "light" ? wl : ml,
|
|
2023
|
+
Sl(e.completions)
|
|
2026
2024
|
];
|
|
2027
2025
|
return W.codeMirrorExtensions(l.value, d, [
|
|
2028
2026
|
...c
|
|
@@ -2031,33 +2029,33 @@ const Dl = (e) => {
|
|
|
2031
2029
|
return z(() => {
|
|
2032
2030
|
const d = new re({
|
|
2033
2031
|
doc: e.value,
|
|
2034
|
-
parent:
|
|
2035
|
-
}), v = new
|
|
2036
|
-
|
|
2032
|
+
parent: i.value
|
|
2033
|
+
}), v = new Al(d);
|
|
2034
|
+
r.value = v, setTimeout(() => {
|
|
2037
2035
|
v.setTabSize(o), v.setDisabled(e.disabled), v.setReadOnly(e.readonly), v.setExtensions(u()), e.placeholder && v.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && v.setMaxLength(e.maxlength), e.autofocus && d.focus();
|
|
2038
2036
|
}, 0), h.on(a, {
|
|
2039
2037
|
name: "ctrlZ",
|
|
2040
2038
|
callback() {
|
|
2041
|
-
|
|
2039
|
+
Dt(d);
|
|
2042
2040
|
}
|
|
2043
2041
|
}), h.on(a, {
|
|
2044
2042
|
name: "ctrlShiftZ",
|
|
2045
2043
|
callback() {
|
|
2046
|
-
|
|
2044
|
+
Et(d);
|
|
2047
2045
|
}
|
|
2048
2046
|
}), h.on(a, {
|
|
2049
2047
|
name: "replace",
|
|
2050
2048
|
callback(y, b = {}) {
|
|
2051
2049
|
var k;
|
|
2052
|
-
const { text: p, options: g } =
|
|
2053
|
-
(k =
|
|
2050
|
+
const { text: p, options: g } = el(y, r.value, b);
|
|
2051
|
+
(k = r.value) == null || k.replaceSelectedText(p, g);
|
|
2054
2052
|
}
|
|
2055
2053
|
});
|
|
2056
2054
|
}), F(
|
|
2057
2055
|
[l, te(e, "completions")],
|
|
2058
2056
|
() => {
|
|
2059
2057
|
var d;
|
|
2060
|
-
(d =
|
|
2058
|
+
(d = r.value) == null || d.setExtensions(u());
|
|
2061
2059
|
},
|
|
2062
2060
|
{
|
|
2063
2061
|
deep: !0
|
|
@@ -2066,37 +2064,37 @@ const Dl = (e) => {
|
|
|
2066
2064
|
() => e.value,
|
|
2067
2065
|
() => {
|
|
2068
2066
|
var d, v;
|
|
2069
|
-
((d =
|
|
2067
|
+
((d = r.value) == null ? void 0 : d.getValue()) !== e.value && ((v = r.value) == null || v.setValue(e.value));
|
|
2070
2068
|
}
|
|
2071
2069
|
), F(
|
|
2072
2070
|
() => e.placeholder,
|
|
2073
2071
|
() => {
|
|
2074
2072
|
var d;
|
|
2075
|
-
(d =
|
|
2073
|
+
(d = r.value) == null || d.setPlaceholder(e.placeholder);
|
|
2076
2074
|
}
|
|
2077
2075
|
), F(
|
|
2078
2076
|
() => e.disabled,
|
|
2079
2077
|
() => {
|
|
2080
2078
|
var d;
|
|
2081
|
-
(d =
|
|
2079
|
+
(d = r.value) == null || d.setDisabled(e.disabled);
|
|
2082
2080
|
}
|
|
2083
2081
|
), F(
|
|
2084
2082
|
() => e.readonly,
|
|
2085
2083
|
() => {
|
|
2086
2084
|
var d;
|
|
2087
|
-
(d =
|
|
2085
|
+
(d = r.value) == null || d.setDisabled(e.readonly);
|
|
2088
2086
|
}
|
|
2089
2087
|
), F(
|
|
2090
2088
|
() => e.maxlength,
|
|
2091
2089
|
() => {
|
|
2092
2090
|
var d;
|
|
2093
|
-
e.maxlength && ((d =
|
|
2091
|
+
e.maxlength && ((d = r.value) == null || d.setMaxLength(e.maxlength));
|
|
2094
2092
|
}
|
|
2095
|
-
),
|
|
2096
|
-
inputWrapperRef:
|
|
2097
|
-
codeMirrorUt:
|
|
2093
|
+
), El(r), {
|
|
2094
|
+
inputWrapperRef: i,
|
|
2095
|
+
codeMirrorUt: r
|
|
2098
2096
|
};
|
|
2099
|
-
},
|
|
2097
|
+
}, Fl = Bl, Ol = {
|
|
2100
2098
|
value: {
|
|
2101
2099
|
type: String,
|
|
2102
2100
|
default: ""
|
|
@@ -2188,25 +2186,32 @@ const Dl = (e) => {
|
|
|
2188
2186
|
},
|
|
2189
2187
|
completions: {
|
|
2190
2188
|
type: Array
|
|
2189
|
+
},
|
|
2190
|
+
catalogVisible: {
|
|
2191
|
+
type: Boolean
|
|
2192
|
+
},
|
|
2193
|
+
theme: {
|
|
2194
|
+
type: String,
|
|
2195
|
+
default: "light"
|
|
2191
2196
|
}
|
|
2192
|
-
},
|
|
2197
|
+
}, Vl = /* @__PURE__ */ O({
|
|
2193
2198
|
name: "MDEditorContent",
|
|
2194
|
-
props:
|
|
2199
|
+
props: Ol,
|
|
2195
2200
|
setup(e) {
|
|
2196
|
-
const o = G(""), {
|
|
2197
|
-
inputWrapperRef:
|
|
2198
|
-
codeMirrorUt:
|
|
2199
|
-
} =
|
|
2200
|
-
return
|
|
2201
|
+
const o = S("editorId"), a = G(""), {
|
|
2202
|
+
inputWrapperRef: l,
|
|
2203
|
+
codeMirrorUt: i
|
|
2204
|
+
} = Fl(e);
|
|
2205
|
+
return Qt(e, a, i), () => t("div", {
|
|
2201
2206
|
class: `${n}-content`
|
|
2202
2207
|
}, [t("div", {
|
|
2203
2208
|
class: `${n}-input-wrapper`,
|
|
2204
|
-
ref:
|
|
2209
|
+
ref: l
|
|
2205
2210
|
}, null), t(ut, {
|
|
2206
2211
|
modelValue: e.value,
|
|
2207
2212
|
setting: e.setting,
|
|
2208
2213
|
onHtmlChanged: (r) => {
|
|
2209
|
-
|
|
2214
|
+
a.value = r, e.onHtmlChanged(r);
|
|
2210
2215
|
},
|
|
2211
2216
|
onGetCatalog: e.onGetCatalog,
|
|
2212
2217
|
mdHeadingId: e.mdHeadingId,
|
|
@@ -2215,9 +2220,15 @@ const Dl = (e) => {
|
|
|
2215
2220
|
noKatex: e.noKatex,
|
|
2216
2221
|
formatCopiedText: e.formatCopiedText,
|
|
2217
2222
|
noHighlight: e.noHighlight
|
|
2223
|
+
}, null), e.catalogVisible && t(Ye, {
|
|
2224
|
+
theme: e.theme,
|
|
2225
|
+
class: `${n}-catalog-editor`,
|
|
2226
|
+
editorId: o,
|
|
2227
|
+
mdHeadingId: e.mdHeadingId,
|
|
2228
|
+
key: "internal-catalog"
|
|
2218
2229
|
}, null)]);
|
|
2219
2230
|
}
|
|
2220
|
-
}),
|
|
2231
|
+
}), Rl = /* @__PURE__ */ O({
|
|
2221
2232
|
props: {
|
|
2222
2233
|
modelValue: {
|
|
2223
2234
|
type: String,
|
|
@@ -2225,7 +2236,7 @@ const Dl = (e) => {
|
|
|
2225
2236
|
}
|
|
2226
2237
|
},
|
|
2227
2238
|
setup(e) {
|
|
2228
|
-
const o =
|
|
2239
|
+
const o = S("usedLanguageText");
|
|
2229
2240
|
return () => {
|
|
2230
2241
|
var a, l;
|
|
2231
2242
|
return t("div", {
|
|
@@ -2235,7 +2246,7 @@ const Dl = (e) => {
|
|
|
2235
2246
|
}, [`${(a = o.value.footer) == null ? void 0 : a.markdownTotal}:`]), t("span", null, [((l = e.modelValue) == null ? void 0 : l.length) || 0])]);
|
|
2236
2247
|
};
|
|
2237
2248
|
}
|
|
2238
|
-
}),
|
|
2249
|
+
}), Pl = {
|
|
2239
2250
|
checked: {
|
|
2240
2251
|
type: Boolean,
|
|
2241
2252
|
default: !1
|
|
@@ -2245,8 +2256,8 @@ const Dl = (e) => {
|
|
|
2245
2256
|
default: () => {
|
|
2246
2257
|
}
|
|
2247
2258
|
}
|
|
2248
|
-
},
|
|
2249
|
-
props:
|
|
2259
|
+
}, Nl = /* @__PURE__ */ O({
|
|
2260
|
+
props: Pl,
|
|
2250
2261
|
setup(e) {
|
|
2251
2262
|
return () => t("div", {
|
|
2252
2263
|
class: [`${n}-checkbox`, e.checked && `${n}-checkbox-checked`],
|
|
@@ -2255,7 +2266,7 @@ const Dl = (e) => {
|
|
|
2255
2266
|
}
|
|
2256
2267
|
}, null);
|
|
2257
2268
|
}
|
|
2258
|
-
}),
|
|
2269
|
+
}), ql = {
|
|
2259
2270
|
scrollAuto: {
|
|
2260
2271
|
type: Boolean
|
|
2261
2272
|
},
|
|
@@ -2264,10 +2275,10 @@ const Dl = (e) => {
|
|
|
2264
2275
|
default: () => {
|
|
2265
2276
|
}
|
|
2266
2277
|
}
|
|
2267
|
-
},
|
|
2268
|
-
props:
|
|
2278
|
+
}, Ul = /* @__PURE__ */ O({
|
|
2279
|
+
props: ql,
|
|
2269
2280
|
setup(e) {
|
|
2270
|
-
const o =
|
|
2281
|
+
const o = S("usedLanguageText");
|
|
2271
2282
|
return () => {
|
|
2272
2283
|
var a;
|
|
2273
2284
|
return t("div", {
|
|
@@ -2277,13 +2288,13 @@ const Dl = (e) => {
|
|
|
2277
2288
|
onClick: () => {
|
|
2278
2289
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2279
2290
|
}
|
|
2280
|
-
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(
|
|
2291
|
+
}, [(a = o.value.footer) == null ? void 0 : a.scrollAuto]), t(Nl, {
|
|
2281
2292
|
checked: e.scrollAuto,
|
|
2282
2293
|
onChange: e.onScrollAutoChange
|
|
2283
2294
|
}, null)]);
|
|
2284
2295
|
};
|
|
2285
2296
|
}
|
|
2286
|
-
}),
|
|
2297
|
+
}), Gl = {
|
|
2287
2298
|
modelValue: {
|
|
2288
2299
|
type: String,
|
|
2289
2300
|
default: ""
|
|
@@ -2303,22 +2314,22 @@ const Dl = (e) => {
|
|
|
2303
2314
|
defFooters: {
|
|
2304
2315
|
type: Object
|
|
2305
2316
|
}
|
|
2306
|
-
},
|
|
2317
|
+
}, Kl = /* @__PURE__ */ O({
|
|
2307
2318
|
name: "MDEditorFooter",
|
|
2308
|
-
props:
|
|
2319
|
+
props: Gl,
|
|
2309
2320
|
setup(e) {
|
|
2310
2321
|
const o = fe(() => {
|
|
2311
|
-
const l = e.footers.indexOf("="),
|
|
2312
|
-
return [
|
|
2322
|
+
const l = e.footers.indexOf("="), i = l === -1 ? e.footers : e.footers.slice(0, l), r = l === -1 ? [] : e.footers.slice(l, Number.MAX_SAFE_INTEGER);
|
|
2323
|
+
return [i, r];
|
|
2313
2324
|
}), a = (l) => {
|
|
2314
2325
|
if (lt.includes(l))
|
|
2315
2326
|
switch (l) {
|
|
2316
2327
|
case "markdownTotal":
|
|
2317
|
-
return t(
|
|
2328
|
+
return t(Rl, {
|
|
2318
2329
|
modelValue: e.modelValue
|
|
2319
2330
|
}, null);
|
|
2320
2331
|
case "scrollSwitch":
|
|
2321
|
-
return t(
|
|
2332
|
+
return t(Ul, {
|
|
2322
2333
|
scrollAuto: e.scrollAuto,
|
|
2323
2334
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2324
2335
|
}, null);
|
|
@@ -2327,17 +2338,17 @@ const Dl = (e) => {
|
|
|
2327
2338
|
return e.defFooters instanceof Array ? e.defFooters[l] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[l] || "";
|
|
2328
2339
|
};
|
|
2329
2340
|
return () => {
|
|
2330
|
-
const l = o.value[0].map((
|
|
2341
|
+
const l = o.value[0].map((r) => a(r)), i = o.value[1].map((r) => a(r));
|
|
2331
2342
|
return t("div", {
|
|
2332
2343
|
class: `${n}-footer`
|
|
2333
2344
|
}, [t("div", {
|
|
2334
2345
|
class: `${n}-footer-left`
|
|
2335
2346
|
}, [l]), t("div", {
|
|
2336
2347
|
class: `${n}-footer-right`
|
|
2337
|
-
}, [
|
|
2348
|
+
}, [i])]);
|
|
2338
2349
|
};
|
|
2339
2350
|
}
|
|
2340
|
-
}),
|
|
2351
|
+
}), jl = /* @__PURE__ */ O({
|
|
2341
2352
|
name: "MdEditorV3",
|
|
2342
2353
|
props: mt,
|
|
2343
2354
|
emits: ft,
|
|
@@ -2345,8 +2356,8 @@ const Dl = (e) => {
|
|
|
2345
2356
|
const {
|
|
2346
2357
|
editorId: a,
|
|
2347
2358
|
noKatex: l,
|
|
2348
|
-
noMermaid:
|
|
2349
|
-
noPrettier:
|
|
2359
|
+
noMermaid: i,
|
|
2360
|
+
noPrettier: r,
|
|
2350
2361
|
noUploadImg: c,
|
|
2351
2362
|
noHighlight: m
|
|
2352
2363
|
} = e, f = Z({
|
|
@@ -2369,8 +2380,8 @@ const Dl = (e) => {
|
|
|
2369
2380
|
id: a,
|
|
2370
2381
|
class: [n, e.class, e.theme === "dark" && `${n}-dark`, u.fullscreen || u.pageFullscreen ? `${n}-fullscreen` : ""],
|
|
2371
2382
|
style: e.style
|
|
2372
|
-
}, [t(
|
|
2373
|
-
noPrettier:
|
|
2383
|
+
}, [t(Yt, {
|
|
2384
|
+
noPrettier: r,
|
|
2374
2385
|
toolbars: e.toolbars,
|
|
2375
2386
|
toolbarsExclude: e.toolbarsExclude,
|
|
2376
2387
|
setting: u,
|
|
@@ -2378,12 +2389,12 @@ const Dl = (e) => {
|
|
|
2378
2389
|
tableShape: e.tableShape,
|
|
2379
2390
|
defToolbars: y,
|
|
2380
2391
|
noUploadImg: c
|
|
2381
|
-
}, null), t(
|
|
2392
|
+
}, null), t(Vl, {
|
|
2382
2393
|
value: e.modelValue,
|
|
2383
2394
|
setting: u,
|
|
2384
2395
|
mdHeadingId: e.mdHeadingId,
|
|
2385
|
-
noMermaid:
|
|
2386
|
-
noPrettier:
|
|
2396
|
+
noMermaid: i,
|
|
2397
|
+
noPrettier: r,
|
|
2387
2398
|
sanitize: e.sanitize,
|
|
2388
2399
|
placeholder: e.placeholder,
|
|
2389
2400
|
noKatex: l,
|
|
@@ -2410,24 +2421,20 @@ const Dl = (e) => {
|
|
|
2410
2421
|
onFocus: (g) => {
|
|
2411
2422
|
e.onFocus ? e.onFocus(g) : o.emit("onFocus", g);
|
|
2412
2423
|
},
|
|
2413
|
-
completions: e.completions
|
|
2414
|
-
|
|
2424
|
+
completions: e.completions,
|
|
2425
|
+
catalogVisible: v.value,
|
|
2426
|
+
theme: e.theme
|
|
2427
|
+
}, null), ((p = e.footers) == null ? void 0 : p.length) > 0 && t(Kl, {
|
|
2415
2428
|
modelValue: e.modelValue,
|
|
2416
2429
|
footers: e.footers,
|
|
2417
2430
|
defFooters: b,
|
|
2418
2431
|
scrollAuto: f.scrollAuto,
|
|
2419
2432
|
onScrollAutoChange: (g) => f.scrollAuto = g
|
|
2420
|
-
}, null), v.value && t(Ye, {
|
|
2421
|
-
theme: e.theme,
|
|
2422
|
-
class: `${n}-catalog-editor`,
|
|
2423
|
-
editorId: a,
|
|
2424
|
-
mdHeadingId: e.mdHeadingId,
|
|
2425
|
-
key: "internal-catalog"
|
|
2426
2433
|
}, null)]);
|
|
2427
2434
|
};
|
|
2428
2435
|
}
|
|
2429
|
-
}), ue =
|
|
2430
|
-
ue.install = (e) => (e.component(ue.name, ue), e.use(
|
|
2436
|
+
}), ue = jl;
|
|
2437
|
+
ue.install = (e) => (e.component(ue.name, ue), e.use(Ot).use(ot).use(yt).use(Ye).use(Ct), e);
|
|
2431
2438
|
export {
|
|
2432
2439
|
ue as default
|
|
2433
2440
|
};
|