1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 16:31:13 +00:00

Improve search in file move/copy dialog (#3543)

This commit is contained in:
Daniel Pan
2019-05-27 17:13:15 +08:00
committed by GitHub
parent 4ffa3c48cf
commit 07881f6ff9
13 changed files with 370 additions and 220 deletions

View File

@@ -5,6 +5,7 @@ import { Utils } from '../../utils/utils';
const propTypes = {
currentItem: PropTypes.object,
onItemClick: PropTypes.func.isRequired,
onSearchedItemDoubleClick: PropTypes.func.isRequired,
};
class SearchedListItem extends React.Component {
@@ -29,6 +30,12 @@ class SearchedListItem extends React.Component {
this.props.onItemClick(item);
}
searchItemDoubleClick = (e) => {
let item = this.props.item;
this.props.onSearchedItemDoubleClick(item);
}
render() {
let { item, currentItem } = this.props;
let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(false);
@@ -36,11 +43,11 @@ class SearchedListItem extends React.Component {
let trClass = this.state.highlight ? 'tr-highlight' : '';
if (currentItem) {
if (item.repo_id === currentItem.repo_id && item.path === currentItem.path) {
trClass = 'searched-active';
trClass = 'tr-active';
}
}
return (
<tr className={trClass} onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
<tr className={trClass} onClick={this.onClick} onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave} onDoubleClick={this.searchItemDoubleClick}>
<td className="text-center"><img className="item-img" src={fileIconUrl} alt="" width="24"/></td>
<td><span className="item-link">{item.repo_name}/{item.link_content}</span></td>
</tr>