Skip to content

Commit cfde378

Browse files
authored
Fix/#361-B: init 후에도 Caret이 유지되게 해결 (#364)
* fix: init 후에도 Caret이 유지되게 해결 Resolve: #361 * refactor: TextBlock에서 onClick 함수 제거 Resolve: #361
1 parent ee92ec1 commit cfde378

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

client/src/components/Block/TextBlock.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ function TextBlock({
9090
if (!blockRef.current) return;
9191

9292
blockRef.current.innerText = readCRDT();
93+
94+
updateCaretPosition();
9395
};
9496

9597
const onInsert = (op: RemoteInsertOperation) => {

client/src/hooks/useOffset.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,12 @@ export function useOffset(blockRef: React.RefObject<HTMLParagraphElement>) {
5353
}
5454
};
5555

56+
const onClick = () => {
57+
setOffset();
58+
};
59+
5660
const offsetHandlers = {
57-
onClick: setOffset,
61+
onClick,
5862
onBlur: clearOffset,
5963
onKeyUp: onArrowKeyup,
6064
};

0 commit comments

Comments
 (0)