feat: copy model link
This commit is contained in:
1 parent
2d5b82df8c
commit
9a5febc2d1
4 files changed
+56
-1
No files matched your search
@@ -34,6 +34,7 @@
|
||||
import EllipsisHorizontal from '$lib/components/icons/EllipsisHorizontal.svelte';
|
||||
import EyeSlash from '$lib/components/icons/EyeSlash.svelte';
|
||||
import Eye from '$lib/components/icons/Eye.svelte';
|
||||
import { copyToClipboard } from '$lib/utils';
|
||||
|
||||
let shiftKey = false;
|
||||
|
||||
@@ -182,6 +183,17 @@
|
||||
upsertModelHandler(model);
|
||||
};
|
||||
|
||||
const copyLinkHandler = async (model) => {
|
||||
const baseUrl = window.location.origin;
|
||||
const res = await copyToClipboard(`${baseUrl}/?model=${encodeURIComponent(model.id)}`);
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t('Copied link to clipboard'));
|
||||
} else {
|
||||
toast.error($i18n.t('Failed to copy link'));
|
||||
}
|
||||
};
|
||||
|
||||
const exportModelHandler = async (model) => {
|
||||
let blob = new Blob([JSON.stringify([model])], {
|
||||
type: 'application/json'
|
||||
@@ -394,6 +406,9 @@
|
||||
hideHandler={() => {
|
||||
hideModelHandler(model);
|
||||
}}
|
||||
copyLinkHandler={() => {
|
||||
copyLinkHandler(model);
|
||||
}}
|
||||
onClose={() => {}}
|
||||
>
|
||||
<button
|
||||
|
||||
Reference in new issue
Block a user