clicking Esc clears autosuggestions
This commit is contained in:
parent
2848d5a417
commit
ec80a3847b
|
@ -112,6 +112,9 @@
|
||||||
case 40: // down
|
case 40: // down
|
||||||
this.incrementAutosuggestSelected(1, e)
|
this.incrementAutosuggestSelected(1, e)
|
||||||
break
|
break
|
||||||
|
case 27: // escape
|
||||||
|
this.clearAutosuggestions(e)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -127,6 +130,7 @@
|
||||||
/* no await */ clickSelectedAutosuggestionEmoji(this.get('realm'))
|
/* no await */ clickSelectedAutosuggestionEmoji(this.get('realm'))
|
||||||
}
|
}
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
},
|
},
|
||||||
incrementAutosuggestSelected(increment, event) {
|
incrementAutosuggestSelected(increment, event) {
|
||||||
let autosuggestionShown = this.store.get('composeAutosuggestionShown')
|
let autosuggestionShown = this.store.get('composeAutosuggestionShown')
|
||||||
|
@ -143,6 +147,19 @@
|
||||||
}
|
}
|
||||||
this.store.set({composeAutosuggestionSelected: selected})
|
this.store.set({composeAutosuggestionSelected: selected})
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
|
},
|
||||||
|
clearAutosuggestions(event) {
|
||||||
|
let autosuggestionShown = this.store.get('composeAutosuggestionShown')
|
||||||
|
if (!autosuggestionShown) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.store.set({
|
||||||
|
composeAutosuggestionSearchResults: [],
|
||||||
|
composeAutosuggestionSelected: 0
|
||||||
|
})
|
||||||
|
event.preventDefault()
|
||||||
|
event.stopPropagation()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
store: () => store,
|
store: () => store,
|
||||||
|
|
Loading…
Reference in a new issue