www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 1c7ac1a9a0f502b0d9ee204c67ee8b2f350683c2
parent 2327c5cc980a843c8e9ecb1eafcf8bebe173fbbb
Author: Dan Stillman <dstillman@zotero.org>
Date:   Mon, 16 Apr 2012 04:01:36 -0400

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.

Diffstat:
Mchrome/content/zotero/zoteroPane.js | 17++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js @@ -566,8 +566,23 @@ var ZoteroPane = new function() document.getElementById('zotero-editpane-item-box').itemTypeMenu.menupopup.openPopup(menu, "before_start", 0, 0); break; 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 - ZoteroPane_Local.newNote(useShift ? event.altKey : event.shiftKey); + ZoteroPane_Local.newNote( + useShift ? event.altKey : event.shiftKey, parent + ); break; case 'toggleTagSelector': ZoteroPane_Local.toggleTagSelector();