JSFiddle - React, Tailwind, and code Playground
by faceleg
HTML
<script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js"></script>
<div id="editor">function foo(items) {
var x = "All this is syntax highlighted";
return x;
}</div>
CSS
#editor {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
JavaScript
document.body.onkeydown =
document.body.onkeyup =
document.body.onkeypress = function(event) {
event.cancelBubble = true;
event.stopPropogation = true;
return false;
};
var editor = ace.edit("editor");
editor.setTheme("ace/theme/monokai");
editor.getSession().setMode("ace/mode/javascript");