Created
February 20, 2012 21:09
-
-
Save cweider/1871440 to your computer and use it in GitHub Desktop.
Ace Templates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
== iframeHTML | |
<!doctype html> | |
<html> | |
<head> | |
<%= INCLUDE_CSS %> | |
<%= INCLUDE_JS %> | |
<style type="text/css" title="dynamicsyntax"></style> | |
</head> | |
<body id="innerdocbody" class="syntax" spellcheck="false"> | |
| |
</body> | |
</html> | |
== outerScript | |
editorId = <%= JSON.stringify(info.id) %>; | |
editorInfo = parent.[<%= JSON.stringify(thisFunctionsName)%>].registry[editorId]; | |
window.onload = function () { | |
window.onload = null; | |
setTimeout(function () { | |
var iframe = document.createElement("IFRAME"); | |
iframe.scrolling = "no"; | |
iframe.frameBorder = 0; | |
iframe.allowTransparency = true; | |
var outerdocbody = document.getElementById("outerdocbody"); | |
outerdocbody.insertBefore(iframe, outerdocbody.firstChild); | |
iframe.ace_outerWin = window; | |
readyFunc = function () { | |
editorInfo.onEditorReady(); | |
readyFunc = null; | |
editorInfo = null; | |
}; | |
var doc = iframe.contentWindow.document; | |
doc.open(); | |
var text = <%= JSON.stringify(iframeHTML.join('\n')) %>; | |
doc.write(text); | |
doc.close(); | |
}, 0); | |
}; | |
== outerHTML | |
<!doctype html> | |
<html> | |
<head> | |
<%= INCLUDE_CSS %> | |
<link rel="stylesheet" type="text/css" href="data:text/css,"/> | |
<script type="application/javascript"><%= JSON.stringify(outerScript).replace(/<\//g, '<\\/') %></script> | |
</head> | |
<body id="outerdocbody"> | |
<div id="sidediv"><!-- --></div> | |
<div id="linemetricsdiv">x</div> | |
<div id="overlaysdiv"><!-- --></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment