sirFunkenstine
sirFunkenstine

Reputation: 8495

Django CKEditor AllowedContent

Does anyone know how to get the advancedContentFilter working in the django-ckeditor config settings? Im trying to filter pasted in p tags to remove style attributes. Im using the following in settings.py but it does'nt seem to register.

CKEDITOR_CONFIGS = {
    'allowedContent':'p',
}

Upvotes: 4

Views: 3094

Answers (4)

Gaurav Nagar
Gaurav Nagar

Reputation: 371

Django CKEditor

It's works for me

you can add or remove tag according to your need,

and do True False which you want (attributes, styles, classes)

https://django-ckeditor.readthedocs.io/en/latest/#if-you-want-to-use-allowedcontent


CKEDITOR_CONFIGS = {
    'default': {

    'removePlugins': 'stylesheetparser',
            
    'allowedContent': True,

    'allowedContent':{'ul div section ol a p ':{
                'attributes': True,
                'styles': True,
                'classes': False
                },
              
            }, 
    ......
    .......
    ......


}
}

Upvotes: 0

Vladimir Evstratov
Vladimir Evstratov

Reputation: 61

This works for me

CKEDITOR_CONFIGS = {
  'default': {
    'removePlugins': 'stylesheetparser',
    'allowedContent': True,
  },
}

Upvotes: 6

nevelis
nevelis

Reputation: 748

CKEDITOR_CONFIGS is a dictionary of configs, not a config dictionary :D try:

CKEDITOR_CONFIGS = {
    'default': {
        'allowedContent':'p',
    },
}

Upvotes: 1

Andrey Nelubin
Andrey Nelubin

Reputation: 3294

Have you tried to remove stylesheetparser plugin?

https://github.com/shaunsephton/django-ckeditor#if-you-want-to-use-allowedcontent

Upvotes: 0

Related Questions