1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 17:02:47 +00:00

repair mode change bug (#3264)

This commit is contained in:
杨顺强
2019-04-13 11:56:44 +08:00
committed by Daniel Pan
parent c42bf25a1d
commit 11d43de63a

View File

@@ -31,7 +31,7 @@ class LibContentView extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
currentMode: cookie.load('seafile-view-mode') || 'list', currentMode: cookie.load('seafile_view_mode') || 'list',
path: '', path: '',
pathExist: true, pathExist: true,
isViewFile: false, isViewFile: false,
@@ -245,7 +245,7 @@ class LibContentView extends React.Component {
if (Utils.isMarkdownFile(path)) { if (Utils.isMarkdownFile(path)) {
seafileAPI.getFileInfo(this.props.repoID, path).then(() => { seafileAPI.getFileInfo(this.props.repoID, path).then(() => {
if (this.state.currentMode !== 'column') { if (this.state.currentMode !== 'column') {
cookie.save('seafile-view-mode', 'column'); cookie.save('seafile_view_mode', 'column');
this.setState({currentMode: 'column'}); this.setState({currentMode: 'column'});
} }
this.loadSidePanel(path); this.loadSidePanel(path);
@@ -541,7 +541,7 @@ class LibContentView extends React.Component {
this.toggleDirentDetail(); this.toggleDirentDetail();
return; return;
} }
cookie.save('seafile-view-mode', mode); cookie.save('seafile_view_mode', mode);
let path = this.state.path; let path = this.state.path;
if (this.state.currentMode === 'column' && this.state.isViewFile) { if (this.state.currentMode === 'column' && this.state.isViewFile) {
path = Utils.getDirName(path); path = Utils.getDirName(path);
@@ -585,7 +585,6 @@ class LibContentView extends React.Component {
} else { } else {
this.loadNodeAndParentsByPath(path); this.loadNodeAndParentsByPath(path);
} }
}
// load mainPanel // load mainPanel
if (item.is_dir) { if (item.is_dir) {
@@ -599,6 +598,15 @@ class LibContentView extends React.Component {
newWindow.location.href = url; newWindow.location.href = url;
} }
} }
} else {
if (item.is_dir) {
this.showDir(path);
} else {
let url = siteRoot + 'lib/' + item.repo_id + '/file' + Utils.encodePath(path);
let newWindow = window.open('about:blank');
newWindow.location.href = url;
}
}
} }
onMainNavBarClick = (nodePath) => { onMainNavBarClick = (nodePath) => {