mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
This commit is contained in:
parent
1ab43ec9aa
commit
37e88627c0
2 changed files with 9 additions and 5 deletions
|
|
@ -59,9 +59,13 @@ const exitApp = (port, errorWindowId) => {
|
|||
try {
|
||||
const currentURL = new URL(item.getURL());
|
||||
if (port.toString() === currentURL.port.toString()) {
|
||||
if (currentURL.href.indexOf("/stage/build/app/?v=") > -1) {
|
||||
mainWindow = item;
|
||||
} else {
|
||||
const hasMain = workspaces.find((workspaceItem) => {
|
||||
if (workspaceItem.browserWindow.id === item.id) {
|
||||
mainWindow = item
|
||||
return true;
|
||||
}
|
||||
})
|
||||
if (!hasMain) {
|
||||
item.destroy();
|
||||
}
|
||||
}
|
||||
|
|
@ -70,7 +74,7 @@ const exitApp = (port, errorWindowId) => {
|
|||
}
|
||||
});
|
||||
workspaces.find((item, index) => {
|
||||
if (mainWindow.id === item.browserWindow.id) {
|
||||
if (mainWindow && mainWindow.id === item.browserWindow.id) {
|
||||
if (workspaces.length > 1) {
|
||||
item.browserWindow.destroy();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -437,7 +437,7 @@
|
|||
try {
|
||||
const {ipcRenderer} = require('electron')
|
||||
const {getCurrentWindow} = require('@electron/remote')
|
||||
ipcRenderer.send('siyuan-quit', getCurrentWindow().id)
|
||||
ipcRenderer.send('siyuan-quit', location.port)
|
||||
} catch (e) {
|
||||
if ((window.webkit && window.webkit.messageHandlers) || window.JSAndroid) {
|
||||
window.location.href = 'siyuan://api/system/exit'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue