Updates on search and something
Former-commit-id: 229baefa76ee3202dcf4aac3249a461b6cc51eed [formerly 2773046c33eee1ff79ef1d02238de37e14860726] [formerly 2d50f10c3f809c6135cc861eaf0360092a23ea3f [formerly 14ff4f2b74c440888b632a6bacd338067dd0b588]] Former-commit-id: e766887e65390514cf827700c3ab0d5ed000c480 [formerly 7429be72884d3eb154e45dc638fd17dfcfdfaa62] Former-commit-id: d23373bf316295d6579e4bbc780f5b963c632c4d
This commit is contained in:
@@ -41,7 +41,6 @@ export default {
|
||||
data: function () {
|
||||
return {
|
||||
value: '',
|
||||
active: false,
|
||||
ongoing: false,
|
||||
scrollable: null,
|
||||
search: [],
|
||||
@@ -49,7 +48,11 @@ export default {
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState(['user']),
|
||||
...mapState(['user', 'show']),
|
||||
// Computed property for activeness of search.
|
||||
active () {
|
||||
return (this.show === 'search')
|
||||
},
|
||||
// Placeholder value.
|
||||
placeholder: function () {
|
||||
if (this.user.allowCommands && this.user.commands.length > 0) {
|
||||
@@ -88,14 +91,14 @@ export default {
|
||||
// when it's pressed, it closes the search window.
|
||||
window.addEventListener('keydown', (event) => {
|
||||
if (event.keyCode === 27) {
|
||||
this.active = false
|
||||
this.$store.commit('closeHovers')
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// Sets the search to active.
|
||||
open: function (event) {
|
||||
this.active = true
|
||||
this.$store.commit('showHover', 'search')
|
||||
},
|
||||
// Closes the search and prevents the event
|
||||
// of propagating so it doesn't trigger the
|
||||
@@ -103,7 +106,7 @@ export default {
|
||||
close: function (event) {
|
||||
event.stopPropagation()
|
||||
event.preventDefault()
|
||||
this.active = false
|
||||
this.$store.commit('closeHovers')
|
||||
},
|
||||
// Checks if the current input is a supported command.
|
||||
supported: function () {
|
||||
@@ -127,7 +130,6 @@ export default {
|
||||
return
|
||||
}
|
||||
|
||||
this.active = true
|
||||
this.search.length = 0
|
||||
this.commands.length = 0
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user