Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions front/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,15 +618,16 @@ ipcRenderer.on("syncLinkedDisplay", (event, fileID, display) => {
// Handle App Closing
//////////////////////////////////////////////////////////////////

window.addEventListener("beforeunload", (event) => {
window.addEventListener("beforeunload", async(event) => {
ipcRenderer.send("closeAllDisplays")
isClosing = true;
if (OpenedFiles.GETJSONDATA().length > 0) {
event.preventDefault();
OpenedFiles.GETJSONDATA().forEach(async (e) => {
await closeFile(e.fileLink);
});
} else {
ipcRenderer.send("forceCloseWindow");
await ipcRenderer.send("forceCloseWindow");
}
});

Expand Down
19 changes: 18 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- Handle file picking
- Handle directory picking
- Handle window closures
- Close all displays
- Handle Display Restart
- Others

Expand Down Expand Up @@ -88,7 +89,11 @@ function createNewDisplay(fileLink) {
openedDisplays.DELETE(
openedDisplays.FINDQUICKINDEX("fileLink", fileLink)
);
mainWindow.webContents.send("deleteWindow", fileLink);
if(!mainWindow.isDestroyed()){
mainWindow.webContents.send("deleteWindow", fileLink);
} else {
app.quit()
}
});
}

Expand Down Expand Up @@ -205,6 +210,16 @@ ipcMain.on("forceCloseWindow", (event) => {
}
});

///////////////////////////////////////////////////////////////
// Close all displays
///////////////////////////////////////////////////////////////

ipcMain.on("closeAllDisplays", ()=>{
openedDisplays.GETJSONDATA().forEach((e)=>{
e.window.close();
})
})

///////////////////////////////////////////////////////////////
// Handle Display Restart
///////////////////////////////////////////////////////////////
Expand All @@ -218,6 +233,8 @@ ipcMain.on("restartDisplay", (event, args) => {
"fileLink"
)
);
openedDisplays
.READ(openedDisplays.FINDQUICKINDEX("fileLink", args), "window").show()
});

///////////////////////////////////////////////////////////////
Expand Down
Loading