md-editor-v3 4.2.0 → 4.2.1-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/MdEditor.cjs +5 -5
- package/lib/cjs/chunks/index.cjs +5 -5
- package/lib/cjs/chunks/index2.cjs +1 -1
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +109 -107
- package/lib/es/chunks/index.mjs +255 -258
- package/lib/es/chunks/index2.mjs +34 -42
- package/lib/es/index.mjs +15 -14
- package/lib/types/MdEditor/components/Dropdown/index.d.ts +0 -9
- package/lib/types/MdEditor/type.d.ts +3 -1
- package/lib/umd/index.js +34 -34
- package/package.json +1 -1
package/lib/es/chunks/index2.mjs
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { defineComponent as H, reactive as
|
|
1
|
+
import { defineComponent as H, reactive as E, ref as C, watch as T, onMounted as D, onBeforeUnmount as $, cloneVNode as O, createVNode as c, inject as j } from "vue";
|
|
2
2
|
import { p as g } from "./config.mjs";
|
|
3
|
-
import { g as
|
|
3
|
+
import { g as d } from "./vue-tsx.mjs";
|
|
4
4
|
const B = {
|
|
5
|
-
trigger: {
|
|
6
|
-
type: String,
|
|
7
|
-
default: "hover"
|
|
8
|
-
},
|
|
9
5
|
overlay: {
|
|
10
6
|
type: [String, Object],
|
|
11
7
|
default: ""
|
|
@@ -27,56 +23,52 @@ const B = {
|
|
|
27
23
|
}, I = /* @__PURE__ */ H({
|
|
28
24
|
props: B,
|
|
29
25
|
setup(e, a) {
|
|
30
|
-
const
|
|
31
|
-
overlayClass: [
|
|
26
|
+
const i = `${g}-dropdown-hidden`, t = E({
|
|
27
|
+
overlayClass: [i],
|
|
32
28
|
overlayStyle: {},
|
|
33
29
|
triggerHover: !1,
|
|
34
30
|
overlayHover: !1
|
|
35
|
-
}),
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
const
|
|
31
|
+
}), r = C(), n = C(), y = () => {
|
|
32
|
+
var p;
|
|
33
|
+
t.triggerHover = !0;
|
|
34
|
+
const o = r.value, l = n.value, v = o.getBoundingClientRect(), u = o.offsetTop, L = o.offsetLeft, S = v.height, b = v.width, w = ((p = document.querySelector(e.relative)) == null ? void 0 : p.scrollLeft) || 0;
|
|
39
35
|
t.overlayStyle = {
|
|
40
36
|
...t.overlayStyle,
|
|
41
|
-
top:
|
|
42
|
-
left:
|
|
37
|
+
top: u + S + "px",
|
|
38
|
+
left: L - l.offsetWidth / 2 + b / 2 - w + "px"
|
|
43
39
|
}, e.onChange(!0);
|
|
44
40
|
}, m = () => {
|
|
45
41
|
t.overlayHover = !0;
|
|
46
42
|
};
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
T(() => e.visible, (o) => {
|
|
44
|
+
o ? t.overlayClass = t.overlayClass.filter((l) => l !== i) : t.overlayClass.push(i);
|
|
49
45
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
let C = -1;
|
|
55
|
-
const c = (r) => {
|
|
56
|
-
o.value === r.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(C), C = window.setTimeout(() => {
|
|
46
|
+
let h = -1;
|
|
47
|
+
const s = (o) => {
|
|
48
|
+
r.value === o.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(h), h = window.setTimeout(() => {
|
|
57
49
|
!t.overlayHover && !t.triggerHover && e.onChange(!1);
|
|
58
50
|
}, 10);
|
|
59
51
|
};
|
|
60
52
|
return D(() => {
|
|
61
|
-
|
|
53
|
+
r.value.addEventListener("mouseenter", y), r.value.addEventListener("mouseleave", s), n.value.addEventListener("mouseenter", m), n.value.addEventListener("mouseleave", s);
|
|
62
54
|
}), $(() => {
|
|
63
|
-
|
|
55
|
+
r.value.removeEventListener("mouseenter", y), r.value.removeEventListener("mouseleave", s), n.value.removeEventListener("mouseenter", m), n.value.removeEventListener("mouseleave", s);
|
|
64
56
|
}), () => {
|
|
65
|
-
const
|
|
57
|
+
const o = d({
|
|
66
58
|
ctx: a
|
|
67
|
-
}), l =
|
|
59
|
+
}), l = d({
|
|
68
60
|
props: e,
|
|
69
61
|
ctx: a
|
|
70
|
-
}, "overlay"),
|
|
71
|
-
ref:
|
|
72
|
-
}),
|
|
62
|
+
}, "overlay"), v = O(o instanceof Array ? o[0] : o, {
|
|
63
|
+
ref: r
|
|
64
|
+
}), u = c("div", {
|
|
73
65
|
class: [`${g}-dropdown`, t.overlayClass],
|
|
74
66
|
style: t.overlayStyle,
|
|
75
67
|
ref: n
|
|
76
|
-
}, [
|
|
68
|
+
}, [c("div", {
|
|
77
69
|
class: `${g}-dropdown-overlay`
|
|
78
70
|
}, [l instanceof Array ? l[0] : l])]);
|
|
79
|
-
return [
|
|
71
|
+
return [v, u];
|
|
80
72
|
};
|
|
81
73
|
}
|
|
82
74
|
}), A = {
|
|
@@ -98,29 +90,29 @@ const B = {
|
|
|
98
90
|
overlay: {
|
|
99
91
|
type: [String, Object]
|
|
100
92
|
}
|
|
101
|
-
},
|
|
93
|
+
}, f = /* @__PURE__ */ H({
|
|
102
94
|
name: "DropdownToolbar",
|
|
103
95
|
props: A,
|
|
104
96
|
emits: ["onChange"],
|
|
105
97
|
setup(e, a) {
|
|
106
|
-
const
|
|
98
|
+
const i = j("editorId");
|
|
107
99
|
return () => {
|
|
108
|
-
const t =
|
|
100
|
+
const t = d({
|
|
109
101
|
props: e,
|
|
110
102
|
ctx: a
|
|
111
|
-
}, "trigger"),
|
|
103
|
+
}, "trigger"), r = d({
|
|
112
104
|
props: e,
|
|
113
105
|
ctx: a
|
|
114
106
|
}, "overlay");
|
|
115
|
-
return
|
|
116
|
-
relative: `#${
|
|
107
|
+
return c(I, {
|
|
108
|
+
relative: `#${i}-toolbar-wrapper`,
|
|
117
109
|
visible: e.visible,
|
|
118
110
|
onChange: (n) => {
|
|
119
111
|
e.onChange instanceof Function ? e.onChange(n) : a.emit("onChange", n);
|
|
120
112
|
},
|
|
121
|
-
overlay:
|
|
113
|
+
overlay: r
|
|
122
114
|
}, {
|
|
123
|
-
default: () => [
|
|
115
|
+
default: () => [c("div", {
|
|
124
116
|
class: `${g}-toolbar-item`,
|
|
125
117
|
title: e.title || ""
|
|
126
118
|
}, [t])]
|
|
@@ -128,8 +120,8 @@ const B = {
|
|
|
128
120
|
};
|
|
129
121
|
}
|
|
130
122
|
});
|
|
131
|
-
|
|
123
|
+
f.install = (e) => (e.component(f.name, f), e);
|
|
132
124
|
export {
|
|
133
|
-
|
|
125
|
+
f as D,
|
|
134
126
|
I as a
|
|
135
127
|
};
|
package/lib/es/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { M as
|
|
3
|
-
import { default as
|
|
4
|
-
import { D as
|
|
5
|
-
import { M as
|
|
6
|
-
import { default as
|
|
7
|
-
import { c as
|
|
1
|
+
import { default as C } from "./MdEditor.mjs";
|
|
2
|
+
import { M as N } from "./chunks/index.mjs";
|
|
3
|
+
import { default as h } from "./NormalToolbar.mjs";
|
|
4
|
+
import { D as k } from "./chunks/index2.mjs";
|
|
5
|
+
import { M as y } from "./chunks/index3.mjs";
|
|
6
|
+
import { default as A } from "./MdCatalog.mjs";
|
|
7
|
+
import { c as F } from "./chunks/config.mjs";
|
|
8
8
|
import "vue";
|
|
9
9
|
import "./chunks/index4.mjs";
|
|
10
10
|
import "@vavt/util";
|
|
@@ -13,6 +13,7 @@ import "codemirror";
|
|
|
13
13
|
import "@codemirror/view";
|
|
14
14
|
import "@codemirror/language-data";
|
|
15
15
|
import "@codemirror/lang-markdown";
|
|
16
|
+
import "@codemirror/lang-html";
|
|
16
17
|
import "@codemirror/commands";
|
|
17
18
|
import "@codemirror/language";
|
|
18
19
|
import "@lezer/highlight";
|
|
@@ -26,11 +27,11 @@ import "markdown-it-image-figures";
|
|
|
26
27
|
import "markdown-it-task-lists";
|
|
27
28
|
import "lru-cache";
|
|
28
29
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
k as DropdownToolbar,
|
|
31
|
+
A as MdCatalog,
|
|
32
|
+
C as MdEditor,
|
|
33
|
+
N as MdPreview,
|
|
34
|
+
y as ModalToolbar,
|
|
35
|
+
h as NormalToolbar,
|
|
36
|
+
F as config
|
|
36
37
|
};
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { PropType, EmitsOptions, ExtractPropTypes } from 'vue';
|
|
2
2
|
declare const _default: import("vue").DefineComponent<{
|
|
3
|
-
trigger: {
|
|
4
|
-
type: PropType<"hover" | "click">;
|
|
5
|
-
default: string;
|
|
6
|
-
};
|
|
7
3
|
overlay: {
|
|
8
4
|
type: PropType<string | JSX.Element>;
|
|
9
5
|
default: string;
|
|
@@ -23,10 +19,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
23
19
|
}, () => import("vue").VNode<unknown, unknown, {
|
|
24
20
|
[key: string]: any;
|
|
25
21
|
}>[], unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
26
|
-
trigger: {
|
|
27
|
-
type: PropType<"hover" | "click">;
|
|
28
|
-
default: string;
|
|
29
|
-
};
|
|
30
22
|
overlay: {
|
|
31
23
|
type: PropType<string | JSX.Element>;
|
|
32
24
|
default: string;
|
|
@@ -45,7 +37,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
45
37
|
};
|
|
46
38
|
}>>, {
|
|
47
39
|
visible: boolean;
|
|
48
|
-
trigger: "hover" | "click";
|
|
49
40
|
onChange: (v: boolean) => void;
|
|
50
41
|
overlay: string | JSX.Element;
|
|
51
42
|
relative: string;
|
|
@@ -215,9 +215,11 @@ export interface ConfigOption {
|
|
|
215
215
|
*
|
|
216
216
|
* @params theme 当前主题
|
|
217
217
|
* @params innerExtensions 当前主题下的扩展列表
|
|
218
|
-
* [keymap, minimalSetup, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
218
|
+
* [keymap, minimalSetup, html, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
219
219
|
* [快捷键, 最低配置, markdown识别, 横向自动换行, 更新事件, dom监听事件, oneDark主题(暗夜模式下), oneLight(默认模式下)]
|
|
220
220
|
*
|
|
221
|
+
* 如果要添加其他自带的扩展,比如java,注意添加到markdown之前,不然自动提示不正常
|
|
222
|
+
*
|
|
221
223
|
* @params keyBindings md-editor-v3内置的快捷键
|
|
222
224
|
*/
|
|
223
225
|
codeMirrorExtensions?: (theme: Themes, extensions: Array<Extension>, keyBindings: Array<KeyBinding>) => Array<Extension>;
|