"use strict";

exports.__esModule = true;
exports.shortcutsEditorContext = shortcutsEditorContext;
var _constants = require("./constants");
var _commands = require("./commands");
/**
 * The context that defines a base shortcut list available for cells editors.
 *
 * @param {Handsontable} hot The Handsontable instance.
 */
function shortcutsEditorContext(hot) {
  var context = hot.getShortcutManager().addContext('editor');
  var commandsPool = (0, _commands.createKeyboardShortcutCommandsPool)(hot);
  var config = {
    group: _constants.EDITOR_EDIT_GROUP
  };
  context.addShortcuts([{
    keys: [['Enter'], ['Enter', 'Shift'], ['Enter', 'Control/Meta'], ['Enter', 'Control/Meta', 'Shift']],
    callback: function callback(event, keys) {
      return commandsPool.editorCloseAndSave(event, keys);
    }
  }, {
    keys: [['Escape'], ['Escape', 'Control/Meta']],
    callback: function callback() {
      return commandsPool.editorCloseWithoutSaving();
    }
  }], config);
}