Citation Explorer: Fix item tree menu view

This commit is contained in:
Adomas Venčkauskas 2025-09-24 12:32:34 +03:00
parent b7c5caa8ee
commit 2fb4c61064
3 changed files with 32 additions and 13 deletions

View file

@ -166,6 +166,8 @@ window.ZoteroDocumentCitations = {
onSelectionChange={this.onCitationSelectionChange.bind(this)}
getRowString={index => this._renderedCitationRows[index].title}
/>);
// Remove focus from itemList if focus is on citationList
// to prevent highlighting in both lists
domElem.addEventListener("focusin", (event) => {
itemList?.selection.clearSelection()
});
@ -194,9 +196,12 @@ window.ZoteroDocumentCitations = {
firstColumnExtraWidth: 28-16,
});
await itemList.waitForLoad();
// Remove focus from citationList if focus is on itemList
// to prevent highlighting in both lists
domElem.addEventListener("focusin", (event) => {
citationList?.selection.clearSelection()
});
document.querySelector("item-tree-menu-bar").init(itemList);
}
await itemList.changeCollectionTreeRow({
getItems: async () => filteredItems,

View file

@ -42,9 +42,20 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
persist="screenX screenY width height"
resizable="true">
<!-- do not wait for itemTree to add the menubar, otherwise it does not appear on the first dialog open -->
<xul:item-tree-menu-bar/>
<xul:dialog
buttons="accept" buttonpack="end">
<linkset>
<link rel="localization" href="browser/menubar.ftl"/>
<link rel="localization" href="browser/browserSets.ftl"/>
<link rel="localization" href="zotero.ftl"/>
<link rel="localization" href="reader.ftl"/>
</linkset>
<script>
Services.scriptloader.loadSubScript("chrome://zotero/content/include.js", this);
Services.scriptloader.loadSubScript("chrome://zotero/content/customElements.js", this);
@ -52,6 +63,7 @@
Services.scriptloader.loadSubScript("chrome://zotero/content/integration/citationExplorer.js", this);
</script>
<div class="citation-explorer-grid">
<!-- Left Column -->

View file

@ -2039,20 +2039,22 @@ var ItemTree = class ItemTree extends LibraryTree {
moreItems.push(columnMenuitemElements[column.dataKey]);
}
}
if (moreItems.length) {
// Sort fields and move to submenu
var collation = Zotero.getLocaleCollation();
moreItems.sort(function (a, b) {
return collation.compareString(1, a.getAttribute('label'), b.getAttribute('label'));
});
moreItems.forEach(function (elem) {
moreMenuPopup.appendChild(menupopup.removeChild(elem));
});
// Sort fields and move to submenu
var collation = Zotero.getLocaleCollation();
moreItems.sort(function (a, b) {
return collation.compareString(1, a.getAttribute('label'), b.getAttribute('label'));
});
moreItems.forEach(function (elem) {
moreMenuPopup.appendChild(menupopup.removeChild(elem));
});
let sep = document.createXULElement('menuseparator');
menupopup.appendChild(sep);
moreMenu.appendChild(moreMenuPopup);
menupopup.appendChild(moreMenu);
let sep = document.createXULElement('menuseparator');
menupopup.appendChild(sep);
moreMenu.appendChild(moreMenuPopup);
menupopup.appendChild(moreMenu);
}
}
catch (e) {
Zotero.logError(e);