Merge pull request #2744 from tsiegleauq/issue2576-parsing-does-not-end

add precise text decoration (fixes #2576)
This commit is contained in:
Norman Jäckel 2016-12-07 22:14:49 +01:00 committed by GitHub
commit 787805efa6

View File

@ -619,6 +619,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
alreadyConverted.push(st); alreadyConverted.push(st);
break; break;
case "span": case "span":
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"),
@ -653,8 +654,12 @@ angular.module('OpenSlidesApp.core.pdf', [])
col.columns.push(currentParagraph); col.columns.push(currentParagraph);
parseChildren(col.columns[0], element, currentParagraph, styles, diff_mode); parseChildren(col.columns[0], element, currentParagraph, styles, diff_mode);
alreadyConverted.push(col); alreadyConverted.push(col);
} else { }
parseChildren(alreadyConverted, element, currentParagraph, styles, diff_mode); }
else {
var spanText = create("text", element.textContent.replace(/\n/g, ""));
ComputeStyle(spanText, styles);
currentParagraph.text.push(spanText);
} }
break; break;
case "br": case "br":
@ -704,7 +709,6 @@ angular.module('OpenSlidesApp.core.pdf', [])
width *= scaleByHeight; width *= scaleByHeight;
height *= scaleByHeight; height *= scaleByHeight;
} }
alreadyConverted.push({ alreadyConverted.push({
image: BaseMap[element.getAttribute("src")], image: BaseMap[element.getAttribute("src")],
width: width, width: width,
@ -745,17 +749,12 @@ angular.module('OpenSlidesApp.core.pdf', [])
} }
break; break;
default: default:
var temporary = create("text", element.textContent.replace(/\n/g, "")); var defaultText = create("text", element.textContent.replace(/\n/g, ""));
if (styles) {
ComputeStyle(temporary, styles);
}
// TODO: This if-clause is a hotfix for issue #2442.
// Do this right! Why is currentParagraph undefined?
if (!currentParagraph) { if (!currentParagraph) {
currentParagraph = {}; currentParagraph = {};
currentParagraph.text = []; currentParagraph.text = [];
} }
currentParagraph.text.push(temporary); currentParagraph.text.push(defaultText);
break; break;
} }
return currentParagraph; return currentParagraph;