Disable bpmn element editing


#1

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,


#2

Are you speaking of a viewer instead of a modeler?


#3

Within the modeler.

thank you.


#4

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.


#5

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
});

#6

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

kind regards,


#7

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.


#8

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