fix(editor): 🐛 Start block was deletable
This commit is contained in:
@ -38,8 +38,7 @@ export const BlockNode = ({ block, blockIndex }: Props) => {
|
|||||||
const isPreviewing =
|
const isPreviewing =
|
||||||
previewingEdge?.to.blockId === block.id ||
|
previewingEdge?.to.blockId === block.id ||
|
||||||
previewingEdge?.from.blockId === block.id
|
previewingEdge?.from.blockId === block.id
|
||||||
const isStartBlock =
|
const isStartBlock = block.steps[0].type === 'start'
|
||||||
block.steps.length === 1 && block.steps[0].type === 'start'
|
|
||||||
|
|
||||||
const blockCoordinates = blocksCoordinates[block.id]
|
const blockCoordinates = blocksCoordinates[block.id]
|
||||||
const blockRef = useRef<HTMLDivElement | null>(null)
|
const blockRef = useRef<HTMLDivElement | null>(null)
|
||||||
@ -96,7 +95,7 @@ export const BlockNode = ({ block, blockIndex }: Props) => {
|
|||||||
return (
|
return (
|
||||||
<ContextMenu<HTMLDivElement>
|
<ContextMenu<HTMLDivElement>
|
||||||
renderMenu={() => <BlockNodeContextMenu blockIndex={blockIndex} />}
|
renderMenu={() => <BlockNodeContextMenu blockIndex={blockIndex} />}
|
||||||
isDisabled={isReadOnly}
|
isDisabled={isReadOnly || isStartBlock}
|
||||||
>
|
>
|
||||||
{(ref, isOpened) => (
|
{(ref, isOpened) => (
|
||||||
<DraggableCore
|
<DraggableCore
|
||||||
@ -135,7 +134,7 @@ export const BlockNode = ({ block, blockIndex }: Props) => {
|
|||||||
defaultValue={block.title}
|
defaultValue={block.title}
|
||||||
onSubmit={handleTitleSubmit}
|
onSubmit={handleTitleSubmit}
|
||||||
fontWeight="semibold"
|
fontWeight="semibold"
|
||||||
pointerEvents={isReadOnly ? 'none' : 'auto'}
|
pointerEvents={isReadOnly || isStartBlock ? 'none' : 'auto'}
|
||||||
>
|
>
|
||||||
<EditablePreview
|
<EditablePreview
|
||||||
_hover={{ bgColor: 'gray.300' }}
|
_hover={{ bgColor: 'gray.300' }}
|
||||||
|
@ -119,7 +119,7 @@ export const StepNodesList = ({
|
|||||||
<Stack
|
<Stack
|
||||||
spacing={1}
|
spacing={1}
|
||||||
transition="none"
|
transition="none"
|
||||||
pointerEvents={isReadOnly ? 'none' : 'auto'}
|
pointerEvents={isReadOnly || isStartBlock ? 'none' : 'auto'}
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
ref={handlePushElementRef(0)}
|
ref={handlePushElementRef(0)}
|
||||||
|
Reference in New Issue
Block a user