V8.7RC Show Blocks that does not have a BlockConfiguration as Unsupported Bl… (#8786)

This commit is contained in:
Niels Lyngsø
2020-09-07 12:33:58 +02:00
committed by GitHub
parent 86d105dcf3
commit 40d13bfb2f
7 changed files with 29 additions and 25 deletions

View File

@@ -524,12 +524,11 @@
}
var blockConfiguration = this.getBlockConfiguration(dataModel.contentTypeKey);
var contentScaffold;
var contentScaffold = null;
if (blockConfiguration === null) {
console.error("The block of " + contentUdi + " is not being initialized because its contentTypeKey('" + dataModel.contentTypeKey + "') is not allowed for this PropertyEditor");
}
else {
console.warn("The block of " + contentUdi + " is not being initialized because its contentTypeKey('" + dataModel.contentTypeKey + "') is not allowed for this PropertyEditor");
} else {
contentScaffold = this.getScaffoldFromKey(blockConfiguration.contentElementTypeKey);
if (contentScaffold === null) {
console.error("The block of " + contentUdi + " is not begin initialized cause its Element Type was not loaded.");
@@ -539,10 +538,9 @@
if (blockConfiguration === null || contentScaffold === null) {
blockConfiguration = {
label: "Unsupported Block",
label: "Unsupported",
unsupported: true
};
contentScaffold = {};
}
var blockObject = {};
@@ -567,10 +565,14 @@
, 10);
// make basics from scaffold
blockObject.content = Utilities.copy(contentScaffold);
ensureUdiAndKey(blockObject.content, contentUdi);
if(contentScaffold !== null) {// We might not have contentScaffold
blockObject.content = Utilities.copy(contentScaffold);
ensureUdiAndKey(blockObject.content, contentUdi);
mapToElementModel(blockObject.content, dataModel);
mapToElementModel(blockObject.content, dataModel);
} else {
blockObject.content = null;
}
blockObject.data = dataModel;
blockObject.layout = layoutEntry;
@@ -672,11 +674,8 @@
* @param {Object} blockObject The BlockObject to be removed and destroyed.
*/
removeDataAndDestroyModel: function (blockObject) {
var udi = blockObject.content.udi;
var settingsUdi = null;
if (blockObject.settings) {
settingsUdi = blockObject.settings.udi;
}
var udi = blockObject.layout.contentUdi;
var settingsUdi = blockObject.layout.settingsUdi || null;
this.destroyBlockObject(blockObject);
this.removeDataByUdi(udi);
if (settingsUdi) {

View File

@@ -4,9 +4,11 @@
<span>{{block.label}}</span>
</div>
<div class="__body">
This Block is no longer supported in this context.<br/>
This content is no longer supported in this context.<br/>
You might want to remove this block, or contact your developer to take actions for making this block available again.<br/><br/>
<a href="http://our.umbraco.com" target="_blank" rel="noreferrer">Learn about this circumstance</a>
<!-- TODO: Add link when we have one
<a href="http://our.umbraco.com" target="_blank" rel="noopener">Learn more about this warning</a>
-->
<h5>Block data:</h5>
<pre ng-bind="block.data | json : 4"></pre>
</div>

View File

@@ -50,7 +50,7 @@
unsubscribe.push(eventsService.on("editors.documentType.saved", updateUsedElementTypes));
vm.requestRemoveBlockByIndex = function (index) {
localizationService.localizeMany(["general_delete", "blockEditor_confirmDeleteBlockMessage", "blockEditor_confirmDeleteBlockNotice"]).then(function (data) {
localizationService.localizeMany(["general_delete", "blockEditor_confirmDeleteBlockTypeMessage", "blockEditor_confirmDeleteBlockTypeNotice"]).then(function (data) {
var contentElementType = vm.getElementTypeByKey($scope.model.value[index].contentElementTypeKey);
overlayService.confirmDelete({
title: data[0],

View File

@@ -294,9 +294,9 @@
function deleteBlock(block) {
var layoutIndex = vm.layout.findIndex(entry => entry.contentUdi === block.content.udi);
var layoutIndex = vm.layout.findIndex(entry => entry.contentUdi === block.layout.contentUdi);
if (layoutIndex === -1) {
throw new Error("Could not find layout entry of block with udi: "+block.content.udi)
throw new Error("Could not find layout entry of block with udi: "+block.layout.contentUdi)
}
setDirty();