mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
Merge branch 'mp/chat/code-toggle-2' (#2796)
* origin/mp/chat/code-toggle-2: chat: toggle code at start of input Signed-off-by: Matilde Park <matilde@tlon.io>
This commit is contained in:
commit
0926454e08
@ -2,6 +2,7 @@ import React, { Component } from 'react';
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import { UnControlled as CodeEditor } from 'react-codemirror2';
|
||||
import CodeMirror from 'codemirror';
|
||||
|
||||
import 'codemirror/mode/markdown/markdown';
|
||||
import 'codemirror/addon/display/placeholder';
|
||||
@ -306,7 +307,9 @@ export class ChatInput extends Component {
|
||||
'Enter': cm =>
|
||||
this.messageSubmit(),
|
||||
'Shift-3': cm =>
|
||||
this.toggleCode()
|
||||
cm.getValue().length === 0
|
||||
? this.toggleCode()
|
||||
: CodeMirror.Pass
|
||||
}
|
||||
};
|
||||
|
||||
@ -340,8 +343,8 @@ export class ChatInput extends Component {
|
||||
<CodeEditor
|
||||
options={options}
|
||||
editorDidMount={(editor) => {
|
||||
this.editor = editor;
|
||||
}}
|
||||
this.editor = editor;
|
||||
}}
|
||||
onChange={(e, d, v) => this.messageChange(e, d, v)}
|
||||
/>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user