Welcome to mirror list, hosted at ThFree Co, Russian Federation.

autosize.js « behaviors « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3bea460dcc690b225b6adf3f35d58f09adda8926 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import autosize from 'vendor/autosize';

$(() => {
  const $fields = $('.js-autosize');

  $fields.on('autosize:resized', function resized() {
    const $field = $(this);
    $field.data('height', $field.outerHeight());
  });

  $fields.on('resize.autosize', function resize() {
    const $field = $(this);
    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');
});