Days
Hours
Minutes
Seconds
x

New Froala Editor v5.0.0 is here โ€“ Learn More

Skip to content
Froala Documentation

Migrate from TinyMCE

Events

This guide provides a side by side comparison of using the Froala Editor events next to TinyMCE ones. For a full list of events, please check the Events documentation.


1. Click event

This section compares the click event inside the editable area.

TinyMCE Code Example

tinymce.init({
  selector: 'textarea',
  init_instance_callback: function (editor) {
    editor.on('click', function (e) {
      console.log('Element clicked:', e.target.nodeName);
    });
  }
});

Froala Code Example

new FroalaEditor('textarea', {
  events: {
    click: function (e) {
      console.log('Element clicked:', e.target.nodeName);
    }
  }
});

2. Intercepting a button click

This section shows how to intercept the format change of a paragraph.

TinyMCE Code Example

tinymce.init({
  selector: 'textarea',
  init_instance_callback: function (editor) {
    editor.on('ExecCommand', function (e) {
      if (e.command === 'mceToggleFormat' && e.value === 'H1') {
        console.log('mceToggleFormat was executed')
      }
    });
  }
});

Froala Code Example

new FroalaEditor('textarea', {
  events: {
    'commands.after', function (cmd, param1, param2) {
      if (cmd === 'paragraphFormat' && param1 === 'H1') {
        console.log('paragraphFormat was executed');
      }
    }
  }
});

Do you think we can improve this article? Let us know.

Ready to dive in? Explore our plans

Sign up

Download the code by signing up for our newsletter

Sign up

Download the code by signing up for our newsletter

Note: By registering, you confirm that you agree to the processing of your personal data by Froala, Inc. - Froala as described in the Privacy Statement. Froala, Inc. - Froala is part of the Idera group and may share your information with its parent company Idera, Inc., and its affiliates. For further details on how your data is used, stored, and shared, please review our Privacy Statement.