server/bo_client/app/mixins/cell-editing-mixin.js
author ymh <ymh.work@gmail.com>
Wed, 28 Sep 2016 15:58:18 +0200
changeset 305 ff6cf3fc5f40
parent 28 b0b56e0f8c7f
permissions -rw-r--r--
api reorganisation and propagation if the changes + some code cleaning

import Ember from 'ember';
import ClickOutsideMixin from 'bo-client/mixins/click-outside-mixin';

export default Ember.Mixin.create(ClickOutsideMixin, {
  isEditing: false,
  // override from ClickOutsideMixin
  onOutsideClickEnabled: Ember.computed.bool('isEditing'),

  onOutsideClick() {
    this.set('isEditing', false);
  },
  click() {
    var _this = this;
    setTimeout(() => {
      _this.set('isEditing', true);
    }, 200);
  },
  keyDown(event) {
    if(event.which === this.get('constants').KEY_CODES.ESCAPE) {
      this.set('isEditing', false);
    }
  },

});