Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Target_Blank option to open External links #31180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/src/components/MainMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const setUp = () => {
if (!$app.is('a')) {
$app = $app.closest('a')
}
if (event.which === 1 && !event.ctrlKey && !event.metaKey) {
if (event.which === 1 && !event.ctrlKey && !event.metaKey && $app.attr('target') !== '_blank') {
$app.find('svg').remove()
$app.find('div').remove() // prevent odd double-clicks
// no need for theming, loader is already inverted on dark mode
Expand Down Expand Up @@ -100,7 +100,7 @@ export const setUp = () => {
$app = $app.closest('a')
}

if (event.which === 1 && !event.ctrlKey && !event.metaKey && $app.parent('#more-apps').length === 0) {
if (event.which === 1 && !event.ctrlKey && !event.metaKey && $app.parent('#more-apps').length === 0 && $app.attr('target') !== '_blank') {
$app.find('svg').remove()
$app.find('div').remove() // prevent odd double-clicks
$app.prepend($('<div/>').addClass(
Expand Down
2 changes: 2 additions & 0 deletions core/templates/layout.user.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
<?php foreach ($_['navigation'] as $entry): ?>
<li data-id="<?php p($entry['id']); ?>" class="hidden" tabindex="-1">
<a href="<?php print_unescaped($entry['href']); ?>"
<?php if ($entry['target']): ?> target="_blank" rel="noreferrer noopener"<?php endif; ?>
nickvergessen marked this conversation as resolved.
Show resolved Hide resolved
<?php if ($entry['active']): ?> class="active"<?php endif; ?>
aria-label="<?php p($entry['name']); ?>">
<svg width="24" height="20" viewBox="0 0 24 20" alt=""<?php if ($entry['unread'] !== 0) { ?> class="has-unread"<?php } ?>>
Expand Down Expand Up @@ -105,6 +106,7 @@
<?php foreach ($_['navigation'] as $entry): ?>
<li data-id="<?php p($entry['id']); ?>">
<a href="<?php print_unescaped($entry['href']); ?>"
<?php if ($entry['target']): ?> target="_blank" rel="noreferrer noopener"<?php endif; ?>
<?php if ($entry['active']): ?> class="active"<?php endif; ?>
aria-label="<?php p($entry['name']); ?>">
<svg width="20" height="20" viewBox="0 0 20 20" alt=""<?php if ($entry['unread'] !== 0) { ?> class="has-unread"<?php } ?>>
Expand Down
4 changes: 2 additions & 2 deletions dist/core-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/core-main.js.map

Large diffs are not rendered by default.