fix(copy): prevent shorthand copy if source is present in useCopy (#559)

* fix(copy): prevent shorthand copy if source is present in useCopy

* refactor(copy): normalized copy usage
This commit is contained in:
Corentin THOMASSET authored and GitHub committed 2023-08-09 22:07:44 +00:00
1 parent 7b6232a151
commit 86e964a274
14 files changed
+26 -20

No files matched your search

+7 -1
View File
@@ -7,7 +7,13 @@ export function useCopy({ source, text = 'Copied to the clipboard' }: { source?:
return {
async copy(content?: string, { notificationMessage }: { notificationMessage?: string } = {}) {
await copy(content);
if (source) {
await copy();
}
else {
await copy(content);
}
message.success(notificationMessage ?? text);
},
};