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() {
|
loadPane() {
|
||||||
var tagSelector = document.getElementById('zotero-tag-selector');
|
ZoteroPane.initTagSelector();
|
||||||
ZoteroPane.tagSelector = Zotero.TagSelector.init(tagSelector, {
|
|
||||||
onSelection: ZoteroPane.updateTagFilter.bind(ZoteroPane)
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async initIntlStrings() {
|
async initIntlStrings() {
|
||||||
|
@ -53,7 +50,7 @@ ZoteroPane.Containers = {
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy() {
|
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'});
|
this.state.viewOnly != (mode == 'view') && this.setState({viewOnly: mode == 'view'});
|
||||||
}
|
}
|
||||||
|
|
||||||
unregister() {
|
uninit() {
|
||||||
ReactDOM.unmountComponentAtNode(this.domEl);
|
ReactDOM.unmountComponentAtNode(this.domEl);
|
||||||
if (this._notifierID) {
|
if (this._notifierID) {
|
||||||
Zotero.Notifier.unregisterObserver(this._notifierID);
|
Zotero.Notifier.unregisterObserver(this._notifierID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uninit() {
|
|
||||||
this.setState({searchString: ''});
|
|
||||||
this.selectedTags = new Set();
|
|
||||||
}
|
|
||||||
|
|
||||||
handleTagContext = (tag, ev) => {
|
handleTagContext = (tag, ev) => {
|
||||||
let tagContextMenu = document.getElementById('tag-menu');
|
let tagContextMenu = document.getElementById('tag-menu');
|
||||||
ev.preventDefault();
|
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* () {
|
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';
|
var showing = container.getAttribute('collapsed') == 'true';
|
||||||
tagSelector.setAttribute('collapsed', !showing);
|
container.setAttribute('collapsed', !showing);
|
||||||
|
|
||||||
// If showing, set scope to items in current view
|
// If showing, set scope to items in current view
|
||||||
// and focus filter textbox
|
// and focus filter textbox
|
||||||
if (showing) {
|
if (showing) {
|
||||||
|
this.initTagSelector();
|
||||||
yield this.setTagScope();
|
yield this.setTagScope();
|
||||||
ZoteroPane_Local.tagSelector.focusTextbox();
|
ZoteroPane.tagSelector.focusTextbox();
|
||||||
}
|
}
|
||||||
// If hiding, clear selection
|
// If hiding, clear selection
|
||||||
else {
|
else {
|
||||||
ZoteroPane_Local.tagSelector.uninit();
|
ZoteroPane.tagSelector.uninit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue