File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export interface Props {
15
15
mode? : string
16
16
value? : string
17
17
readonly? : boolean
18
+ extension? : string
18
19
}
19
20
20
21
const props = withDefaults (defineProps <Props >(), {
@@ -68,7 +69,7 @@ onMounted(() => {
68
69
: props .mode === ' htmlmixed' ? ' html'
69
70
: props .mode === ' javascript' ? ' babel'
70
71
: props .mode === ' css' ? ' postcss'
71
- : props .mode
72
+ : props .extension || props . mode
72
73
emit (' change' , prettier .format (
73
74
editor .getValue (),
74
75
{
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ const activeMode = computed(() => {
19
19
: filename .endsWith (' .css' ) ? ' css'
20
20
: ' javascript'
21
21
})
22
+
23
+ const extension = computed (() => {
24
+ const { filename } = store .state .activeFile
25
+ return filename .split (' .' ).pop ()
26
+ })
22
27
</script >
23
28
24
29
<template >
@@ -28,6 +33,7 @@ const activeMode = computed(() => {
28
33
@change =" onChange"
29
34
:value =" store.state.activeFile.code"
30
35
:mode =" activeMode"
36
+ :extension =" extension"
31
37
/>
32
38
<Message :err =" store.state.errors[0]" />
33
39
</div >
You can’t perform that action at this time.
0 commit comments