Ensures the config is cleared properly every time
This commit is contained in:
@@ -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]);
|
||||
|
||||
@@ -41,7 +41,8 @@
|
||||
center="model.value.focalPoint" />
|
||||
</div>
|
||||
|
||||
<p>Previews</p>
|
||||
<hr />
|
||||
|
||||
<ul class="umb-sortable-thumbnails" >
|
||||
<li ng-repeat="(key,value) in model.value.crops">
|
||||
<a href title="{{value.alias}}: {{value.height}}px x {{value.width}}px" ng-click="crop(value)">
|
||||
@@ -56,7 +57,7 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<a href class="btn btn-link" ng-click="clear()"><i class="icon-delete red"></i> Remove file</a></li>
|
||||
<a href class="btn btn-link" ng-click="clear()"><i class="icon-delete red"></i> Remove file</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,6 +42,8 @@ namespace Umbraco.Web.PropertyEditors
|
||||
/// <returns></returns>
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user