0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-24 18:32:41 +00:00
This commit is contained in:
Rodrigo Kuerten
2020-10-26 23:09:36 -03:00
parent 8a13387874
commit 19c04e125a

View File

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