U4-3744: Make it possible to make individual selections while still selecting the entire text on first click

This commit is contained in:
arknu
2014-03-25 19:34:19 +01:00
parent 8f1d8419a0
commit 490c346fcf

View File

@@ -1,8 +1,22 @@
angular.module("umbraco.directives")
.directive('selectOnFocus', function () {
return function (scope, el, attrs) {
$(el).bind("click", function(){
this.select();
$(el).bind("click", function () {
var editmode = $(el).data("editmode");
if (editmode)
{
//Do nothing in this case
}
else {
//initial click
this.select();
//Set the edit mode so subsequent clicks work normally
$(el).data("editmode", true)
}
}).
bind("blur", function () {
//reset on blur
$(el).data("editmode", false);
});
};
});