I am looking to implement a web application that has a coding-competition interface with two different code editors on the same screen. One will be read-only, and the other will be active and allow the user to edit.
I am currently using Ace Editor, and I find it just cool and easy to use.
However, here is my question. It seems that I am getting an error when trying to implement 2 different editors on the same page.
Uncaught RangeError: maximum call stack size
Is the "editor" variable in js script a limited word or does it not matter which variable name is used?
Here is my code in my JS file:
var editorFirst = ace.edit("editorFirst"); var editorSecond= ace.edit("editorSecond"); setupEditor(); function setupEditor() { editorFirst.setTheme("ace/theme/eclipse"); editorFirst.getSession().setMode("ace/mode/javascript"); editorFirst.setShowPrintMargin(false); editorFirst.setHighlightActiveLine(true); editorFirst.resize(); editorFirst.setBehavioursEnabled(true); editorFirst.getSession().setUseWrapMode(true); document.getElementById('editorFirst').style.fontSize = '14px'; editorSecond.setTheme("ace/theme/eclipse"); editorSecond.getSession().setMode("ace/mode/javascript"); editorSecond.setShowPrintMargin(false); editorSecond.setHighlightActiveLine(true); editorSecond.resize(); editorSecond.setBehavioursEnabled(true); editorReducer.getSession().setUseWrapMode(true); document.getElementById('editorSecond').style.fontSize = '14px'; }
Here is my code for the html file:
<script src="../assets/js/main.js"></script> <script src="../assets/js/src/ace.js" type="text/javascript" charset="utf-8"></script> <div id="editorFirst"></div> <div id="editorSecond"></div>
Thanks for answers!
kenwjj
source share