a gallery block edits its gallery
Add, remove, reorder and caption, in the editor column. A gallery block on a page IS a gallery, and being sent to another section to reorder it means losing the page you were arranging it for. It reads the gallery itself from its id, so it can be dropped anywhere something knows one. GalleriesPanel still draws its own copy of this list. That is a real duplicate and it should adopt this component — its version has the same operations against the same routes, plus creating and deleting whole galleries, which this does not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ import { FreeTextEditor } from './FreeTextEditor';
|
||||
import { SpacingEditor, type Padding } from './SpacingEditor';
|
||||
import { BandSettings } from './BandSettings';
|
||||
import { BlockSettings } from './BlockSettings';
|
||||
import { GalleryItems } from './GalleryItems';
|
||||
import { useEditorSlot } from '../useEditorSlot';
|
||||
import { AddComponentDialog, type ComponentKind } from './AddComponentDialog';
|
||||
import { MediaPicker } from '../MediaPicker';
|
||||
@@ -657,14 +658,27 @@ export const PageBuilderPanel = () => {
|
||||
it are two acts — see the note in the selection effect.
|
||||
*/}
|
||||
{block.kind === 'gallery' && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8 self-start text-xs"
|
||||
onClick={() => handlersRef.current.editComponent(block)}
|
||||
>
|
||||
Choose gallery…
|
||||
</Button>
|
||||
<div className="flex flex-col gap-3">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8 self-start text-xs"
|
||||
onClick={() => handlersRef.current.editComponent(block)}
|
||||
>
|
||||
Choose gallery…
|
||||
</Button>
|
||||
|
||||
{/*
|
||||
The gallery's own contents, here rather than a link to the Galleries section.
|
||||
|
||||
A gallery block on a page IS a gallery, and being sent elsewhere to reorder it means
|
||||
losing the page you were arranging it for. `onChanged` reloads the frame, because the
|
||||
page draws this set and has just been given a different one.
|
||||
*/}
|
||||
{typeof block.content?.galleryId === 'number' && (
|
||||
<GalleryItems galleryId={block.content.galleryId} onChanged={() => setRendered((n) => n + 1)} />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(block.kind === 'media' || block.kind === 'video') && (
|
||||
|
||||
Reference in New Issue
Block a user