mirror of
https://github.com/bpmn-io/bpmn-js.git
synced 2025-08-26 12:40:20 +08:00
feat(keyboard-bindings): add append shortcut
This commit is contained in:
@ -172,4 +172,22 @@ BpmnKeyboardBindings.prototype.registerBindings = function(keyboard, editorActio
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// activate append element
|
||||
// A
|
||||
addListener('appendElement', function(context) {
|
||||
|
||||
var event = context.keyEvent;
|
||||
|
||||
if (keyboard.hasModifier(event)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (keyboard.isKey([ 'a', 'A' ], event)) {
|
||||
editorActions.trigger('appendElement', event);
|
||||
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
@ -68,7 +68,8 @@ describe('features/keyboard', function() {
|
||||
'directEditing',
|
||||
'find',
|
||||
'moveToOrigin',
|
||||
'replaceElement'
|
||||
'replaceElement',
|
||||
'appendElement'
|
||||
];
|
||||
|
||||
// then
|
||||
@ -178,6 +179,26 @@ describe('features/keyboard', function() {
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should trigger append menu',
|
||||
inject(function(keyboard, popupMenu, elementRegistry, selection) {
|
||||
|
||||
sinon.spy(popupMenu, 'open');
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1');
|
||||
|
||||
selection.select(task);
|
||||
|
||||
var e = createKeyEvent(key);
|
||||
|
||||
// when
|
||||
keyboard._keyHandler(e);
|
||||
|
||||
// then
|
||||
expect(popupMenu.open).to.have.been.calledOnce;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user