diff options
| author | Shpuld Shpludson <shp@cock.li> | 2019-02-14 14:50:58 +0000 |
|---|---|---|
| committer | Shpuld Shpludson <shp@cock.li> | 2019-02-14 14:50:58 +0000 |
| commit | 295becd6c8cf8d6f628be74a14d8f28361c1923a (patch) | |
| tree | d7b73325de8a2fc6c7d02a7dbdee7d0e6aefb4fb /src/components/autocomplete_input/autocomplete_input.js | |
| parent | 40b51b659eb89df3c2a841ddf93452314f609678 (diff) | |
| parent | 19dd36945ab91ad3a1cff9ddbbfadea437b75d6f (diff) | |
Merge branch 'hotfix/issues-in-autocomplete' into 'develop'
#355 hotfix/issues in autocomplete
Closes #355
See merge request pleroma/pleroma-fe!574
Diffstat (limited to 'src/components/autocomplete_input/autocomplete_input.js')
| -rw-r--r-- | src/components/autocomplete_input/autocomplete_input.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/components/autocomplete_input/autocomplete_input.js b/src/components/autocomplete_input/autocomplete_input.js index 404a8cdb..1544e7bb 100644 --- a/src/components/autocomplete_input/autocomplete_input.js +++ b/src/components/autocomplete_input/autocomplete_input.js @@ -24,8 +24,7 @@ const AutoCompleteInput = { data () { return { caret: 0, - highlighted: 0, - text: this.value + highlighted: 0 } }, computed: { @@ -42,7 +41,7 @@ const AutoCompleteInput = { return (this.wordAtCaret || {}).word || '' }, wordAtCaret () { - const word = Completion.wordAtPosition(this.text, this.caret - 1) || {} + const word = Completion.wordAtPosition(this.value, this.caret - 1) || {} return word }, candidates () { @@ -113,8 +112,8 @@ const AutoCompleteInput = { } }, replace (replacement) { - this.text = Completion.replaceWord(this.text, this.wordAtCaret, replacement) - const el = this.$el.querySelector('textarea') + this.$emit('input', Completion.replaceWord(this.value, this.wordAtCaret, replacement)) + const el = this.$el.querySelector('textarea') || this.$el.querySelector('input') el.focus() this.caret = 0 }, @@ -125,8 +124,7 @@ const AutoCompleteInput = { e.preventDefault() const candidate = this.candidates[this.highlighted] const replacement = candidate.utf || (candidate.screen_name + ' ') - this.text = Completion.replaceWord(this.text, this.wordAtCaret, replacement) - this.$emit('input', this.text) + this.$emit('input', Completion.replaceWord(this.value, this.wordAtCaret, replacement)) const el = this.$el.querySelector('textarea') || this.$el.querySelector('input') el.focus() this.caret = 0 |
