diff options
| author | HJ <spam@hjkos.com> | 2019-02-14 19:09:32 +0000 |
|---|---|---|
| committer | HJ <spam@hjkos.com> | 2019-02-14 19:09:32 +0000 |
| commit | dfecbe0ab741d3e892c109770a4898c79e165e3c (patch) | |
| tree | f93fa8c6d06dfc8f4642a50b80769cf495138eea /src/components/autocomplete_input/autocomplete_input.js | |
| parent | 295becd6c8cf8d6f628be74a14d8f28361c1923a (diff) | |
| parent | ee4c6f362b286e1306b89e036a48ebc79589d056 (diff) | |
Merge branch 'revert-295becd6' into 'develop'
Revert "Merge branch 'hotfix/issues-in-autocomplete' into 'develop'"
See merge request pleroma/pleroma-fe!580
Diffstat (limited to 'src/components/autocomplete_input/autocomplete_input.js')
| -rw-r--r-- | src/components/autocomplete_input/autocomplete_input.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/autocomplete_input/autocomplete_input.js b/src/components/autocomplete_input/autocomplete_input.js index 1544e7bb..404a8cdb 100644 --- a/src/components/autocomplete_input/autocomplete_input.js +++ b/src/components/autocomplete_input/autocomplete_input.js @@ -24,7 +24,8 @@ const AutoCompleteInput = { data () { return { caret: 0, - highlighted: 0 + highlighted: 0, + text: this.value } }, computed: { @@ -41,7 +42,7 @@ const AutoCompleteInput = { return (this.wordAtCaret || {}).word || '' }, wordAtCaret () { - const word = Completion.wordAtPosition(this.value, this.caret - 1) || {} + const word = Completion.wordAtPosition(this.text, this.caret - 1) || {} return word }, candidates () { @@ -112,8 +113,8 @@ const AutoCompleteInput = { } }, replace (replacement) { - this.$emit('input', Completion.replaceWord(this.value, this.wordAtCaret, replacement)) - const el = this.$el.querySelector('textarea') || this.$el.querySelector('input') + this.text = Completion.replaceWord(this.text, this.wordAtCaret, replacement) + const el = this.$el.querySelector('textarea') el.focus() this.caret = 0 }, @@ -124,7 +125,8 @@ const AutoCompleteInput = { e.preventDefault() const candidate = this.candidates[this.highlighted] const replacement = candidate.utf || (candidate.screen_name + ' ') - this.$emit('input', Completion.replaceWord(this.value, this.wordAtCaret, replacement)) + this.text = Completion.replaceWord(this.text, this.wordAtCaret, replacement) + this.$emit('input', this.text) const el = this.$el.querySelector('textarea') || this.$el.querySelector('input') el.focus() this.caret = 0 |
