chat-editor: actually use controlled component
@@ -5,7 +5,7 @@ import 'codemirror/addon/hint/show-hint';
import 'codemirror/lib/codemirror.css';
import 'codemirror/mode/markdown/markdown';
import React, { useRef, ClipboardEvent, useEffect, useImperativeHandle } from 'react';
-import { UnControlled as CodeEditor } from 'react-codemirror2';
+import { Controlled as CodeEditor } from 'react-codemirror2';
import styled from 'styled-components';
import { MOBILE_BROWSER_REGEX } from '~/logic/lib/util';
import '../css/custom.css';
@@ -254,7 +254,7 @@ const ChatEditor = React.forwardRef<CodeMirrorShim, ChatEditorProps>(({ inCodeMo
className="lh-copy"
value={message}
options={options}
- onChange={(e, d, v) => messageChange(e, d, v)}
+ onBeforeChange={(e, d, v) => messageChange(e, d, v)}
editorDidMount={(codeEditor) => {
editorRef.current = codeEditor;
}}
