diff --git a/resources/assets/js/components/DrawerOverlay.vue b/resources/assets/js/components/DrawerOverlay.vue index 0dcce1ad6..c2f6ce1aa 100644 --- a/resources/assets/js/components/DrawerOverlay.vue +++ b/resources/assets/js/components/DrawerOverlay.vue @@ -27,6 +27,10 @@ type: Boolean, default: true }, + escClosable: { + type: Boolean, + default: true + }, placement: { validator (value) { return ['right', 'bottom'].includes(value) @@ -45,6 +49,14 @@ } }, + mounted () { + document.addEventListener('keydown', this.escClose); + }, + + beforeDestroy () { + document.removeEventListener('keydown', this.escClose); + }, + computed: { bodyStyle() { let size = parseInt(this.size); @@ -72,6 +84,13 @@ close() { this.$emit("input", !this.value) }, + escClose(e) { + if (this.value && this.escClosable) { + if (e.keyCode === 27) { + this.close() + } + } + } } } diff --git a/resources/assets/js/pages/manage/components/FileContent.vue b/resources/assets/js/pages/manage/components/FileContent.vue index 95b8b9d69..94ea7261e 100644 --- a/resources/assets/js/pages/manage/components/FileContent.vue +++ b/resources/assets/js/pages/manage/components/FileContent.vue @@ -112,6 +112,7 @@ export default { handler(info) { if (this.fileId != info.id) { this.fileId = info.id; + this.contentDetail = null; this.getContent(); } }, diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index a2c1fa575..8f4e28a6b 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -195,7 +195,10 @@ - +