reduce dependencies, and stop blocking

This commit is contained in:
Zoe
2024-09-25 03:13:40 -05:00
parent d85b6e7fe8
commit d0fb293c76
16 changed files with 414 additions and 14221 deletions

View File

@@ -29,9 +29,7 @@
</template>
<script setup lang="ts">
import { useClipboard } from '@vueuse/core';
const { copy, copied } = useClipboard();
const props = withDefaults(
withDefaults(
defineProps<{
code?: string;
language?: string | null;
@@ -42,6 +40,7 @@ const props = withDefaults(
);
const codeElm = ref();
let copied = ref(false);
const copyCode = () => {
if (!codeElm.value) {
@@ -58,7 +57,13 @@ const copyCode = () => {
}
}
copy(str);
if (import.meta.client) {
navigator.clipboard.writeText(str);
copied.value = true;
setTimeout(() => {
copied.value = false;
}, 2000);
}
};
</script>