Browse Source

fix: Added col option for rich text mode

pull/7046/head
Muhammed Mustafa 1 year 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(() => { 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, () => { watch(editEnabled, () => {
@ -187,7 +194,7 @@ watch(editEnabled, () => {
@keydown.escape="isVisible = false" @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> </div>
</template> </template>
</NcDropdown> </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" /> <LazySmartsheetColumnQrCodeOptions v-if="formState.uidt === UITypes.QrCode" v-model="formState" />
<LazySmartsheetColumnBarcodeOptions v-if="formState.uidt === UITypes.Barcode" v-model="formState" /> <LazySmartsheetColumnBarcodeOptions v-if="formState.uidt === UITypes.Barcode" v-model="formState" />
<LazySmartsheetColumnCurrencyOptions v-if="formState.uidt === UITypes.Currency" v-model:value="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" /> <LazySmartsheetColumnDurationOptions v-if="formState.uidt === UITypes.Duration" v-model:value="formState" />
<LazySmartsheetColumnRatingOptions v-if="formState.uidt === UITypes.Rating" 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" /> <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 for JSON & LongText is not supported in MySQL
Default Value is Disabled for MSSQL --> Default Value is Disabled for MSSQL -->
<LazySmartsheetColumnRichLongTextDefaultValue
v-if="isTextArea(formState) && formState.meta.richMode"
v-model:value="formState"
/>
<LazySmartsheetColumnDefaultValue <LazySmartsheetColumnDefaultValue
v-if=" v-else-if="
!isVirtualCol(formState) && !isVirtualCol(formState) &&
!isAttachment(formState) && !isAttachment(formState) &&
!isMssql(meta!.source_id) && !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", "headerName": "Header Name",
"icon": "Icon", "icon": "Icon",
"max": "Max", "max": "Max",
"enableRichText": "Enable Rich Text",
"idColon": "Id:", "idColon": "Id:",
"copiedRecordURL": "Copied Record URL", "copiedRecordURL": "Copied Record URL",
"copyRecordURL": "Copy Record URL", "copyRecordURL": "Copy Record URL",

Loading…
Cancel
Save