mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat(FileExplorer): focus on first content node
This commit is contained in:
parent
64d9ab9482
commit
998a8aa093
1 changed files with 17 additions and 0 deletions
|
|
@ -116,6 +116,23 @@ export default class List extends React.Component {
|
|||
|
||||
// consider the two keys as 'confirm' key
|
||||
case 'ArrowRight':
|
||||
// expand node or focus on first content node or redirect to file page
|
||||
if (focusedNode.type === 'tree') {
|
||||
if (expandedNodes.has(focusedNode)) {
|
||||
const nextNode = nodes[focusedNodeIndex + 1]
|
||||
if (depths.get(nextNode) > depths.get(focusedNode)) {
|
||||
this.focusNode(nextNode)
|
||||
}
|
||||
} else {
|
||||
this.setExpand(focusedNode, true)
|
||||
}
|
||||
} else if (focusedNode.type === 'blob') {
|
||||
DOMHelper.loadWithPJAX(focusedNode.url)
|
||||
} else if (focusedNode.type === 'commit') {
|
||||
// redirect to its parent folder
|
||||
DOMHelper.loadWithPJAX(focusedNode.parent.url)
|
||||
}
|
||||
break
|
||||
case 'Enter':
|
||||
// expand node or redirect to file page
|
||||
if (focusedNode.type === 'tree') {
|
||||
|
|
|
|||
Loading…
Reference in a new issue