monad98 / ng2-lazy-trumbowyg

Angular 2 Component for lazy loading of Trumbowyg wysiwyg editor
https://plnkr.co/edit/dirpKmLNalUmz0mpdrk7?p=preview
MIT License
12 stars 8 forks source link

initialContent does not display on rerendering component with Trumbowyg #12

Closed ferdinandvi closed 6 years ago

ferdinandvi commented 7 years ago

I'm using ng2-lazy-trumbowyg on a component which is inside an accordion. The page is loaded for the first time and when I click to open the accordion trumbowyg's initialContent is displayed as intended. Then when I close the accordion the component is destroyed, when I reopen the accordion after that the component loads as intended, but the initialContent is is never displayed.

The only solution I've been able to come up with is to use window.location.reload() on ngOnDestroy() of the component on which trumbowyg is usedbut this is obviously not ideal.

Any help or advice is appreciated.

monad98 commented 7 years ago

Can I see the live example? don't have much time to do it by myself. Thank you.

SirWojtek commented 6 years ago

The problem also occurs for me. I've used trumbowyg inside modal and after first pop-up initial value was correctly displayed but after close and re-open a modal with new content it doesn't appear in trumbowyg.

My findings:

ferdinandvi commented 6 years ago

Thanks @SirWojtek for feedback. @monad98 Sorry, I've just not had time to look at this again yet, but I'll post a live example as soon as I'm able.

monad98 commented 6 years ago

is it fixed now? I don't have time to test.

ferdinandvi commented 6 years ago

After updating to version 2.4.1 I get this: ERROR TypeError: Cannot read property 'version' of null in the Trumbowyg service on line 27: this.TRUMBOWYG_PREFIX_URL = "https://cdnjs.cloudflare.com/ajax/libs/Trumbowyg/" + (config.version || '2.8.0'); Not sure if this is helpful at all, maybe I did something wrong when updating?

SirWojtek commented 6 years ago

Please paste the file in which you include TrumbowygModule. In the new version, you should import TrumbowygModule in your root component:


class AppModule {
...
  imports: [
    TrumbowygModule.forRoot(),
  ]
...
}
ferdinandvi commented 6 years ago

Ah thanks @SirWojtek I somehow missed that... @monad98 In my testing this works in ng2-lazy-trumbowyg version 2.4.1 so you can close this. Thanks for your patience and quick responses.

monad98 commented 6 years ago

@synetax For the error, it's a bug. Using 'forRoot()' is optional. I will fix it tonight.

ferdinandvi commented 6 years ago

@monad98 Thanks