From c4f779b1d537eb4660cbb25f4e3a29d6d71d471c Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 28 Aug 2018 13:45:28 +0200 Subject: [PATCH] MOBILE-2567 core: Fix descriptions not shortened in dashboard --- src/directives/format-text.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/directives/format-text.ts b/src/directives/format-text.ts index b4bec6d50..ded8c96d9 100644 --- a/src/directives/format-text.ts +++ b/src/directives/format-text.ts @@ -272,6 +272,14 @@ export class CoreFormatTextDirective implements OnChanges { return; } + // In AOT the inputs and ng-reflect aren't in the DOM sometimes. Add them so styles are applied. + if (this.maxHeight && !this.element.getAttribute('maxHeight')) { + this.element.setAttribute('maxHeight', String(this.maxHeight)); + } + if (!this.element.getAttribute('singleLine')) { + this.element.setAttribute('singleLine', String(this.utils.isTrueOrOne(this.singleLine))); + } + this.text = this.text ? this.text.trim() : ''; this.formatContents().then((div: HTMLElement) => { @@ -281,11 +289,6 @@ export class CoreFormatTextDirective implements OnChanges { this.element.innerHTML = ''; // Remove current contents. if (this.maxHeight && div.innerHTML != '') { - // For some reason, in iOS the inputs and ng-reflect aren't in the DOM sometimes. Add it so styles are applied. - if (!this.element.getAttribute('maxHeight')) { - this.element.setAttribute('maxHeight', String(this.maxHeight)); - } - // Move the children to the current element to be able to calculate the height. this.domUtils.moveChildren(div, this.element);