md-editor-v3 2.7.2 → 2.8.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.
@@ -9,7 +9,7 @@ declare const catalogLinkProps: () => {
9
9
  };
10
10
  markedHeadingId: {
11
11
  type: PropType<MarkedHeadingId>;
12
- default: () => () => void;
12
+ default: () => void;
13
13
  };
14
14
  scrollElement: {
15
15
  type: PropType<string | Element>;
@@ -17,7 +17,7 @@ declare const catalogLinkProps: () => {
17
17
  };
18
18
  onClick: {
19
19
  type: PropType<(e: MouseEvent, t: TocItem) => void>;
20
- default: () => () => void;
20
+ default: () => void;
21
21
  };
22
22
  scrollElementOffsetTop: {
23
23
  type: PropType<number>;
@@ -32,7 +32,7 @@ declare const CatalogLink: import("vue").DefineComponent<{
32
32
  };
33
33
  markedHeadingId: {
34
34
  type: PropType<MarkedHeadingId>;
35
- default: () => () => void;
35
+ default: () => void;
36
36
  };
37
37
  scrollElement: {
38
38
  type: PropType<string | Element>;
@@ -40,7 +40,7 @@ declare const CatalogLink: import("vue").DefineComponent<{
40
40
  };
41
41
  onClick: {
42
42
  type: PropType<(e: MouseEvent, t: TocItem) => void>;
43
- default: () => () => void;
43
+ default: () => void;
44
44
  };
45
45
  scrollElementOffsetTop: {
46
46
  type: PropType<number>;
@@ -53,7 +53,7 @@ declare const CatalogLink: import("vue").DefineComponent<{
53
53
  };
54
54
  markedHeadingId: {
55
55
  type: PropType<MarkedHeadingId>;
56
- default: () => () => void;
56
+ default: () => void;
57
57
  };
58
58
  scrollElement: {
59
59
  type: PropType<string | Element>;
@@ -61,7 +61,7 @@ declare const CatalogLink: import("vue").DefineComponent<{
61
61
  };
62
62
  onClick: {
63
63
  type: PropType<(e: MouseEvent, t: TocItem) => void>;
64
- default: () => () => void;
64
+ default: () => void;
65
65
  };
66
66
  scrollElementOffsetTop: {
67
67
  type: PropType<number>;
@@ -53,6 +53,10 @@ declare const MdCatalog: import("vue").DefineComponent<{
53
53
  type: PropType<number>;
54
54
  default: number;
55
55
  };
56
+ onClick: {
57
+ type: PropType<(e: MouseEvent, t: TocItem) => void>;
58
+ default: () => void;
59
+ };
56
60
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, "onClick"[], "onClick", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
57
61
  /**
58
62
  * 编辑器的Id,务必与需要绑定的编辑器Id相同
@@ -99,12 +103,17 @@ declare const MdCatalog: import("vue").DefineComponent<{
99
103
  type: PropType<number>;
100
104
  default: number;
101
105
  };
106
+ onClick: {
107
+ type: PropType<(e: MouseEvent, t: TocItem) => void>;
108
+ default: () => void;
109
+ };
102
110
  }>> & {
103
111
  onOnClick?: ((...args: any[]) => any) | undefined;
104
112
  }, {
105
113
  theme: Themes;
106
114
  class: string;
107
115
  markedHeadingId: MarkedHeadingId;
116
+ onClick: (e: MouseEvent, t: TocItem) => void;
108
117
  offsetTop: number;
109
118
  scrollElementOffsetTop: number;
110
119
  }>;
@@ -1083,7 +1083,7 @@ const dropdownToolbarProps$1 = () => ({
1083
1083
  },
1084
1084
  onChange: {
1085
1085
  type: Function,
1086
- default: () => () => {
1086
+ default: () => {
1087
1087
  }
1088
1088
  },
1089
1089
  relative: {
@@ -1217,7 +1217,7 @@ const modalProps = () => ({
1217
1217
  },
1218
1218
  onClose: {
1219
1219
  type: Function,
1220
- default: () => () => {
1220
+ default: () => {
1221
1221
  }
1222
1222
  },
1223
1223
  showAdjust: {
@@ -1230,7 +1230,7 @@ const modalProps = () => ({
1230
1230
  },
1231
1231
  onAdjust: {
1232
1232
  type: Function,
1233
- default: () => () => {
1233
+ default: () => {
1234
1234
  }
1235
1235
  },
1236
1236
  class: {
@@ -1384,12 +1384,12 @@ const linkProps = () => ({
1384
1384
  },
1385
1385
  onCancel: {
1386
1386
  type: Function,
1387
- default: () => () => {
1387
+ default: () => {
1388
1388
  }
1389
1389
  },
1390
1390
  onOk: {
1391
1391
  type: Function,
1392
- default: () => () => {
1392
+ default: () => {
1393
1393
  }
1394
1394
  }
1395
1395
  });
@@ -1484,12 +1484,12 @@ const clipProps = () => ({
1484
1484
  },
1485
1485
  onCancel: {
1486
1486
  type: Function,
1487
- default: () => () => {
1487
+ default: () => {
1488
1488
  }
1489
1489
  },
1490
1490
  onOk: {
1491
1491
  type: Function,
1492
- default: () => () => {
1492
+ default: () => {
1493
1493
  }
1494
1494
  }
1495
1495
  });
@@ -1655,12 +1655,12 @@ const modalsProps = () => ({
1655
1655
  },
1656
1656
  onCancel: {
1657
1657
  type: Function,
1658
- default: () => () => {
1658
+ default: () => {
1659
1659
  }
1660
1660
  },
1661
1661
  onOk: {
1662
1662
  type: Function,
1663
- default: () => () => {
1663
+ default: () => {
1664
1664
  }
1665
1665
  }
1666
1666
  });
@@ -1682,7 +1682,6 @@ var Modals = defineComponent({
1682
1682
  const useSreenfull = (props) => {
1683
1683
  var _a, _b, _c, _d;
1684
1684
  const editorId = inject("editorId");
1685
- const previewOnly = inject("previewOnly");
1686
1685
  let screenfull = (_b = (_a = configOption.editorExtensions) == null ? void 0 : _a.screenfull) == null ? void 0 : _b.instance;
1687
1686
  const screenfullJs = (_d = (_c = configOption.editorExtensions) == null ? void 0 : _c.screenfull) == null ? void 0 : _d.js;
1688
1687
  const screenfullMe = ref(false);
@@ -1722,7 +1721,7 @@ const useSreenfull = (props) => {
1722
1721
  };
1723
1722
  onMounted(() => {
1724
1723
  onScreenfullEvent();
1725
- if (!previewOnly && !screenfull) {
1724
+ if (!screenfull) {
1726
1725
  const screenScript = document.createElement("script");
1727
1726
  screenScript.src = screenfullJs || screenfullUrl;
1728
1727
  screenScript.onload = screenfullLoad;
@@ -1731,12 +1730,10 @@ const useSreenfull = (props) => {
1731
1730
  }
1732
1731
  });
1733
1732
  onMounted(() => {
1734
- if (!previewOnly) {
1735
- bus.on(editorId, {
1736
- name: CHANGE_FULL_SCREEN,
1737
- callback: fullscreenHandler
1738
- });
1739
- }
1733
+ bus.on(editorId, {
1734
+ name: CHANGE_FULL_SCREEN,
1735
+ callback: fullscreenHandler
1736
+ });
1740
1737
  });
1741
1738
  return { fullscreenHandler };
1742
1739
  };
@@ -1809,7 +1806,7 @@ const toolbarProps = () => ({
1809
1806
  },
1810
1807
  updateSetting: {
1811
1808
  type: Function,
1812
- default: () => () => {
1809
+ default: () => {
1813
1810
  }
1814
1811
  },
1815
1812
  tableShape: {
@@ -5540,14 +5537,14 @@ const alertTypes = [
5540
5537
  "tip",
5541
5538
  "warning"
5542
5539
  ];
5543
- const startReg = new RegExp(`^!!!\\s+(${alertTypes.join("|")})\\s+(.*)$`);
5540
+ const startReg = new RegExp(`^!!!\\s*(${alertTypes.join("|")})\\s*(.*)$`);
5544
5541
  const endReg = /^!!!\s*$/;
5545
5542
  const Alert = {
5546
5543
  name: "alert",
5547
5544
  level: "block",
5548
5545
  start(src) {
5549
5546
  var _a;
5550
- const index2 = (_a = src.match(new RegExp(`(^|[\\r\\n])!!!\\s+(${alertTypes.join("|")})\\s+(.*)`))) == null ? void 0 : _a.index;
5547
+ const index2 = (_a = src.match(new RegExp(`(^|[\\r\\n])!!!\\s*(${alertTypes.join("|")})\\s*(.*)`))) == null ? void 0 : _a.index;
5551
5548
  return index2;
5552
5549
  },
5553
5550
  tokenizer(src) {
@@ -6000,17 +5997,17 @@ ${nextOrder}. `;
6000
5997
  })));
6001
5998
  }
6002
5999
  });
6000
+ bus.on(editorId, {
6001
+ name: "selectTextChange",
6002
+ callback() {
6003
+ selectedText.value = getSelectionText(textAreaRef.value);
6004
+ }
6005
+ });
6003
6006
  }
6004
6007
  });
6005
6008
  watch(() => props.value, () => {
6006
6009
  selectedText.value = "";
6007
6010
  });
6008
- bus.on(editorId, {
6009
- name: "selectTextChange",
6010
- callback() {
6011
- selectedText.value = getSelectionText(textAreaRef.value);
6012
- }
6013
- });
6014
6011
  };
6015
6012
  const useMermaid = (props) => {
6016
6013
  const theme = inject("theme");
@@ -6105,12 +6102,14 @@ const userZoom = (props, html) => {
6105
6102
  };
6106
6103
  const useAttach = (textAreaRef) => {
6107
6104
  const editorId = inject("editorId");
6108
- bus.on(editorId, {
6109
- name: TEXTAREA_FOCUS,
6110
- callback() {
6111
- var _a;
6112
- (_a = textAreaRef.value) == null ? void 0 : _a.focus();
6113
- }
6105
+ onMounted(() => {
6106
+ bus.on(editorId, {
6107
+ name: TEXTAREA_FOCUS,
6108
+ callback() {
6109
+ var _a;
6110
+ (_a = textAreaRef.value) == null ? void 0 : _a.focus();
6111
+ }
6112
+ });
6114
6113
  });
6115
6114
  };
6116
6115
  const contentProps = () => ({
@@ -6120,7 +6119,7 @@ const contentProps = () => ({
6120
6119
  },
6121
6120
  onChange: {
6122
6121
  type: Function,
6123
- default: () => () => {
6122
+ default: () => {
6124
6123
  }
6125
6124
  },
6126
6125
  setting: {
@@ -6129,12 +6128,12 @@ const contentProps = () => ({
6129
6128
  },
6130
6129
  onHtmlChanged: {
6131
6130
  type: Function,
6132
- default: () => () => {
6131
+ default: () => {
6133
6132
  }
6134
6133
  },
6135
6134
  onGetCatalog: {
6136
6135
  type: Function,
6137
- default: () => () => {
6136
+ default: () => {
6138
6137
  }
6139
6138
  },
6140
6139
  markedHeadingId: {
@@ -6273,7 +6272,7 @@ const checkboxProps = () => ({
6273
6272
  },
6274
6273
  onChange: {
6275
6274
  type: Function,
6276
- default: () => () => {
6275
+ default: () => {
6277
6276
  }
6278
6277
  }
6279
6278
  });
@@ -6296,7 +6295,7 @@ const scrollAutoProps = () => ({
6296
6295
  },
6297
6296
  onScrollAutoChange: {
6298
6297
  type: Function,
6299
- default: () => () => {
6298
+ default: () => {
6300
6299
  }
6301
6300
  }
6302
6301
  });
@@ -6334,7 +6333,7 @@ const footerProps = () => ({
6334
6333
  },
6335
6334
  onScrollAutoChange: {
6336
6335
  type: Function,
6337
- default: () => () => {
6336
+ default: () => {
6338
6337
  }
6339
6338
  },
6340
6339
  defFooters: {
@@ -6394,7 +6393,7 @@ const catalogLinkProps = () => ({
6394
6393
  },
6395
6394
  markedHeadingId: {
6396
6395
  type: Function,
6397
- default: () => () => {
6396
+ default: () => {
6398
6397
  }
6399
6398
  },
6400
6399
  scrollElement: {
@@ -6403,7 +6402,7 @@ const catalogLinkProps = () => ({
6403
6402
  },
6404
6403
  onClick: {
6405
6404
  type: Function,
6406
- default: () => () => {
6405
+ default: () => {
6407
6406
  }
6408
6407
  },
6409
6408
  scrollElementOffsetTop: {
@@ -6487,6 +6486,11 @@ const mdCatalogProps = () => ({
6487
6486
  scrollElementOffsetTop: {
6488
6487
  type: Number,
6489
6488
  default: 0
6489
+ },
6490
+ onClick: {
6491
+ type: Function,
6492
+ default: () => {
6493
+ }
6490
6494
  }
6491
6495
  });
6492
6496
  const MdCatalog = defineComponent({
@@ -6601,7 +6605,11 @@ const MdCatalog = defineComponent({
6601
6605
  "key": `link-${item.level}-${item.text}`,
6602
6606
  "scrollElement": state.scrollElement,
6603
6607
  "onClick": (e, t) => {
6604
- ctx.emit("onClick", e, t);
6608
+ if (props.onClick) {
6609
+ props.onClick(e, t);
6610
+ } else {
6611
+ ctx.emit("onClick", e, t);
6612
+ }
6605
6613
  },
6606
6614
  "scrollElementOffsetTop": props.scrollElementOffsetTop
6607
6615
  }, null);
@@ -6773,7 +6781,6 @@ const editorProps = () => ({
6773
6781
  });
6774
6782
  const markedHeadingId = (text) => text;
6775
6783
  var index = "";
6776
- var alert = "";
6777
6784
  var all = "";
6778
6785
  const Editor = defineComponent({
6779
6786
  name: "MdEditorV3",