fx-compat: Fix attachment rename, remove <links-box> observer

<links-box> doesn't actually have a notify() method, so an error was
being thrown on each notification.
This commit is contained in:
Abe Jellinek 2022-05-27 13:28:07 -06:00
parent 1ef40d9423
commit 496f34117c
3 changed files with 9 additions and 13 deletions

View file

@ -258,7 +258,7 @@
title.className = 'zotero-clicky'; title.className = 'zotero-clicky';
// For the time being, use a silly little popup // For the time being, use a silly little popup
title.addEventListener('click', this.editTitle, false); title.addEventListener('click', () => this.editTitle(), false);
} }
var isImportedURL = this.item.attachmentLinkMode == var isImportedURL = this.item.attachmentLinkMode ==
@ -420,7 +420,7 @@
selectButton.label = this.buttonCaption; selectButton.label = this.buttonCaption;
selectButton.hidden = false; selectButton.hidden = false;
selectButton.setAttribute('oncommand', selectButton.setAttribute('oncommand',
'document.getBindingParent(this).clickHandler(this)'); event => this.clickHandler(event.target));
} }
else { else {
selectButton.hidden = true; selectButton.hidden = true;
@ -428,12 +428,11 @@
} }
editTitle() { editTitle() {
return Zotero.spawn(async () => { return (async () => {
var item = document.getBindingParent(this).item; var item = this.item;
var oldTitle = item.getField('title'); var oldTitle = item.getField('title');
var nsIPS = Components.classes["@mozilla.org/embedcomp/prompt-service;1"] var nsIPS = Services.prompt;
.getService(Components.interfaces.nsIPromptService);
var newTitle = { value: oldTitle }; var newTitle = { value: oldTitle };
var checkState = { value: Zotero.Prefs.get('lastRenameAssociatedFile') }; var checkState = { value: Zotero.Prefs.get('lastRenameAssociatedFile') };
@ -525,7 +524,7 @@
item.setField('title', newTitle.value); item.setField('title', newTitle.value);
await item.saveTx(); await item.saveTx();
} }
}); })();
} }
onViewClick(event) { onViewClick(event) {
@ -537,7 +536,7 @@
} }
updateItemIndexedState() { updateItemIndexedState() {
return Zotero.spawn(async () => { return (async () => {
var indexStatus = this._id('index-status'); var indexStatus = this._id('index-status');
var reindexButton = this._id('reindex'); var reindexButton = this._id('reindex');
@ -582,7 +581,7 @@
else { else {
reindexButton.setAttribute('hidden', true); reindexButton.setAttribute('hidden', true);
} }
}, this); })();
} }
_id(id) { _id(id) {

View file

@ -383,8 +383,6 @@
this._id('parent-value').addEventListener('click', this._parentClickHandler); this._id('parent-value').addEventListener('click', this._parentClickHandler);
this._id('related-value').addEventListener('click', this._relatedClickHandler); this._id('related-value').addEventListener('click', this._relatedClickHandler);
this._id('tags-value').addEventListener('click', this._tagsClickHandler); this._id('tags-value').addEventListener('click', this._tagsClickHandler);
this._notifierID = Zotero.Notifier.registerObserver(this, ['item'], 'itembox');
} }
destroy() { destroy() {
@ -393,8 +391,6 @@
} }
window.removeEventListener("unload", this.destroy); window.removeEventListener("unload", this.destroy);
this._destroyed = true; this._destroyed = true;
Zotero.Notifier.unregisterObserver(this._notifierID);
} }
disconnectedCallback() { disconnectedCallback() {

View file

@ -1,2 +1,3 @@
@import "components/attachmentBox"; @import "components/attachmentBox";
@import "components/textLink"; @import "components/textLink";
@import "components/clicky";