diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index b27dfc5e0..bb814212b 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") {