This commit is contained in:
Vanessa 2023-10-08 23:17:51 +08:00
parent 797716fa1d
commit 56f4b6274d
6 changed files with 35 additions and 31 deletions

View file

@ -683,6 +683,22 @@ app.whenReady().then(() => {
if (data.cmd === "printToPDF") {
return getWindowByContentId(data.webContentsId).webContents.printToPDF(data.pdfOptions);
}
if (data.cmd === "siyuan-open-file") {
let hasMatch = false;
BrowserWindow.getAllWindows().find(item => {
if (item.webContents.id === event.sender.id) {
return;
}
const ids = decodeURIComponent(new URL(item.webContents.getURL()).hash.substring(1)).split("\u200b");
if (ids.includes(data.options.rootID) || ids.includes(data.options.assetPath)) {
item.focus();
item.webContents.send("siyuan-open-file", data.options);
hasMatch = true;
return true;
}
});
return hasMatch
}
});
ipcMain.on("siyuan-cmd", (event, data) => {
let cmd = data;