diff --git a/app/electron/main.js b/app/electron/main.js index fa87a2e5f..43f0d4327 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -908,10 +908,12 @@ app.whenReady().then(() => { }); ipcMain.on("siyuan-export-newwindow", (event, data) => { // 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 wndBounds = getWindowByContentId(event.sender.id).getBounds(); + const wndScreen = screen.getDisplayNearestPoint({x: wndBounds.x, y: wndBounds.y}); const printWin = new BrowserWindow({ show: true, - width: Math.floor(screen.getPrimaryDisplay().size.width * 0.8), - height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8), + width: Math.floor(wndScreen.size.width * 0.8), + height: Math.floor(wndScreen.size.height * 0.8), resizable: true, frame: "darwin" === process.platform, icon: path.join(appDir, "stage", "icon-large.png"), @@ -924,6 +926,7 @@ app.whenReady().then(() => { autoplayPolicy: "user-gesture-required" // 桌面端禁止自动播放多媒体 https://github.com/siyuan-note/siyuan/issues/7587 }, }); + printWin.center(); printWin.webContents.userAgent = "SiYuan/" + appVer + " https://b3log.org/siyuan Electron " + printWin.webContents.userAgent; printWin.loadURL(data); printWin.webContents.on("will-navigate", (nEvent) => { diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index f3bdf0fe0..d4aed231e 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -383,7 +383,7 @@ const renderPDF = async (id: string) => { }) } const renderPreview = (data) => { - previewElement.innerHTML = '
' + data.content + '
'; + previewElement.innerHTML = '
' + data.content + '
'; const wysElement = previewElement.querySelector(".protyle-wysiwyg"); wysElement.setAttribute("data-doc-type", data.type || "NodeDocument"); if (data.attrs.memo) {