diff options
| author | lambda <pleromagit@rogerbraun.net> | 2019-01-30 18:58:08 +0000 |
|---|---|---|
| committer | lambda <pleromagit@rogerbraun.net> | 2019-01-30 18:58:08 +0000 |
| commit | 5b7b1dfebc37bd5db4e839973062b452b02c898d (patch) | |
| tree | a517e4942725286b173b685cbe87bc6c7878b66e /src/components/media_modal/media_modal.js | |
| parent | b1facdf7ad54436c2afde7c28c917cda87a5b7e3 (diff) | |
| parent | c7cffbb6c70bbb21cf787d96e82e0261427b9234 (diff) | |
Merge branch 'feat/media-modal' into 'develop'
modal for viewing attachments in-tab
See merge request pleroma/pleroma-fe!468
Diffstat (limited to 'src/components/media_modal/media_modal.js')
| -rw-r--r-- | src/components/media_modal/media_modal.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/components/media_modal/media_modal.js b/src/components/media_modal/media_modal.js new file mode 100644 index 00000000..14ae19d4 --- /dev/null +++ b/src/components/media_modal/media_modal.js @@ -0,0 +1,38 @@ +import StillImage from '../still-image/still-image.vue' +import VideoAttachment from '../video_attachment/video_attachment.vue' +import fileTypeService from '../../services/file_type/file_type.service.js' + +const MediaModal = { + components: { + StillImage, + VideoAttachment + }, + computed: { + showing () { + return this.$store.state.mediaViewer.activated + }, + currentIndex () { + return this.$store.state.mediaViewer.currentIndex + }, + currentMedia () { + return this.$store.state.mediaViewer.media[this.currentIndex] + }, + type () { + return this.currentMedia ? fileTypeService.fileType(this.currentMedia.mimetype) : null + } + }, + created () { + document.addEventListener('keyup', e => { + if (e.keyCode === 27 && this.showing) { // escape + this.hide() + } + }) + }, + methods: { + hide () { + this.$store.dispatch('closeMediaViewer') + } + } +} + +export default MediaModal |
