Merge branch 'v8/8.15' into v8/dev

This commit is contained in:
Sebastiaan Janssen
2021-07-29 10:17:51 +02:00
9 changed files with 80 additions and 27 deletions

View File

@@ -18,5 +18,5 @@ using System.Resources;
[assembly: AssemblyVersion("8.0.0")]
// these are FYI and changed automatically
[assembly: AssemblyFileVersion("8.15.0")]
[assembly: AssemblyInformationalVersion("8.15.0")]
[assembly: AssemblyFileVersion("8.15.1")]
[assembly: AssemblyInformationalVersion("8.15.1")]

View File

@@ -6,7 +6,7 @@
**/
angular.module("umbraco.directives")
.directive('umbImageCrop',
function ($timeout, $window, cropperHelper) {
function ($timeout, cropperHelper, windowResizeListener) {
const MAX_SCALE = 4;
@@ -26,7 +26,7 @@ angular.module("umbraco.directives")
forceUpdate: '@?'
},
link: function (scope, element, attrs, windowResizeListener) {
link: function (scope, element, attrs) {
var unsubscribe = [];
let sliderRef = null;
@@ -72,7 +72,7 @@ angular.module("umbraco.directives")
};
function updateSlider() {
if(sliderRef) {
if (sliderRef) {
// Update slider range min/max
sliderRef.noUiSlider.updateOptions({
"range": {
@@ -102,7 +102,7 @@ angular.module("umbraco.directives")
// cross-browser wheel delta
var delta = Math.max(-50, Math.min(50, (event.wheelDelta || -event.detail)));
if(sliderRef) {
if (sliderRef) {
var currentScale =sliderRef.noUiSlider.get();
var newScale = Math.min(Math.max(currentScale + delta*.001*scope.dimensions.image.ratio, scope.dimensions.scale.min), scope.dimensions.scale.max);
@@ -127,8 +127,8 @@ angular.module("umbraco.directives")
'left': (parseInt(scope.dimensions.margin.left, 10)) + 'px'
}
};
updateStyles();
updateStyles();
//elements
var $viewport = element.find(".viewport");
@@ -138,11 +138,11 @@ angular.module("umbraco.directives")
$overlay.bind("focus", function () {
$overlay.bind("DOMMouseScroll mousewheel onmousewheel", onScroll);
});
$overlay.bind("blur", function () {
$overlay.unbind("DOMMouseScroll mousewheel onmousewheel", onScroll);
});
//default constraints for drag n drop
var constraints = { left: { max: 0, min: 0 }, top: { max: 0, min: 0 } };
scope.constraints = constraints;

View File

@@ -57,7 +57,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
* Do stuff...
* });
* </pre>
*
*
* @returns {Promise} resourcePromise object.
*
*/
@@ -691,11 +691,12 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
getScaffoldByKeys: function (parentId, scaffoldKeys) {
return umbRequestHelper.resourcePromise(
$http.get(
$http.post(
umbRequestHelper.getApiUrl(
"contentApiBaseUrl",
"GetEmptyByKeys",
{ contentTypeKeys: scaffoldKeys, parentId: parentId })),
"GetEmptyByKeys"),
{ contentTypeKeys: scaffoldKeys, parentId: parentId }
),
'Failed to retrieve data for empty content items ids' + scaffoldKeys.join(", "))
.then(function (result) {
Object.keys(result).map(function(key) {
@@ -804,7 +805,7 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) {
else if (options.orderDirection === "desc") {
options.orderDirection = "Descending";
}
//converts the value to a js bool
function toBool(v) {
if (Utilities.isNumber(v)) {

View File

@@ -487,7 +487,7 @@
* @returns {Object | null} Scaffold model for the that content type. Or null if the scaffolding model dosnt exist in this context.
*/
getScaffoldFromKey: function (contentTypeKey) {
return this.scaffolds.find(o => o.contentTypeKey === contentTypeKey);
return this.scaffolds.find(o => o.contentTypeKey === contentTypeKey) || null;
},
/**
@@ -499,7 +499,7 @@
* @returns {Object | null} Scaffold model for the that content type. Or null if the scaffolding model dosnt exist in this context.
*/
getScaffoldFromAlias: function (contentTypeAlias) {
return this.scaffolds.find(o => o.contentTypeAlias === contentTypeAlias);
return this.scaffolds.find(o => o.contentTypeAlias === contentTypeAlias) || null;
},
/**
@@ -609,10 +609,14 @@
blockObject.settingsData = settingsData;
// make basics from scaffold
blockObject.settings = Utilities.copy(settingsScaffold);
ensureUdiAndKey(blockObject.settings, settingsUdi);
if (settingsScaffold !== null) {// We might not have settingsScaffold
blockObject.settings = Utilities.copy(settingsScaffold);
ensureUdiAndKey(blockObject.settings, settingsUdi);
mapToElementModel(blockObject.settings, settingsData);
mapToElementModel(blockObject.settings, settingsData);
} else {
blockObject.settings = null;
}
// add settings content-app
appendSettingsContentApp(blockObject.content, this.__labels.settingsName);

View File

@@ -11,7 +11,7 @@
*/
function windowResizeListener($rootScope) {
var WinReszier = (function () {
var WinResizer = (function () {
var registered = [];
var inited = false;
var resize = _.debounce(function(ev) {
@@ -51,7 +51,7 @@ function windowResizeListener($rootScope) {
* @param {Function} cb
*/
register: function (cb) {
WinReszier.register(cb);
WinResizer.register(cb);
},
/**
@@ -59,9 +59,9 @@ function windowResizeListener($rootScope) {
* @param {Function} cb
*/
unregister: function(cb) {
WinReszier.unregister(cb);
WinResizer.unregister(cb);
}
};
}
angular.module('umbraco.services').factory('windowResizeListener', windowResizeListener);
angular.module('umbraco.services').factory('windowResizeListener', windowResizeListener);

View File

@@ -348,9 +348,9 @@
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>8150</DevelopmentServerPort>
<DevelopmentServerPort>8151</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:8150</IISUrl>
<IISUrl>http://localhost:8151</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>

View File

@@ -449,6 +449,13 @@ namespace Umbraco.Web.Editors
return result;
}
private IDictionary<Guid, ContentItemDisplay> GetEmptyByKeysInternal(Guid[] contentTypeKeys, int parentId)
{
using var scope = _scopeProvider.CreateScope(autoComplete: true);
var contentTypes = Services.ContentTypeService.GetAll(contentTypeKeys).ToList();
return GetEmpties(contentTypes, parentId).ToDictionary(x => x.ContentTypeKey);
}
/// <summary>
/// Gets a collection of empty content items for all document types.
/// </summary>
@@ -457,9 +464,22 @@ namespace Umbraco.Web.Editors
[OutgoingEditorModelEvent]
public IDictionary<Guid, ContentItemDisplay> GetEmptyByKeys([FromUri] Guid[] contentTypeKeys, [FromUri] int parentId)
{
using var scope = _scopeProvider.CreateScope(autoComplete: true);
var contentTypes = Services.ContentTypeService.GetAll(contentTypeKeys).ToList();
return GetEmpties(contentTypes, parentId).ToDictionary(x => x.ContentTypeKey);
return GetEmptyByKeysInternal(contentTypeKeys, parentId);
}
/// <summary>
/// Gets a collection of empty content items for all document types.
/// </summary>
/// <remarks>
/// This is a post request in order to support a large amount of GUIDs without hitting the URL length limit.
/// </remarks>
/// <param name="contentTypeByKeys"></param>
/// <returns></returns>
[HttpPost]
[OutgoingEditorModelEvent]
public IDictionary<Guid, ContentItemDisplay> GetEmptyByKeys(ContentTypesByKeys contentTypeByKeys)
{
return GetEmptyByKeysInternal(contentTypeByKeys.ContentTypeKeys, contentTypeByKeys.ParentId);
}
[OutgoingEditorModelEvent]

View File

@@ -0,0 +1,27 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model for retrieving multiple content types based on their keys.
/// </summary>
[DataContract(Name = "contentTypes", Namespace = "")]
public class ContentTypesByKeys
{
/// <summary>
/// ID of the parent of the content type.
/// </summary>
[DataMember(Name = "parentId")]
[Required]
public int ParentId { get; set; }
/// <summary>
/// The id of every content type to get.
/// </summary>
[DataMember(Name = "contentTypeKeys")]
[Required]
public Guid[] ContentTypeKeys { get; set; }
}
}

View File

@@ -241,6 +241,7 @@
<Compile Include="Media\UploadAutoFillProperties.cs" />
<Compile Include="Migrations\PostMigrations\PublishedSnapshotRebuilder.cs" />
<Compile Include="Models\AnchorsModel.cs" />
<Compile Include="Models\ContentEditing\ContentTypesByKeys.cs" />
<Compile Include="Models\ContentEditing\DataTypeReferences.cs" />
<Compile Include="Models\ContentEditing\LinkDisplay.cs" />
<Compile Include="Models\ContentEditing\MacroDisplay.cs" />