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-->
[CONTENT HERE]
<!--BODYAPPENDBEGIN--></div></div><!--BODYAPPENDEND--></body>
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]
<!--BODYPREPENDEND-->
<!--BODYAPPENDBEGIN--></div></div><!--BODYAPPENDEND--></body>
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.
I am testing and so far find
I am testing and so far find that that this code works better for the prepend/append. It does not prevent the user from getting outside of the prepend/append code, but it solves the problem of an empty editor noted above and works with the template patch.
and
I would still love some help if anyone can propose a way to force the cursor/input point between the prepend/append tags.