Don't close window with Cmd-W on first tab if other tabs are open
Closes #2572
This commit is contained in:
parent
7c902d40a9
commit
d5a584c28b
3 changed files with 14 additions and 1 deletions
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue