md-editor-v3 4.12.0-beta.0 → 4.12.0-beta.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.
- package/lib/cjs/chunks/index3.cjs +1 -1
- package/lib/es/chunks/index3.mjs +108 -84
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +17 -2
- package/lib/types/MdEditor/components/Modal/index.d.ts +28 -5
- package/lib/umd/index.js +28 -28
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue"),n=require("./config.cjs"),
|
|
1
|
+
"use strict";const e=require("vue"),n=require("./config.cjs"),y=require("./vue-tsx.cjs"),p=require("./dom.cjs"),S=e.defineComponent({props:{name:{type:String,default:""}},setup(t){return()=>n.configOption.iconfontType==="svg"?e.createVNode("svg",{class:`${n.prefix}-icon`,"aria-hidden":"true"},[e.createVNode("use",{"xlink:href":`#${n.prefix}-icon-${t.name}`},null)]):e.createVNode("i",{class:`${n.prefix}-iconfont ${n.prefix}-icon-${t.name}`},null)}}),h=e.defineComponent({props:{name:{type:String,default:""}},setup(t){const d=e.inject("customIcon");return()=>{const l=d.value[t.name];return typeof l=="object"?typeof l.component=="object"?e.h(l.component,l.props):e.createVNode("span",{innerHTML:l.component},null):e.createVNode(S,{name:t.name},null)}}}),V={title:{type:String,default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>{}},class:{type:String},style:{type:Object,default:()=>({})}},k=`.${n.prefix}-modal-container`,x=(()=>{let t=2e4;return()=>++t})(),f=e.defineComponent({name:"MdModal",props:V,emits:["onClose"],setup(t,d){const l=e.ref(t.visible),s=e.ref([`${n.prefix}-modal`]),m=e.ref(),v=e.ref(),u=e.shallowRef();let r=()=>{};const o=e.reactive({maskStyle:{zIndex:-1},modalStyle:{zIndex:-1},initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),g=e.computed(()=>t.isFullscreen?{width:"100%",height:"100%"}:{width:t.width,height:t.height});return e.onMounted(()=>{u.value=document.querySelector(`.${n.prefix}-modal-container`)??void 0,u.value||(u.value=document.createElement("div"),u.value.setAttribute("class",`${n.prefix}-modal-container`),document.body.appendChild(u.value))}),e.watch(()=>t.isFullscreen,a=>{a?r():e.nextTick(()=>{r=p.keyMove(v.value,(i,c)=>{o.initPos.left=i+"px",o.initPos.top=c+"px"})})}),e.watch(()=>t.visible,a=>{a?(o.maskStyle.zIndex=x(),o.modalStyle.zIndex=x(),s.value.push("zoom-in"),l.value=a,e.nextTick(()=>{const i=m.value.offsetWidth/2,c=m.value.offsetHeight/2,C=document.documentElement.clientWidth/2,N=document.documentElement.clientHeight/2;o.initPos.left=C-i+"px",o.initPos.top=N-c+"px",t.isFullscreen||(r=p.keyMove(v.value,($,P)=>{o.initPos.left=$+"px",o.initPos.top=P+"px"}))}),setTimeout(()=>{s.value=s.value.filter(i=>i!=="zoom-in")},140)):(s.value.push("zoom-out"),r(),setTimeout(()=>{s.value=s.value.filter(i=>i!=="zoom-out"),l.value=a},130))}),()=>{const a=y.getSlot({ctx:d}),i=y.getSlot({props:t,ctx:d},"title");return u.value&&e.createVNode(e.Teleport,{to:k},{default:()=>[e.createVNode("div",{class:t.class,style:{...t.style,display:l.value?"block":"none"}},[e.createVNode("div",{class:`${n.prefix}-modal-mask`,style:o.maskStyle,onClick:()=>{t.onClose?t.onClose():d.emit("onClose")}},null),e.createVNode("div",{class:s.value,style:{...o.modalStyle,...o.initPos,...g.value},ref:m},[e.createVNode("div",{class:`${n.prefix}-modal-header`,ref:v},[i||""]),e.createVNode("div",{class:`${n.prefix}-modal-body`},[a]),e.createVNode("div",{class:`${n.prefix}-modal-func`},[t.showAdjust&&e.createVNode("div",{class:`${n.prefix}-modal-adjust`,onClick:c=>{c.stopPropagation(),t.isFullscreen?o.initPos=o.historyPos:(o.historyPos=o.initPos,o.initPos={left:"0",top:"0"}),t.onAdjust(!t.isFullscreen)}},[e.createVNode(h,{name:t.isFullscreen?"suoxiao":"fangda"},null)]),e.createVNode("div",{class:`${n.prefix}-modal-close`,onClick:c=>{c.stopPropagation(),t.onClose?t.onClose():d.emit("onClose")}},[e.createVNode(h,{name:"close"},null)])])])])]})}}});f.install=t=>(t.component(f.name,f),t);exports.Icon=h;exports.MdModal=f;
|
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { p as
|
|
3
|
-
import { g as
|
|
4
|
-
import { k as
|
|
5
|
-
const
|
|
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";
|
|
3
|
+
import { g as x } from "./vue-tsx.mjs";
|
|
4
|
+
import { k as C } from "./dom.mjs";
|
|
5
|
+
const W = /* @__PURE__ */ y({
|
|
6
6
|
props: {
|
|
7
7
|
name: {
|
|
8
8
|
type: String,
|
|
@@ -10,16 +10,16 @@ const T = /* @__PURE__ */ v({
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
setup(e) {
|
|
13
|
-
return () =>
|
|
14
|
-
class: `${
|
|
13
|
+
return () => R.iconfontType === "svg" ? l("svg", {
|
|
14
|
+
class: `${o}-icon`,
|
|
15
15
|
"aria-hidden": "true"
|
|
16
|
-
}, [
|
|
17
|
-
"xlink:href": `#${
|
|
18
|
-
}, null)]) :
|
|
19
|
-
class: `${
|
|
16
|
+
}, [l("use", {
|
|
17
|
+
"xlink:href": `#${o}-icon-${e.name}`
|
|
18
|
+
}, null)]) : l("i", {
|
|
19
|
+
class: `${o}-iconfont ${o}-icon-${e.name}`
|
|
20
20
|
}, null);
|
|
21
21
|
}
|
|
22
|
-
}),
|
|
22
|
+
}), $ = /* @__PURE__ */ y({
|
|
23
23
|
props: {
|
|
24
24
|
name: {
|
|
25
25
|
type: String,
|
|
@@ -27,17 +27,17 @@ const T = /* @__PURE__ */ v({
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
setup(e) {
|
|
30
|
-
const c =
|
|
30
|
+
const c = z("customIcon");
|
|
31
31
|
return () => {
|
|
32
|
-
const
|
|
33
|
-
return typeof
|
|
34
|
-
innerHTML:
|
|
35
|
-
}, null) :
|
|
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, {
|
|
36
36
|
name: e.name
|
|
37
37
|
}, null);
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
}),
|
|
40
|
+
}), B = {
|
|
41
41
|
title: {
|
|
42
42
|
type: String,
|
|
43
43
|
default: ""
|
|
@@ -69,16 +69,32 @@ const T = /* @__PURE__ */ v({
|
|
|
69
69
|
type: Function,
|
|
70
70
|
default: () => {
|
|
71
71
|
}
|
|
72
|
+
},
|
|
73
|
+
class: {
|
|
74
|
+
type: String
|
|
75
|
+
},
|
|
76
|
+
style: {
|
|
77
|
+
type: Object,
|
|
78
|
+
default: () => ({})
|
|
72
79
|
}
|
|
73
|
-
},
|
|
80
|
+
}, E = `.${o}-modal-container`, P = /* @__PURE__ */ (() => {
|
|
81
|
+
let e = 2e4;
|
|
82
|
+
return () => ++e;
|
|
83
|
+
})(), h = /* @__PURE__ */ y({
|
|
74
84
|
name: "MdModal",
|
|
75
|
-
props:
|
|
85
|
+
props: B,
|
|
76
86
|
emits: ["onClose"],
|
|
77
87
|
setup(e, c) {
|
|
78
|
-
const
|
|
79
|
-
let
|
|
88
|
+
const n = f(e.visible), i = f([`${o}-modal`]), r = f(), v = f(), d = M();
|
|
89
|
+
let m = () => {
|
|
80
90
|
};
|
|
81
|
-
const
|
|
91
|
+
const t = w({
|
|
92
|
+
maskStyle: {
|
|
93
|
+
zIndex: -1
|
|
94
|
+
},
|
|
95
|
+
modalStyle: {
|
|
96
|
+
zIndex: -1
|
|
97
|
+
},
|
|
82
98
|
initPos: {
|
|
83
99
|
left: "0px",
|
|
84
100
|
top: "0px"
|
|
@@ -87,85 +103,93 @@ const T = /* @__PURE__ */ v({
|
|
|
87
103
|
left: "0px",
|
|
88
104
|
top: "0px"
|
|
89
105
|
}
|
|
90
|
-
}),
|
|
106
|
+
}), S = T(() => e.isFullscreen ? {
|
|
91
107
|
width: "100%",
|
|
92
108
|
height: "100%"
|
|
93
109
|
} : {
|
|
94
110
|
width: e.width,
|
|
95
111
|
height: e.height
|
|
96
112
|
});
|
|
97
|
-
return
|
|
98
|
-
d =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
s ? d() : d = g(r.value, (n, u) => {
|
|
105
|
-
o.initPos.left = n + "px", o.initPos.top = u + "px";
|
|
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";
|
|
119
|
+
});
|
|
106
120
|
});
|
|
107
|
-
}), p(() => e.visible, (
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
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";
|
|
126
|
+
}));
|
|
111
127
|
}), setTimeout(() => {
|
|
112
|
-
|
|
113
|
-
}, 140)) : (
|
|
114
|
-
|
|
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;
|
|
115
131
|
}, 130));
|
|
116
132
|
}), () => {
|
|
117
|
-
const
|
|
133
|
+
const a = x({
|
|
118
134
|
ctx: c
|
|
119
|
-
}),
|
|
135
|
+
}), s = x({
|
|
120
136
|
props: e,
|
|
121
137
|
ctx: c
|
|
122
138
|
}, "title");
|
|
123
|
-
return
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
139
|
+
return d.value && l(A, {
|
|
140
|
+
to: E
|
|
141
|
+
}, {
|
|
142
|
+
default: () => [l("div", {
|
|
143
|
+
class: e.class,
|
|
144
|
+
style: {
|
|
145
|
+
...e.style,
|
|
146
|
+
display: n.value ? "block" : "none"
|
|
147
|
+
}
|
|
148
|
+
}, [l("div", {
|
|
149
|
+
class: `${o}-modal-mask`,
|
|
150
|
+
style: t.maskStyle,
|
|
151
|
+
onClick: () => {
|
|
152
|
+
e.onClose ? e.onClose() : c.emit("onClose");
|
|
153
|
+
}
|
|
154
|
+
}, null), l("div", {
|
|
155
|
+
class: i.value,
|
|
156
|
+
style: {
|
|
157
|
+
...t.modalStyle,
|
|
158
|
+
...t.initPos,
|
|
159
|
+
...S.value
|
|
160
|
+
},
|
|
161
|
+
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`,
|
|
171
|
+
onClick: (u) => {
|
|
172
|
+
u.stopPropagation(), e.isFullscreen ? t.initPos = t.historyPos : (t.historyPos = t.initPos, t.initPos = {
|
|
173
|
+
left: "0",
|
|
174
|
+
top: "0"
|
|
175
|
+
}), e.onAdjust(!e.isFullscreen);
|
|
176
|
+
}
|
|
177
|
+
}, [l($, {
|
|
178
|
+
name: e.isFullscreen ? "suoxiao" : "fangda"
|
|
179
|
+
}, null)]), l("div", {
|
|
180
|
+
class: `${o}-modal-close`,
|
|
181
|
+
onClick: (u) => {
|
|
182
|
+
u.stopPropagation(), e.onClose ? e.onClose() : c.emit("onClose");
|
|
183
|
+
}
|
|
184
|
+
}, [l($, {
|
|
185
|
+
name: "close"
|
|
186
|
+
}, null)])])])])]
|
|
187
|
+
});
|
|
164
188
|
};
|
|
165
189
|
}
|
|
166
190
|
});
|
|
167
191
|
h.install = (e) => (e.component(h.name, h), e);
|
|
168
192
|
export {
|
|
169
|
-
|
|
193
|
+
$ as I,
|
|
170
194
|
h as M
|
|
171
195
|
};
|