Skip to content

Commit

Permalink
Fixed #7000 - p-textarea resize bug when used in an overlay + tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Jan 7, 2019
1 parent 525b5f0 commit 4f71387
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions src/app/components/inputtextarea/inputtextarea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,15 @@ export class InputTextarea implements DoCheck {
}

resize(event?: Event) {
if (!this.cachedScrollHeight) {
this.cachedScrollHeight = this.el.nativeElement.scrollHeight;
this.el.nativeElement.style.overflow = "hidden";
}

if (this.cachedScrollHeight != this.el.nativeElement.scrollHeight) {
this.el.nativeElement.style.height = ''
this.el.nativeElement.style.height = this.el.nativeElement.scrollHeight + 'px';
this.el.nativeElement.style.height = ''
this.el.nativeElement.style.height = this.el.nativeElement.scrollHeight + 'px';

if (parseFloat(this.el.nativeElement.style.height) >= parseFloat(this.el.nativeElement.style.maxHeight)) {
this.el.nativeElement.style.overflowY = "scroll";
this.el.nativeElement.style.height = this.el.nativeElement.style.maxHeight;
}
else {
this.el.nativeElement.style.overflow = "hidden";
}

this.cachedScrollHeight = this.el.nativeElement.scrollHeight;
if (parseFloat(this.el.nativeElement.style.height) >= parseFloat(this.el.nativeElement.style.maxHeight)) {
this.el.nativeElement.style.overflowY = "scroll";
this.el.nativeElement.style.height = this.el.nativeElement.style.maxHeight;
}
else {
this.el.nativeElement.style.overflow = "hidden";
}

this.onResize.emit(event||{});
Expand Down

0 comments on commit 4f71387

Please sign in to comment.