vditor 3.8.5 → 3.8.9

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.
Files changed (60) hide show
  1. package/README.md +48 -45
  2. package/dist/index.css +2 -2
  3. package/dist/index.d.ts +4 -1
  4. package/dist/index.min.js +722 -858
  5. package/dist/js/i18n/en_US.js +85 -0
  6. package/dist/js/i18n/ja_JP.js +85 -0
  7. package/dist/js/i18n/ko_KR.js +85 -0
  8. package/dist/js/i18n/ru_RU.js +85 -0
  9. package/dist/js/i18n/zh_CN.js +85 -0
  10. package/dist/js/i18n/zh_TW.js +85 -0
  11. package/dist/js/lute/lute.min.js +31 -28
  12. package/dist/method.d.ts +4 -1
  13. package/dist/method.min.js +157 -543
  14. package/dist/ts/markdown/adapterRender.d.ts +33 -0
  15. package/dist/ts/markdown/codeRender.d.ts +1 -2
  16. package/dist/ts/ui/initUI.d.ts +1 -0
  17. package/dist/ts/wysiwyg/index.d.ts +2 -0
  18. package/dist/types/index.d.ts +773 -0
  19. package/package.json +4 -4
  20. package/src/assets/.DS_Store +0 -0
  21. package/src/assets/scss/_content.scss +4 -0
  22. package/src/assets/scss/_reset.scss +11 -0
  23. package/src/index.ts +156 -97
  24. package/src/method.ts +6 -2
  25. package/src/ts/.DS_Store +0 -0
  26. package/src/ts/export/index.ts +7 -5
  27. package/src/ts/hint/index.ts +20 -11
  28. package/src/ts/markdown/abcRender.ts +3 -2
  29. package/src/ts/markdown/adapterRender.ts +33 -0
  30. package/src/ts/markdown/chartRender.ts +3 -2
  31. package/src/ts/markdown/codeRender.ts +5 -6
  32. package/src/ts/markdown/flowchartRender.ts +3 -2
  33. package/src/ts/markdown/graphvizRender.ts +13 -11
  34. package/src/ts/markdown/mathRender.ts +5 -4
  35. package/src/ts/markdown/mermaidRender.ts +4 -2
  36. package/src/ts/markdown/mindmapRender.ts +3 -2
  37. package/src/ts/markdown/plantumlRender.ts +3 -2
  38. package/src/ts/markdown/previewRender.ts +26 -4
  39. package/src/ts/preview/image.ts +2 -4
  40. package/src/ts/preview/index.ts +2 -5
  41. package/src/ts/toolbar/EditMode.ts +3 -4
  42. package/src/ts/toolbar/Headings.ts +6 -6
  43. package/src/ts/toolbar/Info.ts +1 -1
  44. package/src/ts/toolbar/MenuItem.ts +1 -3
  45. package/src/ts/toolbar/Record.ts +3 -4
  46. package/src/ts/ui/initUI.ts +19 -5
  47. package/src/ts/upload/index.ts +11 -11
  48. package/src/ts/util/Options.ts +255 -196
  49. package/src/ts/util/editorCommonEvent.ts +2 -2
  50. package/src/ts/util/fixBrowserBehavior.ts +10 -6
  51. package/src/ts/util/processCode.ts +1 -1
  52. package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +298 -138
  53. package/src/ts/wysiwyg/index.ts +9 -4
  54. package/CHANGELOG.md +0 -1053
  55. package/dist/images/.DS_Store +0 -0
  56. package/dist/js/.DS_Store +0 -0
  57. package/dist/js/lute/.DS_Store +0 -0
  58. package/dist/js/mathjax/.DS_Store +0 -0
  59. package/dist/ts/i18n/index.d.ts +0 -2
  60. package/src/ts/i18n/index.ts +0 -476
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v3.8.5 - A markdown editor written in TypeScript.
2
+ * Vditor v3.8.9 - A markdown editor written in TypeScript.
3
3
  *
4
4
  * MIT License
5
5
  *
