From 6747d154d9021ae5ba8e35835961f57c6f44d354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Tue, 10 Dec 2024 09:26:52 +0100 Subject: [PATCH] MOBILE-4653 core: Deprecate unused hideIfEmpty on format-text --- src/core/directives/format-text.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core/directives/format-text.ts b/src/core/directives/format-text.ts index 1e8035b5d..04d9faff9 100644 --- a/src/core/directives/format-text.ts +++ b/src/core/directives/format-text.ts @@ -92,20 +92,25 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec @Input({ transform: toBoolean }) wsNotFiltered = false; // If true it means the WS didn't filter the text for some reason. @Input({ transform: toBoolean }) captureLinks = true; // Whether links should tried to be opened inside the app. @Input({ transform: toBoolean }) openLinksInApp = false; // Whether links should be opened in InAppBrowser. - @Input({ transform: toBoolean }) hideIfEmpty = false; // If true, the tag will contain nothing if text is empty. @Input({ transform: toBoolean }) disabled = false; // If disabled, autoplay elements will be disabled. + /** + * @deprecated since 5.0. Not used anymore. + */ + @Input() hideIfEmpty = false; // If true, the tag will contain nothing if text is empty. + @Output() afterRender = new EventEmitter(); // Called when the data is rendered. @Output() filterContentRenderingComplete = new EventEmitter(); // Called when the filters have finished rendering content. @Output() onClick: EventEmitter = new EventEmitter(); // Called when clicked. protected element: HTMLElement; protected elementControllers: ElementController[] = []; - protected emptyText = ''; protected domPromises: CoreCancellablePromise[] = []; protected domElementPromise?: CoreCancellablePromise; protected externalContentInstances: CoreExternalContentDirective[] = []; + protected static readonly EMPTY_TEXT = ' '; + constructor( element: ElementRef, protected viewContainerRef: ViewContainerRef, @@ -116,8 +121,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec this.element = element.nativeElement; this.element.classList.add('core-loading'); // Hide contents until they're treated. - this.emptyText = this.hideIfEmpty ? '' : ' '; - this.element.innerHTML = this.emptyText; + this.element.innerHTML = CoreFormatTextDirective.EMPTY_TEXT; this.element.addEventListener('click', (event) => this.elementClicked(event)); } @@ -365,7 +369,7 @@ export class CoreFormatTextDirective implements OnChanges, OnDestroy, AsyncDirec this.externalContentInstances = []; if (!this.text) { - this.element.innerHTML = this.emptyText; // Remove current contents. + this.element.innerHTML = CoreFormatTextDirective.EMPTY_TEXT; // Remove current contents. await this.finishRender();