Skip to content

Commit

Permalink
Hide sections and blocks when working with block elements
Browse files Browse the repository at this point in the history
  • Loading branch information
jzongker committed Nov 21, 2024
1 parent 2d78dbf commit b8eb1a0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/admin/ContentEditor/ContentEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export default function ContentEditor(props: Props) {
const [showHelp, setShowHelp] = useState(false);
const [navLinks, setNavLinks] = useState<any>(null);


let elementOnlyMode = false;
if (props.blockId && container?.sections?.length===1 && container?.sections[0]?.id==="") elementOnlyMode = true;

const zones:any = {
cleanCentered: ["main"],
Expand Down Expand Up @@ -265,7 +266,7 @@ export default function ContentEditor(props: Props) {

<DndProvider backend={HTML5Backend}>
{showHelp && getHelp()}
{showAdd && <ElementAdd includeBlocks={true} includeSection={true} updateCallback={() => { setShowAdd(false); }} draggingCallback={() => setShowAdd(false)} />}
{showAdd && <ElementAdd includeBlocks={!elementOnlyMode} includeSection={!elementOnlyMode} updateCallback={() => { setShowAdd(false); }} draggingCallback={() => setShowAdd(false)} />}
{editElement && <ElementEdit element={editElement} updatedCallback={() => { setEditElement(null); loadData(); }} onRealtimeChange={handleRealtimeChange} globalStyles={props.globalStyles} />}
{editSection && <SectionEdit section={editSection} updatedCallback={() => { setEditSection(null); loadData(); }} globalStyles={props.globalStyles} />}

Expand Down

0 comments on commit b8eb1a0

Please sign in to comment.