Configuring the URI link target

(cherry picked from commit 0ef2db146b)
This commit is contained in:
igorbaptist4
2024-09-11 14:48:59 -03:00
committed by github-actions[bot]
parent 60ff9a9c79
commit 5173b28b5a
2 changed files with 16 additions and 1 deletions

View File

@@ -134,4 +134,16 @@ export class MetadataValuesComponent implements OnChanges {
hasInternalLink(linkValue: string): boolean {
return linkValue.startsWith(environment.ui.baseUrl);
}
/**
* This method performs a validation and determines the target of the url.
* @returns - Returns the target url.
*/
getLinkAttributes(urlValue: string): { target: string, rel: string } {
if (this.hasInternalLink(urlValue)) {
return { target: '_self', rel: '' };
} else {
return { target: '_blank', rel: 'noopener noreferrer' };
}
}
}