diff --git a/package.json b/package.json index 81c9e24..c4e42a7 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "clipboard": "2.0.11", "dayjs": "1.11.11", "echarts": "5.5.0", + "highlight.js": "^11.9.0", "lodash-es": "4.17.21", "naive-ui": "2.38.2", "nprogress": "0.2.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b473283..a1395ab 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -53,6 +53,9 @@ importers: echarts: specifier: 5.5.0 version: 5.5.0 + highlight.js: + specifier: ^11.9.0 + version: 11.9.0 lodash-es: specifier: 4.17.21 version: 4.17.21 diff --git a/src/components/common/code-mirror.vue b/src/components/common/code-mirror.vue index 38b7921..a20946d 100644 --- a/src/components/common/code-mirror.vue +++ b/src/components/common/code-mirror.vue @@ -103,7 +103,13 @@ const theme = computed(() => { watch( () => nodeExpression.value, val => { - emit('update:modelValue', val); + let value = val; + if (props.lang === 'json') { + try { + value = JSON.stringify(JSON.parse(val)); + } catch {} + } + emit('update:modelValue', value); } ); diff --git a/src/components/workflow/modules/common/detail-card.vue b/src/components/workflow/modules/common/detail-card.vue index 50034b7..01b392e 100644 --- a/src/components/workflow/modules/common/detail-card.vue +++ b/src/components/workflow/modules/common/detail-card.vue @@ -1,7 +1,9 @@