Deka87 Deka87 - 1 year ago 125
Javascript Question

TinyMCE Inline mode: Get content of edited area on editor closing

I use TinyMCE plugin with inline mode on. What I want to do is get the content of the area that's been edited after the editor has been closed. This is what I have for now:

selector: '.editable',
plugins: "link",
inline: true,
init_instance_callback: function (editor) {
editor.on('GetContent', function (e) {

However, this on doesn't log anything. Any ideas?

Answer Source

Each time you leave the editor it fires the blur event ( ... and you can capture this in your TinyMCE configuration:

    selector: '#my_div",
    setup: function (editor) {
        editor.on('blur', function (e) {
          console.log('Editor was blurred!');
          // Do what you want when the editor is blurred here
          console.log(editor.getContent());  //get the content from the editor
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download