diff --git a/client/homebrew/brewRenderer/brewRenderer.less b/client/homebrew/brewRenderer/brewRenderer.less index 6dee6433f..066738f70 100644 --- a/client/homebrew/brewRenderer/brewRenderer.less +++ b/client/homebrew/brewRenderer/brewRenderer.less @@ -30,7 +30,7 @@ .ppr_msg{ position : absolute; left : 0px; - bottom : 0; + top : 0; // This obscures the horizonal scrollbar (when shown) when it's on the bottom z-index : 1000; padding : 8px 10px; background-color : #333; diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx index 38f0ff40c..3a7a2359b 100644 --- a/shared/naturalcrit/codeEditor/codeEditor.jsx +++ b/shared/naturalcrit/codeEditor/codeEditor.jsx @@ -30,14 +30,28 @@ const CodeEditor = createClass({ value : this.props.value, lineNumbers : true, lineWrapping : this.props.wrap, - mode : this.props.language + mode : this.props.language, + extraKeys : { + 'Ctrl-B' : this.makeBold, + 'Ctrl-I' : this.makeItalic + } }); this.codeMirror.on('change', this.handleChange); this.codeMirror.on('cursorActivity', this.handleCursorActivity); this.updateSize(); }, + + makeBold : function() { + const selection = this.codeMirror.getSelection(); + this.codeMirror.replaceSelection(`**${selection}**`, 'around'); + }, + makeItalic : function() { + const selection = this.codeMirror.getSelection(); + this.codeMirror.replaceSelection(`*${selection}*`, 'around'); + }, + componentWillReceiveProps : function(nextProps){ if(this.codeMirror && nextProps.value !== undefined && this.codeMirror.getValue() != nextProps.value) { this.codeMirror.setValue(nextProps.value);