From d716bd5414cb9ff91296a106f005bbc937e2019e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emanuel=20Sch=C3=BCtze?= Date: Mon, 28 Mar 2022 14:19:04 +0200 Subject: [PATCH] Fix pdf making of a motion with line numbers (#6391) Fixed line breaks by using change recommendations in li elements. Migrated from OS4 (see #966) --- .../core/pdf-services/html-to-pdf.service.ts | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/client/src/app/core/pdf-services/html-to-pdf.service.ts b/client/src/app/core/pdf-services/html-to-pdf.service.ts index 7d90e8269..1c89e96b1 100644 --- a/client/src/app/core/pdf-services/html-to-pdf.service.ts +++ b/client/src/app/core/pdf-services/html-to-pdf.service.ts @@ -181,7 +181,6 @@ export class HtmlToPdfService { * Converts a single HTML element to pdfmake, calls itself recursively for child html elements * * @param element can be an HTML element (

) or plain text ("Hello World") - * @param currentParagraph usually holds the parent element, to allow nested structures * @param styles holds the style attributes of HTML elements (`

...`) * @returns the doc def to the given element in consideration to the given paragraph and styles */ @@ -237,9 +236,8 @@ export class HtmlToPdfService { if ( this.lineNumberingMode === LineNumberingMode.Outside && !classes.includes('insert') && - !(nodeName === 'li' && directChildIsCrNode) + nodeName !== `li` ) { - // newParagraph = this.create('stack'); newParagraph.stack = children; } else { @@ -344,17 +342,10 @@ export class HtmlToPdfService { break; } case 'br': { - if ( - (this.lineNumberingMode === LineNumberingMode.None && classes.includes('os-line-break')) || - (this.lineNumberingMode === LineNumberingMode.Outside && this.isInsideAList(element)) - ) { - break; - } else { - newParagraph = this.create('text'); - // yep thats all - newParagraph.text = '\n'; - newParagraph.lineHeight = this.LINE_HEIGHT; - } + newParagraph = this.create('text'); + // yep thats all + newParagraph.text = '\n'; + newParagraph.lineHeight = this.LINE_HEIGHT; break; } case 'ul': @@ -712,8 +703,7 @@ export class HtmlToPdfService { } /** - * Detect if the given element is a cr exclusive node - * @param child + * Detect if the given element is a change recommendation exclusive node */ private isCrElement(element: Element): boolean { const nodeName = element.nodeName.toLowerCase();