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

@ -601,6 +601,7 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
}
json = { ...json }
json.tagRenderings = [...(json.tagRenderings ?? [])]
const allIds = new Set<string>(json.tagRenderings.map((tr) => tr["id"]))
const specialVisualisations = ValidationUtils.getAllSpecialVisualisations(
<any>json.tagRenderings
)
@ -658,11 +659,12 @@ export class AddEditingElements extends DesugaringStep<LayerConfigJson> {
})
}
if (!usedSpecialFunctions.has("qr_code")) {
json.tagRenderings.push({
id: "qr_code",
render: { "*": "{qr_code()}" },
})
if (!allIds.has("qr_code")) {
json.tagRenderings.push(this._desugaring.tagRenderings.get("qr_code"))
}
if (!allIds.has("share")) {
json.tagRenderings.push(this._desugaring.tagRenderings.get("share"))
}
if (!usedSpecialFunctions.has("all_tags")) {