md-editor-v3 4.11.3 → 4.12.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 +11 -1
- package/lib/cjs/DropdownToolbar.cjs +1 -1
- package/lib/cjs/MdCatalog.cjs +1 -1
- package/lib/cjs/MdEditor.cjs +7 -7
- package/lib/cjs/MdModal.cjs +1 -1
- package/lib/cjs/MdPreview.cjs +1 -1
- package/lib/cjs/ModalToolbar.cjs +1 -1
- package/lib/cjs/chunks/config.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +7 -7
- package/lib/cjs/chunks/index3.cjs +1 -1
- package/lib/cjs/chunks/index4.cjs +2 -2
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/DropdownToolbar.mjs +2 -5
- package/lib/es/MdCatalog.mjs +18 -18
- package/lib/es/MdEditor.mjs +173 -173
- package/lib/es/MdModal.mjs +2 -7
- package/lib/es/MdPreview.mjs +2 -14
- package/lib/es/ModalToolbar.mjs +8 -10
- package/lib/es/chunks/config.mjs +22 -23
- package/lib/es/chunks/index.mjs +153 -137
- package/lib/es/chunks/index3.mjs +108 -84
- package/lib/es/chunks/index4.mjs +22 -18
- package/lib/es/index.mjs +23 -44
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/DropdownToolbar/index.d.ts +8 -8
- package/lib/types/MdCatalog/CatalogLink.d.ts +1 -1
- package/lib/types/MdCatalog/MdCatalog.d.ts +1 -1
- package/lib/types/MdCatalog/index.d.ts +5 -5
- package/lib/types/MdEditor/Editor.d.ts +15 -15
- package/lib/types/MdEditor/components/Dropdown/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +19 -4
- package/lib/types/MdEditor/components/Modal/index.d.ts +34 -11
- package/lib/types/MdEditor/components/Popper/index.d.ts +15 -0
- package/lib/types/MdEditor/config.d.ts +3 -3
- package/lib/types/MdEditor/index.d.ts +68 -68
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +8 -4
- package/lib/types/MdEditor/layouts/Content/composition/useAttach.d.ts +9 -0
- package/lib/types/MdEditor/layouts/Content/index.d.ts +12 -8
- package/lib/types/MdEditor/layouts/Content/props.d.ts +6 -2
- package/lib/types/MdEditor/layouts/Modals/Link.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +1 -1
- package/lib/types/MdEditor/props.d.ts +2 -2
- package/lib/types/MdEditor/static/env.d.ts +1 -0
- package/lib/types/MdEditor/type.d.ts +7 -1
- package/lib/types/MdEditor/utils/index.d.ts +4 -0
- package/lib/types/MdPreview/MdPreview.d.ts +13 -13
- package/lib/types/MdPreview/index.d.ts +45 -45
- package/lib/types/ModalToolbar/ModalToolbar.d.ts +3 -3
- package/lib/types/ModalToolbar/index.d.ts +16 -16
- package/lib/types/NormalToolbar/index.d.ts +5 -5
- package/lib/umd/index.js +67 -68
- package/package.json +32 -32
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
var Ot = Object.defineProperty;
|
|
2
2
|
var Pt = (e, o, l) => o in e ? Ot(e, o, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[o] = l;
|
|
3
3
|
var z = (e, o, l) => (Pt(e, typeof o != "symbol" ? o + "" : o, l), l);
|
|
4
|
-
import { defineComponent as
|
|
5
|
-
import { p as a, e as X,
|
|
4
|
+
import { defineComponent as P, createVNode as t, inject as I, ref as O, onMounted as Y, reactive as _, computed as Ce, watch as H, nextTick as de, Fragment as Mt, cloneVNode as gt, toRef as Q, shallowRef as Wt, onBeforeUnmount as Et } from "vue";
|
|
5
|
+
import { p as a, e as X, l as zt, b as Ut, M as se, d as _t } from "./chunks/config.mjs";
|
|
6
6
|
import { draggingScroll as qt, linkTo as Gt, debounce as Kt, createSmoothScroll as jt, throttle as Zt } from "@vavt/util";
|
|
7
7
|
import { a as ae, D as Xt } from "./chunks/index2.mjs";
|
|
8
|
-
import { b as v, i as Yt, E as ee, U as $e,
|
|
8
|
+
import { b as v, i as Yt, E as ee, U as $e, k as Jt, l as ke, h as L, c as Qt, O as Ht, m as Dt, n as Nt } from "./chunks/index4.mjs";
|
|
9
9
|
import { a as el } from "./chunks/dom.mjs";
|
|
10
10
|
import { M as Bt, I as x } from "./chunks/index3.mjs";
|
|
11
11
|
import { EditorView as ce } from "codemirror";
|
|
12
12
|
import { EditorView as pe, placeholder as tl, keymap as ll } from "@codemirror/view";
|
|
13
13
|
import { languages as ol } from "@codemirror/language-data";
|
|
14
14
|
import { markdown as al } from "@codemirror/lang-markdown";
|
|
15
|
-
import { EditorSelection as
|
|
15
|
+
import { EditorSelection as U, EditorState as fe, Compartment as ne, StateEffect as nl } from "@codemirror/state";
|
|
16
16
|
import { deleteLine as il, defaultKeymap as rl, historyKeymap as sl, indentWithTab as cl, history as ft, undo as ul, redo as dl } from "@codemirror/commands";
|
|
17
17
|
import { HighlightStyle as Vt, syntaxHighlighting as Ft, indentUnit as ml } from "@codemirror/language";
|
|
18
18
|
import { tags as c } from "@lezer/highlight";
|
|
@@ -22,14 +22,7 @@ import Rt from "./MdCatalog.mjs";
|
|
|
22
22
|
import { g as ht } from "./chunks/vue-tsx.mjs";
|
|
23
23
|
import Sl from "./NormalToolbar.mjs";
|
|
24
24
|
import Al from "./ModalToolbar.mjs";
|
|
25
|
-
|
|
26
|
-
import "copy-to-clipboard";
|
|
27
|
-
import "markdown-it";
|
|
28
|
-
import "markdown-it-image-figures";
|
|
29
|
-
import "markdown-it-task-lists";
|
|
30
|
-
import "markdown-it-xss";
|
|
31
|
-
import "lru-cache";
|
|
32
|
-
const Ll = /* @__PURE__ */ O({
|
|
25
|
+
const Ll = /* @__PURE__ */ P({
|
|
33
26
|
setup() {
|
|
34
27
|
return () => t("div", {
|
|
35
28
|
class: `${a}-divider`
|
|
@@ -88,7 +81,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
88
81
|
var d, s, g, w;
|
|
89
82
|
const o = I("editorId");
|
|
90
83
|
let l = (s = (d = X.editorExtensions) == null ? void 0 : d.screenfull) == null ? void 0 : s.instance;
|
|
91
|
-
const n = (w = (g = X.editorExtensions) == null ? void 0 : g.screenfull) == null ? void 0 : w.js, r =
|
|
84
|
+
const n = (w = (g = X.editorExtensions) == null ? void 0 : g.screenfull) == null ? void 0 : w.js, r = O(!1), i = ($) => {
|
|
92
85
|
if (!l) {
|
|
93
86
|
v.emit(o, ee, {
|
|
94
87
|
name: "fullscreen",
|
|
@@ -125,11 +118,11 @@ const Ll = /* @__PURE__ */ O({
|
|
|
125
118
|
default: () => {
|
|
126
119
|
}
|
|
127
120
|
}
|
|
128
|
-
}, Hl = /* @__PURE__ */
|
|
121
|
+
}, Hl = /* @__PURE__ */ P({
|
|
129
122
|
name: "TableShape",
|
|
130
123
|
props: El,
|
|
131
124
|
setup(e) {
|
|
132
|
-
const o =
|
|
125
|
+
const o = _({
|
|
133
126
|
x: -1,
|
|
134
127
|
y: -1
|
|
135
128
|
});
|
|
@@ -173,7 +166,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
173
166
|
default: () => {
|
|
174
167
|
}
|
|
175
168
|
}
|
|
176
|
-
}, Bl = /* @__PURE__ */
|
|
169
|
+
}, Bl = /* @__PURE__ */ P({
|
|
177
170
|
props: Nl,
|
|
178
171
|
setup(e) {
|
|
179
172
|
const o = I("usedLanguageText"), l = I("editorId"), n = Ce(() => {
|
|
@@ -186,7 +179,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
186
179
|
default:
|
|
187
180
|
return "";
|
|
188
181
|
}
|
|
189
|
-
}), r =
|
|
182
|
+
}), r = _({
|
|
190
183
|
desc: "",
|
|
191
184
|
url: ""
|
|
192
185
|
});
|
|
@@ -258,13 +251,13 @@ const Ll = /* @__PURE__ */ O({
|
|
|
258
251
|
default: () => {
|
|
259
252
|
}
|
|
260
253
|
}
|
|
261
|
-
}, Fl = /* @__PURE__ */
|
|
254
|
+
}, Fl = /* @__PURE__ */ P({
|
|
262
255
|
props: Vl,
|
|
263
256
|
setup(e) {
|
|
264
257
|
var g, w, $;
|
|
265
258
|
const o = I("usedLanguageText"), l = I("editorId");
|
|
266
259
|
let n = ($ = (w = (g = X) == null ? void 0 : g.editorExtensions) == null ? void 0 : w.cropper) == null ? void 0 : $.instance;
|
|
267
|
-
const r =
|
|
260
|
+
const r = O(), i = O(), h = O(), f = _({
|
|
268
261
|
cropperInited: !1,
|
|
269
262
|
imgSelected: !1,
|
|
270
263
|
imgSrc: "",
|
|
@@ -284,8 +277,8 @@ const Ll = /* @__PURE__ */ O({
|
|
|
284
277
|
const S = r.value.files || [];
|
|
285
278
|
if (f.imgSelected = !0, (S == null ? void 0 : S.length) > 0) {
|
|
286
279
|
const m = new FileReader();
|
|
287
|
-
m.onload = (
|
|
288
|
-
f.imgSrc =
|
|
280
|
+
m.onload = (C) => {
|
|
281
|
+
f.imgSrc = C.target.result, de(() => {
|
|
289
282
|
d = new n(i.value, {
|
|
290
283
|
viewMode: 2,
|
|
291
284
|
preview: `.${a}-clip-preview-target`
|
|
@@ -325,7 +318,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
325
318
|
height: "421px"
|
|
326
319
|
}, {
|
|
327
320
|
default: () => {
|
|
328
|
-
var m,
|
|
321
|
+
var m, C;
|
|
329
322
|
return [t("div", {
|
|
330
323
|
class: `${a}-form-item ${a}-clip`
|
|
331
324
|
}, [t("div", {
|
|
@@ -367,7 +360,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
367
360
|
v.emit(l, $e, [Jt(u.toDataURL("image/png"))], e.onOk), s();
|
|
368
361
|
}
|
|
369
362
|
}
|
|
370
|
-
}, [((m = o.value.clipModalTips) == null ? void 0 : m.buttonUpload) || ((
|
|
363
|
+
}, [((m = o.value.clipModalTips) == null ? void 0 : m.buttonUpload) || ((C = o.value.linkModalTips) == null ? void 0 : C.buttonOK)])]), t("input", {
|
|
371
364
|
ref: r,
|
|
372
365
|
accept: "image/*",
|
|
373
366
|
type: "file",
|
|
@@ -403,7 +396,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
403
396
|
default: () => {
|
|
404
397
|
}
|
|
405
398
|
}
|
|
406
|
-
}, Ol = /* @__PURE__ */
|
|
399
|
+
}, Ol = /* @__PURE__ */ P({
|
|
407
400
|
props: Rl,
|
|
408
401
|
setup(e) {
|
|
409
402
|
return () => t(Mt, null, [t(Bl, {
|
|
@@ -417,13 +410,13 @@ const Ll = /* @__PURE__ */ O({
|
|
|
417
410
|
onCancel: e.onCancel
|
|
418
411
|
}, null)]);
|
|
419
412
|
}
|
|
420
|
-
}), Pl = /* @__PURE__ */
|
|
413
|
+
}), Pl = /* @__PURE__ */ P({
|
|
421
414
|
name: "MDEditorToolbar",
|
|
422
415
|
props: Il,
|
|
423
416
|
setup(e) {
|
|
424
417
|
const o = I("editorId"), l = I("usedLanguageText"), n = I("theme"), r = I("language"), {
|
|
425
418
|
fullscreenHandler: i
|
|
426
|
-
} = Ml(e), h = `${o}-toolbar-wrapper`, f =
|
|
419
|
+
} = Ml(e), h = `${o}-toolbar-wrapper`, f = O(), d = _({
|
|
427
420
|
title: !1,
|
|
428
421
|
catalog: !1,
|
|
429
422
|
// 图片上传下拉
|
|
@@ -435,11 +428,11 @@ const Ll = /* @__PURE__ */ O({
|
|
|
435
428
|
katex: !1
|
|
436
429
|
}), s = (u, b) => {
|
|
437
430
|
v.emit(o, L, u, b);
|
|
438
|
-
}, g =
|
|
431
|
+
}, g = _({
|
|
439
432
|
type: "link",
|
|
440
433
|
linkVisible: !1,
|
|
441
434
|
clipVisible: !1
|
|
442
|
-
}), w =
|
|
435
|
+
}), w = O();
|
|
443
436
|
Y(() => {
|
|
444
437
|
v.on(o, {
|
|
445
438
|
name: ke,
|
|
@@ -449,17 +442,17 @@ const Ll = /* @__PURE__ */ O({
|
|
|
449
442
|
});
|
|
450
443
|
});
|
|
451
444
|
const $ = Ce(() => {
|
|
452
|
-
const u = e.toolbars.filter((
|
|
445
|
+
const u = e.toolbars.filter((k) => !e.toolbarsExclude.includes(k)), b = u.indexOf("="), p = b === -1 ? u : u.slice(0, b + 1), y = b === -1 ? [] : u.slice(b, Number.MAX_SAFE_INTEGER);
|
|
453
446
|
return [p, y];
|
|
454
|
-
}), S =
|
|
447
|
+
}), S = O(), m = () => {
|
|
455
448
|
v.emit(o, $e, Array.from(S.value.files || [])), S.value.value = "";
|
|
456
449
|
};
|
|
457
450
|
Y(() => {
|
|
458
451
|
S.value.addEventListener("change", m);
|
|
459
452
|
});
|
|
460
|
-
const
|
|
461
|
-
var b, p, y,
|
|
462
|
-
if (
|
|
453
|
+
const C = (u) => {
|
|
454
|
+
var b, p, y, k, A, F, D, W, q, R, N, B, Z, G, K, te, le, oe, j, V, M, me, ye, Te, we, xe, Se, Ae, Le, Ie, Me, Ee, He, De, Ne, Be, Ve, Fe, Re, Oe, Pe, We, ze, Ue, _e, qe, Ge, Ke, je, Ze, Xe, Ye, Je, Qe, et, tt, lt, ot, at, nt, it, rt, st, ct, ut, dt, mt;
|
|
455
|
+
if (Ut.includes(u))
|
|
463
456
|
switch (u) {
|
|
464
457
|
case "-":
|
|
465
458
|
return t(Ll, null, null);
|
|
@@ -486,7 +479,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
486
479
|
name: "underline"
|
|
487
480
|
}, null), e.showToolbarName && t("div", {
|
|
488
481
|
class: `${a}-toolbar-item-name`
|
|
489
|
-
}, [(
|
|
482
|
+
}, [(k = l.value.toolbarTips) == null ? void 0 : k.underline])]);
|
|
490
483
|
case "italic":
|
|
491
484
|
return t("div", {
|
|
492
485
|
class: `${a}-toolbar-item`,
|
|
@@ -498,11 +491,11 @@ const Ll = /* @__PURE__ */ O({
|
|
|
498
491
|
name: "italic"
|
|
499
492
|
}, null), e.showToolbarName && t("div", {
|
|
500
493
|
class: `${a}-toolbar-item-name`
|
|
501
|
-
}, [(
|
|
494
|
+
}, [(F = l.value.toolbarTips) == null ? void 0 : F.italic])]);
|
|
502
495
|
case "strikeThrough":
|
|
503
496
|
return t("div", {
|
|
504
497
|
class: `${a}-toolbar-item`,
|
|
505
|
-
title: (
|
|
498
|
+
title: (D = l.value.toolbarTips) == null ? void 0 : D.strikeThrough,
|
|
506
499
|
onClick: () => {
|
|
507
500
|
s("strikeThrough");
|
|
508
501
|
}
|
|
@@ -533,17 +526,17 @@ const Ll = /* @__PURE__ */ O({
|
|
|
533
526
|
onClick: () => {
|
|
534
527
|
s("h2");
|
|
535
528
|
}
|
|
536
|
-
}, [(
|
|
529
|
+
}, [(R = l.value.titleItem) == null ? void 0 : R.h2]), t("li", {
|
|
537
530
|
class: `${a}-menu-item ${a}-menu-item-title`,
|
|
538
531
|
onClick: () => {
|
|
539
532
|
s("h3");
|
|
540
533
|
}
|
|
541
|
-
}, [(
|
|
534
|
+
}, [(N = l.value.titleItem) == null ? void 0 : N.h3]), t("li", {
|
|
542
535
|
class: `${a}-menu-item ${a}-menu-item-title`,
|
|
543
536
|
onClick: () => {
|
|
544
537
|
s("h4");
|
|
545
538
|
}
|
|
546
|
-
}, [(
|
|
539
|
+
}, [(B = l.value.titleItem) == null ? void 0 : B.h4]), t("li", {
|
|
547
540
|
class: `${a}-menu-item ${a}-menu-item-title`,
|
|
548
541
|
onClick: () => {
|
|
549
542
|
s("h5");
|
|
@@ -602,7 +595,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
602
595
|
name: "quote"
|
|
603
596
|
}, null), e.showToolbarName && t("div", {
|
|
604
597
|
class: `${a}-toolbar-item-name`
|
|
605
|
-
}, [(
|
|
598
|
+
}, [(V = l.value.toolbarTips) == null ? void 0 : V.quote])]);
|
|
606
599
|
case "unorderedList":
|
|
607
600
|
return t("div", {
|
|
608
601
|
class: `${a}-toolbar-item`,
|
|
@@ -794,7 +787,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
794
787
|
case "prettier":
|
|
795
788
|
return e.noPrettier ? "" : t("div", {
|
|
796
789
|
class: `${a}-toolbar-item`,
|
|
797
|
-
title: (
|
|
790
|
+
title: (Ue = l.value.toolbarTips) == null ? void 0 : Ue.prettier,
|
|
798
791
|
onClick: () => {
|
|
799
792
|
s("prettier");
|
|
800
793
|
}
|
|
@@ -802,7 +795,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
802
795
|
name: "prettier"
|
|
803
796
|
}, null), e.showToolbarName && t("div", {
|
|
804
797
|
class: `${a}-toolbar-item-name`
|
|
805
|
-
}, [(
|
|
798
|
+
}, [(_e = l.value.toolbarTips) == null ? void 0 : _e.prettier])]);
|
|
806
799
|
case "pageFullscreen":
|
|
807
800
|
return !e.setting.fullscreen && t("div", {
|
|
808
801
|
class: `${a}-toolbar-item`,
|
|
@@ -1011,7 +1004,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1011
1004
|
}, {
|
|
1012
1005
|
immediate: !0
|
|
1013
1006
|
}), () => {
|
|
1014
|
-
const u = $.value[0].map((p) =>
|
|
1007
|
+
const u = $.value[0].map((p) => C(p)), b = $.value[1].map((p) => C(p));
|
|
1015
1008
|
return t(Mt, null, [e.toolbars.length > 0 && t("div", {
|
|
1016
1009
|
class: `${a}-toolbar-wrapper`,
|
|
1017
1010
|
ref: f,
|
|
@@ -1070,19 +1063,19 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1070
1063
|
e.removeEventListener("scroll", n), o.removeEventListener("scroll", n);
|
|
1071
1064
|
}
|
|
1072
1065
|
];
|
|
1073
|
-
},
|
|
1066
|
+
}, Ul = (e, o, l) => {
|
|
1074
1067
|
const { view: n } = l, r = jt(), i = (u) => n.lineBlockAt(n.state.doc.line(u).from).top, h = (u) => n.lineBlockAt(n.state.doc.line(u).from).height;
|
|
1075
1068
|
let f = [], d = [], s = [];
|
|
1076
1069
|
const g = () => {
|
|
1077
1070
|
f = [], d = [], s = [], d = d.concat(
|
|
1078
1071
|
Array.from(o.querySelectorAll(Wl))
|
|
1079
1072
|
);
|
|
1080
|
-
const u = d.map((
|
|
1073
|
+
const u = d.map((k) => Number(k.dataset.line) + 1);
|
|
1081
1074
|
s = s.concat(u);
|
|
1082
1075
|
const { lines: b } = n.state.doc;
|
|
1083
1076
|
let p = 1, y = u.shift() ?? b;
|
|
1084
|
-
for (let
|
|
1085
|
-
|
|
1077
|
+
for (let k = 1; k <= b; k++)
|
|
1078
|
+
k === y && (p = k, y = u.shift() || b + 1), f.push({
|
|
1086
1079
|
start: p,
|
|
1087
1080
|
end: y - 1
|
|
1088
1081
|
});
|
|
@@ -1095,14 +1088,14 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1095
1088
|
w++;
|
|
1096
1089
|
const { scrollDOM: u, contentHeight: b } = n;
|
|
1097
1090
|
let p = +getComputedStyle(o).paddingTop.replace("px", "");
|
|
1098
|
-
const y = n.lineBlockAtHeight(u.scrollTop), { number:
|
|
1091
|
+
const y = n.lineBlockAtHeight(u.scrollTop), { number: k } = n.state.doc.lineAt(y.from), A = f[k - 1];
|
|
1099
1092
|
if (!A)
|
|
1100
1093
|
return !1;
|
|
1101
|
-
let
|
|
1102
|
-
const W = i(A.start), q = o.querySelector(`[data-line="${A.start - 1}"]`) || ((G = o.firstElementChild) == null ? void 0 : G.firstElementChild),
|
|
1103
|
-
let
|
|
1104
|
-
W === 0 ? (
|
|
1105
|
-
const Z =
|
|
1094
|
+
let F = i(A.end) + h(A.end), D = 0;
|
|
1095
|
+
const W = i(A.start), q = o.querySelector(`[data-line="${A.start - 1}"]`) || ((G = o.firstElementChild) == null ? void 0 : G.firstElementChild), R = o.querySelector(`[data-line="${A.end}"]`) || ((K = o.lastElementChild) == null ? void 0 : K.lastElementChild);
|
|
1096
|
+
let N = 0, B = 0;
|
|
1097
|
+
W === 0 ? (D = u.scrollTop / F, q === R ? (p = 0, F = b - u.offsetHeight, N = R.offsetTop + R.offsetHeight - o.clientHeight) : N = R.offsetTop) : (D = (u.scrollTop - W) / (F - W), B = q.offsetTop, N = R.offsetTop - B), F > u.scrollHeight - u.clientHeight && (D = (u.scrollTop - W) / (u.scrollHeight - u.clientHeight - W), B = q.offsetTop, N = o.scrollHeight - o.clientHeight - B + 10);
|
|
1098
|
+
const Z = B - p + N * D;
|
|
1106
1099
|
r(o, Z, () => {
|
|
1107
1100
|
w--;
|
|
1108
1101
|
});
|
|
@@ -1112,70 +1105,70 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1112
1105
|
return;
|
|
1113
1106
|
$++;
|
|
1114
1107
|
const { scrollDOM: u } = n, b = o.scrollTop, p = o.scrollHeight;
|
|
1115
|
-
let y = (Z = o.firstElementChild) == null ? void 0 : Z.firstElementChild,
|
|
1108
|
+
let y = (Z = o.firstElementChild) == null ? void 0 : Z.firstElementChild, k = (G = o.firstElementChild) == null ? void 0 : G.lastElementChild;
|
|
1116
1109
|
if (s.length > 0) {
|
|
1117
1110
|
let j = Math.ceil(
|
|
1118
1111
|
Number(s[s.length - 1]) * (b / p)
|
|
1119
|
-
),
|
|
1120
|
-
|
|
1121
|
-
for (let M =
|
|
1112
|
+
), V = s.findLastIndex((M) => M <= j);
|
|
1113
|
+
V = V === -1 ? 0 : V, j = s[V];
|
|
1114
|
+
for (let M = V; M >= 0 && M < s.length; )
|
|
1122
1115
|
if (d[M].offsetTop > b) {
|
|
1123
1116
|
if (M - 1 >= 0) {
|
|
1124
1117
|
M--;
|
|
1125
1118
|
continue;
|
|
1126
1119
|
}
|
|
1127
|
-
j = -1,
|
|
1120
|
+
j = -1, V = M;
|
|
1128
1121
|
break;
|
|
1129
1122
|
} else {
|
|
1130
1123
|
if (M + 1 <= s.length && d[M + 1].offsetTop < b) {
|
|
1131
1124
|
M++;
|
|
1132
1125
|
continue;
|
|
1133
1126
|
}
|
|
1134
|
-
j = s[M],
|
|
1127
|
+
j = s[M], V = M;
|
|
1135
1128
|
break;
|
|
1136
1129
|
}
|
|
1137
1130
|
switch (j) {
|
|
1138
1131
|
case -1: {
|
|
1139
|
-
y = (K = o.firstElementChild) == null ? void 0 : K.firstElementChild,
|
|
1132
|
+
y = (K = o.firstElementChild) == null ? void 0 : K.firstElementChild, k = d[V];
|
|
1140
1133
|
break;
|
|
1141
1134
|
}
|
|
1142
1135
|
case s.length - 1: {
|
|
1143
|
-
y = d[
|
|
1136
|
+
y = d[V], k = (te = o.firstElementChild) == null ? void 0 : te.lastElementChild;
|
|
1144
1137
|
break;
|
|
1145
1138
|
}
|
|
1146
1139
|
default:
|
|
1147
|
-
y = d[
|
|
1140
|
+
y = d[V], k = d[V + 1];
|
|
1148
1141
|
}
|
|
1149
1142
|
}
|
|
1150
1143
|
const A = y === ((le = o.firstElementChild) == null ? void 0 : le.firstElementChild) ? 0 : y.offsetTop;
|
|
1151
|
-
let
|
|
1152
|
-
const { start: W, end: q } = f[Number(y.dataset.line || 0)],
|
|
1153
|
-
let
|
|
1154
|
-
|
|
1144
|
+
let F = k.offsetTop, D = 0;
|
|
1145
|
+
const { start: W, end: q } = f[Number(y.dataset.line || 0)], R = i(W);
|
|
1146
|
+
let N = i(q + 1), B = 0;
|
|
1147
|
+
N > u.scrollHeight - u.clientHeight || k.scrollTop > o.scrollHeight - o.clientHeight ? (D = Math.max(
|
|
1155
1148
|
(b - A) / (o.scrollHeight - A - o.clientHeight),
|
|
1156
1149
|
0
|
|
1157
|
-
),
|
|
1158
|
-
(b - A) / (
|
|
1150
|
+
), N = i(n.state.doc.lines) + h(n.state.doc.lines), B = 8 + N - R - e.clientHeight) : y === ((oe = o.firstElementChild) == null ? void 0 : oe.firstElementChild) ? (y === k && (F = k.offsetTop + k.offsetHeight + +getComputedStyle(k).marginBottom.replace("px", "")), B = N, D = Math.max(b / F, 0)) : (D = Math.max(
|
|
1151
|
+
(b - A) / (F - A),
|
|
1159
1152
|
0
|
|
1160
|
-
),
|
|
1153
|
+
), B = N - R), r(e, R + B * D, () => {
|
|
1161
1154
|
$--;
|
|
1162
1155
|
});
|
|
1163
|
-
},
|
|
1164
|
-
var
|
|
1156
|
+
}, C = Zt((u) => {
|
|
1157
|
+
var k;
|
|
1165
1158
|
const { scrollDOM: b, contentHeight: p } = n, y = b.clientHeight;
|
|
1166
|
-
if (p <= y || o.firstElementChild.clientHeight <= o.clientHeight || n.state.doc.lines < ((
|
|
1159
|
+
if (p <= y || o.firstElementChild.clientHeight <= o.clientHeight || n.state.doc.lines < ((k = f[f.length - 1]) == null ? void 0 : k.end))
|
|
1167
1160
|
return !1;
|
|
1168
1161
|
u.target === e ? S() : m();
|
|
1169
1162
|
}, 8);
|
|
1170
1163
|
return [
|
|
1171
1164
|
() => {
|
|
1172
|
-
g(), e.addEventListener("scroll",
|
|
1165
|
+
g(), e.addEventListener("scroll", C), o.addEventListener("scroll", C), e.dispatchEvent(new Event("scroll"));
|
|
1173
1166
|
},
|
|
1174
1167
|
() => {
|
|
1175
|
-
e.removeEventListener("scroll",
|
|
1168
|
+
e.removeEventListener("scroll", C), o.removeEventListener("scroll", C);
|
|
1176
1169
|
}
|
|
1177
1170
|
];
|
|
1178
|
-
},
|
|
1171
|
+
}, _l = (e, o, l) => {
|
|
1179
1172
|
const n = I("editorId");
|
|
1180
1173
|
let r = () => {
|
|
1181
1174
|
}, i = () => {
|
|
@@ -1185,11 +1178,11 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1185
1178
|
const f = document.querySelector(
|
|
1186
1179
|
`#${n} .cm-scroller`
|
|
1187
1180
|
), d = document.querySelector(
|
|
1188
|
-
`[id="${n}-preview-wrapper"]
|
|
1181
|
+
`[id="${n}-preview-wrapper"]`
|
|
1189
1182
|
), s = document.querySelector(
|
|
1190
|
-
`[id="${n}-html-wrapper"]
|
|
1183
|
+
`[id="${n}-html-wrapper"]`
|
|
1191
1184
|
);
|
|
1192
|
-
(d || s) && ([i, r] = (d ?
|
|
1185
|
+
(d || s) && ([i, r] = (d ? Ul : zl)(
|
|
1193
1186
|
f,
|
|
1194
1187
|
d || s,
|
|
1195
1188
|
l.value
|
|
@@ -1212,8 +1205,8 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1212
1205
|
f ? i() : r();
|
|
1213
1206
|
}
|
|
1214
1207
|
), Y(h);
|
|
1215
|
-
}, ql =
|
|
1216
|
-
var g, w, $, S, m,
|
|
1208
|
+
}, ql = (e, o, l) => {
|
|
1209
|
+
var g, w, $, S, m, C;
|
|
1217
1210
|
let n = "", r = 0, i = 0, h = !0, f = !1;
|
|
1218
1211
|
const d = o.getSelectedText(), s = (g = X.editorConfig) == null ? void 0 : g.mermaidTemplate;
|
|
1219
1212
|
if (/^h[1-6]{1}$/.test(e)) {
|
|
@@ -1221,7 +1214,7 @@ const Ll = /* @__PURE__ */ O({
|
|
|
1221
1214
|
n = `${u} ${d}`, r = u.length + 1;
|
|
1222
1215
|
} else if (e === "prettier") {
|
|
1223
1216
|
const u = window.prettier || (($ = (w = X.editorExtensions) == null ? void 0 : w.prettier) == null ? void 0 : $.prettierInstance), b = [
|
|
1224
|
-
((S = window.prettierPlugins) == null ? void 0 : S.markdown) || ((
|
|
1217
|
+
((S = window.prettierPlugins) == null ? void 0 : S.markdown) || ((C = (m = X.editorExtensions) == null ? void 0 : m.prettier) == null ? void 0 : C.parserMarkdownInstance)
|
|
1225
1218
|
];
|
|
1226
1219
|
!u || b[0] === void 0 ? (v.emit(l.editorId, ee, {
|
|
1227
1220
|
name: "prettier",
|
|
@@ -1296,7 +1289,7 @@ ${u}
|
|
|
1296
1289
|
for (let y = 0; y <= b; y++) {
|
|
1297
1290
|
n += `
|
|
1298
1291
|
|`;
|
|
1299
|
-
for (let
|
|
1292
|
+
for (let k = 0; k <= p; k++)
|
|
1300
1293
|
n += " content |";
|
|
1301
1294
|
}
|
|
1302
1295
|
r = 2, i = 5 - n.length;
|
|
@@ -1309,8 +1302,15 @@ ${u}
|
|
|
1309
1302
|
}
|
|
1310
1303
|
case "image": {
|
|
1311
1304
|
const { desc: u, url: b, urls: p } = l;
|
|
1312
|
-
p instanceof Array ? n = p.reduce((y,
|
|
1313
|
-
|
|
1305
|
+
p instanceof Array ? n = p.reduce((y, k) => {
|
|
1306
|
+
const {
|
|
1307
|
+
url: A = "",
|
|
1308
|
+
alt: F = "",
|
|
1309
|
+
title: D = ""
|
|
1310
|
+
} = typeof k == "object" ? k : { url: k };
|
|
1311
|
+
return y + `
|
|
1312
|
+
`;
|
|
1313
|
+
}, "") : n = `
|
|
1314
1314
|
`, h = !1;
|
|
1315
1315
|
break;
|
|
1316
1316
|
}
|
|
@@ -1424,7 +1424,7 @@ $$
|
|
|
1424
1424
|
replaceAll: f
|
|
1425
1425
|
}
|
|
1426
1426
|
};
|
|
1427
|
-
},
|
|
1427
|
+
}, Gl = "#e5c07b", bt = "var(--md-color)", Kl = "#56b6c2", jl = "#ffffff", ie = "var(--md-color)", vt = "#e5c07b", Zl = "#e5c07b", Xl = "var(--md-color)", kt = "#d19a66", Yl = "#c678dd", Jl = "#21252b", Ql = "#2c313a", Ct = "var(--md-bk-color)", he = "var(--md-bk-color)", eo = "#ceedfa33", $t = "#528bff", to = pe.theme(
|
|
1428
1428
|
{
|
|
1429
1429
|
"&": {
|
|
1430
1430
|
color: ie,
|
|
@@ -1434,8 +1434,8 @@ $$
|
|
|
1434
1434
|
caretColor: $t
|
|
1435
1435
|
},
|
|
1436
1436
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: $t },
|
|
1437
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1438
|
-
".cm-panels": { backgroundColor:
|
|
1437
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: eo },
|
|
1438
|
+
".cm-panels": { backgroundColor: Jl, color: ie },
|
|
1439
1439
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1440
1440
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1441
1441
|
".cm-searchMatch": {
|
|
@@ -1457,7 +1457,7 @@ $$
|
|
|
1457
1457
|
borderColor: "var(--md-border-color)"
|
|
1458
1458
|
},
|
|
1459
1459
|
".cm-activeLineGutter": {
|
|
1460
|
-
backgroundColor:
|
|
1460
|
+
backgroundColor: Ql
|
|
1461
1461
|
},
|
|
1462
1462
|
".cm-foldPlaceholder": {
|
|
1463
1463
|
backgroundColor: "transparent",
|
|
@@ -1483,10 +1483,10 @@ $$
|
|
|
1483
1483
|
}
|
|
1484
1484
|
},
|
|
1485
1485
|
{ dark: !0 }
|
|
1486
|
-
),
|
|
1487
|
-
{ tag: c.keyword, color:
|
|
1486
|
+
), lo = Vt.define([
|
|
1487
|
+
{ tag: c.keyword, color: Yl },
|
|
1488
1488
|
{ tag: [c.name, c.deleted, c.character, c.propertyName, c.macroName], color: bt },
|
|
1489
|
-
{ tag: [c.function(c.variableName), c.labelName], color:
|
|
1489
|
+
{ tag: [c.function(c.variableName), c.labelName], color: Zl },
|
|
1490
1490
|
{ tag: [c.color, c.constant(c.name), c.standard(c.name)], color: kt },
|
|
1491
1491
|
{ tag: [c.definition(c.name), c.separator], color: ie },
|
|
1492
1492
|
{
|
|
@@ -1500,7 +1500,7 @@ $$
|
|
|
1500
1500
|
c.self,
|
|
1501
1501
|
c.namespace
|
|
1502
1502
|
],
|
|
1503
|
-
color:
|
|
1503
|
+
color: Gl
|
|
1504
1504
|
},
|
|
1505
1505
|
{
|
|
1506
1506
|
tag: [
|
|
@@ -1512,7 +1512,7 @@ $$
|
|
|
1512
1512
|
c.link,
|
|
1513
1513
|
c.special(c.string)
|
|
1514
1514
|
],
|
|
1515
|
-
color:
|
|
1515
|
+
color: Kl
|
|
1516
1516
|
},
|
|
1517
1517
|
{ tag: [c.meta, c.comment], color: vt },
|
|
1518
1518
|
{ tag: c.strong, fontWeight: "bold" },
|
|
@@ -1521,12 +1521,12 @@ $$
|
|
|
1521
1521
|
{ tag: c.link, color: vt, textDecoration: "underline" },
|
|
1522
1522
|
{ tag: c.heading, fontWeight: "bold", color: bt },
|
|
1523
1523
|
{ tag: [c.atom, c.bool, c.special(c.variableName)], color: kt },
|
|
1524
|
-
{ tag: [c.processingInstruction, c.string, c.inserted], color:
|
|
1525
|
-
{ tag: c.invalid, color:
|
|
1524
|
+
{ tag: [c.processingInstruction, c.string, c.inserted], color: Xl },
|
|
1525
|
+
{ tag: c.invalid, color: jl }
|
|
1526
1526
|
]), pt = [
|
|
1527
|
-
|
|
1528
|
-
Ft(
|
|
1529
|
-
],
|
|
1527
|
+
to,
|
|
1528
|
+
Ft(lo)
|
|
1529
|
+
], oo = "#e5c07b", yt = "#3f4a54", ao = "#56b6c2", no = "#fff", re = "#3f4a54", Tt = "#2d8cf0", io = "#2d8cf0", ro = "#3f4a54", wt = "#d19a66", so = "#c678dd", co = "#21252b", uo = "#ceedfa33", xt = "var(--md-bk-color)", be = "var(--md-bk-color)", mo = "#bad5fa", St = "#3f4a54", go = pe.theme(
|
|
1530
1530
|
{
|
|
1531
1531
|
"&": {
|
|
1532
1532
|
color: re,
|
|
@@ -1536,8 +1536,8 @@ $$
|
|
|
1536
1536
|
caretColor: St
|
|
1537
1537
|
},
|
|
1538
1538
|
".cm-cursor, .cm-dropCursor": { borderLeftColor: St },
|
|
1539
|
-
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor:
|
|
1540
|
-
".cm-panels": { backgroundColor:
|
|
1539
|
+
"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection": { backgroundColor: mo },
|
|
1540
|
+
".cm-panels": { backgroundColor: co, color: re },
|
|
1541
1541
|
".cm-panels.cm-panels-top": { borderBottom: "2px solid black" },
|
|
1542
1542
|
".cm-panels.cm-panels-bottom": { borderTop: "2px solid black" },
|
|
1543
1543
|
".cm-searchMatch": {
|
|
@@ -1559,7 +1559,7 @@ $$
|
|
|
1559
1559
|
borderColor: "var(--md-border-color)"
|
|
1560
1560
|
},
|
|
1561
1561
|
".cm-activeLineGutter": {
|
|
1562
|
-
backgroundColor:
|
|
1562
|
+
backgroundColor: uo
|
|
1563
1563
|
},
|
|
1564
1564
|
".cm-foldPlaceholder": {
|
|
1565
1565
|
backgroundColor: "transparent",
|
|
@@ -1585,10 +1585,10 @@ $$
|
|
|
1585
1585
|
}
|
|
1586
1586
|
}
|
|
1587
1587
|
// { dark: true }
|
|
1588
|
-
),
|
|
1589
|
-
{ tag: c.keyword, color:
|
|
1588
|
+
), fo = Vt.define([
|
|
1589
|
+
{ tag: c.keyword, color: so },
|
|
1590
1590
|
{ tag: [c.name, c.deleted, c.character, c.propertyName, c.macroName], color: yt },
|
|
1591
|
-
{ tag: [c.function(c.variableName), c.labelName], color:
|
|
1591
|
+
{ tag: [c.function(c.variableName), c.labelName], color: io },
|
|
1592
1592
|
{ tag: [c.color, c.constant(c.name), c.standard(c.name)], color: wt },
|
|
1593
1593
|
{ tag: [c.definition(c.name), c.separator], color: re },
|
|
1594
1594
|
{
|
|
@@ -1602,7 +1602,7 @@ $$
|
|
|
1602
1602
|
c.self,
|
|
1603
1603
|
c.namespace
|
|
1604
1604
|
],
|
|
1605
|
-
color:
|
|
1605
|
+
color: oo
|
|
1606
1606
|
},
|
|
1607
1607
|
{
|
|
1608
1608
|
tag: [
|
|
@@ -1614,7 +1614,7 @@ $$
|
|
|
1614
1614
|
c.link,
|
|
1615
1615
|
c.special(c.string)
|
|
1616
1616
|
],
|
|
1617
|
-
color:
|
|
1617
|
+
color: ao
|
|
1618
1618
|
},
|
|
1619
1619
|
{ tag: [c.meta, c.comment], color: Tt },
|
|
1620
1620
|
{ tag: c.strong, fontWeight: "bold" },
|
|
@@ -1623,23 +1623,23 @@ $$
|
|
|
1623
1623
|
{ tag: c.link, color: Tt, textDecoration: "underline" },
|
|
1624
1624
|
{ tag: c.heading, fontWeight: "bold", color: yt },
|
|
1625
1625
|
{ tag: [c.atom, c.bool, c.special(c.variableName)], color: wt },
|
|
1626
|
-
{ tag: [c.processingInstruction, c.string, c.inserted], color:
|
|
1627
|
-
{ tag: c.invalid, color:
|
|
1626
|
+
{ tag: [c.processingInstruction, c.string, c.inserted], color: ro },
|
|
1627
|
+
{ tag: c.invalid, color: no }
|
|
1628
1628
|
]), At = [
|
|
1629
|
-
|
|
1630
|
-
Ft(
|
|
1629
|
+
go,
|
|
1630
|
+
Ft(fo)
|
|
1631
1631
|
], ue = (e, o, l, n, r) => (i, h, f, d) => {
|
|
1632
1632
|
const s = `${e}${o}`.slice(d - f);
|
|
1633
1633
|
i.dispatch(i.state.replaceSelection(`${s}${l}${n}`));
|
|
1634
1634
|
const g = f + h.label.length + (r === "title" ? l.length : 0);
|
|
1635
1635
|
i.dispatch({
|
|
1636
|
-
selection:
|
|
1636
|
+
selection: U.create(
|
|
1637
1637
|
[
|
|
1638
|
-
|
|
1638
|
+
U.range(
|
|
1639
1639
|
f + h.label.length + (r === "title" ? 1 : -o.length),
|
|
1640
1640
|
g
|
|
1641
1641
|
),
|
|
1642
|
-
|
|
1642
|
+
U.cursor(g)
|
|
1643
1643
|
],
|
|
1644
1644
|
1
|
|
1645
1645
|
)
|
|
@@ -1647,7 +1647,7 @@ $$
|
|
|
1647
1647
|
}, Lt = (e) => (o, l, n, r) => {
|
|
1648
1648
|
const i = e.slice(r - n);
|
|
1649
1649
|
o.dispatch(o.state.replaceSelection(`${i} `));
|
|
1650
|
-
},
|
|
1650
|
+
}, It = (e) => {
|
|
1651
1651
|
const o = (l) => {
|
|
1652
1652
|
const n = l.matchBefore(
|
|
1653
1653
|
/^#+|^-\s*\[*\s*\]*|`+|\[|!\[*|^\|\s?\|?|^\$\$?|!+\s*\w*/
|
|
@@ -1746,13 +1746,13 @@ $$`, "title")
|
|
|
1746
1746
|
return gl({
|
|
1747
1747
|
override: e ? [o, ...e] : [o]
|
|
1748
1748
|
});
|
|
1749
|
-
},
|
|
1749
|
+
}, J = (e) => {
|
|
1750
1750
|
const o = new ne();
|
|
1751
1751
|
return (n) => (o.get(e.state) ? e.dispatch({ effects: o.reconfigure(n) }) : e.dispatch({
|
|
1752
1752
|
effects: nl.appendConfig.of(o.of(n))
|
|
1753
1753
|
}), !0);
|
|
1754
1754
|
};
|
|
1755
|
-
class
|
|
1755
|
+
class ho {
|
|
1756
1756
|
constructor(o) {
|
|
1757
1757
|
z(this, "view");
|
|
1758
1758
|
z(this, "maxLength", Number.MAX_SAFE_INTEGER);
|
|
@@ -1822,10 +1822,10 @@ class vo {
|
|
|
1822
1822
|
if (this.view.dispatch(this.view.state.replaceSelection(o)), l.select) {
|
|
1823
1823
|
const i = r + o.length + l.deviationEnd;
|
|
1824
1824
|
this.view.dispatch({
|
|
1825
|
-
selection:
|
|
1825
|
+
selection: U.create(
|
|
1826
1826
|
[
|
|
1827
|
-
|
|
1828
|
-
|
|
1827
|
+
U.range(r + l.deviationStart, i),
|
|
1828
|
+
U.cursor(i)
|
|
1829
1829
|
],
|
|
1830
1830
|
1
|
|
1831
1831
|
)
|
|
@@ -1878,8 +1878,8 @@ class vo {
|
|
|
1878
1878
|
}
|
|
1879
1879
|
this.view.dispatch({
|
|
1880
1880
|
scrollIntoView: !0,
|
|
1881
|
-
selection:
|
|
1882
|
-
[
|
|
1881
|
+
selection: U.create(
|
|
1882
|
+
[U.range(l, n), U.cursor(r)],
|
|
1883
1883
|
1
|
|
1884
1884
|
)
|
|
1885
1885
|
});
|
|
@@ -1896,7 +1896,7 @@ class vo {
|
|
|
1896
1896
|
]);
|
|
1897
1897
|
}
|
|
1898
1898
|
}
|
|
1899
|
-
const
|
|
1899
|
+
const bo = (e) => {
|
|
1900
1900
|
const o = I("editorId");
|
|
1901
1901
|
return (n) => {
|
|
1902
1902
|
if (!n.clipboardData)
|
|
@@ -1925,7 +1925,7 @@ const ko = (e) => {
|
|
|
1925
1925
|
data: r
|
|
1926
1926
|
});
|
|
1927
1927
|
};
|
|
1928
|
-
},
|
|
1928
|
+
}, vo = (e, o) => [
|
|
1929
1929
|
{
|
|
1930
1930
|
key: "Ctrl-b",
|
|
1931
1931
|
mac: "Cmd-b",
|
|
@@ -1940,7 +1940,7 @@ const ko = (e) => {
|
|
|
1940
1940
|
{
|
|
1941
1941
|
key: "Ctrl-s",
|
|
1942
1942
|
mac: "Cmd-s",
|
|
1943
|
-
run: (
|
|
1943
|
+
run: (k) => (v.emit(e, Ht, k.state.doc.toString()), !0),
|
|
1944
1944
|
shift: () => (v.emit(e, L, "strikeThrough"), !0)
|
|
1945
1945
|
},
|
|
1946
1946
|
{
|
|
@@ -2004,7 +2004,7 @@ const ko = (e) => {
|
|
|
2004
2004
|
key: "Ctrl-c",
|
|
2005
2005
|
mac: "Cmd-c",
|
|
2006
2006
|
shift: () => (v.emit(e, L, "code"), !0),
|
|
2007
|
-
any(
|
|
2007
|
+
any(k, A) {
|
|
2008
2008
|
return (A.ctrlKey || A.metaKey) && A.altKey && A.code === "KeyC" ? (v.emit(e, L, "codeRow"), !0) : !1;
|
|
2009
2009
|
}
|
|
2010
2010
|
},
|
|
@@ -2019,10 +2019,10 @@ const ko = (e) => {
|
|
|
2019
2019
|
shift: () => o.noPrettier ? !1 : (v.emit(e, L, "prettier"), !0)
|
|
2020
2020
|
},
|
|
2021
2021
|
{
|
|
2022
|
-
any: (
|
|
2022
|
+
any: (k, A) => (A.ctrlKey || A.metaKey) && A.altKey && A.shiftKey && A.code === "KeyT" ? (v.emit(e, L, "table"), !0) : !1
|
|
2023
2023
|
}
|
|
2024
|
-
],
|
|
2025
|
-
const o = I("tabWidth"), l = I("editorId"), n = I("theme"), r =
|
|
2024
|
+
], ko = (e) => {
|
|
2025
|
+
const o = I("tabWidth"), l = I("editorId"), n = I("theme"), r = O(), i = Wt(), h = new ne(), f = new ne(), d = new ne(), s = new ne(), g = vo(l, e), w = bo(e), $ = [
|
|
2026
2026
|
ll.of([...rl, ...sl, ...g, cl]),
|
|
2027
2027
|
s.of(ft()),
|
|
2028
2028
|
h.of(al({ codeLanguages: ol })),
|
|
@@ -2038,11 +2038,11 @@ const ko = (e) => {
|
|
|
2038
2038
|
drop: e.onDrop,
|
|
2039
2039
|
input: (m) => {
|
|
2040
2040
|
e.onInput && e.onInput(m);
|
|
2041
|
-
const { data:
|
|
2042
|
-
e.maxlength && e.modelValue.length +
|
|
2041
|
+
const { data: C } = m;
|
|
2042
|
+
e.maxlength && e.modelValue.length + C.length > e.maxlength && v.emit(l, ee, {
|
|
2043
2043
|
name: "overlength",
|
|
2044
2044
|
message: "The input text is too long",
|
|
2045
|
-
data:
|
|
2045
|
+
data: C
|
|
2046
2046
|
});
|
|
2047
2047
|
}
|
|
2048
2048
|
})
|
|
@@ -2061,9 +2061,9 @@ const ko = (e) => {
|
|
|
2061
2061
|
doc: e.modelValue,
|
|
2062
2062
|
parent: r.value,
|
|
2063
2063
|
extensions: [S()]
|
|
2064
|
-
}),
|
|
2065
|
-
i.value =
|
|
2066
|
-
|
|
2064
|
+
}), C = new ho(m);
|
|
2065
|
+
i.value = C, setTimeout(() => {
|
|
2066
|
+
C.setTabSize(o), C.setDisabled(e.disabled), C.setReadOnly(e.readonly), e.placeholder && C.setPlaceholder(e.placeholder), typeof e.maxlength == "number" && C.setMaxLength(e.maxlength), e.autofocus && m.focus();
|
|
2067
2067
|
}, 0), v.on(l, {
|
|
2068
2068
|
name: Nt,
|
|
2069
2069
|
callback() {
|
|
@@ -2077,9 +2077,9 @@ const ko = (e) => {
|
|
|
2077
2077
|
}), v.on(l, {
|
|
2078
2078
|
name: L,
|
|
2079
2079
|
callback(u, b = {}) {
|
|
2080
|
-
var
|
|
2081
|
-
const { text: p, options: y } =
|
|
2082
|
-
(
|
|
2080
|
+
var k;
|
|
2081
|
+
const { text: p, options: y } = ql(u, i.value, b);
|
|
2082
|
+
(k = i.value) == null || k.replaceSelectedText(p, y, l);
|
|
2083
2083
|
}
|
|
2084
2084
|
});
|
|
2085
2085
|
}), H(
|
|
@@ -2107,8 +2107,8 @@ const ko = (e) => {
|
|
|
2107
2107
|
), H(
|
|
2108
2108
|
() => e.modelValue,
|
|
2109
2109
|
() => {
|
|
2110
|
-
var m,
|
|
2111
|
-
((m = i.value) == null ? void 0 : m.getValue()) !== e.modelValue && ((
|
|
2110
|
+
var m, C;
|
|
2111
|
+
((m = i.value) == null ? void 0 : m.getValue()) !== e.modelValue && ((C = i.value) == null || C.setValue(e.modelValue));
|
|
2112
2112
|
}
|
|
2113
2113
|
), H(
|
|
2114
2114
|
() => e.placeholder,
|
|
@@ -2138,25 +2138,25 @@ const ko = (e) => {
|
|
|
2138
2138
|
inputWrapperRef: r,
|
|
2139
2139
|
codeMirrorUt: i,
|
|
2140
2140
|
resetHistory() {
|
|
2141
|
-
var m,
|
|
2141
|
+
var m, C;
|
|
2142
2142
|
(m = i.value) == null || m.view.dispatch({
|
|
2143
2143
|
effects: s.reconfigure([])
|
|
2144
|
-
}), (
|
|
2144
|
+
}), (C = i.value) == null || C.view.dispatch({
|
|
2145
2145
|
effects: s.reconfigure(ft())
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
2148
2148
|
};
|
|
2149
|
-
},
|
|
2150
|
-
const n =
|
|
2149
|
+
}, Co = (e, o, l) => {
|
|
2150
|
+
const n = _({
|
|
2151
2151
|
resizedWidth: e.inputBoxWitdh
|
|
2152
|
-
}), r =
|
|
2152
|
+
}), r = _({
|
|
2153
2153
|
width: e.inputBoxWitdh
|
|
2154
|
-
}), i =
|
|
2154
|
+
}), i = _({
|
|
2155
2155
|
left: e.inputBoxWitdh,
|
|
2156
2156
|
display: "initial"
|
|
2157
2157
|
}), h = (s) => {
|
|
2158
|
-
var m,
|
|
2159
|
-
const g = ((m = o.value) == null ? void 0 : m.offsetWidth) || 0, w = ((
|
|
2158
|
+
var m, C, u;
|
|
2159
|
+
const g = ((m = o.value) == null ? void 0 : m.offsetWidth) || 0, w = ((C = o.value) == null ? void 0 : C.getBoundingClientRect().x) || 0;
|
|
2160
2160
|
let $ = s.x - w;
|
|
2161
2161
|
$ < se ? $ = se : $ > g - se && ($ = g - se);
|
|
2162
2162
|
const S = `${$}px`;
|
|
@@ -2186,19 +2186,19 @@ const ko = (e) => {
|
|
|
2186
2186
|
immediate: !0
|
|
2187
2187
|
}
|
|
2188
2188
|
), { inputWrapperStyle: r, resizeOperateStyle: i };
|
|
2189
|
-
},
|
|
2189
|
+
}, $o = /* @__PURE__ */ P({
|
|
2190
2190
|
name: "MDEditorContent",
|
|
2191
2191
|
props: fl,
|
|
2192
2192
|
setup(e, o) {
|
|
2193
|
-
const l = I("editorId"), n =
|
|
2193
|
+
const l = I("editorId"), n = O(""), r = O(), i = O(), {
|
|
2194
2194
|
inputWrapperRef: h,
|
|
2195
2195
|
codeMirrorUt: f,
|
|
2196
2196
|
resetHistory: d
|
|
2197
|
-
} =
|
|
2197
|
+
} = ko(e), {
|
|
2198
2198
|
inputWrapperStyle: s,
|
|
2199
2199
|
resizeOperateStyle: g
|
|
2200
|
-
} =
|
|
2201
|
-
return
|
|
2200
|
+
} = Co(e, r, i);
|
|
2201
|
+
return _l(e, n, f), o.expose({
|
|
2202
2202
|
getSelectedText() {
|
|
2203
2203
|
var w;
|
|
2204
2204
|
return (w = f.value) == null ? void 0 : w.getSelectedText();
|
|
@@ -2242,7 +2242,7 @@ const ko = (e) => {
|
|
|
2242
2242
|
key: "internal-catalog"
|
|
2243
2243
|
}, null)]);
|
|
2244
2244
|
}
|
|
2245
|
-
}),
|
|
2245
|
+
}), po = /* @__PURE__ */ P({
|
|
2246
2246
|
props: {
|
|
2247
2247
|
modelValue: {
|
|
2248
2248
|
type: String,
|
|
@@ -2260,7 +2260,7 @@ const ko = (e) => {
|
|
|
2260
2260
|
}, [`${(l = o.value.footer) == null ? void 0 : l.markdownTotal}:`]), t("span", null, [((n = e.modelValue) == null ? void 0 : n.length) || 0])]);
|
|
2261
2261
|
};
|
|
2262
2262
|
}
|
|
2263
|
-
}),
|
|
2263
|
+
}), yo = {
|
|
2264
2264
|
checked: {
|
|
2265
2265
|
type: Boolean,
|
|
2266
2266
|
default: !1
|
|
@@ -2270,8 +2270,8 @@ const ko = (e) => {
|
|
|
2270
2270
|
default: () => {
|
|
2271
2271
|
}
|
|
2272
2272
|
}
|
|
2273
|
-
},
|
|
2274
|
-
props:
|
|
2273
|
+
}, To = /* @__PURE__ */ P({
|
|
2274
|
+
props: yo,
|
|
2275
2275
|
setup(e) {
|
|
2276
2276
|
return () => t("div", {
|
|
2277
2277
|
class: [`${a}-checkbox`, e.checked && `${a}-checkbox-checked`],
|
|
@@ -2280,7 +2280,7 @@ const ko = (e) => {
|
|
|
2280
2280
|
}
|
|
2281
2281
|
}, null);
|
|
2282
2282
|
}
|
|
2283
|
-
}),
|
|
2283
|
+
}), wo = {
|
|
2284
2284
|
scrollAuto: {
|
|
2285
2285
|
type: Boolean
|
|
2286
2286
|
},
|
|
@@ -2289,8 +2289,8 @@ const ko = (e) => {
|
|
|
2289
2289
|
default: () => {
|
|
2290
2290
|
}
|
|
2291
2291
|
}
|
|
2292
|
-
},
|
|
2293
|
-
props:
|
|
2292
|
+
}, xo = /* @__PURE__ */ P({
|
|
2293
|
+
props: wo,
|
|
2294
2294
|
setup(e) {
|
|
2295
2295
|
const o = I("usedLanguageText");
|
|
2296
2296
|
return () => {
|
|
@@ -2302,13 +2302,13 @@ const ko = (e) => {
|
|
|
2302
2302
|
onClick: () => {
|
|
2303
2303
|
e.onScrollAutoChange(!e.scrollAuto);
|
|
2304
2304
|
}
|
|
2305
|
-
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(
|
|
2305
|
+
}, [(l = o.value.footer) == null ? void 0 : l.scrollAuto]), t(To, {
|
|
2306
2306
|
checked: e.scrollAuto,
|
|
2307
2307
|
onChange: e.onScrollAutoChange
|
|
2308
2308
|
}, null)]);
|
|
2309
2309
|
};
|
|
2310
2310
|
}
|
|
2311
|
-
}),
|
|
2311
|
+
}), So = {
|
|
2312
2312
|
modelValue: {
|
|
2313
2313
|
type: String,
|
|
2314
2314
|
default: ""
|
|
@@ -2328,22 +2328,22 @@ const ko = (e) => {
|
|
|
2328
2328
|
defFooters: {
|
|
2329
2329
|
type: Object
|
|
2330
2330
|
}
|
|
2331
|
-
},
|
|
2331
|
+
}, Ao = /* @__PURE__ */ P({
|
|
2332
2332
|
name: "MDEditorFooter",
|
|
2333
|
-
props:
|
|
2333
|
+
props: So,
|
|
2334
2334
|
setup(e) {
|
|
2335
2335
|
const o = Ce(() => {
|
|
2336
2336
|
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);
|
|
2337
2337
|
return [r, i];
|
|
2338
2338
|
}), l = (n) => {
|
|
2339
|
-
if (
|
|
2339
|
+
if (_t.includes(n))
|
|
2340
2340
|
switch (n) {
|
|
2341
2341
|
case "markdownTotal":
|
|
2342
|
-
return t(
|
|
2342
|
+
return t(po, {
|
|
2343
2343
|
modelValue: e.modelValue
|
|
2344
2344
|
}, null);
|
|
2345
2345
|
case "scrollSwitch":
|
|
2346
|
-
return t(
|
|
2346
|
+
return t(xo, {
|
|
2347
2347
|
scrollAuto: e.scrollAuto,
|
|
2348
2348
|
onScrollAutoChange: e.onScrollAutoChange
|
|
2349
2349
|
}, null);
|
|
@@ -2362,7 +2362,7 @@ const ko = (e) => {
|
|
|
2362
2362
|
}, [r])]);
|
|
2363
2363
|
};
|
|
2364
2364
|
}
|
|
2365
|
-
}),
|
|
2365
|
+
}), ve = /* @__PURE__ */ P({
|
|
2366
2366
|
name: "MdEditorV3",
|
|
2367
2367
|
props: bl,
|
|
2368
2368
|
emits: vl,
|
|
@@ -2374,15 +2374,15 @@ const ko = (e) => {
|
|
|
2374
2374
|
noPrettier: i,
|
|
2375
2375
|
noUploadImg: h,
|
|
2376
2376
|
noHighlight: f
|
|
2377
|
-
} = e, d =
|
|
2377
|
+
} = e, d = _({
|
|
2378
2378
|
scrollAuto: e.scrollAuto
|
|
2379
|
-
}), s =
|
|
2379
|
+
}), s = O();
|
|
2380
2380
|
kl(e, o), Cl(e), $l(e), pl(e, o);
|
|
2381
2381
|
const [g, w] = yl(e, o), $ = Tl(e);
|
|
2382
2382
|
return Et(() => {
|
|
2383
2383
|
v.clear(l);
|
|
2384
2384
|
}), wl(e, o, $, g, w, s), () => {
|
|
2385
|
-
var
|
|
2385
|
+
var C;
|
|
2386
2386
|
const S = ht({
|
|
2387
2387
|
props: e,
|
|
2388
2388
|
ctx: o
|
|
@@ -2404,7 +2404,7 @@ const ko = (e) => {
|
|
|
2404
2404
|
defToolbars: S,
|
|
2405
2405
|
noUploadImg: h,
|
|
2406
2406
|
showToolbarName: e.showToolbarName
|
|
2407
|
-
}, null), t(
|
|
2407
|
+
}, null), t($o, {
|
|
2408
2408
|
ref: s,
|
|
2409
2409
|
modelValue: e.modelValue,
|
|
2410
2410
|
setting: g,
|
|
@@ -2452,7 +2452,7 @@ const ko = (e) => {
|
|
|
2452
2452
|
e.onInputBoxWitdhChange && e.onInputBoxWitdhChange(u), o.emit("onInputBoxWitdhChange", u);
|
|
2453
2453
|
},
|
|
2454
2454
|
sanitizeMermaid: e.sanitizeMermaid
|
|
2455
|
-
}, null), ((
|
|
2455
|
+
}, null), ((C = e.footers) == null ? void 0 : C.length) > 0 && t(Ao, {
|
|
2456
2456
|
modelValue: e.modelValue,
|
|
2457
2457
|
footers: e.footers,
|
|
2458
2458
|
defFooters: m,
|
|
@@ -2461,7 +2461,7 @@ const ko = (e) => {
|
|
|
2461
2461
|
}, null)]);
|
|
2462
2462
|
};
|
|
2463
2463
|
}
|
|
2464
|
-
})
|
|
2464
|
+
});
|
|
2465
2465
|
ve.install = (e) => (e.component(ve.name, ve), e.use(Sl).use(Xt).use(Al).use(Rt).use(xl), e);
|
|
2466
2466
|
export {
|
|
2467
2467
|
ve as default
|