diff --git a/packages/nc-gui-v2/components/monaco/Editor.vue b/packages/nc-gui-v2/components/monaco/Editor.vue index 5f1ed4411f..739429905b 100644 --- a/packages/nc-gui-v2/components/monaco/Editor.vue +++ b/packages/nc-gui-v2/components/monaco/Editor.vue @@ -9,6 +9,14 @@ const emit = defineEmits(['update:modelValue']) const root = ref() let editor: monaco.editor.IStandaloneCodeEditor +const format = () => { + editor.setValue(JSON.stringify(JSON.parse(editor?.getValue() as string), null, 2)) +} + +defineExpose({ + format, +}) + onMounted(() => { if (root.value) { const model = monaco.editor.createModel(JSON.stringify(modelValue, null, 2), 'json')