From 5913e6780e6bc885551db508c84c4a3b7ab25206 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 29 Apr 2014 17:11:07 -0400 Subject: [PATCH 1/8] Fix Redo via Cmd-Shift-Z in notes on OS X --- .../zotero/bindings/styled-textbox.xml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/chrome/content/zotero/bindings/styled-textbox.xml b/chrome/content/zotero/bindings/styled-textbox.xml index 443532728..9cb967fa8 100644 --- a/chrome/content/zotero/bindings/styled-textbox.xml +++ b/chrome/content/zotero/bindings/styled-textbox.xml @@ -125,6 +125,18 @@ this._eventHandler = function (event) { //Zotero.debug(event.type); switch (event.type) { + case 'keydown': + // Intercept and manually trigger redo for Cmd-Shift-Z, + // which keeps it from toggling the Zotero pane instead + if (Zotero.isMac && event.metaKey && event.shiftKey && !event.ctrlKey + && !event.altKey && event.keyCode == 90) { + event.stopPropagation(); + event.preventDefault(); + self.redo(); + return; + } + break; + case 'keypress': // Ignore keypresses that don't change // any text @@ -336,6 +348,14 @@ + + + + + + Date: Wed, 30 Apr 2014 14:29:59 -0400 Subject: [PATCH 2/8] Redo instead of toggling Z pane in text fields (except search bar) on OS X Previously Cmd-Shift-Z worked for redo in text areas (Abstract, Extra) but would toggle the Zotero pane in regular text fields. This change allows Redo to work as expected. The search bar gets focus when you first open the Zotero pane, though, so we don't redo there, since it would be annoying if you couldn't close the pane immediately with the same shortcut. --- chrome/content/zotero/zoteroPane.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 59ae609a7..1d4192dc0 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -631,9 +631,19 @@ var ZoteroPane = new function() try { // Ignore Cmd-Shift-Z keystroke in text areas if (Zotero.isMac && key == 'Z' && - event.originalTarget.localName == 'textarea') { - Zotero.debug('Ignoring keystroke in text area'); - return; + (event.originalTarget.localName == 'input' + || event.originalTarget.localName == 'textarea')) { + try { + var isSearchBar = event.originalTarget.parentNode.parentNode.id == 'zotero-tb-search'; + } + catch (e) { + Zotero.debug(e, 1); + Components.utils.reportError(e); + } + if (!isSearchBar) { + Zotero.debug('Ignoring keystroke in text field'); + return; + } } } catch (e) { From c73a0753d7eb9936978fdc2a054569172fb43f79 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 30 Apr 2014 15:06:35 -0400 Subject: [PATCH 3/8] Handle lowercase shortcut key pref values Honor lowercase pref values for shortcut keys, and also always display and set shortcut keys as uppercase in the preferences --- .../zotero/preferences/preferences_keys.js | 19 +++++++++++++++ chrome/content/zotero/xpcom/zotero.js | 23 +++++++++++++------ 2 files changed, 35 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_keys.js b/chrome/content/zotero/preferences/preferences_keys.js index 20f7ecd19..8adb8935e 100644 --- a/chrome/content/zotero/preferences/preferences_keys.js +++ b/chrome/content/zotero/preferences/preferences_keys.js @@ -32,5 +32,24 @@ Zotero_Preferences.Keys = { // Display the appropriate modifier keys for the platform rows[i].firstChild.nextSibling.value = Zotero.isMac ? Zotero.getString('general.keys.cmdShift') : Zotero.getString('general.keys.ctrlShift'); } + + var textboxes = document.getElementById('zotero-keys-rows').getElementsByTagName('textbox'); + for (let i=0; icommand mappings from the prefs - for each(var action in actions) { - var action = action.substr(5); // strips 'keys.' + for each(var cmd in cmds) { + cmd = cmd.substr(5); // strips 'keys.' // Remove old pref - if (action == 'overrideGlobal') { + if (cmd == 'overrideGlobal') { Zotero.Prefs.clear('keys.overrideGlobal'); continue; } - _keys[Zotero.Prefs.get('keys.' + action)] = action; + _keys[this.getKeyForCommand(cmd)] = cmd; } } @@ -2453,7 +2453,7 @@ Zotero.Keys = new function() { globalKeys.forEach(function (x) { let keyElem = document.getElementById('key_' + x.name); if (keyElem) { - let prefKey = Zotero.Prefs.get('keys.' + x.name); + let prefKey = this.getKeyForCommand(x.name); // Only override the default with the pref if the hasn't // been manually changed and the pref has been if (keyElem.getAttribute('key') == x.defaultKey @@ -2462,7 +2462,7 @@ Zotero.Keys = new function() { keyElem.setAttribute('key', prefKey); } } - }); + }.bind(this)); } @@ -2470,6 +2470,15 @@ Zotero.Keys = new function() { key = key.toUpperCase(); return _keys[key] ? _keys[key] : false; } + + + this.getKeyForCommand = function (cmd) { + try { + var key = Zotero.Prefs.get('keys.' + cmd); + } + catch (e) {} + return key !== undefined ? key.toUpperCase() : false; + } } From 61af5e987d0dcc1c3087e258bc3cc37076d8640c Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 30 Apr 2014 15:08:58 -0400 Subject: [PATCH 4/8] Update versions --- chrome/content/zotero/xpcom/zotero.js | 2 +- install.rdf | 2 +- update.rdf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 320f2d74b..91f758fd0 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -39,7 +39,7 @@ const ZOTERO_CONFIG = { BOOKMARKLET_ORIGIN : 'https://www.zotero.org', HTTP_BOOKMARKLET_ORIGIN : 'http://www.zotero.org', BOOKMARKLET_URL: 'https://www.zotero.org/bookmarklet/', - VERSION: "4.0.20.1.SOURCE" + VERSION: "4.0.21.SOURCE" }; // Commonly used imports accessible anywhere diff --git a/install.rdf b/install.rdf index 188f70aa0..d29e1dd28 100644 --- a/install.rdf +++ b/install.rdf @@ -6,7 +6,7 @@ zotero@chnm.gmu.edu Zotero - 4.0.20.1.SOURCE + 4.0.21.SOURCE Center for History and New Media
George Mason University
Dan Cohen Sean Takats diff --git a/update.rdf b/update.rdf index a14669ab4..ac787fca9 100644 --- a/update.rdf +++ b/update.rdf @@ -7,7 +7,7 @@ - 4.0.20.1.SOURCE + 4.0.21.SOURCE {ec8030f7-c20a-464f-9b0e-13a3a9e97384} From c1c0b42a12fd057bd110e73de9c7898d0a3a7ea4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 30 Apr 2014 18:01:11 -0400 Subject: [PATCH 5/8] Fix gray bar when resizing Zotero pane down Caused by new toolbar icon guidance panel --- chrome/content/zotero/overlay.xul | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/overlay.xul b/chrome/content/zotero/overlay.xul index 570b2188a..410d4a663 100644 --- a/chrome/content/zotero/overlay.xul +++ b/chrome/content/zotero/overlay.xul @@ -52,13 +52,14 @@ -