md-editor-v3 4.3.0-beta.2 → 4.3.0-beta.3
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
CHANGED
|
@@ -21,7 +21,7 @@ Markdown editor for vue3, developed in `jsx` and `typescript`.
|
|
|
21
21
|
- Multi-language, build-in Chinese and English(default: Chinese).
|
|
22
22
|
- Upload picture, paste or clip the picture and upload it.
|
|
23
23
|
- Render article directly(no editor, no event listener, only preview of content).
|
|
24
|
-
- Theme of preview, `
|
|
24
|
+
- Theme of preview, `default`, `vuepress`, `github`, `cyanosis`, `mk-cute`, `smart-blue` styles(not identical). It can be customized also(Refer to example page).
|
|
25
25
|
- `mermaid`(>=1.8.0), `katex` mathematical formula(>=1.9.0).
|
|
26
26
|
- Customize the toolbar as you like.
|
|
27
27
|
- On-demand Import(>=4.0.0).
|
|
@@ -675,7 +675,7 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
|
|
|
675
675
|
|
|
676
676
|
- **slots**
|
|
677
677
|
|
|
678
|
-
- `trigger`: `
|
|
678
|
+
- `trigger`: `VNode | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
679
679
|
|
|
680
680
|
### 🐼 DropdownToolbar
|
|
681
681
|
|
|
@@ -692,8 +692,8 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
|
|
|
692
692
|
|
|
693
693
|
- **slots**
|
|
694
694
|
|
|
695
|
-
- `trigger`: `
|
|
696
|
-
- `overlay`: `
|
|
695
|
+
- `trigger`: `VNode | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
696
|
+
- `overlay`: `VNode | JSX.Element`, necessary, content of dropdown box.
|
|
697
697
|
|
|
698
698
|
### 🦉 ModalToolbar
|
|
699
699
|
|
|
@@ -717,8 +717,8 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
|
|
|
717
717
|
|
|
718
718
|
- **slots**
|
|
719
719
|
|
|
720
|
-
- `trigger`: `
|
|
721
|
-
- `
|
|
720
|
+
- `trigger`: `VNode | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
|
|
721
|
+
- `default`: `VNode | JSX.Element`, necessary, content of Modal.
|
|
722
722
|
|
|
723
723
|
### 🐻 MdCatalog
|
|
724
724
|
|
|
@@ -731,13 +731,37 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
|
|
|
731
731
|
- `mdHeadingId`: `MdHeadingId`, not necessary, same as editor.
|
|
732
732
|
- `scrollElement`: `string | HTMLElement`, not necessary, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
|
|
733
733
|
- `theme`: `'light' | 'dark'`, not necessary, provide it when you want to change theme online, it is the same as Editor `theme`.
|
|
734
|
-
- `offsetTop`: `number`, not necessary, highlight current item of catalogs when title is `offsetTop` pixels from the top,
|
|
735
|
-
- `scrollElementOffsetTop`: `number`, not necessary, offsetTop of the scroll container,
|
|
734
|
+
- `offsetTop`: `number`, not necessary, highlight current item of catalogs when title is `offsetTop` pixels from the top, default 20.
|
|
735
|
+
- `scrollElementOffsetTop`: `number`, not necessary, offsetTop of the scroll container,default 0.
|
|
736
736
|
|
|
737
737
|
- **events**
|
|
738
738
|
|
|
739
739
|
- `onClick`: `(e: MouseEvent, t: TocItem) => void`, not necessary.
|
|
740
740
|
|
|
741
|
+
### 🛸 MdModal
|
|
742
|
+
|
|
743
|
+
`MdModal`
|
|
744
|
+
|
|
745
|
+
- **props**
|
|
746
|
+
|
|
747
|
+
- `title`: `string`, not necessary, title of Modal.
|
|
748
|
+
- `visible`: `boolean`, necessary, visibility of Modal.
|
|
749
|
+
- `width`: `string`, not necessary, width of Modal, default `auto`.
|
|
750
|
+
- `height`: `string`, same as `width`.
|
|
751
|
+
- `showAdjust`: `boolean`, not necessary, visibility of fullscreen button.
|
|
752
|
+
- `isFullscreen`: `boolean`, necessary when `showAdjust = true`, status of fullscreen.
|
|
753
|
+
- `className`: `string`, not necessary.
|
|
754
|
+
- `style`: `CSSProperties`, not necessary.
|
|
755
|
+
|
|
756
|
+
- **events**
|
|
757
|
+
|
|
758
|
+
- `onClose`: `() => void`, necessary, close event.
|
|
759
|
+
- `onAdjust`: `(val: boolean) => void`, fullscreen button click event.
|
|
760
|
+
|
|
761
|
+
- **slots**
|
|
762
|
+
|
|
763
|
+
- `default`: `VNode | JSX.Element`, necessary, content of Modal.
|
|
764
|
+
|
|
741
765
|
## 🗂 Examples
|
|
742
766
|
|
|
743
767
|
### 🎸 Jsx Template
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("vue"),
|
|
1
|
+
"use strict";const o=require("vue"),u=require("./config.cjs"),c=require("./vue-tsx.cjs"),L={overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}},relative:{type:String,default:"html"}},C=o.defineComponent({props:L,setup(e,i){const s=`${u.prefix}-dropdown-hidden`,t=o.reactive({overlayClass:[s],overlayStyle:{},triggerHover:!1,overlayHover:!1}),n=o.ref(),l=o.ref(),v=()=>{var p;t.triggerHover=!0;const r=n.value,a=l.value;if(!r||!a)return;const d=r.getBoundingClientRect(),y=r.offsetTop,S=r.offsetLeft,b=d.height,w=d.width,H=((p=document.querySelector(e.relative))==null?void 0:p.scrollLeft)||0;t.overlayStyle={...t.overlayStyle,top:y+b+"px",left:S-a.offsetWidth/2+w/2-H+"px"},e.onChange(!0)},m=()=>{t.overlayHover=!0};o.watch(()=>e.visible,r=>{r?t.overlayClass=t.overlayClass.filter(a=>a!==s):t.overlayClass.push(s)});let h=-1;const g=r=>{n.value===r.target?t.triggerHover=!1:t.overlayHover=!1,clearTimeout(h),h=window.setTimeout(()=>{!t.overlayHover&&!t.triggerHover&&e.onChange(!1)},10)};return o.onMounted(()=>{n.value.addEventListener("mouseenter",v),n.value.addEventListener("mouseleave",g),l.value.addEventListener("mouseenter",m),l.value.addEventListener("mouseleave",g)}),o.onBeforeUnmount(()=>{n.value.removeEventListener("mouseenter",v),n.value.removeEventListener("mouseleave",g),l.value.removeEventListener("mouseenter",m),l.value.removeEventListener("mouseleave",g)}),()=>{const r=c.getSlot({ctx:i}),a=c.getSlot({props:e,ctx:i},"overlay"),d=o.cloneVNode(r instanceof Array?r[0]:r,{ref:n}),y=o.createVNode("div",{class:[`${u.prefix}-dropdown`,t.overlayClass],style:t.overlayStyle,ref:l},[o.createVNode("div",{class:`${u.prefix}-dropdown-overlay`},[a instanceof Array?a[0]:a])]);return[d,y]}}}),E={title:{type:String,default:""},visible:{type:Boolean},trigger:{type:[String,Object]},onChange:{type:Function},overlay:{type:[String,Object]},insert:{type:Function},children:{type:[String,Object]}},f=o.defineComponent({name:"DropdownToolbar",props:E,emits:["onChange"],setup(e,i){const s=o.inject("editorId");return()=>{const t=c.getSlot({props:e,ctx:i},"trigger"),n=c.getSlot({props:e,ctx:i},"overlay"),l=c.getSlot({props:e,ctx:i});return o.createVNode(C,{relative:`#${s}-toolbar-wrapper`,visible:e.visible,onChange:v=>{e.onChange instanceof Function?e.onChange(v):i.emit("onChange",v)},overlay:n},{default:()=>[o.createVNode("div",{class:`${u.prefix}-toolbar-item`,title:e.title||""},[t,l])]})}}});f.install=e=>(e.component(f.name,f),e);exports.Dropdown=C;exports.DropdownToolbar=f;
|
package/lib/es/chunks/index2.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { p as
|
|
3
|
-
import { g as
|
|
1
|
+
import { defineComponent as S, reactive as E, ref as C, watch as T, onMounted as D, onBeforeUnmount as O, cloneVNode as $, createVNode as u, inject as j } from "vue";
|
|
2
|
+
import { p as d } from "./config.mjs";
|
|
3
|
+
import { g as v } from "./vue-tsx.mjs";
|
|
4
4
|
const B = {
|
|
5
5
|
overlay: {
|
|
6
6
|
type: [String, Object],
|
|
@@ -20,58 +20,58 @@ const B = {
|
|
|
20
20
|
type: String,
|
|
21
21
|
default: "html"
|
|
22
22
|
}
|
|
23
|
-
}, F = /* @__PURE__ */
|
|
23
|
+
}, F = /* @__PURE__ */ S({
|
|
24
24
|
props: B,
|
|
25
25
|
setup(e, a) {
|
|
26
|
-
const i = `${
|
|
26
|
+
const i = `${d}-dropdown-hidden`, t = E({
|
|
27
27
|
overlayClass: [i],
|
|
28
28
|
overlayStyle: {},
|
|
29
29
|
triggerHover: !1,
|
|
30
30
|
overlayHover: !1
|
|
31
|
-
}),
|
|
31
|
+
}), o = C(), n = C(), s = () => {
|
|
32
32
|
var p;
|
|
33
33
|
t.triggerHover = !0;
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
34
|
+
const r = o.value, l = n.value;
|
|
35
|
+
if (!r || !l)
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
37
|
+
const c = r.getBoundingClientRect(), f = r.offsetTop, b = r.offsetLeft, H = c.height, L = c.width, w = ((p = document.querySelector(e.relative)) == null ? void 0 : p.scrollLeft) || 0;
|
|
38
38
|
t.overlayStyle = {
|
|
39
39
|
...t.overlayStyle,
|
|
40
|
-
top:
|
|
41
|
-
left:
|
|
40
|
+
top: f + H + "px",
|
|
41
|
+
left: b - l.offsetWidth / 2 + L / 2 - w + "px"
|
|
42
42
|
}, e.onChange(!0);
|
|
43
43
|
}, m = () => {
|
|
44
44
|
t.overlayHover = !0;
|
|
45
45
|
};
|
|
46
|
-
T(() => e.visible, (
|
|
47
|
-
|
|
46
|
+
T(() => e.visible, (r) => {
|
|
47
|
+
r ? t.overlayClass = t.overlayClass.filter((l) => l !== i) : t.overlayClass.push(i);
|
|
48
48
|
});
|
|
49
49
|
let h = -1;
|
|
50
|
-
const
|
|
51
|
-
|
|
50
|
+
const g = (r) => {
|
|
51
|
+
o.value === r.target ? t.triggerHover = !1 : t.overlayHover = !1, clearTimeout(h), h = window.setTimeout(() => {
|
|
52
52
|
!t.overlayHover && !t.triggerHover && e.onChange(!1);
|
|
53
53
|
}, 10);
|
|
54
54
|
};
|
|
55
55
|
return D(() => {
|
|
56
|
-
|
|
57
|
-
}),
|
|
58
|
-
|
|
56
|
+
o.value.addEventListener("mouseenter", s), o.value.addEventListener("mouseleave", g), n.value.addEventListener("mouseenter", m), n.value.addEventListener("mouseleave", g);
|
|
57
|
+
}), O(() => {
|
|
58
|
+
o.value.removeEventListener("mouseenter", s), o.value.removeEventListener("mouseleave", g), n.value.removeEventListener("mouseenter", m), n.value.removeEventListener("mouseleave", g);
|
|
59
59
|
}), () => {
|
|
60
|
-
const
|
|
60
|
+
const r = v({
|
|
61
61
|
ctx: a
|
|
62
|
-
}), l =
|
|
62
|
+
}), l = v({
|
|
63
63
|
props: e,
|
|
64
64
|
ctx: a
|
|
65
|
-
}, "overlay"),
|
|
66
|
-
ref:
|
|
67
|
-
}),
|
|
68
|
-
class: [`${
|
|
65
|
+
}, "overlay"), c = $(r instanceof Array ? r[0] : r, {
|
|
66
|
+
ref: o
|
|
67
|
+
}), f = u("div", {
|
|
68
|
+
class: [`${d}-dropdown`, t.overlayClass],
|
|
69
69
|
style: t.overlayStyle,
|
|
70
70
|
ref: n
|
|
71
|
-
}, [
|
|
72
|
-
class: `${
|
|
71
|
+
}, [u("div", {
|
|
72
|
+
class: `${d}-dropdown-overlay`
|
|
73
73
|
}, [l instanceof Array ? l[0] : l])]);
|
|
74
|
-
return [
|
|
74
|
+
return [c, f];
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
}), I = {
|
|
@@ -98,39 +98,45 @@ const B = {
|
|
|
98
98
|
*/
|
|
99
99
|
insert: {
|
|
100
100
|
type: Function
|
|
101
|
+
},
|
|
102
|
+
children: {
|
|
103
|
+
type: [String, Object]
|
|
101
104
|
}
|
|
102
|
-
},
|
|
105
|
+
}, y = /* @__PURE__ */ S({
|
|
103
106
|
name: "DropdownToolbar",
|
|
104
107
|
props: I,
|
|
105
108
|
emits: ["onChange"],
|
|
106
109
|
setup(e, a) {
|
|
107
110
|
const i = j("editorId");
|
|
108
111
|
return () => {
|
|
109
|
-
const t =
|
|
112
|
+
const t = v({
|
|
110
113
|
props: e,
|
|
111
114
|
ctx: a
|
|
112
|
-
}, "trigger"),
|
|
115
|
+
}, "trigger"), o = v({
|
|
113
116
|
props: e,
|
|
114
117
|
ctx: a
|
|
115
|
-
}, "overlay")
|
|
116
|
-
|
|
118
|
+
}, "overlay"), n = v({
|
|
119
|
+
props: e,
|
|
120
|
+
ctx: a
|
|
121
|
+
});
|
|
122
|
+
return u(F, {
|
|
117
123
|
relative: `#${i}-toolbar-wrapper`,
|
|
118
124
|
visible: e.visible,
|
|
119
|
-
onChange: (
|
|
120
|
-
e.onChange instanceof Function ? e.onChange(
|
|
125
|
+
onChange: (s) => {
|
|
126
|
+
e.onChange instanceof Function ? e.onChange(s) : a.emit("onChange", s);
|
|
121
127
|
},
|
|
122
|
-
overlay:
|
|
128
|
+
overlay: o
|
|
123
129
|
}, {
|
|
124
|
-
default: () => [
|
|
125
|
-
class: `${
|
|
130
|
+
default: () => [u("div", {
|
|
131
|
+
class: `${d}-toolbar-item`,
|
|
126
132
|
title: e.title || ""
|
|
127
|
-
}, [t])]
|
|
133
|
+
}, [t, n])]
|
|
128
134
|
});
|
|
129
135
|
};
|
|
130
136
|
}
|
|
131
137
|
});
|
|
132
|
-
|
|
138
|
+
y.install = (e) => (e.component(y.name, y), e);
|
|
133
139
|
export {
|
|
134
|
-
|
|
140
|
+
y as D,
|
|
135
141
|
F as a
|
|
136
142
|
};
|
|
@@ -22,6 +22,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
insert: {
|
|
23
23
|
type: PropType<() => void>;
|
|
24
24
|
};
|
|
25
|
+
children: {
|
|
26
|
+
type: PropType<string | JSX.Element>;
|
|
27
|
+
};
|
|
25
28
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], "onChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
26
29
|
title: {
|
|
27
30
|
type: PropType<string>;
|
|
@@ -45,6 +48,9 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
45
48
|
insert: {
|
|
46
49
|
type: PropType<() => void>;
|
|
47
50
|
};
|
|
51
|
+
children: {
|
|
52
|
+
type: PropType<string | JSX.Element>;
|
|
53
|
+
};
|
|
48
54
|
}>> & {
|
|
49
55
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
50
56
|
}, {
|
|
@@ -25,6 +25,9 @@ declare const _default: {
|
|
|
25
25
|
insert: {
|
|
26
26
|
type: import("vue").PropType<() => void>;
|
|
27
27
|
};
|
|
28
|
+
children: {
|
|
29
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
30
|
+
};
|
|
28
31
|
}>> & {
|
|
29
32
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
30
33
|
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "title">;
|
|
@@ -61,6 +64,9 @@ declare const _default: {
|
|
|
61
64
|
insert: {
|
|
62
65
|
type: import("vue").PropType<() => void>;
|
|
63
66
|
};
|
|
67
|
+
children: {
|
|
68
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
69
|
+
};
|
|
64
70
|
}>> & {
|
|
65
71
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
66
72
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], string, {
|
|
@@ -105,6 +111,9 @@ declare const _default: {
|
|
|
105
111
|
insert: {
|
|
106
112
|
type: import("vue").PropType<() => void>;
|
|
107
113
|
};
|
|
114
|
+
children: {
|
|
115
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
116
|
+
};
|
|
108
117
|
}>> & {
|
|
109
118
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
110
119
|
} & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & import("vue").ComponentCustomProperties & {};
|
|
@@ -131,6 +140,9 @@ declare const _default: {
|
|
|
131
140
|
insert: {
|
|
132
141
|
type: import("vue").PropType<() => void>;
|
|
133
142
|
};
|
|
143
|
+
children: {
|
|
144
|
+
type: import("vue").PropType<string | JSX.Element>;
|
|
145
|
+
};
|
|
134
146
|
}>> & {
|
|
135
147
|
onOnChange?: ((...args: any[]) => any) | undefined;
|
|
136
148
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], "onChange", {
|