ckeditor自定义模板配置

时间:2012-07-24 10:56:44

标签: javascript ckeditor

我声明ckeditor的配置如下:

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']] 
}

并以

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

哪个好,但是如何使用这种表示法添加自定义模板文件?

1 个答案:

答案 0 :(得分:3)

如果你进入ckeditor / plugins / templates / templates / default.js(基于版本3.6.2的文件结构),你会看到模板的定义。

使用此页面作为指南 - http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Templates - 您应该能够完成创建新模板所需的任何内容。

您可以使用以下表示法声明要在config.js文件中使用的模板文件的明确列表:

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

对于您的具体表示法,该行将是:

templates_files: [ '/mytemplates1.js', '/mytemplates2.js' ]
相关问题