compose: Have at least 2 new lines before and after a quoted message.

Uptil now, 1 new line was added before and 1 after a quoted message. Now
for more breathing room around a quoted message, new lines are inserted
to space it from any content before and after by at least 2 new lines.

Fixes: #23608.
This commit is contained in:
N-Shar-ma
2023-01-30 16:35:09 +05:30
committed by Tim Abbott
parent 3feb536df3
commit 25d2e1caed
4 changed files with 135 additions and 41 deletions

View File

@@ -536,25 +536,17 @@ export function quote_and_reply(opts) {
const message = message_lists.current.selected_message();
const quoting_placeholder = $t({defaultMessage: "[Quoting…]"});
if (compose_state.has_message_content()) {
// The user already started typing a message,
// so we won't re-open the compose box.
if (!compose_state.has_message_content()) {
// The user has not started typing a message,
// so we will re-open the compose box.
// (If you did re-open the compose box, you
// are prone to glitches where you select the
// text, plus it's a complicated codepath that
// can have other unintended consequences.)
if ($textarea.caret() !== 0) {
// Insert a newline before quoted message if there is
// already some content in the compose box and quoted
// message is not being inserted at the beginning.
$textarea.caret("\n");
}
} else {
respond_to_message(opts);
}
compose_ui.insert_syntax_and_focus(quoting_placeholder + "\n", $textarea);
compose_ui.insert_syntax_and_focus(quoting_placeholder, $textarea, "block");
function replace_content(message) {
// Final message looks like: