always allow keyboards shortcuts
This commit is contained in:
parent
ba44f8e65b
commit
da61426fc9
|
|
@ -83,6 +83,20 @@
|
|||
}
|
||||
})
|
||||
|
||||
// Send all keydown events to parent
|
||||
window.addEventListener('keydown', (e) => {
|
||||
window.parent.postMessage({
|
||||
type: 'KEYDOWN',
|
||||
data: {
|
||||
key: e.key,
|
||||
ctrlKey: e.ctrlKey,
|
||||
shiftKey: e.shiftKey,
|
||||
altKey: e.altKey,
|
||||
metaKey: e.metaKey
|
||||
}
|
||||
}, '*')
|
||||
})
|
||||
|
||||
if (window.parent !== window) {
|
||||
window.parent.postMessage({ type: 'NAV_READY' }, '*')
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,18 @@ function handleAppMessage(event: MessageEvent) {
|
|||
case 'NAV_BLOCKED':
|
||||
showNavigationError(data.url, data.reason)
|
||||
break
|
||||
|
||||
case 'KEYDOWN':
|
||||
const keyEvent = new KeyboardEvent('keydown', {
|
||||
key: data.key,
|
||||
ctrlKey: data.ctrlKey,
|
||||
shiftKey: data.shiftKey,
|
||||
altKey: data.altKey,
|
||||
metaKey: data.metaKey,
|
||||
bubbles: true
|
||||
})
|
||||
window.dispatchEvent(keyEvent)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user