forked from MapComplete/MapComplete
Fix: note themes uses full URL now instead of Panoramax-id
This commit is contained in:
parent
4395e88390
commit
ce363dfb59
4 changed files with 41 additions and 32 deletions
|
@ -14,11 +14,14 @@
|
|||
import LoginButton from "../Base/LoginButton.svelte"
|
||||
import { Translation } from "../i18n/Translation"
|
||||
import Camera from "@babeard/svelte-heroicons/solid/Camera"
|
||||
import LayerConfig from "../../Models/ThemeConfig/LayerConfig"
|
||||
import NoteCommentElement from "../Popup/Notes/NoteCommentElement"
|
||||
|
||||
export let state: SpecialVisualizationState
|
||||
|
||||
export let tags: UIEventSource<OsmTags>
|
||||
export let targetKey: string = undefined
|
||||
export let layer: LayerConfig
|
||||
/**
|
||||
* Image to show in the button
|
||||
* NOT the image to upload!
|
||||
|
@ -30,11 +33,9 @@
|
|||
export let labelText: string = undefined
|
||||
const t = Translations.t.image
|
||||
|
||||
let licenseStore = state?.userRelatedState?.imageLicense ?? new ImmutableStore("CC0")
|
||||
|
||||
let errors = new UIEventSource<Translation[]>([])
|
||||
|
||||
function handleFiles(files: FileList) {
|
||||
async function handleFiles(files: FileList) {
|
||||
const errs = []
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files.item(i)
|
||||
|
@ -45,7 +46,21 @@
|
|||
errs.push(canBeUploaded.error)
|
||||
continue
|
||||
}
|
||||
state?.imageUploadManager.uploadImageAndApply(file, tags, targetKey)
|
||||
|
||||
if(layer.id === "note"){
|
||||
const uploadResult = await state?.imageUploadManager.uploadImageWithLicense(file, tags, targetKey)
|
||||
if(!uploadResult){
|
||||
return
|
||||
}
|
||||
const url = uploadResult.absoluteUrl
|
||||
await this._osmConnection.addCommentToNote(tags.data.id, url)
|
||||
NoteCommentElement.addCommentTo(url, <UIEventSource<any>>tags, {
|
||||
osmConnection: this._osmConnection,
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
await state?.imageUploadManager.uploadImageAndApply(file, tags, targetKey)
|
||||
} catch (e) {
|
||||
alert(e)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue