mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-20 13:33:39 -07:00
fix copy errors in popup & console
This commit is contained in:
parent
28e2666c17
commit
1f6c9e09e3
1 changed files with 10 additions and 10 deletions
|
@ -24,7 +24,7 @@
|
||||||
{{ icon ? "" : $t("general.copy") }}
|
{{ icon ? "" : $t("general.copy") }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
</template>
|
</template>
|
||||||
<span>
|
<span v-if="!isSupported || copiedSuccess !== null">
|
||||||
<v-icon
|
<v-icon
|
||||||
start
|
start
|
||||||
dark
|
dark
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
{{ $globals.icons.clipboardCheck }}
|
{{ $globals.icons.clipboardCheck }}
|
||||||
</v-icon>
|
</v-icon>
|
||||||
<slot v-if="!isSupported"> {{ $t("general.your-browser-does-not-support-clipboard") }} </slot>
|
<slot v-if="!isSupported"> {{ $t("general.your-browser-does-not-support-clipboard") }} </slot>
|
||||||
<slot v-else> {{ copied ? $t("general.copied_message") : $t("general.clipboard-copy-failure") }} </slot>
|
<slot v-else> {{ copiedSuccess ? $t("general.copied_message") : $t("general.clipboard-copy-failure") }} </slot>
|
||||||
</span>
|
</span>
|
||||||
</v-tooltip>
|
</v-tooltip>
|
||||||
</template>
|
</template>
|
||||||
|
@ -63,19 +63,18 @@ export default defineNuxtComponent({
|
||||||
const { copy, copied, isSupported } = useClipboard();
|
const { copy, copied, isSupported } = useClipboard();
|
||||||
const show = ref(false);
|
const show = ref(false);
|
||||||
const copyToolTip = ref<VTooltip | null>(null);
|
const copyToolTip = ref<VTooltip | null>(null);
|
||||||
|
const copiedSuccess = ref<boolean | null>(null);
|
||||||
function toggleBlur() {
|
|
||||||
copyToolTip.value?.deactivate();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function textToClipboard() {
|
async function textToClipboard() {
|
||||||
if (isSupported.value) {
|
if (isSupported.value) {
|
||||||
await copy(props.copyText);
|
await copy(props.copyText);
|
||||||
if (copied.value) {
|
if (copied.value) {
|
||||||
console.log(`Copied\n${props.copyText}`);
|
copiedSuccess.value = true;
|
||||||
|
console.info(`Copied\n${props.copyText}`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.warn("Copy failed: ", copied.value);
|
copiedSuccess.value = false;
|
||||||
|
console.error("Copy failed: ", copied.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -84,8 +83,8 @@ export default defineNuxtComponent({
|
||||||
|
|
||||||
show.value = true;
|
show.value = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
toggleBlur();
|
show.value = false;
|
||||||
}, 500);
|
}, 2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -94,6 +93,7 @@ export default defineNuxtComponent({
|
||||||
textToClipboard,
|
textToClipboard,
|
||||||
copied,
|
copied,
|
||||||
isSupported,
|
isSupported,
|
||||||
|
copiedSuccess,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue