From 6be21417aeb503ccd94facb0d34c232379a94ce9 Mon Sep 17 00:00:00 2001 From: pipisebastian Date: Thu, 28 Nov 2024 03:33:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20tab=EC=9D=98=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=EB=B6=80=EB=AA=A8=EC=9A=94=EC=86=8C=EC=9D=98=20+1=20=EA=B9=8C?= =?UTF-8?q?=EC=A7=80=EB=A7=8C=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #213 --- .../src/features/editor/hooks/useMarkdownGrammer.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/src/features/editor/hooks/useMarkdownGrammer.ts b/client/src/features/editor/hooks/useMarkdownGrammer.ts index 96b64bfa..56b92e97 100644 --- a/client/src/features/editor/hooks/useMarkdownGrammer.ts +++ b/client/src/features/editor/hooks/useMarkdownGrammer.ts @@ -342,8 +342,17 @@ export const useMarkdownGrammer = ({ updateEditorState(); } } else { - // tab: 들여쓰기 증가 - const maxIndent = 3; + if (!currentBlock.prev) return; + + let parentIndent = + editorCRDT.LinkedList.nodeMap[JSON.stringify(currentBlock.prev)].indent; + + const maxIndent = Math.min( + parentIndent + 1, // 부모 indent + 1 + 2, // 들여쓰기 최대 indent + ); + + // 현재 indent가 허용된 최대값보다 작을 때만 들여쓰기 증가 if (currentBlock.indent < maxIndent) { const isOrderedList = currentBlock.type === "ol"; currentBlock.indent += 1;