diff --git a/openslides/core/static/js/core/pdf.js b/openslides/core/static/js/core/pdf.js index 48d4ecadc..5ce270beb 100644 --- a/openslides/core/static/js/core/pdf.js +++ b/openslides/core/static/js/core/pdf.js @@ -847,19 +847,37 @@ angular.module('OpenSlidesApp.core.pdf', []) case "br": var brParent = element.parentNode; var brParentNodeName = brParent.nodeName; - //in case of inline-line-numbers and the os-line-break class ignore the break - if (((lineNumberMode === 'inline' || lineNumberMode === 'none') && - hasClass(element, 'os-line-break')) || - (lineNumberMode === 'outside' && - hasClass(element, 'os-line-break') && - hasClass(brParent, 'os-split-before'))) { + //in case of no or inline-line-numbers and the ignore os-line-breaks. + if ((lineNumberMode === 'inline' || lineNumberMode === 'none') && + hasClass(element, 'os-line-break')) { break; } else { currentParagraph = create("text"); if (lineNumberMode === "outside" && brParentNodeName !== "LI" && element.parentNode.parentNode.nodeName !== "LI") { - currentParagraph.margin = [20, 0, 0, 0]; + if (brParentNodeName === 'INS' || brParentNodeName === 'DEL') { + + var hasPrevSiblingALineNumber = function (element) { + // Iterare all nodes up to the top from element. + while (element) { + if (getLineNumber(element)) { + return true; + } + if (element.previousSibling) { + element = element.previousSibling; + } else { + element = element.parentNode; + } + } + return false; + }; + if (hasPrevSiblingALineNumber(brParent)) { + currentParagraph.margin = [20, 0, 0, 0]; + } + } else { + currentParagraph.margin = [20, 0, 0, 0]; + } } // Add a dummy line, if the next tag is a BR tag again. The line could // not be empty otherwise it will be removed and the empty line is not displayed diff --git a/openslides/utils/validate.py b/openslides/utils/validate.py index 973b42bb5..e0e5bbb0e 100644 --- a/openslides/utils/validate.py +++ b/openslides/utils/validate.py @@ -24,7 +24,9 @@ def validate_html(html: str) -> str: """ This method takes a string and escapes all non-whitelisted html entries. Every field of a model that is loaded trusted in the DOM should be validated. + During copy and paste from Word maybe some tabs are spread over the html. Remove them. """ + html = html.replace('\t', '') return bleach.clean( html, tags=allowed_tags,