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