md-editor-v3 4.12.0-beta.1 → 4.12.0
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 +12 -0
- package/lib/cjs/MdEditor.cjs +8 -8
- package/lib/cjs/chunks/index.cjs +6 -6
- package/lib/cjs/chunks/index3.cjs +1 -1
- package/lib/cjs/chunks/index4.cjs +2 -2
- package/lib/es/MdEditor.mjs +569 -541
- package/lib/es/chunks/index.mjs +231 -223
- package/lib/es/chunks/index3.mjs +66 -64
- package/lib/es/chunks/index4.mjs +19 -18
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/index.d.ts +3 -3
- package/lib/types/MdEditor/layouts/Content/index.d.ts +9 -0
- package/lib/types/MdEditor/layouts/Content/props.d.ts +4 -0
- package/lib/types/MdEditor/static/event-name.d.ts +1 -0
- package/lib/types/MdEditor/type.d.ts +10 -1
- package/lib/umd/index.js +38 -38
- package/package.json +1 -1
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as y, createVNode as
|
|
2
|
-
import { p as
|
|
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
3
|
import { g as x } from "./vue-tsx.mjs";
|
|
4
4
|
import { k as C } from "./dom.mjs";
|
|
5
5
|
const W = /* @__PURE__ */ y({
|
|
@@ -10,16 +10,16 @@ const W = /* @__PURE__ */ y({
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
setup(e) {
|
|
13
|
-
return () =>
|
|
14
|
-
class: `${
|
|
13
|
+
return () => A.iconfontType === "svg" ? t("svg", {
|
|
14
|
+
class: `${l}-icon`,
|
|
15
15
|
"aria-hidden": "true"
|
|
16
|
-
}, [
|
|
17
|
-
"xlink:href": `#${
|
|
18
|
-
}, null)]) :
|
|
19
|
-
class: `${
|
|
16
|
+
}, [t("use", {
|
|
17
|
+
"xlink:href": `#${l}-icon-${e.name}`
|
|
18
|
+
}, null)]) : t("i", {
|
|
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,12 +27,12 @@ const W = /* @__PURE__ */ y({
|
|
|
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) :
|
|
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
|
};
|
|
@@ -77,18 +77,18 @@ const W = /* @__PURE__ */ y({
|
|
|
77
77
|
type: Object,
|
|
78
78
|
default: () => ({})
|
|
79
79
|
}
|
|
80
|
-
}, E =
|
|
80
|
+
}, E = `${l}-modal-container`, $ = /* @__PURE__ */ (() => {
|
|
81
81
|
let e = 2e4;
|
|
82
82
|
return () => ++e;
|
|
83
|
-
})(),
|
|
83
|
+
})(), v = /* @__PURE__ */ y({
|
|
84
84
|
name: "MdModal",
|
|
85
85
|
props: B,
|
|
86
86
|
emits: ["onClose"],
|
|
87
87
|
setup(e, c) {
|
|
88
|
-
const
|
|
89
|
-
let
|
|
88
|
+
const s = S("theme"), f = m(e.visible), i = m([`${l}-modal`]), r = m(), h = m(), k = M();
|
|
89
|
+
let d = () => {
|
|
90
90
|
};
|
|
91
|
-
const
|
|
91
|
+
const o = T({
|
|
92
92
|
maskStyle: {
|
|
93
93
|
zIndex: -1
|
|
94
94
|
},
|
|
@@ -103,93 +103,95 @@ const W = /* @__PURE__ */ y({
|
|
|
103
103
|
left: "0px",
|
|
104
104
|
top: "0px"
|
|
105
105
|
}
|
|
106
|
-
}),
|
|
106
|
+
}), I = H(() => e.isFullscreen ? {
|
|
107
107
|
width: "100%",
|
|
108
108
|
height: "100%"
|
|
109
109
|
} : {
|
|
110
110
|
width: e.width,
|
|
111
111
|
height: e.height
|
|
112
112
|
});
|
|
113
|
-
return
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
m = C(v.value, (s, u) => {
|
|
118
|
-
t.initPos.left = s + "px", t.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";
|
|
119
117
|
});
|
|
120
118
|
});
|
|
121
|
-
}),
|
|
122
|
-
a ? (
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
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";
|
|
126
124
|
}));
|
|
127
125
|
}), setTimeout(() => {
|
|
128
|
-
i.value = i.value.filter((
|
|
129
|
-
}, 140)) : (i.value.push("zoom-out"),
|
|
130
|
-
i.value = i.value.filter((
|
|
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;
|
|
131
129
|
}, 130));
|
|
132
130
|
}), () => {
|
|
133
131
|
const a = x({
|
|
134
132
|
ctx: c
|
|
135
|
-
}),
|
|
133
|
+
}), n = x({
|
|
136
134
|
props: e,
|
|
137
135
|
ctx: c
|
|
138
136
|
}, "title");
|
|
139
|
-
return
|
|
140
|
-
to:
|
|
137
|
+
return t(R, {
|
|
138
|
+
to: document.body
|
|
141
139
|
}, {
|
|
142
|
-
default: () => [
|
|
140
|
+
default: () => [t("div", {
|
|
141
|
+
ref: k,
|
|
142
|
+
class: E,
|
|
143
|
+
"data-theme": s.value
|
|
144
|
+
}, [t("div", {
|
|
143
145
|
class: e.class,
|
|
144
146
|
style: {
|
|
145
147
|
...e.style,
|
|
146
|
-
display:
|
|
148
|
+
display: f.value ? "block" : "none"
|
|
147
149
|
}
|
|
148
|
-
}, [
|
|
149
|
-
class: `${
|
|
150
|
-
style:
|
|
150
|
+
}, [t("div", {
|
|
151
|
+
class: `${l}-modal-mask`,
|
|
152
|
+
style: o.maskStyle,
|
|
151
153
|
onClick: () => {
|
|
152
154
|
e.onClose ? e.onClose() : c.emit("onClose");
|
|
153
155
|
}
|
|
154
|
-
}, null),
|
|
156
|
+
}, null), t("div", {
|
|
155
157
|
class: i.value,
|
|
156
158
|
style: {
|
|
157
|
-
...
|
|
158
|
-
...
|
|
159
|
-
...
|
|
159
|
+
...o.modalStyle,
|
|
160
|
+
...o.initPos,
|
|
161
|
+
...I.value
|
|
160
162
|
},
|
|
161
163
|
ref: r
|
|
162
|
-
}, [
|
|
163
|
-
class: `${
|
|
164
|
-
ref:
|
|
165
|
-
}, [
|
|
166
|
-
class: `${
|
|
167
|
-
}, [a]),
|
|
168
|
-
class: `${
|
|
169
|
-
}, [e.showAdjust &&
|
|
170
|
-
class: `${
|
|
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`,
|
|
171
173
|
onClick: (u) => {
|
|
172
|
-
u.stopPropagation(), e.isFullscreen ?
|
|
174
|
+
u.stopPropagation(), e.isFullscreen ? o.initPos = o.historyPos : (o.historyPos = o.initPos, o.initPos = {
|
|
173
175
|
left: "0",
|
|
174
176
|
top: "0"
|
|
175
177
|
}), e.onAdjust(!e.isFullscreen);
|
|
176
178
|
}
|
|
177
|
-
}, [
|
|
179
|
+
}, [t(P, {
|
|
178
180
|
name: e.isFullscreen ? "suoxiao" : "fangda"
|
|
179
|
-
}, null)]),
|
|
180
|
-
class: `${
|
|
181
|
+
}, null)]), t("div", {
|
|
182
|
+
class: `${l}-modal-close`,
|
|
181
183
|
onClick: (u) => {
|
|
182
184
|
u.stopPropagation(), e.onClose ? e.onClose() : c.emit("onClose");
|
|
183
185
|
}
|
|
184
|
-
}, [
|
|
186
|
+
}, [t(P, {
|
|
185
187
|
name: "close"
|
|
186
|
-
}, null)])])])])]
|
|
188
|
+
}, null)])])])])])]
|
|
187
189
|
});
|
|
188
190
|
};
|
|
189
191
|
}
|
|
190
192
|
});
|
|
191
|
-
|
|
193
|
+
v.install = (e) => (e.component(v.name, v), e);
|
|
192
194
|
export {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
+
P as I,
|
|
196
|
+
v as M
|
|
195
197
|
};
|
package/lib/es/chunks/index4.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var i = Object.defineProperty;
|
|
2
2
|
var p = (o, s, t) => s in o ? i(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
3
|
var r = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
|
-
class
|
|
4
|
+
class E {
|
|
5
5
|
constructor() {
|
|
6
6
|
// 事件池
|
|
7
7
|
r(this, "pools", {});
|
|
@@ -32,7 +32,7 @@ class h {
|
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
const C = new
|
|
35
|
+
const C = new E(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscreen", A = "pageFullscreenChanged", _ = "fullscreenChanged", L = "previewChanged", d = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "buildFinished", G = "errorCatcher", H = "replace", I = "uploadImage", b = "openModals", S = "ctrlZ", T = "ctrlShiftZ", m = "catalogChanged", D = "pushCatalog", F = "rerender", O = "eventListener", w = (o, s = "image.png") => {
|
|
36
36
|
const t = o.split(","), n = t[0].match(/:(.*?);/);
|
|
37
37
|
if (n) {
|
|
38
38
|
const l = n[1], e = atob(t[1]);
|
|
@@ -43,7 +43,7 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
|
|
|
43
43
|
return new File([c], s, { type: l });
|
|
44
44
|
}
|
|
45
45
|
return null;
|
|
46
|
-
},
|
|
46
|
+
}, P = (o) => {
|
|
47
47
|
if (!o)
|
|
48
48
|
return o;
|
|
49
49
|
const s = o.split(`
|
|
@@ -51,7 +51,7 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
|
|
|
51
51
|
return s.forEach(() => {
|
|
52
52
|
t.push("<span></span>");
|
|
53
53
|
}), t.push("</span>"), `<span class="code-block">${o}</span>${t.join("")}`;
|
|
54
|
-
},
|
|
54
|
+
}, U = (o, s) => {
|
|
55
55
|
if (!o || !s)
|
|
56
56
|
return 0;
|
|
57
57
|
const t = o == null ? void 0 : o.getBoundingClientRect();
|
|
@@ -59,32 +59,33 @@ const C = new h(), u = "onSave", g = "changeCatalogVisible", R = "changeFullscre
|
|
|
59
59
|
return t.top - s.clientTop;
|
|
60
60
|
const n = s == null ? void 0 : s.getBoundingClientRect();
|
|
61
61
|
return t.top - n.top;
|
|
62
|
-
},
|
|
62
|
+
}, V = /* @__PURE__ */ (() => {
|
|
63
63
|
let o = 0;
|
|
64
64
|
return (s) => s + ++o;
|
|
65
65
|
})();
|
|
66
66
|
export {
|
|
67
67
|
f as B,
|
|
68
|
-
|
|
68
|
+
m as C,
|
|
69
69
|
G as E,
|
|
70
70
|
_ as F,
|
|
71
|
-
|
|
71
|
+
d as H,
|
|
72
72
|
u as O,
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
D as P,
|
|
74
|
+
F as R,
|
|
75
|
+
I as U,
|
|
76
|
+
P as a,
|
|
77
77
|
C as b,
|
|
78
78
|
g as c,
|
|
79
79
|
A as d,
|
|
80
|
-
|
|
80
|
+
L as e,
|
|
81
81
|
N as f,
|
|
82
|
-
|
|
82
|
+
U as g,
|
|
83
83
|
H as h,
|
|
84
84
|
R as i,
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
85
|
+
O as j,
|
|
86
|
+
V as k,
|
|
87
|
+
w as l,
|
|
88
|
+
b as m,
|
|
89
|
+
T as n,
|
|
90
|
+
S as o
|
|
90
91
|
};
|