Skip to content
Snippets Groups Projects
Commit f25c46fb authored by tony's avatar tony
Browse files

add new highlight

parent 672f640c
No related merge requests found
......@@ -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>
......
<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>
......@@ -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 {
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment