From cf64048304ad50412bb26373a032596a8aec3462 Mon Sep 17 00:00:00 2001 From: mertmit Date: Sat, 3 Jun 2023 12:48:28 +0300 Subject: [PATCH] fix: trim unnecessary spaces from copy output Signed-off-by: mertmit --- .../nc-gui/composables/useMultiSelect/copyValue.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/composables/useMultiSelect/copyValue.ts b/packages/nc-gui/composables/useMultiSelect/copyValue.ts index 3a2fca1ac7..14ca8d3e21 100644 --- a/packages/nc-gui/composables/useMultiSelect/copyValue.ts +++ b/packages/nc-gui/composables/useMultiSelect/copyValue.ts @@ -5,21 +5,22 @@ export const copyTable = async (rows: Row[], cols: ColumnType[]) => { let copyHTML = '' let copyPlainText = '' - rows.forEach((row) => { + rows.forEach((row, i) => { let copyRow = '' - cols.forEach((col) => { + cols.forEach((col, i) => { let value = (col.title && row.row[col.title]) ?? '' if (typeof value === 'object') { value = JSON.stringify(value) } copyRow += `` - copyPlainText = `${copyPlainText} ${value} \t` + copyPlainText = `${copyPlainText}${value}${cols.length - 1 !== i ? '\t' : ''}` }) copyHTML += `${copyRow}` - copyPlainText = `${copyPlainText.trim()}\n` + if (rows.length - 1 !== i) { + copyPlainText = `${copyPlainText}\n` + } }) copyHTML += '
${value}
' - copyPlainText.trim() const blobHTML = new Blob([copyHTML], { type: 'text/html' }) const blobPlainText = new Blob([copyPlainText], { type: 'text/plain' })