Commit e665ea05 authored by Kushal Pandya's avatar Kushal Pandya

Add Ctrl+Click support

parent ff4950b7
...@@ -147,13 +147,28 @@ ...@@ -147,13 +147,28 @@
goToTodoUrl(e) { goToTodoUrl(e) {
const todoLink = $(this).data('url'); const todoLink = $(this).data('url');
let targetLink = $(e.target).attr('href');
if ($(e.target).is('img')) { // See if clicked target was Avatar
targetLink = $(e.target).parent().attr('href'); // Parent of Avatar is link
}
if (!todoLink) { if (!todoLink) {
return; return;
} }
// Allow Meta-Click or Mouse3-click to open in a new tab
if (e.metaKey || e.which === 2) { // Allow Meta-Click (Cmd+Click or Ctrl+Click)
// or Mouse3-click (middle-click)
// to open in a new tab
if (e.metaKey || e.ctrlKey || e.which === 2) {
e.preventDefault(); e.preventDefault();
return window.open(todoLink, '_blank'); // Meta-Click on username leads to different URL than todoLink.
// Turbolinks can resolve that URL, but window.open requires URL manually.
if (targetLink !== todoLink) {
return window.open(targetLink, '_blank');
} else {
return window.open(todoLink, '_blank');
}
} else { } else {
return gl.utils.visitUrl(todoLink); return gl.utils.visitUrl(todoLink);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment