From c7698a2324b67ade6caaaac9e08d06868c247c36 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 7 Mar 2019 04:08:45 -0500 Subject: [PATCH] Restore disabling of automatic tag deletion option when no such tags --- chrome/content/zotero/containers/tagSelector.jsx | 2 +- chrome/content/zotero/containers/tagSelector.xul | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/containers/tagSelector.jsx b/chrome/content/zotero/containers/tagSelector.jsx index 3548fa3a21..efb0a2dd6b 100644 --- a/chrome/content/zotero/containers/tagSelector.jsx +++ b/chrome/content/zotero/containers/tagSelector.jsx @@ -159,7 +159,7 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component { onSelect={this.state.viewOnly ? () => {} : this.handleTagSelected} onTagContext={this.handleTagContext} onSearch={this.handleSearch} - onSettings={this.handleSettings} + onSettings={this.handleSettings.bind(this)} loaded={this.state.loaded} />; } diff --git a/chrome/content/zotero/containers/tagSelector.xul b/chrome/content/zotero/containers/tagSelector.xul index d84e384080..f056b539fa 100644 --- a/chrome/content/zotero/containers/tagSelector.xul +++ b/chrome/content/zotero/containers/tagSelector.xul @@ -41,7 +41,18 @@ onpopupshowing=" document.getElementById('show-automatic').setAttribute('checked', ZoteroPane.tagSelector.showAutomatic); document.getElementById('display-all-tags').setAttribute('checked', ZoteroPane.tagSelector.displayAllTags); - document.getElementById('num-selected').label = ZoteroPane.tagSelector.label"> + document.getElementById('num-selected').label = ZoteroPane.tagSelector.label; + (async function () { + var libraryID = ZoteroPane.tagSelector.libraryID; + var library = Zotero.Libraries.get(libraryID); + var enabled = false; + if (library.editable) { + if ((await Zotero.Tags.getAutomaticInLibrary(libraryID)).length) { + enabled = true; + } + } + document.getElementById('delete-automatic-tags').disabled = !enabled; + })();">