From 5adbfb333b9f2688023a465509757ba5ebc42692 Mon Sep 17 00:00:00 2001 From: Richie Bendall Date: Sat, 9 Oct 2021 21:36:37 +1300 Subject: [PATCH] Minor tweak (#45) --- index.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/index.js b/index.js index 2c943cc..983daca 100644 --- a/index.js +++ b/index.js @@ -13,10 +13,7 @@ export default function copyTextToClipboard(input, {target = document.body} = {} element.style.fontSize = '12pt'; // Prevent zooming on iOS const selection = document.getSelection(); - let originalRange = false; - if (selection.rangeCount > 0) { - originalRange = selection.getRangeAt(0); - } + const originalRange = selection.rangeCount > 0 && selection.getRangeAt(0); target.append(element); element.select();