Skip to content

Commit

Permalink
only in readonly mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gempir committed Feb 10, 2024
1 parent 50f97f7 commit 506065a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions web/src/components/Overlay/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ export function CustomEditor(props: Partial<TldrawProps> & Props) {
roomId: props.roomId,
hostUrl: yjsWsUrl,
});

const handleMount = (editor: Editor) => {
editor.setCamera({ x: 0, y: 0, z: 1 });
editor.updateInstanceState({ isReadonly: true, canMoveCamera: false })
editor.selectNone();
}
if (props.readonly) {
editor.setCamera({ x: 0, y: 0, z: 1 });
editor.updateInstanceState({ isReadonly: true, canMoveCamera: false })
editor.selectNone();
}
}

return <Tldraw onMount={handleMount} inferDarkMode store={store} {...props} />
}

0 comments on commit 506065a

Please sign in to comment.