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