camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.49k stars 479 forks source link

Make `context` easily available in Plugins #2138

Open MaxTru opened 3 years ago

MaxTru commented 3 years ago

Is your feature request related to a problem? Please describe.

In the current situation, there is no clear best-practice way of how to access the current modeler context from within a plugin.

Example: the ElementTemplatesModal requires access to the elementTemplates service via the active modeler instance of the active tab. There is no clear apparent way of how to do that (see analysis on this board: https://miro.com/app/board/o9J_lTaSpoI=/).

This leads to:

Describe the solution you'd like

There should be a best-practice public API mechanism to get access to the current modeler instance from within a Camunda Modeler Plugin / React component.

We need to:

Describe alternatives you've considered

Additional context

See https://miro.com/app/board/o9J_lTaSpoI=/

pinussilvestrus commented 3 years ago

We recently implemented something similar in properties-panel-next.

function MyPlugin(props) {
  const elementTemplates = useService('elementTemplates');

  // do stuff ...
}