md-editor-v3 5.0.2 → 5.1.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.
@@ -6,7 +6,11 @@ const props = {
6
6
  type: String,
7
7
  default: ""
8
8
  },
9
- // 展示在工具栏的内容,通常是个图标
9
+ /**
10
+ * 展示在工具栏的内容,通常是个图标
11
+ *
12
+ * @deprecated 使用默认插槽代替
13
+ */
10
14
  trigger: {
11
15
  type: [String, Object],
12
16
  default: void 0
@@ -37,6 +41,10 @@ const props = {
37
41
  codeTheme: {
38
42
  type: String,
39
43
  default: void 0
44
+ },
45
+ disabled: {
46
+ type: Boolean,
47
+ default: void 0
40
48
  }
41
49
  /**
42
50
  * ==结束
@@ -52,6 +60,10 @@ const NormalToolbar = /* @__PURE__ */ defineComponent({
52
60
  props: props2,
53
61
  ctx
54
62
  }, "trigger");
63
+ const Default = getSlot({
64
+ props: props2,
65
+ ctx
66
+ });
55
67
  return createVNode("div", {
56
68
  "class": `${prefix}-toolbar-item`,
57
69
  "title": props2.title,
@@ -62,7 +74,7 @@ const NormalToolbar = /* @__PURE__ */ defineComponent({
62
74
  ctx.emit("onClick", e);
63
75
  }
64
76
  }
65
- }, [Trigger]);
77
+ }, [Default || Trigger]);
66
78
  };
67
79
  }
68
80
  });
@@ -1372,6 +1372,10 @@ const useProvidePreview = (props, rootRef) => {
1372
1372
  };
1373
1373
  const useProvide = (props, rootRef) => {
1374
1374
  provide("tabWidth", props.tabWidth);
1375
+ provide(
1376
+ "disabled",
1377
+ computed(() => props.disabled)
1378
+ );
1375
1379
  return useProvidePreview(props, rootRef);
1376
1380
  };
1377
1381
  const useExpansion = (props) => {
@@ -1502,7 +1506,7 @@ const useConfig = (props, context, options) => {
1502
1506
  });
1503
1507
  return [setting, updateSetting];
1504
1508
  };
1505
- const useCatalog = (props, options) => {
1509
+ const useCatalog = (_props, options) => {
1506
1510
  const { editorId } = options;
1507
1511
  const catalogShow = ref(false);
1508
1512
  onMounted(() => {
@@ -1517,10 +1521,7 @@ const useCatalog = (props, options) => {
1517
1521
  }
1518
1522
  });
1519
1523
  });
1520
- const catalogVisible = computed(() => {
1521
- return !props.toolbarsExclude.includes("catalog") && props.toolbars.includes("catalog") && catalogShow.value;
1522
- });
1523
- return catalogVisible;
1524
+ return catalogShow;
1524
1525
  };
