diff --git a/resources/assets/js/pages/manage/file.vue b/resources/assets/js/pages/manage/file.vue index 9593ea00f..28d7b73ca 100644 --- a/resources/assets/js/pages/manage/file.vue +++ b/resources/assets/js/pages/manage/file.vue @@ -147,19 +147,24 @@ trigger="custom" :visible="contextMenuVisible" transfer-class-name="page-file-dropdown-menu" + @on-click="handleContextClick" @on-clickoutside="handleClickContextMenuOutside" @on-visible-change="handleVisibleChangeMenu" transfer> @@ -909,7 +914,9 @@ export default { }, addFile(command) { - if (command == 'upload') { + if (!command) { + return; + } else if (command == 'upload') { this.uploadDir = false this.$refs.fileUpload.handleClick(); return; @@ -968,6 +975,7 @@ export default { if (id > 0) { this.goForward({name: 'manage-file', params: {folderId: id, fileId: null}}); } else { + this.searchKey = ''; this.goForward({name: 'manage-file'}); } }, @@ -1074,7 +1082,11 @@ export default { }, handleContextClick(command) { - this.dropFile(this.contextMenuItem, command) + if ($A.leftExists(command, "new:")) { + this.addFile($A.leftDelete(command, "new:")) + } else { + this.dropFile(this.contextMenuItem, command) + } }, handleClickContextMenuOutside() { @@ -1111,6 +1123,10 @@ export default { } break; + case 'upperFolder': + this.browseFolder(item.pid) + break; + case 'select': let index = this.selectIds.findIndex(id => id == item.id) if (index > -1) { @@ -1335,13 +1351,19 @@ export default { if (e.keyCode === 13) { this.onEnter(item); } else if (e.keyCode === 27) { - this.setLoad(item.id, false) - this.setEdit(item.id, false) + const isCreate = !/^\d+$/.test(item.id); + if (isCreate) { + item.newname = '' + this.$store.dispatch("forgetFile", item.id); + } else { + this.setLoad(item.id, false) + this.setEdit(item.id, false) + } } }, onEnter(item) { - let isCreate = !/^\d+$/.test(item.id); + const isCreate = !/^\d+$/.test(item.id); if (!item.newname) { if (isCreate) { this.$store.dispatch("forgetFile", item.id);