md-editor-v3 5.0.2 → 5.1.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.
@@ -536,6 +536,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
536
536
  const theme = vue.inject("theme");
537
537
  const previewTheme = vue.inject("previewTheme");
538
538
  const language2 = vue.inject("language");
539
+ const disabled = vue.inject("disabled");
539
540
  const {
540
541
  fullscreenHandler
541
542
  } = useSreenfull(props2);
@@ -553,6 +554,9 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
553
554
  katex: false
554
555
  });
555
556
  const emitHandler = (direct, params) => {
557
+ if (disabled == null ? void 0 : disabled.value) {
558
+ return false;
559
+ }
556
560
  eventName.bus.emit(editorId, eventName.REPLACE, direct, params);
557
561
  };
558
562
  const modalData = vue.reactive({
@@ -586,7 +590,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
586
590
  uploadRef.value.addEventListener("change", uploadHandler);
587
591
  });
588
592
  const barRender = (barItem) => {
589
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa;
593
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya;
590
594
  if (config.allToolbar.includes(barItem)) {
591
595
  switch (barItem) {
592
596
  case "-": {
@@ -594,7 +598,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
594
598
  }
595
599
  case "bold": {
596
600
  return vue.createVNode("div", {
597
- "class": `${config.prefix}-toolbar-item`,
601
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
598
602
  "title": (_a = ult.value.toolbarTips) == null ? void 0 : _a.bold,
599
603
  "onClick": () => {
600
604
  emitHandler("bold");
@@ -607,7 +611,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
607
611
  }
608
612
  case "underline": {
609
613
  return vue.createVNode("div", {
610
- "class": `${config.prefix}-toolbar-item`,
614
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
611
615
  "title": (_c = ult.value.toolbarTips) == null ? void 0 : _c.underline,
612
616
  "onClick": () => {
613
617
  emitHandler("underline");
@@ -620,7 +624,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
620
624
  }
621
625
  case "italic": {
622
626
  return vue.createVNode("div", {
623
- "class": `${config.prefix}-toolbar-item`,
627
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
624
628
  "title": (_e = ult.value.toolbarTips) == null ? void 0 : _e.italic,
625
629
  "onClick": () => {
626
630
  emitHandler("italic");
@@ -633,7 +637,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
633
637
  }
634
638
  case "strikeThrough": {
635
639
  return vue.createVNode("div", {
636
- "class": `${config.prefix}-toolbar-item`,
640
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
637
641
  "title": (_g = ult.value.toolbarTips) == null ? void 0 : _g.strikeThrough,
638
642
  "onClick": () => {
639
643
  emitHandler("strikeThrough");
@@ -651,6 +655,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
651
655
  "onChange": (v) => {
652
656
  visible.title = v;
653
657
  },
658
+ "disabled": disabled == null ? void 0 : disabled.value,
654
659
  "overlay": vue.createVNode("ul", {
655
660
  "class": `${config.prefix}-menu`,
656
661
  "onClick": () => {
@@ -704,7 +709,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
704
709
  default: () => {
705
710
  var _a2, _b2;
706
711
  return [vue.createVNode("div", {
707
- "class": `${config.prefix}-toolbar-item`,
712
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
708
713
  "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.title
709
714
  }, [vue.createVNode(MdModal.Icon, {
710
715
  "name": "title"
@@ -716,7 +721,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
716
721
  }
717
722
  case "sub": {
718
723
  return vue.createVNode("div", {
719
- "class": `${config.prefix}-toolbar-item`,
724
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
720
725
  "title": (_o = ult.value.toolbarTips) == null ? void 0 : _o.sub,
721
726
  "onClick": () => {
722
727
  emitHandler("sub");
@@ -729,7 +734,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
729
734
  }
730
735
  case "sup": {
731
736
  return vue.createVNode("div", {
732
- "class": `${config.prefix}-toolbar-item`,
737
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
733
738
  "title": (_q = ult.value.toolbarTips) == null ? void 0 : _q.sup,
734
739
  "onClick": () => {
735
740
  emitHandler("sup");
@@ -742,7 +747,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
742
747
  }
743
748
  case "quote": {
744
749
  return vue.createVNode("div", {
745
- "class": `${config.prefix}-toolbar-item`,
750
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
746
751
  "title": (_s = ult.value.toolbarTips) == null ? void 0 : _s.quote,
747
752
  "onClick": () => {
748
753
  emitHandler("quote");
@@ -755,7 +760,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
755
760
  }
756
761
  case "unorderedList": {
757
762
  return vue.createVNode("div", {
758
- "class": `${config.prefix}-toolbar-item`,
763
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
759
764
  "title": (_u = ult.value.toolbarTips) == null ? void 0 : _u.unorderedList,
760
765
  "onClick": () => {
761
766
  emitHandler("unorderedList");
@@ -768,7 +773,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
768
773
  }
769
774
  case "orderedList": {
770
775
  return vue.createVNode("div", {
771
- "class": `${config.prefix}-toolbar-item`,
776
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
772
777
  "title": (_w = ult.value.toolbarTips) == null ? void 0 : _w.orderedList,
773
778
  "onClick": () => {
774
779
  emitHandler("orderedList");
@@ -781,7 +786,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
781
786
  }
782
787
  case "task": {
783
788
  return vue.createVNode("div", {
784
- "class": `${config.prefix}-toolbar-item`,
789
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
785
790
  "title": (_y = ult.value.toolbarTips) == null ? void 0 : _y.task,
786
791
  "onClick": () => {
787
792
  emitHandler("task");
@@ -794,7 +799,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
794
799
  }
795
800
  case "codeRow": {
796
801
  return vue.createVNode("div", {
797
- "class": `${config.prefix}-toolbar-item`,
802
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
798
803
  "title": (_A = ult.value.toolbarTips) == null ? void 0 : _A.codeRow,
799
804
  "onClick": () => {
800
805
  emitHandler("codeRow");
@@ -807,7 +812,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
807
812
  }
808
813
  case "code": {
809
814
  return vue.createVNode("div", {
810
- "class": `${config.prefix}-toolbar-item`,
815
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
811
816
  "title": (_C = ult.value.toolbarTips) == null ? void 0 : _C.code,
812
817
  "onClick": () => {
813
818
  emitHandler("code");
@@ -820,9 +825,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
820
825
  }
821
826
  case "link": {
822
827
  return vue.createVNode("div", {
823
- "class": `${config.prefix}-toolbar-item`,
828
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
824
829
  "title": (_E = ult.value.toolbarTips) == null ? void 0 : _E.link,
825
830
  "onClick": () => {
831
+ if (disabled == null ? void 0 : disabled.value) {
832
+ return false;
833
+ }
826
834
  modalData.type = "link";
827
835
  modalData.linkVisible = true;
828
836
  }
@@ -834,9 +842,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
834
842
  }
835
843
  case "image": {
836
844
  return props2.noUploadImg ? vue.createVNode("div", {
837
- "class": `${config.prefix}-toolbar-item`,
845
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
838
846
  "title": (_G = ult.value.toolbarTips) == null ? void 0 : _G.image,
839
847
  "onClick": () => {
848
+ if (disabled == null ? void 0 : disabled.value) {
849
+ return false;
850
+ }
840
851
  modalData.type = "image";
841
852
  modalData.linkVisible = true;
842
853
  }
@@ -850,6 +861,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
850
861
  "onChange": (v) => {
851
862
  visible.image = v;
852
863
  },
864
+ "disabled": disabled == null ? void 0 : disabled.value,
853
865
  "overlay": vue.createVNode("ul", {
854
866
  "class": `${config.prefix}-menu`,
855
867
  "onClick": () => {
@@ -883,7 +895,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
883
895
  default: () => {
884
896
  var _a2, _b2;
885
897
  return [vue.createVNode("div", {
886
- "class": `${config.prefix}-toolbar-item`,
898
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
887
899
  "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.image
888
900
  }, [vue.createVNode(MdModal.Icon, {
889
901
  "name": "image"
@@ -900,6 +912,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
900
912
  "onChange": (v) => {
901
913
  visible.table = v;
902
914
  },
915
+ "disabled": disabled == null ? void 0 : disabled.value,
903
916
  "key": "bar-table",
904
917
  "overlay": vue.createVNode(TableShape, {
905
918
  "tableShape": props2.tableShape,
@@ -913,7 +926,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
913
926
  default: () => {
914
927
  var _a2, _b2;
915
928
  return [vue.createVNode("div", {
916
- "class": `${config.prefix}-toolbar-item`,
929
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
917
930
  "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.table
918
931
  }, [vue.createVNode(MdModal.Icon, {
919
932
  "name": "table"
@@ -925,9 +938,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
925
938
  }
926
939
  case "revoke": {
927
940
  return vue.createVNode("div", {
928
- "class": `${config.prefix}-toolbar-item`,
941
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
929
942
  "title": (_L = ult.value.toolbarTips) == null ? void 0 : _L.revoke,
930
943
  "onClick": () => {
944
+ if (disabled == null ? void 0 : disabled.value) {
945
+ return false;
946
+ }
931
947
  eventName.bus.emit(editorId, eventName.CTRL_Z);
932
948
  }
933
949
  }, [vue.createVNode(MdModal.Icon, {
@@ -938,9 +954,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
938
954
  }
939
955
  case "next": {
940
956
  return vue.createVNode("div", {
941
- "class": `${config.prefix}-toolbar-item`,
957
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
942
958
  "title": (_N = ult.value.toolbarTips) == null ? void 0 : _N.next,
943
959
  "onClick": () => {
960
+ if (disabled == null ? void 0 : disabled.value) {
961
+ return false;
962
+ }
944
963
  eventName.bus.emit(editorId, eventName.CTRL_SHIFT_Z);
945
964
  }
946
965
  }, [vue.createVNode(MdModal.Icon, {
@@ -951,9 +970,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
951
970
  }
952
971
  case "save": {
953
972
  return vue.createVNode("div", {
954
- "class": `${config.prefix}-toolbar-item`,
973
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
955
974
  "title": (_P = ult.value.toolbarTips) == null ? void 0 : _P.save,
956
975
  "onClick": () => {
976
+ if (disabled == null ? void 0 : disabled.value) {
977
+ return false;
978
+ }
957
979
  eventName.bus.emit(editorId, eventName.ON_SAVE);
958
980
  }
959
981
  }, [vue.createVNode(MdModal.Icon, {
@@ -964,7 +986,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
964
986
  }
965
987
  case "prettier": {
966
988
  return !props2.noPrettier ? vue.createVNode("div", {
967
- "class": `${config.prefix}-toolbar-item`,
989
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
968
990
  "title": (_R = ult.value.toolbarTips) == null ? void 0 : _R.prettier,
969
991
  "onClick": () => {
970
992
  emitHandler("prettier");
@@ -977,9 +999,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
977
999
  }
978
1000
  case "pageFullscreen": {
979
1001
  return !props2.setting.fullscreen && vue.createVNode("div", {
980
- "class": [`${config.prefix}-toolbar-item`, props2.setting.pageFullscreen && `${config.prefix}-toolbar-active`],
1002
+ "class": [`${config.prefix}-toolbar-item`, props2.setting.pageFullscreen && `${config.prefix}-toolbar-active`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
981
1003
  "title": (_T = ult.value.toolbarTips) == null ? void 0 : _T.pageFullscreen,
982
1004
  "onClick": () => {
1005
+ if (disabled == null ? void 0 : disabled.value) {
1006
+ return false;
1007
+ }
983
1008
  props2.updateSetting("pageFullscreen");
984
1009
  }
985
1010
  }, [vue.createVNode(MdModal.Icon, {
@@ -990,9 +1015,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
990
1015
  }
991
1016
  case "fullscreen": {
992
1017
  return vue.createVNode("div", {
993
- "class": [`${config.prefix}-toolbar-item`, props2.setting.fullscreen && `${config.prefix}-toolbar-active`],
1018
+ "class": [`${config.prefix}-toolbar-item`, props2.setting.fullscreen && `${config.prefix}-toolbar-active`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
994
1019
  "title": (_V = ult.value.toolbarTips) == null ? void 0 : _V.fullscreen,
995
1020
  "onClick": () => {
1021
+ if (disabled == null ? void 0 : disabled.value) {
1022
+ return false;
1023
+ }
996
1024
  fullscreenHandler();
997
1025
  }
998
1026
  }, [vue.createVNode(MdModal.Icon, {
@@ -1003,9 +1031,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1003
1031
  }
1004
1032
  case "preview": {
1005
1033
  return vue.createVNode("div", {
1006
- "class": [`${config.prefix}-toolbar-item`, props2.setting.preview && `${config.prefix}-toolbar-active`],
1034
+ "class": [`${config.prefix}-toolbar-item`, props2.setting.preview && `${config.prefix}-toolbar-active`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1007
1035
  "title": (_X = ult.value.toolbarTips) == null ? void 0 : _X.preview,
1008
1036
  "onClick": () => {
1037
+ if (disabled == null ? void 0 : disabled.value) {
1038
+ return false;
1039
+ }
1009
1040
  props2.updateSetting("preview");
1010
1041
  }
1011
1042
  }, [vue.createVNode(MdModal.Icon, {
@@ -1016,9 +1047,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1016
1047
  }
1017
1048
  case "previewOnly": {
1018
1049
  return vue.createVNode("div", {
1019
- "class": [`${config.prefix}-toolbar-item`, props2.setting.previewOnly && `${config.prefix}-toolbar-active`],
1050
+ "class": [`${config.prefix}-toolbar-item`, props2.setting.previewOnly && `${config.prefix}-toolbar-active`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1020
1051
  "title": (_Z = ult.value.toolbarTips) == null ? void 0 : _Z.previewOnly,
1021
1052
  "onClick": () => {
1053
+ if (disabled == null ? void 0 : disabled.value) {
1054
+ return false;
1055
+ }
1022
1056
  props2.updateSetting("previewOnly");
1023
1057
  }
1024
1058
  }, [vue.createVNode(MdModal.Icon, {
@@ -1029,9 +1063,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1029
1063
  }
1030
1064
  case "htmlPreview": {
1031
1065
  return vue.createVNode("div", {
1032
- "class": [`${config.prefix}-toolbar-item`, props2.setting.htmlPreview && `${config.prefix}-toolbar-active`],
1066
+ "class": [`${config.prefix}-toolbar-item`, props2.setting.htmlPreview && `${config.prefix}-toolbar-active`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1033
1067
  "title": (_$ = ult.value.toolbarTips) == null ? void 0 : _$.htmlPreview,
1034
1068
  "onClick": () => {
1069
+ if (disabled == null ? void 0 : disabled.value) {
1070
+ return false;
1071
+ }
1035
1072
  props2.updateSetting("htmlPreview");
1036
1073
  }
1037
1074
  }, [vue.createVNode(MdModal.Icon, {
@@ -1042,9 +1079,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1042
1079
  }
1043
1080
  case "catalog": {
1044
1081
  return vue.createVNode("div", {
1045
- "class": [`${config.prefix}-toolbar-item`, props2.catalogVisible && `${config.prefix}-toolbar-active`],
1082
+ "class": [`${config.prefix}-toolbar-item`, props2.catalogVisible && `${config.prefix}-toolbar-active`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1046
1083
  "title": (_ba = ult.value.toolbarTips) == null ? void 0 : _ba.catalog,
1047
1084
  "onClick": () => {
1085
+ if (disabled == null ? void 0 : disabled.value) {
1086
+ return false;
1087
+ }
1048
1088
  eventName.bus.emit(editorId, eventName.CHANGE_CATALOG_VISIBLE);
1049
1089
  },
1050
1090
  "key": "bar-catalog"
@@ -1056,9 +1096,14 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1056
1096
  }
1057
1097
  case "github": {
1058
1098
  return vue.createVNode("div", {
1059
- "class": `${config.prefix}-toolbar-item`,
1099
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1060
1100
  "title": (_da = ult.value.toolbarTips) == null ? void 0 : _da.github,
1061
- "onClick": () => util.linkTo("https://github.com/imzbf/md-editor-v3")
1101
+ "onClick": () => {
1102
+ if (disabled == null ? void 0 : disabled.value) {
1103
+ return false;
1104
+ }
1105
+ util.linkTo("https://github.com/imzbf/md-editor-v3");
1106
+ }
1062
1107
  }, [vue.createVNode(MdModal.Icon, {
1063
1108
  "name": "github"
1064
1109
  }, null), props2.showToolbarName && vue.createVNode("div", {
@@ -1072,6 +1117,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1072
1117
  "onChange": (v) => {
1073
1118
  visible.mermaid = v;
1074
1119
  },
1120
+ "disabled": disabled == null ? void 0 : disabled.value,
1075
1121
  "overlay": vue.createVNode("ul", {
1076
1122
  "class": `${config.prefix}-menu`,
1077
1123
  "onClick": () => {
@@ -1140,7 +1186,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1140
1186
  default: () => {
1141
1187
  var _a2, _b2;
1142
1188
  return [vue.createVNode("div", {
1143
- "class": `${config.prefix}-toolbar-item`,
1189
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1144
1190
  "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.mermaid
1145
1191
  }, [vue.createVNode(MdModal.Icon, {
1146
1192
  "name": "mermaid"
@@ -1157,6 +1203,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1157
1203
  "onChange": (v) => {
1158
1204
  visible.katex = v;
1159
1205
  },
1206
+ "disabled": disabled == null ? void 0 : disabled.value,
1160
1207
  "overlay": vue.createVNode("ul", {
1161
1208
  "class": `${config.prefix}-menu`,
1162
1209
  "onClick": () => {
@@ -1183,7 +1230,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1183
1230
  default: () => {
1184
1231
  var _a2, _b2;
1185
1232
  return [vue.createVNode("div", {
1186
- "class": `${config.prefix}-toolbar-item`,
1233
+ "class": [`${config.prefix}-toolbar-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`],
1187
1234
  "title": (_a2 = ult.value.toolbarTips) == null ? void 0 : _a2.katex
1188
1235
  }, [vue.createVNode(MdModal.Icon, {
1189
1236
  "name": "formula"
@@ -1202,6 +1249,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1202
1249
  previewTheme: ((_qa = defItem.props) == null ? void 0 : _qa.theme) || previewTheme.value,
1203
1250
  language: ((_ra = defItem.props) == null ? void 0 : _ra.theme) || language2.value,
1204
1251
  codeTheme: ((_sa = defItem.props) == null ? void 0 : _sa.codeTheme) || props2.codeTheme,
1252
+ disabled: ((_ta = defItem.props) == null ? void 0 : _ta.disabled) || (disabled == null ? void 0 : disabled.value),
1205
1253
  insert(generate) {
1206
1254
  eventName.bus.emit(editorId, eventName.REPLACE, "universal", {
1207
1255
  generate
@@ -1215,10 +1263,11 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1215
1263
  const defItem = props2.defToolbars.children[barItem];
1216
1264
  if (defItem) {
1217
1265
  const defItemCloned = vue.cloneVNode(defItem, {
1218
- theme: ((_ta = defItem.props) == null ? void 0 : _ta.theme) || theme.value,
1219
- previewTheme: ((_ua = defItem.props) == null ? void 0 : _ua.theme) || previewTheme.value,
1220
- language: ((_va = defItem.props) == null ? void 0 : _va.theme) || language2.value,
1221
- codeTheme: ((_wa = defItem.props) == null ? void 0 : _wa.codeTheme) || props2.codeTheme,
1266
+ theme: ((_ua = defItem.props) == null ? void 0 : _ua.theme) || theme.value,
1267
+ previewTheme: ((_va = defItem.props) == null ? void 0 : _va.theme) || previewTheme.value,
1268
+ language: ((_wa = defItem.props) == null ? void 0 : _wa.theme) || language2.value,
1269
+ codeTheme: ((_xa = defItem.props) == null ? void 0 : _xa.codeTheme) || props2.codeTheme,
1270
+ disabled: ((_ya = defItem.props) == null ? void 0 : _ya.disabled) || (disabled == null ? void 0 : disabled.value),
1222
1271
  insert(generate) {
1223
1272
  eventName.bus.emit(editorId, eventName.REPLACE, "universal", {
1224
1273
  generate
@@ -2870,6 +2919,10 @@ const props$2 = {
2870
2919
  type: Function,
2871
2920
  default: () => {
2872
2921
  }
2922
+ },
2923
+ disabled: {
2924
+ type: Boolean,
2925
+ default: void 0
2873
2926
  }
2874
2927
  };
2875
2928
  const Checkbox = /* @__PURE__ */ vue.defineComponent({
@@ -2878,9 +2931,11 @@ const Checkbox = /* @__PURE__ */ vue.defineComponent({
2878
2931
  setup(props2) {
2879
2932
  return () => {
2880
2933
  return vue.createVNode("div", {
2881
- "class": [`${config.prefix}-checkbox`, props2.checked && `${config.prefix}-checkbox-checked`],
2934
+ "class": [`${config.prefix}-checkbox`, props2.checked && `${config.prefix}-checkbox-checked`, props2.disabled && `${config.prefix}-disabled`],
2882
2935
  "onClick": () => {
2883
- props2.onChange(!props2.checked);
2936
+ if (!props2.disabled) {
2937
+ props2.onChange(!props2.checked);
2938
+ }
2884
2939
  }
2885
2940
  }, null);
2886
2941
  };
@@ -2900,18 +2955,20 @@ const ScrollAuto = /* @__PURE__ */ vue.defineComponent({
2900
2955
  props: props$1,
2901
2956
  setup(props2) {
2902
2957
  const ult = vue.inject("usedLanguageText");
2958
+ const disabled = vue.inject("disabled");
2903
2959
  return () => {
2904
2960
  var _a;
2905
2961
  return vue.createVNode("div", {
2906
- "class": `${config.prefix}-footer-item`
2962
+ "class": [`${config.prefix}-footer-item`, (disabled == null ? void 0 : disabled.value) && `${config.prefix}-disabled`]
2907
2963
  }, [vue.createVNode("label", {
2908
2964
  "class": `${config.prefix}-footer-label`,
2909
2965
  "onClick": () => {
2910
2966
  props2.onScrollAutoChange(!props2.scrollAuto);
2911
2967
  }
2912
- }, [(_a = ult.value.footer) == null ? void 0 : _a.scrollAuto]), vue.createVNode(Checkbox, {
2968
+ }, [(_a = ult == null ? void 0 : ult.value.footer) == null ? void 0 : _a.scrollAuto]), vue.createVNode(Checkbox, {
2913
2969
  "checked": props2.scrollAuto,
2914
- "onChange": props2.onScrollAutoChange
2970
+ "onChange": props2.onScrollAutoChange,
2971
+ "disabled": disabled == null ? void 0 : disabled.value
2915
2972
  }, null)]);
2916
2973
  };
2917
2974
  }
@@ -2944,6 +3001,9 @@ const Footer = /* @__PURE__ */ vue.defineComponent({
2944
3001
  name: "MDEditorFooter",
2945
3002
  props,
2946
3003
  setup(props2) {
3004
+ const theme = vue.inject("theme");
3005
+ const language2 = vue.inject("language");
3006
+ const disabled = vue.inject("disabled");
2947
3007
  const splitedItems = vue.computed(() => {
2948
3008
  const moduleSplitIndex = props2.footers.indexOf("=");
2949
3009
  const barLeft = moduleSplitIndex === -1 ? props2.footers : props2.footers.slice(0, moduleSplitIndex);
@@ -2951,6 +3011,7 @@ const Footer = /* @__PURE__ */ vue.defineComponent({
2951
3011
  return [barLeft, barRight];
2952
3012
  });
2953
3013
  const footerRender = (name) => {
3014
+ var _a, _b, _c, _d, _e, _f;
2954
3015
  if (config.allFooter.includes(name)) {
2955
3016
  switch (name) {
2956
3017
  case "markdownTotal": {
@@ -2966,9 +3027,27 @@ const Footer = /* @__PURE__ */ vue.defineComponent({
2966
3027
  }
2967
3028
  }
2968
3029
  } else if (props2.defFooters instanceof Array) {
2969
- return props2.defFooters[name] || "";
3030
+ const defItem = props2.defFooters[name];
3031
+ if (defItem) {
3032
+ const defItemCloned = vue.cloneVNode(defItem, {
3033
+ theme: ((_a = defItem.props) == null ? void 0 : _a.theme) || theme.value,
3034
+ language: ((_b = defItem.props) == null ? void 0 : _b.language) || language2.value,
3035
+ disabled: ((_c = defItem.props) == null ? void 0 : _c.disabled) || (disabled == null ? void 0 : disabled.value)
3036
+ });
3037
+ return defItemCloned;
3038
+ }
3039
+ return "";
2970
3040
  } else if (props2.defFooters && props2.defFooters.children instanceof Array) {
2971
- return props2.defFooters.children[name] || "";
3041
+ const defItem = props2.defFooters.children[name];
3042
+ if (defItem) {
3043
+ const defItemCloned = vue.cloneVNode(defItem, {
3044
+ theme: ((_d = defItem.props) == null ? void 0 : _d.theme) || theme.value,
3045
+ language: ((_e = defItem.props) == null ? void 0 : _e.language) || language2.value,
3046
+ disabled: ((_f = defItem.props) == null ? void 0 : _f.disabled) || (disabled == null ? void 0 : disabled.value)
3047
+ });
3048
+ return defItemCloned;
3049
+ }
3050
+ return "";
2972
3051
  } else {
2973
3052
  return "";
2974
3053
  }
@@ -12,7 +12,7 @@ const props = {
12
12
  default: ""
13
13
  },
14
14
  modalTitle: {
15
- type: String,
15
+ type: [String, Object],
16
16
  default: ""
17
17
  },
18
18
  visible: {
@@ -89,6 +89,10 @@ const props = {
89
89
  codeTheme: {
90
90
  type: String,
91
91
  default: void 0
92
+ },
93
+ disabled: {
94
+ type: Boolean,
95
+ default: void 0
92
96
  }
93
97
  /**
94
98
  * ==结束
@@ -104,10 +108,14 @@ const ModalToolbar = /* @__PURE__ */ vue.defineComponent({
104
108
  props: props2,
105
109
  ctx
106
110
  }, "trigger");
111
+ const ModalTitle = vueTsx.getSlot({
112
+ props: props2,
113
+ ctx
114
+ }, "modalTitle");
107
115
  const Default = vueTsx.getSlot({
108
116
  props: props2,
109
117
  ctx
110
- }, "default");
118
+ });
111
119
  return vue.createVNode(vue.Fragment, null, [vue.createVNode("div", {
112
120
  "class": `${config.prefix}-toolbar-item`,
113
121
  "title": props2.title,
@@ -123,7 +131,7 @@ const ModalToolbar = /* @__PURE__ */ vue.defineComponent({
123
131
  "class": props2.class,
124
132
  "width": props2.width,
125
133
  "height": props2.height,
126
- "title": props2.modalTitle,
134
+ "title": ModalTitle,
127
135
  "visible": props2.visible,
128
136
  "showMask": props2.showMask,
129
137
  "onClose": () => {
@@ -7,7 +7,11 @@ const props = {
7
7
  type: String,
8
8
  default: ""
9
9
  },
10
- // 展示在工具栏的内容,通常是个图标
10
+ /**
11
+ * 展示在工具栏的内容,通常是个图标
12
+ *
13
+ * @deprecated 使用默认插槽代替
14
+ */
11
15
  trigger: {
12
16
  type: [String, Object],
13
17
  default: void 0
@@ -38,6 +42,10 @@ const props = {
38
42
  codeTheme: {
39
43
  type: String,
40
44
  default: void 0
45
+ },
46
+ disabled: {
47
+ type: Boolean,
48
+ default: void 0
41
49
  }
42
50
  /**
43
51
  * ==结束
@@ -53,6 +61,10 @@ const NormalToolbar = /* @__PURE__ */ vue.defineComponent({
53
61
  props: props2,
54
62
  ctx
55
63
  }, "trigger");
64
+ const Default = vueTsx.getSlot({
65
+ props: props2,
66
+ ctx
67
+ });
56
68
  return vue.createVNode("div", {
57
69
  "class": `${config.prefix}-toolbar-item`,
58
70
  "title": props2.title,
@@ -63,7 +75,7 @@ const NormalToolbar = /* @__PURE__ */ vue.defineComponent({
63
75
  ctx.emit("onClick", e);
64
76
  }
65
77
  }
66
- }, [Trigger]);
78
+ }, [Default || Trigger]);
67
79
  };
68
80
  }
69
81
  });
@@ -1373,6 +1373,10 @@ const useProvidePreview = (props, rootRef) => {
1373
1373
  };
1374
1374
  const useProvide = (props, rootRef) => {
1375
1375
  vue.provide("tabWidth", props.tabWidth);
1376
+ vue.provide(
1377
+ "disabled",
1378
+ vue.computed(() => props.disabled)
1379
+ );
1376
1380
  return useProvidePreview(props, rootRef);
1377
1381
  };
1378
1382
  const useExpansion = (props) => {
@@ -1503,7 +1507,7 @@ const useConfig = (props, context, options) => {
1503
1507
  });
1504
1508
  return [setting, updateSetting];
1505
1509
  };
1506
- const useCatalog = (props, options) => {
1510
+ const useCatalog = (_props, options) => {
1507
1511
  const { editorId } = options;
1508
1512
  const catalogShow = vue.ref(false);
1509
1513
  vue.onMounted(() => {
@@ -1518,10 +1522,7 @@ const useCatalog = (props, options) => {
1518
1522
  }
1519
1523
  });
1520
1524
  });
1521
- const catalogVisible = vue.computed(() => {
1522
- return !props.toolbarsExclude.includes("catalog") && props.toolbars.includes("catalog") && catalogShow.value;
1523
- });
1524
- return catalogVisible;
1525
+ return catalogShow;
1525
1526
  };
1526
1527
  const useExpose$1 = (props, ctx, options) => {
1527
1528
  const { editorId, catalogVisible, setting, updateSetting, codeRef } = options;