Unregister tag selector when closed
This restores the pre-Reactification behavior.
This commit is contained in:
parent
94ccba45b9
commit
cdf9d7ff32
3 changed files with 19 additions and 16 deletions
|
@ -33,10 +33,7 @@ ZoteroPane.Containers = {
|
|||
},
|
||||
|
||||
loadPane() {
|
||||
var tagSelector = document.getElementById('zotero-tag-selector');
|
||||
ZoteroPane.tagSelector = Zotero.TagSelector.init(tagSelector, {
|
||||
onSelection: ZoteroPane.updateTagFilter.bind(ZoteroPane)
|
||||
});
|
||||
ZoteroPane.initTagSelector();
|
||||
},
|
||||
|
||||
async initIntlStrings() {
|
||||
|
@ -53,7 +50,7 @@ ZoteroPane.Containers = {
|
|||
},
|
||||
|
||||
destroy() {
|
||||
ZoteroPane.tagSelector.unregister();
|
||||
ZoteroPane.tagSelector.uninit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -189,18 +189,13 @@ Zotero.TagSelector = class TagSelectorContainer extends React.Component {
|
|||
this.state.viewOnly != (mode == 'view') && this.setState({viewOnly: mode == 'view'});
|
||||
}
|
||||
|
||||
unregister() {
|
||||
uninit() {
|
||||
ReactDOM.unmountComponentAtNode(this.domEl);
|
||||
if (this._notifierID) {
|
||||
Zotero.Notifier.unregisterObserver(this._notifierID);
|
||||
}
|
||||
}
|
||||
|
||||
uninit() {
|
||||
this.setState({searchString: ''});
|
||||
this.selectedTags = new Set();
|
||||
}
|
||||
|
||||
handleTagContext = (tag, ev) => {
|
||||
let tagContextMenu = document.getElementById('tag-menu');
|
||||
ev.preventDefault();
|
||||
|
|
|
@ -1088,21 +1088,32 @@ var ZoteroPane = new function()
|
|||
};
|
||||
|
||||
|
||||
this.initTagSelector = function () {
|
||||
this.tagSelector = Zotero.TagSelector.init(
|
||||
document.getElementById('zotero-tag-selector'),
|
||||
{
|
||||
onSelection: this.updateTagFilter.bind(this)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
this.toggleTagSelector = Zotero.Promise.coroutine(function* () {
|
||||
var tagSelector = document.getElementById('zotero-tag-selector-container');
|
||||
var container = document.getElementById('zotero-tag-selector-container');
|
||||
|
||||
var showing = tagSelector.getAttribute('collapsed') == 'true';
|
||||
tagSelector.setAttribute('collapsed', !showing);
|
||||
var showing = container.getAttribute('collapsed') == 'true';
|
||||
container.setAttribute('collapsed', !showing);
|
||||
|
||||
// If showing, set scope to items in current view
|
||||
// and focus filter textbox
|
||||
if (showing) {
|
||||
this.initTagSelector();
|
||||
yield this.setTagScope();
|
||||
ZoteroPane_Local.tagSelector.focusTextbox();
|
||||
ZoteroPane.tagSelector.focusTextbox();
|
||||
}
|
||||
// If hiding, clear selection
|
||||
else {
|
||||
ZoteroPane_Local.tagSelector.uninit();
|
||||
ZoteroPane.tagSelector.uninit();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue