@@ -58,16 +58,13 @@ export default function Edit( {
5858
5959 const { replaceInnerBlocks, insertBlock } = useDispatch ( 'core/block-editor' ) ;
6060
61- // Existing carousels (before this feature) already have inner blocks;
62- // skip the setup screen for them even though isSetup is still false.
6361 const hasInnerBlocks = useSelect (
6462 ( select ) =>
6563 // eslint-disable-next-line @typescript-eslint/no-explicit-any
6664 ( select ( 'core/block-editor' ) as any ) . getBlockCount ( clientId ) > 0 ,
6765 [ clientId ] ,
6866 ) ;
6967
70- // Find the viewport block so the carousel-level toolbar can insert slides into it.
7168 const viewportClientId = useSelect (
7269 ( select ) => {
7370 // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -84,10 +81,6 @@ export default function Edit( {
8481 insertBlock ( createBlock ( 'carousel-kit/carousel-slide' ) , undefined , viewportClientId ) ;
8582 } , [ insertBlock , viewportClientId ] ) ;
8683
87- // Show the setup screen only for a genuinely fresh insertion.
88- // hasInnerBlocks alone is the reliable gate: existing carousels already have
89- // inner blocks so they skip setup; a new carousel has none until the user picks.
90- // This avoids persisting editor-only state (isSetup) into post content.
9184 const showSetup = ! hasInnerBlocks ;
9285
9386 // Fetch registered block types for the allowed-blocks token field
@@ -109,7 +102,6 @@ export default function Edit( {
109102 } as React . CSSProperties ,
110103 } ) ;
111104
112- // No template — setup is handled via replaceInnerBlocks
113105 const innerBlocksProps = useInnerBlocksProps ( blockProps , { } ) ;
114106
115107 const carouselOptions = useMemo (
@@ -147,9 +139,6 @@ export default function Edit( {
147139 ] ,
148140 ) ;
149141
150- /**
151- * Controls + Dots in a flex-row group with space-between.
152- */
153142 const createNavGroup = ( ) =>
154143 createBlock (
155144 'core/group' ,
@@ -166,9 +155,6 @@ export default function Edit( {
166155 ] ,
167156 ) ;
168157
169- // Create N slides, each with a single empty paragraph.
170- // No wrapper group — avoids any persistent padding or layout constraints
171- // that would interfere with the user's own content structure.
172158 const handleSetup = ( slideCount : number ) => {
173159 const slides = Array . from ( { length : slideCount } , ( ) =>
174160 createBlock ( 'carousel-kit/carousel-slide' , { } , [
@@ -194,7 +180,6 @@ export default function Edit( {
194180 ) ;
195181 } ;
196182
197- // ── Shared inspector panels ──────────────────────────────────────────────
198183 const inspectorControls = (
199184 < >
200185 < InspectorControls >
@@ -400,7 +385,6 @@ export default function Edit( {
400385 </ >
401386 ) ;
402387
403- // ── Setup / chooser screen ───────────────────────────────────────────────
404388 if ( showSetup ) {
405389 return (
406390 < EditorCarouselContext . Provider value = { contextValue } >
@@ -439,7 +423,6 @@ export default function Edit( {
439423 ) ;
440424 }
441425
442- // ── Normal carousel editor ───────────────────────────────────────────────
443426 return (
444427 < EditorCarouselContext . Provider value = { contextValue } >
445428 < BlockControls >
0 commit comments