diff --git a/UI/WebServerResources/js/Common/sgAutogrow.directive.js b/UI/WebServerResources/js/Common/sgAutogrow.directive.js
index b27e83b16..26f953558 100644
--- a/UI/WebServerResources/js/Common/sgAutogrow.directive.js
+++ b/UI/WebServerResources/js/Common/sgAutogrow.directive.js
@@ -18,8 +18,8 @@
*/
- sgAutogrow.$inject = ['$document', '$timeout'];
- function sgAutogrow($document, $timeout) {
+ sgAutogrow.$inject = ['$document', '$timeout', '$mdUtil'];
+ function sgAutogrow($document, $timeout, $mdUtil) {
return {
restrict: 'A',
scope: {
@@ -44,19 +44,17 @@
textarea.style.overflow = 'hidden';
function AutoGrowTextArea() {
- $timeout(function() {
- content = textarea.value.encodeEntities();
- content = content.replace(/\n/g, '
');
- hiddenDiv.innerHTML = content + '
';
- hiddenDiv.style.visibility = 'hidden';
- hiddenDiv.style.display = 'block';
- textarea.style.height = Math.max(minHeight, hiddenDiv.offsetHeight) + 'px';
- hiddenDiv.style.visibility = 'visible';
- hiddenDiv.style.display = 'none';
- });
+ content = textarea.value.encodeEntities();
+ content = content.replace(/\n/g, '
');
+ hiddenDiv.innerHTML = content + '
';
+ hiddenDiv.style.visibility = 'hidden';
+ hiddenDiv.style.display = 'block';
+ textarea.style.height = Math.max(minHeight, hiddenDiv.offsetHeight) + 'px';
+ hiddenDiv.style.visibility = 'visible';
+ hiddenDiv.style.display = 'none';
}
- elem.on('keyup', AutoGrowTextArea);
+ elem.on('keyup', $mdUtil.debounce(AutoGrowTextArea, 200));
elem.on('paste', AutoGrowTextArea);
var deregisterWatcher = scope.$watch(function() {