diff --git a/chrome/content/zotero/elements/itemPaneSidenav.js b/chrome/content/zotero/elements/itemPaneSidenav.js index 68a17fc275..fb7150a727 100644 --- a/chrome/content/zotero/elements/itemPaneSidenav.js +++ b/chrome/content/zotero/elements/itemPaneSidenav.js @@ -28,11 +28,6 @@ { class ItemPaneSidenav extends XULElementBase { content = MozXULElement.parseXULToFragment(` - - - - + + + + + + + + @@ -180,10 +186,6 @@ this.render(); } - get _showCollapseButton() { - return false; - } - isPanePinnable(id) { return id !== 'info' && id !== 'context-all-notes' && id !== 'context-item-notes'; } @@ -209,6 +211,24 @@ this.addEventListener('click', this.handleButtonClick); + // Set up action toolbarbuttons + for (let toolbarbutton of this.querySelectorAll('toolbarbutton[data-action]')) { + let action = toolbarbutton.dataset.action; + + if (action === 'locate') { + toolbarbutton.addEventListener('mousedown', async (event) => { + if (event.button !== 0 || toolbarbutton.open) { + return; + } + event.preventDefault(); + let menu = toolbarbutton.querySelector('menupopup'); + await Zotero_LocateMenu.buildLocateMenu(menu); + await document.l10n.translateFragment(menu); + toolbarbutton.open = true; + }); + } + } + this.querySelector('.zotero-menuitem-pin').addEventListener('command', () => { this.container.scrollToPane(this._contextMenuTarget, 'smooth'); this.pinnedPane = this._contextMenuTarget; @@ -226,7 +246,7 @@ if (!this.container) return; let contextNotesPaneVisible = this._contextNotesPaneVisible; let pinnedPane = this.pinnedPane; - for (let toolbarbutton of this.querySelectorAll('toolbarbutton')) { + for (let toolbarbutton of this.querySelectorAll('toolbarbutton[data-pane]')) { let pane = toolbarbutton.dataset.pane; // TEMP: never disable context notes button if (this._contextNotesPane) { @@ -244,17 +264,6 @@ continue; } - else if (pane == 'toggle-collapse') { - let hidden = !this._showCollapseButton; - - toolbarbutton.parentElement.hidden = hidden; - toolbarbutton.parentElement.nextElementSibling.hidden = hidden; // Divider - - toolbarbutton.setAttribute('data-l10n-id', 'sidenav-' + (this._collapsed ? 'expand' : 'collapse')); - toolbarbutton.classList.toggle('collapsed', this._collapsed); - - continue; - } toolbarbutton.setAttribute('aria-selected', !contextNotesPaneVisible && pane == pinnedPane); // No need to set `hidden` here, since it's updated by ItemDetails#_handlePaneStatus @@ -262,6 +271,14 @@ toolbarbutton.parentElement.classList.toggle('pinned', pane == pinnedPane); } + for (let toolbarbutton of this.querySelectorAll('toolbarbutton[data-action]')) { + let action = toolbarbutton.dataset.action; + + if (action == 'locate') { + toolbarbutton.parentElement.hidden = false; + } + } + this.querySelector('.highlight-notes-active').classList.toggle('highlight', contextNotesPaneVisible); this.querySelector('.highlight-notes-inactive').classList.toggle('highlight', this._contextNotesPane && !contextNotesPaneVisible); @@ -338,12 +355,16 @@ renderDefaultStatus() { if (this._defaultStatus) { - this.querySelectorAll('toolbarbutton').forEach((elem) => { + this.querySelectorAll('toolbarbutton[data-pane]').forEach((elem) => { elem.disabled = true; elem.parentElement.hidden = !( ["info", "abstract", "attachments", "notes", "libraries-collections", "tags", "related"] .includes(elem.dataset.pane)); }); + + this.querySelectorAll('toolbarbutton[data-action]').forEach((elem) => { + elem.disabled = false; + }); } else { this.querySelectorAll('toolbarbutton').forEach((elem) => { @@ -367,12 +388,6 @@ } this._contextNotesPaneVisible = true; break; - case "toggle-collapse": - if (event.button !== 0) { - return; - } - this._collapsed = !this._collapsed; - break; default: { if (event.button !== 0) { return; diff --git a/chrome/content/zotero/locateMenu.js b/chrome/content/zotero/locateMenu.js index 86c2bdd03c..b1a6db557b 100644 --- a/chrome/content/zotero/locateMenu.js +++ b/chrome/content/zotero/locateMenu.js @@ -34,7 +34,7 @@ var Zotero_LocateMenu = new function() { /** * Clear and build the locate menu */ - this.buildLocateMenu = function (locateMenu) { + this.buildLocateMenu = async function (locateMenu) { // clear menu while(locateMenu.childElementCount > 0) { locateMenu.removeChild(locateMenu.firstChild); @@ -43,7 +43,7 @@ var Zotero_LocateMenu = new function() { var selectedItems = _getSelectedItems(); if(selectedItems.length) { - _addViewOptions(locateMenu, selectedItems, true, true, true); + await _addViewOptions(locateMenu, selectedItems, true, true, true); var availableEngines = _getAvailableLocateEngines(selectedItems); // add engines that are available for selected items diff --git a/chrome/skin/default/zotero/20/universal/go-to.svg b/chrome/skin/default/zotero/20/universal/go-to.svg index cb0f67e979..b4fce697de 100644 --- a/chrome/skin/default/zotero/20/universal/go-to.svg +++ b/chrome/skin/default/zotero/20/universal/go-to.svg @@ -1,3 +1,3 @@ - + diff --git a/chrome/skin/default/zotero/itempane/20/collapse.svg b/chrome/skin/default/zotero/itempane/20/collapse.svg deleted file mode 100644 index 4d6fc44585..0000000000 --- a/chrome/skin/default/zotero/itempane/20/collapse.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/chrome/skin/default/zotero/itempane/20/expand.svg b/chrome/skin/default/zotero/itempane/20/expand.svg deleted file mode 100644 index 09edacb6e3..0000000000 --- a/chrome/skin/default/zotero/itempane/20/expand.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/chrome/skin/default/zotero/locate.svg b/chrome/skin/default/zotero/locate.svg deleted file mode 100644 index baabcd02fd..0000000000 --- a/chrome/skin/default/zotero/locate.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/scss/elements/_itemPaneSidenav.scss b/scss/elements/_itemPaneSidenav.scss index a17cd3bce8..f2f01a5a4c 100644 --- a/scss/elements/_itemPaneSidenav.scss +++ b/scss/elements/_itemPaneSidenav.scss @@ -88,27 +88,16 @@ item-pane-sidenav { } } - // Special case for Notes context pane button: + // Notes context pane button &[data-pane="context-notes"] { list-style-image: url("chrome://zotero/skin/itempane/20/notes.svg"); fill: map.get($item-pane-sections, "notes"); stroke: map.get($item-pane-sections, "notes"); } - // Special case for Expand/Collapse button: - &[data-pane="toggle-collapse"] { - list-style-image: url("chrome://zotero/skin/itempane/20/collapse.svg"); - - &.collapsed { - list-style-image: url("chrome://zotero/skin/itempane/20/expand.svg"); - } - - &:-moz-locale-dir(rtl) { - transform: scaleX(-1); - } - - fill: var(--fill-secondary); - stroke: var(--fill-secondary); + // Locate button + &[data-action="locate"] { + @include svgicon-menu("go-to", "universal", "20"); } &[custom] { @@ -124,10 +113,6 @@ item-pane-sidenav { } } - &.stacked toolbarbutton[data-pane="toggle-collapse"] { - transform: rotate(90deg); - } - &:not(.stacked) > .divider { width: 20px; height: 0; @@ -140,7 +125,7 @@ item-pane-sidenav { border-inline-end: 1px solid var(--fill-quinary); } - menupopup { + .context-menu { @include macOS-hide-menu-icons; } }