Browse Source

fix(nc-gui): disable autofocus json field in form view

pull/7786/head
Ramesh Mane 6 months ago
parent
commit
18c352c4b3
  1. 1
      packages/nc-gui/components/cell/Json.vue
  2. 13
      packages/nc-gui/components/monaco/Editor.vue

1
packages/nc-gui/components/cell/Json.vue

@ -184,6 +184,7 @@ watch(isExpanded, () => {
:class="{ 'expanded-editor': isExpanded, 'editor': !isExpanded }" :class="{ 'expanded-editor': isExpanded, 'editor': !isExpanded }"
:hide-minimap="true" :hide-minimap="true"
:disable-deep-compare="true" :disable-deep-compare="true"
:auto-focus="!isForm"
@update:model-value="localValue = $event" @update:model-value="localValue = $event"
@keydown.enter.stop @keydown.enter.stop
/> />

13
packages/nc-gui/components/monaco/Editor.vue

@ -12,9 +12,18 @@ interface Props {
validate?: boolean validate?: boolean
disableDeepCompare?: boolean disableDeepCompare?: boolean
readOnly?: boolean readOnly?: boolean
autoFocus: boolean
} }
const { hideMinimap, lang = 'json', validate = true, disableDeepCompare = false, modelValue, readOnly } = defineProps<Props>() const {
hideMinimap,
lang = 'json',
validate = true,
disableDeepCompare = false,
modelValue,
readOnly,
autoFocus = true,
} = defineProps<Props>()
const emits = defineEmits(['update:modelValue']) const emits = defineEmits(['update:modelValue'])
@ -120,7 +129,7 @@ onMounted(async () => {
} }
}) })
if (!isDrawerOrModalExist()) { if (!isDrawerOrModalExist() && autoFocus) {
// auto focus on json cells only // auto focus on json cells only
editor.focus() editor.focus()
} }

Loading…
Cancel
Save