mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-02 04:53:41 +00:00
fix: update code mirror dark mode detection to use VueUse's useColorMode
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user