chore: clean card item

This commit is contained in:
lawvs 2022-08-18 17:59:21 +08:00
parent 0d89fa1026
commit 42cc6e9042

View File

@ -11,7 +11,7 @@ import {
styled, styled,
} from '@toeverything/components/ui'; } from '@toeverything/components/ui';
import { useFlag } from '@toeverything/datasource/feature-flags'; import { useFlag } from '@toeverything/datasource/feature-flags';
import { useState } from 'react'; import { useState, type MouseEvent } from 'react';
import { useRefPage } from './RefPage'; import { useRefPage } from './RefPage';
const CardContent = styled('div')({ const CardContent = styled('div')({
@ -101,7 +101,13 @@ export const CardItem = ({
}; };
const onClickCard = async () => { const onClickCard = async () => {
showKanbanRefPageFlag && openSubPage(id); openSubPage(id);
};
const onClickPen = (e: MouseEvent<Element>) => {
e.stopPropagation();
setEditable(true);
editor.selectionManager.activeNodeByNodeId(block.id);
}; };
return ( return (
@ -110,18 +116,9 @@ export const CardItem = ({
<CardContent> <CardContent>
<RenderBlock blockId={id} /> <RenderBlock blockId={id} />
</CardContent> </CardContent>
{!editable && ( {showKanbanRefPageFlag && !editable && (
<Overlay onClick={onClickCard}> <Overlay onClick={onClickCard}>
<IconButton <IconButton backgroundColor="#fff" onClick={onClickPen}>
backgroundColor="#fff"
onClick={e => {
e.stopPropagation();
setEditable(true);
editor.selectionManager.activeNodeByNodeId(
block.id
);
}}
>
<PenIcon /> <PenIcon />
</IconButton> </IconButton>
</Overlay> </Overlay>