From 5352f7cda7b8b1189aa8dc9313bb3beb308e2ce5 Mon Sep 17 00:00:00 2001 From: ed Date: Thu, 11 Nov 2021 00:11:29 +0100 Subject: [PATCH] fix ctrl-a fencing in codeblocks --- copyparty/web/browser.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 34f8b8a9..8347ecd9 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2511,6 +2511,7 @@ var showfile = (function () { wr.appendChild(el); wr.style.display = ''; + set_tabindex(); document.documentElement.scrollTop = 0; var hfun = no_push ? hist_replace : hist_push; @@ -4736,14 +4737,12 @@ function show_md(md, name, div, url, depth) { var els = QSA('#epi a'); for (var a = 0, aa = els.length; a < aa; a++) { var href = els[a].getAttribute('href'); - if (!href.startsWith('#')) + if (!href.startsWith('#') || href.startsWith('#md-')) continue; els[a].setAttribute('href', '#md-' + href.slice(1)); } - els = QSA('pre'); - for (var a = 0, aa = els.length; a < aa; a++) - els[a].setAttribute('tabindex', '0'); + set_tabindex(); } catch (ex) { toast.warn(10, errmsg + ex); @@ -4751,6 +4750,13 @@ function show_md(md, name, div, url, depth) { } +function set_tabindex() { + var els = QSA('pre'); + for (var a = 0, aa = els.length; a < aa; a++) + els[a].setAttribute('tabindex', '0'); +} + + function show_readme(md) { if (!treectl.ireadme) return;