Skip to content

Commit

Permalink
fix deselect markdown file detail (#6780)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael18811380328 authored Sep 14, 2024
1 parent 227a9d5 commit 7f56426
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 22 deletions.
1 change: 0 additions & 1 deletion frontend/src/components/dir-view-mode/dir-column-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 2 additions & 13 deletions frontend/src/components/dirent-grid-view/dirent-grid-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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 = '';
Expand Down Expand Up @@ -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}/>}
Expand Down
10 changes: 3 additions & 7 deletions frontend/src/pages/lib-content-view/lib-content-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class LibContentView extends React.Component {
asyncOperationProgress: 0,
asyncOperatedFilesLength: 0,
viewId: '0000',
currentDirent: {}
currentDirent: null,
};

this.oldonpopstate = window.onpopstate;
Expand Down Expand Up @@ -1914,10 +1914,7 @@ class LibContentView extends React.Component {
};

onCloseMarkdownViewDialog = () => {
this.setState({
isViewFile: false,
currentDirent: {},
});
this.setState({ isViewFile: false });
};

onTreeNodeCollapse = (node) => {
Expand Down Expand Up @@ -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 (
Expand Down Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit 7f56426

Please sign in to comment.