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