agjaeger / CodeBin

CodeBin - an online IDE and compiler with a file server attached
Apache License 2.0
0 stars 1 forks source link

Ace Integration #1

Closed agjaeger closed 10 years ago

agjaeger commented 10 years ago

Currently, Skulpt pulls code from the editor div, however after trying to use Ace as a text editor, Skulpt was unable to load the new code into the interpreter

In order to fix problem, I feel it might be necessary to create a temporary div that JS can pull the code from the editor, place it in the temp div and then Skulpt can interpret it and output the result to the output div.

As a quick fix, a text area has replaced Ace, as it allows Skulpt to pull its contents as the run button is pressed. I recommend modeling Ace after the text area with the temporary div.

cptaffe commented 10 years ago

You can use this answer from stackoverflow

var code = editor.getSession().getValue();

You can implement this, for example, by editing a line in the example gist in the function runit():

// Original code
var prog = document.getElementById("yourcode").value;
// Using Ace Editor
var prog = editor.getSession().getValue();