diff --git a/src/editor/CodeMirrorEditor.vue b/src/editor/CodeMirrorEditor.vue index b9caccbc..ba7adfce 100644 --- a/src/editor/CodeMirrorEditor.vue +++ b/src/editor/CodeMirrorEditor.vue @@ -16,6 +16,10 @@ const onChange = (code: string, fileName?: string, save?: boolean) => { const modes: Record = { css: 'css', + sass: 'sass', + scss: 'css', + less: 'css', + md: 'gfm', html: 'htmlmixed', js: { name: 'javascript', diff --git a/src/editor/MonacoEditor.vue b/src/editor/MonacoEditor.vue index fd1b132d..48a56988 100644 --- a/src/editor/MonacoEditor.vue +++ b/src/editor/MonacoEditor.vue @@ -1,8 +1,9 @@ diff --git a/src/monaco/Monaco.vue b/src/monaco/Monaco.vue index 4d3499ce..a8dfdb23 100644 --- a/src/monaco/Monaco.vue +++ b/src/monaco/Monaco.vue @@ -16,16 +16,9 @@ import { getOrCreateModel } from './utils' import { loadGrammars, loadTheme } from 'monaco-volar' import { debounce } from '../utils' import type { Store } from '../store' -import type { EditorEmits, PreviewMode } from '../editor/types' +import type { EditorProps, EditorEmits } from '../editor/types' -export interface Props { - filename: string - value?: string - readonly?: boolean - mode?: PreviewMode -} - -const props = withDefaults(defineProps(), { +const props = withDefaults(defineProps(), { readonly: false, }) diff --git a/src/store.ts b/src/store.ts index 13aece03..cd948266 100644 --- a/src/store.ts +++ b/src/store.ts @@ -58,7 +58,12 @@ export class File { if (this.filename.endsWith('.html')) { return 'html' } - if (this.filename.endsWith('.css')) { + if ( + this.filename.endsWith('.css') || + this.filename.endsWith('.sass') || + this.filename.endsWith('.scss') || + this.filename.endsWith('.less') + ) { return 'css' } if (this.filename.endsWith('.ts')) { @@ -67,9 +72,6 @@ export class File { if (this.filename.endsWith('.md')) { return 'markdown' } - if (this.filename.endsWith('.sass') || this.filename.endsWith('.scss')) { - return 'scss' - } return 'javascript' } }