File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 66 * External dependencies
77 */
88import { ColumnIcon } from '~stackable/icons'
9+ import { i18n } from 'stackable'
910
1011/**
1112 * Internal dependencies
@@ -20,6 +21,7 @@ import metadata from './block.json'
2021 * WordPress dependencies
2122 */
2223import { __ } from '@wordpress/i18n'
24+ import { select } from '@wordpress/data'
2325
2426export const settings = {
2527 ...metadata ,
@@ -38,4 +40,26 @@ export const settings = {
3840 deprecated,
3941 edit,
4042 save,
43+
44+ __experimentalLabel : ( attributes , { context } ) => {
45+ const customName = attributes ?. metadata ?. name
46+ if ( context === 'list-view' && customName ) {
47+ return customName
48+ }
49+
50+ if ( context === 'list-view' && attributes ?. uniqueId ) {
51+ const { getEditorDom } = select ( 'stackable/editor-dom' )
52+ const editorDom = getEditorDom ( )
53+ const isCarouselSlide = editorDom ?. querySelector ( `.stk-block-carousel__slider > * > * > * > * > [data-block-id="${ attributes . uniqueId } "]` )
54+ if ( isCarouselSlide ) {
55+ return __ ( 'Slide' , i18n )
56+ }
57+ const isHorizontalScroller = editorDom ?. querySelector ( `.stk-block-horizontal-scroller > * > * > * > * > * > [data-block-id="${ attributes . uniqueId } "]` )
58+ if ( isHorizontalScroller ) {
59+ return __ ( 'Slide' , i18n )
60+ }
61+ }
62+
63+ return ''
64+ } ,
4165}
You can’t perform that action at this time.
0 commit comments