md-editor-v3 4.3.0-beta.0 → 4.3.0-beta.2

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.
@@ -0,0 +1,141 @@
1
+ import { defineComponent as C, ref as d, reactive as k, computed as $, onMounted as F, onBeforeUnmount as w, watch as v, nextTick as M, createVNode as o } from "vue";
2
+ import { p as s } from "./chunks/config.mjs";
3
+ import { g } from "./chunks/vue-tsx.mjs";
4
+ import { k as y } from "./chunks/dom.mjs";
5
+ import "@vavt/util";
6
+ const b = {
7
+ title: {
8
+ type: String,
9
+ default: ""
10
+ },
11
+ visible: {
12
+ type: Boolean,
13
+ default: !1
14
+ },
15
+ width: {
16
+ type: String,
17
+ default: "auto"
18
+ },
19
+ height: {
20
+ type: String,
21
+ default: "auto"
22
+ },
23
+ onClose: {
24
+ type: Function,
25
+ default: () => {
26
+ }
27
+ },
28
+ showAdjust: {
29
+ type: Boolean,
30
+ default: !1
31
+ },
32
+ isFullscreen: {
33
+ type: Boolean,
34
+ default: !1
35
+ },
36
+ onAdjust: {
37
+ type: Function,
38
+ default: () => {
39
+ }
40
+ }
41
+ }, m = /* @__PURE__ */ C({
42
+ name: "MdModal",
43
+ props: b,
44
+ setup(e, h) {
45
+ const c = d(e.visible), n = d([`${s}-modal`]), f = d(), r = d();
46
+ let u = () => {
47
+ };
48
+ const t = k({
49
+ initPos: {
50
+ left: "0px",
51
+ top: "0px"
52
+ },
53
+ historyPos: {
54
+ left: "0px",
55
+ top: "0px"
56
+ }
57
+ }), P = $(() => e.isFullscreen ? {
58
+ width: "100%",
59
+ height: "100%"
60
+ } : {
61
+ width: e.width,
62
+ height: e.height
63
+ });
64
+ return F(() => {
65
+ u = y(r.value, (i, l) => {
66
+ t.initPos.left = i + "px", t.initPos.top = l + "px";
67
+ });
68
+ }), w(() => {
69
+ u();
70
+ }), v(() => e.isFullscreen, (i) => {
71
+ i ? u() : u = y(r.value, (l, a) => {
72
+ t.initPos.left = l + "px", t.initPos.top = a + "px";
73
+ });
74
+ }), v(() => e.visible, (i) => {
75
+ i ? (n.value.push("zoom-in"), c.value = i, M(() => {
76
+ const l = f.value.offsetWidth / 2, a = f.value.offsetHeight / 2, p = document.documentElement.clientWidth / 2, x = document.documentElement.clientHeight / 2;
77
+ t.initPos.left = p - l + "px", t.initPos.top = x - a + "px";
78
+ }), setTimeout(() => {
79
+ n.value = n.value.filter((l) => l !== "zoom-in");
80
+ }, 140)) : (n.value.push("zoom-out"), setTimeout(() => {
81
+ n.value = n.value.filter((l) => l !== "zoom-out"), c.value = i;
82
+ }, 130));
83
+ }), () => {
84
+ const i = g({
85
+ ctx: h
86
+ }), l = g({
87
+ props: e,
88
+ ctx: h
89
+ }, "title");
90
+ return o("div", {
91
+ style: {
92
+ display: c.value ? "block" : "none"
93
+ }
94
+ }, [o("div", {
95
+ class: `${s}-modal-mask`,
96
+ onClick: e.onClose
97
+ }, null), o("div", {
98
+ class: n.value,
99
+ style: {
100
+ ...t.initPos,
101
+ ...P.value
102
+ },
103
+ ref: f
104
+ }, [o("div", {
105
+ class: `${s}-modal-header`,
106
+ ref: r
107
+ }, [l || ""]), o("div", {
108
+ class: `${s}-modal-body`
109
+ }, [i]), o("div", {
110
+ class: `${s}-modal-func`
111
+ }, [e.showAdjust && o("div", {
112
+ class: `${s}-modal-adjust`,
113
+ onClick: (a) => {
114
+ a.stopPropagation(), e.isFullscreen ? t.initPos = t.historyPos : (t.historyPos = t.initPos, t.initPos = {
115
+ left: "0",
116
+ top: "0"
117
+ }), e.onAdjust(!e.isFullscreen);
118
+ }
119
+ }, [o("svg", {
120
+ class: `${s}-icon`,
121
+ "aria-hidden": "true"
122
+ }, [o("use", {
123
+ "xlink:href": `#md-editor-icon-${e.isFullscreen ? "suoxiao" : "fangda"}`
124
+ }, null)])]), o("div", {
125
+ class: `${s}-modal-close`,
126
+ onClick: (a) => {
127
+ a.stopPropagation(), e.onClose && e.onClose();
128
+ }
129
+ }, [o("svg", {
130
+ class: `${s}-icon`,
131
+ "aria-hidden": "true"
132
+ }, [o("use", {
133
+ "xlink:href": "#md-editor-icon-close"
134
+ }, null)])])])])]);
135
+ };
136
+ }
137
+ });
138
+ m.install = (e) => (e.component(m.name, m), e);
139
+ export {
140
+ m as default
141
+ };
@@ -1,7 +1,7 @@
1
1
  import { M as x } from "./chunks/index.mjs";
