Merge pull request #3723 from Icinga/feature/ctrl-click-does-not-open-links-in-new-tab-3722

Make ctrl-click open new tab
This commit is contained in:
Johannes Meyer 2019-05-24 13:01:52 +02:00 committed by GitHub
commit b4979b75a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View File

@ -95,6 +95,11 @@
var _this = event.data.self; var _this = event.data.self;
var icinga = _this.icinga; var icinga = _this.icinga;
// Check for ctrl or cmd click to open new tab and don't unfold other menus
if (event.ctrlKey || event.metaKey) {
return false;
}
if (href.match(/#/)) { if (href.match(/#/)) {
// ...it may be a menu section without a dedicated link. // ...it may be a menu section without a dedicated link.
// Switch the active menu item: // Switch the active menu item:

View File

@ -457,10 +457,16 @@
return true; return true;
} }
// Check for ctrl or cmd click to open new tab unless clicking on a multiselect row
if ((event.ctrlKey || event.metaKey) && href !== '#' && $a.is('a')) {
window.open(href, linkTarget);
return false;
}
// Special checks for link clicks in action tables // Special checks for link clicks in action tables
if (! $a.is('tr[href]') && $a.closest('table.action').length > 0) { if (! $a.is('tr[href]') && $a.closest('table.action').length > 0) {
// ignoray clicks to ANY link with special key pressed // ignore clicks to ANY link with special key pressed
if ($a.closest('table.multiselect').length > 0 && (event.ctrlKey || event.metaKey || event.shiftKey)) { if ($a.closest('table.multiselect').length > 0 && (event.ctrlKey || event.metaKey || event.shiftKey)) {
return true; return true;
} }