Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#193 한글 캐럿 계속 업데이트 되는 문제 수정 #194

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading