forked from MapComplete/MapComplete
UX: add unlink button, simplify unlink code
This commit is contained in:
parent
45c0f1a8d6
commit
1192434b45
13 changed files with 117 additions and 69 deletions
|
@ -145,14 +145,14 @@ export class WikimediaImageProvider extends ImageProvider {
|
|||
.map((image) => this.UrlForImage(image))
|
||||
}
|
||||
if (value.startsWith("File:")) {
|
||||
return [this.UrlForImage(value)]
|
||||
return [this.UrlForImage(value, key, value)]
|
||||
}
|
||||
if (value.startsWith("http")) {
|
||||
// Probably an error
|
||||
return undefined
|
||||
}
|
||||
// We do a last effort and assume this is a file
|
||||
return [this.UrlForImage("File:" + value)]
|
||||
return [this.UrlForImage("File:" + value, key, value)]
|
||||
}
|
||||
|
||||
public async DownloadAttribution(img: { id: string }): Promise<LicenseInfo> {
|
||||
|
@ -211,9 +211,9 @@ export class WikimediaImageProvider extends ImageProvider {
|
|||
return licenseInfo
|
||||
}
|
||||
|
||||
private UrlForImage(image: string): ProvidedImage {
|
||||
private UrlForImage(image: string, key?: string, value?: string): ProvidedImage {
|
||||
image = "File:" + WikimediaImageProvider.makeCanonical(image)
|
||||
return {
|
||||
const providedImage: ProvidedImage = {
|
||||
url: WikimediaImageProvider.PrepareUrl(image),
|
||||
url_hd: WikimediaImageProvider.PrepareUrl(image, true),
|
||||
key: undefined,
|
||||
|
@ -221,6 +221,10 @@ export class WikimediaImageProvider extends ImageProvider {
|
|||
id: image,
|
||||
isSpherical: false,
|
||||
}
|
||||
if(key && value){
|
||||
providedImage.originalAttribute = {key, value}
|
||||
}
|
||||
return providedImage
|
||||
}
|
||||
|
||||
getPanoramaInfo(): Promise<Feature<Point, PanoramaView>> | undefined {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue