]> BookStack Code Mirror - bookstack/blobdiff - resources/js/components/markdown-editor.js
Added tests and translations for dark-mode components
[bookstack] / resources / js / components / markdown-editor.js
index f88cb765104d617095bdf0fd95f9d9a24a24cc78..4dc240d485429ceaf662bdfea3ab95ff96a9de81 100644 (file)
@@ -127,7 +127,13 @@ class MarkdownEditor {
 
     loadStylesIntoDisplay() {
         if (this.displayStylesLoaded) return;
-        this.displayDoc.documentElement.className = 'markdown-editor-display';
+        this.displayDoc.documentElement.classList.add('markdown-editor-display');
+        // Set display to be dark mode if parent is
+
+        if (document.documentElement.classList.contains('dark-mode')) {
+            this.displayDoc.documentElement.style.backgroundColor = '#222';
+            this.displayDoc.documentElement.classList.add('dark-mode');
+        }
 
         this.displayDoc.head.innerHTML = '';
         const styles = document.head.querySelectorAll('style,link[rel=stylesheet]');