Skip to content

Commit

Permalink
MOBILE-4653 core: Deprecate unused hideIfEmpty on format-text
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Dec 10, 2024
1 parent 09a2cd2 commit 6747d15
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/core/directives/format-text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(); // Called when the data is rendered.
@Output() filterContentRenderingComplete = new EventEmitter<void>(); // Called when the filters have finished rendering content.
@Output() onClick: EventEmitter<void> = new EventEmitter(); // Called when clicked.

protected element: HTMLElement;
protected elementControllers: ElementController[] = [];
protected emptyText = '';
protected domPromises: CoreCancellablePromise<void>[] = [];
protected domElementPromise?: CoreCancellablePromise<void>;
protected externalContentInstances: CoreExternalContentDirective[] = [];

protected static readonly EMPTY_TEXT = '&nbsp;';

constructor(
element: ElementRef,
protected viewContainerRef: ViewContainerRef,
Expand All @@ -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 ? '' : '&nbsp;';
this.element.innerHTML = this.emptyText;
this.element.innerHTML = CoreFormatTextDirective.EMPTY_TEXT;

this.element.addEventListener('click', (event) => this.elementClicked(event));
}
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 6747d15

Please sign in to comment.