message_edit: Scroll back to original position after closing edit form.

This commit changes the code to scroll to the top after closing the
message edit form to make sure the cursor it at same position and
the scroll does not distract the user when the request of message
edit is processing. Though the scrolling is not visible distinctly
in much case and is visible only when there is some delay, but it
is fine to change this code as the logic is correct and to be on
safer side.
This commit is contained in:
sahil839
2021-07-03 23:09:57 +05:30
committed by Tim Abbott
parent 8e7ad58557
commit d620ad0969

View File

@@ -656,7 +656,7 @@ export function end_message_row_edit(row) {
const message = message_lists.current.get(rows.id(row));
if (message !== undefined && currently_editing_messages.has(message.id)) {
const scroll_by = currently_editing_messages.get(message.id).scrolled_by;
message_viewport.scrollTop(message_viewport.scrollTop() - scroll_by);
const original_scrollTop = message_viewport.scrollTop();
// Clean up resize event listeners
const listeners = currently_editing_messages.get(message.id).listeners;
@@ -671,6 +671,7 @@ export function end_message_row_edit(row) {
currently_editing_messages.delete(message.id);
message_lists.current.hide_edit_message(row);
message_viewport.scrollTop(original_scrollTop - scroll_by);
compose.abort_video_callbacks(message.id);
}