I have not figured out how to compile CKEditor 4 to try this with the latest version, though it looks like it should work.
For that reason, I am still using the last version of 3.6. I implemented this patch (http://dev.ckeditor.com/ticket/9774) which works fairly well.
The patch wraps the editor contents with elements which can match the target page elements without saving them. This way, I can use the same css as the website and get the contents to match the site fairly exactly.
The editor source contents within the iframe ends up looking like this:
...<body><!--BODYPREPENDBEGIN--><div id="myWrapper"><div class="myContent"><!--BODYPREPENDEND-->
When the layout is more complex, this is really helpful for matching the site css to the editor wysiwyg view.
The main issue I am having is that the patch is using comment tags to mark the beginning and and of the prepended and appended tags. Occasionally, it is possible to get the cursor outside of the desired area entering content that would not be saved. It is however obvious when it happens and is managable in all but one circumstance.
If the orginal value in the editor is empty, the cursor always falls before the ending comment tag of the prepended tags, so nothing can get entered.
...<body><!--BODYPREPENDBEGIN--><div id="myWrapper"><div class="myContent">
[THE CURSOR ALWAYS INPUTS HERE]
Does anyone have any ideas as to how I might be able to force the cursor to always be between <!--BODYPREPENDEND--> and <!--BODYAPPENDBEGIN--> using a configuration value like protectedSource, or an expansion of the proposed patch code that would solve this?
I was wonding, for example, if it is possible to force the cursor/insert point to always be between xx characters from start of editable space and yy characters from the ned of the editable space so I could use string length of the prepend and append values to draw the boundaries, OR
If I could force it to stay between <!--BODYPREPENDEND--> and <!--BODYAPPENDBEGIN-->, BUT
I have not figured out how I could do either of these things.
Any ideas would be appreciated.