mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 15:33:04 +00:00
print commit
This commit is contained in:
@@ -1 +1,2 @@
|
||||
<span dsShave [shave]="{character: '...'}" [shaveHeight]="height | async" [innerHTML]="innerHTML"></span>
|
||||
<span dsShave [shave]="{character: '...'}" [shaveHeight]="styles.toString()" [innerHTML]="innerHTML"></span>
|
||||
{{print(styles)}}
|
@@ -11,16 +11,22 @@ import { NativeWindowRef, NativeWindowService } from '../window.service';
|
||||
selector: 'ds-truncatable',
|
||||
templateUrl: './truncatable.component.html'
|
||||
})
|
||||
export class TruncatableComponent implements AfterViewChecked {
|
||||
export class TruncatableComponent implements OnInit {
|
||||
|
||||
@Input() lines: Observable<number>;
|
||||
@Input() innerHTML;
|
||||
@Input() height: Observable<number>;
|
||||
styles: any;
|
||||
public constructor(private elementRef:ElementRef, @Inject(NativeWindowService) private _window: NativeWindowRef) { }
|
||||
|
||||
ngAfterViewChecked(): void {
|
||||
ngOnInit(): void {
|
||||
const lineHeight = this._window.nativeWindow.getComputedStyle(this.elementRef.nativeElement).lineHeight.replace('px', '');
|
||||
this.styles = this._window.nativeWindow.getComputedStyle(this.elementRef.nativeElement);
|
||||
this.height = this.lines.map((lines) => (lines * lineHeight)).startWith(0);
|
||||
this.height.subscribe((h) => console.log('height: ', h));
|
||||
this.print(this.styles);
|
||||
}
|
||||
|
||||
print(styles) {
|
||||
console.log(styles);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user