diff --git a/frontend/src/components/tree-view/tree-node-view.js b/frontend/src/components/tree-view/tree-node-view.js index df99dbce2c..f55d352b8e 100644 --- a/frontend/src/components/tree-view/tree-node-view.js +++ b/frontend/src/components/tree-view/tree-node-view.js @@ -20,7 +20,6 @@ const propTypes = { onMenuItemClick: PropTypes.func, onNodeDragMove: PropTypes.func, onNodeDrop: PropTypes.func, - appMenuType: PropTypes.oneOf(['list_view_contextmenu', 'item_contextmenu', 'tree_contextmenu', 'item_op_menu']), handleContextClick: PropTypes.func.isRequired, onNodeDragEnter: PropTypes.func.isRequired, onNodeDragLeave:PropTypes.func.isRequired, @@ -207,7 +206,6 @@ class TreeNodeView extends React.Component { onNodeDrop={this.props.onNodeDrop} onNodeDragEnter={this.props.onNodeDragEnter} onNodeDragLeave={this.props.onNodeDragLeave} - appMenuType={this.props.appMenuType} handleContextClick={this.props.handleContextClick} /> ); diff --git a/frontend/src/pages/lib-content-view/lib-content-view.js b/frontend/src/pages/lib-content-view/lib-content-view.js index bf40f4d620..5286380abb 100644 --- a/frontend/src/pages/lib-content-view/lib-content-view.js +++ b/frontend/src/pages/lib-content-view/lib-content-view.js @@ -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});