@@ -164,6 +164,17 @@ class LoadSketch {
164
164
}
165
165
}
166
166
167
+ class Source extends Component {
168
+ onInput ( e ) {
169
+ const source = e . target . value ;
170
+ this . props . onSourceChanged ( source ) ;
171
+ }
172
+
173
+ render ( props ) {
174
+ return h ( 'textarea' , { className : 'editor__area' , value : this . props . source , onInput : this . onInput . bind ( this ) , readonly : this . props . loading } ) ;
175
+ }
176
+ }
177
+
167
178
class Editor extends Component {
168
179
constructor ( props ) {
169
180
super ( props ) ;
@@ -244,8 +255,7 @@ class Editor extends Component {
244
255
document . querySelector ( 'html' ) . classList . remove ( 'fullscreen' ) ;
245
256
}
246
257
247
- onInput ( e ) {
248
- const source = e . target . value ;
258
+ onSourceChanged ( source ) {
249
259
this . setState ( { source } ) ;
250
260
if ( this . props . onSourceChanged ) {
251
261
this . props . onSourceChanged ( source ) ;
@@ -345,8 +355,8 @@ class Editor extends Component {
345
355
h ( SeedPicker , { seed : this . state . seed , onSetSeed : this . onSetSeed . bind ( this ) , onPrevSeed : this . onPrevSeed . bind ( this ) , onNextSeed : this . onNextSeed . bind ( this ) } )
346
356
) ,
347
357
h ( 'div' , { className : 'editor__source' } ,
348
- h ( 'textarea' , { className : 'editor__area' , value : source , onInput : this . onInput . bind ( this ) , readonly : state . loading } ) ,
349
- debugView
358
+ h ( Source , { source , loading : this . state . loading , onSourceChanged : this . onSourceChanged . bind ( this ) } ) ,
359
+ debugView
350
360
) ,
351
361
) ,
352
362
h ( 'div' , { className : 'editor__viewer-wrap' } ,
0 commit comments