TinyMCE:API/tinymce.Editor/onSaveContent

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Event: onSaveContent

Summary

This event gets executed when the save method is called. The event is sent after getContent is called and is the last step before the contents of the editor are saved back to the textarea/div element.

Syntax

event_callback(<tinymce.Editor> ed, <Object> o)

Parameters

ed
Sender object/Editor instance that is serializing an element.
o
Object containing things like the element that contents was saved to. The contents themselves are a string available via the 'content' property: o.content

Examples

// Adds an observer to the onSaveContent event using tinyMCE.init
tinyMCE.init({
   ...
   setup : function(ed) {
      ed.onSaveContent.add(function(ed, o) {
          // Output the element name
          console.debug(o.element.nodeName);
      });
   }
});

// Adds an observer to the onSaveContent event using the render method
var ed = new tinymce.Editor('someid', {
   .. Some settings
});

ed.onSaveContent.add(function(ed, o) {
   // Output the element name
   console.debug(o.element.nodeName);
});

ed.render();
Personal tools