Add images in grid - fixes 9982 (#9987)
Co-authored-by: Sebastiaan Janssen <sebastiaan@umbraco.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
angular.module("umbraco")
|
||||
.controller("Umbraco.PropertyEditors.Grid.MediaController",
|
||||
function ($scope, userService, editorService, localizationService) {
|
||||
|
||||
$scope.thumbnailUrl = getThumbnailUrl();
|
||||
|
||||
function ($scope, userService, editorService, localizationService) {
|
||||
|
||||
$scope.thumbnailUrl = getThumbnailUrl();
|
||||
|
||||
if (!$scope.model.config.startNodeId) {
|
||||
if ($scope.model.config.ignoreUserStartNodes === true) {
|
||||
$scope.model.config.startNodeId = -1;
|
||||
@@ -29,16 +29,16 @@ angular.module("umbraco")
|
||||
onlyImages: true,
|
||||
dataTypeKey: $scope.model.dataTypeKey,
|
||||
submit: model => {
|
||||
updateControlValue(model.selection[0]);
|
||||
updateControlValue(model.selection[0]);
|
||||
editorService.close();
|
||||
},
|
||||
close: () => editorService.close()
|
||||
close: () => editorService.close()
|
||||
};
|
||||
|
||||
editorService.mediaPicker(mediaPicker);
|
||||
};
|
||||
|
||||
$scope.editImage = function() {
|
||||
$scope.editImage = function() {
|
||||
|
||||
const mediaCropDetailsConfig = {
|
||||
size: 'small',
|
||||
@@ -47,17 +47,17 @@ angular.module("umbraco")
|
||||
updateControlValue(model.target);
|
||||
editorService.close();
|
||||
},
|
||||
close: () => editorService.close()
|
||||
close: () => editorService.close()
|
||||
};
|
||||
|
||||
localizationService.localize('defaultdialogs_editSelectedMedia').then(value => {
|
||||
mediaCropDetailsConfig.title = value;
|
||||
editorService.mediaCropDetails(mediaCropDetailsConfig);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function getThumbnailUrl() {
|
||||
|
||||
@@ -94,19 +94,15 @@ angular.module("umbraco")
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} selectedImage
|
||||
*
|
||||
* @param {object} selectedImage
|
||||
*/
|
||||
function updateControlValue(selectedImage) {
|
||||
|
||||
const doGetThumbnail = $scope.control.value.focalPoint !== selectedImage.focalPoint
|
||||
|| $scope.control.value.image !== selectedImage.image;
|
||||
|
||||
// we could apply selectedImage directly to $scope.control.value,
|
||||
// but this allows excluding fields in future if needed
|
||||
$scope.control.value = {
|
||||
@@ -118,10 +114,6 @@ angular.module("umbraco")
|
||||
caption: selectedImage.caption,
|
||||
altText: selectedImage.altText
|
||||
};
|
||||
|
||||
|
||||
if (doGetThumbnail) {
|
||||
$scope.thumbnailUrl = getThumbnailUrl();
|
||||
}
|
||||
}
|
||||
$scope.thumbnailUrl = getThumbnailUrl();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user