1525
1526
  const useExpose$1 = (props, ctx, options) => {
1526
1527
  const { editorId, catalogVisible, setting, updateSetting, codeRef } = options;
@@ -19,6 +19,10 @@ const props$1 = {
19
19
  relative: {
20
20
  type: String,
21
21
  default: "html"
22
+ },
23
+ disabled: {
24
+ type: Boolean,
25
+ default: void 0
22
26
  }
23
27
  };
24
28
  const Dropdown = /* @__PURE__ */ defineComponent({
@@ -36,6 +40,9 @@ const Dropdown = /* @__PURE__ */ defineComponent({
36
40
  const overlayRef = ref();
37
41
  const triggerHandler = () => {
38
42
  var _a, _b;
43
+ if (props2.disabled) {
44
+ return false;
45
+ }
39
46
  ctl.triggerHover = true;
40
47
  const triggerEle = triggerRef.value;
41
48
  const overlayEle = overlayRef.value;
@@ -65,6 +72,9 @@ const Dropdown = /* @__PURE__ */ defineComponent({
65
72
  props2.onChange(true);
66
73
  };
67
74
  const overlayHandler = () => {
75
+ if (props2.disabled) {
76
+ return false;
77
+ }
68
78
  ctl.overlayHover = true;
69
79
  };
70
80
  watch(() => props2.visible, (newV) => {
@@ -132,7 +142,11 @@ const props = {
132
142
  type: Boolean,
133
143
  default: void 0
134
144
  },
135
- // 展示在工具栏的内容,通常是个图标
145
+ /**
146
+ * 展示在工具栏的内容,通常是个图标
147
+ *
148
+ * @deprecated 使用默认插槽代替
149
+ */
136
150
  trigger: {
137
151
  type: [String, Object],
138
152
  default: void 0
@@ -169,13 +183,13 @@ const props = {
169
183
  type: String,
170
184
  default: void 0
171
185
  },
186
+ disabled: {
187
+ type: Boolean,
188
+ default: void 0
189
+ }
172
190
  /**
173
191
  * ==结束
174
192
  */
175
- default: {
176
- type: [String, Object],
177
- default: void 0
178
- }
179
193
  };
180
194
  const DropdownToolbar = /* @__PURE__ */ defineComponent({
181
195
  name: "DropdownToolbar",
@@ -211,7 +225,7 @@ const DropdownToolbar = /* @__PURE__ */ defineComponent({
211
225
  default: () => [createVNode("div", {
212
226
  "class": `${prefix}-toolbar-item`,
213
227
  "title": props2.title || ""
214
- }, [Trigger, Default])]
228
+ }, [Default || Trigger])]
215
229
  });
216
230
  };
217
231
  }
@@ -2,7 +2,7 @@ import { createVNode, defineComponent, h, inject, ref, shallowRef, reactive, com
2
2
  import { p as prefix, d as configOption } from "./config.mjs";
3
3
  import { g as getSlot } from "./vue-tsx.mjs";
4
4
  import { k as keyMove } from "./dom.mjs";
5
- import { Bold, Underline, Italic, Strikethrough, Heading, Subscript, Superscript, Quote, List, ListOrdered, ListTodo, Code, SquareCode, Link, Image, Table, Reply, Forward, Save, Minimize2, Maximize2, Shrink, Expand, View, Eye, CodeXml, ListTree, ChartArea, SquareSigma, X, Trash2, Upload, CircleChevronDown } from "lucide-vue-next";
5
+ import { Bold, Underline, Italic, Strikethrough, Heading, Subscript, Superscript, Quote, List, ListOrdered, ListTodo, Code, SquareCode, Link, Image, Table, Reply, Forward, Save, Minimize2, Maximize2, Shrink, Expand, View, Eye, CodeXml, ListTree, ChartArea, SquareSigma, X, Trash2, Upload } from "lucide-vue-next";
6
6
  import { c as getZIndexIncrement } from "./index5.mjs";
7
7
  const Github = () => createVNode("svg", {
8
8
  "xmlns": "http://www.w3.org/2000/svg",
@@ -52,8 +52,7 @@ const iconMaps = {
52
52
  formula: SquareSigma,
53
53
  close: X,
54
54
  delete: Trash2,
55
- upload: Upload,
56
- "collapse-tips": CircleChevronDown
55
+ upload: Upload
57
56
  };
58
57
  const Icon$1 = /* @__PURE__ */ defineComponent({
59
58
  name: `${prefix}-icon-set`,
@@ -96,7 +95,7 @@ const Icon = /* @__PURE__ */ defineComponent({
96
95
  });
97
96
  const props = {
98
97
  title: {
99
- type: String,
98
+ type: [String, Object],
100
99
  default: ""
101
100
  },
102
101
  visible: {
package/lib/es/index.mjs CHANGED
@@ -34,7 +34,25 @@ const props = {
34
34
  onClick: {
35
35
  type: Function,
36
36
  default: void 0
37
+ },
38
+ /**
39
+ * ==没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
40
+ */
41
+ language: {
42
+ type: String,
43
+ default: void 0
44
+ },
45
+ theme: {
46
+ type: String,
47
+ default: void 0
48
+ },
49
+ disabled: {
50
+ type: Boolean,
51
+ default: void 0
37
52
  }
53
+ /**
54
+ * ==结束
55
+ */
38
56
  };
39
57
  const NormalFooterToolbar = /* @__PURE__ */ defineComponent({
40
58
  name: "NormalFooterToolbar",
package/lib/style.css CHANGED
@@ -671,4 +671,6 @@
671
671
  width: auto !important;
672
672
  height: auto !important;
673
673
  z-index: 10000;
674
+ }.md-editor-disabled {
675
+ cursor: not-allowed !important;
674
676
  }
@@ -2,10 +2,10 @@ import { VNode } from 'vue';
2
2
  import { Themes } from '../MdEditor/type';
3
3
  declare const _default: import("vue").DefineComponent<{
4
4
  readonly title: string;
5
- readonly default: string | Element | undefined;
6
5
  readonly onChange: ((visible: boolean) => void) | undefined;
7
6
  readonly insert: (() => void) | undefined;
8
7
  readonly language: string | undefined;
8
+ readonly disabled: boolean | undefined;
9
9
  readonly theme: Themes | undefined;
10
10
  readonly previewTheme: string | undefined;
11
11
  readonly codeTheme: string | undefined;
@@ -18,10 +18,10 @@ declare const _default: import("vue").DefineComponent<{
18
18
  }> | undefined;
19
19
  }, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onChange"[], "onChange", import("vue").PublicProps, Readonly<{
20
20
  readonly title: string;
21
- readonly default: string | Element | undefined;
22
21
  readonly onChange: ((visible: boolean) => void) | undefined;
23
22
  readonly insert: (() => void) | undefined;
24
23
  readonly language: string | undefined;
24
+ readonly disabled: boolean | undefined;
25
25
  readonly theme: Themes | undefined;
26
26
  readonly previewTheme: string | undefined;
27
27
  readonly codeTheme: string | undefined;
@@ -35,11 +35,11 @@ declare const _default: import("vue").DefineComponent<{
35
35
  }> & Readonly<{
36
36
  onOnChange?: ((...args: any[]) => any) | undefined;
37
37
  }>, {
38
- default: string | Element;
39
38
  title: string;
40
39
  onChange: (visible: boolean) => void;
41
40
  insert: () => void;
42
41
  language: string;
42
+ disabled: boolean;
43
43
  theme: Themes;
44
44
  previewTheme: string;
45
45
  codeTheme: string;
@@ -240,14 +240,9 @@ declare const Editor: import("vue").DefineComponent<{
240
240
  [key: string | number | symbol]: any;
241
241
  };
242
242
  } | undefined;
243
- "collapse-tips"?: {
244
- component: import("vue").Component | import("vue").VNode | string;
245
- props?: {
246
- [key: string | number | symbol]: any;
247
- };
248
- } | undefined;
249
243
  } & {
250
244
  copy?: string;
245
+ 'collapse-tips'?: string;
251
246
  };
252
247
  readonly sanitizeMermaid: (h: string) => Promise<string>;
253
248
  readonly codeFoldable: boolean;
@@ -515,14 +510,9 @@ declare const Editor: import("vue").DefineComponent<{
515
510
  [key: string | number | symbol]: any;
516
511
  };
517
512
  } | undefined;
518
- "collapse-tips"?: {
519
- component: import("vue").Component | import("vue").VNode | string;
520
- props?: {
521
- [key: string | number | symbol]: any;
522
- };
523
- } | undefined;
524
513
  } & {
525
514
  copy?: string;
515
+ 'collapse-tips'?: string;
526
516
  };
527
517
  readonly sanitizeMermaid: (h: string) => Promise<string>;
528
518
  readonly codeFoldable: boolean;
@@ -1,11 +1,14 @@
1
1
  declare const _default: import("vue").DefineComponent<{
2
2
  readonly onChange: (checked: boolean) => void;
3
3
  readonly checked: boolean;
4
+ readonly disabled: boolean | undefined;
4
5
  }, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
5
6
  readonly onChange: (checked: boolean) => void;
6
7
  readonly checked: boolean;
8
+ readonly disabled: boolean | undefined;
7
9
  }> & Readonly<{}>, {
8
10
  onChange: (checked: boolean) => void;
11
+ disabled: boolean;
9
12
  checked: boolean;
10
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
11
14
  export default _default;
@@ -6,6 +6,7 @@ declare const _default: import("vue").DefineComponent<{
6
6
  }>;
7
7
  readonly visible: boolean;
8
8
  readonly relative: string;
9
+ readonly disabled: boolean | undefined;
9
10
  }, () => VNode<unknown, unknown, {
10
11
  [key: string]: any;
11
12
  }>[], {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
@@ -15,8 +16,10 @@ declare const _default: import("vue").DefineComponent<{
15
16
  }>;
16
17
  readonly visible: boolean;
17
18
  readonly relative: string;
19
+ readonly disabled: boolean | undefined;
18
20
  }> & Readonly<{}>, {
19
21
  onChange: (v: boolean) => void;
22
+ disabled: boolean;
20
23
  overlay: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
24
  [key: string]: any;
22
25
  }>;
@@ -1,5 +1,5 @@
1
1
  import { PropType } from 'vue';
2
- export type IconName = 'bold' | 'underline' | 'italic' | 'strike-through' | 'title' | 'sub' | 'sup' | 'quote' | 'unordered-list' | 'ordered-list' | 'task' | 'code-row' | 'code' | 'link' | 'image' | 'table' | 'revoke' | 'next' | 'save' | 'prettier' | 'minimize' | 'maximize' | 'fullscreen-exit' | 'fullscreen' | 'preview-only' | 'preview' | 'preview-html' | 'catalog' | 'github' | 'mermaid' | 'formula' | 'close' | 'delete' | 'upload' | 'collapse-tips';
2
+ export type IconName = 'bold' | 'underline' | 'italic' | 'strike-through' | 'title' | 'sub' | 'sup' | 'quote' | 'unordered-list' | 'ordered-list' | 'task' | 'code-row' | 'code' | 'link' | 'image' | 'table' | 'revoke' | 'next' | 'save' | 'prettier' | 'minimize' | 'maximize' | 'fullscreen-exit' | 'fullscreen' | 'preview-only' | 'preview' | 'preview-html' | 'catalog' | 'github' | 'mermaid' | 'formula' | 'close' | 'delete' | 'upload';
3
3
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
4
  name: {
5
5
  type: PropType<IconName>;
@@ -1,6 +1,8 @@
1
- import { CSSProperties } from 'vue';
1
+ import { CSSProperties, VNode } from 'vue';
2
2
  declare const _default: import("vue").DefineComponent<{
3
- readonly title: string;
3
+ readonly title: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
4
+ [key: string]: any;
5
+ }>;
4
6
  readonly style: string | CSSProperties;
5
7
  readonly height: string;
6
8
  readonly width: string;
@@ -12,7 +14,9 @@ declare const _default: import("vue").DefineComponent<{
12
14
  readonly class: string | undefined;
13
15
  readonly onClose: (() => void) | undefined;
14
16
  }, () => "" | import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClose"[], "onClose", import("vue").PublicProps, Readonly<{
15
- readonly title: string;
17
+ readonly title: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
18
+ [key: string]: any;
19
+ }>;
16
20
  readonly style: string | CSSProperties;
17
21
  readonly height: string;
18
22
  readonly width: string;
@@ -26,7 +30,9 @@ declare const _default: import("vue").DefineComponent<{
26
30
  }> & Readonly<{
27
31
  onOnClose?: ((...args: any[]) => any) | undefined;
28
32
  }>, {
29
- title: string;
33
+ title: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
34
+ [key: string]: any;
35
+ }>;
30
36
  style: string | CSSProperties;
31
37
  class: string;
32
38
  height: string;
@@ -62,9 +62,9 @@ export declare const useConfig: (props: EditorProps, context: EditorContext, opt
62
62
  * @param props
63
63
  * @returns
64
64
  */
65
- export declare const useCatalog: (props: EditorProps, options: {
65
+ export declare const useCatalog: (_props: EditorProps, options: {
66
66
  editorId: string;
67
- }) => import("vue").ComputedRef<boolean>;
67
+ }) => Ref<boolean, boolean>;
68
68
  /**
69
69
  * 向外暴露属性
70
70
  *
@@ -474,4 +474,5 @@ export type CustomIcon = {
474
474
  };
475
475
  } & {
476
476
  copy?: string;
477
+ 'collapse-tips'?: string;
477
478
  };
@@ -221,14 +221,9 @@ declare const MdPreview: import("vue").DefineComponent<{
221
221
  [key: string | number | symbol]: any;
222
222
  };
223
223
  } | undefined;
224
- "collapse-tips"?: {
225
- component: import("vue").Component | import("vue").VNode | string;
226
- props?: {
227
- [key: string | number | symbol]: any;
228
- };
229
- } | undefined;
230
224
  } & {
231
225
  copy?: string;
226
+ 'collapse-tips'?: string;
232
227
  };
233
228
  readonly sanitizeMermaid: (h: string) => Promise<string>;
234
229
  readonly codeFoldable: boolean;
@@ -461,14 +456,9 @@ declare const MdPreview: import("vue").DefineComponent<{
461
456
  [key: string | number | symbol]: any;
462
457
  };
463
458
  } | undefined;
464
- "collapse-tips"?: {
465
- component: import("vue").Component | import("vue").VNode | string;
466
- props?: {
467
- [key: string | number | symbol]: any;
468
- };
469
- } | undefined;
470
459
  } & {
471
460
  copy?: string;
461
+ 'collapse-tips'?: string;
472
462
  };
473
463
  readonly sanitizeMermaid: (h: string) => Promise<string>;
474
464
  readonly codeFoldable: boolean;
@@ -7,13 +7,16 @@ declare const _default: import("vue").DefineComponent<{
7
7
  readonly showAdjust: boolean;
8
8
  readonly isFullscreen: boolean;
9
9
  readonly showMask: boolean;
10
- readonly modalTitle: string;
10
+ readonly modalTitle: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
11
+ [key: string]: any;
12
+ }>;
11
13
  readonly style: string | CSSProperties | undefined;
12
14
  readonly onClick: (() => void) | undefined;
13
15
  readonly class: string | undefined;
14
16
  readonly onClose: (() => void) | undefined;
15
17
  readonly insert: (() => void) | undefined;
16
18
  readonly language: string | undefined;
19
+ readonly disabled: boolean | undefined;
17
20
  readonly theme: Themes | undefined;
18
21
  readonly previewTheme: string | undefined;
19
22
  readonly codeTheme: string | undefined;
@@ -29,13 +32,16 @@ declare const _default: import("vue").DefineComponent<{
29
32
  readonly showAdjust: boolean;
30
33
  readonly isFullscreen: boolean;
31
34
  readonly showMask: boolean;
32
- readonly modalTitle: string;
35
+ readonly modalTitle: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
36
+ [key: string]: any;
37
+ }>;
33
38
  readonly style: string | CSSProperties | undefined;
34
39
  readonly onClick: (() => void) | undefined;
35
40
  readonly class: string | undefined;
36
41
  readonly onClose: (() => void) | undefined;
37
42
  readonly insert: (() => void) | undefined;
38
43
  readonly language: string | undefined;
44
+ readonly disabled: boolean | undefined;
39
45
  readonly theme: Themes | undefined;
40
46
  readonly previewTheme: string | undefined;
41
47
  readonly codeTheme: string | undefined;
@@ -58,6 +64,7 @@ declare const _default: import("vue").DefineComponent<{
58
64
  onClose: () => void;
59
65
  insert: () => void;
60
66
  language: string;
67
+ disabled: boolean;
61
68
  theme: Themes;
62
69
  previewTheme: string;
63
70
  codeTheme: string;
@@ -69,6 +76,8 @@ declare const _default: import("vue").DefineComponent<{
69
76
  trigger: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
70
77
  [key: string]: any;
71
78
  }>;
72
- modalTitle: string;
79
+ modalTitle: string | VNode<import("vue").RendererNode, import("vue").RendererElement, {
80
+ [key: string]: any;
81
+ }>;
73
82
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
74
83
  export default _default;
@@ -1,10 +1,20 @@
1
+ import { Themes } from '../MdEditor/type';
1
2
  declare const _default: import("vue").DefineComponent<{
2
3
  readonly onClick: ((e: MouseEvent) => void) | undefined;
4
+ readonly language: string | undefined;
5
+ readonly disabled: boolean | undefined;
6
+ readonly theme: Themes | undefined;
3
7
  }, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", import("vue").PublicProps, Readonly<{
4
8
  readonly onClick: ((e: MouseEvent) => void) | undefined;
9
+ readonly language: string | undefined;
10
+ readonly disabled: boolean | undefined;
11
+ readonly theme: Themes | undefined;
5
12
  }> & Readonly<{
6
13
  onOnClick?: ((...args: any[]) => any) | undefined;
7
14
  }>, {
8
15
  onClick: (e: MouseEvent) => void;
16
+ language: string;
17
+ disabled: boolean;
18
+ theme: Themes;
9
19
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
20
  export default _default;
@@ -5,6 +5,7 @@ declare const _default: import("vue").DefineComponent<{
5
5
  readonly onClick: ((e: MouseEvent) => void) | undefined;
6
6
  readonly insert: (() => void) | undefined;
7
7
  readonly language: string | undefined;
8
+ readonly disabled: boolean | undefined;
8
9
  readonly theme: Themes | undefined;
9
10
  readonly previewTheme: string | undefined;
10
11
  readonly codeTheme: string | undefined;
@@ -16,6 +17,7 @@ declare const _default: import("vue").DefineComponent<{
16
17
  readonly onClick: ((e: MouseEvent) => void) | undefined;
17
18
  readonly insert: (() => void) | undefined;
18
19
  readonly language: string | undefined;
20
+ readonly disabled: boolean | undefined;
19
21
  readonly theme: Themes | undefined;
20
22
  readonly previewTheme: string | undefined;
21
23
  readonly codeTheme: string | undefined;
@@ -29,6 +31,7 @@ declare const _default: import("vue").DefineComponent<{
29
31
  onClick: (e: MouseEvent) => void;
30
32
  insert: () => void;
31
33
  language: string;
34
+ disabled: boolean;
32
35
  theme: Themes;
33
36
  previewTheme: string;
34
37
  codeTheme: string;