md-editor-v3 4.20.4 → 4.21.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.
package/README.md CHANGED
@@ -803,15 +803,15 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
803
803
 
804
804
  - **props**
805
805
 
806
- - `title`: `string`, not necessary, title of toolbar.
806
+ - `title`: `string`, not required, title of toolbar.
807
807
 
808
808
  - **events**
809
809
 
810
- - `onClick`: `(e: MouseEvent) => void`, necessary.
810
+ - `onClick`: `(e: MouseEvent) => void`, required.
811
811
 
812
812
  - **slots**
813
813
 
814
- - `trigger`: `VNode | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
814
+ - `trigger`: `VNode | JSX.Element`, required, it is usually an icon, which is displayed on the toolbar.
815
815
 
816
816
  ### 🐼 DropdownToolbar
817
817
 
@@ -819,17 +819,17 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
819
819
 
820
820
  - **props**
821
821
 
822
- - `title`: `string`, not necessary, title of toolbar.
823
- - `visible`: `boolean`, necessary.
822
+ - `title`: `string`, not required, title of toolbar.
823
+ - `visible`: `boolean`, required.
824
824
 
825
825
  - **events**
826
826
 
827
- - `onChange`: `(visible: boolean) => void`, necessary.
827
+ - `onChange`: `(visible: boolean) => void`, required.
828
828
 
829
829
  - **slots**
830
830
 
831
- - `trigger`: `VNode | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
832
- - `overlay`: `VNode | JSX.Element`, necessary, content of dropdown box.
831
+ - `trigger`: `VNode | JSX.Element`, required, it is usually an icon, which is displayed on the toolbar.
832
+ - `overlay`: `VNode | JSX.Element`, required, content of dropdown box.
833
833
 
834
834
  ### 🦉 ModalToolbar
835
835
 
@@ -837,27 +837,27 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
837
837
 
838
838
  - **props**
839
839
 
840
- - `title`: `string`, not necessary, title of toolbar.
841
- - `modalTitle`: `string`, not necessary, title of the Modal.
842
- - `visible`: `boolean`, necessary, visibility of Modal.
843
- - `width`: `string`, not necessary, width of Modal, default `auto`.
840
+ - `title`: `string`, not required, title of toolbar.
841
+ - `modalTitle`: `string`, not required, title of the Modal.
842
+ - `visible`: `boolean`, required, visibility of Modal.
843
+ - `width`: `string`, not required, width of Modal, default `auto`.
844
844
  - `height`: `string`, same as `width`.
845
- - `showAdjust`: `boolean`, not necessary, visibility of fullscreen button.
846
- - `isFullscreen`: `boolean`, necessary when `showAdjust = true`, status of fullscreen.
847
- - `class`: `string`, not necessary.
848
- - `style`: `CSSProperties | string`, not necessary.
849
- - `showMask`: `boolean`, not necessary, whether to display the mask layer, default `true`.
845
+ - `showAdjust`: `boolean`, not required, visibility of fullscreen button.
846
+ - `isFullscreen`: `boolean`, required when `showAdjust = true`, status of fullscreen.
847
+ - `class`: `string`, not required.
848
+ - `style`: `CSSProperties | string`, not required.
849
+ - `showMask`: `boolean`, not required, whether to display the mask layer, default `true`.
850
850
 
851
851
  - **events**
852
852
 
853
- - `onClick`: `() => void`, necessary.
854
- - `onClose`: `() => void`, necessary, closed event.
853
+ - `onClick`: `() => void`, required.
854
+ - `onClose`: `() => void`, required, closed event.
855
855
  - `onAdjust`: `(val: boolean) => void`, fullscreen button was clicked.
856
856
 
857
857
  - **slots**
858
858
 
