mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-29 19:34:31 +00:00
17 lines
No EOL
390 B
CoffeeScript
17 lines
No EOL
390 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.directive "expandableTextArea", () ->
|
|
restrict: "A"
|
|
link: (scope, el) ->
|
|
resetHeight = () ->
|
|
curHeight = el.outerHeight()
|
|
fitHeight = el.prop("scrollHeight")
|
|
|
|
if fitHeight > curHeight and el.val() != ""
|
|
scope.$emit "expandable-text-area:resize"
|
|
el.css("height", fitHeight)
|
|
|
|
scope.$watch (() -> el.val()), resetHeight
|
|
|
|
|