0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-03 14:52:38 +00:00

Added back the original codeEditor file

This commit is contained in:
Rodrigo Kuerten
2020-10-25 14:13:23 -03:00
parent b908cd7cbd
commit af4ec3d096

View File

@@ -45,24 +45,12 @@ const CodeEditor = createClass({
makeBold : function() { makeBold : function() {
const selection = this.codeMirror.getSelection(); const selection = this.codeMirror.getSelection();
if (selection.length === 0){ this.codeMirror.replaceSelection(`**${selection}**`, 'around');
this.codeMirror.replaceSelection(`**${selection}**`, 'around');
let cursor = this.codeMirror.getCursor();
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 2 });
} else {
this.codeMirror.replaceSelection(`**${selection}**`, 'around');
}
}, },
makeItalic : function() { makeItalic : function() {
const selection = this.codeMirror.getSelection(); const selection = this.codeMirror.getSelection();
if (selection.length === 0){ this.codeMirror.replaceSelection(`*${selection}*`, 'around');
this.codeMirror.replaceSelection(`*${selection}*`, 'around');
let cursor = this.codeMirror.getCursor();
this.codeMirror.setCursor({ line: cursor.line, ch: cursor.ch - 1 });
} else {
this.codeMirror.replaceSelection(`*${selection}*`, 'around');
}
}, },
componentWillReceiveProps : function(nextProps){ componentWillReceiveProps : function(nextProps){