Merge v13/dev

This commit is contained in:
nikolajlauridsen
2023-07-21 10:59:47 +02:00
52 changed files with 457 additions and 234 deletions

View File

@@ -16470,9 +16470,9 @@
}
},
"node_modules/tough-cookie": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.2.tgz",
"integrity": "sha512-G9fqXWoYFZgTc2z8Q5zaHy/vJMjm+WV0AkAeHxVCQiEB1b+dGvWzFW6QV07cY5jQ5gRkeid2qIkzkxUnmoQZUQ==",
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.3.tgz",
"integrity": "sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==",
"dependencies": {
"psl": "^1.1.33",
"punycode": "^2.1.1",

View File

@@ -3,11 +3,14 @@ angular.module("umbraco")
function ($scope, localizationService, $filter) {
var unsubscribe = [];
var vm = this;
const vm = this;
vm.navigation = [];
vm.filterSearchTerm = '';
vm.filter = {
searchTerm: ""
};
vm.filteredItems = [];
// Ensure groupKey value, as we need it to be present for the filtering logic.
@@ -15,12 +18,19 @@ angular.module("umbraco")
item.blockConfigModel.groupKey = item.blockConfigModel.groupKey || null;
});
unsubscribe.push($scope.$watch('vm.filterSearchTerm', updateFiltering));
unsubscribe.push($scope.$watch('vm.filter.searchTerm', updateFiltering));
function updateFiltering() {
vm.filteredItems = $filter('umbCmsBlockCard')($scope.model.availableItems, vm.filterSearchTerm);
vm.filteredItems = $filter('umbCmsBlockCard')($scope.model.availableItems, vm.filter.searchTerm);
}
vm.filterByGroup = function (group) {
const items = $filter('filter')(vm.filteredItems, { blockConfigModel: { groupKey: group?.key || null } });
return items;
};
localizationService.localizeMany(["blockEditor_tabCreateEmpty", "blockEditor_tabClipboard"]).then(
function (data) {
@@ -47,9 +57,7 @@ angular.module("umbraco")
} else {
vm.activeTab = vm.navigation[0];
}
vm.activeTab.active = true;
}
);
@@ -61,12 +69,13 @@ angular.module("umbraco")
};
vm.clickClearClipboard = function () {
vm.model.clipboardItems = [];// This dialog is not connected via the clipboardService events, so we need to update manually.
vm.model.clipboardItems = []; // This dialog is not connected via the clipboardService events, so we need to update manually.
vm.model.clickClearClipboard();
if (vm.model.singleBlockMode !== true && vm.model.openClipboard !== true)
{
vm.onNavigationChanged(vm.navigation[0]);
vm.navigation[1].disabled = true;// disabled ws determined when creating the navigation, so we need to update it here.
vm.navigation[1].disabled = true; // disabled ws determined when creating the navigation, so we need to update it here.
}
else {
vm.close();

View File

@@ -19,7 +19,7 @@
<div class="umb-control-group" ng-if="vm.model.filter === true" style="margin-bottom: 20px;">
<umb-search-filter
input-id="block-search"
model="vm.filterSearchTerm"
model="vm.filter.searchTerm"
label-key="placeholders_filter"
text="Type to filter..."
css-class="w-100"
@@ -27,11 +27,11 @@
</umb-search-filter>
</div>
<div class="umb-block-card-grid" ng-if="vm.filteredItems.length > 0">
<div class="umb-block-card-grid" ng-if="vm.filterByGroup(null).length > 0">
<umb-block-card
class="umb-outline"
ng-repeat="block in (vm.filteredItems | filter:{blockConfigModel:{groupKey: null}})"
ng-repeat="block in vm.filterByGroup(null)"
block-config-model="block.blockConfigModel"
element-type-model="block.elementTypeModel"
ng-click="vm.selectItem(block, $event)">
@@ -39,14 +39,14 @@
</div>
<div ng-repeat="blockGroup in model.blockGroups" ng-if="vm.filteredItems.length > 0">
<div ng-repeat="blockGroup in model.blockGroups" ng-if="vm.filterByGroup(blockGroup).length > 0">
<h5>{{blockGroup.name}}</h5>
<div class="umb-block-card-grid">
<umb-block-card
class="umb-outline"
ng-repeat="block in (vm.filteredItems | filter:{blockConfigModel:{groupKey: blockGroup.key}})"
ng-repeat="block in vm.filterByGroup(blockGroup)"
block-config-model="block.blockConfigModel"
element-type-model="block.elementTypeModel"
ng-click="vm.selectItem(block, $event)">

View File

@@ -114,22 +114,29 @@
});
}
vm.requestRemoveBlockByIndex = function (index) {
localizationService.localizeMany(["general_delete", "blockEditor_confirmDeleteBlockTypeMessage", "blockEditor_confirmDeleteBlockTypeNotice"]).then(function (data) {
vm.requestRemoveBlockByIndex = function (index, event) {
const labelKeys = [
"general_delete",
"blockEditor_confirmDeleteBlockTypeMessage",
"blockEditor_confirmDeleteBlockTypeNotice"
];
localizationService.localizeMany(labelKeys).then(data => {
var contentElementType = vm.getElementTypeByKey($scope.model.value[index].contentElementTypeKey);
overlayService.confirmDelete({
title: data[0],
content: localizationService.tokenReplace(data[1], [contentElementType ? contentElementType.name : "(Unavailable ElementType)"]),
confirmMessage: data[2],
close: function () {
overlayService.close();
},
submit: function () {
submit: () => {
vm.removeBlockByIndex(index);
overlayService.close();
}
},
close: overlayService.close()
});
});
event.stopPropagation();
}
vm.removeBlockByIndex = function (index) {
@@ -164,7 +171,7 @@
placeholder: '--sortable-placeholder',
forcePlaceHolderSize: true,
stop: function(e, ui) {
if(ui.item.sortable.droptarget && ui.item.sortable.droptarget.length > 0) {
if (ui.item.sortable.droptarget && ui.item.sortable.droptarget.length > 0) {
// We do not want sortable to actually move the data, as we are using the same ng-model. Instead we just change the groupKey and cancel the transfering.
ui.item.sortable.model.groupKey = ui.item.sortable.droptarget[0].dataset.groupKey || null;
ui.item.sortable.cancel();
@@ -346,7 +353,7 @@
// Then remove group:
const groupIndex = vm.blockGroups.indexOf(blockGroup);
if(groupIndex !== -1) {
if (groupIndex !== -1) {
vm.blockGroups.splice(groupIndex, 1);
removeReferencesToGroupKey(blockGroup.key);
}
@@ -375,7 +382,7 @@
const groupName = "Demo Blocks";
var sampleGroup = vm.blockGroups.find(x => x.name === groupName);
if(!sampleGroup) {
if (!sampleGroup) {
sampleGroup = {
key: String.CreateGuid(),
name: groupName
@@ -394,6 +401,7 @@
initSampleBlock(data.umbBlockGridDemoHeadlineBlock, sampleGroup.key, {"label": "Headline ({{headline | truncate:true:36}})", "view": "~/App_Plugins/Umbraco.BlockGridEditor.DefaultCustomViews/umbBlockGridDemoHeadlineBlock.html"});
initSampleBlock(data.umbBlockGridDemoImageBlock, sampleGroup.key, {"label": "Image", "view": "~/App_Plugins/Umbraco.BlockGridEditor.DefaultCustomViews/umbBlockGridDemoImageBlock.html"});
initSampleBlock(data.umbBlockGridDemoRichTextBlock, sampleGroup.key, { "label": "Rich Text ({{richText | ncRichText | truncate:true:36}})", "view": "~/App_Plugins/Umbraco.BlockGridEditor.DefaultCustomViews/umbBlockGridDemoRichTextBlock.html"});
const twoColumnLayoutAreas = [
{
'key': String.CreateGuid(),
@@ -414,6 +422,7 @@
'specifiedAllowance': []
}
];
initSampleBlock(data.umbBlockGridDemoTwoColumnLayoutBlock, sampleGroup.key, {"label": "Two Column Layout", "view": "~/App_Plugins/Umbraco.BlockGridEditor.DefaultCustomViews/umbBlockGridDemoTwoColumnLayoutBlock.html", "allowInAreas": false, "areas": twoColumnLayoutAreas});
vm.showSampleDataCTA = false;

View File

@@ -19,12 +19,12 @@
ng-class="{'--isOpen':vm.openBlock === block}"
ng-click="vm.openBlockOverlay(block)"
data-content-element-type-key="{{block.contentElementTypeKey}}">
<div class="__actions">
<button ng-if="block.areas.length > 0" type="button" class="btn-reset __action umb-outline" ng-click="vm.openBlockOverlay(block, true); $event.stopPropagation();">
<div class="__actions" ng-click="$event.stopPropagation()" tabindex="-1">
<button type="button" ng-if="block.areas.length > 0" class="btn-reset __action umb-outline" ng-click="vm.openBlockOverlay(block, true); $event.stopPropagation();">
<umb-icon icon="icon-layout" class="icon"></umb-icon>
<localize key="blockEditor_tabAreas" class="sr-only">Areas</localize>
</button>
<button type="button" class="btn-reset __action umb-outline" ng-click="vm.requestRemoveBlockByIndex($index); $event.stopPropagation();">
<button type="button" class="btn-reset __action umb-outline" ng-click="vm.requestRemoveBlockByIndex($index, $event)">
<umb-icon icon="icon-trash" class="icon"></umb-icon>
<localize key="general_delete" class="sr-only">Delete</localize>
</button>
@@ -46,11 +46,13 @@
<div ui-sortable="vm.groupSortableOptions" ng-model="vm.blockGroups">
<div class="umb-block-card-group" ng-repeat="blockGroup in vm.blockGroups track by blockGroup.key">
<div class="__controls">
<div class="__handle"><umb-icon icon="icon-navigation"></umb-icon></div>
<input class="__title" title="group name" type="text" ng-model="blockGroup.name"/>
<div class="__handle">
<umb-icon icon="icon-navigation"></umb-icon>
</div>
<input type="text" class="__title" title="group name" ng-model="blockGroup.name" />
<button
type="button"
@@ -76,12 +78,12 @@
ng-class="{'--isOpen':vm.openBlock === block}"
ng-click="vm.openBlockOverlay(block)"
data-content-element-type-key="{{block.contentElementTypeKey}}">
<div class="__actions">
<button ng-if="block.areas.length > 0" type="button" class="btn-reset __action umb-outline" ng-click="vm.openBlockOverlay(block, true); $event.stopPropagation();">
<div class="__actions" ng-click="$event.stopPropagation()" tabindex="-1">
<button type="button" ng-if="block.areas.length > 0" class="btn-reset __action umb-outline" ng-click="vm.openBlockOverlay(block, true); $event.stopPropagation();">
<umb-icon icon="icon-layout" class="icon"></umb-icon>
<localize key="blockEditor_tabAreas" class="sr-only">Areas</localize>
</button>
<button type="button" class="btn-reset __action umb-outline" ng-click="vm.requestRemoveBlockByIndex($index); $event.stopPropagation();">
<button type="button" class="btn-reset __action umb-outline" ng-click="vm.requestRemoveBlockByIndex($index, $event)">
<umb-icon icon="icon-trash" class="icon"></umb-icon>
<localize key="general_delete" class="sr-only">Delete</localize>
</button>

View File

@@ -51,13 +51,13 @@
vm.requestRemoveBlockByIndex = function (index, event) {
const labelKeys = [
"general_delete",
"blockEditor_confirmDeleteBlockTypeMessage",
"blockEditor_confirmDeleteBlockTypeNotice"
];
const labelKeys = [
"general_delete",
"blockEditor_confirmDeleteBlockTypeMessage",
"blockEditor_confirmDeleteBlockTypeNotice"
];
localizationService.localizeMany(labelKeys).then(data => {
localizationService.localizeMany(labelKeys).then(data => {
var contentElementType = vm.getElementTypeByKey($scope.model.value[index].contentElementTypeKey);
overlayService.confirmDelete({
title: data[0],