mirror of
https://github.com/zulip/zulip.git
synced 2025-10-27 10:03:56 +00:00
drafts: Append a space to draft when restoring it.
If a user starts typing before they see that a draft was restored, this makes that experience a little smoother by adding some separation between the old draft and the new text.
This commit is contained in:
@@ -312,7 +312,12 @@ export function start(raw_opts: ComposeActionsStartOpts): void {
|
||||
const possible_last_draft = drafts.get_last_draft_based_on_compose_state();
|
||||
if (possible_last_draft !== undefined) {
|
||||
opts.draft_id = possible_last_draft.id;
|
||||
opts.content = possible_last_draft.content;
|
||||
// Add a space at the end so that if the user starts typing
|
||||
// as soon as the composebox opens, they have a bit of separation
|
||||
// from the restored draft. This won't result in a long trail of
|
||||
// spaces if a draft is restored several times, because we trim
|
||||
// whitespace whenever we save drafts.
|
||||
opts.content = possible_last_draft.content + " ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user