From 34ea8ced85b945c7f7adc9d5db9347bf73923dd3 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 31 Oct 2007 00:03:06 +0000 Subject: [PATCH] Addresses #283, Minefield compatibility Closes #285, Hitting Esc should close tags popup Fixes various UI issues and problems adding tags on Minefield Still getting autocomplete self-destruction --- chrome.manifest | 2 ++ chrome/content/zotero/bindings/noteeditor.xml | 2 +- chrome/content/zotero/bindings/tagsbox.xml | 6 +++--- chrome/content/zotero/itemPane.js | 19 ++++++++++++++----- chrome/content/zotero/itemPane.xul | 1 + chrome/content/zotero/overlay.xul | 5 ++--- .../default/zotero/bindings/noteeditor.css | 4 ++++ 7 files changed, 27 insertions(+), 12 deletions(-) diff --git a/chrome.manifest b/chrome.manifest index de1612c43..d65aacb54 100644 --- a/chrome.manifest +++ b/chrome.manifest @@ -36,6 +36,8 @@ locale zotero zh-TW chrome/locale/zh-TW/zotero/ skin zotero default chrome/skin/default/zotero/ overlay chrome://browser/content/browser.xul chrome://zotero/content/overlay.xul +overlay chrome://browser/content/browser.xul chrome://zotero/content/itemPane.xul + style chrome://browser/content/browser.xul chrome://zotero/skin/zotero.css style chrome://global/content/customizeToolbar.xul chrome://zotero/skin/zotero.css diff --git a/chrome/content/zotero/bindings/noteeditor.xml b/chrome/content/zotero/bindings/noteeditor.xml index 25d091149..e81de8d75 100644 --- a/chrome/content/zotero/bindings/noteeditor.xml +++ b/chrome/content/zotero/bindings/noteeditor.xml @@ -286,7 +286,7 @@ Note: Code in tagsbox.xml is dependent on the DOM path between the tagsbox and tagsLabel above, so be sure to update fixPopup() if it changes --> - diff --git a/chrome/content/zotero/bindings/tagsbox.xml b/chrome/content/zotero/bindings/tagsbox.xml index 2e44b4bf1..49ad462d0 100644 --- a/chrome/content/zotero/bindings/tagsbox.xml +++ b/chrome/content/zotero/bindings/tagsbox.xml @@ -265,8 +265,8 @@ @@ -283,7 +283,7 @@ - + diff --git a/chrome/content/zotero/itemPane.js b/chrome/content/zotero/itemPane.js index d0a90c9ee..9ad0e748b 100644 --- a/chrome/content/zotero/itemPane.js +++ b/chrome/content/zotero/itemPane.js @@ -1006,7 +1006,7 @@ var ZoteroItemPane = new function() _dynamicFields.focus(); } - //Zotero.debug('Showing editor'); + Zotero.debug('Showing editor'); var fieldName = elem.getAttribute('fieldname'); var tabindex = elem.getAttribute('ztabindex'); @@ -1167,6 +1167,9 @@ var ZoteroItemPane = new function() switch (event.keyCode) { case event.DOM_VK_RETURN: + // Prevent blur on textbox above + event.preventDefault(); + var fieldname = target.getAttribute('fieldname'); // Use shift-enter as the save action for the larger fields if ((fieldname == 'abstractNote' || fieldname == 'extra') @@ -1220,8 +1223,15 @@ var ZoteroItemPane = new function() case event.DOM_VK_ESCAPE: // Reset field to original value target.value = target.getAttribute('value'); + + var tagsbox = Zotero.getAncestorByTagName(focused, 'tagsbox'); + focused.blur(); + if (tagsbox) { + tagsbox.closePopup(); + } + // Return focus to items pane var tree = document.getElementById('zotero-items-tree'); if (tree) { @@ -1243,12 +1253,13 @@ var ZoteroItemPane = new function() function hideEditor(t, saveChanges) { - //Zotero.debug('Hiding editor'); + Zotero.debug('Hiding editor'); var textbox = Zotero.getAncestorByTagName(t, 'textbox'); if (!textbox){ Zotero.debug('Textbox not found in hideEditor'); return; } + var fieldName = textbox.getAttribute('fieldname'); var tabindex = textbox.getAttribute('ztabindex'); @@ -1349,10 +1360,7 @@ var ZoteroItemPane = new function() if (existingTypes && existingTypes.indexOf(1) != -1) { _lastTabIndex--; } - var id = tagsbox.add(value); - - // DEBUG: why does this need to continue if added? } } @@ -1370,6 +1378,7 @@ var ZoteroItemPane = new function() } catch (e) {} tagsbox.fixPopup(); + tagsbox.closePopup(); _tabDirection = false; return; diff --git a/chrome/content/zotero/itemPane.xul b/chrome/content/zotero/itemPane.xul index 27497772b..8d2085b6a 100644 --- a/chrome/content/zotero/itemPane.xul +++ b/chrome/content/zotero/itemPane.xul @@ -22,6 +22,7 @@ --> + %globalDTD; - %zoteroDTD; + %globalDTD; + %zoteroDTD; ]> -