vditor 3.8.8 → 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.
package/dist/index.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v3.8.8 - 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
  *
package/dist/index.min.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v3.8.8 - 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
  *
@@ -2735,24 +2735,26 @@ var previewRender = function (previewElement, markdown, options) { return __awai
2735
2735
  }
2736
2736
  previewElement.innerHTML = html;
2737
2737
  previewElement.classList.add("vditor-reset");
2738
- if (!mergedOptions.i18n) {
2739
- if (!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) {
2740
- throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
2741
- }
2742
- else {
2743
- i18nScriptPrefix = "vditorI18nScript";
2744
- i18nScriptID_1 = i18nScriptPrefix + mergedOptions.lang;
2745
- document.querySelectorAll("head script[id^=\"" + i18nScriptPrefix + "\"]").forEach(function (el) {
2746
- if (el.id !== i18nScriptID_1) {
2747
- document.head.removeChild(el);
2748
- }
2749
- });
2750
- (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/i18n/" + mergedOptions.lang + ".js", i18nScriptID_1);
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);
2751
2747
  }
2752
- }
2753
- else {
2754
- window.VditorI18n = mergedOptions.i18n;
2755
- }
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:
2756
2758
  (0,setContentTheme/* setContentTheme */.Z)(mergedOptions.theme.current, mergedOptions.theme.path);
