Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should be shown again, when pressing Escape in ace editor', () => {
const textarea = element.find('textarea');
const hint = element.find('.kbnUiAceKeyboardHint');
sinon.spy(hint[0], 'focus');
const ev = angular.element.Event('keydown'); // eslint-disable-line new-cap
ev.keyCode = keyCodes.ESCAPE;
textarea.trigger(ev);
expect(hint[0].focus.called).to.be(true);
expect(hint.hasClass('kbnUiAceKeyboardHint-isInactive')).to.be(false);
});
});
it('should be shown again, when pressing Escape in ace editor', () => {
const textarea = element.find('textarea');
const hint = element.find('.kbnUiAceKeyboardHint');
sinon.spy(hint[0], 'focus');
const ev = angular.element.Event('keydown'); // eslint-disable-line new-cap
ev.keyCode = keyCodes.ESCAPE;
textarea.trigger(ev);
expect(hint[0].focus.called).to.be(true);
expect(hint.hasClass('kbnUiAceKeyboardHint-isInactive')).to.be(false);
});
});
uiAceTextbox.keydown(ev => {
if (ev.keyCode === keyCodes.ESCAPE) {
// If the autocompletion context menu is open then we want to let ESC close it but
// **not** exit out of editing mode.
if (!isAutoCompleterOpen) {
ev.preventDefault();
ev.stopPropagation();
enableOverlay();
hint.focus();
}
}
});
onFieldKeyDown = ({ keyCode }) => {
if (keyCode === keyCodes.ENTER) {
this.saveEdit();
}
if (keyCode === keyCodes.ESCAPE) {
this.cancelEdit();
}
}
onFieldKeyDown = ({ keyCode }) => {
if (keyCode === keyCodes.ENTER) {
this.saveEdit();
}
if (keyCode === keyCodes.ESCAPE) {
this.cancelEdit();
}
}
onFieldEscape = ({ keyCode }) => {
if (keyCode === keyCodes.ESCAPE) {
this.cancelEdit();
}
}
onEditFieldKeyDown = ({ keyCode }) => {
if (keyCodes.ENTER === keyCode) {
this.props.saveFilter({
filterId: this.state.editingFilterId,
newFilterValue: this.state.editingFilterValue,
});
this.stopEditingFilter();
}
if (keyCodes.ESCAPE === keyCode) {
this.stopEditingFilter();
}
};
$scope.onLegendEntryKeydown = function (event, scope) {
if (event.keyCode === keyCodes.ESCAPE && scope.showDetails) {
event.preventDefault();
event.stopPropagation();
scope.showDetails = false;
}
};
public onKeyDown = (e: KeyboardEvent) => {
if (e.keyCode === keyCodes.ESCAPE) {
this.props.onExitFullScreenMode();
}
};
onEditFieldKeyDown = ({ keyCode }) => {
if (keyCodes.ENTER === keyCode) {
this.props.saveFilter({
filterId: this.state.editingFilterId,
newFilterValue: this.state.editingFilterValue,
});
this.stopEditingFilter();
}
if (keyCodes.ESCAPE === keyCode) {
this.stopEditingFilter();
}
};