diff --git a/static/js/compose_actions.js b/static/js/compose_actions.js index 7598cd81ea983e..de59bba0f29c62 100644 --- a/static/js/compose_actions.js +++ b/static/js/compose_actions.js @@ -118,11 +118,15 @@ function clear_box() { } export function autosize_message_content() { - autosize($("#compose-textarea"), { - callback() { - maybe_scroll_up_selected_message(); - }, - }); + if (compose_height.get_is_full_size()) { + maybe_scroll_up_selected_message(); + } else { + autosize($("#compose-textarea"), { + callback() { + maybe_scroll_up_selected_message(); + }, + }); + } } export function expand_compose_box() { diff --git a/static/js/compose_height.js b/static/js/compose_height.js index 8b06f71e2ea664..4ff1d0642e1b8d 100644 --- a/static/js/compose_height.js +++ b/static/js/compose_height.js @@ -1,9 +1,6 @@ -// Making this similar to compose_state.js - +import autosize from "autosize"; import $ from "jquery"; -import * as compose_ui from "./compose_ui"; - const compose_textarea = $("#compose-textarea"); let is_full_size = false; // true or false @@ -25,6 +22,10 @@ export function get_is_full_size() { export function make_compose_box_full_size() { set_is_full_size(true); + // The autosize should be destroyed for the full size compose + // box else it will interfare and shrink its size accordingly. + autosize.destroy($("#compose-textarea")); + compose_textarea.css("max-height", get_expected_full_height()); compose_textarea.css("height", get_expected_full_height()); $("#floating_recipient_bar").css("z-index", -1); @@ -39,6 +40,10 @@ export function make_compose_box_original_size() { compose_textarea.css("max-height", "calc(50vh - 50px)"); $("#floating_recipient_bar").css("z-index", 98); + // Again initialise the compose textarea as it was destroyed + // when compose box was made full screen + autosize($("#compose-textarea")); + $("#collapse_composebox_button").hide(); $("#expand_composebox_button").show(); } diff --git a/static/js/compose_ui.js b/static/js/compose_ui.js index d6330462d5ec6c..aa95a8fd565296 100644 --- a/static/js/compose_ui.js +++ b/static/js/compose_ui.js @@ -1,6 +1,7 @@ import autosize from "autosize"; import $ from "jquery"; +import * as compose_height from "./compose_height"; import {$t} from "./i18n"; import * as people from "./people"; import * as user_status from "./user_status"; @@ -8,7 +9,9 @@ import * as user_status from "./user_status"; export function autosize_textarea(textarea) { // Since this supports both compose and file upload, one must pass // in the text area to autosize. - autosize.update(textarea); + if (!compose_height.get_is_full_size()) { + autosize.update(textarea); + } } export function smart_insert(textarea, syntax) {