Skip to content

Commit

Permalink
bugfix: autofocus editor to bind search function
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Dej <[email protected]>
  • Loading branch information
meteyou committed Aug 24, 2021
1 parent d4670c5 commit aa6221f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/inputs/Codemirror.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<template>
<div class="vue-codemirror">
<div ref="codemirror"></div>
<div ref="codemirror" v-observe-visibility="visibilityChanged"></div>
</div>
</template>

Expand Down Expand Up @@ -72,7 +72,6 @@ export default class Codemirror extends Mixins(BaseMixin) {
})
this.cminstance = this.codemirror
this.$nextTick(() => {
this.setCmValue(this.code || this.value || this.content)
Expand Down Expand Up @@ -106,5 +105,9 @@ export default class Codemirror extends Mixins(BaseMixin) {
return extensions
}
visibilityChanged(isVisible: boolean) {
if (isVisible) this.cminstance?.focus()
}
}
</script>

0 comments on commit aa6221f

Please sign in to comment.