Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Commit

Permalink
OLPSUP-9660: Implemented opening of copyright links in new tab. (#1330)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksandr Popov <ext-oleksandr.popov@here.com>
  • Loading branch information
keaukraine committed Feb 28, 2020
1 parent 79226d7 commit a77b9a8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions @here/harp-mapview/lib/copyrights/CopyrightInfo.ts
Expand Up @@ -93,6 +93,8 @@ export namespace CopyrightInfo {
*
* * Empty list returns empty string.
* * Entries with empty (but defined) labels are skipped.
*
* @param copyrightInfo Array of copyrights to format.
*/
export function formatAsHtml(copyrightInfo: CopyrightInfo[]): string {
if (copyrightInfo.length === 0) {
Expand All @@ -108,9 +110,12 @@ export namespace CopyrightInfo {
"© " +
filtered
.map(entry => {
const label = entry.label !== undefined ? entry.label : entry.id;
const label = entry.label ?? entry.id;
const text = entry.year !== undefined ? `${entry.year} ${label}` : label;
return entry.link ? `<a href="${entry.link}">${text}</a>` : `${text}`;
const link = entry.link;
return link
? `<a href="${link}" target="_blank" rel="noreferrer noopener">${text}</a>`
: `${text}`;
})
.join(", ")
);
Expand Down

0 comments on commit a77b9a8

Please sign in to comment.