相关疑难解决方法(0)

强制CKEditor将类添加到p-tags

我必须配置CKEditor以将class-attribute添加到内容中的每个p-tag.您可以使用config.format_p执行类似的操作,但它只会将class-attribute应用于标记为"normal"的文本,而不是默认值.

任何人?

编辑:我正在使用当前版本3.6.2.以下是我的配置的相关部分:

CKEDITOR.editorConfig = function( config )
{   
    config.removeFormatTags = 'b,div,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var,form,input,textarea';

    config.format_p =
    {
        element: 'p',
        attributes:
        {
            'class': 'tiny_p'
        }
    };
    config.skin = "office2003";
    config.entities_processNumerical = true;
}
Run Code Online (Sandbox Code Playgroud)

config.format_p选项仅在用户从格式菜单中选择"正常"时生效,并且config.removeFormatTags仅在用户手动单击清洁按钮时才有效.两者都应该像在TinyMCE中那样自动工作.

css ckeditor

9
推荐指数
1
解决办法
1万
查看次数

标签 统计

ckeditor ×1

css ×1