提交 1a4cfb02 编写于 作者: D Daniel

Remove "Save Editor to JSON" and "Open Editor from JSON"

Issue #37
上级 92ee2e19
......@@ -32,62 +32,6 @@ Menubar.File = function ( editor ) {
} );
options.add( option );
// Open Editor-JSON
var editorJsonInput = document.createElement( 'input' );
editorJsonInput.type = 'file';
editorJsonInput.addEventListener( 'change', function ( event ) {
var reader = new FileReader();
reader.addEventListener( 'load', function ( event ) {
var contents = event.target.result;
var data;
try {
data = JSON.parse( contents );
editor.clear();
editor.fromJSON( data );
} catch ( error ) {
alert( error );
return;
}
}, false );
reader.readAsText( editorJsonInput.files[ 0 ] );
} );
var option = new UI.Panel();
option.setClass( 'option' );
option.setTextContent( 'Open Editor-JSON...' );
option.onClick( function () {
editorJsonInput.click();
} );
options.add( option );
// Save Editor-JSON
var option = new UI.Panel();
option.setClass( 'option' );
option.setTextContent( 'Save Editor-JSON...' );
option.onClick( function () {
var output = editor.toJSON();
output = JSON.stringify( output, null, '\t' );
output = output.replace( /[\n\t]+([\d\.e\-\[\]]+)/g, '$1' );
exportString( output, 'editor.json' );
} );
options.add( option );
//
options.add( new UI.HorizontalRule() );
......@@ -358,4 +302,4 @@ Menubar.File = function ( editor ) {
return container;
};
};
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册