-
Notifications
You must be signed in to change notification settings - Fork 171
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
Input/controls constraints for viewers #4713
Conversation
Job #9811: Bundle Size — 62.2MiB (~+0.01%).
Warning Bundle contains 66 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
View job #9811 report View feat/disable-inspector-viewer branch activity |
# Conflicts: # editor/src/components/canvas/controls/new-canvas-controls.tsx # editor/src/core/performance/performance-regression-tests.spec.tsx
@@ -686,6 +686,9 @@ export function handleKeyDown( | |||
) | |||
}, | |||
[INSERT_DIV_SHORTCUT]: () => { | |||
if (!allowedToEdit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have some other INSERT_
shortcuts that might need this check then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed (not just insert_
but a lot more), but since changes cannot propagate, I added this here like we did for the text mode so the cursor does not change to a misleading crosshair, it's not meant to safeguard from the insertion per-se, as it's implicitly prevented by the collaboration
@@ -717,3 +717,11 @@ export function useAllowedToEditProject(): boolean { | |||
'useAllowedToEditProject', | |||
) | |||
} | |||
|
|||
export function useIsMyProject(): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this clash with the baton passing work? I'm thinking that a lot of the places using this check should be instead using useAllowedToEditProject
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it clashes, but it definitely makes it more granular. My take would be to wait that there are no baton-opened PRs to revisit and update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving because the code and feature looks good, but please check the question around whether useIsMyProject
is suitable for all the cases here before merging
Fixes #4712
Problem:
Fix:
useIsMyProject
hook which returns whether the user is an owner of the current project, regardless of the baton