md-editor-v3 5.3.0 → 5.3.1

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.
@@ -3186,39 +3186,33 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
3186
3186
  ctx.emit("update:modelValue", value);
3187
3187
  },
3188
3188
  "onChange": (value) => {
3189
- if (props2.onChange) {
3190
- props2.onChange(value);
3191
- }
3189
+ var _a;
3190
+ (_a = props2.onChange) == null ? void 0 : _a.call(props2, value);
3192
3191
  ctx.emit("onChange", value);
3193
3192
  },
3194
3193
  "onHtmlChanged": (html) => {
3195
- if (props2.onHtmlChanged) {
3196
- props2.onHtmlChanged(html);
3197
- }
3194
+ var _a;
3195
+ (_a = props2.onHtmlChanged) == null ? void 0 : _a.call(props2, html);
3198
3196
  ctx.emit("onHtmlChanged", html);
3199
3197
  },
3200
3198
  "onGetCatalog": (list) => {
3201
- if (props2.onGetCatalog) {
3202
- props2.onGetCatalog(list);
3203
- }
3199
+ var _a;
3200
+ (_a = props2.onGetCatalog) == null ? void 0 : _a.call(props2, list);
3204
3201
  ctx.emit("onGetCatalog", list);
3205
3202
  },
3206
3203
  "onBlur": (e) => {
3207
- if (props2.onBlur) {
3208
- props2.onBlur(e);
3209
- }
3204
+ var _a;
3205
+ (_a = props2.onBlur) == null ? void 0 : _a.call(props2, e);
3210
3206
  ctx.emit("onBlur", e);
3211
3207
  },
3212
3208
  "onFocus": (e) => {
3213
- if (props2.onFocus) {
3214
- props2.onFocus(e);
3215
- }
3209
+ var _a;
3210
+ (_a = props2.onFocus) == null ? void 0 : _a.call(props2, e);
3216
3211
  ctx.emit("onFocus", e);
3217
3212
  },
3218
3213
  "onInput": (e) => {
3219
- if (props2.onInput) {
3220
- props2.onInput(e);
3221
- }
3214
+ var _a;
3215
+ (_a = props2.onInput) == null ? void 0 : _a.call(props2, e);
3222
3216
  ctx.emit("onInput", e);
3223
3217
  },
3224
3218
  "completions": props2.completions,
@@ -3226,16 +3220,14 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
3226
3220
  "theme": props2.theme,
3227
3221
  "noImgZoomIn": props2.noImgZoomIn,
3228
3222
  "onDrop": (e) => {
3229
- if (props2.onDrop) {
3230
- props2.onDrop(e);
3231
- }
3223
+ var _a;
3224
+ (_a = props2.onDrop) == null ? void 0 : _a.call(props2, e);
3232
3225
  ctx.emit("onDrop", e);
3233
3226
  },
3234
3227
  "inputBoxWidth": props2.inputBoxWidth,
3235
3228
  "oninputBoxWidthChange": (width) => {
3236
- if (props2.oninputBoxWidthChange) {
3237
- props2.oninputBoxWidthChange(width);
3238
- }
3229
+ var _a;
3230
+ (_a = props2.oninputBoxWidthChange) == null ? void 0 : _a.call(props2, width);
3239
3231
  ctx.emit("oninputBoxWidthChange", width);
3240
3232
  },
3241
3233
  "sanitizeMermaid": props2.sanitizeMermaid,
@@ -3243,9 +3235,8 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
3243
3235
  "codeFoldable": props2.codeFoldable,
3244
3236
  "autoFoldThreshold": props2.autoFoldThreshold,
3245
3237
  "onRemount": () => {
3246
- if (props2.onRemount) {
3247
- props2.onRemount();
3248
- }
3238
+ var _a;
3239
+ (_a = props2.onRemount) == null ? void 0 : _a.call(props2);
3249
3240
  ctx.emit("onRemount");
3250
3241
  },
3251
3242
  "catalogLayout": props2.catalogLayout
