chore(copy-paste): temporarily prevent consecutive paste
This prevents users from creating invalid models due to IDs not properly being generated on consecutive paste (#686). Closes #688.
This commit is contained in:
parent
4a83d7a060
commit
8e55edd80f
|
@ -30,7 +30,9 @@ function removeProperties(element, properties) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canvas, bpmnRules) {
|
function BpmnCopyPaste(
|
||||||
|
bpmnFactory, eventBus, copyPaste,
|
||||||
|
clipboard, canvas, bpmnRules) {
|
||||||
|
|
||||||
var helper = new ModelCloneHelper(eventBus);
|
var helper = new ModelCloneHelper(eventBus);
|
||||||
|
|
||||||
|
@ -138,6 +140,14 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
||||||
'triggeredByEvent'
|
'triggeredByEvent'
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
eventBus.on('commandStack.elements.paste.postExecuted', function() {
|
||||||
|
// temporarily disable multi paste until #686
|
||||||
|
// is addressed
|
||||||
|
clipboard.clear();
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,7 +156,6 @@ BpmnCopyPaste.$inject = [
|
||||||
'eventBus',
|
'eventBus',
|
||||||
'copyPaste',
|
'copyPaste',
|
||||||
'clipboard',
|
'clipboard',
|
||||||
'moddle',
|
|
||||||
'canvas',
|
'canvas',
|
||||||
'bpmnRules'
|
'bpmnRules'
|
||||||
];
|
];
|
||||||
|
|
|
@ -58,6 +58,38 @@ describe('features/copy-paste', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
it('should forbid multi paste', inject(
|
||||||
|
function(elementRegistry, canvas, copyPaste) {
|
||||||
|
// given
|
||||||
|
var element = elementRegistry.get('SubProcess_1kd6ist'),
|
||||||
|
rootElement = canvas.getRootElement();
|
||||||
|
|
||||||
|
// when
|
||||||
|
copyPaste.copy(element);
|
||||||
|
|
||||||
|
copyPaste.paste({
|
||||||
|
element: rootElement,
|
||||||
|
point: {
|
||||||
|
x: 600,
|
||||||
|
y: 100
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
copyPaste.paste({
|
||||||
|
element: rootElement,
|
||||||
|
point: {
|
||||||
|
x: 600,
|
||||||
|
y: 275
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// then
|
||||||
|
// pasted was only once
|
||||||
|
expect(rootElement.children).to.have.length(2);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
describe('integration', function() {
|
describe('integration', function() {
|
||||||
|
|
||||||
it('should retain label\'s relative position',
|
it('should retain label\'s relative position',
|
||||||
|
@ -489,6 +521,7 @@ describe('features/copy-paste', function() {
|
||||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||||
|
|
||||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue