md-editor-v3 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,8 +16,8 @@ import Nt from "markdown-it";
16
16
  import Vt from "markdown-it-image-figures";
17
17
  import Ut from "markdown-it-task-lists";
18
18
  import qt from "markdown-it-codetabs";
19
- import Wt from "lru-cache";
20
- const s = "md-editor", Gt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", L = "https://cdnjs.cloudflare.com/ajax/libs", zt = `${L}/highlight.js/11.7.0/highlight.min.js`, Ge = {
19
+ import Gt from "lru-cache";
20
+ const s = "md-editor", Wt = "md-editor-v3", Kt = "https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js", L = "https://cdnjs.cloudflare.com/ajax/libs", zt = `${L}/highlight.js/11.7.0/highlight.min.js`, We = {
21
21
  main: `${L}/prettier/2.8.0/standalone.js`,
22
22
  markdown: `${L}/prettier/2.8.0/parser-markdown.js`
23
23
  }, Ke = {
@@ -277,7 +277,7 @@ const Yt = /* @__PURE__ */ M({
277
277
  class: `${s}-divider`
278
278
  }, null);
279
279
  }
280
- }), W = ({
280
+ }), G = ({
281
281
  instance: e,
282
282
  ctx: l,
283
283
  props: o = {}
@@ -346,9 +346,9 @@ const Qt = {
346
346
  }), Se(() => {
347
347
  e.trigger === "click" ? (r.value.removeEventListener("click", a), document.removeEventListener("click", m)) : (r.value.removeEventListener("mouseenter", a), r.value.removeEventListener("mouseleave", c), n.value.removeEventListener("mouseenter", d), n.value.removeEventListener("mouseleave", c));
348
348
  }), () => {
349
- const f = W({
349
+ const f = G({
350
350
  ctx: l
351
- }), h = W({
351
+ }), h = G({
352
352
  props: e,
353
353
  ctx: l
354
354
  }, "overlay"), p = St(f instanceof Array ? f[0] : f, {
@@ -659,9 +659,9 @@ const ml = {
659
659
  t.value = t.value.filter((c) => c !== "zoom-out"), o.value = u;
660
660
  }, 130));
661
661
  }), () => {
662
- const u = W({
662
+ const u = G({
663
663
  ctx: l
664
- }), c = W({
664
+ }), c = G({
665
665
  props: e,
666
666
  ctx: l
667
667
  }, "title");
@@ -1024,7 +1024,7 @@ const hl = {
1024
1024
  c.value.addEventListener("change", f);
1025
1025
  });
1026
1026
  const h = (p) => {
1027
- var v, b, y, C, $, T, I, w, F, j, R, P, _, N, D, Q, z, ue, re, ee, X, ie, te, O, G, ae, me, Ie, He, Fe, Me, Be, Re, je, Pe, De, Oe, _e, Ne, Ve, Ue, qe, We;
1027
+ var v, b, y, C, $, T, I, w, F, j, R, P, _, N, D, Q, z, ue, re, ee, X, ie, te, O, W, ae, me, Ie, He, Fe, Me, Be, Re, je, Pe, De, Oe, _e, Ne, Ve, Ue, qe, Ge;
1028
1028
  if (bt.includes(p))
1029
1029
  switch (p) {
1030
1030
  case "-":
@@ -1354,7 +1354,7 @@ const hl = {
1354
1354
  case "next":
1355
1355
  return i("div", {
1356
1356
  class: `${s}-toolbar-item`,
1357
- title: (G = o.value.toolbarTips) == null ? void 0 : G.next,
1357
+ title: (W = o.value.toolbarTips) == null ? void 0 : W.next,
1358
1358
  onClick: () => {
1359
1359
  k.emit(l, "ctrlShiftZ");
1360
1360
  }
@@ -1557,7 +1557,7 @@ const hl = {
1557
1557
  onClick: () => {
1558
1558
  a("katexBlock");
1559
1559
  }
1560
- }, [(We = o.value.katex) == null ? void 0 : We.block])]),
1560
+ }, [(Ge = o.value.katex) == null ? void 0 : Ge.block])]),
1561
1561
  key: "bar-katex"
1562
1562
  }, {
1563
1563
  default: () => {
@@ -1689,9 +1689,9 @@ const hl = {
1689
1689
  Number(w[w.length - 1].dataset.line) * (F / j)
1690
1690
  ), P = (C = l.firstElementChild) == null ? void 0 : C.firstElementChild;
1691
1691
  for (let O = R; O >= 0; O--) {
1692
- const G = l.querySelector(`[data-line="${O}"]`);
1693
- if (G) {
1694
- P = G, R = O;
1692
+ const W = l.querySelector(`[data-line="${O}"]`);
1693
+ if (W) {
1694
+ P = W, R = O;
1695
1695
  break;
1696
1696
  }
1697
1697
  }
@@ -1700,21 +1700,21 @@ const hl = {
1700
1700
  const O = w.indexOf(P);
1701
1701
  if (O + 1 >= w.length)
1702
1702
  break;
1703
- const G = w[O + 1], ae = P.offsetTop;
1703
+ const W = w[O + 1], ae = P.offsetTop;
1704
1704
  if (ae > F) {
1705
1705
  if (O === 0) {
1706
- _ = P, N = G;
1706
+ _ = P, N = W;
1707
1707
  break;
1708
1708
  }
1709
1709
  P = w[O - 1];
1710
1710
  continue;
1711
1711
  }
1712
- const me = G.offsetTop;
1712
+ const me = W.offsetTop;
1713
1713
  if (ae <= F && me > F) {
1714
- _ = P, N = G;
1714
+ _ = P, N = W;
1715
1715
  break;
1716
1716
  }
1717
- P = G;
1717
+ P = W;
1718
1718
  }
1719
1719
  const D = _.offsetTop, Q = N.offsetTop;
1720
1720
  let z = 0;
@@ -2187,7 +2187,7 @@ $$
2187
2187
  { tag: [g.atom, g.bool, g.special(g.variableName)], color: ut },
2188
2188
  { tag: [g.processingInstruction, g.string, g.inserted], color: Ol },
2189
2189
  { tag: g.invalid, color: Pl }
2190
- ]), Wl = [
2190
+ ]), Gl = [
2191
2191
  Ul,
2192
2192
  pt(ql)
2193
2193
  ], le = (e) => {
@@ -2196,7 +2196,7 @@ $$
2196
2196
  effects: At.appendConfig.of(l.of(t))
2197
2197
  }), !0);
