mirror of https://github.com/ColorlibHQ/AdminLTE
Esc key exitst fullscreen
parent
e0e343e743
commit
4d78600b11
|
@ -28,6 +28,7 @@ const SELECTOR_MINIMIZE_ICON = '[data-lte-icon="minimize"]'
|
|||
*/
|
||||
class FullScreen {
|
||||
_element: HTMLElement
|
||||
|
||||
constructor(element: HTMLElement) {
|
||||
this._element = element
|
||||
}
|
||||
|
@ -86,6 +87,18 @@ onDOMContentLoaded(() => {
|
|||
}
|
||||
})
|
||||
})
|
||||
document.addEventListener('keydown', event => {
|
||||
event.preventDefault()
|
||||
if (event.key === 'Escape' && document.fullscreenEnabled) {
|
||||
const target = event.target as HTMLElement
|
||||
const fsButton = target.closest(SELECTOR_FULLSCREEN_TOGGLE) as HTMLElement | undefined
|
||||
|
||||
if (fsButton) {
|
||||
const data = new FullScreen(fsButton)
|
||||
data.toggleFullScreen()
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
export default FullScreen
|
||||
|
|
Loading…
Reference in New Issue