Make "New Note" shortcut key context sensitive
- If a regular item is selected, use that as the parent. - If a child item is selected, use its parent as the parent. - Otherwise create a standalone note.
This commit is contained in:
parent
2327c5cc98
commit
1c7ac1a9a0
1 changed files with 16 additions and 1 deletions
|
@ -566,8 +566,23 @@ var ZoteroPane = new function()
|
||||||
document.getElementById('zotero-editpane-item-box').itemTypeMenu.menupopup.openPopup(menu, "before_start", 0, 0);
|
document.getElementById('zotero-editpane-item-box').itemTypeMenu.menupopup.openPopup(menu, "before_start", 0, 0);
|
||||||
break;
|
break;
|
||||||
case 'newNote':
|
case 'newNote':
|
||||||
|
// If a regular item is selected, use that as the parent.
|
||||||
|
// If a child item is selected, use its parent as the parent.
|
||||||
|
// Otherwise create a standalone note.
|
||||||
|
var parent = false;
|
||||||
|
var items = ZoteroPane_Local.getSelectedItems();
|
||||||
|
if (items.length == 1) {
|
||||||
|
if (items[0].isRegularItem()) {
|
||||||
|
parent = items[0].id;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
parent = items[0].getSource();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Use key that's not the modifier as the popup toggle
|
// Use key that's not the modifier as the popup toggle
|
||||||
ZoteroPane_Local.newNote(useShift ? event.altKey : event.shiftKey);
|
ZoteroPane_Local.newNote(
|
||||||
|
useShift ? event.altKey : event.shiftKey, parent
|
||||||
|
);
|
||||||
break;
|
break;
|
||||||
case 'toggleTagSelector':
|
case 'toggleTagSelector':
|
||||||
ZoteroPane_Local.toggleTagSelector();
|
ZoteroPane_Local.toggleTagSelector();
|
||||||
|
|
Loading…
Reference in a new issue