mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-05 08:53: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:
@@ -20,7 +20,6 @@ const propTypes = {
|
|||||||
onMenuItemClick: PropTypes.func,
|
onMenuItemClick: PropTypes.func,
|
||||||
onNodeDragMove: PropTypes.func,
|
onNodeDragMove: PropTypes.func,
|
||||||
onNodeDrop: PropTypes.func,
|
onNodeDrop: PropTypes.func,
|
||||||
appMenuType: PropTypes.oneOf(['list_view_contextmenu', 'item_contextmenu', 'tree_contextmenu', 'item_op_menu']),
|
|
||||||
handleContextClick: PropTypes.func.isRequired,
|
handleContextClick: PropTypes.func.isRequired,
|
||||||
onNodeDragEnter: PropTypes.func.isRequired,
|
onNodeDragEnter: PropTypes.func.isRequired,
|
||||||
onNodeDragLeave:PropTypes.func.isRequired,
|
onNodeDragLeave:PropTypes.func.isRequired,
|
||||||
@@ -207,7 +206,6 @@ class TreeNodeView extends React.Component {
|
|||||||
onNodeDrop={this.props.onNodeDrop}
|
onNodeDrop={this.props.onNodeDrop}
|
||||||
onNodeDragEnter={this.props.onNodeDragEnter}
|
onNodeDragEnter={this.props.onNodeDragEnter}
|
||||||
onNodeDragLeave={this.props.onNodeDragLeave}
|
onNodeDragLeave={this.props.onNodeDragLeave}
|
||||||
appMenuType={this.props.appMenuType}
|
|
||||||
handleContextClick={this.props.handleContextClick}
|
handleContextClick={this.props.handleContextClick}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@@ -864,7 +864,7 @@ class LibContentView extends React.Component {
|
|||||||
this.showDir(direntPath);
|
this.showDir(direntPath);
|
||||||
} else { // is file
|
} else { // is file
|
||||||
if (this.state.currentMode === 'column' && Utils.isMarkdownFile(direntPath)) {
|
if (this.state.currentMode === 'column' && Utils.isMarkdownFile(direntPath)) {
|
||||||
this.showFile(direntPath);
|
this.showColumnMarkdownFile(direntPath);
|
||||||
} else {
|
} else {
|
||||||
const w=window.open('about:blank');
|
const w=window.open('about:blank');
|
||||||
const url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(direntPath);
|
const url = siteRoot + 'lib/' + repoID + '/file' + Utils.encodePath(direntPath);
|
||||||
@@ -1177,7 +1177,7 @@ class LibContentView extends React.Component {
|
|||||||
} else {
|
} else {
|
||||||
if (Utils.isMarkdownFile(node.path)) {
|
if (Utils.isMarkdownFile(node.path)) {
|
||||||
if (node.path !== this.state.path) {
|
if (node.path !== this.state.path) {
|
||||||
this.showFile(node.path);
|
this.showColumnMarkdownFile(node.path);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const w = window.open('about:blank');
|
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) => {
|
onTreeNodeCollapse = (node) => {
|
||||||
let tree = treeHelper.collapseNode(this.state.treeData, node);
|
let tree = treeHelper.collapseNode(this.state.treeData, node);
|
||||||
this.setState({treeData: tree});
|
this.setState({treeData: tree});
|
||||||
|
Reference in New Issue
Block a user