From ba7713fb93a52bf903c7fd7df7d20f80c7c9fcec Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 9 Oct 2013 19:53:29 +1100 Subject: [PATCH] Auto selects all text in the header if it is still empty --- .../directives/editors/umbcontentname.directive.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js index 59b8eb65d1..1a8839171d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js @@ -19,6 +19,8 @@ angular.module("umbraco.directives") }, link: function(scope, element, attrs, ngModel) { + var inputElement = element.find("input"); + ngModel.$render = function(){ $timeout(function(){ if(!scope.model){ @@ -29,8 +31,11 @@ angular.module("umbraco.directives") scope.goEdit = function(){ scope.editMode = true; - $timeout(function(){ - element.find("input").focus(); + $timeout(function () { + inputElement.focus(); + if (inputElement.val() === "Empty...") { + inputElement.select(); + } }, 100); };