Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

compose: Don't calculate preview height preemptively.

evykassirer01cb7867156e
diff --git a/web/src/compose.js b/web/src/compose.js
index 915c34887fc..a35534992c1 100644
--- a/web/src/compose.js
+++ b/web/src/compose.js
@@ -60,23 +60,18 @@ export function show_preview_area() {
const $compose_textarea = $("textarea#compose-textarea");
const content = $compose_textarea.val();
- const edit_height = $compose_textarea.height();
$("#compose .markdown_preview").hide();
$("#compose .undo_markdown_preview").show();
$("#compose .undo_markdown_preview").trigger("focus");
const $preview_message_area = $("#compose .preview_message_area");
- // Set the preview area to the edit height to keep from
- // having the preview jog the size of the compose box.
- $preview_message_area.css({height: edit_height + "px"});
- $preview_message_area.show();
-
compose_ui.render_and_show_preview(
$("#compose .markdown_preview_spinner"),
$("#compose .preview_content"),
content,
);
+ $preview_message_area.show();
}
export function create_message_object(message_content = compose_state.message_content()) {
diff --git a/web/src/message_edit.ts b/web/src/message_edit.ts
index 13ee0befc68..2ad8791cab7 100644
--- a/web/src/message_edit.ts
+++ b/web/src/message_edit.ts
@@ -1648,7 +1648,6 @@ export function is_message_oldest_or_newest(
export function show_preview_area($element: JQuery): void {
const $row = rows.get_closest_row($element);
const $msg_edit_content = $row.find<HTMLTextAreaElement>("textarea.message_edit_content");
- const edit_height = $msg_edit_content.height();
const content = $msg_edit_content.val();
assert(content !== undefined);
@@ -1661,16 +1660,12 @@ export function show_preview_area($element: JQuery): void {
$row.find(".markdown_preview").hide();
$row.find(".undo_markdown_preview").show();
const $preview_message_area = $row.find(".preview_message_area");
- // Set the preview area to the edit height to keep from
- // having the preview jog the size of the message-edit box.
- $preview_message_area.css({height: edit_height + "px"});
- $preview_message_area.show();
-
compose_ui.render_and_show_preview(
$row.find(".markdown_preview_spinner"),
$row.find(".preview_content"),
content,
);
+ $preview_message_area.show();
}
export function clear_preview_area($element: JQuery): void {