From 1767d04e14db0f837b06a81f0ad71014cdabff8a Mon Sep 17 00:00:00 2001 From: Ramon Mi Date: Wed, 8 Apr 2026 17:41:34 +0800 Subject: [PATCH] add Find option to Edit menu in note tab and window unify Find option as a ZoteroPane.js function that runs the appropriate find based on the tab type --- chrome/content/zotero/note.js | 4 ++++ chrome/content/zotero/note.xhtml | 6 ++++++ chrome/content/zotero/xpcom/editorInstance.js | 5 +++++ chrome/content/zotero/zoteroPane.js | 19 +++++++++++++++++++ chrome/content/zotero/zoteroPane.xhtml | 9 ++------- note-editor | 2 +- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/note.js b/chrome/content/zotero/note.js index 8abdd7ea89..521b7c5e32 100644 --- a/chrome/content/zotero/note.js +++ b/chrome/content/zotero/note.js @@ -32,6 +32,10 @@ function showInLibrary() { noteEditor._editorInstance._showInLibrary([noteEditor._editorInstance._item.id]); } +function handleFind() { + noteEditor._editorInstance.openFindBar(); +} + async function onLoad() { if (window.arguments) { var io = window.arguments[0]; diff --git a/chrome/content/zotero/note.xhtml b/chrome/content/zotero/note.xhtml index 3321a1309f..0e19f683df 100644 --- a/chrome/content/zotero/note.xhtml +++ b/chrome/content/zotero/note.xhtml @@ -48,6 +48,8 @@ + + @@ -108,6 +110,10 @@ + + diff --git a/chrome/content/zotero/xpcom/editorInstance.js b/chrome/content/zotero/xpcom/editorInstance.js index 4d10d37834..f290f6b187 100644 --- a/chrome/content/zotero/xpcom/editorInstance.js +++ b/chrome/content/zotero/xpcom/editorInstance.js @@ -425,6 +425,11 @@ class EditorInstance { this._postMessage({ action: 'focusToolbar' }); } + openFindBar() { + this._iframeWindow.focus(); + this._postMessage({ action: 'openFindBar' }); + } + async importImages(annotations) { for (let annotation of annotations) { if (annotation.image && !this._filesReadOnly) { diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 627b70dcc1..2228586401 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1636,6 +1636,25 @@ var ZoteroPane = new function () { return this.collectionsView.toggleVirtualCollection(libraryID, type, show, select); }; + this.handleFind = function () { + switch (Zotero_Tabs.selectedType) { + case 'reader': { + ZoteroStandalone.currentReader.toggleFindPopup({ open: true }); + return; + } + case 'note': { + let noteEditor = Zotero.Notes.getByTabID(Zotero_Tabs.selectedID) + if (noteEditor) { + return noteEditor.openFindBar(); + } + return; + } + default: + document.getElementById('zotero-tb-search-textbox').select(); + return; + } + }; + this.openAdvancedSearchWindow = function () { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); diff --git a/chrome/content/zotero/zoteroPane.xhtml b/chrome/content/zotero/zoteroPane.xhtml index ba1049efab..1fd4ca685f 100644 --- a/chrome/content/zotero/zoteroPane.xhtml +++ b/chrome/content/zotero/zoteroPane.xhtml @@ -95,9 +95,7 @@ - - + @@ -421,12 +419,9 @@ oncommand="ZoteroStandalone.currentReader.rotatePageRight()" /> - -