@@ -1797,12 +1797,8 @@ diff_match_patch.prototype.patch_make = function (a, opt_b, opt_c) {
1797
1797
  if (typeof a == 'string' && typeof opt_b == 'string' && typeof opt_c == 'undefined') {
1798
1798
  // Method 1: text1, text2
1799
1799
  // Compute diffs from text1 and text2.
1800
- text1 =
1801
- /** @type {string} */
1802
- a;
1803
- diffs = this.diff_main(text1,
1804
- /** @type {string} */
1805
- opt_b, true);
1800
+ text1 = a;
1801
+ diffs = this.diff_main(text1, opt_b, true);
1806
1802
 
1807
1803
  if (diffs.length > 2) {
1808
1804
  this.diff_cleanupSemantic(diffs);
@@ -1811,27 +1807,17 @@ diff_match_patch.prototype.patch_make = function (a, opt_b, opt_c) {
1811
1807
  } else if (a && typeof a == 'object' && typeof opt_b == 'undefined' && typeof opt_c == 'undefined') {
1812
1808
  // Method 2: diffs
1813
1809
  // Compute text1 from diffs.
1814
- diffs =
1815
- /** @type {!Array.<!diff_match_patch.Diff>} */
1816
- a;
1810
+ diffs = a;
1817
1811
  text1 = this.diff_text1(diffs);
1818
1812
  } else if (typeof a == 'string' && opt_b && typeof opt_b == 'object' && typeof opt_c == 'undefined') {
1819
1813
  // Method 3: text1, diffs
1820
- text1 =
1821
- /** @type {string} */
1822
- a;
1823
- diffs =
1824
- /** @type {!Array.<!diff_match_patch.Diff>} */
1825
- opt_b;
1814
+ text1 = a;
1815
+ diffs = opt_b;
1826
1816
  } else if (typeof a == 'string' && typeof opt_b == 'string' && opt_c && typeof opt_c == 'object') {
1827
1817
  // Method 4: text1, text2, diffs
1828
1818
  // text2 is not used.
1829
- text1 =
1830
- /** @type {string} */
1831
- a;
1832
- diffs =
1833
- /** @type {!Array.<!diff_match_patch.Diff>} */
1834
- opt_c;
1819
+ text1 = a;
1820
+ diffs = opt_c;
1835
1821
  } else {
1836
1822
  throw new Error('Unknown call format to patch_make.');
1837
1823
  }
@@ -2427,6 +2413,8 @@ __webpack_require__.d(__webpack_exports__, {
2427
2413
 
2428
2414
  // EXTERNAL MODULE: ./src/ts/markdown/abcRender.ts
2429
2415
  var abcRender = __webpack_require__(369);
2416
+ // EXTERNAL MODULE: ./src/ts/markdown/adapterRender.ts
2417
+ var adapterRender = __webpack_require__(46);
2430
2418
  // EXTERNAL MODULE: ./src/ts/markdown/chartRender.ts
2431
2419
  var chartRender = __webpack_require__(726);
2432
2420
  // EXTERNAL MODULE: ./src/ts/markdown/codeRender.ts
@@ -2734,7 +2722,7 @@ var md2html = function (mdText, options) {
2734
2722
  });
2735
2723
  };
2736
2724
  var previewRender = function (previewElement, markdown, options) { return __awaiter(void 0, void 0, void 0, function () {
2737
- var mergedOptions, html;
2725
+ var mergedOptions, html, i18nScriptPrefix, i18nScriptID_1;
2738
2726
  return __generator(this, function (_a) {
2739
2727
  switch (_a.label) {
2740
2728
  case 0:
@@ -2747,11 +2735,31 @@ var previewRender = function (previewElement, markdown, options) { return __awai
2747
2735
  }
2748
2736
  previewElement.innerHTML = html;
2749
2737
  previewElement.classList.add("vditor-reset");
2738
+ if (!!mergedOptions.i18n) return [3 /*break*/, 5];
2739
+ if (!!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) return [3 /*break*/, 2];
2740
+ throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
2741
+ case 2:
2742
+ i18nScriptPrefix = "vditorI18nScript";
2743
+ i18nScriptID_1 = i18nScriptPrefix + mergedOptions.lang;
2744
+ document.querySelectorAll("head script[id^=\"" + i18nScriptPrefix + "\"]").forEach(function (el) {
2745
+ if (el.id !== i18nScriptID_1) {
2746
+ document.head.removeChild(el);
2747
+ }
2748
+ });
2749
+ return [4 /*yield*/, (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/i18n/" + mergedOptions.lang + ".js", i18nScriptID_1)];
2750
+ case 3:
2751
+ _a.sent();
2752
+ _a.label = 4;
2753
+ case 4: return [3 /*break*/, 6];
2754
+ case 5:
2755
+ window.VditorI18n = mergedOptions.i18n;
2756
+ _a.label = 6;
2757
+ case 6:
2750
2758
  (0,setContentTheme/* setContentTheme */.Z)(mergedOptions.theme.current, mergedOptions.theme.path);
2751
2759
  if (mergedOptions.anchor === 1) {
2752
2760
  previewElement.classList.add("vditor-reset--anchor");
2753
2761
  }
2754
- (0,codeRender/* codeRender */.O)(previewElement, mergedOptions.lang);
2762
+ (0,codeRender/* codeRender */.O)(previewElement);
2755
2763
  (0,highlightRender/* highlightRender */.s)(mergedOptions.hljs, previewElement, mergedOptions.cdn);
2756
2764
  (0,mathRender/* mathRender */.H)(previewElement, {
2757
2765
  cdn: mergedOptions.cdn,
@@ -2766,7 +2774,7 @@ var previewRender = function (previewElement, markdown, options) { return __awai
2766
2774
  (0,abcRender/* abcRender */.Q)(previewElement, mergedOptions.cdn);
2767
2775
  (0,mediaRender/* mediaRender */.Y)(previewElement);
2768
2776
  if (mergedOptions.speech.enable) {
2769
- speechRender(previewElement, mergedOptions.lang);
2777
+ speechRender(previewElement);
2770
2778
  }
2771
2779
  if (mergedOptions.anchor !== 0) {
2772
2780
  anchorRender(mergedOptions.anchor);
@@ -2818,10 +2826,13 @@ var setCodeTheme = __webpack_require__(968);
2818
2826
 
2819
2827
 
2820
2828
 
2829
+
2821
2830
  var Vditor = /** @class */ (function () {
2822
2831
  function Vditor() {
2823
2832
  }
2824
2833
  /** 点击图片放大 */
2834
+ Vditor.adapterRender = adapterRender;
2835
+ /** 点击图片放大 */
2825
2836
  Vditor.previewImage = preview_image/* previewImage */.E;
2826
2837
  /** 为 element 中的代码块添加复制按钮 */
2827
2838
  Vditor.codeRender = codeRender/* codeRender */.O;
@@ -2874,7 +2885,7 @@ var Vditor = /** @class */ (function () {
2874
2885
  /* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
2875
2886
  /* harmony export */ "g": () => (/* binding */ Constants)
2876
2887
  /* harmony export */ });
2877
- var _VDITOR_VERSION = "3.8.5";
2888
+ var _VDITOR_VERSION = "3.8.9";
2878
2889
 
2879
2890
  var Constants = /** @class */ (function () {
2880
2891
  function Constants() {
@@ -2900,7 +2911,7 @@ var Constants = /** @class */ (function () {
2900
2911
  "swift", "ini", "typescript", "vbnet", "yaml",
2901
2912
  "ada", "clojure", "dart", "erb", "fortran", "gradle", "haskell", "julia", "julia-repl", "lisp", "matlab",
2902
2913
  "pgsql", "powershell", "sql_more", "stata", "cmake", "mathematica"];
2903
- Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.5";
2914
+ Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.9";
2904
2915
  Constants.MARKDOWN_OPTIONS = {
2905
2916
  autoSpace: false,
2906
2917
  codeBlockPreview: true,
@@ -2940,493 +2951,6 @@ var Constants = /** @class */ (function () {
2940
2951
 
2941
2952
 
2942
2953
 
2943
- /***/ }),
2944
-
2945
- /***/ 577:
2946
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2947
-
2948
- "use strict";
2949
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2950
- /* harmony export */ "a": () => (/* binding */ i18n)
2951
- /* harmony export */ });
2952
- var i18n = {
2953
- en_US: {
2954
- "alignCenter": "Center",
2955
- "alignLeft": "Left",
2956
- "alignRight": "Right",
2957
- "alternateText": "Alternate text",
2958
- "bold": "Blod",
2959
- "both": "editor & preview",
2960
- "check": "Task List",
2961
- "close": "Close",
2962
- "code": "Code Block",
2963
- "code-theme": "Code Block Theme Preview",
2964
- "column": "Column",
2965
- "comment": "Comment",
2966
- "confirm": "Confirm",
2967
- "content-theme": "Content Theme Preview",
2968
- "copied": "Copied",
2969
- "copy": "Copy",
2970
- "delete-column": "Delete Row",
2971
- "delete-row": "Delete Column",
2972
- "devtools": "DevTools",
2973
- "down": "Down",
2974
- "downloadTip": "The browser does not support the download function",
2975
- "edit": "Edit",
2976
- "edit-mode": "Toggle Edit Mode",
2977
- "emoji": "Emoji",
2978
- "export": "Export",
2979
- "fileTypeError": "file type is error",
2980
- "footnoteRef": "Footnote Ref",
2981
- "fullscreen": "Toggle Fullscreen",
2982
- "generate": "Generating",
2983
- "headings": "Headings",
2984
- "help": "Help",
2985
- "imageURL": "image URL",
2986
- "indent": "Indent",
2987
- "info": "Info",
2988
- "inline-code": "Inline Code",
2989
- "insert-after": "Insert line after",
2990
- "insert-before": "Insert line Before",
2991
- "insertColumnLeft": "Insert 1 left",
2992
- "insertColumnRight": "Insert 1 right",
2993
- "insertRowAbove": "Insert 1 above",
2994
- "insertRowBelow": "Insert 1 below",
2995
- "instantRendering": "Instant Rendering",
2996
- "italic": "Italic",
2997
- "language": "Language",
2998
- "line": "Line",
2999
- "link": "Link",
3000
- "linkRef": "Link Ref",
3001
- "list": "List",
3002
- "more": "More",
3003
- "nameEmpty": "Name is empty",
3004
- "ordered-list": "Order List",
3005
- "outdent": "Outdent",
3006
- "outline": "Outline",
3007
- "over": "over",
3008
- "performanceTip": "Real-time preview requires ${x}ms, you can close it",
3009
- "preview": "Preview",
3010
- "quote": "Quote",
3011
- "record": "Start Record/End Record",
3012
- "record-tip": "The device does not support recording",
3013
- "recording": "recording...",
3014
- "redo": "Redo",
3015
- "remove": "Remove",
3016
- "row": "Row",
3017
- "spin": "Spin",
3018
- "splitView": "Split View",
3019
- "strike": "Strike",
3020
- "table": "Table",
3021
- "textIsNotEmpty": "text(no empty)",
3022
- "title": "Title",
3023
- "tooltipText": "Tooltip text",
3024
- "undo": "Undo",
3025
- "up": "Up",
3026
- "update": "Update",
3027
- "upload": "Upload image or file",
3028
- "uploadError": "upload error",
3029
- "uploading": "uploading...",
3030
- "wysiwyg": "WYSIWYG",
3031
- },
3032
- ja_JP: {
3033
- "alignCenter": "中央",
3034
- "alignLeft": "左側",
3035
- "alignRight": "右側",
3036
- "alternateText": "イメージタグ",
3037
- "bold": "太く",
3038
- "both": "エディター & プレビュー",
3039
- "check": "チェックリスト",
3040
- "close": "閉じる",
3041
- "code": "コードブロック挿入",
3042
- "code-theme": "コードブロックテーマ",
3043
- "column": "行列",
3044
- "comment": "コメント",
3045
- "confirm": "確認",
3046
- "content-theme": "コンテンツテーマ",
3047
- "copied": "コピー完了",
3048
- "copy": "コピー",
3049
- "delete-column": "列 消去",
3050
- "delete-row": "行 消去",
3051
- "devtools": "開発ツール",
3052
- "down": "ダウンロード",
3053
- "downloadTip": "ブラウザがダウンロード機能をサポートしていません。",
3054
- "edit": "修正",
3055
- "edit-mode": "編集モード",
3056
- "emoji": "絵文字",
3057
- "export": "書き出し",
3058
- "fileTypeError": "サポートしていません。",
3059
- "footnoteRef": "脚注参照",
3060
- "fullscreen": "全体画面",
3061
- "generate": "作成する",
3062
- "headings": "タイトル大きさ",
3063
- "help": "ヘルプ",
3064
- "imageURL": "イメージ URL",
3065
- "indent": "字下げ",
3066
- "info": "情報",
3067
- "inline-code": "インラインコード",
3068
- "insert-after": "ブロックの後ろに入力",
3069
- "insert-before": "ブロックの前に入力",
3070
- "insertColumnLeft": "左側に列を挿入",
3071
- "insertColumnRight": "右側に列を挿入",
3072
- "insertRowAbove": "上に行を挿入",
3073
- "insertRowBelow": "下に行を挿入",
3074
- "instantRendering": "インスタントレンダリング",
3075
- "italic": "斜体",
3076
- "language": "言語",
3077
- "line": "段落分割",
3078
- "link": "リンク",
3079
- "linkRef": "リンク参照",
3080
- "list": "リスト",
3081
- "more": "詳しく見る",
3082
- "nameEmpty": "名前が入力されていません。",
3083
- "ordered-list": "順序のあるリスト",
3084
- "outdent": "ぶら下げインデント",
3085
- "outline": "概要",
3086
- "over": "オーバー",
3087
- "performanceTip": "リアルタイムプレビューには、${x}msが必要でエディター/プレビューボタンをクリックして閉じる事が出来ます。",
3088
- "preview": "プレビュー",
3089
- "quote": "引用段落",
3090
- "record": "録音開始/録音終了",
3091
- "record-tip": "録音がサポートされていません。",
3092
- "recording": "録音中...",
3093
- "redo": "戻る",
3094
- "remove": "消去",
3095
- "row": "列",
3096
- "spin": "スピン",
3097
- "splitView": "マークダウン",
3098
- "strike": "取り消し線",
3099
- "table": "表 挿入",
3100
- "textIsNotEmpty": "テキスト(no empty)",
3101
- "title": "題名",
3102
- "tooltipText": "ツールチップ",
3103
- "undo": "取り消す",
3104
- "up": "戻る",
3105
- "update": "アップデート",
3106
- "upload": "イメージをダウンロードする",
3107
- "uploadError": "アップロード失敗",
3108
- "uploading": "アップロード中",
3109
- "wysiwyg": "ウィジウィグ",
3110
- },
3111
- ko_KR: {
3112
- "alignCenter": "가운데",
3113
- "alignLeft": "왼쪽",
3114
- "alignRight": "오른쪽",
3115
- "alternateText": "이미지 태그",
3116
- "bold": "굵게",
3117
- "both": "에디터 & 미리보기",
3118
- "check": "체크박스",
3119
- "close": "닫기",
3120
- "code": "코드블럭삽입",
3121
- "code-theme": "코드블럭테마",
3122
- "column": "행",
3123
- "comment": "코멘트",
3124
- "confirm": "확인",
3125
- "content-theme": "컨텐츠테마",
3126
- "copied": "복사완료",
3127
- "copy": "복사",
3128
- "delete-column": "열 삭제",
3129
- "delete-row": "행 삭제",
3130
- "devtools": "개발툴",
3131
- "down": "다운",
3132
- "downloadTip": "브라우저가 다운로드 기능을 지원하지 않습니다",
3133
- "edit": "수정",
3134
- "edit-mode": "편집모드",
3135
- "emoji": "이모지",
3136
- "export": "내보내기",
3137
- "fileTypeError": "지원하지않습니다.",
3138
- "footnoteRef": "각주참조",
3139
- "fullscreen": "전체화면",
3140
- "generate": "생성",
3141
- "headings": "제목크기",
3142
- "help": "도움말",
3143
- "imageURL": "이미지 URL",
3144
- "indent": "들여쓰기",
3145
- "info": "정보",
3146
- "inline-code": "인라인코드",
3147
- "insert-after": "블락 뒤로 입력",
3148
- "insert-before": "블락 앞으로 입력",
3149
- "insertColumnLeft": "왼쪽에 열 삽입",
3150
- "insertColumnRight": "오른쪽에 열 삽입",
3151
- "insertRowAbove": "위에 행 삽입",
3152
- "insertRowBelow": "아래에 행 삽입",
3153
- "instantRendering": "타이포라",
3154
- "italic": "기울임꼴",
3155
- "language": "언어",
3156
- "line": "문단나눔",
3157
- "link": "링크",
3158
- "linkRef": "링크 참조",
3159
- "list": "순서없는 목록",
3160
- "more": "더보기",
3161
- "nameEmpty": "이름이 비어있습니다.",
3162
- "ordered-list": "순서있는 목록",
3163
- "outdent": "내어쓰기",
3164
- "outline": "개요",
3165
- "over": "오버",
3166
- "performanceTip": "실시간 미리보기에는 ${x}ms가 필요하며 에디터/미리보기 버튼을 클릭하여 닫을 수 있습니다.",
3167
- "preview": "미리보기",
3168
- "quote": "인용단락",
3169
- "record": "녹음시작/녹음종료",
3170
- "record-tip": "녹음을 지원하지 않습니다.",
3171
- "recording": "녹음중...",
3172
- "redo": "되돌리기",
3173
- "remove": "삭제",
3174
- "row": "열",
3175
- "spin": "회전",
3176
- "splitView": "마크다운",
3177
- "strike": "취소선",
3178
- "table": "표삽입",
3179
- "textIsNotEmpty": "텍스트(no empty)",
3180
- "title": "표제",
3181
- "tooltipText": "툴팁",
3182
- "undo": "취소하기",
3183
- "up": "위로",
3184
- "update": "업데이트",
3185
- "upload": "이미지 업로드하기",
3186
- "uploadError": "업로드 실패",
3187
- "uploading": "업로드중...",
3188
- "wysiwyg": "위지위그",
3189
- },
3190
- ru_RU: {
3191
- "alignCenter": "Выровнять по центру",
3192
- "alignLeft": "Выровнять по левому краю",
3193
- "alignRight": "Выровнять по правому краю",
3194
- "alternateText": "Альтернативный текст",
3195
- "bold": "Полужирный текст",
3196
- "both": "Редактор с предпросмотром",
3197
- "check": "Список задач",
3198
- "close": "Закрыть",
3199
- "code": "Блок кода",
3200
- "code-theme": "Тема отображения блока кода",
3201
- "column": "Количество столбцов",
3202
- "comment": "Комментарий",
3203
- "confirm": "Подтвердить",
3204
- "content-theme": "Тема отображения контента",
3205
- "copied": "Скопировано",
3206
- "copy": "Копировать",
3207
- "delete-column": "Удалить столбец",
3208
- "delete-row": "Удалить строку",
3209
- "devtools": "Граф документа",
3210
- "down": "Переместить вниз",
3211
- "downloadTip": "Браузер не поддерживает функции загрузки",
3212
- "edit": "Редактирование",
3213
- "edit-mode": "Переключить режим редактирования",
3214
- "emoji": "Смайлы",
3215
- "export": "Экспорт",
3216
- "fileTypeError": "Ошибка типа файла",
3217
- "footnoteRef": "Сноска",
3218
- "fullscreen": "Переключиться на полный экран",
3219
- "generate": "Генерация",
3220
- "headings": "Заголовки",
3221
- "help": "Помощь",
3222
- "imageURL": "Ссылка на картинку",
3223
- "indent": "Отступ",
3224
- "info": "Информация о редакторе",
3225
- "inline-code": "Встроенный код ",
3226
- "insert-after": "Вставить линию после этой строки",
3227
- "insert-before": "Вставить линию перед этой строкой",
3228
- "insertColumnLeft": "Вставить столбец слева",
3229
- "insertColumnRight": "Вставить столбец справа",
3230
- "insertRowAbove": "Вставить строку сверху",
3231
- "insertRowBelow": "Вставить строку снизу",
3232
- "instantRendering": "Мгновенный рендеринг",
3233
- "italic": "Курсив",
3234
- "language": "Синтаксис",
3235
- "line": "Линия",
3236
- "link": "Ссылка",
3237
- "linkRef": "Вставить ссылку",
3238
- "list": "Список",
3239
- "more": "Дополнительно",
3240
- "nameEmpty": "Имя пустое",
3241
- "ordered-list": "Упорядоченный список",
3242
- "outdent": "Выступ",
3243
- "outline": "Содержание",
3244
- "over": "Над",
3245
- "performanceTip": "Предварительный просмотр в реальном времени требует ${x}мс, вы можете закрыть его",
3246
- "preview": "Предпросмотр",
3247
- "quote": "Цитата",
3248
- "record": "Начать запись/Завершить запись",
3249
- "record-tip": "Устройство не поддерживает запись",
3250
- "recording": "Запись...",
3251
- "redo": "Вернуть",
3252
- "remove": "Удалить",
3253
- "row": "Количество строк",
3254
- "spin": "Прокрутка",
3255
- "splitView": "Разделенный просмотр",
3256
- "strike": "Зачеркнутый текст",
3257
- "table": "Таблица",
3258
- "textIsNotEmpty": "Текст (непустой)",
3259
- "title": "Заголовок",
3260
- "tooltipText": "Текст всплывающей подсказки",
3261
- "undo": "Отменить",
3262
- "up": "Переместить вверх",
3263
- "update": "Обновить",
3264
- "upload": "Загрузить изображение или файл",
3265
- "uploadError": "Ошибка загрузки",
3266
- "uploading": "Загрузка...",
3267
- "wysiwyg": "Редактор WYSIWYG",
3268
- },
3269
- zh_CN: {
3270
- "alignCenter": "居中",
3271
- "alignLeft": "居左",
3272
- "alignRight": "居右",
3273
- "alternateText": "替代文本",
3274
- "bold": "粗体",
3275
- "both": "编辑 & 预览",
3276
- "check": "任务列表",
3277
- "close": "关闭",
3278
- "code": "代码块",
3279
- "code-theme": "代码块主题预览",
3280
- "column": "列",
3281
- "comment": "评论",
3282
- "confirm": "确定",
3283
- "content-theme": "内容主题预览",
3284
- "copied": "已复制",
3285
- "copy": "复制",
3286
- "delete-column": "删除列",
3287
- "delete-row": "删除行",
3288
- "devtools": "开发者工具",
3289
- "down": "下",
3290
- "downloadTip": "该浏览器不支持下载功能",
3291
- "edit": "编辑",
3292
- "edit-mode": "切换编辑模式",
3293
- "emoji": "表情",
3294
- "export": "导出",
3295
- "fileTypeError": "文件类型不允许上传",
3296
- "footnoteRef": "脚注标识",
3297
- "fullscreen": "全屏切换",
3298
- "generate": "生成中",
3299
- "headings": "标题",
3300
- "help": "帮助",
3301
- "imageURL": "图片地址",
3302
- "indent": "列表缩进",
3303
- "info": "关于",
3304
- "inline-code": "行内代码",
3305
- "insert-after": "末尾插入行",
3306
- "insert-before": "起始插入行",
3307
- "insertColumnLeft": "在左边插入一列",
3308
- "insertColumnRight": "在右边插入一列",
3309
- "insertRowAbove": "在上方插入一行",
3310
- "insertRowBelow": "在下方插入一行",
3311
- "instantRendering": "即时渲染",
3312
- "italic": "斜体",
3313
- "language": "语言",
3314
- "line": "分隔线",
3315
- "link": "链接",
3316
- "linkRef": "引用标识",
3317
- "list": "无序列表",
3318
- "more": "更多",
3319
- "nameEmpty": "文件名不能为空",
3320
- "ordered-list": "有序列表",
3321
- "outdent": "列表反向缩进",
3322
- "outline": "大纲",
3323
- "over": "超过",
3324
- "performanceTip": "实时预览需 ${x}ms,可点击编辑 & 预览按钮进行关闭",
3325
- "preview": "预览",
3326
- "quote": "引用",
3327
- "record": "开始录音/结束录音",
3328
- "record-tip": "该设备不支持录音功能",
3329
- "recording": "录音中...",
3330
- "redo": "重做",
3331
- "remove": "删除",
3332
- "row": "行",
3333
- "spin": "旋转",
3334
- "splitView": "分屏预览",
3335
- "strike": "删除线",
3336
- "table": "表格",
3337
- "textIsNotEmpty": "文本(不能为空)",
3338
- "title": "标题",
3339
- "tooltipText": "提示文本",
3340
- "undo": "撤销",
3341
- "up": "上",
3342
- "update": "更新",
3343
- "upload": "上传图片或文件",
3344
- "uploadError": "上传错误",
3345
- "uploading": "上传中...",
3346
- "wysiwyg": "所见即所得",
3347
- },
3348
- zh_TW: {
3349
- "alignCenter": "置中",
3350
- "alignLeft": "置左",
3351
- "alignRight": "置右",
3352
- "alternateText": "替代文字",
3353
- "bold": "粗體",
3354
- "both": "編輯 & 預覽",
3355
- "check": "任務列表",
3356
- "close": "關閉",
3357
- "code": "代碼塊",
3358
- "code-theme": "代碼塊主題預覽",
3359
- "column": "欄",
3360
- "comment": "評論",
3361
- "confirm": "確定",
3362
- "content-theme": "內容主題預覽",
3363
- "copied": "已複製",
3364
- "copy": "複製",
3365
- "delete-column": "刪除欄",
3366
- "delete-row": "刪除列",
3367
- "devtools": "開發者工具",
3368
- "down": "下",
3369
- "downloadTip": "該瀏覽器不支持下載功能",
3370
- "edit": "編輯",
3371
- "edit-mode": "切換編輯模式",
3372
- "emoji": "表情",
3373
- "export": "匯出",
3374
- "fileTypeError": "檔案類型不允許上傳",
3375
- "footnoteRef": "腳註參考",
3376
- "fullscreen": "全螢幕切換",
3377
- "generate": "生成中",
3378
- "headings": "標題",
3379
- "help": "幫助",
3380
- "imageURL": "圖片位址",
3381
- "indent": "列表縮排",
3382
- "info": "關於",
3383
- "inline-code": "行內代碼",
3384
- "insert-after": "末尾插入列",
3385
- "insert-before": "起始插入列",
3386
- "insertColumnLeft": "在左邊插入一欄",
3387
- "insertColumnRight": "在右邊插入一欄",
3388
- "insertRowAbove": "在上方插入一行",
3389
- "insertRowBelow": "在下方插入一行",
3390
- "instantRendering": "即時渲染",
3391
- "italic": "斜體",
3392
- "language": "語言",
3393
- "line": "分隔線",
3394
- "link": "連結",
3395
- "linkRef": "連結參考",
3396
- "list": "無序列表",
3397
- "more": "更多",
3398
- "nameEmpty": "文件名不能為空",
3399
- "ordered-list": "有序列表",
3400
- "outdent": "列表反向縮排",
3401
- "outline": "大綱",
3402
- "over": "超過",
3403
- "performanceTip": "即時預覽需 ${x}ms,可點擊編輯 & 預覽按鈕進行關閉",
3404
- "preview": "預覽",
3405
- "quote": "引用",
3406
- "record": "開始錄音/結束錄音",
3407
- "record-tip": "該設備不支持錄音功能",
3408
- "recording": "錄音中...",
3409
- "redo": "重做",
3410
- "remove": "刪除",
3411
- "row": "列",
3412
- "spin": "旋轉",
3413
- "splitView": "分割預覽",
3414
- "strike": "刪除縣",
3415
- "table": "表格",
3416
- "textIsNotEmpty": "文字(不能為空)",
3417
- "title": "標題",
3418
- "tooltipText": "提示文字",
3419
- "undo": "撤銷",
3420
- "up": "上",
3421
- "update": "更新",
3422
- "upload": "上傳圖片或文件",
3423
- "uploadError": "上傳錯誤",
3424
- "uploading": "上傳中...",
3425
- "wysiwyg": "所見即所得",
3426
- }
3427
- };
3428
-
3429
-
3430
2954
  /***/ }),
3431
2955
 
3432
2956
  /***/ 369:
@@ -3437,15 +2961,17 @@ var i18n = {
3437
2961
  /* harmony export */ "Q": () => (/* binding */ abcRender)
3438
2962
  /* harmony export */ });
3439
2963
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
3440
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
2964
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
2965
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
2966
+
3441
2967
 
3442
2968
 
3443
2969
  var abcRender = function (element, cdn) {
3444
2970
  if (element === void 0) { element = document; }
3445
2971
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
3446
- var abcElements = element.querySelectorAll(".language-abc");
2972
+ var abcElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.abcRenderAdapter.getElements(element);
3447
2973
  if (abcElements.length > 0) {
3448
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/abcjs/abcjs_basic.min.js", "vditorAbcjsScript").then(function () {
2974
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/abcjs/abcjs_basic.min.js", "vditorAbcjsScript").then(function () {
3449
2975
  abcElements.forEach(function (item) {
3450
2976
  if (item.parentElement.classList.contains("vditor-wysiwyg__pre") ||
3451
2977
  item.parentElement.classList.contains("vditor-ir__marker--pre")) {
@@ -3454,7 +2980,7 @@ var abcRender = function (element, cdn) {
3454
2980
  if (item.getAttribute("data-processed") === "true") {
3455
2981
  return;
3456
2982
  }
3457
- ABCJS.renderAbc(item, item.textContent.trim());
2983
+ ABCJS.renderAbc(item, _adapterRender__WEBPACK_IMPORTED_MODULE_1__.abcRenderAdapter.getCode(item).trim());
3458
2984
  item.style.overflowX = "auto";
3459
2985
  item.setAttribute("data-processed", "true");
3460
2986
  });
@@ -3463,6 +2989,58 @@ var abcRender = function (element, cdn) {
3463
2989
  };
3464
2990
 
3465
2991
 
2992
+ /***/ }),
2993
+
2994
+ /***/ 46:
2995
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
2996
+
2997
+ "use strict";
2998
+ __webpack_require__.r(__webpack_exports__);
2999
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3000
+ /* harmony export */ "mathRenderAdapter": () => (/* binding */ mathRenderAdapter),
3001
+ /* harmony export */ "mermaidRenderAdapter": () => (/* binding */ mermaidRenderAdapter),
3002
+ /* harmony export */ "mindmapRenderAdapter": () => (/* binding */ mindmapRenderAdapter),
3003
+ /* harmony export */ "chartRenderAdapter": () => (/* binding */ chartRenderAdapter),
3004
+ /* harmony export */ "abcRenderAdapter": () => (/* binding */ abcRenderAdapter),
3005
+ /* harmony export */ "graphvizRenderAdapter": () => (/* binding */ graphvizRenderAdapter),
3006
+ /* harmony export */ "flowchartRenderAdapter": () => (/* binding */ flowchartRenderAdapter),
3007
+ /* harmony export */ "plantumlRenderAdapter": () => (/* binding */ plantumlRenderAdapter)
3008
+ /* harmony export */ });
3009
+ var mathRenderAdapter = {
3010
+ getCode: function (mathElement) { return mathElement.textContent; },
3011
+ getElements: function (element) { return element.querySelectorAll(".language-math"); },
3012
+ };
3013
+ var mermaidRenderAdapter = {
3014
+ /** 不仅要返回code,并且需要将 code 设置为 el 的 innerHTML */
3015
+ getCode: function (el) { return el.textContent; },
3016
+ getElements: function (element) { return element.querySelectorAll(".language-mermaid"); },
3017
+ };
3018
+ var mindmapRenderAdapter = {
3019
+ getCode: function (el) { return el.getAttribute("data-code"); },
3020
+ getElements: function (el) { return el.querySelectorAll(".language-mindmap"); },
3021
+ };
3022
+ var chartRenderAdapter = {
3023
+ getCode: function (el) { return el.innerText; },
3024
+ getElements: function (el) { return el.querySelectorAll(".language-echarts"); },
3025
+ };
3026
+ var abcRenderAdapter = {
3027
+ getCode: function (el) { return el.textContent; },
3028
+ getElements: function (el) { return el.querySelectorAll(".language-abc"); },
3029
+ };
3030
+ var graphvizRenderAdapter = {
3031
+ getCode: function (el) { return el.textContent; },
3032
+ getElements: function (el) { return el.querySelectorAll(".language-graphviz"); },
3033
+ };
3034
+ var flowchartRenderAdapter = {
3035
+ getCode: function (el) { return el.textContent; },
3036
+ getElements: function (el) { return el.querySelectorAll(".language-flowchart"); },
3037
+ };
3038
+ var plantumlRenderAdapter = {
3039
+ getCode: function (el) { return el.textContent; },
3040
+ getElements: function (el) { return el.querySelectorAll(".language-plantuml"); },
3041
+ };
3042
+
3043
+
3466
3044
  /***/ }),
3467
3045
 
3468
3046
  /***/ 726:
@@ -3473,21 +3051,23 @@ var abcRender = function (element, cdn) {
3473
3051
  /* harmony export */ "p": () => (/* binding */ chartRender)
3474
3052
  /* harmony export */ });
3475
3053
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
3476
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
3054
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3055
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3056
+
3477
3057
 
3478
3058
 
3479
3059
  var chartRender = function (element, cdn, theme) {
3480
3060
  if (element === void 0) { element = document; }
3481
3061
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
3482
- var echartsElements = element.querySelectorAll(".language-echarts");
3062
+ var echartsElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.chartRenderAdapter.getElements(element);
3483
3063
  if (echartsElements.length > 0) {
3484
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/echarts/echarts.min.js", "vditorEchartsScript").then(function () {
3064
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/echarts/echarts.min.js", "vditorEchartsScript").then(function () {
3485
3065
  echartsElements.forEach(function (e) {
3486
3066
  if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
3487
3067
  e.parentElement.classList.contains("vditor-ir__marker--pre")) {
3488
3068
  return;
3489
3069
  }
3490
- var text = e.innerText.trim();
3070
+ var text = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.chartRenderAdapter.getCode(e).trim();
3491
3071
  if (!text) {
3492
3072
  return;
3493
3073
  }
@@ -3518,12 +3098,9 @@ var chartRender = function (element, cdn, theme) {
3518
3098
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3519
3099
  /* harmony export */ "O": () => (/* binding */ codeRender)
3520
3100
  /* harmony export */ });
3521
- /* harmony import */ var _i18n_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(577);
3522
- /* harmony import */ var _util_code160to32__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(769);
3101
+ /* harmony import */ var _util_code160to32__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(769);
3523
3102
 
3524
-
3525
- var codeRender = function (element, lang) {
3526
- if (lang === void 0) { lang = "zh_CN"; }
3103
+ var codeRender = function (element) {
3527
3104
  element.querySelectorAll("pre > code").forEach(function (e, index) {
3528
3105
  if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
3529
3106
  e.parentElement.classList.contains("vditor-ir__marker--pre")) {
@@ -3554,10 +3131,10 @@ var codeRender = function (element, lang) {
3554
3131
  }
3555
3132
  var divElement = document.createElement("div");
3556
3133
  divElement.className = "vditor-copy";
3557
- divElement.innerHTML = "<span aria-label=\"" + _i18n_index__WEBPACK_IMPORTED_MODULE_0__/* .i18n */ .a[lang].copy + "\"\nonmouseover=\"this.setAttribute('aria-label', '" + _i18n_index__WEBPACK_IMPORTED_MODULE_0__/* .i18n */ .a[lang].copy + "')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');" +
3558
- ("this.setAttribute('aria-label', '" + _i18n_index__WEBPACK_IMPORTED_MODULE_0__/* .i18n */ .a[lang].copied + "')\"><svg><use xlink:href=\"#vditor-icon-copy\"></use></svg></span>");
3134
+ divElement.innerHTML = "<span aria-label=\"" + window.VditorI18n.copy + "\"\nonmouseover=\"this.setAttribute('aria-label', '" + window.VditorI18n.copy + "')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');" +
3135
+ ("this.setAttribute('aria-label', '" + window.VditorI18n.copied + "')\"><svg><use xlink:href=\"#vditor-icon-copy\"></use></svg></span>");
3559
3136
  var textarea = document.createElement("textarea");
3560
- textarea.value = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_1__/* .code160to32 */ .X)(codeText);
3137
+ textarea.value = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_0__/* .code160to32 */ .X)(codeText);
3561
3138
  divElement.insertAdjacentElement("afterbegin", textarea);
3562
3139
  e.before(divElement);
3563
3140
  e.style.maxHeight = (window.outerHeight - 40) + "px";
@@ -3575,21 +3152,23 @@ var codeRender = function (element, lang) {
3575
3152
  /* harmony export */ "P": () => (/* binding */ flowchartRender)
3576
3153
  /* harmony export */ });
3577
3154
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
3578
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
3155
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3156
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3157
+
3579
3158
 
3580
3159
 
3581
3160
  var flowchartRender = function (element, cdn) {
3582
3161
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
3583
- var flowchartElements = element.querySelectorAll(".language-flowchart");
3162
+ var flowchartElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.flowchartRenderAdapter.getElements(element);
3584
3163
  if (flowchartElements.length === 0) {
3585
3164
  return;
3586
3165
  }
3587
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/flowchart.js/flowchart.min.js", "vditorFlowchartScript").then(function () {
3166
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/flowchart.js/flowchart.min.js", "vditorFlowchartScript").then(function () {
3588
3167
  flowchartElements.forEach(function (item) {
3589
3168
  if (item.getAttribute("data-processed") === "true") {
3590
3169
  return;
3591
3170
  }
3592
- var flowchartObj = flowchart.parse(item.textContent);
3171
+ var flowchartObj = flowchart.parse(_adapterRender__WEBPACK_IMPORTED_MODULE_1__.flowchartRenderAdapter.getCode(item));
3593
3172
  item.innerHTML = "";
3594
3173
  flowchartObj.drawSVG(item);
3595
3174
  item.setAttribute("data-processed", "true");
@@ -3608,22 +3187,25 @@ var flowchartRender = function (element, cdn) {
3608
3187
  /* harmony export */ "v": () => (/* binding */ graphvizRender)
3609
3188
  /* harmony export */ });
3610
3189
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
3611
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
3190
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3191
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3192
+
3612
3193
 
3613
3194
 
3614
3195
  var graphvizRender = function (element, cdn) {
3615
3196
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
3616
- var graphvizElements = element.querySelectorAll(".language-graphviz");
3197
+ var graphvizElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.graphvizRenderAdapter.getElements(element);
3617
3198
  if (graphvizElements.length === 0) {
3618
3199
  return;
3619
3200
  }
3620
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/graphviz/viz.js", "vditorGraphVizScript").then(function () {
3201
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/graphviz/viz.js", "vditorGraphVizScript").then(function () {
3621
3202
  graphvizElements.forEach(function (e) {
3203
+ var code = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.graphvizRenderAdapter.getCode(e);
3622
3204
  if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
3623
3205
  e.parentElement.classList.contains("vditor-ir__marker--pre")) {
3624
3206
  return;
3625
3207
  }
3626
- if (e.getAttribute("data-processed") === "true" || e.textContent.trim() === "") {
3208
+ if (e.getAttribute("data-processed") === "true" || code.trim() === "") {
3627
3209
  return;
3628
3210
  }
3629
3211
  try {
@@ -3632,7 +3214,7 @@ var graphvizRender = function (element, cdn) {
3632
3214
  var blobUrl = url.createObjectURL(blob);
3633
3215
  var worker = new Worker(blobUrl);
3634
3216
  new Viz({ worker: worker })
3635
- .renderSVGElement(e.textContent).then(function (result) {
3217
+ .renderSVGElement(code).then(function (result) {
3636
3218
  e.innerHTML = result.outerHTML;
3637
3219
  }).catch(function (error) {
3638
3220
  e.innerHTML = "graphviz render error: <br>" + error;
@@ -3742,15 +3324,17 @@ var highlightRender = function (hljsOption, element, cdn) {
3742
3324
  /* harmony export */ "H": () => (/* binding */ mathRender)
3743
3325
  /* harmony export */ });
3744
3326
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
3745
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3746
- /* harmony import */ var _util_addStyle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(946);
3747
- /* harmony import */ var _util_code160to32__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(769);
3327
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(228);
3328
+ /* harmony import */ var _util_addStyle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(946);
3329
+ /* harmony import */ var _util_code160to32__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(769);
3330
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3331
+
3748
3332
 
3749
3333
 
3750
3334
 
3751
3335
 
3752
3336
  var mathRender = function (element, options) {
3753
- var mathElements = element.querySelectorAll(".language-math");
3337
+ var mathElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.mathRenderAdapter.getElements(element);
3754
3338
  if (mathElements.length === 0) {
3755
3339
  return;
3756
3340
  }
@@ -3768,8 +3352,8 @@ var mathRender = function (element, options) {
3768
3352
  }
3769
3353
  options = Object.assign({}, defaultOptions, options);
3770
3354
  if (options.math.engine === "KaTeX") {
3771
- (0,_util_addStyle__WEBPACK_IMPORTED_MODULE_1__/* .addStyle */ .c)(options.cdn + "/dist/js/katex/katex.min.css", "vditorKatexStyle");
3772
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(options.cdn + "/dist/js/katex/katex.min.js", "vditorKatexScript").then(function () {
3355
+ (0,_util_addStyle__WEBPACK_IMPORTED_MODULE_2__/* .addStyle */ .c)(options.cdn + "/dist/js/katex/katex.min.css", "vditorKatexStyle");
3356
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_3__/* .addScript */ .G)(options.cdn + "/dist/js/katex/katex.min.js", "vditorKatexScript").then(function () {
3773
3357
  mathElements.forEach(function (mathElement) {
3774
3358
  if (mathElement.parentElement.classList.contains("vditor-wysiwyg__pre") ||
3775
3359
  mathElement.parentElement.classList.contains("vditor-ir__marker--pre")) {
@@ -3778,7 +3362,7 @@ var mathRender = function (element, options) {
3778
3362
  if (mathElement.getAttribute("data-math")) {
3779
3363
  return;
3780
3364
  }
3781
- var math = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_3__/* .code160to32 */ .X)(mathElement.textContent);
3365
+ var math = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_4__/* .code160to32 */ .X)(_adapterRender__WEBPACK_IMPORTED_MODULE_1__.mathRenderAdapter.getCode(mathElement));
3782
3366
  mathElement.setAttribute("data-math", math);
3783
3367
  try {
3784
3368
  mathElement.innerHTML = katex.renderToString(math, {
@@ -3827,9 +3411,9 @@ var mathRender = function (element, options) {
3827
3411
  };
3828
3412
  }
3829
3413
  // 循环加载会抛异常
3830
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScriptSync */ .J)(options.cdn + "/dist/js/mathjax/tex-svg-full.js", "protyleMathJaxScript");
3414
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_3__/* .addScriptSync */ .J)(options.cdn + "/dist/js/mathjax/tex-svg-full.js", "protyleMathJaxScript");
3831
3415
  var renderMath_1 = function (mathElement, next) {
3832
- var math = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_3__/* .code160to32 */ .X)(mathElement.textContent).trim();
3416
+ var math = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_4__/* .code160to32 */ .X)(mathElement.textContent).trim();
3833
3417
  var mathOptions = window.MathJax.getMetricsFor(mathElement);
3834
3418
  mathOptions.display = mathElement.tagName === "DIV";
3835
3419
  window.MathJax.tex2svgPromise(math, mathOptions).then(function (node) {
@@ -3854,7 +3438,7 @@ var mathRender = function (element, options) {
3854
3438
  var mathElement = mathElements[i];
3855
3439
  if (!mathElement.parentElement.classList.contains("vditor-wysiwyg__pre") &&
3856
3440
  !mathElement.parentElement.classList.contains("vditor-ir__marker--pre") &&
3857
- !mathElement.getAttribute("data-math") && (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_3__/* .code160to32 */ .X)(mathElement.textContent).trim()) {
3441
+ !mathElement.getAttribute("data-math") && (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_4__/* .code160to32 */ .X)(mathElement.textContent).trim()) {
3858
3442
  chains.push(function (next) {
3859
3443
  if (i === mathElements.length - 1) {
3860
3444
  renderMath_1(mathElement);
@@ -3966,16 +3550,18 @@ var mediaRender = function (element) {
3966
3550
  /* harmony export */ "i": () => (/* binding */ mermaidRender)
3967
3551
  /* harmony export */ });
3968
3552
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
3969
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
3553
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3554
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3555
+
3970
3556
 
3971
3557
 
3972
3558
  var mermaidRender = function (element, cdn, theme) {
3973
3559
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
3974
- var mermaidElements = element.querySelectorAll(".language-mermaid");
3560
+ var mermaidElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.mermaidRenderAdapter.getElements(element);
3975
3561
  if (mermaidElements.length === 0) {
3976
3562
  return;
3977
3563
  }
3978
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/mermaid/mermaid.min.js", "vditorMermaidScript").then(function () {
3564
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/mermaid/mermaid.min.js", "vditorMermaidScript").then(function () {
3979
3565
  var config = {
3980
3566
  altFontFamily: "sans-serif",
3981
3567
  flowchart: {
@@ -4079,7 +3665,8 @@ var mermaidRender = function (element, cdn, theme) {
4079
3665
  }
4080
3666
  mermaid.initialize(config);
4081
3667
  mermaidElements.forEach(function (item) {
4082
- if (item.getAttribute("data-processed") === "true" || item.textContent.trim() === "") {
3668
+ var code = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.mermaidRenderAdapter.getCode(item);
3669
+ if (item.getAttribute("data-processed") === "true" || code.trim() === "") {
4083
3670
  return;
4084
3671
  }
4085
3672
  mermaid.init(undefined, item);
@@ -4099,21 +3686,23 @@ var mermaidRender = function (element, cdn, theme) {
4099
3686
  /* harmony export */ "P": () => (/* binding */ mindmapRender)
4100
3687
  /* harmony export */ });
4101
3688
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
4102
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
3689
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3690
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3691
+
4103
3692
 
4104
3693
 
4105
3694
  var mindmapRender = function (element, cdn, theme) {
4106
3695
  if (element === void 0) { element = document; }
4107
3696
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
4108
- var mindmapElements = element.querySelectorAll(".language-mindmap");
3697
+ var mindmapElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.mindmapRenderAdapter.getElements(element);
4109
3698
  if (mindmapElements.length > 0) {
4110
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/echarts/echarts.min.js", "vditorEchartsScript").then(function () {
3699
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/echarts/echarts.min.js", "vditorEchartsScript").then(function () {
4111
3700
  mindmapElements.forEach(function (e) {
4112
3701
  if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
4113
3702
  e.parentElement.classList.contains("vditor-ir__marker--pre")) {
4114
3703
  return;
4115
3704
  }
4116
- var text = e.getAttribute("data-code");
3705
+ var text = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.mindmapRenderAdapter.getCode(e);
4117
3706
  if (!text) {
4118
3707
  return;
4119
3708
  }
@@ -4312,23 +3901,25 @@ var outlineRender = function (contentElement, targetElement, vditor) {
4312
3901
  /* harmony export */ "B": () => (/* binding */ plantumlRender)
4313
3902
  /* harmony export */ });
4314
3903
  /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(260);
4315
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(228);
3904
+ /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(228);
3905
+ /* harmony import */ var _adapterRender__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(46);
3906
+
4316
3907
 
4317
3908
 
4318
3909
  var plantumlRender = function (element, cdn) {
4319
3910
  if (element === void 0) { element = document; }
4320
3911
  if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
4321
- var plantumlElements = element.querySelectorAll(".language-plantuml");
3912
+ var plantumlElements = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.plantumlRenderAdapter.getElements(element);
4322
3913
  if (plantumlElements.length === 0) {
4323
3914
  return;
4324
3915
  }
4325
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_1__/* .addScript */ .G)(cdn + "/dist/js/plantuml/plantuml-encoder.min.js", "vditorPlantumlScript").then(function () {
3916
+ (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)(cdn + "/dist/js/plantuml/plantuml-encoder.min.js", "vditorPlantumlScript").then(function () {
4326
3917
  plantumlElements.forEach(function (e) {
4327
3918
  if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
4328
3919
  e.parentElement.classList.contains("vditor-ir__marker--pre")) {
4329
3920
  return;
4330
3921
  }
4331
- var text = e.textContent.trim();
3922
+ var text = _adapterRender__WEBPACK_IMPORTED_MODULE_1__.plantumlRenderAdapter.getCode(e).trim();
4332
3923
  if (!text) {
4333
3924
  return;
4334
3925
  }
@@ -4387,14 +3978,12 @@ var setLute = function (options) {
4387
3978
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4388
3979
  /* harmony export */ "E": () => (/* binding */ previewImage)
4389
3980
  /* harmony export */ });
4390
- /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(577);
4391
-
4392
3981
  var previewImage = function (oldImgElement, lang, theme) {
4393
3982
  if (lang === void 0) { lang = "zh_CN"; }
4394
3983
  if (theme === void 0) { theme = "classic"; }
4395
3984
  var oldImgRect = oldImgElement.getBoundingClientRect();
4396
3985
  var height = 36;
4397
- document.body.insertAdjacentHTML("beforeend", "<div class=\"vditor vditor-img" + (theme === "dark" ? " vditor--dark" : "") + "\">\n <div class=\"vditor-img__bar\">\n <span class=\"vditor-img__btn\" data-deg=\"0\">\n <svg><use xlink:href=\"#vditor-icon-redo\"></use></svg>\n " + _i18n__WEBPACK_IMPORTED_MODULE_0__/* .i18n */ .a[lang].spin + "\n </span>\n <span class=\"vditor-img__btn\" onclick=\"this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n X &nbsp;" + _i18n__WEBPACK_IMPORTED_MODULE_0__/* .i18n */ .a[lang].close + "\n </span>\n </div>\n <div class=\"vditor-img__img\" onclick=\"this.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n <img style=\"width: " + oldImgElement.width + "px;height:" + oldImgElement.height + "px;transform: translate3d(" + oldImgRect.left + "px, " + (oldImgRect.top - height) + "px, 0)\" src=\"" + oldImgElement.getAttribute("src") + "\">\n </div>\n</div>");
3986
+ document.body.insertAdjacentHTML("beforeend", "<div class=\"vditor vditor-img" + (theme === "dark" ? " vditor--dark" : "") + "\">\n <div class=\"vditor-img__bar\">\n <span class=\"vditor-img__btn\" data-deg=\"0\">\n <svg><use xlink:href=\"#vditor-icon-redo\"></use></svg>\n " + window.VditorI18n.spin + "\n </span>\n <span class=\"vditor-img__btn\" onclick=\"this.parentElement.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n X &nbsp;" + window.VditorI18n.close + "\n </span>\n </div>\n <div class=\"vditor-img__img\" onclick=\"this.parentElement.outerHTML = '';document.body.style.overflow = ''\">\n <img style=\"width: " + oldImgElement.width + "px;height:" + oldImgElement.height + "px;transform: translate3d(" + oldImgRect.left + "px, " + (oldImgRect.top - height) + "px, 0)\" src=\"" + oldImgElement.getAttribute("src") + "\">\n </div>\n</div>");
4398
3987
  document.body.style.overflow = "hidden";
4399
3988
  // 图片从原始位置移动到预览正中间的动画效果
4400
3989
  var imgElement = document.querySelector(".vditor-img img");
@@ -5237,6 +4826,17 @@ var insertHTML = function (html, vditor) {
5237
4826
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
5238
4827
  /******/ })();
5239
4828
  /******/
4829
+ /******/ /* webpack/runtime/make namespace object */
4830
+ /******/ (() => {
4831
+ /******/ // define __esModule on exports
4832
+ /******/ __webpack_require__.r = (exports) => {
4833
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
4834
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4835
+ /******/ }
4836
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
4837
+ /******/ };
4838
+ /******/ })();
4839
+ /******/
5240
4840
  /************************************************************************/
5241
4841
  var __webpack_exports__ = {};
5242
4842
  // This entry need to be wrapped in an IIFE because it need to be in strict mode.
@@ -5594,7 +5194,7 @@ var processCodeRender = function (previewPanel, vditor) {
5594
5194
  }
5595
5195
  else {
5596
5196
  (0,highlightRender/* highlightRender */.s)(Object.assign({}, vditor.options.preview.hljs), previewPanel, vditor.options.cdn);
5597
- (0,codeRender/* codeRender */.O)(previewPanel, vditor.options.lang);
5197
+ (0,codeRender/* codeRender */.O)(previewPanel);
5598
5198
  }
5599
5199
  previewPanel.setAttribute("data-render", "1");
5600
5200
  };
@@ -6618,8 +6218,6 @@ var processKeydown_processKeydown = function (vditor, event) {
6618
6218
  return false;
6619
6219
  };
6620
6220
 
6621
- // EXTERNAL MODULE: ./src/ts/i18n/index.ts
6622
- var i18n = __webpack_require__(577);
6623
6221
  // EXTERNAL MODULE: ./src/ts/ui/setContentTheme.ts
6624
6222
  var setContentTheme = __webpack_require__(958);
6625
6223
  ;// CONCATENATED MODULE: ./src/ts/ui/setTheme.ts
@@ -6638,6 +6236,7 @@ var setTheme = function (vditor) {
6638
6236
 
6639
6237
 
6640
6238
 
6239
+
6641
6240
  var initUI = function (vditor) {
6642
6241
  vditor.element.innerHTML = "";
6643
6242
  vditor.element.classList.add("vditor");
@@ -6681,11 +6280,14 @@ var initUI = function (vditor) {
6681
6280
  contentElement.appendChild(vditor.hint.element);
6682
6281
  contentElement.appendChild(vditor.tip.element);
6683
6282
  vditor.element.appendChild(contentElement);
6283
+ contentElement.addEventListener("click", function () {
6284
+ hidePanel(vditor, ["subToolbar"]);
6285
+ });
6684
6286
  if (vditor.toolbar.elements.export) {
6685
6287
  // for export pdf
6686
6288
  vditor.element.insertAdjacentHTML("beforeend", '<iframe style="width: 100%;height: 0;border: 0"></iframe>');
6687
6289
  }
6688
- setEditMode(vditor, vditor.options.mode, afterRender(vditor, contentElement));
6290
+ setEditMode(vditor, vditor.options.mode, afterRender(vditor));
6689
6291
  document.execCommand("DefaultParagraphSeparator", false, "p");
6690
6292
  if (navigator.userAgent.indexOf("iPhone") > -1 && typeof window.visualViewport !== "undefined") {
6691
6293
  // https://github.com/Vanessa219/vditor/issues/379
@@ -6720,10 +6322,14 @@ var setPadding = function (vditor) {
6720
6322
  - vditor.options.preview.maxWidth) / 2;
6721
6323
  vditor.ir.element.style.padding = "10px " + Math.max(minPadding, padding) + "px";
6722
6324
  }
6723
- if (vditor.preview.element.style.display !== "block" || vditor.currentMode === "sv") {
6325
+ if (vditor.preview.element.style.display !== "block") {
6724
6326
  vditor.toolbar.element.style.paddingLeft = Math.max(5, parseInt(vditor[vditor.currentMode].element.style.paddingLeft || "0", 10) +
6725
6327
  (vditor.options.outline.position === "left" ? vditor.outline.element.offsetWidth : 0)) + "px";
6726
6328
  }
6329
+ else {
6330
+ vditor.toolbar.element.style.paddingLeft = (5 +
6331
+ (vditor.options.outline.position === "left" ? vditor.outline.element.offsetWidth : 0)) + "px";
6332
+ }
6727
6333
  };
6728
6334
  var setTypewriterPosition = function (vditor) {
6729
6335
  if (!vditor.options.typewriterMode) {
@@ -6743,9 +6349,14 @@ var setTypewriterPosition = function (vditor) {
6743
6349
  // 由于 Firefox padding-bottom bug,只能使用 :after
6744
6350
  vditor[vditor.currentMode].element.style.setProperty("--editor-bottom", ((height - vditor.toolbar.element.offsetHeight) / 2) + "px");
6745
6351
  };
6746
- var afterRender = function (vditor, contentElement) {
6352
+ var resizeCb;
6353
+ function UIUnbindListener() {
6354
+ window.removeEventListener("resize", resizeCb);
6355
+ }
6356
+ var afterRender = function (vditor) {
6747
6357
  setTypewriterPosition(vditor);
6748
- window.addEventListener("resize", function () {
6358
+ UIUnbindListener();
6359
+ window.addEventListener("resize", resizeCb = function () {
6749
6360
  setPadding(vditor);
6750
6361
  setTypewriterPosition(vditor);
6751
6362
  });
@@ -7421,7 +7032,6 @@ var removeBlockElement = function (vditor, event) {
7421
7032
 
7422
7033
 
7423
7034
 
7424
-
7425
7035
  var highlightToolbarWYSIWYG = function (vditor) {
7426
7036
  clearTimeout(vditor.wysiwyg.hlToolbarTimeoutId);
7427
7037
  vditor.wysiwyg.hlToolbarTimeoutId = window.setTimeout(function () {
@@ -7439,8 +7049,9 @@ var highlightToolbarWYSIWYG = function (vditor) {
7439
7049
  typeElement = range.startContainer.parentElement;
7440
7050
  }
7441
7051
  else {
7442
- typeElement = typeElement.childNodes[range.startOffset >= typeElement.childNodes.length ?
7443
- typeElement.childNodes.length - 1 : range.startOffset];
7052
+ typeElement = typeElement.childNodes[range.startOffset >= typeElement.childNodes.length
7053
+ ? typeElement.childNodes.length - 1
7054
+ : range.startOffset];
7444
7055
  }
7445
7056
  var footnotesElement = (0,hasClosest/* hasClosestByAttribute */.a1)(typeElement, "data-type", "footnotes-block");
7446
7057
  if (footnotesElement) {
@@ -7469,24 +7080,31 @@ var highlightToolbarWYSIWYG = function (vditor) {
7469
7080
  if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "BLOCKQUOTE")) {
7470
7081
  setCurrentToolbar(vditor.toolbar.elements, ["quote"]);
7471
7082
  }
7472
- if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "B") || (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "STRONG")) {
7083
+ if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "B") ||
7084
+ (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "STRONG")) {
7473
7085
  setCurrentToolbar(vditor.toolbar.elements, ["bold"]);
7474
7086
  }
7475
- if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "I") || (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "EM")) {
7087
+ if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "I") ||
7088
+ (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "EM")) {
7476
7089
  setCurrentToolbar(vditor.toolbar.elements, ["italic"]);
7477
7090
  }
7478
- if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "STRIKE") || (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "S")) {
7091
+ if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "STRIKE") ||
7092
+ (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "S")) {
7479
7093
  setCurrentToolbar(vditor.toolbar.elements, ["strike"]);
7480
7094
  }
7481
7095
  // comments
7482
- vditor.wysiwyg.element.querySelectorAll(".vditor-comment--focus").forEach(function (item) {
7096
+ vditor.wysiwyg.element
7097
+ .querySelectorAll(".vditor-comment--focus")
7098
+ .forEach(function (item) {
7483
7099
  item.classList.remove("vditor-comment--focus");
7484
7100
  });
7485
7101
  var commentElement = (0,hasClosest/* hasClosestByClassName */.fb)(typeElement, "vditor-comment");
7486
7102
  if (commentElement) {
7487
7103
  var ids_1 = commentElement.getAttribute("data-cmtids").split(" ");
7488
7104
  if (ids_1.length > 1 && commentElement.nextSibling.isSameNode(commentElement.nextElementSibling)) {
7489
- var nextIds_1 = commentElement.nextElementSibling.getAttribute("data-cmtids").split(" ");
7105
+ var nextIds_1 = commentElement.nextElementSibling
7106
+ .getAttribute("data-cmtids")
7107
+ .split(" ");
7490
7108
  ids_1.find(function (id) {
7491
7109
  if (nextIds_1.includes(id)) {
7492
7110
  ids_1 = [id];
@@ -7494,7 +7112,9 @@ var highlightToolbarWYSIWYG = function (vditor) {
7494
7112
  }
7495
7113
  });
7496
7114
  }
7497
- vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function (item) {
7115
+ vditor.wysiwyg.element
7116
+ .querySelectorAll(".vditor-comment")
7117
+ .forEach(function (item) {
7498
7118
  if (item.getAttribute("data-cmtids").indexOf(ids_1[0]) > -1) {
7499
7119
  item.classList.add("vditor-comment--focus");
7500
7120
  }
@@ -7508,13 +7128,42 @@ var highlightToolbarWYSIWYG = function (vditor) {
7508
7128
  var headingElement = (0,hasClosestByHeadings/* hasClosestByHeadings */.W)(typeElement);
7509
7129
  if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "CODE")) {
7510
7130
  if ((0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "PRE")) {
7511
- disableToolbar(vditor.toolbar.elements, ["headings", "bold", "italic", "strike", "line", "quote",
7512
- "list", "ordered-list", "check", "code", "inline-code", "upload", "link", "table", "record"]);
7131
+ disableToolbar(vditor.toolbar.elements, [
7132
+ "headings",
7133
+ "bold",
7134
+ "italic",
7135
+ "strike",
7136
+ "line",
7137
+ "quote",
7138
+ "list",
7139
+ "ordered-list",
7140
+ "check",
7141
+ "code",
7142
+ "inline-code",
7143
+ "upload",
7144
+ "link",
7145
+ "table",
7146
+ "record",
7147
+ ]);
7513
7148
  setCurrentToolbar(vditor.toolbar.elements, ["code"]);
7514
7149
  }
7515
7150
  else {
7516
- disableToolbar(vditor.toolbar.elements, ["headings", "bold", "italic", "strike", "line", "quote",
7517
- "list", "ordered-list", "check", "code", "upload", "link", "table", "record"]);
7151
+ disableToolbar(vditor.toolbar.elements, [
7152
+ "headings",
7153
+ "bold",
7154
+ "italic",
7155
+ "strike",
7156
+ "line",
7157
+ "quote",
7158
+ "list",
7159
+ "ordered-list",
7160
+ "check",
7161
+ "code",
7162
+ "upload",
7163
+ "link",
7164
+ "table",
7165
+ "record",
7166
+ ]);
7518
7167
  setCurrentToolbar(vditor.toolbar.elements, ["inline-code"]);
7519
7168
  }
7520
7169
  }
@@ -7552,6 +7201,8 @@ var highlightToolbarWYSIWYG = function (vditor) {
7552
7201
  }
7553
7202
  // table popover
7554
7203
  if (tableElement) {
7204
+ var lang = vditor.options.lang;
7205
+ var options = vditor.options;
7555
7206
  vditor.wysiwyg.popover.innerHTML = "";
7556
7207
  var updateTable_1 = function () {
7557
7208
  var oldRow = tableElement.rows.length;
@@ -7590,10 +7241,14 @@ var highlightToolbarWYSIWYG = function (vditor) {
7590
7241
  }
7591
7242
  for (var l = 0; l < rowDiff; l++) {
7592
7243
  if (tableElement.querySelector("tbody")) {
7593
- tableElement.querySelector("tbody").insertAdjacentHTML("beforeend", rowHTML);
7244
+ tableElement
7245
+ .querySelector("tbody")
7246
+ .insertAdjacentHTML("beforeend", rowHTML);
7594
7247
  }
7595
7248
  else {
7596
- tableElement.querySelector("thead").insertAdjacentHTML("afterend", rowHTML + "</tr>");
7249
+ tableElement
7250
+ .querySelector("thead")
7251
+ .insertAdjacentHTML("afterend", rowHTML + "</tr>");
7597
7252
  }
7598
7253
  }
7599
7254
  }
@@ -7638,46 +7293,51 @@ var highlightToolbarWYSIWYG = function (vditor) {
7638
7293
  }
7639
7294
  var left_1 = document.createElement("button");
7640
7295
  left_1.setAttribute("type", "button");
7641
- left_1.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].alignLeft +
7642
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘L") + ">");
7296
+ left_1.setAttribute("aria-label", window.VditorI18n.alignLeft + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘L") + ">");
7643
7297
  left_1.setAttribute("data-type", "left");
7644
- left_1.innerHTML = '<svg><use xlink:href="#vditor-icon-align-left"></use></svg>';
7645
- left_1.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n" +
7646
- (alignType === "left" ? " vditor-icon--current" : "");
7298
+ left_1.innerHTML =
7299
+ '<svg><use xlink:href="#vditor-icon-align-left"></use></svg>';
7300
+ left_1.className =
7301
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n" +
7302
+ (alignType === "left" ? " vditor-icon--current" : "");
7647
7303
  left_1.onclick = function () {
7648
7304
  setAlign_1("left");
7649
7305
  };
7650
7306
  var center_1 = document.createElement("button");
7651
7307
  center_1.setAttribute("type", "button");
7652
- center_1.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].alignCenter +
7653
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘C") + ">");
7308
+ center_1.setAttribute("aria-label", window.VditorI18n.alignCenter + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘C") + ">");
7654
7309
  center_1.setAttribute("data-type", "center");
7655
- center_1.innerHTML = '<svg><use xlink:href="#vditor-icon-align-center"></use></svg>';
7656
- center_1.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n" +
7657
- (alignType === "center" ? " vditor-icon--current" : "");
7310
+ center_1.innerHTML =
7311
+ '<svg><use xlink:href="#vditor-icon-align-center"></use></svg>';
7312
+ center_1.className =
7313
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n" +
7314
+ (alignType === "center" ? " vditor-icon--current" : "");
7658
7315
  center_1.onclick = function () {
7659
7316
  setAlign_1("center");
7660
7317
  };
7661
7318
  var right_1 = document.createElement("button");
7662
7319
  right_1.setAttribute("type", "button");
7663
- right_1.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].alignRight +
7664
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘R") + ">");
7320
+ right_1.setAttribute("aria-label", window.VditorI18n.alignRight + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘R") + ">");
7665
7321
  right_1.setAttribute("data-type", "right");
7666
- right_1.innerHTML = '<svg><use xlink:href="#vditor-icon-align-right"></use></svg>';
7667
- right_1.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n" +
7668
- (alignType === "right" ? " vditor-icon--current" : "");
7322
+ right_1.innerHTML =
7323
+ '<svg><use xlink:href="#vditor-icon-align-right"></use></svg>';
7324
+ right_1.className =
7325
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n" +
7326
+ (alignType === "right" ? " vditor-icon--current" : "");
7669
7327
  right_1.onclick = function () {
7670
7328
  setAlign_1("right");
7671
7329
  };
7672
7330
  var insertRowElement = document.createElement("button");
7673
7331
  insertRowElement.setAttribute("type", "button");
7674
- insertRowElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].insertRowBelow +
7675
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌘=") + ">");
7332
+ insertRowElement.setAttribute("aria-label", window.VditorI18n.insertRowBelow + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌘=") + ">");
7676
7333
  insertRowElement.setAttribute("data-type", "insertRow");
7677
- insertRowElement.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>';
7678
- insertRowElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7334
+ insertRowElement.innerHTML =
7335
+ '<svg><use xlink:href="#vditor-icon-insert-row"></use></svg>';
7336
+ insertRowElement.className =
7337
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7679
7338
  insertRowElement.onclick = function () {
7680
- var startContainer = getSelection().getRangeAt(0).startContainer;
7339
+ var startContainer = getSelection().getRangeAt(0)
7340
+ .startContainer;
7681
7341
  var cellElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TD") ||
7682
7342
  (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TH");
7683
7343
  if (cellElement) {
@@ -7686,13 +7346,15 @@ var highlightToolbarWYSIWYG = function (vditor) {
7686
7346
  };
7687
7347
  var insertRowBElement = document.createElement("button");
7688
7348
  insertRowBElement.setAttribute("type", "button");
7689
- insertRowBElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].insertRowAbove +
7690
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘F") + ">");
7349
+ insertRowBElement.setAttribute("aria-label", window.VditorI18n.insertRowAbove + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘F") + ">");
7691
7350
  insertRowBElement.setAttribute("data-type", "insertRow");
7692
- insertRowBElement.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>';
7693
- insertRowBElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7351
+ insertRowBElement.innerHTML =
7352
+ '<svg><use xlink:href="#vditor-icon-insert-rowb"></use></svg>';
7353
+ insertRowBElement.className =
7354
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7694
7355
  insertRowBElement.onclick = function () {
7695
- var startContainer = getSelection().getRangeAt(0).startContainer;
7356
+ var startContainer = getSelection().getRangeAt(0)
7357
+ .startContainer;
7696
7358
  var cellElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TD") ||
7697
7359
  (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TH");
7698
7360
  if (cellElement) {
@@ -7701,13 +7363,15 @@ var highlightToolbarWYSIWYG = function (vditor) {
7701
7363
  };
7702
7364
  var insertColumnElement = document.createElement("button");
7703
7365
  insertColumnElement.setAttribute("type", "button");
7704
- insertColumnElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].insertColumnRight +
7705
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘=") + ">");
7366
+ insertColumnElement.setAttribute("aria-label", window.VditorI18n.insertColumnRight + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘=") + ">");
7706
7367
  insertColumnElement.setAttribute("data-type", "insertColumn");
7707
- insertColumnElement.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>';
7708
- insertColumnElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7368
+ insertColumnElement.innerHTML =
7369
+ '<svg><use xlink:href="#vditor-icon-insert-column"></use></svg>';
7370
+ insertColumnElement.className =
7371
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7709
7372
  insertColumnElement.onclick = function () {
7710
- var startContainer = getSelection().getRangeAt(0).startContainer;
7373
+ var startContainer = getSelection().getRangeAt(0)
7374
+ .startContainer;
7711
7375
  var cellElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TD") ||
7712
7376
  (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TH");
7713
7377
  if (cellElement) {
@@ -7716,13 +7380,15 @@ var highlightToolbarWYSIWYG = function (vditor) {
7716
7380
  };
7717
7381
  var insertColumnBElement = document.createElement("button");
7718
7382
  insertColumnBElement.setAttribute("type", "button");
7719
- insertColumnBElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].insertColumnLeft +
7720
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘G") + ">");
7383
+ insertColumnBElement.setAttribute("aria-label", window.VditorI18n.insertColumnLeft + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘G") + ">");
7721
7384
  insertColumnBElement.setAttribute("data-type", "insertColumn");
7722
- insertColumnBElement.innerHTML = '<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>';
7723
- insertColumnBElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7385
+ insertColumnBElement.innerHTML =
7386
+ '<svg><use xlink:href="#vditor-icon-insert-columnb"></use></svg>';
7387
+ insertColumnBElement.className =
7388
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7724
7389
  insertColumnBElement.onclick = function () {
7725
- var startContainer = getSelection().getRangeAt(0).startContainer;
7390
+ var startContainer = getSelection().getRangeAt(0)
7391
+ .startContainer;
7726
7392
  var cellElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TD") ||
7727
7393
  (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TH");
7728
7394
  if (cellElement) {
@@ -7731,13 +7397,15 @@ var highlightToolbarWYSIWYG = function (vditor) {
7731
7397
  };
7732
7398
  var deleteRowElement = document.createElement("button");
7733
7399
  deleteRowElement.setAttribute("type", "button");
7734
- deleteRowElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang]["delete-row"] +
7735
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌘-") + ">");
7400
+ deleteRowElement.setAttribute("aria-label", window.VditorI18n["delete-row"] + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌘-") + ">");
7736
7401
  deleteRowElement.setAttribute("data-type", "deleteRow");
7737
- deleteRowElement.innerHTML = '<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>';
7738
- deleteRowElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7402
+ deleteRowElement.innerHTML =
7403
+ '<svg><use xlink:href="#vditor-icon-delete-row"></use></svg>';
7404
+ deleteRowElement.className =
7405
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7739
7406
  deleteRowElement.onclick = function () {
7740
- var startContainer = getSelection().getRangeAt(0).startContainer;
7407
+ var startContainer = getSelection().getRangeAt(0)
7408
+ .startContainer;
7741
7409
  var cellElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TD") ||
7742
7410
  (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TH");
7743
7411
  if (cellElement) {
@@ -7746,13 +7414,15 @@ var highlightToolbarWYSIWYG = function (vditor) {
7746
7414
  };
7747
7415
  var deleteColumnElement = document.createElement("button");
7748
7416
  deleteColumnElement.setAttribute("type", "button");
7749
- deleteColumnElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang]["delete-column"] +
7750
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘-") + ">");
7417
+ deleteColumnElement.setAttribute("aria-label", window.VditorI18n["delete-column"] + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘-") + ">");
7751
7418
  deleteColumnElement.setAttribute("data-type", "deleteColumn");
7752
- deleteColumnElement.innerHTML = '<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>';
7753
- deleteColumnElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7419
+ deleteColumnElement.innerHTML =
7420
+ '<svg><use xlink:href="#vditor-icon-delete-column"></use></svg>';
7421
+ deleteColumnElement.className =
7422
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7754
7423
  deleteColumnElement.onclick = function () {
7755
- var startContainer = getSelection().getRangeAt(0).startContainer;
7424
+ var startContainer = getSelection().getRangeAt(0)
7425
+ .startContainer;
7756
7426
  var cellElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TD") ||
7757
7427
  (0,hasClosest/* hasClosestByMatchTag */.lG)(startContainer, "TH");
7758
7428
  if (cellElement) {
@@ -7760,7 +7430,7 @@ var highlightToolbarWYSIWYG = function (vditor) {
7760
7430
  }
7761
7431
  };
7762
7432
  var inputWrap = document.createElement("span");
7763
- inputWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].row);
7433
+ inputWrap.setAttribute("aria-label", window.VditorI18n.row);
7764
7434
  inputWrap.className = "vditor-tooltipped vditor-tooltipped__n";
7765
7435
  var input_1 = document.createElement("input");
7766
7436
  inputWrap.appendChild(input_1);
@@ -7769,7 +7439,7 @@ var highlightToolbarWYSIWYG = function (vditor) {
7769
7439
  input_1.className = "vditor-input";
7770
7440
  input_1.style.width = "42px";
7771
7441
  input_1.style.textAlign = "center";
7772
- input_1.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].row);
7442
+ input_1.setAttribute("placeholder", window.VditorI18n.row);
7773
7443
  input_1.value = tableElement.rows.length.toString();
7774
7444
  input_1.oninput = function () {
7775
7445
  updateTable_1();
@@ -7787,7 +7457,7 @@ var highlightToolbarWYSIWYG = function (vditor) {
7787
7457
  removeBlockElement(vditor, event);
7788
7458
  };
7789
7459
  var input2Wrap = document.createElement("span");
7790
- input2Wrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].column);
7460
+ input2Wrap.setAttribute("aria-label", window.VditorI18n.column);
7791
7461
  input2Wrap.className = "vditor-tooltipped vditor-tooltipped__n";
7792
7462
  var input2_1 = document.createElement("input");
7793
7463
  input2Wrap.appendChild(input2_1);
@@ -7796,7 +7466,7 @@ var highlightToolbarWYSIWYG = function (vditor) {
7796
7466
  input2_1.className = "vditor-input";
7797
7467
  input2_1.style.width = "42px";
7798
7468
  input2_1.style.textAlign = "center";
7799
- input2_1.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].column);
7469
+ input2_1.setAttribute("placeholder", window.VditorI18n.column);
7800
7470
  input2_1.value = tableElement.rows[0].cells.length.toString();
7801
7471
  input2_1.oninput = function () {
7802
7472
  updateTable_1();
@@ -7838,15 +7508,16 @@ var highlightToolbarWYSIWYG = function (vditor) {
7838
7508
  // footnote popover
7839
7509
  var footnotesRefElement = (0,hasClosest/* hasClosestByAttribute */.a1)(typeElement, "data-type", "footnotes-ref");
7840
7510
  if (footnotesRefElement) {
7511
+ var lang = vditor.options.lang;
7512
+ var options = vditor.options;
7841
7513
  vditor.wysiwyg.popover.innerHTML = "";
7842
7514
  var inputWrap = document.createElement("span");
7843
- inputWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].footnoteRef +
7844
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7515
+ inputWrap.setAttribute("aria-label", window.VditorI18n.footnoteRef + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7845
7516
  inputWrap.className = "vditor-tooltipped vditor-tooltipped__n";
7846
7517
  var input_2 = document.createElement("input");
7847
7518
  inputWrap.appendChild(input_2);
7848
7519
  input_2.className = "vditor-input";
7849
- input_2.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].footnoteRef + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7520
+ input_2.setAttribute("placeholder", window.VditorI18n.footnoteRef + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7850
7521
  input_2.style.width = "120px";
7851
7522
  input_2.value = footnotesRefElement.getAttribute("data-footnotes-label");
7852
7523
  input_2.oninput = function () {
@@ -7858,7 +7529,10 @@ var highlightToolbarWYSIWYG = function (vditor) {
7858
7529
  if (event.isComposing) {
7859
7530
  return;
7860
7531
  }
7861
- if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && event.altKey && event.key === "Enter") {
7532
+ if (!(0,compatibility/* isCtrl */.yl)(event) &&
7533
+ !event.shiftKey &&
7534
+ event.altKey &&
7535
+ event.key === "Enter") {
7862
7536
  range.selectNodeContents(footnotesRefElement);
7863
7537
  range.collapse(false);
7864
7538
  (0,selection/* setSelectionFocus */.Hc)(range);
@@ -7873,24 +7547,28 @@ var highlightToolbarWYSIWYG = function (vditor) {
7873
7547
  }
7874
7548
  var blockRenderElement = (0,hasClosest/* hasClosestByClassName */.fb)(typeElement, "vditor-wysiwyg__block");
7875
7549
  // block popover: math-inline, math-block, html-block, html-inline, code-block, html-entity
7876
- if (blockRenderElement && blockRenderElement.getAttribute("data-type").indexOf("block") > -1) {
7550
+ if (blockRenderElement &&
7551
+ blockRenderElement.getAttribute("data-type").indexOf("block") > -1) {
7552
+ var lang = vditor.options.lang;
7553
+ var options = vditor.options;
7877
7554
  vditor.wysiwyg.popover.innerHTML = "";
7878
7555
  genUp(range, blockRenderElement, vditor);
7879
7556
  genDown(range, blockRenderElement, vditor);
7880
7557
  genClose(blockRenderElement, vditor);
7881
7558
  if (blockRenderElement.getAttribute("data-type") === "code-block") {
7882
7559
  var languageWrap = document.createElement("span");
7883
- languageWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].language +
7884
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7560
+ languageWrap.setAttribute("aria-label", window.VditorI18n.language + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7885
7561
  languageWrap.className = "vditor-tooltipped vditor-tooltipped__n";
7886
7562
  var language_1 = document.createElement("input");
7887
7563
  languageWrap.appendChild(language_1);
7888
7564
  var codeElement_1 = blockRenderElement.firstElementChild.firstElementChild;
7889
7565
  language_1.className = "vditor-input";
7890
- language_1.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].language + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7891
- language_1.value = codeElement_1.className.indexOf("language-") > -1 ?
7892
- codeElement_1.className.split("-")[1].split(" ")[0] : "";
7893
- language_1.oninput = function () {
7566
+ language_1.setAttribute("placeholder", window.VditorI18n.language + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⌥Enter") + ">");
7567
+ language_1.value =
7568
+ codeElement_1.className.indexOf("language-") > -1
7569
+ ? codeElement_1.className.split("-")[1].split(" ")[0]
7570
+ : "";
7571
+ language_1.oninput = function (e) {
7894
7572
  if (language_1.value.trim() !== "") {
7895
7573
  codeElement_1.className = "language-" + language_1.value;
7896
7574
  }
@@ -7899,10 +7577,18 @@ var highlightToolbarWYSIWYG = function (vditor) {
7899
7577
  vditor.hint.recentLanguage = "";
7900
7578
  }
7901
7579
  if (blockRenderElement.lastElementChild.classList.contains("vditor-wysiwyg__preview")) {
7902
- blockRenderElement.lastElementChild.innerHTML = blockRenderElement.firstElementChild.innerHTML;
7580
+ blockRenderElement.lastElementChild.innerHTML =
7581
+ blockRenderElement.firstElementChild.innerHTML;
7903
7582
  processCodeRender(blockRenderElement.lastElementChild, vditor);
7904
7583
  }
7905
7584
  afterRenderEvent(vditor);
7585
+ // 当鼠标点选语言时,触发自定义input事件
7586
+ if (e.detail === 1) {
7587
+ // 选择语言后,输入焦点切换到代码输入框
7588
+ range.setStart(codeElement_1.firstChild, 0);
7589
+ range.collapse(true);
7590
+ (0,selection/* setSelectionFocus */.Hc)(range);
7591
+ }
7906
7592
  };
7907
7593
  language_1.onkeydown = function (event) {
7908
7594
  if (event.isComposing) {
@@ -7911,21 +7597,29 @@ var highlightToolbarWYSIWYG = function (vditor) {
7911
7597
  if (removeBlockElement(vditor, event)) {
7912
7598
  return;
7913
7599
  }
7914
- if (event.key === "Escape" && vditor.hint.element.style.display === "block") {
7600
+ if (event.key === "Escape" &&
7601
+ vditor.hint.element.style.display === "block") {
7915
7602
  vditor.hint.element.style.display = "none";
7916
7603
  event.preventDefault();
7917
7604
  return;
7918
7605
  }
7919
- if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && event.altKey && event.key === "Enter") {
7606
+ vditor.hint.select(event, vditor);
7607
+ if (!(0,compatibility/* isCtrl */.yl)(event) &&
7608
+ !event.shiftKey &&
7609
+ event.key === "Enter") {
7920
7610
  range.setStart(codeElement_1.firstChild, 0);
7921
7611
  range.collapse(true);
7922
7612
  (0,selection/* setSelectionFocus */.Hc)(range);
7613
+ event.preventDefault();
7614
+ event.stopPropagation();
7923
7615
  }
7924
- vditor.hint.select(event, vditor);
7925
7616
  };
7926
7617
  language_1.onkeyup = function (event) {
7927
- if (event.isComposing || event.key === "Enter" || event.key === "ArrowUp" || event.key === "Escape"
7928
- || event.key === "ArrowDown") {
7618
+ if (event.isComposing ||
7619
+ event.key === "Enter" ||
7620
+ event.key === "ArrowUp" ||
7621
+ event.key === "Escape" ||
7622
+ event.key === "ArrowDown") {
7929
7623
  return;
7930
7624
  }
7931
7625
  var matchLangData = [];
@@ -7947,7 +7641,9 @@ var highlightToolbarWYSIWYG = function (vditor) {
7947
7641
  }
7948
7642
  else {
7949
7643
  if (!blockRenderElement) {
7950
- vditor.wysiwyg.element.querySelectorAll(".vditor-wysiwyg__preview").forEach(function (itemElement) {
7644
+ vditor.wysiwyg.element
7645
+ .querySelectorAll(".vditor-wysiwyg__preview")
7646
+ .forEach(function (itemElement) {
7951
7647
  var previousElement = itemElement.previousElementSibling;
7952
7648
  previousElement.style.display = "none";
7953
7649
  });
@@ -7972,7 +7668,10 @@ var highlightToolbarWYSIWYG = function (vditor) {
7972
7668
  if (event.isComposing) {
7973
7669
  return;
7974
7670
  }
7975
- if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && event.altKey && event.key === "Enter") {
7671
+ if (!(0,compatibility/* isCtrl */.yl)(event) &&
7672
+ !event.shiftKey &&
7673
+ event.altKey &&
7674
+ event.key === "Enter") {
7976
7675
  range.selectNodeContents(headingElement);
7977
7676
  range.collapse(false);
7978
7677
  (0,selection/* setSelectionFocus */.Hc)(range);
@@ -7991,10 +7690,18 @@ var highlightToolbarWYSIWYG = function (vditor) {
7991
7690
  if (aElement) {
7992
7691
  genAPopover(vditor, aElement);
7993
7692
  }
7994
- if (!blockquoteElement && !liElement && !tableElement && !blockRenderElement && !aElement
7995
- && !linkRefElement && !footnotesRefElement && !headingElement && !tocElement) {
7693
+ if (!blockquoteElement &&
7694
+ !liElement &&
7695
+ !tableElement &&
7696
+ !blockRenderElement &&
7697
+ !aElement &&
7698
+ !linkRefElement &&
7699
+ !footnotesRefElement &&
7700
+ !headingElement &&
7701
+ !tocElement) {
7996
7702
  var blockElement = (0,hasClosest/* hasClosestByAttribute */.a1)(typeElement, "data-block", "0");
7997
- if (blockElement && blockElement.parentElement.isEqualNode(vditor.wysiwyg.element)) {
7703
+ if (blockElement &&
7704
+ blockElement.parentElement.isEqualNode(vditor.wysiwyg.element)) {
7998
7705
  vditor.wysiwyg.popover.innerHTML = "";
7999
7706
  genUp(range, blockElement, vditor);
8000
7707
  genDown(range, blockElement, vditor);
@@ -8006,7 +7713,9 @@ var highlightToolbarWYSIWYG = function (vditor) {
8006
7713
  }
8007
7714
  }
8008
7715
  // 反斜杠特殊处理
8009
- vditor.wysiwyg.element.querySelectorAll('span[data-type="backslash"] > span').forEach(function (item) {
7716
+ vditor.wysiwyg.element
7717
+ .querySelectorAll('span[data-type="backslash"] > span')
7718
+ .forEach(function (item) {
8010
7719
  item.style.display = "none";
8011
7720
  });
8012
7721
  var backslashElement = (0,hasClosest/* hasClosestByAttribute */.a1)(range.startContainer, "data-type", "backslash");
@@ -8023,7 +7732,8 @@ var setPopoverPosition = function (vditor, element) {
8023
7732
  }
8024
7733
  vditor.wysiwyg.popover.style.left = "0";
8025
7734
  vditor.wysiwyg.popover.style.display = "block";
8026
- vditor.wysiwyg.popover.style.top = Math.max(-8, targetElement.offsetTop - 21 - vditor.wysiwyg.element.scrollTop) + "px";
7735
+ vditor.wysiwyg.popover.style.top =
7736
+ Math.max(-8, targetElement.offsetTop - 21 - vditor.wysiwyg.element.scrollTop) + "px";
8027
7737
  vditor.wysiwyg.popover.style.left =
8028
7738
  Math.min(targetElement.offsetLeft, vditor.wysiwyg.element.clientWidth - vditor.wysiwyg.popover.clientWidth) + "px";
8029
7739
  vditor.wysiwyg.popover.setAttribute("data-top", (targetElement.offsetTop - 21).toString());
@@ -8045,14 +7755,15 @@ var genLinkRefPopover = function (vditor, linkRefElement) {
8045
7755
  }
8046
7756
  };
8047
7757
  var inputWrap = document.createElement("span");
8048
- inputWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].textIsNotEmpty);
7758
+ inputWrap.setAttribute("aria-label", window.VditorI18n.textIsNotEmpty);
8049
7759
  inputWrap.className = "vditor-tooltipped vditor-tooltipped__n";
8050
7760
  var input = document.createElement("input");
8051
7761
  inputWrap.appendChild(input);
8052
7762
  input.className = "vditor-input";
8053
- input.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].textIsNotEmpty);
7763
+ input.setAttribute("placeholder", window.VditorI18n.textIsNotEmpty);
8054
7764
  input.style.width = "120px";
8055
- input.value = linkRefElement.getAttribute("alt") || linkRefElement.textContent;
7765
+ input.value =
7766
+ linkRefElement.getAttribute("alt") || linkRefElement.textContent;
8056
7767
  input.oninput = function () {
8057
7768
  updateLinkRef();
8058
7769
  };
@@ -8063,12 +7774,12 @@ var genLinkRefPopover = function (vditor, linkRefElement) {
8063
7774
  linkHotkey(vditor, linkRefElement, event, input1);
8064
7775
  };
8065
7776
  var input1Wrap = document.createElement("span");
8066
- input1Wrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].linkRef);
7777
+ input1Wrap.setAttribute("aria-label", window.VditorI18n.linkRef);
8067
7778
  input1Wrap.className = "vditor-tooltipped vditor-tooltipped__n";
8068
7779
  var input1 = document.createElement("input");
8069
7780
  input1Wrap.appendChild(input1);
8070
7781
  input1.className = "vditor-input";
8071
- input1.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].linkRef);
7782
+ input1.setAttribute("placeholder", window.VditorI18n.linkRef);
8072
7783
  input1.value = linkRefElement.getAttribute("data-link-label");
8073
7784
  input1.oninput = function () {
8074
7785
  updateLinkRef();
@@ -8086,14 +7797,15 @@ var genLinkRefPopover = function (vditor, linkRefElement) {
8086
7797
  };
8087
7798
  var genUp = function (range, element, vditor) {
8088
7799
  var previousElement = element.previousElementSibling;
8089
- if (!previousElement || (!element.parentElement.isEqualNode(vditor.wysiwyg.element) && element.tagName !== "LI")) {
7800
+ if (!previousElement ||
7801
+ (!element.parentElement.isEqualNode(vditor.wysiwyg.element) &&
7802
+ element.tagName !== "LI")) {
8090
7803
  return;
8091
7804
  }
8092
7805
  var upElement = document.createElement("button");
8093
7806
  upElement.setAttribute("type", "button");
8094
7807
  upElement.setAttribute("data-type", "up");
8095
- upElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].up +
8096
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘U") + ">");
7808
+ upElement.setAttribute("aria-label", window.VditorI18n.up + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘U") + ">");
8097
7809
  upElement.innerHTML = '<svg><use xlink:href="#vditor-icon-up"></use></svg>';
8098
7810
  upElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
8099
7811
  upElement.onclick = function () {
@@ -8108,16 +7820,19 @@ var genUp = function (range, element, vditor) {
8108
7820
  };
8109
7821
  var genDown = function (range, element, vditor) {
8110
7822
  var nextElement = element.nextElementSibling;
8111
- if (!nextElement || (!element.parentElement.isEqualNode(vditor.wysiwyg.element) && element.tagName !== "LI")) {
7823
+ if (!nextElement ||
7824
+ (!element.parentElement.isEqualNode(vditor.wysiwyg.element) &&
7825
+ element.tagName !== "LI")) {
8112
7826
  return;
8113
7827
  }
8114
7828
  var downElement = document.createElement("button");
8115
7829
  downElement.setAttribute("type", "button");
8116
7830
  downElement.setAttribute("data-type", "down");
8117
- downElement.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].down +
8118
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘D") + ">");
8119
- downElement.innerHTML = '<svg><use xlink:href="#vditor-icon-down"></use></svg>';
8120
- downElement.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
7831
+ downElement.setAttribute("aria-label", window.VditorI18n.down + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘D") + ">");
7832
+ downElement.innerHTML =
7833
+ '<svg><use xlink:href="#vditor-icon-down"></use></svg>';
7834
+ downElement.className =
7835
+ "vditor-icon vditor-tooltipped vditor-tooltipped__n";
8121
7836
  downElement.onclick = function () {
8122
7837
  range.insertNode(document.createElement("wbr"));
8123
7838
  nextElement.insertAdjacentElement("afterend", element);
@@ -8132,9 +7847,9 @@ var genClose = function (element, vditor) {
8132
7847
  var close = document.createElement("button");
8133
7848
  close.setAttribute("type", "button");
8134
7849
  close.setAttribute("data-type", "remove");
8135
- close.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].remove +
8136
- "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘X") + ">");
8137
- close.innerHTML = '<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>';
7850
+ close.setAttribute("aria-label", window.VditorI18n.remove + "<" + (0,compatibility/* updateHotkeyTip */.ns)("⇧⌘X") + ">");
7851
+ close.innerHTML =
7852
+ '<svg><use xlink:href="#vditor-icon-trashcan"></use></svg>';
8138
7853
  close.className = "vditor-icon vditor-tooltipped vditor-tooltipped__n";
8139
7854
  close.onclick = function () {
8140
7855
  var range = (0,selection/* getEditorRange */.zh)(vditor);
@@ -8156,7 +7871,10 @@ var linkHotkey = function (vditor, element, event, nextInputElement) {
8156
7871
  event.preventDefault();
8157
7872
  return;
8158
7873
  }
8159
- if (!(0,compatibility/* isCtrl */.yl)(event) && !event.shiftKey && event.altKey && event.key === "Enter") {
7874
+ if (!(0,compatibility/* isCtrl */.yl)(event) &&
7875
+ !event.shiftKey &&
7876
+ event.altKey &&
7877
+ event.key === "Enter") {
8160
7878
  var range = (0,selection/* getEditorRange */.zh)(vditor);
8161
7879
  // firefox 不会打断 link https://github.com/Vanessa219/vditor/issues/193
8162
7880
  element.insertAdjacentHTML("afterend", constants/* Constants.ZWSP */.g.ZWSP);
@@ -8167,6 +7885,8 @@ var linkHotkey = function (vditor, element, event, nextInputElement) {
8167
7885
  }
8168
7886
  };
8169
7887
  var genAPopover = function (vditor, aElement) {
7888
+ var lang = vditor.options.lang;
7889
+ var options = vditor.options;
8170
7890
  vditor.wysiwyg.popover.innerHTML = "";
8171
7891
  var updateA = function () {
8172
7892
  if (input.value.trim() !== "") {
@@ -8179,12 +7899,12 @@ var genAPopover = function (vditor, aElement) {
8179
7899
  item.removeAttribute("data-marker");
8180
7900
  });
8181
7901
  var inputWrap = document.createElement("span");
8182
- inputWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].textIsNotEmpty);
7902
+ inputWrap.setAttribute("aria-label", window.VditorI18n.textIsNotEmpty);
8183
7903
  inputWrap.className = "vditor-tooltipped vditor-tooltipped__n";
8184
7904
  var input = document.createElement("input");
8185
7905
  inputWrap.appendChild(input);
8186
7906
  input.className = "vditor-input";
8187
- input.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].textIsNotEmpty);
7907
+ input.setAttribute("placeholder", window.VditorI18n.textIsNotEmpty);
8188
7908
  input.style.width = "120px";
8189
7909
  input.value = aElement.innerHTML || "";
8190
7910
  input.oninput = function () {
@@ -8197,12 +7917,12 @@ var genAPopover = function (vditor, aElement) {
8197
7917
  linkHotkey(vditor, aElement, event, input1);
8198
7918
  };
8199
7919
  var input1Wrap = document.createElement("span");
8200
- input1Wrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].link);
7920
+ input1Wrap.setAttribute("aria-label", window.VditorI18n.link);
8201
7921
  input1Wrap.className = "vditor-tooltipped vditor-tooltipped__n";
8202
7922
  var input1 = document.createElement("input");
8203
7923
  input1Wrap.appendChild(input1);
8204
7924
  input1.className = "vditor-input";
8205
- input1.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].link);
7925
+ input1.setAttribute("placeholder", window.VditorI18n.link);
8206
7926
  input1.value = aElement.getAttribute("href") || "";
8207
7927
  input1.oninput = function () {
8208
7928
  updateA();
@@ -8214,12 +7934,12 @@ var genAPopover = function (vditor, aElement) {
8214
7934
  linkHotkey(vditor, aElement, event, input2);
8215
7935
  };
8216
7936
  var input2Wrap = document.createElement("span");
8217
- input2Wrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].tooltipText);
7937
+ input2Wrap.setAttribute("aria-label", window.VditorI18n.tooltipText);
8218
7938
  input2Wrap.className = "vditor-tooltipped vditor-tooltipped__n";
8219
7939
  var input2 = document.createElement("input");
8220
7940
  input2Wrap.appendChild(input2);
8221
7941
  input2.className = "vditor-input";
8222
- input2.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].tooltipText);
7942
+ input2.setAttribute("placeholder", window.VditorI18n.tooltipText);
8223
7943
  input2.style.width = "60px";
8224
7944
  input2.value = aElement.getAttribute("title") || "";
8225
7945
  input2.oninput = function () {
@@ -8246,12 +7966,12 @@ var genImagePopover = function (event, vditor) {
8246
7966
  imgElement.setAttribute("title", title.value);
8247
7967
  };
8248
7968
  var inputWrap = document.createElement("span");
8249
- inputWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].imageURL);
7969
+ inputWrap.setAttribute("aria-label", window.VditorI18n.imageURL);
8250
7970
  inputWrap.className = "vditor-tooltipped vditor-tooltipped__n";
8251
7971
  var inputElement = document.createElement("input");
8252
7972
  inputWrap.appendChild(inputElement);
8253
7973
  inputElement.className = "vditor-input";
8254
- inputElement.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].imageURL);
7974
+ inputElement.setAttribute("placeholder", window.VditorI18n.imageURL);
8255
7975
  inputElement.value = imgElement.getAttribute("src") || "";
8256
7976
  inputElement.oninput = function () {
8257
7977
  updateImg();
@@ -8260,12 +7980,12 @@ var genImagePopover = function (event, vditor) {
8260
7980
  removeBlockElement(vditor, elementEvent);
8261
7981
  };
8262
7982
  var altWrap = document.createElement("span");
8263
- altWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].alternateText);
7983
+ altWrap.setAttribute("aria-label", window.VditorI18n.alternateText);
8264
7984
  altWrap.className = "vditor-tooltipped vditor-tooltipped__n";
8265
7985
  var alt = document.createElement("input");
8266
7986
  altWrap.appendChild(alt);
8267
7987
  alt.className = "vditor-input";
8268
- alt.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].alternateText);
7988
+ alt.setAttribute("placeholder", window.VditorI18n.alternateText);
8269
7989
  alt.style.width = "52px";
8270
7990
  alt.value = imgElement.getAttribute("alt") || "";
8271
7991
  alt.oninput = function () {
@@ -8275,12 +7995,12 @@ var genImagePopover = function (event, vditor) {
8275
7995
  removeBlockElement(vditor, elementEvent);
8276
7996
  };
8277
7997
  var titleWrap = document.createElement("span");
8278
- titleWrap.setAttribute("aria-label", i18n/* i18n */.a[vditor.options.lang].title);
7998
+ titleWrap.setAttribute("aria-label", window.VditorI18n.title);
8279
7999
  titleWrap.className = "vditor-tooltipped vditor-tooltipped__n";
8280
8000
  var title = document.createElement("input");
8281
8001
  titleWrap.appendChild(title);
8282
8002
  title.className = "vditor-input";
8283
- title.setAttribute("placeholder", i18n/* i18n */.a[vditor.options.lang].title);
8003
+ title.setAttribute("placeholder", window.VditorI18n.title);
8284
8004
  title.value = imgElement.getAttribute("title") || "";
8285
8005
  title.oninput = function () {
8286
8006
  updateImg();
@@ -8671,7 +8391,6 @@ var toolbarEvent = function (vditor, actionBtn, event) {
8671
8391
 
8672
8392
 
8673
8393
 
8674
-
8675
8394
  var MenuItem = /** @class */ (function () {
8676
8395
  function MenuItem(vditor, menuItem) {
8677
8396
  var _a;
@@ -8684,8 +8403,7 @@ var MenuItem = /** @class */ (function () {
8684
8403
  if (menuItem.level === 2) {
8685
8404
  hotkey = menuItem.hotkey ? " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)(menuItem.hotkey) + "&gt;" : "";
8686
8405
  }
8687
- var tip = menuItem.tip ?
8688
- menuItem.tip + hotkey : i18n/* i18n */.a[vditor.options.lang][menuItem.name] + hotkey;
8406
+ var tip = menuItem.tip ? menuItem.tip + hotkey : "" + window.VditorI18n[menuItem.name] + hotkey;
8689
8407
  var tagName = menuItem.name === "upload" ? "div" : "button";
8690
8408
  if (menuItem.level === 2) {
8691
8409
  this.element.innerHTML = "<" + tagName + " data-type=\"" + menuItem.name + "\">" + tip + "</" + tagName + ">";
@@ -8749,7 +8467,6 @@ var __extends = (undefined && undefined.__extends) || (function () {
8749
8467
 
8750
8468
 
8751
8469
 
8752
-
8753
8470
  var setEditMode = function (vditor, type, event) {
8754
8471
  var markdownText;
8755
8472
  if (typeof event !== "string") {
@@ -8876,7 +8593,7 @@ var EditMode = /** @class */ (function (_super) {
8876
8593
  var _this = _super.call(this, vditor, menuItem) || this;
8877
8594
  var panelElement = document.createElement("div");
8878
8595
  panelElement.className = "vditor-hint" + (menuItem.level === 2 ? "" : " vditor-panel--arrow");
8879
- panelElement.innerHTML = "<button data-mode=\"wysiwyg\">" + i18n/* i18n */.a[vditor.options.lang].wysiwyg + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘7") + "></button>\n<button data-mode=\"ir\">" + i18n/* i18n */.a[vditor.options.lang].instantRendering + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘8") + "></button>\n<button data-mode=\"sv\">" + i18n/* i18n */.a[vditor.options.lang].splitView + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘9") + "></button>";
8596
+ panelElement.innerHTML = "<button data-mode=\"wysiwyg\">" + window.VditorI18n.wysiwyg + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘7") + "></button>\n<button data-mode=\"ir\">" + window.VditorI18n.instantRendering + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘8") + "></button>\n<button data-mode=\"sv\">" + window.VditorI18n.splitView + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘9") + "></button>";
8880
8597
  _this.element.appendChild(panelElement);
8881
8598
  _this._bindEvent(vditor, panelElement, menuItem);
8882
8599
  return _this;
@@ -8940,7 +8657,7 @@ var focusEvent = function (vditor, editorElement) {
8940
8657
  if (vditor.options.focus) {
8941
8658
  vditor.options.focus(getMarkdown(vditor));
8942
8659
  }
8943
- hidePanel(vditor, ["subToolbar"]);
8660
+ hidePanel(vditor, ["subToolbar", "hint"]);
8944
8661
  });
8945
8662
  };
8946
8663
  var dblclickEvent = function (vditor, editorElement) {
@@ -8978,7 +8695,7 @@ var dropEvent = function (vditor, editorElement) {
8978
8695
  // 编辑器内选中文字拖拽
8979
8696
  execAfterRender(vditor);
8980
8697
  }
8981
- else if (event.dataTransfer.types[0] === "Files" || event.dataTransfer.types.includes("text/html")) {
8698
+ else if (event.dataTransfer.types.includes("Files") || event.dataTransfer.types.includes("text/html")) {
8982
8699
  // 外部文件拖入编辑器中或者编辑器内选中文字拖拽
8983
8700
  paste(vditor, event, {
8984
8701
  pasteCode: function (code) {
@@ -9438,7 +9155,6 @@ var __generator = (undefined && undefined.__generator) || function (thisArg, bod
9438
9155
 
9439
9156
 
9440
9157
 
9441
-
9442
9158
  var Upload = /** @class */ (function () {
9443
9159
  function Upload() {
9444
9160
  this.isUploading = false;
@@ -9453,15 +9169,16 @@ var validateFile = function (vditor, files) {
9453
9169
  var errorTip = "";
9454
9170
  var uploadingStr = "";
9455
9171
  var lang = vditor.options.lang;
9172
+ var options = vditor.options;
9456
9173
  var _loop_1 = function (iMax, i) {
9457
9174
  var file = files[i];
9458
9175
  var validate = true;
9459
9176
  if (!file.name) {
9460
- errorTip += "<li>" + i18n/* i18n */.a[lang].nameEmpty + "</li>";
9177
+ errorTip += "<li>" + window.VditorI18n.nameEmpty + "</li>";
9461
9178
  validate = false;
9462
9179
  }
9463
9180
  if (file.size > vditor.options.upload.max) {
9464
- errorTip += "<li>" + file.name + " " + i18n/* i18n */.a[lang].over + " " + vditor.options.upload.max / 1024 / 1024 + "M</li>";
9181
+ errorTip += "<li>" + file.name + " " + window.VditorI18n.over + " " + vditor.options.upload.max / 1024 / 1024 + "M</li>";
9465
9182
  validate = false;
9466
9183
  }
9467
9184
  var lastIndex = file.name.lastIndexOf(".");
@@ -9483,13 +9200,13 @@ var validateFile = function (vditor, files) {
9483
9200
  return false;
9484
9201
  });
9485
9202
  if (!isAccept) {
9486
- errorTip += "<li>" + file.name + " " + i18n/* i18n */.a[lang].fileTypeError + "</li>";
9203
+ errorTip += "<li>" + file.name + " " + window.VditorI18n.fileTypeError + "</li>";
9487
9204
  validate = false;
9488
9205
  }
9489
9206
  }
9490
9207
  if (validate) {
9491
9208
  uploadFileList.push(file);
9492
- uploadingStr += "<li>" + filename + " " + i18n/* i18n */.a[lang].uploading + "</li>";
9209
+ uploadingStr += "<li>" + filename + " " + window.VditorI18n.uploading + "</li>";
9493
9210
  }
9494
9211
  };
9495
9212
  for (var iMax = files.length, i = 0; i < iMax; i++) {
@@ -9511,7 +9228,7 @@ var genUploadedLabel = function (responseText, vditor) {
9511
9228
  response.data.errFiles.forEach(function (data) {
9512
9229
  var lastIndex = data.lastIndexOf(".");
9513
9230
  var filename = vditor.options.upload.filename(data.substr(0, lastIndex)) + data.substr(lastIndex);
9514
- errorTip += "<li>" + filename + " " + i18n/* i18n */.a[vditor.options.lang].uploadError + "</li>";
9231
+ errorTip += "<li>" + filename + " " + window.VditorI18n.uploadError + "</li>";
9515
9232
  });
9516
9233
  errorTip += "</ul>";
9517
9234
  }
@@ -9530,7 +9247,7 @@ var genUploadedLabel = function (responseText, vditor) {
9530
9247
  type = type.toLowerCase();
9531
9248
  if (type.indexOf(".wav") === 0 || type.indexOf(".mp3") === 0 || type.indexOf(".ogg") === 0) {
9532
9249
  if (vditor.currentMode === "wysiwyg") {
9533
- succFileText += "<div class=\"vditor-wysiwyg__block\" data-type=\"html-block\"\n data-block=\"0\"><pre><code>&lt;audio controls=\"controls\" src=\"" + path + "\"&gt;&lt;/audio&gt;</code></pre>";
9250
+ succFileText += "<div class=\"vditor-wysiwyg__block\" data-type=\"html-block\"\n data-block=\"0\"><pre><code>&lt;audio controls=\"controls\" src=\"" + path + "\"&gt;&lt;/audio&gt;</code></pre>\n";
9534
9251
  }
9535
9252
  else if (vditor.currentMode === "ir") {
9536
9253
  succFileText += "<audio controls=\"controls\" src=\"" + path + "\"></audio>\n";
@@ -9548,7 +9265,7 @@ var genUploadedLabel = function (responseText, vditor) {
9548
9265
  || type.indexOf(".svg") === 0
9549
9266
  || type.indexOf(".webp") === 0) {
9550
9267
  if (vditor.currentMode === "wysiwyg") {
9551
- succFileText += "<img alt=\"" + filename + "\" src=\"" + path + "\">";
9268
+ succFileText += "<img alt=\"" + filename + "\" src=\"" + path + "\">\n";
9552
9269
  }
9553
9270
  else {
9554
9271
  succFileText += "![" + filename + "](" + path + ")\n";
@@ -9556,7 +9273,7 @@ var genUploadedLabel = function (responseText, vditor) {
9556
9273
  }
9557
9274
  else {
9558
9275
  if (vditor.currentMode === "wysiwyg") {
9559
- succFileText += "<a href=\"" + path + "\">" + filename + "</a>";
9276
+ succFileText += "<a href=\"" + path + "\">" + filename + "</a>\n";
9560
9277
  }
9561
9278
  else {
9562
9279
  succFileText += "[" + filename + "](" + path + ")\n";
@@ -9581,14 +9298,16 @@ var uploadFiles = function (vditor, files, element) { return __awaiter(void 0, v
9581
9298
  }
9582
9299
  fileList.push(fileItem);
9583
9300
  }
9584
- if (vditor.options.upload.handler) {
9585
- isValidate = vditor.options.upload.handler(fileList);
9586
- if (typeof isValidate === "string") {
9587
- vditor.tip.show(isValidate);
9588
- return [2 /*return*/];
9589
- }
9301
+ if (!vditor.options.upload.handler) return [3 /*break*/, 2];
9302
+ return [4 /*yield*/, vditor.options.upload.handler(fileList)];
9303
+ case 1:
9304
+ isValidate = _b.sent();
9305
+ if (typeof isValidate === "string") {
9306
+ vditor.tip.show(isValidate);
9590
9307
  return [2 /*return*/];
9591
9308
  }
9309
+ return [2 /*return*/];
9310
+ case 2:
9592
9311
  if (!vditor.options.upload.url || !vditor.upload) {
9593
9312
  if (element) {
9594
9313
  element.value = "";
@@ -9596,12 +9315,12 @@ var uploadFiles = function (vditor, files, element) { return __awaiter(void 0, v
9596
9315
  vditor.tip.show("please config: options.upload.url");
9597
9316
  return [2 /*return*/];
9598
9317
  }
9599
- if (!vditor.options.upload.file) return [3 /*break*/, 2];
9318
+ if (!vditor.options.upload.file) return [3 /*break*/, 4];
9600
9319
  return [4 /*yield*/, vditor.options.upload.file(fileList)];
9601
- case 1:
9320
+ case 3:
9602
9321
  fileList = _b.sent();
9603
- _b.label = 2;
9604
- case 2:
9322
+ _b.label = 4;
9323
+ case 4:
9605
9324
  if (vditor.options.upload.validate) {
9606
9325
  isValidate = vditor.options.upload.validate(fileList);
9607
9326
  if (typeof isValidate === "string") {
@@ -10124,10 +9843,14 @@ var listToggle = function (vditor, range, type, cancel) {
10124
9843
  var element = void 0;
10125
9844
  if (type === "list") {
10126
9845
  element = document.createElement("ul");
9846
+ element.setAttribute("data-marker", "*");
10127
9847
  }
10128
9848
  else {
10129
9849
  element = document.createElement("ol");
9850
+ element.setAttribute("data-marker", "1.");
10130
9851
  }
9852
+ element.setAttribute("data-block", "0");
9853
+ element.setAttribute("data-tight", itemElement.parentElement.getAttribute("data-tight"));
10131
9854
  element.innerHTML = itemElement.parentElement.innerHTML;
10132
9855
  itemElement.parentElement.parentNode.replaceChild(element, itemElement.parentElement);
10133
9856
  }
@@ -11123,7 +10846,7 @@ var paste = function (vditor, event, callback) { return fixBrowserBehavior_await
11123
10846
  else {
11124
10847
  textHTML = event.dataTransfer.getData("text/html");
11125
10848
  textPlain = event.dataTransfer.getData("text/plain");
11126
- if (event.dataTransfer.types[0] === "Files") {
10849
+ if (event.dataTransfer.types.includes("Files")) {
11127
10850
  files = event.dataTransfer.items;
11128
10851
  }
11129
10852
  }
@@ -11207,6 +10930,7 @@ var paste = function (vditor, event, callback) { return fixBrowserBehavior_await
11207
10930
  if (doc.body) {
11208
10931
  textHTML = doc.body.innerHTML;
11209
10932
  }
10933
+ textHTML = Lute.Sanitize(textHTML);
11210
10934
  vditor.wysiwyg.getComments(vditor);
11211
10935
  height = vditor[vditor.currentMode].element.scrollHeight;
11212
10936
  code = processPasteCode(textHTML, textPlain, vditor.currentMode);
@@ -11265,7 +10989,7 @@ var paste = function (vditor, event, callback) { return fixBrowserBehavior_await
11265
10989
  vditor.outline.render(vditor);
11266
10990
  return [3 /*break*/, 6];
11267
10991
  case 3:
11268
- if (!(files.length > 0 && vditor.options.upload.url)) return [3 /*break*/, 5];
10992
+ if (!(files.length > 0 && (vditor.options.upload.url || vditor.options.upload.handler))) return [3 /*break*/, 5];
11269
10993
  return [4 /*yield*/, uploadFiles(vditor, files)];
11270
10994
  case 4:
11271
10995
  _b.sent();
@@ -11553,6 +11277,42 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
11553
11277
  };
11554
11278
 
11555
11279
  ;// CONCATENATED MODULE: ./src/ts/hint/index.ts
11280
+ var hint_awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
11281
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11282
+ return new (P || (P = Promise))(function (resolve, reject) {
11283
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11284
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11285
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11286
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11287
+ });
11288
+ };
11289
+ var hint_generator = (undefined && undefined.__generator) || function (thisArg, body) {
11290
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11291
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11292
+ function verb(n) { return function (v) { return step([n, v]); }; }
11293
+ function step(op) {
11294
+ if (f) throw new TypeError("Generator is already executing.");
11295
+ while (_) try {
11296
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
11297
+ if (y = 0, t) op = [op[0] & 2, t.value];
11298
+ switch (op[0]) {
11299
+ case 0: case 1: t = op; break;
11300
+ case 4: _.label++; return { value: op[1], done: false };
11301
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11302
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11303
+ default:
11304
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11305
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11306
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11307
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11308
+ if (t[2]) _.ops.pop();
11309
+ _.trys.pop(); continue;
11310
+ }
11311
+ op = body.call(thisArg, _);
11312
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11313
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11314
+ }
11315
+ };
11556
11316
 
11557
11317
 
11558
11318
 
@@ -11586,15 +11346,25 @@ var Hint = /** @class */ (function () {
11586
11346
  return;
11587
11347
  }
11588
11348
  }
11589
- if (vditor.currentMode === "wysiwyg" && range.startContainer.nodeType !== 3 &&
11590
- range.startContainer.firstElementChild.classList.contains("vditor-input")) {
11591
- var inputElement = range.startContainer.firstElementChild;
11592
- inputElement.value = value.trimRight();
11593
- range.selectNodeContents(inputElement);
11594
- range.collapse(false);
11595
- inputElement.dispatchEvent(new CustomEvent("input"));
11596
- _this.recentLanguage = value.trimRight();
11597
- return;
11349
+ if (vditor.currentMode === "wysiwyg" && range.startContainer.nodeType !== 3) {
11350
+ var startContainer = range.startContainer;
11351
+ var inputElement = void 0;
11352
+ if (startContainer.classList.contains("vditor-input")) {
11353
+ inputElement = startContainer;
11354
+ }
11355
+ else {
11356
+ inputElement = startContainer.firstElementChild;
11357
+ }
11358
+ if (inputElement && inputElement.classList.contains("vditor-input")) {
11359
+ inputElement.value = value.trimRight();
11360
+ range.selectNodeContents(inputElement);
11361
+ range.collapse(false);
11362
+ // {detail: 1}用于标识这个自定义事件是在编程语言选择后触发的
11363
+ // 用于在鼠标选择语言后,自动聚焦到代码输入框
11364
+ inputElement.dispatchEvent(new CustomEvent("input", { detail: 1 }));
11365
+ _this.recentLanguage = value.trimRight();
11366
+ return;
11367
+ }
11598
11368
  }
11599
11369
  range.setStart(range.startContainer, _this.lastIndex);
11600
11370
  range.deleteContents();
@@ -11678,9 +11448,19 @@ var Hint = /** @class */ (function () {
11678
11448
  vditor.options.hint.extend.forEach(function (item) {
11679
11449
  if (item.key === _this.splitChar) {
11680
11450
  clearTimeout(_this.timeId);
11681
- _this.timeId = window.setTimeout(function () {
11682
- _this.genHTML(item.hint(key), key, vditor);
11683
- }, vditor.options.hint.delay);
11451
+ _this.timeId = window.setTimeout(function () { return hint_awaiter(_this, void 0, void 0, function () {
11452
+ var _a;
11453
+ return hint_generator(this, function (_b) {
11454
+ switch (_b.label) {
11455
+ case 0:
11456
+ _a = this.genHTML;
11457
+ return [4 /*yield*/, item.hint(key)];
11458
+ case 1:
11459
+ _a.apply(this, [_b.sent(), key, vditor]);
11460
+ return [2 /*return*/];
11461
+ }
11462
+ });
11463
+ }); }, vditor.options.hint.delay);
11684
11464
  }
11685
11465
  });
11686
11466
  }
@@ -12120,7 +11900,6 @@ var mediaRender = __webpack_require__(207);
12120
11900
 
12121
11901
 
12122
11902
 
12123
-
12124
11903
  var Preview = /** @class */ (function () {
12125
11904
  function Preview(vditor) {
12126
11905
  var _this = this;
@@ -12292,7 +12071,7 @@ var Preview = /** @class */ (function () {
12292
12071
  var time = (new Date().getTime() - startTime);
12293
12072
  if ((new Date().getTime() - startTime) > 2600) {
12294
12073
  // https://github.com/b3log/vditor/issues/67
12295
- vditor.tip.show(i18n/* i18n */.a[vditor.options.lang].performanceTip.replace("${x}", time.toString()));
12074
+ vditor.tip.show(window.VditorI18n.performanceTip.replace("${x}", time.toString()));
12296
12075
  vditor.preview.element.setAttribute("data-type", "renderPerformance");
12297
12076
  }
12298
12077
  else if (vditor.preview.element.getAttribute("data-type") === "renderPerformance") {
@@ -12303,7 +12082,7 @@ var Preview = /** @class */ (function () {
12303
12082
  if (cmtFocusElement) {
12304
12083
  cmtFocusElement.classList.remove("vditor-comment--focus");
12305
12084
  }
12306
- (0,codeRender/* codeRender */.O)(vditor.preview.element.lastElementChild, vditor.options.lang);
12085
+ (0,codeRender/* codeRender */.O)(vditor.preview.element.lastElementChild);
12307
12086
  (0,highlightRender/* highlightRender */.s)(vditor.options.preview.hljs, vditor.preview.element.lastElementChild, vditor.options.cdn);
12308
12087
  (0,mermaidRender/* mermaidRender */.i)(vditor.preview.element.lastElementChild, vditor.options.cdn, vditor.options.theme);
12309
12088
  (0,flowchartRender/* flowchartRender */.P)(vditor.preview.element.lastElementChild, vditor.options.cdn);
@@ -12944,7 +12723,6 @@ var Emoji = /** @class */ (function (_super) {
12944
12723
  ;// CONCATENATED MODULE: ./src/ts/export/index.ts
12945
12724
 
12946
12725
 
12947
-
12948
12726
  var download = function (vditor, content, filename) {
12949
12727
  var aElement = document.createElement("a");
12950
12728
  if ("download" in aElement) {
@@ -12956,7 +12734,7 @@ var download = function (vditor, content, filename) {
12956
12734
  aElement.remove();
12957
12735
  }
12958
12736
  else {
12959
- vditor.tip.show(i18n/* i18n */.a[vditor.options.lang].downloadTip, 0);
12737
+ vditor.tip.show(window.VditorI18n.downloadTip, 0);
12960
12738
  }
12961
12739
  };
12962
12740
  var exportMarkdown = function (vditor) {
@@ -12964,7 +12742,7 @@ var exportMarkdown = function (vditor) {
12964
12742
  download(vditor, content, content.substr(0, 10) + ".md");
12965
12743
  };
12966
12744
  var exportPDF = function (vditor) {
12967
- vditor.tip.show(i18n/* i18n */.a[vditor.options.lang].generate, 3800);
12745
+ vditor.tip.show(window.VditorI18n.generate, 3800);
12968
12746
  var iframe = document.querySelector("iframe");
12969
12747
  iframe.contentDocument.open();
12970
12748
  iframe.contentDocument.write("<link rel=\"stylesheet\" href=\"" + vditor.options.cdn + "/dist/index.css\"/>\n<script src=\"" + vditor.options.cdn + "/dist/method.min.js\"></script>\n<div id=\"preview\"></div>\n<script>\nwindow.addEventListener(\"message\", (e) => {\n if(!e.data) {\n return;\n }\n Vditor.preview(document.getElementById('preview'), e.data, {\n markdown: {\n theme: \"" + vditor.options.preview.theme + "\"\n },\n hljs: {\n style: \"" + vditor.options.preview.hljs.style + "\"\n }\n });\n setTimeout(() => {\n window.print();\n }, 3600);\n}, false);\n</script>");
@@ -12975,7 +12753,7 @@ var exportPDF = function (vditor) {
12975
12753
  };
12976
12754
  var exportHTML = function (vditor) {
12977
12755
  var content = getHTML(vditor);
12978
- var html = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"" + vditor.options.cdn + "/dist/index.css\"/>\n<script src=\"" + vditor.options.cdn + "/dist/method.min.js\"></script></head>\n<body><div class=\"vditor-reset\" id=\"preview\">" + content + "</div>\n<script>\n const previewElement = document.getElementById('preview')\n Vditor.setContentTheme('" + vditor.options.preview.theme.current + "', '" + vditor.options.preview.theme.path + "');\n Vditor.codeRender(previewElement, '" + vditor.options.lang + "');\n Vditor.highlightRender(" + JSON.stringify(vditor.options.preview.hljs) + ", previewElement, '" + vditor.options.cdn + "');\n Vditor.mathRender(previewElement, {\n cdn: '" + vditor.options.cdn + "',\n math: " + JSON.stringify(vditor.options.preview.math) + ",\n });\n Vditor.mermaidRender(previewElement, '" + vditor.options.cdn + "', '" + vditor.options.theme + "');\n Vditor.flowchartRender(previewElement, '" + vditor.options.cdn + "');\n Vditor.graphvizRender(previewElement, '" + vditor.options.cdn + "');\n Vditor.chartRender(previewElement, '" + vditor.options.cdn + "', '" + vditor.options.theme + "');\n Vditor.mindmapRender(previewElement, '" + vditor.options.cdn + "', '" + vditor.options.theme + "');\n Vditor.abcRender(previewElement, '" + vditor.options.cdn + "');\n Vditor.mediaRender(previewElement);\n</script></body></html>";
12756
+ var html = "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"" + vditor.options.cdn + "/dist/index.css\"/>\n<script src=\"" + vditor.options.cdn + "/dist/js/i18n/" + vditor.options.lang + ".js\"></script>\n<script src=\"" + vditor.options.cdn + "/dist/method.min.js\"></script></head>\n<body><div class=\"vditor-reset\" id=\"preview\">" + content + "</div>\n<script>\n const previewElement = document.getElementById('preview')\n Vditor.setContentTheme('" + vditor.options.preview.theme.current + "', '" + vditor.options.preview.theme.path + "');\n Vditor.codeRender(previewElement);\n Vditor.highlightRender(" + JSON.stringify(vditor.options.preview.hljs) + ", previewElement, '" + vditor.options.cdn + "');\n Vditor.mathRender(previewElement, {\n cdn: '" + vditor.options.cdn + "',\n math: " + JSON.stringify(vditor.options.preview.math) + ",\n });\n Vditor.mermaidRender(previewElement, '" + vditor.options.cdn + "', '" + vditor.options.theme + "');\n Vditor.flowchartRender(previewElement, '" + vditor.options.cdn + "');\n Vditor.graphvizRender(previewElement, '" + vditor.options.cdn + "');\n Vditor.chartRender(previewElement, '" + vditor.options.cdn + "', '" + vditor.options.theme + "');\n Vditor.mindmapRender(previewElement, '" + vditor.options.cdn + "', '" + vditor.options.theme + "');\n Vditor.abcRender(previewElement, '" + vditor.options.cdn + "');\n Vditor.mediaRender(previewElement);\n Vditor.speechRender(previewElement);\n</script>\n<script src=\"" + vditor.options.cdn + "/dist/js/icons/" + vditor.options.icon + ".js\"></script></body></html>";
12979
12757
  download(vditor, html, content.substr(0, 10) + ".html");
12980
12758
  };
12981
12759
 
@@ -13137,7 +12915,7 @@ var Headings = /** @class */ (function (_super) {
13137
12915
  var _this = _super.call(this, vditor, menuItem) || this;
13138
12916
  var panelElement = document.createElement("div");
13139
12917
  panelElement.className = "vditor-hint vditor-panel--arrow";
13140
- panelElement.innerHTML = "<button data-tag=\"h1\" data-value=\"# \">Heading 1 " + (0,compatibility/* updateHotkeyTip */.ns)("&lt;⌥⌘1>") + "</button>\n<button data-tag=\"h2\" data-value=\"## \">Heading 2 &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘2") + "></button>\n<button data-tag=\"h3\" data-value=\"### \">Heading 3 &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘3") + "></button>\n<button data-tag=\"h4\" data-value=\"#### \">Heading 4 &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘4") + "></button>\n<button data-tag=\"h5\" data-value=\"##### \">Heading 5 &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘5") + "></button>\n<button data-tag=\"h6\" data-value=\"###### \">Heading 6 &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘6") + "></button>";
12918
+ panelElement.innerHTML = "<button data-tag=\"h1\" data-value=\"# \">" + window.VditorI18n.heading1 + " " + (0,compatibility/* updateHotkeyTip */.ns)("&lt;⌥⌘1>") + "</button>\n<button data-tag=\"h2\" data-value=\"## \">" + window.VditorI18n.heading2 + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘2") + "></button>\n<button data-tag=\"h3\" data-value=\"### \">" + window.VditorI18n.heading3 + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘3") + "></button>\n<button data-tag=\"h4\" data-value=\"#### \">" + window.VditorI18n.heading4 + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘4") + "></button>\n<button data-tag=\"h5\" data-value=\"##### \">" + window.VditorI18n.heading5 + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘5") + "></button>\n<button data-tag=\"h6\" data-value=\"###### \">" + window.VditorI18n.heading6 + " &lt;" + (0,compatibility/* updateHotkeyTip */.ns)("⌥⌘6") + "></button>";
13141
12919
  _this.element.appendChild(panelElement);
13142
12920
  _this._bindEvent(vditor, panelElement);
13143
12921
  return _this;
@@ -13283,7 +13061,7 @@ var Info = /** @class */ (function (_super) {
13283
13061
  var _this = _super.call(this, vditor, menuItem) || this;
13284
13062
  _this.element.children[0].addEventListener((0,compatibility/* getEventName */.Le)(), function (event) {
13285
13063
  event.preventDefault();
13286
- vditor.tip.show("<div style=\"max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;\">\n<p style=\"text-align: center;margin: 14px 0\">\n <em>\u4E0B\u4E00\u4EE3\u7684 Markdown \u7F16\u8F91\u5668\uFF0C\u4E3A\u672A\u6765\u800C\u6784\u5EFA</em>\n</p>\n<div style=\"display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center\">\n <img src=\"https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png\" style=\"margin: 0 auto;height: 68px\"/>\n <div>&nbsp;&nbsp;</div>\n <div style=\"flex: 1;min-width: 250px\">\n Vditor \u662F\u4E00\u6B3E\u6D4F\u89C8\u5668\u7AEF\u7684 Markdown \u7F16\u8F91\u5668\uFF0C\u652F\u6301\u6240\u89C1\u5373\u6240\u5F97\u3001\u5373\u65F6\u6E32\u67D3\uFF08\u7C7B\u4F3C Typora\uFF09\u548C\u5206\u5C4F\u9884\u89C8\u6A21\u5F0F\u3002\n \u5B83\u4F7F\u7528 TypeScript \u5B9E\u73B0\uFF0C\u652F\u6301\u539F\u751F JavaScript\u3001Vue\u3001React\u3001Angular\uFF0C\u63D0\u4F9B<a target=\"_blank\" href=\"https://b3log.org/siyuan\">\u684C\u9762\u7248</a>\u3002\n </div>\n</div>\n<div style=\"display: flex;flex-wrap: wrap;\">\n <ul style=\"list-style: none;flex: 1;min-width:148px\">\n <li>\n \u9879\u76EE\u5730\u5740\uFF1A<a href=\"https://b3log.org/vditor\" target=\"_blank\">b3log.org/vditor</a>\n </li>\n <li>\n \u5F00\u6E90\u534F\u8BAE\uFF1AMIT\n </li>\n </ul>\n <ul style=\"list-style: none;margin-right: 18px\">\n <li>\n \u7EC4\u4EF6\u7248\u672C\uFF1AVditor v" + constants/* VDITOR_VERSION */.H + " / Lute v" + Lute.Version + "\n </li>\n <li>\n \u8D5E\u52A9\u6350\u8D60\uFF1A<a href=\"https://ld246.com/sponsor\" target=\"_blank\">https://ld246.com/sponsor</a>\n </li>\n </ul>\n</div>\n</div>", 0);
13064
+ vditor.tip.show("<div style=\"max-width: 520px; font-size: 14px;line-height: 22px;margin-bottom: 14px;\">\n<p style=\"text-align: center;margin: 14px 0\">\n <em>\u4E0B\u4E00\u4EE3\u7684 Markdown \u7F16\u8F91\u5668\uFF0C\u4E3A\u672A\u6765\u800C\u6784\u5EFA</em>\n</p>\n<div style=\"display: flex;margin-bottom: 14px;flex-wrap: wrap;align-items: center\">\n <img src=\"https://cdn.jsdelivr.net/npm/vditor/src/assets/images/logo.png\" style=\"margin: 0 auto;height: 68px\"/>\n <div>&nbsp;&nbsp;</div>\n <div style=\"flex: 1;min-width: 250px\">\n Vditor \u662F\u4E00\u6B3E\u6D4F\u89C8\u5668\u7AEF\u7684 Markdown \u7F16\u8F91\u5668\uFF0C\u652F\u6301\u6240\u89C1\u5373\u6240\u5F97\u3001\u5373\u65F6\u6E32\u67D3\uFF08\u7C7B\u4F3C Typora\uFF09\u548C\u5206\u5C4F\u9884\u89C8\u6A21\u5F0F\u3002\n \u5B83\u4F7F\u7528 TypeScript \u5B9E\u73B0\uFF0C\u652F\u6301\u539F\u751F JavaScript \u4EE5\u53CA Vue\u3001React\u3001Angular \u548C Svelte \u7B49\u6846\u67B6\u3002\n </div>\n</div>\n<div style=\"display: flex;flex-wrap: wrap;\">\n <ul style=\"list-style: none;flex: 1;min-width:148px\">\n <li>\n \u9879\u76EE\u5730\u5740\uFF1A<a href=\"https://b3log.org/vditor\" target=\"_blank\">b3log.org/vditor</a>\n </li>\n <li>\n \u5F00\u6E90\u534F\u8BAE\uFF1AMIT\n </li>\n </ul>\n <ul style=\"list-style: none;margin-right: 18px\">\n <li>\n \u7EC4\u4EF6\u7248\u672C\uFF1AVditor v" + constants/* VDITOR_VERSION */.H + " / Lute v" + Lute.Version + "\n </li>\n <li>\n \u8D5E\u52A9\u6350\u8D60\uFF1A<a href=\"https://ld246.com/sponsor\" target=\"_blank\">https://ld246.com/sponsor</a>\n </li>\n </ul>\n</div>\n</div>", 0);
13287
13065
  });
13288
13066
  return _this;
13289
13067
  }
@@ -13685,7 +13463,6 @@ var Record_extends = (undefined && undefined.__extends) || (function () {
13685
13463
 
13686
13464
 
13687
13465
 
13688
-
13689
13466
  var Record = /** @class */ (function (_super) {
13690
13467
  Record_extends(Record, _super);
13691
13468
  function Record(vditor, menuItem) {
@@ -13716,11 +13493,11 @@ var Record = /** @class */ (function (_super) {
13716
13493
  mediaRecorder.cloneChannelData(left, right);
13717
13494
  };
13718
13495
  mediaRecorder.startRecordingNewWavFile();
13719
- vditor.tip.show(i18n/* i18n */.a[vditor.options.lang].recording);
13496
+ vditor.tip.show(window.VditorI18n.recording);
13720
13497
  editorElement.setAttribute("contenteditable", "false");
13721
13498
  _this.element.children[0].classList.add("vditor-menu--current");
13722
13499
  }).catch(function () {
13723
- vditor.tip.show(i18n/* i18n */.a[vditor.options.lang]["record-tip"]);
13500
+ vditor.tip.show(window.VditorI18n["record-tip"]);
13724
13501
  });
13725
13502
  return;
13726
13503
  }
@@ -13732,7 +13509,7 @@ var Record = /** @class */ (function (_super) {
13732
13509
  _this.element.children[0].classList.remove("vditor-menu--current");
13733
13510
  }
13734
13511
  else {
13735
- vditor.tip.show(i18n/* i18n */.a[vditor.options.lang].recording);
13512
+ vditor.tip.show(window.VditorI18n.recording);
13736
13513
  editorElement.setAttribute("contenteditable", "false");
13737
13514
  mediaRecorder.startRecordingNewWavFile();
13738
13515
  _this.element.children[0].classList.add("vditor-menu--current");
@@ -14387,7 +14164,7 @@ var Options = /** @class */ (function () {
14387
14164
  "info",
14388
14165
  "help",
14389
14166
  ],
14390
- }
14167
+ },
14391
14168
  ],
14392
14169
  toolbarConfig: {
14393
14170
  hide: false,
@@ -14437,204 +14214,247 @@ var Options = /** @class */ (function () {
14437
14214
  };
14438
14215
  Options.prototype.mergeToolbar = function (toolbar) {
14439
14216
  var _this = this;
14440
- var toolbarItem = [{
14217
+ var toolbarItem = [
14218
+ {
14441
14219
  icon: '<svg><use xlink:href="#vditor-icon-export"></use></svg>',
14442
14220
  name: "export",
14443
14221
  tipPosition: "ne",
14444
- }, {
14222
+ },
14223
+ {
14445
14224
  hotkey: "⌘E",
14446
14225
  icon: '<svg><use xlink:href="#vditor-icon-emoji"></use></svg>',
14447
14226
  name: "emoji",
14448
14227
  tipPosition: "ne",
14449
- }, {
14228
+ },
14229
+ {
14450
14230
  hotkey: "⌘H",
14451
14231
  icon: '<svg><use xlink:href="#vditor-icon-headings"></use></svg>',
14452
14232
  name: "headings",
14453
14233
  tipPosition: "ne",
14454
- }, {
14234
+ },
14235
+ {
14455
14236
  hotkey: "⌘B",
14456
14237
  icon: '<svg><use xlink:href="#vditor-icon-bold"></use></svg>',
14457
14238
  name: "bold",
14458
14239
  prefix: "**",
14459
14240
  suffix: "**",
14460
14241
  tipPosition: "ne",
14461
- }, {
14242
+ },
14243
+ {
14462
14244
  hotkey: "⌘I",
14463
14245
  icon: '<svg><use xlink:href="#vditor-icon-italic"></use></svg>',
14464
14246
  name: "italic",
14465
14247
  prefix: "*",
14466
14248
  suffix: "*",
14467
14249
  tipPosition: "ne",
14468
- }, {
14250
+ },
14251
+ {
14469
14252
  hotkey: "⌘D",
14470
14253
  icon: '<svg><use xlink:href="#vditor-icon-strike"></use></svg>',
14471
14254
  name: "strike",
14472
14255
  prefix: "~~",
14473
14256
  suffix: "~~",
14474
14257
  tipPosition: "ne",
14475
- }, {
14258
+ },
14259
+ {
14476
14260
  hotkey: "⌘K",
14477
14261
  icon: '<svg><use xlink:href="#vditor-icon-link"></use></svg>',
14478
14262
  name: "link",
14479
14263
  prefix: "[",
14480
14264
  suffix: "](https://)",
14481
14265
  tipPosition: "n",
14482
- }, {
14266
+ },
14267
+ {
14483
14268
  name: "|",
14484
- }, {
14269
+ },
14270
+ {
14485
14271
  hotkey: "⌘L",
14486
14272
  icon: '<svg><use xlink:href="#vditor-icon-list"></use></svg>',
14487
14273
  name: "list",
14488
14274
  prefix: "* ",
14489
14275
  tipPosition: "n",
14490
- }, {
14276
+ },
14277
+ {
14491
14278
  hotkey: "⌘O",
14492
14279
  icon: '<svg><use xlink:href="#vditor-icon-ordered-list"></use></svg>',
14493
14280
  name: "ordered-list",
14494
14281
  prefix: "1. ",
14495
14282
  tipPosition: "n",
14496
- }, {
14283
+ },
14284
+ {
14497
14285
  hotkey: "⌘J",
14498
14286
  icon: '<svg><use xlink:href="#vditor-icon-check"></use></svg>',
14499
14287
  name: "check",
14500
14288
  prefix: "* [ ] ",
14501
14289
  tipPosition: "n",
14502
- }, {
14290
+ },
14291
+ {
14503
14292
  hotkey: "⇧⌘I",
14504
14293
  icon: '<svg><use xlink:href="#vditor-icon-outdent"></use></svg>',
14505
14294
  name: "outdent",
14506
14295
  tipPosition: "n",
14507
- }, {
14296
+ },
14297
+ {
14508
14298
  hotkey: "⇧⌘O",
14509
14299
  icon: '<svg><use xlink:href="#vditor-icon-indent"></use></svg>',
14510
14300
  name: "indent",
14511
14301
  tipPosition: "n",
14512
- }, {
14302
+ },
14303
+ {
14513
14304
  name: "|",
14514
- }, {
14305
+ },
14306
+ {
14515
14307
  hotkey: "⌘;",
14516
14308
  icon: '<svg><use xlink:href="#vditor-icon-quote"></use></svg>',
14517
14309
  name: "quote",
14518
14310
  prefix: "> ",
14519
14311
  tipPosition: "n",
14520
- }, {
14312
+ },
14313
+ {
14521
14314
  hotkey: "⇧⌘H",
14522
14315
  icon: '<svg><use xlink:href="#vditor-icon-line"></use></svg>',
14523
14316
  name: "line",
14524
14317
  prefix: "---",
14525
14318
  tipPosition: "n",
14526
- }, {
14319
+ },
14320
+ {
14527
14321
  hotkey: "⌘U",
14528
14322
  icon: '<svg><use xlink:href="#vditor-icon-code"></use></svg>',
14529
14323
  name: "code",
14530
14324
  prefix: "```",
14531
14325
  suffix: "\n```",
14532
14326
  tipPosition: "n",
14533
- }, {
14327
+ },
14328
+ {
14534
14329
  hotkey: "⌘G",
14535
14330
  icon: '<svg><use xlink:href="#vditor-icon-inline-code"></use></svg>',
14536
14331
  name: "inline-code",
14537
14332
  prefix: "`",
14538
14333
  suffix: "`",
14539
14334
  tipPosition: "n",
14540
- }, {
14335
+ },
14336
+ {
14541
14337
  hotkey: "⇧⌘B",
14542
14338
  icon: '<svg><use xlink:href="#vditor-icon-before"></use></svg>',
14543
14339
  name: "insert-before",
14544
14340
  tipPosition: "n",
14545
- }, {
14341
+ },
14342
+ {
14546
14343
  hotkey: "⇧⌘E",
14547
14344
  icon: '<svg><use xlink:href="#vditor-icon-after"></use></svg>',
14548
14345
  name: "insert-after",
14549
14346
  tipPosition: "n",
14550
- }, {
14347
+ },
14348
+ {
14551
14349
  name: "|",
14552
- }, {
14350
+ },
14351
+ {
14553
14352
  icon: '<svg><use xlink:href="#vditor-icon-upload"></use></svg>',
14554
14353
  name: "upload",
14555
14354
  tipPosition: "n",
14556
- }, {
14355
+ },
14356
+ {
14557
14357
  icon: '<svg><use xlink:href="#vditor-icon-record"></use></svg>',
14558
14358
  name: "record",
14559
14359
  tipPosition: "n",
14560
- }, {
14360
+ },
14361
+ {
14561
14362
  hotkey: "⌘M",
14562
14363
  icon: '<svg><use xlink:href="#vditor-icon-table"></use></svg>',
14563
14364
  name: "table",
14564
14365
  prefix: "| col1",
14565
14366
  suffix: " | col2 | col3 |\n| --- | --- | --- |\n| | | |\n| | | |",
14566
14367
  tipPosition: "n",
14567
- }, {
14368
+ },
14369
+ {
14568
14370
  name: "|",
14569
- }, {
14371
+ },
14372
+ {
14570
14373
  hotkey: "⌘Z",
14571
14374
  icon: '<svg><use xlink:href="#vditor-icon-undo"></use></svg>',
14572
14375
  name: "undo",
14573
14376
  tipPosition: "nw",
14574
- }, {
14377
+ },
14378
+ {
14575
14379
  hotkey: "⌘Y",
14576
14380
  icon: '<svg><use xlink:href="#vditor-icon-redo"></use></svg>',
14577
14381
  name: "redo",
14578
14382
  tipPosition: "nw",
14579
- }, {
14383
+ },
14384
+ {
14580
14385
  name: "|",
14581
- }, {
14386
+ },
14387
+ {
14582
14388
  icon: '<svg><use xlink:href="#vditor-icon-more"></use></svg>',
14583
14389
  name: "more",
14584
14390
  tipPosition: "e",
14585
- }, {
14391
+ },
14392
+ {
14586
14393
  hotkey: "⌘'",
14587
14394
  icon: '<svg><use xlink:href="#vditor-icon-fullscreen"></use></svg>',
14588
14395
  name: "fullscreen",
14589
14396
  tipPosition: "nw",
14590
- }, {
14397
+ },
14398
+ {
14591
14399
  icon: '<svg><use xlink:href="#vditor-icon-edit"></use></svg>',
14592
14400
  name: "edit-mode",
14593
14401
  tipPosition: "nw",
14594
- }, {
14402
+ },
14403
+ {
14595
14404
  hotkey: "⌘P",
14596
14405
  icon: '<svg><use xlink:href="#vditor-icon-both"></use></svg>',
14597
14406
  name: "both",
14598
14407
  tipPosition: "nw",
14599
- }, {
14408
+ },
14409
+ {
14600
14410
  icon: '<svg><use xlink:href="#vditor-icon-preview"></use></svg>',
14601
14411
  name: "preview",
14602
14412
  tipPosition: "nw",
14603
- }, {
14413
+ },
14414
+ {
14604
14415
  icon: '<svg><use xlink:href="#vditor-icon-align-center"></use></svg>',
14605
14416
  name: "outline",
14606
14417
  tipPosition: "nw",
14607
- }, {
14418
+ },
14419
+ {
14608
14420
  icon: '<svg><use xlink:href="#vditor-icon-theme"></use></svg>',
14609
14421
  name: "content-theme",
14610
14422
  tipPosition: "nw",
14611
- }, {
14423
+ },
14424
+ {
14612
14425
  icon: '<svg><use xlink:href="#vditor-icon-code-theme"></use></svg>',
14613
14426
  name: "code-theme",
14614
14427
  tipPosition: "nw",
14615
- }, {
14428
+ },
14429
+ {
14616
14430
  icon: '<svg><use xlink:href="#vditor-icon-bug"></use></svg>',
14617
14431
  name: "devtools",
14618
14432
  tipPosition: "nw",
14619
- }, {
14433
+ },
14434
+ {
14620
14435
  icon: '<svg><use xlink:href="#vditor-icon-info"></use></svg>',
14621
14436
  name: "info",
14622
14437
  tipPosition: "nw",
14623
- }, {
14438
+ },
14439
+ {
14624
14440
  icon: '<svg><use xlink:href="#vditor-icon-help"></use></svg>',
14625
14441
  name: "help",
14626
14442
  tipPosition: "nw",
14627
- }, {
14443
+ },
14444
+ {
14628
14445
  name: "br",
14629
- }];
14446
+ },
14447
+ ];
14630
14448
  var toolbarResult = [];
14631
14449
  toolbar.forEach(function (menuItem) {
14632
14450
  var currentMenuItem = menuItem;
14633
14451
  toolbarItem.forEach(function (defaultMenuItem) {
14634
- if (typeof menuItem === "string" && defaultMenuItem.name === menuItem) {
14452
+ if (typeof menuItem === "string" &&
14453
+ defaultMenuItem.name === menuItem) {
14635
14454
  currentMenuItem = defaultMenuItem;
14636
14455
  }
14637
- if (typeof menuItem === "object" && defaultMenuItem.name === menuItem.name) {
14456
+ if (typeof menuItem === "object" &&
14457
+ defaultMenuItem.name === menuItem.name) {
14638
14458
  currentMenuItem = Object.assign({}, defaultMenuItem, menuItem);
14639
14459
  }
14640
14460
  });
@@ -14664,7 +14484,6 @@ var Options = /** @class */ (function () {
14664
14484
 
14665
14485
 
14666
14486
 
14667
-
14668
14487
  var WYSIWYG = /** @class */ (function () {
14669
14488
  function WYSIWYG(vditor) {
14670
14489
  var _this = this;
@@ -14672,7 +14491,7 @@ var WYSIWYG = /** @class */ (function () {
14672
14491
  this.commentIds = [];
14673
14492
  var divElement = document.createElement("div");
14674
14493
  divElement.className = "vditor-wysiwyg";
14675
- divElement.innerHTML = "<pre class=\"vditor-reset\" placeholder=\"" + vditor.options.placeholder + "\"\n contenteditable=\"true\" spellcheck=\"false\"></pre>\n<div class=\"vditor-panel vditor-panel--none\"></div>\n<div class=\"vditor-panel vditor-panel--none\">\n <button type=\"button\" aria-label=\"" + i18n/* i18n */.a[vditor.options.lang].comment + "\" class=\"vditor-icon vditor-tooltipped vditor-tooltipped__n\">\n <svg><use xlink:href=\"#vditor-icon-comment\"></use></svg>\n </button>\n</div>";
14494
+ divElement.innerHTML = "<pre class=\"vditor-reset\" placeholder=\"" + vditor.options.placeholder + "\"\n contenteditable=\"true\" spellcheck=\"false\"></pre>\n<div class=\"vditor-panel vditor-panel--none\"></div>\n<div class=\"vditor-panel vditor-panel--none\">\n <button type=\"button\" aria-label=\"" + window.VditorI18n.comment + "\" class=\"vditor-icon vditor-tooltipped vditor-tooltipped__n\">\n <svg><use xlink:href=\"#vditor-icon-comment\"></use></svg>\n </button>\n</div>";
14676
14495
  this.element = divElement.firstElementChild;
14677
14496
  this.popover = divElement.firstElementChild.nextElementSibling;
14678
14497
  this.selectPopover = divElement.lastElementChild;
@@ -14816,6 +14635,9 @@ var WYSIWYG = /** @class */ (function () {
14816
14635
  WYSIWYG.prototype.hideComment = function () {
14817
14636
  this.selectPopover.setAttribute("style", "display:none");
14818
14637
  };
14638
+ WYSIWYG.prototype.unbindListener = function () {
14639
+ window.removeEventListener("scroll", this.scrollListener);
14640
+ };
14819
14641
  WYSIWYG.prototype.copy = function (event, vditor) {
14820
14642
  var range = getSelection().getRangeAt(0);
14821
14643
  if (range.toString() === "") {
@@ -14855,7 +14677,8 @@ var WYSIWYG = /** @class */ (function () {
14855
14677
  };
14856
14678
  WYSIWYG.prototype.bindEvent = function (vditor) {
14857
14679
  var _this = this;
14858
- window.addEventListener("scroll", function () {
14680
+ this.unbindListener();
14681
+ window.addEventListener("scroll", this.scrollListener = function () {
14859
14682
  hidePanel(vditor, ["hint"]);
14860
14683
  if (_this.popover.style.display !== "block" || _this.selectPopover.style.display !== "block") {
14861
14684
  return;
@@ -15192,7 +15015,6 @@ var src_extends = (undefined && undefined.__extends) || (function () {
15192
15015
 
15193
15016
 
15194
15017
 
15195
-
15196
15018
 
15197
15019
 
15198
15020
  var Vditor = /** @class */ (function (_super) {
@@ -15222,63 +15044,28 @@ var Vditor = /** @class */ (function (_super) {
15222
15044
  }
15223
15045
  var getOptions = new Options(options);
15224
15046
  var mergedOptions = getOptions.merge();
15225
- if (!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) {
15226
- throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
15227
- }
15228
- _this.vditor = {
15229
- currentMode: mergedOptions.mode,
15230
- element: id,
15231
- hint: new Hint(mergedOptions.hint.extend),
15232
- lute: undefined,
15233
- options: mergedOptions,
15234
- originalInnerHTML: id.innerHTML,
15235
- outline: new Outline(i18n/* i18n */.a[mergedOptions.lang].outline),
15236
- tip: new Tip(),
15237
- };
15238
- _this.vditor.sv = new Editor(_this.vditor);
15239
- _this.vditor.undo = new undo_Undo();
15240
- _this.vditor.wysiwyg = new WYSIWYG(_this.vditor);
15241
- _this.vditor.ir = new IR(_this.vditor);
15242
- _this.vditor.toolbar = new Toolbar(_this.vditor);
15243
- if (mergedOptions.resize.enable) {
15244
- _this.vditor.resize = new Resize(_this.vditor);
15245
- }
15246
- if (_this.vditor.toolbar.elements.devtools) {
15247
- _this.vditor.devtools = new DevTools();
15248
- }
15249
- if (mergedOptions.upload.url || mergedOptions.upload.handler) {
15250
- _this.vditor.upload = new Upload();
15251
- }
15252
- (0,addScript/* addScript */.G)(options._lutePath || mergedOptions.cdn + "/dist/js/lute/lute.min.js", "vditorLuteScript")
15253
- .then(function () {
15254
- _this.vditor.lute = (0,setLute/* setLute */.X)({
15255
- autoSpace: _this.vditor.options.preview.markdown.autoSpace,
15256
- codeBlockPreview: _this.vditor.options.preview.markdown.codeBlockPreview,
15257
- emojiSite: _this.vditor.options.hint.emojiPath,
15258
- emojis: _this.vditor.options.hint.emoji,
15259
- fixTermTypo: _this.vditor.options.preview.markdown.fixTermTypo,
15260
- footnotes: _this.vditor.options.preview.markdown.footnotes,
15261
- headingAnchor: false,
15262
- inlineMathDigit: _this.vditor.options.preview.math.inlineDigit,
15263
- linkBase: _this.vditor.options.preview.markdown.linkBase,
15264
- linkPrefix: _this.vditor.options.preview.markdown.linkPrefix,
15265
- listStyle: _this.vditor.options.preview.markdown.listStyle,
15266
- mark: _this.vditor.options.preview.markdown.mark,
15267
- mathBlockPreview: _this.vditor.options.preview.markdown.mathBlockPreview,
15268
- paragraphBeginningSpace: _this.vditor.options.preview.markdown.paragraphBeginningSpace,
15269
- sanitize: _this.vditor.options.preview.markdown.sanitize,
15270
- toc: _this.vditor.options.preview.markdown.toc,
15271
- });
15272
- _this.vditor.preview = new Preview(_this.vditor);
15273
- initUI(_this.vditor);
15274
- if (mergedOptions.after) {
15275
- mergedOptions.after();
15047
+ // 支持自定义国际化
15048
+ if (!mergedOptions.i18n) {
15049
+ if (!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) {
15050
+ throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
15276
15051
  }
15277
- if (mergedOptions.icon) {
15278
- // 防止初始化 2 个编辑器时加载 2 次
15279
- (0,addScript/* addScriptSync */.J)(mergedOptions.cdn + "/dist/js/icons/" + mergedOptions.icon + ".js", "vditorIconScript");
15052
+ else {
15053
+ var i18nScriptPrefix = "vditorI18nScript";
15054
+ var i18nScriptID_1 = i18nScriptPrefix + mergedOptions.lang;
15055
+ document.querySelectorAll("head script[id^=\"" + i18nScriptPrefix + "\"]").forEach(function (el) {
15056
+ if (el.id !== i18nScriptID_1) {
15057
+ document.head.removeChild(el);
15058
+ }
15059
+ });
15060
+ (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/i18n/" + mergedOptions.lang + ".js", i18nScriptID_1).then(function () {
15061
+ _this.init(id, mergedOptions);
15062
+ });
15280
15063
  }
15281
- });
15064
+ }
15065
+ else {
15066
+ window.VditorI18n = mergedOptions.i18n;
15067
+ _this.init(id, mergedOptions);
15068
+ }
15282
15069
  return _this;
15283
15070
  }
15284
15071
  /** 设置主题 */
@@ -15329,14 +15116,12 @@ var Vditor = /** @class */ (function (_super) {
15329
15116
  /** 禁用编辑器 */
15330
15117
  Vditor.prototype.disabled = function () {
15331
15118
  hidePanel(this.vditor, ["subToolbar", "hint", "popover"]);
15332
- disableToolbar(this.vditor.toolbar.elements, constants/* Constants.EDIT_TOOLBARS.concat */.g.EDIT_TOOLBARS.concat(["undo", "redo", "fullscreen",
15333
- "edit-mode"]));
15119
+ disableToolbar(this.vditor.toolbar.elements, constants/* Constants.EDIT_TOOLBARS.concat */.g.EDIT_TOOLBARS.concat(["undo", "redo", "fullscreen", "edit-mode"]));
15334
15120
  this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable", "false");
15335
15121
  };
15336
15122
  /** 解除编辑器禁用 */
15337
15123
  Vditor.prototype.enable = function () {
15338
- enableToolbar(this.vditor.toolbar.elements, constants/* Constants.EDIT_TOOLBARS.concat */.g.EDIT_TOOLBARS.concat(["undo", "redo", "fullscreen",
15339
- "edit-mode"]));
15124
+ enableToolbar(this.vditor.toolbar.elements, constants/* Constants.EDIT_TOOLBARS.concat */.g.EDIT_TOOLBARS.concat(["undo", "redo", "fullscreen", "edit-mode"]));
15340
15125
  this.vditor.undo.resetIcon(this.vditor);
15341
15126
  this.vditor[this.vditor.currentMode].element.setAttribute("contenteditable", "true");
15342
15127
  };
@@ -15376,7 +15161,6 @@ var Vditor = /** @class */ (function (_super) {
15376
15161
  Vditor.prototype.enableCache = function () {
15377
15162
  if (!this.vditor.options.cache.id) {
15378
15163
  throw new Error("need options.cache.id, see https://ld246.com/article/1549638745630#options");
15379
- return;
15380
15164
  }
15381
15165
  this.vditor.options.cache.enable = true;
15382
15166
  };
@@ -15384,6 +15168,10 @@ var Vditor = /** @class */ (function (_super) {
15384
15168
  Vditor.prototype.html2md = function (value) {
15385
15169
  return this.vditor.lute.HTML2Md(value);
15386
15170
  };
15171
+ /** markdown 转 JSON 输出 */
15172
+ Vditor.prototype.exportJSON = function (value) {
15173
+ return this.vditor.lute.RenderJSON(value);
15174
+ };
15387
15175
  /** 获取 HTML */
15388
15176
  Vditor.prototype.getHTML = function () {
15389
15177
  return getHTML(this.vditor);
@@ -15455,7 +15243,9 @@ var Vditor = /** @class */ (function (_super) {
15455
15243
  }
15456
15244
  else {
15457
15245
  this.vditor.ir.element.innerHTML = this.vditor.lute.Md2VditorIRDOM(markdown);
15458
- this.vditor.ir.element.querySelectorAll(".vditor-ir__preview[data-render='2']").forEach(function (item) {
15246
+ this.vditor.ir.element
15247
+ .querySelectorAll(".vditor-ir__preview[data-render='2']")
15248
+ .forEach(function (item) {
15459
15249
  processCodeRender(item, _this.vditor);
15460
15250
  });
15461
15251
  process_processAfterRender(this.vditor, {
@@ -15488,6 +15278,8 @@ var Vditor = /** @class */ (function (_super) {
15488
15278
  this.vditor.element.removeAttribute("style");
15489
15279
  document.getElementById("vditorIconScript").remove();
15490
15280
  this.clearCache();
15281
+ UIUnbindListener();
15282
+ this.vditor.wysiwyg.unbindListener();
15491
15283
  };
15492
15284
  /** 获取评论 ID */
15493
15285
  Vditor.prototype.getCommentIds = function () {
@@ -15509,11 +15301,15 @@ var Vditor = /** @class */ (function (_super) {
15509
15301
  }
15510
15302
  });
15511
15303
  };
15512
- this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function (item) {
15304
+ this.vditor.wysiwyg.element
15305
+ .querySelectorAll(".vditor-comment")
15306
+ .forEach(function (item) {
15513
15307
  hlItem(item);
15514
15308
  });
15515
15309
  if (this.vditor.preview.element.style.display !== "none") {
15516
- this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function (item) {
15310
+ this.vditor.preview.element
15311
+ .querySelectorAll(".vditor-comment")
15312
+ .forEach(function (item) {
15517
15313
  hlItem(item);
15518
15314
  });
15519
15315
  }
@@ -15530,11 +15326,15 @@ var Vditor = /** @class */ (function (_super) {
15530
15326
  }
15531
15327
  });
15532
15328
  };
15533
- this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function (item) {
15329
+ this.vditor.wysiwyg.element
15330
+ .querySelectorAll(".vditor-comment")
15331
+ .forEach(function (item) {
15534
15332
  unHlItem(item);
15535
15333
  });
15536
15334
  if (this.vditor.preview.element.style.display !== "none") {
15537
- this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function (item) {
15335
+ this.vditor.preview.element
15336
+ .querySelectorAll(".vditor-comment")
15337
+ .forEach(function (item) {
15538
15338
  unHlItem(item);
15539
15339
  });
15540
15340
  }
@@ -15562,11 +15362,15 @@ var Vditor = /** @class */ (function (_super) {
15562
15362
  }
15563
15363
  };
15564
15364
  removeIds.forEach(function (removeId) {
15565
- _this.vditor.wysiwyg.element.querySelectorAll(".vditor-comment").forEach(function (item) {
15365
+ _this.vditor.wysiwyg.element
15366
+ .querySelectorAll(".vditor-comment")
15367
+ .forEach(function (item) {
15566
15368
  removeItem(item, removeId);
15567
15369
  });
15568
15370
  if (_this.vditor.preview.element.style.display !== "none") {
15569
- _this.vditor.preview.element.querySelectorAll(".vditor-comment").forEach(function (item) {
15371
+ _this.vditor.preview.element
15372
+ .querySelectorAll(".vditor-comment")
15373
+ .forEach(function (item) {
15570
15374
  removeItem(item, removeId);
15571
15375
  });
15572
15376
  }
@@ -15577,13 +15381,73 @@ var Vditor = /** @class */ (function (_super) {
15577
15381
  enableInput: false,
15578
15382
  });
15579
15383
  };
15384
+ Vditor.prototype.init = function (id, mergedOptions) {
15385
+ var _this = this;
15386
+ this.vditor = {
15387
+ currentMode: mergedOptions.mode,
15388
+ element: id,
15389
+ hint: new Hint(mergedOptions.hint.extend),
15390
+ lute: undefined,
15391
+ options: mergedOptions,
15392
+ originalInnerHTML: id.innerHTML,
15393
+ outline: new Outline(window.VditorI18n.outline),
15394
+ tip: new Tip(),
15395
+ };
15396
+ this.vditor.sv = new Editor(this.vditor);
15397
+ this.vditor.undo = new undo_Undo();
15398
+ this.vditor.wysiwyg = new WYSIWYG(this.vditor);
15399
+ this.vditor.ir = new IR(this.vditor);
15400
+ this.vditor.toolbar = new Toolbar(this.vditor);
15401
+ if (mergedOptions.resize.enable) {
15402
+ this.vditor.resize = new Resize(this.vditor);
15403
+ }
15404
+ if (this.vditor.toolbar.elements.devtools) {
15405
+ this.vditor.devtools = new DevTools();
15406
+ }
15407
+ if (mergedOptions.upload.url || mergedOptions.upload.handler) {
15408
+ this.vditor.upload = new Upload();
15409
+ }
15410
+ (0,addScript/* addScript */.G)(mergedOptions._lutePath ||
15411
+ mergedOptions.cdn + "/dist/js/lute/lute.min.js", "vditorLuteScript").then(function () {
15412
+ _this.vditor.lute = (0,setLute/* setLute */.X)({
15413
+ autoSpace: _this.vditor.options.preview.markdown.autoSpace,
15414
+ codeBlockPreview: _this.vditor.options.preview.markdown
15415
+ .codeBlockPreview,
15416
+ emojiSite: _this.vditor.options.hint.emojiPath,
15417
+ emojis: _this.vditor.options.hint.emoji,
15418
+ fixTermTypo: _this.vditor.options.preview.markdown.fixTermTypo,
15419
+ footnotes: _this.vditor.options.preview.markdown.footnotes,
15420
+ headingAnchor: false,
15421
+ inlineMathDigit: _this.vditor.options.preview.math.inlineDigit,
15422
+ linkBase: _this.vditor.options.preview.markdown.linkBase,
15423
+ linkPrefix: _this.vditor.options.preview.markdown.linkPrefix,
15424
+ listStyle: _this.vditor.options.preview.markdown.listStyle,
15425
+ mark: _this.vditor.options.preview.markdown.mark,
15426
+ mathBlockPreview: _this.vditor.options.preview.markdown
15427
+ .mathBlockPreview,
15428
+ paragraphBeginningSpace: _this.vditor.options.preview.markdown
15429
+ .paragraphBeginningSpace,
15430
+ sanitize: _this.vditor.options.preview.markdown.sanitize,
15431
+ toc: _this.vditor.options.preview.markdown.toc,
15432
+ });
15433
+ _this.vditor.preview = new Preview(_this.vditor);
15434
+ initUI(_this.vditor);
15435
+ if (mergedOptions.after) {
15436
+ mergedOptions.after();
15437
+ }
15438
+ if (mergedOptions.icon) {
15439
+ // 防止初始化 2 个编辑器时加载 2 次
15440
+ (0,addScript/* addScriptSync */.J)(mergedOptions.cdn + "/dist/js/icons/" + mergedOptions.icon + ".js", "vditorIconScript");
15441
+ }
15442
+ });
15443
+ };
15580
15444
  return Vditor;
15581
- }(method.default));
15445
+ }(method["default"]));
15582
15446
  /* harmony default export */ const src = (Vditor);
15583
15447
 
15584
15448
  })();
15585
15449
 
15586
- __webpack_exports__ = __webpack_exports__.default;
15450
+ __webpack_exports__ = __webpack_exports__["default"];
15587
15451
  /******/ return __webpack_exports__;
15588
15452
  /******/ })()
15589
15453
  ;