overleaf/services/web/public/coffee/directives/expandableTextArea.coffee
2017-01-25 15:49:38 +01:00

16 lines
No EOL
277 B
CoffeeScript

define [
"base"
], (App) ->
App.directive "expandableTextArea", () ->
restrict: "A"
link: (scope, el) ->
resetHeight = () ->
el.css("height", "auto")
el.css("height", el.prop("scrollHeight"))
scope.$watch (() -> el.val()), resetHeight
resetHeight()