diff --git a/client/src/views/note/fields/post.js b/client/src/views/note/fields/post.js index bb6218c013..b25239b134 100644 --- a/client/src/views/note/fields/post.js +++ b/client/src/views/note/fields/post.js @@ -44,16 +44,19 @@ Espo.define('views/note/fields/post', ['views/fields/text', 'lib!Textcomplete'], Dep.prototype.setup.call(this); }, - controlTextareaHeight: function () { + controlTextareaHeight: function (lastHeight) { var scrollHeight = this.$element.prop('scrollHeight'); var clientHeight = this.$element.prop('clientHeight'); - if (this.$element.prop('scrollHeight') > clientHeight + 2) { - this.$element.prop('rows', this.$element.prop('rows') + 1); - this.controlTextareaHeight(); + + if (clientHeight === lastHeight) return; + + if (scrollHeight > clientHeight) { + this.$element.attr('rows', this.$element.prop('rows') + 1); + this.controlTextareaHeight(clientHeight); } if (this.$element.val().length === 0) { - this.$element.prop('rows', 1); + this.$element.attr('rows', 1); } }, diff --git a/client/src/views/stream/panel.js b/client/src/views/stream/panel.js index 9010f55b7d..cf4bc598a7 100644 --- a/client/src/views/stream/panel.js +++ b/client/src/views/stream/panel.js @@ -78,15 +78,18 @@ Espo.define('views/stream/panel', ['views/record/panels/relationship', 'lib!Text return data; }, - controlTextareaHeight: function () { + controlTextareaHeight: function (lastHeight) { var scrollHeight = this.$textarea.prop('scrollHeight'); var clientHeight = this.$textarea.prop('clientHeight'); - if (this.$textarea.prop('scrollHeight') > clientHeight + 2) { - this.$textarea.prop('rows', this.$textarea.prop('rows') + 1); - this.controlTextareaHeight(); + + if (clientHeight === lastHeight) return; + + if (scrollHeight > clientHeight) { + this.$textarea.attr('rows', this.$textarea.prop('rows') + 1); + this.controlTextareaHeight(clientHeight); } if (this.$textarea.val().length === 0) { - this.$textarea.prop('rows', 1); + this.$textarea.attr('rows', 1); } },