@@ -4,12 +4,13 @@ import CodeMirror from 'codemirror';
4
4
import { Encode } from 'console-feed' ;
5
5
6
6
import RightArrowIcon from '../../../images/right-arrow.svg' ;
7
+ import { dispatchConsoleEvent } from '../../IDE/actions/console' ;
7
8
import { dispatchMessage , MessageTypes } from '../../../utils/dispatcher' ;
8
9
9
10
// heavily inspired by
10
11
// https://github.com/codesandbox/codesandbox-client/blob/92a1131f4ded6f7d9c16945dc7c18aa97c8ada27/packages/app/src/app/components/Preview/DevTools/Console/Input/index.tsx
11
12
12
- function ConsoleInput ( { theme, dispatchConsoleEvent , fontSize } ) {
13
+ function ConsoleInput ( { theme, fontSize } ) {
13
14
const [ commandHistory , setCommandHistory ] = useState ( [ ] ) ;
14
15
const [ commandCursor , setCommandCursor ] = useState ( - 1 ) ;
15
16
const codemirrorContainer = useRef ( null ) ;
@@ -25,12 +26,6 @@ function ConsoleInput({ theme, dispatchConsoleEvent, fontSize }) {
25
26
} ) ;
26
27
27
28
cmInstance . current . getWrapperElement ( ) . style [ 'font-size' ] = `${ fontSize } px` ;
28
-
29
- return ( ) => {
30
- if ( cmInstance . current ) {
31
- cmInstance . current = null ;
32
- }
33
- } ;
34
29
} , [ ] ) ;
35
30
36
31
useEffect ( ( ) => {
@@ -78,7 +73,7 @@ function ConsoleInput({ theme, dispatchConsoleEvent, fontSize }) {
78
73
cmInstance . current . off ( 'keydown' , handleEnterKey ) ;
79
74
}
80
75
} ;
81
- } , [ commandHistory , dispatchConsoleEvent ] ) ;
76
+ } , [ commandHistory ] ) ;
82
77
83
78
useEffect ( ( ) => {
84
79
const handleUpArrowKey = ( cm , e ) => {
@@ -158,7 +153,6 @@ function ConsoleInput({ theme, dispatchConsoleEvent, fontSize }) {
158
153
159
154
ConsoleInput . propTypes = {
160
155
theme : PropTypes . string . isRequired ,
161
- dispatchConsoleEvent : PropTypes . func . isRequired ,
162
156
fontSize : PropTypes . number . isRequired
163
157
} ;
164
158
0 commit comments