From fe204797dd4cc2085af911c9d7e3f9a5756e076e Mon Sep 17 00:00:00 2001 From: jmal Date: Thu, 18 Jul 2024 15:22:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=92=8C=E5=85=B6=E4=BB=96=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E4=B9=8B=E9=97=B4=E7=9A=84=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ShowFile/ShowFile.vue | 56 ++++++++++++++++++---------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/src/components/ShowFile/ShowFile.vue b/src/components/ShowFile/ShowFile.vue index 1332ad0..ea000be 100644 --- a/src/components/ShowFile/ShowFile.vue +++ b/src/components/ShowFile/ShowFile.vue @@ -1352,34 +1352,30 @@ export default { const { keyCode } = event const isCmd = this.checkCmdKey(event) console.log('keydown', 'keyCode', keyCode, 'isCmd', isCmd) + + const checkPreviewVisible = this.checkPreviewVisible() // space - if (keyCode === 32) { - if (!this.inputting && this.selectRowData.length > 0 && !this.drawer) { - this.drawer = true - this.drawerShowTime = Date.now() - event.preventDefault() - event.stopPropagation() - } + if (keyCode === 32 && this.selectRowData.length > 0 && !this.drawer && !checkPreviewVisible) { + this.drawer = true + this.drawerShowTime = Date.now() + event.preventDefault() + event.stopPropagation() } // F2 - if (keyCode === 113) { - if (this.selectRowData.length > 0 && !this.drawer) { - this.renameFileName = this.rowContextData.name - this.editingIndex = this.rowContextData.index - } + if (keyCode === 113 && this.selectRowData.length > 0 && !checkPreviewVisible) { + this.renameFileName = this.rowContextData.name + this.editingIndex = this.rowContextData.index event.preventDefault() event.stopPropagation() } // Del - if (keyCode === 8) { - if (!this.inputting && this.selectRowData.length > 0) { - this.removeOperation() - event.preventDefault() - event.stopPropagation() - } + if (keyCode === 8 && !this.inputting && this.selectRowData.length > 0 && !checkPreviewVisible) { + this.removeOperation() + event.preventDefault() + event.stopPropagation() } // ctrl + A / cmd + A - if (isCmd && keyCode === 65) { + if (isCmd && keyCode === 65 && !checkPreviewVisible) { if (this.inputting || this.editingIndex !== -1) { event.target.select() } else { @@ -3406,6 +3402,7 @@ export default { }, // 全局右键菜单操作 contextmenuClick(operation) { + this.$refs.fileListTable.clearSelection() switch (operation) { case 'vmode-list': this.grid = true @@ -4244,6 +4241,27 @@ export default { this.notPreviewDialogVisible = true } }, + checkPreviewVisible() { + if (this.iframePreviewVisible) { + return true + } + if (this.imagePreviewVisible) { + return true + } + if (this.textPreviewVisible) { + return true + } + if (this.videoPreviewVisible) { + return true + } + if (this.audioPreviewVisible) { + return true + } + if (this.openCompressionVisible) { + return true + } + return this.notPreviewDialogVisible; + }, hasIframePreview(suffix, fileHandlers) { for (let key in fileHandlers) { const extensions = key.split(',')