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)
This commit is contained in:
parent
941b0be524
commit
d716bd5414
@ -181,7 +181,6 @@ export class HtmlToPdfService {
|
|||||||
* Converts a single HTML element to pdfmake, calls itself recursively for child html elements
|
* Converts a single HTML element to pdfmake, calls itself recursively for child html elements
|
||||||
*
|
*
|
||||||
* @param element can be an HTML element (<p>) or plain text ("Hello World")
|
* @param element can be an HTML element (<p>) 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 (`<div style="color: green">...`)
|
* @param styles holds the style attributes of HTML elements (`<div style="color: green">...`)
|
||||||
* @returns the doc def to the given element in consideration to the given paragraph and styles
|
* @returns the doc def to the given element in consideration to the given paragraph and styles
|
||||||
*/
|
*/
|
||||||
@ -237,9 +236,8 @@ export class HtmlToPdfService {
|
|||||||
if (
|
if (
|
||||||
this.lineNumberingMode === LineNumberingMode.Outside &&
|
this.lineNumberingMode === LineNumberingMode.Outside &&
|
||||||
!classes.includes('insert') &&
|
!classes.includes('insert') &&
|
||||||
!(nodeName === 'li' && directChildIsCrNode)
|
nodeName !== `li`
|
||||||
) {
|
) {
|
||||||
//
|
|
||||||
newParagraph = this.create('stack');
|
newParagraph = this.create('stack');
|
||||||
newParagraph.stack = children;
|
newParagraph.stack = children;
|
||||||
} else {
|
} else {
|
||||||
@ -344,17 +342,10 @@ export class HtmlToPdfService {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'br': {
|
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');
|
newParagraph = this.create('text');
|
||||||
// yep thats all
|
// yep thats all
|
||||||
newParagraph.text = '\n';
|
newParagraph.text = '\n';
|
||||||
newParagraph.lineHeight = this.LINE_HEIGHT;
|
newParagraph.lineHeight = this.LINE_HEIGHT;
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'ul':
|
case 'ul':
|
||||||
@ -712,8 +703,7 @@ export class HtmlToPdfService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detect if the given element is a cr exclusive node
|
* Detect if the given element is a change recommendation exclusive node
|
||||||
* @param child
|
|
||||||
*/
|
*/
|
||||||
private isCrElement(element: Element): boolean {
|
private isCrElement(element: Element): boolean {
|
||||||
const nodeName = element.nodeName.toLowerCase();
|
const nodeName = element.nodeName.toLowerCase();
|
||||||
|
Loading…
Reference in New Issue
Block a user