md-editor-v3 6.2.1 → 6.3.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/MdEditor.cjs +1 -1
- package/lib/cjs/chunks/index.cjs +1 -1
- package/lib/cjs/chunks/index2.cjs +1 -1
- package/lib/cjs/chunks/index4.cjs +1 -1
- package/lib/es/MdEditor.mjs +457 -427
- package/lib/es/chunks/index.mjs +15 -15
- package/lib/es/chunks/index2.mjs +85 -85
- package/lib/es/chunks/index4.mjs +90 -90
- package/lib/preview.css +1 -1
- package/lib/style.css +1 -1
- package/lib/types/MdEditor/layouts/Content/composition/useResize.d.ts +1 -1
- package/package.json +2 -2
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as H, reactive as
|
|
1
|
+
import { defineComponent as H, reactive as B, ref as w, watch as D, onMounted as $, onBeforeUnmount as N, cloneVNode as W, createVNode as c, inject as I } from "vue";
|
|
2
2
|
import { p as i } from "./config.mjs";
|
|
3
3
|
import { g as f } from "./vue-tsx.mjs";
|
|
4
|
-
const
|
|
4
|
+
const O = {
|
|
5
5
|
overlay: {
|
|
6
6
|
type: [String, Object],
|
|
7
7
|
default: ""
|
|
@@ -24,11 +24,11 @@ const j = {
|
|
|
24
24
|
type: Boolean,
|
|
25
25
|
default: void 0
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, j = /* @__PURE__ */ H({
|
|
28
28
|
name: `${i}-dropdown`,
|
|
29
|
-
props:
|
|
29
|
+
props: O,
|
|
30
30
|
setup(e, a) {
|
|
31
|
-
const d = `${i}-dropdown-hidden`, t =
|
|
31
|
+
const d = `${i}-dropdown-hidden`, t = B({
|
|
32
32
|
overlayClass: [d],
|
|
33
33
|
overlayStyle: {},
|
|
34
34
|
triggerHover: !1,
|
|
@@ -40,28 +40,28 @@ const j = {
|
|
|
40
40
|
const n = o.value, r = l.value;
|
|
41
41
|
if (!n || !r)
|
|
42
42
|
return;
|
|
43
|
-
const g = n.getBoundingClientRect(), y = n.offsetTop, L = n.offsetLeft, E = g.height, T = g.width,
|
|
43
|
+
const g = n.getBoundingClientRect(), y = n.offsetTop, L = n.offsetLeft, E = g.height, T = g.width, p = n.getRootNode(), m = p.querySelector(e.relative)?.scrollLeft || 0, C = p.querySelector(e.relative)?.clientWidth || 0;
|
|
44
44
|
let s = L - r.offsetWidth / 2 + T / 2 - m;
|
|
45
45
|
s + r.offsetWidth > m + C && (s = m + C - r.offsetWidth), s < 0 && (s = 0), t.overlayStyle = {
|
|
46
46
|
...t.overlayStyle,
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
insetBlockStart: y + E + "px",
|
|
48
|
+
insetInlineStart: s + "px"
|
|
49
49
|
}, e.onChange(!0);
|
|
50
50
|
}, b = () => {
|
|
51
51
|
if (e.disabled)
|
|
52
52
|
return !1;
|
|
53
53
|
t.overlayHover = !0;
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
D(() => e.visible, (n) => {
|
|
56
56
|
n ? t.overlayClass = t.overlayClass.filter((r) => r !== d) : t.overlayClass.push(d);
|
|
57
57
|
});
|
|
58
|
-
let
|
|
58
|
+
let S = -1;
|
|
59
59
|
const v = (n) => {
|
|
60
|
-
o.value === n.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(
|
|
60
|
+
o.value === n.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(S), S = window.setTimeout(() => {
|
|
61
61
|
!t.overlayHover && !t.triggerHover && e.onChange(!1);
|
|
62
62
|
}, 10);
|
|
63
63
|
};
|
|
64
|
-
return
|
|
64
|
+
return $(() => {
|
|
65
65
|
o.value.addEventListener("mouseenter", u), o.value.addEventListener("mouseleave", v), l.value.addEventListener("mouseenter", b), l.value.addEventListener("mouseleave", v);
|
|
66
66
|
}), N(() => {
|
|
67
67
|
o.value.removeEventListener("mouseenter", u), o.value.removeEventListener("mouseleave", v), l.value.removeEventListener("mouseenter", b), l.value.removeEventListener("mouseleave", v);
|
|
@@ -150,7 +150,7 @@ const j = {
|
|
|
150
150
|
props: R,
|
|
151
151
|
emits: ["onChange"],
|
|
152
152
|
setup(e, a) {
|
|
153
|
-
const d =
|
|
153
|
+
const d = I("editorId"), t = (o) => {
|
|
154
154
|
e.onChange?.(o), a.emit("onChange", o);
|
|
155
155
|
};
|
|
156
156
|
return () => {
|
|
@@ -164,7 +164,7 @@ const j = {
|
|
|
164
164
|
props: e,
|
|
165
165
|
ctx: a
|
|
166
166
|
});
|
|
167
|
-
return c(
|
|
167
|
+
return c(j, {
|
|
168
168
|
relative: `#${d}-toolbar-wrapper`,
|
|
169
169
|
visible: e.visible,
|
|
170
170
|
onChange: t,
|
|
@@ -184,5 +184,5 @@ const j = {
|
|
|
184
184
|
h.install = (e) => (e.component(h.name, h), e);
|
|
185
185
|
export {
|
|
186
186
|
h as D,
|
|
187
|
-
|
|
187
|
+
j as a
|
|
188
188
|
};
|
package/lib/es/chunks/index2.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createVNode as t, defineComponent as k, h as
|
|
2
|
-
import { p as
|
|
1
|
+
import { createVNode as t, defineComponent as k, h as j, inject as p, ref as c, shallowRef as O, reactive as E, computed as g, watch as x, nextTick as b, onMounted as W, Teleport as q } from "vue";
|
|
2
|
+
import { p as l, g as C } from "./config.mjs";
|
|
3
3
|
import { c as w } from "./index5.mjs";
|
|
4
|
-
import { k as
|
|
5
|
-
import { g as
|
|
6
|
-
import { Upload as N, Trash2 as D, X as U, SquareSigma as X, ChartArea as G, ListTree as Q, CodeXml as V, Eye as Z, View as J, Expand as K, Shrink as Y, Maximize2 as _, Minimize2 as ee, SquareCode as
|
|
7
|
-
const
|
|
4
|
+
import { k as I } from "./dom.mjs";
|
|
5
|
+
import { g as z } from "./vue-tsx.mjs";
|
|
6
|
+
import { Upload as N, Trash2 as D, X as U, SquareSigma as X, ChartArea as G, ListTree as Q, CodeXml as V, Eye as Z, View as J, Expand as K, Shrink as Y, Maximize2 as _, Minimize2 as ee, SquareCode as M, Save as te, Forward as ne, Reply as oe, Table as ie, Image as le, Link as se, Code as ae, ListTodo as re, ListOrdered as ue, List as ce, Quote as de, Superscript as me, Subscript as fe, Heading as he, Strikethrough as ve, Italic as ye, Underline as ge, Bold as Se } from "lucide-vue-next";
|
|
7
|
+
const pe = () => t("svg", {
|
|
8
8
|
xmlns: "http://www.w3.org/2000/svg",
|
|
9
9
|
viewBox: "0 0 24 24",
|
|
10
10
|
fill: "none",
|
|
@@ -18,26 +18,26 @@ const Se = () => t("svg", {
|
|
|
18
18
|
}, null), t("path", {
|
|
19
19
|
d: "M9 18c-4.51 2-5-2-7-2"
|
|
20
20
|
}, null)]), ke = {
|
|
21
|
-
bold:
|
|
22
|
-
underline:
|
|
21
|
+
bold: Se,
|
|
22
|
+
underline: ge,
|
|
23
23
|
italic: ye,
|
|
24
24
|
"strike-through": ve,
|
|
25
25
|
title: he,
|
|
26
26
|
sub: fe,
|
|
27
27
|
sup: me,
|
|
28
|
-
quote:
|
|
29
|
-
"unordered-list":
|
|
30
|
-
"ordered-list":
|
|
31
|
-
task:
|
|
28
|
+
quote: de,
|
|
29
|
+
"unordered-list": ce,
|
|
30
|
+
"ordered-list": ue,
|
|
31
|
+
task: re,
|
|
32
32
|
"code-row": ae,
|
|
33
|
-
code:
|
|
33
|
+
code: M,
|
|
34
34
|
link: se,
|
|
35
|
-
image:
|
|
36
|
-
table:
|
|
37
|
-
revoke:
|
|
38
|
-
next:
|
|
35
|
+
image: le,
|
|
36
|
+
table: ie,
|
|
37
|
+
revoke: oe,
|
|
38
|
+
next: ne,
|
|
39
39
|
save: te,
|
|
40
|
-
prettier:
|
|
40
|
+
prettier: M,
|
|
41
41
|
minimize: ee,
|
|
42
42
|
maximize: _,
|
|
43
43
|
"fullscreen-exit": Y,
|
|
@@ -46,14 +46,14 @@ const Se = () => t("svg", {
|
|
|
46
46
|
preview: Z,
|
|
47
47
|
"preview-html": V,
|
|
48
48
|
catalog: Q,
|
|
49
|
-
github:
|
|
49
|
+
github: pe,
|
|
50
50
|
mermaid: G,
|
|
51
51
|
formula: X,
|
|
52
52
|
close: U,
|
|
53
53
|
delete: D,
|
|
54
54
|
upload: N
|
|
55
55
|
}, xe = /* @__PURE__ */ k({
|
|
56
|
-
name: `${
|
|
56
|
+
name: `${l}-icon-set`,
|
|
57
57
|
props: {
|
|
58
58
|
name: {
|
|
59
59
|
type: String,
|
|
@@ -61,12 +61,12 @@ const Se = () => t("svg", {
|
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
63
|
setup(e) {
|
|
64
|
-
return () =>
|
|
65
|
-
class: `${
|
|
64
|
+
return () => j(ke[e.name], {
|
|
65
|
+
class: `${l}-icon`
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
|
-
}),
|
|
69
|
-
name: `${
|
|
68
|
+
}), P = /* @__PURE__ */ k({
|
|
69
|
+
name: `${l}-icon`,
|
|
70
70
|
props: {
|
|
71
71
|
name: {
|
|
72
72
|
type: String,
|
|
@@ -74,10 +74,10 @@ const Se = () => t("svg", {
|
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
setup(e) {
|
|
77
|
-
const
|
|
77
|
+
const u = p("customIcon");
|
|
78
78
|
return () => {
|
|
79
|
-
const a =
|
|
80
|
-
return typeof a == "object" ? typeof a.component == "object" ?
|
|
79
|
+
const a = u.value[e.name];
|
|
80
|
+
return typeof a == "object" ? typeof a.component == "object" ? j(a.component, a.props) : t("span", {
|
|
81
81
|
innerHTML: a.component
|
|
82
82
|
}, null) : t(xe, {
|
|
83
83
|
name: e.name
|
|
@@ -129,15 +129,15 @@ const Se = () => t("svg", {
|
|
|
129
129
|
type: Boolean,
|
|
130
130
|
default: !0
|
|
131
131
|
}
|
|
132
|
-
},
|
|
132
|
+
}, S = /* @__PURE__ */ k({
|
|
133
133
|
name: "MdModal",
|
|
134
134
|
props: be,
|
|
135
135
|
emits: ["onClose"],
|
|
136
|
-
setup(e,
|
|
137
|
-
const a =
|
|
138
|
-
let
|
|
136
|
+
setup(e, u) {
|
|
137
|
+
const a = p("theme"), $ = p("rootRef"), m = c(e.visible), r = c([`${l}-modal`]), f = c(), h = c(), v = c(), B = O();
|
|
138
|
+
let d = () => {
|
|
139
139
|
};
|
|
140
|
-
const
|
|
140
|
+
const n = E({
|
|
141
141
|
maskStyle: {
|
|
142
142
|
zIndex: -1
|
|
143
143
|
},
|
|
@@ -145,114 +145,114 @@ const Se = () => t("svg", {
|
|
|
145
145
|
zIndex: -1
|
|
146
146
|
},
|
|
147
147
|
initPos: {
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
insetInlineStart: "0px",
|
|
149
|
+
insetBlockStart: "0px"
|
|
150
150
|
},
|
|
151
151
|
historyPos: {
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
insetInlineStart: "0px",
|
|
153
|
+
insetBlockStart: "0px"
|
|
154
154
|
}
|
|
155
|
-
}),
|
|
155
|
+
}), F = g(() => e.isFullscreen ? {
|
|
156
156
|
width: "100%",
|
|
157
157
|
height: "100%"
|
|
158
158
|
} : {
|
|
159
159
|
width: e.width,
|
|
160
160
|
height: e.height
|
|
161
161
|
});
|
|
162
|
-
x(() => e.isFullscreen, (
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
x(() => e.isFullscreen, (o) => {
|
|
163
|
+
o ? d() : b(() => {
|
|
164
|
+
d = I(h.value, (i, s) => {
|
|
165
|
+
n.initPos.insetInlineStart = i + "px", n.initPos.insetBlockStart = s + "px";
|
|
166
166
|
});
|
|
167
167
|
});
|
|
168
|
-
}), x(() => e.visible, (
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
}), x(() => e.visible, (o) => {
|
|
169
|
+
o ? (n.maskStyle.zIndex = C.editorConfig.zIndex + w(), n.modalStyle.zIndex = C.editorConfig.zIndex + w(), r.value.push("zoom-in"), m.value = o, b(() => {
|
|
170
|
+
const i = f.value.offsetWidth / 2, s = f.value.offsetHeight / 2, T = document.documentElement.clientWidth / 2, H = document.documentElement.clientHeight / 2;
|
|
171
|
+
n.initPos.insetInlineStart = T - i + "px", n.initPos.insetBlockStart = H - s + "px", e.isFullscreen || (d = I(h.value, (A, L) => {
|
|
172
|
+
n.initPos.insetInlineStart = A + "px", n.initPos.insetBlockStart = L + "px";
|
|
173
173
|
}));
|
|
174
174
|
}), setTimeout(() => {
|
|
175
|
-
|
|
176
|
-
}, 140)) : (
|
|
177
|
-
|
|
175
|
+
r.value = r.value.filter((i) => i !== "zoom-in");
|
|
176
|
+
}, 140)) : (r.value.push("zoom-out"), d(), setTimeout(() => {
|
|
177
|
+
r.value = r.value.filter((i) => i !== "zoom-out"), m.value = o;
|
|
178
178
|
}, 130));
|
|
179
179
|
});
|
|
180
|
-
const y =
|
|
180
|
+
const y = g(() => ({
|
|
181
181
|
display: m.value ? "block" : "none"
|
|
182
|
-
})),
|
|
182
|
+
})), R = g(() => {
|
|
183
183
|
if (typeof e.style == "string") {
|
|
184
|
-
const
|
|
185
|
-
return [e.style,
|
|
184
|
+
const o = Object.entries(y.value).map(([i, s]) => `${i}: ${s}`).join("; ");
|
|
185
|
+
return [e.style, o].join("; ");
|
|
186
186
|
} else return e.style instanceof Object ? {
|
|
187
187
|
...y.value,
|
|
188
188
|
...e.style
|
|
189
189
|
} : y.value;
|
|
190
190
|
});
|
|
191
191
|
return W(() => {
|
|
192
|
-
const
|
|
193
|
-
v.value =
|
|
192
|
+
const o = $.value?.getRootNode();
|
|
193
|
+
v.value = o instanceof Document ? document.body : o;
|
|
194
194
|
}), () => {
|
|
195
|
-
const
|
|
196
|
-
ctx:
|
|
197
|
-
}),
|
|
195
|
+
const o = z({
|
|
196
|
+
ctx: u
|
|
197
|
+
}), i = z({
|
|
198
198
|
props: e,
|
|
199
|
-
ctx:
|
|
199
|
+
ctx: u
|
|
200
200
|
}, "title");
|
|
201
201
|
return v.value ? t(q, {
|
|
202
202
|
to: v.value
|
|
203
203
|
}, {
|
|
204
204
|
default: () => [t("div", {
|
|
205
|
-
ref:
|
|
206
|
-
class: `${
|
|
205
|
+
ref: B,
|
|
206
|
+
class: `${l}-modal-container`,
|
|
207
207
|
"data-theme": a.value
|
|
208
208
|
}, [t("div", {
|
|
209
209
|
class: e.class,
|
|
210
|
-
style:
|
|
210
|
+
style: R.value
|
|
211
211
|
}, [e.showMask && t("div", {
|
|
212
|
-
class: `${
|
|
213
|
-
style:
|
|
212
|
+
class: `${l}-modal-mask`,
|
|
213
|
+
style: n.maskStyle,
|
|
214
214
|
onClick: () => {
|
|
215
|
-
e.onClose?.(),
|
|
215
|
+
e.onClose?.(), u.emit("onClose");
|
|
216
216
|
}
|
|
217
217
|
}, null), t("div", {
|
|
218
|
-
class:
|
|
218
|
+
class: r.value,
|
|
219
219
|
style: {
|
|
220
|
-
...
|
|
221
|
-
...
|
|
222
|
-
...
|
|
220
|
+
...n.modalStyle,
|
|
221
|
+
...n.initPos,
|
|
222
|
+
...F.value
|
|
223
223
|
},
|
|
224
224
|
ref: f
|
|
225
225
|
}, [t("div", {
|
|
226
|
-
class: `${
|
|
226
|
+
class: `${l}-modal-header`,
|
|
227
227
|
ref: h
|
|
228
|
-
}, [
|
|
229
|
-
class: `${
|
|
230
|
-
}, [
|
|
231
|
-
class: `${
|
|
228
|
+
}, [i || ""]), t("div", {
|
|
229
|
+
class: `${l}-modal-body`
|
|
230
|
+
}, [o]), t("div", {
|
|
231
|
+
class: `${l}-modal-func`
|
|
232
232
|
}, [e.showAdjust && t("div", {
|
|
233
|
-
class: `${
|
|
233
|
+
class: `${l}-modal-adjust`,
|
|
234
234
|
onClick: (s) => {
|
|
235
|
-
s.stopPropagation(), e.isFullscreen ?
|
|
236
|
-
|
|
237
|
-
|
|
235
|
+
s.stopPropagation(), e.isFullscreen ? n.initPos = n.historyPos : (n.historyPos = n.initPos, n.initPos = {
|
|
236
|
+
insetInlineStart: "0",
|
|
237
|
+
insetBlockStart: "0"
|
|
238
238
|
}), e.onAdjust(!e.isFullscreen);
|
|
239
239
|
}
|
|
240
|
-
}, [t(
|
|
240
|
+
}, [t(P, {
|
|
241
241
|
name: e.isFullscreen ? "minimize" : "maximize"
|
|
242
242
|
}, null)]), t("div", {
|
|
243
|
-
class: `${
|
|
243
|
+
class: `${l}-modal-close`,
|
|
244
244
|
onClick: (s) => {
|
|
245
|
-
s.stopPropagation(), e.onClose?.(),
|
|
245
|
+
s.stopPropagation(), e.onClose?.(), u.emit("onClose");
|
|
246
246
|
}
|
|
247
|
-
}, [t(
|
|
247
|
+
}, [t(P, {
|
|
248
248
|
name: "close"
|
|
249
249
|
}, null)])])])])])]
|
|
250
250
|
}) : "";
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
|
-
|
|
254
|
+
S.install = (e) => (e.component(S.name, S), e);
|
|
255
255
|
export {
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
P as I,
|
|
257
|
+
S as M
|
|
258
258
|
};
|