1

my question is. That i use a class "light-mode" and wan't to change the tinymce to light mode when i use the class.

I tryed this:

skin: (document.body.classList.contains('light-mode') ? "oxide-light" : "oxide-dark"), content_css: (document.body.classList.contains('light-mode') ? "light" : "dark"),

But might not work, it breaks tinymce. Is there any solution for this?

skin: (document.body.classList.contains('light-mode') ? "oxide-light" : "oxide-dark"), content_css: (document.body.classList.contains('light-mode') ? "light" : "dark"),

1 Answers1

1

Try This:

tinymce.init({
  selector: "#post-editor",
  skin: localStorage.getItem("darkMode") === "on" ? "oxide-dark" : "snow",
  content_css: localStorage.getItem("darkMode") === "on" ? "dark" : "default",
});

more themes can be found on (TinyMCE 6): Content CSS | Skins