this repo has no description
at main 49 lines 982 B view raw
1--- 2type Props = { 3 href: string; 4 title: string; 5 text: string; 6 keybind?: string; 7 openWith: "vscode" | "vnd.gwennlbh.explorer"; 8}; 9 10const { href, title, text, keybind, openWith } = Astro.props; 11--- 12 13<script> 14 document.querySelectorAll("a[data-keybind]").forEach((el) => { 15 window.addEventListener("keypress", (e) => { 16 if (!(el instanceof HTMLAnchorElement)) return; 17 if (e.key === el.dataset.keybind) { 18 window.location.href = el.href; 19 } 20 }); 21 }); 22</script> 23 24<a 25 data-keybind={keybind} 26 class="edit-button" 27 href={[ 28 openWith === "vscode" ? "vscode://file" : "vnd.gwennlbh.explorer://", 29 href 30 .replace("/home/uwun/", "C:/Users/ewen/") 31 .replace("~/", "C:/Users/ewen/") 32 .replaceAll("/", "\\"), 33 ].join("/")} 34 title={title} 35> 36 {text} 37</a> 38 39<style> 40 a.edit-button { 41 color: transparent; 42 margin-left: 1em; 43 text-decoration: none; 44 } 45 46 a.edit-button:hover { 47 color: var(--primary, black); 48 } 49</style>