aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEgil Moeller <egil.moller@freecode.no>2010-03-25 19:14:53 +0100
committerEgil Moeller <egil.moller@freecode.no>2010-03-25 19:14:53 +0100
commit20014050bf91266757b2c1ba82ab333638fe570d (patch)
treeb4de4f05376f30cab0ca4a729a99f841a4ef123f
parentf7dd3aa34cad8a59ad00172339c565731ad80fbb (diff)
downloadetherpad-20014050bf91266757b2c1ba82ab333638fe570d.tar.gz
etherpad-20014050bf91266757b2c1ba82ab333638fe570d.tar.xz
etherpad-20014050bf91266757b2c1ba82ab333638fe570d.zip
Added aceCreateDomline hook plus some code cleanup in the ace
Diffstat (limited to '')
-rw-r--r--infrastructure/ace/www/domline.js19
-rw-r--r--infrastructure/ace/www/linestylefilter.js13
2 files changed, 22 insertions, 10 deletions
diff --git a/infrastructure/ace/www/domline.js b/infrastructure/ace/www/domline.js
index 70f86cc..38cddf5 100644
--- a/infrastructure/ace/www/domline.js
+++ b/infrastructure/ace/www/domline.js
@@ -1,4 +1,5 @@
// THIS FILE IS ALSO AN APPJET MODULE: etherpad.collab.ace.domline
+// %APPJET%: import("etherpad.admin.plugins");
/**
* Copyright 2009 Google Inc.
@@ -16,6 +17,10 @@
* limitations under the License.
*/
+// requires: top
+// requires: plugins
+// requires: undefined
+
var domline = {};
domline.noop = function() {};
domline.identity = function(x) { return x; };
@@ -92,12 +97,22 @@ domline.createDomLine = function(nonEmpty, doesWrap, optBrowser, optDocument) {
return space+tag;
});
}
+
+ var extraOpenTags = "";
+ var extraCloseTags = "";
+
+ ((top == undefined) ? plugins : top.plugins).callHook(
+ "aceCreateDomLine", {domline:domline, cls:cls}
+ ).map(function (modifier) {
+ cls = modifier.cls;
+ extraOpenTags = extraOpenTags+modifier.extraOpenTags;
+ extraCloseTags = modifier.extraCloseTags+extraCloseTags;
+ });
+
if ((! txt) && cls) {
lineClass = domline.addToLineClass(lineClass, cls);
}
else if (txt) {
- var extraOpenTags = "";
- var extraCloseTags = "";
if (href) {
extraOpenTags = extraOpenTags+'<a href="'+
href.replace(/\"/g, '&quot;')+'">';
diff --git a/infrastructure/ace/www/linestylefilter.js b/infrastructure/ace/www/linestylefilter.js
index 71bc30d..d69376a 100644
--- a/infrastructure/ace/www/linestylefilter.js
+++ b/infrastructure/ace/www/linestylefilter.js
@@ -21,7 +21,6 @@
// requires: easysync2.Changeset
// requires: top
// requires: plugins
-// requires: plugins
// requires: undefined
var linestylefilter = {};
@@ -239,13 +238,11 @@ linestylefilter.textAndClassFuncSplitter = function(func, splitPointsOpt) {
linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) {
var func = linestylefilter.getURLFilter(lineText, textAndClassFunc);
- /* Handle both client and server side situation */
-
- var pluginModule = (top == undefined) ? plugins : top.plugins;
-
- var hookFilters = pluginModule.callHook("aceGetFilterStack", {linestylefilter:linestylefilter, browser:browser});
- for (var i = 0; i < hookFilters.length; i++)
- func = hookFilters[i](lineText, func);
+ var hookFilters = ((top == undefined) ? plugins : top.plugins).callHook(
+ "aceGetFilterStack", {linestylefilter:linestylefilter, browser:browser});
+ hookFilters.map(function (hookFilter) {
+ func = hookFilter(lineText, func);
+ });
if (browser !== undefined && browser.msie) {
// IE7+ will take an e-mail address like <foo@bar.com> and linkify it to foo@bar.com.