mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-02 07:27:04 +00:00
show img thumbnail when search file (#4792)
Co-authored-by: lian <lian@seafile.com>
This commit is contained in:
@@ -19,6 +19,11 @@ class SearchResultItem extends React.Component {
|
||||
let className = item.link_content ? 'item-img' : 'lib-item-img';
|
||||
let folderIconUrl = item.link_content ? Utils.getFolderIconUrl(false, 192) : Utils.getDefaultLibIconUrl(true);
|
||||
let fileIconUrl = item.is_dir ? folderIconUrl : Utils.getFileIconUrl(item.name, 192);
|
||||
|
||||
if (item.thumbnail_url !== '') {
|
||||
fileIconUrl = item.thumbnail_url;
|
||||
}
|
||||
|
||||
return (
|
||||
<li className="search-result-item" onClick={this.onClickHandler}>
|
||||
<img className={className} src={fileIconUrl} alt="" />
|
||||
|
@@ -178,6 +178,7 @@ class Search extends Component {
|
||||
items[i]['is_dir'] = data[i].is_dir;
|
||||
items[i]['link_content'] = decodeURI(data[i].fullpath).substring(1);
|
||||
items[i]['content'] = data[i].content_highlight;
|
||||
items[i]['thumbnail_url'] = data[i].thumbnail_url;
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
Reference in New Issue
Block a user