From 3ced66f749bc5090ca4116efc404ef6cb4a80e4d Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 9 Mar 2024 18:05:36 +0800 Subject: [PATCH] :art: The PDF/Word export preview window automatically adjusts according to the size of the main window https://github.com/siyuan-note/siyuan/issues/10554 --- app/electron/main.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index d107f3408..d293d3838 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -859,12 +859,16 @@ app.whenReady().then(() => { }); }); ipcMain.on("siyuan-export-newwindow", (event, data) => { + const parentWnd = getWindowByContentId(event.sender.id); + // The PDF/Word export preview window automatically adjusts according to the size of the main window https://github.com/siyuan-note/siyuan/issues/10554 + const width = parentWnd.getBounds().width * 0.8; + const height = parentWnd.getBounds().height * 0.8; const printWin = new BrowserWindow({ - parent: getWindowByContentId(event.sender.id), - modal: true, + parent: parentWnd, + modal: false, show: true, - width: Math.floor(screen.getPrimaryDisplay().size.width * 0.8), - height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8), + width: width, + height: height, resizable: false, frame: "darwin" === process.platform, icon: path.join(appDir, "stage", "icon-large.png"),