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

add new highlight

parent 672f640c
Branches
Tags
No related merge requests found
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
<mat-divider></mat-divider> <mat-divider></mat-divider>
<app-topic-dialog-comment <app-topic-dialog-comment
[question]="question" [question]="question"
[keyword] ="keyword.keyword"
[maxShowedCharachters] = "140" [maxShowedCharachters] = "140"
[isCollapsed] = "!panelOpenState" [isCollapsed] = "!panelOpenState"
></app-topic-dialog-comment> ></app-topic-dialog-comment>
......
<div> <div>
<p> <p>
{{(isCollapsed) ? question : question | slice:0:maxShowedCharachters}}{{question.length > maxShowedCharachters && !isCollapsed? "..." : ""}} {{(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"> (click)="isCollapsed = !isCollapsed">
{{ "dialog-comment.read-" + (!isCollapsed ? 'more': 'less') | translate }} {{ "dialog-comment.read-" + (!isCollapsed ? 'more': 'less') | translate }}
</button> </button>
</p> </p>
</div> </div>
\ No newline at end of file
...@@ -8,10 +8,17 @@ import { Component, Input, OnInit } from '@angular/core'; ...@@ -8,10 +8,17 @@ import { Component, Input, OnInit } from '@angular/core';
export class TopicDialogCommentComponent implements OnInit { export class TopicDialogCommentComponent implements OnInit {
@Input() question: string; @Input() question: string;
@Input() keyword: string ;
@Input() maxShowedCharachters: number; @Input() maxShowedCharachters: number;
@Input() isCollapsed: boolean = false; @Input() isCollapsed: boolean = false;
constructor() { } constructor() { }
get partsOfQuestion(){
return this.question.slice(0,this.isCollapsed? this.question.length: this.maxShowedCharachters).split(this.keyword) ;
}
ngOnInit(): void { 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