File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,12 @@ class SimpleEditor extends React.PureComponent<CommonEditorProps> {
108
108
}
109
109
}
110
110
111
+ const editorMap = {
112
+ [ EditorType . Simple ] : SimpleEditor ,
113
+ [ EditorType . Ace ] : AceEditor ,
114
+ [ EditorType . Monaco ] : MonacoEditor ,
115
+ } ;
116
+
111
117
const Editor : React . SFC = ( ) => {
112
118
const code = useSelector ( ( state : State ) => state . code ) ;
113
119
const editor = useSelector ( ( state : State ) => state . configuration . editor ) ;
@@ -119,7 +125,7 @@ const Editor: React.SFC = () => {
119
125
const execute = useCallback ( ( ) => dispatch ( actions . performPrimaryAction ( ) ) , [ dispatch ] ) ;
120
126
const onEditCode = useCallback ( ( c ) => dispatch ( actions . editCode ( c ) ) , [ dispatch ] ) ;
121
127
122
- const SelectedEditor = editor === EditorType . Simple ? SimpleEditor : editor === EditorType . Monaco ? MonacoEditor : AceEditor ;
128
+ const SelectedEditor = editorMap [ editor ] ;
123
129
124
130
return (
125
131
< div className = { styles . container } >
You can’t perform that action at this time.
0 commit comments