Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Editor.prototype.onInsertKey = function (event) {
if (this.editor.vimInUse) {
var currentState = monacoVim.VimMode.Vim.maybeInitVimState_(this.vimMode);
if (!currentState.insertMode) {
var insertEvent = {};
insertEvent.preventDefault = event.preventDefault;
insertEvent.stopPropagation = event.stopPropagation;
insertEvent.browserEvent = {};
insertEvent.browserEvent.key = 'i';
insertEvent.browserEvent.defaultPrevented = false;
insertEvent.keyCode = 39;
this.vimMode.handleKeyDown(insertEvent);
}
}
};
Editor.prototype.onEscapeKey = function () {
if (this.editor.vimInUse) {
var currentState = monacoVim.VimMode.Vim.maybeInitVimState_(this.vimMode);
if (currentState.insertMode) {
monacoVim.VimMode.Vim.exitInsertMode(this.vimMode);
} else if (currentState.visualMode) {
monacoVim.VimMode.Vim.exitVisualMode(this.vimMode, false);
}
}
};