浏览代码

: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

Daniel 1 年之前
父节点
当前提交
3ced66f749
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      app/electron/main.js

+ 8 - 4
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"),