Merge pull request #557 from redhog/master

Templating system built on top of EJS and plugin installer
This commit is contained in:
John McLear 2012-04-02 12:42:38 -07:00
commit 9ecd864ac6
46 changed files with 1526 additions and 1774 deletions

View file

@ -844,7 +844,7 @@ function Ace2Inner(){
var cmdArgs = Array.prototype.slice.call(arguments, 1);
if (CMDS[cmd])
{
inCallStack(cmd, function()
inCallStackIfNecessary(cmd, function()
{
fastIncorp(9);
CMDS[cmd].apply(CMDS, cmdArgs);
@ -854,7 +854,7 @@ function Ace2Inner(){
function replaceRange(start, end, text)
{
inCallStack('replaceRange', function()
inCallStackIfNecessary('replaceRange', function()
{
fastIncorp(9);
performDocumentReplaceRange(start, end, text);
@ -1155,7 +1155,7 @@ function Ace2Inner(){
return;
}
inCallStack("idleWorkTimer", function()
inCallStackIfNecessary("idleWorkTimer", function()
{
var isTimeUp = newTimeLimit(250);
@ -2043,6 +2043,7 @@ function Ace2Inner(){
return [lineNum, col];
}
}
editorInfo.ace_getLineAndCharForPoint = getLineAndCharForPoint;
function createDomLineEntry(lineString)
{
@ -2328,6 +2329,7 @@ function Ace2Inner(){
var cs = builder.toString();
performDocumentApplyChangeset(cs);
}
editorInfo.ace_performDocumentApplyAttributesToRange = performDocumentApplyAttributesToRange;
function buildKeepToStartOfRange(builder, start)
{
@ -2853,6 +2855,7 @@ function Ace2Inner(){
currentCallStack.selectionAffected = true;
}
}
editorInfo.ace_performSelectionChange = performSelectionChange;
// Change the abstract representation of the document to have a different selection.
// Should not rely on the line representation. Should not affect the DOM.
@ -3280,7 +3283,7 @@ function Ace2Inner(){
function handleClick(evt)
{
inCallStack("handleClick", function()
inCallStackIfNecessary("handleClick", function()
{
idleWorkTimer.atMost(200);
});
@ -3602,7 +3605,7 @@ function Ace2Inner(){
var stopped = false;
inCallStack("handleKeyEvent", function()
inCallStackIfNecessary("handleKeyEvent", function()
{
if (type == "keypress" || (isTypeForSpecialKey && keyCode == 13 /*return*/ ))
@ -4689,7 +4692,7 @@ function Ace2Inner(){
}
// click below the body
inCallStack("handleOuterClick", function()
inCallStackIfNecessary("handleOuterClick", function()
{
// put caret at bottom of doc
fastIncorp(11);
@ -4726,6 +4729,54 @@ function Ace2Inner(){
else $(elem).removeClass(elem, className);
}
function setup()
{
doc = document; // defined as a var in scope outside
inCallStackIfNecessary("setup", function()
{
var body = doc.getElementById("innerdocbody");
root = body; // defined as a var in scope outside
if (browser.mozilla) addClass(root, "mozilla");
if (browser.safari) addClass(root, "safari");
if (browser.msie) addClass(root, "msie");
if (browser.msie)
{
// cache CSS background images
try
{
doc.execCommand("BackgroundImageCache", false, true);
}
catch (e)
{ /* throws an error in some IE 6 but not others! */
}
}
setClassPresence(root, "authorColors", true);
setClassPresence(root, "doesWrap", doesWrap);
initDynamicCSS();
enforceEditability();
// set up dom and rep
while (root.firstChild) root.removeChild(root.firstChild);
var oneEntry = createDomLineEntry("");
doRepLineSplice(0, rep.lines.length(), [oneEntry]);
insertDomLines(null, [oneEntry.domInfo], null);
rep.alines = Changeset.splitAttributionLines(
Changeset.makeAttribution("\n"), "\n");
bindTheEventHandlers();
});
scheduler.setTimeout(function()
{
parent.readyFunc(); // defined in code that sets up the inner iframe
}, 0);
isSetUp = true;
}
function focus()
{
window.focus();