Custom emoji (#3061)

* wip

* wip

* wip
This commit is contained in:
syuilo
2018-11-01 11:51:49 +09:00
committed by GitHub
parent 86fcd3a378
commit c21caad1c5
7 changed files with 91 additions and 8 deletions

View File

@ -222,13 +222,15 @@ class Autocomplete {
const trimmedBefore = before.substring(0, before.lastIndexOf(':'));
const after = source.substr(caret);
if (value.startsWith(':')) value = value + ' ';
// 挿入
this.text = trimmedBefore + value + after;
// キャレットを戻す
this.vm.$nextTick(() => {
this.textarea.focus();
const pos = trimmedBefore.length + 1;
const pos = trimmedBefore.length + (value.startsWith(':') ? value.length : 1);
this.textarea.setSelectionRange(pos, pos);
});
}