From d9d8f2055ff34b2c5e2ca7167c9728ecd3e0bb19 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 7 Aug 2017 16:23:37 +0100 Subject: [PATCH 1/2] Allow default for ctrl+shift+b, ctrl+shift+u in RTE fixes vector-im/riot-web#4750 --- src/components/views/rooms/MessageComposerInput.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index c16348300f..68df8fce57 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -104,7 +104,11 @@ export default class MessageComposerInput extends React.Component { } // Allow opening of dev tools. getDefaultKeyBinding would be 'italic' for KEY_I - if (e.keyCode === KeyCode.KEY_I && e.shiftKey && e.ctrlKey) { + // Likewise protect bold and underline (in case some browsers use these as + // shortcuts for things). + if ([KeyCode.KEY_B, KeyCode.KEY_I, KeyCode.KEY_U].includes(e.keyCode) && + e.shiftKey && e.ctrlKey + ) { // When null is returned, draft-js will NOT preventDefault, allowing dev tools // to be toggled when the editor is focussed return null; From 641fda01622754f31a7b49629a617440317c86c1 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Mon, 7 Aug 2017 16:29:22 +0100 Subject: [PATCH 2/2] Adjust comment --- src/components/views/rooms/MessageComposerInput.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 68df8fce57..f2c6c3a054 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -109,8 +109,7 @@ export default class MessageComposerInput extends React.Component { if ([KeyCode.KEY_B, KeyCode.KEY_I, KeyCode.KEY_U].includes(e.keyCode) && e.shiftKey && e.ctrlKey ) { - // When null is returned, draft-js will NOT preventDefault, allowing dev tools - // to be toggled when the editor is focussed + // When null is returned, draft-js will NOT preventDefault return null; }