md-editor-v3 4.3.0-beta.2 → 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.
@@ -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 I, 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 Dt } from "./chunks/config.mjs";
6
- import { draggingScroll as Nt, linkTo as Et, debounce as Ht, throttle as It, smoothScroll as rt } from "@vavt/util";
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 I(() => e.visible, (i) => {
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
- I(() => e.visible, () => {
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
- }), I(() => [d.imgSelected], () => {
298
+ }), H(() => [d.imgSelected], () => {
299
299
  u.value.style = "";
300
- }), I(() => d.isFullscreen, () => {
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, D, N, V, B, E, j, U, re, X, _, G, Q, W, H, F, ee, ne, ve, ke, pe, Ce, $e, ye, Te, we, xe, Se, Ae, Me, Le, De, Ne, Ee, He, Ie, Be, Fe, Oe, Ve, Re, Pe, qe, Ue, Ge, Ke, je, _e, We, ze, Ye, Ze, Je, Xe, Qe, et, tt, lt, ot;
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
- }, [(D = l.value.titleItem) == null ? void 0 : D.h2]), t("li", {
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
- }, [(N = l.value.titleItem) == null ? void 0 : N.h3]), t("li", {
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
- }, [(E = l.value.titleItem) == null ? void 0 : E.h6])])
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: (H = l.value.toolbarTips) == null ? void 0 : H.orderedList,
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: (De = l.value.toolbarTips) == null ? void 0 : De.next,
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
- }, [(Ne = l.value.toolbarTips) == null ? void 0 : Ne.next])]);
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: (Ee = l.value.toolbarTips) == null ? void 0 : Ee.save,
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
- }, [(He = l.value.toolbarTips) == null ? void 0 : He.save])]);
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: (Ie = l.value.toolbarTips) == null ? void 0 : Ie.prettier,
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: () => Et("https://github.com/imzbf/md-editor-v3")
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 I(() => e.toolbars, () => {
1096
+ return H(() => e.toolbars, () => {
1097
1097
  ce(() => {
1098
- i.value && Nt(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 = Ht(() => {
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 = It((b) => {
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 D = n(C.start), N = 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, E = 0;
1192
- D === 0 ? (R = (a.scrollDOM.scrollTop - D) / (M - D), B = V.offsetTop) : M > a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight ? (R = (a.scrollDOM.scrollTop - D) / (a.scrollDOM.scrollHeight - a.scrollDOM.clientHeight - D), E = N.offsetTop, B = r.scrollHeight - r.clientHeight - E + 10) : (R = (a.scrollDOM.scrollTop - D) / (M - D), E = N.offsetTop, B = V.offsetTop - E);
1193
- const j = E - 10 + B * R;
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 D = C.length === 0 ? 1 : Math.ceil(
1204
+ let I = C.length === 0 ? 1 : Math.ceil(
1205
1205
  Number(C[C.length - 1].dataset.line) * (M / R)
1206
- ), N = (y = r.firstElementChild) == null ? void 0 : y.firstElementChild;
1207
- for (let H = D; H >= 0; H--) {
1208
- const F = r.querySelector(`[data-line="${H}"]`);
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
- N = F, D = H;
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 H = C.indexOf(N);
1217
- if (H + 1 >= C.length)
1216
+ const E = C.indexOf(D);
1217
+ if (E + 1 >= C.length)
1218
1218
  break;
1219
- const F = C[H + 1];
1220
- if (H === -1) {
1219
+ const F = C[E + 1];
1220
+ if (E === -1) {
1221
1221
  B = F;
1222
1222
  break;
1223
1223
  }
1224
- const ee = N.offsetTop;
1224
+ const ee = D.offsetTop;
1225
1225
  if (ee > M) {
1226
- if (H === 0) {
1227
- V = N, B = F;
1226
+ if (E === 0) {
1227
+ V = D, B = F;
1228
1228
  break;
1229
1229
  }
1230
- N = C[H - 1];
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 = N, B = F;
1235
+ V = D, B = F;
1236
1236
  break;
1237
1237
  }
1238
- N = F;
1238
+ D = F;
1239
1239
  }
1240
- const E = V.offsetTop, j = B.offsetTop;
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 - E) / (r.scrollHeight - E - r.clientHeight),
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 - E) / (j - E),
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
- I(
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
- ), I(
1294
+ ), H(
1295
1295
  () => e.scrollAuto,
1296
1296
  (d) => {
1297
1297
  d ? i() : n();
1298
1298
  }
1299
1299
  ), Y(u);
1300
- }, Dl = Ll, Nl = (e, r, l) => {
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
- }, El = "#e5c07b", it = "var(--md-color)", Hl = "#56b6c2", Il = "#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(
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: El
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: Hl
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: Il }
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 } = Nl($, i.value, T);
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
- }), I(
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
- ), I(
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
- ), I(
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
- ), I(
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
- ), I(
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
- ), I(
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 Dl(e, l, n), () => t("div", {
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 (Dt.includes(a))
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
@@ -1,4 +1,4 @@
1
- import { defineComponent as C, ref as d, reactive as k, computed as $, onMounted as F, onBeforeUnmount as w, watch as v, nextTick as M, createVNode as o } from "vue";
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
- }, m = /* @__PURE__ */ C({
39
+ }, h = /* @__PURE__ */ x({
42
40
  name: "MdModal",
43
41
  props: b,
44
- setup(e, h) {
45
- const c = d(e.visible), n = d([`${s}-modal`]), f = d(), r = d();
46
- let u = () => {
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
- }), P = $(() => e.isFullscreen ? {
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
- u = y(r.value, (i, l) => {
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
- u();
68
+ d();
70
69
  }), v(() => e.isFullscreen, (i) => {
71
- i ? u() : u = y(r.value, (l, a) => {
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"), c.value = i, M(() => {
76
- const l = f.value.offsetWidth / 2, a = f.value.offsetHeight / 2, p = document.documentElement.clientWidth / 2, x = document.documentElement.clientHeight / 2;
77
- t.initPos.left = p - l + "px", t.initPos.top = x - a + "px";
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"), c.value = i;
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: h
84
+ ctx: u
86
85
  }), l = g({
87
86
  props: e,
88
- ctx: h
87
+ ctx: u
89
88
  }, "title");
90
89
  return o("div", {
91
90
  style: {
92
- display: c.value ? "block" : "none"
91
+ display: f.value ? "block" : "none"
93
92
  }
94
93
  }, [o("div", {
95
94
  class: `${s}-modal-mask`,
96
- onClick: e.onClose
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
- ...P.value
102
+ ...C.value
102
103
  },
103
- ref: f
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 && 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
- m.install = (e) => (e.component(m.name, m), e);
139
+ h.install = (e) => (e.component(h.name, h), e);
139
140
  export {
140
- m as default
141
+ h as default
141
142
  };
@@ -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,