Skip to content

Commit

Permalink
fix #5770: verify that the keyCode is greater than zero (#6380)
Browse files Browse the repository at this point in the history
* Update gridEdit.js

Verify that the keyCode is greater than zero.
#5770

* remove tabs

* code style

* code style
  • Loading branch information
DespotMagic authored and mportuga committed Sep 1, 2017
1 parent 84ea8fa commit 5ccd7f3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/features/edit/js/gridEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -963,8 +963,11 @@
if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
var viewPortKeyDownUnregister = uiGridCtrl.grid.api.cellNav.on.viewPortKeyPress($scope, function (evt, rowCol) {
if (uiGridEditService.isStartEditKey(evt)) {
ngModel.$setViewValue(String.fromCharCode( typeof evt.which === 'number' ? evt.which : evt.keyCode), evt);
ngModel.$render();
var code = typeof evt.which === 'number' ? evt.which : evt.keyCode;
if (code > 0) {
ngModel.$setViewValue(String.fromCharCode(code), evt);
ngModel.$render();
}
}
viewPortKeyDownUnregister();
});
Expand Down

0 comments on commit 5ccd7f3

Please sign in to comment.