Skip to content

Commit 5ea6221

Browse files
committed
Editor: Working File/Open.
Trick stolen from Google Cloud Storage web admin.
1 parent a7a4590 commit 5ea6221

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

editor/js/Menubar.File.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,25 @@ Menubar.File = function ( editor ) {
1919
options.setDisplay( 'none' );
2020
container.add( options );
2121

22-
/*
2322
// open
2423

24+
var input = document.createElement( 'input' );
25+
input.type = 'file';
26+
input.addEventListener( 'change', function ( event ) {
27+
28+
editor.loader.loadFile( input.files[ 0 ] );
29+
30+
} );
31+
2532
var option = new UI.Panel();
2633
option.setClass( 'option' );
2734
option.setTextContent( 'Open' );
28-
option.onClick( function () { alert( 'Open' ) } );
35+
option.onClick( function () {
36+
37+
input.click();
38+
39+
} );
2940
options.add( option );
30-
*/
3141

3242
// reset
3343

0 commit comments

Comments
 (0)