Merge branch '788-hide-media-viewer-on-navigation' into 'develop'

MediaModal: Close on browser navigation events.

Closes #788

See merge request pleroma/pleroma-fe!1129
This commit is contained in:
HJ 2020-06-04 16:00:53 +00:00
commit a6f73d7da5
1 changed files with 2 additions and 0 deletions

View File

@ -84,10 +84,12 @@ const MediaModal = {
} }
}, },
mounted () { mounted () {
window.addEventListener('popstate', this.hide)
document.addEventListener('keyup', this.handleKeyupEvent) document.addEventListener('keyup', this.handleKeyupEvent)
document.addEventListener('keydown', this.handleKeydownEvent) document.addEventListener('keydown', this.handleKeydownEvent)
}, },
destroyed () { destroyed () {
window.removeEventListener('popstate', this.hide)
document.removeEventListener('keyup', this.handleKeyupEvent) document.removeEventListener('keyup', this.handleKeyupEvent)
document.removeEventListener('keydown', this.handleKeydownEvent) document.removeEventListener('keydown', this.handleKeydownEvent)
} }