Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Better display of multiple comment hits

Michael Shamoon4dc0c7bbe273
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
index c114a2d6e..b18524e38 100644
--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.html
@@ -26,11 +26,11 @@
</div>
<p class="card-text">
<span *ngIf="document.__search_hit__ && document.__search_hit__.highlights" [innerHtml]="document.__search_hit__.highlights"></span>
- <span *ngIf="document.__search_hit__ && document.__search_hit__.comment_highlights" class="d-block">
+ <span *ngFor="let highlight of searchCommentHighlights" class="d-block">
<svg width="1em" height="1em" fill="currentColor" class="me-2">
<use xlink:href="assets/bootstrap-icons.svg#chat-left-text"/>
</svg>
- <span [innerHtml]="document.__search_hit__.comment_highlights"></span>
+ <span [innerHtml]="highlight"></span>
</span>
<span *ngIf="!document.__search_hit__" class="result-content">{{contentTrimmed}}</span>
</p>
diff --git a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts
index b43187879..5d24042b9 100644
--- a/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts
+++ b/src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts
@@ -70,6 +70,22 @@ export class DocumentCardLargeComponent {
}
}
+ get searchCommentHighlights() {
+ let highlights = []
+ if (
+ this.document['__search_hit__'] &&
+ this.document['__search_hit__'].comment_highlights
+ ) {
+ // only show comments with a match
+ highlights = (
+ this.document['__search_hit__'].comment_highlights as string
+ )
+ .split(',')
+ .filter((higlight) => higlight.includes('<span'))
+ }
+ return highlights
+ }
+
getIsThumbInverted() {
return this.settingsService.get(SETTINGS_KEYS.DARK_MODE_THUMB_INVERTED)
}