Switch between Viewer and Modeler


#1

Hello,
in my project I would like to switch from BPMN viewer to BPMN modeler for the same file.
Is there any kind of best practise?

Expected Behavior

It would be nice if I can use the same libary to use viewer and modeler.
Maybe is there any kind of flag, which I not discovered until now, to decide whether a diagram is editable or not.

Actual Behavior

At the moment I have one view which shows the bpmn viewer to show a diagram. By click on an edit button a new view with the bpmn modeler is loaded. This switch is working, because I use viewer.clear() and viewer.detach().

If I want to go back from modeler to viewer, I have the issue that the palette control is still available at the viewer. My impression is that modeler.detach() is not working in the same way like viewer.detach().

I also tried to use modeler.destroy() but it had other side effects.

I have read there where a lot of other request related to this topic, but unfortunately this ReadOnly.js seams to be to old or not working anymore. I did’t find any alternative.

Many Thanks in advanced,
Best Regards,
Anja


#2

The modeler has no built-in readonly mode.

Could you provide us with a small demo based on our modeler starter that reproduces the behavior you’re seeing? Switching between Viewer and Modeler should work fine and is the recommended way to tackle this task.

Another approach would be to disable keyboard shortcuts and add an overlay to make the modeler a viewer.

Even more approaches have been discussed previously in this forum.


#3

Hi Nikku,

thank you very much for your fast reply.
I modified the starter example and it worked perfectly.
So, … I guest the issue is on my environment. :frowning:

Have a nice day.
Best Regards,
Anja