You have full control over how to interpret a key stroke.
If you intend to implement such a shortcut, simply check if an element is selected before deciding what to do in your BpmnKeyboardBindings override:
function MyCustomKeyboardBindings(selection, keyboard) {
// contextual activate
// E
keyboard.addListener(function(context) {
var event = context.keyEvent;
if (selection.get().length) {
// do this
} else {
// do that;
}
// indicate we handled the key stroke
return true;
});
}
What is the correct procedure to pass the selection value to that file?
My CustomKeyboard file is
import KeyboardBindings from 'playbooks-bpmn-js/lib/features/keyboard/BpmnKeyboardBindings';
export default class CustomKeyboard extends KeyboardBindings {
constructor(injector) {
super(injector);
injector.invoke(KeyboardBindings, this);
}
public registerBindings(keyboard, editorActions, eventBus) {
// (1) register another listener with a higher priority so it's called first
keyboard.addListener(10000, context => {
const event = context.keyEvent;
if (keyboard.isKey(['e'], event)) {
console.log('E WAS PRESSED');
}
});
}
}