md-editor-v3 4.12.4 → 4.13.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.
package/README.md CHANGED
@@ -185,6 +185,7 @@ Except for the same as `MdPreview`:
185
185
  'pageFullscreen',
186
186
  'fullscreen',
187
187
  'preview',
188
+ 'previewOnly',
188
189
  'htmlPreview',
189
190
  'catalog',
190
191
  'github'
@@ -230,6 +231,7 @@ export interface ToolbarTips {
230
231
  fullscreen?: string;
231
232
  catalog?: string;
232
233
  preview?: string;
234
+ previewOnly?: string;
233
235
  htmlPreview?: string;
234
236
  github?: string;
235
237
  '-'?: string;
@@ -403,6 +405,12 @@ Get the internal state of the editor, including pageFullscreen, fullscreen, prev
403
405
  editorRef.value?.on('preview', (status) => console.log(status));
404
406
  ```
405
407
 
408
+ - previewOnly
409
+
410
+ ```js
411
+ editorRef.value?.on('previewOnly', (status) => console.log(status));
412
+ ```
413
+
406
414
  - htmlPreview
407
415
 
408
416
  ```js
@@ -439,6 +447,14 @@ Toggle status of preview.
439
447
  editorRef.value?.togglePreview(true);
440
448
  ```
441
449
 
450
+ ### 📖 togglePreviewOnly
451
+
452
+ Toggle into Preview Only Mode.
453
+
454
+ ```js
455
+ editorRef.value?.togglePreviewOnly(true);
456
+ ```
457
+
442
458
  ### 📼 toggleHtmlPreview
443
459
 
444
460
  Toggle status of htmlPreview.
@@ -532,6 +548,14 @@ editorRef.value?.domEventHandlers({
532
548
  });
533
549
  ```
534
550
 
551
+ ### 🎛 execCommand
552
+
553
+ Insert content into the editor via trigger.
554
+
555
+ ```js
556
+ editorRef.value?.execCommand('bold');
557
+ ```
558
+
535
559
  ## 💴 Config Editor
536
560
 
537
561
  Use `config(option: ConfigOption)` to reconfigure `markdown-it` and so on.
@@ -545,7 +545,7 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
545
545
  uploadRef.value.addEventListener("change", uploadHandler);
546
546
  });
547
547
  const barRender = (barItem) => {
548
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma;
548
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa;
549
549
  if (config.allToolbar.includes(barItem)) {
550
550
  switch (barItem) {
551
551
  case "-": {
@@ -953,10 +953,23 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
953
953
  "class": `${config.prefix}-toolbar-item-name`
954
954
  }, [(_Y = ult.value.toolbarTips) == null ? void 0 : _Y.preview])]);
955
955
  }
956
+ case "previewOnly": {
957
+ return vue.createVNode("div", {
958
+ "class": `${config.prefix}-toolbar-item`,
959
+ "title": (_Z = ult.value.toolbarTips) == null ? void 0 : _Z.previewOnly,
960
+ "onClick": () => {
961
+ props2.updateSetting("previewOnly");
962
+ }
963
+ }, [vue.createVNode(MdModal.Icon, {
964
+ "name": "preview-only"
965
+ }, null), props2.showToolbarName && vue.createVNode("div", {
966
+ "class": `${config.prefix}-toolbar-item-name`
967
+ }, [(__ = ult.value.toolbarTips) == null ? void 0 : __.previewOnly])]);
968
+ }
956
969
  case "htmlPreview": {
957
970
  return vue.createVNode("div", {
958
971
  "class": `${config.prefix}-toolbar-item`,
959
- "title": (_Z = ult.value.toolbarTips) == null ? void 0 : _Z.htmlPreview,
972
+ "title": (_$ = ult.value.toolbarTips) == null ? void 0 : _$.htmlPreview,
960
973
  "onClick": () => {
961
974
  props2.updateSetting("htmlPreview");
962
975
  }
@@ -964,12 +977,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
964
977
  "name": "coding"
965
978
  }, null), props2.showToolbarName && vue.createVNode("div", {
966
979
  "class": `${config.prefix}-toolbar-item-name`
967
- }, [(__ = ult.value.toolbarTips) == null ? void 0 : __.htmlPreview])]);
980
+ }, [(_aa = ult.value.toolbarTips) == null ? void 0 : _aa.htmlPreview])]);
968
981
  }