859
- - `trigger`: `VNode | JSX.Element`, necessary, it is usually an icon, which is displayed on the toolbar.
860
- - `default`: `VNode | JSX.Element`, necessary, content of Modal.
859
+ - `trigger`: `VNode | JSX.Element`, required, it is usually an icon, which is displayed on the toolbar.
860
+ - `default`: `VNode | JSX.Element`, required, content of Modal.
861
861
 
862
862
  ### 🐻 MdCatalog
863
863
 
@@ -865,19 +865,19 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
865
865
 
866
866
  - **props**
867
867
 
868
- - `editorId`: `string`, necessary, same as editor's `editorId`, used to register listening events.
869
- - `class`: `string`, not necessary.
870
- - `mdHeadingId`: `MdHeadingId`, not necessary, same as editor.
871
- - `scrollElement`: `string | HTMLElement`, not necessary, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
872
- - `theme`: `'light' | 'dark'`, not necessary, provide it when you want to change theme online, it is the same as Editor `theme`.
873
- - `offsetTop`: `number`, not necessary, highlight current item of catalogs when title is `offsetTop` pixels from the top, default 20.
874
- - `scrollElementOffsetTop`: `number`, not necessary, offsetTop of the scroll container,default 0.
868
+ - `editorId`: `string`, required, same as editor's `editorId`, used to register listening events.
869
+ - `class`: `string`, not required.
870
+ - `mdHeadingId`: `MdHeadingId`, not required, same as editor.
871
+ - `scrollElement`: `string | HTMLElement`, not required, it is an element selector when its type is string. When `previewOnly` eq `true`, it is usually set to `document.documentElement`.
872
+ - `theme`: `'light' | 'dark'`, not required, provide it when you want to change theme online, it is the same as Editor `theme`.
873
+ - `offsetTop`: `number`, not required, highlight current item of catalogs when title is `offsetTop` pixels from the top, default 20.
874
+ - `scrollElementOffsetTop`: `number`, not required, offsetTop of the scroll container,default 0.
875
875
  - `isScrollElementInShadow`: `boolean`, whether the scroll container is in web component, default false.
876
876
 
877
877
  - **events**
878
878
 
879
- - `onClick`: `(e: MouseEvent, t: TocItem) => void`, not necessary, heading was clicked.
880
- - `onActive`: `(heading: HeadList | undefined) => void`, not necessary, heading was highlighted.
879
+ - `onClick`: `(e: MouseEvent, t: TocItem) => void`, not required, heading was clicked.
880
+ - `onActive`: `(heading: HeadList | undefined) => void`, not required, heading was highlighted.
881
881
 
882
882
  ### 🛸 MdModal
883
883
 