2757
2759
  if (mergedOptions.anchor === 1) {
2758
2760
  previewElement.classList.add("vditor-reset--anchor");
@@ -2883,7 +2885,7 @@ var Vditor = /** @class */ (function () {
2883
2885
  /* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
2884
2886
  /* harmony export */ "g": () => (/* binding */ Constants)
2885
2887
  /* harmony export */ });
2886
- var _VDITOR_VERSION = "3.8.8";
2888
+ var _VDITOR_VERSION = "3.8.9";
2887
2889
 
2888
2890
  var Constants = /** @class */ (function () {
2889
2891
  function Constants() {
@@ -2909,7 +2911,7 @@ var Constants = /** @class */ (function () {
2909
2911
  "swift", "ini", "typescript", "vbnet", "yaml",
2910
2912
  "ada", "clojure", "dart", "erb", "fortran", "gradle", "haskell", "julia", "julia-repl", "lisp", "matlab",
2911
2913
  "pgsql", "powershell", "sql_more", "stata", "cmake", "mathematica"];
2912
- Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.8";
2914
+ Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.9";
2913
2915
  Constants.MARKDOWN_OPTIONS = {
2914
2916
  autoSpace: false,
2915
2917
  codeBlockPreview: true,
@@ -9245,7 +9247,7 @@ var genUploadedLabel = function (responseText, vditor) {
9245
9247
  type = type.toLowerCase();
9246
9248
  if (type.indexOf(".wav") === 0 || type.indexOf(".mp3") === 0 || type.indexOf(".ogg") === 0) {
9247
9249
  if (vditor.currentMode === "wysiwyg") {
9248
- 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";
9249
9251
  }
9250
9252
  else if (vditor.currentMode === "ir") {
9251
9253
  succFileText += "<audio controls=\"controls\" src=\"" + path + "\"></audio>\n";
@@ -9263,7 +9265,7 @@ var genUploadedLabel = function (responseText, vditor) {
9263
9265
  || type.indexOf(".svg") === 0
9264
9266
  || type.indexOf(".webp") === 0) {
9265
9267
  if (vditor.currentMode === "wysiwyg") {
9266
- succFileText += "<img alt=\"" + filename + "\" src=\"" + path + "\">";
9268
+ succFileText += "<img alt=\"" + filename + "\" src=\"" + path + "\">\n";
9267
9269
  }
9268
9270
  else {
9269
9271
  succFileText += "![" + filename + "](" + path + ")\n";
@@ -9271,7 +9273,7 @@ var genUploadedLabel = function (responseText, vditor) {
9271
9273
  }
9272
9274
  else {
9273
9275
  if (vditor.currentMode === "wysiwyg") {
9274
- succFileText += "<a href=\"" + path + "\">" + filename + "</a>";
9276
+ succFileText += "<a href=\"" + path + "\">" + filename + "</a>\n";
9275
9277
  }
9276
9278
  else {
9277
9279
  succFileText += "[" + filename + "](" + path + ")\n";
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v3.8.8 - 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
  *
@@ -45,7 +45,7 @@ return /******/ (() => { // webpackBootstrap
45
45
  /* harmony export */ "g": () => (/* binding */ Constants)
46
46
  /* harmony export */ });
47
47
  /* unused harmony export VDITOR_VERSION */
48
- var _VDITOR_VERSION = (/* unused pure expression or super */ null && ("3.8.8"));
48
+ var _VDITOR_VERSION = (/* unused pure expression or super */ null && ("3.8.9"));
49
49
 
50
50
  var Constants = /** @class */ (function () {
51
51
  function Constants() {
@@ -71,7 +71,7 @@ var Constants = /** @class */ (function () {
71
71
  "swift", "ini", "typescript", "vbnet", "yaml",
72
72
  "ada", "clojure", "dart", "erb", "fortran", "gradle", "haskell", "julia", "julia-repl", "lisp", "matlab",
73
73
  "pgsql", "powershell", "sql_more", "stata", "cmake", "mathematica"];
74
- Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.8";
74
+ Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.9";
75
75
  Constants.MARKDOWN_OPTIONS = {
76
76
  autoSpace: false,
77
77
  codeBlockPreview: true,
@@ -2207,24 +2207,26 @@ var previewRender = function (previewElement, markdown, options) { return __awai
2207
2207
  }
2208
2208
  previewElement.innerHTML = html;
2209
2209
  previewElement.classList.add("vditor-reset");
2210
- if (!mergedOptions.i18n) {
2211
- if (!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) {
2212
- throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
2210
+ if (!!mergedOptions.i18n) return [3 /*break*/, 5];
2211
+ if (!!["en_US", "ja_JP", "ko_KR", "ru_RU", "zh_CN", "zh_TW"].includes(mergedOptions.lang)) return [3 /*break*/, 2];
2212
+ throw new Error("options.lang error, see https://ld246.com/article/1549638745630#options");
2213
+ case 2:
2214
+ i18nScriptPrefix = "vditorI18nScript";
2215
+ i18nScriptID_1 = i18nScriptPrefix + mergedOptions.lang;
2216
+ document.querySelectorAll("head script[id^=\"" + i18nScriptPrefix + "\"]").forEach(function (el) {
2217
+ if (el.id !== i18nScriptID_1) {
2218
+ document.head.removeChild(el);
2213
2219
  }
2214
- else {
2215
- i18nScriptPrefix = "vditorI18nScript";
2216
- i18nScriptID_1 = i18nScriptPrefix + mergedOptions.lang;
2217
- document.querySelectorAll("head script[id^=\"" + i18nScriptPrefix + "\"]").forEach(function (el) {
2218
- if (el.id !== i18nScriptID_1) {
2219
- document.head.removeChild(el);
2220
- }
2221
- });
2222
- (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/i18n/" + mergedOptions.lang + ".js", i18nScriptID_1);
2223
- }
2224
- }
2225
- else {
2226
- window.VditorI18n = mergedOptions.i18n;
2227
- }
2220
+ });
2221
+ return [4 /*yield*/, (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/i18n/" + mergedOptions.lang + ".js", i18nScriptID_1)];
2222
+ case 3:
2223
+ _a.sent();
2224
+ _a.label = 4;
2225
+ case 4: return [3 /*break*/, 6];
2226
+ case 5:
2227
+ window.VditorI18n = mergedOptions.i18n;
2228
+ _a.label = 6;
2229
+ case 6:
2228
2230
  (0,setContentTheme/* setContentTheme */.Z)(mergedOptions.theme.current, mergedOptions.theme.path);
2229
2231
  if (mergedOptions.anchor === 1) {
2230
2232
  previewElement.classList.add("vditor-reset--anchor");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vditor",
3
- "version": "3.8.8",
3
+ "version": "3.8.9",
4
4
  "description": "♏ 易于使用的 Markdown 编辑器,为适配不同的应用场景而生",
5
5
  "author": "Vanessa <v@b3log.org> (http://vanessa.b3log.org)",
6
6
  "homepage": "https://b3log.org/vditor",
@@ -34,10 +34,10 @@
34
34
  "identity-obj-proxy": "^3.0.0",
35
35
  "jest": "^26.6.3",
36
36
  "mini-css-extract-plugin": "^0.8.2",
37
- "node-sass": "^6.0.1",
37
+ "node-sass": "^7.0.0",
38
38
  "postcss-loader": "^5.2.0",
39
39
  "puppeteer": "^1.20.0",
40
- "sass-loader": "^10.2.0",
40
+ "sass-loader": "^12.4.0",
41
41
  "style-loader": "^1.3.0",
42
42
  "terser-webpack-plugin": "^5.1.2",
43
43
  "ts-jest": "^26.5.6",
@@ -97,7 +97,7 @@ export const previewRender = async (previewElement: HTMLDivElement, markdown: st
97
97
  document.head.removeChild(el);
98
98
  }
99
99
  });
100
- addScript(`${mergedOptions.cdn}/dist/js/i18n/${mergedOptions.lang}.js`, i18nScriptID);
100
+ await addScript(`${mergedOptions.cdn}/dist/js/i18n/${mergedOptions.lang}.js`, i18nScriptID);
101
101
  }
102
102
  } else {
103
103
  window.VditorI18n = mergedOptions.i18n;
@@ -108,7 +108,7 @@ const genUploadedLabel = (responseText: string, vditor: IVditor) => {
108
108
  if (type.indexOf(".wav") === 0 || type.indexOf(".mp3") === 0 || type.indexOf(".ogg") === 0) {
109
109
  if (vditor.currentMode === "wysiwyg") {
110
110
  succFileText += `<div class="vditor-wysiwyg__block" data-type="html-block"
111
- data-block="0"><pre><code>&lt;audio controls="controls" src="${path}"&gt;&lt;/audio&gt;</code></pre>`;
111
+ data-block="0"><pre><code>&lt;audio controls="controls" src="${path}"&gt;&lt;/audio&gt;</code></pre>\n`;
112
112
  } else if (vditor.currentMode === "ir") {
113
113
  succFileText += `<audio controls="controls" src="${path}"></audio>\n`;
114
114
  } else {
@@ -123,13 +123,13 @@ const genUploadedLabel = (responseText: string, vditor: IVditor) => {
123
123
  || type.indexOf(".svg") === 0
124
124
  || type.indexOf(".webp") === 0) {
125
125
  if (vditor.currentMode === "wysiwyg") {
126
- succFileText += `<img alt="${filename}" src="${path}">`;
126
+ succFileText += `<img alt="${filename}" src="${path}">\n`;
127
127
  } else {
128
128
  succFileText += `![${filename}](${path})\n`;
129
129
  }
130
130
  } else {
131
131
  if (vditor.currentMode === "wysiwyg") {
132
- succFileText += `<a href="${path}">${filename}</a>`;
132
+ succFileText += `<a href="${path}">${filename}</a>\n`;
133
133
  } else {
134
134
  succFileText += `[${filename}](${path})\n`;
135
135
  }