diff --git a/libs/shared/src/lib/components/widgets/common/html-widget-content/html-widget-content.component.ts b/libs/shared/src/lib/components/widgets/common/html-widget-content/html-widget-content.component.ts index 90150cd4f5..9a7859c6c0 100644 --- a/libs/shared/src/lib/components/widgets/common/html-widget-content/html-widget-content.component.ts +++ b/libs/shared/src/lib/components/widgets/common/html-widget-content/html-widget-content.component.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, Input } from '@angular/core'; +import { AfterViewInit, Component, ElementRef, Input } from '@angular/core'; import { SafeHtml } from '@angular/platform-browser'; /** @@ -13,7 +13,7 @@ import { SafeHtml } from '@angular/platform-browser'; // todo: enable // encapsulation: ViewEncapsulation.ShadowDom, }) -export class HtmlWidgetContentComponent { +export class HtmlWidgetContentComponent implements AfterViewInit { /** * HTML to render */ @@ -29,4 +29,25 @@ export class HtmlWidgetContentComponent { * @param {ElementRef} el Element reference */ constructor(public el: ElementRef) {} + + /** + * Script to fix bulletin and announcement text overlapping issue + */ + ngAfterViewInit(): void { + // Find the element with the class "text-overlapping-fix" + const overlappedElement: HTMLElement | null = + this.el.nativeElement.querySelector('.text-overlapping-fix'); + + // If the element exists, remove all inline styles from its children + if (overlappedElement) { + // Find all elements with the "style" attribute + const elementsWithStyle: NodeListOf = + overlappedElement.querySelectorAll('[style]'); + + // Iterate over the elements and remove the "style" attribute + elementsWithStyle.forEach((element: HTMLElement) => { + element.removeAttribute('style'); + }); + } + } }