Make Tags/Related sections functional in note windows

Fixes #3581
This commit is contained in:
Abe Jellinek 2024-02-05 17:09:45 -05:00
parent f29f87ad5b
commit de89e82e75
2 changed files with 13 additions and 3 deletions

View file

@ -285,8 +285,12 @@
});
}
get _disableCollapsing() {
return !!this.closest('panel, menupopup');
}
_handleClick = (event) => {
if (!this._getSidenav()) return;
if (this._disableCollapsing) return;
if (event.target.closest('.section-custom-button, menupopup')) return;
this.open = !this.open;
};
@ -373,7 +377,11 @@
_getSidenav() {
// If we're inside a popup, the main window sidenav is irrelevant
if (this.closest('popup, menupopup')) {
if (this.closest('panel, menupopup')) {
return null;
}
// If we're not in the main window, we don't have a sidenav
if (document.documentElement.getAttribute('windowtype') !== 'navigator:browser') {
return null;
}
// TODO: update this after unifying item pane & context pane
@ -395,7 +403,7 @@
this._head.setAttribute('aria-expanded', this.open);
this._title.textContent = this.label;
this._head.querySelector('.twisty').hidden = !this._getSidenav();
this._head.querySelector('.twisty').hidden = this._disableCollapsing;
}
}
customElements.define("collapsible-section", CollapsibleSection);

View file

@ -23,6 +23,8 @@
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
Services.scriptloader.loadSubScript("chrome://zotero/content/include.js", this);
Services.scriptloader.loadSubScript("resource://zotero/require.js", this);
Services.scriptloader.loadSubScript("chrome://global/content/globalOverlay.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/editMenuOverlay.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/note.js", this);