From: Ardis Lu Date: Sat, 3 Aug 2024 06:31:03 +0000 (-0700) Subject: Fix triple click over-selecting trailing node X-Git-Url: https://git.ardis.lu/?a=commitdiff_plain;h=8ae79f888059254aa8c05ccfc918c991b5c7c1d4;p=function-extractor Fix triple click over-selecting trailing node Otherwise, triple clicking on a table row will copy a trailing newline or tab. --- 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'));