md-editor-v3 4.6.1 → 4.6.2-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/MdCatalog.cjs +1 -1
- package/lib/cjs/MdEditor.cjs +3 -3
- package/lib/cjs/MdModal.cjs +1 -1
- package/lib/cjs/MdPreview.cjs +1 -1
- package/lib/cjs/ModalToolbar.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +1 -8
- package/lib/cjs/chunks/index3.cjs +2 -1
- package/lib/cjs/chunks/index4.cjs +8 -2
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/DropdownToolbar.mjs +2 -2
- package/lib/es/MdCatalog.mjs +9 -9
- package/lib/es/MdEditor.mjs +137 -135
- package/lib/es/MdModal.mjs +1 -1
- package/lib/es/MdPreview.mjs +2 -2
- package/lib/es/ModalToolbar.mjs +1 -1
- package/lib/es/chunks/config.mjs +11 -11
- package/lib/es/chunks/index.mjs +138 -1231
- package/lib/es/chunks/index2.mjs +2 -2
- package/lib/es/chunks/index3.mjs +79 -163
- package/lib/es/chunks/index4.mjs +1255 -77
- package/lib/es/config.mjs +1 -1
- package/lib/es/index.mjs +18 -17
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +1 -1
- package/lib/types/DropdownToolbar/index.d.ts +59 -33
- package/lib/types/MdCatalog/CatalogLink.d.ts +1 -1
- package/lib/types/MdCatalog/MdCatalog.d.ts +1 -1
- package/lib/types/MdCatalog/index.d.ts +59 -44
- package/lib/types/MdEditor/Editor.d.ts +1 -1
- package/lib/types/MdEditor/components/Checkbox/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Divider/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Dropdown/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Icon/Icon.d.ts +1 -1
- package/lib/types/MdEditor/components/Icon/index.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/Modal.d.ts +1 -1
- package/lib/types/MdEditor/components/Modal/index.d.ts +60 -48
- package/lib/types/MdEditor/index.d.ts +101 -225
- package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Content/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/MarkdownTotal.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/ScrollAuto.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Footer/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/Clip.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/Link.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Modals/index.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/TableShape.d.ts +1 -1
- package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +1 -1
- package/lib/types/MdEditor/type.d.ts +3 -1
- package/lib/types/MdEditor/utils/vue-tsx.d.ts +1 -1
- package/lib/types/MdPreview/MdPreview.d.ts +1 -1
- package/lib/types/MdPreview/index.d.ts +72 -114
- package/lib/types/ModalToolbar/ModalToolbar.d.ts +1 -1
- package/lib/types/ModalToolbar/index.d.ts +64 -58
- package/lib/types/NormalToolbar/NormalToolbar.d.ts +1 -1
- package/lib/types/NormalToolbar/index.d.ts +56 -24
- package/lib/umd/index.js +32 -32
- package/package.json +9 -8
package/lib/es/chunks/index2.mjs
CHANGED
package/lib/es/chunks/index3.mjs
CHANGED
|
@@ -1,171 +1,87 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type: String,
|
|
9
|
-
default: ""
|
|
10
|
-
}
|
|
11
|
-
},
|
|
12
|
-
setup(e) {
|
|
13
|
-
return () => H.iconfontType === "svg" ? t("svg", {
|
|
14
|
-
class: `${l}-icon`,
|
|
15
|
-
"aria-hidden": "true"
|
|
16
|
-
}, [t("use", {
|
|
17
|
-
"xlink:href": `#${l}-icon-${e.name}`
|
|
18
|
-
}, null)]) : t("i", {
|
|
19
|
-
class: `${l}-iconfont ${l}-icon-${e.name}`
|
|
20
|
-
}, null);
|
|
1
|
+
var r = Object.defineProperty;
|
|
2
|
+
var p = (o, s, t) => s in o ? r(o, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[s] = t;
|
|
3
|
+
var i = (o, s, t) => (p(o, typeof s != "symbol" ? s + "" : s, t), t);
|
|
4
|
+
class h {
|
|
5
|
+
constructor() {
|
|
6
|
+
// 事件池
|
|
7
|
+
i(this, "pools", {});
|
|
21
8
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
default: ""
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
setup(e) {
|
|
30
|
-
const c = k("customIcon");
|
|
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, {
|
|
36
|
-
name: e.name
|
|
37
|
-
}, null);
|
|
38
|
-
};
|
|
9
|
+
// 移除事件监听
|
|
10
|
+
remove(s, t, n) {
|
|
11
|
+
const a = this.pools[s] && this.pools[s][t];
|
|
12
|
+
a && (this.pools[s][t] = a.filter((e) => e !== n));
|
|
39
13
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
default: ""
|
|
44
|
-
},
|
|
45
|
-
visible: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
default: !1
|
|
48
|
-
},
|
|
49
|
-
width: {
|
|
50
|
-
type: String,
|
|
51
|
-
default: "auto"
|
|
52
|
-
},
|
|
53
|
-
height: {
|
|
54
|
-
type: String,
|
|
55
|
-
default: "auto"
|
|
56
|
-
},
|
|
57
|
-
onClose: {
|
|
58
|
-
type: Function
|
|
59
|
-
},
|
|
60
|
-
showAdjust: {
|
|
61
|
-
type: Boolean,
|
|
62
|
-
default: !1
|
|
63
|
-
},
|
|
64
|
-
isFullscreen: {
|
|
65
|
-
type: Boolean,
|
|
66
|
-
default: !1
|
|
67
|
-
},
|
|
68
|
-
onAdjust: {
|
|
69
|
-
type: Function,
|
|
70
|
-
default: () => {
|
|
71
|
-
}
|
|
14
|
+
// 清空全部事件,由于单一实例,多次注册会被共享内容
|
|
15
|
+
clear(s) {
|
|
16
|
+
this.pools[s] = {};
|
|
72
17
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
historyPos: {
|
|
87
|
-
left: "0px",
|
|
88
|
-
top: "0px"
|
|
18
|
+
// 注册事件监听
|
|
19
|
+
on(s, t) {
|
|
20
|
+
return this.pools[s] || (this.pools[s] = {}), this.pools[s][t.name] || (this.pools[s][t.name] = []), this.pools[s][t.name].push(t.callback), this.pools[s][t.name].includes(t.callback);
|
|
21
|
+
}
|
|
22
|
+
// 触发事件
|
|
23
|
+
emit(s, t, ...n) {
|
|
24
|
+
this.pools[s] || (this.pools[s] = {});
|
|
25
|
+
const a = this.pools[s][t];
|
|
26
|
+
a && a.forEach((e) => {
|
|
27
|
+
try {
|
|
28
|
+
e(...n);
|
|
29
|
+
} catch (c) {
|
|
30
|
+
console.error(`${t} monitor event exception!`, c);
|
|
89
31
|
}
|
|
90
|
-
}), P = j(() => e.isFullscreen ? {
|
|
91
|
-
width: "100%",
|
|
92
|
-
height: "100%"
|
|
93
|
-
} : {
|
|
94
|
-
width: e.width,
|
|
95
|
-
height: e.height
|
|
96
32
|
});
|
|
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";
|
|
106
|
-
});
|
|
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";
|
|
111
|
-
}), 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;
|
|
115
|
-
}, 130));
|
|
116
|
-
}), () => {
|
|
117
|
-
const s = y({
|
|
118
|
-
ctx: c
|
|
119
|
-
}), n = y({
|
|
120
|
-
props: e,
|
|
121
|
-
ctx: c
|
|
122
|
-
}, "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)])])])]);
|
|
164
|
-
};
|
|
165
33
|
}
|
|
166
|
-
}
|
|
167
|
-
|
|
34
|
+
}
|
|
35
|
+
const C = new h(), E = "onSave", g = "changeCatalogVisible", A = "changeFullscreen", R = "pageFullscreenChanged", _ = "fullscreenChanged", d = "previewChanged", L = "htmlPreviewChanged", N = "catalogVisibleChanged", f = "textareaFocus", S = "buildFinished", b = "errorCatcher", G = "replace", H = "uploadImage", T = "openModals", F = "ctrlZ", m = "ctrlShiftZ", I = "catalogChanged", D = "pushCatalog", O = (o, s = "image.png") => {
|
|
36
|
+
const t = o.split(","), n = t[0].match(/:(.*?);/);
|
|
37
|
+
if (n) {
|
|
38
|
+
const l = n[1], a = atob(t[1]);
|
|
39
|
+
let e = a.length;
|
|
40
|
+
const c = new Uint8Array(e);
|
|
41
|
+
for (; e--; )
|
|
42
|
+
c[e] = a.charCodeAt(e);
|
|
43
|
+
return new File([c], s, { type: l });
|
|
44
|
+
}
|
|
45
|
+
return null;
|
|
46
|
+
}, w = (o) => {
|
|
47
|
+
if (!o)
|
|
48
|
+
return o;
|
|
49
|
+
const s = o.split(`
|
|
50
|
+
`), t = ['<span rn-wrapper aria-hidden="true">'];
|
|
51
|
+
return s.forEach(() => {
|
|
52
|
+
t.push("<span></span>");
|
|
53
|
+
}), t.push("</span>"), `<span class="code-block">${o}</span>${t.join("")}`;
|
|
54
|
+
}, P = (o, s) => {
|
|
55
|
+
if (!o || !s)
|
|
56
|
+
return 0;
|
|
57
|
+
const t = o == null ? void 0 : o.getBoundingClientRect();
|
|
58
|
+
if (s === document.documentElement)
|
|
59
|
+
return t.top - s.clientTop;
|
|
60
|
+
const n = s == null ? void 0 : s.getBoundingClientRect();
|
|
61
|
+
return t.top - n.top;
|
|
62
|
+
}, U = () => `${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`;
|
|
168
63
|
export {
|
|
169
|
-
|
|
170
|
-
|
|
64
|
+
S as B,
|
|
65
|
+
I as C,
|
|
66
|
+
b as E,
|
|
67
|
+
_ as F,
|
|
68
|
+
L as H,
|
|
69
|
+
E as O,
|
|
70
|
+
D as P,
|
|
71
|
+
G as R,
|
|
72
|
+
f as T,
|
|
73
|
+
H as U,
|
|
74
|
+
w as a,
|
|
75
|
+
C as b,
|
|
76
|
+
g as c,
|
|
77
|
+
R as d,
|
|
78
|
+
d as e,
|
|
79
|
+
N as f,
|
|
80
|
+
P as g,
|
|
81
|
+
A as h,
|
|
82
|
+
O as i,
|
|
83
|
+
T as j,
|
|
84
|
+
m as k,
|
|
85
|
+
F as l,
|
|
86
|
+
U as u
|
|
171
87
|
};
|