MenuItemUndo.js 731 B

12345678910111213141516171819202122232425262728293031323334
  1. SC.loadPackage({ 'MenuItemUndo': {
  2. comment: 'I am the MenuItem for Undo.',
  3. traits: ['MenuItem'],
  4. sharedProperties: {
  5. menuContainer: { initValue: '<div class="sg-editing-menu-container"><button id="sg-editing-menu-undo" class="sg-editing-menu-button"></button></div>' }
  6. },
  7. methods: {
  8. init: {
  9. comment: 'I init the MenuItem.',
  10. code: function(theDocumentMenu){
  11. this.delegate('MenuItem', 'init', theDocumentMenu);
  12. this.set({ isActionButton: true });
  13. this.get('menuButton').addEventListener('mouseup', function(){
  14. SuperGlue.get('history').do('undo');
  15. }, false);
  16. }
  17. }
  18. }
  19. }});