mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 09:21:54 +00:00
open file (#3008)
This commit is contained in:
@@ -7,6 +7,8 @@ import Delete from '../../components/dialog/delete-dialog';
|
||||
import Rename from '../../components/dialog/rename-dialog';
|
||||
import CreateFolder from '../../components/dialog/create-folder-dialog';
|
||||
import CreateFile from '../../components/dialog/create-file-dialog';
|
||||
import { siteRoot } from '../../utils/constants';
|
||||
import { Utils } from '../../utils/utils';
|
||||
|
||||
const propTypes = {
|
||||
currentPath: PropTypes.string.isRequired,
|
||||
@@ -21,6 +23,7 @@ const propTypes = {
|
||||
onDeleteNode: PropTypes.func.isRequired,
|
||||
onAddFileNode: PropTypes.func.isRequired,
|
||||
onAddFolderNode: PropTypes.func.isRequired,
|
||||
repoID: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
class DirColumnNav extends React.Component {
|
||||
@@ -61,6 +64,9 @@ class DirColumnNav extends React.Component {
|
||||
case 'Delete':
|
||||
this.onDeleteToggle();
|
||||
break;
|
||||
case 'Open in New Tab':
|
||||
this.onOpenFile(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +124,11 @@ class DirColumnNav extends React.Component {
|
||||
this.props.onDeleteNode(node);
|
||||
}
|
||||
|
||||
onOpenFile = (node) => {
|
||||
let newUrl = siteRoot + 'lib/' + this.props.repoID + '/file' + Utils.encodePath(node.path);
|
||||
window.open(newUrl, '_blank');
|
||||
}
|
||||
|
||||
checkDuplicatedName = (newName) => {
|
||||
let node = this.state.opNode;
|
||||
// root node to new node conditions: parentNode is null,
|
||||
|
Reference in New Issue
Block a user