Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): form view title korean text input issue

Ramesh Mane3b82ea76ab9b
diff --git a/packages/nc-gui/components/nc/AutoSizeTextarea.vue b/packages/nc-gui/components/nc/AutoSizeTextarea.vue
new file mode 100644
index 0000000000..2d814be8fb
--- /dev/null
+++ b/packages/nc-gui/components/nc/AutoSizeTextarea.vue
@@ -0,0 +1,86 @@
+<script setup lang="ts">
+import { ref, watch, toRefs } from 'vue'
+import { useTextareaAutosize, type UseTextareaAutosizeOptions } from '@vueuse/core'
+
+/**
+ * Define props β€” you can extend this later if needed.
+ */
+
+interface Props {
+ modelValue?: string
+ disabled?: boolean
+ placeholder?: string
+ bordered?: boolean
+ hideScrollbar?: boolean
+ autoSizeProps?: Omit<UseTextareaAutosizeOptions, 'input'>
+}
+
+const props = withDefaults(defineProps<Props>(), {
+ bordered: true,
+ hideScrollbar: true,
+})
+
+const emit = defineEmits<{
+ (e: 'update:modelValue', value: string): void
+ (e: 'input', value: string): void
+}>()
+
+/**
+ * Make props reactive β€” keeps modelValue in sync
+ */
+const { modelValue } = toRefs(props)
+const value = ref(modelValue.value ?? '')
+
+/**
+ * Auto-resize logic from @vueuse/core
+ */
+const { textarea, input } = useTextareaAutosize({
+ input: value,
+ ...(props.autoSizeProps || {}),
+})
+
+/**
+ * Keep v-model two-way bound
+ */
+watch(value, (val) => {
+ emit('update:modelValue', val)
+ emit('input', val)
+})
+
+watch(modelValue, (val) => {
+ if (val !== value.value) value.value = val ?? ''
+})
+</script>
+
+<template>
+ <textarea
+ ref="textarea"
+ v-bind="$attrs"
+ v-model="input"
+ :disabled="disabled"
+ :placeholder="placeholder"
+ class="nc-auto-size-textarea w-full resize-none"
+ :class="{
+ 'nc-no-border': !bordered,
+ 'nc-hide-scrollbar': hideScrollbar,
+ }"
+ />
+</template>
+<style scoped lang="scss">
+.nc-auto-size-textarea {
+ &.nc-no-border {
+ @apply !border-0 !border-none !outline-none !ring-0 focus:(!border-0 !outline-none !ring-0);
+ }
+
+ &.nc-hide-scrollbar {
+ @apply overflow-hidden;
+
+ -ms-overflow-style: none;
+ scrollbar-width: none;
+
+ &::-webkit-scrollbar {
+ display: none;
+ }
+ }
+}
+</style>
diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue
index 095bc0a25d..d7c22decaa 100644
--- a/packages/nc-gui/components/smartsheet/Form.vue
+++ b/packages/nc-gui/components/smartsheet/Form.vue
@@ -927,7 +927,6 @@ const handleOnClick = (e: MouseEvent) => {
isSidebarVisible.value = true
}
}
-
const { message: templatedMessage } = useTemplatedMessage(
computed(() => formViewData?.value?.success_msg),
computed(() => formState.value),
@@ -1292,24 +1291,18 @@ const { message: templatedMessage } = useTemplatedMessage(
@click.stop="onFormItemClick({ id: NcForm.heading })"
>
<a-form-item v-if="isEditable" class="!my-0">
- <a-textarea
- v-model:value="formViewData.heading"
- class="nc-form-focus-element !p-0 !m-0 w-full !font-bold !text-2xl !border-0 !rounded-none !text-gray-900"
- :style="{
- 'borderRightWidth': '0px !important',
- 'height': '70px',
- 'max-height': '250px',
- 'resize': 'vertical',
- }"
- auto-size
- size="large"
- hide-details
- :disabled="isLocked"
+ <NcAutoSizeTextarea
+ v-model:model-value="formViewData.heading"
+ class="nc-form-focus-element !p-0 !m-0 w-full !font-bold !text-2xl !bg-transparent !text-gray-900"
placeholder="Form Title"
:bordered="false"
:data-testid="NcForm.heading"
:data-title="NcForm.heading"
- @input="updateView"
+ @input="
+ (value) => {
+ updateView()
+ }
+ "
@focus="activeRow = NcForm.heading"
@blur="activeRow = ''"
/>