django-tinymce

Configure TinyMCE Tag Use (Strong->B, etc) (Django-tinymce)


So, I'm looking through the documentation, and unfortunately it stops short of offering any sort of explanation on how the normal TinyMCE format translates into the settings.py TINYMCE_DEFAULT_CONFIG dictionary.

Basically, I need to configure it so that bold is represented as b, not strong, and other similar changes.

Does anyone have a syntax example they could share for this?


Solution

  • So, it turns out, using:

    django-tinymce4-lite

    As my library, the way this is done is:

    1. Try adjusting the formatting for inline to use the different element

    2. If it's still persistent, add the element to the extended_valid_elements

    3. Finally, if it really won't stop using strong and em, blacklist those tags

      'formats': {
        'bold':{'inline': 'b'},
        'underline':{'inline': 'u'},
        'italic':{'inline': 'i'},
       }
      

    and later:

    extended_valid_elements:'u,b,i'
    

    finally:

    invalid_elements:'em strong'