Barry Hamilton
Barry Hamilton

Reputation: 973

ckeditor custom template config

I declare config for ckeditor as follows:

var ckconfig  = {
    uiColor: '#ffffff',
    stylesCombo_stylesSet: [],
    format_tags: "p;h2;h3;h4;div",
    contentsCss : '/js/admin/editorstyles/default.css',
    extraPlugins : 'stylesheetparser',
    scayt_autoStartup:true,
    toolbar_Full: [['Templates','Styles','Format','FontSize','TextColor', 'Bold', 'Italic', 'Underline','-', 'NumberedList', 'BulletedList','-','Scayt','PasteText'],
    ['Image','Link', 'Unlink'], ['Undo', 'Redo'],['Source', 'Maximize', 'ShowBlocks']] 
}

and initiate as

$('textarea#b_description').ckeditor(ckconfig);

Which is fine, but how would I add a custom template file with this notation?

Upvotes: 2

Views: 8339

Answers (1)

Trip
Trip

Reputation: 2016

If you go into ckeditor/plugins/templates/templates/default.js (based on file structure for version 3.6.2), you will see the definitions for templates.

Using this page as a guide -- http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Templates -- you should be able to accomplish whatever is necessary to create new templates.

You can declare an explicit list of template files to use inside your config.js file using the following notation:

config.templates_files = [ '/mytemplates.js' ];

For your specific notation, the line would be:

templates_files: [ '/mytemplates1.js', '/mytemplates2.js' ]

Upvotes: 3

Related Questions