Skip to content

Commit

Permalink
fix(edit): selecting text no longer required on editor
Browse files Browse the repository at this point in the history
After implementing viewPortKeyPress, the selection of text is redundant
  • Loading branch information
swalters committed Aug 4, 2015
1 parent 65417da commit d609a10
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/features/edit/js/gridEdit.js
Expand Up @@ -785,14 +785,14 @@
if (!inEdit) {
return;
}

//sometimes the events can't keep up with the keyboard and grid focus is lost, so always focus
//back to grid here. The focus call needs to be before the $destroy and removal of the control,
//otherwise ng-model-options of UpdateOn: 'blur' will not work.
if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
uiGridCtrl.focus();
}

var gridCellContentsEl = angular.element($elm.children()[0]);
//remove edit element
editCellScope.$destroy();
Expand Down Expand Up @@ -874,7 +874,10 @@
$scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function (evt,triggerEvent) {
$timeout(function () {
$elm[0].focus();
$elm[0].select();
//only select text if it is not being replaced below in the cellNav viewPortKeyPress
if ($scope.col.colDef.enableCellEditOnFocus || !(uiGridCtrl && uiGridCtrl.grid.api.cellNav)) {
$elm[0].select();
}
});

//set the keystroke that started the edit event
Expand Down

0 comments on commit d609a10

Please sign in to comment.