diff options
author | John McLear <john@mclear.co.uk> | 2012-09-14 04:51:17 -0700 |
---|---|---|
committer | John McLear <john@mclear.co.uk> | 2012-09-14 04:51:17 -0700 |
commit | e9e3ea305bc084f6f306413100578e74dec29b88 (patch) | |
tree | a39dcd188ab80fb2a4fd8781406c89fb9c7aa9f7 /src/static/js/contentcollector.js | |
parent | ba8177fc6f97c5cf12890ea70fc407cdf744ea7e (diff) | |
parent | a25feed1c2750c52e9aa43661b44fe2fb1aa53b5 (diff) | |
download | etherpad-lite-e9e3ea305bc084f6f306413100578e74dec29b88.zip |
Merge pull request #992 from gedion/develop
Added hooks and made some ace functions available to editorInfo Object
Diffstat (limited to 'src/static/js/contentcollector.js')
-rw-r--r-- | src/static/js/contentcollector.js | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index 3ac4421c..6a75de43 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -375,6 +375,19 @@ 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 = (typeof(txtFromHook)=='object'&&txtFromHook.length==0)?dom.nodeValue(node):txtFromHook[0]; + var rest = ''; var x = 0; // offset into original text if (txt.length == 0) @@ -386,7 +399,7 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class if (endPoint && node == endPoint.node) { selEnd = _pointHere(0, state); - } + } } while (txt.length > 0) { @@ -441,8 +454,21 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class { var tname = (dom.nodeTagName(node) || "").toLowerCase(); if (tname == "br") - { - 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 + }); + var startNewLine= (typeof(induceLineBreak)=='object'&&induceLineBreak.length==0)?true:induceLineBreak[0]; + if(startNewLine){ + cc.startNewLine(state); + } } else if (tname == "script" || tname == "style") { |