2

I'm using the following config:

formats : {alignleft : {selector : 'img', classes : 'float-left'},
    alignright : {selector : 'img', classes : 'float-right'},
},

to make tiny use my custom classes for image alignment (which just set a css float of left or right) rather than applying them inline in styles.

Now, this works when I save the content and preview it, but in the tiny editor the image just stays where it is and won't float.

Inspecting the image code in Safari web inspector shows the class being correctly applied to the img element, it just doesn't.. float!

The page with the editor has access to the main stylesheet with the float-left and float-right classes too.

I'm new to tiny so perhaps I'm missing something here?

4

1 回答 1

2

为了在编辑器本身中查看类的变化,您需要在初始化期间设置样式表。

tinyMCE.init({
    content_css : "/editor-style.css"    // http://domain.com/editor-style.css
});

这应该为您的编辑器拉入样式表。拉入样式表后,您必须将样式添加到样式表中才能正确显示它们。

于 2013-09-03T00:45:52.313 回答