Plugins are injected and no longer exist in the global scope.

This commit is contained in:
Chad Weider 2012-02-05 11:13:43 -08:00
parent 8ade4c89d5
commit 3fb62956b9
7 changed files with 22 additions and 94 deletions

View File

@ -337,6 +337,15 @@ function Ace2Editor()
$$INCLUDE_JS("../static/js/domline.js");
$$INCLUDE_JS("../static/js/ace2_inner.js");
pushRequireScriptTo(iframeHTML);
// Inject my plugins into my child.
iframeHTML.push('\
<script type="text/javascript">\
require.define("/plugins", null);\n\
require.define("/plugins.js", function (require, exports, module) {\
module.exports = parent.parent.require("/plugins");\
});\
</script>\
');
pushScriptTagsFor(iframeHTML, includedJS);
iframeHTML.push('<style type="text/css" title="dynamicsyntax"></style>');

View File

@ -26,12 +26,7 @@
var _MAX_LIST_LEVEL = 8;
var Changeset = require('/easysync2').Changeset
var plugins = undefined;
try {
plugins = require('/plugins').plugins;
} catch (e) {
// silence
}
var plugins = require('/plugins').plugins;
function sanitizeUnicode(s)
{
@ -42,15 +37,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
{
browser = browser || {};
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
var dom = domInterface || {
isNodeText: function(n)

View File

@ -26,12 +26,7 @@
// requires: plugins
// requires: undefined
var plugins = undefined;
try {
plugins = require('/plugins').plugins;
} catch (e) {
// silence
}
var plugins = require('/plugins').plugins;
var domline = {};
domline.noop = function()
@ -148,15 +143,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
var extraOpenTags = "";
var extraCloseTags = "";
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
plugins_.callHook("aceCreateDomLine", {
domline: domline,

View File

@ -25,12 +25,7 @@
// requires: plugins
// requires: undefined
var plugins = undefined;
try {
plugins = require('/plugins').plugins;
} catch (e) {
// silence
}
var plugins = require('/plugins').plugins;
var domline = {};
domline.noop = function()
@ -147,15 +142,7 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument)
var extraOpenTags = "";
var extraCloseTags = "";
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
plugins_.callHook("aceCreateDomLine", {
domline: domline,

View File

@ -29,12 +29,7 @@
// requires: undefined
var Changeset = require('/easysync2').Changeset
var plugins = undefined;
try {
plugins = require('/plugins').plugins;
} catch (e) {
// silence
}
var plugins = require('/plugins').plugins;
var linestylefilter = {};
@ -59,15 +54,7 @@ linestylefilter.getAuthorClassName = function(author)
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
{
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
if (lineLength == 0) return textAndClassFunc;
@ -312,15 +299,7 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
{
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
var hookFilters = plugins_.callHook("aceGetFilterStack", {
linestylefilter: linestylefilter,

View File

@ -27,12 +27,7 @@
// requires: undefined
var Changeset = require('/easysync2_client').Changeset
var plugins = undefined;
try {
plugins = require('/plugins').plugins;
} catch (e) {
// silence
}
var plugins = require('/plugins').plugins;
var linestylefilter = {};
@ -57,15 +52,7 @@ linestylefilter.getAuthorClassName = function(author)
linestylefilter.getLineStyleFilter = function(lineLength, aline, textAndClassFunc, apool)
{
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
if (lineLength == 0) return textAndClassFunc;
@ -310,15 +297,7 @@ linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser)
{
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
var plugins_;
if (typeof(plugins) != 'undefined')
{
plugins_ = plugins;
}
else
{
plugins_ = parent.parent.plugins;
}
var plugins_ = plugins;
var hookFilters = plugins_.callHook("aceGetFilterStack", {
linestylefilter: linestylefilter,

View File

@ -4,7 +4,7 @@
* TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED
*/
plugins = {
var plugins = {
callHook: function(hookName, args)
{
var global = (function () {return this}());