Skip to content

Commit 971d32e

Browse files
committed
[#118] feat: 빈공간 클릭에 따른 새로운 Block 생성 시 서버 동기화 로직 구현
1 parent 615eba5 commit 971d32e

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

frontend/src/components/pages/PageComponent/PageComponent.tsx

+2-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { Header, Title, Editor, BlockModal } from '@components/molecules';
66
import { HeaderMenu } from '@components/organisms';
77
import { useRecoilValue } from 'recoil';
88
import { pageState, staticMenuToggleState, modalState } from '@/stores';
9-
import { createBlock } from '@/utils';
109
import { useManager } from '@/hooks';
1110
import styled from '@emotion/styled';
1211
import { animated, useSpring } from 'react-spring';
@@ -42,7 +41,7 @@ function PageComponent(): JSX.Element {
4241
const page = useRecoilValue(pageState);
4342
const [
4443
{ children },
45-
{ setBlock, startTransaction, commitTransaction, setFocus },
44+
{ insertNewChild, startTransaction, commitTransaction, setFocus },
4645
] = useManager(page.rootId);
4746
const staticAreaStyleProps = useSpring({
4847
left: staticMenuToggle ? 240 : 0,
@@ -54,12 +53,8 @@ function PageComponent(): JSX.Element {
5453
setFocus(children[children.length - 1]);
5554
return;
5655
}
57-
const { parent, block } = await createBlock({
58-
parentBlockId: page.rootId,
59-
});
6056
startTransaction();
61-
setBlock(parent.id, parent);
62-
setBlock(block.id, block);
57+
const block = await insertNewChild({}, children.length);
6358
setFocus(block);
6459
commitTransaction();
6560
};

0 commit comments

Comments
 (0)