forked from MapComplete/MapComplete
Improve share functionality
This commit is contained in:
parent
df6e47faa8
commit
6cd3c15544
6 changed files with 68 additions and 18 deletions
|
|
@ -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 })
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue