Tinymce Halfpage Plugin
This came about when I was trying to use TinyMCE to edit html templates which contained various <html> <body> <style> tags.
By default, tinymce & the browser remove these tags from the content when it loads.
The tinymce fullpage plugin does a great job in stopping them from getting removed, it saves them in memory as the page loads before tinymce and the browser gets a chance to remove them. The problem with the default fullpage plugin is it will add those html/body tags back if they don’t exist. This is a problem if you are also editing content that doesn’t need these <body> tags added in.
Here’s some really simple examples of what the plugin does:
HTML Content before loading in TinyMCE | HTML Content after saving from TinyMCE |
<html> <title>test</title> <style> body{ color:red;} </style> <body> <h1>Testing Page</h1> </body> | <html> <title>test</title> <style> body{ color:red;} </style> <body> <h1>Testing Page</h1> </body> |
<h1>Testing Page</h1> <p>test test test</p> | <h1>Testing Page</h1> <p>test test test</p> |
<body bgcolor=”black”> <h1>Testing Page</h1> <p>test test test</p> </body> | <body bgcolor=”black”> <h1>Testing Page</h1> <p>test test test</p> </body> |
<html> invalid stuff </html> | invalid stuff |
Download the plugin as a zip file by clicking here.
Extract the plugin to the tiny_mce/plugins directory (eg: tiny_mce/plugins/halfpage/)
Then add “halfpage” to the list of plugins in your tinymce config.
Leave me a comment if you have any problems with it, this works perfectly in my situation but others may have different needs.
Cheers!
dtbaker
Hi there! I stumbled on exactly the same problem and it seems your solution could work, but the link to plugin is broken. Can you please update it? Thx!