feat: add format action to code composable

This commit is contained in:
2026-06-14 07:02:23 -06:00
parent 1fd2025fe1
commit dde90adb46

View File

@@ -2,7 +2,7 @@ import { useStorage } from "@vueuse/core"
import copyTextToClipboard from "copy-text-to-clipboard"
import qs from "query-string"
import { reactive, ref, watch } from "vue"
import { getCodeByQuery, submit } from "../api"
import { formatCode, getCodeByQuery, submit } from "../api"
import { sources } from "../templates"
import { Cache, Code, LANGUAGE, Status } from "../types"
import { atou, utoa } from "../utils"
@@ -136,3 +136,7 @@ export function share() {
qs.stringifyUrl({ url: location.href, query: { share: base64 } }),
)
}
export async function format() {
code.value = await formatCode(code.value, code.language)
}