fix(label-editing): cancel on element deletion
Closes https://github.com/bpmn-io/bpmn-js/issues/1664
This commit is contained in:
parent
c80880fa39
commit
aa4b45da6c
|
@ -58,6 +58,16 @@ export default function LabelEditingProvider(
|
|||
}
|
||||
});
|
||||
|
||||
eventBus.on([
|
||||
'shape.remove',
|
||||
'connection.remove'
|
||||
], function(event) {
|
||||
|
||||
if (directEditing.isActive(event.element)) {
|
||||
directEditing.cancel();
|
||||
}
|
||||
});
|
||||
|
||||
// cancel on command stack changes
|
||||
eventBus.on([ 'commandStack.changed' ], function(e) {
|
||||
if (directEditing.isActive()) {
|
||||
|
|
|
@ -203,6 +203,26 @@ describe('features - label-editing', function() {
|
|||
}
|
||||
));
|
||||
|
||||
|
||||
it('should cancel on element deletion', inject(
|
||||
function(elementRegistry, directEditing, selection, modeling) {
|
||||
|
||||
// given
|
||||
var shape = elementRegistry.get('Task_1'),
|
||||
task = shape.businessObject;
|
||||
|
||||
directEditing.activate(shape);
|
||||
|
||||
directEditing._textbox.content.textContent = 'FOO BAR';
|
||||
|
||||
// when
|
||||
modeling.removeElements([ shape ]);
|
||||
|
||||
// then
|
||||
expect(task.name).not.to.equal('FOO BAR');
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue