MenuItemNewPage.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. SC.loadPackage({ 'MenuItemNewPage': {
  2. comment: 'I am the MenuItem invoking the FileManger with context newPage.',
  3. traits: ['MenuItem'],
  4. sharedProperties: {
  5. menuContainer: { initValue: '<div class="sg-editing-menu-container"><button id="sg-editing-menu-newPage" class="sg-editing-menu-button"></button></div>' }
  6. },
  7. methods: {
  8. init: {
  9. comment: 'I init the MenuItem.',
  10. code: function(theDocumentMenu){
  11. var self = this;
  12. this.delegate('MenuItem', 'init', theDocumentMenu);
  13. this.set({ isActionButton: true });
  14. this.get('menuContainer').firstChild.addEventListener('mouseup', function(evt){
  15. self.do('action');
  16. theDocumentMenu.do('close');
  17. }, false);
  18. }
  19. },
  20. action: {
  21. comment: 'I do the job.',
  22. code: function(){
  23. SuperGlue.get('fileManager').do('newPage');
  24. }
  25. }
  26. }
  27. }});