Don't use conflicting name "select" for language change event

#windows-build
This commit is contained in:
Jonatan Heyman 2023-01-16 21:52:45 +01:00
parent 9599fd7d92
commit c3918c32c5
2 changed files with 8 additions and 4 deletions

View File

@ -69,7 +69,7 @@
this.$refs.editor.focus()
},
onLanguageSelect(language) {
onSelectLanguage(language) {
this.showLanguageSelector = false
this.$refs.editor.setLanguage(language)
},
@ -102,7 +102,7 @@
<div class="overlay">
<LanguageSelector
v-if="showLanguageSelector"
@select="onLanguageSelect"
@selectLanguage="onSelectLanguage"
@close="closeLanguageSelector"
/>
</div>

View File

@ -41,7 +41,7 @@
this.selected = Math.max(this.selected - 1, 0)
event.preventDefault()
} else if (event.key === "Enter") {
this.$emit("select", this.filteredItems[this.selected].token)
this.selectItem(this.filteredItems[this.selected].token)
event.preventDefault()
} else if (event.key === "Escape") {
this.$emit("close")
@ -49,6 +49,10 @@
}
},
selectItem(token) {
this.$emit("selectLanguage", token)
},
onInput(event) {
// reset selection
this.selected = 0
@ -78,7 +82,7 @@
v-for="item, idx in filteredItems"
:key="item.token"
:class="idx === selected ? 'selected' : ''"
@click="$emit('select', item.token)"
@click="selectItem(item.token)"
>
{{ item.name }}
</li>