Fix middle click behaviors (#278)

* Do not open links in the current tab by middle click, fix #201

* Set links of directories so that they can be opened in new tab by middle click
This commit is contained in:
Yuichi Tanikawa 2016-05-18 08:33:49 +09:00 committed by Buu Nguyen
parent ed2704a2eb
commit 531b7e6111
2 changed files with 6 additions and 1 deletions

View File

@ -70,7 +70,9 @@ class Adapter {
if (type === 'tree') {
if (node) item.children = true
else folders[item.path] = item.children = []
item.a_attr = { href: '#' }
item.a_attr = {
href: `/${repo.username}/${repo.reponame}/${type}/${repo.branch}/${encodeURIComponent(path)}`
}
}
else if (type === 'blob') {
item.a_attr = {

View File

@ -109,6 +109,9 @@ class TreeView {
if (!$target.is('a.jstree-anchor')) return
// handle middle click
if (event.which === 2) return
// refocus after complete so that keyboard navigation works, fix #158
const refocusAfterCompletion = () => {
$(document).one('pjax:success page:load', () => {