md-editor-v3 4.12.0-beta.1 → 4.12.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.
@@ -1,5 +1,5 @@
1
- import { defineComponent as y, createVNode as l, inject as z, h as F, ref as f, shallowRef as M, reactive as w, computed as T, onMounted as H, watch as p, nextTick as g, Teleport as A } from "vue";
2
- import { p as o, e as R } from "./config.mjs";
1
+ import { defineComponent as y, createVNode as t, inject as S, h as w, ref as m, shallowRef as M, reactive as T, computed as H, watch as g, nextTick as p, Teleport as R } from "vue";
2
+ import { p as l, e as A } from "./config.mjs";
3
3
  import { g as x } from "./vue-tsx.mjs";
4
4
  import { k as C } from "./dom.mjs";
5
5
  const W = /* @__PURE__ */ y({
@@ -10,16 +10,16 @@ const W = /* @__PURE__ */ y({
10
10
  }
11
11
  },
12
12
  setup(e) {
13
- return () => R.iconfontType === "svg" ? l("svg", {
14
- class: `${o}-icon`,
13
+ return () => A.iconfontType === "svg" ? t("svg", {
14
+ class: `${l}-icon`,
15
15
  "aria-hidden": "true"
16
- }, [l("use", {
17
- "xlink:href": `#${o}-icon-${e.name}`
18
- }, null)]) : l("i", {
19
- class: `${o}-iconfont ${o}-icon-${e.name}`
16
+ }, [t("use", {
17
+ "xlink:href": `#${l}-icon-${e.name}`
18
+ }, null)]) : t("i", {
19
+ class: `${l}-iconfont ${l}-icon-${e.name}`
20
20
  }, null);
21
21
  }
22
- }), $ = /* @__PURE__ */ y({
22
+ }), P = /* @__PURE__ */ y({
23
23
  props: {
24
24
  name: {
25
25
  type: String,
@@ -27,12 +27,12 @@ const W = /* @__PURE__ */ y({
27
27
  }
28
28
  },
29
29
  setup(e) {
30
- const c = z("customIcon");
30
+ const c = S("customIcon");
31
31
  return () => {
32
- const n = c.value[e.name];
33
- return typeof n == "object" ? typeof n.component == "object" ? F(n.component, n.props) : l("span", {
34
- innerHTML: n.component
35
- }, null) : l(W, {
32
+ const s = c.value[e.name];
33
+ return typeof s == "object" ? typeof s.component == "object" ? w(s.component, s.props) : t("span", {
34
+ innerHTML: s.component
35
+ }, null) : t(W, {
36
36
  name: e.name
37
37
  }, null);
38
38
  };
@@ -77,18 +77,18 @@ const W = /* @__PURE__ */ y({
77
77
  type: Object,
78
78
  default: () => ({})
79
79
  }
80
- }, E = `.${o}-modal-container`, P = /* @__PURE__ */ (() => {
80
+ }, E = `${l}-modal-container`, $ = /* @__PURE__ */ (() => {
81
81
  let e = 2e4;
82
82
  return () => ++e;
83
- })(), h = /* @__PURE__ */ y({
83
+ })(), v = /* @__PURE__ */ y({
84
84
  name: "MdModal",
85
85
  props: B,
86
86
  emits: ["onClose"],
87
87
  setup(e, c) {
88
- const n = f(e.visible), i = f([`${o}-modal`]), r = f(), v = f(), d = M();
89
- let m = () => {
88
+ const s = S("theme"), f = m(e.visible), i = m([`${l}-modal`]), r = m(), h = m(), k = M();
89
+ let d = () => {
90
90
  };
91
- const t = w({
91
+ const o = T({
92
92
  maskStyle: {
93
93
  zIndex: -1
94
94
  },
@@ -103,93 +103,95 @@ const W = /* @__PURE__ */ y({
103
103
  left: "0px",
104
104
  top: "0px"
105
105
  }
106
- }), S = T(() => e.isFullscreen ? {
106
+ }), I = H(() => e.isFullscreen ? {
107
107
  width: "100%",
108
108
  height: "100%"
109
109
  } : {
110
110
  width: e.width,
111
111
  height: e.height
112
112
  });
113
- return H(() => {
114
- d.value = document.querySelector(`.${o}-modal-container`) ?? void 0, d.value || (d.value = document.createElement("div"), d.value.setAttribute("class", `${o}-modal-container`), document.body.appendChild(d.value));
115
- }), p(() => e.isFullscreen, (a) => {
116
- a ? m() : g(() => {
117
- m = C(v.value, (s, u) => {
118
- t.initPos.left = s + "px", t.initPos.top = u + "px";
113
+ return g(() => e.isFullscreen, (a) => {
114
+ a ? d() : p(() => {
115
+ d = C(h.value, (n, u) => {
116
+ o.initPos.left = n + "px", o.initPos.top = u + "px";
119
117
  });
120
118
  });
121
- }), p(() => e.visible, (a) => {
122
- a ? (t.maskStyle.zIndex = P(), t.modalStyle.zIndex = P(), i.value.push("zoom-in"), n.value = a, g(() => {
123
- const s = r.value.offsetWidth / 2, u = r.value.offsetHeight / 2, k = document.documentElement.clientWidth / 2, b = document.documentElement.clientHeight / 2;
124
- t.initPos.left = k - s + "px", t.initPos.top = b - u + "px", e.isFullscreen || (m = C(v.value, (I, j) => {
125
- t.initPos.left = I + "px", t.initPos.top = j + "px";
119
+ }), g(() => e.visible, (a) => {
120
+ a ? (o.maskStyle.zIndex = $(), o.modalStyle.zIndex = $(), i.value.push("zoom-in"), f.value = a, p(() => {
121
+ const n = r.value.offsetWidth / 2, u = r.value.offsetHeight / 2, b = document.documentElement.clientWidth / 2, j = document.documentElement.clientHeight / 2;
122
+ o.initPos.left = b - n + "px", o.initPos.top = j - u + "px", e.isFullscreen || (d = C(h.value, (z, F) => {
123
+ o.initPos.left = z + "px", o.initPos.top = F + "px";
126
124
  }));
127
125
  }), setTimeout(() => {
128
- i.value = i.value.filter((s) => s !== "zoom-in");
129
- }, 140)) : (i.value.push("zoom-out"), m(), setTimeout(() => {
130
- i.value = i.value.filter((s) => s !== "zoom-out"), n.value = a;
126
+ i.value = i.value.filter((n) => n !== "zoom-in");
127
+ }, 140)) : (i.value.push("zoom-out"), d(), setTimeout(() => {
128
+ i.value = i.value.filter((n) => n !== "zoom-out"), f.value = a;
131
129
  }, 130));
132
130
  }), () => {
133
131
  const a = x({
134
132
  ctx: c
135
- }), s = x({
133
+ }), n = x({
136
134
  props: e,
137
135
  ctx: c
138
136
  }, "title");
139
- return d.value && l(A, {
140
- to: E
137
+ return t(R, {
138
+ to: document.body
141
139
  }, {
142
- default: () => [l("div", {
140
+ default: () => [t("div", {
141
+ ref: k,
142
+ class: E,
143
+ "data-theme": s.value
144
+ }, [t("div", {
143
145
  class: e.class,
144
146
  style: {
145
147
  ...e.style,
146
- display: n.value ? "block" : "none"
148
+ display: f.value ? "block" : "none"
147
149
  }
148
- }, [l("div", {
149
- class: `${o}-modal-mask`,
150
- style: t.maskStyle,
150
+ }, [t("div", {
151
+ class: `${l}-modal-mask`,
152
+ style: o.maskStyle,
151
153
  onClick: () => {
152
154
  e.onClose ? e.onClose() : c.emit("onClose");
153
155
  }
154
- }, null), l("div", {
156
+ }, null), t("div", {
155
157
  class: i.value,
156
158
  style: {
157
- ...t.modalStyle,
158
- ...t.initPos,
159
- ...S.value
159
+ ...o.modalStyle,
160
+ ...o.initPos,
161
+ ...I.value
160
162
  },
161
163
  ref: r
162
- }, [l("div", {
163
- class: `${o}-modal-header`,
164
- ref: v
165
- }, [s || ""]), l("div", {
166
- class: `${o}-modal-body`
167
- }, [a]), l("div", {
168
- class: `${o}-modal-func`
169
- }, [e.showAdjust && l("div", {
170
- class: `${o}-modal-adjust`,
164
+ }, [t("div", {
165
+ class: `${l}-modal-header`,
166
+ ref: h
167
+ }, [n || ""]), t("div", {
168
+ class: `${l}-modal-body`
169
+ }, [a]), t("div", {
170
+ class: `${l}-modal-func`
171
+ }, [e.showAdjust && t("div", {
172
+ class: `${l}-modal-adjust`,
171
173
  onClick: (u) => {
172
- u.stopPropagation(), e.isFullscreen ? t.initPos = t.historyPos : (t.historyPos = t.initPos, t.initPos = {
174
+ u.stopPropagation(), e.isFullscreen ? o.initPos = o.historyPos : (o.historyPos = o.initPos, o.initPos = {
173
175
  left: "0",
174
176
  top: "0"
175
177
  }), e.onAdjust(!e.isFullscreen);
176
178
  }
177
- }, [l($, {
179
+ }, [t(P, {
178
180
  name: e.isFullscreen ? "suoxiao" : "fangda"
179
- }, null)]), l("div", {
180
- class: `${o}-modal-close`,
181
+ }, null)]), t("div", {
182
+ class: `${l}-modal-close`,
181
183
  onClick: (u) => {
182
184
  u.stopPropagation(), e.onClose ? e.onClose() : c.emit("onClose");
183
185
  }
184
- }, [l($, {
186
+ }, [t(P, {
185
187
  name: "close"
186
- }, null)])])])])]
188
+ }, null)])])])])])]
187
189
  });
188
190
  };
189
191
  }
190
192
  });
191
- h.install = (e) => (e.component(h.name, h), e);
193
+ v.install = (e) => (e.component(v.name, v), e);
192
194
  export {
193
- $ as I,
194
- h as M
195
+ P as I,
196
+ v as M
195
197
  };
@@ -1,7 +1,7 @@
1
1
  var i = Object.defineProperty;
2
2
  var p = (o, s, t) => s in o ? i(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
3
3
  var r = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
4
- class h {
4
+ class E {
5
5
  constructor() {
6
6
  // 事件池
7
7
  r(this, "pools", {});
@@ -32,7 +32,7 @@ class h {
32
32
  });
33
33
  }
34
34
  }
35
- const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscreen", A = "pageFullscreenChanged", _ = "fullscreenChanged", d = "previewChanged", L = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "buildFinished", G = "errorCatcher", H = "replace", b = "uploadImage", I = "openModals", m = "ctrlZ", S = "ctrlShiftZ", D = "catalogChanged", F = "pushCatalog", T = "rerender", O = (o, s = "image.png") => {
35
+ const C = new E(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscreen", A = "pageFullscreenChanged", _ = "fullscreenChanged", L = "previewChanged", d = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "buildFinished", G = "errorCatcher", H = "replace", I = "uploadImage", b = "openModals", S = "ctrlZ", T = "ctrlShiftZ", m = "catalogChanged", D = "pushCatalog", F = "rerender", O = "eventListener", w = (o, s = "image.png") => {
36
36
  const t = o.split(","), n = t[0].match(/:(.*?);/);
37
37
  if (n) {
38
38
  const l = n[1], e = atob(t[1]);
@@ -43,7 +43,7 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
43
43
  return new File([c], s, { type: l });
44
44
  }
45
45
  return null;
46
- }, w = (o) => {
46
+ }, P = (o) => {
47
47
  if (!o)
48
48
  return o;
49
49
  const s = o.split(`
@@ -51,7 +51,7 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
51
51
  return s.forEach(() => {
52
52
  t.push("<span></span>");
53
53
  }), t.push("</span>"), `<span class="code-block">${o}</span>${t.join("")}`;
54
- }, P = (o, s) => {
54
+ }, U = (o, s) => {
55
55
  if (!o || !s)
56
56
  return 0;
57
57
  const t = o == null ? void 0 : o.getBoundingClientRect();
@@ -59,32 +59,33 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
59
59
  return t.top - s.clientTop;
60
60
  const n = s == null ? void 0 : s.getBoundingClientRect();
61
61
  return t.top - n.top;
62
- }, U = /* @__PURE__ */ (() => {
62
+ }, V = /* @__PURE__ */ (() => {
63
63
  let o = 0;
64
64
  return (s) => s + ++o;
65
65
  })();
66
66
  export {
67
67
  f as B,
68
- D as C,
68
+ m as C,
69
69
  G as E,
70
70
  _ as F,
71
- L as H,
71
+ d as H,
72
72
  u as O,
73
- F as P,
74
- T as R,
75
- b as U,
76
- w as a,
73
+ D as P,
74
+ F as R,
75
+ I as U,
76
+ P as a,
77
77
  C as b,
78
78
  g as c,
79
79
  A as d,
80
- d as e,
80
+ L as e,
81
81
  N as f,
82
- P as g,
82
+ U as g,
83
83
  H as h,
84
84
  R as i,
85
- U as j,
86
- O as k,
87
- I as l,
88
- S as m,
89
- m as n
85
+ O as j,
86
+ V as k,
87
+ w as l,
88
+ b as m,
89
+ T as n,
90
+ S as o
90
91
  };