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:
parent
abcbd0f3dc
commit
2c442f0932
@ -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 (
|
||||||
|
@ -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) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user