diff options
Diffstat (limited to 'webclient/app-directive.js')
-rw-r--r-- | webclient/app-directive.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/webclient/app-directive.js b/webclient/app-directive.js index 75283598ab..d788475f46 100644 --- a/webclient/app-directive.js +++ b/webclient/app-directive.js @@ -40,4 +40,19 @@ angular.module('matrixWebClient') } } }; -}]); \ No newline at end of file +}]) +.directive('elastic', [ // http://stackoverflow.com/questions/17772260/textarea-auto-height + '$timeout', + function($timeout) { + return { + restrict: 'A', + link: function($scope, element) { + var resize = function() { + return element[0].style.height = "" + element[0].scrollHeight + "px"; + }; + element.on("blur keyup change", resize); + $timeout(resize, 10); + } + }; + } +]);; |