# all files / src/js/base/module/ Statusbar.js

55.56% Statements 15/27
37.5% Branches 3/8
57.14% Functions 4/7
55.56% Lines 15/27

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    431×
    1×

    1×
    1×
    96×
    96×
    96×
    96×

    97×
    96×

    96×

    1×
    2×
    2×

    1×
     import $ from 'jquery';
    const EDITABLE_PADDING = 24;

    export default class Statusbar {
      constructor(context) {
        this.$document = $(document);
        this.$statusbar = context.layoutInfo.statusbar;
        this.$editable = context.layoutInfo.editable;
        this.options = context.options;
      }

      initialize() {
        Iif (this.options.airMode || this.options.disableResizeEditor) {
          this.destroy();
          return;
        }

        this.$statusbar.on('mousedown', (event) => {
          event.preventDefault();
          event.stopPropagation();

          const editableTop = this.$editable.offset().top - this.$document.scrollTop();
          const onMouseMove = (event) => {
            let height = event.clientY - (editableTop + EDITABLE_PADDING);

            height = (this.options.minheight > 0) ? Math.max(height, this.options.minheight) : height;
            height = (this.options.maxHeight > 0) ? Math.min(height, this.options.maxHeight) : height;

            this.$editable.height(height);
          };

          this.$document.on('mousemove', onMouseMove).one('mouseup', () => {
            this.$document.off('mousemove', onMouseMove);
          });
        });
      }

      destroy() {
        this.$statusbar.off();
        this.$statusbar.addClass('locked');
      }
    }