0
votes

I've implemented a PlaceholderField outside my CMS and it works fine but Text copied from MS-Word keeps all dirty markup (like <font face="Times New Roman, serif"><font size="3">) which I want to get rid of. When I copy the same Text in a normal CKEditor field it works as explained in djangocms-text-ckeditor source (settings.TEXT_HTML_SANITIZE using html5lib).

Is there a parameter I can add to settings.CMS_PLACEHOLDER_CONF in order to make it work? Or any idea to implement it?

You may ask "Why not using directly HTMLField with djangocms-text-ckeditor?" Because I want to have access to Filer-File and Filer-Image plugins available in PlaceholderField.

1
in fact TEXT_HTML_SANITIZE is set to True by default and it is not meant to what I want to do: clean unwanted styling attributes. It is designed to make sure to have perfect (leniant) HTML code: open and close accepted tags (w3c). One of the reason to use it is to make you app able to embed <iframe>. This is done in conjunction with these 2 extra settings vars: TEXT_ADDITIONAL_TAGS = ('iframe',) TEXT_ADDITIONAL_ATTRIBUTES = ('scrolling', 'allowfullscreen', 'frameborder', 'src', 'height', 'width') - openHBP
I have build my own HTML cleanup by using beautifulsoup :-) - openHBP

1 Answers

0
votes

The following setting is not part of the placeholder config, they are separate settings in the settings.py file:

TEXT_HTML_SANITIZE = True

CKEDITOR_SETTINGS = {
    ...
    'basicEntities': True,
    'entities': True,
    ...
}

Taken from: https://github.com/django-cms/djangocms-text-ckeditor#configurable-sanitizer