feat(keyboard-bindings): add append shortcut

This commit is contained in:
Beatriz Mendes
2023-01-18 13:52:27 +01:00
parent 7d3d171e15
commit a3153fe59a
2 changed files with 40 additions and 1 deletions

View File

@ -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;
}
});
};

View File

@ -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;
}));
});