mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-10-28 04:56:37 +00:00
add fallback for copying to clipboard
This commit is contained in:
1 parent
336784519b
commit
89944eb2b6
3 files changed
+17
-2
No files matched your search
@@ -11,3 +11,18 @@
|
||||
<script src="https://unpkg.com/bootstrap-table@1.21.1/dist/extensions/export/bootstrap-table-export.min.js"></script>
|
||||
|
||||
<script src="https://unpkg.com/bootstrap-table@1.21.1/dist/extensions/resizable/bootstrap-table-resizable.js"></script>
|
||||
|
||||
<script>
|
||||
async function copyToClipboard(text) {
|
||||
if (navigator.clipboard === undefined) {
|
||||
const input = document.createElement("textarea");
|
||||
input.innerHTML = text;
|
||||
document.body.appendChild(input);
|
||||
input.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(input);
|
||||
} else {
|
||||
await navigator.clipboard.writeText(text);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in new issue
Block a user