diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js index 26351b1fca..bfe8aba0d8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.controller.js @@ -4,7 +4,7 @@ angular.module('umbraco') .controller("Umbraco.PropertyEditors.ImageCropperController", function ($rootScope, $routeParams, $scope, $log, mediaHelper, cropperHelper, $timeout, editorState, umbRequestHelper, fileManager) { - var config = $scope.model.config; + var config = angular.copy($scope.model.config); //move previously saved value to the editor if ($scope.model.value) { @@ -52,8 +52,8 @@ angular.module('umbraco') //clear the ui $scope.imageSrc = undefined; - if ($scope.model.value.src) { - delete $scope.model.value.src; + if ($scope.model.value) { + delete $scope.model.value; } }; @@ -67,15 +67,6 @@ angular.module('umbraco') } }; - - $scope.$on("imageFocalPointStart", function () { - $scope.tempShowPreviews = true; - }); - - $scope.$on("imageFocalPointStop", function () { - $scope.tempShowPreviews = false; - }); - //on image selected, update the cropper $scope.$on("filesSelected", function (ev, args) { $scope.model.value = config; @@ -86,9 +77,11 @@ angular.module('umbraco') var reader = new FileReader(); reader.onload = function (e) { + $scope.$apply(function () { $scope.imageSrc = e.target.result; }); + }; reader.readAsDataURL(args.files[0]); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html index 57517ce466..90a6f0981d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/imagecropper/imagecropper.html @@ -41,7 +41,8 @@ center="model.value.focalPoint" /> -

Previews

+
+ - Remove file + Remove file \ No newline at end of file diff --git a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs index 6fa309f2f9..2f06aaebcd 100644 --- a/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/ImageCropperPropertyValueEditor.cs @@ -42,6 +42,8 @@ namespace Umbraco.Web.PropertyEditors /// public override object ConvertEditorToDb(ContentPropertyData editorValue, object currentValue) { + + string oldFile = string.Empty; string newFile = string.Empty; JObject newJson = null; @@ -118,6 +120,10 @@ namespace Umbraco.Web.PropertyEditors } } + //incase we submit nothing back + if (editorValue.Value == null) + return null; + return editorValue.Value.ToString(); }