This commit is contained in:
parent
d67235589c
commit
f723206423
2 changed files with 10 additions and 17 deletions
|
@ -700,6 +700,9 @@ app.whenReady().then(() => {
|
|||
if (data.cmd === "showOpenDialog") {
|
||||
return dialog.showOpenDialog(data);
|
||||
}
|
||||
if (data.cmd === "getCurrentWindowId") {
|
||||
return event.sender.id;
|
||||
}
|
||||
if (data.cmd === "setProxy") {
|
||||
return setProxy(data.proxyURL, event.sender);
|
||||
}
|
||||
|
@ -904,26 +907,12 @@ app.whenReady().then(() => {
|
|||
}
|
||||
data.filePaths = result.filePaths;
|
||||
data.webContentsId = event.sender.id;
|
||||
const wnd = getWindowByContentId(event.sender.id);
|
||||
if (!wnd) {
|
||||
// 文档已经被删除的情况下关闭窗口,下同
|
||||
event.sender.destroy();
|
||||
return;
|
||||
}
|
||||
const parentWnd = wnd.getParentWindow();
|
||||
if (!parentWnd) {
|
||||
event.sender.destroy();
|
||||
return;
|
||||
}
|
||||
parentWnd.send("siyuan-export-pdf", data);
|
||||
getWindowByContentId(data.parentWindowId).send("siyuan-export-pdf", data);
|
||||
});
|
||||
});
|
||||
ipcMain.on("siyuan-export-newwindow", (event, data) => {
|
||||
const parentWnd = getWindowByContentId(event.sender.id);
|
||||
const parentWndBounds = parentWnd.getBounds();
|
||||
const parentWndBounds = getWindowByContentId(event.sender.id).getBounds();
|
||||
const parentWndScreen = screen.getDisplayNearestPoint({x: parentWndBounds.x, y: parentWndBounds.y});
|
||||
parentWndScreen.size.width;
|
||||
|
||||
// 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 printWin = new BrowserWindow({
|
||||
show: true,
|
||||
|
|
|
@ -81,7 +81,7 @@ const getSnippetCSS = () => {
|
|||
};
|
||||
|
||||
/// #if !BROWSER
|
||||
const renderPDF = (id: string) => {
|
||||
const renderPDF = async (id: string) => {
|
||||
const localData = window.siyuan.storage[Constants.LOCAL_EXPORTPDF];
|
||||
const servePath = window.location.protocol + "//" + window.location.host;
|
||||
const isDefault = (window.siyuan.config.appearance.mode === 1 && window.siyuan.config.appearance.themeDark === "midnight") || (window.siyuan.config.appearance.mode === 0 && window.siyuan.config.appearance.themeLight === "daylight");
|
||||
|
@ -89,6 +89,9 @@ const renderPDF = (id: string) => {
|
|||
if (!isDefault) {
|
||||
themeStyle = `<link rel="stylesheet" type="text/css" id="themeStyle" href="${servePath}/appearance/themes/${window.siyuan.config.appearance.themeLight}/theme.css?${Constants.SIYUAN_VERSION}"/>`;
|
||||
}
|
||||
const currentWindowId = await ipcRenderer.invoke(Constants.SIYUAN_GET, {
|
||||
cmd: "getCurrentWindowId",
|
||||
})
|
||||
// data-theme-mode="light" https://github.com/siyuan-note/siyuan/issues/7379
|
||||
const html = `<!DOCTYPE html>
|
||||
<html lang="${window.siyuan.config.appearance.lang}" data-theme-mode="light" data-light-theme="${window.siyuan.config.appearance.themeLight}" data-dark-theme="${window.siyuan.config.appearance.themeDark}">
|
||||
|
@ -542,6 +545,7 @@ const renderPDF = (id: string) => {
|
|||
removeAssets: actionElement.querySelector("#removeAssets").checked,
|
||||
rootId: "${id}",
|
||||
rootTitle: response.data.name,
|
||||
parentWindowId: ${currentWindowId},
|
||||
})
|
||||
previewElement.classList.add("exporting");
|
||||
previewElement.style.zoom = "";
|
||||
|
|
Loading…
Add table
Reference in a new issue