mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	hotkey: Add support for hotspots on enter.
This commit is contained in:
		@@ -162,7 +162,9 @@ function stubbing(func_name_to_stub, test_function) {
 | 
			
		||||
    set_global('emoji_picker', {
 | 
			
		||||
        reactions_popped: return_false,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    set_global('hotspots', {
 | 
			
		||||
        is_open: return_false,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // All letters should return false if we are composing text.
 | 
			
		||||
    hotkey.processing_text = return_true;
 | 
			
		||||
 
 | 
			
		||||
@@ -251,6 +251,11 @@ exports.process_enter_key = function (e) {
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (hotspots.is_open()) {
 | 
			
		||||
        $(e.target).find('.hotspot.overlay.show .hotspot-confirm').click();
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (emoji_picker.reactions_popped()) {
 | 
			
		||||
        if (emoji_picker.is_composition(e.target)) {
 | 
			
		||||
            e.target.click();
 | 
			
		||||
@@ -443,6 +448,10 @@ exports.process_hotkey = function (e, hotkey) {
 | 
			
		||||
        return emoji_picker.navigate(e, event_name);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (hotspots.is_open()) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (overlays.info_overlay_open()) {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -247,6 +247,10 @@ function insert_hotspot_into_DOM(hotspot) {
 | 
			
		||||
    }, (hotspot.delay * 100));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.is_open = function () {
 | 
			
		||||
    return $('.hotspot.overlay').hasClass('show');
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.load_new = function (new_hotspots) {
 | 
			
		||||
    exports.map_hotspots_to_DOM(new_hotspots, HOTSPOT_LOCATIONS);
 | 
			
		||||
    new_hotspots.forEach(insert_hotspot_into_DOM);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user