mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
feat: make expression persistent in the overpass importer
In other words: fill in the "tags" input with the latest typed expression. Otherwise, when making tries with overpass imports, one have to type it again and again (it's available through the autocomplete, though, but it's not obvious and it's less friendly IMHO).
This commit is contained in:
parent
8f7e5c7252
commit
e012d57e5c
1 changed files with 5 additions and 0 deletions
|
@ -53,11 +53,15 @@ export class Importer {
|
||||||
'https://photon.komoot.io/api?q={q}&layer=county&layer=city&layer=state'
|
'https://photon.komoot.io/api?q={q}&layer=county&layer=city&layer=state'
|
||||||
this.id = 'overpass'
|
this.id = 'overpass'
|
||||||
this.boundaryChoice = null
|
this.boundaryChoice = null
|
||||||
|
this.expression = null
|
||||||
}
|
}
|
||||||
|
|
||||||
async open(importer) {
|
async open(importer) {
|
||||||
const container = DomUtil.create('div')
|
const container = DomUtil.create('div')
|
||||||
container.innerHTML = TEMPLATE
|
container.innerHTML = TEMPLATE
|
||||||
|
if (this.expression) {
|
||||||
|
container.querySelector('[name=tags]').value = this.expression
|
||||||
|
}
|
||||||
this.autocomplete = new Autocomplete(container.querySelector('#area'), {
|
this.autocomplete = new Autocomplete(container.querySelector('#area'), {
|
||||||
url: this.searchUrl,
|
url: this.searchUrl,
|
||||||
placeholder: translate(
|
placeholder: translate(
|
||||||
|
@ -80,6 +84,7 @@ export class Importer {
|
||||||
Alert.error(translate('Expression is empty'))
|
Alert.error(translate('Expression is empty'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.expression = form.tags
|
||||||
let tags = form.tags
|
let tags = form.tags
|
||||||
if (!tags.startsWith('[')) tags = `[${tags}]`
|
if (!tags.startsWith('[')) tags = `[${tags}]`
|
||||||
let area = '{south},{west},{north},{east}'
|
let area = '{south},{west},{north},{east}'
|
||||||
|
|
Loading…
Reference in a new issue