I don't have a publicly available working example I can point you to, but I can outline in more detail what I did:
Here is the HAML for my partial/template:
%pre#editor{:style => 'position: relative; height: 600px; width: 100%;'}= @content
or in ERB it would look something like this:
<pre id="editor" style="position: relative; height: 600px; width: 100%;"><%= @content %></pre>
The important bits (at least what I had to do to make things work):
1) use relative or absolute positioning
2) use fixed height and width (I am using 100% because the <pre> element's parent is fixed width and that seems to work so far)
3) use the <pre> element (I could be mistaken but I am pretty sure you need to use a different ACE setup with textareas)
4) use an id without underscores
5) use "noconflict" versions of the ace files (see below)
Here are the javascript files I am using (from the ACE build directory):
ace-noconflict.js
mode-html-noconflict.js
theme-textmate-noconflict.js
And I am initializing the setup with the following javascript (I have it in an external javascript file):
$(function() {
// Setup Ace
var editor = ace.edit("editor");
var HtmlMode = ace.require("ace/mode/html").Mode;
editor.getSession().setMode(new HtmlMode());
editor.setTheme("ace/theme/textmate");
editor.renderer.setShowPrintMargin(false);
editor.renderer.setHScrollBarAlwaysVisible(false);
editor.getSession().setUseSoftTabs(true);
});
I am using the jQuery document ready event in the above example, though it works equally well with the standard on load event used in the ace examples. I hope this helps!
Brett :-)