compose: Update max-height when compose banner is displayed.

Othwersie, compose banner will overlap with any breadcrumbs
we have below the last message when user is fully scrolled up
and compose is at max-height.
This commit is contained in:
Aman Agrawal
2023-05-30 08:49:44 +05:30
committed by Tim Abbott
parent 7706d64530
commit 839af9ed8d
2 changed files with 6 additions and 7 deletions

View File

@@ -451,12 +451,10 @@ export function initialize() {
resize.watch_manual_resize("#compose-textarea"); resize.watch_manual_resize("#compose-textarea");
// Update position of scroll to bottom button based on // Updates compose max-height and scroll to bottom button position when
// height of the compose box. // there is a change in compose height like when a compose banner is displayed.
const update_scroll_to_bottom_position = new ResizeObserver(() => { const update_compose_max_height = new ResizeObserver(resize.reset_compose_message_max_height);
$("#scroll-to-bottom-button-container").css("bottom", $("#compose").outerHeight()); update_compose_max_height.observe(document.querySelector("#compose"));
});
update_scroll_to_bottom_position.observe(document.querySelector("#compose"));
upload.feature_check($("#compose .compose_upload_file")); upload.feature_check($("#compose .compose_upload_file"));

View File

@@ -91,7 +91,7 @@ export function reset_compose_message_max_height(bottom_whitespace_height) {
// the last message of the current stream. // the last message of the current stream.
// Compute bottom_whitespace_height if not provided by caller. // Compute bottom_whitespace_height if not provided by caller.
if (bottom_whitespace_height === undefined) { if (typeof bottom_whitespace_height !== "number") {
bottom_whitespace_height = get_bottom_whitespace_height(); bottom_whitespace_height = get_bottom_whitespace_height();
} }
@@ -115,6 +115,7 @@ export function reset_compose_message_max_height(bottom_whitespace_height) {
// subtract 10 for the selected message border. // subtract 10 for the selected message border.
bottom_whitespace_height - compose_non_textarea_height - 10, bottom_whitespace_height - compose_non_textarea_height - 10,
); );
$("#scroll-to-bottom-button-container").css("bottom", compose_height);
} }
export function resize_bottom_whitespace() { export function resize_bottom_whitespace() {