md-editor-v3 4.3.0-beta.3 → 4.3.0-beta.4
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 +2 -0
- package/lib/cjs/MdEditor.cjs +2 -2
- package/lib/cjs/MdModal.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +1 -1
- package/lib/cjs/chunks/index2.cjs +1 -1
- package/lib/es/MdEditor.mjs +68 -61
- package/lib/es/MdModal.mjs +26 -25
- package/lib/es/chunks/index.mjs +8 -1
- package/lib/es/chunks/index2.mjs +28 -28
- package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +2 -2
- package/lib/types/DropdownToolbar/index.d.ts +4 -4
- package/lib/types/MdEditor/Editor.d.ts +8 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +4 -5
- package/lib/types/MdEditor/components/Modal/index.d.ts +13 -12
- package/lib/types/MdEditor/index.d.ts +18 -2
- package/lib/types/MdEditor/layouts/Content/index.d.ts +6 -0
- package/lib/types/MdEditor/layouts/Content/props.d.ts +3 -0
- package/lib/types/MdEditor/props.d.ts +6 -0
- package/lib/types/MdEditor/type.d.ts +1 -1
- package/lib/types/MdPreview/MdPreview.d.ts +2 -1
- package/lib/types/MdPreview/index.d.ts +6 -2
- package/lib/umd/index.js +3 -3
- package/package.json +1 -1
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var wt = Object.defineProperty;
|
|
2
2
|
var xt = (e, r, l) => r in e ? wt(e, r, { enumerable: !0, configurable: !0, writable: !0, value: l }) : e[r] = l;
|
|
3
3
|
var K = (e, r, l) => (xt(e, typeof r != "symbol" ? r + "" : r, l), l);
|
|
4
|
-
import { defineComponent as O, createVNode as t, inject as A, ref as q, onMounted as Y, reactive as J, computed as he, watch as
|
|
5
|
-
import { p as o, a as z, s as Mt, b as Lt, d as
|
|
6
|
-
import { draggingScroll as
|
|
4
|
+
import { defineComponent as O, createVNode as t, inject as A, ref as q, onMounted as Y, reactive as J, computed as he, 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 Nt, debounce as Et, throttle as Ht, smoothScroll as rt } from "@vavt/util";
|
|
7
7
|
import { a as te, D as Bt } from "./chunks/index2.mjs";
|
|
8
8
|
import { b as h, a as Ft } from "./chunks/index3.mjs";
|
|
9
9
|
import { C as Ot, a as Vt, 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, M as Yt } from "./chunks/index.mjs";
|
|
@@ -190,7 +190,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
190
190
|
desc: "",
|
|
191
191
|
url: ""
|
|
192
192
|
});
|
|
193
|
-
return
|
|
193
|
+
return H(() => e.visible, (i) => {
|
|
194
194
|
i || setTimeout(() => {
|
|
195
195
|
n.desc = "", n.url = "";
|
|
196
196
|
}, 200);
|
|
@@ -272,7 +272,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
272
272
|
isFullscreen: !1
|
|
273
273
|
});
|
|
274
274
|
let c = null;
|
|
275
|
-
|
|
275
|
+
H(() => e.visible, () => {
|
|
276
276
|
e.visible && !d.cropperInited && (a = a || window.Cropper, n.value.onchange = () => {
|
|
277
277
|
if (!a) {
|
|
278
278
|
h.emit(l, "errorCatcher", {
|
|
@@ -295,9 +295,9 @@ const gl = /* @__PURE__ */ O({
|
|
|
295
295
|
}, v.readAsDataURL(T[0]);
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
|
-
}),
|
|
298
|
+
}), H(() => [d.imgSelected], () => {
|
|
299
299
|
u.value.style = "";
|
|
300
|
-
}),
|
|
300
|
+
}), H(() => d.isFullscreen, () => {
|
|
301
301
|
ce(() => {
|
|
302
302
|
c == null || c.destroy(), u.value.style = "", i.value && (c = new a(i.value, {
|
|
303
303
|
viewMode: 2,
|
|
@@ -464,7 +464,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
464
464
|
b.value.addEventListener("change", $);
|
|
465
465
|
});
|
|
466
466
|
const T = (v) => {
|
|
467
|
-
var g, k, y, w, x, L, C, M, R,
|
|
467
|
+
var g, k, y, w, x, L, C, M, R, I, D, V, B, N, j, U, re, X, _, G, Q, W, E, F, ee, ne, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, Ie, De, Ne, Ee, He, Be, Fe, Oe, Ve, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Ye, Ze, Je, Xe, Qe, et, tt, lt, ot;
|
|
468
468
|
if (Lt.includes(v))
|
|
469
469
|
switch (v) {
|
|
470
470
|
case "-":
|
|
@@ -551,12 +551,12 @@ const gl = /* @__PURE__ */ O({
|
|
|
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");
|
|
@@ -571,7 +571,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
571
571
|
onClick: () => {
|
|
572
572
|
d("h6");
|
|
573
573
|
}
|
|
574
|
-
}, [(
|
|
574
|
+
}, [(N = l.value.titleItem) == null ? void 0 : N.h6])])
|
|
575
575
|
}, {
|
|
576
576
|
default: () => {
|
|
577
577
|
var p, S;
|
|
@@ -651,7 +651,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
651
651
|
case "orderedList":
|
|
652
652
|
return t("div", {
|
|
653
653
|
class: `${o}-toolbar-item`,
|
|
654
|
-
title: (
|
|
654
|
+
title: (E = l.value.toolbarTips) == null ? void 0 : E.orderedList,
|
|
655
655
|
onClick: () => {
|
|
656
656
|
d("orderedList");
|
|
657
657
|
}
|
|
@@ -830,7 +830,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
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
|
h.emit(r, "ctrlShiftZ");
|
|
836
836
|
}
|
|
@@ -841,11 +841,11 @@ const gl = /* @__PURE__ */ O({
|
|
|
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: (Ne = l.value.toolbarTips) == null ? void 0 : Ne.save,
|
|
849
849
|
onClick: () => {
|
|
850
850
|
h.emit(r, pt);
|
|
851
851
|
}
|
|
@@ -856,11 +856,11 @@ const gl = /* @__PURE__ */ O({
|
|
|
856
856
|
"xlink:href": "#md-editor-icon-baocun"
|
|
857
857
|
}, null)]), e.showToolbarName && t("div", {
|
|
858
858
|
class: `${o}-toolbar-item-name`
|
|
859
|
-
}, [(
|
|
859
|
+
}, [(Ee = l.value.toolbarTips) == null ? void 0 : Ee.save])]);
|
|
860
860
|
case "prettier":
|
|
861
861
|
return e.noPrettier ? "" : t("div", {
|
|
862
862
|
class: `${o}-toolbar-item`,
|
|
863
|
-
title: (
|
|
863
|
+
title: (He = l.value.toolbarTips) == null ? void 0 : He.prettier,
|
|
864
864
|
onClick: () => {
|
|
865
865
|
d("prettier");
|
|
866
866
|
}
|
|
@@ -952,7 +952,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
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: () => Nt("https://github.com/imzbf/md-editor-v3")
|
|
956
956
|
}, [t("svg", {
|
|
957
957
|
class: `${o}-icon`,
|
|
958
958
|
"aria-hidden": "true"
|
|
@@ -1093,9 +1093,9 @@ const gl = /* @__PURE__ */ O({
|
|
|
1093
1093
|
} else
|
|
1094
1094
|
return "";
|
|
1095
1095
|
};
|
|
1096
|
-
return
|
|
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
|
|
@@ -1137,7 +1137,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
}), Al = (e, r) => {
|
|
1140
|
-
const l =
|
|
1140
|
+
const l = Et(() => {
|
|
1141
1141
|
e.removeEventListener("scroll", a), e.addEventListener("scroll", a), r.removeEventListener("scroll", a), r.addEventListener("scroll", a);
|
|
1142
1142
|
}, 50), a = (n) => {
|
|
1143
1143
|
const i = e.clientHeight, u = r.clientHeight, d = e.scrollHeight, c = r.scrollHeight, m = (d - i) / (c - u);
|
|
@@ -1175,7 +1175,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1175
1175
|
});
|
|
1176
1176
|
};
|
|
1177
1177
|
let c = 0, m = 0;
|
|
1178
|
-
const f =
|
|
1178
|
+
const f = Ht((b) => {
|
|
1179
1179
|
var v, g, k, y, w, x, L;
|
|
1180
1180
|
if (!((v = r.firstElementChild) != null && v.firstElementChild))
|
|
1181
1181
|
return;
|
|
@@ -1187,10 +1187,10 @@ const gl = /* @__PURE__ */ O({
|
|
|
1187
1187
|
c++;
|
|
1188
1188
|
const C = u[T - 1], M = n(C.end) + i(C.end);
|
|
1189
1189
|
let R = 0;
|
|
1190
|
-
const
|
|
1191
|
-
let B = 0,
|
|
1192
|
-
|
|
1193
|
-
const j =
|
|
1190
|
+
const I = n(C.start), D = r.querySelector(`[data-line="${C.start - 1}"]`) || ((g = r.firstElementChild) == null ? void 0 : g.firstElementChild), V = r.querySelector(`[data-line="${C.end}"]`) || ((k = r.lastElementChild) == null ? void 0 : k.lastElementChild);
|
|
1191
|
+
let B = 0, N = 0;
|
|
1192
|
+
I === 0 ? (R = (a.scrollDOM.scrollTop - I) / (M - I), B = V.offsetTop) : M > a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight ? (R = (a.scrollDOM.scrollTop - I) / (a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight - I), N = D.offsetTop, B = r.scrollHeight - r.clientHeight - N + 10) : (R = (a.scrollDOM.scrollTop - I) / (M - I), N = D.offsetTop, B = V.offsetTop - N);
|
|
1193
|
+
const j = N - 10 + B * R;
|
|
1194
1194
|
rt(r, j, () => {
|
|
1195
1195
|
c--;
|
|
1196
1196
|
});
|
|
@@ -1201,53 +1201,53 @@ const gl = /* @__PURE__ */ O({
|
|
|
1201
1201
|
const C = Array.from(
|
|
1202
1202
|
r.querySelectorAll("[data-line]")
|
|
1203
1203
|
), M = r.scrollTop, R = r.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 F = r.querySelector(`[data-line="${
|
|
1206
|
+
), D = (y = r.firstElementChild) == null ? void 0 : y.firstElementChild;
|
|
1207
|
+
for (let E = I; E >= 0; E--) {
|
|
1208
|
+
const F = r.querySelector(`[data-line="${E}"]`);
|
|
1209
1209
|
if (F && F.offsetTop <= M) {
|
|
1210
|
-
|
|
1210
|
+
D = F, I = E;
|
|
1211
1211
|
break;
|
|
1212
1212
|
}
|
|
1213
1213
|
}
|
|
1214
1214
|
let V = (w = r.firstElementChild) == null ? void 0 : w.firstElementChild, B = (x = r.firstElementChild) == null ? void 0 : x.lastElementChild;
|
|
1215
1215
|
for (; C.length > 0; ) {
|
|
1216
|
-
const
|
|
1217
|
-
if (
|
|
1216
|
+
const E = C.indexOf(D);
|
|
1217
|
+
if (E + 1 >= C.length)
|
|
1218
1218
|
break;
|
|
1219
|
-
const F = C[
|
|
1220
|
-
if (
|
|
1219
|
+
const F = C[E + 1];
|
|
1220
|
+
if (E === -1) {
|
|
1221
1221
|
B = F;
|
|
1222
1222
|
break;
|
|
1223
1223
|
}
|
|
1224
|
-
const ee =
|
|
1224
|
+
const ee = D.offsetTop;
|
|
1225
1225
|
if (ee > M) {
|
|
1226
|
-
if (
|
|
1227
|
-
V =
|
|
1226
|
+
if (E === 0) {
|
|
1227
|
+
V = D, B = F;
|
|
1228
1228
|
break;
|
|
1229
1229
|
}
|
|
1230
|
-
|
|
1230
|
+
D = C[E - 1];
|
|
1231
1231
|
continue;
|
|
1232
1232
|
}
|
|
1233
1233
|
const ne = F.offsetTop;
|
|
1234
1234
|
if (ee <= M && ne > M) {
|
|
1235
|
-
V =
|
|
1235
|
+
V = D, B = F;
|
|
1236
1236
|
break;
|
|
1237
1237
|
}
|
|
1238
|
-
|
|
1238
|
+
D = F;
|
|
1239
1239
|
}
|
|
1240
|
-
const
|
|
1240
|
+
const N = V.offsetTop, j = B.offsetTop;
|
|
1241
1241
|
let U = 0;
|
|
1242
1242
|
const { start: re, end: X } = u[Number(V.dataset.line || 0)], _ = n(re);
|
|
1243
1243
|
let G = n(X);
|
|
1244
1244
|
const Q = i(X);
|
|
1245
1245
|
let W = 0;
|
|
1246
1246
|
V === ((L = r.firstElementChild) == null ? void 0 : L.firstElementChild) ? (U = Math.max(M / j, 0), W = G + Q - _) : G > a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight ? (U = Math.max(
|
|
1247
|
-
(M -
|
|
1247
|
+
(M - N) / (r.scrollHeight - N - r.clientHeight),
|
|
1248
1248
|
0
|
|
1249
1249
|
), G = n(a.state.doc.lines) + i(a.state.doc.lines), W = 8 + G - _ - e.clientHeight) : (U = Math.max(
|
|
1250
|
-
(M -
|
|
1250
|
+
(M - N) / (j - N),
|
|
1251
1251
|
0
|
|
1252
1252
|
), W = G + Q - _), rt(e, _ + W * U, () => {
|
|
1253
1253
|
m--;
|
|
@@ -1280,7 +1280,7 @@ const gl = /* @__PURE__ */ O({
|
|
|
1280
1280
|
l.value
|
|
1281
1281
|
)), e.scrollAuto && i();
|
|
1282
1282
|
};
|
|
1283
|
-
|
|
1283
|
+
H(
|
|
1284
1284
|
[
|
|
1285
1285
|
r,
|
|
1286
1286
|
le(e.setting, "preview"),
|
|
@@ -1291,13 +1291,13 @@ const gl = /* @__PURE__ */ O({
|
|
|
1291
1291
|
() => {
|
|
1292
1292
|
ce(u);
|
|
1293
1293
|
}
|
|
1294
|
-
),
|
|
1294
|
+
), H(
|
|
1295
1295
|
() => e.scrollAuto,
|
|
1296
1296
|
(d) => {
|
|
1297
1297
|
d ? i() : n();
|
|
1298
1298
|
}
|
|
1299
1299
|
), Y(u);
|
|
1300
|
-
},
|
|
1300
|
+
}, Il = Ll, Dl = (e, r, l) => {
|
|
1301
1301
|
var f, b, $, T, v, g;
|
|
1302
1302
|
let a = "", n = 0, i = 0, u = !0, d = !1;
|
|
1303
1303
|
const c = r.getSelectedText(), m = (f = z.editorConfig) == null ? void 0 : f.mermaidTemplate;
|
|
@@ -1509,7 +1509,7 @@ $$
|
|
|
1509
1509
|
replaceAll: d
|
|
1510
1510
|
}
|
|
1511
1511
|
};
|
|
1512
|
-
},
|
|
1512
|
+
}, Nl = "#e5c07b", it = "var(--md-color)", El = "#56b6c2", Hl = "#ffffff", oe = "var(--md-color)", st = "#e5c07b", Bl = "#e5c07b", Fl = "var(--md-color)", ct = "#d19a66", Ol = "#c678dd", Vl = "#21252b", Rl = "#2c313a", dt = "var(--md-bk-color)", me = "var(--md-bk-color)", Pl = "#ceedfa33", ut = "#528bff", ql = be.theme(
|
|
1513
1513
|
{
|
|
1514
1514
|
"&": {
|
|
1515
1515
|
color: oe,
|
|
@@ -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: [
|
|
@@ -1597,7 +1597,7 @@ $$
|
|
|
1597
1597
|
s.link,
|
|
1598
1598
|
s.special(s.string)
|
|
1599
1599
|
],
|
|
1600
|
-
color:
|
|
1600
|
+
color: El
|
|
1601
1601
|
},
|
|
1602
1602
|
{ tag: [s.meta, s.comment], color: st },
|
|
1603
1603
|
{ tag: s.strong, fontWeight: "bold" },
|
|
@@ -1607,7 +1607,7 @@ $$
|
|
|
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: Fl },
|
|
1610
|
-
{ tag: s.invalid, color:
|
|
1610
|
+
{ tag: s.invalid, color: Hl }
|
|
1611
1611
|
]), Gl = [
|
|
1612
1612
|
ql,
|
|
1613
1613
|
yt(Ul)
|
|
@@ -2108,7 +2108,8 @@ const ro = (e) => {
|
|
|
2108
2108
|
ie.domEventHandlers({
|
|
2109
2109
|
paste: d,
|
|
2110
2110
|
blur: e.onBlur,
|
|
2111
|
-
focus: e.onFocus
|
|
2111
|
+
focus: e.onFocus,
|
|
2112
|
+
input: e.onInput
|
|
2112
2113
|
})
|
|
2113
2114
|
], m = () => {
|
|
2114
2115
|
const f = [
|
|
@@ -2141,11 +2142,11 @@ const ro = (e) => {
|
|
|
2141
2142
|
name: "replace",
|
|
2142
2143
|
callback($, T = {}) {
|
|
2143
2144
|
var k;
|
|
2144
|
-
const { text: v, options: g } =
|
|
2145
|
+
const { text: v, options: g } = Dl($, i.value, T);
|
|
2145
2146
|
(k = i.value) == null || k.replaceSelectedText(v, g);
|
|
2146
2147
|
}
|
|
2147
2148
|
});
|
|
2148
|
-
}),
|
|
2149
|
+
}), H(
|
|
2149
2150
|
[a, le(e, "completions")],
|
|
2150
2151
|
() => {
|
|
2151
2152
|
var f;
|
|
@@ -2154,31 +2155,31 @@ const ro = (e) => {
|
|
|
2154
2155
|
{
|
|
2155
2156
|
deep: !0
|
|
2156
2157
|
}
|
|
2157
|
-
),
|
|
2158
|
+
), H(
|
|
2158
2159
|
() => e.value,
|
|
2159
2160
|
() => {
|
|
2160
2161
|
var f, b;
|
|
2161
2162
|
((f = i.value) == null ? void 0 : f.getValue()) !== e.value && ((b = i.value) == null || b.setValue(e.value));
|
|
2162
2163
|
}
|
|
2163
|
-
),
|
|
2164
|
+
), H(
|
|
2164
2165
|
() => e.placeholder,
|
|
2165
2166
|
() => {
|
|
2166
2167
|
var f;
|
|
2167
2168
|
(f = i.value) == null || f.setPlaceholder(e.placeholder);
|
|
2168
2169
|
}
|
|
2169
|
-
),
|
|
2170
|
+
), H(
|
|
2170
2171
|
() => e.disabled,
|
|
2171
2172
|
() => {
|
|
2172
2173
|
var f;
|
|
2173
2174
|
(f = i.value) == null || f.setDisabled(e.disabled);
|
|
2174
2175
|
}
|
|
2175
|
-
),
|
|
2176
|
+
), H(
|
|
2176
2177
|
() => e.readonly,
|
|
2177
2178
|
() => {
|
|
2178
2179
|
var f;
|
|
2179
2180
|
(f = i.value) == null || f.setDisabled(e.readonly);
|
|
2180
2181
|
}
|
|
2181
|
-
),
|
|
2182
|
+
), H(
|
|
2182
2183
|
() => e.maxlength,
|
|
2183
2184
|
() => {
|
|
2184
2185
|
var f;
|
|
@@ -2287,6 +2288,9 @@ const ro = (e) => {
|
|
|
2287
2288
|
theme: {
|
|
2288
2289
|
type: String,
|
|
2289
2290
|
default: "light"
|
|
2291
|
+
},
|
|
2292
|
+
onInput: {
|
|
2293
|
+
type: Function
|
|
2290
2294
|
}
|
|
2291
2295
|
}, ho = /* @__PURE__ */ O({
|
|
2292
2296
|
name: "MDEditorContent",
|
|
@@ -2296,7 +2300,7 @@ const ro = (e) => {
|
|
|
2296
2300
|
inputWrapperRef: a,
|
|
2297
2301
|
codeMirrorUt: n
|
|
2298
2302
|
} = fo(e);
|
|
2299
|
-
return
|
|
2303
|
+
return Il(e, l, n), () => t("div", {
|
|
2300
2304
|
class: `${o}-content`
|
|
2301
2305
|
}, [t("div", {
|
|
2302
2306
|
class: `${o}-input-wrapper`,
|
|
@@ -2416,7 +2420,7 @@ const ro = (e) => {
|
|
|
2416
2420
|
const a = e.footers.indexOf("="), n = a === -1 ? e.footers : e.footers.slice(0, a), i = a === -1 ? [] : e.footers.slice(a, Number.MAX_SAFE_INTEGER);
|
|
2417
2421
|
return [n, i];
|
|
2418
2422
|
}), l = (a) => {
|
|
2419
|
-
if (
|
|
2423
|
+
if (It.includes(a))
|
|
2420
2424
|
switch (a) {
|
|
2421
2425
|
case "markdownTotal":
|
|
2422
2426
|
return t(bo, {
|
|
@@ -2516,6 +2520,9 @@ const ro = (e) => {
|
|
|
2516
2520
|
onFocus: (g) => {
|
|
2517
2521
|
e.onFocus ? e.onFocus(g) : r.emit("onFocus", g);
|
|
2518
2522
|
},
|
|
2523
|
+
onInput: (g) => {
|
|
2524
|
+
e.onInput ? e.onInput(g) : r.emit("onInput", g);
|
|
2525
|
+
},
|
|
2519
2526
|
completions: e.completions,
|
|
2520
2527
|
catalogVisible: b.value,
|
|
2521
2528
|
theme: e.theme
|
package/lib/es/MdModal.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as x, ref as c, reactive as k, computed as $, onMounted as F, onBeforeUnmount as w, watch as v, nextTick as M, createVNode as o } from "vue";
|
|
2
2
|
import { p as s } from "./chunks/config.mjs";
|
|
3
3
|
import { g } from "./chunks/vue-tsx.mjs";
|
|
4
4
|
import { k as y } from "./chunks/dom.mjs";
|
|
@@ -21,9 +21,7 @@ const b = {
|
|
|
21
21
|
default: "auto"
|
|
22
22
|
},
|
|
23
23
|
onClose: {
|
|
24
|
-
type: Function
|
|
25
|
-
default: () => {
|
|
26
|
-
}
|
|
24
|
+
type: Function
|
|
27
25
|
},
|
|
28
26
|
showAdjust: {
|
|
29
27
|
type: Boolean,
|
|
@@ -38,12 +36,13 @@ const b = {
|
|
|
38
36
|
default: () => {
|
|
39
37
|
}
|
|
40
38
|
}
|
|
41
|
-
},
|
|
39
|
+
}, h = /* @__PURE__ */ x({
|
|
42
40
|
name: "MdModal",
|
|
43
41
|
props: b,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
emits: ["onClose"],
|
|
43
|
+
setup(e, u) {
|
|
44
|
+
const f = c(e.visible), n = c([`${s}-modal`]), m = c(), r = c();
|
|
45
|
+
let d = () => {
|
|
47
46
|
};
|
|
48
47
|
const t = k({
|
|
49
48
|
initPos: {
|
|
@@ -54,7 +53,7 @@ const b = {
|
|
|
54
53
|
left: "0px",
|
|
55
54
|
top: "0px"
|
|
56
55
|
}
|
|
57
|
-
}),
|
|
56
|
+
}), C = $(() => e.isFullscreen ? {
|
|
58
57
|
width: "100%",
|
|
59
58
|
height: "100%"
|
|
60
59
|
} : {
|
|
@@ -62,45 +61,47 @@ const b = {
|
|
|
62
61
|
height: e.height
|
|
63
62
|
});
|
|
64
63
|
return F(() => {
|
|
65
|
-
|
|
64
|
+
d = y(r.value, (i, l) => {
|
|
66
65
|
t.initPos.left = i + "px", t.initPos.top = l + "px";
|
|
67
66
|
});
|
|
68
67
|
}), w(() => {
|
|
69
|
-
|
|
68
|
+
d();
|
|
70
69
|
}), v(() => e.isFullscreen, (i) => {
|
|
71
|
-
i ?
|
|
70
|
+
i ? d() : d = y(r.value, (l, a) => {
|
|
72
71
|
t.initPos.left = l + "px", t.initPos.top = a + "px";
|
|
73
72
|
});
|
|
74
73
|
}), v(() => e.visible, (i) => {
|
|
75
|
-
i ? (n.value.push("zoom-in"),
|
|
76
|
-
const l =
|
|
77
|
-
t.initPos.left =
|
|
74
|
+
i ? (n.value.push("zoom-in"), f.value = i, M(() => {
|
|
75
|
+
const l = m.value.offsetWidth / 2, a = m.value.offsetHeight / 2, P = document.documentElement.clientWidth / 2, p = document.documentElement.clientHeight / 2;
|
|
76
|
+
t.initPos.left = P - l + "px", t.initPos.top = p - a + "px";
|
|
78
77
|
}), setTimeout(() => {
|
|
79
78
|
n.value = n.value.filter((l) => l !== "zoom-in");
|
|
80
79
|
}, 140)) : (n.value.push("zoom-out"), setTimeout(() => {
|
|
81
|
-
n.value = n.value.filter((l) => l !== "zoom-out"),
|
|
80
|
+
n.value = n.value.filter((l) => l !== "zoom-out"), f.value = i;
|
|
82
81
|
}, 130));
|
|
83
82
|
}), () => {
|
|
84
83
|
const i = g({
|
|
85
|
-
ctx:
|
|
84
|
+
ctx: u
|
|
86
85
|
}), l = g({
|
|
87
86
|
props: e,
|
|
88
|
-
ctx:
|
|
87
|
+
ctx: u
|
|
89
88
|
}, "title");
|
|
90
89
|
return o("div", {
|
|
91
90
|
style: {
|
|
92
|
-
display:
|
|
91
|
+
display: f.value ? "block" : "none"
|
|
93
92
|
}
|
|
94
93
|
}, [o("div", {
|
|
95
94
|
class: `${s}-modal-mask`,
|
|
96
|
-
onClick:
|
|
95
|
+
onClick: () => {
|
|
96
|
+
e.onClose ? e.onClose() : u.emit("onClose");
|
|
97
|
+
}
|
|
97
98
|
}, null), o("div", {
|
|
98
99
|
class: n.value,
|
|
99
100
|
style: {
|
|
100
101
|
...t.initPos,
|
|
101
|
-
...
|
|
102
|
+
...C.value
|
|
102
103
|
},
|
|
103
|
-
ref:
|
|
104
|
+
ref: m
|
|
104
105
|
}, [o("div", {
|
|
105
106
|
class: `${s}-modal-header`,
|
|
106
107
|
ref: r
|
|
@@ -124,7 +125,7 @@ const b = {
|
|
|
124
125
|
}, null)])]), o("div", {
|
|
125
126
|
class: `${s}-modal-close`,
|
|
126
127
|
onClick: (a) => {
|
|
127
|
-
a.stopPropagation(), e.onClose
|
|
128
|
+
a.stopPropagation(), e.onClose ? e.onClose() : u.emit("onClose");
|
|
128
129
|
}
|
|
129
130
|
}, [o("svg", {
|
|
130
131
|
class: `${s}-icon`,
|
|
@@ -135,7 +136,7 @@ const b = {
|
|
|
135
136
|
};
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
|
-
|
|
139
|
+
h.install = (e) => (e.component(h.name, h), e);
|
|
139
140
|
export {
|
|
140
|
-
|
|
141
|
+
h as default
|
|
141
142
|
};
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1074,6 +1074,12 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
|
|
|
1074
1074
|
showToolbarName: {
|
|
1075
1075
|
type: Boolean,
|
|
1076
1076
|
default: !1
|
|
1077
|
+
},
|
|
1078
|
+
/**
|
|
1079
|
+
* 字符输入事件
|
|
1080
|
+
*/
|
|
1081
|
+
onInput: {
|
|
1082
|
+
type: Function
|
|
1077
1083
|
}
|
|
1078
1084
|
}, oe = ["onHtmlChanged", "onGetCatalog"], yt = [
|
|
1079
1085
|
...oe,
|
|
@@ -1083,7 +1089,8 @@ const Y = "onSave", ee = "changeCatalogVisible", Ce = "changeFullscreen", G = "p
|
|
|
1083
1089
|
"onError",
|
|
1084
1090
|
"update:modelValue",
|
|
1085
1091
|
"onBlur",
|
|
1086
|
-
"onFocus"
|
|
1092
|
+
"onFocus",
|
|
1093
|
+
"onInput"
|
|
1087
1094
|
], Ye = /* @__PURE__ */ J({
|
|
1088
1095
|
name: "MdPreview",
|
|
1089
1096
|
props: re,
|
package/lib/es/chunks/index2.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as S, reactive as E, ref as C, watch as
|
|
2
|
-
import { p as
|
|
1
|
+
import { defineComponent as S, reactive as E, ref as C, watch as D, onMounted as T, onBeforeUnmount as O, cloneVNode as $, createVNode as d, inject as j } from "vue";
|
|
2
|
+
import { p as c } from "./config.mjs";
|
|
3
3
|
import { g as v } from "./vue-tsx.mjs";
|
|
4
4
|
const B = {
|
|
5
5
|
overlay: {
|
|
@@ -23,18 +23,18 @@ const B = {
|
|
|
23
23
|
}, F = /* @__PURE__ */ S({
|
|
24
24
|
props: B,
|
|
25
25
|
setup(e, a) {
|
|
26
|
-
const i = `${
|
|
26
|
+
const i = `${c}-dropdown-hidden`, t = E({
|
|
27
27
|
overlayClass: [i],
|
|
28
28
|
overlayStyle: {},
|
|
29
29
|
triggerHover: !1,
|
|
30
30
|
overlayHover: !1
|
|
31
|
-
}),
|
|
31
|
+
}), r = C(), n = C(), s = () => {
|
|
32
32
|
var p;
|
|
33
33
|
t.triggerHover = !0;
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
34
|
+
const o = r.value, l = n.value;
|
|
35
|
+
if (!o || !l)
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
37
|
+
const u = o.getBoundingClientRect(), f = o.offsetTop, b = o.offsetLeft, H = u.height, L = u.width, w = ((p = document.querySelector(e.relative)) == null ? void 0 : p.scrollLeft) || 0;
|
|
38
38
|
t.overlayStyle = {
|
|
39
39
|
...t.overlayStyle,
|
|
40
40
|
top: f + H + "px",
|
|
@@ -43,35 +43,35 @@ const B = {
|
|
|
43
43
|
}, m = () => {
|
|
44
44
|
t.overlayHover = !0;
|
|
45
45
|
};
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
D(() => e.visible, (o) => {
|
|
47
|
+
o ? t.overlayClass = t.overlayClass.filter((l) => l !== i) : t.overlayClass.push(i);
|
|
48
48
|
});
|
|
49
49
|
let h = -1;
|
|
50
|
-
const g = (
|
|
51
|
-
|
|
50
|
+
const g = (o) => {
|
|
51
|
+
r.value === o.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(h), h = window.setTimeout(() => {
|
|
52
52
|
!t.overlayHover && !t.triggerHover && e.onChange(!1);
|
|
53
53
|
}, 10);
|
|
54
54
|
};
|
|
55
|
-
return
|
|
56
|
-
|
|
55
|
+
return T(() => {
|
|
56
|
+
r.value.addEventListener("mouseenter", s), r.value.addEventListener("mouseleave", g), n.value.addEventListener("mouseenter", m), n.value.addEventListener("mouseleave", g);
|
|
57
57
|
}), O(() => {
|
|
58
|
-
|
|
58
|
+
r.value.removeEventListener("mouseenter", s), r.value.removeEventListener("mouseleave", g), n.value.removeEventListener("mouseenter", m), n.value.removeEventListener("mouseleave", g);
|
|
59
59
|
}), () => {
|
|
60
|
-
const
|
|
60
|
+
const o = v({
|
|
61
61
|
ctx: a
|
|
62
62
|
}), l = v({
|
|
63
63
|
props: e,
|
|
64
64
|
ctx: a
|
|
65
|
-
}, "overlay"),
|
|
66
|
-
ref:
|
|
67
|
-
}), f =
|
|
68
|
-
class: [`${
|
|
65
|
+
}, "overlay"), u = $(o instanceof Array ? o[0] : o, {
|
|
66
|
+
ref: r
|
|
67
|
+
}), f = d("div", {
|
|
68
|
+
class: [`${c}-dropdown`, t.overlayClass],
|
|
69
69
|
style: t.overlayStyle,
|
|
70
70
|
ref: n
|
|
71
|
-
}, [
|
|
72
|
-
class: `${
|
|
71
|
+
}, [d("div", {
|
|
72
|
+
class: `${c}-dropdown-overlay`
|
|
73
73
|
}, [l instanceof Array ? l[0] : l])]);
|
|
74
|
-
return [
|
|
74
|
+
return [u, f];
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
}), I = {
|
|
@@ -99,7 +99,7 @@ const B = {
|
|
|
99
99
|
insert: {
|
|
100
100
|
type: Function
|
|
101
101
|
},
|
|
102
|
-
|
|
102
|
+
default: {
|
|
103
103
|
type: [String, Object]
|
|
104
104
|
}
|
|
105
105
|
}, y = /* @__PURE__ */ S({
|
|
@@ -112,23 +112,23 @@ const B = {
|
|
|
112
112
|
const t = v({
|
|
113
113
|
props: e,
|
|
114
114
|
ctx: a
|
|
115
|
-
}, "trigger"),
|
|
115
|
+
}, "trigger"), r = v({
|
|
116
116
|
props: e,
|
|
117
117
|
ctx: a
|
|
118
118
|
}, "overlay"), n = v({
|
|
119
119
|
props: e,
|
|
120
120
|
ctx: a
|
|
121
121
|
});
|
|
122
|
-
return
|
|
122
|
+
return d(F, {
|
|
123
123
|
relative: `#${i}-toolbar-wrapper`,
|
|
124
124
|
visible: e.visible,
|
|
125
125
|
onChange: (s) => {
|
|
126
126
|
e.onChange instanceof Function ? e.onChange(s) : a.emit("onChange", s);
|
|
127
127
|
},
|
|
128
|
-
overlay:
|
|
128
|
+
overlay: r
|
|
129
129
|
}, {
|
|
130
|
-
default: () => [
|
|
131
|
-
class: `${
|
|
130
|
+
default: () => [d("div", {
|
|
131
|
+
class: `${c}-toolbar-item`,
|
|
132
132
|
title: e.title || ""
|
|
133
133
|
}, [t, n])]
|
|
134
134
|
});
|