Vanessa 2023-01-01 15:18:32 +08:00
parent 95bb18afe1
commit 00eaf9b4b4
21 changed files with 123 additions and 111 deletions

View file

@ -10,7 +10,7 @@ import {setPadding} from "../protyle/ui/initUI";
import {newFile} from "../util/newFile";
import {Outline} from "./dock/Outline";
import {Bookmark} from "./dock/Bookmark";
import {exportLocalStorage, updateHotkeyTip} from "../protyle/util/compatibility";
import {updateHotkeyTip} from "../protyle/util/compatibility";
import {Tag} from "./dock/Tag";
import {getAllModels, getAllTabs} from "./getAll";
import {Asset} from "../asset";
@ -138,9 +138,7 @@ const dockToJSON = (dock: Dock) => {
export const resetLayout = () => {
fetchPost("/api/system/setUILayout", {layout: {}}, () => {
exportLocalStorage(() => {
window.location.reload();
});
window.location.reload();
});
};
@ -159,13 +157,11 @@ export const exportLayout = (reload: boolean, cb?: () => void) => {
};
layoutToJSON(window.siyuan.layout.layout, layoutJSON.layout);
fetchPost("/api/system/setUILayout", {layout: layoutJSON, exit: typeof cb !== "undefined"}, () => {
exportLocalStorage(() => {
if (reload) {
window.location.reload();
} else if (cb) {
cb();
}
});
});
};
@ -541,7 +537,7 @@ export const copyTab = (tab: Tab) => {
});
};
export const getInstanceById = (id: string, layout =window.siyuan.layout.centerLayout) => {
export const getInstanceById = (id: string, layout = window.siyuan.layout.centerLayout) => {
const _getInstanceById = (item: Layout | Wnd, id: string) => {
if (item.id === id) {
return item;