mirror of
https://github.com/a-nyx/maputnik-with-pmtiles.git
synced 2025-01-01 00:33:16 +01:00
Merge pull request #516 from orangemug/fix/prevent-default-browser-undo-redo
Prevent native browser undo/redo when handled by app
This commit is contained in:
commit
c947d9e3ed
1 changed files with 5 additions and 1 deletions
|
@ -225,20 +225,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