fix: update code mirror dark mode detection to use VueUse's useColorMode

This commit is contained in:
Abhinav Raut
2025-07-06 21:10:09 +05:30
parent d9b5fb8f0f
commit 6d62c3a4ba

View File

@@ -7,6 +7,7 @@ import { ref, onMounted, watch, nextTick, useTemplateRef } from 'vue'
import { EditorView, basicSetup } from 'codemirror'
import { html } from '@codemirror/lang-html'
import { oneDark } from '@codemirror/theme-one-dark'
import { useColorMode } from '@vueuse/core'
const props = defineProps({
modelValue: { type: String, default: '' },
@@ -20,7 +21,7 @@ let editorView = null
const codeEditor = useTemplateRef('codeEditor')
const initCodeEditor = (body) => {
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches
const isDark = useColorMode().value === 'dark'
editorView = new EditorView({
doc: body,