prevLine/nextLine check fix

pull/3268/head
ilmar 2018-05-14 22:57:15 +03:00
parent 8d27f3cf03
commit 016497dbb4
1 changed files with 11 additions and 5 deletions

View File

@ -360,7 +360,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
{ {
nextLine = _analyzeLine(textLines[i + 1], attribLines[i + 1], apool); nextLine = _analyzeLine(textLines[i + 1], attribLines[i + 1], apool);
} }
hooks.callAll('getLineHTMLForExport', context); hooks.aCallAll('getLineHTMLForExport', context);
//To create list parent elements //To create list parent elements
if ((!prevLine || prevLine.listLevel !== line.listLevel) || (prevLine && line.listTypeName !== prevLine.listTypeName)) 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); return (item.level === line.listLevel && item.type === line.listTypeName);
}); });
if (!exists) { if (!exists) {
var prevLevel = prevLine.listLevel || 0; var prevLevel = 0;
if (prevLine && prevLine.listLevel) {
prevlevel = prevLine.listLevel;
}
if (prevLine && line.listTypeName !== prevLine.listTypeName) if (prevLine && line.listTypeName !== prevLine.listTypeName)
{ {
prevLevel = 0; prevLevel = 0;
@ -405,7 +408,10 @@ function getHTMLFromAtext(pad, atext, authorColors)
} }
if ((!nextLine || !nextLine.listLevel || nextLine.listLevel < line.listLevel) || (nextLine && line.listTypeName !== nextLine.listTypeName)) 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) if (nextLine && line.listTypeName !== nextLine.listTypeName)
{ {
nextLevel = 0; nextLevel = 0;
@ -445,7 +451,7 @@ function getHTMLFromAtext(pad, atext, authorColors)
padId: pad.id padId: pad.id
}; };
hooks.callAll("getLineHTMLForExport", context); hooks.aCallAll("getLineHTMLForExport", context);
pieces.push(context.lineContent, "<br>"); pieces.push(context.lineContent, "<br>");
} }
} }
@ -556,4 +562,4 @@ function _processSpaces(s){
} }
} }
return parts.join(''); return parts.join('');
} }