From f25c46fb54706b43954ce40a3e2d72c947b82914 Mon Sep 17 00:00:00 2001 From: tony <yvan.tchiengue1504@yahoo.fr> Date: Mon, 10 May 2021 21:44:04 +0200 Subject: [PATCH] add new highlight --- .../topic-cloud-administration.component.html | 1 + .../topic-dialog-comment.component.html | 8 ++++++-- .../topic-dialog-comment.component.ts | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html index cdad89b4e..7b25a7741 100644 --- a/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html +++ b/src/app/components/shared/_dialogs/topic-cloud-administration/topic-cloud-administration.component.html @@ -36,6 +36,7 @@ <mat-divider></mat-divider> <app-topic-dialog-comment [question]="question" + [keyword] ="keyword.keyword" [maxShowedCharachters] = "140" [isCollapsed] = "!panelOpenState" ></app-topic-dialog-comment> 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 a188307db..ea037559d 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,9 +1,13 @@ <div> <p> {{(isCollapsed) ? question : question | slice:0:maxShowedCharachters}}{{question.length > maxShowedCharachters && !isCollapsed? "..." : ""}} - <button *ngIf = "question.length > maxShowedCharachters" + <span *ngFor="let part Of partsOfQuestion; let i = index"> + {{part}} + <span *ngIf="i < partsOfQuestion.length -1"><mark id="myMark">{{keyword}}</mark></span> + </span> + <button *ngIf = "question.length > maxShowedCharachters" (click)="isCollapsed = !isCollapsed"> {{ "dialog-comment.read-" + (!isCollapsed ? 'more': 'less') | translate }} </button> </p> -</div> \ No newline at end of file +</div> 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 6c74197dc..6ad9d0972 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 @@ -8,10 +8,17 @@ import { Component, Input, OnInit } from '@angular/core'; export class TopicDialogCommentComponent implements OnInit { @Input() question: string; + @Input() keyword: string ; @Input() maxShowedCharachters: number; @Input() isCollapsed: boolean = false; constructor() { } + get partsOfQuestion(){ + + return this.question.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters).split(this.keyword) ; + + } + ngOnInit(): void { } } -- GitLab