I am using the following code to add keyboard events to the Invision Power Board editor, but those combinations have been reserved for the Rich editor already. console.log(event);
outputs on both Ctrl and B, but not Ctrl+B at the same time. The combinations are simply not read by the event handler on Plaintext mode.
The code works on this site and others. How can I add to them/unblock them on IPB?
document.addEventListener('keydown', function(event) {
if (event.ctrlKey) {
switch (event.keyCode) {
case 66:
event.preventDefault();
console.log('b pressed');
break;
case 73:
event.preventDefault();
console.log('i pressed');
break;
case 85:
event.preventDefault();
console.log('u pressed');
break;
}
}
}, false);