From ff26c10a12c7b3a3557fca7e3f94b685795bfba6 Mon Sep 17 00:00:00 2001 From: Til Schmitter Date: Fri, 1 May 2026 18:17:08 +0200 Subject: [PATCH] crash fix when dragging text --- copyparty/web/browser.css | 4 ++++ copyparty/web/browser.js | 26 +++++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 160d5515..fa0036d3 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -544,6 +544,7 @@ html.y #path { } #path a.dtarget { text-shadow: var(--f-sel-sh) 0 0 5px; + background: color-mix(var(--a), transparent); } #path #entree { margin-left: -.7em; @@ -721,6 +722,7 @@ html.y #files span.fsz_P { font-weight: bold } } #files tr.dtarget { box-shadow: 0 0 5px 0 var(--f-sel-sh) inset; + background: color-mix(var(--a), transparent); } #files tr.dtarget td { background: none; @@ -1095,6 +1097,7 @@ html:not(.e) #ggrid>a.dir:before { } #ggrid a.dtarget { box-shadow: 0 0 5px 0 var(--f-sel-sh); + background: color-mix(var(--a), transparent); } #files tr.sel a, #files tr.sel a.play { @@ -1973,6 +1976,7 @@ html.a .btn { } #tree li a.dtarget { box-shadow: 0 0 5px 0 var(--f-sel-sh) inset; + background: color-mix(var(--a) 30%, transparent); } #tree ul a.sel { background: #000; diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index e5c5606b..bbdcb83a 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -10589,9 +10589,15 @@ var drag = (function() { var f = files[i]; f.draggable = true; f.ondragstart = function(e) { - current = e.target; - currLink = basenames(current.querySelector("td:nth-child(2) a").href.split("?")); - r.no_warn = true; + try{ + currLink = basenames(e.target.querySelector("td:nth-child(2) a").href.split("?")); + current = e.target; + r.no_warn = true; + } + catch(ex){ + console.log(e.target) + console.log(ex) + } }; f.ondragend = function() { r.no_warn = false; @@ -10614,10 +10620,16 @@ var drag = (function() { var f = files[i]; f.draggable = true; f.ondragstart = function(e) { - var a = ebi(e.target.getAttribute("ref")); - current = a.closest("tr"); - currLink = basenames(a.href.split("?")); - r.no_warn = true; + try{ + var a = ebi(e.target.getAttribute("ref")); + current = a.closest("tr"); + currLink = basenames(a.href.split("?")); + r.no_warn = true; + } + catch(ex){ + console.log(e.target) + console.log(ex) + } } f.ondragend = function() { r.no_warn = false;