Coykto
Coykto

Reputation: 1102

Is it possible to add a temlate to django CKEditor without editing it's templates-plugin files in site-packages?

There is a file in lib/python3.6/site-packages/ckeditor/static/ckeditor/ckeditor/plugins/templates/templates/default.js that i can edit to add more templates to my RichTextFields. But i would really like to track those changes with git and i don't want to add my environment to git. Is there a way to customize, add templates to django ckeditor's templates plugin?

Upvotes: 0

Views: 546

Answers (1)

j.swiderski
j.swiderski

Reputation: 2445

I can't tell you much about Dijango CKEditor however there is a possibility to add more than one template file to CKEditor using https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-templates and https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-templates_files configuration settings. Please see below:

var editor = CKEDITOR.replace( 'editor1', {
    language: 'en'              
    templates_files : [
        '/ckeditor/plugins/templates/templates/default.js',
        '/ckeditor/my_templates.js'
    ],
    templates : 'default,my_templates'
});

Please also have a look at: CKEditor - how to get the template attributes

Upvotes: 1

Related Questions