开发者

Set default image style in CKEditor

I'm using CKEditor with CKFinder in a custom CMS. Users upload and insert photos in articles and that works almost beautifully. The downside is that the default image style is margin/padding:0px, so the images appear crowded when left or right aligned.

Is there a way to set up a default image style in CKEditor, so that when a user inserts an image (whether through CKFinder or entering direct HTML/Source), a padding:10px at开发者_如何学Ctribute is added as a style?


You can set the styles within the editor here

CKEditor 3.x Styles

Personally, I use the contentsCss configuration option to provide a stylesheet reference, like so:

CKEDITOR.editorConfig = function(config) {
    config.contentsCss = ['styles.css'];
};

And inside styles.css you could do:

img { margin: 10px; }

or whatever you want to do for images.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