Skip to content

Commit 76a56cb

Browse files
hyonun321Ludovico7minjungw00pipisebastian
committed
chore: cursor operation Interface ์ˆ˜์ •
Co-authored-by: Yeonkyu Min <Ludovico7@users.noreply.github.com> Co-authored-by: minjungw00 <minjungw00@naver.com> Co-authored-by: Jang seo yun <pipisebastian@users.noreply.github.com>
1 parent 3141337 commit 76a56cb

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

โ€Ž@noctaCrdt/src/types/Interfaces.tsโ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ export interface RemoteCharUpdateOperation {
146146
export interface CursorPosition {
147147
type: "cursor";
148148
clientId: number;
149-
position: number;
149+
workspaceId: string;
150+
pageId: string;
151+
blockId: string;
152+
charId: string;
150153
}
151154

152155
export interface CRDTSerializedProps<T> {

โ€Žclient/src/utils/caretUtils.tsโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ interface SetCaretPositionProps {
66
linkedList: BlockLinkedList | TextLinkedList;
77
clientX?: number;
88
clientY?: number;
9-
position?: number; // Used to set the caret at a specific position
10-
pageId: string; // Add rootElement to scope the query
9+
position?: number;
10+
pageId: string;
1111
}
1212

1313
export const getAbsoluteCaretPosition = (element: HTMLElement): number => {

โ€Žserver/src/workspace/workspace.gateway.tsโ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,14 @@ export class WorkspaceGateway implements OnGatewayInit, OnGatewayConnection, OnG
913913
JSON.stringify(data),
914914
);
915915

916+
// broadcast์šฉ cursor operation
916917
const operation = {
917918
type: "cursor",
918919
clientId: clientInfo?.clientId,
919-
position: data.position,
920+
workspaceId: data.workspaceId,
921+
pageId: data.pageId,
922+
blockId: data.blockId,
923+
charId: data.charId,
920924
} as CursorPosition;
921925
const { workspaceId } = client.data;
922926
this.emitOperation(client.id, workspaceId, "cursor", operation, batch);

0 commit comments

Comments
ย (0)