From dcb3e13358c9da5f3036cbf0c655cf9dd289af12 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 7 Apr 2014 19:19:38 +0100 Subject: [PATCH] content collector for images --- src/static/js/contentcollector.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index ee0a1c27a..88ada345f 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -78,7 +78,8 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class "div": 1, "p": 1, "pre": 1, - "li": 1 + "li": 1, + "img":1 }; function isBlockElement(n) @@ -452,7 +453,12 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class else { var tname = (dom.nodeTagName(node) || "").toLowerCase(); - if (tname == "br") + if(tname == "img"){ + cc.incrementAttrib(state, "image"); + isEmpty = false; + state.lineAttributes.pastedImage = node.outerHTML + "
foo
"; + } + else if (tname == "br") { this.breakLine = true; var tvalue = dom.nodeAttr(node, 'value'); @@ -616,13 +622,13 @@ function makeContentCollector(collectStyles, browser, apool, domInterface, class }; // each returns [line, char] or [-1,-1] var getSelectionStart = function() - { - return selStart; - }; + { + return selStart; + }; var getSelectionEnd = function() - { - return selEnd; - }; + { + return selEnd; + }; // returns array of strings for lines found, last entry will be "" if // last line is complete (i.e. if a following span should be on a new line).