Vanessa 2022-06-05 00:48:29 +08:00
parent 64ae905921
commit ff3cd4d4e9
21 changed files with 117 additions and 85 deletions

View file

@ -1,4 +1,4 @@
import {showMessage} from "../../dialog/message";
import {hideMessage, showMessage} from "../../dialog/message";
import {Constants} from "../../constants";
/// #if !BROWSER
import {PrintToPDFOptions, SaveDialogReturnValue} from "electron";
@ -126,7 +126,7 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
properties: ["showOverwriteConfirmation"],
}).then((result: SaveDialogReturnValue) => {
if (!result.canceled) {
showMessage(window.siyuan.languages.exporting, -1);
const id = showMessage(window.siyuan.languages.exporting, -1);
let url = "/api/export/exportHTML";
if (option.type === "htmlmd") {
url = "/api/export/exportMdHTML";
@ -138,6 +138,7 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
pdf: option.type === "pdf",
savePath: result.filePath
}, exportResponse => {
hideMessage(id);
if (option.type === "word") {
afterExport(result.filePath);
} else {

View file

@ -5,7 +5,7 @@ import {shell} from "electron";
import * as path from "path";
export const afterExport = (exportPath: string) => {
showMessage(`<div class="fn__flex">
const id = showMessage(`<div class="fn__flex">
<div class="fn__flex-center">${window.siyuan.languages.exported}${escapeHtml(exportPath)}</div>
<div class="fn__space"></div>
<div class="fn__space"></div>
@ -13,7 +13,7 @@ export const afterExport = (exportPath: string) => {
</div>`, 6000);
document.querySelector("#message button").addEventListener("click", () => {
shell.showItemInFolder(path.join(exportPath));
hideMessage();
hideMessage(id);
});
};
/// #endif