This commit is contained in:
Vanessa 2022-07-15 10:41:05 +08:00
parent d3b603ff6b
commit bf2e2123b7
4 changed files with 9 additions and 9 deletions

View file

@ -84,13 +84,13 @@ class App {
menus: new Menus() menus: new Menus()
}; };
fetchPost("/api/system/getConf", {}, response => { fetchPost("/api/system/getConf", {}, response => {
window.siyuan.config = response.data; window.siyuan.config = response.data.conf;
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) => {
window.siyuan.languages = lauguages; window.siyuan.languages = lauguages;
bootSync(); bootSync();
fetchPost("/api/setting/getCloudUser", {}, userResponse => { fetchPost("/api/setting/getCloudUser", {}, userResponse => {
window.siyuan.user = userResponse.data; window.siyuan.user = userResponse.data;
onGetConfig(); onGetConfig(response.data.start);
account.onSetaccount(); account.onSetaccount();
resizeDrag(); resizeDrag();
setTitle(window.siyuan.languages.siyuanNote); setTitle(window.siyuan.languages.siyuanNote);

View file

@ -269,12 +269,12 @@ const JSONToCenter = (json: any, layout?: Layout | Wnd | Tab | Model) => {
} }
}; };
export const JSONToLayout = () => { export const JSONToLayout = (isStart: boolean) => {
JSONToCenter(window.siyuan.config.uiLayout.layout); JSONToCenter(window.siyuan.config.uiLayout.layout);
JSONToDock(window.siyuan.config.uiLayout); JSONToDock(window.siyuan.config.uiLayout);
const allModels = getAllModels(); const allModels = getAllModels();
// 启动时不打开页签,需要移除没有钉住的页签 // 启动时不打开页签,需要移除没有钉住的页签
if (window.siyuan.config.fileTree.closeTabsOnStart) { if (window.siyuan.config.fileTree.closeTabsOnStart && isStart) {
allModels.editor.forEach(item => { allModels.editor.forEach(item => {
if (item.parent.headElement && !item.parent.headElement.classList.contains("item--pin")) { if (item.parent.headElement && !item.parent.headElement.classList.contains("item--pin")) {
item.parent.parent.removeTab(item.parent.id); item.parent.parent.removeTab(item.parent.id);

View file

@ -43,13 +43,13 @@ class App {
} }
}); });
fetchPost("/api/system/getConf", {}, confResponse => { fetchPost("/api/system/getConf", {}, confResponse => {
confResponse.data.keymap = Constants.SIYUAN_KEYMAP; confResponse.data.conf.keymap = Constants.SIYUAN_KEYMAP;
window.siyuan.config = confResponse.data; window.siyuan.config = confResponse.data.conf;
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) => {
window.siyuan.languages = lauguages; window.siyuan.languages = lauguages;
document.title = window.siyuan.languages.siyuanNote; document.title = window.siyuan.languages.siyuanNote;
bootSync(); bootSync();
loadAssets(confResponse.data.appearance); loadAssets(confResponse.data.conf.appearance);
initAssets(); initAssets();
fetchPost("/api/system/getEmojiConf", {}, emojiResponse => { fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
window.siyuan.emojis = emojiResponse.data as IEmoji[]; window.siyuan.emojis = emojiResponse.data as IEmoji[];

View file

@ -92,7 +92,7 @@ export const setProxy = () => {
/// #endif /// #endif
}; };
export const onGetConfig = () => { export const onGetConfig = (isStart:boolean) => {
const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general"); const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");
const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general"); const matchKeymap2 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.general, "editor", "general");
const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert"); const matchKeymap3 = matchKeymap(Constants.SIYUAN_KEYMAP.editor.insert, "editor", "insert");
@ -128,7 +128,7 @@ export const onGetConfig = () => {
fetchPost("/api/system/getEmojiConf", {}, response => { fetchPost("/api/system/getEmojiConf", {}, response => {
window.siyuan.emojis = response.data as IEmoji[]; window.siyuan.emojis = response.data as IEmoji[];
try { try {
JSONToLayout(); JSONToLayout(isStart);
} catch (e) { } catch (e) {
fetchPost("/api/system/setUILayout", {layout: {}}, () => { fetchPost("/api/system/setUILayout", {layout: {}}, () => {
window.location.reload(); window.location.reload();