Skip to content

Commit

Permalink
Change link target behaviour, so it takes into account appConfig opti…
Browse files Browse the repository at this point in the history
…ons (#4474)
  • Loading branch information
thecalcc committed Apr 11, 2024
1 parent c32bc2d commit 4c9abde
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/core/editor3/components/links/LinkInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {applyLink, hidePopups, createLinkSuggestion, changeLinkSuggestion} from
import {connectPromiseResults} from 'core/helpers/ReactRenderAsync';
import ng from 'core/services/ng';
import {gettext} from 'core/utils';
import {appConfig} from 'appConfig';

/**
* @ngdoc React
Expand Down Expand Up @@ -93,7 +94,7 @@ export class LinkInputComponent extends React.Component<any, any> {
const isLocalDomain = (localDomains || []).some((item) => url.includes(item.domain));

link = {href: url};
if (!isLocalDomain && localDomains != null) {
if ((appConfig.linksBlankTarget === true) || (!isLocalDomain && localDomains != null)) {
link.target = '_blank';
}
} else if (linkType === linkTypes.attachement) {
Expand Down
3 changes: 3 additions & 0 deletions scripts/core/superdesk-api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1963,6 +1963,9 @@ declare module 'superdesk-api' {
oidc_auth: any;
keycloak_config: any;

/** Allow default target for links to be _blank. */
linksBlankTarget?: boolean;

/**
* Enable autocomplete for supported text fields in authoring.
* Values of published items are used for autocomplete suggestions.
Expand Down

0 comments on commit 4c9abde

Please sign in to comment.