This commit is contained in:
Tom Moor
2023-07-17 20:10:27 -04:00
parent 64b2718673
commit 60b456f35a

View File

@@ -106,11 +106,13 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
presence.updateFromAwarenessChangeEvent(documentId, event);
event.states.forEach(({ user, scrollY }) => {
if (scrollY !== undefined && user?.id === ui.observingUserId) {
window.scrollTo({
top: scrollY * window.innerHeight,
behavior: "smooth",
});
if (user) {
if (scrollY !== undefined && user.id === ui.observingUserId) {
window.scrollTo({
top: scrollY * window.innerHeight,
behavior: "smooth",
});
}
}
});
});