From c6b0c9206130d46f5ab72cdcb562ea0257a15c87 Mon Sep 17 00:00:00 2001 From: John McLear Date: Thu, 14 Jan 2021 14:03:29 +0000 Subject: [PATCH] stable :) --- src/static/js/contentcollector.js | 15 +++++++-------- src/static/js/domline.js | 3 ++- src/static/js/linestylefilter.js | 3 ++- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/static/js/contentcollector.js b/src/static/js/contentcollector.js index df84b34c4..245acc0c4 100644 --- a/src/static/js/contentcollector.js +++ b/src/static/js/contentcollector.js @@ -393,9 +393,8 @@ const makeContentCollector = function ( const tname = (dom.nodeTagName(node) || '').toLowerCase(); const styl = dom.nodeAttr(node, 'style'); const cls = dom.nodeAttr(node, 'class'); - if (tname === 'img') { - /* + // no hook sare called in this branch, just a demo.. hooks.callAll('collectContentImage', { cc, state, @@ -404,12 +403,13 @@ const makeContentCollector = function ( cls, node, }); - */ - state.lineAttributes.img = node.src; -// cc.doAttrib(state, 'img'); -// cc.startNewLine(state); - + if (node.src) state.lineAttributes.img = node.src; + this.breakLine = true; } else if (tname === 'br') { + // Delete line Attributes that can pollute line breaks, they should only + // 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; this.breakLine = true; const tvalue = dom.nodeAttr(node, 'value'); const induceLineBreak = hooks.callAll('collectContentLineBreak', { @@ -449,7 +449,6 @@ const makeContentCollector = function ( return; } if (collectStyles) { - if(tname === "img") debugger; hooks.callAll('collectContentPre', { cc, state, diff --git a/src/static/js/domline.js b/src/static/js/domline.js index fed9c96ad..5436bfa95 100644 --- a/src/static/js/domline.js +++ b/src/static/js/domline.js @@ -97,7 +97,8 @@ domline.createDomLine = (nonEmpty, doesWrap, optBrowser, optDocument) => { }); if (img) { - // do some shit with an image... cake + preHtml += ``; + processedMarker = true; } if (listType) { diff --git a/src/static/js/linestylefilter.js b/src/static/js/linestylefilter.js index 919a707f1..b191724eb 100644 --- a/src/static/js/linestylefilter.js +++ b/src/static/js/linestylefilter.js @@ -72,7 +72,6 @@ linestylefilter.getLineStyleFilter = (lineLength, aline, textAndClassFunc, apool const attribsToClasses = (attribs) => { let classes = ''; let isLineAttribMarker = false; -top.console.log("attribs", attribs) // For each attribute number Changeset.eachAttribNumber(attribs, (n) => { // Give us this attributes key @@ -92,6 +91,8 @@ top.console.log("attribs", attribs) classes += ` start:${value}`; } else if (linestylefilter.ATTRIB_CLASSES[key]) { classes += ` ${linestylefilter.ATTRIB_CLASSES[key]}`; + } else if (key === 'img') { + classes += ` img:${value}`; } else { classes += hooks.callAllStr('aceAttribsToClasses', { linestylefilter,