Skip to content

A self-hosted media server and file management system

fix: copy to clipboard does not see text changes

aminnausin789d8cbf8f05
diff --git a/resources/js/components/cedar-ui/clipboard/CopyToClipboard.vue b/resources/js/components/cedar-ui/clipboard/CopyToClipboard.vue
index 522f0064..3188d7a0 100644
--- a/resources/js/components/cedar-ui/clipboard/CopyToClipboard.vue
+++ b/resources/js/components/cedar-ui/clipboard/CopyToClipboard.vue
@@ -1,13 +1,18 @@
<script setup lang="ts">
import { cn, useClipboard } from '@aminnausin/cedar-ui';
import { ButtonIcon } from '../button';
+import { ref, watch } from 'vue';
import { TextInput } from '../input';
-import { ref } from 'vue';
const props = defineProps<{ text: string; tabindex?: number }>();
const text = ref(props.text);
const clipboard = useClipboard(text);
+
+watch(
+ () => props.text,
+ () => (text.value = props.text),
+);
</script>
<template>
@@ -35,7 +40,7 @@ const clipboard = useClipboard(text);
<ButtonIcon
@click="clipboard.copyToClipboard()"
:class="
- cn('group hover:text-foreground-0 text-foreground-1 focus:ring-green-600/50', {
+ cn('group hover:text-foreground-0 text-foreground-1 dark:text-foreground-i focus:ring-green-600/50 dark:bg-white', {
'ring-green-600/50': clipboard.copyNotification.value,
})
"