added hooks to contentcollector.js

This commit is contained in:
Gedion 2012-09-08 12:03:13 -05:00
parent 453b6473a0
commit a2c8d21240
1 changed files with 35 additions and 0 deletions

View File

@ -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")
{