mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Change: v-focus directive looking for input +
Searches children and uses first <input> child. if target of v-focus is not instanceof HTMLInputElement Also, adds vue-directives to storybook and tests
This commit is contained in:
parent
5a2c8220af
commit
15d5933821
@ -7,7 +7,14 @@ export default ({ app }) => {
|
|||||||
// Focus the element
|
// Focus the element
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
if (binding.value !== false) {
|
if (binding.value !== false) {
|
||||||
el.focus()
|
let target = el
|
||||||
|
const isInput = target instanceof HTMLInputElement
|
||||||
|
if (!isInput) {
|
||||||
|
target = el.querySelector('input')
|
||||||
|
}
|
||||||
|
if (target && typeof target.focus === 'function') {
|
||||||
|
target.focus()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import Vuex from 'vuex'
|
|||||||
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'
|
import vuexI18n from 'vuex-i18n/dist/vuex-i18n.umd.js'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
import Filters from '~/plugins/vue-filters'
|
import Filters from '~/plugins/vue-filters'
|
||||||
|
import Directives from '~/plugins/vue-directives'
|
||||||
import IziToast from '~/plugins/izi-toast'
|
import IziToast from '~/plugins/izi-toast'
|
||||||
import layout from './layout.vue'
|
import layout from './layout.vue'
|
||||||
import locales from '~/locales/index.js'
|
import locales from '~/locales/index.js'
|
||||||
@ -15,6 +16,7 @@ const helpers = {
|
|||||||
Vue.use(Styleguide)
|
Vue.use(Styleguide)
|
||||||
Vue.use(Filters)
|
Vue.use(Filters)
|
||||||
Vue.use(IziToast)
|
Vue.use(IziToast)
|
||||||
|
Vue.use(Directives)
|
||||||
|
|
||||||
Vue.use(vuexI18n.plugin, helpers.store)
|
Vue.use(vuexI18n.plugin, helpers.store)
|
||||||
locales.forEach(({ code }) => {
|
locales.forEach(({ code }) => {
|
||||||
@ -38,7 +40,7 @@ const helpers = {
|
|||||||
isAdmin() {
|
isAdmin() {
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
user(state) {
|
user() {
|
||||||
return { id: '1', name: 'admin', slug: 'admin' }
|
return { id: '1', name: 'admin', slug: 'admin' }
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import Styleguide from '@human-connection/styleguide'
|
|||||||
import BaseComponents from '~/plugins/base-components'
|
import BaseComponents from '~/plugins/base-components'
|
||||||
import Filters from '~/plugins/vue-filters'
|
import Filters from '~/plugins/vue-filters'
|
||||||
import InfiniteLoading from '~/plugins/vue-infinite-loading'
|
import InfiniteLoading from '~/plugins/vue-infinite-loading'
|
||||||
|
import Directives from '~/plugins/vue-directives'
|
||||||
|
|
||||||
global.localVue = createLocalVue()
|
global.localVue = createLocalVue()
|
||||||
|
|
||||||
@ -13,4 +14,5 @@ global.localVue.use(VTooltip)
|
|||||||
global.localVue.use(Styleguide)
|
global.localVue.use(Styleguide)
|
||||||
global.localVue.use(BaseComponents)
|
global.localVue.use(BaseComponents)
|
||||||
global.localVue.use(Filters)
|
global.localVue.use(Filters)
|
||||||
|
global.localVue.use(Directives)
|
||||||
global.localVue.use(InfiniteLoading)
|
global.localVue.use(InfiniteLoading)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user