6
6
import type { ModeSpec , ModeSpecOptions } from ' codemirror'
7
7
import { ref , onMounted , watchEffect , inject } from ' vue'
8
8
import prettier from ' prettier/standalone'
9
- import parserBabel from ' prettier/parser- babel'
10
- import parserHtml from ' prettier/parser- html'
11
- import parserPostcss from ' prettier/parser- postcss'
9
+ import parserBabel from ' prettier/plugins/ babel'
10
+ import parserHtml from ' prettier/plugins/ html'
11
+ import parserPostcss from ' prettier/plugins/ postcss'
12
12
import { debounce } from ' ../utils'
13
13
import CodeMirror from ' ./codemirror'
14
14
@@ -65,7 +65,7 @@ onMounted(() => {
65
65
emit (' change' , editor .getValue ())
66
66
})
67
67
68
- editor .on (' blur' , () => {
68
+ editor .on (' blur' , async () => {
69
69
const parser = props .extension === ' vue' ? ' html'
70
70
: props .extension === ' html' ? ' html'
71
71
: props .extension === ' css' ? ' css'
@@ -83,7 +83,7 @@ onMounted(() => {
83
83
84
84
let code = editor .getValue ()
85
85
try {
86
- code = prettier .format (code , options )
86
+ code = await prettier .format (code , options )
87
87
} catch (err ) {}
88
88
89
89
emit (' change' , code )
0 commit comments