mirror of
https://github.com/flarum/framework.git
synced 2025-02-01 23:09:46 +08:00
Fix cursor not being placed correctly after emoji insertion
This commit is contained in:
parent
a095f17ea3
commit
7a97d281ba
|
@ -26,10 +26,12 @@ export default function addComposerAutocomplete() {
|
|||
const applySuggestion = function(replacement) {
|
||||
const insert = replacement + ' ';
|
||||
|
||||
// When calling setValue(), emojiStart will be set back to 0 so we need to compute this beforehand
|
||||
const index = emojiStart - 1 + insert.length;
|
||||
|
||||
const content = composer.content();
|
||||
composer.editor.setValue(content.substring(0, emojiStart - 1) + insert + content.substr($textarea[0].selectionStart));
|
||||
|
||||
const index = emojiStart - 1 + insert.length;
|
||||
composer.editor.setSelectionRange(index, index);
|
||||
|
||||
dropdown.hide();
|
||||
|
|
Loading…
Reference in New Issue
Block a user