selecting a band opens its settings
Name and Title, in the editor column — the band row in the nav had only scrolled the preview until now. Both, not the title alone: a form showing one of two names invites somebody to change the wrong one, and `name` could only be set when the band was created. Last in the editor's order, so a block or a spacing editor wins — those were opened deliberately, and the band is merely still selected underneath them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,6 +32,7 @@ const PLACES_ONLY: string[] = ['contact-form', 'partners'];
|
||||
import { AddSectionDialog, type SectionLayout } from './AddSectionDialog';
|
||||
import { FreeTextEditor } from './FreeTextEditor';
|
||||
import { SpacingEditor, type Padding } from './SpacingEditor';
|
||||
import { BandSettings } from './BandSettings';
|
||||
import { useEditorSlot } from '../useEditorSlot';
|
||||
import { AddComponentDialog, type ComponentKind } from './AddComponentDialog';
|
||||
import { MediaPicker } from '../MediaPicker';
|
||||
@@ -597,8 +598,22 @@ export const PageBuilderPanel = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
A band selected and nothing inside it: its own settings.
|
||||
|
||||
Last, so a block or a spacing editor wins — those are things you opened deliberately, and the
|
||||
band is merely still selected underneath them.
|
||||
*/
|
||||
const band = !piece && part ? sections.find((section) => String(section.id) === part) : null;
|
||||
if (band && page) {
|
||||
setEditorRef.current(
|
||||
<BandSettings pageId={page.id} band={band} onSaved={() => setRendered((n) => n + 1)} />,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
setEditorRef.current(null);
|
||||
}, [spacing, editing, creating, device, steps]);
|
||||
}, [spacing, editing, creating, device, steps, part, piece, sections, page]);
|
||||
|
||||
// Cleared on unmount, or the panel goes on offering an editor for a page nobody is looking at.
|
||||
useEffect(() => () => setEditorRef.current(null), []);
|
||||
|
||||
Reference in New Issue
Block a user