Wysiwyg-editor: Uncaught TypeError: Cannot read property 'find' of null

Created on 30 Aug 2016  路  6Comments  路  Source: froala/wysiwyg-editor

I'm sorry I don't have a clear reproduction technique yet, however... I've seen this a few times sporadically now.

I believe the error occurs when the Froala editor is supposed to already be cleaned up, and then later I do a window resize.

I'm on master (b14d290d8b1b9ed1e4bcaf56326fc201f7da9d41)

Uncaught TypeError: Cannot read property 'find' of null

screenshot 2016-08-30 11 21 49
screenshot 2016-08-30 11 21 22

Any ideas?

bug

All 6 comments

Do you have any editor instance that was not destroyed, but it was removed from the DOM?

I kind of solved this issue for me (I use the angular-froala port)
The problem there is, that when the controller $destroy event is emitted, the DOM has already changed. That's why my froalaEditor('destroy') call does not work

my solution is simply to add an event listener for the $stateChangeStart event and manually destroy the editor there - in that way, the destroy event is sometimes called twice but IMO that's better than a memory leak

This still occurs for me.

The scenario is the following:
I got an open editor on a page, open a popup where another editor is present.
If I now close the popup and resize my browser window, I get this error Uncaught TypeError: Cannot read property 'find' of null

@cfey would it be possible to make a jsFiddle? Thanks.

I couldn't reproduce it there :/
Anyway I monkey patched it
I added to the line t.$tb.html("").removeData().remove(), t.$tb = null the command e(t.o_win).unbind("resize", i)
Somehow the resize listener gets called even after this line t.$tb.html("").removeData().remove(), t.$tb = null was executed

strange...

Do you have any editor instance that was not destroyed, but it was removed from the DOM?

Great question. It turns out I had this window resize error in my app in multiple places. The first case seems to have been me not properly cleaning up the editor.

However the second case seems like an issue with Froala when I have two instances and clean one up. Here's how to reproduce:

  1. Load http://jsfiddle.net/74t89g2y/
  2. Open console
  3. Trigger window resize.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bbugh picture bbugh  路  3Comments

adilsonb picture adilsonb  路  3Comments

jmsche picture jmsche  路  3Comments

cristianst picture cristianst  路  4Comments

Nucs picture Nucs  路  4Comments