This commit is contained in:
Vanessa 2024-03-26 08:59:44 +08:00
parent 8dac1d944c
commit bf969395f4
2 changed files with 6 additions and 3 deletions

View file

@ -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) => {