md-editor-v3 5.0.2-0 → 5.1.0-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.
@@ -969,7 +969,6 @@ const useMarkdownIt = (props, previewOnly) => {
969
969
  });
970
970
  });
971
971
  };
972
- vue.onMounted(updatedTodo);
973
972
  const markHtml = () => {
974
973
  headsRef.value = [];
975
974
  html.value = props.sanitize(md.render(props.modelValue));
@@ -978,10 +977,15 @@ const useMarkdownIt = (props, previewOnly) => {
978
977
  const needReRender = vue.computed(() => {
979
978
  return (props.noKatex || katexRef.value) && (props.noHighlight || hljsRef.value);
980
979
  });
981
- vue.watch(
982
- [vue.toRef(props, "modelValue"), needReRender, reRenderRef, languageRef],
983
- util.debounce(markHtml, previewOnly ? 0 : editorConfig.renderDelay)
984
- );
980
+ let timer = -1;
981
+ vue.watch([vue.toRef(props, "modelValue"), needReRender, reRenderRef, languageRef], () => {
982
+ timer = window.setTimeout(
983
+ () => {
984
+ markHtml();
985
+ },
986
+ previewOnly ? 0 : editorConfig.renderDelay
987
+ );
988
+ });
985
989
  vue.watch(
986
990
  () => props.setting.preview,
987
991
  () => {
@@ -997,6 +1001,7 @@ const useMarkdownIt = (props, previewOnly) => {
997
1001
  }
998
1002
  }
999
1003
  );
1004
+ vue.onMounted(updatedTodo);
1000
1005
  vue.onMounted(() => {
1001
1006
  eventName.bus.on(editorId, {
1002
1007
  name: eventName.PUSH_CATALOG,
@@ -1012,6 +1017,9 @@ const useMarkdownIt = (props, previewOnly) => {
1012
1017
  }
1013
1018
  });
1014
1019
  });
1020
+ vue.onBeforeUnmount(() => {
1021
+ clearTimeout(timer);
1022
+ });
1015
1023
  return { html, key };
1016
1024
  };
1017
1025
  const template = {
@@ -1365,6 +1373,10 @@ const useProvidePreview = (props, rootRef) => {
1365
1373
  };
1366
1374
  const useProvide = (props, rootRef) => {
1367
1375
  vue.provide("tabWidth", props.tabWidth);
1376
+ vue.provide(
1377
+ "disabled",
1378
+ vue.computed(() => props.disabled)
1379
+ );
1368
1380
  return useProvidePreview(props, rootRef);
1369
1381
  };
1370
1382
  const useExpansion = (props) => {
@@ -1495,7 +1507,7 @@ const useConfig = (props, context, options) => {
1495
1507
  });
1496
1508
  return [setting, updateSetting];
1497
1509
  };
1498
- const useCatalog = (props, options) => {
1510
+ const useCatalog = (_props, options) => {
1499
1511
  const { editorId } = options;
1500
1512
  const catalogShow = vue.ref(false);
1501
1513
  vue.onMounted(() => {
@@ -1510,10 +1522,7 @@ const useCatalog = (props, options) => {
1510
1522
  }
1511
1523
  });
1512
1524
  });
1513
- const catalogVisible = vue.computed(() => {
1514
- return !props.toolbarsExclude.includes("catalog") && props.toolbars.includes("catalog") && catalogShow.value;
1515
- });
1516
- return catalogVisible;
1525
+ return catalogShow;
1517
1526
  };
1518
1527
  const useExpose$1 = (props, ctx, options) => {
1519
1528
  const { editorId, catalogVisible, setting, updateSetting, codeRef } = options;
@@ -20,6 +20,10 @@ const props$1 = {
20
20
  relative: {
21
21
  type: String,
22
22
  default: "html"
23
+ },
24
+ disabled: {
25
+ type: Boolean,
26
+ default: void 0
23
27
  }
24
28
  };
25
29
  const Dropdown = /* @__PURE__ */ vue.defineComponent({
@@ -37,6 +41,9 @@ const Dropdown = /* @__PURE__ */ vue.defineComponent({
37
41
  const overlayRef = vue.ref();
38
42
  const triggerHandler = () => {
39
43
  var _a, _b;
44
+ if (props2.disabled) {
45
+ return false;
46
+ }
40
47
  ctl.triggerHover = true;
41
48
  const triggerEle = triggerRef.value;
42
49
  const overlayEle = overlayRef.value;
@@ -66,6 +73,9 @@ const Dropdown = /* @__PURE__ */ vue.defineComponent({
66
73
  props2.onChange(true);
67
74
  };
68
75
  const overlayHandler = () => {
76
+ if (props2.disabled) {
77
+ return false;
78
+ }
69
79
  ctl.overlayHover = true;
70
80
  };
71
81
  vue.watch(() => props2.visible, (newV) => {
@@ -133,7 +143,11 @@ const props = {
133
143
  type: Boolean,
134
144
  default: void 0
135
145
  },
136
- // 展示在工具栏的内容,通常是个图标
146
+ /**
147
+ * 展示在工具栏的内容,通常是个图标
148
+ *
149
+ * @deprecated 使用默认插槽代替
150
+ */
137
151
  trigger: {
138
152
  type: [String, Object],
139
153
  default: void 0
@@ -170,13 +184,13 @@ const props = {
170
184
  type: String,
171
185
  default: void 0
172
186
  },
187
+ disabled: {
188
+ type: Boolean,
189
+ default: void 0
190
+ }
173
191
  /**
174
192
  * ==结束
175
193
  */
176
- default: {
177
- type: [String, Object],
178
- default: void 0
179
- }
180
194
  };
181
195
  const DropdownToolbar = /* @__PURE__ */ vue.defineComponent({
182
196
  name: "DropdownToolbar",
@@ -212,7 +226,7 @@ const DropdownToolbar = /* @__PURE__ */ vue.defineComponent({
212
226
  default: () => [vue.createVNode("div", {
213
227
  "class": `${config.prefix}-toolbar-item`,
214
228
  "title": props2.title || ""
215
- }, [Trigger, Default])]
229
+ }, [Default || Trigger])]
216
230
  });
217
231
  };
218
232
  }
@@ -53,8 +53,7 @@ const iconMaps = {
53
53
  formula: lucideVueNext.SquareSigma,
54
54
  close: lucideVueNext.X,
55
55
  delete: lucideVueNext.Trash2,
56
- upload: lucideVueNext.Upload,
57
- "collapse-tips": lucideVueNext.CircleChevronDown
56
+ upload: lucideVueNext.Upload
58
57
  };
59
58
  const Icon$1 = /* @__PURE__ */ vue.defineComponent({
60
59
  name: `${config.prefix}-icon-set`,
@@ -97,7 +96,7 @@ const Icon = /* @__PURE__ */ vue.defineComponent({
97
96
  });
98
97
  const props = {
99
98
  title: {
100
- type: String,
99
+ type: [String, Object],
101
100
  default: ""
102
101
  },
103
102
  visible: {
package/lib/cjs/index.cjs 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__ */ vue.defineComponent({
40
58
  name: "NormalFooterToolbar",