Days
Hours
Minutes
Seconds
x

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

Skip to content

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 page from the docs.


1. Click event

When customizing a WYSIWYG HTML Editor, one of the most common used events is 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

$('textarea').on('froalaEditor.click', function (e, editor, clickEvent) {
  console.log('Element clicked:', e.target.nodeName);
})
.froalaEditor();

2. Intercepting a button click

The next example highlights 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

$('textarea').on('froalaEditor.commands.after', function (e, editor, cmd, param1, param2) {
  if (cmd === 'paragraphFormat' && param1 === 'H1') {
    console.log('paragraphFormat was executed');
  }
})
.froalaEditor();
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.