From 016497dbb4021db3ac70e605aae5c71e10e78258 Mon Sep 17 00:00:00 2001 From: ilmar Date: Mon, 14 May 2018 22:57:15 +0300 Subject: [PATCH] prevLine/nextLine check fix --- src/node/utils/ExportHtml.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/node/utils/ExportHtml.js b/src/node/utils/ExportHtml.js index bd0ad12c2..50ebd8b65 100644 --- a/src/node/utils/ExportHtml.js +++ b/src/node/utils/ExportHtml.js @@ -360,7 +360,7 @@ function getHTMLFromAtext(pad, atext, authorColors) { nextLine = _analyzeLine(textLines[i + 1], attribLines[i + 1], apool); } - hooks.callAll('getLineHTMLForExport', context); + hooks.aCallAll('getLineHTMLForExport', context); //To create list parent elements if ((!prevLine || prevLine.listLevel !== line.listLevel) || (prevLine && line.listTypeName !== prevLine.listTypeName)) { @@ -369,7 +369,10 @@ function getHTMLFromAtext(pad, atext, authorColors) return (item.level === line.listLevel && item.type === line.listTypeName); }); if (!exists) { - var prevLevel = prevLine.listLevel || 0; + var prevLevel = 0; + if (prevLine && prevLine.listLevel) { + prevlevel = prevLine.listLevel; + } if (prevLine && line.listTypeName !== prevLine.listTypeName) { prevLevel = 0; @@ -405,7 +408,10 @@ function getHTMLFromAtext(pad, atext, authorColors) } if ((!nextLine || !nextLine.listLevel || nextLine.listLevel < line.listLevel) || (nextLine && line.listTypeName !== nextLine.listTypeName)) { - var nextLevel = nextLine.listLevel || 0; + var nextLevel = 0; + if (nextLine && nextLine.listLevel) { + nextLevel = nextLine.listLevel; + } if (nextLine && line.listTypeName !== nextLine.listTypeName) { nextLevel = 0; @@ -445,7 +451,7 @@ function getHTMLFromAtext(pad, atext, authorColors) padId: pad.id }; - hooks.callAll("getLineHTMLForExport", context); + hooks.aCallAll("getLineHTMLForExport", context); pieces.push(context.lineContent, "
"); } } @@ -556,4 +562,4 @@ function _processSpaces(s){ } } return parts.join(''); -} \ No newline at end of file +}