1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-01 07:10:55 +00:00

Fix searched file is markdown (#6172)

* fix searched file is markdown

* delete uesless codes
This commit is contained in:
Michael An 2024-06-06 16:57:20 +08:00 committed by GitHub
parent abcbd0f3dc
commit 2c442f0932
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 21 deletions

View File

@ -12,11 +12,6 @@ const propTypes = {
};
class MainPanel extends React.Component {
onSearchedClick = () => {
//todos;
};
render() {
const { renderingContent, newMarkdownContent } = this.props;
return (

View File

@ -932,6 +932,9 @@ class LibContentView extends React.Component {
};
onSearchedClick = (item) => {
if (item.repo_id !== this.props.repoID) {
this.openSearchedNewTab(item);
}
let path = item.is_dir ? item.path.slice(0, item.path.length - 1) : item.path;
if (this.state.currentPath === path) {
return;
@ -962,32 +965,30 @@ class LibContentView extends React.Component {
if (Utils.isMarkdownFile(path)) {
this.showFile(path);
} else {
let url = siteRoot + 'lib/' + item.repo_id + '/file' + Utils.encodePath(path);
let isWeChat = Utils.isWeChat();
if (!isWeChat) {
let newWindow = window.open('about:blank');
newWindow.location.href = url;
} else {
location.href = url;
}
this.openSearchedNewTab(item);
}
}
} else {
if (item.is_dir) {
this.showDir(path);
} else {
let url = siteRoot + 'lib/' + item.repo_id + '/file' + Utils.encodePath(path);
let isWeChat = Utils.isWeChat();
if (!isWeChat) {
let newWindow = window.open('about:blank');
newWindow.location.href = url;
} else {
location.href = url;
}
this.openSearchedNewTab(item);
}
}
};
openSearchedNewTab = (item) => {
let path = item.is_dir ? item.path.slice(0, item.path.length - 1) : item.path;
let url = siteRoot + 'lib/' + item.repo_id + '/file' + Utils.encodePath(path);
let isWeChat = Utils.isWeChat();
if (!isWeChat) {
let newWindow = window.open('about:blank');
newWindow.location.href = url;
} else {
location.href = url;
}
};
onMainNavBarClick = (nodePath) => {
//just for dir
this.resetSelected();