Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE - toggle dark-theme after init

after the tinymce.init() i can toggle the readOnly setting like this:

editor.mode.set("design");
editor.mode.set("readonly");

but how can i toggle the dark theme for the editor and the content?

this will not work:

  editor.mode.set.content_css("dark");
  editor.mode.set.skin("dark-oxide");
like image 968
kolja Avatar asked Sep 12 '25 21:09

kolja


1 Answers

No, it is not possible. All the settings defined in the tinymce.init() function cannot be changed without reinitialization. However, reinitialization can be done very fast. You will need to perform 4 steps:

  1. Save current content somewhere with getContent()
  2. Destroy the TinyMCE instance with destroy()
  3. Reinitialize
  4. Use setContent() to add the content saved on step 1.
like image 131
Dmitry D Avatar answered Sep 17 '25 19:09

Dmitry D