1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-11 03:42:16 +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 { class MainPanel extends React.Component {
onSearchedClick = () => {
//todos;
};
render() { render() {
const { renderingContent, newMarkdownContent } = this.props; const { renderingContent, newMarkdownContent } = this.props;
return ( return (

View File

@ -932,6 +932,9 @@ class LibContentView extends React.Component {
}; };
onSearchedClick = (item) => { 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; let path = item.is_dir ? item.path.slice(0, item.path.length - 1) : item.path;
if (this.state.currentPath === path) { if (this.state.currentPath === path) {
return; return;
@ -962,20 +965,20 @@ class LibContentView extends React.Component {
if (Utils.isMarkdownFile(path)) { if (Utils.isMarkdownFile(path)) {
this.showFile(path); this.showFile(path);
} else { } else {
let url = siteRoot + 'lib/' + item.repo_id + '/file' + Utils.encodePath(path); this.openSearchedNewTab(item);
let isWeChat = Utils.isWeChat();
if (!isWeChat) {
let newWindow = window.open('about:blank');
newWindow.location.href = url;
} else {
location.href = url;
}
} }
} }
} else { } else {
if (item.is_dir) { if (item.is_dir) {
this.showDir(path); this.showDir(path);
} else { } else {
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 url = siteRoot + 'lib/' + item.repo_id + '/file' + Utils.encodePath(path);
let isWeChat = Utils.isWeChat(); let isWeChat = Utils.isWeChat();
if (!isWeChat) { if (!isWeChat) {
@ -984,8 +987,6 @@ class LibContentView extends React.Component {
} else { } else {
location.href = url; location.href = url;
} }
}
}
}; };
onMainNavBarClick = (nodePath) => { onMainNavBarClick = (nodePath) => {