feat(new tool): emoji picker (#551)

This commit is contained in:
Corentin THOMASSET 2023-08-08 09:19:43 +02:00 committed by Corentin Thomasset
parent dfa1ba8554
commit 93f7cf0e98
No known key found for this signature in database
GPG key ID: DBD997E935996158
11 changed files with 192 additions and 6 deletions

View file

@ -1,14 +1,14 @@
import { type MaybeRef, get, useClipboard } from '@vueuse/core';
import { useMessage } from 'naive-ui';
export function useCopy({ source, text = 'Copied to the clipboard' }: { source: MaybeRef<unknown>; text?: string }) {
const { copy } = useClipboard({ source: computed(() => String(get(source))) });
export function useCopy({ source, text = 'Copied to the clipboard' }: { source?: MaybeRef<unknown>; text?: string } = {}) {
const { copy } = useClipboard(source ? { source: computed(() => String(get(source))) } : {});
const message = useMessage();
return {
async copy() {
async copy(content?: string, { notificationMessage }: { notificationMessage?: string } = {}) {
await copy();
message.success(text);
message.success(notificationMessage ?? text);
},
};
}