@@ -885,24 +885,36 @@ On-demand import. For more examples, refer to [document](https://imzbf.github.io
885
885
 
886
886
  - **props**
887
887
 
888
- - `title`: `string`, not necessary, title of Modal.
889
- - `visible`: `boolean`, necessary, visibility of Modal.
890
- - `width`: `string`, not necessary, width of Modal, default `auto`.
888
+ - `title`: `string`, not required, title of Modal.
889
+ - `visible`: `boolean`, required, visibility of Modal.
890
+ - `width`: `string`, not required, width of Modal, default `auto`.
891
891
  - `height`: `string`, same as `width`.
892
- - `showAdjust`: `boolean`, not necessary, visibility of fullscreen button.
893
- - `isFullscreen`: `boolean`, necessary when `showAdjust = true`, status of fullscreen.
894
- - `class`: `string`, not necessary.
895
- - `style`: `CSSProperties | string`, not necessary.
896
- - `showMask`: `boolean`, not necessary, whether to display the mask layer, default `true`.
892
+ - `showAdjust`: `boolean`, not required, visibility of fullscreen button.
893
+ - `isFullscreen`: `boolean`, required when `showAdjust = true`, status of fullscreen.
894
+ - `class`: `string`, not required.
895
+ - `style`: `CSSProperties | string`, not required.
896
+ - `showMask`: `boolean`, not required, whether to display the mask layer, default `true`.
897
897
 
898
898
  - **events**
899
899
 
900
- - `onClose`: `() => void`, necessary, closed event.
900
+ - `onClose`: `() => void`, required, closed event.
901
901
  - `onAdjust`: `(val: boolean) => void`, fullscreen button was clicked.
902
902
 
903
903
  - **slots**
904
904
 
905
- - `default`: `VNode | JSX.Element`, necessary, content of Modal.
905
+ - `default`: `VNode | JSX.Element`, required, content of Modal.
906
+
907
+ ### 🛸 NormalFooterToolbar
908
+
909
+ `NormalFooterToolbar`
910
+
911
+ - **events**
912
+
913
+ - `onClick`: `(e: MouseEvent) => void`, not required, toolbar was clicked.
914
+
915
+ - **slots**
916
+
917
+ - `default`: `VNode | JSX.Element`, required, content.
906
918
 
907
919
  ## 🪤 Internal Configuration
908
920
 
@@ -420,7 +420,7 @@ const ClipModal = /* @__PURE__ */ vue.defineComponent({
420
420
  "height": "421px"
421
421
  }, {
422
422
  default: () => {
423
- var _a2, _b;
423
+ var _a2, _b, _c;
424
424
  return [vue.createVNode("div", {
425
425
  "class": `${config.prefix}-form-item ${config.prefix}-clip`
426
426
  }, [vue.createVNode("div", {
@@ -443,7 +443,10 @@ const ClipModal = /* @__PURE__ */ vue.defineComponent({
443
443
  "class": `${config.prefix}-clip-upload`,
444
444
  "onClick": () => {
445
445
  uploadRef.value.click();
446
- }
446
+ },
447
+ "role": "button",
448
+ "tabindex": "0",
449
+ "aria-label": (_a2 = ult.value.imgTitleItem) == null ? void 0 : _a2.upload
447
450
  }, [vue.createVNode(MdModal.Icon, {
448
451
  "name": "upload"
449
452
  }, null)])]), vue.createVNode("div", {
@@ -463,14 +466,15 @@ const ClipModal = /* @__PURE__ */ vue.defineComponent({
463
466
  reset();
464
467
  }
465
468
  }
466
- }, [((_a2 = ult.value.clipModalTips) == null ? void 0 : _a2.buttonUpload) || ((_b = ult.value.linkModalTips) == null ? void 0 : _b.buttonOK)])]), vue.createVNode("input", {
469
+ }, [((_b = ult.value.clipModalTips) == null ? void 0 : _b.buttonUpload) || ((_c = ult.value.linkModalTips) == null ? void 0 : _c.buttonOK)])]), vue.createVNode("input", {
467
470
  "ref": uploadRef,
468
471
  "accept": "image/*",
469
472
  "type": "file",
470
473
  "multiple": false,
471
474
  "style": {
472
475
  display: "none"
473
- }
476
+ },
477
+ "aria-hidden": "true"
474
478
  }, null)];
475
479
  }
476
480
  });
@@ -644,37 +648,50 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
644
648
  "class": `${config.prefix}-menu`,
