From 0b89868ab00265897a31bdc2ca99e6953789a1f9 Mon Sep 17 00:00:00 2001 From: FrancescoMolinaro Date: Tue, 16 Dec 2025 16:54:41 +0100 Subject: [PATCH] [DURACOM-429] simplify truncatable calculation --- .../truncatable-part.component.ts | 22 ++++--------------- 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts index b5db493ffa9..074dadfde32 100644 --- a/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts +++ b/src/app/shared/truncatable/truncatable-part/truncatable-part.component.ts @@ -127,24 +127,10 @@ export class TruncatablePartComponent implements AfterViewChecked, OnInit, OnDes public truncateElement() { if (this.showToggle) { const entry = this.content.nativeElement; - if (entry.scrollHeight > entry.offsetHeight) { - if (entry.children.length > 0) { - if (entry.children[entry.children.length - 1].offsetHeight > entry.offsetHeight) { - entry.classList.add('truncated'); - entry.classList.remove('removeFaded'); - } else { - entry.classList.remove('truncated'); - entry.classList.add('removeFaded'); - } - } else { - if (entry.innerText.length > 0) { - entry.classList.add('truncated'); - entry.classList.remove('removeFaded'); - } else { - entry.classList.remove('truncated'); - entry.classList.add('removeFaded'); - } - } + const isOverflowing = entry.scrollHeight > entry.clientHeight; + if (isOverflowing) { + entry.classList.add('truncated'); + entry.classList.remove('removeFaded'); } else { entry.classList.remove('truncated'); entry.classList.add('removeFaded');