From 83fc4b01b61b64073745e9bb79f9a17445c5f36c Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Mon, 26 Feb 2024 14:24:14 +0300 Subject: [PATCH] feat(addon-doc): support target property for links (#6876) --- .../components/navigation/navigation.template.html | 6 ++++++ projects/addon-doc/interfaces/page.ts | 2 ++ projects/demo/src/modules/app/pages.ts | 1 + 3 files changed, 9 insertions(+) diff --git a/projects/addon-doc/components/navigation/navigation.template.html b/projects/addon-doc/components/navigation/navigation.template.html index 27e72cdf546b..a0908f2f2c9a 100644 --- a/projects/addon-doc/components/navigation/navigation.template.html +++ b/projects/addon-doc/components/navigation/navigation.template.html @@ -18,8 +18,10 @@ {{ item.title }} @@ -81,7 +83,9 @@ routerLinkActive="t-sublink_active" tuiLink class="t-sublink" + [attr.rel]="item.rel" [routerLink]="item.route" + [target]="item.target || '_self'" [tuiScrollIntoViewLink]="isActive(item.route)" (click)="closeMenu()" > @@ -128,8 +132,10 @@ routerLinkActive="t-sublink_active" tuiLink class="t-sublink t-sublink_small" + [attr.rel]="subPage.rel" [fragment]="subPage.fragment" [routerLink]="subPage.route" + [target]="subPage.target || '_self'" [tuiScrollIntoViewLink]="isActive(subPage.route)" (click)="closeMenu()" > diff --git a/projects/addon-doc/interfaces/page.ts b/projects/addon-doc/interfaces/page.ts index bda048fdf02f..65e678223b99 100644 --- a/projects/addon-doc/interfaces/page.ts +++ b/projects/addon-doc/interfaces/page.ts @@ -10,6 +10,8 @@ export interface TuiDocPage extends TuiDocPageBase { readonly keywords?: string; readonly route: string; readonly icon?: PolymorpheusContent; + readonly rel?: HTMLAnchorElement['rel']; + readonly target?: HTMLAnchorElement['target']; } export interface TuiDocPageGroup extends TuiDocPageBase { diff --git a/projects/demo/src/modules/app/pages.ts b/projects/demo/src/modules/app/pages.ts index dda46bd3e3e7..b0e269a99de5 100644 --- a/projects/demo/src/modules/app/pages.ts +++ b/projects/demo/src/modules/app/pages.ts @@ -44,6 +44,7 @@ export const pages: TuiDocPages = [ title: 'StackBlitz', keywords: 'reproduce, issue, bug, sandbox, playground, test', route: '/stackblitz', + target: '_blank', }, { section: 'Documentation',