645
649
  "onClick": () => {
646
650
  visible.title = false;
647
- }
651
+ },
652
+ "role": "menu"
648
653
  }, [vue.createVNode("li", {
649
654
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
650
655
  "onClick": () => {
651
656
  emitHandler("h1");
652
- }
657
+ },
658
+ "role": "menuitem",
659
+ "tabindex": "0"
653
660
  }, [(_i = ult.value.titleItem) == null ? void 0 : _i.h1]), vue.createVNode("li", {
654
661
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
655
662
  "onClick": () => {
656
663
  emitHandler("h2");
657
- }
664
+ },
665
+ "role": "menuitem",
666
+ "tabindex": "0"
658
667
  }, [(_j = ult.value.titleItem) == null ? void 0 : _j.h2]), vue.createVNode("li", {
659
668
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
660
669
  "onClick": () => {
661
670
  emitHandler("h3");
662
- }
671
+ },
672
+ "role": "menuitem",
673
+ "tabindex": "0"
663
674
  }, [(_k = ult.value.titleItem) == null ? void 0 : _k.h3]), vue.createVNode("li", {
664
675
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
665
676
  "onClick": () => {
666
677
  emitHandler("h4");
667
- }
678
+ },
679
+ "role": "menuitem",
680
+ "tabindex": "0"
668
681
  }, [(_l = ult.value.titleItem) == null ? void 0 : _l.h4]), vue.createVNode("li", {
669
682
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
670
683
  "onClick": () => {
671
684
  emitHandler("h5");
672
- }
685
+ },
686
+ "role": "menuitem",
687
+ "tabindex": "0"
673
688
  }, [(_m = ult.value.titleItem) == null ? void 0 : _m.h5]), vue.createVNode("li", {
674
689
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-title`,
675
690
  "onClick": () => {
676
691
  emitHandler("h6");
677
- }
692
+ },
693
+ "role": "menuitem",
694
+ "tabindex": "0"
678
695
  }, [(_n = ult.value.titleItem) == null ? void 0 : _n.h6])])
679
696
  }, {
680
697
  default: () => {
@@ -830,23 +847,30 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
830
847
  "class": `${config.prefix}-menu`,
831
848
  "onClick": () => {
832
849
  visible.title = false;
833
- }
850
+ },
851
+ "role": "menu"
834
852
  }, [vue.createVNode("li", {
835
853
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-image`,
836
854
  "onClick": () => {
837
855
  modalData.type = "image";
838
856
  modalData.linkVisible = true;
839
- }
857
+ },
858
+ "role": "menuitem",
859
+ "tabindex": "0"
840
860
  }, [(_I = ult.value.imgTitleItem) == null ? void 0 : _I.link]), vue.createVNode("li", {
841
861
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-image`,
842
862
  "onClick": () => {
843
863
  uploadRef.value.click();
844
- }
864
+ },
865
+ "role": "menuitem",
866
+ "tabindex": "0"
845
867
  }, [(_J = ult.value.imgTitleItem) == null ? void 0 : _J.upload]), vue.createVNode("li", {
846
868
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-image`,
847
869
  "onClick": () => {
848
870
  modalData.clipVisible = true;
849
- }
871
+ },
872
+ "role": "menuitem",
873
+ "tabindex": "0"
850
874
  }, [(_K = ult.value.imgTitleItem) == null ? void 0 : _K.clip2upload])])
851
875
  }, {
852
876
  default: () => {
@@ -1045,47 +1069,64 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1045
1069
  "class": `${config.prefix}-menu`,
1046
1070
  "onClick": () => {
1047
1071
  visible.mermaid = false;
1048
- }
1072
+ },
1073
+ "role": "menu"
1049
1074
  }, [vue.createVNode("li", {
1050
1075
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1051
1076
  "onClick": () => {
1052
1077
  emitHandler("flow");
1053
- }
1078
+ },
1079
+ "role": "menuitem",
1080
+ "tabindex": "0"
1054
1081
  }, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.flow]), vue.createVNode("li", {
1055
1082
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1056
1083
  "onClick": () => {
1057
1084
  emitHandler("sequence");
1058
- }
1085
+ },
1086
+ "role": "menuitem",
1087
+ "tabindex": "0"
1059
1088
  }, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.sequence]), vue.createVNode("li", {
1060
1089
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1061
1090
  "onClick": () => {
1062
1091
  emitHandler("gantt");
1063
- }
1092
+ },
1093
+ "role": "menuitem",
1094
+ "tabindex": "0"
1064
1095
  }, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.gantt]), vue.createVNode("li", {
1065
1096
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1066
1097
  "onClick": () => {
1067
1098
  emitHandler("class");
1068
- }
1099
+ },
1100
+ "role": "menuitem",
1101
+ "tabindex": "0"
1069
1102
  }, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.class]), vue.createVNode("li", {
1070
1103
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1071
1104
  "onClick": () => {
1072
1105
  emitHandler("state");
1073
- }
1106
+ },
1107
+ "role": "menuitem",
1108
+ "tabindex": "0"
1074
1109
  }, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.state]), vue.createVNode("li", {
1075
1110
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1076
1111
  "onClick": () => {
1077
1112
  emitHandler("pie");
1078
- }
1113
+ },
1114
+ "role": "menuitem",
1115
+ "tabindex": "0"
1079
1116
  }, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.pie]), vue.createVNode("li", {
1080
1117
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1081
1118
  "onClick": () => {
1082
1119
  emitHandler("relationship");
1083
- }
1120
+ },
1121
+ "role": "menuitem",
1122
+ "tabindex": "0"
1084
1123
  }, [(_la = ult.value.mermaid) == null ? void 0 : _la.relationship]), vue.createVNode("li", {
1085
1124
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1086
1125
  "onClick": () => {
1087
1126
  emitHandler("journey");
1088
- }
1127
+ },
1128
+ "role": "menuitem",
1129
+ "tabindex": "0"
1089
1130
  }, [(_ma = ult.value.mermaid) == null ? void 0 : _ma.journey])]),
