summaryrefslogtreecommitdiff
path: root/src/static
diff options
context:
space:
mode:
authorGedion <gwy321@gmail.com>2012-09-08 12:03:13 -0500
committerGedion <gwy321@gmail.com>2012-09-08 12:03:13 -0500
commita2c8d2124071d668bd3799c166004263d46fcc6a (patch)
tree422c7b22676dec9d8c9ba50862d23a55f8ad3dd0 /src/static
parent453b6473a0b65f584596658aff770b524340ba07 (diff)
downloadetherpad-lite-a2c8d2124071d668bd3799c166004263d46fcc6a.zip
added hooks to contentcollector.js
Diffstat (limited to 'src/static')
-rw-r--r--src/static/js/contentcollector.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js
index b27dfc5e..bb814212 100644
--- a/src/static/js/contentcollector.js
+++ b/src/static/js/contentcollector.js
@@ -375,6 +375,17 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
if (dom.isNodeText(node))
{
var txt = dom.nodeValue(node);
+ var tname = dom.nodeAttr(node.parentNode,"name");
+ var txtFromHook = hooks.callAll('collectContentLineText', {
+ cc: this,
+ state: state,
+ tname: tname,
+ node:node,
+ text:txt,
+ styl: null,
+ cls: null
+ });
+ var txt = txtFromHook||txt;
var rest = '';
var x = 0; // offset into original text
if (txt.length == 0)
@@ -441,8 +452,32 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class
{
var tname = (dom.nodeTagName(node) || "").toLowerCase();
if (tname == "br")
+ /*
+ *Called from: src/static/js/contentcollector.js
+ *
+ * cc - the contentcollector object
+ * state - the current state of the change being made
+ * tname - the tag name of this node currently being processed
+ *
+ * This hook is provided to allow Whether the br tag should induce a new magic domline or not.
+ * The return value should be either true(break the line) or values.
+ *
+ */
{
cc.startNewLine(state);
+ this.breakLine = true;
+ var tvalue = dom.nodeAttr(node, 'value');
+ var induceLineBreak = hooks.callAll('collectContentLineBreak', {
+ cc: this,
+ state: state,
+ tname: tname,
+ tvalue:tvalue,
+ styl: null,
+ cls: null
+ });
+ if(induceLineBreak){
+ cc.startNewLine(state);
+ }
}
else if (tname == "script" || tname == "style")
{