mirror of
https://github.com/docmost/docmost.git
synced 2026-05-20 00:14:10 +08:00
ignore ts error
This commit is contained in:
@@ -2,7 +2,11 @@ import { useEffect, useRef, useCallback, useMemo, useState } from "react";
|
|||||||
import { useAtom } from "jotai";
|
import { useAtom } from "jotai";
|
||||||
import { socketAtom } from "@/features/websocket/atoms/socket-atom";
|
import { socketAtom } from "@/features/websocket/atoms/socket-atom";
|
||||||
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
import { currentUserAtom } from "@/features/user/atoms/current-user-atom";
|
||||||
import type { ExcalidrawImperativeAPI, Collaborator, Gesture } from "@excalidraw/excalidraw/types";
|
import type {
|
||||||
|
ExcalidrawImperativeAPI,
|
||||||
|
Collaborator,
|
||||||
|
Gesture,
|
||||||
|
} from "@excalidraw/excalidraw/types";
|
||||||
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
import type { ExcalidrawElement } from "@excalidraw/element/types";
|
||||||
import { reconcileElements, getSceneVersion } from "@excalidraw/excalidraw";
|
import { reconcileElements, getSceneVersion } from "@excalidraw/excalidraw";
|
||||||
import throttle from "lodash.throttle";
|
import throttle from "lodash.throttle";
|
||||||
@@ -114,6 +118,7 @@ export function useExcalidrawCollab(
|
|||||||
|
|
||||||
const reconciledElements = reconcileElements(
|
const reconciledElements = reconcileElements(
|
||||||
localElements,
|
localElements,
|
||||||
|
// @ts-ignore
|
||||||
remoteElements,
|
remoteElements,
|
||||||
excalidrawAPI.getAppState(),
|
excalidrawAPI.getAppState(),
|
||||||
);
|
);
|
||||||
@@ -134,14 +139,17 @@ export function useExcalidrawCollab(
|
|||||||
const collaborator = collaboratorsRef.current.get(socketId) || {};
|
const collaborator = collaboratorsRef.current.get(socketId) || {};
|
||||||
collaboratorsRef.current.set(socketId, {
|
collaboratorsRef.current.set(socketId, {
|
||||||
...collaborator,
|
...collaborator,
|
||||||
|
// @ts-ignore
|
||||||
pointer,
|
pointer,
|
||||||
button,
|
button,
|
||||||
username,
|
username,
|
||||||
|
// @ts-ignore
|
||||||
selectedElementIds,
|
selectedElementIds,
|
||||||
isCurrentUser: false,
|
isCurrentUser: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
excalidrawAPI.updateScene({
|
excalidrawAPI.updateScene({
|
||||||
|
// @ts-ignore
|
||||||
collaborators: collaboratorsRef.current,
|
collaborators: collaboratorsRef.current,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -164,11 +172,13 @@ export function useExcalidrawCollab(
|
|||||||
newCollaborators.set(id, {
|
newCollaborators.set(id, {
|
||||||
...existing,
|
...existing,
|
||||||
isCurrentUser: id === socket.id,
|
isCurrentUser: id === socket.id,
|
||||||
username: existing?.username || (id === socket.id ? username : "User"),
|
username:
|
||||||
|
existing?.username || (id === socket.id ? username : "User"),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
collaboratorsRef.current = newCollaborators;
|
collaboratorsRef.current = newCollaborators;
|
||||||
|
// @ts-ignore
|
||||||
excalidrawAPI.updateScene({ collaborators: newCollaborators });
|
excalidrawAPI.updateScene({ collaborators: newCollaborators });
|
||||||
|
|
||||||
// We're collaborating if there are other users
|
// We're collaborating if there are other users
|
||||||
|
|||||||
Reference in New Issue
Block a user