mirror of https://github.com/zulip/zulip.git
inbox_util: Move is_in_focus to inbox_ui.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
919381e5e7
commit
73507ee2ae
|
@ -22,7 +22,6 @@ import * as hash_util from "./hash_util";
|
||||||
import * as hashchange from "./hashchange";
|
import * as hashchange from "./hashchange";
|
||||||
import * as hotspots from "./hotspots";
|
import * as hotspots from "./hotspots";
|
||||||
import * as inbox_ui from "./inbox_ui";
|
import * as inbox_ui from "./inbox_ui";
|
||||||
import * as inbox_util from "./inbox_util";
|
|
||||||
import * as lightbox from "./lightbox";
|
import * as lightbox from "./lightbox";
|
||||||
import * as list_util from "./list_util";
|
import * as list_util from "./list_util";
|
||||||
import * as message_edit from "./message_edit";
|
import * as message_edit from "./message_edit";
|
||||||
|
@ -257,7 +256,7 @@ export function process_escape_key(e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inbox_util.is_in_focus() && inbox_ui.change_focused_element("escape")) {
|
if (inbox_ui.is_in_focus() && inbox_ui.change_focused_element("escape")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,7 +662,7 @@ export function process_hotkey(e, hotkey) {
|
||||||
case "vim_down":
|
case "vim_down":
|
||||||
case "vim_left":
|
case "vim_left":
|
||||||
case "vim_right":
|
case "vim_right":
|
||||||
if (inbox_util.is_in_focus()) {
|
if (inbox_ui.is_in_focus()) {
|
||||||
return inbox_ui.change_focused_element(event_name);
|
return inbox_ui.change_focused_element(event_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,17 @@ import render_user_with_status_icon from "../templates/user_with_status_icon.hbs
|
||||||
|
|
||||||
import * as buddy_data from "./buddy_data";
|
import * as buddy_data from "./buddy_data";
|
||||||
import * as compose_closed_ui from "./compose_closed_ui";
|
import * as compose_closed_ui from "./compose_closed_ui";
|
||||||
|
import * as compose_state from "./compose_state";
|
||||||
import * as hash_util from "./hash_util";
|
import * as hash_util from "./hash_util";
|
||||||
import {is_visible, set_visible} from "./inbox_util";
|
import {is_visible, set_visible} from "./inbox_util";
|
||||||
import * as keydown_util from "./keydown_util";
|
import * as keydown_util from "./keydown_util";
|
||||||
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
|
import * as left_sidebar_navigation_area from "./left_sidebar_navigation_area";
|
||||||
import {localstorage} from "./localstorage";
|
import {localstorage} from "./localstorage";
|
||||||
import * as message_store from "./message_store";
|
import * as message_store from "./message_store";
|
||||||
|
import * as overlays from "./overlays";
|
||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
|
import * as popovers from "./popovers";
|
||||||
|
import * as sidebar_ui from "./sidebar_ui";
|
||||||
import * as stream_color from "./stream_color";
|
import * as stream_color from "./stream_color";
|
||||||
import * as stream_data from "./stream_data";
|
import * as stream_data from "./stream_data";
|
||||||
import * as sub_store from "./sub_store";
|
import * as sub_store from "./sub_store";
|
||||||
|
@ -928,6 +932,19 @@ function move_focus_to_visible_area() {
|
||||||
revive_current_focus();
|
revive_current_focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function is_in_focus() {
|
||||||
|
// Check if user is focused on
|
||||||
|
// inbox
|
||||||
|
return (
|
||||||
|
is_visible() &&
|
||||||
|
!compose_state.composing() &&
|
||||||
|
!popovers.any_active() &&
|
||||||
|
!sidebar_ui.any_sidebar_expanded_as_overlay() &&
|
||||||
|
!overlays.is_overlay_or_modal_open() &&
|
||||||
|
!$(".home-page-input").is(":focus")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function initialize() {
|
export function initialize() {
|
||||||
$(document).on(
|
$(document).on(
|
||||||
"scroll",
|
"scroll",
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
import $ from "jquery";
|
import $ from "jquery";
|
||||||
|
|
||||||
import * as compose_state from "./compose_state";
|
|
||||||
import * as overlays from "./overlays";
|
|
||||||
import * as popovers from "./popovers";
|
|
||||||
import * as sidebar_ui from "./sidebar_ui";
|
|
||||||
import * as stream_color from "./stream_color";
|
import * as stream_color from "./stream_color";
|
||||||
import * as stream_data from "./stream_data";
|
import * as stream_data from "./stream_data";
|
||||||
|
|
||||||
|
@ -21,19 +17,6 @@ export function get_dm_key(msg) {
|
||||||
return "dm:" + msg.other_user_id;
|
return "dm:" + msg.other_user_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function is_in_focus() {
|
|
||||||
// Check if user is focused on
|
|
||||||
// inbox
|
|
||||||
return (
|
|
||||||
is_visible() &&
|
|
||||||
!compose_state.composing() &&
|
|
||||||
!popovers.any_active() &&
|
|
||||||
!sidebar_ui.any_sidebar_expanded_as_overlay() &&
|
|
||||||
!overlays.is_overlay_or_modal_open() &&
|
|
||||||
!$(".home-page-input").is(":focus")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function update_stream_colors() {
|
export function update_stream_colors() {
|
||||||
if (!is_visible()) {
|
if (!is_visible()) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue