mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	Add support for emoji picker hotkeys in compose context.
This is a follow-up to merging the compose and reactions emoji pickers. The logic for what happens when the user picks an emoji via the hotkeys (i.e. hits `enter`) was still attempting to add a reaction to the currently selected message unconditionally. This commit adds a check in the two `enter` key code paths, and does the correct thing in each case. Fixes #4736.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							52059d21a4
						
					
				
				
					commit
					5dd5c84854
				
			@@ -182,6 +182,10 @@ exports.register_click_handlers = function () {
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.is_composition = function (emoji) {
 | 
			
		||||
    return emoji.classList.contains('composition');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
return exports;
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
@@ -245,7 +245,11 @@ exports.process_enter_key = function (e) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (emoji_picker.reactions_popped()) {
 | 
			
		||||
        if (emoji_picker.is_composition(e.target)) {
 | 
			
		||||
            e.target.click();
 | 
			
		||||
        } else {
 | 
			
		||||
            reactions.toggle_reaction(current_msg_list.selected_id());
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -116,9 +116,13 @@ function maybe_select_emoji(e) {
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
        var first_emoji = get_emoji_at_index(0);
 | 
			
		||||
        if (first_emoji) {
 | 
			
		||||
            if (emoji_picker.is_composition(first_emoji)) {
 | 
			
		||||
                first_emoji.click();
 | 
			
		||||
            } else {
 | 
			
		||||
                exports.toggle_reaction(current_msg_list.selected_id(), first_emoji.title);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$(document).on('click', '.emoji-popover-emoji.reaction', function () {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user