focus search input on toggleSearch event

This commit is contained in:
Chrissi2812
2019-05-28 13:53:15 +02:00
parent f19b5c8f34
commit 94b2846695

View File

@@ -107,7 +107,7 @@
<button
class="menubar__button"
@click="toggleSearch"
@click="editor.commands.toggleSearch"
>
Search
<div
@@ -163,16 +163,6 @@ export default {
EditorMenuBar,
Icon,
},
methods: {
toggleSearch() {
this.editor.commands.toggleSearch()
this.$nextTick(() => {
if (this.$refs.search) {
this.$refs.search.focus()
}
})
},
},
data() {
return {
searching: false,
@@ -201,6 +191,13 @@ export default {
onUpdate: ({ getJSON }) => {
this.json = getJSON()
},
onToggleSearch: searching => {
this.$nextTick(() => {
if (searching) {
this.$refs.search.focus()
}
})
},
content: `
<h2>
Hi there,