Using v1.6, I made some changes that should preserve HTML and BODY tags. I would like to know if anyone else has tried this method.
I found all occurances of this code:
objContent.DOM.body.innerHTML
and changed it to this:
objContent.DocumentHTML
So, instead of just accessing the BODY tag's innerHTML, it will access the HTML from the complete document, including everything located outside of the BODY tag.
I only had to make the change in two files: fck_actions.js and fck_editor.js
Example:
// Gets the actual HTML.
function getValue()
{
var bWysiwyg = (trSource.style.display == "none") ;
if (bWysiwyg)
//return objContent.DOM.body.innerHTML ;
return objContent.DocumentHTML ;
else
return txtSource.value ;
}
I also modified the LoadHTML function in fck_editor.js. When switching from source view to wysiwyg view, it will add HTML and BODY tags if your html string is empty. I had to add this, otherwise the editor would not switch back to wysiwyg view when the string was empty:
function LoadHTML( html )
{
eActualState = STATE_LOADING_DATA ;
if (html != '')
objContent.DocumentHTML = html;
else
objContent.DocumentHTML =
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' +
'<html><head></head><body>' + html + '</body></html>' ;