mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2024-12-31 00:30:33 +01:00
Prevent native browser undo/redo when handled by app
This commit is contained in:
parent
c3c0c35d8a
commit
979fc98e70
1 changed files with 5 additions and 1 deletions
|
@ -217,20 +217,24 @@ export default class App extends React.Component {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
handleKeyPress(e) {
|
handleKeyPress = (e) => {
|
||||||
if(navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
|
if(navigator.platform.toUpperCase().indexOf('MAC') >= 0) {
|
||||||
if(e.metaKey && e.shiftKey && e.keyCode === 90) {
|
if(e.metaKey && e.shiftKey && e.keyCode === 90) {
|
||||||
|
e.preventDefault();
|
||||||
this.onRedo(e);
|
this.onRedo(e);
|
||||||
}
|
}
|
||||||
else if(e.metaKey && e.keyCode === 90) {
|
else if(e.metaKey && e.keyCode === 90) {
|
||||||
|
e.preventDefault();
|
||||||
this.onUndo(e);
|
this.onUndo(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(e.ctrlKey && e.keyCode === 90) {
|
if(e.ctrlKey && e.keyCode === 90) {
|
||||||
|
e.preventDefault();
|
||||||
this.onUndo(e);
|
this.onUndo(e);
|
||||||
}
|
}
|
||||||
else if(e.ctrlKey && e.keyCode === 89) {
|
else if(e.ctrlKey && e.keyCode === 89) {
|
||||||
|
e.preventDefault();
|
||||||
this.onRedo(e);
|
this.onRedo(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue