CKEditor issue and TInyMCE

I have been playing around with using a WYSIWYG editor on some PHP pages.  I tried TinyMCE and CKEditor.  They are both pretty nice for open source, although I think I like the CKEditor better.  Problem is, the documentation isn't the bast, atlhough if you dig around a little there does seem to be some.

The problem that I've had with both is that it looks like the editors are changing the contents of the textarea after the page has loaded in a manner that I want to prevent.  Namely, it looks like it is putting paragraph tags before my existing content like this:
Original content, in database:

<p>test</p>, which should be what is rendered on the page.

But after the page has loaded and all scripts/jsscripts have run the textarea is like this,


with the extra paragraph container and spaces at the time and some extra spaces added after my original opening paragraph tag.  This is reproducible and it seems that the CKEditor javascript must be modifying the contents that is rendered from the server.  I would prefer that the contents of the textarea be precisely what I have stored in the database server rather than being modified with the extra <p> tags.

I have the content data stored in a MySQL database and the contents gets written out to the text area when the server renders the PHP page.  I have a save button that saves the form that the textarea is in via an AJAX call that updates the database.  This is working fine.  I am using jquery with the page for some other things and I guess CKEditor supports jquery with an extension.  The calls for getting the content are like:


This is also working.

This is really annoying.  I've seen some other posts elsewhere about this issue in both TinyMCE and CKEditor.  I just thought there might be a configuration parameter that could prevent this.

I guess there is a commercial product as well, e.g. Cute Editor for PHP.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sscottiAuthor Commented:
As a follow up to this question, I am looking for a way to add a custom button to the editor toolbar that will close the editor window.
sscottiAuthor Commented:
Was looking for one last thing related to this.  There is normally or can be a save button in the CKEditor editor toolbar.  Normally, this just submits the form via a post.  I actually want to submit the form via ajax.  This works fine when I use an onsubmit handler in the form, but for some reason, it doesn't capture the event from the save button in the editor window.  I want to intercept the save button event from the editor window so that I can use the AJAX call rather than just submitting the form via a post.
Steve BinkCommented:
The problem you are describing annoys me to my last hair, but the people over at CK are just too lazy to bother with fixing it.  Their forums lit up with this problem when it was first discovered, and their response was pretty much "white-space is ignored by standard, deal with it".  Never mind the idea that their editor is no longer faithfully reproducing the user input.  

More info, and the official recommended work-around:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.