@@ -138,20 +138,16 @@ const ModalToolbar = /* @__PURE__ */ vue.defineComponent({
138
138
  "visible": props2.visible,
139
139
  "showMask": props2.showMask,
140
140
  "onClose": () => {
141
- if (props2.onClose instanceof Function) {
142
- props2.onClose();
143
- } else {
144
- ctx.emit("onClose");
145
- }
141
+ var _a;
142
+ (_a = props2.onClose) == null ? void 0 : _a.call(props2);
143
+ ctx.emit("onClose");
146
144
  },
147
145
  "showAdjust": props2.showAdjust,
148
146
  "isFullscreen": props2.isFullscreen,
149
147
  "onAdjust": (v) => {
150
- if (props2.onAdjust instanceof Function) {
151
- props2.onAdjust(v);
152
- } else {
153
- ctx.emit("onAdjust", v);
154
- }
148
+ var _a;
149
+ (_a = props2.onAdjust) == null ? void 0 : _a.call(props2, v);
150
+ ctx.emit("onAdjust", v);
155
151
  }
156
152
  }, _isSlot(Default) ? Default : {
157
153
  default: () => [Default]
@@ -2277,25 +2277,20 @@ const MdPreview = /* @__PURE__ */ vue.defineComponent({
2277
2277
  }, [vue.createVNode(ContentPreview, {
2278
2278
  "modelValue": props.modelValue,
2279
2279
  "onChange": (value) => {
2280
- if (props.onChange) {
2281
- props.onChange(value);
2282
- }
2280
+ var _a;
2281
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
2283
2282
  ctx.emit("onChange", value);
2284
2283
  ctx.emit("update:modelValue", value);
2285
2284
  },
2286
2285
  "onHtmlChanged": (html) => {
2287
- if (props.onHtmlChanged) {
2288
- props.onHtmlChanged(html);
2289
- } else {
2290
- ctx.emit("onHtmlChanged", html);
2291
- }
2286
+ var _a;
2287
+ (_a = props.onHtmlChanged) == null ? void 0 : _a.call(props, html);
2288
+ ctx.emit("onHtmlChanged", html);
2292
2289
  },
2293
2290
  "onGetCatalog": (list) => {
2294
- if (props.onGetCatalog) {
2295
- props.onGetCatalog(list);
2296
- } else {
2297
- ctx.emit("onGetCatalog", list);
2298
- }
2291
+ var _a;
2292
+ (_a = props.onGetCatalog) == null ? void 0 : _a.call(props, list);
2293
+ ctx.emit("onGetCatalog", list);
2299
2294
  },
2300
2295
  "mdHeadingId": props.mdHeadingId,
2301
2296
  "noMermaid": noMermaid,
@@ -2308,7 +2303,11 @@ const MdPreview = /* @__PURE__ */ vue.defineComponent({
2308
2303
  "sanitizeMermaid": props.sanitizeMermaid,
2309
2304
  "codeFoldable": props.codeFoldable,
2310
2305
  "autoFoldThreshold": props.autoFoldThreshold,
2311
- "onRemount": props.onRemount
2306
+ "onRemount": () => {
2307
+ var _a;
2308
+ (_a = props.onRemount) == null ? void 0 : _a.call(props);
2309
+ ctx.emit("onRemount");
2310
+ }
2312
2311
  }, null)]);
2313
2312
  };
2314
2313
  }
@@ -219,11 +219,9 @@ const DropdownToolbar = /* @__PURE__ */ vue.defineComponent({
219
219
  "relative": `#${editorId}-toolbar-wrapper`,
220
220
  "visible": props2.visible,
221
221
  "onChange": (v) => {
222
- if (props2.onChange instanceof Function) {
223
- props2.onChange(v);
224
- } else {
225
- ctx.emit("onChange", v);
226
- }
222
+ var _a;
223
+ (_a = props2.onChange) == null ? void 0 : _a.call(props2, v);
224
+ ctx.emit("onChange", v);
227
225
  },
228
226
  "overlay": Overlay,
229
227
  "disabled": props2.disabled
@@ -560,12 +560,10 @@ const MdCatalog = /* @__PURE__ */ vue.defineComponent({
560
560
  state.list = list;
561
561
  };
562
562
  const onActive = (tocItem, ele) => {
563
+ var _a;
563
564
  indicatorStyles.value.top = ele.offsetTop + getComputedStyleNum(ele, "padding-top") + "px";
564
- if (props2.onActive) {
565
- props2.onActive(tocItem, ele);
566
- } else {
567
- ctx.emit("onActive", tocItem, ele);
568
- }
565
+ (_a = props2.onActive) == null ? void 0 : _a.call(props2, tocItem, ele);
566
+ ctx.emit("onActive", tocItem, ele);
569
567
  };
570
568
  const scrollHandler = () => {
571
569
  findActiveHeading(state.list);
@@ -623,9 +621,8 @@ const MdCatalog = /* @__PURE__ */ vue.defineComponent({
623
621
  "key": `link-${item.level}-${item.text}`,
624
622
  "onActive": onActive,
625
623
  "onClick": (e, t) => {
626
- if (props2.onClick) {
627
- props2.onClick(e, t);
628
- }
624
+ var _a;
625
+ (_a = props2.onClick) == null ? void 0 : _a.call(props2, e, t);
629
626
  ctx.emit("onClick", e, t);
630
627
  },
631
628
  "scrollElementOffsetTop": props2.scrollElementOffsetTop
@@ -270,11 +270,9 @@ const MdModal = /* @__PURE__ */ vue.defineComponent({
270
270
  "class": `${config.prefix}-modal-mask`,
271
271
  "style": state.maskStyle,
272
272
  "onClick": () => {
273
- if (props2.onClose) {
274
- props2.onClose();
275
- } else {
276
- ctx.emit("onClose");
277
- }
273
+ var _a;
274
+ (_a = props2.onClose) == null ? void 0 : _a.call(props2);
275
+ ctx.emit("onClose");
278
276
  }
279
277
  }, null), vue.createVNode("div", {
280
278
  "class": modalClass.value,
@@ -311,12 +309,10 @@ const MdModal = /* @__PURE__ */ vue.defineComponent({
311
309
  }, null)]), vue.createVNode("div", {
312
310
  "class": `${config.prefix}-modal-close`,
313
311
  "onClick": (e) => {
312
+ var _a;
314
313
  e.stopPropagation();
315
- if (props2.onClose) {
316
- props2.onClose();
317
- } else {
318
- ctx.emit("onClose");
319
- }
314
+ (_a = props2.onClose) == null ? void 0 : _a.call(props2);
315
+ ctx.emit("onClose");
320
316
  }
321
317
  }, [vue.createVNode(Icon, {
322
318
  "name": "close"
@@ -3185,39 +3185,33 @@ const Editor = /* @__PURE__ */ defineComponent({
3185
3185
  ctx.emit("update:modelValue", value);
3186
3186
  },
3187
3187
  "onChange": (value) => {
3188
- if (props2.onChange) {
3189
- props2.onChange(value);
3190
- }
3188
+ var _a;
3189
+ (_a = props2.onChange) == null ? void 0 : _a.call(props2, value);
3191
3190
  ctx.emit("onChange", value);
3192
3191
  },
3193
3192
  "onHtmlChanged": (html) => {
3194
- if (props2.onHtmlChanged) {
3195
- props2.onHtmlChanged(html);
3196
- }
3193
+ var _a;
3194
+ (_a = props2.onHtmlChanged) == null ? void 0 : _a.call(props2, html);
3197
3195
  ctx.emit("onHtmlChanged", html);
3198
3196
  },
3199
3197
  "onGetCatalog": (list) => {
3200
- if (props2.onGetCatalog) {
3201
- props2.onGetCatalog(list);
3202
- }
3198
+ var _a;
3199
+ (_a = props2.onGetCatalog) == null ? void 0 : _a.call(props2, list);
3203
3200
  ctx.emit("onGetCatalog", list);
3204
3201
  },
3205
3202
  "onBlur": (e) => {
3206
- if (props2.onBlur) {
3207
- props2.onBlur(e);
3208
- }
3203
+ var _a;
3204
+ (_a = props2.onBlur) == null ? void 0 : _a.call(props2, e);
3209
3205
  ctx.emit("onBlur", e);
3210
3206
  },
3211
3207
  "onFocus": (e) => {
3212
- if (props2.onFocus) {
3213
- props2.onFocus(e);
3214
- }
3208
+ var _a;
3209
+ (_a = props2.onFocus) == null ? void 0 : _a.call(props2, e);
3215
3210
  ctx.emit("onFocus", e);
3216
3211
  },
3217
3212
  "onInput": (e) => {
3218
- if (props2.onInput) {
3219
- props2.onInput(e);
3220
- }
3213
+ var _a;
3214
+ (_a = props2.onInput) == null ? void 0 : _a.call(props2, e);
3221
3215
  ctx.emit("onInput", e);
3222
3216
  },
3223
3217
  "completions": props2.completions,
@@ -3225,16 +3219,14 @@ const Editor = /* @__PURE__ */ defineComponent({
3225
3219
  "theme": props2.theme,
3226
3220
  "noImgZoomIn": props2.noImgZoomIn,
3227
3221
  "onDrop": (e) => {
3228
- if (props2.onDrop) {
3229
- props2.onDrop(e);
3230
- }
3222
+ var _a;
3223
+ (_a = props2.onDrop) == null ? void 0 : _a.call(props2, e);
3231
3224
  ctx.emit("onDrop", e);
3232
3225
  },
3233
3226
  "inputBoxWidth": props2.inputBoxWidth,
3234
3227
  "oninputBoxWidthChange": (width) => {
3235
- if (props2.oninputBoxWidthChange) {
3236
- props2.oninputBoxWidthChange(width);
3237
- }
3228
+ var _a;
3229
+ (_a = props2.oninputBoxWidthChange) == null ? void 0 : _a.call(props2, width);
3238
3230
  ctx.emit("oninputBoxWidthChange", width);
3239
3231
  },
3240
3232
  "sanitizeMermaid": props2.sanitizeMermaid,
@@ -3242,9 +3234,8 @@ const Editor = /* @__PURE__ */ defineComponent({
3242
3234
  "codeFoldable": props2.codeFoldable,
3243
3235
  "autoFoldThreshold": props2.autoFoldThreshold,
3244
3236
  "onRemount": () => {
3245
- if (props2.onRemount) {
3246
- props2.onRemount();
3247
- }
3237
+ var _a;
3238
+ (_a = props2.onRemount) == null ? void 0 : _a.call(props2);
3248
3239
  ctx.emit("onRemount");
3249
3240
  },
3250
3241
  "catalogLayout": props2.catalogLayout
@@ -137,20 +137,16 @@ const ModalToolbar = /* @__PURE__ */ defineComponent({
137
137
  "visible": props2.visible,
138
138
  "showMask": props2.showMask,
139
139
  "onClose": () => {
140
- if (props2.onClose instanceof Function) {
141
- props2.onClose();
142
- } else {
143
- ctx.emit("onClose");
144
- }
140
+ var _a;
141
+ (_a = props2.onClose) == null ? void 0 : _a.call(props2);
142
+ ctx.emit("onClose");
145
143
  },
146
144
  "showAdjust": props2.showAdjust,
147
145
  "isFullscreen": props2.isFullscreen,
148
146
  "onAdjust": (v) => {
149
- if (props2.onAdjust instanceof Function) {
150
- props2.onAdjust(v);
151
- } else {
152
- ctx.emit("onAdjust", v);
153
- }
147
+ var _a;
148
+ (_a = props2.onAdjust) == null ? void 0 : _a.call(props2, v);
149
+ ctx.emit("onAdjust", v);
154
150
  }
155
151
  }, _isSlot(Default) ? Default : {
156
152
  default: () => [Default]
@@ -2276,25 +2276,20 @@ const MdPreview = /* @__PURE__ */ defineComponent({
2276
2276
  }, [createVNode(ContentPreview, {
2277
2277
  "modelValue": props.modelValue,
2278
2278
  "onChange": (value) => {
2279
- if (props.onChange) {
2280
- props.onChange(value);
2281
- }
2279
+ var _a;
2280
+ (_a = props.onChange) == null ? void 0 : _a.call(props, value);
2282
2281
  ctx.emit("onChange", value);
2283
2282
  ctx.emit("update:modelValue", value);
2284
2283
  },
2285
2284
  "onHtmlChanged": (html) => {
2286
- if (props.onHtmlChanged) {
2287
- props.onHtmlChanged(html);
2288
- } else {
2289
- ctx.emit("onHtmlChanged", html);
2290
- }
2285
+ var _a;
2286
+ (_a = props.onHtmlChanged) == null ? void 0 : _a.call(props, html);
2287
+ ctx.emit("onHtmlChanged", html);
2291
2288
  },
2292
2289
  "onGetCatalog": (list) => {
2293
- if (props.onGetCatalog) {
2294
- props.onGetCatalog(list);
2295
- } else {
2296
- ctx.emit("onGetCatalog", list);
2297
- }
2290
+ var _a;
2291
+ (_a = props.onGetCatalog) == null ? void 0 : _a.call(props, list);
2292
+ ctx.emit("onGetCatalog", list);
2298
2293
  },
2299
2294
  "mdHeadingId": props.mdHeadingId,
2300
2295
  "noMermaid": noMermaid,
@@ -2307,7 +2302,11 @@ const MdPreview = /* @__PURE__ */ defineComponent({
2307
2302
  "sanitizeMermaid": props.sanitizeMermaid,
2308
2303
  "codeFoldable": props.codeFoldable,
2309
2304
  "autoFoldThreshold": props.autoFoldThreshold,
2310
- "onRemount": props.onRemount
2305
+ "onRemount": () => {
2306
+ var _a;
2307
+ (_a = props.onRemount) == null ? void 0 : _a.call(props);
2308
+ ctx.emit("onRemount");
2309
+ }
2311
2310
  }, null)]);
2312
2311
  };
2313
2312
  }
@@ -218,11 +218,9 @@ const DropdownToolbar = /* @__PURE__ */ defineComponent({
218
218
  "relative": `#${editorId}-toolbar-wrapper`,
219
219
  "visible": props2.visible,
220
220
  "onChange": (v) => {
221
- if (props2.onChange instanceof Function) {
222
- props2.onChange(v);
223
- } else {
224
- ctx.emit("onChange", v);
225
- }
221
+ var _a;
222
+ (_a = props2.onChange) == null ? void 0 : _a.call(props2, v);
223
+ ctx.emit("onChange", v);
226
224
  },
227
225
  "overlay": Overlay,
228
226
  "disabled": props2.disabled
@@ -559,12 +559,10 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
559
559
  state.list = list;
560
560
  };
561
561
  const onActive = (tocItem, ele) => {
562
+ var _a;
562
563
  indicatorStyles.value.top = ele.offsetTop + getComputedStyleNum(ele, "padding-top") + "px";
563
- if (props2.onActive) {
564
- props2.onActive(tocItem, ele);
565
- } else {
566
- ctx.emit("onActive", tocItem, ele);
567
- }
564
+ (_a = props2.onActive) == null ? void 0 : _a.call(props2, tocItem, ele);
565
+ ctx.emit("onActive", tocItem, ele);
568
566
  };
569
567
  const scrollHandler = () => {
570
568
  findActiveHeading(state.list);
@@ -622,9 +620,8 @@ const MdCatalog = /* @__PURE__ */ defineComponent({
622
620
  "key": `link-${item.level}-${item.text}`,
623
621
  "onActive": onActive,
624
622
  "onClick": (e, t) => {
625
- if (props2.onClick) {
626
- props2.onClick(e, t);
627
- }
623
+ var _a;
624
+ (_a = props2.onClick) == null ? void 0 : _a.call(props2, e, t);
628
625
  ctx.emit("onClick", e, t);
629
626
  },
630
627
  "scrollElementOffsetTop": props2.scrollElementOffsetTop
@@ -269,11 +269,9 @@ const MdModal = /* @__PURE__ */ defineComponent({
269
269
  "class": `${prefix}-modal-mask`,
270
270
  "style": state.maskStyle,
271
271
  "onClick": () => {
272
- if (props2.onClose) {
273
- props2.onClose();
274
- } else {
275
- ctx.emit("onClose");
276
- }
272
+ var _a;
273
+ (_a = props2.onClose) == null ? void 0 : _a.call(props2);
274
+ ctx.emit("onClose");
277
275
  }
278
276
  }, null), createVNode("div", {
279
277
  "class": modalClass.value,
@@ -310,12 +308,10 @@ const MdModal = /* @__PURE__ */ defineComponent({
310
308
  }, null)]), createVNode("div", {
311
309
  "class": `${prefix}-modal-close`,
312
310
  "onClick": (e) => {
311
+ var _a;
313
312
  e.stopPropagation();
314
- if (props2.onClose) {
315
- props2.onClose();
316
- } else {
317
- ctx.emit("onClose");
318
- }
313
+ (_a = props2.onClose) == null ? void 0 : _a.call(props2);
314
+ ctx.emit("onClose");
319
315
  }
320
316
  }, [createVNode(Icon, {
321
317
  "name": "close"