diff --git a/src/core/components/sidepanels/panels/add-blocks/AddBlocks.tsx b/src/core/components/sidepanels/panels/add-blocks/AddBlocks.tsx index 27b10af8..fdc602f4 100644 --- a/src/core/components/sidepanels/panels/add-blocks/AddBlocks.tsx +++ b/src/core/components/sidepanels/panels/add-blocks/AddBlocks.tsx @@ -67,10 +67,12 @@ const AddBlocksPanel = ({ className, showHeading = true, parentId = undefined, + tabs = ["library", "core", "html"], }: { parentId?: string; showHeading?: boolean; className?: string; + tabs?: string[]; }) => { const { t } = useTranslation(); const [tab, setTab] = useAtom(addBlockTabAtom); @@ -100,15 +102,15 @@ const AddBlocksPanel = ({ {importHTMLSupport ? {t("Import")} : null} - {tab === "core" && ( + {tabs.includes("core") && tab === "core" && (
)} - {tab === "library" && } - {tab === "html" && importHTMLSupport ? : null} + {tabs.includes("library") && tab === "library" && } + {tabs.includes("html") && tab === "html" && importHTMLSupport ? : null} ); }; diff --git a/src/core/hooks/index.ts b/src/core/hooks/index.ts index d0e26284..479cc63a 100644 --- a/src/core/hooks/index.ts +++ b/src/core/hooks/index.ts @@ -33,6 +33,7 @@ import { useCodeEditor } from "./useCodeEditor.ts"; import { useGlobalBlocksList, useGlobalBlocksStore } from "./useGlobalBlocksStore.ts"; import { useLanguages } from "./useLanguages.ts"; import { useBlockHighlight } from "./useBlockHighlight.ts"; +import { useDraggedBlock } from "./useDraggedBlock.ts"; export { useLayoutVariant } from "./useLayoutVariant.ts"; export { useBlocksStoreUndoableActions } from "../history/useBlocksStoreUndoableActions.ts"; export { @@ -44,6 +45,7 @@ export { useBuilderReset, useAddBlock, useAddClassesToBlocks, + useDraggedBlock, useCanvasWidth, useCanvasZoom, useBuilderProp, diff --git a/src/core/hooks/useDraggedBlock.tsx b/src/core/hooks/useDraggedBlock.tsx new file mode 100644 index 00000000..7f61d454 --- /dev/null +++ b/src/core/hooks/useDraggedBlock.tsx @@ -0,0 +1,7 @@ +import { useAtom } from "jotai"; +import { draggedBlockAtom } from "../components/canvas/dnd/atoms.ts"; + +export const useDraggedBlock = () => { + const [draggedBlock, setDraggedBlockAtom] = useAtom(draggedBlockAtom); + return [draggedBlock, setDraggedBlockAtom]; +};