mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 00:20:12 +01:00
This commit is contained in:
parent
aaeff27ba6
commit
325feb4afb
5 changed files with 19 additions and 8 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
@ -139,6 +139,13 @@ id="preview"></div>
|
|||
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();
|
||||
|
|
|
|||
|
|
@ -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) => {
|
||||
if (response.headers.get("content-type")?.indexOf("application/json") > -1) {
|
||||
return response.json();
|
||||
}).then((response: IWebSocketData) => {
|
||||
} else {
|
||||
return response.text();
|
||||
}
|
||||
}).then((response) => {
|
||||
cb(response);
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue