vditor 3.8.9 → 3.8.10
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 +1 -1
- package/dist/index.min.js +24 -9
- package/dist/method.min.js +24 -9
- package/package.json +1 -1
- package/src/ts/markdown/codeRender.ts +8 -4
- package/src/ts/markdown/outlineRender.ts +5 -1
- package/src/ts/markdown/previewRender.ts +4 -3
- package/src/ts/markdown/speechRender.ts +6 -2
package/dist/index.css
CHANGED
package/dist/index.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v3.8.
|
|
2
|
+
* Vditor v3.8.10 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -2531,6 +2531,10 @@ var speechRender = function (element, lang) {
|
|
|
2531
2531
|
}
|
|
2532
2532
|
var playSVG = '<svg><use xlink:href="#vditor-icon-play"></use></svg>';
|
|
2533
2533
|
var pauseSVG = '<svg><use xlink:href="#vditor-icon-pause"></use></svg>';
|
|
2534
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
2535
|
+
playSVG = '<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>';
|
|
2536
|
+
pauseSVG = '<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>';
|
|
2537
|
+
}
|
|
2534
2538
|
var speechDom = document.querySelector(".vditor-speech");
|
|
2535
2539
|
if (!speechDom) {
|
|
2536
2540
|
speechDom = document.createElement("div");
|
|
@@ -2755,6 +2759,12 @@ var previewRender = function (previewElement, markdown, options) { return __awai
|
|
|
2755
2759
|
window.VditorI18n = mergedOptions.i18n;
|
|
2756
2760
|
_a.label = 6;
|
|
2757
2761
|
case 6:
|
|
2762
|
+
if (!mergedOptions.icon) return [3 /*break*/, 8];
|
|
2763
|
+
return [4 /*yield*/, (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/icons/" + mergedOptions.icon + ".js", "vditorIconScript")];
|
|
2764
|
+
case 7:
|
|
2765
|
+
_a.sent();
|
|
2766
|
+
_a.label = 8;
|
|
2767
|
+
case 8:
|
|
2758
2768
|
(0,setContentTheme/* setContentTheme */.Z)(mergedOptions.theme.current, mergedOptions.theme.path);
|
|
2759
2769
|
if (mergedOptions.anchor === 1) {
|
|
2760
2770
|
previewElement.classList.add("vditor-reset--anchor");
|
|
@@ -2785,9 +2795,6 @@ var previewRender = function (previewElement, markdown, options) { return __awai
|
|
|
2785
2795
|
if (mergedOptions.lazyLoadImage) {
|
|
2786
2796
|
lazyLoadImageRender(previewElement);
|
|
2787
2797
|
}
|
|
2788
|
-
if (mergedOptions.icon) {
|
|
2789
|
-
(0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/icons/" + mergedOptions.icon + ".js", "vditorIconScript");
|
|
2790
|
-
}
|
|
2791
2798
|
previewElement.addEventListener("click", function (event) {
|
|
2792
2799
|
var spanElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(event.target, "SPAN");
|
|
2793
2800
|
if (spanElement && (0,hasClosest/* hasClosestByClassName */.fb)(spanElement, "vditor-toc")) {
|
|
@@ -2885,7 +2892,7 @@ var Vditor = /** @class */ (function () {
|
|
|
2885
2892
|
/* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
|
|
2886
2893
|
/* harmony export */ "g": () => (/* binding */ Constants)
|
|
2887
2894
|
/* harmony export */ });
|
|
2888
|
-
var _VDITOR_VERSION = "3.8.
|
|
2895
|
+
var _VDITOR_VERSION = "3.8.10";
|
|
2889
2896
|
|
|
2890
2897
|
var Constants = /** @class */ (function () {
|
|
2891
2898
|
function Constants() {
|
|
@@ -2911,7 +2918,7 @@ var Constants = /** @class */ (function () {
|
|
|
2911
2918
|
"swift", "ini", "typescript", "vbnet", "yaml",
|
|
2912
2919
|
"ada", "clojure", "dart", "erb", "fortran", "gradle", "haskell", "julia", "julia-repl", "lisp", "matlab",
|
|
2913
2920
|
"pgsql", "powershell", "sql_more", "stata", "cmake", "mathematica"];
|
|
2914
|
-
Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.
|
|
2921
|
+
Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.10";
|
|
2915
2922
|
Constants.MARKDOWN_OPTIONS = {
|
|
2916
2923
|
autoSpace: false,
|
|
2917
2924
|
codeBlockPreview: true,
|
|
@@ -3102,6 +3109,7 @@ var chartRender = function (element, cdn, theme) {
|
|
|
3102
3109
|
|
|
3103
3110
|
var codeRender = function (element) {
|
|
3104
3111
|
element.querySelectorAll("pre > code").forEach(function (e, index) {
|
|
3112
|
+
var _a, _b, _c;
|
|
3105
3113
|
if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
|
|
3106
3114
|
e.parentElement.classList.contains("vditor-ir__marker--pre")) {
|
|
3107
3115
|
return;
|
|
@@ -3129,10 +3137,13 @@ var codeRender = function (element) {
|
|
|
3129
3137
|
});
|
|
3130
3138
|
codeText = codeElement.innerText;
|
|
3131
3139
|
}
|
|
3140
|
+
var iconHTML = '<svg><use xlink:href="#vditor-icon-copy"></use></svg>';
|
|
3141
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
3142
|
+
iconHTML = '<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>';
|
|
3143
|
+
}
|
|
3132
3144
|
var divElement = document.createElement("div");
|
|
3133
3145
|
divElement.className = "vditor-copy";
|
|
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>");
|
|
3146
|
+
divElement.innerHTML = "<span aria-label=\"" + (((_a = window.VditorI18n) === null || _a === void 0 ? void 0 : _a.copy) || "复制") + "\"\nonmouseover=\"this.setAttribute('aria-label', '" + (((_b = window.VditorI18n) === null || _b === void 0 ? void 0 : _b.copy) || "复制") + "')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '" + (((_c = window.VditorI18n) === null || _c === void 0 ? void 0 : _c.copy) || "已复制") + "')\">" + iconHTML + "</span>";
|
|
3136
3147
|
var textarea = document.createElement("textarea");
|
|
3137
3148
|
textarea.value = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_0__/* .code160to32 */ .X)(codeText);
|
|
3138
3149
|
divElement.insertAdjacentElement("afterbegin", textarea);
|
|
@@ -3817,7 +3828,11 @@ var outlineRender = function (contentElement, targetElement, vditor) {
|
|
|
3817
3828
|
var headingsElement = tempElement.firstElementChild.querySelectorAll("li > span[data-target-id]");
|
|
3818
3829
|
headingsElement.forEach(function (item, index) {
|
|
3819
3830
|
if (item.nextElementSibling && item.nextElementSibling.tagName === "UL") {
|
|
3820
|
-
|
|
3831
|
+
var iconHTML = "<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";
|
|
3832
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
3833
|
+
iconHTML = '<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>';
|
|
3834
|
+
}
|
|
3835
|
+
item.innerHTML = iconHTML + "<span>" + item.innerHTML + "</span>";
|
|
3821
3836
|
}
|
|
3822
3837
|
else {
|
|
3823
3838
|
item.innerHTML = "<svg></svg><span>" + item.innerHTML + "</span>";
|
package/dist/method.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v3.8.
|
|
2
|
+
* Vditor v3.8.10 - 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.
|
|
48
|
+
var _VDITOR_VERSION = (/* unused pure expression or super */ null && ("3.8.10"));
|
|
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.
|
|
74
|
+
Constants.CDN = "https://cdn.jsdelivr.net/npm/vditor@" + "3.8.10";
|
|
75
75
|
Constants.MARKDOWN_OPTIONS = {
|
|
76
76
|
autoSpace: false,
|
|
77
77
|
codeBlockPreview: true,
|
|
@@ -258,6 +258,7 @@ var chartRender = function (element, cdn, theme) {
|
|
|
258
258
|
|
|
259
259
|
var codeRender = function (element) {
|
|
260
260
|
element.querySelectorAll("pre > code").forEach(function (e, index) {
|
|
261
|
+
var _a, _b, _c;
|
|
261
262
|
if (e.parentElement.classList.contains("vditor-wysiwyg__pre") ||
|
|
262
263
|
e.parentElement.classList.contains("vditor-ir__marker--pre")) {
|
|
263
264
|
return;
|
|
@@ -285,10 +286,13 @@ var codeRender = function (element) {
|
|
|
285
286
|
});
|
|
286
287
|
codeText = codeElement.innerText;
|
|
287
288
|
}
|
|
289
|
+
var iconHTML = '<svg><use xlink:href="#vditor-icon-copy"></use></svg>';
|
|
290
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
291
|
+
iconHTML = '<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>';
|
|
292
|
+
}
|
|
288
293
|
var divElement = document.createElement("div");
|
|
289
294
|
divElement.className = "vditor-copy";
|
|
290
|
-
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');" +
|
|
291
|
-
("this.setAttribute('aria-label', '" + window.VditorI18n.copied + "')\"><svg><use xlink:href=\"#vditor-icon-copy\"></use></svg></span>");
|
|
295
|
+
divElement.innerHTML = "<span aria-label=\"" + (((_a = window.VditorI18n) === null || _a === void 0 ? void 0 : _a.copy) || "复制") + "\"\nonmouseover=\"this.setAttribute('aria-label', '" + (((_b = window.VditorI18n) === null || _b === void 0 ? void 0 : _b.copy) || "复制") + "')\"\nclass=\"vditor-tooltipped vditor-tooltipped__w\"\nonclick=\"this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '" + (((_c = window.VditorI18n) === null || _c === void 0 ? void 0 : _c.copy) || "已复制") + "')\">" + iconHTML + "</span>";
|
|
292
296
|
var textarea = document.createElement("textarea");
|
|
293
297
|
textarea.value = (0,_util_code160to32__WEBPACK_IMPORTED_MODULE_0__/* .code160to32 */ .X)(codeText);
|
|
294
298
|
divElement.insertAdjacentElement("afterbegin", textarea);
|
|
@@ -965,7 +969,11 @@ var outlineRender = function (contentElement, targetElement, vditor) {
|
|
|
965
969
|
var headingsElement = tempElement.firstElementChild.querySelectorAll("li > span[data-target-id]");
|
|
966
970
|
headingsElement.forEach(function (item, index) {
|
|
967
971
|
if (item.nextElementSibling && item.nextElementSibling.tagName === "UL") {
|
|
968
|
-
|
|
972
|
+
var iconHTML = "<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";
|
|
973
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
974
|
+
iconHTML = '<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>';
|
|
975
|
+
}
|
|
976
|
+
item.innerHTML = iconHTML + "<span>" + item.innerHTML + "</span>";
|
|
969
977
|
}
|
|
970
978
|
else {
|
|
971
979
|
item.innerHTML = "<svg></svg><span>" + item.innerHTML + "</span>";
|
|
@@ -2003,6 +2011,10 @@ var speechRender = function (element, lang) {
|
|
|
2003
2011
|
}
|
|
2004
2012
|
var playSVG = '<svg><use xlink:href="#vditor-icon-play"></use></svg>';
|
|
2005
2013
|
var pauseSVG = '<svg><use xlink:href="#vditor-icon-pause"></use></svg>';
|
|
2014
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
2015
|
+
playSVG = '<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>';
|
|
2016
|
+
pauseSVG = '<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>';
|
|
2017
|
+
}
|
|
2006
2018
|
var speechDom = document.querySelector(".vditor-speech");
|
|
2007
2019
|
if (!speechDom) {
|
|
2008
2020
|
speechDom = document.createElement("div");
|
|
@@ -2227,6 +2239,12 @@ var previewRender = function (previewElement, markdown, options) { return __awai
|
|
|
2227
2239
|
window.VditorI18n = mergedOptions.i18n;
|
|
2228
2240
|
_a.label = 6;
|
|
2229
2241
|
case 6:
|
|
2242
|
+
if (!mergedOptions.icon) return [3 /*break*/, 8];
|
|
2243
|
+
return [4 /*yield*/, (0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/icons/" + mergedOptions.icon + ".js", "vditorIconScript")];
|
|
2244
|
+
case 7:
|
|
2245
|
+
_a.sent();
|
|
2246
|
+
_a.label = 8;
|
|
2247
|
+
case 8:
|
|
2230
2248
|
(0,setContentTheme/* setContentTheme */.Z)(mergedOptions.theme.current, mergedOptions.theme.path);
|
|
2231
2249
|
if (mergedOptions.anchor === 1) {
|
|
2232
2250
|
previewElement.classList.add("vditor-reset--anchor");
|
|
@@ -2257,9 +2275,6 @@ var previewRender = function (previewElement, markdown, options) { return __awai
|
|
|
2257
2275
|
if (mergedOptions.lazyLoadImage) {
|
|
2258
2276
|
lazyLoadImageRender(previewElement);
|
|
2259
2277
|
}
|
|
2260
|
-
if (mergedOptions.icon) {
|
|
2261
|
-
(0,addScript/* addScript */.G)(mergedOptions.cdn + "/dist/js/icons/" + mergedOptions.icon + ".js", "vditorIconScript");
|
|
2262
|
-
}
|
|
2263
2278
|
previewElement.addEventListener("click", function (event) {
|
|
2264
2279
|
var spanElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(event.target, "SPAN");
|
|
2265
2280
|
if (spanElement && (0,hasClosest/* hasClosestByClassName */.fb)(spanElement, "vditor-toc")) {
|
package/package.json
CHANGED
|
@@ -33,13 +33,17 @@ export const codeRender = (element: HTMLElement) => {
|
|
|
33
33
|
codeText = codeElement.innerText;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
let iconHTML = '<svg><use xlink:href="#vditor-icon-copy"></use></svg>';
|
|
37
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
38
|
+
iconHTML = '<svg viewBox="0 0 32 32"><path d="M22.545-0h-17.455c-1.6 0-2.909 1.309-2.909 2.909v20.364h2.909v-20.364h17.455v-2.909zM26.909 5.818h-16c-1.6 0-2.909 1.309-2.909 2.909v20.364c0 1.6 1.309 2.909 2.909 2.909h16c1.6 0 2.909-1.309 2.909-2.909v-20.364c0-1.6-1.309-2.909-2.909-2.909zM26.909 29.091h-16v-20.364h16v20.364z"></path></svg>';
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
const divElement = document.createElement("div");
|
|
37
42
|
divElement.className = "vditor-copy";
|
|
38
|
-
divElement.innerHTML = `<span aria-label="${window.VditorI18n
|
|
39
|
-
onmouseover="this.setAttribute('aria-label', '${window.VditorI18n
|
|
43
|
+
divElement.innerHTML = `<span aria-label="${window.VditorI18n?.copy || "复制"}"
|
|
44
|
+
onmouseover="this.setAttribute('aria-label', '${window.VditorI18n?.copy || "复制"}')"
|
|
40
45
|
class="vditor-tooltipped vditor-tooltipped__w"
|
|
41
|
-
onclick="this.previousElementSibling.select();document.execCommand('copy')
|
|
42
|
-
`this.setAttribute('aria-label', '${window.VditorI18n.copied}')"><svg><use xlink:href="#vditor-icon-copy"></use></svg></span>`;
|
|
46
|
+
onclick="this.previousElementSibling.select();document.execCommand('copy');this.setAttribute('aria-label', '${window.VditorI18n?.copy || "已复制"}')">${iconHTML}</span>`;
|
|
43
47
|
const textarea = document.createElement("textarea");
|
|
44
48
|
textarea.value = code160to32(codeText);
|
|
45
49
|
divElement.insertAdjacentElement("afterbegin", textarea);
|
|
@@ -38,7 +38,11 @@ export const outlineRender = (contentElement: HTMLElement, targetElement: Elemen
|
|
|
38
38
|
const headingsElement = tempElement.firstElementChild.querySelectorAll("li > span[data-target-id]");
|
|
39
39
|
headingsElement.forEach((item, index) => {
|
|
40
40
|
if (item.nextElementSibling && item.nextElementSibling.tagName === "UL") {
|
|
41
|
-
|
|
41
|
+
let iconHTML = "<svg class='vditor-outline__action'><use xlink:href='#vditor-icon-down'></use></svg>";
|
|
42
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
43
|
+
iconHTML = '<svg class="vditor-outline__action" viewBox="0 0 32 32"><path d="M3.76 6.12l12.24 12.213 12.24-12.213 3.76 3.76-16 16-16-16 3.76-3.76z"></path></svg>';
|
|
44
|
+
}
|
|
45
|
+
item.innerHTML = `${iconHTML}<span>${item.innerHTML}</span>`;
|
|
42
46
|
} else {
|
|
43
47
|
item.innerHTML = `<svg></svg><span>${item.innerHTML}</span>`;
|
|
44
48
|
}
|
|
@@ -103,6 +103,10 @@ export const previewRender = async (previewElement: HTMLDivElement, markdown: st
|
|
|
103
103
|
window.VditorI18n = mergedOptions.i18n;
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
+
if (mergedOptions.icon) {
|
|
107
|
+
await addScript(`${mergedOptions.cdn}/dist/js/icons/${mergedOptions.icon}.js`, "vditorIconScript");
|
|
108
|
+
}
|
|
109
|
+
|
|
106
110
|
setContentTheme(mergedOptions.theme.current, mergedOptions.theme.path);
|
|
107
111
|
if (mergedOptions.anchor === 1) {
|
|
108
112
|
previewElement.classList.add("vditor-reset--anchor");
|
|
@@ -133,9 +137,6 @@ export const previewRender = async (previewElement: HTMLDivElement, markdown: st
|
|
|
133
137
|
if (mergedOptions.lazyLoadImage) {
|
|
134
138
|
lazyLoadImageRender(previewElement);
|
|
135
139
|
}
|
|
136
|
-
if (mergedOptions.icon) {
|
|
137
|
-
addScript(`${mergedOptions.cdn}/dist/js/icons/${mergedOptions.icon}.js`, "vditorIconScript");
|
|
138
|
-
}
|
|
139
140
|
previewElement.addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
|
|
140
141
|
const spanElement = hasClosestByMatchTag(event.target, "SPAN");
|
|
141
142
|
if (spanElement && hasClosestByClassName(spanElement, "vditor-toc")) {
|
|
@@ -9,8 +9,12 @@ export const speechRender = (element: HTMLElement, lang: keyof II18n = "zh_CN")
|
|
|
9
9
|
if (typeof speechSynthesis === "undefined" || typeof SpeechSynthesisUtterance === "undefined") {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
let playSVG = '<svg><use xlink:href="#vditor-icon-play"></use></svg>';
|
|
13
|
+
let pauseSVG = '<svg><use xlink:href="#vditor-icon-pause"></use></svg>';
|
|
14
|
+
if (!document.getElementById("vditorIconScript")) {
|
|
15
|
+
playSVG = '<svg viewBox="0 0 32 32"><path d="M3.436 0l25.128 16-25.128 16v-32z"></path></svg>';
|
|
16
|
+
pauseSVG = '<svg viewBox="0 0 32 32"><path d="M20.617 0h9.128v32h-9.128v-32zM2.255 32v-32h9.128v32h-9.128z"></path></svg>';
|
|
17
|
+
}
|
|
14
18
|
let speechDom: HTMLDivElement = document.querySelector(".vditor-speech");
|
|
15
19
|
if (!speechDom) {
|
|
16
20
|
speechDom = document.createElement("div");
|