<commit_before>import Handsontable from './../browser';
import {stringify} from './../helpers/mixed';
import {WalkontableCellCoords} from './../3rdparty/walkontable/src/cell/coords';

export {BaseEditor};

Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.BaseEditor = BaseEditor;

Handsontable.EditorState = {
  VIRGIN: 'STATE_VIRGIN', //before editing
  EDITING: 'STATE_EDITING',
  WAITING: 'STATE_WAITING', //waiting for async validation
  FINISHED: 'STATE_FINISHED'
};

function BaseEditor(instance) {
  this.instance = instance;
  this.state = Handsontable.EditorState.VIRGIN;

  this._opened = false;
  this._fullEditMode = false;
  this._closeCallback = null;

  this.init();
}

BaseEditor.prototype._fireCallbacks = function(result) {
  if (this._closeCallback) {
    this._closeCallback(result);
    this._closeCallback = null;
  }
};

BaseEditor.prototype.init = function() {};

BaseEditor.prototype.getValue = function() {
  throw Error('Editor getValue() method unimplemented');
};

BaseEditor.prototype.setValue = function(newValue) {
  throw Error('Editor setValue() method unimplemented');
};

BaseEditor.prototype.open = function() {
  throw Error('Editor open() method unimplemented');
};

BaseEditor.prototype.close = function() {
  throw Error('Editor close() method unimplemented');
};

BaseEditor.prototype.prepare = function(row, col, prop, td, originalValue, cellProperties) {
  this.TD = td;
  this.row = row;
  this.col = col;
  this.prop = prop;
  this.originalValue = originalValue;
  this.cellProperties = cellProperties;

  let ieIframeDocument = !document.activeElement || (document.activeElement && document.activeElement.nodeName === void 0);

  console.log(document.activeElement, ' - ', document.activeElement.nodeName);
  if (this.instance.view.isMouseDown() && document.activeElement && document.activeElement !== document.body && !ieIframeDocument) {
    document.activeElement.blur();

  } else if (ieIframeDocument) { //IE
    document.body.focus();
  }

  this.state = Handsontable.EditorState.VIRGIN;
};

BaseEditor.prototype.extend = function() {
  var baseClass = this.constructor;<commit_msg>Fix: remove console.log. Change: rename ieIframeDocument to invalidActiveElement. #3938<commit_after>import Handsontable from './../browser';
import {stringify} from './../helpers/mixed';
import {WalkontableCellCoords} from './../3rdparty/walkontable/src/cell/coords';

export {BaseEditor};

Handsontable.editors = Handsontable.editors || {};
Handsontable.editors.BaseEditor = BaseEditor;

Handsontable.EditorState = {
  VIRGIN: 'STATE_VIRGIN', //before editing
  EDITING: 'STATE_EDITING',
  WAITING: 'STATE_WAITING', //waiting for async validation
  FINISHED: 'STATE_FINISHED'
};

function BaseEditor(instance) {
  this.instance = instance;
  this.state = Handsontable.EditorState.VIRGIN;

  this._opened = false;
  this._fullEditMode = false;
  this._closeCallback = null;

  this.init();
}

BaseEditor.prototype._fireCallbacks = function(result) {
  if (this._closeCallback) {
    this._closeCallback(result);
    this._closeCallback = null;
  }
};

BaseEditor.prototype.init = function() {};

BaseEditor.prototype.getValue = function() {
  throw Error('Editor getValue() method unimplemented');
};

BaseEditor.prototype.setValue = function(newValue) {
  throw Error('Editor setValue() method unimplemented');
};

BaseEditor.prototype.open = function() {
  throw Error('Editor open() method unimplemented');
};

BaseEditor.prototype.close = function() {
  throw Error('Editor close() method unimplemented');
};

BaseEditor.prototype.prepare = function(row, col, prop, td, originalValue, cellProperties) {
  this.TD = td;
  this.row = row;
  this.col = col;
  this.prop = prop;
  this.originalValue = originalValue;
  this.cellProperties = cellProperties;

  let invalidActiveElement = !document.activeElement || (document.activeElement && document.activeElement.nodeName === void 0);

  if (this.instance.view.isMouseDown() && document.activeElement && document.activeElement !== document.body && !invalidActiveElement) {
    document.activeElement.blur();

  } else if (invalidActiveElement) { //IE
    document.body.focus();
  }

  this.state = Handsontable.EditorState.VIRGIN;
};

BaseEditor.prototype.extend = function() {
  var baseClass = this.constructor;
{'fraction_non_alphanumeric': 0.13694193846865602, 'fraction_numerical': 0.0018505667360629193, 'mean_word_length': 4.8432432432432435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6857206', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1291, 'n_words': 265}