Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
compose: Fix preview area bottom cut-off after fullscreen collapse.
sandeepf20563da572c
diff --git a/web/src/compose_ui.ts b/web/src/compose_ui.tsindex aa6a17e7b9c..83d7a6644a5 100644--- a/web/src/compose_ui.ts+++ b/web/src/compose_ui.ts@@ -546,9 +546,17 @@ export function make_compose_box_original_size(): void {// Again initialise the compose textarea as it was destroyed// when compose box was made full screen- autosize($("textarea#compose-textarea"));-- $("textarea#compose-textarea").trigger("focus");+ const $compose_textarea = $<HTMLTextAreaElement>("textarea#compose-textarea");+ autosize($compose_textarea);++ // If the preview area is open, reset the min-height for it to+ // ensure a smooth back-and-forth for toggling preview mode.+ const $preview_message_area = $("#compose .preview_message_area");+ if ($preview_message_area.length > 0) {+ const edit_height = $compose_textarea.height();+ $preview_message_area.css({"min-height": edit_height + "px"});+ }+ $compose_textarea.trigger("focus");}export function handle_scrolling_formatting_buttons(event: JQuery.ScrollEvent): void {diff --git a/web/tests/compose_ui.test.cjs b/web/tests/compose_ui.test.cjsindex af64ead6532..64b741c233d 100644--- a/web/tests/compose_ui.test.cjs+++ b/web/tests/compose_ui.test.cjs@@ -682,6 +682,8 @@ run_test("test_compose_height_changes", ({override, override_rewire}) => {assert.ok(autosize_destroyed);assert.ok(compose_box_top_set);+ $("textarea#compose-textarea").set_height(100);+ $("#compose .preview_message_area").set_height(100);compose_ui.make_compose_box_original_size();assert.ok(!$("#compose").hasClass("compose-fullscreen"));assert.ok(!compose_ui.is_expanded());