View
 

Saving via AJAX

Page history last edited by diogo 15 years, 10 months ago

NicEdit supports having a save button the toolbar that users can click to save content.

To use this mode you should have some understanding of javascript and follow these steps:

 

  • First make sure you have configured your download with the nicSave plugin
  • Use the onSave option when you declare you nicEditor instance, for example:

 

  1. bkLib.onDomLoaded(function(){
  2.   new nicEditor({fullPanel : true, onSave : function(content, id, instance) {
  3.     alert('save button clicked for element '+id+' = '+content);
  4.   } }).panelInstance('myArea2');
  5. });

 

  • Because we have set the onSave option to our callback function, and included the 'save' button the save icon will appear on our toolbar
  • When clicking the button, the onSave callback will run with 3 parameters
    • The first parameter is the content of the nicEditor instance
    • Second parameter is the ID of the element converted to a nicEditor
    • Third parameter is a reference to the nicInstance (see Javascript API for more info on that)

 

Comments (0)

You don't have permission to comment on this page.