Menubar.View.js 965 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { UIPanel, UIRow } from './libs/ui.js';
  2. function MenubarView( editor ) {
  3. var container = new UIPanel();
  4. container.setClass( 'menu' );
  5. var title = new UIPanel();
  6. title.setClass( 'title' );
  7. title.setTextContent( 'View' );
  8. container.add( title );
  9. var options = new UIPanel();
  10. options.setClass( 'options' );
  11. container.add( options );
  12. // Fullscreen
  13. var option = new UIRow();
  14. option.setClass( 'option' );
  15. option.setTextContent( 'Fullscreen' );
  16. option.onClick( function () {
  17. if ( document.fullscreenElement === null ) {
  18. document.documentElement.requestFullscreen();
  19. } else if ( document.exitFullscreen ) {
  20. document.exitFullscreen();
  21. }
  22. // Safari
  23. if ( document.webkitFullscreenElement === null ) {
  24. document.documentElement.webkitRequestFullscreen();
  25. } else if ( document.webkitExitFullscreen ) {
  26. document.webkitExitFullscreen();
  27. }
  28. } );
  29. options.add( option );
  30. return container;
  31. }
  32. export { MenubarView };