diff --git a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.html b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.html index ef9738a6ac20839cafc7e1ac53c074644dd9ef66..8465d971e8e436c69bb0ddd4a203a4e76c4455c3 100644 --- a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.html +++ b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.html @@ -1,6 +1,6 @@ <div> <p> - <span *ngFor="let part Of partsOfQuestion; let i = index">{{part}}<mark *ngIf="i < partsOfQuestion.length -1">{{keyword}}</mark></span> + <span *ngFor="let part Of (isCollapsed?partsOfQuestion:partsOfShortQuestion); let i = index">{{part}}<mark *ngIf="i < partsOfQuestion.length-1">{{keyword}}</mark></span> <button *ngIf = "question.length > maxShowedCharachters" (click)="isCollapsed = !isCollapsed"> diff --git a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts index 0b9fabd09ec1d5f346d5053781666fd1eb650de9..3a8869b37e47796cdfe8caa9cef0f639b522bcb0 100644 --- a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts +++ b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.ts @@ -17,9 +17,10 @@ export class TopicDialogCommentComponent implements OnInit { public badWords = []; questionWithoutProfanity: string = undefined; - public shortQuestion: string; public parts: string[]; public partsWithoutProfanity: string[]; + public partsShort: string[]; + public partsWithoutProfanityShort: string[]; constructor(private topicCloudAdminService: TopicCloudAdminService) { } @@ -31,11 +32,21 @@ export class TopicDialogCommentComponent implements OnInit { } } + get partsOfShortQuestion(){ + if (this.profanityFilter) { + return this.partsWithoutProfanityShort; + } else { + return this.partsShort; + } + } + ngOnInit(): void { this.questionWithoutProfanity = this.topicCloudAdminService.filterProfanityWords(this.question); - this.partsWithoutProfanity = this.questionWithoutProfanity.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters) - .split(new RegExp(this.keyword,'i')); - this.parts = this.question.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters) - .split(new RegExp(this.keyword,'i')); + this.partsWithoutProfanity = this.questionWithoutProfanity.split(new RegExp(this.keyword,'i')); + this.parts = this.question.split(new RegExp(this.keyword,'i')); + this.partsShort = this.question.slice(0, this.maxShowedCharachters) + .split(new RegExp(this.keyword,'i')); + this.partsWithoutProfanityShort = this.questionWithoutProfanity.slice(0, this.maxShowedCharachters) + .split(new RegExp(this.keyword,'i')); } }