Closed ponyr1der closed 20 hours ago
Hi, I also just found out that there's an option for that, and I added types for it in a new version I just published. Have a look at the Storybook demo to see how it works:
https://marcveens.github.io/react-drawio/?path=/story/components-drawioembed--read-only
Let me know if this does the job for you!
That looks great! Is it possible when changing from view mode to edit - open drawio in the same iframe, not creating a new browser tab? Also i have my own edit button (that toggles view and edit mode), is it possible to use it to change view mode?
At this moment i made it by creating 2 pages and in each one i import DrawIoEmbed but with different urlParameters and switch between view and edit modes by routing between this 2 pages. Not the best implementation, but it works. Cons is that we need to fetch DrawIoEmbed each time that we change mode and wait for its loading. If you have a better implementation, please, share it :)
I added an example of how to toggle between view/edit mode in Storybook: https://marcveens.github.io/react-drawio/?path=/story/components-drawioembed--read-only
I needed to add a key
property to make it render properly. I'm not sure if that's only a Storybook thing, or if you also need it in a regular React application.
Is it possible to add view mode, where user can only view diagram, zoom in/out e.t.c, but can't do any changes, and can do everything in edit mode?