mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-31 03:04:49 +00:00
d3449ca87c
* use ES6 import / export * UTILS: export individual utilities * TESTS: localize TestHelper includes BREAKING CHANGE: * all utilities export independent functions * library sources got ported to ES6. You must now use a ES module bundler such as Browserify + babelify or Webpack to consume this library (or parts of it).
35 lines
757 B
JavaScript
35 lines
757 B
JavaScript
'use strict';
|
|
|
|
import {
|
|
forEach
|
|
} from 'min-dash';
|
|
|
|
import inherits from 'inherits';
|
|
|
|
import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor';
|
|
|
|
|
|
/**
|
|
* Unclaims model IDs on element deletion.
|
|
*
|
|
* @param {EventBus} eventBus
|
|
* @param {Modeling} modeling
|
|
*/
|
|
export default function UnclaimIdBehavior(eventBus, modeling) {
|
|
|
|
CommandInterceptor.call(this, eventBus);
|
|
|
|
this.preExecute('elements.delete', function(event) {
|
|
var context = event.context,
|
|
elements = context.elements;
|
|
|
|
forEach(elements, function(element) {
|
|
modeling.unclaimId(element.businessObject.id, element.businessObject);
|
|
});
|
|
|
|
});
|
|
}
|
|
|
|
inherits(UnclaimIdBehavior, CommandInterceptor);
|
|
|
|
UnclaimIdBehavior.$inject = [ 'eventBus', 'modeling' ]; |