Created
September 17, 2013 23:50
-
-
Save samclarke/6602408 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.sceditor.plugins.undomanager = function() { | |
var base = this; | |
base.init = function() { | |
// The this variable will be set to the instance of the editor calling it, | |
// hence why the plugins "this" is saved to the base variable. | |
// addShortcut is the easiest way to add handlers to specific shortcuts | |
this.addShortcut('ctrl+z', base.undo); | |
this.addShortcut('ctrl+shift+z', base.redo); | |
this.addShortcut('ctrl+y', base.redo); | |
}; | |
base.undo = function() { | |
alert('Undo!'); | |
// Prevent the default action | |
return false; | |
}; | |
base.redo = function() { | |
alert('Redo!'); | |
// Prevent the default action | |
return false; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment