TinyMCE:API/tinymce.Editor/onGetContent
From Moxiecode Documentation Wiki
Contents |
[edit]
Event: onGetContent
[edit]
Summary
This event gets executed when the getContent method is called and after the content has been serialized. This enables you to change the content before it gets returned similar to the onPostProcess event but this only occurs when getContent gets called.
[edit]
Syntax
event_callback(<tinymce.Editor> ed, <Object> o)
[edit]
Parameters
- ed
- Sender object/Editor instance that is serializing an element.
- o
- Object containing things like the format.
[edit]
Examples
// Adds an observer to the onGetContent event using tinyMCE.init
tinyMCE.init({
...
setup : function(ed) {
ed.onGetContent.add(function(ed, o) {
// Replace all a characters with b
o.content = o.content.replace(/a/g, 'b');
});
}
});
// Adds an observer to the onGetContent event using the render method
var ed = new tinymce.Editor('someid', {
.. Some settings
});
ed.onGetContent.add(function(ed, o) {
// Replace all a characters with b
o.content = o.content.replace(/a/g, 'b');
});
ed.render();
