Skip to content

Commit

Permalink
fix(ui/split-attrs): update to newest vue specs #11297
Browse files Browse the repository at this point in the history
  • Loading branch information
rstoenescu committed Nov 13, 2021
1 parent 0e16178 commit cf47248
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ui/src/components/editor/QEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,12 @@ export default createComponent({
],

setup (props, { slots, emit, attrs }) {
const { proxy } = getCurrentInstance()
const { proxy, vnode } = getCurrentInstance()
const { $q } = proxy

const isDark = useDark(props, $q)
const { inFullscreen, toggleFullscreen } = useFullscreen()
const splitAttrs = useSplitAttrs(attrs)
const splitAttrs = useSplitAttrs(attrs, vnode)

const rootRef = ref(null)
const contentRef = ref(null)
Expand Down
4 changes: 2 additions & 2 deletions ui/src/composables/private/use-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const useFieldProps = {
export const useFieldEmits = [ 'update:modelValue', 'clear', 'focus', 'blur', 'popup-show', 'popup-hide' ]

export function useFieldState () {
const { props, attrs, proxy } = getCurrentInstance()
const { props, attrs, proxy, vnode } = getCurrentInstance()

const isDark = useDark(props, proxy.$q)

Expand All @@ -90,7 +90,7 @@ export function useFieldState () {
focused: ref(false),
hasPopupOpen: false,

splitAttrs: useSplitAttrs(attrs),
splitAttrs: useSplitAttrs(attrs, vnode),
targetUid: ref(getTargetUid(props.for)),

rootRef: ref(null),
Expand Down
8 changes: 7 additions & 1 deletion ui/src/composables/private/use-split-attrs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ref, onBeforeUpdate } from 'vue'

const listenerRE = /^on[A-Z]/

export default function (attrs) {
export default function (attrs, vnode) {
const acc = {
listeners: ref({}),
attributes: ref({})
Expand All @@ -21,6 +21,12 @@ export default function (attrs) {
}
})

Object.keys(vnode.props).forEach(key => {
if (listenerRE.test(key) === true) {
listeners[ key ] = vnode.props[ key ]
}
})

acc.listeners.value = listeners
acc.attributes.value = attributes
}
Expand Down

0 comments on commit cf47248

Please sign in to comment.