Skip to content

Commit

Permalink
improve suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Williangalvani committed Oct 26, 2024
1 parent 862f5db commit 435d5c8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/ExpressionEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
:value="value"
@input="updateValue($event.target.value)"
@keydown="handleKeyDown"
@blur="hideSuggestions"
@focus="handleInput"
ref="codeEditor"/>
<div v-if="showSuggestions" class="suggestions-box" :style="suggestionsBoxStyle">
<div v-for="(suggestion, index) in filteredSuggestions"
Expand Down Expand Up @@ -50,6 +52,11 @@ export default {
this.$emit('input', value)
this.handleInput()
},
hideSuggestions () {
setTimeout(() => {
this.showSuggestions = false
}, 100)
},
handleInput () {
const cursorPosition = this.$refs.codeEditor.selectionStart
const textBeforeCursor = this.value.slice(0, cursorPosition)
Expand Down

0 comments on commit 435d5c8

Please sign in to comment.