Skip to content

Commit 380aadb

Browse files
committed
Merge branch 'dspace-cris-7' of bitbucket.org:4Science/dspace-angular into dspace-cris-7
2 parents 566b1fc + 2f3c278 commit 380aadb

3 files changed

Lines changed: 12 additions & 4 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-
{{metadataValue.value}}
5+
<div [innerHTML]="formatText(metadataValue.value)"></div>
66
</ds-truncatable-part>
77
</ds-truncatable>
88
</div>

src/app/cris-layout/cris-layout-matrix/cris-layout-box-container/boxes/metadata/rendering-types/rendering-type-value.model.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,14 @@ export abstract class RenderingTypeValueModelComponent extends RenderingTypeMode
3333
this.renderingSubType = renderingSubTypeProvider;
3434
}
3535

36+
/**
37+
* Purge all HTML tags, then replace newline character with <br>
38+
* @param text
39+
*/
40+
formatText(text: string): string {
41+
const htmlTagRegex = /<.*?>/;
42+
const newlineRegex = /\n/g;
43+
return text.replace(htmlTagRegex, '').replace(newlineRegex, '<br>');
44+
}
45+
3646
}
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
<div [class]="field.styleValue">
2-
<span class="text-value">
3-
{{ metadataValue.value }}
4-
</span>
2+
<span class="text-value" [innerHTML]="formatText(metadataValue.value)"></span>
53
</div>

0 commit comments

Comments
 (0)