From ba31a324406832073a3232526138eb896d412134 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Tue, 27 Jun 2017 15:17:57 +0100 Subject: [PATCH] Allow toggling of dev tools when RTE focussed --- src/KeyCode.js | 23 +++++++++++++++++++ .../views/rooms/MessageComposerInput.js | 7 ++++++ 2 files changed, 30 insertions(+) diff --git a/src/KeyCode.js b/src/KeyCode.js index 28aafc00cb..90c2caeb0e 100644 --- a/src/KeyCode.js +++ b/src/KeyCode.js @@ -30,7 +30,30 @@ module.exports = { RIGHT: 39, DOWN: 40, DELETE: 46, + KEY_A: 65, + KEY_B: 66, + KEY_C: 67, KEY_D: 68, KEY_E: 69, + KEY_F: 70, + KEY_G: 71, + KEY_H: 72, + KEY_I: 73, + KEY_J: 74, + KEY_K: 75, + KEY_L: 76, KEY_M: 77, + KEY_N: 78, + KEY_O: 79, + KEY_P: 80, + KEY_Q: 81, + KEY_R: 82, + KEY_S: 83, + KEY_T: 84, + KEY_U: 85, + KEY_V: 86, + KEY_W: 87, + KEY_X: 88, + KEY_Y: 89, + KEY_Z: 90, }; diff --git a/src/components/views/rooms/MessageComposerInput.js b/src/components/views/rooms/MessageComposerInput.js index 5ea92d18ce..8a0d00f9af 100644 --- a/src/components/views/rooms/MessageComposerInput.js +++ b/src/components/views/rooms/MessageComposerInput.js @@ -87,6 +87,13 @@ export default class MessageComposerInput extends React.Component { return 'toggle-mode'; } + // Allow opening of dev tools. getDefaultKeyBinding would be 'italic' for KEY_I + if (e.keyCode === KeyCode.KEY_I && 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; + } + return getDefaultKeyBinding(e); }