File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
packages/react-live/src/components/Editor Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -24,16 +24,21 @@ const CodeEditor = (props: Props) => {
2424 setCode ( props . code ) ;
2525 } , [ props . code ] ) ;
2626
27- useEditable ( editorRef , ( text ) => setCode ( text . slice ( 0 , - 1 ) ) , {
28- disabled : props . disabled ,
29- indentation : tabMode === "indentation" ? 2 : undefined ,
30- } ) ;
27+ useEditable (
28+ editorRef ,
29+ ( text ) => {
30+ const t = text . slice ( 0 , - 1 ) ;
31+ setCode ( t ) ;
3132
32- useEffect ( ( ) => {
33- if ( props . onChange ) {
34- props . onChange ( code ) ;
33+ if ( props . onChange ) {
34+ props . onChange ( t ) ;
35+ }
36+ } ,
37+ {
38+ disabled : props . disabled ,
39+ indentation : tabMode === "indentation" ? 2 : undefined ,
3540 }
36- } , [ code ] ) ;
41+ ) ;
3742
3843 return (
3944 < div className = { props . className } style = { props . style } >
You can’t perform that action at this time.
0 commit comments