Merge pull request #2 from ziveo/develop__mac-keyboard-bindings

Improving keyboard bindings code
This commit is contained in:
ziveo 2018-03-16 23:01:34 -04:00 committed by GitHub
commit edc7e02f58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,17 +75,13 @@ export default class App extends React.Component {
} }
componentDidMount() { componentDidMount() {
Mousetrap.bind(['ctrl+z'], this.onUndo.bind(this)); Mousetrap.bind(['mod+z'], this.onUndo.bind(this));
Mousetrap.bind(['command+z'], this.onUndo.bind(this)); Mousetrap.bind(['mod+y', 'mod+shift+z'], this.onRedo.bind(this));
Mousetrap.bind(['ctrl+y'], this.onRedo.bind(this));
Mousetrap.bind(['command+shift+z'], this.onRedo.bind(this));
} }
componentWillUnmount() { componentWillUnmount() {
Mousetrap.unbind(['ctrl+z'], this.onUndo.bind(this)); Mousetrap.unbind(['mod+z'], this.onUndo.bind(this));
Mousetrap.unbind(['command+z'], this.onUndo.bind(this)); Mousetrap.unbind(['mod+y', 'mod+shift+z'], this.onRedo.bind(this));
Mousetrap.unbind(['ctrl+y'], this.onRedo.bind(this));
Mousetrap.unbind(['command+shift+z'], this.onRedo.bind(this));
} }
onReset() { onReset() {