From dc2aee4be906ebbb46b6e1f24250f2811c44f0bf Mon Sep 17 00:00:00 2001 From: Alex Hall Date: Wed, 3 Nov 2021 22:39:20 +0200 Subject: [PATCH] (core) Trim trailing whitespace when pasting plain text Summary: title Test Plan: Tested manually. Blank rows at the end are no longer pasted. Pasting multiple columns separated by tabs can still have blank cells in some cells of the final rows. I don't think this needs an automated test. Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D3110 --- app/client/components/Clipboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/client/components/Clipboard.js b/app/client/components/Clipboard.js index d4c300e1..9dabcaea 100644 --- a/app/client/components/Clipboard.js +++ b/app/client/components/Clipboard.js @@ -154,7 +154,7 @@ Clipboard.prototype._onPaste = function(elem, event) { if (plainText === '' || plainText.charCodeAt(0) === 0xFEFF) { data = [['']]; } else { - data = tsvDecode(plainText.replace(/\r\n?/g, "\n")); + data = tsvDecode(plainText.replace(/\r\n?/g, "\n").trimEnd()); } }