|
|
@@ -73,13 +73,13 @@ class Vditor extends VditorMethod {
|
|
|
"options.lang error, see https://ld246.com/article/1549638745630#options",
|
|
|
);
|
|
|
} else {
|
|
|
- const i18nScriptPrefix = "vditorI18nScript"
|
|
|
- const i18nScriptID = i18nScriptPrefix + "_" + mergedOptions.lang
|
|
|
- document.querySelectorAll(`head script[id^="${i18nScriptPrefix}"]`).forEach(el=>{
|
|
|
- if(el.id !== i18nScriptID){
|
|
|
- document.head.removeChild(el)
|
|
|
+ const i18nScriptPrefix = "vditorI18nScript";
|
|
|
+ const i18nScriptID = i18nScriptPrefix + mergedOptions.lang;
|
|
|
+ document.querySelectorAll(`head script[id^="${i18nScriptPrefix}"]`).forEach((el) => {
|
|
|
+ if (el.id !== i18nScriptID) {
|
|
|
+ document.head.removeChild(el);
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
addScript(`${mergedOptions.cdn}/dist/js/i18n/${mergedOptions.lang}.js`, i18nScriptID).then(() => {
|
|
|
this.init(id as HTMLElement, mergedOptions);
|
|
|
});
|
|
|
@@ -89,7 +89,7 @@ class Vditor extends VditorMethod {
|
|
|
this.init(id, mergedOptions);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/** 设置主题 */
|
|
|
public setTheme(
|
|
|
theme: "dark" | "classic",
|