Merge pull request #2776 from CatoTH/Issue2770-pdfmake-bugfix
Bugfix for #2770
This commit is contained in:
commit
4ebb8023e3
@ -410,7 +410,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
*/
|
*/
|
||||||
extractLineNumbers = function(element) {
|
extractLineNumbers = function(element) {
|
||||||
var foundLineNumbers = [];
|
var foundLineNumbers = [];
|
||||||
if (element.nodeName == 'SPAN' && element.getAttribute('class').indexOf('os-line-number') > -1) {
|
if (element.nodeName == 'SPAN' && element.getAttribute('class') && element.getAttribute('class').indexOf('os-line-number') > -1) {
|
||||||
foundLineNumbers.push(element.getAttribute('data-line-number'));
|
foundLineNumbers.push(element.getAttribute('data-line-number'));
|
||||||
element.parentNode.removeChild(element);
|
element.parentNode.removeChild(element);
|
||||||
} else {
|
} else {
|
||||||
|
@ -158,6 +158,17 @@ describe('pdf', function () {
|
|||||||
"margin": [0,10,0,0]
|
"margin": [0,10,0,0]
|
||||||
}));
|
}));
|
||||||
expect(JSON.stringify(pdfmake[2])).toBe(emptyline);
|
expect(JSON.stringify(pdfmake[2])).toBe(emptyline);
|
||||||
})
|
});
|
||||||
|
|
||||||
|
it('does not break with non-line-break SPANs', function () {
|
||||||
|
var inHtml = "<ol><li>Test line 1<span>empty span</span></li></ol>",
|
||||||
|
numberedHtml = lineNumberingService.insertLineNumbers(inHtml, 80);
|
||||||
|
|
||||||
|
var instance = PdfMakeConverter.createInstance();
|
||||||
|
var pdfmake = instance.convertHTML(numberedHtml, 'outside');
|
||||||
|
|
||||||
|
// the actual result is's the point here; only that it doesn't throw an exception
|
||||||
|
expect(JSON.stringify(pdfmake[0])).toBe(emptyline);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
Loading…
Reference in New Issue
Block a user