Improve share functionality

This commit is contained in:
Pieter Vander Vennet 2023-12-25 23:55:52 +01:00
parent df6e47faa8
commit 6cd3c15544
6 changed files with 68 additions and 18 deletions

View file

@ -14,6 +14,10 @@ export class ShareLinkViz implements SpecialVisualization {
name: "url",
doc: "The url to share (default: current URL)",
},
{
name: "text",
doc: "The text to show on the button. If none is given, will act as a titleIcon",
},
]
needsUrls = []
@ -22,6 +26,8 @@ export class ShareLinkViz implements SpecialVisualization {
tagSource: UIEventSource<Record<string, string>>,
args: string[]
) {
const text = args[1]
const generateShareData = () => {
const title = state?.layout?.title?.txt ?? "MapComplete"
@ -46,6 +52,6 @@ export class ShareLinkViz implements SpecialVisualization {
}
}
return new SvelteUIElement(ShareButton, { generateShareData })
return new SvelteUIElement(ShareButton, { generateShareData, text })
}
}