I am using ACE editor for the first time. I have the below questions related to it.
How do I find the instance of
ACE
To save the contents of the editor I placed a hidden input immediately before it, and initialized the editor like so:
var $editor = $('#editor');
if ($editor.length > 0) {
var editor = ace.edit('editor');
editor.session.setMode("ace/mode/css");
$editor.closest('form').submit(function() {
var code = editor.getValue();
$editor.prev('input[type=hidden]').val(code);
});
}
When my form is submitted we get the editor value and copy it to the hidden input.