From 313b814163ee5bcaf48fd0e9cad34b6caebd523b Mon Sep 17 00:00:00 2001 From: domino8788 Date: Thu, 17 Dec 2020 10:37:24 +0900 Subject: [PATCH] =?UTF-8?q?[#122]=20refactor:=20=EB=93=A4=EC=97=AC?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/PageComponent/PageComponent.tsx | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/components/pages/PageComponent/PageComponent.tsx b/frontend/src/components/pages/PageComponent/PageComponent.tsx index d8474e1..bfdb0f1 100644 --- a/frontend/src/components/pages/PageComponent/PageComponent.tsx +++ b/frontend/src/components/pages/PageComponent/PageComponent.tsx @@ -49,18 +49,18 @@ function PageComponent(): JSX.Element { }); const createBlockHandler = async () => { - if (children[children.length - 1].value !== '') { - const { parent, block } = await createBlock({ - parentBlockId: page.rootId, - }); - startTransaction(); - setBlock(parent.id, parent); - setBlock(block.id, block); - setFocus(block); - commitTransaction(); - } else { + if (children[children.length - 1].value === '') { setFocus(children[children.length - 1]); + return; } + const { parent, block } = await createBlock({ + parentBlockId: page.rootId, + }); + startTransaction(); + setBlock(parent.id, parent); + setBlock(block.id, block); + setFocus(block); + commitTransaction(); }; return (