Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-02-23 13:20:28 +08:00
commit d59c131170
16 changed files with 264 additions and 69 deletions

View file

@ -1,7 +1,7 @@
import {hideMessage, showMessage} from "../../dialog/message";
import {Constants} from "../../constants";
/// #if !BROWSER
import {OpenDialogReturnValue, ipcRenderer} from "electron";
import {ipcRenderer, OpenDialogReturnValue} from "electron";
import {app, BrowserWindow, dialog, getCurrentWindow} from "@electron/remote";
import * as fs from "fs";
import * as path from "path";
@ -33,14 +33,14 @@ export const saveExport = (option: { type: string, id: string }) => {
content: `<div class="b3-dialog__content">
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.exportPDF4}
${window.siyuan.languages.removeAssetsFolder}
</div>
<span class="fn__space"></span>
<input id="removeAssets" class="b3-switch" type="checkbox" ${localData.removeAssets ? "checked" : ""}>
</label>
<label class="fn__flex b3-label">
<div class="fn__flex-1">
${window.siyuan.languages.exportPDF6}
${window.siyuan.languages.mergeSubdocs}
</div>
<span class="fn__space"></span>
<input id="mergeSubdocs" class="b3-switch" type="checkbox" ${localData.mergeSubdocs ? "checked" : ""}>
@ -215,7 +215,7 @@ const renderPDF = (id: string) => {
</label>
<label class="b3-label">
<div>
${window.siyuan.languages.exportPDF6}
${window.siyuan.languages.mergeSubdocs}
</div>
<span class="fn__hr"></span>
<input id="mergeSubdocs" class="b3-switch" type="checkbox" ${localData.mergeSubdocs ? "checked" : ""}>

View file

@ -3,7 +3,7 @@ import {exportLayout, getInstanceById, JSONToLayout, resetLayout, resizeDrag, re
import {hotKey2Electron, setStorageVal, updateHotkeyTip} from "../protyle/util/compatibility";
/// #if !BROWSER
import {dialog, getCurrentWindow} from "@electron/remote";
import {webFrame, ipcRenderer, OpenDialogReturnValue} from "electron";
import {ipcRenderer, OpenDialogReturnValue, webFrame} from "electron";
import * as fs from "fs";
import * as path from "path";
import {afterExport} from "../protyle/export/util";
@ -418,10 +418,11 @@ export const initWindow = () => {
const pdfFilePath = path.join(result.filePaths[0], replaceLocalPath(ipcData.rootTitle) + ".pdf");
fs.writeFileSync(pdfFilePath, pdfData);
window.siyuan.printWin.destroy();
fetchPost("/api/export/addPDFOutline", {
fetchPost("/api/export/processPDF", {
id: ipcData.rootId,
merge: ipcData.mergeSubdocs,
path: pdfFilePath
path: pdfFilePath,
removeAssets: ipcData.removeAssets,
}, () => {
afterExport(pdfFilePath, msgId);
if (ipcData.removeAssets) {