diff --git a/app/src/index.ts b/app/src/index.ts
index a79133a24..d5646e9e6 100644
--- a/app/src/index.ts
+++ b/app/src/index.ts
@@ -166,7 +166,7 @@ export class App {
}
await loadPlugins(this);
getLocalStorage(() => {
- fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
+ fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages:IObject) => {
window.siyuan.languages = lauguages;
window.siyuan.menus = new Menus(this);
bootSync();
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index 6cf980c16..8197c9dee 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -85,7 +85,7 @@ class App {
window.siyuan.config = confResponse.data.conf;
await loadPlugins(this);
getLocalStorage(() => {
- fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
+ fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages: IObject) => {
window.siyuan.languages = lauguages;
window.siyuan.menus = new Menus(this);
document.title = window.siyuan.languages.siyuanNote;
diff --git a/app/src/protyle/export/util.ts b/app/src/protyle/export/util.ts
index afbb761c7..f7bb4beae 100644
--- a/app/src/protyle/export/util.ts
+++ b/app/src/protyle/export/util.ts
@@ -3,7 +3,7 @@ import {escapeHtml} from "../../util/escape";
import * as path from "path";
/// #endif
import {hideMessage, showMessage} from "../../dialog/message";
-import {fetchPost} from "../../util/fetch";
+import {fetchGet, fetchPost} from "../../util/fetch";
import {Dialog} from "../../dialog";
import {addScript} from "../util/addScript";
import {isMobile} from "../../util/functions";
@@ -96,7 +96,7 @@ id="preview">
markItem.childNodes.forEach((item) => {
let spanHTML = "";
Array.from(item.textContent).forEach(str => {
- spanHTML += `${str}`;
+ spanHTML += `${str}`;
});
const templateElement = document.createElement("template");
templateElement.innerHTML = spanHTML;
@@ -139,6 +139,13 @@ id="preview">
item.setAttribute("viewBox", viewBox);
item.innerHTML = symbolElements[symbolElements.length - 1].innerHTML;
});
+ previewElement.querySelectorAll(".img img").forEach((item: HTMLImageElement) => {
+ if (item.src.endsWith(".svg")) {
+ fetchGet(item.src, (response: string) => {
+ item.src = `data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(response)))}`;
+ })
+ }
+ });
btnsElement[0].removeAttribute("disabled");
btnsElement[1].removeAttribute("disabled");
exportDialog.element.querySelector(".fn__loading").remove();
diff --git a/app/src/util/fetch.ts b/app/src/util/fetch.ts
index dc5e029d9..ca59ab111 100644
--- a/app/src/util/fetch.ts
+++ b/app/src/util/fetch.ts
@@ -93,10 +93,14 @@ export const fetchSyncPost = async (url: string, data?: any) => {
return res2;
};
-export const fetchGet = (url: string, cb: (response: IWebSocketData | IEmoji[]) => void) => {
+export const fetchGet = (url: string, cb: (response: IWebSocketData | IObject | string) => void) => {
fetch(url).then((response) => {
- return response.json();
- }).then((response: IWebSocketData) => {
+ if (response.headers.get("content-type")?.indexOf("application/json") > -1) {
+ return response.json();
+ } else {
+ return response.text();
+ }
+ }).then((response) => {
cb(response);
});
};
diff --git a/app/src/window/index.ts b/app/src/window/index.ts
index 21cea8d10..1d6df797e 100644
--- a/app/src/window/index.ts
+++ b/app/src/window/index.ts
@@ -137,7 +137,7 @@ class App {
window.siyuan.config = response.data.conf;
await loadPlugins(this);
getLocalStorage(() => {
- fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages) => {
+ fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages: IObject) => {
window.siyuan.languages = lauguages;
window.siyuan.menus = new Menus(this);
fetchPost("/api/setting/getCloudUser", {}, userResponse => {