md-editor-v3 4.21.0 → 5.0.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.
Files changed (79) hide show
  1. package/README.md +3 -3
  2. package/lib/cjs/MdEditor.cjs +123 -53
  3. package/lib/cjs/ModalToolbar.cjs +20 -10
  4. package/lib/cjs/chunks/config.cjs +0 -15
  5. package/lib/cjs/chunks/dom.cjs +6 -2
  6. package/lib/cjs/chunks/index.cjs +174 -1441
  7. package/lib/cjs/chunks/index2.cjs +19 -9
  8. package/lib/cjs/chunks/index3.cjs +58 -28
  9. package/lib/cjs/chunks/index4.cjs +538 -10
  10. package/lib/cjs/chunks/index5.cjs +0 -7
  11. package/lib/cjs/config.cjs +0 -2
  12. package/lib/cjs/index.cjs +1311 -3
  13. package/lib/es/MdEditor.mjs +125 -55
  14. package/lib/es/ModalToolbar.mjs +20 -10
  15. package/lib/es/chunks/config.mjs +4 -19
  16. package/lib/es/chunks/dom.mjs +6 -2
  17. package/lib/es/chunks/index.mjs +181 -1448
  18. package/lib/es/chunks/index2.mjs +19 -9
  19. package/lib/es/chunks/index3.mjs +60 -30
  20. package/lib/es/chunks/index4.mjs +541 -13
  21. package/lib/es/chunks/index5.mjs +2 -9
  22. package/lib/es/config.mjs +3 -5
  23. package/lib/es/index.mjs +1314 -6
  24. package/lib/preview.css +20 -7
  25. package/lib/style.css +20 -7
  26. package/lib/types/DropdownToolbar/DropdownToolbar.d.ts +46 -87
  27. package/lib/types/DropdownToolbar/index.d.ts +2 -171
  28. package/lib/types/MdCatalog/CatalogLink.d.ts +18 -35
  29. package/lib/types/MdCatalog/MdCatalog.d.ts +29 -129
  30. package/lib/types/MdCatalog/index.d.ts +2 -194
  31. package/lib/types/MdEditor/Editor.d.ts +584 -427
  32. package/lib/types/MdEditor/components/Checkbox/index.d.ts +7 -20
  33. package/lib/types/MdEditor/components/Divider/index.d.ts +1 -1
  34. package/lib/types/MdEditor/components/Dropdown/index.d.ts +16 -40
  35. package/lib/types/MdEditor/components/Icon/Github.d.ts +2 -0
  36. package/lib/types/MdEditor/components/Icon/Icon.d.ts +7 -5
  37. package/lib/types/MdEditor/components/Icon/Str.d.ts +2 -1
  38. package/lib/types/MdEditor/components/Icon/index.d.ts +5 -5
  39. package/lib/types/MdEditor/components/Modal/Modal.d.ts +29 -90
  40. package/lib/types/MdEditor/components/Modal/index.d.ts +2 -223
  41. package/lib/types/MdEditor/composition.d.ts +26 -8
  42. package/lib/types/MdEditor/config.d.ts +0 -2
  43. package/lib/types/MdEditor/index.d.ts +2 -1017
  44. package/lib/types/MdEditor/layouts/Content/ContentPreview.d.ts +35 -127
  45. package/lib/types/MdEditor/layouts/Content/composition/useCodeMirror.d.ts +2 -2
  46. package/lib/types/MdEditor/layouts/Content/composition/useHighlight.d.ts +1 -1
  47. package/lib/types/MdEditor/layouts/Content/composition/useKatex.d.ts +1 -1
  48. package/lib/types/MdEditor/layouts/Content/composition/useMarkdownIt.d.ts +2 -2
  49. package/lib/types/MdEditor/layouts/Content/composition/useMermaid.d.ts +2 -2
  50. package/lib/types/MdEditor/layouts/Content/composition/useResize.d.ts +1 -1
  51. package/lib/types/MdEditor/layouts/Content/index.d.ts +73 -255
  52. package/lib/types/MdEditor/layouts/Content/markdownIt/xss/index.d.ts +1 -2
  53. package/lib/types/MdEditor/layouts/Content/props.d.ts +3 -3
  54. package/lib/types/MdEditor/layouts/Footer/MarkdownTotal.d.ts +4 -4
  55. package/lib/types/MdEditor/layouts/Footer/ScrollAuto.d.ts +7 -18
  56. package/lib/types/MdEditor/layouts/Footer/index.d.ts +20 -50
  57. package/lib/types/MdEditor/layouts/Modals/Clip.d.ts +10 -29
  58. package/lib/types/MdEditor/layouts/Modals/Link.d.ts +12 -37
  59. package/lib/types/MdEditor/layouts/Modals/index.d.ts +13 -44
  60. package/lib/types/MdEditor/layouts/Toolbar/TableShape.d.ts +7 -20
  61. package/lib/types/MdEditor/layouts/Toolbar/index.d.ts +31 -93
  62. package/lib/types/MdEditor/layouts/Toolbar/props.d.ts +4 -6
  63. package/lib/types/MdEditor/props.d.ts +66 -24
  64. package/lib/types/MdEditor/type.d.ts +1 -20
  65. package/lib/types/MdEditor/utils/index.d.ts +0 -4
  66. package/lib/types/MdPreview/MdPreview.d.ts +491 -206
  67. package/lib/types/MdPreview/composition/useExpose.d.ts +3 -1
  68. package/lib/types/MdPreview/index.d.ts +2 -538
  69. package/lib/types/ModalToolbar/ModalToolbar.d.ts +57 -143
  70. package/lib/types/ModalToolbar/index.d.ts +2 -309
  71. package/lib/types/NormalFooterToolbar/NormalFooterToolbar.d.ts +7 -10
  72. package/lib/types/NormalFooterToolbar/index.d.ts +2 -37
  73. package/lib/types/NormalToolbar/NormalToolbar.d.ts +21 -53
  74. package/lib/types/NormalToolbar/index.d.ts +2 -115
  75. package/lib/types/config.d.ts +1 -1
  76. package/lib/types/index.d.ts +1 -0
  77. package/lib/umd/index.js +283 -64
  78. package/package.json +21 -28
  79. package/lib/types/MdEditor/components/Popper/index.d.ts +0 -15
