fx-compat: Item box: Fix URL opening and field blurring

This commit is contained in:
Abe Jellinek 2022-06-10 13:59:01 -05:00
parent 7dd60abb11
commit ac9e882bda

View file

@ -560,7 +560,7 @@
&& Zotero.Utilities.isHTTPURL(val, true)) { && Zotero.Utilities.isHTTPURL(val, true)) {
th.classList.add("pointer"); th.classList.add("pointer");
// TODO: make getFieldValue non-private and use below instead // TODO: make getFieldValue non-private and use below instead
th.setAttribute("onclick", "Zotero.launchURL(this.nextSibling.firstChild ? this.nextSibling.firstChild.textContent : this.nextSibling.value)"); th.setAttribute("onclick", "Zotero.launchURL(this.nextSibling.firstChild.value || this.nextSibling.firstChild.textContent)");
th.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip')); th.setAttribute("tooltiptext", Zotero.getString('pane.item.viewOnline.tooltip'));
} }
else if (fieldName == 'DOI' && val && typeof val == 'string') { else if (fieldName == 'DOI' && val && typeof val == 'string') {
@ -593,8 +593,8 @@
th.classList.add("pointer"); th.classList.add("pointer");
} }
th.addEventListener('click', function () { th.addEventListener('click', function () {
if (this.nextSibling.inputField) { if (this.nextSibling.querySelector('input, textarea')) {
this.nextSibling.inputField.blur(); this.nextSibling.querySelector('input, textarea').blur();
} }
else { else {
this.getRootNode().host.toggleAbstractExpand( this.getRootNode().host.toggleAbstractExpand(
@ -604,8 +604,11 @@
}); });
} }
else { else {
th.setAttribute("onclick", th.addEventListener('click', function () {
"if (this.nextSibling.inputField) { this.nextSibling.inputField.blur(); }"); if (this.nextSibling.querySelector('input, textarea')) {
this.nextSibling.querySelector('input, textarea').blur();
}
});
} }
let td = document.createElement('td'); let td = document.createElement('td');