mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 13:24:52 +00:00
fix deselect markdown file detail (#6780)
This commit is contained in:
@@ -26,7 +26,6 @@ const propTypes = {
|
||||
isTreeDataLoading: PropTypes.bool.isRequired,
|
||||
treeData: PropTypes.object.isRequired,
|
||||
currentNode: PropTypes.object,
|
||||
currentDirent: PropTypes.object,
|
||||
onNodeClick: PropTypes.func.isRequired,
|
||||
onNodeCollapse: PropTypes.func.isRequired,
|
||||
onNodeExpanded: PropTypes.func.isRequired,
|
||||
|
@@ -183,18 +183,8 @@ class DirentGridItem extends React.Component {
|
||||
this.props.onGridItemMouseDown(event);
|
||||
};
|
||||
|
||||
getFileUrl = (url) => {
|
||||
let fileUrlArr = url.split('/');
|
||||
if (fileUrlArr.indexOf('48') !== -1) {
|
||||
fileUrlArr.splice(fileUrlArr.indexOf('48'), 1, '192');
|
||||
}
|
||||
let fileUrl = fileUrlArr.join('/');
|
||||
return fileUrl;
|
||||
};
|
||||
|
||||
onGridItemContextMenu = (event) => {
|
||||
let dirent = this.props.dirent;
|
||||
this.props.onGridItemContextMenu(event, dirent);
|
||||
this.props.onGridItemContextMenu(event, this.props.dirent);
|
||||
};
|
||||
|
||||
getTextRenderWidth = (text, font) => {
|
||||
@@ -245,7 +235,6 @@ class DirentGridItem extends React.Component {
|
||||
let { dirent, path, repoID } = this.props;
|
||||
let direntPath = Utils.joinPath(path, dirent.name);
|
||||
let iconUrl = Utils.getDirentIcon(dirent, true);
|
||||
let fileUrl = dirent.encoded_thumbnail_src ? this.getFileUrl(dirent.encoded_thumbnail_src) : '';
|
||||
|
||||
let toolTipID = '';
|
||||
let tagTitle = '';
|
||||
@@ -289,7 +278,7 @@ class DirentGridItem extends React.Component {
|
||||
onDrop={this.onGridItemDragDrop}
|
||||
>
|
||||
{(this.canPreview && dirent.encoded_thumbnail_src) ?
|
||||
<img src={`${siteRoot}${fileUrl}`} className="thumbnail" onClick={this.onItemClick} alt=""/> :
|
||||
<img src={`${siteRoot}${dirent.encoded_thumbnail_src || ''}`} className="thumbnail" onClick={this.onItemClick} alt=""/> :
|
||||
<img src={iconUrl} width="96" alt='' />
|
||||
}
|
||||
{dirent.is_locked && <img className="grid-file-locked-icon" src={lockedImageUrl} alt={lockedMessage} title={lockedInfo}/>}
|
||||
|
@@ -93,7 +93,7 @@ class LibContentView extends React.Component {
|
||||
asyncOperationProgress: 0,
|
||||
asyncOperatedFilesLength: 0,
|
||||
viewId: '0000',
|
||||
currentDirent: {}
|
||||
currentDirent: null,
|
||||
};
|
||||
|
||||
this.oldonpopstate = window.onpopstate;
|
||||
@@ -1914,10 +1914,7 @@ class LibContentView extends React.Component {
|
||||
};
|
||||
|
||||
onCloseMarkdownViewDialog = () => {
|
||||
this.setState({
|
||||
isViewFile: false,
|
||||
currentDirent: {},
|
||||
});
|
||||
this.setState({ isViewFile: false });
|
||||
};
|
||||
|
||||
onTreeNodeCollapse = (node) => {
|
||||
@@ -2193,7 +2190,7 @@ class LibContentView extends React.Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
let { currentRepoInfo, userPerm, isCopyMoveProgressDialogShow, isDeleteFolderDialogOpen, currentDirent,
|
||||
let { currentRepoInfo, userPerm, isCopyMoveProgressDialogShow, isDeleteFolderDialogOpen,
|
||||
path, usedRepoTags } = this.state;
|
||||
if (this.state.libNeedDecrypt) {
|
||||
return (
|
||||
@@ -2358,7 +2355,6 @@ class LibContentView extends React.Component {
|
||||
isSidePanelFolded={this.props.isSidePanelFolded}
|
||||
isTreePanelShown={this.state.isTreePanelShown}
|
||||
currentMode={this.state.currentMode}
|
||||
currentDirent={currentDirent}
|
||||
path={this.state.path}
|
||||
repoID={this.props.repoID}
|
||||
currentRepoInfo={this.state.currentRepoInfo}
|
||||
|
@@ -396,7 +396,7 @@ export const Utils = {
|
||||
},
|
||||
|
||||
getDirentIcon: function (dirent, isBig) {
|
||||
if (!dirent) return mediaUrl + 'img/file/256/' + Utils.FILEEXT_ICON_MAP['default'];
|
||||
if (!dirent) return '';
|
||||
let size = Utils.isHiDPI() ? 48 : 24;
|
||||
size = isBig ? 192 : size;
|
||||
if (dirent.isDir()) {
|
||||
|
Reference in New Issue
Block a user