Skip to content

Commit

Permalink
fix(taBind): Fix cursor selection on focus
Browse files Browse the repository at this point in the history
Fixes #444
  • Loading branch information
SimeonC authored and SimeonC committed Dec 15, 2014
1 parent dd479a1 commit 05f15a5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/textAngular.min.js

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion lib/taBind.js
Expand Up @@ -445,11 +445,16 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
ngModel.$render();
});

element.on('mouseup', function(){
var _selection = taSelection.getSelection();
if(_selection.start.element === element[0]) taSelection.setSelectionToElementStart(element.children()[0]);
});

// prevent propagation on mousedown in editor, see #206
element.on('mousedown', function(event, eventData){
/* istanbul ignore else: this is for catching the jqLite testing*/
if(eventData) angular.extend(event, eventData);
event.stopPropagation();
event.stopPropagation();
});
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/textAngular.js
Expand Up @@ -1238,11 +1238,16 @@ angular.module('textAngular.taBind', ['textAngular.factories', 'textAngular.DOM'
ngModel.$render();
});

element.on('mouseup', function(){
var _selection = taSelection.getSelection();
if(_selection.start.element === element[0]) taSelection.setSelectionToElementStart(element.children()[0]);
});

// prevent propagation on mousedown in editor, see #206
element.on('mousedown', function(event, eventData){
/* istanbul ignore else: this is for catching the jqLite testing*/
if(eventData) angular.extend(event, eventData);
event.stopPropagation();
event.stopPropagation();
});
}
}
Expand Down
24 changes: 24 additions & 0 deletions test/taBind/taBind.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 05f15a5

Please sign in to comment.