feat(replace): keep element ID on replace

Closes #513
This commit is contained in:
Philipp Fromme
2016-06-07 16:45:47 +02:00
committed by Nico Rehwaldt
parent 2a989465fb
commit 6da1a0cb63
3 changed files with 20 additions and 18 deletions

View File

@ -57,9 +57,6 @@ function ReplaceElementBehaviour(eventBus, bpmnReplace, bpmnRules, elementRegist
attachers = oldShape.attachers,
canReplace;
modeling.unclaimId(oldShape.businessObject.id, oldShape.businessObject);
modeling.claimId(newShape.businessObject.id, newShape.businessObject);
if (attachers && attachers.length) {
canReplace = bpmnRules.canReplace(attachers, newShape);
@ -67,6 +64,15 @@ function ReplaceElementBehaviour(eventBus, bpmnReplace, bpmnRules, elementRegist
}
}, this);
this.postExecuted( [ 'shape.replace' ], 1500, function(e) {
var context = e.context,
oldShape = context.oldShape,
newShape = context.newShape;
modeling.unclaimId(oldShape.businessObject.id, oldShape.businessObject);
modeling.updateProperties(newShape, { id: oldShape.id });
});
}
inherits(ReplaceElementBehaviour, CommandInterceptor);