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 * Trigger actions based on keyboard shortcuts
*/ */
function handleKeyDown(event, from) { 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') { if (from == 'zotero-pane') {
// Highlight collections containing selected items // Highlight collections containing selected items
// //
@ -406,6 +416,9 @@ var ZoteroPane = new function()
Zotero.debug(command); Zotero.debug(command);
switch (command) { switch (command) {
case 'openZotero':
ZoteroPane.toggleDisplay()
break;
case 'library': case 'library':
document.getElementById('zotero-collections-tree').focus(); document.getElementById('zotero-collections-tree').focus();
ZoteroPane.collectionsView.selection.select(0); ZoteroPane.collectionsView.selection.select(0);

View File

@ -987,7 +987,7 @@ Zotero.Keys = new function() {
this.windowInit = windowInit; this.windowInit = windowInit;
this.getCommand = getCommand; this.getCommand = getCommand;
_keys = {}; var _keys = {};
/* /*
@ -1050,6 +1050,12 @@ Zotero.Keys = new function() {
} }
if (_keys[key.getAttribute('key')] || key.getAttribute('key') == zKey) { 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')); Zotero.debug('Removing key ' + id + ' with accesskey ' + key.getAttribute('key'));
key.parentNode.removeChild(key); key.parentNode.removeChild(key);
} }