md-editor-v3 4.3.0-beta.5 → 4.3.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/lib/cjs/MdEditor.cjs +15 -15
- package/lib/es/MdEditor.mjs +431 -428
- package/lib/types/MdEditor/layouts/Content/codemirror/index.d.ts +1 -0
- package/lib/umd/index.js +10 -10
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
1
|
var wt = Object.defineProperty;
|
|
2
2
|
var xt = (e, a, l) => a in e ? wt(e, a, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[a] = l;
|
|
3
|
-
var
|
|
4
|
-
import { defineComponent as V, createVNode as t, inject as A, ref as
|
|
5
|
-
import { p as o, a as z, s as Mt, b as Lt, d as
|
|
6
|
-
import { draggingScroll as
|
|
7
|
-
import { a as te, D as
|
|
8
|
-
import { b as
|
|
9
|
-
import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as
|
|
10
|
-
import { a as
|
|
3
|
+
var P = (e, a, l) => (xt(e, typeof a != "symbol" ? a + "" : a, l), l);
|
|
4
|
+
import { defineComponent as V, createVNode as t, inject as A, ref as U, onMounted as X, reactive as Z, computed as fe, watch as H, nextTick as ce, Fragment as kt, cloneVNode as at, toRef as le, shallowRef as St, onBeforeUnmount as At } from "vue";
|
|
5
|
+
import { p as o, a as z, s as Mt, b as Lt, d as It } from "./chunks/config.mjs";
|
|
6
|
+
import { draggingScroll as Dt, linkTo as Et, debounce as Nt, throttle as Ht, smoothScroll as nt } from "@vavt/util";
|
|
7
|
+
import { a as te, D as Ft } from "./chunks/index2.mjs";
|
|
8
|
+
import { b as f, a as Bt } from "./chunks/index3.mjs";
|
|
9
|
+
import { C as Vt, a as Ot, O as pt, T as Rt, b as Pt, e as qt, c as Ut, u as Gt, d as Kt, f as jt, g as _t, h as Wt, i as zt, j as Xt, M as Yt } from "./chunks/index.mjs";
|
|
10
|
+
import { a as Zt } from "./chunks/dom.mjs";
|
|
11
11
|
import Ct from "./MdModal.mjs";
|
|
12
|
-
import { minimalSetup as
|
|
12
|
+
import { minimalSetup as Jt, EditorView as ie } from "codemirror";
|
|
13
13
|
import { EditorView as be, placeholder as Qt, keymap as el } from "@codemirror/view";
|
|
14
14
|
import { languages as tl } from "@codemirror/language-data";
|
|
15
15
|
import { markdown as ll } from "@codemirror/lang-markdown";
|
|
16
16
|
import { htmlCompletionSource as ol, html as al } from "@codemirror/lang-html";
|
|
17
|
-
import { deleteLine as
|
|
17
|
+
import { deleteLine as nl, indentWithTab as rl, undo as il, redo as sl } from "@codemirror/commands";
|
|
18
18
|
import { HighlightStyle as $t, syntaxHighlighting as yt, indentUnit as cl } from "@codemirror/language";
|
|
19
19
|
import { tags as s } from "@lezer/highlight";
|
|
20
|
-
import { EditorSelection as
|
|
20
|
+
import { EditorSelection as q, EditorState as ue, Compartment as dl, StateEffect as ul } from "@codemirror/state";
|
|
21
21
|
import { autocompletion as ml } from "@codemirror/autocomplete";
|
|
22
22
|
import Tt from "./MdCatalog.mjs";
|
|
23
|
-
import { g as
|
|
24
|
-
import
|
|
25
|
-
import
|
|
23
|
+
import { g as rt } from "./chunks/vue-tsx.mjs";
|
|
24
|
+
import gl from "./NormalToolbar.mjs";
|
|
25
|
+
import hl from "./ModalToolbar.mjs";
|
|
26
26
|
import "medium-zoom";
|
|
27
27
|
import "copy-to-clipboard";
|
|
28
28
|
import "markdown-it";
|
|
29
29
|
import "markdown-it-image-figures";
|
|
30
30
|
import "markdown-it-task-lists";
|
|
31
31
|
import "lru-cache";
|
|
32
|
-
const
|
|
32
|
+
const fl = /* @__PURE__ */ V({
|
|
33
33
|
setup() {
|
|
34
34
|
return () => t("div", {
|
|
35
35
|
class: `${o}-divider`
|
|
@@ -85,32 +85,32 @@ const hl = /* @__PURE__ */ V({
|
|
|
85
85
|
type: Boolean
|
|
86
86
|
}
|
|
87
87
|
}, vl = (e) => {
|
|
88
|
-
var c,
|
|
88
|
+
var c, g, m, b;
|
|
89
89
|
const a = A("editorId");
|
|
90
|
-
let l = (
|
|
91
|
-
const
|
|
90
|
+
let l = (g = (c = z.editorExtensions) == null ? void 0 : c.screenfull) == null ? void 0 : g.instance;
|
|
91
|
+
const n = (b = (m = z.editorExtensions) == null ? void 0 : m.screenfull) == null ? void 0 : b.js, r = U(!1), i = ($) => {
|
|
92
92
|
if (!l) {
|
|
93
|
-
|
|
93
|
+
f.emit(a, "errorCatcher", {
|
|
94
94
|
name: "fullscreen",
|
|
95
95
|
message: "fullscreen is undefined"
|
|
96
96
|
});
|
|
97
97
|
return;
|
|
98
98
|
}
|
|
99
|
-
l.isEnabled ? (
|
|
99
|
+
l.isEnabled ? (r.value = !0, ($ === void 0 ? !l.isFullscreen : $) ? l.request() : l.exit()) : console.error("browser does not support screenfull!");
|
|
100
100
|
}, u = () => {
|
|
101
101
|
l && l.isEnabled && l.on("change", () => {
|
|
102
|
-
(
|
|
102
|
+
(r.value || e.setting.fullscreen) && (r.value = !1, e.updateSetting("fullscreen"));
|
|
103
103
|
});
|
|
104
104
|
}, d = () => {
|
|
105
105
|
l = window.screenfull, u();
|
|
106
106
|
};
|
|
107
|
-
return
|
|
107
|
+
return X(() => {
|
|
108
108
|
if (u(), !l) {
|
|
109
109
|
const $ = document.createElement("script");
|
|
110
|
-
$.src =
|
|
110
|
+
$.src = n || Mt, $.onload = d, $.id = `${o}-screenfull`, Zt($, "screenfull");
|
|
111
111
|
}
|
|
112
|
-
}),
|
|
113
|
-
|
|
112
|
+
}), X(() => {
|
|
113
|
+
f.on(a, {
|
|
114
114
|
name: Vt,
|
|
115
115
|
callback: i
|
|
116
116
|
});
|
|
@@ -129,7 +129,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
129
129
|
name: "TableShape",
|
|
130
130
|
props: kl,
|
|
131
131
|
setup(e) {
|
|
132
|
-
const a =
|
|
132
|
+
const a = Z({
|
|
133
133
|
x: -1,
|
|
134
134
|
y: -1
|
|
135
135
|
});
|
|
@@ -138,20 +138,20 @@ const hl = /* @__PURE__ */ V({
|
|
|
138
138
|
onMouseleave: () => {
|
|
139
139
|
a.x = -1, a.y = -1;
|
|
140
140
|
}
|
|
141
|
-
}, [new Array(e.tableShape[1]).fill("").map((l,
|
|
141
|
+
}, [new Array(e.tableShape[1]).fill("").map((l, n) => t("div", {
|
|
142
142
|
class: `${o}-table-shape-row`,
|
|
143
|
-
key: `table-shape-row-${
|
|
144
|
-
}, [new Array(e.tableShape[0]).fill("").map((
|
|
143
|
+
key: `table-shape-row-${n}`
|
|
144
|
+
}, [new Array(e.tableShape[0]).fill("").map((r, i) => t("div", {
|
|
145
145
|
class: `${o}-table-shape-col`,
|
|
146
146
|
key: `table-shape-col-${i}`,
|
|
147
147
|
onMouseenter: () => {
|
|
148
|
-
a.x =
|
|
148
|
+
a.x = n, a.y = i;
|
|
149
149
|
},
|
|
150
150
|
onClick: () => {
|
|
151
151
|
e.onSelected(a);
|
|
152
152
|
}
|
|
153
153
|
}, [t("div", {
|
|
154
|
-
class: [`${o}-table-shape-col-default`,
|
|
154
|
+
class: [`${o}-table-shape-col-default`, n <= a.x && i <= a.y && `${o}-table-shape-col-include`]
|
|
155
155
|
}, null)]))]))]);
|
|
156
156
|
}
|
|
157
157
|
}), Cl = pl, $l = {
|
|
@@ -176,7 +176,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
176
176
|
}, yl = /* @__PURE__ */ V({
|
|
177
177
|
props: $l,
|
|
178
178
|
setup(e) {
|
|
179
|
-
const a = A("usedLanguageText"), l = A("editorId"),
|
|
179
|
+
const a = A("usedLanguageText"), l = A("editorId"), n = fe(() => {
|
|
180
180
|
var i, u;
|
|
181
181
|
switch (e.type) {
|
|
182
182
|
case "link":
|
|
@@ -186,21 +186,21 @@ const hl = /* @__PURE__ */ V({
|
|
|
186
186
|
default:
|
|
187
187
|
return "";
|
|
188
188
|
}
|
|
189
|
-
}),
|
|
189
|
+
}), r = Z({
|
|
190
190
|
desc: "",
|
|
191
191
|
url: ""
|
|
192
192
|
});
|
|
193
193
|
return H(() => e.visible, (i) => {
|
|
194
194
|
i || setTimeout(() => {
|
|
195
|
-
|
|
195
|
+
r.desc = "", r.url = "";
|
|
196
196
|
}, 200);
|
|
197
197
|
}), () => t(Ct, {
|
|
198
|
-
title:
|
|
198
|
+
title: n.value,
|
|
199
199
|
visible: e.visible,
|
|
200
200
|
onClose: e.onCancel
|
|
201
201
|
}, {
|
|
202
202
|
default: () => {
|
|
203
|
-
var i, u, d, c,
|
|
203
|
+
var i, u, d, c, g;
|
|
204
204
|
return [t("div", {
|
|
205
205
|
class: `${o}-form-item`
|
|
206
206
|
}, [t("label", {
|
|
@@ -211,9 +211,9 @@ const hl = /* @__PURE__ */ V({
|
|
|
211
211
|
class: `${o}-input`,
|
|
212
212
|
id: `link-desc-${l}`,
|
|
213
213
|
type: "text",
|
|
214
|
-
value:
|
|
214
|
+
value: r.desc,
|
|
215
215
|
onChange: (m) => {
|
|
216
|
-
|
|
216
|
+
r.desc = m.target.value;
|
|
217
217
|
},
|
|
218
218
|
autocomplete: "off"
|
|
219
219
|
}, null)]), t("div", {
|
|
@@ -226,9 +226,9 @@ const hl = /* @__PURE__ */ V({
|
|
|
226
226
|
class: `${o}-input`,
|
|
227
227
|
id: `link-url-${l}`,
|
|
228
228
|
type: "text",
|
|
229
|
-
value:
|
|
229
|
+
value: r.url,
|
|
230
230
|
onChange: (m) => {
|
|
231
|
-
|
|
231
|
+
r.url = m.target.value;
|
|
232
232
|
},
|
|
233
233
|
autocomplete: "off"
|
|
234
234
|
}, null)]), t("div", {
|
|
@@ -237,9 +237,9 @@ const hl = /* @__PURE__ */ V({
|
|
|
237
237
|
class: [`${o}-btn`, `${o}-btn-row`],
|
|
238
238
|
type: "button",
|
|
239
239
|
onClick: () => {
|
|
240
|
-
e.onOk(
|
|
240
|
+
e.onOk(r), r.desc = "", r.url = "";
|
|
241
241
|
}
|
|
242
|
-
}, [(
|
|
242
|
+
}, [(g = a.value.linkModalTips) == null ? void 0 : g.buttonOK])])];
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
245
|
}
|
|
@@ -263,8 +263,8 @@ const hl = /* @__PURE__ */ V({
|
|
|
263
263
|
setup(e) {
|
|
264
264
|
var m, b, $;
|
|
265
265
|
const a = A("usedLanguageText"), l = A("editorId");
|
|
266
|
-
let
|
|
267
|
-
const
|
|
266
|
+
let n = ($ = (b = (m = z) == null ? void 0 : m.editorExtensions) == null ? void 0 : b.cropper) == null ? void 0 : $.instance;
|
|
267
|
+
const r = U(), i = U(), u = U(), d = Z({
|
|
268
268
|
cropperInited: !1,
|
|
269
269
|
imgSelected: !1,
|
|
270
270
|
imgSrc: "",
|
|
@@ -273,20 +273,20 @@ const hl = /* @__PURE__ */ V({
|
|
|
273
273
|
});
|
|
274
274
|
let c = null;
|
|
275
275
|
H(() => e.visible, () => {
|
|
276
|
-
e.visible && !d.cropperInited && (
|
|
277
|
-
if (!
|
|
278
|
-
|
|
276
|
+
e.visible && !d.cropperInited && (n = n || window.Cropper, r.value.onchange = () => {
|
|
277
|
+
if (!n) {
|
|
278
|
+
f.emit(l, "errorCatcher", {
|
|
279
279
|
name: "Cropper",
|
|
280
280
|
message: "Cropper is undefined"
|
|
281
281
|
});
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
284
|
-
const T =
|
|
284
|
+
const T = r.value.files || [];
|
|
285
285
|
if (d.imgSelected = !0, (T == null ? void 0 : T.length) > 0) {
|
|
286
286
|
const v = new FileReader();
|
|
287
|
-
v.onload = (
|
|
288
|
-
d.imgSrc =
|
|
289
|
-
c = new
|
|
287
|
+
v.onload = (h) => {
|
|
288
|
+
d.imgSrc = h.target.result, ce(() => {
|
|
289
|
+
c = new n(i.value, {
|
|
290
290
|
viewMode: 2,
|
|
291
291
|
preview: `.${o}-clip-preview-target`
|
|
292
292
|
// aspectRatio: 16 / 9,
|
|
@@ -299,15 +299,15 @@ const hl = /* @__PURE__ */ V({
|
|
|
299
299
|
u.value.style = "";
|
|
300
300
|
}), H(() => d.isFullscreen, () => {
|
|
301
301
|
ce(() => {
|
|
302
|
-
c == null || c.destroy(), u.value.style = "", i.value && (c = new
|
|
302
|
+
c == null || c.destroy(), u.value.style = "", i.value && (c = new n(i.value, {
|
|
303
303
|
viewMode: 2,
|
|
304
304
|
preview: `.${o}-clip-preview-target`
|
|
305
305
|
// aspectRatio: 16 / 9,
|
|
306
306
|
}));
|
|
307
307
|
});
|
|
308
308
|
});
|
|
309
|
-
const
|
|
310
|
-
c.clear(), c.destroy(), c = null,
|
|
309
|
+
const g = () => {
|
|
310
|
+
c.clear(), c.destroy(), c = null, r.value.value = "", d.imgSelected = !1;
|
|
311
311
|
};
|
|
312
312
|
return () => {
|
|
313
313
|
var T;
|
|
@@ -325,7 +325,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
325
325
|
height: "421px"
|
|
326
326
|
}, {
|
|
327
327
|
default: () => {
|
|
328
|
-
var v,
|
|
328
|
+
var v, h;
|
|
329
329
|
return [t("div", {
|
|
330
330
|
class: `${o}-form-item ${o}-clip`
|
|
331
331
|
}, [t("div", {
|
|
@@ -341,7 +341,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
341
341
|
alt: ""
|
|
342
342
|
}, null), t("div", {
|
|
343
343
|
class: `${o}-clip-delete`,
|
|
344
|
-
onClick:
|
|
344
|
+
onClick: g
|
|
345
345
|
}, [t("svg", {
|
|
346
346
|
class: `${o}-icon`,
|
|
347
347
|
"aria-hidden": "true"
|
|
@@ -350,7 +350,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
350
350
|
}, null)])])]) : t("div", {
|
|
351
351
|
class: `${o}-clip-upload`,
|
|
352
352
|
onClick: () => {
|
|
353
|
-
|
|
353
|
+
r.value.click();
|
|
354
354
|
}
|
|
355
355
|
}, [t("svg", {
|
|
356
356
|
class: `${o}-icon`,
|
|
@@ -370,11 +370,11 @@ const hl = /* @__PURE__ */ V({
|
|
|
370
370
|
onClick: () => {
|
|
371
371
|
if (c) {
|
|
372
372
|
const k = c.getCroppedCanvas();
|
|
373
|
-
|
|
373
|
+
f.emit(l, "uploadImage", [Bt(k.toDataURL("image/png"))], e.onOk), g();
|
|
374
374
|
}
|
|
375
375
|
}
|
|
376
|
-
}, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((
|
|
377
|
-
ref:
|
|
376
|
+
}, [((v = a.value.clipModalTips) == null ? void 0 : v.buttonUpload) || ((h = a.value.linkModalTips) == null ? void 0 : h.buttonOK)])]), t("input", {
|
|
377
|
+
ref: r,
|
|
378
378
|
accept: "image/*",
|
|
379
379
|
type: "file",
|
|
380
380
|
multiple: !1,
|
|
@@ -428,8 +428,8 @@ const hl = /* @__PURE__ */ V({
|
|
|
428
428
|
props: bl,
|
|
429
429
|
setup(e) {
|
|
430
430
|
const a = A("editorId"), l = A("usedLanguageText"), {
|
|
431
|
-
fullscreenHandler:
|
|
432
|
-
} = vl(e),
|
|
431
|
+
fullscreenHandler: n
|
|
432
|
+
} = vl(e), r = `${a}-toolbar-wrapper`, i = U(), u = Z({
|
|
433
433
|
title: !1,
|
|
434
434
|
catalog: !1,
|
|
435
435
|
// 图片上传下拉
|
|
@@ -439,40 +439,40 @@ const hl = /* @__PURE__ */ V({
|
|
|
439
439
|
// mermaid
|
|
440
440
|
mermaid: !1,
|
|
441
441
|
katex: !1
|
|
442
|
-
}), d = (v,
|
|
443
|
-
|
|
444
|
-
}, c =
|
|
442
|
+
}), d = (v, h) => {
|
|
443
|
+
f.emit(a, "replace", v, h);
|
|
444
|
+
}, c = Z({
|
|
445
445
|
type: "link",
|
|
446
446
|
linkVisible: !1,
|
|
447
447
|
clipVisible: !1
|
|
448
|
-
}),
|
|
449
|
-
|
|
450
|
-
|
|
448
|
+
}), g = U();
|
|
449
|
+
X(() => {
|
|
450
|
+
f.on(a, {
|
|
451
451
|
name: "openModals",
|
|
452
452
|
callback(v) {
|
|
453
453
|
c.type = v, c.linkVisible = !0;
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
456
|
});
|
|
457
|
-
const m =
|
|
458
|
-
const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)),
|
|
457
|
+
const m = fe(() => {
|
|
458
|
+
const v = e.toolbars.filter((w) => !e.toolbarsExclude.includes(w)), h = v.indexOf("="), k = h === -1 ? v : v.slice(0, h + 1), y = h === -1 ? [] : v.slice(h, Number.MAX_SAFE_INTEGER);
|
|
459
459
|
return [k, y];
|
|
460
|
-
}), b =
|
|
461
|
-
|
|
460
|
+
}), b = U(), $ = () => {
|
|
461
|
+
f.emit(a, "uploadImage", Array.from(b.value.files || [])), b.value.value = "";
|
|
462
462
|
};
|
|
463
|
-
|
|
463
|
+
X(() => {
|
|
464
464
|
b.value.addEventListener("change", $);
|
|
465
465
|
});
|
|
466
466
|
const T = (v) => {
|
|
467
|
-
var
|
|
467
|
+
var h, k, y, w, x, L, C, M, R, I, D, O, F, E, j, G, ne, J, _, K, Q, W, N, B, ee, re, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, Ie, De, Ee, Ne, He, Fe, Be, Ve, Oe, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Xe, Ye, Ze, Je, Qe, et, tt, lt, ot;
|
|
468
468
|
if (Lt.includes(v))
|
|
469
469
|
switch (v) {
|
|
470
470
|
case "-":
|
|
471
|
-
return t(
|
|
471
|
+
return t(fl, null, null);
|
|
472
472
|
case "bold":
|
|
473
473
|
return t("div", {
|
|
474
474
|
class: `${o}-toolbar-item`,
|
|
475
|
-
title: (
|
|
475
|
+
title: (h = l.value.toolbarTips) == null ? void 0 : h.bold,
|
|
476
476
|
onClick: () => {
|
|
477
477
|
d("bold");
|
|
478
478
|
}
|
|
@@ -531,7 +531,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
531
531
|
}, [(M = l.value.toolbarTips) == null ? void 0 : M.strikeThrough])]);
|
|
532
532
|
case "title":
|
|
533
533
|
return t(te, {
|
|
534
|
-
relative: `#${
|
|
534
|
+
relative: `#${r}`,
|
|
535
535
|
visible: u.title,
|
|
536
536
|
onChange: (p) => {
|
|
537
537
|
u.title = p;
|
|
@@ -551,12 +551,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
551
551
|
onClick: () => {
|
|
552
552
|
d("h2");
|
|
553
553
|
}
|
|
554
|
-
}, [(
|
|
554
|
+
}, [(I = l.value.titleItem) == null ? void 0 : I.h2]), t("li", {
|
|
555
555
|
class: `${o}-menu-item`,
|
|
556
556
|
onClick: () => {
|
|
557
557
|
d("h3");
|
|
558
558
|
}
|
|
559
|
-
}, [(
|
|
559
|
+
}, [(D = l.value.titleItem) == null ? void 0 : D.h3]), t("li", {
|
|
560
560
|
class: `${o}-menu-item`,
|
|
561
561
|
onClick: () => {
|
|
562
562
|
d("h4");
|
|
@@ -566,12 +566,12 @@ const hl = /* @__PURE__ */ V({
|
|
|
566
566
|
onClick: () => {
|
|
567
567
|
d("h5");
|
|
568
568
|
}
|
|
569
|
-
}, [(
|
|
569
|
+
}, [(F = l.value.titleItem) == null ? void 0 : F.h5]), t("li", {
|
|
570
570
|
class: `${o}-menu-item`,
|
|
571
571
|
onClick: () => {
|
|
572
572
|
d("h6");
|
|
573
573
|
}
|
|
574
|
-
}, [(
|
|
574
|
+
}, [(E = l.value.titleItem) == null ? void 0 : E.h6])])
|
|
575
575
|
}, {
|
|
576
576
|
default: () => {
|
|
577
577
|
var p, S;
|
|
@@ -602,11 +602,11 @@ const hl = /* @__PURE__ */ V({
|
|
|
602
602
|
"xlink:href": "#md-editor-icon-sub"
|
|
603
603
|
}, null)]), e.showToolbarName && t("div", {
|
|
604
604
|
class: `${o}-toolbar-item-name`
|
|
605
|
-
}, [(
|
|
605
|
+
}, [(G = l.value.toolbarTips) == null ? void 0 : G.sub])]);
|
|
606
606
|
case "sup":
|
|
607
607
|
return t("div", {
|
|
608
608
|
class: `${o}-toolbar-item`,
|
|
609
|
-
title: (
|
|
609
|
+
title: (ne = l.value.toolbarTips) == null ? void 0 : ne.sup,
|
|
610
610
|
onClick: () => {
|
|
611
611
|
d("sup");
|
|
612
612
|
}
|
|
@@ -617,7 +617,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
617
617
|
"xlink:href": "#md-editor-icon-sup"
|
|
618
618
|
}, null)]), e.showToolbarName && t("div", {
|
|
619
619
|
class: `${o}-toolbar-item-name`
|
|
620
|
-
}, [(
|
|
620
|
+
}, [(J = l.value.toolbarTips) == null ? void 0 : J.sup])]);
|
|
621
621
|
case "quote":
|
|
622
622
|
return t("div", {
|
|
623
623
|
class: `${o}-toolbar-item`,
|
|
@@ -632,7 +632,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
632
632
|
"xlink:href": "#md-editor-icon-quote"
|
|
633
633
|
}, null)]), e.showToolbarName && t("div", {
|
|
634
634
|
class: `${o}-toolbar-item-name`
|
|
635
|
-
}, [(
|
|
635
|
+
}, [(K = l.value.toolbarTips) == null ? void 0 : K.quote])]);
|
|
636
636
|
case "unorderedList":
|
|
637
637
|
return t("div", {
|
|
638
638
|
class: `${o}-toolbar-item`,
|
|
@@ -651,7 +651,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
651
651
|
case "orderedList":
|
|
652
652
|
return t("div", {
|
|
653
653
|
class: `${o}-toolbar-item`,
|
|
654
|
-
title: (
|
|
654
|
+
title: (N = l.value.toolbarTips) == null ? void 0 : N.orderedList,
|
|
655
655
|
onClick: () => {
|
|
656
656
|
d("orderedList");
|
|
657
657
|
}
|
|
@@ -662,7 +662,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
662
662
|
"xlink:href": "#md-editor-icon-ordered-list"
|
|
663
663
|
}, null)]), e.showToolbarName && t("div", {
|
|
664
664
|
class: `${o}-toolbar-item-name`
|
|
665
|
-
}, [(
|
|
665
|
+
}, [(B = l.value.toolbarTips) == null ? void 0 : B.orderedList])]);
|
|
666
666
|
case "task":
|
|
667
667
|
return t("div", {
|
|
668
668
|
class: `${o}-toolbar-item`,
|
|
@@ -677,7 +677,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
677
677
|
"xlink:href": "#md-editor-icon-task"
|
|
678
678
|
}, null)]), e.showToolbarName && t("div", {
|
|
679
679
|
class: `${o}-toolbar-item-name`
|
|
680
|
-
}, [(
|
|
680
|
+
}, [(re = l.value.toolbarTips) == null ? void 0 : re.task])]);
|
|
681
681
|
case "codeRow":
|
|
682
682
|
return t("div", {
|
|
683
683
|
class: `${o}-toolbar-item`,
|
|
@@ -738,7 +738,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
738
738
|
}, null)]), e.showToolbarName && t("div", {
|
|
739
739
|
class: `${o}-toolbar-item-name`
|
|
740
740
|
}, [(we = l.value.toolbarTips) == null ? void 0 : we.image])]) : t(te, {
|
|
741
|
-
relative: `#${
|
|
741
|
+
relative: `#${r}`,
|
|
742
742
|
visible: u.image,
|
|
743
743
|
onChange: (p) => {
|
|
744
744
|
u.image = p;
|
|
@@ -782,7 +782,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
782
782
|
});
|
|
783
783
|
case "table":
|
|
784
784
|
return t(te, {
|
|
785
|
-
relative: `#${
|
|
785
|
+
relative: `#${r}`,
|
|
786
786
|
visible: u.table,
|
|
787
787
|
onChange: (p) => {
|
|
788
788
|
u.table = p;
|
|
@@ -817,7 +817,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
817
817
|
class: `${o}-toolbar-item`,
|
|
818
818
|
title: (Me = l.value.toolbarTips) == null ? void 0 : Me.revoke,
|
|
819
819
|
onClick: () => {
|
|
820
|
-
|
|
820
|
+
f.emit(a, "ctrlZ");
|
|
821
821
|
}
|
|
822
822
|
}, [t("svg", {
|
|
823
823
|
class: `${o}-icon`,
|
|
@@ -830,9 +830,9 @@ const hl = /* @__PURE__ */ V({
|
|
|
830
830
|
case "next":
|
|
831
831
|
return t("div", {
|
|
832
832
|
class: `${o}-toolbar-item`,
|
|
833
|
-
title: (
|
|
833
|
+
title: (Ie = l.value.toolbarTips) == null ? void 0 : Ie.next,
|
|
834
834
|
onClick: () => {
|
|
835
|
-
|
|
835
|
+
f.emit(a, "ctrlShiftZ");
|
|
836
836
|
}
|
|
837
837
|
}, [t("svg", {
|
|
838
838
|
class: `${o}-icon`,
|
|
@@ -841,13 +841,13 @@ const hl = /* @__PURE__ */ V({
|
|
|
841
841
|
"xlink:href": "#md-editor-icon-next"
|
|
842
842
|
}, null)]), e.showToolbarName && t("div", {
|
|
843
843
|
class: `${o}-toolbar-item-name`
|
|
844
|
-
}, [(
|
|
844
|
+
}, [(De = l.value.toolbarTips) == null ? void 0 : De.next])]);
|
|
845
845
|
case "save":
|
|
846
846
|
return t("div", {
|
|
847
847
|
class: `${o}-toolbar-item`,
|
|
848
|
-
title: (
|
|
848
|
+
title: (Ee = l.value.toolbarTips) == null ? void 0 : Ee.save,
|
|
849
849
|
onClick: () => {
|
|
850
|
-
|
|
850
|
+
f.emit(a, pt);
|
|
851
851
|
}
|
|
852
852
|
}, [t("svg", {
|
|
853
853
|
class: `${o}-icon`,
|
|
@@ -856,7 +856,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
856
856
|
"xlink:href": "#md-editor-icon-baocun"
|
|
857
857
|
}, null)]), e.showToolbarName && t("div", {
|
|
858
858
|
class: `${o}-toolbar-item-name`
|
|
859
|
-
}, [(
|
|
859
|
+
}, [(Ne = l.value.toolbarTips) == null ? void 0 : Ne.save])]);
|
|
860
860
|
case "prettier":
|
|
861
861
|
return e.noPrettier ? "" : t("div", {
|
|
862
862
|
class: `${o}-toolbar-item`,
|
|
@@ -871,11 +871,11 @@ const hl = /* @__PURE__ */ V({
|
|
|
871
871
|
"xlink:href": "#md-editor-icon-prettier"
|
|
872
872
|
}, null)]), e.showToolbarName && t("div", {
|
|
873
873
|
class: `${o}-toolbar-item-name`
|
|
874
|
-
}, [(
|
|
874
|
+
}, [(Fe = l.value.toolbarTips) == null ? void 0 : Fe.prettier])]);
|
|
875
875
|
case "pageFullscreen":
|
|
876
876
|
return !e.setting.fullscreen && t("div", {
|
|
877
877
|
class: `${o}-toolbar-item`,
|
|
878
|
-
title: (
|
|
878
|
+
title: (Be = l.value.toolbarTips) == null ? void 0 : Be.pageFullscreen,
|
|
879
879
|
onClick: () => {
|
|
880
880
|
e.updateSetting("pageFullscreen");
|
|
881
881
|
}
|
|
@@ -892,7 +892,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
892
892
|
class: `${o}-toolbar-item`,
|
|
893
893
|
title: (Oe = l.value.toolbarTips) == null ? void 0 : Oe.fullscreen,
|
|
894
894
|
onClick: () => {
|
|
895
|
-
|
|
895
|
+
n();
|
|
896
896
|
}
|
|
897
897
|
}, [t("svg", {
|
|
898
898
|
class: `${o}-icon`,
|
|
@@ -937,7 +937,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
937
937
|
class: `${o}-toolbar-item`,
|
|
938
938
|
title: (Ke = l.value.toolbarTips) == null ? void 0 : Ke.catalog,
|
|
939
939
|
onClick: () => {
|
|
940
|
-
|
|
940
|
+
f.emit(a, Ot);
|
|
941
941
|
},
|
|
942
942
|
key: "bar-catalog"
|
|
943
943
|
}, [t("svg", {
|
|
@@ -952,7 +952,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
952
952
|
return t("div", {
|
|
953
953
|
class: `${o}-toolbar-item`,
|
|
954
954
|
title: (_e = l.value.toolbarTips) == null ? void 0 : _e.github,
|
|
955
|
-
onClick: () =>
|
|
955
|
+
onClick: () => Et("https://github.com/imzbf/md-editor-v3")
|
|
956
956
|
}, [t("svg", {
|
|
957
957
|
class: `${o}-icon`,
|
|
958
958
|
"aria-hidden": "true"
|
|
@@ -963,7 +963,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
963
963
|
}, [(We = l.value.toolbarTips) == null ? void 0 : We.github])]);
|
|
964
964
|
case "mermaid":
|
|
965
965
|
return t(te, {
|
|
966
|
-
relative: `#${
|
|
966
|
+
relative: `#${r}`,
|
|
967
967
|
visible: u.mermaid,
|
|
968
968
|
onChange: (p) => {
|
|
969
969
|
u.mermaid = p;
|
|
@@ -983,22 +983,22 @@ const hl = /* @__PURE__ */ V({
|
|
|
983
983
|
onClick: () => {
|
|
984
984
|
d("sequence");
|
|
985
985
|
}
|
|
986
|
-
}, [(
|
|
986
|
+
}, [(Xe = l.value.mermaid) == null ? void 0 : Xe.sequence]), t("li", {
|
|
987
987
|
class: `${o}-menu-item`,
|
|
988
988
|
onClick: () => {
|
|
989
989
|
d("gantt");
|
|
990
990
|
}
|
|
991
|
-
}, [(
|
|
991
|
+
}, [(Ye = l.value.mermaid) == null ? void 0 : Ye.gantt]), t("li", {
|
|
992
992
|
class: `${o}-menu-item`,
|
|
993
993
|
onClick: () => {
|
|
994
994
|
d("class");
|
|
995
995
|
}
|
|
996
|
-
}, [(
|
|
996
|
+
}, [(Ze = l.value.mermaid) == null ? void 0 : Ze.class]), t("li", {
|
|
997
997
|
class: `${o}-menu-item`,
|
|
998
998
|
onClick: () => {
|
|
999
999
|
d("state");
|
|
1000
1000
|
}
|
|
1001
|
-
}, [(
|
|
1001
|
+
}, [(Je = l.value.mermaid) == null ? void 0 : Je.state]), t("li", {
|
|
1002
1002
|
class: `${o}-menu-item`,
|
|
1003
1003
|
onClick: () => {
|
|
1004
1004
|
d("pie");
|
|
@@ -1033,7 +1033,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
1033
1033
|
});
|
|
1034
1034
|
case "katex":
|
|
1035
1035
|
return t(te, {
|
|
1036
|
-
relative: `#${
|
|
1036
|
+
relative: `#${r}`,
|
|
1037
1037
|
visible: u.katex,
|
|
1038
1038
|
onChange: (p) => {
|
|
1039
1039
|
u.katex = p;
|
|
@@ -1076,7 +1076,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
1076
1076
|
const p = e.defToolbars[v];
|
|
1077
1077
|
return p ? at(p, {
|
|
1078
1078
|
insert(de) {
|
|
1079
|
-
|
|
1079
|
+
f.emit(a, "replace", "universal", {
|
|
1080
1080
|
generate: de
|
|
1081
1081
|
});
|
|
1082
1082
|
}
|
|
@@ -1085,7 +1085,7 @@ const hl = /* @__PURE__ */ V({
|
|
|
1085
1085
|
const p = e.defToolbars.children[v];
|
|
1086
1086
|
return p ? at(p, {
|
|
1087
1087
|
insert(de) {
|
|
1088
|
-
|
|
1088
|
+
f.emit(a, "replace", "universal", {
|
|
1089
1089
|
generate: de
|
|
1090
1090
|
});
|
|
1091
1091
|
}
|
|
@@ -1095,24 +1095,24 @@ const hl = /* @__PURE__ */ V({
|
|
|
1095
1095
|
};
|
|
1096
1096
|
return H(() => e.toolbars, () => {
|
|
1097
1097
|
ce(() => {
|
|
1098
|
-
i.value &&
|
|
1098
|
+
i.value && Dt(i.value);
|
|
1099
1099
|
});
|
|
1100
1100
|
}, {
|
|
1101
1101
|
immediate: !0
|
|
1102
1102
|
}), () => {
|
|
1103
|
-
const v = m.value[0].map((k) => T(k)),
|
|
1103
|
+
const v = m.value[0].map((k) => T(k)), h = m.value[1].map((k) => T(k));
|
|
1104
1104
|
return t(kt, null, [e.toolbars.length > 0 && t("div", {
|
|
1105
1105
|
class: `${o}-toolbar-wrapper`,
|
|
1106
1106
|
ref: i,
|
|
1107
|
-
id:
|
|
1107
|
+
id: r
|
|
1108
1108
|
}, [t("div", {
|
|
1109
1109
|
class: [`${o}-toolbar`, e.showToolbarName && `${o}-stn`]
|
|
1110
1110
|
}, [t("div", {
|
|
1111
1111
|
class: `${o}-toolbar-left`,
|
|
1112
|
-
ref:
|
|
1112
|
+
ref: g
|
|
1113
1113
|
}, [v]), t("div", {
|
|
1114
1114
|
class: `${o}-toolbar-right`
|
|
1115
|
-
}, [
|
|
1115
|
+
}, [h])])]), t("input", {
|
|
1116
1116
|
ref: b,
|
|
1117
1117
|
accept: "image/*",
|
|
1118
1118
|
type: "file",
|
|
@@ -1137,15 +1137,15 @@ const hl = /* @__PURE__ */ V({
|
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
}), Ml = (e, a) => {
|
|
1140
|
-
const l =
|
|
1141
|
-
e.removeEventListener("scroll",
|
|
1142
|
-
}, 50),
|
|
1143
|
-
const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight,
|
|
1144
|
-
|
|
1145
|
-
top: e.scrollTop /
|
|
1140
|
+
const l = Nt(() => {
|
|
1141
|
+
e.removeEventListener("scroll", n), e.addEventListener("scroll", n), a.removeEventListener("scroll", n), a.addEventListener("scroll", n);
|
|
1142
|
+
}, 50), n = (r) => {
|
|
1143
|
+
const i = e.clientHeight, u = a.clientHeight, d = e.scrollHeight, c = a.scrollHeight, g = (d - i) / (c - u);
|
|
1144
|
+
r.target === e ? (a.removeEventListener("scroll", n), a.scrollTo({
|
|
1145
|
+
top: e.scrollTop / g
|
|
1146
1146
|
// behavior: 'smooth'
|
|
1147
|
-
}), l()) : (e.removeEventListener("scroll",
|
|
1148
|
-
top: a.scrollTop *
|
|
1147
|
+
}), l()) : (e.removeEventListener("scroll", n), e.scrollTo({
|
|
1148
|
+
top: a.scrollTop * g
|
|
1149
1149
|
// behavior: 'smooth'
|
|
1150
1150
|
}), l());
|
|
1151
1151
|
};
|
|
@@ -1156,101 +1156,101 @@ const hl = /* @__PURE__ */ V({
|
|
|
1156
1156
|
});
|
|
1157
1157
|
},
|
|
1158
1158
|
() => {
|
|
1159
|
-
e.removeEventListener("scroll",
|
|
1159
|
+
e.removeEventListener("scroll", n), a.removeEventListener("scroll", n);
|
|
1160
1160
|
}
|
|
1161
1161
|
];
|
|
1162
1162
|
}, Ll = (e, a, l) => {
|
|
1163
|
-
const { view:
|
|
1163
|
+
const { view: n } = l, r = (b) => n.lineBlockAt(n.state.doc.line(b).from).top, i = (b) => n.lineBlockAt(n.state.doc.line(b).from).height;
|
|
1164
1164
|
let u = [];
|
|
1165
1165
|
const d = () => {
|
|
1166
1166
|
u = [];
|
|
1167
1167
|
const b = Array.from(a.querySelectorAll("[data-line]")).map(
|
|
1168
|
-
(
|
|
1169
|
-
), { lines: $ } =
|
|
1168
|
+
(h) => Number(h.dataset.line) + 1
|
|
1169
|
+
), { lines: $ } = n.state.doc;
|
|
1170
1170
|
let T = 1, v = b.shift() ?? $;
|
|
1171
|
-
for (let
|
|
1172
|
-
|
|
1171
|
+
for (let h = 1; h <= $; h++)
|
|
1172
|
+
h === v && (T = h, v = b.shift() || $ + 1), u.push({
|
|
1173
1173
|
start: T,
|
|
1174
1174
|
end: v - 1
|
|
1175
1175
|
});
|
|
1176
1176
|
};
|
|
1177
|
-
let c = 0,
|
|
1177
|
+
let c = 0, g = 0;
|
|
1178
1178
|
const m = Ht((b) => {
|
|
1179
|
-
var v,
|
|
1179
|
+
var v, h, k, y, w, x, L;
|
|
1180
1180
|
if (!((v = a.firstElementChild) != null && v.firstElementChild))
|
|
1181
1181
|
return;
|
|
1182
|
-
const $ =
|
|
1183
|
-
if (!(T > u.length) && !(
|
|
1182
|
+
const $ = n.lineBlockAtHeight(n.scrollDOM.scrollTop), { number: T } = n.state.doc.lineAt($.from);
|
|
1183
|
+
if (!(T > u.length) && !(n.state.doc.lines < u[u.length - 1].end))
|
|
1184
1184
|
if (b.target === e) {
|
|
1185
|
-
if (
|
|
1185
|
+
if (g !== 0)
|
|
1186
1186
|
return;
|
|
1187
1187
|
c++;
|
|
1188
|
-
const C = u[T - 1], M =
|
|
1188
|
+
const C = u[T - 1], M = r(C.end) + i(C.end);
|
|
1189
1189
|
let R = 0;
|
|
1190
|
-
const
|
|
1191
|
-
let
|
|
1192
|
-
|
|
1193
|
-
const j =
|
|
1194
|
-
|
|
1190
|
+
const I = r(C.start), D = a.querySelector(`[data-line="${C.start - 1}"]`) || ((h = a.firstElementChild) == null ? void 0 : h.firstElementChild), O = a.querySelector(`[data-line="${C.end}"]`) || ((k = a.lastElementChild) == null ? void 0 : k.lastElementChild);
|
|
1191
|
+
let F = 0, E = 0;
|
|
1192
|
+
I === 0 ? (R = (n.scrollDOM.scrollTop - I) / (M - I), F = O.offsetTop) : M > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (R = (n.scrollDOM.scrollTop - I) / (n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight - I), E = D.offsetTop, F = a.scrollHeight - a.clientHeight - E + 10) : (R = (n.scrollDOM.scrollTop - I) / (M - I), E = D.offsetTop, F = O.offsetTop - E);
|
|
1193
|
+
const j = E - 10 + F * R;
|
|
1194
|
+
nt(a, j, () => {
|
|
1195
1195
|
c--;
|
|
1196
1196
|
});
|
|
1197
1197
|
} else {
|
|
1198
1198
|
if (c !== 0)
|
|
1199
1199
|
return;
|
|
1200
|
-
|
|
1200
|
+
g++;
|
|
1201
1201
|
const C = Array.from(
|
|
1202
1202
|
a.querySelectorAll("[data-line]")
|
|
1203
1203
|
), M = a.scrollTop, R = a.scrollHeight;
|
|
1204
|
-
let
|
|
1204
|
+
let I = C.length === 0 ? 1 : Math.ceil(
|
|
1205
1205
|
Number(C[C.length - 1].dataset.line) * (M / R)
|
|
1206
|
-
),
|
|
1207
|
-
for (let
|
|
1208
|
-
const
|
|
1209
|
-
if (
|
|
1210
|
-
|
|
1206
|
+
), D = (y = a.firstElementChild) == null ? void 0 : y.firstElementChild;
|
|
1207
|
+
for (let N = I; N >= 0; N--) {
|
|
1208
|
+
const B = a.querySelector(`[data-line="${N}"]`);
|
|
1209
|
+
if (B && B.offsetTop <= M) {
|
|
1210
|
+
D = B, I = N;
|
|
1211
1211
|
break;
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
|
-
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild,
|
|
1214
|
+
let O = (w = a.firstElementChild) == null ? void 0 : w.firstElementChild, F = (x = a.firstElementChild) == null ? void 0 : x.lastElementChild;
|
|
1215
1215
|
for (; C.length > 0; ) {
|
|
1216
|
-
const
|
|
1217
|
-
if (
|
|
1216
|
+
const N = C.indexOf(D);
|
|
1217
|
+
if (N + 1 >= C.length)
|
|
1218
1218
|
break;
|
|
1219
|
-
const
|
|
1220
|
-
if (
|
|
1221
|
-
|
|
1219
|
+
const B = C[N + 1];
|
|
1220
|
+
if (N === -1) {
|
|
1221
|
+
F = B;
|
|
1222
1222
|
break;
|
|
1223
1223
|
}
|
|
1224
|
-
const ee =
|
|
1224
|
+
const ee = D.offsetTop;
|
|
1225
1225
|
if (ee > M) {
|
|
1226
|
-
if (
|
|
1227
|
-
O =
|
|
1226
|
+
if (N === 0) {
|
|
1227
|
+
O = D, F = B;
|
|
1228
1228
|
break;
|
|
1229
1229
|
}
|
|
1230
|
-
|
|
1230
|
+
D = C[N - 1];
|
|
1231
1231
|
continue;
|
|
1232
1232
|
}
|
|
1233
|
-
const
|
|
1234
|
-
if (ee <= M &&
|
|
1235
|
-
O =
|
|
1233
|
+
const re = B.offsetTop;
|
|
1234
|
+
if (ee <= M && re > M) {
|
|
1235
|
+
O = D, F = B;
|
|
1236
1236
|
break;
|
|
1237
1237
|
}
|
|
1238
|
-
|
|
1238
|
+
D = B;
|
|
1239
1239
|
}
|
|
1240
|
-
const
|
|
1241
|
-
let
|
|
1242
|
-
const { start:
|
|
1243
|
-
let
|
|
1244
|
-
const Q = i(
|
|
1240
|
+
const E = O.offsetTop, j = F.offsetTop;
|
|
1241
|
+
let G = 0;
|
|
1242
|
+
const { start: ne, end: J } = u[Number(O.dataset.line || 0)], _ = r(ne);
|
|
1243
|
+
let K = r(J);
|
|
1244
|
+
const Q = i(J);
|
|
1245
1245
|
let W = 0;
|
|
1246
|
-
O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (
|
|
1247
|
-
(M -
|
|
1246
|
+
O === ((L = a.firstElementChild) == null ? void 0 : L.firstElementChild) ? (G = Math.max(M / j, 0), W = K + Q - _) : K > n.scrollDOM.scrollHeight - n.scrollDOM.clientHeight ? (G = Math.max(
|
|
1247
|
+
(M - E) / (a.scrollHeight - E - a.clientHeight),
|
|
1248
1248
|
0
|
|
1249
|
-
),
|
|
1250
|
-
(M -
|
|
1249
|
+
), K = r(n.state.doc.lines) + i(n.state.doc.lines), W = 8 + K - _ - e.clientHeight) : (G = Math.max(
|
|
1250
|
+
(M - E) / (j - E),
|
|
1251
1251
|
0
|
|
1252
|
-
), W =
|
|
1253
|
-
|
|
1252
|
+
), W = K + Q - _), nt(e, _ + W * G, () => {
|
|
1253
|
+
g--;
|
|
1254
1254
|
});
|
|
1255
1255
|
}
|
|
1256
1256
|
}, 10);
|
|
@@ -1262,21 +1262,21 @@ const hl = /* @__PURE__ */ V({
|
|
|
1262
1262
|
u = [], e.removeEventListener("scroll", m), a.removeEventListener("scroll", m);
|
|
1263
1263
|
}
|
|
1264
1264
|
];
|
|
1265
|
-
},
|
|
1266
|
-
const
|
|
1267
|
-
let
|
|
1265
|
+
}, Il = (e, a, l) => {
|
|
1266
|
+
const n = A("editorId");
|
|
1267
|
+
let r = () => {
|
|
1268
1268
|
}, i = () => {
|
|
1269
1269
|
};
|
|
1270
1270
|
const u = () => {
|
|
1271
|
-
|
|
1271
|
+
r();
|
|
1272
1272
|
const d = document.querySelector(".cm-scroller"), c = document.querySelector(
|
|
1273
|
-
`[id="${
|
|
1274
|
-
),
|
|
1275
|
-
`[id="${
|
|
1273
|
+
`[id="${n}-preview-wrapper"][data-show="true"]`
|
|
1274
|
+
), g = document.querySelector(
|
|
1275
|
+
`[id="${n}-html-wrapper"][data-show="true"]`
|
|
1276
1276
|
);
|
|
1277
|
-
(c ||
|
|
1277
|
+
(c || g) && ([i, r] = (c ? Ll : Ml)(
|
|
1278
1278
|
d,
|
|
1279
|
-
c ||
|
|
1279
|
+
c || g,
|
|
1280
1280
|
l.value
|
|
1281
1281
|
)), e.scrollAuto && i();
|
|
1282
1282
|
};
|
|
@@ -1294,180 +1294,180 @@ const hl = /* @__PURE__ */ V({
|
|
|
1294
1294
|
), H(
|
|
1295
1295
|
() => e.scrollAuto,
|
|
1296
1296
|
(d) => {
|
|
1297
|
-
d ? i() :
|
|
1297
|
+
d ? i() : r();
|
|
1298
1298
|
}
|
|
1299
|
-
),
|
|
1300
|
-
},
|
|
1301
|
-
var m, b, $, T, v,
|
|
1302
|
-
let
|
|
1303
|
-
const c = a.getSelectedText(),
|
|
1299
|
+
), X(u);
|
|
1300
|
+
}, Dl = Il, El = (e, a, l) => {
|
|
1301
|
+
var m, b, $, T, v, h;
|
|
1302
|
+
let n = "", r = 0, i = 0, u = !0, d = !1;
|
|
1303
|
+
const c = a.getSelectedText(), g = (m = z.editorConfig) == null ? void 0 : m.mermaidTemplate;
|
|
1304
1304
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
1305
1305
|
const k = e.replace(/^h(\d)/, (y, w) => new Array(Number(w)).fill("#", 0, w).join(""));
|
|
1306
|
-
|
|
1306
|
+
n = `${k} ${c}`, r = k.length + 1;
|
|
1307
1307
|
} else if (e === "prettier") {
|
|
1308
1308
|
const k = window.prettier || (($ = (b = z.editorExtensions) == null ? void 0 : b.prettier) == null ? void 0 : $.prettierInstance), y = [
|
|
1309
|
-
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((
|
|
1309
|
+
((T = window.prettierPlugins) == null ? void 0 : T.markdown) || ((h = (v = z.editorExtensions) == null ? void 0 : v.prettier) == null ? void 0 : h.parserMarkdownInstance)
|
|
1310
1310
|
];
|
|
1311
|
-
!k || y[0] === void 0 ? (
|
|
1311
|
+
!k || y[0] === void 0 ? (f.emit(l.editorId, "errorCatcher", {
|
|
1312
1312
|
name: "prettier",
|
|
1313
1313
|
message: "prettier is undefined"
|
|
1314
|
-
}),
|
|
1314
|
+
}), n = a.getValue()) : n = k.format(a.getValue(), {
|
|
1315
1315
|
parser: "markdown",
|
|
1316
1316
|
plugins: y
|
|
1317
1317
|
}), u = !1, d = !0;
|
|
1318
1318
|
} else
|
|
1319
1319
|
switch (e) {
|
|
1320
1320
|
case "bold": {
|
|
1321
|
-
|
|
1321
|
+
n = `**${c}**`, r = 2, i = -2;
|
|
1322
1322
|
break;
|
|
1323
1323
|
}
|
|
1324
1324
|
case "underline": {
|
|
1325
|
-
|
|
1325
|
+
n = `<u>${c}</u>`, r = 3, i = -4;
|
|
1326
1326
|
break;
|
|
1327
1327
|
}
|
|
1328
1328
|
case "italic": {
|
|
1329
|
-
|
|
1329
|
+
n = `*${c}*`, r = 1, i = -1;
|
|
1330
1330
|
break;
|
|
1331
1331
|
}
|
|
1332
1332
|
case "strikeThrough": {
|
|
1333
|
-
|
|
1333
|
+
n = `~~${c}~~`, r = 2, i = -2;
|
|
1334
1334
|
break;
|
|
1335
1335
|
}
|
|
1336
1336
|
case "sub": {
|
|
1337
|
-
|
|
1337
|
+
n = `<sub>${c}</sub>`, r = 5, i = -6;
|
|
1338
1338
|
break;
|
|
1339
1339
|
}
|
|
1340
1340
|
case "sup": {
|
|
1341
|
-
|
|
1341
|
+
n = `<sup>${c}</sup>`, r = 5, i = -6;
|
|
1342
1342
|
break;
|
|
1343
1343
|
}
|
|
1344
1344
|
case "codeRow": {
|
|
1345
|
-
|
|
1345
|
+
n = "`" + c + "`", r = 1, i = -1;
|
|
1346
1346
|
break;
|
|
1347
1347
|
}
|
|
1348
1348
|
case "quote": {
|
|
1349
|
-
|
|
1349
|
+
n = `> ${c}`, r = 2;
|
|
1350
1350
|
break;
|
|
1351
1351
|
}
|
|
1352
1352
|
case "orderedList": {
|
|
1353
|
-
|
|
1353
|
+
n = `1. ${c}`, r = 3;
|
|
1354
1354
|
break;
|
|
1355
1355
|
}
|
|
1356
1356
|
case "unorderedList": {
|
|
1357
|
-
|
|
1357
|
+
n = `- ${c}`, r = 2;
|
|
1358
1358
|
break;
|
|
1359
1359
|
}
|
|
1360
1360
|
case "task": {
|
|
1361
|
-
|
|
1361
|
+
n = `- [ ] ${c}`, r = 6;
|
|
1362
1362
|
break;
|
|
1363
1363
|
}
|
|
1364
1364
|
case "code": {
|
|
1365
1365
|
const k = l.text || c || "", y = l.mode || "language";
|
|
1366
|
-
|
|
1366
|
+
n = `\`\`\`${y}
|
|
1367
1367
|
${k}
|
|
1368
1368
|
\`\`\`
|
|
1369
|
-
`,
|
|
1369
|
+
`, r = 3, i = 3 + y.length - n.length;
|
|
1370
1370
|
break;
|
|
1371
1371
|
}
|
|
1372
1372
|
case "table": {
|
|
1373
|
-
|
|
1373
|
+
n = "|";
|
|
1374
1374
|
const { selectedShape: k = { x: 1, y: 1 } } = l, { x: y, y: w } = k;
|
|
1375
1375
|
for (let x = 0; x <= w; x++)
|
|
1376
|
-
|
|
1377
|
-
|
|
1376
|
+
n += " col |";
|
|
1377
|
+
n += `
|
|
1378
1378
|
|`;
|
|
1379
1379
|
for (let x = 0; x <= w; x++)
|
|
1380
|
-
|
|
1380
|
+
n += " - |";
|
|
1381
1381
|
for (let x = 0; x <= y; x++) {
|
|
1382
|
-
|
|
1382
|
+
n += `
|
|
1383
1383
|
|`;
|
|
1384
1384
|
for (let L = 0; L <= w; L++)
|
|
1385
|
-
|
|
1385
|
+
n += " content |";
|
|
1386
1386
|
}
|
|
1387
|
-
|
|
1387
|
+
r = 2, i = 5 - n.length;
|
|
1388
1388
|
break;
|
|
1389
1389
|
}
|
|
1390
1390
|
case "link": {
|
|
1391
1391
|
const { desc: k, url: y } = l;
|
|
1392
|
-
|
|
1392
|
+
n = `[${k}](${y})`, u = !1;
|
|
1393
1393
|
break;
|
|
1394
1394
|
}
|
|
1395
1395
|
case "image": {
|
|
1396
1396
|
const { desc: k, url: y, urls: w } = l;
|
|
1397
|
-
w instanceof Array ?
|
|
1398
|
-
`, "") :
|
|
1397
|
+
w instanceof Array ? n = w.reduce((x, L) => x + `
|
|
1398
|
+
`, "") : n = `
|
|
1399
1399
|
`, u = !1;
|
|
1400
1400
|
break;
|
|
1401
1401
|
}
|
|
1402
1402
|
case "flow": {
|
|
1403
|
-
|
|
1404
|
-
${(
|
|
1403
|
+
n = `\`\`\`mermaid
|
|
1404
|
+
${(g == null ? void 0 : g.flow) || `flowchart TD
|
|
1405
1405
|
Start --> Stop`}
|
|
1406
1406
|
\`\`\`
|
|
1407
|
-
`,
|
|
1407
|
+
`, r = 3, i = 10 - n.length;
|
|
1408
1408
|
break;
|
|
1409
1409
|
}
|
|
1410
1410
|
case "sequence": {
|
|
1411
|
-
|
|
1412
|
-
${(
|
|
1411
|
+
n = `\`\`\`mermaid
|
|
1412
|
+
${(g == null ? void 0 : g.sequence) || `sequenceDiagram
|
|
1413
1413
|
A->>B: hello!
|
|
1414
1414
|
B-->>A: hi!
|
|
1415
1415
|
A-)B: bye!`}
|
|
1416
1416
|
\`\`\`
|
|
1417
|
-
`,
|
|
1417
|
+
`, r = 3, i = 10 - n.length;
|
|
1418
1418
|
break;
|
|
1419
1419
|
}
|
|
1420
1420
|
case "gantt": {
|
|
1421
|
-
|
|
1422
|
-
${(
|
|
1421
|
+
n = `\`\`\`mermaid
|
|
1422
|
+
${(g == null ? void 0 : g.gantt) || `gantt
|
|
1423
1423
|
title A Gantt Diagram
|
|
1424
1424
|
dateFormat YYYY-MM-DD
|
|
1425
1425
|
section Section
|
|
1426
1426
|
A task :a1, 2014-01-01, 30d
|
|
1427
1427
|
Another task :after a1, 20d`}
|
|
1428
1428
|
\`\`\`
|
|
1429
|
-
`,
|
|
1429
|
+
`, r = 3, i = 10 - n.length;
|
|
1430
1430
|
break;
|
|
1431
1431
|
}
|
|
1432
1432
|
case "class": {
|
|
1433
|
-
|
|
1434
|
-
${(
|
|
1433
|
+
n = `\`\`\`mermaid
|
|
1434
|
+
${(g == null ? void 0 : g.class) || `classDiagram
|
|
1435
1435
|
class Animal
|
|
1436
1436
|
Vehicle <|-- Car`}
|
|
1437
1437
|
\`\`\`
|
|
1438
|
-
`,
|
|
1438
|
+
`, r = 3, i = 10 - n.length;
|
|
1439
1439
|
break;
|
|
1440
1440
|
}
|
|
1441
1441
|
case "state": {
|
|
1442
|
-
|
|
1443
|
-
${(
|
|
1442
|
+
n = `\`\`\`mermaid
|
|
1443
|
+
${(g == null ? void 0 : g.state) || `stateDiagram-v2
|
|
1444
1444
|
s1 --> s2`}
|
|
1445
1445
|
\`\`\`
|
|
1446
|
-
`,
|
|
1446
|
+
`, r = 3, i = 10 - n.length;
|
|
1447
1447
|
break;
|
|
1448
1448
|
}
|
|
1449
1449
|
case "pie": {
|
|
1450
|
-
|
|
1451
|
-
${(
|
|
1450
|
+
n = `\`\`\`mermaid
|
|
1451
|
+
${(g == null ? void 0 : g.pie) || `pie title Pets adopted by volunteers
|
|
1452
1452
|
"Dogs" : 386
|
|
1453
1453
|
"Cats" : 85
|
|
1454
1454
|
"Rats" : 15`}
|
|
1455
1455
|
\`\`\`
|
|
1456
|
-
`,
|
|
1456
|
+
`, r = 3, i = 10 - n.length;
|
|
1457
1457
|
break;
|
|
1458
1458
|
}
|
|
1459
1459
|
case "relationship": {
|
|
1460
|
-
|
|
1461
|
-
${(
|
|
1460
|
+
n = `\`\`\`mermaid
|
|
1461
|
+
${(g == null ? void 0 : g.relationship) || `erDiagram
|
|
1462
1462
|
CAR ||--o{ NAMED-DRIVER : allows
|
|
1463
1463
|
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
1464
1464
|
\`\`\`
|
|
1465
|
-
`,
|
|
1465
|
+
`, r = 3, i = 10 - n.length;
|
|
1466
1466
|
break;
|
|
1467
1467
|
}
|
|
1468
1468
|
case "journey": {
|
|
1469
|
-
|
|
1470
|
-
${(
|
|
1469
|
+
n = `\`\`\`mermaid
|
|
1470
|
+
${(g == null ? void 0 : g.journey) || `journey
|
|
1471
1471
|
title My working day
|
|
1472
1472
|
section Go to work
|
|
1473
1473
|
Make tea: 5: Me
|
|
@@ -1477,39 +1477,39 @@ ${(f == null ? void 0 : f.journey) || `journey
|
|
|
1477
1477
|
Go downstairs: 5: Me
|
|
1478
1478
|
Sit down: 5: Me`}
|
|
1479
1479
|
\`\`\`
|
|
1480
|
-
`,
|
|
1480
|
+
`, r = 3, i = 10 - n.length;
|
|
1481
1481
|
break;
|
|
1482
1482
|
}
|
|
1483
1483
|
case "katexInline": {
|
|
1484
|
-
|
|
1484
|
+
n = "$$", r = 1, i = -1;
|
|
1485
1485
|
break;
|
|
1486
1486
|
}
|
|
1487
1487
|
case "katexBlock": {
|
|
1488
|
-
|
|
1488
|
+
n = `$$
|
|
1489
1489
|
|
|
1490
1490
|
$$
|
|
1491
|
-
`,
|
|
1491
|
+
`, r = 3, i = -4;
|
|
1492
1492
|
break;
|
|
1493
1493
|
}
|
|
1494
1494
|
case "universal": {
|
|
1495
1495
|
const { generate: k } = l, y = k(c);
|
|
1496
|
-
|
|
1496
|
+
n = y.targetValue, u = y.select, r = y.deviationStart, i = y.deviationEnd;
|
|
1497
1497
|
}
|
|
1498
1498
|
}
|
|
1499
1499
|
return {
|
|
1500
|
-
text:
|
|
1500
|
+
text: n,
|
|
1501
1501
|
options: {
|
|
1502
1502
|
// 是否选中
|
|
1503
1503
|
select: u,
|
|
1504
1504
|
// 选中时,开始位置的偏移量
|
|
1505
|
-
deviationStart:
|
|
1505
|
+
deviationStart: r,
|
|
1506
1506
|
// 结束的偏移量
|
|
1507
1507
|
deviationEnd: i,
|
|
1508
1508
|
// 是否整个替换
|
|
1509
1509
|
replaceAll: d
|
|
1510
1510
|
}
|
|
1511
1511
|
};
|
|
1512
|
-
},
|
|
1512
|
+
}, Nl = "#e5c07b", it = "var(--md-color)", Hl = "#56b6c2", Fl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Bl = "#e5c07b", Vl = "var(--md-color)", ct = "#d19a66", Ol = "#c678dd", Rl = "#21252b", Pl = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", ql = "#ceedfa33", ut = "#528bff", Ul = be.theme(
|
|
1513
1513
|
{
|
|
1514
1514
|
"&": {
|
|
1515
1515
|
color: oe,
|
|
@@ -1571,7 +1571,7 @@ $$
|
|
|
1571
1571
|
), Gl = $t.define([
|
|
1572
1572
|
{ tag: s.keyword, color: Ol },
|
|
1573
1573
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: it },
|
|
1574
|
-
{ tag: [s.function(s.variableName), s.labelName], color:
|
|
1574
|
+
{ tag: [s.function(s.variableName), s.labelName], color: Bl },
|
|
1575
1575
|
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ct },
|
|
1576
1576
|
{ tag: [s.definition(s.name), s.separator], color: oe },
|
|
1577
1577
|
{
|
|
@@ -1585,7 +1585,7 @@ $$
|
|
|
1585
1585
|
s.self,
|
|
1586
1586
|
s.namespace
|
|
1587
1587
|
],
|
|
1588
|
-
color:
|
|
1588
|
+
color: Nl
|
|
1589
1589
|
},
|
|
1590
1590
|
{
|
|
1591
1591
|
tag: [
|
|
@@ -1607,22 +1607,22 @@ $$
|
|
|
1607
1607
|
{ tag: s.heading, fontWeight: "bold", color: it },
|
|
1608
1608
|
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ct },
|
|
1609
1609
|
{ tag: [s.processingInstruction, s.string, s.inserted], color: Vl },
|
|
1610
|
-
{ tag: s.invalid, color:
|
|
1610
|
+
{ tag: s.invalid, color: Fl }
|
|
1611
1611
|
]), Kl = [
|
|
1612
1612
|
Ul,
|
|
1613
1613
|
yt(Gl)
|
|
1614
|
-
], jl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", Wl = "#fff", ae = "#3f4a54",
|
|
1614
|
+
], jl = "#e5c07b", mt = "#3f4a54", _l = "#56b6c2", Wl = "#fff", ae = "#3f4a54", gt = "#2d8cf0", zl = "#2d8cf0", Xl = "#3f4a54", ht = "#d19a66", Yl = "#c678dd", Zl = "#21252b", Jl = "#ceedfa33", ft = "var(--md-bk-color)", ge = "var(--md-bk-color)", Ql = "#bad5fa", bt = "#3f4a54", eo = be.theme(
|
|
1615
1615
|
{
|
|
1616
1616
|
"&": {
|
|
1617
1617
|
color: ae,
|
|
1618
|
-
backgroundColor:
|
|
1618
|
+
backgroundColor: ft
|
|
1619
1619
|
},
|
|
1620
1620
|
".cm-content": {
|
|
1621
1621
|
caretColor: bt
|
|
1622
1622
|
},
|
|
1623
1623
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: bt },
|
|
1624
1624
|
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: Ql },
|
|
1625
|
-
".cm-panels": { backgroundColor:
|
|
1625
|
+
".cm-panels": { backgroundColor: Zl, color: ae },
|
|
1626
1626
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1627
1627
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1628
1628
|
".cm-searchMatch": {
|
|
@@ -1638,13 +1638,13 @@ $$
|
|
|
1638
1638
|
backgroundColor: "#bad0f847"
|
|
1639
1639
|
},
|
|
1640
1640
|
".cm-gutters": {
|
|
1641
|
-
backgroundColor:
|
|
1641
|
+
backgroundColor: ft,
|
|
1642
1642
|
color: ae,
|
|
1643
1643
|
borderRight: "1px solid",
|
|
1644
1644
|
borderColor: "var(--md-border-color)"
|
|
1645
1645
|
},
|
|
1646
1646
|
".cm-activeLineGutter": {
|
|
1647
|
-
backgroundColor:
|
|
1647
|
+
backgroundColor: Jl
|
|
1648
1648
|
},
|
|
1649
1649
|
".cm-foldPlaceholder": {
|
|
1650
1650
|
backgroundColor: "transparent",
|
|
@@ -1653,15 +1653,15 @@ $$
|
|
|
1653
1653
|
},
|
|
1654
1654
|
".cm-tooltip": {
|
|
1655
1655
|
border: "1px solid var(--md-border-color)",
|
|
1656
|
-
backgroundColor:
|
|
1656
|
+
backgroundColor: ge
|
|
1657
1657
|
},
|
|
1658
1658
|
".cm-tooltip .cm-tooltip-arrow:before": {
|
|
1659
1659
|
borderTopColor: "transparent",
|
|
1660
1660
|
borderBottomColor: "transparent"
|
|
1661
1661
|
},
|
|
1662
1662
|
".cm-tooltip .cm-tooltip-arrow:after": {
|
|
1663
|
-
borderTopColor:
|
|
1664
|
-
borderBottomColor:
|
|
1663
|
+
borderTopColor: ge,
|
|
1664
|
+
borderBottomColor: ge
|
|
1665
1665
|
},
|
|
1666
1666
|
".cm-tooltip-autocomplete": {
|
|
1667
1667
|
"& > ul > li[aria-selected]": {
|
|
@@ -1671,10 +1671,10 @@ $$
|
|
|
1671
1671
|
}
|
|
1672
1672
|
// { dark: true }
|
|
1673
1673
|
), to = $t.define([
|
|
1674
|
-
{ tag: s.keyword, color:
|
|
1674
|
+
{ tag: s.keyword, color: Yl },
|
|
1675
1675
|
{ tag: [s.name, s.deleted, s.character, s.propertyName, s.macroName], color: mt },
|
|
1676
1676
|
{ tag: [s.function(s.variableName), s.labelName], color: zl },
|
|
1677
|
-
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color:
|
|
1677
|
+
{ tag: [s.color, s.constant(s.name), s.standard(s.name)], color: ht },
|
|
1678
1678
|
{ tag: [s.definition(s.name), s.separator], color: ae },
|
|
1679
1679
|
{
|
|
1680
1680
|
tag: [
|
|
@@ -1701,47 +1701,47 @@ $$
|
|
|
1701
1701
|
],
|
|
1702
1702
|
color: _l
|
|
1703
1703
|
},
|
|
1704
|
-
{ tag: [s.meta, s.comment], color:
|
|
1704
|
+
{ tag: [s.meta, s.comment], color: gt },
|
|
1705
1705
|
{ tag: s.strong, fontWeight: "bold" },
|
|
1706
1706
|
{ tag: s.emphasis, fontStyle: "italic" },
|
|
1707
1707
|
{ tag: s.strikethrough, textDecoration: "line-through" },
|
|
1708
|
-
{ tag: s.link, color:
|
|
1708
|
+
{ tag: s.link, color: gt, textDecoration: "underline" },
|
|
1709
1709
|
{ tag: s.heading, fontWeight: "bold", color: mt },
|
|
1710
|
-
{ tag: [s.atom, s.bool, s.special(s.variableName)], color:
|
|
1711
|
-
{ tag: [s.processingInstruction, s.string, s.inserted], color:
|
|
1710
|
+
{ tag: [s.atom, s.bool, s.special(s.variableName)], color: ht },
|
|
1711
|
+
{ tag: [s.processingInstruction, s.string, s.inserted], color: Xl },
|
|
1712
1712
|
{ tag: s.invalid, color: Wl }
|
|
1713
1713
|
]), lo = [
|
|
1714
1714
|
eo,
|
|
1715
1715
|
yt(to)
|
|
1716
|
-
], se = (e, a, l,
|
|
1717
|
-
const
|
|
1718
|
-
i.dispatch(i.state.replaceSelection(`${
|
|
1719
|
-
const m = d + u.label.length + (
|
|
1716
|
+
], se = (e, a, l, n, r) => (i, u, d, c) => {
|
|
1717
|
+
const g = `${e}${a}`.slice(c - d);
|
|
1718
|
+
i.dispatch(i.state.replaceSelection(`${g}${l}${n}`));
|
|
1719
|
+
const m = d + u.label.length + (r === "title" ? l.length : 0);
|
|
1720
1720
|
i.dispatch({
|
|
1721
|
-
selection:
|
|
1721
|
+
selection: q.create(
|
|
1722
1722
|
[
|
|
1723
|
-
|
|
1724
|
-
d + u.label.length + (
|
|
1723
|
+
q.range(
|
|
1724
|
+
d + u.label.length + (r === "title" ? 1 : -a.length),
|
|
1725
1725
|
m
|
|
1726
1726
|
),
|
|
1727
|
-
|
|
1727
|
+
q.cursor(m)
|
|
1728
1728
|
],
|
|
1729
1729
|
1
|
|
1730
1730
|
)
|
|
1731
1731
|
}), i.focus();
|
|
1732
|
-
}, vt = (e) => (a, l,
|
|
1733
|
-
const i = e.slice(
|
|
1732
|
+
}, vt = (e) => (a, l, n, r) => {
|
|
1733
|
+
const i = e.slice(r - n);
|
|
1734
1734
|
a.dispatch(a.state.replaceSelection(`${i} `));
|
|
1735
1735
|
}, oo = (e) => {
|
|
1736
1736
|
const a = (l) => {
|
|
1737
|
-
const
|
|
1737
|
+
const n = l.matchBefore(
|
|
1738
1738
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
1739
1739
|
);
|
|
1740
|
-
return
|
|
1741
|
-
from:
|
|
1740
|
+
return n === null || n.from == n.to && l.explicit ? null : {
|
|
1741
|
+
from: n.from,
|
|
1742
1742
|
options: [
|
|
1743
1743
|
// 标题
|
|
1744
|
-
...["h1", "h2", "h3", "h4", "h5", "h6"].map((
|
|
1744
|
+
...["h1", "h2", "h3", "h4", "h5", "h6"].map((r, i) => {
|
|
1745
1745
|
const u = new Array(i + 1).fill("#").join("");
|
|
1746
1746
|
return {
|
|
1747
1747
|
label: u,
|
|
@@ -1750,8 +1750,8 @@ $$
|
|
|
1750
1750
|
};
|
|
1751
1751
|
}),
|
|
1752
1752
|
// 任务列表
|
|
1753
|
-
...["unchecked", "checked"].map((
|
|
1754
|
-
const i =
|
|
1753
|
+
...["unchecked", "checked"].map((r) => {
|
|
1754
|
+
const i = r === "checked" ? "- [x]" : "- [ ]";
|
|
1755
1755
|
return {
|
|
1756
1756
|
label: i,
|
|
1757
1757
|
type: "text",
|
|
@@ -1763,10 +1763,10 @@ $$
|
|
|
1763
1763
|
["`", ""],
|
|
1764
1764
|
["```", "language"],
|
|
1765
1765
|
["```mermaid\n", ""]
|
|
1766
|
-
].map((
|
|
1767
|
-
label: `${
|
|
1766
|
+
].map((r) => ({
|
|
1767
|
+
label: `${r[0]}${r[1]}`,
|
|
1768
1768
|
type: "text",
|
|
1769
|
-
apply: se(
|
|
1769
|
+
apply: se(r[0], r[1], "", r[0] === "`" ? "`" : "\n```", "type")
|
|
1770
1770
|
})),
|
|
1771
1771
|
// 链接
|
|
1772
1772
|
{
|
|
@@ -1818,10 +1818,10 @@ $$`, "title")
|
|
|
1818
1818
|
"caution",
|
|
1819
1819
|
"error",
|
|
1820
1820
|
"attention"
|
|
1821
|
-
].map((
|
|
1822
|
-
label: `!!! ${
|
|
1821
|
+
].map((r) => ({
|
|
1822
|
+
label: `!!! ${r}`,
|
|
1823
1823
|
type: "text",
|
|
1824
|
-
apply: se("!!!", ` ${
|
|
1824
|
+
apply: se("!!!", ` ${r}`, " Title", `
|
|
1825
1825
|
|
|
1826
1826
|
!!!`, "title")
|
|
1827
1827
|
}))
|
|
@@ -1831,26 +1831,27 @@ $$`, "title")
|
|
|
1831
1831
|
return ml({
|
|
1832
1832
|
override: e ? [a, ol, ...e] : [a]
|
|
1833
1833
|
});
|
|
1834
|
-
}, ao = oo,
|
|
1834
|
+
}, ao = oo, Y = (e) => {
|
|
1835
1835
|
const a = new dl();
|
|
1836
|
-
return (
|
|
1837
|
-
effects: ul.appendConfig.of(a.of(
|
|
1836
|
+
return (n) => (a.get(e.state) ? e.dispatch({ effects: a.reconfigure(n) }) : e.dispatch({
|
|
1837
|
+
effects: ul.appendConfig.of(a.of(n))
|
|
1838
1838
|
}), !0);
|
|
1839
1839
|
};
|
|
1840
|
-
class
|
|
1840
|
+
class no {
|
|
1841
1841
|
constructor(a) {
|
|
1842
|
-
|
|
1842
|
+
P(this, "view");
|
|
1843
|
+
P(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
1843
1844
|
// 切换tabSize的执行方法。切换时,Compartment实例需要相同
|
|
1844
|
-
|
|
1845
|
-
|
|
1845
|
+
P(this, "toggleTabSize");
|
|
1846
|
+
P(this, "togglePlaceholder");
|
|
1846
1847
|
/**
|
|
1847
1848
|
* 设置全部的扩展
|
|
1848
1849
|
*/
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
this.view = a, this.toggleTabSize =
|
|
1850
|
+
P(this, "setExtensions");
|
|
1851
|
+
P(this, "toggleDisabled");
|
|
1852
|
+
P(this, "toggleReadOnly");
|
|
1853
|
+
P(this, "toggleMaxlength");
|
|
1854
|
+
this.view = a, 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);
|
|
1854
1855
|
}
|
|
1855
1856
|
getValue() {
|
|
1856
1857
|
return this.view.state.doc.toString();
|
|
@@ -1862,11 +1863,11 @@ class ro {
|
|
|
1862
1863
|
* @param from 插入开始位置
|
|
1863
1864
|
* @param to 插入结束位置
|
|
1864
1865
|
*/
|
|
1865
|
-
setValue(a, l = 0,
|
|
1866
|
+
setValue(a, l = 0, n = this.view.state.doc.length) {
|
|
1866
1867
|
this.view.dispatch({
|
|
1867
1868
|
changes: {
|
|
1868
1869
|
from: l,
|
|
1869
|
-
to:
|
|
1870
|
+
to: n,
|
|
1870
1871
|
insert: a
|
|
1871
1872
|
}
|
|
1872
1873
|
});
|
|
@@ -1893,36 +1894,38 @@ class ro {
|
|
|
1893
1894
|
deviationEnd: 0,
|
|
1894
1895
|
// 直接替换所有文本
|
|
1895
1896
|
replaceAll: !1
|
|
1896
|
-
},
|
|
1897
|
-
var n;
|
|
1897
|
+
}, n) {
|
|
1898
1898
|
try {
|
|
1899
1899
|
if (l.replaceAll) {
|
|
1900
|
-
this.setValue(a)
|
|
1900
|
+
if (this.setValue(a), a.length > this.maxLength)
|
|
1901
|
+
throw new Error("The input text is too long");
|
|
1901
1902
|
return;
|
|
1902
1903
|
}
|
|
1903
|
-
|
|
1904
|
+
if (this.view.state.doc.length - this.getSelectedText().length + a.length > this.maxLength)
|
|
1905
|
+
throw new Error("The input text is too long");
|
|
1906
|
+
const { from: r } = this.view.state.selection.main;
|
|
1904
1907
|
if (this.view.dispatch(this.view.state.replaceSelection(a)), l.select) {
|
|
1905
|
-
const
|
|
1908
|
+
const i = r + a.length + l.deviationEnd;
|
|
1906
1909
|
this.view.dispatch({
|
|
1907
|
-
selection:
|
|
1910
|
+
selection: q.create(
|
|
1908
1911
|
[
|
|
1909
|
-
|
|
1910
|
-
|
|
1912
|
+
q.range(r + l.deviationStart, i),
|
|
1913
|
+
q.cursor(i)
|
|
1911
1914
|
],
|
|
1912
1915
|
1
|
|
1913
1916
|
)
|
|
1914
1917
|
});
|
|
1915
1918
|
}
|
|
1916
1919
|
this.view.focus();
|
|
1917
|
-
} catch (
|
|
1918
|
-
if (
|
|
1919
|
-
|
|
1920
|
+
} catch (r) {
|
|
1921
|
+
if (r.message === "The input text is too long")
|
|
1922
|
+
f.emit(n, "errorCatcher", {
|
|
1920
1923
|
name: "overlength",
|
|
1921
|
-
message:
|
|
1924
|
+
message: r.message,
|
|
1922
1925
|
data: a
|
|
1923
1926
|
});
|
|
1924
1927
|
else
|
|
1925
|
-
throw
|
|
1928
|
+
throw r;
|
|
1926
1929
|
}
|
|
1927
1930
|
}
|
|
1928
1931
|
/**
|
|
@@ -1947,21 +1950,21 @@ class ro {
|
|
|
1947
1950
|
focus(a) {
|
|
1948
1951
|
if (this.view.focus(), !a)
|
|
1949
1952
|
return;
|
|
1950
|
-
let l = 0,
|
|
1953
|
+
let l = 0, n = 0, r = 0;
|
|
1951
1954
|
switch (a) {
|
|
1952
1955
|
case "start":
|
|
1953
1956
|
break;
|
|
1954
1957
|
case "end": {
|
|
1955
|
-
l =
|
|
1958
|
+
l = n = r = this.getValue().length;
|
|
1956
1959
|
break;
|
|
1957
1960
|
}
|
|
1958
1961
|
default:
|
|
1959
|
-
l = a.rangeAnchor || a.cursorPos,
|
|
1962
|
+
l = a.rangeAnchor || a.cursorPos, n = a.rangeHead || a.cursorPos, r = a.cursorPos;
|
|
1960
1963
|
}
|
|
1961
1964
|
this.view.dispatch({
|
|
1962
1965
|
scrollIntoView: !0,
|
|
1963
|
-
selection:
|
|
1964
|
-
[
|
|
1966
|
+
selection: q.create(
|
|
1967
|
+
[q.range(l, n), q.cursor(r)],
|
|
1965
1968
|
1
|
|
1966
1969
|
)
|
|
1967
1970
|
});
|
|
@@ -1973,48 +1976,48 @@ class ro {
|
|
|
1973
1976
|
this.toggleReadOnly([ue.readOnly.of(a)]);
|
|
1974
1977
|
}
|
|
1975
1978
|
setMaxLength(a) {
|
|
1976
|
-
this.toggleMaxlength([
|
|
1979
|
+
this.maxLength = a, this.toggleMaxlength([
|
|
1977
1980
|
ue.changeFilter.of((l) => l.newDoc.length <= a)
|
|
1978
1981
|
]);
|
|
1979
1982
|
}
|
|
1980
1983
|
}
|
|
1981
|
-
const
|
|
1984
|
+
const ro = (e) => {
|
|
1982
1985
|
const a = A("editorId");
|
|
1983
|
-
return (
|
|
1984
|
-
if (!
|
|
1986
|
+
return (n) => {
|
|
1987
|
+
if (!n.clipboardData)
|
|
1985
1988
|
return;
|
|
1986
|
-
if (
|
|
1987
|
-
const { files: i } =
|
|
1988
|
-
|
|
1989
|
+
if (n.clipboardData.files.length > 0) {
|
|
1990
|
+
const { files: i } = n.clipboardData;
|
|
1991
|
+
f.emit(
|
|
1989
1992
|
a,
|
|
1990
1993
|
"uploadImage",
|
|
1991
1994
|
Array.from(i).filter((u) => /image\/.*/.test(u.type))
|
|
1992
|
-
),
|
|
1995
|
+
), n.preventDefault();
|
|
1993
1996
|
return;
|
|
1994
1997
|
}
|
|
1995
|
-
if (e.autoDetectCode &&
|
|
1996
|
-
const i = JSON.parse(
|
|
1997
|
-
|
|
1998
|
+
if (e.autoDetectCode && n.clipboardData.types.includes("vscode-editor-data")) {
|
|
1999
|
+
const i = JSON.parse(n.clipboardData.getData("vscode-editor-data"));
|
|
2000
|
+
f.emit(a, "replace", "code", {
|
|
1998
2001
|
mode: i.mode,
|
|
1999
|
-
text:
|
|
2000
|
-
}),
|
|
2002
|
+
text: n.clipboardData.getData("text/plain")
|
|
2003
|
+
}), n.preventDefault();
|
|
2001
2004
|
return;
|
|
2002
2005
|
}
|
|
2003
|
-
const
|
|
2004
|
-
e.maxlength &&
|
|
2006
|
+
const r = n.clipboardData.getData("text/plain");
|
|
2007
|
+
e.maxlength && r.length + e.value.length > e.maxlength && f.emit(a, "errorCatcher", {
|
|
2005
2008
|
name: "overlength",
|
|
2006
2009
|
message: "The input text is too long",
|
|
2007
|
-
data:
|
|
2010
|
+
data: r
|
|
2008
2011
|
});
|
|
2009
2012
|
};
|
|
2010
|
-
}, io =
|
|
2013
|
+
}, io = ro, so = (e) => {
|
|
2011
2014
|
const a = A("editorId");
|
|
2012
|
-
|
|
2013
|
-
|
|
2015
|
+
X(() => {
|
|
2016
|
+
f.on(a, {
|
|
2014
2017
|
name: Rt,
|
|
2015
2018
|
callback(l) {
|
|
2016
|
-
var
|
|
2017
|
-
(
|
|
2019
|
+
var n;
|
|
2020
|
+
(n = e.value) == null || n.focus(l);
|
|
2018
2021
|
}
|
|
2019
2022
|
});
|
|
2020
2023
|
});
|
|
@@ -2022,102 +2025,102 @@ const no = (e) => {
|
|
|
2022
2025
|
{
|
|
2023
2026
|
key: "Ctrl-b",
|
|
2024
2027
|
mac: "Cmd-b",
|
|
2025
|
-
run: () => (
|
|
2028
|
+
run: () => (f.emit(e, "replace", "bold"), !0)
|
|
2026
2029
|
},
|
|
2027
2030
|
{
|
|
2028
2031
|
key: "Ctrl-d",
|
|
2029
2032
|
mac: "Cmd-d",
|
|
2030
|
-
run:
|
|
2033
|
+
run: nl,
|
|
2031
2034
|
preventDefault: !0
|
|
2032
2035
|
},
|
|
2033
2036
|
{
|
|
2034
2037
|
key: "Ctrl-s",
|
|
2035
2038
|
mac: "Cmd-s",
|
|
2036
|
-
run: (L) => (
|
|
2037
|
-
shift: () => (
|
|
2039
|
+
run: (L) => (f.emit(e, pt, L.state.doc.toString()), !0),
|
|
2040
|
+
shift: () => (f.emit(e, "replace", "strikeThrough"), !0)
|
|
2038
2041
|
},
|
|
2039
2042
|
{
|
|
2040
2043
|
key: "Ctrl-u",
|
|
2041
2044
|
mac: "Cmd-u",
|
|
2042
|
-
run: () => (
|
|
2043
|
-
shift: () => (
|
|
2045
|
+
run: () => (f.emit(e, "replace", "underline"), !0),
|
|
2046
|
+
shift: () => (f.emit(e, "replace", "unorderedList"), !0)
|
|
2044
2047
|
},
|
|
2045
2048
|
{
|
|
2046
2049
|
key: "Ctrl-i",
|
|
2047
2050
|
mac: "Cmd-i",
|
|
2048
|
-
run: () => (
|
|
2049
|
-
shift: () => (
|
|
2051
|
+
run: () => (f.emit(e, "replace", "italic"), !0),
|
|
2052
|
+
shift: () => (f.emit(e, "openModals", "image"), !0)
|
|
2050
2053
|
},
|
|
2051
2054
|
{
|
|
2052
2055
|
key: "Ctrl-1",
|
|
2053
2056
|
mac: "Cmd-1",
|
|
2054
|
-
run: () => (
|
|
2057
|
+
run: () => (f.emit(e, "replace", "h1"), !0)
|
|
2055
2058
|
},
|
|
2056
2059
|
{
|
|
2057
2060
|
key: "Ctrl-2",
|
|
2058
2061
|
mac: "Cmd-2",
|
|
2059
|
-
run: () => (
|
|
2062
|
+
run: () => (f.emit(e, "replace", "h2"), !0)
|
|
2060
2063
|
},
|
|
2061
2064
|
{
|
|
2062
2065
|
key: "Ctrl-3",
|
|
2063
2066
|
mac: "Cmd-3",
|
|
2064
|
-
run: () => (
|
|
2067
|
+
run: () => (f.emit(e, "replace", "h3"), !0)
|
|
2065
2068
|
},
|
|
2066
2069
|
{
|
|
2067
2070
|
key: "Ctrl-4",
|
|
2068
2071
|
mac: "Cmd-4",
|
|
2069
|
-
run: () => (
|
|
2072
|
+
run: () => (f.emit(e, "replace", "h4"), !0)
|
|
2070
2073
|
},
|
|
2071
2074
|
{
|
|
2072
2075
|
key: "Ctrl-5",
|
|
2073
2076
|
mac: "Cmd-5",
|
|
2074
|
-
run: () => (
|
|
2077
|
+
run: () => (f.emit(e, "replace", "h5"), !0)
|
|
2075
2078
|
},
|
|
2076
2079
|
{
|
|
2077
2080
|
key: "Ctrl-6",
|
|
2078
2081
|
mac: "Cmd-6",
|
|
2079
|
-
run: () => (
|
|
2082
|
+
run: () => (f.emit(e, "replace", "h6"), !0)
|
|
2080
2083
|
},
|
|
2081
2084
|
{
|
|
2082
2085
|
key: "Ctrl-ArrowUp",
|
|
2083
2086
|
mac: "Cmd-ArrowUp",
|
|
2084
|
-
run: () => (
|
|
2087
|
+
run: () => (f.emit(e, "replace", "sup"), !0)
|
|
2085
2088
|
},
|
|
2086
2089
|
{
|
|
2087
2090
|
key: "Ctrl-ArrowDown",
|
|
2088
2091
|
mac: "Cmd-ArrowDown",
|
|
2089
|
-
run: () => (
|
|
2092
|
+
run: () => (f.emit(e, "replace", "sub"), !0)
|
|
2090
2093
|
},
|
|
2091
2094
|
{
|
|
2092
2095
|
key: "Ctrl-o",
|
|
2093
2096
|
mac: "Cmd-o",
|
|
2094
|
-
run: () => (
|
|
2097
|
+
run: () => (f.emit(e, "replace", "orderedList"), !0)
|
|
2095
2098
|
},
|
|
2096
2099
|
{
|
|
2097
2100
|
key: "Ctrl-c",
|
|
2098
2101
|
mac: "Cmd-c",
|
|
2099
|
-
shift: () => (
|
|
2102
|
+
shift: () => (f.emit(e, "replace", "code"), !0),
|
|
2100
2103
|
any(L, C) {
|
|
2101
|
-
return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (
|
|
2104
|
+
return (C.ctrlKey || C.metaKey) && C.altKey && C.code === "KeyC" ? (f.emit(e, "replace", "codeRow"), !0) : !1;
|
|
2102
2105
|
}
|
|
2103
2106
|
},
|
|
2104
2107
|
{
|
|
2105
2108
|
key: "Ctrl-l",
|
|
2106
2109
|
mac: "Cmd-l",
|
|
2107
|
-
run: () => (
|
|
2110
|
+
run: () => (f.emit(e, "openModals", "link"), !0)
|
|
2108
2111
|
},
|
|
2109
2112
|
{
|
|
2110
2113
|
key: "Ctrl-f",
|
|
2111
2114
|
mac: "Cmd-f",
|
|
2112
|
-
shift: () => a.noPrettier ? !1 : (
|
|
2115
|
+
shift: () => a.noPrettier ? !1 : (f.emit(e, "replace", "prettier"), !0)
|
|
2113
2116
|
},
|
|
2114
2117
|
{
|
|
2115
|
-
any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (
|
|
2118
|
+
any: (L, C) => (C.ctrlKey || C.metaKey) && C.altKey && C.shiftKey && C.code === "KeyT" ? (f.emit(e, "replace", "table"), !0) : !1
|
|
2116
2119
|
}
|
|
2117
|
-
], mo = uo,
|
|
2118
|
-
const a = A("tabWidth"), l = A("editorId"),
|
|
2119
|
-
el.of([...u,
|
|
2120
|
-
|
|
2120
|
+
], mo = uo, go = (e) => {
|
|
2121
|
+
const a = A("tabWidth"), l = A("editorId"), n = A("theme"), r = U(), i = St(), u = mo(l, e), d = io(e), c = [
|
|
2122
|
+
el.of([...u, rl]),
|
|
2123
|
+
Jt,
|
|
2121
2124
|
al(),
|
|
2122
2125
|
ll({ codeLanguages: tl }),
|
|
2123
2126
|
// 横向换行
|
|
@@ -2132,53 +2135,53 @@ const no = (e) => {
|
|
|
2132
2135
|
input: (m) => {
|
|
2133
2136
|
e.onInput && e.onInput(m);
|
|
2134
2137
|
const { data: b } = m;
|
|
2135
|
-
e.value.length + b.length &&
|
|
2138
|
+
e.maxlength && e.value.length + b.length > e.maxlength && f.emit(l, "errorCatcher", {
|
|
2136
2139
|
name: "overlength",
|
|
2137
2140
|
message: "The input text is too long",
|
|
2138
2141
|
data: b
|
|
2139
2142
|
});
|
|
2140
2143
|
}
|
|
2141
2144
|
})
|
|
2142
|
-
],
|
|
2145
|
+
], g = () => {
|
|
2143
2146
|
const m = [
|
|
2144
2147
|
...c,
|
|
2145
|
-
|
|
2148
|
+
n.value === "light" ? lo : Kl,
|
|
2146
2149
|
ao(e.completions)
|
|
2147
2150
|
];
|
|
2148
|
-
return z.codeMirrorExtensions(
|
|
2151
|
+
return z.codeMirrorExtensions(n.value, m, [
|
|
2149
2152
|
...u
|
|
2150
2153
|
]);
|
|
2151
2154
|
};
|
|
2152
|
-
return
|
|
2155
|
+
return X(() => {
|
|
2153
2156
|
const m = new ie({
|
|
2154
2157
|
doc: e.value,
|
|
2155
|
-
parent:
|
|
2156
|
-
}), b = new
|
|
2158
|
+
parent: r.value
|
|
2159
|
+
}), b = new no(m);
|
|
2157
2160
|
i.value = b, setTimeout(() => {
|
|
2158
|
-
b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(
|
|
2159
|
-
}, 0),
|
|
2161
|
+
b.setTabSize(a), b.setDisabled(e.disabled), b.setReadOnly(e.readonly), b.setExtensions(g()), e.placeholder && b.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && b.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2162
|
+
}, 0), f.on(l, {
|
|
2160
2163
|
name: "ctrlZ",
|
|
2161
2164
|
callback() {
|
|
2162
2165
|
il(m);
|
|
2163
2166
|
}
|
|
2164
|
-
}),
|
|
2167
|
+
}), f.on(l, {
|
|
2165
2168
|
name: "ctrlShiftZ",
|
|
2166
2169
|
callback() {
|
|
2167
2170
|
sl(m);
|
|
2168
2171
|
}
|
|
2169
|
-
}),
|
|
2172
|
+
}), f.on(l, {
|
|
2170
2173
|
name: "replace",
|
|
2171
2174
|
callback($, T = {}) {
|
|
2172
2175
|
var k;
|
|
2173
|
-
const { text: v, options:
|
|
2174
|
-
(k = i.value) == null || k.replaceSelectedText(v,
|
|
2176
|
+
const { text: v, options: h } = El($, i.value, T);
|
|
2177
|
+
(k = i.value) == null || k.replaceSelectedText(v, h, l);
|
|
2175
2178
|
}
|
|
2176
2179
|
});
|
|
2177
2180
|
}), H(
|
|
2178
|
-
[
|
|
2181
|
+
[n, le(e, "completions")],
|
|
2179
2182
|
() => {
|
|
2180
2183
|
var m;
|
|
2181
|
-
(m = i.value) == null || m.setExtensions(
|
|
2184
|
+
(m = i.value) == null || m.setExtensions(g());
|
|
2182
2185
|
},
|
|
2183
2186
|
{
|
|
2184
2187
|
deep: !0
|
|
@@ -2214,10 +2217,10 @@ const no = (e) => {
|
|
|
2214
2217
|
e.maxlength && ((m = i.value) == null || m.setMaxLength(e.maxlength));
|
|
2215
2218
|
}
|
|
2216
2219
|
), co(i), {
|
|
2217
|
-
inputWrapperRef:
|
|
2220
|
+
inputWrapperRef: r,
|
|
2218
2221
|
codeMirrorUt: i
|
|
2219
2222
|
};
|
|
2220
|
-
},
|
|
2223
|
+
}, ho = go, fo = {
|
|
2221
2224
|
value: {
|
|
2222
2225
|
type: String,
|
|
2223
2226
|
default: ""
|
|
@@ -2322,17 +2325,17 @@ const no = (e) => {
|
|
|
2322
2325
|
}
|
|
2323
2326
|
}, bo = /* @__PURE__ */ V({
|
|
2324
2327
|
name: "MDEditorContent",
|
|
2325
|
-
props:
|
|
2328
|
+
props: fo,
|
|
2326
2329
|
setup(e) {
|
|
2327
|
-
const a = A("editorId"), l =
|
|
2328
|
-
inputWrapperRef:
|
|
2329
|
-
codeMirrorUt:
|
|
2330
|
-
} =
|
|
2331
|
-
return
|
|
2330
|
+
const a = A("editorId"), l = U(""), {
|
|
2331
|
+
inputWrapperRef: n,
|
|
2332
|
+
codeMirrorUt: r
|
|
2333
|
+
} = ho(e);
|
|
2334
|
+
return Dl(e, l, r), () => t("div", {
|
|
2332
2335
|
class: `${o}-content`
|
|
2333
2336
|
}, [t("div", {
|
|
2334
2337
|
class: `${o}-input-wrapper`,
|
|
2335
|
-
ref:
|
|
2338
|
+
ref: n
|
|
2336
2339
|
}, null), t(Pt, {
|
|
2337
2340
|
modelValue: e.value,
|
|
2338
2341
|
setting: e.setting,
|
|
@@ -2364,12 +2367,12 @@ const no = (e) => {
|
|
|
2364
2367
|
setup(e) {
|
|
2365
2368
|
const a = A("usedLanguageText");
|
|
2366
2369
|
return () => {
|
|
2367
|
-
var l,
|
|
2370
|
+
var l, n;
|
|
2368
2371
|
return t("div", {
|
|
2369
2372
|
class: `${o}-footer-item`
|
|
2370
2373
|
}, [t("label", {
|
|
2371
2374
|
class: `${o}-footer-label`
|
|
2372
|
-
}, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((
|
|
2375
|
+
}, [`${(l = a.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((n = e.modelValue) == null ? void 0 : n.length) || 0])]);
|
|
2373
2376
|
};
|
|
2374
2377
|
}
|
|
2375
2378
|
}), ko = {
|
|
@@ -2444,12 +2447,12 @@ const no = (e) => {
|
|
|
2444
2447
|
name: "MDEditorFooter",
|
|
2445
2448
|
props: yo,
|
|
2446
2449
|
setup(e) {
|
|
2447
|
-
const a =
|
|
2448
|
-
const
|
|
2449
|
-
return [
|
|
2450
|
-
}), l = (
|
|
2451
|
-
if (
|
|
2452
|
-
switch (
|
|
2450
|
+
const a = fe(() => {
|
|
2451
|
+
const n = e.footers.indexOf("="), r = n === -1 ? e.footers : e.footers.slice(0, n), i = n === -1 ? [] : e.footers.slice(n, Number.MAX_SAFE_INTEGER);
|
|
2452
|
+
return [r, i];
|
|
2453
|
+
}), l = (n) => {
|
|
2454
|
+
if (It.includes(n))
|
|
2455
|
+
switch (n) {
|
|
2453
2456
|
case "markdownTotal":
|
|
2454
2457
|
return t(vo, {
|
|
2455
2458
|
modelValue: e.modelValue
|
|
@@ -2461,17 +2464,17 @@ const no = (e) => {
|
|
|
2461
2464
|
}, null);
|
|
2462
2465
|
}
|
|
2463
2466
|
else
|
|
2464
|
-
return e.defFooters instanceof Array ? e.defFooters[
|
|
2467
|
+
return e.defFooters instanceof Array ? e.defFooters[n] || "" : e.defFooters && e.defFooters.children instanceof Array && e.defFooters.children[n] || "";
|
|
2465
2468
|
};
|
|
2466
2469
|
return () => {
|
|
2467
|
-
const
|
|
2470
|
+
const n = a.value[0].map((i) => l(i)), r = a.value[1].map((i) => l(i));
|
|
2468
2471
|
return t("div", {
|
|
2469
2472
|
class: `${o}-footer`
|
|
2470
2473
|
}, [t("div", {
|
|
2471
2474
|
class: `${o}-footer-left`
|
|
2472
|
-
}, [
|
|
2475
|
+
}, [n]), t("div", {
|
|
2473
2476
|
class: `${o}-footer-right`
|
|
2474
|
-
}, [
|
|
2477
|
+
}, [r])]);
|
|
2475
2478
|
};
|
|
2476
2479
|
}
|
|
2477
2480
|
}), wo = /* @__PURE__ */ V({
|
|
@@ -2481,36 +2484,36 @@ const no = (e) => {
|
|
|
2481
2484
|
setup(e, a) {
|
|
2482
2485
|
const {
|
|
2483
2486
|
editorId: l,
|
|
2484
|
-
noKatex:
|
|
2485
|
-
noMermaid:
|
|
2487
|
+
noKatex: n,
|
|
2488
|
+
noMermaid: r,
|
|
2486
2489
|
noPrettier: i,
|
|
2487
2490
|
noUploadImg: u,
|
|
2488
2491
|
noHighlight: d
|
|
2489
|
-
} = e, c =
|
|
2492
|
+
} = e, c = Z({
|
|
2490
2493
|
scrollAuto: e.scrollAuto
|
|
2491
2494
|
});
|
|
2492
2495
|
Gt(e, a), Kt(e), jt(e), _t(e, a);
|
|
2493
|
-
const [
|
|
2496
|
+
const [g, m] = Wt(e, a), b = zt(e);
|
|
2494
2497
|
return At(() => {
|
|
2495
|
-
|
|
2496
|
-
}),
|
|
2498
|
+
f.clear(l);
|
|
2499
|
+
}), Xt(e, a, b, g, m), () => {
|
|
2497
2500
|
var v;
|
|
2498
|
-
const $ =
|
|
2501
|
+
const $ = rt({
|
|
2499
2502
|
props: e,
|
|
2500
2503
|
ctx: a
|
|
2501
|
-
}, "defToolbars"), T =
|
|
2504
|
+
}, "defToolbars"), T = rt({
|
|
2502
2505
|
props: e,
|
|
2503
2506
|
ctx: a
|
|
2504
2507
|
}, "defFooters");
|
|
2505
2508
|
return t("div", {
|
|
2506
2509
|
id: l,
|
|
2507
|
-
class: [o, e.class, e.theme === "dark" && `${o}-dark`,
|
|
2510
|
+
class: [o, e.class, e.theme === "dark" && `${o}-dark`, g.fullscreen || g.pageFullscreen ? `${o}-fullscreen` : ""],
|
|
2508
2511
|
style: e.style
|
|
2509
2512
|
}, [t(Al, {
|
|
2510
2513
|
noPrettier: i,
|
|
2511
2514
|
toolbars: e.toolbars,
|
|
2512
2515
|
toolbarsExclude: e.toolbarsExclude,
|
|
2513
|
-
setting:
|
|
2516
|
+
setting: g,
|
|
2514
2517
|
updateSetting: m,
|
|
2515
2518
|
tableShape: e.tableShape,
|
|
2516
2519
|
defToolbars: $,
|
|
@@ -2518,13 +2521,13 @@ const no = (e) => {
|
|
|
2518
2521
|
showToolbarName: e.showToolbarName
|
|
2519
2522
|
}, null), t(bo, {
|
|
2520
2523
|
value: e.modelValue,
|
|
2521
|
-
setting:
|
|
2524
|
+
setting: g,
|
|
2522
2525
|
mdHeadingId: e.mdHeadingId,
|
|
2523
|
-
noMermaid:
|
|
2526
|
+
noMermaid: r,
|
|
2524
2527
|
noPrettier: i,
|
|
2525
2528
|
sanitize: e.sanitize,
|
|
2526
2529
|
placeholder: e.placeholder,
|
|
2527
|
-
noKatex:
|
|
2530
|
+
noKatex: n,
|
|
2528
2531
|
scrollAuto: c.scrollAuto,
|
|
2529
2532
|
formatCopiedText: e.formatCopiedText,
|
|
2530
2533
|
autofocus: e.autoFocus,
|
|
@@ -2533,23 +2536,23 @@ const no = (e) => {
|
|
|
2533
2536
|
maxlength: e.maxLength,
|
|
2534
2537
|
autoDetectCode: e.autoDetectCode,
|
|
2535
2538
|
noHighlight: d,
|
|
2536
|
-
onChange: (
|
|
2537
|
-
e.onChange ? e.onChange(
|
|
2539
|
+
onChange: (h) => {
|
|
2540
|
+
e.onChange ? e.onChange(h) : (a.emit("update:modelValue", h), a.emit("onChange", h));
|
|
2538
2541
|
},
|
|
2539
|
-
onHtmlChanged: (
|
|
2540
|
-
e.onHtmlChanged ? e.onHtmlChanged(
|
|
2542
|
+
onHtmlChanged: (h) => {
|
|
2543
|
+
e.onHtmlChanged ? e.onHtmlChanged(h) : a.emit("onHtmlChanged", h);
|
|
2541
2544
|
},
|
|
2542
|
-
onGetCatalog: (
|
|
2543
|
-
e.onGetCatalog ? e.onGetCatalog(
|
|
2545
|
+
onGetCatalog: (h) => {
|
|
2546
|
+
e.onGetCatalog ? e.onGetCatalog(h) : a.emit("onGetCatalog", h);
|
|
2544
2547
|
},
|
|
2545
|
-
onBlur: (
|
|
2546
|
-
e.onBlur ? e.onBlur(
|
|
2548
|
+
onBlur: (h) => {
|
|
2549
|
+
e.onBlur ? e.onBlur(h) : a.emit("onBlur", h);
|
|
2547
2550
|
},
|
|
2548
|
-
onFocus: (
|
|
2549
|
-
e.onFocus ? e.onFocus(
|
|
2551
|
+
onFocus: (h) => {
|
|
2552
|
+
e.onFocus ? e.onFocus(h) : a.emit("onFocus", h);
|
|
2550
2553
|
},
|
|
2551
|
-
onInput: (
|
|
2552
|
-
e.onInput ? e.onInput(
|
|
2554
|
+
onInput: (h) => {
|
|
2555
|
+
e.onInput ? e.onInput(h) : a.emit("onInput", h);
|
|
2553
2556
|
},
|
|
2554
2557
|
completions: e.completions,
|
|
2555
2558
|
catalogVisible: b.value,
|
|
@@ -2559,12 +2562,12 @@ const no = (e) => {
|
|
|
2559
2562
|
footers: e.footers,
|
|
2560
2563
|
defFooters: T,
|
|
2561
2564
|
scrollAuto: c.scrollAuto,
|
|
2562
|
-
onScrollAutoChange: (
|
|
2565
|
+
onScrollAutoChange: (h) => c.scrollAuto = h
|
|
2563
2566
|
}, null)]);
|
|
2564
2567
|
};
|
|
2565
2568
|
}
|
|
2566
|
-
}),
|
|
2567
|
-
|
|
2569
|
+
}), he = wo;
|
|
2570
|
+
he.install = (e) => (e.component(he.name, he), e.use(gl).use(Ft).use(hl).use(Tt).use(Yt), e);
|
|
2568
2571
|
export {
|
|
2569
|
-
|
|
2572
|
+
he as default
|
|
2570
2573
|
};
|