"use strict";

exports.__esModule = true;
var _event = require("../../../helpers/dom/event");
const command = {
  name: 'editorOpen',
  callback(hot, event, keys) {
    const editorManager = hot._getEditorManager();
    const {
      highlight
    } = hot.getSelectedRangeLast();
    if (highlight.isHeader()) {
      return;
    }
    if (hot.getSettings().enterBeginsEditing) {
      if (editorManager.cellProperties.readOnly) {
        editorManager.moveSelectionAfterEnter();
      } else {
        editorManager.openEditor(null, event, true);
      }
    } else {
      editorManager.moveSelectionAfterEnter(keys.includes('shift'));
    }
    (0, _event.stopImmediatePropagation)(event); // required by HandsontableEditor
  }
};
exports.command = command;