Django-cms editors and HTML data attribute cleared
Using django-cms 2.4 I need to create pages that contain bootstrap code but the html5lib used clears the data- * attributes. Whether you specify valid_element in TINYMCE_DEFAULT_CONFIG. (I'm still looking for a similar option for Wymeditor) because it is done in # plugins / text / models (clean_html function: https://github.com/divio/django-cms/issues/1529 )
Github issue: https://github.com/divio/django-cms/issues/1529
What could be a possible workaround? How do I extend the text plugin in the admin part?
Thank!
source to share
I believe removing fields is done with html5lib which cms uses as python package, you need to open html5lib folder and open sanitizer.py, on line 184 where the code is:
if name in self.allowed_attributes])
change to:
if name in self.allowed_attributes or re.match( r'data-.*',name)])
this will allow all data- (whatever) attributes to be used
for WYMeditor the data- (any) attribute is already allowed
source to share