Skip to content

Commit dc0005f

Browse files
authored
Block Grid: Streamline readonly with other property editors (#21007)
* Align cursor style and readonly mode for other property editors * Show disabled actions as in other property editors when readonly * Disable sortmode as well when readonly * Formatting * Ensure delete action remains disabled if readonly
1 parent 0da1146 commit dc0005f

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockgrid/blockgridui.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ ng-form.ng-invalid > .umb-block-grid__block:not(.--active) > .umb-block-grid__bl
527527
&[disabled]:hover {
528528
color: @gray-7;
529529
border-color: @gray-7;
530-
cursor: default;
530+
cursor: not-allowed;
531531
}
532532

533533
&.umb-block-grid__create-button {

src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockgrid/umb-block-grid-entries.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565
ng-click="vm.blockEditorApi.requestShowCreate(vm.parentBlock, vm.areaKey, vm.entries.length, $event)">
6666
</uui-button-inline-create>
6767

68-
<div class="umb-block-grid__actions" ng-if="!vm.blockEditorApi.readonly && vm.depth === '0'">
68+
<div class="umb-block-grid__actions" ng-if="vm.depth === '0'">
6969
<button
7070
id="{{vm.model.alias}}"
7171
type="button"
7272
class="btn-reset umb-block-grid__create-button umb-outline"
73-
ng-disabled="vm.locallyAvailableBlockTypes.length === 0"
73+
ng-disabled="vm.locallyAvailableBlockTypes.length === 0 || vm.blockEditorApi.readonly"
7474
ng-click="vm.blockEditorApi.requestShowCreate(vm.parentBlock, vm.areaKey, vm.entries.length, $event)">
7575
<span ng-if="vm.createLabel">{{vm.createLabel}}</span>
7676
<localize ng-if="!vm.createLabel && vm.locallyAvailableBlockTypes.length !== 1" key="blockEditor_addBlock">Add content</localize>
@@ -79,7 +79,7 @@
7979
<button type="button"
8080
class="btn-reset umb-block-grid__clipboard-button umb-outline"
8181
ng-class="{'--jump': vm.jumpClipboardButton}"
82-
ng-disabled="vm.clipboardItems.length === 0"
82+
ng-disabled="vm.clipboardItems.length === 0 || vm.blockEditorApi.readonly"
8383
ng-click="vm.blockEditorApi.requestShowClipboard(vm.parentBlock, vm.areaKey, vm.entries.length, $event)"
8484
localize="title"
8585
title="@blockEditor_tabClipboard">

src/Umbraco.Web.UI.Client/src/views/propertyeditors/blockgrid/umbBlockGridPropertyEditor.component.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
var shadowRoot;
8484
var firstLayoutContainer;
8585

86-
8786
var vm = this;
8887

8988
vm.readonly = false;
@@ -96,6 +95,10 @@
9695
if (deleteAllBlocksAction) {
9796
deleteAllBlocksAction.isDisabled = vm.readonly;
9897
}
98+
99+
if (enterSortModeAction) {
100+
enterSortModeAction.isDisabled = vm.readonly;
101+
}
99102
});
100103

101104
vm.loading = true;
@@ -1367,8 +1370,9 @@
13671370
if (copyAllBlocksAction) {
13681371
copyAllBlocksAction.isDisabled = vm.layout.length === 0;
13691372
}
1373+
13701374
if (deleteAllBlocksAction) {
1371-
deleteAllBlocksAction.isDisabled = vm.layout.length === 0;
1375+
deleteAllBlocksAction.isDisabled = vm.layout.length === 0 || vm.readonly;
13721376
}
13731377

13741378
// validate limits:

0 commit comments

Comments
 (0)