@@ -8,6 +8,7 @@ import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/propert
8
8
import { stringOrStringArrayContains } from '@umbraco-cms/backoffice/utils' ;
9
9
10
10
import '../block-grid-block-inline/index.js' ;
11
+ import '../block-grid-block-unsupported/index.js' ;
11
12
import '../block-grid-block/index.js' ;
12
13
import '../block-scale-handler/index.js' ;
13
14
import { UmbObserveValidationStateController } from '@umbraco-cms/backoffice/validation' ;
@@ -18,6 +19,7 @@ import type {
18
19
} from '@umbraco-cms/backoffice/block-custom-view' ;
19
20
import { UUIBlinkAnimationValue , UUIBlinkKeyframes } from '@umbraco-cms/backoffice/external/uui' ;
20
21
import type { UmbExtensionElementInitializer } from '@umbraco-cms/backoffice/extension-api' ;
22
+
21
23
/**
22
24
* @element umb-block-grid-entry
23
25
*/
@@ -91,6 +93,9 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
91
93
@state ( )
92
94
_exposed ?: boolean ;
93
95
96
+ @state ( )
97
+ _unsupported ?: boolean ;
98
+
94
99
@state ( )
95
100
_workspaceEditContentPath ?: string ;
96
101
@@ -191,6 +196,17 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
191
196
} ,
192
197
null ,
193
198
) ;
199
+ this . observe (
200
+ this . #context. unsupported ,
201
+ ( unsupported ) => {
202
+ if ( unsupported === undefined ) return ;
203
+ this . #updateBlockViewProps( { unsupported : unsupported } ) ;
204
+ this . _unsupported = unsupported ;
205
+ this . toggleAttribute ( 'unsupported' , unsupported ) ;
206
+ } ,
207
+ null ,
208
+ ) ;
209
+
194
210
this . observe (
195
211
this . #context. inlineEditingMode ,
196
212
( mode ) => {
@@ -233,18 +249,14 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
233
249
this . observe (
234
250
this . #context. createBeforePath ,
235
251
( createPath ) => {
236
- //const oldValue = this._createBeforePath;
237
252
this . _createBeforePath = createPath ;
238
- //this.requestUpdate('_createPath', oldValue);
239
253
} ,
240
254
null ,
241
255
) ;
242
256
this . observe (
243
257
this . #context. createAfterPath ,
244
258
( createPath ) => {
245
- //const oldValue = this._createAfterPath;
246
259
this . _createAfterPath = createPath ;
247
- //this.requestUpdate('_createPath', oldValue);
248
260
} ,
249
261
null ,
250
262
) ;
@@ -387,6 +399,10 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
387
399
} ;
388
400
389
401
#extensionSlotFilterMethod = ( manifest : ManifestBlockEditorCustomView ) => {
402
+ if ( ! this . _contentTypeAlias ) {
403
+ // accept no extensions if we don't have a content type alias
404
+ return false ;
405
+ }
390
406
// We do have _contentTypeAlias at this stage, cause we do use the filter method in the extension slot which first gets rendered when we have the _contentTypeAlias. [NL]
391
407
if (
392
408
manifest . forContentTypeAlias &&
@@ -416,32 +432,8 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
416
432
}
417
433
} ;
418
434
419
- #renderInlineEditBlock( ) {
420
- return html `<umb- block- grid- block- inline
421
- class= "umb-block-grid__block--view"
422
- .label = ${ this . _label }
423
- .icon = ${ this . _icon }
424
- .unpublished = ${ ! this . _exposed }
425
- .config = ${ this . _blockViewProps . config }
426
- .content = ${ this . _blockViewProps . content }
427
- .settings = ${ this . _blockViewProps . settings } > </ umb- block- grid- block- inline> ` ;
428
- //TODO: investigate if we should have ${umbDestroyOnDisconnect()} here. Note how it works for drag n' drop in grid between areas and areas-root
429
- }
430
-
431
- #renderRefBlock( ) {
432
- return html `<umb- block- grid- block
433
- class= "umb-block-grid__block--view"
434
- .label = ${ this . _label }
435
- .icon = ${ this . _icon }
436
- .unpublished = ${ ! this . _exposed }
437
- .config = ${ this . _blockViewProps . config }
438
- .content = ${ this . _blockViewProps . content }
439
- .settings = ${ this . _blockViewProps . settings } > </ umb- block- grid- block> ` ;
440
- //TODO: investigate if we should have ${umbDestroyOnDisconnect()} here. Note how it works for drag n' drop in grid between areas and areas-root
441
- }
442
-
443
- #renderBlock( ) {
444
- return this . contentKey && this . _contentTypeAlias
435
+ override render ( ) {
436
+ return this . contentKey
445
437
? html `
446
438
${ this . #renderCreateBeforeInlineButton( ) }
447
439
<div class= "umb-block-grid__block" part = "umb-block-grid__block" >
@@ -452,7 +444,7 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
452
444
default- element= ${ this . _inlineEditingMode ? 'umb-block-grid-block-inline' : 'umb-block-grid-block' }
453
445
type= "blockEditorCustomView"
454
446
single
455
- > ${ this . _inlineEditingMode ? this . #renderInlineEditBlock ( ) : this . #renderRefBlock ( ) } </ umb- extension- slot
447
+ > ${ this . #renderBuiltinBlockView ( ) } </ umb- extension- slot
456
448
>
457
449
${ this . #renderActionBar( ) }
458
450
${ ! this . _showContentEdit && this . _contentInvalid
@@ -470,6 +462,49 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
470
462
: nothing ;
471
463
}
472
464
465
+ #renderBuiltinBlockView( ) {
466
+ if ( this . _unsupported ) {
467
+ return this . #renderUnsupportedBlock( ) ;
468
+ }
469
+ if ( this . _inlineEditingMode ) {
470
+ return this . #renderInlineEditBlock( ) ;
471
+ }
472
+ return this . #renderRefBlock( ) ;
473
+ }
474
+
475
+ #renderUnsupportedBlock( ) {
476
+ return html `<umb- block- grid- block- unsuppor ted
477
+ class= "umb-block-grid__block--view"
478
+ .config = ${ this . _blockViewProps . config }
479
+ .content = ${ this . _blockViewProps . content }
480
+ .settings = ${ this . _blockViewProps . settings } > </ umb- block- grid- block- unsuppor ted> ` ;
481
+ //TODO: investigate if we should have ${umbDestroyOnDisconnect()} here. Note how it works for drag n' drop in grid between areas and areas-root
482
+ }
483
+
484
+ #renderInlineEditBlock( ) {
485
+ return html `<umb- block- grid- block- inline
486
+ class= "umb-block-grid__block--view"
487
+ .label = ${ this . _label }
488
+ .icon = ${ this . _icon }
489
+ .unpublished = ${ ! this . _exposed }
490
+ .config = ${ this . _blockViewProps . config }
491
+ .content = ${ this . _blockViewProps . content }
492
+ .settings = ${ this . _blockViewProps . settings } > </ umb- block- grid- block- inline> ` ;
493
+ //TODO: investigate if we should have ${umbDestroyOnDisconnect()} here. Note how it works for drag n' drop in grid between areas and areas-root
494
+ }
495
+
496
+ #renderRefBlock( ) {
497
+ return html `<umb- block- grid- block
498
+ class= "umb-block-grid__block--view"
499
+ .label = ${ this . _label }
500
+ .icon = ${ this . _icon }
501
+ .unpublished = ${ ! this . _exposed }
502
+ .config = ${ this . _blockViewProps . config }
503
+ .content = ${ this . _blockViewProps . content }
504
+ .settings = ${ this . _blockViewProps . settings } > </ umb- block- grid- block> ` ;
505
+ //TODO: investigate if we should have ${umbDestroyOnDisconnect()} here. Note how it works for drag n' drop in grid between areas and areas-root
506
+ }
507
+
473
508
#renderCreateBeforeInlineButton( ) {
474
509
if ( this . _isReadOnly ) return nothing ;
475
510
if ( ! this . _createBeforePath ) return nothing ;
@@ -559,10 +594,6 @@ export class UmbBlockGridEntryElement extends UmbLitElement implements UmbProper
559
594
` ;
560
595
}
561
596
562
- override render ( ) {
563
- return this . #renderBlock( ) ;
564
- }
565
-
566
597
static override styles = [
567
598
UUIBlinkKeyframes ,
568
599
css `
0 commit comments