Browse Source

chore/gui-v2-json-minor-cleanup

pull/2946/head
Muhammed Mustafa 2 years ago
parent
commit
3a51d80ed2
  1. 4
      packages/nc-gui-v2/components/cell/Json.vue
  2. 5
      packages/nc-gui-v2/components/monaco/Editor.vue

4
packages/nc-gui-v2/components/cell/Json.vue

@ -80,10 +80,10 @@ watch(
:hide-minimap="true"
@validation-error="onError"
@update:model-value="localValue = $event"
@value-changed="resetError"
@text-changed="resetError"
/>
<span v-if="error" class="text-xs w-full py-1 text-red-500">
{{ error?.toString() }}
{{ error.toString() }}
</span>
</div>
<span v-else>{{ vModel }}</span>

5
packages/nc-gui-v2/components/monaco/Editor.vue

@ -14,7 +14,7 @@ interface Props {
interface Emits {
(event: 'update:modelValue', model: any): void
(event: 'validationError', error: any): void
(event: 'valueChanged'): void
(event: 'textChanged'): void
}
const props = defineProps<Props>()
@ -84,7 +84,7 @@ onMounted(() => {
try {
isValid.value = true
const obj = JSON.parse(editor.getValue())
emits('valueChanged')
emits('textChanged')
if (!deepCompare(vModel, obj)) vModel = obj
} catch (e) {
isValid.value = false
@ -107,6 +107,7 @@ watch(
editor.setValue(JSON.stringify(v, null, 2))
}
} catch (e) {
console.log(e)
editor.setValue(JSON.stringify(v, null, 2))
}
},

Loading…
Cancel
Save