Skip to content

Commit 4a6b271

Browse files
committed
wip: deal with escape in tableeditor input/textarea
1 parent 9f04f56 commit 4a6b271

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

umap/static/umap/js/modules/tableeditor.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ export default class TableEditor extends WithTemplate {
214214
const field = `properties.${property}`
215215
const tr = event.target.closest('tr')
216216
const feature = this.datalayer.getFeatureById(tr.dataset.feature)
217-
const handler = property === 'description' ? 'Textarea' : 'Input'
217+
const handler = property === 'description' ? 'Textarea' : 'BlurInput'
218218
const builder = new U.FormBuilder(feature, [[field, { handler }]], {
219219
id: `umap-feature-properties_${L.stamp(feature)}`,
220220
})
@@ -226,6 +226,14 @@ export default class TableEditor extends WithTemplate {
226226
cell.innerHTML = feature.properties[property] || ''
227227
cell.focus()
228228
})
229+
input.addEventListener('keydown', (event) => {
230+
if (event.key === 'Escape') {
231+
builder.restoreField(field)
232+
cell.innerHTML = feature.properties[property] || ''
233+
cell.focus()
234+
event.stopPropagation()
235+
}
236+
})
229237
}
230238

231239
onKeyDown(event) {

0 commit comments

Comments
 (0)