From 861ff4840ed46cfb18e424dad7533d5bdc86e899 Mon Sep 17 00:00:00 2001 From: Ben Wiley Date: Tue, 3 Mar 2020 18:12:24 -0500 Subject: [PATCH] Support triple-click selections for smartCopy A triple-click selection typically results in a newline character being added to the end of the selection string, which was incompatible with how we were comparing the copied string to our known text (===). By trimming the whitespace from the selection we can ensure a correct match. --- src/react-middle-truncate/middle-truncate.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/react-middle-truncate/middle-truncate.jsx b/src/react-middle-truncate/middle-truncate.jsx index e7b5e5c..381c8e1 100644 --- a/src/react-middle-truncate/middle-truncate.jsx +++ b/src/react-middle-truncate/middle-truncate.jsx @@ -117,7 +117,7 @@ class MiddleTruncate extends PureComponent { return; } - const selectedText = window.getSelection().toString(); + const selectedText = window.getSelection().toString().trim(); // If smartCopy is set to partial or if smartCopy is set to all and the entire string was selected // copy the original full text to the user's clipboard