Skip to content

Commit dfe424b

Browse files
authored
Fix/#266-B: 누락된 setIsOpen로직 추가 (#269)
1 parent 9d554c6 commit dfe424b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

client/src/components/Mom/Block/TextBlock.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,22 @@ function TextBlock({
127127
};
128128
}, []);
129129

130+
useEffect(() => {
131+
updateCaretPosition();
132+
}, [isOpen]);
133+
130134
// 로컬에서 일어나는 작성 - 삽입과 삭제 연산
131135
const onInput: React.FormEventHandler = (e) => {
132136
setOffset();
133137

138+
if (!blockRef.current) return;
139+
140+
if (blockRef.current.innerText === '/') {
141+
setIsOpen(true);
142+
} else if (isOpen) {
143+
setIsOpen(false);
144+
}
145+
134146
if (offsetRef.current === null) return;
135147

136148
const event = e.nativeEvent as InputEvent;

0 commit comments

Comments
 (0)