Menubar.View.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. Menubar.View = function ( editor ) {
  2. var container = new UI.Panel();
  3. container.setClass( 'menu' );
  4. container.onMouseOver( function () { options.setDisplay( 'block' ) } );
  5. container.onMouseOut( function () { options.setDisplay( 'none' ) } );
  6. container.onClick( function () { options.setDisplay( 'block' ) } );
  7. var title = new UI.Panel();
  8. title.setTextContent( 'View' );
  9. title.setMargin( '0px' );
  10. title.setPadding( '8px' );
  11. container.add( title );
  12. //
  13. var options = new UI.Panel();
  14. options.setClass( 'options' );
  15. options.setDisplay( 'none' );
  16. container.add( options );
  17. // themes
  18. var option = new UI.Panel();
  19. option.setClass( 'option' );
  20. option.setTextContent( 'Light theme' );
  21. option.onClick( function () {
  22. editor.setTheme( 'css/light.css' );
  23. editor.config.setKey( 'theme', 'css/light.css' );
  24. } );
  25. options.add( option );
  26. // about
  27. var option = new UI.Panel();
  28. option.setClass( 'option' );
  29. option.setTextContent( 'Dark theme' );
  30. option.onClick( function () {
  31. editor.setTheme( 'css/dark.css' );
  32. editor.config.setKey( 'theme', 'css/dark.css' );
  33. } );
  34. options.add( option );
  35. //
  36. return container;
  37. }