resize: Rename reset_compose_textarea_max_height.

This no logner just resets the max-height of compose-textarea
but also preview_message_area.
This commit is contained in:
Aman Agrawal 2022-02-02 05:06:56 +00:00 committed by Tim Abbott
parent adf8446b51
commit a38b11d188
5 changed files with 10 additions and 10 deletions

View File

@ -749,9 +749,9 @@ test_ui("on_events", ({override, override_rewire}) => {
})();
(function test_markdown_preview_compose_clicked() {
let reset_compose_textarea_max_height_called = false;
override(resize, "reset_compose_textarea_max_height", () => {
reset_compose_textarea_max_height_called = true;
let reset_compose_message_max_height_called = false;
override(resize, "reset_compose_message_max_height", () => {
reset_compose_message_max_height_called = true;
});
// Tests setup
@ -839,7 +839,7 @@ test_ui("on_events", ({override, override_rewire}) => {
assert.equal($("#compose .preview_content").html(), "translated HTML: Nothing to preview");
assert_visibilities();
assert.ok(reset_compose_textarea_max_height_called);
assert.ok(reset_compose_message_max_height_called);
let make_indicator_called = false;
$("#compose-textarea").val("```foobarfoobar```");

View File

@ -45,7 +45,7 @@ mock_esm("../../static/js/message_lists", {
},
});
mock_esm("../../static/js/resize", {
reset_compose_textarea_max_height: noop,
reset_compose_message_max_height: noop,
});
const people = zrequire("people");

View File

@ -669,7 +669,7 @@ export function initialize() {
$("#compose .preview_content"),
content,
);
resize.reset_compose_textarea_max_height();
resize.reset_compose_message_max_height();
});
$("#compose").on("click", ".undo_markdown_preview", (e) => {

View File

@ -292,7 +292,7 @@ export function start(msg_type, opts) {
// Reset the `max-height` property of `compose-textarea` so that the
// compose-box do not cover the last messages of the current stream
// while writing a long message.
resize.reset_compose_textarea_max_height();
resize.reset_compose_message_max_height();
complete_starting_tasks(msg_type, opts);
}

View File

@ -159,7 +159,7 @@ export function watch_manual_resize(element) {
return [box_handler, body_handler];
}
export function reset_compose_textarea_max_height(bottom_whitespace_height) {
export function reset_compose_message_max_height(bottom_whitespace_height) {
// If the compose-box is open, we set the `max-height` property of
// `compose-textarea` and `preview-textarea`, so that the
// compose-box's maximum extent does not overlap the last message
@ -194,11 +194,11 @@ export function resize_bottom_whitespace(h) {
// The height of the compose box is tied to that of
// bottom_whitespace, so update it if necessary.
//
// reset_compose_textarea_max_height cannot compute the right
// reset_compose_message_max_height cannot compute the right
// height correctly while compose is hidden. This is OK, because
// we also resize compose every time it is opened.
if ($(".message_comp").is(":visible")) {
reset_compose_textarea_max_height(h.bottom_whitespace_height);
reset_compose_message_max_height(h.bottom_whitespace_height);
}
}