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: Scroll cursor at message's end into view when restoring draft.

N-Shar-ma94dc5723c639
diff --git a/web/src/compose_actions.ts b/web/src/compose_actions.ts
index 732cbca5771..0f514058a98 100644
--- a/web/src/compose_actions.ts
+++ b/web/src/compose_actions.ts
@@ -305,7 +305,7 @@ export function start(raw_opts: ComposeActionsStartOpts): void {
// If the user opens the compose box, types some text, and then clicks on a
// different stream/topic, we want to keep the text in the compose box
if (opts.content !== undefined) {
- compose_state.message_content(opts.content);
+ compose_ui.insert_and_scroll_into_view(opts.content, $("textarea#compose-textarea"), true);
$(".compose_control_button_container:has(.add-poll)").addClass("disabled-on-hover");
}
@@ -320,8 +320,7 @@ export function start(raw_opts: ComposeActionsStartOpts): void {
if (opts.content !== undefined) {
// If we were provided with message content, we might need to
- // resize the compose box, or display that it's too long.
- compose_ui.autosize_textarea($("textarea#compose-textarea"));
+ // display that it's too long.
compose_validate.check_overflow_text();
}
diff --git a/web/tests/compose_actions.test.js b/web/tests/compose_actions.test.js
index 35455647d0f..4b5af370057 100644
--- a/web/tests/compose_actions.test.js
+++ b/web/tests/compose_actions.test.js
@@ -124,6 +124,10 @@ test("start", ({override, override_rewire, mock_template}) => {
let compose_defaults;
override(narrow_state, "set_compose_defaults", () => compose_defaults);
+ override(compose_ui, "insert_and_scroll_into_view", (content, $textarea, replace_all) => {
+ $textarea.val(content);
+ assert.ok(replace_all);
+ });
// Start stream message
compose_defaults = {