mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 11:52:38 +02:00
wip: deal with escape in tableeditor input/textarea
This commit is contained in:
parent
9f04f56c7c
commit
4a6b271bbe
1 changed files with 9 additions and 1 deletions
|
@ -214,7 +214,7 @@ export default class TableEditor extends WithTemplate {
|
||||||
const field = `properties.${property}`
|
const field = `properties.${property}`
|
||||||
const tr = event.target.closest('tr')
|
const tr = event.target.closest('tr')
|
||||||
const feature = this.datalayer.getFeatureById(tr.dataset.feature)
|
const feature = this.datalayer.getFeatureById(tr.dataset.feature)
|
||||||
const handler = property === 'description' ? 'Textarea' : 'Input'
|
const handler = property === 'description' ? 'Textarea' : 'BlurInput'
|
||||||
const builder = new U.FormBuilder(feature, [[field, { handler }]], {
|
const builder = new U.FormBuilder(feature, [[field, { handler }]], {
|
||||||
id: `umap-feature-properties_${L.stamp(feature)}`,
|
id: `umap-feature-properties_${L.stamp(feature)}`,
|
||||||
})
|
})
|
||||||
|
@ -226,6 +226,14 @@ export default class TableEditor extends WithTemplate {
|
||||||
cell.innerHTML = feature.properties[property] || ''
|
cell.innerHTML = feature.properties[property] || ''
|
||||||
cell.focus()
|
cell.focus()
|
||||||
})
|
})
|
||||||
|
input.addEventListener('keydown', (event) => {
|
||||||
|
if (event.key === 'Escape') {
|
||||||
|
builder.restoreField(field)
|
||||||
|
cell.innerHTML = feature.properties[property] || ''
|
||||||
|
cell.focus()
|
||||||
|
event.stopPropagation()
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
onKeyDown(event) {
|
onKeyDown(event) {
|
||||||
|
|
Loading…
Reference in a new issue