Ledzz / angular2-tinymce

Angular 2 component for TinyMCE MCE WYSIWYG editor
https://angular2-tinymce.surge.sh
66 stars 37 forks source link

Fixed issued when reinitialling component. #20

Closed smkamranqadri closed 7 years ago

smkamranqadri commented 7 years ago

Below is the error show up and stopped working when we revisit the page where component is initialized.

If it's correct then please merge the pull request. Thanks.

Error from console.

EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'length' of null TypeError: Cannot read property 'length' of null at o.setContent (http://localhost:9500/app.bundle.js:110874:16531) at TinymceComponent.writeValue (http://localhost:9500/app.bundle.js:110802:41) at setUpControl (http://localhost:9500/app.bundle.js:102560:28) at http://localhost:9500/app.bundle.js:104754:18 at ZoneDelegate.invoke (http://localhost:9500/app.bundle.js:16484:27) at Object.onInvoke (http://localhost:9500/app.bundle.js:74973:42) at ZoneDelegate.invoke (http://localhost:9500/app.bundle.js:16483:33) at Zone.run (http://localhost:9500/app.bundle.js:16355:44) at http://localhost:9500/app.bundle.js:16762:58 at ZoneDelegate.invokeTask (http://localhost:9500/app.bundle.js:16517:36) at Object.onInvokeTask (http://localhost:9500/app.bundle.js:74964:42) at ZoneDelegate.invokeTask (http://localhost:9500/app.bundle.js:16516:41) at Zone.runTask (http://localhost:9500/app.bundle.js:16393:48) at drainMicroTaskQueue (http://localhost:9500/app.bundle.js:16660:36) at HTMLAnchorElement.ZoneTask.invoke (http://localhost:9500/app.bundle.js:16591:26)

Ledzz commented 7 years ago

Removing tinymce with tinymce.remove(); would break multiple tinymce editors on one page. I will merge it and solve this issue later when I will have free time. Anyway, thank you for collaborating!

smkamranqadri commented 7 years ago

thanks for the response.

I have tried with tinymce.remove(this.editor) but it didn't worked.