Skip to content

Commit 7bb1543

Browse files
Mattia VianelliMattia Vianelli
authored andcommitted
DSC-2212 Updated rendering for the text and longtext components to use a pipe for the html escaping
1 parent b1faf11 commit 7bb1543

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/longtext/longtext.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="{{field.styleValue}}">
33
<ds-truncatable [id]="truncableId">
44
<ds-truncatable-part [id]="truncableId" [minLines]="3">
5-
<span [innerHTML]="formatText(metadataValue.value)" data-test="formatted-text"></span>
5+
<span [innerHTML]="metadataValue.value | dsEscapeHtml" data-test="formatted-text"></span>
66
</ds-truncatable-part>
77
</ds-truncatable>
88
</div>

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/longtext/longtext.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Component } from '@angular/core';
22

33
import { TruncatableComponent } from '../../../../../../../shared/truncatable/truncatable.component';
44
import { TruncatablePartComponent } from '../../../../../../../shared/truncatable/truncatable-part/truncatable-part.component';
5+
import { EscapeHtmlPipe } from '../../../../../../../shared/utils/escape-html.pipe';
56
import { RenderingTypeValueModelComponent } from '../rendering-type-value.model';
67

78
/**
@@ -13,7 +14,7 @@ import { RenderingTypeValueModelComponent } from '../rendering-type-value.model'
1314
templateUrl: './longtext.component.html',
1415
styleUrls: ['./longtext.component.scss'],
1516
standalone: true,
16-
imports: [TruncatableComponent, TruncatablePartComponent],
17+
imports: [TruncatableComponent, TruncatablePartComponent, EscapeHtmlPipe],
1718
})
1819
export class LongtextComponent extends RenderingTypeValueModelComponent {
1920

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<div [class]="field.styleValue">
2-
<span class="text-value" [attr.lang]="metadataValue.language" [innerHTML]="formatText(metadataValue.value)"></span>
2+
<span class="text-value" [attr.lang]="metadataValue.language" [innerHTML]="metadataValue.value | dsEscapeHtml"></span>
33
</div>

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/text/text.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Component } from '@angular/core';
22

3+
import { EscapeHtmlPipe } from '../../../../../../../shared/utils/escape-html.pipe';
34
import { RenderingTypeValueModelComponent } from '../rendering-type-value.model';
45

56
/**
@@ -11,6 +12,9 @@ import { RenderingTypeValueModelComponent } from '../rendering-type-value.model'
1112
templateUrl: './text.component.html',
1213
styleUrls: ['./text.component.scss'],
1314
standalone: true,
15+
imports: [
16+
EscapeHtmlPipe,
17+
],
1418
})
1519
export class TextComponent extends RenderingTypeValueModelComponent {
1620

0 commit comments

Comments
 (0)