0

How can I set datas with CKEditor (4.0) with CSS style ?

$quote = $editor + '<br />'+ 
        '<div class="quote">'+
            '<div class="quote-infos">'+
                '<i class="icon-comment icon-white"></i>'+
                ' <span class="quote-user">'+$user+'</span>,'+
                ' <span class="quote-date">'+$date+'</span> :'+
            '</div>'+
            '<blockquote>'+$div.html()+'</blockquote>'+
        '</div>';   
editorMessage.setData($quote);

In this code, when I send the datas to a POST form, I just have <div><div><i></i><span...

4

1 回答 1

1

If you are using the new 4.1 CKEditor, it might be because of the new Advanced Content Filter feature. It nukes tags, attributes and attribute contents from content HTML, see demo. Turn it off by adding config.allowedContent = true to your config. More info on configuration in the API

您可以在 CKE 实例中轻松测试这一点,方法是转到源模式,手动将一些属性添加到内容中,例如<div class="MagicalPonies"><div><i></i><span......然后切换到所见即所得模式并返回源模式。如果您的类定义丢失,则很可能是 ACF。也尝试添加一个类<img alt="X" class="left" src="http://b.cksource.com/a/1/img/sample.jpg" />,看看是否坚持。像这样的标准 CKE 类不会被删除。

于 2013-03-30T08:35:25.123 回答