diff --git a/bun.lockb b/bun.lockb old mode 100644 new mode 100755 index ff950c5..4a077a9 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/src/main.ts b/src/main.ts index edd87d6..53f175c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -6,6 +6,8 @@ import { initManageLinks } from "./manageLinks.ts"; import { initManageTemplates } from "./manageTemplates.ts"; import UIManager from "./uiManager.ts"; +import "@placecharity/framework-types" + const DUMMY_DATA = { whoami: "BlueMarble", schemaVersion: "", diff --git a/src/manageTemplates.ts b/src/manageTemplates.ts index 23402c7..e54ba04 100644 --- a/src/manageTemplates.ts +++ b/src/manageTemplates.ts @@ -90,7 +90,15 @@ function exportToggle(id: number){ exportTemplateIndexes.push(id) } function shareTemplate(id: number){ - dataManager.getExportableData([id], []) // make link from this data + try{ + const string = JSON.stringify(dataManager.getExportableData([id], [])); + const windowURL = window.location.origin + window.location.pathname; + const searchParams = new URLSearchParams(); + searchParams.set("bmShare", string); + navigator.clipboard.writeText(windowURL+searchParams.toString()); + window.charity.lib.sonner.toast.success("Share link copied to clipboard") + } + catch{ window.charity.lib.sonner.toast.error("Creating share link failed") } } function deleteTemplate(id: number){