diff --git a/app/src/assets/scss/export.scss b/app/src/assets/scss/export.scss index 748cc402e..29377d311 100644 --- a/app/src/assets/scss/export.scss +++ b/app/src/assets/scss/export.scss @@ -3,6 +3,10 @@ @import "typography"; @import "wysiwyg"; @import "function"; +@import "button"; +@import "select"; +@import "switch"; +@import "slider"; .protyle-wysiwyg a { color: var(--b3-protyle-inline-link-color); diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index f10c433f8..6e5950047 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -15,6 +15,7 @@ import {lockFile} from "../../dialog/processSystem"; import {pathPosix} from "../../util/pathName"; import {replaceLocalPath} from "../../editor/rename"; + export const saveExport = (option: { type: string, id: string }) => { /// #if !BROWSER if (option.type === "pdf") { @@ -61,6 +62,12 @@ export const saveExport = (option: { type: string, id: string }) => { }; /// #if !BROWSER +const destroyWin = (win: Electron.BrowserWindow) => { + setTimeout(() => { + win.destroy(); + }, 1000); +}; + const renderPDF = (id: string) => { const localData = JSON.parse(localStorage.getItem(Constants.LOCAL_EXPORTPDF) || JSON.stringify({ printBackground: true, @@ -73,7 +80,8 @@ const renderPDF = (id: string) => { const servePath = window.location.protocol + "//" + window.location.host; const win = new BrowserWindow({ show: true, - width: 1024, // 860 + width: 1032, + resizable: false, webPreferences: { contextIsolation: false, nodeIntegration: true, @@ -130,16 +138,19 @@ const renderPDF = (id: string) => { }; removePromise(path.join(filePath, "assets")); } - win.destroy(); }); }); + destroyWin(win) }).catch((error: string) => { showMessage("Export PDF error:" + error, 0, "error", msgId); - win.destroy(); + destroyWin(win) }); } catch (e) { showMessage("Export PDF error:" + e + ". Export HTML and use Chrome's printing function to convert to PDF", 0, "error", msgId); + destroyWin(win) } + } else { + destroyWin(win) } }) }) @@ -207,6 +218,29 @@ const renderPDF = (id: string) => { ${response.data.name} - ${window.siyuan.languages.siyuanNote} v${Constants.SIYUAN_VERSION} -
-
${response.data.content.replace(/