Browse Source

fix: Added default value for rich text area

pull/7046/head
Muhammed Mustafa 1 year ago
parent
commit
993aaec27a
  1. 2
      packages/nc-gui/components/cell/TextArea.vue
  2. 1
      packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
  3. 4
      packages/nc-gui/components/smartsheet/column/LongTextOptions.vue
  4. 26
      packages/nc-gui/components/smartsheet/column/RichLongTextDefaultValue.vue

2
packages/nc-gui/components/cell/TextArea.vue

@ -33,7 +33,7 @@ const isForm = inject(IsFormInj, ref(false))
const { showNull } = useGlobal() const { showNull } = useGlobal()
const vModel = useVModel(props, 'modelValue', emits, { defaultValue: '' }) const vModel = useVModel(props, 'modelValue', emits, { defaultValue: column?.value.cdf ? String(column?.value.cdf) : '' })
const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))! const isExpandedFormOpen = inject(IsExpandedFormOpenInj, ref(false))!

1
packages/nc-gui/components/smartsheet/column/EditOrAdd.vue

@ -220,6 +220,7 @@ if (props.fromTableExplorer) {
:class="{ :class="{
'bg-white': !props.fromTableExplorer, 'bg-white': !props.fromTableExplorer,
'w-[400px]': !props.embedMode, 'w-[400px]': !props.embedMode,
'!w-150': isTextArea(formState) && formState.meta.richMode,
'!w-[600px]': formState.uidt === UITypes.Formula && !props.embedMode, '!w-[600px]': formState.uidt === UITypes.Formula && !props.embedMode,
'!w-[500px]': formState.uidt === UITypes.Attachment && !props.embedMode && !appInfo.ee, '!w-[500px]': formState.uidt === UITypes.Attachment && !props.embedMode && !appInfo.ee,
'shadow-lg border-1 border-gray-50 shadow-gray-100 rounded-md p-6': !embedMode, 'shadow-lg border-1 border-gray-50 shadow-gray-100 rounded-md p-6': !embedMode,

4
packages/nc-gui/components/smartsheet/column/LongTextOptions.vue

@ -19,6 +19,10 @@ const richMode = computed({
vModel.value.meta.richMode = value vModel.value.meta.richMode = value
}, },
}) })
watch(richMode, () => {
vModel.value.cdf = null
})
</script> </script>
<template> <template>

26
packages/nc-gui/components/smartsheet/column/RichLongTextDefaultValue.vue

@ -0,0 +1,26 @@
<script lang="ts" setup>
const props = defineProps<{
value: any
}>()
const emits = defineEmits(['update:value'])
const vModel = useVModel(props, 'value', emits)
const cdfValue = computed({
get: () => vModel.value.cdf,
set: (value) => {
vModel.value.cdf = value
},
})
</script>
<template>
<div>
<div class="!my-3 text-xs">{{ $t('placeholder.defaultValue') }}</div>
<div class="flex flex-row gap-2">
<div class="border-1 relative pt-12 flex items-center w-full px-0 my-[-4px] border-gray-300 rounded-md !max-h-70">
<LazyCellRichText v-model:value="cdfValue" class="ml-3 my-2" show-menu full-mode />
</div>
</div>
</div>
</template>
Loading…
Cancel
Save