From 2b79e3ddb4fffcc717c52a8a6984d19dfd66738a Mon Sep 17 00:00:00 2001 From: Bogdan Abaev Date: Tue, 25 Aug 2026 17:05:23 -0700 Subject: [PATCH] display search results in itemPane Added search results pane that is shown when a search result row is selected. It displays the entire chunk that the snippet is based on. When an attachment is selected, its search results section lists all search results --- .../content/zotero/collectionViewItemTree.jsx | 10 + chrome/content/zotero/customElements.js | 3 + chrome/content/zotero/elements/itemDetails.js | 2 + chrome/content/zotero/elements/itemPane.js | 31 ++- .../zotero/elements/itemPaneSidenav.js | 2 +- .../zotero/elements/searchResultRow.js | 161 ++++++++++++++++ .../zotero/elements/searchResultsBox.js | 176 ++++++++++++++++++ .../zotero/elements/searchResultsPane.js | 140 ++++++++++++++ chrome/content/zotero/itemTree.jsx | 32 +++- chrome/content/zotero/itemTreeRow.js | 10 +- chrome/content/zotero/xpcom/bestMatch.js | 38 ++-- chrome/content/zotero/zoteroPane.js | 18 +- chrome/locale/en-US/zotero/zotero.ftl | 12 ++ scss/_zotero.scss | 2 + scss/abstracts/_variables.scss | 1 + scss/elements/_annotationRow.scss | 6 +- scss/elements/_itemPaneSearchResults.scss | 48 +++++ scss/elements/_searchResultsBox.scss | 80 ++++++++ test/tests/bestMatchTest.js | 26 +++ test/tests/collectionViewItemTreeTest.js | 81 +++++++- 20 files changed, 839 insertions(+), 40 deletions(-) create mode 100644 chrome/content/zotero/elements/searchResultRow.js create mode 100644 chrome/content/zotero/elements/searchResultsBox.js create mode 100644 chrome/content/zotero/elements/searchResultsPane.js create mode 100644 scss/elements/_itemPaneSearchResults.scss create mode 100644 scss/elements/_searchResultsBox.scss diff --git a/chrome/content/zotero/collectionViewItemTree.jsx b/chrome/content/zotero/collectionViewItemTree.jsx index a6095e7ea5..56aaf429f4 100644 --- a/chrome/content/zotero/collectionViewItemTree.jsx +++ b/chrome/content/zotero/collectionViewItemTree.jsx @@ -387,6 +387,16 @@ class CollectionViewItemTreeRowProvider extends ItemTreeRowProvider { return kept; } + /** + * The session holding the passages of the active best-match search, or + * null when no such search is running + * + * @return {Zotero.BestMatch.Session|null} + */ + get bestMatchSession() { + return this._bestMatchSession ?? null; + } + /** * Called for every pending search-match row the tree draws: rendering * is the demand signal for deriving previews. Reports are collected diff --git a/chrome/content/zotero/customElements.js b/chrome/content/zotero/customElements.js index 59b5b319bc..04cb9b3ef4 100644 --- a/chrome/content/zotero/customElements.js +++ b/chrome/content/zotero/customElements.js @@ -74,6 +74,9 @@ Services.scriptloader.loadSubScript('chrome://zotero/content/elements/itemTreeMe ['attachment-row', 'chrome://zotero/content/elements/attachmentRow.js'], ['attachment-annotations-box', 'chrome://zotero/content/elements/attachmentAnnotationsBox.js'], ['annotation-row', 'chrome://zotero/content/elements/annotationRow.js'], + ['search-results-box', 'chrome://zotero/content/elements/searchResultsBox.js'], + ['search-result-row', 'chrome://zotero/content/elements/searchResultRow.js'], + ['search-results-pane', 'chrome://zotero/content/elements/searchResultsPane.js'], ['annotation-items-pane', 'chrome://zotero/content/elements/annotationItemsPane.js'], ['context-notes-list', 'chrome://zotero/content/elements/contextNotesList.js'], ['note-row', 'chrome://zotero/content/elements/noteRow.js'], diff --git a/chrome/content/zotero/elements/itemDetails.js b/chrome/content/zotero/elements/itemDetails.js index 9a1c49d455..67f9a8784d 100644 --- a/chrome/content/zotero/elements/itemDetails.js +++ b/chrome/content/zotero/elements/itemDetails.js @@ -56,6 +56,8 @@ +