46063: css attempt to fix multiline clamping

This commit is contained in:
Lotte Hofstede
2017-12-20 12:38:59 +01:00
parent eb2143d0a1
commit f381649112
11 changed files with 42 additions and 64 deletions

View File

@@ -1,28 +0,0 @@
import {
ChangeDetectorRef, Component, ElementRef, Inject, Input,
OnInit
} from '@angular/core';
import { NativeWindowRef, NativeWindowService } from '../window.service';
@Component({
selector: 'ds-truncatable',
templateUrl: './truncatable.component.html'
})
export class TruncatableComponent implements OnInit {
@Input() lines: number;
@Input() innerHTML;
height;
styles: any;
public constructor(private elementRef: ElementRef, @Inject(NativeWindowService) private _window: NativeWindowRef, private changeDetectorRef: ChangeDetectorRef) {
}
ngOnInit(): void {
this.styles = this._window.nativeWindow.getComputedStyle(this.elementRef.nativeElement);
setTimeout(() => {
this.height = this.styles.lineHeight.replace('px', '') * this.lines;
this.changeDetectorRef.detectChanges();
}, 0);
}
}