🎨 导出 PDF 和 Word 时支持覆盖已有文件 https://github.com/siyuan-note/siyuan/issues/5309

This commit is contained in:
Liang Ding 2022-07-19 21:40:16 +08:00
parent c48e04fc16
commit c819b63fa7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 36 additions and 3 deletions

View file

@ -121,8 +121,30 @@ const getExportPath = (option: { type: string, id: string }, pdfOption?: PrintTo
lockFile(response.data);
return;
}
let exportType = "HTML (SiYuan)"
let extension = "html"
switch (option.type) {
case "htmlmd":
exportType = "HTML (Markdown)";
break;
case "word":
exportType = "Word .docx";
extension = "docx";
break;
case "pdf":
exportType = "PDF";
extension = "pdf";
break;
}
dialog.showSaveDialog({
defaultPath: response.data.rootTitle,
title: window.siyuan.languages.export + " " + exportType,
defaultPath: response.data.rootTitle + "." + extension,
filters: [{
name: "Word",
extensions: [extension]
}],
properties: ["showOverwriteConfirmation"],
}).then((result: SaveDialogReturnValue) => {
if (!result.canceled) {