Adjust sorting of block grid editor groups to y-axis only (#13225)
fixes https://github.com/umbraco/Umbraco-CMS/issues/13180
This commit is contained in:
committed by
GitHub
parent
0f4b2300ab
commit
d4c5f5017f
@@ -38,12 +38,12 @@
|
|||||||
"groupKey": null
|
"groupKey": null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
function BlockConfigurationController($scope, $element, $http, elementTypeResource, overlayService, localizationService, editorService, eventsService, udiService, dataTypeResource, umbRequestHelper) {
|
function BlockConfigurationController($scope, $element, $http, elementTypeResource, overlayService, localizationService, editorService, eventsService, udiService, dataTypeResource, umbRequestHelper) {
|
||||||
|
|
||||||
var unsubscribe = [];
|
var unsubscribe = [];
|
||||||
|
|
||||||
var vm = this;
|
const vm = this;
|
||||||
|
|
||||||
vm.openBlock = null;
|
vm.openBlock = null;
|
||||||
vm.showSampleDataCTA = false;
|
vm.showSampleDataCTA = false;
|
||||||
|
|
||||||
@@ -57,6 +57,7 @@
|
|||||||
if (blockGroupModel.value == null) {
|
if (blockGroupModel.value == null) {
|
||||||
blockGroupModel.value = [];
|
blockGroupModel.value = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.blockGroups = blockGroupModel.value;
|
vm.blockGroups = blockGroupModel.value;
|
||||||
|
|
||||||
if (!$scope.model.value) {
|
if (!$scope.model.value) {
|
||||||
@@ -72,12 +73,10 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
loadElementTypes();
|
loadElementTypes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function loadElementTypes() {
|
function loadElementTypes() {
|
||||||
return elementTypeResource.getAll().then(function (elementTypes) {
|
return elementTypeResource.getAll().then(elementTypes => {
|
||||||
vm.elementTypes = elementTypes;
|
vm.elementTypes = elementTypes;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -90,6 +89,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsubscribe.push(eventsService.on("editors.documentType.saved", updateUsedElementTypes));
|
unsubscribe.push(eventsService.on("editors.documentType.saved", updateUsedElementTypes));
|
||||||
|
|
||||||
function removeReferencesToElementTypeKey(contentElementTypeKey) {
|
function removeReferencesToElementTypeKey(contentElementTypeKey) {
|
||||||
@@ -141,18 +141,20 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
axis: '',
|
|
||||||
tolerance: "pointer",
|
tolerance: "pointer",
|
||||||
opacity: 0.7,
|
opacity: 0.7,
|
||||||
scroll: true
|
scroll: true
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.groupSortableOptions = {
|
vm.groupSortableOptions = {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
|
axis: 'y',
|
||||||
handle: '.__handle',
|
handle: '.__handle',
|
||||||
items: ".umb-block-card-group",
|
items: ".umb-block-card-group",
|
||||||
cursor: "grabbing",
|
cursor: "grabbing",
|
||||||
placeholder: 'umb-block-card-group --sortable-placeholder'
|
placeholder: 'umb-block-card-group --sortable-placeholder'
|
||||||
};
|
};
|
||||||
|
|
||||||
vm.blockSortableOptions = {
|
vm.blockSortableOptions = {
|
||||||
...defaultOptions,
|
...defaultOptions,
|
||||||
"ui-floating": true,
|
"ui-floating": true,
|
||||||
@@ -170,7 +172,6 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
vm.getAvailableElementTypes = function () {
|
vm.getAvailableElementTypes = function () {
|
||||||
return vm.elementTypes.filter(function (type) {
|
return vm.elementTypes.filter(function (type) {
|
||||||
return !$scope.model.value.find(function (entry) {
|
return !$scope.model.value.find(function (entry) {
|
||||||
@@ -262,13 +263,8 @@
|
|||||||
$scope.model.value.push(blockType);
|
$scope.model.value.push(blockType);
|
||||||
|
|
||||||
vm.openBlockOverlay(blockType);
|
vm.openBlockOverlay(blockType);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
vm.openBlockOverlay = function (block, openAreas) {
|
vm.openBlockOverlay = function (block, openAreas) {
|
||||||
|
|
||||||
var elementType = vm.getElementTypeByKey(block.contentElementTypeKey);
|
var elementType = vm.getElementTypeByKey(block.contentElementTypeKey);
|
||||||
@@ -279,7 +275,7 @@
|
|||||||
var clonedBlockData = Utilities.copy(block);
|
var clonedBlockData = Utilities.copy(block);
|
||||||
vm.openBlock = block;
|
vm.openBlock = block;
|
||||||
|
|
||||||
var overlayModel = {
|
const overlayModel = {
|
||||||
block: clonedBlockData,
|
block: clonedBlockData,
|
||||||
allBlockTypes: $scope.model.value,
|
allBlockTypes: $scope.model.value,
|
||||||
allBlockGroups: vm.blockGroups,
|
allBlockGroups: vm.blockGroups,
|
||||||
@@ -306,7 +302,17 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
alert("Cannot be edited cause ElementType does not exist.");
|
|
||||||
|
const overlay = {
|
||||||
|
close: () => {
|
||||||
|
overlayService.close()
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
localizationService.localize("blockEditor_elementTypeDoesNotExist").then(data => {
|
||||||
|
overlay.content = data;
|
||||||
|
overlayService.open(overlay);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -355,8 +361,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
dataTypeResource.getAll().then(function(dataTypes) {
|
dataTypeResource.getAll().then(function(dataTypes) {
|
||||||
if (dataTypes.filter(x => x.alias === "Umbraco.BlockGrid").length === 0) {
|
if (dataTypes.filter(x => x.alias === "Umbraco.BlockGrid").length === 0) {
|
||||||
vm.showSampleDataCTA = true;
|
vm.showSampleDataCTA = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user