dangvanthanh / vue-ckeditor2

CKEditor 4 wrapper by Vue.js
https://vue-ckeditor2.surge.sh/
MIT License
171 stars 64 forks source link

CkEditor on SPA, before destroy crash #43

Closed nWidart closed 6 years ago

nWidart commented 7 years ago

Hello,

I'm setting up a SPA, with on the form component ckeditor. When leaving that component and loading in another one, the following error occurs:

app.js:1089 [Vue warn]: Error in beforeDestroy hook: "TypeError: Cannot read property 'clearCustomData' of null"

I've pinned it down to the following line:

this.instance.destroy()

Any idea how this could be fixed?

Thanks

nWidart commented 7 years ago

Current fix is to wrap a try/catch like so:

try {
    this.instance.destroy()
} catch (e) { }

Explained here: https://stackoverflow.com/questions/25034150/ck-editor-uncaught-typeerror-cannot-read-property-clearcustomdata-of-null-i

dangvanthanh commented 7 years ago

Hi @nWidart Thank you very much. I will update for vue-ckeditor component.

nWidart commented 7 years ago

Awesome. Do you happen to know I had to do this? It seems strange to me. It looks like the instance was already destroyed somehow.

dangvanthanh commented 6 years ago

I think error is resolve in #49