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

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.
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as r, createVNode as l } from "vue";
2
- import { p as a } from "./chunks/config.mjs";
3
- import { g as c } from "./chunks/vue-tsx.mjs";
2
+ import { p as c } from "./chunks/config.mjs";
3
+ import { g as a } from "./chunks/vue-tsx.mjs";
4
4
  const m = {
5
5
  title: {
6
6
  type: String,
@@ -12,6 +12,12 @@ const m = {
12
12
  },
13
13
  onClick: {
14
14
  type: Function
15
+ },
16
+ /**
17
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
18
+ */
19
+ insert: {
20
+ type: Function
15
21
  }
16
22
  }, e = /* @__PURE__ */ r({
17
23
  name: "NormalToolbar",
@@ -19,17 +25,17 @@ const m = {
19
25
  emits: ["onClick"],
20
26
  setup(t, o) {
21
27
  return () => {
22
- const n = c({
28
+ const i = a({
23
29
  props: t,
24
30
  ctx: o
25
31
  }, "trigger");
26
32
  return l("div", {
27
- class: `${a}-toolbar-item`,
33
+ class: `${c}-toolbar-item`,
28
34
  title: t.title,
29
- onClick: (i) => {
30
- t.onClick instanceof Function ? t.onClick(i) : o.emit("onClick", i);
35
+ onClick: (n) => {
36
+ t.onClick instanceof Function ? t.onClick(n) : o.emit("onClick", n);
31
37
  }
32
- }, [n]);
38
+ }, [i]);
33
39
  };
34
40
  }
35
41
  });
@@ -1,6 +1,6 @@
1
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 d } from "./vue-tsx.mjs";
3
+ import { g as u } from "./vue-tsx.mjs";
4
4
  const B = {
5
5
  overlay: {
6
6
  type: [String, Object],
@@ -20,7 +20,7 @@ const B = {
20
20
  type: String,
21
21
  default: "html"
22
22
  }
23
- }, I = /* @__PURE__ */ H({
23
+ }, F = /* @__PURE__ */ H({
24
24
  props: B,
25
25
  setup(e, a) {
26
26
  const i = `${g}-dropdown-hidden`, t = E({
@@ -34,10 +34,10 @@ const B = {
34
34
  const o = r.value, l = n.value;
35
35
  if (!o || !l)
36
36
  return;
37
- const 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;
37
+ const v = o.getBoundingClientRect(), d = o.offsetTop, L = o.offsetLeft, S = v.height, b = v.width, w = ((p = document.querySelector(e.relative)) == null ? void 0 : p.scrollLeft) || 0;
38
38
  t.overlayStyle = {
39
39
  ...t.overlayStyle,
40
- top: u + S + "px",
40
+ top: d + S + "px",
41
41
  left: L - l.offsetWidth / 2 + b / 2 - w + "px"
42
42
  }, e.onChange(!0);
43
43
  }, m = () => {
@@ -57,24 +57,24 @@ const B = {
57
57
  }), $(() => {
58
58
  r.value.removeEventListener("mouseenter", y), r.value.removeEventListener("mouseleave", s), n.value.removeEventListener("mouseenter", m), n.value.removeEventListener("mouseleave", s);
59
59
  }), () => {
60
- const o = d({
60
+ const o = u({
61
61
  ctx: a
62
- }), l = d({
62
+ }), l = u({
63
63
  props: e,
64
64
  ctx: a
65
65
  }, "overlay"), v = O(o instanceof Array ? o[0] : o, {
66
66
  ref: r
67
- }), u = c("div", {
67
+ }), d = c("div", {
68
68
  class: [`${g}-dropdown`, t.overlayClass],
69
69
  style: t.overlayStyle,
70
70
  ref: n
71
71
  }, [c("div", {
72
72
  class: `${g}-dropdown-overlay`
73
73
  }, [l instanceof Array ? l[0] : l])]);
74
- return [v, u];
74
+ return [v, d];
75
75
  };
76
76
  }
77
- }), A = {
77
+ }), I = {
78
78
  title: {
79
79
  type: String,
80
80
  default: ""
@@ -92,22 +92,28 @@ const B = {
92
92
  // 下拉框中的内容
93
93
  overlay: {
94
94
  type: [String, Object]
95
+ },
96
+ /**
97
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
98
+ */
99
+ insert: {
100
+ type: Function
95
101
  }
96
102
  }, f = /* @__PURE__ */ H({
97
103
  name: "DropdownToolbar",
98
- props: A,
104
+ props: I,
99
105
  emits: ["onChange"],
100
106
  setup(e, a) {
101
107
  const i = j("editorId");
102
108
  return () => {
103
- const t = d({
109
+ const t = u({
104
110
  props: e,
105
111
  ctx: a
106
- }, "trigger"), r = d({
112
+ }, "trigger"), r = u({
107
113
  props: e,
108
114
  ctx: a
109
115
  }, "overlay");
110
- return c(I, {
116
+ return c(F, {
111
117
  relative: `#${i}-toolbar-wrapper`,
112
118
  visible: e.visible,
113
119
  onChange: (n) => {
@@ -126,5 +132,5 @@ const B = {
126
132
  f.install = (e) => (e.component(f.name, f), e);
127
133
  export {
128
134
  f as D,
129
- I as a
135
+ F as a
130
136
  };
@@ -55,7 +55,7 @@ const T = {
55
55
  left: "0px",
56
56
  top: "0px"
57
57
  }
58
- }), j = P(() => e.isFullscreen ? {
58
+ }), F = P(() => e.isFullscreen ? {
59
59
  width: "100%",
60
60
  height: "100%"
61
61
  } : {
@@ -74,8 +74,8 @@ const T = {
74
74
  });
75
75
  }), v(() => e.visible, (s) => {
76
76
  s ? (o.value.push("zoom-in"), c.value = s, S(() => {
77
- const i = d.value.offsetWidth / 2, u = d.value.offsetHeight / 2, F = document.documentElement.clientWidth / 2, k = document.documentElement.clientHeight / 2;
78
- l.initPos.left = F - i + "px", l.initPos.top = k - u + "px";
77
+ const i = d.value.offsetWidth / 2, u = d.value.offsetHeight / 2, j = document.documentElement.clientWidth / 2, k = document.documentElement.clientHeight / 2;
78
+ l.initPos.left = j - i + "px", l.initPos.top = k - u + "px";
79
79
  }), setTimeout(() => {
80
80
  o.value = o.value.filter((i) => i !== "zoom-in");
81
81
  }, 140)) : (o.value.push("zoom-out"), setTimeout(() => {
@@ -100,7 +100,7 @@ const T = {
100
100
  class: o.value,
101
101
  style: {
102
102
  ...l.initPos,
103
- ...j.value
103
+ ...F.value
104
104
  },
105
105
  ref: d
106
106
  }, [t("div", {
@@ -140,7 +140,7 @@ const T = {
140
140
  function M(e) {
141
141
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !x(e);
142
142
  }
143
- const z = {
143
+ const p = {
144
144
  title: {
145
145
  type: String,
146
146
  default: ""
@@ -183,10 +183,16 @@ const z = {
183
183
  },
184
184
  onAdjust: {
185
185
  type: Function
186
+ },
187
+ /**
188
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
189
+ */
190
+ insert: {
191
+ type: Function
186
192
  }
187
193
  }, g = /* @__PURE__ */ C({
188
194
  name: "ModalToolbar",
189
- props: z,
195
+ props: p,
190
196
  emits: ["onClick", "onClose", "onAdjust"],
191
197
  setup(e, a) {
192
198
  return () => {
package/lib/es/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
- import { default as v } from "./MdEditor.mjs";
2
- import { M as E } from "./chunks/index.mjs";
3
- import { default as P } from "./NormalToolbar.mjs";
4
- import { D as j } from "./chunks/index2.mjs";
5
- import { M as q } from "./chunks/index3.mjs";
6
- import { default as z } from "./MdCatalog.mjs";
7
- import { c as B } from "./chunks/config.mjs";
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
- j as DropdownToolbar,
30
- z as MdCatalog,
31
- v as MdEditor,
32
- E as MdPreview,
33
- q as ModalToolbar,
34
- P as NormalToolbar,
35
- B as config
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
  };
@@ -16,6 +16,12 @@ declare const _default: import("vue").DefineComponent<{
16
16
  overlay: {
17
17
  type: PropType<string | JSX.Element>;
18
18
  };
19
+ /**
20
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
21
+ */
22
+ insert: {
23
+ type: PropType<() => void>;
24
+ };
19
25
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], "onChange", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
20
26
  title: {
21
27
  type: PropType<string>;
@@ -33,6 +39,12 @@ declare const _default: import("vue").DefineComponent<{
33
39
  overlay: {
34
40
  type: PropType<string | JSX.Element>;
35
41
  };
42
+ /**
43
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
44
+ */
45
+ insert: {
46
+ type: PropType<() => void>;
47
+ };
36
48
  }>> & {
37
49
  onOnChange?: ((...args: any[]) => any) | undefined;
38
50
  }, {
@@ -22,6 +22,9 @@ declare const _default: {
22
22
  overlay: {
23
23
  type: import("vue").PropType<string | JSX.Element>;
24
24
  };
25
+ insert: {
26
+ type: import("vue").PropType<() => void>;
27
+ };
25
28
  }>> & {
26
29
  onOnChange?: ((...args: any[]) => any) | undefined;
27
30
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "title">;
@@ -55,6 +58,9 @@ declare const _default: {
55
58
  overlay: {
56
59
  type: import("vue").PropType<string | JSX.Element>;
57
60
  };
61
+ insert: {
62
+ type: import("vue").PropType<() => void>;
63
+ };
58
64
  }>> & {
59
65
  onOnChange?: ((...args: any[]) => any) | undefined;
60
66
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], string, {
@@ -96,6 +102,9 @@ declare const _default: {
96
102
  overlay: {
97
103
  type: import("vue").PropType<string | JSX.Element>;
98
104
  };
105
+ insert: {
106
+ type: import("vue").PropType<() => void>;
107
+ };
99
108
  }>> & {
100
109
  onOnChange?: ((...args: any[]) => any) | undefined;
101
110
  } & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & import("vue").ComponentCustomProperties & {};
@@ -119,6 +128,9 @@ declare const _default: {
119
128
  overlay: {
120
129
  type: import("vue").PropType<string | JSX.Element>;
121
130
  };
131
+ insert: {
132
+ type: import("vue").PropType<() => void>;
133
+ };
122
134
  }>> & {
123
135
  onOnChange?: ((...args: any[]) => any) | undefined;
124
136
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], "onChange", {
@@ -1,3 +1,4 @@
1
+ import { VNode } from 'vue';
1
2
  import { ToolbarNames } from '../../type';
2
3
  declare const _default: import("vue").DefineComponent<{
3
4
  noPrettier: {
@@ -32,7 +33,7 @@ declare const _default: import("vue").DefineComponent<{
32
33
  default: () => number[];
33
34
  };
34
35
  defToolbars: {
35
- type: import("vue").PropType<import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
+ type: import("vue").PropType<VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
37
  [key: string]: any;
37
38
  }>>;
38
39
  };
@@ -72,7 +73,7 @@ declare const _default: import("vue").DefineComponent<{
72
73
  default: () => number[];
73
74
  };
74
75
  defToolbars: {
75
- type: import("vue").PropType<import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
76
+ type: import("vue").PropType<VNode<import("vue").RendererNode, import("vue").RendererElement, {
76
77
  [key: string]: any;
77
78
  }>>;
78
79
  };
@@ -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>;
@@ -42,6 +42,12 @@ declare const _default: import("vue").DefineComponent<{
42
42
  onAdjust: {
43
43
  type: PropType<(val: boolean) => void>;
44
44
  };
45
+ /**
46
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
47
+ */
48
+ insert: {
49
+ type: PropType<() => void>;
50
+ };
45
51
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("onClick" | "onClose" | "onAdjust")[], "onClick" | "onClose" | "onAdjust", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
46
52
  title: {
47
53
  type: PropType<string>;
@@ -85,6 +91,12 @@ declare const _default: import("vue").DefineComponent<{
85
91
  onAdjust: {
86
92
  type: PropType<(val: boolean) => void>;
87
93
  };
94
+ /**
95
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
96
+ */
97
+ insert: {
98
+ type: PropType<() => void>;
99
+ };
88
100
  }>> & {
89
101
  onOnClick?: ((...args: any[]) => any) | undefined;
90
102
  onOnClose?: ((...args: any[]) => any) | undefined;
@@ -50,6 +50,9 @@ declare const _default: {
50
50
  onAdjust: {
51
51
  type: import("vue").PropType<(val: boolean) => void>;
52
52
  };
53
+ insert: {
54
+ type: import("vue").PropType<() => void>;
55
+ };
53
56
  }>> & {
54
57
  onOnClick?: ((...args: any[]) => any) | undefined;
55
58
  onOnClose?: ((...args: any[]) => any) | undefined;
@@ -108,6 +111,9 @@ declare const _default: {
108
111
  onAdjust: {
109
112
  type: import("vue").PropType<(val: boolean) => void>;
110
113
  };
114
+ insert: {
115
+ type: import("vue").PropType<() => void>;
116
+ };
111
117
  }>> & {
112
118
  onOnClick?: ((...args: any[]) => any) | undefined;
113
119
  onOnClose?: ((...args: any[]) => any) | undefined;
@@ -179,6 +185,9 @@ declare const _default: {
179
185
  onAdjust: {
180
186
  type: import("vue").PropType<(val: boolean) => void>;
181
187
  };
188
+ insert: {
189
+ type: import("vue").PropType<() => void>;
190
+ };
182
191
  }>> & {
183
192
  onOnClick?: ((...args: any[]) => any) | undefined;
184
193
  onOnClose?: ((...args: any[]) => any) | undefined;
@@ -227,6 +236,9 @@ declare const _default: {
227
236
  onAdjust: {
228
237
  type: import("vue").PropType<(val: boolean) => void>;
229
238
  };
239
+ insert: {
240
+ type: import("vue").PropType<() => void>;
241
+ };
230
242
  }>> & {
231
243
  onOnClick?: ((...args: any[]) => any) | undefined;
232
244
  onOnClose?: ((...args: any[]) => any) | undefined;
@@ -10,6 +10,12 @@ declare const _default: import("vue").DefineComponent<{
10
10
  onClick: {
11
11
  type: PropType<(e: MouseEvent) => void>;
12
12
  };
13
+ /**
14
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
15
+ */
16
+ insert: {
17
+ type: PropType<() => void>;
18
+ };
13
19
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
14
20
  title: {
15
21
  type: PropType<string>;
@@ -21,6 +27,12 @@ declare const _default: import("vue").DefineComponent<{
21
27
  onClick: {
22
28
  type: PropType<(e: MouseEvent) => void>;
23
29
  };
30
+ /**
31
+ * 没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
32
+ */
33
+ insert: {
34
+ type: PropType<() => void>;
35
+ };
24
36
  }>> & {
25
37
  onOnClick?: ((...args: any[]) => any) | undefined;
26
38
  }, {
@@ -16,6 +16,9 @@ declare const _default: {
16
16
  onClick: {
17
17
  type: import("vue").PropType<(e: MouseEvent) => void>;
18
18
  };
19
+ insert: {
20
+ type: import("vue").PropType<() => void>;
21
+ };
19
22
  }>> & {
20
23
  onOnClick?: ((...args: any[]) => any) | undefined;
21
24
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "title">;
@@ -43,6 +46,9 @@ declare const _default: {
43
46
  onClick: {
44
47
  type: import("vue").PropType<(e: MouseEvent) => void>;
45
48
  };
49
+ insert: {
50
+ type: import("vue").PropType<() => void>;
51
+ };
46
52
  }>> & {
47
53
  onOnClick?: ((...args: any[]) => any) | undefined;
48
54
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], string, {
@@ -78,6 +84,9 @@ declare const _default: {
78
84
  onClick: {
79
85
  type: import("vue").PropType<(e: MouseEvent) => void>;
80
86
  };
87
+ insert: {
88
+ type: import("vue").PropType<() => void>;
89
+ };
81
90
  }>> & {
82
91
  onOnClick?: ((...args: any[]) => any) | undefined;
83
92
  } & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & import("vue").ComponentCustomProperties & {};
@@ -95,6 +104,9 @@ declare const _default: {
95
104
  onClick: {
96
105
  type: import("vue").PropType<(e: MouseEvent) => void>;
97
106
  };
107
+ insert: {
108
+ type: import("vue").PropType<() => void>;
109
+ };
98
110
  }>> & {
99
111
  onOnClick?: ((...args: any[]) => any) | undefined;
100
112
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", {