Browse Source

fix: Added col option for rich text mode

pull/7046/head
Muhammed Mustafa 12 months ago
parent
commit
682d2f1f8d
  1. 11
      packages/nc-gui/components/cell/TextArea.vue
  2. 7
      packages/nc-gui/components/smartsheet/column/EditOrAdd.vue
  3. 33
      packages/nc-gui/components/smartsheet/column/LongTextOptions.vue
  4. 1
      packages/nc-gui/lang/en.json

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

@ -75,7 +75,14 @@ const onTextClick = () => {
}
const isRichMode = computed(() => {
return true
let meta: any = {}
if (typeof column?.value?.meta === 'string') {
meta = JSON.parse(column?.value?.meta)
} else {
meta = column?.value?.meta ?? {}
}
return meta?.richMode
})
watch(editEnabled, () => {
@ -187,7 +194,7 @@ watch(editEnabled, () => {
@keydown.escape="isVisible = false"
/>
<CellRichText v-else v-model:value="vModel" class="ml-2 mt-2 max-h-80vh nc-scrollbar-md" />
<CellRichText v-else v-model:value="vModel" class="ml-2 mt-2 max-h-70vh nc-scrollbar-md" />
</div>
</template>
</NcDropdown>

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

@ -296,6 +296,7 @@ if (props.fromTableExplorer) {
<LazySmartsheetColumnQrCodeOptions v-if="formState.uidt === UITypes.QrCode" v-model="formState" />
<LazySmartsheetColumnBarcodeOptions v-if="formState.uidt === UITypes.Barcode" v-model="formState" />
<LazySmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" v-model:value="formState" />
<LazySmartsheetColumnLongTextOptions v-if="formState.uidt === UITypes.LongText" v-model:value="formState" />
<LazySmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" v-model:value="formState" />
<LazySmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" v-model:value="formState" />
<LazySmartsheetColumnCheckboxOptions v-if="formState.uidt === UITypes.Checkbox" v-model:value="formState" />
@ -331,8 +332,12 @@ if (props.fromTableExplorer) {
<!--
Default Value for JSON & LongText is not supported in MySQL
Default Value is Disabled for MSSQL -->
<LazySmartsheetColumnRichLongTextDefaultValue
v-if="isTextArea(formState) && formState.meta.richMode"
v-model:value="formState"
/>
<LazySmartsheetColumnDefaultValue
v-if="
v-else-if="
!isVirtualCol(formState) &&
!isAttachment(formState) &&
!isMssql(meta!.source_id) &&

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

@ -0,0 +1,33 @@
<!-- File not in use for now -->
<script setup lang="ts">
import { useVModel } from '#imports'
const props = defineProps<{
value: any
}>()
const emit = defineEmits(['update:value'])
const vModel = useVModel(props, 'value', emit)
const richMode = computed({
get: () => vModel.value.meta?.richMode,
set: (value) => {
if (!vModel.value.meta) vModel.value.meta = {}
vModel.value.meta.richMode = value
},
})
</script>
<template>
<div class="flex flex-col mt-2 gap-2">
<a-form-item>
<div class="flex flex-row space-x-2 items-center">
<NcSwitch v-model:checked="richMode" :name="$t('labels.enableRichText')" size="small" />
<div class="text-xs">{{ $t('labels.enableRichText') }}</div>
</div>
</a-form-item>
</div>
</template>

1
packages/nc-gui/lang/en.json

@ -423,6 +423,7 @@
"headerName": "Header Name",
"icon": "Icon",
"max": "Max",
"enableRichText": "Enable Rich Text",
"idColon": "Id:",
"copiedRecordURL": "Copied Record URL",
"copyRecordURL": "Copy Record URL",

Loading…
Cancel
Save