mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 10:57:58 +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', {
|
set_global('emoji_picker', {
|
||||||
reactions_popped: return_false,
|
reactions_popped: return_false,
|
||||||
});
|
});
|
||||||
|
set_global('hotspots', {
|
||||||
|
is_open: return_false,
|
||||||
|
});
|
||||||
|
|
||||||
// All letters should return false if we are composing text.
|
// All letters should return false if we are composing text.
|
||||||
hotkey.processing_text = return_true;
|
hotkey.processing_text = return_true;
|
||||||
|
|||||||
@@ -251,6 +251,11 @@ exports.process_enter_key = function (e) {
|
|||||||
return true;
|
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.reactions_popped()) {
|
||||||
if (emoji_picker.is_composition(e.target)) {
|
if (emoji_picker.is_composition(e.target)) {
|
||||||
e.target.click();
|
e.target.click();
|
||||||
@@ -443,6 +448,10 @@ exports.process_hotkey = function (e, hotkey) {
|
|||||||
return emoji_picker.navigate(e, event_name);
|
return emoji_picker.navigate(e, event_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (hotspots.is_open()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (overlays.info_overlay_open()) {
|
if (overlays.info_overlay_open()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -247,6 +247,10 @@ function insert_hotspot_into_DOM(hotspot) {
|
|||||||
}, (hotspot.delay * 100));
|
}, (hotspot.delay * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.is_open = function () {
|
||||||
|
return $('.hotspot.overlay').hasClass('show');
|
||||||
|
};
|
||||||
|
|
||||||
exports.load_new = function (new_hotspots) {
|
exports.load_new = function (new_hotspots) {
|
||||||
exports.map_hotspots_to_DOM(new_hotspots, HOTSPOT_LOCATIONS);
|
exports.map_hotspots_to_DOM(new_hotspots, HOTSPOT_LOCATIONS);
|
||||||
new_hotspots.forEach(insert_hotspot_into_DOM);
|
new_hotspots.forEach(insert_hotspot_into_DOM);
|
||||||
|
|||||||
Reference in New Issue
Block a user