mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	hotkeys: Modify draft toggle behavior.
This commit is contained in:
		@@ -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({
 | 
			
		||||
 
 | 
			
		||||
@@ -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,
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user