import { EDITOR_EDIT_GROUP } from "./constants.mjs";
import { createKeyboardShortcutCommandsPool } from "./commands/index.mjs";
/**
 * The context that defines a base shortcut list available for cells editors.
 *
 * @param {Handsontable} hot The Handsontable instance.
 */
export function shortcutsEditorContext(hot) {
  var context = hot.getShortcutManager().addContext('editor');
  var commandsPool = createKeyboardShortcutCommandsPool(hot);
  var config = {
    group: 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);
}