componentDidMount() { const path = window.require('path'); const fs = window.require('fs'); var file = fs.readFileSync(this.props.path, { encoding: 'utf8' }); // initialize editor this.editor = monaco.editor.create(document.getElementById('editor-container'), { language: this._getLanguage(this.props.path), theme: 'ayu-dark', lineNumbers: 'on', wordWrap: 'on', scrollBeyondLastLine: false, automaticLayout: true, glyphMargin: true }, ); // Intialize the linter this._linterWorker = new ESLintWorker(); this._linterWorker.addEventListener('message', (message) => { this._updateMarkers(message); }); this._openFile(this.props.path); }
loadEditor() { this.editor = monaco.editor.create(this.divRef, { value: "function hello() {\n\talert('Hello world!');\n}", language: 'javascript', theme: 'vs-dark', }); }
componentDidMount() { this.editor = monaco.editor.create(this.container); }