CompositionInput: Properly set cursor right after pasted data

This commit is contained in:
Scott Nonnenberg 2023-05-22 13:31:36 -07:00 committed by GitHub
parent 99011b0a56
commit afae6bc267
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -38,8 +38,6 @@ export class SignalClipboard {
return; return;
} }
this.quill.focus();
const clipboard = this.quill.getModule('clipboard'); const clipboard = this.quill.getModule('clipboard');
const selection = this.quill.getSelection(); const selection = this.quill.getSelection();
@ -72,8 +70,10 @@ export class SignalClipboard {
.delete(selection.length) .delete(selection.length)
.concat(clipboardDelta); .concat(clipboardDelta);
this.quill.updateContents(delta, 'user'); 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.scrollingContainer.scrollTop = scrollTop;
this.quill.focus();
}, 1); }, 1);
} }
} }