froala / vue-froala-wysiwyg

Vue component for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
633 stars 86 forks source link

Froala V3 - TypeError: self._editor is null #87

Open imuller opened 5 years ago

imuller commented 5 years ago

When initializing a second editor after one is has dissapeared. For example when i create an editor and the container has v-if on it, the console shows an error and wont update the data object in Vue anymore.

TypeError: self._editor is null

Error occures on this line: self._editor.html.set(self.model || ''); //This will reset the undo stack everytime the model changes externally. Can we fix this?

nikpok commented 5 years ago

can you share an example code on JSfiddle @imuller ?

pochocho commented 5 years ago

@nikpok Im experiencing the same issue

here is a link where you can replicate the issue: on that link open the browser console and click on the checkbox to toggle the visibility of the froala editor, when you click the checkbox again, you will get the error on the console. Here is an image of the error in the console: image

Some things I noticed, the problem seems to disappear if the config prop is specified with a plain json object on the tag directly. If you use a config from the data of the component is where it breaks.

You can also test this on the code I provided by commenting the first froala instance (line 8) and uncommenting the one bellow (line 11).

I did some digging on the source code and the issue seems to have something to do with the listener for the initialized event where in some instances, the _editor is not defined by the time it occurs.

pochocho commented 5 years ago

@nikpok just noticed the link was missing, here it is again https://codesandbox.io/s/vue-template-m7ssk

imuller commented 5 years ago

It's when i show the froala editor with an v-if

gabaum10 commented 5 years ago

Can we get this merged in? This is a slightly annoying error.

playerrtwo commented 4 years ago

I'm also experiencing this problem. Need a fix please.

rcheung9 commented 4 years ago

Still broken.