Disable toolbar buttons in collections that cannot be edited
This commit is contained in:
parent
24742691b8
commit
223bfe74db
2 changed files with 15 additions and 2 deletions
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
.zotero-tb-button[open="true"],
|
||||
.zotero-tb-button:hover:active {
|
||||
.zotero-tb-button:not([disabled="true"]):hover:active {
|
||||
background: url("chrome://zotero/skin/mac/menubutton-end-pressed.png") right center no-repeat;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
.zotero-tb-button[open="true"] > .toolbarbutton-icon,
|
||||
.zotero-tb-button:hover:active > .toolbarbutton-icon {
|
||||
.zotero-tb-button:not([disabled="true"]):hover:active > .toolbarbutton-icon {
|
||||
background: url("chrome://zotero/skin/mac/menubutton-start-pressed.png") left center no-repeat;
|
||||
}
|
||||
|
||||
|
|
|
@ -1062,6 +1062,19 @@ var ZoteroPane = new function()
|
|||
itemgroup.setSearch('');
|
||||
itemgroup.setTags(getTagSelection());
|
||||
|
||||
// Enable or disable toolbar icons as necessary
|
||||
const disableIfNoEdit = ["cmd_zotero_newCollection", "zotero-tb-add",
|
||||
"cmd_zotero_newItemFromCurrentPage", "zotero-tb-lookup", "cmd_zotero_newStandaloneNote",
|
||||
"zotero-tb-note-add", "zotero-tb-attachment-add"];
|
||||
for(var i=0; i<disableIfNoEdit.length; i++) {
|
||||
var el = document.getElementById(disableIfNoEdit[i]);
|
||||
if(itemgroup.editable) {
|
||||
if(el.hasAttribute("disabled")) el.removeAttribute("disabled");
|
||||
} else {
|
||||
el.setAttribute("disabled", "true");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Zotero.UnresponsiveScriptIndicator.disable();
|
||||
this.itemsView = new Zotero.ItemTreeView(itemgroup);
|
||||
|
|
Loading…
Reference in a new issue