Add helper to copy markdown
All checks were successful
Gitea Actions Demo / build (push) Successful in 2m18s
All checks were successful
Gitea Actions Demo / build (push) Successful in 2m18s
This commit is contained in:
@@ -6,6 +6,22 @@
|
||||
<meta charset='utf-8' />
|
||||
<title>Chip's Attic</title>
|
||||
<script src='https://cdn.tailwindcss.com'></script>
|
||||
<script>
|
||||
function copyMarkdown() {
|
||||
const markdownContent = document.getElementById("markdown-content").innerText;
|
||||
navigator.clipboard.writeText(markdownContent);
|
||||
markdownContent.select();
|
||||
document.execCommand("Copy");
|
||||
}
|
||||
function startup() {
|
||||
const el = document.getElementById("markdown");
|
||||
el.addEventListener("touchend", copyMarkdown);
|
||||
el.addEventListener("click", copyMarkdown);
|
||||
console.log("Initialized.");
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", startup);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@@ -15,6 +31,7 @@
|
||||
<h2>Description</h2>
|
||||
<p class="bg-slate-100 px-2 py-4">{{description}}</p>
|
||||
<p>Right-click copy: <a class="text-blue-500 underline" href='/attic/{{slug}}'>{{slug}}</a></p>
|
||||
<p id="markdown" class="cursor-pointer mt-2">Click/tap to copy markdown <pre id="markdown-content">[Attic: {{slug}}](https://api.us.dev/attic/{{slug}})</pre></p>
|
||||
{{#if items}}
|
||||
<p class="text-lg">Files:</p>
|
||||
<div class="list-disc list-inside ml-1">
|
||||
|
Reference in New Issue
Block a user