简体   繁体   中英

how to set the placeholder property of django-ckeditor

while using django-ckeditor for my website, i want to set the 'placeholder' property for the editor

I've tried to work directly in settings.py like this:

CKEDITOR_CONFIGS = {
    'default': {
        ...
        'extraPlugins': ','.join(['placeholder']),
        'placeholder': 'blabla'
    },
}

and i tried this in my_app/forms.py:

        widgets = {
            'body': forms.Textarea(attrs={'placeholder': 'blabla'})
        }

but it didn't work? what should i do?

Try this..

setings.py:

CKEDITOR_CONFIGS = {
    'special': 
        {'toolbar': 'Special', 'height': 1000,'width':1000,
         'config.toolbarGroups': 
             [
                 ['Bold', 'Image'],
             ],                          ⬇⬇⬇⬇⬇⬇⬇⬇
             'extraPlugins': ','.join(['placeholder',]),
         }
}

models.py:

class Post(models.Model):
    body = RichTextUploadingField(blank=True,config_name='special')

Image : 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM