mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-20 00:23:58 +01:00
Switch to vkbeautify for XML
https://feedback.yaak.app/p/xml-pretty-formatter-not-rendering-correctly
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import vkBeautify from 'vkbeautify';
|
||||
import { invokeCmd } from './tauri';
|
||||
|
||||
export async function tryFormatJson(text: string): Promise<string> {
|
||||
@@ -23,8 +24,7 @@ export async function tryFormatXml(text: string): Promise<string> {
|
||||
if (text === '') return text;
|
||||
|
||||
try {
|
||||
const result = await invokeCmd<string>('cmd_format_xml', { text });
|
||||
return result;
|
||||
return vkBeautify.xml(text, ' ');
|
||||
} catch (err) {
|
||||
console.warn('Failed to format XML', err);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ type TauriCmd =
|
||||
| 'cmd_dismiss_notification'
|
||||
| 'cmd_export_data'
|
||||
| 'cmd_format_json'
|
||||
| 'cmd_format_xml'
|
||||
| 'cmd_get_http_authentication_config'
|
||||
| 'cmd_get_http_authentication_summaries'
|
||||
| 'cmd_get_sse_events'
|
||||
|
||||
2
src-web/modules.d.ts
vendored
2
src-web/modules.d.ts
vendored
@@ -1,2 +1,2 @@
|
||||
declare module 'format-graphql';
|
||||
declare module 'xml-beautify';
|
||||
declare module 'vkbeautify';
|
||||
|
||||
@@ -65,12 +65,13 @@
|
||||
"remark-gfm": "^4.0.1",
|
||||
"slugify": "^1.6.6",
|
||||
"uuid": "^11.1.0",
|
||||
"vkbeautify": "^0.99.3",
|
||||
"whatwg-mimetype": "^4.0.0",
|
||||
"xml-beautify": "^1.2.3",
|
||||
"yaml": "^2.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@lezer/generator": "^1.8.0",
|
||||
"@tailwindcss/container-queries": "^0.1.1",
|
||||
"@tailwindcss/nesting": "^0.0.0-insiders.565cd3e",
|
||||
"@tanstack/router-plugin": "^1.127.5",
|
||||
"@types/node": "^24.0.13",
|
||||
@@ -83,7 +84,6 @@
|
||||
"@types/whatwg-mimetype": "^3.0.2",
|
||||
"@vitejs/plugin-react": "^4.6.0",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"@tailwindcss/container-queries": "^0.1.1",
|
||||
"decompress": "^4.2.1",
|
||||
"eslint-plugin-react-refresh": "^0.4.20",
|
||||
"internal-ip": "^8.0.0",
|
||||
|
||||
Reference in New Issue
Block a user