TinyMCE:API/tinymce.Editor/onChange

From Moxiecode Documentation Wiki

Jump to: navigation, search

Contents

Event: onChange

Summary

This event gets executed when contents inside the editor gets changed for example after bold command or when the user enters some text into the editor.

Syntax

event_callback(<tinymce.Editor> ed, <Object> l, <tinymce.UndoManager> um)

Parameters

ed
Sender object/Editor instance that is serializing an element.
l
Undo level that got added.
um
Undo manager that the level was added to.

Examples

// Adds an observer to the onChange event using tinyMCE.init
tinyMCE.init({
   ...
   setup : function(ed) {
      ed.onChange.add(function(ed, l) {
          console.debug('Editor contents was modified. Contents: ' + l.content);
      });
   }
});

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

ed.onChange.add(function(ed, l) {
   console.debug('Editor contents was modified. Contents: ' + l.content);
});

ed.render();
Personal tools