package/README.md CHANGED
@@ -154,7 +154,7 @@ Except for the same as `MdPreview`:
154
154
  | autoDetectCode | `boolean` | false | auto detect the type of pasted code, only support that copied from `vscode` |
155
155
  | completions | `Array<CompletionSource>` | [] | `@codemirror/autocomplete` List of function to match keywords |
156
156
  | showToolbarName | `boolean` | false | Show toolbar name or not |
157
- | inputBoxWitdh | `string` | '50%' | Default width of input box |
157
+ | inputBoxWidth | `string` | '50%' | Default width of input box |
158
158
  | transformImgUrl | `(imgUrl: string) => string \| Promise<string>` | t => t | Transform image links |
159
159
 
160
160
  <details>
@@ -326,7 +326,7 @@ Except for the same as `MdPreview`:
326
326
  | onFocus | `event: FocusEvent` | Textarea has received focus |
327
327
  | onInput | `event: Event` | Element gets input |
328
328
  | onDrop | `event: DragEvent` | Selection is being dragged |
329
- | onInputBoxWitdhChange | `(width: string) => void` | Width of input box has been changed |
329
+ | oninputBoxWidthChange | `(width: string) => void` | Width of input box has been changed |
330
330
 
331
331
  ### 🎍 Slots
332
332
 
@@ -877,7 +877,7 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
877
877
  - **events**
878
878
 
879
879
  - `onClick`: `(e: MouseEvent, t: TocItem) => void`, not required, heading was clicked.
880
- - `onActive`: `(heading: HeadList | undefined) => void`, not required, heading was highlighted.
880
+ - `onActive`: `(heading: HeadList | undefined, activeElement: HTMLDivElement) => void`, not required, heading was highlighted.
881
881
 
882
882
  ### 🛸 MdModal
883
883
 
@@ -26,6 +26,7 @@ const vueTsx = require("./chunks/vue-tsx.cjs");
26
26
  const NormalToolbar = require("./NormalToolbar.cjs");
