From afae6bc267cd373d18a2aa8084af7b551b9d01a2 Mon Sep 17 00:00:00 2001 From: Scott Nonnenberg Date: Mon, 22 May 2023 13:31:36 -0700 Subject: [PATCH] CompositionInput: Properly set cursor right after pasted data --- ts/quill/signal-clipboard/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ts/quill/signal-clipboard/index.ts b/ts/quill/signal-clipboard/index.ts index 43e15df6a225..47f618eb4004 100644 --- a/ts/quill/signal-clipboard/index.ts +++ b/ts/quill/signal-clipboard/index.ts @@ -38,8 +38,6 @@ export class SignalClipboard { return; } - this.quill.focus(); - const clipboard = this.quill.getModule('clipboard'); const selection = this.quill.getSelection(); @@ -72,8 +70,10 @@ export class SignalClipboard { .delete(selection.length) .concat(clipboardDelta); this.quill.updateContents(delta, 'user'); - this.quill.setSelection(delta.length(), 0, 'silent'); + this.quill.setSelection(delta.length() - selection.length, 0, 'silent'); this.quill.scrollingContainer.scrollTop = scrollTop; + + this.quill.focus(); }, 1); } }