Search code examples
javascriptjquerywysiwygfroala

Cursor is always placed before the paper clip icon when file is inserted in Froala editors


Step to reproduce::

  1. Open Froala link

  2. Clear editors.

  3. Click on the file icon and select file.

  4. Issue:: Cursor is always placed before the paper clip icon.

Acceptance Criteria:: Cursor is placed after a paper clip icon when a file is attached to editors.

Video::

enter image description here


Solution

  • This problem has occurred in some browsers. I have applied one trick to solve the problem.

    Triggered before uploading a file to the server.

    $('.selector').on('froalaEditor.file.beforeUpload', function (e, editor, files) {
      // Code....
    });
    

    Triggered after the request to upload a file has been completed successfully.

    $('.selector').on('froalaEditor.file.inserted', function (e, editor, $file, response) {
      editor.html.insert(" "); //add extra space after successfully file uploaded.
    });