From f1a34b7d1fee89613113e034e261c4b2c32158e5 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Thu, 12 Nov 2020 14:18:19 -0600 Subject: [PATCH] Markdown editor respects dark mode --- src/app/components/nodes/markdown/markdown.component.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/app/components/nodes/markdown/markdown.component.ts b/src/app/components/nodes/markdown/markdown.component.ts index 4511bdf..6019ed2 100644 --- a/src/app/components/nodes/markdown/markdown.component.ts +++ b/src/app/components/nodes/markdown/markdown.component.ts @@ -22,6 +22,7 @@ export class MarkdownComponent extends EditorNodeContract implements OnInit { protected hadOneFocusOut = false; public editorOptions = { + theme: this.isDark() ? 'vs-dark' : 'vs', language: 'markdown', uri: v4(), readOnly: false, @@ -37,6 +38,10 @@ export class MarkdownComponent extends EditorNodeContract implements OnInit { this.savedValue = this.initialValue; } + public isDark() { + return document.body.classList.contains('dark'); + } + ngOnInit() { this.editorService = this.editorService.getEditor(this.editorUUID); this.editorService.registerNodeEditor(this.nodeId, this).then(() => {