🎨 Support export and import settings https://github.com/siyuan-note/siyuan/issues/10617
This commit is contained in:
parent
694303e5e8
commit
77eb65087c
2 changed files with 14 additions and 2 deletions
|
@ -9,6 +9,8 @@ import {showMessage} from "../dialog/message";
|
|||
import {showFileInFolder} from "../util/pathName";
|
||||
import {Constants} from "../constants";
|
||||
import {openByMobile} from "../protyle/util/compatibility";
|
||||
import {exportLayout} from "../layout/util";
|
||||
import {exitSiYuan} from "../dialog/processSystem";
|
||||
|
||||
export const exportConfig = {
|
||||
element: undefined as Element,
|
||||
|
@ -234,7 +236,18 @@ export const exportConfig = {
|
|||
item.addEventListener("change", (event: InputEvent & { target: HTMLInputElement }) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", event.target.files[0]);
|
||||
fetchPost("/api/system/importConf", formData);
|
||||
fetchPost("/api/system/importConf", formData, response => {
|
||||
if (response.code !== 0) {
|
||||
showMessage(response.msg);
|
||||
return
|
||||
}
|
||||
|
||||
showMessage(window.siyuan.languages.imported);
|
||||
exportLayout({
|
||||
errorExit: true,
|
||||
cb: exitSiYuan
|
||||
});
|
||||
});
|
||||
});
|
||||
} else {
|
||||
item.addEventListener("change", () => {
|
||||
|
|
|
@ -410,7 +410,6 @@ func importConf(c *gin.Context) {
|
|||
}
|
||||
|
||||
logging.LogInfof("imported conf")
|
||||
model.Close(false, true, 1)
|
||||
}
|
||||
|
||||
func getConf(c *gin.Context) {
|
||||
|
|
Loading…
Add table
Reference in a new issue