@@ -10,10 +10,23 @@ import Editor from 'react-ace';
1010import PropTypes from '../../lib/PropTypes' ;
1111
1212import 'ace-builds/src-noconflict/mode-javascript' ;
13- import 'ace-builds/src-noconflict/theme-solarized_dark ' ;
13+ import 'ace-builds/src-noconflict/theme-monokai ' ;
1414import 'ace-builds/src-noconflict/snippets/javascript' ;
1515import 'ace-builds/src-noconflict/ext-language_tools' ;
1616
17+ // Disable web workers to prevent MIME type errors
18+ import ace from 'ace-builds/src-noconflict/ace' ;
19+
20+ // Configure ACE to disable workers globally
21+ ace . config . set ( 'useWorker' , false ) ;
22+ ace . config . set ( 'loadWorkerFromBlob' , false ) ;
23+ ace . config . set ( 'workerPath' , false ) ;
24+
25+ // Also set the base path to prevent worker loading attempts
26+ ace . config . set ( 'basePath' , '/bundles' ) ;
27+ ace . config . set ( 'modePath' , '/bundles' ) ;
28+ ace . config . set ( 'themePath' , '/bundles' ) ;
29+
1730export default class CodeEditor extends React . Component {
1831 constructor ( props ) {
1932 super ( props ) ;
@@ -32,13 +45,13 @@ export default class CodeEditor extends React.Component {
3245 }
3346
3447 render ( ) {
35- const { fontSize = 18 } = this . props ;
48+ const { fontSize = 18 , theme = 'monokai' } = this . props ;
3649 const { code } = this . state ;
3750
3851 return (
3952 < Editor
4053 mode = "javascript"
41- theme = "solarized_dark"
54+ theme = { theme }
4255 onChange = { value => this . setState ( { code : value } ) }
4356 fontSize = { fontSize }
4457 showPrintMargin = { true }
@@ -49,8 +62,25 @@ export default class CodeEditor extends React.Component {
4962 enableBasicAutocompletion = { true }
5063 enableLiveAutocompletion = { true }
5164 enableSnippets = { false }
52- showLineNumbers = { true }
5365 tabSize = { 2 }
66+ style = { {
67+ backgroundColor : '#202020'
68+ } }
69+ setOptions = { {
70+ useWorker : false , // Disable web workers to prevent MIME type errors
71+ wrap : true ,
72+ foldStyle : 'markbegin' ,
73+ enableMultiselect : true ,
74+ // Additional worker-related options
75+ enableBasicAutocompletion : true ,
76+ enableLiveAutocompletion : true ,
77+ enableSnippets : false ,
78+ } }
79+ editorProps = { {
80+ $blockScrolling : Infinity , // Disable annoying warning
81+ $useWorker : false , // Additional worker disable
82+ } }
83+ commands = { [ ] } // Disable any commands that might trigger worker loading
5484 />
5585 ) ;
5686 }
@@ -59,4 +89,5 @@ export default class CodeEditor extends React.Component {
5989CodeEditor . propTypes = {
6090 fontSize : PropTypes . number . describe ( 'Font size of the editor' ) ,
6191 defaultValue : PropTypes . string . describe ( 'Default Code' ) ,
92+ theme : PropTypes . string . describe ( 'Theme for the editor' ) ,
6293} ;
0 commit comments