chore(sources): indent size 2

This commit is contained in:
surunzi
2020-01-01 18:04:18 +08:00
parent 07e7bfd86a
commit 7637f0b778
2 changed files with 5 additions and 5 deletions

View File

@@ -410,7 +410,7 @@ function formatErr(err) {
function formatJs(code) {
const curTheme = evalCss.getCurTheme()
return highlight(beautify(code), 'js', {
return highlight(beautify(code, { indent_size: 2 }), 'js', {
keyword: `color:${curTheme.keywordColor}`,
number: `color:${curTheme.numberColor}`,
operator: `color:${curTheme.operatorColor}`,
@@ -542,7 +542,7 @@ function formatFn(val) {
function formatEl(val) {
return `<pre style="display:inline">${highlight(
beautify.html(val.outerHTML, { unformatted: [] }),
beautify.html(val.outerHTML, { unformatted: [], indent_size: 2 }),
'html'
)}</pre>`
}

View File

@@ -185,13 +185,13 @@ export default class Sources extends Tool {
if (len < MAX_BEAUTIFY_LEN && this._formatCode) {
switch (data.type) {
case 'html':
code = beautify.html(code, { unformatted: [] })
code = beautify.html(code, { unformatted: [], indent_size: 2 })
break
case 'css':
code = beautify.css(code)
code = beautify.css(code, { indent_size: 2 })
break
case 'js':
code = beautify(code)
code = beautify(code, { indent_size: 2 })
break
}