mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 15:09:14 +00:00
Open the edit page when the content is not empty (#3458)
* Open the edit page when the content is not empty * Use size instead of content * change func name * Replace getMarkdownSize with showColumnMarkdownFile
This commit is contained in:
@@ -864,7 +864,7 @@ class LibContentView extends React.Component {
|
||||
this.showDir(direntPath);
|
||||
} else { // is file
|
||||
if (this.state.currentMode === 'column' && Utils.isMarkdownFile(direntPath)) {
|
||||
this.showFile(direntPath);
|
||||
this.showColumnMarkdownFile(direntPath);
|
||||
} else {
|
||||
const w=window.open('about:blank');
|
||||
const url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(direntPath);
|
||||
@@ -1177,7 +1177,7 @@ class LibContentView extends React.Component {
|
||||
} else {
|
||||
if (Utils.isMarkdownFile(node.path)) {
|
||||
if (node.path !== this.state.path) {
|
||||
this.showFile(node.path);
|
||||
this.showColumnMarkdownFile(node.path);
|
||||
}
|
||||
} else {
|
||||
const w = window.open('about:blank');
|
||||
@@ -1187,6 +1187,19 @@ class LibContentView extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
showColumnMarkdownFile = (filePath) => {
|
||||
let repoID = this.props.repoID;
|
||||
seafileAPI.getFileInfo(repoID, filePath).then((res) => {
|
||||
if (res.data.size === 0) {
|
||||
const w = window.open('about:blank');
|
||||
const url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(filePath);
|
||||
w.location.href = url;
|
||||
} else {
|
||||
this.showFile(filePath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onTreeNodeCollapse = (node) => {
|
||||
let tree = treeHelper.collapseNode(this.state.treeData, node);
|
||||
this.setState({treeData: tree});
|
||||
|
Reference in New Issue
Block a user