From 490c346fcf7c8dc9ec0705e9b5cb4dabd5ddf2f8 Mon Sep 17 00:00:00 2001 From: arknu Date: Tue, 25 Mar 2014 19:34:19 +0100 Subject: [PATCH] U4-3744: Make it possible to make individual selections while still selecting the entire text on first click --- .../utill/selectOnFocus.directive.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/utill/selectOnFocus.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/utill/selectOnFocus.directive.js index 4e2809f4dd..e89ab5f70c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/utill/selectOnFocus.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/utill/selectOnFocus.directive.js @@ -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); }); }; }); \ No newline at end of file