diff --git a/shared/naturalcrit/codeEditor/codeEditor.jsx b/shared/naturalcrit/codeEditor/codeEditor.jsx
index fb69b6dcf..a530d6659 100644
--- a/shared/naturalcrit/codeEditor/codeEditor.jsx
+++ b/shared/naturalcrit/codeEditor/codeEditor.jsx
@@ -207,6 +207,7 @@ const CodeEditor = createClass({
},
makeHeader : function (number) {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection();
const header = Array(number).fill('#').join('');
this.codeMirror.replaceSelection(`${header} ${selection}`, 'around');
@@ -215,6 +216,7 @@ const CodeEditor = createClass({
},
makeBold : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '**' && selection.slice(-2) === '**';
this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `**${selection}**`, 'around');
if(selection.length === 0){
@@ -224,6 +226,7 @@ const CodeEditor = createClass({
},
makeItalic : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '*' && selection.slice(-1) === '*';
this.codeMirror.replaceSelection(t ? selection.slice(1, -1) : `*${selection}*`, 'around');
if(selection.length === 0){
@@ -233,6 +236,7 @@ const CodeEditor = createClass({
},
makeSuper : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 1) === '^' && selection.slice(-1) === '^';
this.codeMirror.replaceSelection(t ? selection.slice(1, -1) : `^${selection}^`, 'around');
if(selection.length === 0){
@@ -242,6 +246,7 @@ const CodeEditor = createClass({
},
makeSub : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '^^' && selection.slice(-2) === '^^';
this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `^^${selection}^^`, 'around');
if(selection.length === 0){
@@ -252,10 +257,12 @@ const CodeEditor = createClass({
makeNbsp : function() {
+ if(this.props.language !== 'gfm') return;
this.codeMirror.replaceSelection(' ', 'end');
},
makeSpace : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection();
const t = selection.slice(0, 8) === '{{width:' && selection.slice(0 -4) === '% }}';
if(t){
@@ -267,6 +274,7 @@ const CodeEditor = createClass({
},
removeSpace : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection();
const t = selection.slice(0, 8) === '{{width:' && selection.slice(0 -4) === '% }}';
if(t){
@@ -276,10 +284,12 @@ const CodeEditor = createClass({
},
newColumn : function() {
+ if(this.props.language !== 'gfm') return;
this.codeMirror.replaceSelection('\n\\column\n\n', 'end');
},
newPage : function() {
+ if(this.props.language !== 'gfm') return;
this.codeMirror.replaceSelection('\n\\page\n\n', 'end');
},
@@ -293,6 +303,7 @@ const CodeEditor = createClass({
},
makeUnderline : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 3) === '' && selection.slice(-4) === '';
this.codeMirror.replaceSelection(t ? selection.slice(3, -4) : `${selection}`, 'around');
if(selection.length === 0){
@@ -302,6 +313,7 @@ const CodeEditor = createClass({
},
makeSpan : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '{{' && selection.slice(-2) === '}}';
this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `{{ ${selection}}}`, 'around');
if(selection.length === 0){
@@ -311,6 +323,7 @@ const CodeEditor = createClass({
},
makeDiv : function() {
+ if(this.props.language !== 'gfm') return;
const selection = this.codeMirror.getSelection(), t = selection.slice(0, 2) === '{{' && selection.slice(-2) === '}}';
this.codeMirror.replaceSelection(t ? selection.slice(2, -2) : `{{\n${selection}\n}}`, 'around');
if(selection.length === 0){
@@ -341,6 +354,7 @@ const CodeEditor = createClass({
},
makeLink : function() {
+ if(this.props.language !== 'gfm') return;
const isLink = /^\[(.*)\]\((.*)\)$/;
const selection = this.codeMirror.getSelection().trim();
let match;
@@ -358,6 +372,7 @@ const CodeEditor = createClass({
},
makeList : function(listType) {
+ if(this.props.language !== 'gfm') return;
const selectionStart = this.codeMirror.getCursor('from'), selectionEnd = this.codeMirror.getCursor('to');
this.codeMirror.setSelection(
{ line: selectionStart.line, ch: 0 },