Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
114
rated 0 times [  118] [ 4]  / answers: 1 / hits: 16863  / 11 Years ago, wed, march 27, 2013, 12:00:00

I'm looking to implement a web app that features coding-competition-styled interface with 2 different code editors in a single screen. One will be read only and the other will be active and would allow the user to edit.



I'm currently using Ace Editor and i find it awesome and simple to use.



However, here's my question. I seem to be getting an error upon trying to implement 2 different editors in a single page.




Uncaught RangeError: Maximum call stack size exceeded




Is the variable editor in the js script a restricted word or it doesn't matter what variable name is used?



Here's 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's 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 in advance for the replies!


More From » jquery

 Answers
11

Ace can support any number of editors.
The problem is recent regression which breaks resize for editors with height=0 see this demo


[#79301] Tuesday, March 26, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dominickmackenziet

Total Points: 583
Total Questions: 101
Total Answers: 117

Location: Saint Lucia
Member since Wed, Feb 8, 2023
1 Year ago
dominickmackenziet questions
Wed, Apr 7, 21, 00:00, 3 Years ago
Fri, Feb 12, 21, 00:00, 3 Years ago
;