From c68d7a33ca62855584bb56ef7ce988a16c6c0cc0 Mon Sep 17 00:00:00 2001 From: Bjarne Fyrstenborg Date: Mon, 14 Aug 2017 19:57:28 +0200 Subject: [PATCH] Fix maxchars javascript errors on macro parameter editors --- .../propertyeditors/textarea/textarea.controller.js | 13 ++++++++++++- .../propertyeditors/textbox/textbox.controller.js | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js index 2d4e114dcf..76a3ec2913 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textarea/textarea.controller.js @@ -1,4 +1,15 @@ -function textAreaController($rootScope, $scope, $log) { +function textAreaController($scope) { + + // macro parameter editor doesn't contains a config object, + // so we create a new one to hold any properties + if (!$scope.model.config) { + $scope.model.config = {}; + } + + if (!$scope.model.config.maxChars) { + $scope.model.config.maxChars = false; + } + $scope.model.maxlength = false; if($scope.model.config.maxChars) { $scope.model.maxlength = true; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js index 03f7510112..63dab278e4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/textbox/textbox.controller.js @@ -1,4 +1,15 @@ -function textboxController($rootScope, $scope, $log) { +function textboxController($scope) { + + // macro parameter editor doesn't contains a config object, + // so we create a new one to hold any properties + if (!$scope.model.config) { + $scope.model.config = {}; + } + + if (!$scope.model.config.maxChars) { + $scope.model.config.maxChars = false; + } + $scope.model.maxlength = false; if($scope.model.config.maxChars) { $scope.model.maxlength = true;