2198
2198
  };
2199
- class Gl {
2199
+ class Wl {
2200
2200
  constructor(l) {
2201
2201
  K(this, "view");
2202
2202
  // 切换tabSize的执行方法。切换时,Compartment实例需要相同
@@ -2450,7 +2450,7 @@ const Kl = (e) => {
2450
2450
  })
2451
2451
  ], u = () => t.value === "light" ? A.codeMirrorExtensions(
2452
2452
  t.value,
2453
- [...m, Wl],
2453
+ [...m, Gl],
2454
2454
  [...a]
2455
2455
  ) : A.codeMirrorExtensions(
2456
2456
  t.value,
@@ -2464,7 +2464,7 @@ const Kl = (e) => {
2464
2464
  state: c,
2465
2465
  parent: r.value
2466
2466
  });
2467
- n.value = new Gl(f), n.value.setTabSize(l), n.value.setExtensions(u()), n.value.setPlaceholder(e.placeholder), n.value.setDisabled(e.disabled), n.value.setReadOnly(e.readonly), e.autofocus && f.focus(), e.maxlength && n.value.setMaxLength(e.maxlength), k.on(o, {
2467
+ n.value = new Wl(f), n.value.setTabSize(l), n.value.setExtensions(u()), n.value.setPlaceholder(e.placeholder), n.value.setDisabled(e.disabled), n.value.setReadOnly(e.readonly), e.autofocus && f.focus(), e.maxlength && n.value.setMaxLength(e.maxlength), k.on(o, {
2468
2468
  name: "ctrlZ",
2469
2469
  callback() {
2470
2470
  jt(f);
@@ -2571,7 +2571,7 @@ const Kl = (e) => {
2571
2571
  }
2572
2572
  ), r;
2573
2573
  }, eo = (e) => {
2574
- const l = x("theme"), { editorExtensions: o } = A, t = o == null ? void 0 : o.mermaid, r = de(t == null ? void 0 : t.instance), n = de(!1), a = new Wt({
2574
+ const l = x("theme"), { editorExtensions: o } = A, t = o == null ? void 0 : o.mermaid, r = de(t == null ? void 0 : t.instance), n = de(!1), a = new Gt({
2575
2575
  max: 1e3,
2576
2576
  // 缓存10分钟
2577
2577
  ttl: 6e5
@@ -2788,18 +2788,15 @@ const Kl = (e) => {
2788
2788
  return `<pre><code class="language-${C}" language=${C}>${T}</code></pre>`;
2789
2789
  }
2790
2790
  }), so(h), o(h);
2791
- const p = B(e.sanitize(h.render(e.value))), v = ve(
2791
+ const p = B(e.sanitize(h.render(e.value)));
2792
+ k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), e.onGetCatalog(d.value), k.emit(t, "catalogChanged", d.value), f();
2793
+ const v = ve(
2792
2794
  async () => {
2793
- d.value = [], p.value = e.sanitize(h.render(e.value)), k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), f();
2795
+ d.value = [], p.value = e.sanitize(h.render(e.value)), k.emit(t, "buildFinished", p.value), e.onHtmlChanged(p.value), e.onGetCatalog(d.value), k.emit(t, "catalogChanged", d.value), f();
2794
2796
  },
2795
2797
  (l == null ? void 0 : l.renderDelay) !== void 0 ? l == null ? void 0 : l.renderDelay : n ? 0 : 500
2796
- ), b = U(() => e.noHighlight || m.value);
2797
- return S([ne(e, "value"), b, c], v), S(
2798
- () => d.value,
2799
- (y) => {
2800
- e.onGetCatalog(y), k.emit(t, "catalogChanged", y);
2801
- }
2802
- ), H(() => {
2798
+ ), b = U(() => (e.noKatex || u.value) && (e.noHighlight || m.value));
2799
+ return S([ne(e, "value"), b, c], v), H(() => {
2803
2800
  k.on(t, {
2804
2801
  name: "pushCatalog",
2805
2802
  callback() {
@@ -3351,7 +3348,7 @@ const Co = {
3351
3348
  const b = document.createElement("script");
3352
3349
  b.src = (n == null ? void 0 : n.iconfont) || Kt, b.id = `${s}-icon`;
3353
3350
  const y = document.createElement("script"), C = document.createElement("script");
3354
- y.src = ((I = n == null ? void 0 : n.prettier) == null ? void 0 : I.standaloneJs) || Ge.main, y.id = `${s}-prettier`, C.src = ((w = n == null ? void 0 : n.prettier) == null ? void 0 : w.parserMarkdownJs) || Ge.markdown, C.id = `${s}-prettierMD`;
3351
+ y.src = ((I = n == null ? void 0 : n.prettier) == null ? void 0 : I.standaloneJs) || We.main, y.id = `${s}-prettier`, C.src = ((w = n == null ? void 0 : n.prettier) == null ? void 0 : w.parserMarkdownJs) || We.markdown, C.id = `${s}-prettierMD`;
3355
3352
  const $ = document.createElement("link");
3356
3353
  $.rel = "stylesheet", $.href = ((F = n == null ? void 0 : n.cropper) == null ? void 0 : F.css) || Ke.css, $.id = `${s}-cropperCss`;
3357
3354
  const T = document.createElement("script");
@@ -3634,7 +3631,7 @@ const Co = {
3634
3631
  */
3635
3632
  editorId: {
3636
3633
  type: String,
3637
- default: Gt
3634
+ default: Wt
3638
3635
  },
3639
3636
  /**
3640
3637
  * 一个tab等于空格数
@@ -3901,10 +3898,10 @@ const J = /* @__PURE__ */ M({
3901
3898
  k.clear(o);
3902
3899
  }), Eo(e, l, h, c, f), () => {
3903
3900
  var y;
3904
- const v = W({
3901
+ const v = G({
3905
3902
  props: e,
3906
3903
  ctx: l
3907
- }, "defToolbars"), b = W({
3904
+ }, "defToolbars"), b = G({
3908
3905
  props: e,
3909
3906
  ctx: l
3910
3907
  }, "defFooters");
@@ -3988,7 +3985,7 @@ const J = /* @__PURE__ */ M({
3988
3985
  emits: ["onClick"],
3989
3986
  setup(e, l) {
3990
3987
  return () => {
3991
- const o = W({
3988
+ const o = G({
3992
3989
  props: e,
3993
3990
  ctx: l
3994
3991
  }, "trigger");
@@ -4027,10 +4024,10 @@ const J = /* @__PURE__ */ M({
4027
4024
  setup(e, l) {
4028
4025
  const o = x("editorId");
4029
4026
  return () => {
4030
- const t = W({
4027
+ const t = G({
4031
4028
  props: e,
4032
4029
  ctx: l
4033
- }, "trigger"), r = W({
4030
+ }, "trigger"), r = G({
4034
4031
  props: e,
4035
4032
  ctx: l
4036
4033
  }, "overlay");
@@ -4103,10 +4100,10 @@ const Bo = {
4103
4100
  emits: ["onClick", "onClose", "onAdjust"],
4104
4101
  setup(e, l) {
4105
4102
  return () => {
4106
- const o = W({
4103
+ const o = G({
4107
4104
  props: e,
4108
4105
  ctx: l
4109
- }, "trigger"), t = W({
4106
+ }, "trigger"), t = G({
4110
4107
  props: e,
4111
4108
  ctx: l
4112
4109
  }, "default");