mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-07 01:41:39 +00:00
file chooser bug repair (#2839)
This commit is contained in:
@@ -29,17 +29,19 @@ class DirentListItem extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onItemClick = () => {
|
onItemClick = (e) => {
|
||||||
|
e.stopPropagation(); // need prevent event popup
|
||||||
if (this.props.selectedPath !== this.state.filePath) {
|
if (this.props.selectedPath !== this.state.filePath) {
|
||||||
this.props.onDirentItemClick(this.state.filePath, this.props.dirent);
|
this.props.onDirentItemClick(this.state.filePath, this.props.dirent);
|
||||||
} else {
|
} else {
|
||||||
if (this.props.dirent.type === 'dir') {
|
if (this.props.dirent.type === 'dir') {
|
||||||
this.onToggleClick();
|
this.onToggleClick(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onToggleClick = () => {
|
onToggleClick = (e) => {
|
||||||
|
e.stopPropagation(); // need prevent event popup
|
||||||
if (!this.state.hasRequest) {
|
if (!this.state.hasRequest) {
|
||||||
seafileAPI.listDir(this.props.repo.repo_id, this.state.filePath).then(res => {
|
seafileAPI.listDir(this.props.repo.repo_id, this.state.filePath).then(res => {
|
||||||
let direntList = [];
|
let direntList = [];
|
||||||
@@ -53,18 +55,14 @@ class DirentListItem extends React.Component {
|
|||||||
direntList.push(dirent);
|
direntList.push(dirent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
direntList = Utils.sortDirents(direntList, 'name', 'asc');
|
});
|
||||||
this.setState({
|
direntList = Utils.sortDirents(direntList, 'name', 'asc');
|
||||||
hasRequest: true,
|
this.setState({
|
||||||
direntList: direntList,
|
hasRequest: true,
|
||||||
});
|
direntList: direntList,
|
||||||
});
|
});
|
||||||
if (res.data.length === 0 || direntList.length === 0) {
|
if (res.data.length === 0 || direntList.length === 0) {
|
||||||
this.setState({
|
this.setState({hasChildren: false});
|
||||||
hasRequest: true,
|
|
||||||
direntList: [],
|
|
||||||
hasChildren: false
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user