mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-25 21:35:53 +08:00
fix prevent default keybindings
This commit is contained in:
parent
bf83cabafe
commit
ba2be37f0f
@ -63,36 +63,35 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
onEnter: args => {
|
onEnter: args => {
|
||||||
console.log('start', args)
|
|
||||||
this.query = args.query
|
this.query = args.query
|
||||||
this.filteredUsers = args.items
|
this.filteredUsers = args.items
|
||||||
},
|
},
|
||||||
onChange: args => {
|
onChange: args => {
|
||||||
console.log('change', args)
|
|
||||||
this.query = args.query
|
this.query = args.query
|
||||||
this.filteredUsers = args.items
|
this.filteredUsers = args.items
|
||||||
},
|
},
|
||||||
onExit: args => {
|
onExit: args => {
|
||||||
console.log('stop', args)
|
|
||||||
this.query = null
|
this.query = null
|
||||||
this.filteredUsers = args.items
|
this.filteredUsers = args.items
|
||||||
},
|
},
|
||||||
onKeyDown: ({ event }) => {
|
onKeyDown: ({ event }) => {
|
||||||
// pressing up arrow
|
// pressing up arrow
|
||||||
if (event.keyCode === 38) {
|
if (event.keyCode === 38) {
|
||||||
event.preventDefault()
|
|
||||||
this.upHandler()
|
this.upHandler()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
// pressing down arrow
|
// pressing down arrow
|
||||||
if (event.keyCode === 40) {
|
if (event.keyCode === 40) {
|
||||||
event.preventDefault()
|
|
||||||
this.downHandler()
|
this.downHandler()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
// pressing enter
|
// pressing enter
|
||||||
if (event.keyCode === 13) {
|
if (event.keyCode === 13) {
|
||||||
event.preventDefault()
|
|
||||||
this.enterHandler()
|
this.enterHandler()
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
},
|
},
|
||||||
onFilter: (items, query) => {
|
onFilter: (items, query) => {
|
||||||
if (!query) {
|
if (!query) {
|
||||||
|
Loading…
Reference in New Issue
Block a user