mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-09-21 23:47:35 +03:00
chat: toggle code at start of input
This commit is contained in:
parent
3196179fbd
commit
e657a5514c
@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import { UnControlled as CodeEditor } from 'react-codemirror2';
|
import { UnControlled as CodeEditor } from 'react-codemirror2';
|
||||||
|
import CodeMirror from 'codemirror';
|
||||||
|
|
||||||
import 'codemirror/mode/markdown/markdown';
|
import 'codemirror/mode/markdown/markdown';
|
||||||
import 'codemirror/addon/display/placeholder';
|
import 'codemirror/addon/display/placeholder';
|
||||||
@ -306,7 +307,9 @@ export class ChatInput extends Component {
|
|||||||
'Enter': cm =>
|
'Enter': cm =>
|
||||||
this.messageSubmit(),
|
this.messageSubmit(),
|
||||||
'Shift-3': cm =>
|
'Shift-3': cm =>
|
||||||
this.toggleCode()
|
cm.getValue().length === 0
|
||||||
|
? this.toggleCode()
|
||||||
|
: CodeMirror.Pass
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -340,8 +343,8 @@ export class ChatInput extends Component {
|
|||||||
<CodeEditor
|
<CodeEditor
|
||||||
options={options}
|
options={options}
|
||||||
editorDidMount={(editor) => {
|
editorDidMount={(editor) => {
|
||||||
this.editor = editor;
|
this.editor = editor;
|
||||||
}}
|
}}
|
||||||
onChange={(e, d, v) => this.messageChange(e, d, v)}
|
onChange={(e, d, v) => this.messageChange(e, d, v)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user