Getting Type error on setting values in React-ace

640 views Asked by At

am getting an error when setting the values. I am trying to set JavaScript code, But I am getting the following error.

Document.$detectNewLine
node_modules/ace-builds/src-noconflict/ace.js:7832
  7829 | 
  7830 | 
  7831 | this.$detectNewLine = function(text) {
> 7832 |     var match = text.match(/^.*?(\r\n|\r|\n)/m);
       | ^  7833 |     this.$autoNewLine = match ? match[1] : "\n";
  7834 |     this._signal("changeNewLineMode");
  7835 | };

My editor setup is

<AceEditor 
                        mode="javascript"
                        theme="github"
                        name="editor"
                        value={this.setValue}
                        editorProps={{$blockScrolling: true}}
                        setOptions={{
                            enableBasicAutocompletion: false,
                            enableLiveAutocompletion: false,
                            enableSnippets: false,
                            showLineNumbers: true,
                            tabSize: 2,
                        }}
/>```
 The setValue is

    `
    setValue = async () => {
        let demo = await this.state.getCodeFromFile.success;
        return demo;
    }`
1

There are 1 answers

1
Filip F. On

Have you tried removing last comma from setOptions? That used to cause me some problems.

It would look like this:

setOptions={{
                            enableBasicAutocompletion: false,
                            enableLiveAutocompletion: false,
                            enableSnippets: false,
                            showLineNumbers: true,
                            tabSize: 2
                        }}