1090
1131
  "key": "bar-mermaid"
1091
1132
  }, {
@@ -1113,17 +1154,22 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1113
1154
  "class": `${config.prefix}-menu`,
1114
1155
  "onClick": () => {
1115
1156
  visible.katex = false;
1116
- }
1157
+ },
1158
+ "role": "menu"
1117
1159
  }, [vue.createVNode("li", {
1118
1160
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-katex`,
1119
1161
  "onClick": () => {
1120
1162
  emitHandler("katexInline");
1121
- }
1163
+ },
1164
+ "role": "menuitem",
1165
+ "tabindex": "0"
1122
1166
  }, [(_na = ult.value.katex) == null ? void 0 : _na.inline]), vue.createVNode("li", {
1123
1167
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-katex`,
1124
1168
  "onClick": () => {
1125
1169
  emitHandler("katexBlock");
1126
- }
1170
+ },
1171
+ "role": "menuitem",
1172
+ "tabindex": "0"
1127
1173
  }, [(_oa = ult.value.katex) == null ? void 0 : _oa.block])]),
1128
1174
  "key": "bar-katex"
1129
1175
  }, {
@@ -1187,6 +1233,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1187
1233
  immediate: true
1188
1234
  });
1189
1235
  return () => {
1236
+ var _a;
1190
1237
  const LeftBar = splitedbar.value[0].map((barItem) => barRender(barItem));
1191
1238
  const RightBar = splitedbar.value[1].map((barItem) => barRender(barItem));
1192
1239
  return vue.createVNode(vue.Fragment, null, [props2.toolbars.length > 0 && vue.createVNode("div", {
@@ -1200,7 +1247,14 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1200
1247
  "ref": toolbarLeftRef
1201
1248
  }, [LeftBar]), vue.createVNode("div", {
1202
1249
  "class": `${config.prefix}-toolbar-right`
1203
- }, [RightBar])])]), vue.createVNode("input", {
1250
+ }, [RightBar])])]), vue.createVNode("label", {
1251
+ "for": `${wrapperId}_label`,
1252
+ "style": {
1253
+ display: "none"
1254
+ },
1255
+ "aria-label": (_a = ult.value.imgTitleItem) == null ? void 0 : _a.upload
1256
+ }, null), vue.createVNode("input", {
1257
+ "id": `${wrapperId}_label`,
1204
1258
  "ref": uploadRef,
1205
1259
  "accept": "image/*",
1206
1260
  "type": "file",
@@ -174,8 +174,8 @@ const staticTextDefault = {
174
174
  h6: "Lv6 Heading"
175
175
  },
176
176
  imgTitleItem: {
177
- link: "Add Img Link",
178
- upload: "Upload Img",
177
+ link: "Add Image Link",
178
+ upload: "Upload Images",
179
179
  clip2upload: "Clip Upload"
180
180
  },
181
181
  linkModalTips: {
@@ -131,7 +131,7 @@ const useHighlight = (props) => {
131
131
  vue.watch(
132
132
  () => highlight.value.css,
133
133
  () => {
134
- if (props.noHighlight || hljsRef.value) {
134
+ if (props.noHighlight || config.configOption.editorExtensions.highlight.instance) {
135
135
  return;
136
136
  }
137
137
  dom.updateHandler("link", {
@@ -657,15 +657,19 @@ const codetabs = (md, _opts) => {
657
657
  };
658
658
  tokens[idx].info = tokens[idx].info.replace(mandatoryRe, "");
659
659
  const codeRendered = defaultRender(tokens, idx, options, env, slf);
660
- return `<${tagContainer2} ${slf.renderAttrs(tmpToken2)}>
661
- <${tagHeader2} class="${config.prefix}-code-head">
662
- <div class="${config.prefix}-code-flag"><span></span><span></span><span></span></div>
663
- <div class="${config.prefix}-code-action">
664
- <span class="${config.prefix}-code-lang">${tokens[idx].info.trim()}</span>
665
- <span class="${config.prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}">${copyBtnHtml}</span>
666
- ${tagContainer2 === "details" ? collapseTips : ""}
667
- </div>
668
- </${tagHeader2}>${codeRendered}</${tagContainer2}>`;
660
+ return `
661
+ <${tagContainer2} ${slf.renderAttrs(tmpToken2)}>
662
+ <${tagHeader2} class="${config.prefix}-code-head">
663
+ <div class="${config.prefix}-code-flag"><span></span><span></span><span></span></div>
664
+ <div class="${config.prefix}-code-action">
665
+ <span class="${config.prefix}-code-lang">${tokens[idx].info.trim()}</span>
666
+ <span class="${config.prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}>${copyBtnHtml}</span>
667
+ ${tagContainer2 === "details" ? collapseTips : ""}
668
+ </div>
669
+ </${tagHeader2}>
670
+ ${codeRendered}
671
+ </${tagContainer2}>
672
+ `;
669
673
  }
670
674
  let token, group, tab, checked, labels = "", pres = "", langs = "";
671
675
  const { open, tagContainer, tagHeader } = getTagType(tokens[idx]);
@@ -684,26 +688,56 @@ const codetabs = (md, _opts) => {
684
688
  token.hidden = true;
685
689
  const className = `${config.prefix}-codetab-${_opts.editorId}-${idx}-${i - idx}`;
686
690
  checked = i - idx > 0 ? "" : "checked";
687
- labels += `<li>
688
- <input type="radio" name="${config.prefix}-codetab-label-${_opts.editorId}-${idx}" class="${className}" ${checked}>
689
- <label onclick="this.getRootNode().querySelectorAll('.${className}').forEach(e => e.click())">${tab || getLangName(token)}</label>
691
+ labels += `
692
+ <li>
693
+ <input
694
+ type="radio"
695
+ id="label-${config.prefix}-codetab-label-1-${_opts.editorId}-${idx}-${i - idx}"
696
+ name="${config.prefix}-codetab-label-${_opts.editorId}-${idx}"
697
+ class="${className}"
698
+ ${checked}
699
+ >
700
+ <label
701
+ for="label-${config.prefix}-codetab-label-1-${_opts.editorId}-${idx}-${i - idx}"
702
+ onclick="this.getRootNode().querySelectorAll('.${className}').forEach(e => e.click())"
703
+ >
704
+ ${tab || getLangName(token)}
705
+ </label>
690
706
  </li>`;
691
- pres += `<input type="radio" name="${config.prefix}-codetab-pre-${_opts.editorId}-${idx}" class="${className}" ${checked}>
692
- ${defaultRender(tokens, i, options, env, slf)}`;
693
- langs += `<input type="radio" name="${config.prefix}-codetab-lang-${_opts.editorId}-${idx}" class="${className}" ${checked}>
694
- <span class=${config.prefix}-code-lang>${getLangName(token)}</span>`;
695
- }
696
- return `<${tagContainer} ${slf.renderAttrs(tmpToken)}>
697
- <${tagHeader} class="${config.prefix}-code-head">
698
- <div class="${config.prefix}-code-flag">
699
- <ul class="${config.prefix}-codetab-label">${labels}</ul>
700
- </div>
701
- <div class="${config.prefix}-code-action">
702
- <span class="${config.prefix}-codetab-lang">${langs}</span>
703
- <span class="${config.prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}">${copyBtnHtml}</span>
704
- ${tagContainer === "details" ? collapseTips : ""}
705
- </div>
706
- </${tagHeader}>${pres}</${tagContainer}>`;
707
+ pres += `
708
+ <div role="tabpanel">
709
+ <input
710
+ type="radio"
711
+ name="${config.prefix}-codetab-pre-${_opts.editorId}-${idx}"
712
+ class="${className}"
713
+ ${checked}
714
+ role="presentation">
715
+ ${defaultRender(tokens, i, options, env, slf)}
716
+ </div>`;
717
+ langs += `
718
+ <input
719
+ type="radio"
720
+ name="${config.prefix}-codetab-lang-${_opts.editorId}-${idx}"
721
+ class="${className}"
722
+ ${checked}
723
+ role="presentation">
724
+ <span class=${config.prefix}-code-lang role="note">${getLangName(token)}</span>`;
725
+ }
726
+ return `
727
+ <${tagContainer} ${slf.renderAttrs(tmpToken)}>
728
+ <${tagHeader} class="${config.prefix}-code-head">
729
+ <div class="${config.prefix}-code-flag">
730
+ <ul class="${config.prefix}-codetab-label" role="tablist">${labels}</ul>
731
+ </div>
732
+ <div class="${config.prefix}-code-action">
733
+ <span class="${config.prefix}-codetab-lang">${langs}</span>
734
+ <span class="${config.prefix}-copy-button" data-tips="${codeCodeText}"${isIcon ? " data-is-icon=true" : ""}>${copyBtnHtml}</span>
735
+ ${tagContainer === "details" ? collapseTips : ""}
736
+ </div>
737
+ </${tagHeader}>
738
+ ${pres}
739
+ </${tagContainer}>
740
+ `;
707
741
  };
708
742
  md.renderer.rules.fence = fenceGroup;
709
743
  md.renderer.rules.code_block = fenceGroup;
@@ -510,6 +510,15 @@ const MdCatalog = /* @__PURE__ */ vue.defineComponent({
510
510
  const scrollHandler = () => {
511
511
  findActiveHeading(state.list);
512
512
  };
513
+ const catalogChangedHandler = (_list) => {
514
+ var _a, _b;
515
+ const scrollElement = getScrollElement();
516
+ scrollElementRef.value = scrollElement;
517
+ scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
518
+ (_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
519
+ findActiveHeading(_list);
520
+ (_b = scrollContainerRef.value) == null ? void 0 : _b.addEventListener("scroll", scrollHandler);
521
+ };
513
522
  vue.watch(() => activeItem.value, (nVal) => {
514
523
  const activeHeading = nVal ? {
515
524
  ...nVal
@@ -522,24 +531,15 @@ const MdCatalog = /* @__PURE__ */ vue.defineComponent({
522
531
  });
523
532
  vue.onMounted(() => {
524
533
  rootNodeRef.value = catalogRef.value.getRootNode();
525
- let scrollElement = getScrollElement();
526
- scrollElementRef.value = scrollElement;
527
534
  eventName.bus.on(editorId, {
528
535
  name: eventName.CATALOG_CHANGED,
529
- callback: (_list) => {
530
- var _a, _b;
531
- scrollElement = getScrollElement();
532
- scrollElementRef.value = scrollElement;
533
- scrollContainerRef.value = scrollElement === document.documentElement ? document : scrollElement;
534
- (_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
535
- findActiveHeading(_list);
536
- (_b = scrollContainerRef.value) == null ? void 0 : _b.addEventListener("scroll", scrollHandler);
537
- }
536
+ callback: catalogChangedHandler
538
537
  });
539
538
  eventName.bus.emit(editorId, eventName.PUSH_CATALOG);
540
539
  });
541
540
  vue.onBeforeUnmount(() => {
542
541
  var _a;
542
+ eventName.bus.remove(editorId, eventName.CATALOG_CHANGED, catalogChangedHandler);
543
543
  (_a = scrollContainerRef.value) == null ? void 0 : _a.removeEventListener("scroll", scrollHandler);
544
544
  });
545
545
  return () => vue.createVNode("div", {
package/lib/cjs/index.cjs CHANGED
@@ -7,8 +7,42 @@ const DropdownToolbar = require("./chunks/index2.cjs");
7
7
  const ModalToolbar = require("./ModalToolbar.cjs");
8
8
  const MdCatalog = require("./chunks/index3.cjs");
9
9
  const MdModal = require("./chunks/index4.cjs");
10
- const config = require("./config.cjs");
10
+ const vue = require("vue");
11
+ const vueTsx = require("./chunks/vue-tsx.cjs");
11
12
  const config$1 = require("./chunks/config.cjs");
13
+ const config = require("./config.cjs");
14
+ const props = {
15
+ onClick: {
16
+ type: Function
17
+ }
18
+ };
19
+ const NormalFooterToolbar = /* @__PURE__ */ vue.defineComponent({
20
+ name: "NormalFooterToolbar",
21
+ props,
22
+ emits: ["onClick"],
23
+ setup(props2, ctx) {
24
+ return () => {
25
+ const Children = vueTsx.getSlot({
26
+ props: props2,
27
+ ctx
28
+ });
29
+ return vue.createVNode("div", {
30
+ "class": `${config$1.prefix}-footer-item`,
31
+ "onClick": (e) => {
32
+ if (props2.onClick instanceof Function) {
33
+ props2.onClick(e);
34
+ } else {
35
+ ctx.emit("onClick", e);
36
+ }
37
+ }
38
+ }, [Children]);
39
+ };
40
+ }
41
+ });
42
+ NormalFooterToolbar.install = (app) => {
43
+ app.component(NormalFooterToolbar.name, NormalFooterToolbar);
44
+ return app;
45
+ };
12
46
  exports.MdEditor = MdEditor;
13
47
  exports.MdPreview = MdPreview.MdPreview;
14
48
  exports.StrIcon = MdPreview.StrIcon;
@@ -17,11 +51,12 @@ exports.DropdownToolbar = DropdownToolbar.DropdownToolbar;
17
51
  exports.ModalToolbar = ModalToolbar;
18
52
  exports.MdCatalog = MdCatalog.MdCatalog;
19
53
  exports.MdModal = MdModal.MdModal;
20
- exports.en_US = config.en_US;
21
- exports.zh_CN = config.zh_CN;
22
54
  exports.allFooter = config$1.allFooter;
23
55
  exports.allToolbar = config$1.allToolbar;
24
56
  exports.config = config$1.config;
25
57
  exports.editorExtensionsAttrs = config$1.editorExtensionsAttrs;
26
58
  exports.iconfontClassUrl = config$1.iconfontClassUrl;
27
59
  exports.iconfontSvgUrl = config$1.iconfontSvgUrl;
60
+ exports.en_US = config.en_US;
61
+ exports.zh_CN = config.zh_CN;
62
+ exports.NormalFooterToolbar = NormalFooterToolbar;