tinymce-angular
tinymce-angular copied to clipboard
How to trigger editor reload with new config
Is your feature request related to a problem? Please describe. Language / Localization change on the fly
Describe the solution you'd like A clear way to reload / re-init editor with new config
Describe alternatives you've considered Custom wrapper component that is destroyed and reloaded , but has no effect on editor instance
Ref: INT-2611
I can't believe how many hours I've wasted on this issue to no avail. I couldn't find anything useful on the web, how do we refresh or reinitialize an editor instance in Angular?
I'm trying to implement a color mode switcher with Bootstrap 5.3.0 and when the color mode changes (light/dark) I need to destroy the editor and reinitialize with different options to use the dark theme.
Ideally, I should be able to refresh the editor skin and content_css without destroying and reinitializing. Failing that, I can get the content, destroy the editor, reinitialize, and set the content.
For some reason I can't use an id on the editor component, I get a warning from TinyMCE about multiple instances being mounted.
Does anyone have any clue as to how to achieve this? This has been a blocking issue for us.
You could try something like this: https://codesandbox.io/p/devbox/int-2611-c35xlx
Using a *ngIf
directive would achieve the same thing if you're not using Angular 17.
This completely removes and re-initialises tinymce on each reload, allowing you to change the initial editor state and config inbetween reloads.
Let us know if that helps.
I'm closing this for now as it's become stale. Feel free to reopen a new issue if needed.