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 f89f480d21893729fa95139249318bbd713db8bf..ef9738a6ac20839cafc7e1ac53c074644dd9ef66 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,23 +1,6 @@ -<!-- working --> -<!-- <div> - <p> - <span *ngFor="let part Of partsOfQuestion; let i = index">{{part}}<mark *ngIf="i < partsOfQuestion.length -1">{{keyword}}</mark></span> - <button - *ngIf = "question.length > maxShowedCharachters" - (click)="isCollapsed = !isCollapsed"> - {{"dialog-comment.read-" + (!isCollapsed ? 'more': 'less') | translate}} - </button> - </p> -</div> --> - -<!-- WIP --> <div> <p> - <span *ngFor="let part Of partsOfQuestion"> - <span *ngIf="!part.toLowerCase().includes(keyword.toLowerCase()) && (!badWords.includes(part.toLowerCase()) || !profanityFilter)"> {{part}} </span> - <mark class="mark" *ngIf="part.toLowerCase().includes(keyword.toLowerCase())">{{part}}</mark> - <mark class="profanity" *ngIf="(badWords.includes(part.toLowerCase()) && profanityFilter)">{{part}}</mark> - </span> + <span *ngFor="let part Of partsOfQuestion; 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.scss b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.scss index 708520471ce8cf704ae9791278d74920d692a2a4..84e15614647e5b8ec2680f1c834fbfdcfc18b140 100644 --- a/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.scss +++ b/src/app/components/shared/dialog/topic-dialog-comment/topic-dialog-comment.component.scss @@ -30,12 +30,8 @@ span { padding-left: 0px; } -.mark { +mark { background: none; color: var(--primary); } -.profanity { - background-color: black; - color: black; -} 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 2777191bd92d7026278f8a99d62451218800c04b..8c953195fc9b2ff6ae6c565d1dcc504d34215da8 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 @@ -23,10 +23,15 @@ export class TopicDialogCommentComponent implements OnInit { constructor(private topicCloudAdminService: TopicCloudAdminService) { } get partsOfQuestion() { - const q = this.profanityFilter ? this.questionWithProfinity.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters) : - this.question.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters); - const q2 = q.split(' '); - return q2; + if (this.profanityFilter) { + return this.questionWithProfinity + .slice(0,this.isCollapsed? this.questionWithProfinity.length: this.maxShowedCharachters) + .split(new RegExp(this.keyword,'i')); + } else { + return this.question + .slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters) + .split(new RegExp(this.keyword,'i')); + } } ngOnInit(): void {