I am facing a problem with TinyMCE.
I am developing a functionality on the administration side of my website, where the administrator can edit the content of pages. I have provided them with the TinyMCE for that purpose.
Suppose they are editing Page 'page1'.
They will provide its content in TinyMCE, and save it.
When somebody is visiting that Page 'page1' all I am doing is:
<html>
<head>.........</head>
<body>
.......
<div class='page_content'>
<?php echo $page1->getContent(); ?>
</div>
......
</body>
</html>
Everything is working fine.
Now, TinyMCE provides a feature where you tell which CSS will it use. You set the required CSS to the 'content_css' property of the TinyMCE init function.
I did that, I provided the CSS which I was using to style my page content.
Now, my problem is this:
The content of my page is in div.page_content
. But in TinyMCE, the content of this page is not in any other thing (any div.page_content
). So the style which TinyMCE is applying to my content, while I am editing it, is not visually effective.
The only way, which I can think of,开发者_如何学编程 for resolving this problem is by telling TinyMCE to add
<div class='page_content'>
at the top. And then, when the administrator submits the data, I will just strip this extra div.
Any suggestions?
There is an option in TinyMCE configuration called 'body_class'. You just have to add "body_class = 'page_content'"
The way I would solve this is by adding the class "mceContentBody" to the CSS definitions with a comma as seperator. For example:
.page_content, .mceContentBody {
put your code here..
}
精彩评论