mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
8dac1d944c
commit
bf969395f4
2 changed files with 6 additions and 3 deletions
|
|
@ -908,10 +908,12 @@ app.whenReady().then(() => {
|
||||||
});
|
});
|
||||||
ipcMain.on("siyuan-export-newwindow", (event, data) => {
|
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
|
// 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({
|
const printWin = new BrowserWindow({
|
||||||
show: true,
|
show: true,
|
||||||
width: Math.floor(screen.getPrimaryDisplay().size.width * 0.8),
|
width: Math.floor(wndScreen.size.width * 0.8),
|
||||||
height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8),
|
height: Math.floor(wndScreen.size.height * 0.8),
|
||||||
resizable: true,
|
resizable: true,
|
||||||
frame: "darwin" === process.platform,
|
frame: "darwin" === process.platform,
|
||||||
icon: path.join(appDir, "stage", "icon-large.png"),
|
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
|
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.webContents.userAgent = "SiYuan/" + appVer + " https://b3log.org/siyuan Electron " + printWin.webContents.userAgent;
|
||||||
printWin.loadURL(data);
|
printWin.loadURL(data);
|
||||||
printWin.webContents.on("will-navigate", (nEvent) => {
|
printWin.webContents.on("will-navigate", (nEvent) => {
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ const renderPDF = async (id: string) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const renderPreview = (data) => {
|
const renderPreview = (data) => {
|
||||||
previewElement.innerHTML = '<div style="padding:0" class="protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}">' + data.content + '</div>';
|
previewElement.innerHTML = '<div style="padding:6px 0 0 0" class="protyle-wysiwyg${window.siyuan.config.editor.displayBookmarkIcon ? " protyle-wysiwyg--attr" : ""}">' + data.content + '</div>';
|
||||||
const wysElement = previewElement.querySelector(".protyle-wysiwyg");
|
const wysElement = previewElement.querySelector(".protyle-wysiwyg");
|
||||||
wysElement.setAttribute("data-doc-type", data.type || "NodeDocument");
|
wysElement.setAttribute("data-doc-type", data.type || "NodeDocument");
|
||||||
if (data.attrs.memo) {
|
if (data.attrs.memo) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue