From 8ae79f888059254aa8c05ccfc918c991b5c7c1d4 Mon Sep 17 00:00:00 2001 From: Ardis Lu Date: Fri, 2 Aug 2024 23:31:03 -0700 Subject: [PATCH] Fix triple click over-selecting trailing node Otherwise, triple clicking on a table row will copy a trailing newline or tab. --- index.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/index.html b/index.html index a9c2e38..59e2730 100644 --- a/index.html +++ b/index.html @@ -236,6 +236,18 @@ } }); + // Fix selecting trailing element on triple (or quad) click, resulting in a trailing tab or newline + // when copying text from the table. + addEventListener('click', e => { + if (e.detail >= 3 && tableBody.contains(e.target)) { + const selection = getSelection(); + const range = selection.getRangeAt(0); + const textNode = e.target.firstChild; + range.setStart(textNode, 0); + range.setEnd(textNode, textNode.length); + }; + }); + // Set initial bytecode from prepopulated contract contractInput.dispatchEvent(new Event('input')); -- 2.47.3