fix(Tiptap): don't consume key events if no items (#1594)
parent
faa96c7705
commit
a8e7fd52a9
|
@ -40,6 +40,9 @@ watch(items, () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
function onKeyDown(event: KeyboardEvent) {
|
function onKeyDown(event: KeyboardEvent) {
|
||||||
|
if (items.length === 0)
|
||||||
|
return false
|
||||||
|
|
||||||
if (event.key === 'ArrowUp') {
|
if (event.key === 'ArrowUp') {
|
||||||
selectedIndex = ((selectedIndex + items.length) - 1) % items.length
|
selectedIndex = ((selectedIndex + items.length) - 1) % items.length
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -15,6 +15,9 @@ watch(items, () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
function onKeyDown(event: KeyboardEvent) {
|
function onKeyDown(event: KeyboardEvent) {
|
||||||
|
if (items.length === 0)
|
||||||
|
return false
|
||||||
|
|
||||||
if (event.key === 'ArrowUp') {
|
if (event.key === 'ArrowUp') {
|
||||||
selectedIndex = ((selectedIndex + items.length) - 1) % items.length
|
selectedIndex = ((selectedIndex + items.length) - 1) % items.length
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -15,6 +15,9 @@ watch(items, () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
function onKeyDown(event: KeyboardEvent) {
|
function onKeyDown(event: KeyboardEvent) {
|
||||||
|
if (items.length === 0)
|
||||||
|
return false
|
||||||
|
|
||||||
if (event.key === 'ArrowUp') {
|
if (event.key === 'ArrowUp') {
|
||||||
selectedIndex = ((selectedIndex + items.length) - 1) % items.length
|
selectedIndex = ((selectedIndex + items.length) - 1) % items.length
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue