Browse Source

Nc fix(nc-gui): Copying and pasting from Excel overwrites one additional row cell (#8317)

* fix(nc-gui): copy paste from excel overwrites extra cell from next row

* fix(nc-gui): remove \n from clipboard data if it occured only once at the end

* fix(nc-gui): small changes

* Update index.ts

---------

Co-authored-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/8329/head
Ramesh Mane 2 months ago committed by GitHub
parent
commit
be0f763fba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      packages/nc-gui/composables/useMultiSelect/index.ts

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

@ -816,7 +816,15 @@ export function useMultiSelect(
e.preventDefault()
// Replace \" with " in clipboard data
const clipboardData = e.clipboardData?.getData('text/plain') || ''
let clipboardData = e.clipboardData?.getData('text/plain') || ''
if (clipboardData?.endsWith('\n')) {
// Remove '\n' from the end of the clipboardData
// When copying from XLS/XLSX files, there is an extra '\n' appended to the end
// this overwrites one additional cell information when we paste in NocoDB
clipboardData = clipboardData.replace(/\n$/, '')
}
try {
if (clipboardData?.includes('\n') || clipboardData?.includes('\t')) {
// if the clipboard data contains new line or tab, then it is a matrix or LongText

Loading…
Cancel
Save