@@ -6,7 +6,6 @@ import { Header, Title, Editor, BlockModal } from '@components/molecules';
6
6
import { HeaderMenu } from '@components/organisms' ;
7
7
import { useRecoilValue } from 'recoil' ;
8
8
import { pageState , staticMenuToggleState , modalState } from '@/stores' ;
9
- import { createBlock } from '@/utils' ;
10
9
import { useManager } from '@/hooks' ;
11
10
import styled from '@emotion/styled' ;
12
11
import { animated , useSpring } from 'react-spring' ;
@@ -42,7 +41,7 @@ function PageComponent(): JSX.Element {
42
41
const page = useRecoilValue ( pageState ) ;
43
42
const [
44
43
{ children } ,
45
- { setBlock , startTransaction, commitTransaction, setFocus } ,
44
+ { insertNewChild , startTransaction, commitTransaction, setFocus } ,
46
45
] = useManager ( page . rootId ) ;
47
46
const staticAreaStyleProps = useSpring ( {
48
47
left : staticMenuToggle ? 240 : 0 ,
@@ -54,12 +53,8 @@ function PageComponent(): JSX.Element {
54
53
setFocus ( children [ children . length - 1 ] ) ;
55
54
return ;
56
55
}
57
- const { parent, block } = await createBlock ( {
58
- parentBlockId : page . rootId ,
59
- } ) ;
60
56
startTransaction ( ) ;
61
- setBlock ( parent . id , parent ) ;
62
- setBlock ( block . id , block ) ;
57
+ const block = await insertNewChild ( { } , children . length ) ;
63
58
setFocus ( block ) ;
64
59
commitTransaction ( ) ;
65
60
} ;
0 commit comments