diff --git a/static/js/drafts.js b/static/js/drafts.js index 8bb516e7f2..759656b3f5 100644 --- a/static/js/drafts.js +++ b/static/js/drafts.js @@ -376,14 +376,6 @@ exports.drafts_handle_events = function (e, event_key) { } }; -exports.toggle = function () { - if (overlays.drafts_open()) { - overlays.close_overlay("drafts"); - } else { - exports.launch(); - } -}; - exports.launch = function () { exports.setup_page(function () { overlays.open_overlay({ diff --git a/static/js/hotkey.js b/static/js/hotkey.js index 3c537977a9..b5d198a991 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -80,7 +80,7 @@ var keypress_mappings = { 83: {name: 'narrow_by_subject', message_view_only: true}, //'S' 86: {name: 'view_selected_stream', message_view_only: false}, //'V' 99: {name: 'compose', message_view_only: true}, // 'c' - 100: {name: 'open_drafts', message_view_only: false}, // 'd' + 100: {name: 'open_drafts', message_view_only: true}, // 'd' 103: {name: 'gear_menu', message_view_only: true}, // 'g' 105: {name: 'message_actions', message_view_only: true}, // 'i' 106: {name: 'vim_down', message_view_only: true}, // 'j' @@ -429,6 +429,10 @@ exports.process_hotkey = function (e, hotkey) { overlays.close_overlay('lightbox'); return true; } + if (event_name === 'open_drafts' && overlays.drafts_open()) { + overlays.close_overlay('drafts'); + return true; + } return false; } @@ -605,7 +609,7 @@ exports.process_hotkey = function (e, hotkey) { if (overlays.is_active() && !overlays.drafts_open()) { return false; } - drafts.toggle(); + drafts.launch(); return true; case 'reply_message': // 'r': respond to message // Note that you can "enter" to respond to messages as well, diff --git a/static/js/overlays.js b/static/js/overlays.js index ee6ae75d0f..a7e687afe0 100644 --- a/static/js/overlays.js +++ b/static/js/overlays.js @@ -57,7 +57,7 @@ exports.open_overlay = function (opts) { } if (active_overlay || open_overlay_name || close_handler) { - blueslip.error('Programming error--trying to open ' + opts.name + + blueslip.error('Programming error — trying to open ' + opts.name + ' before closing ' + open_overlay_name); return; }