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.
@@ -1 +1 @@
1
- "use strict";const e=require("vue"),n=require("./config.cjs"),v=require("./vue-tsx.cjs"),p=require("./dom.cjs"),C=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 u=e.inject("customIcon");return()=>{const l=u.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(C,{name:t.name},null)}}}),P={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:()=>{}}},r=e.defineComponent({name:"MdModal",props:P,emits:["onClose"],setup(t,u){const l=e.ref(t.visible),a=e.ref([`${n.prefix}-modal`]),f=e.ref(),m=e.ref();let d=()=>{};const o=e.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),y=e.computed(()=>t.isFullscreen?{width:"100%",height:"100%"}:{width:t.width,height:t.height});return e.onMounted(()=>{d=p.keyMove(m.value,(s,i)=>{o.initPos.left=s+"px",o.initPos.top=i+"px"})}),e.onBeforeUnmount(()=>{d()}),e.watch(()=>t.isFullscreen,s=>{s?d():d=p.keyMove(m.value,(i,c)=>{o.initPos.left=i+"px",o.initPos.top=c+"px"})}),e.watch(()=>t.visible,s=>{s?(a.value.push("zoom-in"),l.value=s,e.nextTick(()=>{const i=f.value.offsetWidth/2,c=f.value.offsetHeight/2,g=document.documentElement.clientWidth/2,x=document.documentElement.clientHeight/2;o.initPos.left=g-i+"px",o.initPos.top=x-c+"px"}),setTimeout(()=>{a.value=a.value.filter(i=>i!=="zoom-in")},140)):(a.value.push("zoom-out"),setTimeout(()=>{a.value=a.value.filter(i=>i!=="zoom-out"),l.value=s},130))}),()=>{const s=v.getSlot({ctx:u}),i=v.getSlot({props:t,ctx:u},"title");return e.createVNode("div",{style:{display:l.value?"block":"none"}},[e.createVNode("div",{class:`${n.prefix}-modal-mask`,onClick:()=>{t.onClose?t.onClose():u.emit("onClose")}},null),e.createVNode("div",{class:a.value,style:{...o.initPos,...y.value},ref:f},[e.createVNode("div",{class:`${n.prefix}-modal-header`,ref:m},[i||""]),e.createVNode("div",{class:`${n.prefix}-modal-body`},[s]),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():u.emit("onClose")}},[e.createVNode(h,{name:"close"},null)])])])])}}});r.install=t=>(t.component(r.name,r),t);exports.Icon=h;exports.MdModal=r;
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;
@@ -1,8 +1,8 @@
1
- import { defineComponent as v, createVNode as t, inject as k, h as M, ref as f, reactive as b, computed as j, onMounted as F, onBeforeUnmount as w, watch as p, nextTick as S } from "vue";
2
- import { p as l, e as H } from "./config.mjs";
3
- import { g as y } from "./vue-tsx.mjs";
4
- import { k as g } from "./dom.mjs";
5
- const T = /* @__PURE__ */ v({
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 () => H.iconfontType === "svg" ? t("svg", {
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
- }), C = /* @__PURE__ */ v({
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 = k("customIcon");
30
+ const c = S("customIcon");
31
31
  return () => {
32
- const i = c.value[e.name];
33
- return typeof i == "object" ? typeof i.component == "object" ? M(i.component, i.props) : t("span", {
34
- innerHTML: i.component
35
- }, null) : t(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
- }), z = {
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
- }, h = /* @__PURE__ */ v({
80
+ }, E = `${l}-modal-container`, $ = /* @__PURE__ */ (() => {
81
+ let e = 2e4;
82
+ return () => ++e;
83
+ })(), v = /* @__PURE__ */ y({
74
84
  name: "MdModal",
75
- props: z,
85
+ props: B,
76
86
  emits: ["onClose"],
77
87
  setup(e, c) {
78
- const i = f(e.visible), a = f([`${l}-modal`]), m = f(), r = f();
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 = b({
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
- }), P = j(() => e.isFullscreen ? {
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 F(() => {
98
- d = g(r.value, (s, n) => {
99
- o.initPos.left = s + "px", o.initPos.top = n + "px";
100
- });
101
- }), w(() => {
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
- }), p(() => e.visible, (s) => {
108
- s ? (a.value.push("zoom-in"), i.value = s, S(() => {
109
- const n = m.value.offsetWidth / 2, u = m.value.offsetHeight / 2, $ = document.documentElement.clientWidth / 2, x = document.documentElement.clientHeight / 2;
110
- o.initPos.left = $ - n + "px", o.initPos.top = x - u + "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";
124
+ }));
111
125
  }), setTimeout(() => {
112
- a.value = a.value.filter((n) => n !== "zoom-in");
113
- }, 140)) : (a.value.push("zoom-out"), setTimeout(() => {
114
- a.value = a.value.filter((n) => n !== "zoom-out"), i.value = s;
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 s = y({
131
+ const a = x({
118
132
  ctx: c
119
- }), n = y({
133
+ }), n = x({
120
134
  props: e,
121
135
  ctx: c
122
136
  }, "title");
123
- return t("div", {
124
- style: {
125
- display: i.value ? "block" : "none"
126
- }
127
- }, [t("div", {
128
- class: `${l}-modal-mask`,
129
- onClick: () => {
130
- e.onClose ? e.onClose() : c.emit("onClose");
131
- }
132
- }, null), t("div", {
133
- class: a.value,
134
- style: {
135
- ...o.initPos,
136
- ...P.value
137
- },
138
- ref: m
139
- }, [t("div", {
140
- class: `${l}-modal-header`,
141
- ref: r
142
- }, [n || ""]), t("div", {
143
- class: `${l}-modal-body`
144
- }, [s]), t("div", {
145
- class: `${l}-modal-func`
146
- }, [e.showAdjust && t("div", {
147
- class: `${l}-modal-adjust`,
148
- onClick: (u) => {
149
- u.stopPropagation(), e.isFullscreen ? o.initPos = o.historyPos : (o.historyPos = o.initPos, o.initPos = {
150
- left: "0",
151
- top: "0"
152
- }), e.onAdjust(!e.isFullscreen);
153
- }
154
- }, [t(C, {
155
- name: e.isFullscreen ? "suoxiao" : "fangda"
156
- }, null)]), t("div", {
157
- class: `${l}-modal-close`,
158
- onClick: (u) => {
159
- u.stopPropagation(), e.onClose ? e.onClose() : c.emit("onClose");
160
- }
161
- }, [t(C, {
162
- name: "close"
163
- }, null)])])])]);
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
- h.install = (e) => (e.component(h.name, h), e);
193
+ v.install = (e) => (e.component(v.name, v), e);
168
194
  export {
169
- C as I,
170
- h as M
195
+ P as I,
196
+ v as M
171
197
  };