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