Browse Source

Merge pull request #6586 from nocodb/nc-fix/long-text-paste

fix: long text to single text paste
pull/6597/head
Raju Udava 11 months ago committed by GitHub
parent
commit
d6958dc7fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      packages/nc-gui/composables/useMultiSelect/convertCellData.ts
  2. 4
      packages/nc-gui/composables/useMultiSelect/index.ts

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

@ -17,6 +17,14 @@ export default function convertCellData(
if (value === '') return null
switch (to) {
case UITypes.SingleLineText:
case UITypes.LongText:
// This is to remove the quotes added from LongText
// TODO (refactor): remove this when we have a better way to handle this
if (value.match(/^".*"$/)) {
return value.slice(1, -1)
}
return value
case UITypes.Number: {
const parsedNumber = Number(value)
if (isNaN(parsedNumber)) {

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

@ -184,7 +184,7 @@ export function useMultiSelect(
}
if (columnObj.uidt === UITypes.LongText) {
textToCopy = `"${textToCopy.replace(/\"/g, '""')}"`
textToCopy = `"${textToCopy.replace(/"/g, '\\"')}"`
}
return textToCopy
@ -202,7 +202,7 @@ export function useMultiSelect(
const value = valueToCopy(row, col)
copyRow += `<td>${value}</td>`
text = `${text}${value}${cols.length - 1 !== i ? '\t' : ''}`
jsonRow.push(col.uidt === UITypes.LongText ? value.replace(/^"/, '').replace(/"$/, '').replace(/""/g, '"') : value)
jsonRow.push(value)
})
html += `${copyRow}</tr>`
if (rows.length - 1 !== i) {

Loading…
Cancel
Save