CKEditor issue and TInyMCE
Posted on 2010-04-02
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,
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.