Skip to content

Commit 7c9016e

Browse files
committed
style(carousel): remove trivial inline comments
1 parent 45c23d9 commit 7c9016e

2 files changed

Lines changed: 0 additions & 26 deletions

File tree

src/blocks/carousel/edit.tsx

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

src/blocks/carousel/viewport/edit.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ export default function Edit( {
3434
},
3535
} );
3636

37-
// Track actual count — used both for the empty-state check and for triggering
38-
// Embla reInit whenever the number of slides changes.
3937
const slideCount = useSelect(
4038
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4139
( select ) => ( select( 'core/block-editor' ) as any ).getBlockCount( clientId ) as number,
@@ -54,8 +52,6 @@ export default function Edit( {
5452
insertBlock( block, undefined, clientId );
5553
}, [ insertBlock, clientId ] );
5654

57-
// Stable renderAppender for the empty state — memoized so useInnerBlocksProps
58-
// doesn't see a new function reference on every render.
5955
const EmptyAppender = useCallback(
6056
() => (
6157
<div className="carousel-kit-viewport-empty">
@@ -67,9 +63,6 @@ export default function Edit( {
6763
[ addSlide ],
6864
);
6965

70-
// No default template — slide creation is handled by the carousel setup flow.
71-
// When empty, renderAppender shows the "Add Slide" button inside .embla__container
72-
// (a flex container), keeping it properly contained and at full width.
7366
const innerBlocksProps = useInnerBlocksProps(
7467
{
7568
className: 'embla__container',
@@ -86,8 +79,6 @@ export default function Edit( {
8679
},
8780
);
8881

89-
// Rerun whenever the slide count changes (slide added/removed via block inserter,
90-
// toolbar, or any other mechanism) so Embla re-indexes dots and nav state.
9182
useEffect( () => {
9283
const api = emblaRef.current
9384
? ( emblaRef.current as { [ EMBLA_KEY ]?: EmblaCarouselType } )[ EMBLA_KEY ]

0 commit comments

Comments
 (0)