mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-18 10:00:48 +08:00
This commit is contained in:
parent
bf3904c2ce
commit
fb8300a8a3
@ -488,7 +488,10 @@ const getExportPath = (option: { type: string, id: string }, removeAssets?: bool
|
|||||||
} else if (option.type === "word") {
|
} else if (option.type === "word") {
|
||||||
url = "/api/export/exportDocx";
|
url = "/api/export/exportDocx";
|
||||||
}
|
}
|
||||||
let savePath = result.filePaths[0].endsWith(response.data.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], replaceLocalPath(response.data.rootTitle));
|
let savePath = result.filePaths[0];
|
||||||
|
if (option.type !== "word" && !savePath.endsWith(response.data.rootTitle)) {
|
||||||
|
savePath = path.join(savePath, replaceLocalPath(response.data.rootTitle));
|
||||||
|
}
|
||||||
savePath = savePath.trim();
|
savePath = savePath.trim();
|
||||||
fetchPost(url, {
|
fetchPost(url, {
|
||||||
id: option.id,
|
id: option.id,
|
||||||
|
@ -27,9 +27,9 @@ import {openHistory} from "./history";
|
|||||||
import {initStatus} from "../layout/status";
|
import {initStatus} from "../layout/status";
|
||||||
import {syncGuide} from "../sync/syncGuide";
|
import {syncGuide} from "../sync/syncGuide";
|
||||||
import {showMessage} from "../dialog/message";
|
import {showMessage} from "../dialog/message";
|
||||||
import {replaceLocalPath} from "../editor/rename";
|
|
||||||
import {editor} from "../config/editor";
|
import {editor} from "../config/editor";
|
||||||
import {goBack, goForward} from "./backForward";
|
import {goBack, goForward} from "./backForward";
|
||||||
|
import {replaceLocalPath} from "../editor/rename";
|
||||||
|
|
||||||
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
const matchKeymap = (keymap: Record<string, IKeymapItem>, key1: "general" | "editor", key2?: "general" | "insert" | "heading" | "list" | "table") => {
|
||||||
if (key1 === "general") {
|
if (key1 === "general") {
|
||||||
@ -372,7 +372,6 @@ const initWindow = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
const msgId = showMessage(window.siyuan.languages.exporting, -1);
|
||||||
const filePath = result.filePaths[0].endsWith(ipcData.rootTitle) ? result.filePaths[0] : path.join(result.filePaths[0], replaceLocalPath(ipcData.rootTitle));
|
|
||||||
localStorage.setItem(Constants.LOCAL_EXPORTPDF, JSON.stringify(Object.assign(ipcData.pdfOptions, {
|
localStorage.setItem(Constants.LOCAL_EXPORTPDF, JSON.stringify(Object.assign(ipcData.pdfOptions, {
|
||||||
removeAssets: ipcData.removeAssets,
|
removeAssets: ipcData.removeAssets,
|
||||||
keepFold: ipcData.keepFold
|
keepFold: ipcData.keepFold
|
||||||
@ -383,9 +382,9 @@ const initWindow = () => {
|
|||||||
id: ipcData.rootId,
|
id: ipcData.rootId,
|
||||||
pdf: true,
|
pdf: true,
|
||||||
removeAssets: ipcData.removeAssets,
|
removeAssets: ipcData.removeAssets,
|
||||||
savePath: filePath
|
savePath: result.filePaths[0]
|
||||||
}, () => {
|
}, () => {
|
||||||
const pdfFilePath = path.join(filePath, path.basename(filePath) + ".pdf");
|
const pdfFilePath = path.join(result.filePaths[0], replaceLocalPath(ipcData.rootTitle) + ".pdf");
|
||||||
fs.writeFileSync(pdfFilePath, pdfData);
|
fs.writeFileSync(pdfFilePath, pdfData);
|
||||||
destroyPrintWindow();
|
destroyPrintWindow();
|
||||||
fetchPost("/api/export/addPDFOutline", {
|
fetchPost("/api/export/addPDFOutline", {
|
||||||
@ -413,7 +412,7 @@ const initWindow = () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
removePromise(path.join(filePath, "assets"));
|
removePromise(path.join(result.filePaths[0], "assets"));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user