md-editor-v3 2.4.2 → 2.5.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,11 +58,12 @@ export interface StaticTextDefaultValue {
58
58
  clip2upload: string;
59
59
  };
60
60
  linkModalTips?: {
61
- title?: string;
62
- descLable?: string;
63
- descLablePlaceHolder?: string;
64
- urlLable?: string;
65
- urlLablePlaceHolder?: string;
61
+ linkTitle?: string;
62
+ imageTitle?: string;
63
+ descLabel?: string;
64
+ descLabelPlaceHolder?: string;
65
+ urlLabel?: string;
66
+ urlLabelPlaceHolder?: string;
66
67
  buttonOK?: string;
67
68
  };
68
69
  clipModalTips?: {
@@ -101,7 +102,7 @@ export declare type StaticTextDefaultKey = keyof StaticTextDefault;
101
102
  export declare type ToolbarNames = keyof ToolbarTips | number;
102
103
  export declare type Footers = '=' | 'markdownTotal' | 'scrollSwitch' | number;
103
104
  export interface SettingType {
104
- pageFullScreen: boolean;
105
+ pageFullscreen: boolean;
105
106
  fullscreen: boolean;
106
107
  preview: boolean;
107
108
  htmlPreview: boolean;
@@ -237,3 +238,81 @@ export interface CodeCss {
237
238
  dark: string;
238
239
  };
239
240
  }
241
+ export declare type UpdateSetting = (v: boolean | undefined, k: keyof SettingType) => void;
242
+ export declare type ChangeEvent = (v: string) => void;
243
+ export declare type SaveEvent = (v: string, h: Promise<string>) => void;
244
+ export declare type UploadImgEvent = (files: Array<File>, callBack: (urls: string[]) => void) => void;
245
+ export declare type HtmlChangedEvent = (h: string) => void;
246
+ export declare type GetCatalogEvent = (list: HeadList[]) => void;
247
+ export declare type ErrorEvent = (err: InnerError) => void;
248
+ export interface ExposeEvent {
249
+ pageFullscreen(status: boolean): void;
250
+ fullscreen(status: boolean): void;
251
+ preview(status: boolean): void;
252
+ htmlPreview(status: boolean): void;
253
+ catalog(status: boolean): void;
254
+ }
255
+ export declare type InsertContentGenerator = (selectedText: string) => {
256
+ targetValue: string;
257
+ select: boolean;
258
+ deviationStart: number;
259
+ deviationEnd: number;
260
+ };
261
+ export interface ExposeParam {
262
+ /**
263
+ * 添加事件监听
264
+ *
265
+ * @param eventName 事件名称
266
+ * @param callBack 事件回调函数
267
+ */
268
+ on<E extends keyof ExposeEvent, C extends ExposeEvent[E]>(eventName: E, callBack: C): void;
269
+ /**
270
+ * 切换页面内全屏
271
+ *
272
+ * @param status 是否页面全屏
273
+ */
274
+ togglePageFullscreen(status?: boolean): void;
275
+ /**
276
+ * 切换屏幕全屏
277
+ *
278
+ * @param status 是否屏幕全屏
279
+ */
280
+ toggleFullscreen(status?: boolean): void;
281
+ /**
282
+ * 切换是否显示预览
283
+ *
284
+ * @param status 是否显示预览
285
+ */
286
+ togglePreview(status?: boolean): void;
287
+ /**
288
+ * 切换是否显示html预览
289
+ *
290
+ * @param status html预览状态
291
+ */
292
+ toggleHtmlPreview(status?: boolean): void;
293
+ /**
294
+ * 切换是否显示目录
295
+ *
296
+ * @param status 是否显示目录,不设置默认相反
297
+ */
298
+ toggleCatalog(status?: boolean): void;
299
+ /**
300
+ * 触发保存
301
+ */
302
+ triggerSave(): void;
303
+ /**
304
+ * 手动向文本框插入内容
305
+ *
306
+ * @param {Function} generate 构造插入内容方法
307
+ * 构造方法提供「当前选中」的内容为入参
308
+ * 返回「待插入内容」和插入的属性
309
+ * 入参 selectedText 当前选中的内容
310
+ *
311
+ * targetValue 待插入内容
312
+ * select 插入后是否自动选中内容
313
+ * deviationStart 插入后选中内容鼠标开始位置
314
+ * deviationEnd 插入后选中内容鼠标结束位置
315
+ *
316
+ */
317
+ insert(generate: InsertContentGenerator): void;
318
+ }
@@ -19,7 +19,7 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { reactive, watch, onMounted, onBeforeUnmount, provide, computed, ref, defineComponent, createVNode, cloneVNode, nextTick, inject, Fragment, toRef, isVNode } from "vue";
21
21
  const prefix = "md-editor";
22
- const iconfontUrl = "https://at.alicdn.com/t/c/font_2605852_4cjr7o5jo0f.js";
22
+ const iconfontUrl = "https://at.alicdn.com/t/c/font_2605852_gymddm8qwtd.js";
23
23
  const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
24
24
  const highlightUrl = `${cdnBase}/highlight.js/11.5.1/highlight.min.js`;
25
25
  const prettierUrl = {
@@ -112,11 +112,12 @@ const staticTextDefault = {
112
112
  clip2upload: "\u88C1\u526A\u4E0A\u4F20"
113
113
  },
114
114
  linkModalTips: {
115
- title: "\u6DFB\u52A0",
116
- descLable: "\u94FE\u63A5\u63CF\u8FF0\uFF1A",
117
- descLablePlaceHolder: "\u8BF7\u8F93\u5165\u63CF\u8FF0...",
118
- urlLable: "\u94FE\u63A5\u5730\u5740\uFF1A",
119
- urlLablePlaceHolder: "\u8BF7\u8F93\u5165\u94FE\u63A5...",
115
+ linkTitle: "\u6DFB\u52A0\u94FE\u63A5",
116
+ imageTitle: "\u6DFB\u52A0\u56FE\u7247",
117
+ descLabel: "\u94FE\u63A5\u63CF\u8FF0\uFF1A",
118
+ descLabelPlaceHolder: "\u8BF7\u8F93\u5165\u63CF\u8FF0...",
119
+ urlLabel: "\u94FE\u63A5\u5730\u5740\uFF1A",
120
+ urlLabelPlaceHolder: "\u8BF7\u8F93\u5165\u94FE\u63A5...",
120
121
  buttonOK: "\u786E\u5B9A"
121
122
  },
122
123
  clipModalTips: {
@@ -192,11 +193,12 @@ const staticTextDefault = {
192
193
  clip2upload: "Clip Upload"
193
194
  },
194
195
  linkModalTips: {
195
- title: "Add ",
196
- descLable: "Desc:",
197
- descLablePlaceHolder: "Enter a description...",
198
- urlLable: "Link:",
199
- urlLablePlaceHolder: "Enter a link...",
196
+ linkTitle: "Add Link",
197
+ imageTitle: "Add Image",
198
+ descLabel: "Desc:",
199
+ descLabelPlaceHolder: "Enter a description...",
200
+ urlLabel: "Link:",
201
+ urlLabelPlaceHolder: "Enter a link...",
200
202
  buttonOK: "OK"
201
203
  },
202
204
  clipModalTips: {
@@ -560,6 +562,14 @@ const updateHandler = debounce((id, attr, value) => {
560
562
  ele.setAttribute(attr, value);
561
563
  }
562
564
  }, 10);
565
+ const ON_SAVE = "onSave";
566
+ const CHANGE_CATALOG_VISIBLE = "changeCatalogVisible";
567
+ const CHANGE_FULL_SCREEN = "changeFullscreen";
568
+ const PAGE_FULL_SCREEN_CHANGED = "pageFullscreenChanged";
569
+ const FULL_SCREEN_CHANGED = "fullscreenChanged";
570
+ const PREVIEW_CHANGED = "previewChanged";
571
+ const HTML_PREVIEW_CHANGED = "htmlPreviewChanged";
572
+ const CATALOG_VISIBLE_CHANGED = "catalogVisibleChanged";
563
573
  const useKeyBoard = (props, context) => {
564
574
  const { editorId, noPrettier, previewOnly } = props;
565
575
  const state = reactive({
@@ -568,7 +578,7 @@ const useKeyBoard = (props, context) => {
568
578
  });
569
579
  const initFunc = (name) => {
570
580
  var _a, _b;
571
- return ((_a = props.toolbars) == null ? void 0 : _a.includes(name)) && !((_b = props.toolbarsExclude) == null ? void 0 : _b.includes(name)) && !noPrettier;
581
+ return ((_a = props.toolbars) == null ? void 0 : _a.includes(name)) && !((_b = props.toolbarsExclude) == null ? void 0 : _b.includes(name));
572
582
  };
573
583
  const keyDownHandler = (event) => {
574
584
  if (event.target !== document.querySelector(`#${props.editorId}-textarea`)) {
@@ -584,7 +594,7 @@ const useKeyBoard = (props, context) => {
584
594
  }
585
595
  } else {
586
596
  if (initFunc("save")) {
587
- bus.emit(editorId, "onSave", props.modelValue);
597
+ bus.emit(editorId, ON_SAVE, props.modelValue);
588
598
  event.preventDefault();
589
599
  }
590
600
  }
@@ -768,7 +778,7 @@ const useKeyBoard = (props, context) => {
768
778
  }
769
779
  case "KeyF": {
770
780
  if (event.shiftKey) {
771
- if (initFunc("prettier")) {
781
+ if (initFunc("prettier") && !noPrettier) {
772
782
  bus.emit(editorId, "replace", "prettier");
773
783
  event.preventDefault();
774
784
  }
@@ -818,7 +828,7 @@ const useKeyBoard = (props, context) => {
818
828
  }
819
829
  });
820
830
  bus.on(editorId, {
821
- name: "onSave",
831
+ name: ON_SAVE,
822
832
  callback() {
823
833
  const htmlPromise = new Promise((rev) => {
824
834
  if (state.buildFinished) {
@@ -858,9 +868,10 @@ const useProvide = (props) => {
858
868
  provide("theme", computed(() => props.theme));
859
869
  provide("highlight", computed(() => {
860
870
  const cssList = __spreadValues(__spreadValues({}, codeCss), highlightConfig == null ? void 0 : highlightConfig.css);
871
+ const theme = props.codeStyleReverse && props.codeStyleReverseList.includes(props.previewTheme) ? "dark" : props.theme;
861
872
  return {
862
873
  js: (highlightConfig == null ? void 0 : highlightConfig.js) || highlightUrl,
863
- css: cssList[props.codeTheme] ? cssList[props.codeTheme][props.theme] : codeCss.atom[props.theme]
874
+ css: cssList[props.codeTheme] ? cssList[props.codeTheme][theme] : codeCss.atom[theme]
864
875
  };
865
876
  }));
866
877
  provide("historyLength", props.historyLength);
@@ -880,11 +891,11 @@ const useProvide = (props) => {
880
891
  };
881
892
  const useExpansion = (props) => {
882
893
  var _a, _b, _c, _d, _e, _f;
883
- const { noPrettier, previewOnly, noIconfont } = props;
894
+ const { noPrettier, previewOnly, noIconfont, noUploadImg } = props;
884
895
  const { editorExtensions } = configOption;
885
896
  const noPrettierScript = noPrettier || !!((_b = (_a = configOption.editorExtensions) == null ? void 0 : _a.prettier) == null ? void 0 : _b.prettierInstance);
886
897
  const noParserMarkdownScript = noPrettier || !!((_d = (_c = configOption.editorExtensions) == null ? void 0 : _c.prettier) == null ? void 0 : _d.parserMarkdownInstance);
887
- const noCropperScript = !!((_f = (_e = configOption.editorExtensions) == null ? void 0 : _e.cropper) == null ? void 0 : _f.instance);
898
+ const noCropperScript = noUploadImg || !!((_f = (_e = configOption.editorExtensions) == null ? void 0 : _e.cropper) == null ? void 0 : _f.instance);
888
899
  onMounted(() => {
889
900
  var _a2, _b2, _c2, _d2;
890
901
  const iconfontScript = document.createElement("script");
@@ -923,13 +934,13 @@ const useExpansion = (props) => {
923
934
  const useConfig = (props, context) => {
924
935
  const { editorId, previewOnly } = props;
925
936
  const setting = reactive({
926
- pageFullScreen: props.pageFullScreen,
937
+ pageFullscreen: props.pageFullscreen,
927
938
  fullscreen: false,
928
939
  preview: props.preview,
929
940
  htmlPreview: props.preview ? false : props.htmlPreview
930
941
  });
931
942
  const updateSetting = (v, k) => {
932
- setting[k] = v;
943
+ setting[k] = v === void 0 ? !setting[k] : v;
933
944
  if (k === "preview" && setting.preview) {
934
945
  setting.htmlPreview = false;
935
946
  } else if (k === "htmlPreview" && setting.htmlPreview) {
@@ -938,13 +949,13 @@ const useConfig = (props, context) => {
938
949
  };
939
950
  let bodyOverflowHistory = "";
940
951
  const adjustBody = () => {
941
- if (setting.pageFullScreen || setting.fullscreen) {
952
+ if (setting.pageFullscreen || setting.fullscreen) {
942
953
  document.body.style.overflow = "hidden";
943
954
  } else {
944
955
  document.body.style.overflow = bodyOverflowHistory;
945
956
  }
946
957
  };
947
- watch(() => [setting.pageFullScreen, setting.fullscreen], adjustBody);
958
+ watch(() => [setting.pageFullscreen, setting.fullscreen], adjustBody);
948
959
  onMounted(() => {
949
960
  if (!previewOnly) {
950
961
  bus.on(editorId, {
@@ -975,9 +986,13 @@ const useCatalog = (props) => {
975
986
  const catalogVisible = ref(false);
976
987
  onMounted(() => {
977
988
  bus.on(editorId, {
978
- name: "catalogShow",
979
- callback: () => {
980
- catalogVisible.value = !catalogVisible.value;
989
+ name: CHANGE_CATALOG_VISIBLE,
990
+ callback: (v) => {
991
+ if (v === void 0) {
992
+ catalogVisible.value = !catalogVisible.value;
993
+ } else {
994
+ catalogVisible.value = v;
995
+ }
981
996
  }
982
997
  });
983
998
  });
@@ -986,6 +1001,97 @@ const useCatalog = (props) => {
986
1001
  });
987
1002
  return [catalogVisible, catalogShow];
988
1003
  };
1004
+ const useExpose = (props, ctx, catalogVisible, setting, updateSetting) => {
1005
+ const { editorId } = props;
1006
+ watch(() => setting.pageFullscreen, (newVal) => {
1007
+ bus.emit(editorId, PAGE_FULL_SCREEN_CHANGED, newVal);
1008
+ });
1009
+ watch(() => setting.fullscreen, (newVal) => {
1010
+ bus.emit(editorId, FULL_SCREEN_CHANGED, newVal);
1011
+ });
1012
+ watch(() => setting.preview, (newVal) => {
1013
+ bus.emit(editorId, PREVIEW_CHANGED, newVal);
1014
+ });
1015
+ watch(() => setting.htmlPreview, (newVal) => {
1016
+ bus.emit(editorId, HTML_PREVIEW_CHANGED, newVal);
1017
+ });
1018
+ watch(catalogVisible, (newVal) => {
1019
+ bus.emit(editorId, CATALOG_VISIBLE_CHANGED, newVal);
1020
+ });
1021
+ const exposeParam = {
1022
+ on(eventName, callBack) {
1023
+ switch (eventName) {
1024
+ case "pageFullscreen": {
1025
+ bus.on(editorId, {
1026
+ name: PAGE_FULL_SCREEN_CHANGED,
1027
+ callback(status) {
1028
+ callBack(status);
1029
+ }
1030
+ });
1031
+ break;
1032
+ }
1033
+ case "fullscreen": {
1034
+ bus.on(editorId, {
1035
+ name: FULL_SCREEN_CHANGED,
1036
+ callback(status) {
1037
+ callBack(status);
1038
+ }
1039
+ });
1040
+ break;
1041
+ }
1042
+ case "preview": {
1043
+ bus.on(editorId, {
1044
+ name: PREVIEW_CHANGED,
1045
+ callback(status) {
1046
+ callBack(status);
1047
+ }
1048
+ });
1049
+ break;
1050
+ }
1051
+ case "htmlPreview": {
1052
+ bus.on(editorId, {
1053
+ name: HTML_PREVIEW_CHANGED,
1054
+ callback(status) {
1055
+ callBack(status);
1056
+ }
1057
+ });
1058
+ break;
1059
+ }
1060
+ case "catalog": {
1061
+ bus.on(editorId, {
1062
+ name: CATALOG_VISIBLE_CHANGED,
1063
+ callback(status) {
1064
+ callBack(status);
1065
+ }
1066
+ });
1067
+ break;
1068
+ }
1069
+ }
1070
+ },
1071
+ togglePageFullscreen(status) {
1072
+ updateSetting(status, "pageFullscreen");
1073
+ },
1074
+ toggleFullscreen(status) {
1075
+ bus.emit(editorId, CHANGE_FULL_SCREEN, status);
1076
+ },
1077
+ togglePreview(status) {
1078
+ updateSetting(status, "preview");
1079
+ },
1080
+ toggleHtmlPreview(status) {
1081
+ updateSetting(status, "htmlPreview");
1082
+ },
1083
+ toggleCatalog(status) {
1084
+ bus.emit(editorId, CHANGE_CATALOG_VISIBLE, status);
1085
+ },
1086
+ triggerSave() {
1087
+ bus.emit(editorId, ON_SAVE);
1088
+ },
1089
+ insert(generate) {
1090
+ bus.emit(editorId, "replace", "universal", { generate });
1091
+ }
1092
+ };
1093
+ ctx.expose(exposeParam);
1094
+ };
989
1095
  var index$1 = "";
990
1096
  var Divider = defineComponent({
991
1097
  setup() {
@@ -1334,13 +1440,13 @@ var LinkModal = defineComponent({
1334
1440
  const ult = inject("usedLanguageText");
1335
1441
  const editorId = inject("editorId");
1336
1442
  const title = computed(() => {
1337
- var _a, _b, _c, _d;
1443
+ var _a, _b;
1338
1444
  switch (props.type) {
1339
1445
  case "link": {
1340
- return `${(_a = ult.value.linkModalTips) == null ? void 0 : _a.title}${(_b = ult.value.toolbarTips) == null ? void 0 : _b.link}`;
1446
+ return (_a = ult.value.linkModalTips) == null ? void 0 : _a.linkTitle;
1341
1447
  }
1342
1448
  case "image": {
1343
- return `${(_c = ult.value.linkModalTips) == null ? void 0 : _c.title}${(_d = ult.value.toolbarTips) == null ? void 0 : _d.image}`;
1449
+ return (_b = ult.value.linkModalTips) == null ? void 0 : _b.imageTitle;
1344
1450
  }
1345
1451
  default: {
1346
1452
  return "";
@@ -1369,10 +1475,10 @@ var LinkModal = defineComponent({
1369
1475
  return [createVNode("div", {
1370
1476
  "class": `${prefix}-form-item`
1371
1477
  }, [createVNode("label", {
1372
- "class": `${prefix}-lable`,
1478
+ "class": `${prefix}-label`,
1373
1479
  "for": `link-desc-${editorId}`
1374
- }, [(_a = ult.value.linkModalTips) == null ? void 0 : _a.descLable]), createVNode("input", {
1375
- "placeholder": (_b = ult.value.linkModalTips) == null ? void 0 : _b.descLablePlaceHolder,
1480
+ }, [(_a = ult.value.linkModalTips) == null ? void 0 : _a.descLabel]), createVNode("input", {
1481
+ "placeholder": (_b = ult.value.linkModalTips) == null ? void 0 : _b.descLabelPlaceHolder,
1376
1482
  "class": `${prefix}-input`,
1377
1483
  "id": `link-desc-${editorId}`,
1378
1484
  "type": "text",
@@ -1384,10 +1490,10 @@ var LinkModal = defineComponent({
1384
1490
  }, null)]), createVNode("div", {
1385
1491
  "class": `${prefix}-form-item`
1386
1492
  }, [createVNode("label", {
1387
- "class": `${prefix}-lable`,
1493
+ "class": `${prefix}-label`,
1388
1494
  "for": `link-url-${editorId}`
1389
- }, [(_c = ult.value.linkModalTips) == null ? void 0 : _c.urlLable]), createVNode("input", {
1390
- "placeholder": (_d = ult.value.linkModalTips) == null ? void 0 : _d.urlLablePlaceHolder,
1495
+ }, [(_c = ult.value.linkModalTips) == null ? void 0 : _c.urlLabel]), createVNode("input", {
1496
+ "placeholder": (_d = ult.value.linkModalTips) == null ? void 0 : _d.urlLabelPlaceHolder,
1391
1497
  "class": `${prefix}-input`,
1392
1498
  "id": `link-url-${editorId}`,
1393
1499
  "type": "text",
@@ -1620,20 +1726,21 @@ const useSreenfull = (props) => {
1620
1726
  let screenfull = (_b = (_a = configOption.editorExtensions) == null ? void 0 : _a.screenfull) == null ? void 0 : _b.instance;
1621
1727
  const screenfullJs = (_d = (_c = configOption.editorExtensions) == null ? void 0 : _c.screenfull) == null ? void 0 : _d.js;
1622
1728
  const screenfullMe = ref(false);
1623
- const fullScreenHandler = () => {
1729
+ const fullscreenHandler = (status) => {
1624
1730
  if (!screenfull) {
1625
1731
  bus.emit(editorId, "errorCatcher", {
1626
- name: "fullScreen",
1627
- message: "fullScreen is undefined"
1732
+ name: "fullscreen",
1733
+ message: "fullscreen is undefined"
1628
1734
  });
1629
1735
  return;
1630
1736
  }
1631
1737
  if (screenfull.isEnabled) {
1632
1738
  screenfullMe.value = true;
1633
- if (screenfull.isFullscreen) {
1634
- screenfull.exit();
1635
- } else {
1739
+ const targetStatus = status === void 0 ? !screenfull.isFullscreen : !!status;
1740
+ if (targetStatus) {
1636
1741
  screenfull.request();
1742
+ } else {
1743
+ screenfull.exit();
1637
1744
  }
1638
1745
  } else {
1639
1746
  console.error("browser does not support screenfull!");
@@ -1663,7 +1770,15 @@ const useSreenfull = (props) => {
1663
1770
  appendHandler(screenScript, "screenfull");
1664
1771
  }
1665
1772
  });
1666
- return { fullScreenHandler };
1773
+ onMounted(() => {
1774
+ if (!previewOnly) {
1775
+ bus.on(editorId, {
1776
+ name: CHANGE_FULL_SCREEN,
1777
+ callback: fullscreenHandler
1778
+ });
1779
+ }
1780
+ });
1781
+ return { fullscreenHandler };
1667
1782
  };
1668
1783
  const tableShapeProps = () => ({
1669
1784
  tableShape: {
@@ -1755,7 +1870,7 @@ var ToolBar = defineComponent({
1755
1870
  const editorId = inject("editorId");
1756
1871
  const ult = inject("usedLanguageText");
1757
1872
  const {
1758
- fullScreenHandler
1873
+ fullscreenHandler
1759
1874
  } = useSreenfull(props);
1760
1875
  const wrapperId = `${editorId}-toolbar-wrapper`;
1761
1876
  const visible = reactive({
@@ -2167,7 +2282,7 @@ var ToolBar = defineComponent({
2167
2282
  "class": `${prefix}-toolbar-item`,
2168
2283
  "title": (_z = ult.value.toolbarTips) == null ? void 0 : _z.save,
2169
2284
  "onClick": () => {
2170
- bus.emit(editorId, "onSave");
2285
+ bus.emit(editorId, ON_SAVE);
2171
2286
  }
2172
2287
  }, [createVNode("svg", {
2173
2288
  "class": `${prefix}-icon`,
@@ -2195,25 +2310,27 @@ var ToolBar = defineComponent({
2195
2310
  "class": `${prefix}-toolbar-item`,
2196
2311
  "title": (_B = ult.value.toolbarTips) == null ? void 0 : _B.pageFullscreen,
2197
2312
  "onClick": () => {
2198
- props.updateSetting(!props.setting.pageFullScreen, "pageFullScreen");
2313
+ props.updateSetting(!props.setting.pageFullscreen, "pageFullscreen");
2199
2314
  }
2200
2315
  }, [createVNode("svg", {
2201
2316
  "class": `${prefix}-icon`,
2202
2317
  "aria-hidden": "true"
2203
2318
  }, [createVNode("use", {
2204
- "xlink:href": `#md-editor-icon-${props.setting.pageFullScreen ? "suoxiao" : "fangda"}`
2319
+ "xlink:href": `#md-editor-icon-${props.setting.pageFullscreen ? "suoxiao" : "fangda"}`
2205
2320
  }, null)])]);
2206
2321
  }
2207
2322
  case "fullscreen": {
2208
2323
  return createVNode("div", {
2209
2324
  "class": `${prefix}-toolbar-item`,
2210
2325
  "title": (_C = ult.value.toolbarTips) == null ? void 0 : _C.fullscreen,
2211
- "onClick": fullScreenHandler
2326
+ "onClick": () => {
2327
+ fullscreenHandler();
2328
+ }
2212
2329
  }, [createVNode("svg", {
2213
2330
  "class": `${prefix}-icon`,
2214
2331
  "aria-hidden": "true"
2215
2332
  }, [createVNode("use", {
2216
- "xlink:href": `#md-editor-icon-${props.setting.fullscreen ? "fullScreen-exit" : "fullScreen"}`
2333
+ "xlink:href": `#md-editor-icon-${props.setting.fullscreen ? "fullscreen-exit" : "fullscreen"}`
2217
2334
  }, null)])]);
2218
2335
  }
2219
2336
  case "preview": {
@@ -2249,7 +2366,7 @@ var ToolBar = defineComponent({
2249
2366
  "class": `${prefix}-toolbar-item`,
2250
2367
  "title": (_F = ult.value.toolbarTips) == null ? void 0 : _F.catalog,
2251
2368
  "onClick": () => {
2252
- bus.emit(editorId, "catalogShow");
2369
+ bus.emit(editorId, CHANGE_CATALOG_VISIBLE);
2253
2370
  },
2254
2371
  "key": "bar-catalog"
2255
2372
  }, [createVNode("svg", {
@@ -2397,10 +2514,7 @@ var ToolBar = defineComponent({
2397
2514
  "class": `${prefix}-toolbar-wrapper`,
2398
2515
  "id": wrapperId
2399
2516
  }, [createVNode("div", {
2400
- "class": `${prefix}-toolbar`,
2401
- "onMouseenter": () => {
2402
- bus.emit(editorId, "selectTextChange");
2403
- }
2517
+ "class": `${prefix}-toolbar`
2404
2518
  }, [createVNode("div", {
2405
2519
  "class": `${prefix}-toolbar-left`,
2406
2520
  "ref": toolbarLeftRef
@@ -5342,6 +5456,14 @@ ${(mermaidTemplate == null ? void 0 : mermaidTemplate.journey) || "journey\n ti
5342
5456
  deviationEnd = -4;
5343
5457
  break;
5344
5458
  }
5459
+ case "universal": {
5460
+ const { generate } = params;
5461
+ const insertOptions = generate(selectedText);
5462
+ targetValue = insertOptions.targetValue;
5463
+ select = insertOptions.select;
5464
+ deviationStart = insertOptions.deviationStart;
5465
+ deviationEnd = insertOptions.deviationEnd;
5466
+ }
5345
5467
  }
5346
5468
  }
5347
5469
  return insert(inputArea, targetValue, {
@@ -6003,6 +6125,9 @@ var Content = defineComponent({
6003
6125
  "id": `${editorId}-textarea`,
6004
6126
  "ref": textAreaRef,
6005
6127
  "value": props.value,
6128
+ "onBlur": () => {
6129
+ bus.emit(editorId, "selectTextChange");
6130
+ },
6006
6131
  "onKeydown": () => {
6007
6132
  bus.emit(editorId, "saveHistoryPos", true);
6008
6133
  },
@@ -6415,7 +6540,7 @@ const editorProps = () => ({
6415
6540
  onUploadImg: {
6416
6541
  type: Function
6417
6542
  },
6418
- pageFullScreen: {
6543
+ pageFullscreen: {
6419
6544
  type: Boolean,
6420
6545
  default: false
6421
6546
  },
@@ -6527,6 +6652,14 @@ const editorProps = () => ({
6527
6652
  },
6528
6653
  noUploadImg: {
6529
6654
  type: Boolean
6655
+ },
6656
+ codeStyleReverse: {
6657
+ type: Boolean,
6658
+ default: true
6659
+ },
6660
+ codeStyleReverseList: {
6661
+ type: Array,
6662
+ default: ["default", "mk-cute"]
6530
6663
  }
6531
6664
  });
6532
6665
  const markedHeadingId = (text) => text;
@@ -6537,7 +6670,11 @@ const Editor = defineComponent({
6537
6670
  setup(props, context) {
6538
6671
  const {
6539
6672
  editorId,
6540
- previewOnly
6673
+ previewOnly,
6674
+ noKatex,
6675
+ noMermaid,
6676
+ noPrettier,
6677
+ noUploadImg
6541
6678
  } = props;
6542
6679
  const state = reactive({
6543
6680
  scrollAuto: props.scrollAuto
@@ -6550,6 +6687,7 @@ const Editor = defineComponent({
6550
6687
  onBeforeUnmount(() => {
6551
6688
  bus.clear(editorId);
6552
6689
  });
6690
+ useExpose(props, context, catalogVisible, setting, updateSetting);
6553
6691
  return () => {
6554
6692
  var _a;
6555
6693
  const defToolbars = getSlot({
@@ -6562,17 +6700,17 @@ const Editor = defineComponent({
6562
6700
  }, "defFooters");
6563
6701
  return createVNode("div", {
6564
6702
  "id": editorId,
6565
- "class": [prefix, props.class, props.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullScreen ? `${prefix}-fullscreen` : "", previewOnly && `${prefix}-previewOnly`],
6703
+ "class": [prefix, props.class, props.theme === "dark" && `${prefix}-dark`, setting.fullscreen || setting.pageFullscreen ? `${prefix}-fullscreen` : "", previewOnly && `${prefix}-previewOnly`],
6566
6704
  "style": props.style
6567
6705
  }, [!previewOnly && createVNode(ToolBar, {
6568
- "noPrettier": props.noPrettier,
6706
+ "noPrettier": noPrettier,
6569
6707
  "toolbars": props.toolbars,
6570
6708
  "toolbarsExclude": props.toolbarsExclude,
6571
6709
  "setting": setting,
6572
6710
  "updateSetting": updateSetting,
6573
6711
  "tableShape": props.tableShape,
6574
6712
  "defToolbars": defToolbars,
6575
- "noUploadImg": props.noUploadImg
6713
+ "noUploadImg": noUploadImg
6576
6714
  }, null), createVNode(Content, {
6577
6715
  "value": props.modelValue,
6578
6716
  "onChange": (value) => {
@@ -6600,10 +6738,10 @@ const Editor = defineComponent({
6600
6738
  }
6601
6739
  },
6602
6740
  "markedHeadingId": props.markedHeadingId,
6603
- "noMermaid": props.noMermaid,
6741
+ "noMermaid": noMermaid,
6604
6742
  "sanitize": props.sanitize,
6605
6743
  "placeholder": props.placeholder,
6606
- "noKatex": props.noKatex,
6744
+ "noKatex": noKatex,
6607
6745
  "scrollAuto": state.scrollAuto,
6608
6746
  "formatCopiedText": props.formatCopiedText
6609
6747
  }, null), !previewOnly && ((_a = props.footers) == null ? void 0 : _a.length) > 0 && createVNode(Footer, {