mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-26 04:32:44 +08:00
fix(modeling/copy-paste): copy referenced message if not present
Related to https://github.com/camunda/camunda-modeler/issues/1639
This commit is contained in:

committed by
fake-join[bot]
![fake-join[bot]](/assets/img/avatar_default.png)
parent
4bafbe5d8b
commit
dc5a566e10
@ -28,7 +28,9 @@ var LOW_PRIORITY = 500;
|
||||
* Add referenced root elements (error, escalation, message, signal) if they don't exist.
|
||||
* Copy referenced root elements on copy & paste.
|
||||
*/
|
||||
export default function RootElementReferenceBehavior(bpmnjs, eventBus, injector) {
|
||||
export default function RootElementReferenceBehavior(
|
||||
bpmnjs, eventBus, injector, moddleCopy, bpmnFactory
|
||||
) {
|
||||
injector.invoke(CommandInterceptor, this);
|
||||
|
||||
function hasRootElement(rootElement) {
|
||||
@ -140,6 +142,13 @@ export default function RootElementReferenceBehavior(bpmnjs, eventBus, injector)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hasRootElement(referencedRootElement)) {
|
||||
referencedRootElement = moddleCopy.copyElement(
|
||||
referencedRootElement,
|
||||
bpmnFactory.create(referencedRootElement.$type)
|
||||
);
|
||||
}
|
||||
|
||||
eventDefinition.set(getRootElementReferencePropertyName(eventDefinition), referencedRootElement);
|
||||
});
|
||||
}
|
||||
@ -147,7 +156,9 @@ export default function RootElementReferenceBehavior(bpmnjs, eventBus, injector)
|
||||
RootElementReferenceBehavior.$inject = [
|
||||
'bpmnjs',
|
||||
'eventBus',
|
||||
'injector'
|
||||
'injector',
|
||||
'moddleCopy',
|
||||
'bpmnFactory'
|
||||
];
|
||||
|
||||
inherits(RootElementReferenceBehavior, CommandInterceptor);
|
||||
|
Reference in New Issue
Block a user