diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js index 6f272f1ea271..0ac285c0949a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/editor/umbeditorheader.directive.js @@ -341,20 +341,19 @@ Use this directive to construct a header inside the main editor window. } } - scope.accessibility.a11yMessageVisible = !isEmptyOrSpaces(scope.accessibility.a11yMessage); - scope.accessibility.a11yNameVisible = !isEmptyOrSpaces(scope.accessibility.a11yName); + + scope.accessibility.a11yMessageVisible = !isNullOrWhitespace(scope.accessibility.a11yMessage); + scope.accessibility.a11yNameVisible = !isNullOrWhitespace(scope.accessibility.a11yName); }); } - - - function isEmptyOrSpaces(str) { - return str === null || str===undefined || str.trim ===''; + function isNullOrWhitespace(str) { + return str === null || str === undefined || str.trim() === ''; } function SetPageTitle(title) { - scope.$emit("$changeTitle", title); + scope.$emit("$changeTitle", title); } var unbindEventHandler = $rootScope.$on('$setAccessibleHeader', function (event, isNew, editorFor, nameLocked, name, contentTypeName, setTitle) { diff --git a/src/Umbraco.Web.UI.Client/src/utilities.js b/src/Umbraco.Web.UI.Client/src/utilities.js index 64884b589b9b..01e18e4e1cdc 100644 --- a/src/Umbraco.Web.UI.Client/src/utilities.js +++ b/src/Umbraco.Web.UI.Client/src/utilities.js @@ -71,28 +71,29 @@ const isScope = obj => obj && obj.$evalAsync && obj.$watch; const toJsonReplacer = (key, value) => { - var val = value; + var val = value; if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') { - val = undefined; + val = undefined; } else if (isWindow(value)) { - val = '$WINDOW'; - } else if (value && window.document === value) { - val = '$DOCUMENT'; + val = '$WINDOW'; + } else if (value && window.document === value) { + val = '$DOCUMENT'; } else if (isScope(value)) { - val = '$SCOPE'; - } + val = '$SCOPE'; + } return val; - } + }; + /** * Equivalent to angular.toJson */ const toJson = (obj, pretty) => { if (isUndefined(obj)) return undefined; if (!isNumber(pretty)) { - pretty = pretty ? 2 : null; + pretty = pretty ? 2 : null; } return JSON.stringify(obj, toJsonReplacer, pretty); - } + }; /** * Equivalent to angular.fromJson @@ -102,7 +103,7 @@ return val; } return JSON.parse(val); - } + }; /** * Not equivalent to angular.forEach. But like the angularJS method this does not fail on null or undefined. @@ -112,7 +113,7 @@ return obj.forEach(iterator); } return obj; - } + }; let _utilities = { noop: noop,