From 4f71387605cf6298116ed083fbd5848453a863d4 Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Mon, 7 Jan 2019 13:47:25 +0300 Subject: [PATCH] Fixed #7000 - p-textarea resize bug when used in an overlay + tabs --- .../components/inputtextarea/inputtextarea.ts | 25 ++++++------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/src/app/components/inputtextarea/inputtextarea.ts b/src/app/components/inputtextarea/inputtextarea.ts index c747db9f7ef..9279d9767a4 100644 --- a/src/app/components/inputtextarea/inputtextarea.ts +++ b/src/app/components/inputtextarea/inputtextarea.ts @@ -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||{});