1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-01 23:20:51 +00:00

repair share&selected-operation bug

This commit is contained in:
shanshuirenjia
2018-12-17 21:38:55 +08:00
parent 6b322b0c13
commit ceb813927a
6 changed files with 135 additions and 47 deletions

View File

@@ -134,15 +134,20 @@ class DirOperationToolbar extends React.Component {
this.props.goDraftPage();
}
render() {
let isFile = this.props.isViewFile;
let itemName;
if (this.props.isViewFile) {
itemName = Utils.getFileName(this.props.path)
} else {
itemName = this.props.path.replace('\/','');
getFolderName = (path) => {
// eg: /
if (path === '/') {
return path;
}
// eg: /abc/bcd/; /abc/bcd
path = path[path.length - 1] !== '/' ? path : path.slice(0, path.length -2);
return path.slice(path.lastIndexOf('/') + 1);
}
render() {
let { path, isViewFile } = this.props;
let itemType = isViewFile ? 'file' : 'dir';
let itemName = isViewFile ? Utils.getFileName(path) : this.getFolderName(path);
return (
<Fragment>
<div className="operation">
@@ -203,7 +208,7 @@ class DirOperationToolbar extends React.Component {
{this.state.isShareDialogShow &&
<ModalPortal>
<ShareDialog
isDir={!isFile}
itemType={itemType}
itemName={itemName}
itemPath={this.props.path}
repoID={this.props.repoID}