How to use the ember-keyboard.keyDown function in ember-keyboard

To help you get started, we’ve selected a few ember-keyboard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github linxmix / linx / app / components / mix-builder.js View on Github external
// optional params
  selectedTransition: null,
  selectedClip: null,

  // params
  selectedQuantizations: [BAR_QUANTIZATION],
  selectedQuantization: Ember.computed.reads('selectedQuantizations.firstObject'),
  mixVisualActionReceiver: null,
  store: Ember.inject.service(),

  followPlayhead: false,
  selectedAutomation: CONTROL_TYPE_VOLUME,
  newTrackPosition: null,

  _playpauseMix: Ember.on(keyDown('Space'), makeKeybinding(function(e) {
    this.send('playpause');
  })),

  _exitTransitionOnEscape: Ember.on(keyDown('Escape'), makeKeybinding(function(e) {
    this.send('selectTransition', null);
  })),

  _pauseMix: Ember.on('willDestroyElement', function() {
    this.send('pause');
  }),

  // repeatedely save mix, if any unsaved changes
  // _autoSaveMix: Ember.on('init', function() {
  //   if (!this.get('isDestroyed')) {
  //     const mix = this.get('mix');
github briarsweetbriar / ember-keyboard / tests / dummy / app / components / key-down-counter.js View on Github external
didInsertElement() {
    this._super(...arguments);

    this.on(keyDown('ArrowLeft'), makeEventHandler(-1));
    this.on(keyDown('ArrowRight'), makeEventHandler(1));
    this.on(keyDown('shift+ArrowLeft'), makeEventHandler(-10));
    this.on(keyDown('shift+ArrowRight'), makeEventHandler(10));
    this.on(keyDown('ctrl+shift+ArrowLeft'), makeEventHandler(-100));
    this.on(keyDown('ctrl+shift+ArrowRight'), makeEventHandler(100));

    this.on(keyUp('KeyR'), function() {
      this.set('counter', 0);
    });

    this.on(keyPress('Digit5'), function() {
      this.set('counter', 5);
    });
  }
github code-corps / code-corps-ember / app / components / modal-dialog.js View on Github external
import { on } from '@ember/object/evented';
import { set } from '@ember/object';
import ModalDialog from 'ember-modal-dialog/components/modal-dialog';
import {
  EKMixin as EmberKeyboardMixin,
  keyDown
} from 'ember-keyboard';

export default ModalDialog.extend(EmberKeyboardMixin, {
  init() {
    this._super(...arguments);

    set(this, 'keyboardActivated', true);
  },

  closeOnEsc: on(keyDown('Escape'), function() {
    this.sendAction('close');
  })
});
github code-corps / code-corps-ember / app / components / submittable-textarea.js View on Github external
import TextArea from '@ember/component/text-area';
import { on } from '@ember/object/evented';
import { EKMixin, EKOnFocusMixin, keyDown } from 'ember-keyboard';

export default TextArea.extend(EKMixin, EKOnFocusMixin, {
  init() {
    this._super(...arguments);
    this.set('keyboardActivated', true);
  },

  customSubmit: on(keyDown('Enter+cmd'), function(e) {
    e.preventDefault();
    this.sendAction('modifiedSubmit');
  })
});
github ember-learn / ember-cli-addon-docs / addon / components / docs-viewer / component.js View on Github external
export default Component.extend(EKMixin, {
  layout,
  docsRoutes: service(),
  router: service(),

  classNames: 'docs-viewer docs-flex docs-flex-1',

  keyboardActivated: true,

  willDestroyElement() {
    this._super(...arguments);

    this.get('docsRoutes').resetState();
  },

  nextPage: on(keyDown('KeyJ'), keyDown('ArrowRight'), function() {
    if (!formElementHasFocus()) {
      if (this.get('docsRoutes.next')) {
        this.get('router').transitionTo(...this.get('docsRoutes.next.route'));
      }
    }
  }),

  previousPage: on(keyDown('KeyK'), keyDown('ArrowLeft'), function() {
    if (!formElementHasFocus()) {
      if (this.get('docsRoutes.previous')) {
        this.get('router').transitionTo(...this.get('docsRoutes.previous.route'));
      }
    }
  }),

});
github briarsweetbriar / ember-letter-by-letter / addon / components / ember-lxl.js View on Github external
keys.forEach((key) => {
      this.on(keyDown(key), this._advanceText);
    });
  },
github HospitalRun / hospitalrun-frontend / app / admin / lookup / controller.js View on Github external
this.set('importFile');
            this.set('model.importFileName');
          });
        });
      });
    },

    _sortValues(a, b) {
      return compare(a.toLowerCase(), b.toLowerCase());
    },

    activateKeyboard: on('init', function() {
      this.set('keyboardActivated', true);
    }),

    updateListKeyboard: on(keyDown('ctrl+KeyS'), keyDown('cmd+KeyS'), function(event) {
      this.send('updateList');
      event.preventDefault();
    }),

    actions: {
      addValue() {
        this.send('openModal', 'admin.lookup.edit', EmberObject.create({
          isNew: true
        }));
      },
      confirmDeleteValue(value) {
        let intl = this.get('intl');
        let title = intl.t('admin.lookup.titles.deleteLookupValue');
        let message = intl.t('messages.delete', { name: value });
        this.displayConfirm(title, message, 'deleteValue', EmberObject.create({
          valueToDelete: value
github briarsweetbriar / ember-letter-by-letter / addon / lxl-tags / pause.js View on Github external
get(lxlContainer, 'keys').forEach((key) => {
        lxlContainer.off(keyDown(key), lxlContainer._advanceText);
        lxlContainer.on(keyDown(key), this, this._resolve);
      });