From 8a6954a23cf26a0624569c3950a1f56caba6faf9 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Wed, 31 Mar 2021 12:01:43 +0200 Subject: [PATCH] MOBILE-3639 format-text: Add new inputs to control links --- src/core/directives/format-text.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/directives/format-text.ts b/src/core/directives/format-text.ts index d9dc16f63..4ceb07fea 100644 --- a/src/core/directives/format-text.ts +++ b/src/core/directives/format-text.ts @@ -69,6 +69,8 @@ export class CoreFormatTextDirective implements OnChanges { @Input() contextInstanceId?: number; // The instance ID related to the context. @Input() courseId?: number; // Course ID the text belongs to. It can be used to improve performance with filters. @Input() wsNotFiltered?: boolean | string; // If true it means the WS didn't filter the text for some reason. + @Input() captureLinks?: boolean; // Whether links should tried to be opened inside the app. Defaults to true. + @Input() openLinksInApp?: boolean; // Whether links should be opened in InAppBrowser. /** * Max height in pixels to render the content box. It should be 50 at least to make sense. @@ -489,7 +491,8 @@ export class CoreFormatTextDirective implements OnChanges { anchors.forEach((anchor) => { // Angular 2 doesn't let adding directives dynamically. Create the CoreLinkDirective manually. const linkDir = new CoreLinkDirective(new ElementRef(anchor), this.content); - linkDir.capture = true; + linkDir.capture = this.captureLinks ?? true; + linkDir.inApp = this.openLinksInApp; linkDir.ngOnInit(); this.addExternalContent(anchor);