diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index d8f8b8340..0ed8edaa6 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -394,11 +394,10 @@ const makeContentCollector = function ( const styl = dom.nodeAttr(node, 'style'); const cls = dom.nodeAttr(node, 'class'); - // clear to avoid pollution of trailing blank lines after lines with attributes - // during import - if (state.lineAttributes) { - delete state.lineAttributes; - state.lineAttributes = {}; + // clear to avoid pollution of trailing blank lines after image lines + // with attributes during import + if (state.lineAttributes && state.lineAttributes.img) { + delete state.lineAttributes.img; } if (tname === 'img') { @@ -420,7 +419,6 @@ const makeContentCollector = function ( // be present in the line itself, not in any attributes of a line.. // uncommenting the below will make duplicate images.. :) if (state.lineAttributes) delete state.lineAttributes; - console.warn("state", state); this.breakLine = true; const tvalue = dom.nodeAttr(node, 'value'); const induceLineBreak = hooks.callAll('collectContentLineBreak', { diff --git a/tests/backend/specs/contentcollector.js b/tests/backend/specs/contentcollector.js index 408ae4f0c..afc982b95 100644 --- a/tests/backend/specs/contentcollector.js +++ b/tests/backend/specs/contentcollector.js @@ -17,11 +17,10 @@ const cheerio = require('../../../src/node_modules/cheerio'); const tests = { image: { description: 'Puts an image in the content', - html: '

image

', - expectedLineAttribs: ['+5', '*0*1*2+1'], - expectedText: ['image', '*'], + html: '

image

world

', + expectedLineAttribs: ['+5', '*0*1*2+1', '+5'], + expectedText: ['image', '*', 'world'], }, -/* nestedLi: { description: 'Complex nested Li', html: '
  1. one
    1. 1.1
  2. two
', @@ -278,7 +277,6 @@ pre expectedLineAttribs: ['+f*0+2+2'], expectedText: ['Need more space s !'] }, -*/ }; describe(__filename, function () {