The Ace-helper helps to easily integrate Ace editor into your project, e.g. Silex, Symfony, also on form elements.
This library depends on jQuery to work.
bower install ace-helper
To use the ace-helper, simply add class="ace-editor"
to div
or textarea
. It will create an Ace editor for you. If it's a textarea, it will create an Ace editor after the textarea and sync the content of the editor with the textarea, which makes it straight-forward to be submitted.
<!-- jQuery -->
<script src=".../jquery.min.js"></script>
<!-- Ace -->
<script src=".../ace-builds/src-min-noconflict/ace.js" charset="utf-8"></script>
<!-- Ace-helper -->
<script src="/bower_components/ace-helper/src/ace-helper.js"></script>
...
<textarea class="ace-editor">Your content here</textarea>
Put the Ace parameters as data attributes in the HTML element to enable them.
<textarea class="ace-editor" data-mode="css" data-theme="monokai"></textarea>
Integrate with Symfony forms:
{{ form_row(form.description, { 'attr': {'class': 'ace-editor', 'data-theme': 'twilight', 'data-mode':'handlebars'} }) }}