summaryrefslogtreecommitdiff
path: root/src/web/app
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2018-02-25 13:31:02 +0900
committersyuilo <syuilotan@yahoo.co.jp>2018-02-25 13:31:02 +0900
commit977df7f194d1e70f3f600ecd7da1c2e1f9f68253 (patch)
tree6b0863ba3a9012bff30cfbbd70fdd2913da5465a /src/web/app
parentFix #1141 (diff)
downloadsharkey-977df7f194d1e70f3f600ecd7da1c2e1f9f68253.tar.gz
sharkey-977df7f194d1e70f3f600ecd7da1c2e1f9f68253.tar.bz2
sharkey-977df7f194d1e70f3f600ecd7da1c2e1f9f68253.zip
Fix #81
Diffstat (limited to 'src/web/app')
-rw-r--r--src/web/app/common/views/directives/autocomplete.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/web/app/common/views/directives/autocomplete.ts b/src/web/app/common/views/directives/autocomplete.ts
index 7d04026f8b..8a33b4e595 100644
--- a/src/web/app/common/views/directives/autocomplete.ts
+++ b/src/web/app/common/views/directives/autocomplete.ts
@@ -152,9 +152,11 @@ class Autocomplete {
this.text = trimmedBefore + '@' + value.username + ' ' + after;
// キャレットを戻す
- this.textarea.focus();
- const pos = caret + value.username.length;
- this.textarea.setSelectionRange(pos, pos);
+ this.vm.$nextTick(() => {
+ this.textarea.focus();
+ const pos = trimmedBefore.length + (value.username.length + 2);
+ this.textarea.setSelectionRange(pos, pos);
+ });
} else if (type == 'emoji') {
const source = this.text;
@@ -166,9 +168,11 @@ class Autocomplete {
this.text = trimmedBefore + value + after;
// キャレットを戻す
- this.textarea.focus();
- const pos = caret + value.length;
- this.textarea.setSelectionRange(pos, pos);
+ this.vm.$nextTick(() => {
+ this.textarea.focus();
+ const pos = trimmedBefore.length + 1;
+ this.textarea.setSelectionRange(pos, pos);
+ });
}
}
}