969
982
  case "catalog": {
970
983
  return vue.createVNode("div", {
971
984
  "class": `${config.prefix}-toolbar-item`,
972
- "title": (_$ = ult.value.toolbarTips) == null ? void 0 : _$.catalog,
985
+ "title": (_ba = ult.value.toolbarTips) == null ? void 0 : _ba.catalog,
973
986
  "onClick": () => {
974
987
  index.bus.emit(editorId, index.CHANGE_CATALOG_VISIBLE);
975
988
  },
@@ -978,18 +991,18 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
978
991
  "name": "catalog"
979
992
  }, null), props2.showToolbarName && vue.createVNode("div", {
980
993
  "class": `${config.prefix}-toolbar-item-name`
981
- }, [(_aa = ult.value.toolbarTips) == null ? void 0 : _aa.catalog])]);
994
+ }, [(_ca = ult.value.toolbarTips) == null ? void 0 : _ca.catalog])]);
982
995
  }
983
996
  case "github": {
984
997
  return vue.createVNode("div", {
985
998
  "class": `${config.prefix}-toolbar-item`,
986
- "title": (_ba = ult.value.toolbarTips) == null ? void 0 : _ba.github,
999
+ "title": (_da = ult.value.toolbarTips) == null ? void 0 : _da.github,
987
1000
  "onClick": () => util.linkTo("https://github.com/imzbf/md-editor-v3")
988
1001
  }, [vue.createVNode(MdModal.Icon, {
989
1002
  "name": "github"
990
1003
  }, null), props2.showToolbarName && vue.createVNode("div", {
991
1004
  "class": `${config.prefix}-toolbar-item-name`
992
- }, [(_ca = ult.value.toolbarTips) == null ? void 0 : _ca.github])]);
1005
+ }, [(_ea = ult.value.toolbarTips) == null ? void 0 : _ea.github])]);
993
1006
  }
