ckeditor新款式不起作用(laravel 5)

时间:2017-08-08 16:33:55

标签: laravel ckeditor styles

我用样式的例子修改了文件styles.js:

CKEDITOR.stylesSet.add( 'estilos', [
// Block-level styles
{ name: 'Blue Title', element: 'h2', styles: { 'color': 'Blue' } },
{ name: 'Red Title' , element: 'h3', styles: { 'color': 'Red' } },

// Inline styles
{ name: 'CSS Style', element: 'span', attributes: { 'class': 'my_style' } },
{ name: 'Marker: Yellow', element: 'span', styles: { 'background-

color': 'Yellow' } }
] );

在config.js中我添加了一行: config.stylesSet =' estilos';

CKEDITOR.editorConfig = function( config ) {

config.stylesSet = 'estilos';

config.toolbarGroups = [
    { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
    { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
    { name: 'links' },
    { name: 'insert' },
    { name: 'forms' },
    { name: 'tools' },
    { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
    { name: 'others' },
    '/',
    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
    { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ] },
    { name: 'styles' },
    { name: 'colors' },
    { name: 'about' }
];

config.removeButtons = 'Underline,Subscript,Superscript';
config.format_tags = 'p;h1;h2;h3;pre';
config.removeDialogTabs = 'image:advanced;link:advanced';
};

但这不起作用。视图中的styles选项被禁用: Styles option view

有什么想法吗?感谢。

1 个答案:

答案 0 :(得分:0)

好吧,我已经解决了:) 您必须在 config.toolbarGroups

之后加上 config.stylesSet =' estilos' 这一行

我希望这对某人有用。