From bdfd0beb29b563928d4b0f48fbf7732f1559f599 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Tue, 7 Aug 2018 21:40:29 +0900
Subject: [PATCH] refs #352 Close suggest popover when text is not match
---
.../components/TimelineSpace/Modals/NewToot/Status.vue | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue b/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue
index 275e0685..4eda0e00 100644
--- a/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue
+++ b/src/renderer/components/TimelineSpace/Modals/NewToot/Status.vue
@@ -82,16 +82,23 @@ export default {
// e.target.value: current value of the textarea
const [start, word] = suggestText(e.target.value, e.target.selectionStart, '@')
if (!start || !word) {
+ this.closeSuggest()
return false
}
this.filteredAccounts = this.accounts.filter((a) => a.startsWith(word))
if (this.filteredAccounts.length === 0) {
+ this.closeSuggest()
return false
}
this.openSuggest = true
this.startIndex = start
this.matchWord = word
},
+ closeSuggest () {
+ this.openSuggest = false
+ this.startIndex = null
+ this.matchWord = null
+ },
suggestHighlight (index) {
if (index < 0) {
this.highlightedIndex = 0
@@ -102,7 +109,6 @@ export default {
}
},
insertAccount (account) {
- console.log(account)
const str = `${this.status.slice(0, this.startIndex - 1)}${account} ${this.status.slice(this.startIndex + this.matchWord.length)}`
this.status = str
this.openSuggest = false