md-editor-v3 4.3.0-beta.3 → 4.3.0-beta.5

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,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
  };