Browse Source

Editor: Working File/Open.
Trick stolen from Google Cloud Storage web admin.

Mr.doob 12 years ago
parent
commit
5ea6221be5
1 changed files with 13 additions and 3 deletions
  1. 13 3
      editor/js/Menubar.File.js

+ 13 - 3
editor/js/Menubar.File.js

@@ -19,15 +19,25 @@ Menubar.File = function ( editor ) {
 	options.setDisplay( 'none' );
 	container.add( options );
 
-	/*
 	// open
 
+	var input = document.createElement( 'input' );
+	input.type = 'file';
+	input.addEventListener( 'change', function ( event ) {
+
+		editor.loader.loadFile( input.files[ 0 ] );
+
+	} );
+
 	var option = new UI.Panel();
 	option.setClass( 'option' );
 	option.setTextContent( 'Open' );
-	option.onClick( function () { alert( 'Open' ) } );
+	option.onClick( function () {
+
+		input.click();
+
+	} );
 	options.add( option );
-	*/
 
 	// reset