2
0

fix(editor): 🐛 Start block was deletable

This commit is contained in:
Baptiste Arnaud
2022-02-25 08:15:30 +01:00
parent 4bb5a57f69
commit 8533bb92a8
2 changed files with 4 additions and 5 deletions

View File

@ -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)
@ -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
@ -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' }}

View File

@ -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)}