Merge pull request #3272 from FinnStutzenstein/tracker14

Fixed missing styles of headings in motion pdf.
This commit is contained in:
Norman Jäckel 2017-05-31 10:08:03 +02:00 committed by GitHub
commit d20945bcb6

View File

@ -527,7 +527,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
var styleDefinition = singleStyle.trim().toLowerCase().split(":"); var styleDefinition = singleStyle.trim().toLowerCase().split(":");
var style = styleDefinition[0]; var style = styleDefinition[0];
var value = styleDefinition[1]; var value = styleDefinition[1];
if (styleDefinition.length == 2) { if (styleDefinition.length === 2) {
switch (style) { switch (style) {
case "padding-left": case "padding-left":
o.margin = [parseInt(value), 0, 0, 0]; o.margin = [parseInt(value), 0, 0, 0];
@ -572,7 +572,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
o.color = parseColor(value); o.color = parseColor(value);
break; break;
case "background-color": case "background-color":
o.background = value; o.background = parseColor(value);
break; break;
} }
} }
@ -591,7 +591,6 @@ angular.module('OpenSlidesApp.core.pdf', [])
styles = styles || []; styles = styles || [];
var classes = []; var classes = [];
if (element.getAttribute) { if (element.getAttribute) {
styles = [];
var nodeStyle = element.getAttribute("style"); var nodeStyle = element.getAttribute("style");
if (nodeStyle) { if (nodeStyle) {
nodeStyle.split(";").forEach(function(nodeStyle) { nodeStyle.split(";").forEach(function(nodeStyle) {
@ -672,9 +671,11 @@ angular.module('OpenSlidesApp.core.pdf', [])
}); });
var border = element.getAttribute("border"); var border = element.getAttribute("border");
var isBorder = false; var isBorder = false;
if (border) if (border) {
if (parseInt(border) == 1) isBorder = true; isBorder = (parseInt(border) === 1);
if (!isBorder) t.layout = 'noBorders'; } else {
t.layout = 'noBorders';
}
currentParagraph = parseChildren(t.table.body, element, currentParagraph, styles, diff_mode); currentParagraph = parseChildren(t.table.body, element, currentParagraph, styles, diff_mode);
var widths = element.getAttribute("widths"); var widths = element.getAttribute("widths");
if (!widths) { if (!widths) {
@ -712,8 +713,8 @@ angular.module('OpenSlidesApp.core.pdf', [])
break; break;
case "span": case "span":
if (element.getAttribute("data-line-number")) { if (element.getAttribute("data-line-number")) {
if (lineNumberMode == "inline") { if (lineNumberMode === "inline") {
if (diff_mode != DIFF_MODE_INSERT) { if (diff_mode !== DIFF_MODE_INSERT) {
var lineNumberInline = element.getAttribute("data-line-number"), var lineNumberInline = element.getAttribute("data-line-number"),
lineNumberObjInline = { lineNumberObjInline = {
text: lineNumberInline, text: lineNumberInline,
@ -722,9 +723,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
}; };
currentParagraph.text.push(lineNumberObjInline); currentParagraph.text.push(lineNumberObjInline);
} }
} else if (lineNumberMode == "outside") { } else if (lineNumberMode === "outside") {
var lineNumberOutline; var lineNumberOutline;
if (diff_mode == DIFF_MODE_INSERT) { if (diff_mode === DIFF_MODE_INSERT) {
lineNumberOutline = ""; lineNumberOutline = "";
} else { } else {
lineNumberOutline = element.getAttribute("data-line-number"); lineNumberOutline = element.getAttribute("data-line-number");
@ -766,9 +767,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
break; break;
} else { } else {
currentParagraph = create("text"); currentParagraph = create("text");
if (lineNumberMode == "outside" && if (lineNumberMode === "outside" &&
brParentNodeName != "LI"&& brParentNodeName !== "LI" &&
element.parentNode.parentNode.nodeName != "LI") { element.parentNode.parentNode.nodeName !== "LI") {
currentParagraph.margin = [20, 0, 0, 0]; currentParagraph.margin = [20, 0, 0, 0];
} }
currentParagraph.lineHeight = 1.25; currentParagraph.lineHeight = 1.25;
@ -863,7 +864,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
case "ol": case "ol":
var list = create(nodeName); var list = create(nodeName);
ComputeStyle(list, styles); ComputeStyle(list, styles);
if (lineNumberMode == "outside") { if (lineNumberMode === "outside") {
var lines = extractLineNumbers(element); var lines = extractLineNumbers(element);
currentParagraph = parseChildren(list[nodeName], element, currentParagraph, styles, diff_mode); currentParagraph = parseChildren(list[nodeName], element, currentParagraph, styles, diff_mode);
if (lines.length > 0) { if (lines.length > 0) {