Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use getvalue using Ace Editor?

I am using the Ace Editor, but I do no use JavaScript a lot so I'm finding it hard to make it actually work without a proper documentation.

I'm working on a local PHP file editor.. so open files etc, works fine, setcontent works like a charm. But now I want to save the editor's information back to the file.

In itself not really a problem. But how do I retrieve the var code. If I use document.write it will not show the current information in the editor

If I could print out what is in the editor I could save the data. But I don't know how to provide a valid callback for getValue

Can someone please give me a little bit more information on what to do?

like image 636
Colt Avatar asked Sep 09 '26 08:09

Colt


1 Answers

Simply say:

editor.getSession().on('change', function(){ 
         editor.getSession().getValue(); 
});
like image 194
Mrchief Avatar answered Sep 11 '26 21:09

Mrchief