diff --git a/openslides/motion/pdf.py b/openslides/motion/pdf.py index 0c66cc4e6..3eb09b93d 100644 --- a/openslides/motion/pdf.py +++ b/openslides/motion/pdf.py @@ -189,6 +189,8 @@ def convert_html_to_reportlab(pdf, text): tag.unwrap() for tag in soup.find_all('li'): tag.unwrap() + for tag in soup.find_all('span'): + tag.unwrap() # print paragraphs with numbers text = soup.body.contents paragraph_number = 1 diff --git a/openslides/static/javascript/ckeditor-config.js b/openslides/static/javascript/ckeditor-config.js index aebd1462c..12e8d36fa 100644 --- a/openslides/static/javascript/ckeditor-config.js +++ b/openslides/static/javascript/ckeditor-config.js @@ -11,7 +11,7 @@ var ck_options = { bodyClass: "ckeditor_html", allowedContent: - 'h1 h2 h3 pre blockquote b i u strike;' + + 'h1 h2 h3 pre b i u strike em;' + // A workaround for the problem described in http://dev.ckeditor.com/ticket/10192 // Hopefully, the problem will be solved in the final version of CKEditor 4.1 @@ -19,10 +19,9 @@ var ck_options = { 'p{margin-left};' + 'a[!href];' + - 'table tr th td caption;' + - 'ol ul li;' + - 'span{!font-family};' + - 'span{!color};', + 'ol ul{list-style};' + + 'li;' + + 'span{color,background-color};', removePlugins: "save, print, preview, pagebreak, templates, showblocks, magicline", // Not part of the standard package of CKEditor @@ -37,7 +36,7 @@ var ck_options = { { name: 'basicstyles', items : [ 'Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat' ] }, { name: 'paragraph', items : [ 'NumberedList','BulletedList','-','Pre','InsertPre','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl' ] }, { name: 'links', items : [ 'Link','Unlink','Anchor' ] }, - { name: 'styles', items : [ 'Format','FontSize' ] }, + { name: 'styles', items : [ 'Format','FontSize','TextColor','BGColor' ] }, { name: 'tools', items : [ 'Maximize', 'ShowBlocks','-','About' ] } ], toolbar: 'Full' diff --git a/openslides/utils/forms.py b/openslides/utils/forms.py index 5803d5cb8..fb0419641 100644 --- a/openslides/utils/forms.py +++ b/openslides/utils/forms.py @@ -27,9 +27,10 @@ HTML_TAG_WHITELIST = ('a', HTML_ATTRIBUTES_WHITELIST = { 'a': ['href'], + '*': ['style'], } -HTML_STYLES_WHITELIST = () +HTML_STYLES_WHITELIST = ('color', 'background-color', 'list-style') class CssClassMixin(object): diff --git a/tests/forms/test_clean_html.py b/tests/forms/test_clean_html.py index 058d9e6a1..d942b46d8 100644 --- a/tests/forms/test_clean_html.py +++ b/tests/forms/test_clean_html.py @@ -40,14 +40,13 @@ class CleanHtmlTest(TestCase): self.clean_html('

good?

', '

good?

') self.clean_html('

Not evil

', '

Not evil

') self.clean_html('
evil
', 'evil') - self.clean_html('

bad

', '

bad

') self.clean_html('
OK
', 'OK') - self.clean_html('
OK
', 'OK') - self.clean_html('

OK

', '

OK

') + self.clean_html('

OK

', '

OK

') # Allowed tags and attributes self.clean_html('good?') self.clean_html('

OK

') self.clean_html('

OK

') self.clean_html('
OK
') - self.clean_html('') + self.clean_html('') + self.clean_html('OK')