Skip to content

Commit

Permalink
fix(editor): 🐛 Start block was deletable
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Feb 25, 2022
1 parent 4bb5a57 commit 8533bb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const BlockNode = ({ block, blockIndex }: Props) => {
const isPreviewing =
previewingEdge?.to.blockId === block.id ||
previewingEdge?.from.blockId === block.id
const isStartBlock =
block.steps.length === 1 && block.steps[0].type === 'start'
const isStartBlock = block.steps[0].type === 'start'

const blockCoordinates = blocksCoordinates[block.id]
const blockRef = useRef<HTMLDivElement | null>(null)
Expand Down Expand Up @@ -96,7 +95,7 @@ export const BlockNode = ({ block, blockIndex }: Props) => {
return (
<ContextMenu<HTMLDivElement>
renderMenu={() => <BlockNodeContextMenu blockIndex={blockIndex} />}
isDisabled={isReadOnly}
isDisabled={isReadOnly || isStartBlock}
>
{(ref, isOpened) => (
<DraggableCore
Expand Down Expand Up @@ -135,7 +134,7 @@ export const BlockNode = ({ block, blockIndex }: Props) => {
defaultValue={block.title}
onSubmit={handleTitleSubmit}
fontWeight="semibold"
pointerEvents={isReadOnly ? 'none' : 'auto'}
pointerEvents={isReadOnly || isStartBlock ? 'none' : 'auto'}
>
<EditablePreview
_hover={{ bgColor: 'gray.300' }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const StepNodesList = ({
<Stack
spacing={1}
transition="none"
pointerEvents={isReadOnly ? 'none' : 'auto'}
pointerEvents={isReadOnly || isStartBlock ? 'none' : 'auto'}
>
<Flex
ref={handlePushElementRef(0)}
Expand Down

0 comments on commit 8533bb9

Please sign in to comment.