mirror of
https://github.com/SwingTheVine/Wplace-BlueMarble.git
synced 2026-03-11 17:15:38 +00:00
Added link sharing functionality
This commit is contained in:
parent
d0ff06dd1d
commit
a6f8c98242
3 changed files with 11 additions and 1 deletions
BIN
bun.lockb
Normal file → Executable file
BIN
bun.lockb
Normal file → Executable file
Binary file not shown.
|
|
@ -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: "",
|
||||
|
|
|
|||
|
|
@ -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){
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue