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:
parent
abcbd0f3dc
commit
2c442f0932
@ -12,11 +12,6 @@ const propTypes = {
|
||||
};
|
||||
|
||||
class MainPanel extends React.Component {
|
||||
|
||||
onSearchedClick = () => {
|
||||
//todos;
|
||||
};
|
||||
|
||||
render() {
|
||||
const { renderingContent, newMarkdownContent } = this.props;
|
||||
return (
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user