From d609a108402293f49220d1523a9089ddd390aa78 Mon Sep 17 00:00:00 2001 From: swalters Date: Tue, 4 Aug 2015 15:19:18 -0500 Subject: [PATCH] fix(edit): selecting text no longer required on editor After implementing viewPortKeyPress, the selection of text is redundant --- src/features/edit/js/gridEdit.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/features/edit/js/gridEdit.js b/src/features/edit/js/gridEdit.js index b4f209432d..195bf89ed8 100644 --- a/src/features/edit/js/gridEdit.js +++ b/src/features/edit/js/gridEdit.js @@ -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(); @@ -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