Merge pull request #237 from jamebal/search

fix: 修复部分快捷键和其他操作之间的冲突
This commit is contained in:
jmal 2024-07-18 15:31:07 +08:00 committed by GitHub
commit dd811cf937
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1352,34 +1352,30 @@ export default {
const { keyCode } = event const { keyCode } = event
const isCmd = this.checkCmdKey(event) const isCmd = this.checkCmdKey(event)
console.log('keydown', 'keyCode', keyCode, 'isCmd', isCmd) console.log('keydown', 'keyCode', keyCode, 'isCmd', isCmd)
const checkPreviewVisible = this.checkPreviewVisible()
// space // space
if (keyCode === 32) { if (keyCode === 32 && this.selectRowData.length > 0 && !this.drawer && !checkPreviewVisible) {
if (!this.inputting && this.selectRowData.length > 0 && !this.drawer) { this.drawer = true
this.drawer = true this.drawerShowTime = Date.now()
this.drawerShowTime = Date.now() event.preventDefault()
event.preventDefault() event.stopPropagation()
event.stopPropagation()
}
} }
// F2 // F2
if (keyCode === 113) { if (keyCode === 113 && this.selectRowData.length > 0 && !checkPreviewVisible) {
if (this.selectRowData.length > 0 && !this.drawer) { this.renameFileName = this.rowContextData.name
this.renameFileName = this.rowContextData.name this.editingIndex = this.rowContextData.index
this.editingIndex = this.rowContextData.index
}
event.preventDefault() event.preventDefault()
event.stopPropagation() event.stopPropagation()
} }
// Del // Del
if (keyCode === 8) { if (keyCode === 8 && !this.inputting && this.selectRowData.length > 0 && !checkPreviewVisible) {
if (!this.inputting && this.selectRowData.length > 0) { this.removeOperation()
this.removeOperation() event.preventDefault()
event.preventDefault() event.stopPropagation()
event.stopPropagation()
}
} }
// ctrl + A / cmd + A // ctrl + A / cmd + A
if (isCmd && keyCode === 65) { if (isCmd && keyCode === 65 && !checkPreviewVisible) {
if (this.inputting || this.editingIndex !== -1) { if (this.inputting || this.editingIndex !== -1) {
event.target.select() event.target.select()
} else { } else {
@ -3406,6 +3402,7 @@ export default {
}, },
// 全局右键菜单操作 // 全局右键菜单操作
contextmenuClick(operation) { contextmenuClick(operation) {
this.$refs.fileListTable.clearSelection()
switch (operation) { switch (operation) {
case 'vmode-list': case 'vmode-list':
this.grid = true this.grid = true
@ -4244,6 +4241,27 @@ export default {
this.notPreviewDialogVisible = true 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) { hasIframePreview(suffix, fileHandlers) {
for (let key in fileHandlers) { for (let key in fileHandlers) {
const extensions = key.split(',') const extensions = key.split(',')