Shortcut key handling improvements:

- Fix Cmd-Shift-Z on Fx3/Mac when Zotero pane is open
- Don't override Redo on Fx3/Mac even if the override pref is set, since it can coexist -- this lets Redo be used within textboxes
- Ignore Zotero shortcuts (other than master shortcut) when Zotero pane isn't focused

This needs testing.
This commit is contained in:
Dan Stillman 2008-05-13 19:20:39 +00:00
parent 3b374e04a5
commit 292c357e4a
2 changed files with 21 additions and 2 deletions

View file

@ -349,6 +349,16 @@ var ZoteroPane = new function()
* Trigger actions based on keyboard shortcuts
*/
function handleKeyDown(event, from) {
try {
// Ignore keystrokes outside of Zotero pane
if (!(event.originalTarget.ownerDocument instanceof XULDocument)) {
return;
}
}
catch (e) {
Zotero.debug(e);
}
if (from == 'zotero-pane') {
// Highlight collections containing selected items
//
@ -406,6 +416,9 @@ var ZoteroPane = new function()
Zotero.debug(command);
switch (command) {
case 'openZotero':
ZoteroPane.toggleDisplay()
break;
case 'library':
document.getElementById('zotero-collections-tree').focus();
ZoteroPane.collectionsView.selection.select(0);

View file

@ -987,7 +987,7 @@ Zotero.Keys = new function() {
this.windowInit = windowInit;
this.getCommand = getCommand;
_keys = {};
var _keys = {};
/*
@ -1019,7 +1019,7 @@ Zotero.Keys = new function() {
// Only override the default with the pref if the <key> hasn't been manually changed
// and the pref has been
if (keyElem.getAttribute('key') == 'Z' && keyElem.getAttribute('modifiers') == 'accel alt'
&& (zKey != 'Z' || useShift)) {
&& (zKey != 'Z' || useShift)) {
keyElem.setAttribute('key', zKey);
if (useShift) {
keyElem.setAttribute('modifiers', 'accel shift');
@ -1050,6 +1050,12 @@ Zotero.Keys = new function() {
}
if (_keys[key.getAttribute('key')] || key.getAttribute('key') == zKey) {
// Don't override Redo on Fx3 Mac, since Redo and Zotero can coexist
if (zKey == 'Z' && key.getAttribute('key') == 'Z'
&& id == 'key_redo' && Zotero.isFx3 && Zotero.isMac) {
continue;
}
Zotero.debug('Removing key ' + id + ' with accesskey ' + key.getAttribute('key'));
key.parentNode.removeChild(key);
}