diff --git a/packages/nc-gui/components/cell/Json.vue b/packages/nc-gui/components/cell/Json.vue index e39ff2e06c..7b2270d6b5 100644 --- a/packages/nc-gui/components/cell/Json.vue +++ b/packages/nc-gui/components/cell/Json.vue @@ -184,6 +184,7 @@ watch(isExpanded, () => { :class="{ 'expanded-editor': isExpanded, 'editor': !isExpanded }" :hide-minimap="true" :disable-deep-compare="true" + :auto-focus="!isForm" @update:model-value="localValue = $event" @keydown.enter.stop /> diff --git a/packages/nc-gui/components/monaco/Editor.vue b/packages/nc-gui/components/monaco/Editor.vue index a353cbca43..06ad6884b7 100644 --- a/packages/nc-gui/components/monaco/Editor.vue +++ b/packages/nc-gui/components/monaco/Editor.vue @@ -12,9 +12,18 @@ interface Props { validate?: boolean disableDeepCompare?: boolean readOnly?: boolean + autoFocus: boolean } -const { hideMinimap, lang = 'json', validate = true, disableDeepCompare = false, modelValue, readOnly } = defineProps() +const { + hideMinimap, + lang = 'json', + validate = true, + disableDeepCompare = false, + modelValue, + readOnly, + autoFocus = true, +} = defineProps() const emits = defineEmits(['update:modelValue']) @@ -120,7 +129,7 @@ onMounted(async () => { } }) - if (!isDrawerOrModalExist()) { + if (!isDrawerOrModalExist() && autoFocus) { // auto focus on json cells only editor.focus() }