27
27
  const ModalToolbar = require("./ModalToolbar.cjs");
28
28
  const Divider = /* @__PURE__ */ vue.defineComponent({
29
+ name: `${config.prefix}-divider`,
29
30
  setup() {
30
31
  return () => vue.createVNode("div", {
31
32
  "class": `${config.prefix}-divider`
@@ -240,6 +241,7 @@ const props$5 = {
240
241
  }
241
242
  };
242
243
  const LinkModal = /* @__PURE__ */ vue.defineComponent({
244
+ name: `${config.prefix}-modal-link`,
243
245
  props: props$5,
244
246
  setup(props2) {
245
247
  const ult = vue.inject("usedLanguageText");
@@ -339,6 +341,7 @@ const props$4 = {
339
341
  }
340
342
  };
341
343
  const ClipModal = /* @__PURE__ */ vue.defineComponent({
344
+ name: `${config.prefix}-modal-clip`,
342
345
  props: props$4,
343
346
  setup(props2) {
344
347
  const ult = vue.inject("usedLanguageText");
@@ -420,7 +423,7 @@ const ClipModal = /* @__PURE__ */ vue.defineComponent({
420
423
  "height": "421px"
421
424
  }, {
422
425
  default: () => {
423
- var _a2, _b;
426
+ var _a2, _b, _c;
424
427
  return [vue.createVNode("div", {
425
428
  "class": `${config.prefix}-form-item ${config.prefix}-clip`
426
429
  }, [vue.createVNode("div", {
@@ -443,7 +446,10 @@ const ClipModal = /* @__PURE__ */ vue.defineComponent({
443
446
  "class": `${config.prefix}-clip-upload`,
444
447
  "onClick": () => {
445
448
  uploadRef.value.click();
446
- }
449
+ },
450
+ "role": "button",
451
+ "tabindex": "0",
452
+ "aria-label": (_a2 = ult.value.imgTitleItem) == null ? void 0 : _a2.upload
447
453
  }, [vue.createVNode(MdModal.Icon, {
448
454
  "name": "upload"
449
455
  }, null)])]), vue.createVNode("div", {
@@ -463,14 +469,15 @@ const ClipModal = /* @__PURE__ */ vue.defineComponent({
463
469
  reset();
464
470
  }
465
471
  }
466
- }, [((_a2 = ult.value.clipModalTips) == null ? void 0 : _a2.buttonUpload) || ((_b = ult.value.linkModalTips) == null ? void 0 : _b.buttonOK)])]), vue.createVNode("input", {
472
+ }, [((_b = ult.value.clipModalTips) == null ? void 0 : _b.buttonUpload) || ((_c = ult.value.linkModalTips) == null ? void 0 : _c.buttonOK)])]), vue.createVNode("input", {
467
473
  "ref": uploadRef,
468
474
  "accept": "image/*",
469
475
  "type": "file",
470
476
  "multiple": false,
471
477
  "style": {
472
478
  display: "none"
473
- }
479
+ },
480
+ "aria-hidden": "true"
474
481
  }, null)];
475
482
  }
476
483
  });
@@ -502,6 +509,7 @@ const props$3 = {
502
509
  }
503
510
  };
504
511
  const Modals = /* @__PURE__ */ vue.defineComponent({
512
+ name: `${config.prefix}-modals`,
505
513
  props: props$3,
506
514
  setup(props2) {
507
515
  return () => vue.createVNode(vue.Fragment, null, [vue.createVNode(LinkModal, {
@@ -644,37 +652,50 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
644
652
  "class": `${config.prefix}-menu`,
645
653
  "onClick": () => {
646
654
  visible.title = false;
647
- }
655
+ },
656
+ "role": "menu"
648
657
  }, [vue.createVNode("li", {
649
658
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
650
659
  "onClick": () => {
651
660
  emitHandler("h1");
652
- }
661
+ },
662
+ "role": "menuitem",
663
+ "tabindex": "0"
653
664
  }, [(_i = ult.value.titleItem) == null ? void 0 : _i.h1]), vue.createVNode("li", {
654
665
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
655
666
  "onClick": () => {
656
667
  emitHandler("h2");
657
- }
668
+ },
669
+ "role": "menuitem",
670
+ "tabindex": "0"
658
671
  }, [(_j = ult.value.titleItem) == null ? void 0 : _j.h2]), vue.createVNode("li", {
659
672
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
660
673
  "onClick": () => {
661
674
  emitHandler("h3");
662
- }
675
+ },
676
+ "role": "menuitem",
677
+ "tabindex": "0"
663
678
  }, [(_k = ult.value.titleItem) == null ? void 0 : _k.h3]), vue.createVNode("li", {
664
679
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
665
680
  "onClick": () => {
666
681
  emitHandler("h4");
667
- }
682
+ },
683
+ "role": "menuitem",
684
+ "tabindex": "0"
668
685
  }, [(_l = ult.value.titleItem) == null ? void 0 : _l.h4]), vue.createVNode("li", {
669
686
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
670
687
  "onClick": () => {
671
688
  emitHandler("h5");
672
- }
689
+ },
690
+ "role": "menuitem",
691
+ "tabindex": "0"
673
692
  }, [(_m = ult.value.titleItem) == null ? void 0 : _m.h5]), vue.createVNode("li", {
674
693
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
675
694
  "onClick": () => {
676
695
  emitHandler("h6");
677
- }
696
+ },
697
+ "role": "menuitem",
698
+ "tabindex": "0"
678
699
  }, [(_n = ult.value.titleItem) == null ? void 0 : _n.h6])])
679
700
  }, {
680
701
  default: () => {
@@ -830,23 +851,30 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
830
851
  "class": `${config.prefix}-menu`,
831
852
  "onClick": () => {
832
853
  visible.title = false;
833
- }
854
+ },
855
+ "role": "menu"
834
856
  }, [vue.createVNode("li", {
835
857
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-image`,
836
858
  "onClick": () => {
837
859
  modalData.type = "image";
838
860
  modalData.linkVisible = true;
839
- }
861
+ },
862
+ "role": "menuitem",
863
+ "tabindex": "0"
840
864
  }, [(_I = ult.value.imgTitleItem) == null ? void 0 : _I.link]), vue.createVNode("li", {
841
865
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-image`,
842
866
  "onClick": () => {
843
867
  uploadRef.value.click();
844
- }
868
+ },
869
+ "role": "menuitem",
870
+ "tabindex": "0"
845
871
  }, [(_J = ult.value.imgTitleItem) == null ? void 0 : _J.upload]), vue.createVNode("li", {
846
872
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-image`,
847
873
  "onClick": () => {
848
874
  modalData.clipVisible = true;
849
- }
875
+ },
876
+ "role": "menuitem",
877
+ "tabindex": "0"
850
878
  }, [(_K = ult.value.imgTitleItem) == null ? void 0 : _K.clip2upload])])
851
879
  }, {
852
880
  default: () => {
@@ -926,7 +954,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
926
954
  eventName.bus.emit(editorId, eventName.ON_SAVE);
927
955
  }
928
956
  }, [vue.createVNode(MdModal.Icon, {
929
- "name": "baocun"
957
+ "name": "save"
930
958
  }, null), props2.showToolbarName && vue.createVNode("div", {
931
959
  "class": `${config.prefix}-toolbar-item-name`
932
960
  }, [(_Q = ult.value.toolbarTips) == null ? void 0 : _Q.save])]);
@@ -952,7 +980,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
952
980
  props2.updateSetting("pageFullscreen");
953
981
  }
954
982
  }, [vue.createVNode(MdModal.Icon, {
955
- "name": props2.setting.pageFullscreen ? "suoxiao" : "fangda"
983
+ "name": props2.setting.pageFullscreen ? "minimize" : "maximize"
956
984
  }, null), props2.showToolbarName && vue.createVNode("div", {
957
985
  "class": `${config.prefix}-toolbar-item-name`
958
986
  }, [(_U = ult.value.toolbarTips) == null ? void 0 : _U.pageFullscreen])]);
@@ -1004,7 +1032,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1004
1032
  props2.updateSetting("htmlPreview");
1005
1033
  }
1006
1034
  }, [vue.createVNode(MdModal.Icon, {
1007
- "name": "coding"
1035
+ "name": "preview-html"
1008
1036
  }, null), props2.showToolbarName && vue.createVNode("div", {
1009
1037
  "class": `${config.prefix}-toolbar-item-name`
1010
1038
  }, [(_aa = ult.value.toolbarTips) == null ? void 0 : _aa.htmlPreview])]);
@@ -1045,47 +1073,64 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1045
1073
  "class": `${config.prefix}-menu`,
1046
1074
  "onClick": () => {
1047
1075
  visible.mermaid = false;
1048
- }
1076
+ },
1077
+ "role": "menu"
1049
1078
  }, [vue.createVNode("li", {
1050
1079
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1051
1080
  "onClick": () => {
1052
1081
  emitHandler("flow");
1053
- }
1082
+ },
1083
+ "role": "menuitem",
1084
+ "tabindex": "0"
1054
1085
  }, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.flow]), vue.createVNode("li", {
1055
1086
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1056
1087
  "onClick": () => {
1057
1088
  emitHandler("sequence");
1058
- }
1089
+ },
1090
+ "role": "menuitem",
1091
+ "tabindex": "0"
1059
1092
  }, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.sequence]), vue.createVNode("li", {
1060
1093
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1061
1094
  "onClick": () => {
1062
1095
  emitHandler("gantt");
1063
- }
1096
+ },
1097
+ "role": "menuitem",
1098
+ "tabindex": "0"
1064
1099
  }, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.gantt]), vue.createVNode("li", {
1065
1100
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1066
1101
  "onClick": () => {
1067
1102
  emitHandler("class");
1068
- }
1103
+ },
1104
+ "role": "menuitem",
1105
+ "tabindex": "0"
1069
1106
  }, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.class]), vue.createVNode("li", {
1070
1107
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1071
1108
  "onClick": () => {
1072
1109
  emitHandler("state");
1073
- }
1110
+ },
1111
+ "role": "menuitem",
1112
+ "tabindex": "0"
1074
1113
  }, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.state]), vue.createVNode("li", {
1075
1114
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1076
1115
  "onClick": () => {
1077
1116
  emitHandler("pie");
1078
- }
1117
+ },
1118
+ "role": "menuitem",
1119
+ "tabindex": "0"
1079
1120
  }, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.pie]), vue.createVNode("li", {
1080
1121
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1081
1122
  "onClick": () => {
1082
1123
  emitHandler("relationship");
1083
- }
1124
+ },
1125
+ "role": "menuitem",
1126
+ "tabindex": "0"
1084
1127
  }, [(_la = ult.value.mermaid) == null ? void 0 : _la.relationship]), vue.createVNode("li", {
1085
1128
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1086
1129
  "onClick": () => {
1087
1130
  emitHandler("journey");
1088
- }
1131
+ },
1132
+ "role": "menuitem",
1133
+ "tabindex": "0"
1089
1134
  }, [(_ma = ult.value.mermaid) == null ? void 0 : _ma.journey])]),
1090
1135
  "key": "bar-mermaid"
1091
1136
  }, {
@@ -1113,17 +1158,22 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1113
1158
  "class": `${config.prefix}-menu`,
1114
1159
  "onClick": () => {
1115
1160
  visible.katex = false;
1116
- }
1161
+ },
1162
+ "role": "menu"
1117
1163
  }, [vue.createVNode("li", {
1118
1164
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-katex`,
1119
1165
  "onClick": () => {
1120
1166
  emitHandler("katexInline");
1121
- }
1167
+ },
1168
+ "role": "menuitem",
1169
+ "tabindex": "0"
1122
1170
  }, [(_na = ult.value.katex) == null ? void 0 : _na.inline]), vue.createVNode("li", {
1123
1171
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-katex`,
1124
1172
  "onClick": () => {
1125
1173
  emitHandler("katexBlock");
1126
- }
1174
+ },
1175
+ "role": "menuitem",
1176
+ "tabindex": "0"
1127
1177
  }, [(_oa = ult.value.katex) == null ? void 0 : _oa.block])]),
1128
1178
  "key": "bar-katex"
1129
1179
  }, {
@@ -1910,9 +1960,13 @@ const createAutocompletion = (completions) => {
1910
1960
  const toggleWith = (view2) => {
1911
1961
  const mc = new state.Compartment();
1912
1962
  const toggle = (extension) => {
1913
- mc.get(view2.state) ? view2.dispatch({ effects: mc.reconfigure(extension) }) : view2.dispatch({
1914
- effects: state.StateEffect.appendConfig.of(mc.of(extension))
1915
- });
1963
+ if (mc.get(view2.state)) {
1964
+ view2.dispatch({ effects: mc.reconfigure(extension) });
1965
+ } else {
1966
+ view2.dispatch({
1967
+ effects: state.StateEffect.appendConfig.of(mc.of(extension))
1968
+ });
1969
+ }
1916
1970
  return true;
1917
1971
  };
1918
1972
  return toggle;
@@ -2449,9 +2503,9 @@ const useCodeMirror = (props2) => {
2449
2503
  nc.setTabSize(tabWidth);
2450
2504
  nc.setDisabled(props2.disabled);
2451
2505
  nc.setReadOnly(props2.readonly);
2452
- props2.placeholder && nc.setPlaceholder(props2.placeholder);
2453
- typeof props2.maxlength === "number" && nc.setMaxLength(props2.maxlength);
2454
- props2.autofocus && view2.focus();
2506
+ if (props2.placeholder) nc.setPlaceholder(props2.placeholder);
2507
+ if (typeof props2.maxlength === "number") nc.setMaxLength(props2.maxlength);
2508
+ if (props2.autofocus) view2.focus();
2455
2509
  }, 0);
2456
2510
  eventName.bus.on(editorId, {
2457
2511
  name: eventName.CTRL_Z,
@@ -2622,13 +2676,13 @@ const useCodeMirror = (props2) => {
2622
2676
  };
2623
2677
  const useResize = (props2, contentRef, resizeRef) => {
2624
2678
  const state2 = vue.reactive({
2625
- resizedWidth: props2.inputBoxWitdh
2679
+ resizedWidth: props2.inputBoxWidth
2626
2680
  });
2627
2681
  const inputWrapperStyle = vue.reactive({
2628
- width: props2.inputBoxWitdh
2682
+ width: props2.inputBoxWidth
2629
2683
  });
2630
2684
  const resizeOperateStyle = vue.reactive({
2631
- left: props2.inputBoxWitdh,
2685
+ left: props2.inputBoxWidth,
2632
2686
  display: "initial"
2633
2687
  });
2634
2688
  const showPreviewWrapper = vue.ref(props2.setting.preview || props2.setting.htmlPreview);
@@ -2646,7 +2700,7 @@ const useResize = (props2, contentRef, resizeRef) => {
2646
2700
  inputWrapperStyle.width = ibw;
2647
2701
  resizeOperateStyle.left = ibw;
2648
2702
  state2.resizedWidth = ibw;
2649
- (_c = props2.onInputBoxWitdhChange) == null ? void 0 : _c.call(props2, ibw);
2703
+ (_c = props2.oninputBoxWidthChange) == null ? void 0 : _c.call(props2, ibw);
2650
2704
  };
2651
2705
  const resizeMousedown = () => {
2652
2706
  document.addEventListener("mousemove", resizeMousemove);
@@ -2671,7 +2725,7 @@ const useResize = (props2, contentRef, resizeRef) => {
2671
2725
  (_b = resizeRef.value) == null ? void 0 : _b.removeEventListener("mouseup", resizeMouseup);
2672
2726
  });
2673
2727
  vue.watch(
2674
- () => props2.inputBoxWitdh,
2728
+ () => props2.inputBoxWidth,
2675
2729
  (nVal) => {
2676
2730
  if (nVal) {
2677
2731
  state2.resizedWidth = nVal;
@@ -2814,6 +2868,7 @@ const props$2 = {
2814
2868
  }
2815
2869
  };
2816
2870
  const Checkbox = /* @__PURE__ */ vue.defineComponent({
2871
+ name: `${config.prefix}-checkbox`,
2817
2872
  props: props$2,
2818
2873
  setup(props2) {
2819
2874
  return () => {
@@ -2932,7 +2987,6 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
2932
2987
  emits: MdPreview.editorEmits,
2933
2988
  setup(props2, ctx) {
2934
2989
  const {
2935
- editorId,
2936
2990
  noKatex,
2937
2991
  noMermaid,
2938
2992
  noPrettier,
@@ -2944,16 +2998,32 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
2944
2998
  });
2945
2999
  const rootRef = vue.ref();
2946
3000
  const codeRef = vue.ref();
2947
- MdPreview.useOnSave(props2, ctx);
2948
- MdPreview.useProvide(props2, rootRef);
3001
+ const {
3002
+ editorId
3003
+ } = MdPreview.useProvide(props2, rootRef);
3004
+ const [setting, updateSetting] = MdPreview.useConfig(props2, ctx, {
3005
+ editorId
3006
+ });
3007
+ const catalogVisible = MdPreview.useCatalog(props2, {
3008
+ editorId
3009
+ });
3010
+ MdPreview.useOnSave(props2, ctx, {
3011
+ editorId
3012
+ });
2949
3013
  MdPreview.useExpansion(props2);
2950
- MdPreview.useErrorCatcher(props2, ctx);
2951
- const [setting, updateSetting] = MdPreview.useConfig(props2, ctx);
2952
- const catalogVisible = MdPreview.useCatalog(props2);
3014
+ MdPreview.useErrorCatcher(props2, ctx, {
3015
+ editorId
3016
+ });
3017
+ MdPreview.useExpose(props2, ctx, {
3018
+ editorId,
3019
+ catalogVisible,
3020
+ setting,
3021
+ updateSetting,
3022
+ codeRef
3023
+ });
2953
3024
  vue.onBeforeUnmount(() => {
2954
3025
  eventName.bus.clear(editorId);
2955
3026
  });
2956
- MdPreview.useExpose(props2, ctx, catalogVisible, setting, updateSetting, codeRef);
2957
3027
  return () => {
2958
3028
  const defToolbars = vueTsx.getSlot({
2959
3029
  props: props2,
@@ -3046,12 +3116,12 @@ const Editor = /* @__PURE__ */ vue.defineComponent({
3046
3116
  }
3047
3117
  ctx.emit("onDrop", e);
3048
3118
  },
3049
- "inputBoxWitdh": props2.inputBoxWitdh,
3050
- "onInputBoxWitdhChange": (width) => {
3051
- if (props2.onInputBoxWitdhChange) {
3052
- props2.onInputBoxWitdhChange(width);
3119
+ "inputBoxWidth": props2.inputBoxWidth,
3120
+ "oninputBoxWidthChange": (width) => {
3121
+ if (props2.oninputBoxWidthChange) {
3122
+ props2.oninputBoxWidthChange(width);
3053
3123
  }
3054
- ctx.emit("onInputBoxWitdhChange", width);
3124
+ ctx.emit("oninputBoxWidthChange", width);
3055
3125
  },
3056
3126
  "sanitizeMermaid": props2.sanitizeMermaid,
3057
3127
  "transformImgUrl": props2.transformImgUrl,
@@ -28,13 +28,16 @@ const props = {
28
28
  },
29
29
  // 展示在工具栏的内容,通常是个图标
30
30
  trigger: {
31
- type: [String, Object]
31
+ type: [String, Object],
32
+ default: void 0
32
33
  },
33
34
  onClick: {
34
- type: Function
35
+ type: Function,
36
+ default: void 0
35
37
  },
36
38
  onClose: {
37
- type: Function
39
+ type: Function,
40
+ default: void 0
38
41
  },
39
42
  /**
40
43
  * 显示全屏按钮
@@ -48,13 +51,16 @@ const props = {
48
51
  default: false
49
52
  },
50
53
  onAdjust: {
51
- type: Function
54
+ type: Function,
55
+ default: void 0
52
56
  },
53
57
  class: {
54
- type: String
58
+ type: String,
59
+ default: void 0
55
60
  },
56
61
  style: {
57
- type: [Object, String]
62
+ type: [Object, String],
63
+ default: void 0
58
64
  },
59
65
  showMask: {
60
66
  type: Boolean,
@@ -64,16 +70,20 @@ const props = {
64
70
  * ==没有意义,仅用于规避克隆组件自动嵌入insert方法时,传入的是该组件而产生的waring
65
71
  */
66
72
  insert: {
67
- type: Function
73
+ type: Function,
74
+ default: void 0
68
75
  },
69
76
  language: {
70
- type: String
77
+ type: String,
78
+ default: void 0
71
79
  },
72
80
  theme: {
73
- type: String
81
+ type: String,
82
+ default: void 0
74
83
  },
75
84
  previewTheme: {
76
- type: String
85
+ type: String,
86
+ default: void 0
77
87
  }
78
88
  /**
79
89
  * ==结束
@@ -1,8 +1,6 @@
1
1
  "use strict";
2
2
  const util = require("@vavt/util");
3
3
  const prefix = "md-editor";
4
- const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.js";
5
- const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.css";
6
4
  const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
7
5
  const highlightUrl = `${cdnBase}/highlight.js/11.10.0/highlight.min.js`;
8
6
  const prettierUrl = {
@@ -364,14 +362,6 @@ const editorExtensionsAttrs = {
364
362
  crossOrigin: "anonymous"
365
363
  }
366
364
  },
367
- iconfont: {
368
- integrity: "sha384-HRrf1e8/EiqrIZQftejl7pMTeuLeYczOz7rolAGxgw86N7UjiXkex67Uf2XTZz5z",
369
- crossOrigin: "anonymous"
370
- },
371
- iconfontClass: {
372
- integrity: "sha384-81pjilF/gLoQvAfd8madmeylVdv8IagPQaq1C/OZbysLav7k9g+Ir3XD5qK00Q5r",
373
- crossOrigin: "anonymous"
374
- },
375
365
  screenfull: {
376
366
  js: {
377
367
  integrity: "sha384-ELVAm9p9T4LGCG4lz8hbYalUYAppIpI1zV8IXYDCBUJFiVnV+EeG8vGSYQi+Wi4S",
@@ -408,8 +398,6 @@ const configOption = {
408
398
  cropper: {
409
399
  ...cropperUrl
410
400
  },
411
- iconfont: iconfontSvgUrl,
412
- iconfontClass: iconfontClassUrl,
413
401
  screenfull: {
414
402
  js: screenfullUrl
415
403
  },
@@ -431,7 +419,6 @@ const configOption = {
431
419
  markdownItConfig: () => {
432
420
  },
433
421
  markdownItPlugins: (s) => s,
434
- iconfontType: "svg",
435
422
  mermaidConfig: (c) => c,
436
423
  katexConfig: (c) => c
437
424
  };
@@ -450,7 +437,5 @@ exports.codeCss = codeCss;
450
437
  exports.config = config;
451
438
  exports.configOption = configOption;
452
439
  exports.editorExtensionsAttrs = editorExtensionsAttrs;
453
- exports.iconfontClassUrl = iconfontClassUrl;
454
- exports.iconfontSvgUrl = iconfontSvgUrl;
455
440
  exports.prefix = prefix;
456
441
  exports.staticTextDefault = staticTextDefault;
@@ -38,13 +38,17 @@ const appendHandler = (tagName, attributes, checkKey = "") => {
38
38
  const attrsCopy = { ...attributes };
39
39
  attrsCopy.onload = null;
40
40
  const ele = createHTMLElement(tagName, attrsCopy);
41
- attributes.onload && ele.addEventListener("load", attributes.onload);
41
+ if (attributes.onload) {
42
+ ele.addEventListener("load", attributes.onload);
43
+ }
42
44
  document.head.appendChild(ele);
43
45
  } else if (checkKey !== "") {
44
46
  if (Reflect.get(window, checkKey)) {
45
47
  (_a = attributes.onload) == null ? void 0 : _a.call(insertedEle, new Event("load"));
46
48
  } else {
47
- attributes.onload && insertedEle.addEventListener("load", attributes.onload);
49
+ if (attributes.onload) {
50
+ insertedEle.addEventListener("load", attributes.onload);
51
+ }
48
52
  }
49
53
  }
50
54
  };