diff options
| author | erdgeist <erdgeist@erdgeist.org> | 2026-08-03 02:04:42 +0200 |
|---|---|---|
| committer | erdgeist <erdgeist@erdgeist.org> | 2026-08-03 02:04:42 +0200 |
| commit | c140ec667ffaadf32753d11dc18eb942862ebcba (patch) | |
| tree | 2e09d7f5956a84b24656d815408e18adf15780da | |
| parent | 5a92cdea355b57443f33eee281238451d83df1cd (diff) | |
Make tinymce use the admin chromes' light/dark scheme
| -rw-r--r-- | public/javascripts/admin_interface.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/public/javascripts/admin_interface.js b/public/javascripts/admin_interface.js index ddea0925..384f48c6 100644 --- a/public/javascripts/admin_interface.js +++ b/public/javascripts/admin_interface.js | |||
| @@ -1,8 +1,17 @@ | |||
| 1 | $(document).ready(function () { | 1 | $(document).ready(function () { |
| 2 | admin_search.initialize(); | 2 | admin_search.initialize(); |
| 3 | 3 | ||
| 4 | function effective_scheme() { | ||
| 5 | var declared = getComputedStyle(document.documentElement).colorScheme; | ||
| 6 | if (declared === "dark") { return "dark"; } | ||
| 7 | if (declared === "light") { return "light"; } | ||
| 8 | return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"; | ||
| 9 | } | ||
| 10 | var dark_editor = effective_scheme() === "dark"; | ||
| 4 | tinymce.init({ | 11 | tinymce.init({ |
| 5 | selector: 'textarea.with_editor', | 12 | selector: 'textarea.with_editor', |
| 13 | skin: dark_editor ? 'oxide-dark' : 'oxide', | ||
| 14 | content_css: dark_editor ? 'dark' : 'default', | ||
| 6 | license_key: 'gpl', | 15 | license_key: 'gpl', |
| 7 | promotion: false, | 16 | promotion: false, |
| 8 | menubar: false, | 17 | menubar: false, |
