Force CKEditor to add a class to p-tags

前端 未结 3 923
青春惊慌失措
青春惊慌失措 2020-12-07 01:18

I must configure CKEditor to add a class-attribute to every p-tag in the content. You can do something similar with config.format_p but it will only apply the class-attribut

3条回答
  •  無奈伤痛
    2020-12-07 01:57

    I had the exact same problem, and after a while of messing around I finally found a one-line solution:

    config.format_p = { element : 'p', attributes : { 'class' : 'yourClassName' } };
    

    All you need to do is put this code in config.js and it will work :)

提交回复
热议问题