Don't close window with Cmd-W on first tab if other tabs are open

Closes #2572
This commit is contained in:
Dan Stillman 2023-05-29 05:50:29 -04:00
parent 7c902d40a9
commit d5a584c28b
3 changed files with 14 additions and 1 deletions

View file

@ -52,6 +52,10 @@ var Zotero_Tabs = new function () {
get: () => document.getElementById('tabs-deck')
});
Object.defineProperty(this, 'numTabs', {
get: () => this._tabs.length
});
this._tabBarRef = React.createRef();
this._tabs = [{
id: 'zotero-pane',

View file

@ -795,6 +795,15 @@ var ZoteroPane = new function()
}
this.handleClose = function (event) {
// Don't close the window from the first tab if other tabs are open
if (Zotero_Tabs.numTabs > 1) {
return;
}
window.close();
};
/*
* Highlights collections containing selected items on Ctrl (Win) or
* Option/Alt (Mac/Linux) press

View file

@ -95,7 +95,7 @@
<commandset id="mainCommandSet">
<!--FILE-->
<command id="cmd_quitApplication" oncommand="goQuitApplication(event);"/>
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_close" oncommand="ZoteroPane.handleClose(event)"/>
<!--EDIT-->
<command id="cmd_find"