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:
parent
ed2704a2eb
commit
531b7e6111
|
@ -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 = {
|
||||
|
|
|
@ -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', () => {
|
||||
|
|
Loading…
Reference in New Issue