|
37 | 37 | let copyAllBlocksAction = null; |
38 | 38 | let deleteAllBlocksAction = null; |
39 | 39 | let pasteSingleBlockAction = null; |
| 40 | + let resetSingleBlock = null; |
| 41 | + |
| 42 | + let scopeOfExistence = null; |
40 | 43 |
|
41 | 44 | var inlineEditing = false; |
42 | 45 | var liveEditing = true; |
|
124 | 127 | vm.listWrapperStyles['max-width'] = vm.model.config.maxPropertyWidth; |
125 | 128 | } |
126 | 129 |
|
127 | | - // We need to ensure that the property model value is an object, this is needed for modelObject to recive a reference and keep that updated. |
| 130 | + // We need to ensure that the property model value is an object, this is needed for modelObject to receive a reference and keep that updated. |
128 | 131 | if (typeof vm.model.value !== 'object' || vm.model.value === null) {// testing if we have null or undefined value or if the value is set to another type than Object. |
129 | 132 | vm.model.value = {}; |
130 | 133 | } |
131 | 134 |
|
132 | | - var scopeOfExistence = $scope; |
| 135 | + scopeOfExistence = $scope; |
133 | 136 | if (vm.umbVariantContentEditors && vm.umbVariantContentEditors.getScope) { |
134 | 137 | scopeOfExistence = vm.umbVariantContentEditors.getScope(); |
135 | 138 | } else if(vm.umbElementEditorContent && vm.umbElementEditorContent.getScope) { |
|
179 | 182 | useLegacyIcon: false |
180 | 183 | }; |
181 | 184 |
|
| 185 | + resetSingleBlock = { |
| 186 | + labelKey: "content_removeItem", |
| 187 | + labelTokens: [], |
| 188 | + icon: "icon-trash", |
| 189 | + method: requestResetSingleBlock, |
| 190 | + isDisabled: false, |
| 191 | + useLegacyIcon: false |
| 192 | + }; |
| 193 | + |
182 | 194 | var propertyActions = [copyAllBlocksAction, deleteAllBlocksAction]; |
183 | 195 |
|
184 | | - var propertyActionsForSingleBlockMode = [pasteSingleBlockAction]; |
| 196 | + var propertyActionsForSingleBlockMode = [pasteSingleBlockAction, resetSingleBlock]; |
185 | 197 |
|
186 | 198 | if (vm.umbProperty) { |
187 | 199 | if (vm.singleBlockMode) { |
|
844 | 856 | }); |
845 | 857 | } |
846 | 858 |
|
| 859 | + function requestResetSingleBlock() { |
| 860 | + localizationService.localizeMany(["content_nestedContentDeleteItem", "general_delete"]).then(function (data) { |
| 861 | + overlayService.confirmDelete({ |
| 862 | + title: data[1], |
| 863 | + content: data[0], |
| 864 | + close: function () { |
| 865 | + overlayService.close(); |
| 866 | + }, |
| 867 | + submit: function () { |
| 868 | + deleteAllBlocks(); |
| 869 | + modelObject = blockEditorService.createModelObject(vm.model.value, vm.model.editor, vm.model.config.blocks, scopeOfExistence, $scope); |
| 870 | + modelObject.load().then(onLoaded); |
| 871 | + overlayService.close(); |
| 872 | + } |
| 873 | + }); |
| 874 | + }); |
| 875 | + } |
| 876 | + |
847 | 877 | function openSettingsForBlock(block, blockIndex, parentForm) { |
848 | 878 | editBlock(block, true, blockIndex, parentForm); |
849 | 879 | } |
|
0 commit comments