From e37f636236eb2293bb0ac772113d3976b6e22cf7 Mon Sep 17 00:00:00 2001 From: "noemi.kallweit" Date: Sat, 15 Aug 2026 12:24:21 +0200 Subject: [PATCH 1/4] feat(news-keyword-search): expand rows to show article excerpt and highlight keyword in topic color. --- .../news-results/news-results.component.html | 53 +++++++- .../news-results/news-results.component.scss | 50 +++++-- .../news-results/news-results.component.ts | 73 ++++++++++ .../news-detail/news-detail.component.scss | 36 ----- .../news-detail/news-detail.component.ts | 57 ++------ .../app/resolvers/utils/keyword-highlight.ts | 126 ++++++++++++++++++ webapp/src/styles.scss | 41 ++++++ 7 files changed, 338 insertions(+), 98 deletions(-) create mode 100644 webapp/src/app/resolvers/utils/keyword-highlight.ts diff --git a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html index fa8728fe..b054c67b 100644 --- a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html +++ b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html @@ -39,13 +39,47 @@ } + + @if (article.snippet) { + @let expanded = isSnippetExpanded(article); + + } + +
- + {{ article.maintitle || 'Kein Titel' }} - @if (article.snippet) { - +
+
+ + +
+ @if (snippetHtml().get(article.id); as snippet) { + Fundstelle im Artikel + + } @else { + + Für diesen Artikel liegt keine Textstelle zu den gesuchten Keywords + vor. + }
@@ -86,7 +120,10 @@ @let visibleTopics = topicsExpanded ? topics : topics.slice(0, topicPreviewCount); -
+
@for (topic of visibleTopics; track topic.id ?? topic.display_name) { + matTooltip="Details anzeigen" + (click)="$event.stopPropagation()"> open_in_new @@ -141,7 +179,10 @@
} @else {
- +
(); @@ -136,13 +143,22 @@ export class KeywordsToNewsResultsComponent { return baseTopicIds.length > 0 || this.selectedTopicIds().length > 0; }); + expandTmp = viewChild.required>('expandTmp'); titleTmp = viewChild.required>('titleTmp'); dateTmp = viewChild.required>('dateTmp'); relevanceTmp = viewChild.required>('relevanceTmp'); topicsTmp = viewChild.required>('topicsTmp'); actionsTmp = viewChild.required>('actionsTmp'); + private readonly dataTable = viewChild(DataTableComponent); + readonly columns = computed[]>(() => [ + { + id: 'expand', + header: '', + type: 'display', + cellTemplate: this.expandTmp(), + }, { id: 'maintitle', header: 'Titel', @@ -222,6 +238,63 @@ export class KeywordsToNewsResultsComponent { return !!topic.id && this.selectedTopicIds().includes(topic.id); } + isSnippetExpanded(article: NewsResult): boolean { + return this.dataTable()?.expandedElement() === article; + } + + readonly snippetHtml = computed(() => { + const byArticleId = new Map(); + + for (const article of this.elements()) { + const html = this.buildSnippetHtml(article); + if (html !== null) { + byArticleId.set( + article.id, + this.sanitizer.bypassSecurityTrustHtml(html), + ); + } + } + + return byArticleId; + }); + + private buildSnippetHtml(article: NewsResult): string | null { + const snippet = article.snippet; + if (!snippet) { + return null; + } + + const keywordColors = topicKeywordColors(article.topics); + const searchMatch = /([\s\S]*?)<\/em>/g; + + let html = ''; + let lastIndex = 0; + let match: RegExpExecArray | null; + + while ((match = searchMatch.exec(snippet)) !== null) { + html += escapeHtml( + this.decodeHtml(snippet.slice(lastIndex, match.index)), + ); + html += `${highlightKeywords( + this.decodeHtml(match[1]), + keywordColors, + )}`; + + lastIndex = searchMatch.lastIndex; + } + + return html + escapeHtml(this.decodeHtml(snippet.slice(lastIndex))); + } + + private decodeHtml(value: string): string { + return value + .replace(/</g, '<') + .replace(/>/g, '>') + .replace(/"/g, '"') + .replace(/&#(?:39|x27);/g, "'") + .replace(/&/g, '&'); + } + isTopicsExpanded(article: NewsResult): boolean { return this.expandedTopicsIds().has(article.id); } 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..a3aaa6c7 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.scss +++ b/webapp/src/app/modules/news-detail/news-detail.component.scss @@ -586,39 +586,3 @@ main { --topic-bg: color-mix(in srgb, var(--sg-error) 8%, var(--sg-color-mix-base)); --topic-color: var(--sg-error); } - -// ── Keyword highlights in article text ─────────────────────────────────────── - -@keyframes kw-flash { - 0% { - background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); - } - 40% { - background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); - } - 100% { - 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..039c7feb 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.ts +++ b/webapp/src/app/modules/news-detail/news-detail.component.ts @@ -16,6 +16,10 @@ import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { WorksService } from '../../api'; import { topicHierarchyColor } from '../../resolvers/utils/topic-colors'; +import { + highlightKeywords, + topicKeywordColors, +} from '../../resolvers/utils/keyword-highlight'; import { LoadingComponent } from '../../shared/ui/loading/loading.component'; interface MentionedPerson { @@ -187,53 +191,12 @@ 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 ?? []; - const keywordColorMap = new Map(); - for (const topic of article.topics ?? []) { - if (topic.source_keyword) { - keywordColorMap.set( - topic.source_keyword.toLowerCase(), - this.getTopicColor(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`, - ); - }); - 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 this.sanitizer.bypassSecurityTrustHtml( + highlightKeywords( + text, + topicKeywordColors(article.topics, article.keywords), + ), + ); } } diff --git a/webapp/src/app/resolvers/utils/keyword-highlight.ts b/webapp/src/app/resolvers/utils/keyword-highlight.ts new file mode 100644 index 00000000..e261e496 --- /dev/null +++ b/webapp/src/app/resolvers/utils/keyword-highlight.ts @@ -0,0 +1,126 @@ +import { MatchedTopic } from '../../api'; +import { topicHierarchyColor } from './topic-colors'; + +/** A keyword together with the colour of the topic it resolved to. */ +export interface KeywordColor { + keyword: string; + color: string; +} + +/** Pairs every keyword that resolved to a topic with that topic's colour. */ +export function topicKeywordColors( + topics: readonly MatchedTopic[] | null | undefined, + keywords?: readonly string[] | null, +): KeywordColor[] { + const colorByKeyword = new Map(); + + for (const topic of topics ?? []) { + if (!topic.source_keyword) { + continue; + } + + colorByKeyword.set( + topic.source_keyword.toLowerCase(), + topicHierarchyColor({ + id: topic.id, + name: topic.display_name, + field_name: topic.field_name, + domain_name: topic.domain_name, + }), + ); + } + + const source = + keywords ?? + (topics ?? []) + .map((topic) => topic.source_keyword) + .filter((keyword): keyword is string => !!keyword); + + const seen = new Set(); + const result: KeywordColor[] = []; + + for (const keyword of source) { + const key = keyword.toLowerCase(); + const color = colorByKeyword.get(key); + if (!color || seen.has(key)) { + continue; + } + seen.add(key); + result.push({ keyword, color }); + } + + return result; +} + +const WORD_CHAR = '[\\w\\u00C0-\\u024F]'; + +/** + * Escapes `text` and wraps every occurrence of a keyword in a `` carrying + * the keyword's topic colour in `--t`. + */ +export function highlightKeywords( + text: string, + keywordColors: readonly KeywordColor[], +): string { + const sorted = [...keywordColors] + .filter(({ keyword }) => keyword.trim()) + .sort((a, b) => b.keyword.length - a.keyword.length); + + if (!sorted.length) { + return escapeHtml(text); + } + + // Acronyms are matched exactly, everything else may carry an inflection + // ("Gründung" also marks "Gründungen"). + const alternatives = sorted.map(({ keyword }) => + isAcronymLike(keyword) + ? `${escapeRegex(keyword)}(?!${WORD_CHAR})` + : `${escapeRegex(keyword)}${WORD_CHAR}*`, + ); + const pattern = new RegExp( + `(? + matched.toLowerCase().startsWith(keyword.toLowerCase()), + ); + if (!entry) { + continue; + } + + html += escapeHtml(text.slice(lastIndex, match.index)); + html += + `${escapeHtml(matched)}`; + + lastIndex = match.index + matched.length; + } + + return html + escapeHtml(text.slice(lastIndex)); +} + +export function escapeHtml(text: string): string { + return text + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"'); +} + +function escapeRegex(text: string): string { + return text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} + +function isAcronymLike(keyword: string): boolean { + return ( + keyword.length <= 3 || + (keyword === keyword.toUpperCase() && keyword !== keyword.toLowerCase()) + ); +} diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index 6d39dd4b..1655ff86 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -627,3 +627,44 @@ html.dark-theme { flex-shrink: 0; transition: transform 0.3s ease; } + +/* Keyword highlight */ +@keyframes kw-flash { + 0% { + background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); + } + 40% { + background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); + } + 100% { + background: transparent; + } +} + +.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; + } +} + +.search-mark { + background: transparent; + color: var(--sg-blue-highlight); + font-weight: 700; +} -- 2.56.1 From bd581e60049ae73a30efacb654116bb5706c1b53 Mon Sep 17 00:00:00 2001 From: "noemi.kallweit" Date: Sat, 15 Aug 2026 15:27:31 +0200 Subject: [PATCH 2/4] refactor(news-keyword-search): refactor keyword highlighting to show tooltips --- .../news-results/news-results.component.html | 19 +++- .../news-results/news-results.component.scss | 17 ++- .../news-results/news-results.component.ts | 73 ++++++++---- .../app/resolvers/utils/keyword-highlight.ts | 104 ++++++++++++++---- webapp/src/styles.scss | 7 +- 5 files changed, 166 insertions(+), 54 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html index b054c67b..c9c04f61 100644 --- a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html +++ b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.html @@ -72,9 +72,24 @@
- @if (snippetHtml().get(article.id); as snippet) { + @if (snippetSegments().get(article.id); as segments) { Fundstelle im Artikel - +

+ @for (segment of segments; track $index) { + @if (segment.isSearchMatch) { + {{ segment.text }} + } @else { + {{ segment.text }} + } + } +

} @else { Für diesen Artikel liegt keine Textstelle zu den gesuchten Keywords diff --git a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss index 1f618a6f..c21d48b3 100644 --- a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss +++ b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss @@ -151,14 +151,29 @@ text-transform: uppercase; } -/* .kw-mark / .search-mark inside are styled globally in styles.scss. */ .snippet { + margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--sg-text-secondary); overflow-wrap: anywhere; } +.snippet-mark { + background: transparent; + color: var(--sg-blue-highlight); + font-weight: 700; + cursor: help; + + &.has-topic { + color: var(--t); + text-decoration: underline; + text-decoration-color: var(--t); + text-decoration-thickness: 2px; + text-underline-offset: 2px; + } +} + .date-text { white-space: nowrap; } diff --git a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.ts b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.ts index 27d1a15a..b3b84983 100644 --- a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.ts +++ b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.ts @@ -9,7 +9,6 @@ import { viewChild, } from '@angular/core'; import { ActivatedRoute, Router, RouterModule } from '@angular/router'; -import { DomSanitizer, SafeHtml } from '@angular/platform-browser'; import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop'; import { MatButtonModule } from '@angular/material/button'; @@ -34,13 +33,20 @@ import { keywordsNewsQueryParamKeys } from '../../../../resolvers/keywords-news- import { SearchResultsStateService } from '../search-results-state.service'; import { YearRangeSliderComponent } from '../../../../shared/ui/year-range-slider/year-range-slider.component'; import { - escapeHtml, - highlightKeywords, + keywordTooltip, + splitByKeywords, topicKeywordColors, } from '../../../../resolvers/utils/keyword-highlight'; type NewsResult = NewsPage['results'][number]; +interface SnippetSegment { + text: string; + color: string | null; + tooltip: string | null; + isSearchMatch: boolean; +} + @Component({ selector: 'app-news-results', imports: [ @@ -66,7 +72,6 @@ export class KeywordsToNewsResultsComponent { private readonly route = inject(ActivatedRoute); private readonly router = inject(Router); private readonly destroyRef = inject(DestroyRef); - private readonly sanitizer = inject(DomSanitizer); newsPage = input.required(); @@ -242,48 +247,70 @@ export class KeywordsToNewsResultsComponent { return this.dataTable()?.expandedElement() === article; } - readonly snippetHtml = computed(() => { - const byArticleId = new Map(); + readonly snippetSegments = computed(() => { + const byArticleId = new Map(); for (const article of this.elements()) { - const html = this.buildSnippetHtml(article); - if (html !== null) { - byArticleId.set( - article.id, - this.sanitizer.bypassSecurityTrustHtml(html), - ); + const segments = this.buildSnippetSegments(article); + if (segments.length) { + byArticleId.set(article.id, segments); } } return byArticleId; }); - private buildSnippetHtml(article: NewsResult): string | null { + private buildSnippetSegments(article: NewsResult): SnippetSegment[] { const snippet = article.snippet; if (!snippet) { - return null; + return []; } const keywordColors = topicKeywordColors(article.topics); const searchMatch = /([\s\S]*?)<\/em>/g; - let html = ''; + const segments: SnippetSegment[] = []; let lastIndex = 0; let match: RegExpExecArray | null; + const pushPlain = (raw: string) => { + const text = this.decodeHtml(raw); + if (text) { + segments.push({ + text, + color: null, + tooltip: null, + isSearchMatch: false, + }); + } + }; + while ((match = searchMatch.exec(snippet)) !== null) { - html += escapeHtml( - this.decodeHtml(snippet.slice(lastIndex, match.index)), - ); - html += `${highlightKeywords( - this.decodeHtml(match[1]), - keywordColors, - )}`; + pushPlain(snippet.slice(lastIndex, match.index)); + + const term = this.decodeHtml(match[1]); + const parts = splitByKeywords(term, keywordColors); + const hasTopic = parts.some((part) => part.match); + + for (const part of parts) { + segments.push({ + text: part.text, + color: part.match?.color ?? null, + tooltip: part.match + ? keywordTooltip(part.match.keyword, part.match.topicNames) + : hasTopic + ? null + : keywordTooltip(term, []), + isSearchMatch: true, + }); + } lastIndex = searchMatch.lastIndex; } - return html + escapeHtml(this.decodeHtml(snippet.slice(lastIndex))); + pushPlain(snippet.slice(lastIndex)); + + return segments; } private decodeHtml(value: string): string { diff --git a/webapp/src/app/resolvers/utils/keyword-highlight.ts b/webapp/src/app/resolvers/utils/keyword-highlight.ts index e261e496..b22ec493 100644 --- a/webapp/src/app/resolvers/utils/keyword-highlight.ts +++ b/webapp/src/app/resolvers/utils/keyword-highlight.ts @@ -1,10 +1,11 @@ import { MatchedTopic } from '../../api'; import { topicHierarchyColor } from './topic-colors'; -/** A keyword together with the colour of the topic it resolved to. */ +/** A keyword together with the colour and names of the topics it resolved to. */ export interface KeywordColor { keyword: string; color: string; + topicNames: string[]; } /** Pairs every keyword that resolved to a topic with that topic's colour. */ @@ -12,22 +13,33 @@ export function topicKeywordColors( topics: readonly MatchedTopic[] | null | undefined, keywords?: readonly string[] | null, ): KeywordColor[] { - const colorByKeyword = new Map(); + const byKeyword = new Map>(); for (const topic of topics ?? []) { if (!topic.source_keyword) { continue; } - colorByKeyword.set( - topic.source_keyword.toLowerCase(), - topicHierarchyColor({ + const key = topic.source_keyword.toLowerCase(); + const topicName = topic.display_name?.trim(); + const existing = byKeyword.get(key); + + if (existing) { + if (topicName && !existing.topicNames.includes(topicName)) { + existing.topicNames.push(topicName); + } + continue; + } + + byKeyword.set(key, { + color: topicHierarchyColor({ id: topic.id, name: topic.display_name, field_name: topic.field_name, domain_name: topic.domain_name, }), - ); + topicNames: topicName ? [topicName] : [], + }); } const source = @@ -41,33 +53,52 @@ export function topicKeywordColors( for (const keyword of source) { const key = keyword.toLowerCase(); - const color = colorByKeyword.get(key); - if (!color || seen.has(key)) { + const entry = byKeyword.get(key); + if (!entry || seen.has(key)) { continue; } seen.add(key); - result.push({ keyword, color }); + result.push({ keyword, ...entry }); } return result; } +/** Explains, for a mark in the text, which topics its keyword is assigned to. */ +export function keywordTooltip( + keyword: string, + topicNames: readonly string[], +): string { + if (!topicNames.length) { + return `„${keyword}“ ist keinem der aufgelisteten Themen zugeordnet.`; + } + + if (topicNames.length === 1) { + return `„${keyword}“ ist dem Thema „${topicNames[0]}“ zugeordnet.`; + } + + const names = topicNames.map((name) => `„${name}“`).join(', '); + return `„${keyword}“ ist den Themen ${names} zugeordnet.`; +} + const WORD_CHAR = '[\\w\\u00C0-\\u024F]'; -/** - * Escapes `text` and wraps every occurrence of a keyword in a `` carrying - * the keyword's topic colour in `--t`. - */ -export function highlightKeywords( +export const KW_MARK_CLASS = 'kw-mark'; + +export interface KeywordSegment { + text: string; + match: KeywordColor | null; +} +export function splitByKeywords( text: string, keywordColors: readonly KeywordColor[], -): string { +): KeywordSegment[] { const sorted = [...keywordColors] .filter(({ keyword }) => keyword.trim()) .sort((a, b) => b.keyword.length - a.keyword.length); if (!sorted.length) { - return escapeHtml(text); + return text ? [{ text, match: null }] : []; } // Acronyms are matched exactly, everything else may carry an inflection @@ -82,10 +113,16 @@ export function highlightKeywords( 'gi', ); - let html = ''; + const segments: KeywordSegment[] = []; let lastIndex = 0; let match: RegExpExecArray | null; + const pushPlain = (value: string) => { + if (value) { + segments.push({ text: value, match: null }); + } + }; + while ((match = pattern.exec(text)) !== null) { const matched = match[0]; const entry = sorted.find(({ keyword }) => @@ -95,15 +132,38 @@ export function highlightKeywords( continue; } - html += escapeHtml(text.slice(lastIndex, match.index)); - html += - `${escapeHtml(matched)}`; + pushPlain(text.slice(lastIndex, match.index)); + segments.push({ text: matched, match: entry }); lastIndex = match.index + matched.length; } - return html + escapeHtml(text.slice(lastIndex)); + pushPlain(text.slice(lastIndex)); + + return segments; +} + +export function highlightKeywords( + text: string, + keywordColors: readonly KeywordColor[], +): string { + return splitByKeywords(text, keywordColors) + .map(({ text: value, match }) => { + if (!match) { + return escapeHtml(value); + } + + const tooltip = escapeHtml( + keywordTooltip(match.keyword, match.topicNames), + ); + + return ( + `` + + `${escapeHtml(value)}` + ); + }) + .join(''); } export function escapeHtml(text: string): string { diff --git a/webapp/src/styles.scss b/webapp/src/styles.scss index 1655ff86..05b08f35 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -652,6 +652,7 @@ html.dark-theme { font-weight: inherit; border-radius: 2px; padding: 0 1px; + cursor: help; transition: background 0.15s; &:hover { @@ -662,9 +663,3 @@ html.dark-theme { animation: kw-flash 2.4s ease-out forwards; } } - -.search-mark { - background: transparent; - color: var(--sg-blue-highlight); - font-weight: 700; -} -- 2.56.1 From da9516331ef0572719f8f3f447cc3ee0dbc3cd58 Mon Sep 17 00:00:00 2001 From: "noemi.kallweit" Date: Sat, 15 Aug 2026 20:05:54 +0200 Subject: [PATCH 3/4] feat(news-keyword-search): align table content to the left --- .../search-results/news-results/news-results.component.scss | 6 ------ 1 file changed, 6 deletions(-) diff --git a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss index c21d48b3..117b1e3a 100644 --- a/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss +++ b/webapp/src/app/modules/keywords-search/search-results/news-results/news-results.component.scss @@ -76,12 +76,6 @@ } ::ng-deep .table-wrap { - .mat-column-date, - .mat-column-relevant, - .mat-mdc-header-cell { - text-align: center; - } - .mat-column-topics { overflow: visible; } -- 2.56.1 From ef2ea4688248135b3b786157cef8e83dca81dfa3 Mon Sep 17 00:00:00 2001 From: "noemi.kallweit" Date: Sat, 15 Aug 2026 20:48:39 +0200 Subject: [PATCH 4/4] refactor(news): move keyword highlighting back to news details --- .../news-detail/news-detail.component.scss | 35 ++++++++++++++++++ webapp/src/styles.scss | 36 ------------------- 2 files changed, 35 insertions(+), 36 deletions(-) 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 a3aaa6c7..4b091f89 100644 --- a/webapp/src/app/modules/news-detail/news-detail.component.scss +++ b/webapp/src/app/modules/news-detail/news-detail.component.scss @@ -586,3 +586,38 @@ main { --topic-bg: color-mix(in srgb, var(--sg-error) 8%, var(--sg-color-mix-base)); --topic-color: var(--sg-error); } + +@keyframes kw-flash { + 0% { + background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); + } + 40% { + background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); + } + 100% { + 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; + cursor: help; + 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/styles.scss b/webapp/src/styles.scss index 05b08f35..6d39dd4b 100644 --- a/webapp/src/styles.scss +++ b/webapp/src/styles.scss @@ -627,39 +627,3 @@ html.dark-theme { flex-shrink: 0; transition: transform 0.3s ease; } - -/* Keyword highlight */ -@keyframes kw-flash { - 0% { - background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); - } - 40% { - background: color-mix(in srgb, var(--t) 45%, var(--sg-color-mix-base)); - } - 100% { - background: transparent; - } -} - -.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; - cursor: help; - 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; - } -} -- 2.56.1