Skip to content

Commit

Permalink
fix: do not consume ctrl-Z in textarea or input (#2441)
Browse files Browse the repository at this point in the history
fix #2422
  • Loading branch information
yohanboniface authored Jan 22, 2025
2 parents e7388f6 + 122d470 commit 8a207af
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion umap/static/umap/js/modules/umap.js
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,13 @@ export default class Umap extends ServerStored {
if (SAVEMANAGER.isDirty) this.saveAll()
break
case 'z':
if (SAVEMANAGER.isDirty) this.askForReset()
if (Utils.isWritable(event.target)) {
used = false
break
}
if (SAVEMANAGER.isDirty) {
this.askForReset()
}
break
case 'm':
this._leafletMap.editTools.startMarker()
Expand Down
6 changes: 6 additions & 0 deletions umap/static/umap/js/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,12 @@ export class WithEvents {
}
}

export function isWritable(element) {
if (['TEXTAREA', 'INPUT'].includes(element.tagName)) return true
if (element.isContentEditable) return true
return false
}

export const COLORS = [
'Black',
'Navy',
Expand Down

0 comments on commit 8a207af

Please sign in to comment.