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