Skip to content

Commit

Permalink
ComposeBox : Fixed composebox overlapping latest messages
Browse files Browse the repository at this point in the history
While writing long messages,the textarea would cover-up the latest messages hence blocking its visibility .
Fixed this by adding a max-height property to textarea , hence
avoiding overlapping with the latest messages in the current stream.

Fixes zulip#16038
  • Loading branch information
aryanshridhar committed Sep 22, 2020
1 parent 2b9f791 commit e4b7235
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions static/js/click_handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,12 @@ exports.initialize = function () {
$(".compose_stream_button").on("click", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("stream", {trigger: "new topic button"});
compose_ui.autosize_textarea();
});
$(".compose_private_button").on("click", () => {
popovers.hide_mobile_message_buttons_popover();
compose_actions.start("private");
compose_ui.autosize_textarea();
});

$("body").on("click", ".compose_mobile_stream_button", () => {
Expand Down
11 changes: 11 additions & 0 deletions static/js/compose_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ const people = require("./people");

exports.autosize_textarea = function () {
autosize.update($("#compose-textarea"));
$("#compose-textarea").css(
"max-height",
parseInt($("#bottom_whitespace").outerHeight(), 10) -
(parseInt($("#below-compose-content").outerHeight(), 10) +
parseInt($("#right_part").outerHeight(), 10) +
parseInt($("#compose-textarea").css("padding-top"), 10) +
parseInt($("#compose-textarea").css("padding-bottom"), 10) +
parseInt($("#compose-textarea").css("margin-top"), 10) +
parseInt($(".message_comp.compose-content").css("padding-top"), 10) +
parseInt($(".message_comp.compose-content").css("padding-bottom"), 10)),
);
};

exports.smart_insert = function (textarea, syntax) {
Expand Down
1 change: 1 addition & 0 deletions static/js/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ exports.watch_manual_resize = function (element) {

exports.resize_bottom_whitespace = function (h) {
$("#bottom_whitespace").height(h.bottom_whitespace_height);
compose_ui.autosize_textarea();
};

exports.resize_stream_filters_container = function (h) {
Expand Down
2 changes: 1 addition & 1 deletion templates/zerver/app/compose.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="compose_table">
<div id="stream-message">
<div class="stream-selection-header-colorblock message_header_stream left_part"></div>
<div class="right_part">
<div class="right_part" id = 'right_part'>
<span id="compose-lock-icon">
<i class="fa fa-lock" title="{{ _('This is a private stream') }}" aria-hidden="true"></i>
</span>
Expand Down

0 comments on commit e4b7235

Please sign in to comment.