From b78bf8e24b1285855c9ff9ac680e6d07dfed268a Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 11 Mar 2025 08:03:54 -0400 Subject: [PATCH] Citation dialog: Use "All Fields & Tags Mode" in Library Mode Quick fix for #5090 --- chrome/content/zotero/integration/citationDialog.js | 2 +- chrome/content/zotero/itemTree.jsx | 3 +++ chrome/content/zotero/xpcom/collectionTreeRow.js | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/integration/citationDialog.js b/chrome/content/zotero/integration/citationDialog.js index 08d0259f3d..0af8bb34f9 100644 --- a/chrome/content/zotero/integration/citationDialog.js +++ b/chrome/content/zotero/integration/citationDialog.js @@ -277,7 +277,7 @@ class Layout { while (!this.itemsView.collectionTreeRow) { await Zotero.Promise.delay(10); } - await this.itemsView.setFilter('search', value); + await this.itemsView.setFilter('citation-search', value); } SearchHandler.searching = false; diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 8210d5d589..2b1add391e 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -1603,6 +1603,9 @@ var ItemTree = class ItemTree extends LibraryTree { case 'search': this.collectionTreeRow.setSearch(data); break; + case 'citation-search': + this.collectionTreeRow.setSearch(data, 'fields'); + break; case 'tags': this.collectionTreeRow.setTags(data); break; diff --git a/chrome/content/zotero/xpcom/collectionTreeRow.js b/chrome/content/zotero/xpcom/collectionTreeRow.js index 6d76d0003e..98da6b9571 100644 --- a/chrome/content/zotero/xpcom/collectionTreeRow.js +++ b/chrome/content/zotero/xpcom/collectionTreeRow.js @@ -428,7 +428,8 @@ Zotero.CollectionTreeRow.prototype.getSearchObject = Zotero.Promise.coroutine(fu s2.setScope(s, includeScopeChildren); if (this.searchText) { - var cond = 'quicksearch-' + Zotero.Prefs.get('search.quicksearch-mode'); + let cond = 'quicksearch-' + + (this.searchMode || Zotero.Prefs.get('search.quicksearch-mode')); s2.addCondition(cond, 'contains', this.searchText); } @@ -470,9 +471,10 @@ Zotero.CollectionTreeRow.prototype.getTags = async function (types, tagIDs) { }; -Zotero.CollectionTreeRow.prototype.setSearch = function (searchText) { +Zotero.CollectionTreeRow.prototype.setSearch = function (searchText, mode = null) { Zotero.CollectionTreeCache.clear(); this.searchText = searchText; + this.searchMode = mode; } Zotero.CollectionTreeRow.prototype.setTags = function (tags) {