mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-08 00:04:21 +01:00
This commit is contained in:
parent
78b7f86921
commit
7fd92c21d3
4 changed files with 28 additions and 74 deletions
|
|
@ -3,13 +3,13 @@ import {fetchPost} from "../util/fetch";
|
|||
import {afterExport} from "../protyle/export/util";
|
||||
import {ipcRenderer} from "electron";
|
||||
import * as path from "path";
|
||||
import {exportLayout} from "../layout/util";
|
||||
/// #endif
|
||||
import {isBrowser} from "../util/functions";
|
||||
import {showMessage} from "../dialog/message";
|
||||
import {useShell} 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 = {
|
||||
|
|
@ -277,10 +277,14 @@ export const exportConfig = {
|
|||
}
|
||||
|
||||
showMessage(window.siyuan.languages.imported);
|
||||
/// #if MOBILE
|
||||
exitSiYuan();
|
||||
/// #else
|
||||
exportLayout({
|
||||
errorExit: true,
|
||||
cb: exitSiYuan
|
||||
});
|
||||
/// #endif
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import {afterLoadPlugin} from "../../plugin/loader";
|
|||
import {commandPanel} from "../../boot/globalEvent/command/panel";
|
||||
import {openTopBarMenu} from "../../plugin/openTopBarMenu";
|
||||
import {initFileTree} from "../settings/fileTree";
|
||||
import {initExport} from "../settings/export";
|
||||
|
||||
export const popMenu = () => {
|
||||
activeBlur();
|
||||
|
|
@ -115,6 +116,9 @@ export const initRightMenu = (app: App) => {
|
|||
<div class="b3-menu__item${window.siyuan.config.readonly ? " fn__none" : ""}" id="menuAssets">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconImage"></use></svg><span class="b3-menu__label">${window.siyuan.languages.assets}</span>
|
||||
</div>
|
||||
<div class="b3-menu__item${window.siyuan.config.readonly ? " fn__none" : ""}" id="menuExport">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconUpload"></use></svg><span class="b3-menu__label">${window.siyuan.languages.export}</span>
|
||||
</div>
|
||||
<div class="b3-menu__item${window.siyuan.config.readonly ? " fn__none" : ""}" id="menuAppearance">
|
||||
<svg class="b3-menu__icon"><use xlink:href="#iconTheme"></use></svg><span class="b3-menu__label">${window.siyuan.languages.appearance}</span>
|
||||
</div>
|
||||
|
|
@ -178,6 +182,11 @@ export const initRightMenu = (app: App) => {
|
|||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuExport") {
|
||||
initExport();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "menuAI") {
|
||||
initAI();
|
||||
event.preventDefault();
|
||||
|
|
|
|||
|
|
@ -163,44 +163,6 @@ export const initAbout = () => {
|
|||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.systemLogTip}</div>
|
||||
</div>
|
||||
<div class="b3-label">
|
||||
${window.siyuan.languages.export} Data
|
||||
<div class="fn__hr"></div>
|
||||
<button class="b3-button b3-button--outline fn__block" id="exportData">
|
||||
<svg><use xlink:href="#iconUpload"></use></svg>${window.siyuan.languages.export}
|
||||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.exportDataTip}</div>
|
||||
</div>
|
||||
<div class="b3-label${window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<div class="fn__flex">
|
||||
${window.siyuan.languages.import} Data
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<button class="b3-button b3-button--outline fn__block" style="position: relative">
|
||||
<input id="importData" class="b3-form__upload" type="file">
|
||||
<svg><use xlink:href="#iconDownload"></use></svg> ${window.siyuan.languages.import}
|
||||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.importDataTip}</div>
|
||||
</div>
|
||||
<div class="b3-label">
|
||||
${window.siyuan.languages.exportConf}
|
||||
<div class="fn__hr"></div>
|
||||
<button class="b3-button b3-button--outline fn__block" id="exportConf">
|
||||
<svg><use xlink:href="#iconUpload"></use></svg>${window.siyuan.languages.export}
|
||||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.exportConfTip}</div>
|
||||
</div>
|
||||
<div class="b3-label${window.siyuan.config.readonly ? " fn__none" : ""}">
|
||||
<div class="fn__flex">
|
||||
${window.siyuan.languages.importConf}
|
||||
</div>
|
||||
<div class="fn__hr"></div>
|
||||
<button class="b3-button b3-button--outline fn__block" style="position: relative">
|
||||
<input id="importConf" class="b3-form__upload" type="file">
|
||||
<svg><use xlink:href="#iconDownload"></use></svg> ${window.siyuan.languages.import}
|
||||
</button>
|
||||
<div class="b3-label__text">${window.siyuan.languages.importConfTip}</div>
|
||||
</div>
|
||||
<div class="b3-label${(!window.siyuan.config.readonly && (isInAndroid() || isInIOS() || isInHarmony())) ? "" : " fn__none"}">
|
||||
${window.siyuan.languages.workspaceList}
|
||||
<div class="fn__hr"></div>
|
||||
|
|
@ -330,20 +292,6 @@ export const initAbout = () => {
|
|||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "exportData") {
|
||||
fetchPost("/api/export/exportData", {}, response => {
|
||||
openByMobile(response.data.zip);
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "exportConf") {
|
||||
fetchPost("/api/system/exportConf", {}, response => {
|
||||
openByMobile(response.data.zip);
|
||||
});
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
break;
|
||||
} else if (target.id === "vacuumDataIndex") {
|
||||
fetchPost("/api/system/vacuumDataIndex", {}, () => {
|
||||
});
|
||||
|
|
@ -465,27 +413,6 @@ export const initAbout = () => {
|
|||
target = target.parentElement;
|
||||
}
|
||||
});
|
||||
modelMainElement.querySelector("#importData").addEventListener("change", (event: InputEvent & {
|
||||
target: HTMLInputElement
|
||||
}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", event.target.files[0]);
|
||||
fetchPost("/api/import/importData", formData);
|
||||
});
|
||||
modelMainElement.querySelector("#importConf").addEventListener("change", (event: InputEvent & {
|
||||
target: HTMLInputElement
|
||||
}) => {
|
||||
const formData = new FormData();
|
||||
formData.append("file", event.target.files[0]);
|
||||
fetchPost("/api/system/importConf", formData, (response) => {
|
||||
if (response.code !== 0) {
|
||||
showMessage(response.msg);
|
||||
return;
|
||||
}
|
||||
|
||||
exitSiYuan();
|
||||
});
|
||||
});
|
||||
const networkServeElement = modelMainElement.querySelector("#networkServe") as HTMLInputElement;
|
||||
const networkServeTLSElement = modelMainElement.querySelector("#networkServeTLS") as HTMLInputElement;
|
||||
const networkServeContainElement = hasClosestByClassName(networkServeElement, "b3-label") as HTMLElement;
|
||||
|
|
|
|||
14
app/src/mobile/settings/export.ts
Normal file
14
app/src/mobile/settings/export.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
import {openModel} from "../menu/model";
|
||||
import {exportConfig} from "../../config/exportConfig";
|
||||
|
||||
export const initExport = () => {
|
||||
openModel({
|
||||
title: window.siyuan.languages.export,
|
||||
icon: "iconUpload",
|
||||
html: `<div>${exportConfig.genHTML()}</div>`,
|
||||
bindEvent(modelMainElement: HTMLElement) {
|
||||
exportConfig.element = modelMainElement.firstElementChild;
|
||||
exportConfig.bindEvent();
|
||||
}
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue