Merge branch 'v12/dev' into contrib

This commit is contained in:
Sebastiaan Janssen
2023-05-15 10:48:51 +02:00
206 changed files with 7063 additions and 1634 deletions

View File

@@ -313,7 +313,7 @@ function mediaHelper(umbRequestHelper, $http, $log) {
var thumbnailUrl = umbRequestHelper.getApiUrl(
"imagesApiBaseUrl",
"GetBigThumbnail",
[{ originalImagePath: imagePath }]) + '&rnd=' + Math.random();
[{ originalImagePath: imagePath }]);
return thumbnailUrl;
},

View File

@@ -14,7 +14,7 @@
}
});
function BlockCardController($scope, umbRequestHelper) {
function BlockCardController($scope, umbRequestHelper, mediaHelper) {
const vm = this;
vm.styleBackgroundImage = "none";
@@ -49,8 +49,10 @@
var path = umbRequestHelper.convertVirtualToAbsolutePath(vm.blockConfigModel.thumbnail);
if (path.toLowerCase().endsWith(".svg") === false) {
path += "?width=400";
path = mediaHelper.getThumbnailFromPath(path);
}
vm.styleBackgroundImage = `url('${path}')`;
};

View File

@@ -85,11 +85,11 @@ function ExamineManagementController($http, $q, $timeout, umbRequestHelper, loca
function nextSearchResultPage(pageNumber) {
search(vm.selectedIndex ? vm.selectedIndex : vm.selectedSearcher, null, pageNumber);
}
function prevSearchResultPage(pageNumber) {
search(vm.selectedIndex ? vm.selectedIndex : vm.selectedSearcher, null, pageNumber);
}
function goToPageSearchResultPage(pageNumber) {
search(vm.selectedIndex ? vm.selectedIndex : vm.selectedSearcher, null, pageNumber);
}
@@ -131,7 +131,7 @@ function ExamineManagementController($http, $q, $timeout, umbRequestHelper, loca
event.stopPropagation();
event.preventDefault();
}
}
function setViewState(state) {
vm.searchResults = null;
@@ -216,8 +216,8 @@ function ExamineManagementController($http, $q, $timeout, umbRequestHelper, loca
switch (section) {
case "content":
case "media":
result.editUrl = "/" + section + "/" + section + "/edit/" + result.values["__NodeId"][0];
result.editId = result.values["__NodeId"][0];
result.editUrl = "/" + section + "/" + section + "/edit/" + result.id;
result.editId = result.id;
result.editSection = section;
break;
case "member":

View File

@@ -53,16 +53,8 @@
// they contain different data structures so if we need to query against it we need to be aware of this.
mediaHelper.registerFileResolver("Umbraco.UploadField", function (property, entity, thumbnail) {
if (thumbnail) {
if (mediaHelper.detectIfImageByExtension(property.value)) {
//get default big thumbnail from image processor
var thumbnailUrl = property.value + "?width=500&rnd=" + moment(entity.updateDate).format("YYYYMMDDHHmmss");
return thumbnailUrl;
}
else {
return null;
}
}
else {
return mediaHelper.getThumbnailFromPath(property.value);
} else {
return property.value;
}
});

View File

@@ -1,10 +1,10 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.Grid.MediaController",
function ($scope, userService, editorService, localizationService) {
function ($scope, userService, editorService, localizationService, mediaHelper) {
$scope.control.icon = $scope.control.icon || 'icon-picture';
$scope.thumbnailUrl = getThumbnailUrl();
updateThumbnailUrl();
if (!$scope.model.config.startNodeId) {
if ($scope.model.config.ignoreUserStartNodes === true) {
@@ -61,40 +61,31 @@ angular.module("umbraco")
/**
*
*/
function getThumbnailUrl() {
function updateThumbnailUrl() {
if ($scope.control.value && $scope.control.value.image) {
var url = $scope.control.value.image;
var options = {
width: 800
};
if ($scope.control.editor.config && $scope.control.editor.config.size){
if ($scope.control.value.coordinates) {
// New way, crop by percent must come before width/height.
var coords = $scope.control.value.coordinates;
url += `?cc=${coords.x1},${coords.y1},${coords.x2},${coords.y2}`;
} else {
// Here in order not to break existing content where focalPoint were used.
if ($scope.control.value.focalPoint) {
url += `?rxy=${$scope.control.value.focalPoint.left},${$scope.control.value.focalPoint.top}`;
} else {
// Prevent black padding and no crop when focal point not set / changed from default
url += '?rxy=0.5,0.5';
}
}
url += '&width=' + $scope.control.editor.config.size.width;
url += '&height=' + $scope.control.editor.config.size.height;
if ($scope.control.value.coordinates) {
// Use crop
options.crop = $scope.control.value.coordinates;
} else if ($scope.control.value.focalPoint) {
// Otherwise use focal point
options.focalPoint = $scope.control.value.focalPoint;
}
// set default size if no crop present (moved from the view)
if (url.includes('?') === false)
{
url += '?width=800'
if ($scope.control.editor.config && $scope.control.editor.config.size) {
options.width = $scope.control.editor.config.size.width;
options.height = $scope.control.editor.config.size.height;
}
return url;
mediaHelper.getProcessedImageUrl($scope.control.value.image, options).then(imageUrl => {
$scope.thumbnailUrl = imageUrl;
});
} else {
$scope.thumbnailUrl = null;
}
return null;
}
/**
@@ -113,6 +104,7 @@ angular.module("umbraco")
caption: selectedImage.caption,
altText: selectedImage.altText
};
$scope.thumbnailUrl = getThumbnailUrl();
updateThumbnailUrl();
}
});

View File

@@ -236,9 +236,8 @@ angular.module('umbraco')
if (property.value && property.value.src) {
if (thumbnail === true) {
return property.value.src + "?width=500";
}
else {
return mediaHelper.getThumbnailFromPath(property.value.src);
} else {
return property.value.src;
}