@if (article.full_content) { -

+ [content]="article.full_content" + [highlights]="articleHighlights" /> } @else {

Kein Inhalt verfügbar.

} diff --git a/webapp/src/app/modules/news-detail/news-detail.component.scss b/webapp/src/app/modules/news-detail/news-detail.component.scss index 1d31ab79..ba40e8bd 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.scss +++ b/webapp/src/app/modules/news-detail/news-detail.component.scss @@ -600,25 +600,3 @@ main { background: transparent; } } - -:host ::ng-deep .kw-mark { - background: transparent; - color: var(--t); - text-decoration: underline; - text-decoration-color: var(--t); - text-decoration-style: solid; - text-decoration-thickness: 2px; - text-underline-offset: 2px; - font-weight: inherit; - border-radius: 2px; - padding: 0 1px; - transition: background 0.15s; - - &:hover { - background: color-mix(in srgb, var(--t) 15%, var(--sg-color-mix-base)); - } - - &.kw-flash { - animation: kw-flash 2.4s ease-out forwards; - } -} diff --git a/webapp/src/app/modules/news-detail/news-detail.component.ts b/webapp/src/app/modules/news-detail/news-detail.component.ts index fdbb74f9..f048b76f 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.ts +++ b/webapp/src/app/modules/news-detail/news-detail.component.ts @@ -12,8 +12,10 @@ import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatTooltipModule } from '@angular/material/tooltip'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; - +import { + HighlightedTextComponent, + HighlightTerm, +} from '../../shared/ui/highlighted-text/highlighted-text.component'; import { WorksService } from '../../api'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; import { LoadingComponent } from '../../shared/ui/loading/loading.component'; @@ -54,21 +56,21 @@ interface NewsArticleDetail { MatTooltipModule, RouterLink, LoadingComponent, + HighlightedTextComponent, ], templateUrl: './news-detail.component.html', styleUrl: './news-detail.component.scss', }) export class NewsDetailComponent implements OnInit { - @ViewChild('articleBody') articleBodyRef?: ElementRef; + @ViewChild('articleBody', { read: ElementRef }) + articleBodyRef?: ElementRef; private readonly router = inject(Router); private readonly destroyRef = inject(DestroyRef); private readonly route = inject(ActivatedRoute); private readonly httpClient = inject(HttpClient); private readonly worksService = inject(WorksService); - private readonly sanitizer = inject(DomSanitizer); article: NewsArticleDetail | null = null; - highlightedContent: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(''); loading = false; notFound = false; @@ -172,7 +174,6 @@ export class NewsDetailComponent implements OnInit { .subscribe({ next: (article) => { this.article = article; - this.highlightedContent = this.buildHighlightedContent(article); this.expandedTopicId = null; this.personsPage = 0; this.loading = false; @@ -184,56 +185,33 @@ export class NewsDetailComponent implements OnInit { }); } - private buildHighlightedContent(article: NewsArticleDetail): SafeHtml { - const text = article.full_content; - if (!text) return this.sanitizer.bypassSecurityTrustHtml(''); - const keywords = article.keywords ?? []; + get articleHighlights(): HighlightTerm[] { + const article = this.article; + if (!article) return []; - const keywordColorMap = new Map(); + const topicByKeyword = new Map(); for (const topic of article.topics ?? []) { if (topic.source_keyword) { - keywordColorMap.set( - topic.source_keyword.toLowerCase(), - this.getTopicColor(topic), - ); + topicByKeyword.set(topic.source_keyword.toLowerCase(), topic); } } - let html = this.escapeHtml(text); - [...keywords] - .sort((a, b) => b.length - a.length) - .forEach((kw) => { - const color = keywordColorMap.get(kw.toLowerCase()); - if (!color) return; - const kwHtml = this.escapeHtml(kw); - const escaped = this.escapeRegex(kwHtml); - const before = '(?$1`, - ); + const highlights: HighlightTerm[] = []; + for (const keyword of article.keywords ?? []) { + const topic = topicByKeyword.get(keyword.toLowerCase()); + if (!topic) continue; + + highlights.push({ + term: keyword, + topic: { + id: topic.id, + name: topic.display_name, + field_name: topic.field_name, + domain_name: topic.domain_name, + }, }); - return this.sanitizer.bypassSecurityTrustHtml(html); - } + } - private escapeHtml(text: string): string { - return text - .replace(/&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); - } - - private escapeRegex(text: string): string { - return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + return highlights; } } From bee9b6e8fdcc647c57b62d42fc886b8533798365 Mon Sep 17 00:00:00 2001 From: genja Date: Sat, 15 Aug 2026 23:01:04 +0200 Subject: [PATCH 45/92] added details row for dfg projects --- .../dfg-project-table.component.html | 122 ++++++++- .../dfg-project-table.component.scss | 246 ++++++++++++++++++ .../dfg-project-table.component.ts | 146 ++++++++++- 3 files changed, 504 insertions(+), 10 deletions(-) diff --git a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html index 790baa53..ec8f7600 100644 --- a/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html +++ b/webapp/src/app/shared/ui/dfg-project-table/dfg-project-table.component.html @@ -1,6 +1,7 @@ @@ -9,7 +10,9 @@ queryParamPageKey="page" queryParamSizeKey="size" [pageSizeOptions]="[10, 25, 50]" /> - + + {{ element.title_de }} + {{ @@ -42,12 +45,11 @@ + matTooltipPosition="above"> category - {{ - getClassificationFullChain(classification) - }} + + {{ getClassificationFullChain(classification) }} } @empty { - @@ -60,7 +62,115 @@ }