Skip to content

Commit 3a7a5f8

Browse files
committed
chore(prettier): use async formatting in codemirror
1 parent d9a70e0 commit 3a7a5f8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/codemirror/CodeMirror.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
import type { ModeSpec, ModeSpecOptions } from 'codemirror'
77
import { ref, onMounted, watchEffect, inject } from 'vue'
88
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'
1212
import { debounce } from '../utils'
1313
import CodeMirror from './codemirror'
1414
@@ -65,7 +65,7 @@ onMounted(() => {
6565
emit('change', editor.getValue())
6666
})
6767
68-
editor.on('blur', () => {
68+
editor.on('blur', async () => {
6969
const parser = props.extension === 'vue' ? 'html'
7070
: props.extension === 'html' ? 'html'
7171
: props.extension === 'css' ? 'css'
@@ -83,7 +83,7 @@ onMounted(() => {
8383
8484
let code = editor.getValue()
8585
try {
86-
code = prettier.format(code, options)
86+
code = await prettier.format(code, options)
8787
} catch (err) {}
8888
8989
emit('change', code)

0 commit comments

Comments
 (0)