mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	composebox_typeahead: Rewrite code for handling modifier+enter.
We've iterated on this code incorrectly something like 3 times now, so it's worth rewriting it with a lot of comments in a way that makes sense. The main actual functional change here is that modified key + enter now is consistently the opposite of enter (in terms of whether to provide a newline or send the message) in all cases. Fixes #6489.
This commit is contained in:
		@@ -603,6 +603,20 @@ global.people.add(deactivated_user);
 | 
			
		||||
    event.target.id = 'some_non_existing_id';
 | 
			
		||||
    $('form#send_message_form').keydown(event);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // Setup jquery functions used in new_message_content enter
 | 
			
		||||
    // handler.
 | 
			
		||||
    var range_length = 0;
 | 
			
		||||
    $('#new_message_content').range = function () {
 | 
			
		||||
        return {
 | 
			
		||||
            length: range_length,
 | 
			
		||||
            range: noop,
 | 
			
		||||
            start: 0,
 | 
			
		||||
            end: 0 + range_length,
 | 
			
		||||
        };
 | 
			
		||||
    };
 | 
			
		||||
    $('#new_message_content').caret = noop;
 | 
			
		||||
 | 
			
		||||
    event.keyCode = 13;
 | 
			
		||||
    event.target.id = 'subject';
 | 
			
		||||
    $('form#send_message_form').keydown(event);
 | 
			
		||||
@@ -624,6 +638,12 @@ global.people.add(deactivated_user);
 | 
			
		||||
    event.ctrlKey = false;
 | 
			
		||||
    event.altKey = true;
 | 
			
		||||
    $('form#send_message_form').keydown(event);
 | 
			
		||||
 | 
			
		||||
    // Cover case where there's a least one character there.
 | 
			
		||||
    range_length = 2;
 | 
			
		||||
    $('form#send_message_form').keydown(event);
 | 
			
		||||
 | 
			
		||||
    event.altKey = false;
 | 
			
		||||
    event.metaKey = true;
 | 
			
		||||
    $('form#send_message_form').keydown(event);
 | 
			
		||||
    event.target.id = 'private_message_recipient';
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user