md-editor-v3 2.2.0-beta.2 → 2.2.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.
@@ -527,14 +527,14 @@ const updateHandler = debounce((id, attr, value) => {
527
527
  ele.setAttribute(attr, value);
528
528
  }
529
529
  }, 10);
530
- const useKeyBoard = (props2, context) => {
531
- const { editorId, noPrettier } = props2;
530
+ const useKeyBoard = (props, context) => {
531
+ const { editorId, noPrettier } = props;
532
532
  const initFunc = (name) => {
533
533
  var _a, _b;
534
- return ((_a = props2.toolbars) == null ? void 0 : _a.includes(name)) && !((_b = props2.toolbarsExclude) == null ? void 0 : _b.includes(name)) && !noPrettier;
534
+ return ((_a = props.toolbars) == null ? void 0 : _a.includes(name)) && !((_b = props.toolbarsExclude) == null ? void 0 : _b.includes(name)) && !noPrettier;
535
535
  };
536
536
  const keyDownHandler = (event) => {
537
- if (event.target !== document.querySelector(`#${props2.editorId}-textarea`)) {
537
+ if (event.target !== document.querySelector(`#${props.editorId}-textarea`)) {
538
538
  return;
539
539
  }
540
540
  bus.emit(editorId, "selectTextChange");
@@ -547,7 +547,7 @@ const useKeyBoard = (props2, context) => {
547
547
  }
548
548
  } else {
549
549
  if (initFunc("save")) {
550
- bus.emit(editorId, "onSave", props2.modelValue);
550
+ bus.emit(editorId, "onSave", props.modelValue);
551
551
  event.preventDefault();
552
552
  }
553
553
  }
@@ -768,58 +768,58 @@ const useKeyBoard = (props2, context) => {
768
768
  }
769
769
  };
770
770
  onMounted(() => {
771
- if (!props2.previewOnly) {
771
+ if (!props.previewOnly) {
772
772
  window.addEventListener("keydown", keyDownHandler);
773
773
  bus.on(editorId, {
774
774
  name: "onSave",
775
775
  callback() {
776
- if (props2.onSave) {
777
- props2.onSave(props2.modelValue);
776
+ if (props.onSave) {
777
+ props.onSave(props.modelValue);
778
778
  } else {
779
- context.emit("onSave", props2.modelValue);
779
+ context.emit("onSave", props.modelValue);
780
780
  }
781
781
  }
782
782
  });
783
783
  }
784
784
  });
785
785
  onBeforeUnmount(() => {
786
- if (!props2.previewOnly) {
786
+ if (!props.previewOnly) {
787
787
  window.removeEventListener("keydown", keyDownHandler);
788
788
  }
789
789
  });
790
790
  };
791
- const useProvide = (props2) => {
791
+ const useProvide = (props) => {
792
792
  var _a;
793
- const { editorId } = props2;
793
+ const { editorId } = props;
794
794
  const highlightConfig = (_a = configOption == null ? void 0 : configOption.editorExtensions) == null ? void 0 : _a.highlight;
795
795
  provide("editorId", editorId);
796
- provide("tabWidth", props2.tabWidth);
797
- provide("theme", computed(() => props2.theme));
796
+ provide("tabWidth", props.tabWidth);
797
+ provide("theme", computed(() => props.theme));
798
798
  provide("highlight", computed(() => {
799
799
  const cssList = __spreadValues(__spreadValues({}, codeCss), highlightConfig == null ? void 0 : highlightConfig.css);
800
800
  return {
801
801
  js: (highlightConfig == null ? void 0 : highlightConfig.js) || highlightUrl,
802
- css: cssList[props2.codeTheme] ? cssList[props2.codeTheme][props2.theme] : codeCss.atom[props2.theme]
802
+ css: cssList[props.codeTheme] ? cssList[props.codeTheme][props.theme] : codeCss.atom[props.theme]
803
803
  };
804
804
  }));
805
- provide("historyLength", props2.historyLength);
806
- provide("previewOnly", props2.previewOnly);
807
- provide("showCodeRowNumber", props2.showCodeRowNumber);
805
+ provide("historyLength", props.historyLength);
806
+ provide("previewOnly", props.previewOnly);
807
+ provide("showCodeRowNumber", props.showCodeRowNumber);
808
808
  const usedLanguageText = computed(() => {
809
809
  var _a2;
810
810
  const allText = __spreadValues(__spreadValues({}, staticTextDefault), (_a2 = configOption == null ? void 0 : configOption.editorConfig) == null ? void 0 : _a2.languageUserDefined);
811
- if (allText[props2.language]) {
812
- return allText[props2.language];
811
+ if (allText[props.language]) {
812
+ return allText[props.language];
813
813
  } else {
814
814
  return staticTextDefault["zh-CN"];
815
815
  }
816
816
  });
817
817
  provide("usedLanguageText", usedLanguageText);
818
- provide("previewTheme", computed(() => props2.previewTheme));
818
+ provide("previewTheme", computed(() => props.previewTheme));
819
819
  };
820
- const useExpansion = (props2) => {
820
+ const useExpansion = (props) => {
821
821
  var _a, _b, _c, _d, _e, _f;
822
- const { noPrettier, previewOnly, noIconfont } = props2;
822
+ const { noPrettier, previewOnly, noIconfont } = props;
823
823
  const { editorExtensions } = configOption;
824
824
  const noPrettierScript = noPrettier || !!((_b = (_a = configOption.editorExtensions) == null ? void 0 : _a.prettier) == null ? void 0 : _b.prettierInstance);
825
825
  const noParserMarkdownScript = noPrettier || !!((_d = (_c = configOption.editorExtensions) == null ? void 0 : _c.prettier) == null ? void 0 : _d.parserMarkdownInstance);
@@ -859,13 +859,13 @@ const useExpansion = (props2) => {
859
859
  }
860
860
  });
861
861
  };
862
- const useConfig = (props2, context) => {
863
- const { editorId } = props2;
862
+ const useConfig = (props, context) => {
863
+ const { editorId } = props;
864
864
  const setting = reactive({
865
- pageFullScreen: props2.pageFullScreen,
865
+ pageFullScreen: props.pageFullScreen,
866
866
  fullscreen: false,
867
- preview: props2.preview,
868
- htmlPreview: props2.preview ? false : props2.htmlPreview
867
+ preview: props.preview,
868
+ htmlPreview: props.preview ? false : props.htmlPreview
869
869
  });
870
870
  const updateSetting = (v, k) => {
871
871
  setting[k] = v;
@@ -885,7 +885,7 @@ const useConfig = (props2, context) => {
885
885
  };
886
886
  watch(() => [setting.pageFullScreen, setting.fullscreen], adjustBody);
887
887
  onMounted(() => {
888
- if (!props2.previewOnly) {
888
+ if (!props.previewOnly) {
889
889
  bus.on(editorId, {
890
890
  name: "uploadImage",
891
891
  callback(files, cb) {
@@ -896,8 +896,8 @@ const useConfig = (props2, context) => {
896
896
  });
897
897
  cb && cb();
898
898
  };
899
- if (props2.onUploadImg) {
900
- props2.onUploadImg(files, insertHanlder);
899
+ if (props.onUploadImg) {
900
+ props.onUploadImg(files, insertHanlder);
901
901
  } else {
902
902
  context.emit("onUploadImg", files, insertHanlder);
903
903
  }
@@ -909,8 +909,8 @@ const useConfig = (props2, context) => {
909
909
  });
910
910
  return [setting, updateSetting];
911
911
  };
912
- const useCatalog = (props2) => {
913
- const { editorId } = props2;
912
+ const useCatalog = (props) => {
913
+ const { editorId } = props;
914
914
  const catalogVisible = ref(false);
915
915
  onMounted(() => {
916
916
  bus.on(editorId, {
@@ -921,7 +921,7 @@ const useCatalog = (props2) => {
921
921
  });
922
922
  });
923
923
  const catalogShow = computed(() => {
924
- return !props2.toolbarsExclude.includes("catalog") && props2.toolbars.includes("catalog");
924
+ return !props.toolbarsExclude.includes("catalog") && props.toolbars.includes("catalog");
925
925
  });
926
926
  return [catalogVisible, catalogShow];
927
927
  };
@@ -936,37 +936,38 @@ var Divider = defineComponent({
936
936
  const getSlot = ({
937
937
  instance,
938
938
  ctx,
939
- props: props2 = {}
939
+ props = {}
940
940
  }, name = "default") => {
941
941
  const targetSlot = (instance == null ? void 0 : instance.$slots[name]) || (ctx == null ? void 0 : ctx.slots[name]);
942
- return (targetSlot ? targetSlot(instance) : "") || props2[name];
942
+ return (targetSlot ? targetSlot(instance) : "") || props[name];
943
943
  };
944
944
  var style$4 = "";
945
- var Dropdown = defineComponent({
946
- props: {
947
- trigger: {
948
- type: String,
949
- default: "hover"
950
- },
951
- overlay: {
952
- type: [String, Object],
953
- default: ""
954
- },
955
- visible: {
956
- type: Boolean,
957
- default: false
958
- },
959
- onChange: {
960
- type: Function,
961
- default: () => () => {
962
- }
963
- },
964
- relative: {
965
- type: String,
966
- default: "html"
945
+ const dropdownToolbarProps$1 = () => ({
946
+ trigger: {
947
+ type: String,
948
+ default: "hover"
949
+ },
950
+ overlay: {
951
+ type: [String, Object],
952
+ default: ""
953
+ },
954
+ visible: {
955
+ type: Boolean,
956
+ default: false
957
+ },
958
+ onChange: {
959
+ type: Function,
960
+ default: () => () => {
967
961
  }
968
962
  },
969
- setup(props2, ctx) {
963
+ relative: {
964
+ type: String,
965
+ default: "html"
966
+ }
967
+ });
968
+ var Dropdown = defineComponent({
969
+ props: dropdownToolbarProps$1(),
970
+ setup(props, ctx) {
970
971
  const HIDDEN_CLASS = `${prefix}-dropdown-hidden`;
971
972
  const ctl = reactive({
972
973
  overlayClass: [HIDDEN_CLASS],
@@ -978,7 +979,7 @@ var Dropdown = defineComponent({
978
979
  const overlayRef = ref();
979
980
  const triggerHandler = () => {
980
981
  var _a;
981
- if (props2.trigger === "hover") {
982
+ if (props.trigger === "hover") {
982
983
  ctl.triggerHover = true;
983
984
  }
984
985
  const triggerEle = triggerRef.value;
@@ -988,17 +989,17 @@ var Dropdown = defineComponent({
988
989
  const triggerLeft = triggerEle.offsetLeft;
989
990
  const triggerHeight = triggerInfo.height;
990
991
  const triggerWidth = triggerInfo.width;
991
- const relativecrollLeft = ((_a = document.querySelector(props2.relative)) == null ? void 0 : _a.scrollLeft) || 0;
992
+ const relativecrollLeft = ((_a = document.querySelector(props.relative)) == null ? void 0 : _a.scrollLeft) || 0;
992
993
  ctl.overlayStyle = __spreadProps(__spreadValues({}, ctl.overlayStyle), {
993
994
  top: triggerTop + triggerHeight + "px",
994
995
  left: triggerLeft - overlayEle.offsetWidth / 2 + triggerWidth / 2 - relativecrollLeft + "px"
995
996
  });
996
- props2.onChange(true);
997
+ props.onChange(true);
997
998
  };
998
999
  const overlayHandler = () => {
999
1000
  ctl.overlayHover = true;
1000
1001
  };
1001
- watch(() => props2.visible, (newV) => {
1002
+ watch(() => props.visible, (newV) => {
1002
1003
  if (newV) {
1003
1004
  ctl.overlayClass = ctl.overlayClass.filter((classItem) => classItem !== HIDDEN_CLASS);
1004
1005
  } else {
@@ -1009,7 +1010,7 @@ var Dropdown = defineComponent({
1009
1010
  const triggerEle = triggerRef.value;
1010
1011
  const overlayEle = overlayRef.value;
1011
1012
  if (!triggerEle.contains(e.target) && !overlayEle.contains(e.target)) {
1012
- props2.onChange(false);
1013
+ props.onChange(false);
1013
1014
  }
1014
1015
  };
1015
1016
  let hiddenTimer = -1;
@@ -1022,12 +1023,12 @@ var Dropdown = defineComponent({
1022
1023
  clearTimeout(hiddenTimer);
1023
1024
  hiddenTimer = window.setTimeout(() => {
1024
1025
  if (!ctl.overlayHover && !ctl.triggerHover) {
1025
- props2.onChange(false);
1026
+ props.onChange(false);
1026
1027
  }
1027
1028
  }, 10);
1028
1029
  };
1029
1030
  onMounted(() => {
1030
- if (props2.trigger === "click") {
1031
+ if (props.trigger === "click") {
1031
1032
  triggerRef.value.addEventListener("click", triggerHandler);
1032
1033
  document.addEventListener("click", clickHidden);
1033
1034
  } else {
@@ -1038,7 +1039,7 @@ var Dropdown = defineComponent({
1038
1039
  }
1039
1040
  });
1040
1041
  onBeforeUnmount(() => {
1041
- if (props2.trigger === "click") {
1042
+ if (props.trigger === "click") {
1042
1043
  triggerRef.value.removeEventListener("click", triggerHandler);
1043
1044
  document.removeEventListener("click", clickHidden);
1044
1045
  } else {
@@ -1053,7 +1054,7 @@ var Dropdown = defineComponent({
1053
1054
  ctx
1054
1055
  });
1055
1056
  const slotOverlay = getSlot({
1056
- props: props2,
1057
+ props,
1057
1058
  ctx
1058
1059
  }, "overlay");
1059
1060
  const trigger = cloneVNode(slotDefault instanceof Array ? slotDefault[0] : slotDefault, {
@@ -1071,45 +1072,46 @@ var Dropdown = defineComponent({
1071
1072
  }
1072
1073
  });
1073
1074
  var style$3 = "";
1074
- var Modal = defineComponent({
1075
- props: {
1076
- title: {
1077
- type: String,
1078
- default: ""
1079
- },
1080
- visible: {
1081
- type: Boolean,
1082
- default: false
1083
- },
1084
- width: {
1085
- type: String,
1086
- default: "auto"
1087
- },
1088
- height: {
1089
- type: String,
1090
- default: "auto"
1091
- },
1092
- onClose: {
1093
- type: Function,
1094
- default: () => () => {
1095
- }
1096
- },
1097
- showAdjust: {
1098
- type: Boolean,
1099
- default: false
1100
- },
1101
- isFullscreen: {
1102
- type: Boolean,
1103
- default: false
1104
- },
1105
- onAdjust: {
1106
- type: Function,
1107
- default: () => () => {
1108
- }
1075
+ const modalProps = () => ({
1076
+ title: {
1077
+ type: String,
1078
+ default: ""
1079
+ },
1080
+ visible: {
1081
+ type: Boolean,
1082
+ default: false
1083
+ },
1084
+ width: {
1085
+ type: String,
1086
+ default: "auto"
1087
+ },
1088
+ height: {
1089
+ type: String,
1090
+ default: "auto"
1091
+ },
1092
+ onClose: {
1093
+ type: Function,
1094
+ default: () => () => {
1109
1095
  }
1110
1096
  },
1111
- setup(props2, ctx) {
1112
- const modalVisible = ref(props2.visible);
1097
+ showAdjust: {
1098
+ type: Boolean,
1099
+ default: false
1100
+ },
1101
+ isFullscreen: {
1102
+ type: Boolean,
1103
+ default: false
1104
+ },
1105
+ onAdjust: {
1106
+ type: Function,
1107
+ default: () => () => {
1108
+ }
1109
+ }
1110
+ });
1111
+ var Modal = defineComponent({
1112
+ props: modalProps(),
1113
+ setup(props, ctx) {
1114
+ const modalVisible = ref(props.visible);
1113
1115
  const modalClass = ref([`${prefix}-modal`]);
1114
1116
  const modalRef = ref();
1115
1117
  const modalHeaderRef = ref();
@@ -1126,15 +1128,15 @@ var Modal = defineComponent({
1126
1128
  }
1127
1129
  });
1128
1130
  const innerSize = computed(() => {
1129
- if (props2.isFullscreen) {
1131
+ if (props.isFullscreen) {
1130
1132
  return {
1131
1133
  width: "100%",
1132
1134
  height: "100%"
1133
1135
  };
1134
1136
  } else {
1135
1137
  return {
1136
- width: props2.width,
1137
- height: props2.height
1138
+ width: props.width,
1139
+ height: props.height
1138
1140
  };
1139
1141
  }
1140
1142
  });
@@ -1147,7 +1149,7 @@ var Modal = defineComponent({
1147
1149
  onBeforeUnmount(() => {
1148
1150
  keyMoveClear();
1149
1151
  });
1150
- watch(() => props2.isFullscreen, (nVal) => {
1152
+ watch(() => props.isFullscreen, (nVal) => {
1151
1153
  if (nVal) {
1152
1154
  keyMoveClear();
1153
1155
  } else {
@@ -1157,7 +1159,7 @@ var Modal = defineComponent({
1157
1159
  });
1158
1160
  }
1159
1161
  });
1160
- watch(() => props2.visible, (nVal) => {
1162
+ watch(() => props.visible, (nVal) => {
1161
1163
  if (nVal) {
1162
1164
  modalClass.value.push("zoom-in");
1163
1165
  modalVisible.value = nVal;
@@ -1185,7 +1187,7 @@ var Modal = defineComponent({
1185
1187
  ctx
1186
1188
  });
1187
1189
  const slotTitle = getSlot({
1188
- props: props2,
1190
+ props,
1189
1191
  ctx
1190
1192
  }, "title");
1191
1193
  return createVNode("div", {
@@ -1194,7 +1196,7 @@ var Modal = defineComponent({
1194
1196
  }
1195
1197
  }, [createVNode("div", {
1196
1198
  "class": `${prefix}-modal-mask`,
1197
- "onClick": props2.onClose
1199
+ "onClick": props.onClose
1198
1200
  }, null), createVNode("div", {
1199
1201
  "class": modalClass.value,
1200
1202
  "style": __spreadValues(__spreadValues({}, state.initPos), innerSize.value),
@@ -1206,11 +1208,11 @@ var Modal = defineComponent({
1206
1208
  "class": `${prefix}-modal-body`
1207
1209
  }, [slotDefault]), createVNode("div", {
1208
1210
  "class": `${prefix}-modal-func`
1209
- }, [props2.showAdjust && createVNode("div", {
1211
+ }, [props.showAdjust && createVNode("div", {
1210
1212
  "class": `${prefix}-modal-adjust`,
1211
1213
  "onClick": (e) => {
1212
1214
  e.stopPropagation();
1213
- if (!props2.isFullscreen) {
1215
+ if (!props.isFullscreen) {
1214
1216
  state.historyPos = state.initPos;
1215
1217
  state.initPos = {
1216
1218
  left: "0",
@@ -1219,18 +1221,18 @@ var Modal = defineComponent({
1219
1221
  } else {
1220
1222
  state.initPos = state.historyPos;
1221
1223
  }
1222
- props2.onAdjust(!props2.isFullscreen);
1224
+ props.onAdjust(!props.isFullscreen);
1223
1225
  }
1224
1226
  }, [createVNode("svg", {
1225
1227
  "class": `${prefix}-icon`,
1226
1228
  "aria-hidden": "true"
1227
1229
  }, [createVNode("use", {
1228
- "xlink:href": `#icon-${props2.isFullscreen ? "suoxiao" : "fangda"}`
1230
+ "xlink:href": `#icon-${props.isFullscreen ? "suoxiao" : "fangda"}`
1229
1231
  }, null)])]), createVNode("div", {
1230
1232
  "class": `${prefix}-modal-close`,
1231
1233
  "onClick": (e) => {
1232
1234
  e.stopPropagation();
1233
- props2.onClose && props2.onClose();
1235
+ props.onClose && props.onClose();
1234
1236
  }
1235
1237
  }, [createVNode("svg", {
1236
1238
  "class": `${prefix}-icon`,
@@ -1241,33 +1243,34 @@ var Modal = defineComponent({
1241
1243
  };
1242
1244
  }
1243
1245
  });
1244
- var LinkModal = defineComponent({
1245
- props: {
1246
- type: {
1247
- type: String,
1248
- default: "link"
1249
- },
1250
- visible: {
1251
- type: Boolean,
1252
- default: false
1253
- },
1254
- onCancel: {
1255
- type: Function,
1256
- default: () => () => {
1257
- }
1258
- },
1259
- onOk: {
1260
- type: Function,
1261
- default: () => () => {
1262
- }
1246
+ const linkProps = () => ({
1247
+ type: {
1248
+ type: String,
1249
+ default: "link"
1250
+ },
1251
+ visible: {
1252
+ type: Boolean,
1253
+ default: false
1254
+ },
1255
+ onCancel: {
1256
+ type: Function,
1257
+ default: () => () => {
1263
1258
  }
1264
1259
  },
1265
- setup(props2) {
1260
+ onOk: {
1261
+ type: Function,
1262
+ default: () => () => {
1263
+ }
1264
+ }
1265
+ });
1266
+ var LinkModal = defineComponent({
1267
+ props: linkProps(),
1268
+ setup(props) {
1266
1269
  const ult = inject("usedLanguageText");
1267
1270
  const editorId = inject("editorId");
1268
1271
  const title = computed(() => {
1269
1272
  var _a, _b, _c, _d;
1270
- switch (props2.type) {
1273
+ switch (props.type) {
1271
1274
  case "link": {
1272
1275
  return `${(_a = ult.value.linkModalTips) == null ? void 0 : _a.title}${(_b = ult.value.toolbarTips) == null ? void 0 : _b.link}`;
1273
1276
  }
@@ -1283,7 +1286,7 @@ var LinkModal = defineComponent({
1283
1286
  desc: "",
1284
1287
  url: ""
1285
1288
  });
1286
- watch(() => props2.visible, (nVal) => {
1289
+ watch(() => props.visible, (nVal) => {
1287
1290
  if (!nVal) {
1288
1291
  setTimeout(() => {
1289
1292
  linkData.desc = "";
@@ -1293,8 +1296,8 @@ var LinkModal = defineComponent({
1293
1296
  });
1294
1297
  return () => createVNode(Modal, {
1295
1298
  "title": title.value,
1296
- "visible": props2.visible,
1297
- "onClose": props2.onCancel
1299
+ "visible": props.visible,
1300
+ "onClose": props.onCancel
1298
1301
  }, {
1299
1302
  default: () => {
1300
1303
  var _a, _b, _c, _d, _e;
@@ -1334,7 +1337,7 @@ var LinkModal = defineComponent({
1334
1337
  "class": [`${prefix}-btn`, `${prefix}-btn-row`],
1335
1338
  "type": "button",
1336
1339
  "onClick": () => {
1337
- props2.onOk(linkData);
1340
+ props.onOk(linkData);
1338
1341
  linkData.desc = "";
1339
1342
  linkData.url = "";
1340
1343
  }
@@ -1344,24 +1347,25 @@ var LinkModal = defineComponent({
1344
1347
  }
1345
1348
  });
1346
1349
  var style$2 = "";
1347
- var ClipModal = defineComponent({
1348
- props: {
1349
- visible: {
1350
- type: Boolean,
1351
- default: false
1352
- },
1353
- onCancel: {
1354
- type: Function,
1355
- default: () => () => {
1356
- }
1357
- },
1358
- onOk: {
1359
- type: Function,
1360
- default: () => () => {
1361
- }
1350
+ const clipProps = () => ({
1351
+ visible: {
1352
+ type: Boolean,
1353
+ default: false
1354
+ },
1355
+ onCancel: {
1356
+ type: Function,
1357
+ default: () => () => {
1362
1358
  }
1363
1359
  },
1364
- setup(props2) {
1360
+ onOk: {
1361
+ type: Function,
1362
+ default: () => () => {
1363
+ }
1364
+ }
1365
+ });
1366
+ var ClipModal = defineComponent({
1367
+ props: clipProps(),
1368
+ setup(props) {
1365
1369
  var _a, _b;
1366
1370
  const ult = inject("usedLanguageText");
1367
1371
  const editorId = inject("editorId");
@@ -1376,8 +1380,8 @@ var ClipModal = defineComponent({
1376
1380
  isFullscreen: false
1377
1381
  });
1378
1382
  let cropper = null;
1379
- watch(() => props2.visible, () => {
1380
- if (props2.visible && !data.cropperInited) {
1383
+ watch(() => props.visible, () => {
1384
+ if (props.visible && !data.cropperInited) {
1381
1385
  Cropper = Cropper || window.Cropper;
1382
1386
  uploadRef.value.onchange = () => {
1383
1387
  if (!Cropper) {
@@ -1429,8 +1433,8 @@ var ClipModal = defineComponent({
1429
1433
  var _a2;
1430
1434
  return createVNode(Modal, {
1431
1435
  "title": (_a2 = ult.value.clipModalTips) == null ? void 0 : _a2.title,
1432
- "visible": props2.visible,
1433
- "onClose": props2.onCancel,
1436
+ "visible": props.visible,
1437
+ "onClose": props.onCancel,
1434
1438
  "showAdjust": true,
1435
1439
  "isFullscreen": data.isFullscreen,
1436
1440
  "onAdjust": (val) => {
@@ -1483,7 +1487,7 @@ var ClipModal = defineComponent({
1483
1487
  "type": "button",
1484
1488
  "onClick": () => {
1485
1489
  const cvs = cropper.getCroppedCanvas();
1486
- bus.emit(editorId, "uploadImage", [base642File(cvs.toDataURL("image/png"))], props2.onOk);
1490
+ bus.emit(editorId, "uploadImage", [base642File(cvs.toDataURL("image/png"))], props.onOk);
1487
1491
  reset();
1488
1492
  }
1489
1493
  }, [(_a3 = ult.value.linkModalTips) == null ? void 0 : _a3.buttonOK])]), createVNode("input", {
@@ -1500,45 +1504,46 @@ var ClipModal = defineComponent({
1500
1504
  };
1501
1505
  }
1502
1506
  });
1503
- var Modals = defineComponent({
1504
- props: {
1505
- type: {
1506
- type: String,
1507
- default: "link"
1508
- },
1509
- linkVisible: {
1510
- type: Boolean,
1511
- default: false
1512
- },
1513
- clipVisible: {
1514
- type: Boolean,
1515
- default: false
1516
- },
1517
- onCancel: {
1518
- type: Function,
1519
- default: () => () => {
1520
- }
1521
- },
1522
- onOk: {
1523
- type: Function,
1524
- default: () => () => {
1525
- }
1507
+ const modalsProps = () => ({
1508
+ type: {
1509
+ type: String,
1510
+ default: "link"
1511
+ },
1512
+ linkVisible: {
1513
+ type: Boolean,
1514
+ default: false
1515
+ },
1516
+ clipVisible: {
1517
+ type: Boolean,
1518
+ default: false
1519
+ },
1520
+ onCancel: {
1521
+ type: Function,
1522
+ default: () => () => {
1526
1523
  }
1527
1524
  },
1528
- setup(props2) {
1525
+ onOk: {
1526
+ type: Function,
1527
+ default: () => () => {
1528
+ }
1529
+ }
1530
+ });
1531
+ var Modals = defineComponent({
1532
+ props: modalsProps(),
1533
+ setup(props) {
1529
1534
  return () => createVNode(Fragment, null, [createVNode(LinkModal, {
1530
- "type": props2.type,
1531
- "visible": props2.linkVisible,
1532
- "onOk": props2.onOk,
1533
- "onCancel": props2.onCancel
1535
+ "type": props.type,
1536
+ "visible": props.linkVisible,
1537
+ "onOk": props.onOk,
1538
+ "onCancel": props.onCancel
1534
1539
  }, null), createVNode(ClipModal, {
1535
- "visible": props2.clipVisible,
1536
- "onOk": props2.onOk,
1537
- "onCancel": props2.onCancel
1540
+ "visible": props.clipVisible,
1541
+ "onOk": props.onOk,
1542
+ "onCancel": props.onCancel
1538
1543
  }, null)]);
1539
1544
  }
1540
1545
  });
1541
- const useSreenfull = (props2) => {
1546
+ const useSreenfull = (props) => {
1542
1547
  var _a, _b, _c, _d;
1543
1548
  const editorId = inject("editorId");
1544
1549
  const previewOnly = inject("previewOnly");
@@ -1567,9 +1572,9 @@ const useSreenfull = (props2) => {
1567
1572
  const onScreenfullEvent = () => {
1568
1573
  if (screenfull && screenfull.isEnabled) {
1569
1574
  screenfull.on("change", () => {
1570
- if (screenfullMe.value) {
1575
+ if (screenfullMe.value || props.setting.fullscreen) {
1571
1576
  screenfullMe.value = false;
1572
- props2.updateSetting(!props2.setting.fullscreen, "fullscreen");
1577
+ props.updateSetting(!props.setting.fullscreen, "fullscreen");
1573
1578
  }
1574
1579
  });
1575
1580
  }
@@ -1590,20 +1595,21 @@ const useSreenfull = (props2) => {
1590
1595
  });
1591
1596
  return { fullScreenHandler };
1592
1597
  };
1598
+ const tableShapeProps = () => ({
1599
+ tableShape: {
1600
+ type: Array,
1601
+ default: () => [6, 4]
1602
+ },
1603
+ onSelected: {
1604
+ type: Function,
1605
+ default: () => {
1606
+ }
1607
+ }
1608
+ });
1593
1609
  const TableShape = defineComponent({
1594
1610
  name: "TableShape",
1595
- props: {
1596
- tableShape: {
1597
- type: Array,
1598
- default: () => [6, 4]
1599
- },
1600
- onSelected: {
1601
- type: Function,
1602
- default: () => {
1603
- }
1604
- }
1605
- },
1606
- setup(props2) {
1611
+ props: tableShapeProps(),
1612
+ setup(props) {
1607
1613
  const hoverPosition = reactive({
1608
1614
  x: -1,
1609
1615
  y: -1
@@ -1614,10 +1620,10 @@ const TableShape = defineComponent({
1614
1620
  hoverPosition.x = -1;
1615
1621
  hoverPosition.y = -1;
1616
1622
  }
1617
- }, [new Array(props2.tableShape[1]).fill("").map((_, rowIndex) => createVNode("div", {
1623
+ }, [new Array(props.tableShape[1]).fill("").map((_, rowIndex) => createVNode("div", {
1618
1624
  "class": `${prefix}-table-shape-row`,
1619
1625
  "key": `table-shape-row-${rowIndex}`
1620
- }, [new Array(props2.tableShape[0]).fill("").map((_2, colIndex) => createVNode("div", {
1626
+ }, [new Array(props.tableShape[0]).fill("").map((_2, colIndex) => createVNode("div", {
1621
1627
  "class": `${prefix}-table-shape-col`,
1622
1628
  "key": `table-shape-col-${colIndex}`,
1623
1629
  "onMouseenter": () => {
@@ -1625,58 +1631,59 @@ const TableShape = defineComponent({
1625
1631
  hoverPosition.y = colIndex;
1626
1632
  },
1627
1633
  "onClick": () => {
1628
- props2.onSelected(hoverPosition);
1634
+ props.onSelected(hoverPosition);
1629
1635
  }
1630
1636
  }, [createVNode("div", {
1631
1637
  "class": [`${prefix}-table-shape-col-default`, rowIndex <= hoverPosition.x && colIndex <= hoverPosition.y && `${prefix}-table-shape-col-include`]
1632
1638
  }, null)]))]))]);
1633
1639
  }
1634
1640
  });
1635
- var ToolBar = defineComponent({
1636
- name: "MDEditorToolbar",
1637
- props: {
1638
- noPrettier: {
1639
- type: Boolean
1640
- },
1641
- toolbars: {
1642
- type: Array,
1643
- default: () => []
1644
- },
1645
- toolbarsExclude: {
1646
- type: Array,
1647
- default: () => []
1648
- },
1649
- setting: {
1650
- type: Object,
1651
- default: () => ({})
1652
- },
1653
- screenfull: {
1654
- type: Object,
1655
- default: null
1656
- },
1657
- screenfullJs: {
1658
- type: String,
1659
- default: ""
1660
- },
1661
- updateSetting: {
1662
- type: Function,
1663
- default: () => () => {
1664
- }
1665
- },
1666
- tableShape: {
1667
- type: Array,
1668
- default: () => [6, 4]
1669
- },
1670
- defToolbars: {
1671
- type: Object
1641
+ const toolbarProps = () => ({
1642
+ noPrettier: {
1643
+ type: Boolean
1644
+ },
1645
+ toolbars: {
1646
+ type: Array,
1647
+ default: () => []
1648
+ },
1649
+ toolbarsExclude: {
1650
+ type: Array,
1651
+ default: () => []
1652
+ },
1653
+ setting: {
1654
+ type: Object,
1655
+ default: () => ({})
1656
+ },
1657
+ screenfull: {
1658
+ type: Object,
1659
+ default: null
1660
+ },
1661
+ screenfullJs: {
1662
+ type: String,
1663
+ default: ""
1664
+ },
1665
+ updateSetting: {
1666
+ type: Function,
1667
+ default: () => () => {
1672
1668
  }
1673
1669
  },
1674
- setup(props2) {
1670
+ tableShape: {
1671
+ type: Array,
1672
+ default: () => [6, 4]
1673
+ },
1674
+ defToolbars: {
1675
+ type: Object
1676
+ }
1677
+ });
1678
+ var ToolBar = defineComponent({
1679
+ name: "MDEditorToolbar",
1680
+ props: toolbarProps(),
1681
+ setup(props) {
1675
1682
  const editorId = inject("editorId");
1676
1683
  const ult = inject("usedLanguageText");
1677
1684
  const {
1678
1685
  fullScreenHandler
1679
- } = useSreenfull(props2);
1686
+ } = useSreenfull(props);
1680
1687
  const wrapperId = `${editorId}-toolbar-wrapper`;
1681
1688
  const visible = reactive({
1682
1689
  title: false,
@@ -1705,7 +1712,7 @@ var ToolBar = defineComponent({
1705
1712
  });
1706
1713
  });
1707
1714
  const splitedbar = computed(() => {
1708
- const excluedBars = props2.toolbars.filter((barItem) => !props2.toolbarsExclude.includes(barItem));
1715
+ const excluedBars = props.toolbars.filter((barItem) => !props.toolbarsExclude.includes(barItem));
1709
1716
  const moduleSplitIndex = excluedBars.indexOf("=");
1710
1717
  const barLeft = moduleSplitIndex === -1 ? excluedBars : excluedBars.slice(0, moduleSplitIndex + 1);
1711
1718
  const barRight = moduleSplitIndex === -1 ? [] : excluedBars.slice(moduleSplitIndex, Number.MAX_SAFE_INTEGER);
@@ -2006,7 +2013,7 @@ var ToolBar = defineComponent({
2006
2013
  },
2007
2014
  "key": "bar-table",
2008
2015
  "overlay": createVNode(TableShape, {
2009
- "tableShape": props2.tableShape,
2016
+ "tableShape": props.tableShape,
2010
2017
  "onSelected": (selectedShape) => {
2011
2018
  emitHandler("table", {
2012
2019
  selectedShape
@@ -2071,7 +2078,7 @@ var ToolBar = defineComponent({
2071
2078
  }, null)])]);
2072
2079
  }
2073
2080
  case "prettier": {
2074
- return !props2.noPrettier ? createVNode("div", {
2081
+ return !props.noPrettier ? createVNode("div", {
2075
2082
  "class": `${prefix}-toolbar-item`,
2076
2083
  "title": (_y = ult.value.toolbarTips) == null ? void 0 : _y.prettier,
2077
2084
  "onClick": () => {
@@ -2085,17 +2092,17 @@ var ToolBar = defineComponent({
2085
2092
  }, null)])]) : "";
2086
2093
  }
2087
2094
  case "pageFullscreen": {
2088
- return !props2.setting.fullscreen && createVNode("div", {
2095
+ return !props.setting.fullscreen && createVNode("div", {
2089
2096
  "class": `${prefix}-toolbar-item`,
2090
2097
  "title": (_z = ult.value.toolbarTips) == null ? void 0 : _z.pageFullscreen,
2091
2098
  "onClick": () => {
2092
- props2.updateSetting(!props2.setting.pageFullScreen, "pageFullScreen");
2099
+ props.updateSetting(!props.setting.pageFullScreen, "pageFullScreen");
2093
2100
  }
2094
2101
  }, [createVNode("svg", {
2095
2102
  "class": `${prefix}-icon`,
2096
2103
  "aria-hidden": "true"
2097
2104
  }, [createVNode("use", {
2098
- "xlink:href": `#icon-${props2.setting.pageFullScreen ? "suoxiao" : "fangda"}`
2105
+ "xlink:href": `#icon-${props.setting.pageFullScreen ? "suoxiao" : "fangda"}`
2099
2106
  }, null)])]);
2100
2107
  }
2101
2108
  case "fullscreen": {
@@ -2107,7 +2114,7 @@ var ToolBar = defineComponent({
2107
2114
  "class": `${prefix}-icon`,
2108
2115
  "aria-hidden": "true"
2109
2116
  }, [createVNode("use", {
2110
- "xlink:href": `#icon-${props2.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
2117
+ "xlink:href": `#icon-${props.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
2111
2118
  }, null)])]);
2112
2119
  }
2113
2120
  case "preview": {
@@ -2115,7 +2122,7 @@ var ToolBar = defineComponent({
2115
2122
  "class": `${prefix}-toolbar-item`,
2116
2123
  "title": (_B = ult.value.toolbarTips) == null ? void 0 : _B.preview,
2117
2124
  "onClick": () => {
2118
- props2.updateSetting(!props2.setting.preview, "preview");
2125
+ props.updateSetting(!props.setting.preview, "preview");
2119
2126
  }
2120
2127
  }, [createVNode("svg", {
2121
2128
  "class": `${prefix}-icon`,
@@ -2129,7 +2136,7 @@ var ToolBar = defineComponent({
2129
2136
  "class": `${prefix}-toolbar-item`,
2130
2137
  "title": (_C = ult.value.toolbarTips) == null ? void 0 : _C.htmlPreview,
2131
2138
  "onClick": () => {
2132
- props2.updateSetting(!props2.setting.htmlPreview, "htmlPreview");
2139
+ props.updateSetting(!props.setting.htmlPreview, "htmlPreview");
2133
2140
  }
2134
2141
  }, [createVNode("svg", {
2135
2142
  "class": `${prefix}-icon`,
@@ -2274,11 +2281,11 @@ var ToolBar = defineComponent({
2274
2281
  });
2275
2282
  }
2276
2283
  }
2277
- } else if (props2.defToolbars instanceof Array) {
2278
- const defItem = props2.defToolbars[barItem];
2284
+ } else if (props.defToolbars instanceof Array) {
2285
+ const defItem = props.defToolbars[barItem];
2279
2286
  return defItem || "";
2280
- } else if (props2.defToolbars && props2.defToolbars.children instanceof Array) {
2281
- const defItem = props2.defToolbars.children[barItem];
2287
+ } else if (props.defToolbars && props.defToolbars.children instanceof Array) {
2288
+ const defItem = props.defToolbars.children[barItem];
2282
2289
  return defItem || "";
2283
2290
  } else {
2284
2291
  return "";
@@ -5309,7 +5316,7 @@ var kaTexExtensions = {
5309
5316
  };
5310
5317
  }
5311
5318
  };
5312
- const useHistory = (props2, textAreaRef, completeStatus) => {
5319
+ const useHistory = (props, textAreaRef, completeStatus) => {
5313
5320
  var _a, _b;
5314
5321
  const previewOnly = inject("previewOnly");
5315
5322
  const historyLength = inject("historyLength");
@@ -5321,7 +5328,7 @@ const useHistory = (props2, textAreaRef, completeStatus) => {
5321
5328
  const history = {
5322
5329
  list: [
5323
5330
  {
5324
- content: props2.value,
5331
+ content: props.value,
5325
5332
  startPos: ((_a = textAreaRef.value) == null ? void 0 : _a.selectionStart) || 0,
5326
5333
  endPos: ((_b = textAreaRef.value) == null ? void 0 : _b.selectionEnd) || 0
5327
5334
  }
@@ -5341,7 +5348,7 @@ const useHistory = (props2, textAreaRef, completeStatus) => {
5341
5348
  history.curr = curr;
5342
5349
  const currHistory = history.list[history.curr];
5343
5350
  historyPos = [currHistory.startPos, currHistory.endPos];
5344
- props2.onChange(currHistory.content);
5351
+ props.onChange(currHistory.content);
5345
5352
  setPosition(textAreaRef.value, currHistory.startPos, currHistory.endPos).then(() => {
5346
5353
  bus.emit(editorId, "selectTextChange");
5347
5354
  });
@@ -5384,12 +5391,12 @@ const useHistory = (props2, textAreaRef, completeStatus) => {
5384
5391
  historyPos = [(_a2 = textAreaRef.value) == null ? void 0 : _a2.selectionStart, (_b2 = textAreaRef.value) == null ? void 0 : _b2.selectionEnd];
5385
5392
  }
5386
5393
  };
5387
- watch([toRef(props2, "value"), completeStatus], () => {
5394
+ watch([toRef(props, "value"), completeStatus], () => {
5388
5395
  if (completeStatus.value) {
5389
- saveHistory(props2.value);
5396
+ saveHistory(props.value);
5390
5397
  }
5391
5398
  });
5392
- watch(() => props2.value, () => {
5399
+ watch(() => props.value, () => {
5393
5400
  bus.emit(editorId, "selectTextChange");
5394
5401
  }, {
5395
5402
  flush: "post"
@@ -5413,7 +5420,7 @@ const useHistory = (props2, textAreaRef, completeStatus) => {
5413
5420
  });
5414
5421
  });
5415
5422
  };
5416
- const useMarked = (props2, mermaidData) => {
5423
+ const useMarked = (props, mermaidData) => {
5417
5424
  var _a, _b, _c;
5418
5425
  const {
5419
5426
  markedRenderer,
@@ -5437,7 +5444,7 @@ const useMarked = (props2, mermaidData) => {
5437
5444
  const markedCode = renderer.code;
5438
5445
  renderer.code = (code, language, isEscaped) => {
5439
5446
  var _a2;
5440
- if (!props2.noMermaid && language === "mermaid") {
5447
+ if (!props.noMermaid && language === "mermaid") {
5441
5448
  const idRand = `${prefix}-mermaid-${Date.now().toString(36)}`;
5442
5449
  try {
5443
5450
  let svgCode = "";
@@ -5483,7 +5490,7 @@ const useMarked = (props2, mermaidData) => {
5483
5490
  if (isNewHeading) {
5484
5491
  return newHeading.call(renderer, text, level, raw, slugger, heads.value.length);
5485
5492
  }
5486
- const id = props2.markedHeadingId(raw, level, heads.value.length);
5493
+ const id = props.markedHeadingId(raw, level, heads.value.length);
5487
5494
  if (text !== raw) {
5488
5495
  return `<h${level} id="${id}">${text}</h${level}>`;
5489
5496
  } else {
@@ -5493,7 +5500,7 @@ const useMarked = (props2, mermaidData) => {
5493
5500
  marked.setOptions(__spreadValues({
5494
5501
  breaks: true
5495
5502
  }, markedOptions));
5496
- if (!props2.noKatex) {
5503
+ if (!props.noKatex) {
5497
5504
  marked.use({
5498
5505
  extensions: [
5499
5506
  kaTexExtensions.inline(prefix, katexIns),
@@ -5523,19 +5530,19 @@ const useMarked = (props2, mermaidData) => {
5523
5530
  extensions: markedExtensions
5524
5531
  });
5525
5532
  }
5526
- const html = ref(props2.sanitize(marked(props2.value || "", { renderer })));
5533
+ const html = ref(props.sanitize(marked(props.value || "", { renderer })));
5527
5534
  const markHtml = debounce(() => {
5528
5535
  heads.value = [];
5529
- const _html = props2.sanitize(marked(props2.value || "", { renderer }));
5536
+ const _html = props.sanitize(marked(props.value || "", { renderer }));
5530
5537
  html.value = _html;
5531
- props2.onHtmlChanged(_html);
5538
+ props.onHtmlChanged(_html);
5532
5539
  }, (editorConfig == null ? void 0 : editorConfig.renderDelay) !== void 0 ? editorConfig == null ? void 0 : editorConfig.renderDelay : previewOnly ? 0 : 500);
5533
5540
  watch([
5534
5541
  highlightInited,
5535
5542
  toRef(mermaidData, "reRender"),
5536
5543
  toRef(mermaidData, "mermaidInited"),
5537
5544
  katexInited,
5538
- toRef(props2, "value")
5545
+ toRef(props, "value")
5539
5546
  ], markHtml);
5540
5547
  const highlightLoad = () => {
5541
5548
  marked.setOptions({
@@ -5556,11 +5563,11 @@ const useMarked = (props2, mermaidData) => {
5556
5563
  highlightInited.value = true;
5557
5564
  };
5558
5565
  watch(() => heads.value, (list) => {
5559
- props2.onGetCatalog(list);
5566
+ props.onGetCatalog(list);
5560
5567
  bus.emit(editorId, "catalogChanged", list);
5561
5568
  });
5562
5569
  onMounted(() => {
5563
- if (!props2.noKatex && !katexIns) {
5570
+ if (!props.noKatex && !katexIns) {
5564
5571
  const katexScript = document.createElement("script");
5565
5572
  katexScript.src = (katexConf == null ? void 0 : katexConf.js) || katexUrl.js;
5566
5573
  katexScript.onload = () => {
@@ -5602,7 +5609,7 @@ const useMarked = (props2, mermaidData) => {
5602
5609
  html
5603
5610
  };
5604
5611
  };
5605
- const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
5612
+ const useAutoScroll = (props, html, textAreaRef, previewRef, htmlRef) => {
5606
5613
  const previewOnly = inject("previewOnly");
5607
5614
  const ult = inject("usedLanguageText");
5608
5615
  const editorId = inject("editorId");
@@ -5632,7 +5639,7 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
5632
5639
  };
5633
5640
  const htmlChanged = () => {
5634
5641
  nextTick(() => {
5635
- if (props2.setting.preview && !previewOnly && props2.scrollAuto) {
5642
+ if (props.setting.preview && !previewOnly && props.scrollAuto) {
5636
5643
  clearScrollAuto();
5637
5644
  initScrollAuto();
5638
5645
  }
@@ -5649,9 +5656,9 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
5649
5656
  }
5650
5657
  };
5651
5658
  watch(() => html.value, htmlChanged);
5652
- watch(() => props2.setting.preview, settingPreviewChanged);
5653
- watch(() => props2.setting.htmlPreview, settingPreviewChanged);
5654
- watch(() => props2.scrollAuto, (sa) => {
5659
+ watch(() => props.setting.preview, settingPreviewChanged);
5660
+ watch(() => props.setting.htmlPreview, settingPreviewChanged);
5661
+ watch(() => props.scrollAuto, (sa) => {
5655
5662
  if (sa) {
5656
5663
  initScrollAuto();
5657
5664
  } else {
@@ -5663,12 +5670,12 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
5663
5670
  if (!previewOnly && (previewRef.value || htmlRef.value)) {
5664
5671
  [initScrollAuto, clearScrollAuto] = scrollAuto(textAreaRef.value, previewRef.value || htmlRef.value);
5665
5672
  }
5666
- if (props2.scrollAuto) {
5673
+ if (props.scrollAuto) {
5667
5674
  initScrollAuto();
5668
5675
  }
5669
5676
  });
5670
5677
  };
5671
- const useAutoGenrator = (props2, textAreaRef) => {
5678
+ const useAutoGenrator = (props, textAreaRef) => {
5672
5679
  const previewOnly = inject("previewOnly");
5673
5680
  const tabWidth = inject("tabWidth");
5674
5681
  const editorId = inject("editorId");
@@ -5690,14 +5697,14 @@ const useAutoGenrator = (props2, textAreaRef) => {
5690
5697
  event.stopPropagation();
5691
5698
  if (/^\d+\.\s+$|^-\s+$/.test(enterPressRow)) {
5692
5699
  const resetPrefixStr = prefixStr == null ? void 0 : prefixStr.replace(new RegExp(enterPressRow + "$"), "");
5693
- props2.onChange(resetPrefixStr + subStr);
5700
+ props.onChange(resetPrefixStr + subStr);
5694
5701
  setPosition(textAreaRef.value, resetPrefixStr == null ? void 0 : resetPrefixStr.length);
5695
5702
  } else if (/^-\s+.+/.test(enterPressRow)) {
5696
- props2.onChange(insert(textAreaRef.value, "\n- ", {}));
5703
+ props.onChange(insert(textAreaRef.value, "\n- ", {}));
5697
5704
  } else {
5698
5705
  const lastOrderMatch = enterPressRow == null ? void 0 : enterPressRow.match(/\d+(?=\.)/);
5699
5706
  const nextOrder = lastOrderMatch && Number(lastOrderMatch[0]) + 1 || 1;
5700
- props2.onChange(insert(textAreaRef.value, `
5707
+ props.onChange(insert(textAreaRef.value, `
5701
5708
  ${nextOrder}. `, {}));
5702
5709
  }
5703
5710
  }
@@ -5706,7 +5713,7 @@ ${nextOrder}. `, {}));
5706
5713
  bus.on(editorId, {
5707
5714
  name: "replace",
5708
5715
  callback(direct, params = {}) {
5709
- props2.onChange(directive2flag(direct, selectedText.value, textAreaRef.value, __spreadProps(__spreadValues({}, params), {
5716
+ props.onChange(directive2flag(direct, selectedText.value, textAreaRef.value, __spreadProps(__spreadValues({}, params), {
5710
5717
  tabWidth,
5711
5718
  editorId
5712
5719
  })));
@@ -5714,7 +5721,7 @@ ${nextOrder}. `, {}));
5714
5721
  });
5715
5722
  }
5716
5723
  });
5717
- watch(() => props2.value, () => {
5724
+ watch(() => props.value, () => {
5718
5725
  selectedText.value = "";
5719
5726
  });
5720
5727
  bus.on(editorId, {
@@ -5724,7 +5731,7 @@ ${nextOrder}. `, {}));
5724
5731
  }
5725
5732
  });
5726
5733
  };
5727
- const useMermaid = (props2) => {
5734
+ const useMermaid = (props) => {
5728
5735
  const theme = inject("theme");
5729
5736
  const { editorExtensions } = configOption;
5730
5737
  const mermaidConf = editorExtensions == null ? void 0 : editorExtensions.mermaid;
@@ -5733,7 +5740,7 @@ const useMermaid = (props2) => {
5733
5740
  mermaidInited: !!(mermaidConf == null ? void 0 : mermaidConf.instance)
5734
5741
  });
5735
5742
  const reSetMermaidTheme = () => {
5736
- if (!props2.noMermaid) {
5743
+ if (!props.noMermaid) {
5737
5744
  if (mermaidConf == null ? void 0 : mermaidConf.instance) {
5738
5745
  mermaidConf.instance.initialize({
5739
5746
  theme: theme.value === "dark" ? "dark" : "default"
@@ -5749,7 +5756,7 @@ const useMermaid = (props2) => {
5749
5756
  watch(() => theme.value, reSetMermaidTheme);
5750
5757
  let mermaidScript;
5751
5758
  onMounted(() => {
5752
- if (!props2.noMermaid && !(mermaidConf == null ? void 0 : mermaidConf.instance)) {
5759
+ if (!props.noMermaid && !(mermaidConf == null ? void 0 : mermaidConf.instance)) {
5753
5760
  mermaidScript = document.createElement("script");
5754
5761
  mermaidScript.src = (mermaidConf == null ? void 0 : mermaidConf.js) || mermaidUrl;
5755
5762
  mermaidScript.onload = () => {
@@ -5761,7 +5768,7 @@ const useMermaid = (props2) => {
5761
5768
  };
5762
5769
  mermaidScript.id = `${prefix}-mermaid`;
5763
5770
  appendHandler(mermaidScript, "mermaid");
5764
- } else if (!props2.noMermaid) {
5771
+ } else if (!props.noMermaid) {
5765
5772
  reSetMermaidTheme();
5766
5773
  }
5767
5774
  });
@@ -5804,57 +5811,58 @@ const userZoom = (html) => {
5804
5811
  onMounted(zoomHander);
5805
5812
  watch([html], zoomHander);
5806
5813
  };
5807
- var Content = defineComponent({
5808
- name: "MDEditorContent",
5809
- props: {
5810
- value: {
5811
- type: String,
5812
- default: ""
5813
- },
5814
- onChange: {
5815
- type: Function,
5816
- default: () => () => {
5817
- }
5818
- },
5819
- setting: {
5820
- type: Object,
5821
- default: () => ({})
5822
- },
5823
- onHtmlChanged: {
5824
- type: Function,
5825
- default: () => () => {
5826
- }
5827
- },
5828
- onGetCatalog: {
5829
- type: Function,
5830
- default: () => () => {
5831
- }
5832
- },
5833
- markedHeadingId: {
5834
- type: Function,
5835
- default: () => ""
5836
- },
5837
- noMermaid: {
5838
- type: Boolean,
5839
- default: false
5840
- },
5841
- sanitize: {
5842
- type: Function,
5843
- default: (html) => html
5844
- },
5845
- placeholder: {
5846
- type: String,
5847
- default: ""
5848
- },
5849
- noKatex: {
5850
- type: Boolean,
5851
- default: false
5852
- },
5853
- scrollAuto: {
5854
- type: Boolean
5814
+ const contentProps = () => ({
5815
+ value: {
5816
+ type: String,
5817
+ default: ""
5818
+ },
5819
+ onChange: {
5820
+ type: Function,
5821
+ default: () => () => {
5822
+ }
5823
+ },
5824
+ setting: {
5825
+ type: Object,
5826
+ default: () => ({})
5827
+ },
5828
+ onHtmlChanged: {
5829
+ type: Function,
5830
+ default: () => () => {
5855
5831
  }
5856
5832
  },
5857
- setup(props2) {
5833
+ onGetCatalog: {
5834
+ type: Function,
5835
+ default: () => () => {
5836
+ }
5837
+ },
5838
+ markedHeadingId: {
5839
+ type: Function,
5840
+ default: () => ""
5841
+ },
5842
+ noMermaid: {
5843
+ type: Boolean,
5844
+ default: false
5845
+ },
5846
+ sanitize: {
5847
+ type: Function,
5848
+ default: (html) => html
5849
+ },
5850
+ placeholder: {
5851
+ type: String,
5852
+ default: ""
5853
+ },
5854
+ noKatex: {
5855
+ type: Boolean,
5856
+ default: false
5857
+ },
5858
+ scrollAuto: {
5859
+ type: Boolean
5860
+ }
5861
+ });
5862
+ var Content = defineComponent({
5863
+ name: "MDEditorContent",
5864
+ props: contentProps(),
5865
+ setup(props) {
5858
5866
  const completeStatus = ref(true);
5859
5867
  const previewOnly = inject("previewOnly");
5860
5868
  const showCodeRowNumber = inject("showCodeRowNumber");
@@ -5863,13 +5871,13 @@ var Content = defineComponent({
5863
5871
  const textAreaRef = ref();
5864
5872
  const previewRef = ref();
5865
5873
  const htmlRef = ref();
5866
- const mermaidData = useMermaid(props2);
5874
+ const mermaidData = useMermaid(props);
5867
5875
  const {
5868
5876
  html
5869
- } = useMarked(props2, mermaidData);
5870
- useAutoScroll(props2, html, textAreaRef, previewRef, htmlRef);
5871
- useAutoGenrator(props2, textAreaRef);
5872
- useHistory(props2, textAreaRef, completeStatus);
5877
+ } = useMarked(props, mermaidData);
5878
+ useAutoScroll(props, html, textAreaRef, previewRef, htmlRef);
5879
+ useAutoGenrator(props, textAreaRef);
5880
+ useHistory(props, textAreaRef, completeStatus);
5873
5881
  usePasteUpload(textAreaRef);
5874
5882
  userZoom(html);
5875
5883
  return () => {
@@ -5880,7 +5888,7 @@ var Content = defineComponent({
5880
5888
  }, [createVNode("textarea", {
5881
5889
  "id": `${editorId}-textarea`,
5882
5890
  "ref": textAreaRef,
5883
- "value": props2.value,
5891
+ "value": props.value,
5884
5892
  "onKeydown": () => {
5885
5893
  bus.emit(editorId, "saveHistoryPos", true);
5886
5894
  },
@@ -5888,14 +5896,14 @@ var Content = defineComponent({
5888
5896
  completeStatus.value = false;
5889
5897
  },
5890
5898
  "onInput": (e) => {
5891
- props2.onChange(e.target.value);
5899
+ props.onChange(e.target.value);
5892
5900
  },
5893
5901
  "onCompositionend": () => {
5894
5902
  completeStatus.value = true;
5895
5903
  },
5896
- "class": [props2.setting.preview || props2.setting.htmlPreview ? "" : "textarea-only"],
5897
- "placeholder": props2.placeholder
5898
- }, null)]), props2.setting.preview && createVNode("div", {
5904
+ "class": [props.setting.preview || props.setting.htmlPreview ? "" : "textarea-only"],
5905
+ "placeholder": props.placeholder
5906
+ }, null)]), props.setting.preview && createVNode("div", {
5899
5907
  "id": `${editorId}-preview-wrapper`,
5900
5908
  "class": `${prefix}-preview-wrapper`,
5901
5909
  "ref": previewRef,
@@ -5904,7 +5912,7 @@ var Content = defineComponent({
5904
5912
  "id": `${editorId}-preview`,
5905
5913
  "class": [`${prefix}-preview`, `${previewTheme == null ? void 0 : previewTheme.value}-theme`, showCodeRowNumber && `${prefix}-scrn`],
5906
5914
  "innerHTML": html.value
5907
- }, null)]), props2.setting.htmlPreview && createVNode("div", {
5915
+ }, null)]), props.setting.htmlPreview && createVNode("div", {
5908
5916
  "class": `${prefix}-preview-wrapper`,
5909
5917
  "ref": htmlRef,
5910
5918
  "key": "html-preview-wrapper"
@@ -5921,7 +5929,7 @@ var MarkdownTotal = defineComponent({
5921
5929
  default: ""
5922
5930
  }
5923
5931
  },
5924
- setup(props2) {
5932
+ setup(props) {
5925
5933
  const ult = inject("usedLanguageText");
5926
5934
  return () => {
5927
5935
  var _a;
@@ -5929,46 +5937,48 @@ var MarkdownTotal = defineComponent({
5929
5937
  "class": `${prefix}-footer-item`
5930
5938
  }, [createVNode("label", {
5931
5939
  "class": `${prefix}-footer-label`
5932
- }, [(_a = ult.value.footer) == null ? void 0 : _a.markdownTotal, createTextVNode(":")]), createVNode("span", null, [props2.modelValue.length])]);
5940
+ }, [(_a = ult.value.footer) == null ? void 0 : _a.markdownTotal, createTextVNode(":")]), createVNode("span", null, [props.modelValue.length])]);
5933
5941
  };
5934
5942
  }
5935
5943
  });
5936
5944
  var style$1 = "";
5937
- var Checkbox = defineComponent({
5938
- props: {
5939
- checked: {
5940
- type: Boolean,
5941
- default: false
5942
- },
5943
- onChange: {
5944
- type: Function,
5945
- default: () => () => {
5946
- }
5947
- }
5945
+ const checkboxProps = () => ({
5946
+ checked: {
5947
+ type: Boolean,
5948
+ default: false
5948
5949
  },
5949
- setup(props2) {
5950
+ onChange: {
5951
+ type: Function,
5952
+ default: () => () => {
5953
+ }
5954
+ }
5955
+ });
5956
+ var Checkbox = defineComponent({
5957
+ props: checkboxProps(),
5958
+ setup(props) {
5950
5959
  return () => {
5951
5960
  return createVNode("div", {
5952
- "class": [`${prefix}-checkbox`, props2.checked && `${prefix}-checkbox-checked`],
5961
+ "class": [`${prefix}-checkbox`, props.checked && `${prefix}-checkbox-checked`],
5953
5962
  "onClick": () => {
5954
- props2.onChange(!props2.checked);
5963
+ props.onChange(!props.checked);
5955
5964
  }
5956
5965
  }, null);
5957
5966
  };
5958
5967
  }
5959
5968
  });
5960
- var ScrollAuto = defineComponent({
5961
- props: {
5962
- scrollAuto: {
5963
- type: Boolean
5964
- },
5965
- onScrollAutoChange: {
5966
- type: Function,
5967
- default: () => () => {
5968
- }
5969
- }
5969
+ const scrollAutoProps = () => ({
5970
+ scrollAuto: {
5971
+ type: Boolean
5970
5972
  },
5971
- setup(props2) {
5973
+ onScrollAutoChange: {
5974
+ type: Function,
5975
+ default: () => () => {
5976
+ }
5977
+ }
5978
+ });
5979
+ var ScrollAuto = defineComponent({
5980
+ props: scrollAutoProps(),
5981
+ setup(props) {
5972
5982
  const ult = inject("usedLanguageText");
5973
5983
  return () => {
5974
5984
  var _a;
@@ -5977,43 +5987,44 @@ var ScrollAuto = defineComponent({
5977
5987
  }, [createVNode("label", {
5978
5988
  "class": `${prefix}-footer-label`,
5979
5989
  "onClick": () => {
5980
- props2.onScrollAutoChange(!props2.scrollAuto);
5990
+ props.onScrollAutoChange(!props.scrollAuto);
5981
5991
  }
5982
5992
  }, [(_a = ult.value.footer) == null ? void 0 : _a.scrollAuto]), createVNode(Checkbox, {
5983
- "checked": props2.scrollAuto,
5984
- "onChange": props2.onScrollAutoChange
5993
+ "checked": props.scrollAuto,
5994
+ "onChange": props.onScrollAutoChange
5985
5995
  }, null)]);
5986
5996
  };
5987
5997
  }
5988
5998
  });
5989
- var Footer = defineComponent({
5990
- name: "MDEditorFooter",
5991
- props: {
5992
- modelValue: {
5993
- type: String,
5994
- default: ""
5995
- },
5996
- footers: {
5997
- type: Array,
5998
- default: []
5999
- },
6000
- scrollAuto: {
6001
- type: Boolean
6002
- },
6003
- onScrollAutoChange: {
6004
- type: Function,
6005
- default: () => () => {
6006
- }
6007
- },
6008
- defFooters: {
6009
- type: Object
5999
+ const footerProps = () => ({
6000
+ modelValue: {
6001
+ type: String,
6002
+ default: ""
6003
+ },
6004
+ footers: {
6005
+ type: Array,
6006
+ default: []
6007
+ },
6008
+ scrollAuto: {
6009
+ type: Boolean
6010
+ },
6011
+ onScrollAutoChange: {
6012
+ type: Function,
6013
+ default: () => () => {
6010
6014
  }
6011
6015
  },
6012
- setup(props2) {
6016
+ defFooters: {
6017
+ type: Object
6018
+ }
6019
+ });
6020
+ var Footer = defineComponent({
6021
+ name: "MDEditorFooter",
6022
+ props: footerProps(),
6023
+ setup(props) {
6013
6024
  const splitedItems = computed(() => {
6014
- const moduleSplitIndex = props2.footers.indexOf("=");
6015
- const barLeft = moduleSplitIndex === -1 ? props2.footers : props2.footers.slice(0, moduleSplitIndex);
6016
- const barRight = moduleSplitIndex === -1 ? [] : props2.footers.slice(moduleSplitIndex, Number.MAX_SAFE_INTEGER);
6025
+ const moduleSplitIndex = props.footers.indexOf("=");
6026
+ const barLeft = moduleSplitIndex === -1 ? props.footers : props.footers.slice(0, moduleSplitIndex);
6027
+ const barRight = moduleSplitIndex === -1 ? [] : props.footers.slice(moduleSplitIndex, Number.MAX_SAFE_INTEGER);
6017
6028
  return [barLeft, barRight];
6018
6029
  });
6019
6030
  const footerRender = (name) => {
@@ -6021,20 +6032,20 @@ var Footer = defineComponent({
6021
6032
  switch (name) {
6022
6033
  case "markdownTotal": {
6023
6034
  return createVNode(MarkdownTotal, {
6024
- "modelValue": props2.modelValue
6035
+ "modelValue": props.modelValue
6025
6036
  }, null);
6026
6037
  }
6027
6038
  case "scrollSwitch": {
6028
6039
  return createVNode(ScrollAuto, {
6029
- "scrollAuto": props2.scrollAuto,
6030
- "onScrollAutoChange": props2.onScrollAutoChange
6040
+ "scrollAuto": props.scrollAuto,
6041
+ "onScrollAutoChange": props.onScrollAutoChange
6031
6042
  }, null);
6032
6043
  }
6033
6044
  }
6034
- } else if (props2.defFooters instanceof Array) {
6035
- return props2.defFooters[name] || "";
6036
- } else if (props2.defFooters && props2.defFooters.children instanceof Array) {
6037
- return props2.defFooters.children[name] || "";
6045
+ } else if (props.defFooters instanceof Array) {
6046
+ return props.defFooters[name] || "";
6047
+ } else if (props.defFooters && props.defFooters.children instanceof Array) {
6048
+ return props.defFooters.children[name] || "";
6038
6049
  } else {
6039
6050
  return "";
6040
6051
  }
@@ -6052,27 +6063,28 @@ var Footer = defineComponent({
6052
6063
  };
6053
6064
  }
6054
6065
  });
6055
- const CatalogLink = defineComponent({
6056
- props: {
6057
- tocItem: {
6058
- type: Object,
6059
- default: () => ({})
6060
- },
6061
- markedHeadingId: {
6062
- type: Function,
6063
- default: () => {
6064
- }
6065
- },
6066
- scrollElement: {
6067
- type: [String, Object],
6068
- default: ""
6069
- },
6070
- onClick: {
6071
- type: Function,
6072
- default: () => {
6073
- }
6066
+ const catalogLinkProps = () => ({
6067
+ tocItem: {
6068
+ type: Object,
6069
+ default: () => ({})
6070
+ },
6071
+ markedHeadingId: {
6072
+ type: Function,
6073
+ default: () => () => {
6074
6074
  }
6075
6075
  },
6076
+ scrollElement: {
6077
+ type: [String, Object],
6078
+ default: ""
6079
+ },
6080
+ onClick: {
6081
+ type: Function,
6082
+ default: () => () => {
6083
+ }
6084
+ }
6085
+ });
6086
+ const CatalogLink = defineComponent({
6087
+ props: catalogLinkProps(),
6076
6088
  setup({
6077
6089
  tocItem,
6078
6090
  markedHeadingId: markedHeadingId2,
@@ -6116,35 +6128,36 @@ const CatalogLink = defineComponent({
6116
6128
  }
6117
6129
  });
6118
6130
  var style = "";
6131
+ const mdCatalogProps = () => ({
6132
+ editorId: {
6133
+ type: String
6134
+ },
6135
+ class: {
6136
+ type: String,
6137
+ default: ""
6138
+ },
6139
+ markedHeadingId: {
6140
+ type: Function,
6141
+ default: (text) => text
6142
+ },
6143
+ scrollElement: {
6144
+ type: [String, Object]
6145
+ },
6146
+ theme: {
6147
+ type: String,
6148
+ default: "light"
6149
+ }
6150
+ });
6119
6151
  const MdCatalog = defineComponent({
6120
6152
  name: "MdCatalog",
6121
- props: {
6122
- editorId: {
6123
- type: String
6124
- },
6125
- class: {
6126
- type: String,
6127
- default: ""
6128
- },
6129
- markedHeadingId: {
6130
- type: Function,
6131
- default: (text) => text
6132
- },
6133
- scrollElement: {
6134
- type: [String, Object]
6135
- },
6136
- theme: {
6137
- type: String,
6138
- default: "light"
6139
- }
6140
- },
6153
+ props: mdCatalogProps(),
6141
6154
  emits: ["onClick"],
6142
- setup(props2, ctx) {
6143
- const editorId = props2.editorId;
6155
+ setup(props, ctx) {
6156
+ const editorId = props.editorId;
6144
6157
  const state = reactive({
6145
6158
  list: [],
6146
6159
  show: false,
6147
- scrollElement: props2.scrollElement || `#${editorId}-preview-wrapper`
6160
+ scrollElement: props.scrollElement || `#${editorId}-preview-wrapper`
6148
6161
  });
6149
6162
  const catalogs = computed(() => {
6150
6163
  const tocItems = [];
@@ -6193,10 +6206,10 @@ const MdCatalog = defineComponent({
6193
6206
  bus.emit(editorId, "pushCatalog");
6194
6207
  });
6195
6208
  return () => createVNode("div", {
6196
- "class": `${prefix}-catalog${props2.theme === "dark" ? "-dark" : ""} ${props2.class}`
6209
+ "class": `${prefix}-catalog${props.theme === "dark" ? "-dark" : ""} ${props.class}`
6197
6210
  }, [catalogs.value.map((item) => {
6198
6211
  return createVNode(CatalogLink, {
6199
- "markedHeadingId": props2.markedHeadingId,
6212
+ "markedHeadingId": props.markedHeadingId,
6200
6213
  "tocItem": item,
6201
6214
  "key": item.text,
6202
6215
  "scrollElement": state.scrollElement,
@@ -6209,8 +6222,7 @@ const MdCatalog = defineComponent({
6209
6222
  });
6210
6223
  var index = "";
6211
6224
  var all = "";
6212
- const markedHeadingId = (text) => text;
6213
- const props = {
6225
+ const editorProps = () => ({
6214
6226
  modelValue: {
6215
6227
  type: String,
6216
6228
  default: ""
@@ -6342,54 +6354,55 @@ const props = {
6342
6354
  noIconfont: {
6343
6355
  type: Boolean
6344
6356
  }
6345
- };
6357
+ });
6358
+ const markedHeadingId = (text) => text;
6346
6359
  const Editor = defineComponent({
6347
6360
  name: "MdEditorV3",
6348
- props,
6361
+ props: editorProps(),
6349
6362
  emits: ["onChange", "onSave", "onUploadImg", "onHtmlChanged", "onGetCatalog", "onError", "update:modelValue"],
6350
- setup(props2, context) {
6363
+ setup(props, context) {
6351
6364
  const {
6352
6365
  editorId
6353
- } = props2;
6366
+ } = props;
6354
6367
  const state = reactive({
6355
- scrollAuto: props2.scrollAuto
6368
+ scrollAuto: props.scrollAuto
6356
6369
  });
6357
- useKeyBoard(props2, context);
6358
- useProvide(props2);
6359
- useExpansion(props2);
6360
- const [setting, updateSetting] = useConfig(props2, context);
6361
- const [catalogVisible, catalogShow] = useCatalog(props2);
6370
+ useKeyBoard(props, context);
6371
+ useProvide(props);
6372
+ useExpansion(props);
6373
+ const [setting, updateSetting] = useConfig(props, context);
6374
+ const [catalogVisible, catalogShow] = useCatalog(props);
6362
6375
  onBeforeUnmount(() => {
6363
6376
  bus.clear(editorId);
6364
6377
  });
6365
6378
  return () => {
6366
6379
  var _a;
6367
6380
  const defToolbars = getSlot({
6368
- props: props2,
6381
+ props,
6369
6382
  ctx: context
6370
6383
  }, "defToolbars");
6371
6384
  const defFooters = getSlot({
6372
- props: props2,
6385
+ props,
6373
6386
  ctx: context
6374
6387
  }, "defFooters");
6375
6388
  return createVNode("div", {
6376
6389
  "id": editorId,
6377
- "class": [prefix, props2.class, props2.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullScreen ? `${prefix}-fullscreen` : "", props2.previewOnly && `${prefix}-previewOnly`],
6378
- "style": props2.style
6379
- }, [!props2.previewOnly && createVNode(ToolBar, {
6380
- "noPrettier": props2.noPrettier,
6381
- "toolbars": props2.toolbars,
6382
- "toolbarsExclude": props2.toolbarsExclude,
6390
+ "class": [prefix, props.class, props.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullScreen ? `${prefix}-fullscreen` : "", props.previewOnly && `${prefix}-previewOnly`],
6391
+ "style": props.style
6392
+ }, [!props.previewOnly && createVNode(ToolBar, {
6393
+ "noPrettier": props.noPrettier,
6394
+ "toolbars": props.toolbars,
6395
+ "toolbarsExclude": props.toolbarsExclude,
6383
6396
  "setting": setting,
6384
6397
  "updateSetting": updateSetting,
6385
- "tableShape": props2.tableShape,
6398
+ "tableShape": props.tableShape,
6386
6399
  "defToolbars": defToolbars
6387
6400
  }, null), createVNode(Content, {
6388
- "value": props2.modelValue,
6401
+ "value": props.modelValue,
6389
6402
  "onChange": (value) => {
6390
6403
  bus.emit(editorId, "saveHistoryPos");
6391
- if (props2.onChange) {
6392
- props2.onChange(value);
6404
+ if (props.onChange) {
6405
+ props.onChange(value);
6393
6406
  } else {
6394
6407
  context.emit("update:modelValue", value);
6395
6408
  context.emit("onChange", value);
@@ -6397,70 +6410,71 @@ const Editor = defineComponent({
6397
6410
  },
6398
6411
  "setting": setting,
6399
6412
  "onHtmlChanged": (html) => {
6400
- if (props2.onHtmlChanged) {
6401
- props2.onHtmlChanged(html);
6413
+ if (props.onHtmlChanged) {
6414
+ props.onHtmlChanged(html);
6402
6415
  } else {
6403
6416
  context.emit("onHtmlChanged", html);
6404
6417
  }
6405
6418
  },
6406
6419
  "onGetCatalog": (list) => {
6407
- if (props2.onGetCatalog) {
6408
- props2.onGetCatalog(list);
6420
+ if (props.onGetCatalog) {
6421
+ props.onGetCatalog(list);
6409
6422
  } else {
6410
6423
  context.emit("onGetCatalog", list);
6411
6424
  }
6412
6425
  },
6413
- "markedHeadingId": props2.markedHeadingId,
6414
- "noMermaid": props2.noMermaid,
6415
- "sanitize": props2.sanitize,
6416
- "placeholder": props2.placeholder,
6417
- "noKatex": props2.noKatex,
6426
+ "markedHeadingId": props.markedHeadingId,
6427
+ "noMermaid": props.noMermaid,
6428
+ "sanitize": props.sanitize,
6429
+ "placeholder": props.placeholder,
6430
+ "noKatex": props.noKatex,
6418
6431
  "scrollAuto": state.scrollAuto
6419
- }, null), !props2.previewOnly && ((_a = props2.footers) == null ? void 0 : _a.length) > 0 && createVNode(Footer, {
6420
- "modelValue": props2.modelValue,
6421
- "footers": props2.footers,
6432
+ }, null), !props.previewOnly && ((_a = props.footers) == null ? void 0 : _a.length) > 0 && createVNode(Footer, {
6433
+ "modelValue": props.modelValue,
6434
+ "footers": props.footers,
6422
6435
  "defFooters": defFooters,
6423
6436
  "scrollAuto": state.scrollAuto,
6424
6437
  "onScrollAutoChange": (v) => state.scrollAuto = v
6425
6438
  }, null), catalogShow.value && createVNode(MdCatalog, {
6426
- "theme": props2.theme,
6439
+ "theme": props.theme,
6427
6440
  "style": {
6428
6441
  display: catalogVisible.value ? "block" : "none"
6429
6442
  },
6430
6443
  "class": `${prefix}-catalog-editor`,
6431
6444
  "editorId": editorId,
6432
- "markedHeadingId": props2.markedHeadingId
6445
+ "markedHeadingId": props.markedHeadingId
6433
6446
  }, null)]);
6434
6447
  };
6435
6448
  }
6436
6449
  });
6450
+ const normalToolbarProps = () => ({
6451
+ title: {
6452
+ type: String,
6453
+ default: ""
6454
+ },
6455
+ trigger: {
6456
+ type: [String, Object]
6457
+ },
6458
+ onClick: {
6459
+ type: Function
6460
+ }
6461
+ });
6437
6462
  var NormalToolbar = defineComponent({
6438
6463
  name: "NormalToolbar",
6439
- props: {
6440
- title: {
6441
- type: String,
6442
- default: ""
6443
- },
6444
- trigger: {
6445
- type: [String, Object]
6446
- },
6447
- onClick: {
6448
- type: Function
6449
- }
6450
- },
6464
+ props: normalToolbarProps(),
6451
6465
  emits: ["onClick"],
6452
- setup(props2, ctx) {
6466
+ setup(props, ctx) {
6453
6467
  return () => {
6454
6468
  const Trigger = getSlot({
6455
- props: props2,
6469
+ props,
6456
6470
  ctx
6457
6471
  }, "trigger");
6458
6472
  return createVNode("div", {
6459
6473
  "class": `${prefix}-toolbar-item`,
6460
- "title": props2.title,
6474
+ "title": props.title,
6461
6475
  "onClick": (e) => {
6462
- if (props2.onClick instanceof Function) {
6463
- props2.onClick(e);
6476
+ if (props.onClick instanceof Function) {
6477
+ props.onClick(e);
6464
6478
  } else {
6465
6479
  ctx.emit("onClick", e);
6466
6480
  }
@@ -6469,44 +6483,45 @@ var NormalToolbar = defineComponent({
6469
6483
  };
6470
6484
  }
6471
6485
  });
6486
+ const dropdownToolbarProps = () => ({
6487
+ title: {
6488
+ type: String,
6489
+ default: ""
6490
+ },
6491
+ visible: {
6492
+ type: Boolean
6493
+ },
6494
+ trigger: {
6495
+ type: [String, Object]
6496
+ },
6497
+ onChange: {
6498
+ type: Function
6499
+ },
6500
+ overlay: {
6501
+ type: [String, Object]
6502
+ }
6503
+ });
6472
6504
  var DropdownToolbar = defineComponent({
6473
6505
  name: "DropdownToolbar",
6474
- props: {
6475
- title: {
6476
- type: String,
6477
- default: ""
6478
- },
6479
- visible: {
6480
- type: Boolean
6481
- },
6482
- trigger: {
6483
- type: [String, Object]
6484
- },
6485
- onChange: {
6486
- type: Function
6487
- },
6488
- overlay: {
6489
- type: [String, Object]
6490
- }
6491
- },
6506
+ props: dropdownToolbarProps(),
6492
6507
  emits: ["onChange"],
6493
- setup(props2, ctx) {
6508
+ setup(props, ctx) {
6494
6509
  const editorId = inject("editorId");
6495
6510
  return () => {
6496
6511
  const Trigger = getSlot({
6497
- props: props2,
6512
+ props,
6498
6513
  ctx
6499
6514
  }, "trigger");
6500
6515
  const Overlay = getSlot({
6501
- props: props2,
6516
+ props,
6502
6517
  ctx
6503
6518
  }, "overlay");
6504
6519
  return createVNode(Dropdown, {
6505
6520
  "relative": `#${editorId}-toolbar-wrapper`,
6506
- "visible": props2.visible,
6521
+ "visible": props.visible,
6507
6522
  "onChange": (v) => {
6508
- if (props2.onChange instanceof Function) {
6509
- props2.onChange(v);
6523
+ if (props.onChange instanceof Function) {
6524
+ props.onChange(v);
6510
6525
  } else {
6511
6526
  ctx.emit("onChange", v);
6512
6527
  }
@@ -6515,7 +6530,7 @@ var DropdownToolbar = defineComponent({
6515
6530
  }, {
6516
6531
  default: () => [createVNode("div", {
6517
6532
  "class": `${prefix}-toolbar-item`,
6518
- "title": props2.title || ""
6533
+ "title": props.title || ""
6519
6534
  }, [Trigger])]
6520
6535
  });
6521
6536
  };
@@ -6524,87 +6539,88 @@ var DropdownToolbar = defineComponent({
6524
6539
  function _isSlot(s) {
6525
6540
  return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
6526
6541
  }
6542
+ const modalToolbarProps = () => ({
6543
+ title: {
6544
+ type: String,
6545
+ default: ""
6546
+ },
6547
+ modalTitle: {
6548
+ type: String,
6549
+ default: ""
6550
+ },
6551
+ visible: {
6552
+ type: Boolean
6553
+ },
6554
+ width: {
6555
+ type: String,
6556
+ default: "auto"
6557
+ },
6558
+ height: {
6559
+ type: String,
6560
+ default: "auto"
6561
+ },
6562
+ trigger: {
6563
+ type: [String, Object]
6564
+ },
6565
+ onClick: {
6566
+ type: Function
6567
+ },
6568
+ onClose: {
6569
+ type: Function
6570
+ },
6571
+ showAdjust: {
6572
+ type: Boolean,
6573
+ default: false
6574
+ },
6575
+ isFullscreen: {
6576
+ type: Boolean,
6577
+ default: false
6578
+ },
6579
+ onAdjust: {
6580
+ type: Function
6581
+ }
6582
+ });
6527
6583
  var ModalToolbar = defineComponent({
6528
6584
  name: "ModalToolbar",
6529
- props: {
6530
- title: {
6531
- type: String,
6532
- default: ""
6533
- },
6534
- modalTitle: {
6535
- type: String,
6536
- default: ""
6537
- },
6538
- visible: {
6539
- type: Boolean
6540
- },
6541
- width: {
6542
- type: String,
6543
- default: "auto"
6544
- },
6545
- height: {
6546
- type: String,
6547
- default: "auto"
6548
- },
6549
- trigger: {
6550
- type: [String, Object]
6551
- },
6552
- onClick: {
6553
- type: Function
6554
- },
6555
- onClose: {
6556
- type: Function
6557
- },
6558
- showAdjust: {
6559
- type: Boolean,
6560
- default: false
6561
- },
6562
- isFullscreen: {
6563
- type: Boolean,
6564
- default: false
6565
- },
6566
- onAdjust: {
6567
- type: Function
6568
- }
6569
- },
6585
+ props: modalToolbarProps(),
6570
6586
  emits: ["onClick", "onClose", "onAdjust"],
6571
- setup(props2, ctx) {
6587
+ setup(props, ctx) {
6572
6588
  return () => {
6573
6589
  const Trigger = getSlot({
6574
- props: props2,
6590
+ props,
6575
6591
  ctx
6576
6592
  }, "trigger");
6577
6593
  const Default = getSlot({
6578
- props: props2,
6594
+ props,
6579
6595
  ctx
6580
6596
  }, "default");
6581
6597
  return createVNode(Fragment, null, [createVNode("div", {
6582
6598
  "class": `${prefix}-toolbar-item`,
6583
- "title": props2.title,
6599
+ "title": props.title,
6584
6600
  "onClick": () => {
6585
- if (props2.onClick instanceof Function) {
6586
- props2.onClick();
6601
+ if (props.onClick instanceof Function) {
6602
+ props.onClick();
6587
6603
  } else {
6588
6604
  ctx.emit("onClick");
6589
6605
  }
6590
6606
  }
6591
6607
  }, [Trigger]), createVNode(Modal, {
6592
- "width": props2.width,
6593
- "height": props2.height,
6594
- "title": props2.modalTitle,
6595
- "visible": props2.visible,
6608
+ "width": props.width,
6609
+ "height": props.height,
6610
+ "title": props.modalTitle,
6611
+ "visible": props.visible,
6596
6612
  "onClose": () => {
6597
- if (props2.onClose instanceof Function) {
6598
- props2.onClose();
6613
+ if (props.onClose instanceof Function) {
6614
+ props.onClose();
6599
6615
  } else {
6600
6616
  ctx.emit("onClose");
6601
6617
  }
6602
6618
  },
6603
- "showAdjust": props2.showAdjust,
6604
- "isFullscreen": props2.isFullscreen,
6619
+ "showAdjust": props.showAdjust,
6620
+ "isFullscreen": props.isFullscreen,
6605
6621
  "onAdjust": (v) => {
6606
- if (props2.onAdjust instanceof Function) {
6607
- props2.onAdjust(v);
6622
+ if (props.onAdjust instanceof Function) {
6623
+ props.onAdjust(v);
6608
6624
  } else {
6609
6625
  ctx.emit("onAdjust", v);
6610
6626
  }