forked from MapComplete/MapComplete
Fix: no more duplicate link showing up, avoid crash
This commit is contained in:
parent
0d085c92cf
commit
7be01d5b8f
1 changed files with 18 additions and 16 deletions
|
@ -89,6 +89,7 @@ import Toggle from "./Input/Toggle"
|
||||||
import ImportReviewIdentity from "./Reviews/ImportReviewIdentity.svelte"
|
import ImportReviewIdentity from "./Reviews/ImportReviewIdentity.svelte"
|
||||||
import LinkedDataLoader from "../Logic/Web/LinkedDataLoader"
|
import LinkedDataLoader from "../Logic/Web/LinkedDataLoader"
|
||||||
import SplitRoadWizard from "./Popup/SplitRoadWizard.svelte"
|
import SplitRoadWizard from "./Popup/SplitRoadWizard.svelte"
|
||||||
|
import DynLink from "./Base/DynLink.svelte"
|
||||||
|
|
||||||
class NearbyImageVis implements SpecialVisualization {
|
class NearbyImageVis implements SpecialVisualization {
|
||||||
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
|
// Class must be in SpecialVisualisations due to weird cyclical import that breaks the tests
|
||||||
|
@ -1236,22 +1237,19 @@ export default class SpecialVisualizations {
|
||||||
download = undefined
|
download = undefined
|
||||||
}
|
}
|
||||||
const newTab = download === undefined && !href.startsWith("#")
|
const newTab = download === undefined && !href.startsWith("#")
|
||||||
return new VariableUiElement(
|
const textStore = tagSource.map(tags => Utils.SubstituteKeys(text, tags))
|
||||||
tagSource.map(
|
const hrefStore = tagSource.map(tags => Utils.SubstituteKeys(href, tags).replaceAll(
|
||||||
(tags) =>
|
/ /g,
|
||||||
new SvelteUIElement(Link, {
|
"%20"
|
||||||
text: Utils.SubstituteKeys(text, tags),
|
) /* Chromium based browsers eat the spaces */)
|
||||||
href: Utils.SubstituteKeys(href, tags).replaceAll(
|
return new SvelteUIElement(DynLink, {
|
||||||
/ /g,
|
text:textStore,
|
||||||
"%20"
|
href: hrefStore,
|
||||||
) /* Chromium based browsers eat the spaces */,
|
classnames: new ImmutableStore(classnames),
|
||||||
classnames,
|
download: tagSource.map(tags => Utils.SubstituteKeys(download, tags)),
|
||||||
download: Utils.SubstituteKeys(download, tags),
|
ariaLabel: tagSource.map(tags => Utils.SubstituteKeys(ariaLabel, tags)),
|
||||||
ariaLabel: Utils.SubstituteKeys(ariaLabel, tags),
|
newTab: new ImmutableStore(newTab)
|
||||||
newTab
|
})
|
||||||
})
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -1309,6 +1307,10 @@ export default class SpecialVisualizations {
|
||||||
} else {
|
} else {
|
||||||
properties = <any>tags[key]
|
properties = <any>tags[key]
|
||||||
}
|
}
|
||||||
|
if(!properties){
|
||||||
|
console.debug("Could not create a special visualization for multi(",args.join(", ")+")", "no properties found for object",feature.properties.id)
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
const elements = []
|
const elements = []
|
||||||
for (const property of properties) {
|
for (const property of properties) {
|
||||||
const subsTr = new SvelteUIElement(SpecialTranslation, {
|
const subsTr = new SvelteUIElement(SpecialTranslation, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue