Skip to content

Commit

Permalink
feat: tab의 경우 부모요소의 +1 까지만 가능하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
pipisebastian committed Nov 27, 2024
1 parent 39a8e08 commit 6be2141
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions client/src/features/editor/hooks/useMarkdownGrammer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,17 @@ export const useMarkdownGrammer = ({
updateEditorState();
}
} else {
// tab: 들여쓰기 증가
const maxIndent = 3;
if (!currentBlock.prev) return;

let parentIndent =

Check failure on line 347 in client/src/features/editor/hooks/useMarkdownGrammer.ts

View workflow job for this annotation

GitHub Actions / Lint and Unit Test

'parentIndent' is never reassigned. Use 'const' instead
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;
Expand Down

0 comments on commit 6be2141

Please sign in to comment.