md-editor-v3 4.3.0-beta.0 → 4.3.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/README.md +28 -0
- package/lib/cjs/MdCatalog.cjs +1 -1
- package/lib/cjs/MdEditor.cjs +25 -25
- package/lib/cjs/MdModal.cjs +1 -0
- package/lib/cjs/MdPreview.cjs +1 -1
- package/lib/cjs/ModalToolbar.cjs +1 -1
- package/lib/cjs/chunks/config.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +7 -7
- package/lib/cjs/chunks/index3.cjs +2 -1
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdCatalog.mjs +1 -1
- package/lib/es/MdEditor.mjs +1046 -971
- package/lib/es/MdModal.mjs +141 -0
- package/lib/es/MdPreview.mjs +1 -1
- package/lib/es/ModalToolbar.mjs +97 -5
- package/lib/es/chunks/config.mjs +2 -1
- package/lib/es/chunks/index.mjs +369 -321
- package/lib/es/chunks/index3.mjs +61 -227
- package/lib/es/index.mjs +4 -2
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/Editor.d.ts +9 -0
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +78 -0
- package/lib/types/MdEditor/components/Modal/index.d.ts +173 -51
- package/lib/types/MdEditor/index.d.ts +20 -1
- package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +6 -0
- package/lib/types/MdEditor/layouts/Toolbar/props.d.ts +8 -0
- package/lib/types/MdEditor/props.d.ts +9 -0
- package/lib/types/MdEditor/type.d.ts +21 -1
- package/lib/types/index.d.ts +1 -0
- package/lib/umd/index.js +42 -42
- package/package.json +2 -2
- package/lib/cjs/chunks/index4.cjs +0 -2
- package/lib/es/chunks/index4.mjs +0 -69
|
@@ -0,0 +1,141 @@
|
|
|
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";
|
|
2
|
+
import { p as s } from "./chunks/config.mjs";
|
|
3
|
+
import { g } from "./chunks/vue-tsx.mjs";
|
|
4
|
+
import { k as y } from "./chunks/dom.mjs";
|
|
5
|
+
import "@vavt/util";
|
|
6
|
+
const b = {
|
|
7
|
+
title: {
|
|
8
|
+
type: String,
|
|
9
|
+
default: ""
|
|
10
|
+
},
|
|
11
|
+
visible: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !1
|
|
14
|
+
},
|
|
15
|
+
width: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: "auto"
|
|
18
|
+
},
|
|
19
|
+
height: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "auto"
|
|
22
|
+
},
|
|
23
|
+
onClose: {
|
|
24
|
+
type: Function,
|
|
25
|
+
default: () => {
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
showAdjust: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
isFullscreen: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !1
|
|
35
|
+
},
|
|
36
|
+
onAdjust: {
|
|
37
|
+
type: Function,
|
|
38
|
+
default: () => {
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}, m = /* @__PURE__ */ C({
|
|
42
|
+
name: "MdModal",
|
|
43
|
+
props: b,
|
|
44
|
+
setup(e, h) {
|
|
45
|
+
const c = d(e.visible), n = d([`${s}-modal`]), f = d(), r = d();
|
|
46
|
+
let u = () => {
|
|
47
|
+
};
|
|
48
|
+
const t = k({
|
|
49
|
+
initPos: {
|
|
50
|
+
left: "0px",
|
|
51
|
+
top: "0px"
|
|
52
|
+
},
|
|
53
|
+
historyPos: {
|
|
54
|
+
left: "0px",
|
|
55
|
+
top: "0px"
|
|
56
|
+
}
|
|
57
|
+
}), P = $(() => e.isFullscreen ? {
|
|
58
|
+
width: "100%",
|
|
59
|
+
height: "100%"
|
|
60
|
+
} : {
|
|
61
|
+
width: e.width,
|
|
62
|
+
height: e.height
|
|
63
|
+
});
|
|
64
|
+
return F(() => {
|
|
65
|
+
u = y(r.value, (i, l) => {
|
|
66
|
+
t.initPos.left = i + "px", t.initPos.top = l + "px";
|
|
67
|
+
});
|
|
68
|
+
}), w(() => {
|
|
69
|
+
u();
|
|
70
|
+
}), v(() => e.isFullscreen, (i) => {
|
|
71
|
+
i ? u() : u = y(r.value, (l, a) => {
|
|
72
|
+
t.initPos.left = l + "px", t.initPos.top = a + "px";
|
|
73
|
+
});
|
|
74
|
+
}), 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";
|
|
78
|
+
}), setTimeout(() => {
|
|
79
|
+
n.value = n.value.filter((l) => l !== "zoom-in");
|
|
80
|
+
}, 140)) : (n.value.push("zoom-out"), setTimeout(() => {
|
|
81
|
+
n.value = n.value.filter((l) => l !== "zoom-out"), c.value = i;
|
|
82
|
+
}, 130));
|
|
83
|
+
}), () => {
|
|
84
|
+
const i = g({
|
|
85
|
+
ctx: h
|
|
86
|
+
}), l = g({
|
|
87
|
+
props: e,
|
|
88
|
+
ctx: h
|
|
89
|
+
}, "title");
|
|
90
|
+
return o("div", {
|
|
91
|
+
style: {
|
|
92
|
+
display: c.value ? "block" : "none"
|
|
93
|
+
}
|
|
94
|
+
}, [o("div", {
|
|
95
|
+
class: `${s}-modal-mask`,
|
|
96
|
+
onClick: e.onClose
|
|
97
|
+
}, null), o("div", {
|
|
98
|
+
class: n.value,
|
|
99
|
+
style: {
|
|
100
|
+
...t.initPos,
|
|
101
|
+
...P.value
|
|
102
|
+
},
|
|
103
|
+
ref: f
|
|
104
|
+
}, [o("div", {
|
|
105
|
+
class: `${s}-modal-header`,
|
|
106
|
+
ref: r
|
|
107
|
+
}, [l || ""]), o("div", {
|
|
108
|
+
class: `${s}-modal-body`
|
|
109
|
+
}, [i]), o("div", {
|
|
110
|
+
class: `${s}-modal-func`
|
|
111
|
+
}, [e.showAdjust && o("div", {
|
|
112
|
+
class: `${s}-modal-adjust`,
|
|
113
|
+
onClick: (a) => {
|
|
114
|
+
a.stopPropagation(), e.isFullscreen ? t.initPos = t.historyPos : (t.historyPos = t.initPos, t.initPos = {
|
|
115
|
+
left: "0",
|
|
116
|
+
top: "0"
|
|
117
|
+
}), e.onAdjust(!e.isFullscreen);
|
|
118
|
+
}
|
|
119
|
+
}, [o("svg", {
|
|
120
|
+
class: `${s}-icon`,
|
|
121
|
+
"aria-hidden": "true"
|
|
122
|
+
}, [o("use", {
|
|
123
|
+
"xlink:href": `#md-editor-icon-${e.isFullscreen ? "suoxiao" : "fangda"}`
|
|
124
|
+
}, null)])]), o("div", {
|
|
125
|
+
class: `${s}-modal-close`,
|
|
126
|
+
onClick: (a) => {
|
|
127
|
+
a.stopPropagation(), e.onClose && e.onClose();
|
|
128
|
+
}
|
|
129
|
+
}, [o("svg", {
|
|
130
|
+
class: `${s}-icon`,
|
|
131
|
+
"aria-hidden": "true"
|
|
132
|
+
}, [o("use", {
|
|
133
|
+
"xlink:href": "#md-editor-icon-close"
|
|
134
|
+
}, null)])])])])]);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
m.install = (e) => (e.component(m.name, m), e);
|
|
139
|
+
export {
|
|
140
|
+
m as default
|
|
141
|
+
};
|
package/lib/es/MdPreview.mjs
CHANGED
package/lib/es/ModalToolbar.mjs
CHANGED
|
@@ -1,9 +1,101 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "
|
|
3
|
-
import "./chunks/
|
|
4
|
-
import "./
|
|
1
|
+
import { defineComponent as s, createVNode as o, Fragment as d, isVNode as c } from "vue";
|
|
2
|
+
import { p as r } from "./chunks/config.mjs";
|
|
3
|
+
import { g as u } from "./chunks/vue-tsx.mjs";
|
|
4
|
+
import f from "./MdModal.mjs";
|
|
5
5
|
import "./chunks/dom.mjs";
|
|
6
6
|
import "@vavt/util";
|
|
7
|
+
function m(t) {
|
|
8
|
+
return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !c(t);
|
|
9
|
+
}
|
|
10
|
+
const g = {
|
|
11
|
+
title: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ""
|
|
14
|
+
},
|
|
15
|
+
modalTitle: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: ""
|
|
18
|
+
},
|
|
19
|
+
visible: {
|
|
20
|
+
type: Boolean
|
|
21
|
+
},
|
|
22
|
+
width: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: "auto"
|
|
25
|
+
},
|
|
26
|
+
height: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: "auto"
|
|
29
|
+
},
|
|
30
|
+
// 展示在工具栏的内容,通常是个图标
|
|
31
|
+
trigger: {
|
|
32
|
+
type: [String, Object]
|
|
33
|
+
},
|
|
34
|
+
onClick: {
|
|
35
|
+
type: Function
|
|
36
|
+
},
|
|
37
|
+
onClose: {
|
|
38
|
+
type: Function
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* 显示全屏按钮
|
|
42
|
+
*/
|
|
43
|
+
showAdjust: {
|
|
44
|
+
type: Boolean,
|
|
45
|
+
default: !1
|
|
46
|
+
},
|
|
47
|
+
isFullscreen: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: !1
|
|
50
|
+
},
|
|
51
|
+
onAdjust: {
|
|
52
|
+
type: Function
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
|
|
56
|
+
*/
|
|
57
|
+
insert: {
|
|
58
|
+
type: Function
|
|
59
|
+
}
|
|
60
|
+
}, i = /* @__PURE__ */ s({
|
|
61
|
+
name: "ModalToolbar",
|
|
62
|
+
props: g,
|
|
63
|
+
emits: ["onClick", "onClose", "onAdjust"],
|
|
64
|
+
setup(t, e) {
|
|
65
|
+
return () => {
|
|
66
|
+
const a = u({
|
|
67
|
+
props: t,
|
|
68
|
+
ctx: e
|
|
69
|
+
}, "trigger"), n = u({
|
|
70
|
+
props: t,
|
|
71
|
+
ctx: e
|
|
72
|
+
}, "default");
|
|
73
|
+
return o(d, null, [o("div", {
|
|
74
|
+
class: `${r}-toolbar-item`,
|
|
75
|
+
title: t.title,
|
|
76
|
+
onClick: () => {
|
|
77
|
+
t.onClick instanceof Function ? t.onClick() : e.emit("onClick");
|
|
78
|
+
}
|
|
79
|
+
}, [a]), o(f, {
|
|
80
|
+
width: t.width,
|
|
81
|
+
height: t.height,
|
|
82
|
+
title: t.modalTitle,
|
|
83
|
+
visible: t.visible,
|
|
84
|
+
onClose: () => {
|
|
85
|
+
t.onClose instanceof Function ? t.onClose() : e.emit("onClose");
|
|
86
|
+
},
|
|
87
|
+
showAdjust: t.showAdjust,
|
|
88
|
+
isFullscreen: t.isFullscreen,
|
|
89
|
+
onAdjust: (l) => {
|
|
90
|
+
t.onAdjust instanceof Function ? t.onAdjust(l) : e.emit("onAdjust", l);
|
|
91
|
+
}
|
|
92
|
+
}, m(n) ? n : {
|
|
93
|
+
default: () => [n]
|
|
94
|
+
})]);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
i.install = (t) => (t.component(i.name, i), t);
|
|
7
99
|
export {
|
|
8
|
-
|
|
100
|
+
i as default
|
|
9
101
|
};
|
package/lib/es/chunks/config.mjs
CHANGED
|
@@ -244,7 +244,8 @@ const a = "md-editor", o = "md-editor-v3", r = "https://at.alicdn.com/t/c/font_2
|
|
|
244
244
|
editorConfig: {},
|
|
245
245
|
codeMirrorExtensions: (i, t) => t,
|
|
246
246
|
markdownItConfig: () => {
|
|
247
|
-
}
|
|
247
|
+
},
|
|
248
|
+
markdownItPlugins: (i) => i
|
|
248
249
|
}, j = (i) => {
|
|
249
250
|
if (i)
|
|
250
251
|
for (const t in i) {
|