mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-06 17:33:18 +00:00
optimized onsearched handle
This commit is contained in:
@@ -186,16 +186,8 @@ class FileHistory extends React.Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchedClick = (selectedItem) => {
|
onSearchedClick = (searchedItem) => {
|
||||||
if (selectedItem.is_dir === true) {
|
Utils.handleSearchedItemClick(searchedItem);
|
||||||
let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path;
|
|
||||||
let newWindow = window.open('about:blank');
|
|
||||||
newWindow.location.href = url;
|
|
||||||
} else {
|
|
||||||
let url = siteRoot + 'lib/' + selectedItem.repo_id + '/file' + Utils.encodePath(selectedItem.path);
|
|
||||||
let newWindow = window.open('about:blank');
|
|
||||||
newWindow.location.href = url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@@ -27,16 +27,8 @@ class FileHistory extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
onSearchedClick = (selectedItem) => {
|
onSearchedClick = (searchedItem) => {
|
||||||
if (selectedItem.is_dir === true) {
|
Utils.handleSearchedItemClick(searchedItem);
|
||||||
let url = siteRoot + 'library/' + selectedItem.repo_id + '/' + selectedItem.repo_name + selectedItem.path;
|
|
||||||
let newWindow = window.open('about:blank');
|
|
||||||
newWindow.location.href = url;
|
|
||||||
} else {
|
|
||||||
let url = siteRoot + 'lib/' + selectedItem.repo_id + '/file' + Utils.encodePath(selectedItem.path);
|
|
||||||
let newWindow = window.open('about:blank');
|
|
||||||
newWindow.location.href = url;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
setDiffContent = (newMarkdownContent, oldMarkdownContent)=> {
|
setDiffContent = (newMarkdownContent, oldMarkdownContent)=> {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { mediaUrl, gettext, serviceURL } from './constants';
|
import { mediaUrl, gettext, serviceURL, siteRoot } from './constants';
|
||||||
import { strChineseFirstPY } from './pinyin-by-unicode';
|
import { strChineseFirstPY } from './pinyin-by-unicode';
|
||||||
|
|
||||||
export const Utils = {
|
export const Utils = {
|
||||||
@@ -801,4 +801,16 @@ export const Utils = {
|
|||||||
return message;
|
return message;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleSearchedItemClick: function(searchedItem) {
|
||||||
|
if (searchedItem.is_dir === true) {
|
||||||
|
let url = siteRoot + 'library/' + searchedItem.repo_id + '/' + searchedItem.repo_name + searchedItem.path;
|
||||||
|
let newWindow = window.open('about:blank');
|
||||||
|
newWindow.location.href = url;
|
||||||
|
} else {
|
||||||
|
let url = siteRoot + 'lib/' + searchedItem.repo_id + '/file' + Utils.encodePath(searchedItem.path);
|
||||||
|
let newWindow = window.open('about:blank');
|
||||||
|
newWindow.location.href = url;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user