Command stack in viewer

Hi,
is it possible to use the command stack in the viewer .
i developed many features in the modeler part, and i heavily used the commandStack because i liked the flexibility it provides, and the commandInterceptors(by the way - great work!!)

i was wondering why the command stack is not available in viewer, and is it ok to inject it manually in the viewer and use its abilities ??

Thanks
Elia

i was wondering why the command stack is not available in viewer

Could you elaborate on why you need editing support in the viewer (which is meant to be for viewing only)?

why command stack should be only for editing?
command stack is generic enough to run any action, doesn’t matter if it is editing or not, at least that’s my perspective :slight_smile:

anyway i added it to the extention module and it works

Which actions are you composing on top of it that you’d like to use in the viewer?

custom actions
such as changing visibility of a shape

Thanks for the clarification.

I’m still not 100% sold on using the CommandStack in the viewer. But hey, I’m happy that you made it work :+1:.

I see what you mean. The commandStack is analog to the eventBus and should be in the core, so its available for everyone. Now there is a huge dependency on modeling for a couple of modules, without defining that dependency in the depends section. Modeling makes no sense to me. I mean what is modeling for? Creating things, moving things, connecting things? It’s like a collection of that things, and should only define a collection without logic in it. Maybe I want a Viewer, who can bind things, but I have to include modeling, so it is a Modeler now? However, revertable actions should be in the core, not in modeling.

Hi Tim,
i agree with every word! :slight_smile:

It is already available for everyone, it is simply not provided out of the box with every viewer.

To be clear:

  • it has zero dependencies to modeling

  • it can be included as easy as

    var viewer = new BpmnViewer({
      additionalModules: [
        commandModule
      ]
    });
    

We are happy to file you in on how our toolkits work (and why they work the way they work). Please open a separate topic and clearly make your case regarding

  • your use case
  • what you’re trying to achieve
  • what did not work (and how you expected it to work)

What exactly would you like to achieve? What would you like to bind? Let us continue the discussion in a new issue.

Thanks :sunny: