11import React from 'react' ;
22import ReactDOM from 'react-dom' ;
33import DocChomp from 'doc-chomp' ;
4- import Codemirror from 'react-codemirror2' ;
4+ import { Controlled as Codemirror } from 'react-codemirror2' ;
55
66import 'codemirror/lib/codemirror.css' ;
77import 'codemirror/mode/markdown/markdown' ;
@@ -50,18 +50,18 @@ class REPL extends React.Component {
5050 error : 'Not yet compiled...'
5151 } ;
5252
53- this . handleEditorChange = this . handleEditorChange . bind ( this ) ;
53+ this . handleEditorBeforeChange = this . handleEditorBeforeChange . bind ( this ) ;
5454 }
5555
56- componentWillMount ( ) {
56+ UNSAFE_componentWillMount ( ) {
5757 this . compile ( this . state . input ) ;
5858 }
5959
6060 render ( ) {
6161 return (
6262 < div className = "repl" >
6363 < div className = "header" >
64- < img id = "logo" src = { require ( './images/logo.svg' ) } alt = "Markdown Component Loader" />
64+ < img id = "logo" src = { require ( './images/logo.svg' ) . default } alt = "Markdown Component Loader" />
6565 < a className = "bubble-link blue-bubble" href = "index.html" > Learn more</ a >
6666 </ div >
6767 < div className = "repl-editors" >
@@ -72,7 +72,7 @@ class REPL extends React.Component {
7272 ...COMMON_CODEMIRROR_OPTIONS
7373 } }
7474 value = { this . state . input }
75- onChange = { this . handleEditorChange }
75+ onBeforeChange = { this . handleEditorBeforeChange }
7676 />
7777 < Codemirror
7878 className = "repl-editor repl-output"
@@ -95,7 +95,7 @@ class REPL extends React.Component {
9595 ) ;
9696 }
9797
98- handleEditorChange ( editor , metadata , input ) {
98+ handleEditorBeforeChange ( editor , metadata , input ) {
9999 this . setState ( { input } , ( ) => {
100100 this . compile ( input ) ;
101101 } ) ;
@@ -121,6 +121,8 @@ class REPL extends React.Component {
121121 }
122122}
123123
124+ console . debug ( REPL , Codemirror ) ;
125+
124126ReactDOM . render (
125127 < REPL /> ,
126128 document . getElementById ( 'root' )
0 commit comments