Disable bpmn element editing

Hello,

I’m looking for the way how to disable editing and the double click within a bpmn element.

any clue, thank you in advance

kind regards,

Are you speaking of a viewer instead of a modeler?

Within the modeler.

thank you.

I think @philippfromme tried to point out that you could just use the Viewer instead of the Modeler which would prevent all editing.

Anyways: I’d be also interested in this. Especially in how to prevent name-editing by double-clicking.

You can disable editing labels through intercepting the double click event as follows:


// register listener with high priority will make sure it's called first
var priority = 10000;

eventBus.on('element.dblclick', priority, function(event) {
  return false; // will cancel event
});
2 Likes

Thank you Philipp,
In which class I can intercept and override the dblclick only for the Bpmn:StartEvent and Bpmn:EndEvent elements?

kind regards,

You can easily check the type of an element and only cancel the event if the element is of a specific type:

var isAny = require('lib/features/modeling/util/ModelingUtil').isAny; // check if element is of any type

var priority = 10000;

eventBus.on('element.dblclick', priority, function(event) {
  var element = context.element;

  if (isAny(element, [ 'bpmn:StartEvent', 'bpmn:EndEvent' ])) {
    return false; // will cancel event
  }
});

You can put this into an existing feature or go for a cleaner solution and put this into a seperate module.

3 Likes

Is it possible to deactivate the Direct-Editing Feature when the User clicks on the “Append Task” menu entry in the Context Menu?

eventBus.on(‘element.dblclick’, function(event) {
return;
});