Ace Editor Bootstrap
by Guddu Kumar
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/ace/1.1.01/ace.js"></script>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.0/css/bootstrap.min.css">
<div class="container">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Editor</h3>
</div>
<div class="panel-body">
<div id="editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}
function abc(){}
</div>
</div>
</div>
<div class="text-center">---End of editor---</div>
</div>
CSS
#editor {
/** Setting height is also important, otherwise editor wont showup**/
height: 300px;
}
JavaScript
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");