Avoid too often replacement of highlighted strings

pull/10674/head
Henriette Darge 2 years ago
parent 335d6551b9
commit f73aa18a00
  1. 7
      frontend/src/app/shared/directives/search-highlight.directive.ts

@ -15,8 +15,13 @@ export class OpSearchHighlightDirective implements AfterViewChecked {
ngAfterViewChecked():void { ngAfterViewChecked():void {
let el = this.elementRef.nativeElement as HTMLElement; let el = this.elementRef.nativeElement as HTMLElement;
el = this.cleanUpOldHighlighting(el); const highlightedElement = el.querySelector('.op-search-highlight');
if (!!highlightedElement && highlightedElement.innerHTML.toLocaleLowerCase() === this.query) {
return;
}
el = this.cleanUpOldHighlighting(el);
if (!this.query) { if (!this.query) {
return; return;
} }

Loading…
Cancel
Save