focus search input on toggleSearch event
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user