tinymce-angular icon indicating copy to clipboard operation
tinymce-angular copied to clipboard

How to trigger editor reload with new config

Open mirzinho opened this issue 3 years ago • 1 comments

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

mirzinho avatar Jul 13 '21 08:07 mirzinho

Ref: INT-2611

exalate-issue-sync[bot] avatar Jul 13 '21 08:07 exalate-issue-sync[bot]

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.

inexuscore avatar Jun 22 '23 23:06 inexuscore

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.

danoaky-tiny avatar Jan 10 '24 19:01 danoaky-tiny

I'm closing this for now as it's become stale. Feel free to reopen a new issue if needed.

danoaky-tiny avatar Feb 28 '24 19:02 danoaky-tiny