feat: Support customising canvas actions 🎉 #3364
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/excalidraw/excalidraw/5bCyps1CiVWQF32Pjyb16W4rUXmf |
ad1992
left a comment
There was a problem hiding this comment.
Since these prop will be one time options (only applicable during mount) I am thinking if we should instead rename the prop to
UIOptions: {
canvasActions: {}
}
}and later shapes and selectedShapeActions can also be added to the same instead of having individual props
|
Perfect! I'll add tests and make changes to docs. |
| .filter( | ||
| (action) => | ||
| (action.name in canvasActions | ||
| ? canvasActions[action.name as keyof typeof canvasActions] |
There was a problem hiding this comment.
The consumer will still be able to pass the actions which we don't support unless using typescript. I am ok with it to start with, we can whitelist it if needed later to prevent it.
Yep the |
|
Thanks a lot for working on this @h7y ❤️ |
|
Thank you so much for the review @ad1992! ❤️ |

I've used the action names for
canvasActionsattributes to conditionally disable the respective action, except forexportsince it doesn't have an action. I'm not sure whether this is the right way to do it. Looking for feedback :)I'll add tests & make changes to docs after initial feedback.
Example with export hidden
Addresses 1/3 of #3012