disable file > close for library if 1+ tabs open (#3210)

When there are multiple tabs opened, menuitem File > Close is disabled for the library tab.

Fixes: #3198
This commit is contained in:
abaevbog 2023-07-18 00:40:19 -07:00 committed by GitHub
parent e37eaac8d1
commit 9599d1712c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,6 +83,9 @@ var Zotero_Tabs = new function () {
selected: tab.id == this._selectedID,
iconBackgroundImage: tab.iconBackgroundImage
})));
// Disable File > Close menuitem if multiple tabs are open
const multipleTabsOpen = this._tabs.length > 1;
document.getElementById('cmd_close').setAttribute('disabled', multipleTabsOpen);
var { tab } = this._getTab(this._selectedID);
document.title = (tab.title.length ? tab.title + ' - ' : '') + Zotero.appName;
this._updateTabBar();