mirror of
https://github.com/zulip/zulip.git
synced 2026-07-06 21:18:58 +08:00
This commit changes a few things: * Using `scrollHeight` instead of `offsetHeight`, which explicitly also measures content not visible on the screen due to overflow. * Measures the height of `.message_content` which is the div with the full message height. * Only resizes messages that are visible on the screen, i.e. only those in `message_lists.current`.
45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
import $ from "jquery";
|
|
|
|
import {Filter} from "./filter";
|
|
import * as message_list from "./message_list";
|
|
import * as recent_topics_util from "./recent_topics_util";
|
|
import * as ui_util from "./ui_util";
|
|
|
|
export let home;
|
|
export let current;
|
|
|
|
export function set_current(msg_list) {
|
|
current = msg_list;
|
|
}
|
|
|
|
export function all_rendered_message_lists() {
|
|
const rendered_message_lists = [home];
|
|
if (current !== home && !recent_topics_util.is_visible()) {
|
|
rendered_message_lists.push(current);
|
|
}
|
|
return rendered_message_lists;
|
|
}
|
|
|
|
export function all_current_message_rows() {
|
|
return $(`#${current.table_name}.message_table .message_row`);
|
|
}
|
|
|
|
export function update_recipient_bar_background_color() {
|
|
for (const msg_list of all_rendered_message_lists()) {
|
|
msg_list.view.update_recipient_bar_background_color();
|
|
}
|
|
}
|
|
|
|
export function initialize() {
|
|
home = new message_list.MessageList({
|
|
table_name: "zhome",
|
|
filter: new Filter([{operator: "in", operand: "home"}]),
|
|
excludes_muted_topics: true,
|
|
});
|
|
current = home;
|
|
|
|
// For users with automatic color scheme, we need to detect change
|
|
// in `prefers-color-scheme`as it changes based on time.
|
|
ui_util.listener_for_preferred_color_scheme_change(update_recipient_bar_background_color);
|
|
}
|