Files
standardnotes-app-web/app/assets/javascripts/app/services/directives/functional/selectOnClick.js
2017-01-27 19:39:10 -06:00

16 lines
457 B
JavaScript

angular
.module('app.frontend')
.directive('selectOnClick', ['$window', function ($window) {
return {
restrict: 'A',
link: function (scope, element, attrs) {
element.on('focus', function () {
if (!$window.getSelection().toString()) {
// Required for mobile Safari
this.setSelectionRange(0, this.value.length)
}
});
}
};
}]);