Skip to content

Commit

Permalink
use constants for keycodes in RTE
Browse files Browse the repository at this point in the history
  • Loading branch information
aviraldg committed Jun 14, 2016
1 parent 2606ea9 commit 8cb086e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/views/rooms/MessageComposerInput.js
Expand Up @@ -46,6 +46,8 @@ import * as RichText from '../../../RichText';

const TYPING_USER_TIMEOUT = 10000, TYPING_SERVER_TIMEOUT = 30000;

const KEY_M = 77;

// FIXME Breaks markdown with multiple paragraphs, since it only strips first and last <p>
function mdownToHtml(mdown) {
var html = marked(mdown) || "";
Expand Down Expand Up @@ -85,7 +87,7 @@ export default class MessageComposerInput extends React.Component {

static getKeyBinding(e: SyntheticKeyboardEvent): string {
// C-m => Toggles between rich text and markdown modes
if(e.keyCode == 77 && KeyBindingUtil.isCtrlKeyCommand(e)) {
if(e.keyCode == KEY_M && KeyBindingUtil.isCtrlKeyCommand(e)) {
return 'toggle-mode';
}

Expand Down

0 comments on commit 8cb086e

Please sign in to comment.