Skip to content

Commit

Permalink
Merge pull request #194 from boostcampwm-2024/Feature/#193_한글_캐럿_업데이트…
Browse files Browse the repository at this point in the history
…되는_문제_수정

Feature/#193 한글 캐럿 계속 업데이트 되는 문제 수정
  • Loading branch information
github-actions[bot] authored Nov 26, 2024
2 parents c65fde7 + e08bc44 commit e2fc884
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
14 changes: 3 additions & 11 deletions client/src/features/editor/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,14 @@ interface EditorProps {
onTitleChange: (title: string) => void;
pageId: string;
serializedEditorData: serializedEditorDataProps;
updatePageData: (pageId: string, newData: serializedEditorDataProps) => void;
}
interface ClipboardMetadata {
value: string;
style: string[];
color: TextColorType | undefined;
backgroundColor: BackgroundColorType | undefined;
}
export const Editor = ({
onTitleChange,
pageId,
serializedEditorData,
updatePageData,
}: EditorProps) => {
export const Editor = ({ onTitleChange, pageId, serializedEditorData }: EditorProps) => {
const {
sendCharInsertOperation,
sendCharDeleteOperation,
Expand Down Expand Up @@ -194,7 +188,7 @@ export const Editor = ({
linkedList: editorCRDT.current.LinkedList,
});
},
[sendCharInsertOperation, sendCharDeleteOperation, editorCRDT, pageId, updatePageData],
[sendCharInsertOperation, sendCharDeleteOperation, editorCRDT, pageId],
);

const handleKeyDown = (
Expand Down Expand Up @@ -355,9 +349,8 @@ export const Editor = ({
});

block.crdt.currentCaret = caretPosition;
updatePageData(pageId, editorCRDT.current.serialize());
},
[editorCRDT, pageId, sendCharInsertOperation, updatePageData],
[editorCRDT, pageId, sendCharInsertOperation],
);

const subscriptionRef = useRef(false);
Expand Down Expand Up @@ -481,7 +474,6 @@ export const Editor = ({
clock: editorCRDT.current.clock,
linkedList: editorCRDT.current.LinkedList,
}));
updatePageData(pageId, editorCRDT.current.serialize());
};

// 로딩 상태 체크
Expand Down
5 changes: 1 addition & 4 deletions client/src/features/page/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ interface PageProps extends PageType {
handlePageSelect: ({ pageId, isSidebar }: { pageId: string; isSidebar?: boolean }) => void;
handlePageClose: (pageId: string) => void;
handleTitleChange: (pageId: string, newTitle: string) => void;
updatePageData: (pageId: string, newData: serializedEditorDataProps) => void;
serializedEditorData: serializedEditorDataProps | null;
}

Expand All @@ -26,7 +25,6 @@ export const Page = ({
handlePageSelect,
handlePageClose,
handleTitleChange,
updatePageData,
serializedEditorData,
}: PageProps) => {
const { position, size, pageDrag, pageResize, pageMinimize, pageMaximize } = usePage({ x, y });
Expand All @@ -46,7 +44,7 @@ export const Page = ({
// serializedEditorData prop이 변경되면 local state도 업데이트
useEffect(() => {
setSerializedEditorDatas(serializedEditorData);
}, [serializedEditorData, updatePageData]);
}, [serializedEditorData]);

if (!serializedEditorDatas) {
return null;
Expand Down Expand Up @@ -76,7 +74,6 @@ export const Page = ({
onTitleChange={onTitleChange}
pageId={id}
serializedEditorData={serializedEditorDatas}
updatePageData={updatePageData}
/>
{DIRECTIONS.map((direction) => (
<motion.div
Expand Down
2 changes: 0 additions & 2 deletions client/src/features/workSpace/WorkSpace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const WorkSpace = () => {
updatePageTitle,
initPages,
initPagePosition,
updatePageData,
openPage,
} = usePagesManage(workspace, clientId);
const visiblePages = pages.filter((page) => page.isVisible);
Expand Down Expand Up @@ -69,7 +68,6 @@ export const WorkSpace = () => {
handlePageSelect={selectPage}
handlePageClose={closePage}
handleTitleChange={updatePageTitle}
updatePageData={updatePageData}
/>
) : null,
)}
Expand Down

0 comments on commit e2fc884

Please sign in to comment.