Browse Source

feat(gui): show warning if paste not supported in cell

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4514/head
Pranav C 2 years ago
parent
commit
6752669287
  1. 8
      packages/nc-gui/composables/useMultiSelect/index.ts
  2. 1
      packages/nc-gui/lang/en.json

8
packages/nc-gui/composables/useMultiSelect/index.ts

@ -1,6 +1,6 @@
import type { MaybeRef } from '@vueuse/core' import type { MaybeRef } from '@vueuse/core'
import type { ColumnType } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk' import { isVirtualCol, RelationTypes, UITypes } from 'nocodb-sdk'
import type { Cell } from './cellRange' import type { Cell } from './cellRange'
import { CellRange } from './cellRange' import { CellRange } from './cellRange'
import { copyTable, message, reactive, ref, unref, useCopy, useEventListener, useI18n } from '#imports' import { copyTable, message, reactive, ref, unref, useCopy, useEventListener, useI18n } from '#imports'
@ -266,6 +266,9 @@ export function useMultiSelect(
await copyValue() await copyValue()
break break
case 86: case 86:
if(isVirtualCol(columnObj) && (columnObj.uidt !== UITypes.LinkToAnotherRecord || (columnObj.colOptions as LinkToAnotherRecordType)?.type !== RelationTypes.BELONGS_TO)) {
return message.info(t('msg.info.cannotPasteHere'))
}
// const clipboardText = await getClipboardData() // const clipboardText = await getClipboardData()
if (clipboardContext) { if (clipboardContext) {
rowObj.row[columnObj.title!] = convertCellData({ rowObj.row[columnObj.title!] = convertCellData({
@ -301,6 +304,7 @@ export function useMultiSelect(
} }
break break
} }
} }
useEventListener(document, 'keydown', onKeyDown) useEventListener(document, 'keydown', onKeyDown)

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

@ -497,6 +497,7 @@
} }
}, },
"info": { "info": {
"cannotPasteHere": "Cannot paste here",
"roles": { "roles": {
"orgCreator": "Creator can create new projects and access any invited project.", "orgCreator": "Creator can create new projects and access any invited project.",
"orgViewer": "Viewer is not allowed to create new projects but they can access any invited project." "orgViewer": "Viewer is not allowed to create new projects but they can access any invited project."

Loading…
Cancel
Save