debian-mirror-gitlab/app/assets/javascripts/behaviors/autosize.js.coffee

23 lines
512 B
CoffeeScript
Raw Normal View History

2016-02-05 20:25:01 +05:30
#= require jquery.ba-resize
#= require autosize
$ ->
2016-02-05 20:25:01 +05:30
$fields = $('.js-autosize')
$fields.on 'autosize:resized', ->
$field = $(@)
$field.data('height', $field.outerHeight())
$fields.on 'resize.autosize', ->
$field = $(@)
if $field.data('height') != $field.outerHeight()
$field.data('height', $field.outerHeight())
autosize.destroy($field)
$field.css('max-height', window.outerHeight)
autosize($fields)
autosize.update($fields)
$fields.css('resize', 'vertical')