diff --git a/chrome/content/zotero/lookup.js b/chrome/content/zotero/lookup.js index 22997fafd8..c341b13a82 100644 --- a/chrome/content/zotero/lookup.js +++ b/chrome/content/zotero/lookup.js @@ -108,6 +108,13 @@ var Zotero_Lookup = new function () { document.getElementById("zotero-lookup-panel").style.padding = "10px"; this.getActivePanel().getElementsByTagName('textbox')[0].focus(); + + // Resize arrow box to fit content + if (Zotero.isMac) { + let panel = document.getElementById("zotero-lookup-panel"); + let box = panel.firstChild; + panel.sizeTo(box.scrollWidth, box.scrollHeight); + } } @@ -121,6 +128,9 @@ var Zotero_Lookup = new function () { document.getElementById("zotero-lookup-textbox").value = ""; document.getElementById("zotero-lookup-multiline-textbox").value = ""; Zotero_Lookup.toggleProgress(false); + + // Revert to single-line when closing + this.toggleMultiline(false); } @@ -145,7 +155,7 @@ var Zotero_Lookup = new function () { event.stopImmediatePropagation(); } else if(!multiline) { //switch to multiline var mlTextbox = Zotero_Lookup.toggleMultiline(true); - mlTextbox.value = mlTextbox.value + '\n'; + mlTextbox.value = mlTextbox.value.trim() !== '' ? mlTextbox.value + '\n' : ''; } } else if(keyCode == event.DOM_VK_ESCAPE) { document.getElementById("zotero-lookup-panel").hidePopup(); @@ -185,8 +195,6 @@ var Zotero_Lookup = new function () { var source = on ? slTxtBox : mlTxtBox; var dest = on ? mlTxtBox : slTxtBox; - if((mlPanel.collapsed && !on) || (!mlPanel.collapsed && on)) return dest; - //copy over the value dest.value = source.value; @@ -194,13 +202,13 @@ var Zotero_Lookup = new function () { mlPanel.setAttribute("collapsed", !on); slPanel.setAttribute("collapsed", !!on); - // Resize arrow box to fit content + // Resize arrow box to fit content -- also done in onShowing() if(Zotero.isMac) { var panel = document.getElementById("zotero-lookup-panel"); var box = panel.firstChild; panel.sizeTo(box.scrollWidth, box.scrollHeight); } - + dest.focus(); return dest; } @@ -221,5 +229,6 @@ var Zotero_Lookup = new function () { document.getElementById("zotero-lookup-multiline-textbox").disabled = !!on; var p2 = document.getElementById("zotero-lookup-multiline-progress"); p2.mode = mode; + p2.hidden = !on; } } diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 2687c6d8c0..7606a48bce 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -1061,20 +1061,6 @@ var ZoteroPane = new function() }); - this.openLookupWindow = Zotero.Promise.coroutine(function* () { - if (Zotero.DB.inTransaction()) { - yield Zotero.DB.waitForTransaction(); - } - - if (!this.canEdit()) { - this.displayCannotEditLibraryMessage(); - return; - } - - window.openDialog('chrome://zotero/content/lookup.xul', 'zotero-lookup', 'chrome,modal'); - }); - - this.openAdvancedSearchWindow = function () { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getService(Components.interfaces.nsIWindowMediator); diff --git a/chrome/content/zotero/zoteroPane.xul b/chrome/content/zotero/zoteroPane.xul index 66809b8895..54e98ae27a 100644 --- a/chrome/content/zotero/zoteroPane.xul +++ b/chrome/content/zotero/zoteroPane.xul @@ -128,7 +128,7 @@