views:

249

answers:

1

I have ckeditor embedded into one of my pages....but I don't know how to wire up certain buttons in ckeditor to perform specific actions. Most importantly, how do I tell it when the save button is clicked to save the document?

+2  A: 

Dave--

The beauty of the save button in CKEditor is that it is setup default to submit the form that it's in. In my company's case, I bolted in CKEditor expecting to have to disable the save button because the larger form already had a save button...but it turns out that it worked right out of the box. Get the system installed, tested, and hit save...see what happens.

You can control the output of buttons in the Config.js file. If a particular button is not to your liking, you can use javascript to define actions or create new buttons there as well. There are fairly good tutorials on this at http://docs.cksource.com/

bpeterson76
But when you use the save button that uses ajax and isn't there not a postback?
davemackey
CKEditor isn't using ajax in the basic examples for submit....it's just using Javascript to post a form on your page. For it to be AJAXed (asynchronously posted to a submit function) you'd have to incorporate some other sort of "helper" such as Jquery or XAJAX to make that happen.There is a method to load data IN to CK via ajax here: http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.ajax.html Though I see no reference to it supporting posting data via AJAX in documentation.Also, there's a brief mention of a patch to support AJAX here: http://dev.fckeditor.net/ticket/4507
bpeterson76
Given that CKEditor has a solid API and customization features, you can control it in almost any way you like. You can load whatever html you want into the editor, hide the save button, or even just read the code because it is open source. Is there some specific scenario you are trying to solve?
Robert Diana