2
2
  import "vue";
3
3
  import "./chunks/config.mjs";
4
- import "./chunks/index4.mjs";
4
+ import "./chunks/index3.mjs";
5
5
  import "./chunks/dom.mjs";
6
6
  import "@vavt/util";
7
7
  import "medium-zoom";
@@ -1,9 +1,101 @@
1
- import { M as e } from "./chunks/index3.mjs";
2
- import "vue";
3
- import "./chunks/config.mjs";
4
- import "./chunks/vue-tsx.mjs";
1
+ import { defineComponent as s, createVNode as o, Fragment as d, isVNode as c } from "vue";
2
+ import { p as r } from "./chunks/config.mjs";
3
+ import { g as u } from "./chunks/vue-tsx.mjs";
4
+ import f from "./MdModal.mjs";
5
5
  import "./chunks/dom.mjs";
6
6
  import "@vavt/util";
7
+ function m(t) {
8
+ return typeof t == "function" || Object.prototype.toString.call(t) === "[object Object]" && !c(t);
9
+ }
10
+ const g = {
11
+ title: {
12
+ type: String,
13
+ default: ""
14
+ },
15
+ modalTitle: {
16
+ type: String,
17
+ default: ""
18
+ },
19
+ visible: {
20
+ type: Boolean
21
+ },
22
+ width: {
23
+ type: String,
24
+ default: "auto"
25
+ },
26
+ height: {
27
+ type: String,
28
+ default: "auto"
29
+ },
30
+ // 展示在工具栏的内容,通常是个图标
31
+ trigger: {
32
+ type: [String, Object]
33
+ },
34
+ onClick: {
35
+ type: Function
36
+ },
37
+ onClose: {
38
+ type: Function
39
+ },
40
+ /**
41
+ * 显示全屏按钮
42
+ */
43
+ showAdjust: {
44
+ type: Boolean,
45
+ default: !1
46
+ },
47
+ isFullscreen: {
48
+ type: Boolean,
49
+ default: !1
50
+ },
51
+ onAdjust: {
52
+ type: Function
53
+ },
54
+ /**
55
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
56
+ */
57
+ insert: {
58
+ type: Function
59
+ }
60
+ }, i = /* @__PURE__ */ s({
61
+ name: "ModalToolbar",
62
+ props: g,
63
+ emits: ["onClick", "onClose", "onAdjust"],
64
+ setup(t, e) {
65
+ return () => {
66
+ const a = u({
67
+ props: t,
68
+ ctx: e
69
+ }, "trigger"), n = u({
70
+ props: t,
71
+ ctx: e
72
+ }, "default");
73
+ return o(d, null, [o("div", {
74
+ class: `${r}-toolbar-item`,
75
+ title: t.title,
76
+ onClick: () => {
77
+ t.onClick instanceof Function ? t.onClick() : e.emit("onClick");
78
+ }
79
+ }, [a]), o(f, {
80
+ width: t.width,
81
+ height: t.height,
82
+ title: t.modalTitle,
83
+ visible: t.visible,
84
+ onClose: () => {
85
+ t.onClose instanceof Function ? t.onClose() : e.emit("onClose");
86
+ },
87
+ showAdjust: t.showAdjust,
88
+ isFullscreen: t.isFullscreen,
89
+ onAdjust: (l) => {
90
+ t.onAdjust instanceof Function ? t.onAdjust(l) : e.emit("onAdjust", l);
91
+ }
92
+ }, m(n) ? n : {
93
+ default: () => [n]
94
+ })]);
95
+ };
96
+ }
97
+ });
98
+ i.install = (t) => (t.component(i.name, i), t);
7
99
  export {
8
- e as default
100
+ i as default
9
101
  };
@@ -244,7 +244,8 @@ const a = "md-editor", o = "md-editor-v3", r = "https://at.alicdn.com/t/c/font_2
244
244
  editorConfig: {},
245
245
  codeMirrorExtensions: (i, t) => t,
246
246
  markdownItConfig: () => {
247
- }
247
+ },
248
+ markdownItPlugins: (i) => i
248
249
  }, j = (i) => {
249
250
  if (i)
250
251
  for (const t in i) {