Skip to content

Commit d609a10

Browse files
committed
fix(edit): selecting text no longer required on editor
After implementing viewPortKeyPress, the selection of text is redundant
1 parent 65417da commit d609a10

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/features/edit/js/gridEdit.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -785,14 +785,14 @@
785785
if (!inEdit) {
786786
return;
787787
}
788-
788+
789789
//sometimes the events can't keep up with the keyboard and grid focus is lost, so always focus
790790
//back to grid here. The focus call needs to be before the $destroy and removal of the control,
791791
//otherwise ng-model-options of UpdateOn: 'blur' will not work.
792792
if (uiGridCtrl && uiGridCtrl.grid.api.cellNav) {
793793
uiGridCtrl.focus();
794794
}
795-
795+
796796
var gridCellContentsEl = angular.element($elm.children()[0]);
797797
//remove edit element
798798
editCellScope.$destroy();
@@ -874,7 +874,10 @@
874874
$scope.$on(uiGridEditConstants.events.BEGIN_CELL_EDIT, function (evt,triggerEvent) {
875875
$timeout(function () {
876876
$elm[0].focus();
877-
$elm[0].select();
877+
//only select text if it is not being replaced below in the cellNav viewPortKeyPress
878+
if ($scope.col.colDef.enableCellEditOnFocus || !(uiGridCtrl && uiGridCtrl.grid.api.cellNav)) {
879+
$elm[0].select();
880+
}
878881
});
879882

880883
//set the keystroke that started the edit event

0 commit comments

Comments
 (0)