diff options
author | Egil Moeller <egil.moller@freecode.no> | 2010-03-25 17:53:24 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2010-03-25 17:53:24 +0100 |
commit | b897b18b9cb727f277a41ba12349548fe854d724 (patch) | |
tree | d49b2f9da7dd9bd2e6d590a1536ff48576914e7f /infrastructure | |
parent | e19fc9f24ab128d4337d67d0e3f312a1ab0be38b (diff) | |
download | etherpad-b897b18b9cb727f277a41ba12349548fe854d724.tar.gz etherpad-b897b18b9cb727f277a41ba12349548fe854d724.tar.xz etherpad-b897b18b9cb727f277a41ba12349548fe854d724.zip |
Added support for plugins in the ACE linefilter
Diffstat (limited to 'infrastructure')
-rw-r--r-- | infrastructure/ace/www/ace2_inner.js | 10 | ||||
-rw-r--r-- | infrastructure/ace/www/linestylefilter.js | 29 |
2 files changed, 28 insertions, 11 deletions
diff --git a/infrastructure/ace/www/ace2_inner.js b/infrastructure/ace/www/ace2_inner.js index afd1e35..e817c95 100644 --- a/infrastructure/ace/www/ace2_inner.js +++ b/infrastructure/ace/www/ace2_inner.js @@ -1139,15 +1139,7 @@ function OUTER(gscope) { } else { var offsetIntoLine = 0; - var filteredFunc = textAndClassFunc; - filteredFunc = linestylefilter.getURLFilter(text, filteredFunc); - if (browser.msie) { - // IE7+ will take an e-mail address like <foo@bar.com> and linkify it to foo@bar.com. - // We then normalize it back to text with no angle brackets. It's weird. So always - // break spans at an "at" sign. - filteredFunc = linestylefilter.getAtSignSplitterFilter( - text, filteredFunc); - } + var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, browser); var lineNum = rep.lines.indexOfEntry(lineEntry); var aline = rep.alines[lineNum]; filteredFunc = linestylefilter.getLineStyleFilter( diff --git a/infrastructure/ace/www/linestylefilter.js b/infrastructure/ace/www/linestylefilter.js index 0ac578b..c493911 100644 --- a/infrastructure/ace/www/linestylefilter.js +++ b/infrastructure/ace/www/linestylefilter.js @@ -1,5 +1,6 @@ // THIS FILE IS ALSO AN APPJET MODULE: etherpad.collab.ace.linestylefilter // %APPJET%: import("etherpad.collab.ace.easysync2.Changeset"); +// %APPJET%: import("etherpad.admin.plugins"); /** * Copyright 2009 Google Inc. @@ -18,6 +19,10 @@ */ // requires: easysync2.Changeset +// requires: top +// requires: plugins +// requires: plugins +// requires: undefined var linestylefilter = {}; @@ -226,6 +231,27 @@ linestylefilter.textAndClassFuncSplitter = function(func, splitPointsOpt) { return spanHandler; }; +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); + + if (browser !== undefined && browser.msie) { + // IE7+ will take an e-mail address like <foo@bar.com> and linkify it to foo@bar.com. + // We then normalize it back to text with no angle brackets. It's weird. So always + // break spans at an "at" sign. + func = linestylefilter.getAtSignSplitterFilter( + lineText, func); + } + return func; +}; + // domLineObj is like that returned by domline.createDomLine linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj) { @@ -239,8 +265,7 @@ linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj.appendSpan(tokenText, tokenClass); } - var func = textAndClassFunc; - func = linestylefilter.getURLFilter(text, func); + var func = linestylefilter.getFilterStack(text, textAndClassFunc); func = linestylefilter.getLineStyleFilter(text.length, aline, func, apool); func(text, ''); |