994
1007
  case "mermaid": {
995
1008
  return vue.createVNode(DropdownToolbar.Dropdown, {
@@ -1008,42 +1021,42 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1008
1021
  "onClick": () => {
1009
1022
  emitHandler("flow");
1010
1023
  }
1011
- }, [(_da = ult.value.mermaid) == null ? void 0 : _da.flow]), vue.createVNode("li", {
1024
+ }, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.flow]), vue.createVNode("li", {
1012
1025
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1013
1026
  "onClick": () => {
1014
1027
  emitHandler("sequence");
1015
1028
  }
1016
- }, [(_ea = ult.value.mermaid) == null ? void 0 : _ea.sequence]), vue.createVNode("li", {
1029
+ }, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.sequence]), vue.createVNode("li", {
1017
1030
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1018
1031
  "onClick": () => {
1019
1032
  emitHandler("gantt");
1020
1033
  }
1021
- }, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.gantt]), vue.createVNode("li", {
1034
+ }, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.gantt]), vue.createVNode("li", {
1022
1035
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1023
1036
  "onClick": () => {
1024
1037
  emitHandler("class");
1025
1038
  }
1026
- }, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.class]), vue.createVNode("li", {
1039
+ }, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.class]), vue.createVNode("li", {
1027
1040
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1028
1041
  "onClick": () => {
1029
1042
  emitHandler("state");
1030
1043
  }
1031
- }, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.state]), vue.createVNode("li", {
1044
+ }, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.state]), vue.createVNode("li", {
1032
1045
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1033
1046
  "onClick": () => {
1034
1047
  emitHandler("pie");
1035
1048
  }
1036
- }, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.pie]), vue.createVNode("li", {
1049
+ }, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.pie]), vue.createVNode("li", {
1037
1050
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1038
1051
  "onClick": () => {
1039
1052
  emitHandler("relationship");
1040
1053
  }
1041
- }, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.relationship]), vue.createVNode("li", {
1054
+ }, [(_la = ult.value.mermaid) == null ? void 0 : _la.relationship]), vue.createVNode("li", {
1042
1055
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-mermaid`,
1043
1056
  "onClick": () => {
1044
1057
  emitHandler("journey");
1045
1058
  }
1046
- }, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.journey])]),
1059
+ }, [(_ma = ult.value.mermaid) == null ? void 0 : _ma.journey])]),
1047
1060
  "key": "bar-mermaid"
1048
1061
  }, {
1049
1062
  default: () => {
@@ -1076,12 +1089,12 @@ const ToolBar = /* @__PURE__ */ vue.defineComponent({
1076
1089
  "onClick": () => {
1077
1090
  emitHandler("katexInline");
1078
1091
  }
1079
- }, [(_la = ult.value.katex) == null ? void 0 : _la.inline]), vue.createVNode("li", {
1092
+ }, [(_na = ult.value.katex) == null ? void 0 : _na.inline]), vue.createVNode("li", {
1080
1093
  "class": `${config.prefix}-menu-item ${config.prefix}-menu-item-katex`,
1081
1094
  "onClick": () => {
1082
1095
  emitHandler("katexBlock");
1083
1096
  }
1084
- }, [(_ma = ult.value.katex) == null ? void 0 : _ma.block])]),
1097
+ }, [(_oa = ult.value.katex) == null ? void 0 : _oa.block])]),
1085
1098
  "key": "bar-katex"
1086
1099
  }, {
1087
1100
  default: () => {
@@ -1451,9 +1464,9 @@ const useAutoScroll = (props2, html, codeMirrorUt) => {
1451
1464
  cEle,
1452
1465
  codeMirrorUt.value
1453
1466
  );
1454
- }
1455
- if (props2.scrollAuto) {
1456
- initScrollAuto();
1467
+ if (props2.scrollAuto) {
1468
+ initScrollAuto();
1469
+ }
1457
1470
  }
1458
1471
  };
1459
1472
  vue.watch(
@@ -1478,6 +1491,16 @@ const useAutoScroll = (props2, html, codeMirrorUt) => {
1478
1491
  }
1479
1492
  }
1480
1493
  );
1494
+ vue.watch(
1495
+ () => props2.setting.previewOnly,
1496
+ (po) => {
1497
+ if (po) {
1498
+ clearScrollAuto();
1499
+ } else {
1500
+ initScrollAuto();
1501
+ }
1502
+ }
1503
+ );
1481
1504
  vue.onMounted(rebindEvent);
1482
1505
  };
1483
1506
  const directive2flag = (direct, codeMirrorUt, params) => {
@@ -2755,6 +2778,18 @@ const useResize = (props2, contentRef, resizeRef) => {
2755
2778
  immediate: true
2756
2779
  }
2757
2780
  );
2781
+ vue.watch(
2782
+ () => props2.setting.previewOnly,
2783
+ (po) => {
2784
+ if (po) {
2785
+ inputWrapperStyle.width = "0%";
2786
+ resizeOperateStyle.display = "none";
2787
+ } else {
2788
+ inputWrapperStyle.width = state2.resizedWidth;
2789
+ resizeOperateStyle.display = "initial";
2790
+ }
2791
+ }
2792
+ );
2758
2793
  return { inputWrapperStyle, resizeOperateStyle };
2759
2794
  };
2760
2795
  const Content = /* @__PURE__ */ vue.defineComponent({
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  const prefix = "md-editor";
3
- const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_prouiefeic.js";
4
- const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_prouiefeic.css";
3
+ const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_rfu1p40qggh.js";
4
+ const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_rfu1p40qggh.css";
5
5
  const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
6
6
  const highlightUrl = `${cdnBase}/highlight.js/11.8.0/highlight.min.js`;
7
7
  const prettierUrl = {
@@ -43,6 +43,7 @@ const allToolbar = [
43
43
  "pageFullscreen",
44
44
  "fullscreen",
45
45
  "preview",
46
+ "previewOnly",
46
47
  "htmlPreview",
47
48
  "catalog",
48
49
  "github"
@@ -76,6 +77,7 @@ const staticTextDefault = {
76
77
  pageFullscreen: "浏览器全屏",
77
78
  fullscreen: "屏幕全屏",
78
79
  preview: "预览",
80
+ previewOnly: "仅预览",
79
81
  htmlPreview: "html代码预览",
80
82
  catalog: "目录",
81
83
  github: "源码地址"
@@ -157,6 +159,7 @@ const staticTextDefault = {
157
159
  pageFullscreen: "fullscreen in page",
158
160
  fullscreen: "fullscreen",
159
161
  preview: "preview",
162
+ previewOnly: "preview only",
160
163
  htmlPreview: "html preview",
161
164
  catalog: "catalog",
162
165
  github: "source code"
@@ -3,8 +3,8 @@ const vue = require("vue");
3
3
  const config = require("./config.cjs");
4
4
  const index = require("./index4.cjs");
5
5
  const dom = require("./dom.cjs");
6
- const mediumZoom = require("medium-zoom");
7
6
  const util = require("@vavt/util");
7
+ const mediumZoom = require("medium-zoom");
8
8
  const copy = require("copy-to-clipboard");
9
9
  const mdit = require("markdown-it");
10
10
  const ImageFiguresPlugin = require("markdown-it-image-figures");
@@ -1050,11 +1050,10 @@ const useProvidePreview = (props) => {
1050
1050
  ...config.staticTextDefault,
1051
1051
  ...(_b2 = (_a2 = config.configOption) == null ? void 0 : _a2.editorConfig) == null ? void 0 : _b2.languageUserDefined
1052
1052
  };
1053
- if (allText[props.language]) {
1054
- return allText[props.language];
1055
- } else {
1056
- return config.staticTextDefault["zh-CN"];
1057
- }
1053
+ return util.deepMerge(
1054
+ util.deepClone(config.staticTextDefault["en-US"]),
1055
+ allText[props.language] || {}
1056
+ );
1058
1057
  });
1059
1058
  vue.provide("usedLanguageText", usedLanguageText);
1060
1059
  vue.provide(
@@ -1145,14 +1144,19 @@ const useConfig = (props, context) => {
1145
1144
  pageFullscreen: props.pageFullscreen,
1146
1145
  fullscreen: false,
1147
1146
  preview: props.preview,
1148
- htmlPreview: props.preview ? false : props.htmlPreview
1147
+ htmlPreview: props.preview ? false : props.htmlPreview,
1148
+ previewOnly: false
1149
1149
  });
1150
1150
  const updateSetting = (k, v) => {
1151
1151
  setting[k] = v === void 0 ? !setting[k] : v;
1152
- if (k === "preview" && setting.preview) {
1152
+ if (k === "preview") {
1153
1153
  setting.htmlPreview = false;
1154
- } else if (k === "htmlPreview" && setting.htmlPreview) {
1154
+ setting.previewOnly = false;
1155
+ } else if (k === "htmlPreview") {
1155
1156
  setting.preview = false;
1157
+ setting.previewOnly = false;
1158
+ } else if (k === "previewOnly" && !setting.preview && !setting.htmlPreview) {
1159
+ setting.preview = true;
1156
1160
  }
1157
1161
  };
1158
1162
  let bodyOverflowHistory = "";
@@ -1227,6 +1231,12 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
1227
1231
  index.bus.emit(editorId, index.PREVIEW_CHANGED, newVal);
1228
1232
  }
1229
1233
  );
1234
+ vue.watch(
1235
+ () => setting.previewOnly,
1236
+ (newVal) => {
1237
+ index.bus.emit(editorId, index.PREVIEW_ONLY_CHANGED, newVal);
1238
+ }
1239
+ );
1230
1240
  vue.watch(
1231
1241
  () => setting.htmlPreview,
1232
1242
  (newVal) => {
@@ -1266,6 +1276,15 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
1266
1276
  });
1267
1277
  break;
1268
1278
  }
1279
+ case "previewOnly": {
1280
+ index.bus.on(editorId, {
1281
+ name: index.PREVIEW_ONLY_CHANGED,
1282
+ callback(status) {
1283
+ callBack(status);
1284
+ }
1285
+ });
1286
+ break;
1287
+ }
1269
1288
  case "htmlPreview": {
1270
1289
  index.bus.on(editorId, {
1271
1290
  name: index.HTML_PREVIEW_CHANGED,
@@ -1295,6 +1314,9 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
1295
1314
  togglePreview(status) {
1296
1315
  updateSetting("preview", status);
1297
1316
  },
1317
+ togglePreviewOnly(status) {
1318
+ updateSetting("previewOnly", status);
1319
+ },
1298
1320
  toggleHtmlPreview(status) {
1299
1321
  updateSetting("htmlPreview", status);
1300
1322
  },
@@ -1324,6 +1346,9 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
1324
1346
  },
1325
1347
  domEventHandlers(handlers) {
1326
1348
  index.bus.emit(editorId, index.EVENT_LISTENER, handlers);
1349
+ },
1350
+ execCommand(direct) {
1351
+ index.bus.emit(editorId, index.REPLACE, direct);
1327
1352
  }
1328
1353
  };
1329
1354
  ctx.expose(exposeParam);
@@ -58,6 +58,7 @@ const CHANGE_FULL_SCREEN = "changeFullscreen";
58
58
  const PAGE_FULL_SCREEN_CHANGED = "pageFullscreenChanged";
59
59
  const FULL_SCREEN_CHANGED = "fullscreenChanged";
60
60
  const PREVIEW_CHANGED = "previewChanged";
61
+ const PREVIEW_ONLY_CHANGED = "previewOnlyChanged";
61
62
  const HTML_PREVIEW_CHANGED = "htmlPreviewChanged";
62
63
  const CATALOG_VISIBLE_CHANGED = "catalogVisibleChanged";
63
64
  const BUILD_FINISHED = "buildFinished";
@@ -130,6 +131,7 @@ exports.ON_SAVE = ON_SAVE;
130
131
  exports.OPEN_MODALS = OPEN_MODALS;
131
132
  exports.PAGE_FULL_SCREEN_CHANGED = PAGE_FULL_SCREEN_CHANGED;
132
133
  exports.PREVIEW_CHANGED = PREVIEW_CHANGED;
134
+ exports.PREVIEW_ONLY_CHANGED = PREVIEW_ONLY_CHANGED;
133
135
  exports.PUSH_CATALOG = PUSH_CATALOG;
134
136
  exports.REPLACE = REPLACE;
135
137
  exports.RERENDER = RERENDER;
@@ -8,7 +8,7 @@ import { defineComponent, createVNode, inject, ref, onMounted, reactive, compute
8
8
  import { p as prefix, e as configOption, l as screenfullUrl, b as allToolbar, M as MinInputBoxWidth, d as allFooter } from "./chunks/config.mjs";
9
9
  import { draggingScroll, linkTo, debounce, createSmoothScroll, throttle } from "@vavt/util";
10
10
  import { a as Dropdown, D as DropdownToolbar } from "./chunks/index2.mjs";
11
- import { b as bus, i as CHANGE_FULL_SCREEN, E as ERROR_CATCHER, U as UPLOAD_IMAGE, l as base642File, m as OPEN_MODALS, h as REPLACE, c as CHANGE_CATALOG_VISIBLE, O as ON_SAVE, n as CTRL_SHIFT_Z, o as CTRL_Z, j as EVENT_LISTENER } from "./chunks/index4.mjs";
11
+ import { b as bus, j as CHANGE_FULL_SCREEN, E as ERROR_CATCHER, U as UPLOAD_IMAGE, m as base642File, n as OPEN_MODALS, i as REPLACE, c as CHANGE_CATALOG_VISIBLE, O as ON_SAVE, o as CTRL_SHIFT_Z, p as CTRL_Z, k as EVENT_LISTENER } from "./chunks/index4.mjs";
12
12
  import { a as appendHandler } from "./chunks/dom.mjs";
13
13
  import { M as MdModal, I as Icon } from "./chunks/index3.mjs";
14
14
  import { EditorView as EditorView$1 } from "codemirror";
@@ -544,7 +544,7 @@ const ToolBar = /* @__PURE__ */ defineComponent({
544
544
  uploadRef.value.addEventListener("change", uploadHandler);
545
545
  });
546
546
  const barRender = (barItem) => {
547
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma;
547
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa;
548
548
  if (allToolbar.includes(barItem)) {
549
549
  switch (barItem) {
550
550
  case "-": {
@@ -952,10 +952,23 @@ const ToolBar = /* @__PURE__ */ defineComponent({
952
952
  "class": `${prefix}-toolbar-item-name`
953
953
  }, [(_Y = ult.value.toolbarTips) == null ? void 0 : _Y.preview])]);
954
954
  }
955
+ case "previewOnly": {
956
+ return createVNode("div", {
957
+ "class": `${prefix}-toolbar-item`,
958
+ "title": (_Z = ult.value.toolbarTips) == null ? void 0 : _Z.previewOnly,
959
+ "onClick": () => {
960
+ props2.updateSetting("previewOnly");
961
+ }
962
+ }, [createVNode(Icon, {
963
+ "name": "preview-only"
964
+ }, null), props2.showToolbarName && createVNode("div", {
965
+ "class": `${prefix}-toolbar-item-name`
966
+ }, [(__ = ult.value.toolbarTips) == null ? void 0 : __.previewOnly])]);
967
+ }
955
968
  case "htmlPreview": {
956
969
  return createVNode("div", {
957
970
  "class": `${prefix}-toolbar-item`,
958
- "title": (_Z = ult.value.toolbarTips) == null ? void 0 : _Z.htmlPreview,
971
+ "title": (_$ = ult.value.toolbarTips) == null ? void 0 : _$.htmlPreview,
959
972
  "onClick": () => {
960
973
  props2.updateSetting("htmlPreview");
961
974
  }
@@ -963,12 +976,12 @@ const ToolBar = /* @__PURE__ */ defineComponent({
963
976
  "name": "coding"
964
977
  }, null), props2.showToolbarName && createVNode("div", {
965
978
  "class": `${prefix}-toolbar-item-name`
966
- }, [(__ = ult.value.toolbarTips) == null ? void 0 : __.htmlPreview])]);
979
+ }, [(_aa = ult.value.toolbarTips) == null ? void 0 : _aa.htmlPreview])]);
967
980
  }
968
981
  case "catalog": {
969
982
  return createVNode("div", {
970
983
  "class": `${prefix}-toolbar-item`,
971
- "title": (_$ = ult.value.toolbarTips) == null ? void 0 : _$.catalog,
984
+ "title": (_ba = ult.value.toolbarTips) == null ? void 0 : _ba.catalog,
972
985
  "onClick": () => {
973
986
  bus.emit(editorId, CHANGE_CATALOG_VISIBLE);
974
987
  },
@@ -977,18 +990,18 @@ const ToolBar = /* @__PURE__ */ defineComponent({
977
990
  "name": "catalog"
978
991
  }, null), props2.showToolbarName && createVNode("div", {
979
992
  "class": `${prefix}-toolbar-item-name`
980
- }, [(_aa = ult.value.toolbarTips) == null ? void 0 : _aa.catalog])]);
993
+ }, [(_ca = ult.value.toolbarTips) == null ? void 0 : _ca.catalog])]);
981
994
  }
982
995
  case "github": {
983
996
  return createVNode("div", {
984
997
  "class": `${prefix}-toolbar-item`,
985
- "title": (_ba = ult.value.toolbarTips) == null ? void 0 : _ba.github,
998
+ "title": (_da = ult.value.toolbarTips) == null ? void 0 : _da.github,
986
999
  "onClick": () => linkTo("https://github.com/imzbf/md-editor-v3")
987
1000
  }, [createVNode(Icon, {
988
1001
  "name": "github"
989
1002
  }, null), props2.showToolbarName && createVNode("div", {
990
1003
  "class": `${prefix}-toolbar-item-name`
991
- }, [(_ca = ult.value.toolbarTips) == null ? void 0 : _ca.github])]);
1004
+ }, [(_ea = ult.value.toolbarTips) == null ? void 0 : _ea.github])]);
992
1005
  }
993
1006
  case "mermaid": {
994
1007
  return createVNode(Dropdown, {
@@ -1007,42 +1020,42 @@ const ToolBar = /* @__PURE__ */ defineComponent({
1007
1020
  "onClick": () => {
1008
1021
  emitHandler("flow");
1009
1022
  }
1010
- }, [(_da = ult.value.mermaid) == null ? void 0 : _da.flow]), createVNode("li", {
1023
+ }, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.flow]), createVNode("li", {
1011
1024
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1012
1025
  "onClick": () => {
1013
1026
  emitHandler("sequence");
1014
1027
  }
1015
- }, [(_ea = ult.value.mermaid) == null ? void 0 : _ea.sequence]), createVNode("li", {
1028
+ }, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.sequence]), createVNode("li", {
1016
1029
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1017
1030
  "onClick": () => {
1018
1031
  emitHandler("gantt");
1019
1032
  }
1020
- }, [(_fa = ult.value.mermaid) == null ? void 0 : _fa.gantt]), createVNode("li", {
1033
+ }, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.gantt]), createVNode("li", {
1021
1034
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1022
1035
  "onClick": () => {
1023
1036
  emitHandler("class");
1024
1037
  }
1025
- }, [(_ga = ult.value.mermaid) == null ? void 0 : _ga.class]), createVNode("li", {
1038
+ }, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.class]), createVNode("li", {
1026
1039
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1027
1040
  "onClick": () => {
1028
1041
  emitHandler("state");
1029
1042
  }
1030
- }, [(_ha = ult.value.mermaid) == null ? void 0 : _ha.state]), createVNode("li", {
1043
+ }, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.state]), createVNode("li", {
1031
1044
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1032
1045
  "onClick": () => {
1033
1046
  emitHandler("pie");
1034
1047
  }
1035
- }, [(_ia = ult.value.mermaid) == null ? void 0 : _ia.pie]), createVNode("li", {
1048
+ }, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.pie]), createVNode("li", {
1036
1049
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1037
1050
  "onClick": () => {
1038
1051
  emitHandler("relationship");
1039
1052
  }
1040
- }, [(_ja = ult.value.mermaid) == null ? void 0 : _ja.relationship]), createVNode("li", {
1053
+ }, [(_la = ult.value.mermaid) == null ? void 0 : _la.relationship]), createVNode("li", {
1041
1054
  "class": `${prefix}-menu-item ${prefix}-menu-item-mermaid`,
1042
1055
  "onClick": () => {
1043
1056
  emitHandler("journey");
1044
1057
  }
1045
- }, [(_ka = ult.value.mermaid) == null ? void 0 : _ka.journey])]),
1058
+ }, [(_ma = ult.value.mermaid) == null ? void 0 : _ma.journey])]),
1046
1059
  "key": "bar-mermaid"
1047
1060
  }, {
1048
1061
  default: () => {
@@ -1075,12 +1088,12 @@ const ToolBar = /* @__PURE__ */ defineComponent({
1075
1088
  "onClick": () => {
1076
1089
  emitHandler("katexInline");
1077
1090
  }
1078
- }, [(_la = ult.value.katex) == null ? void 0 : _la.inline]), createVNode("li", {
1091
+ }, [(_na = ult.value.katex) == null ? void 0 : _na.inline]), createVNode("li", {
1079
1092
  "class": `${prefix}-menu-item ${prefix}-menu-item-katex`,
1080
1093
  "onClick": () => {
1081
1094
  emitHandler("katexBlock");
1082
1095
  }
1083
- }, [(_ma = ult.value.katex) == null ? void 0 : _ma.block])]),
1096
+ }, [(_oa = ult.value.katex) == null ? void 0 : _oa.block])]),
1084
1097
  "key": "bar-katex"
1085
1098
  }, {
1086
1099
  default: () => {
@@ -1450,9 +1463,9 @@ const useAutoScroll = (props2, html, codeMirrorUt) => {
1450
1463
  cEle,
1451
1464
  codeMirrorUt.value
1452
1465
  );
1453
- }
1454
- if (props2.scrollAuto) {
1455
- initScrollAuto();
1466
+ if (props2.scrollAuto) {
1467
+ initScrollAuto();
1468
+ }
1456
1469
  }
1457
1470
  };
1458
1471
  watch(
@@ -1477,6 +1490,16 @@ const useAutoScroll = (props2, html, codeMirrorUt) => {
1477
1490
  }
1478
1491
  }
1479
1492
  );
1493
+ watch(
1494
+ () => props2.setting.previewOnly,
1495
+ (po) => {
1496
+ if (po) {
1497
+ clearScrollAuto();
1498
+ } else {
1499
+ initScrollAuto();
1500
+ }
1501
+ }
1502
+ );
1480
1503
  onMounted(rebindEvent);
1481
1504
  };
1482
1505
  const directive2flag = (direct, codeMirrorUt, params) => {
@@ -2754,6 +2777,18 @@ const useResize = (props2, contentRef, resizeRef) => {
2754
2777
  immediate: true
2755
2778
  }
2756
2779
  );
2780
+ watch(
2781
+ () => props2.setting.previewOnly,
2782
+ (po) => {
2783
+ if (po) {
2784
+ inputWrapperStyle.width = "0%";
2785
+ resizeOperateStyle.display = "none";
2786
+ } else {
2787
+ inputWrapperStyle.width = state.resizedWidth;
2788
+ resizeOperateStyle.display = "initial";
2789
+ }
2790
+ }
2791
+ );
2757
2792
  return { inputWrapperStyle, resizeOperateStyle };
2758
2793
  };
2759
2794
  const Content = /* @__PURE__ */ defineComponent({
@@ -1,6 +1,6 @@
1
1
  const prefix = "md-editor";
2
- const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_prouiefeic.js";
3
- const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_prouiefeic.css";
2
+ const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_rfu1p40qggh.js";
3
+ const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_rfu1p40qggh.css";
4
4
  const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
5
5
  const highlightUrl = `${cdnBase}/highlight.js/11.8.0/highlight.min.js`;
6
6
  const prettierUrl = {
@@ -42,6 +42,7 @@ const allToolbar = [
42
42
  "pageFullscreen",
43
43
  "fullscreen",
44
44
  "preview",
45
+ "previewOnly",
45
46
  "htmlPreview",
46
47
  "catalog",
47
48
  "github"
@@ -75,6 +76,7 @@ const staticTextDefault = {
75
76
  pageFullscreen: "浏览器全屏",
76
77
  fullscreen: "屏幕全屏",
77
78
  preview: "预览",
79
+ previewOnly: "仅预览",
78
80
  htmlPreview: "html代码预览",
79
81
  catalog: "目录",
80
82
  github: "源码地址"
@@ -156,6 +158,7 @@ const staticTextDefault = {
156
158
  pageFullscreen: "fullscreen in page",
157
159
  fullscreen: "fullscreen",
158
160
  preview: "preview",
161
+ previewOnly: "preview only",
159
162
  htmlPreview: "html preview",
160
163
  catalog: "catalog",
161
164
  github: "source code"