Skip to content

Commit

Permalink
♻️ 当 code 大于 0 时同样需要进行相关的业务处理 siyuan-note#11367
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 authored and tom2319273 committed Aug 3, 2024
1 parent 26115d9 commit 1b9e121
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
12 changes: 5 additions & 7 deletions app/src/config/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,10 @@ export const editor = {
if (fontFamilyElement.tagName === "SELECT") {
let fontFamilyHTML = `<option value="">${window.siyuan.languages.default}</option>`;
fetchPost("/api/system/getSysFonts", {}, (response) => {
if (response.code === 0) {
response.data.forEach((item: string) => {
fontFamilyHTML += `<option value="${item}"${window.siyuan.config.editor.fontFamily === item ? " selected" : ""}>${item}</option>`;
});
fontFamilyElement.innerHTML = fontFamilyHTML;
}
response.data.forEach((item: string) => {
fontFamilyHTML += `<option value="${item}"${window.siyuan.config.editor.fontFamily === item ? " selected" : ""}>${item}</option>`;
});
fontFamilyElement.innerHTML = fontFamilyHTML;
});
}
editor.element.querySelector("#clearHistory").addEventListener("click", () => {
Expand All @@ -337,7 +335,7 @@ export const editor = {

fetchPost("/api/setting/setEditor", {
fullWidth: (editor.element.querySelector("#fullWidth") as HTMLInputElement).checked,
markdown: {
markdown: {
inlineSup: (editor.element.querySelector("#editorMarkdownInlineSup") as HTMLInputElement).checked,
inlineSub: (editor.element.querySelector("#editorMarkdownInlineSub") as HTMLInputElement).checked,
inlineTag: (editor.element.querySelector("#editorMarkdownInlineTag") as HTMLInputElement).checked,
Expand Down
3 changes: 1 addition & 2 deletions app/src/menus/commonMenuItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,8 @@ export const exportMd = (id: string) => {
});
});
return;
} else if (response.code === 0) {
showMessage(window.siyuan.languages.exportTplSucc);
}
showMessage(window.siyuan.languages.exportTplSucc);
});
dialog.destroy();
});
Expand Down
6 changes: 2 additions & 4 deletions app/src/util/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,8 @@ export const initAssets = () => {
return;
}
}
if (response.code === 0) {
window.siyuan.config.appearance = response.data.appearance;
loadAssets(response.data.appearance);
}
window.siyuan.config.appearance = response.data.appearance;
loadAssets(response.data.appearance);
});
});
};
Expand Down
2 changes: 1 addition & 1 deletion app/src/util/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const fetchPost = (url: string, data?: any, cb?: (response: IWebSocketDat
return {
data: null,
msg: response.statusText,
code: response.status,
code: -response.status,
};
default:
if (response.headers.get("content-type")?.indexOf("application/json") > -1) {
Expand Down

0 comments on commit 1b9e121

Please sign in to comment.