Sidebar.Script.js 739 B

123456789101112131415161718192021222324252627282930313233343536
  1. Sidebar.Script = function ( editor ) {
  2. var signals = editor.signals;
  3. var container = new UI.CollapsiblePanel();
  4. container.setCollapsed( editor.config.getKey( 'ui/sidebar/script/collapsed' ) );
  5. container.onCollapsedChange( function ( boolean ) {
  6. editor.config.setKey( 'ui/sidebar/script/collapsed', boolean );
  7. } );
  8. container.setDisplay( 'none' );
  9. container.addStatic( new UI.Text( 'Script' ).setTextTransform( 'uppercase' ) );
  10. container.add( new UI.Break() );
  11. var scriptsRow = new UI.Panel();
  12. container.add( scriptsRow );
  13. signals.objectSelected.add( function ( object ) {
  14. if ( object !== null ) {
  15. container.setDisplay( 'block' );
  16. } else {
  17. container.setDisplay( 'none' );
  18. }
  19. } );
  20. return container;
  21. }