Search code examples
javascriptwysiwygaddeventlisteneronfocusfroala

How I catch froala editor on focus event?


I must wirte a eventListener function for froala editor on focus event. But I couldn't found any event callback on documentation and couldn't found any input element this editor's structure.

This is focused froalaeditor structure snapshot.

Focused Frolaeditor structure

What is the way to do it


Solution

  • According to the Official documentation, you write this:

    $(".selector").on('editable.focus', function (e, editor) {
      // editor focused
    });
    

    And blur:

    $(".selector").on('editable.blur', function (e, editor) {
      // editor blurred
    });
    

    And to detach the focus event:

    $(".selector").off('editable.focus');
    
    $(".selector").off('editable.blur');