提交 56f51279 编写于 作者: M Mr.doob

Editor: Fixed duplicate loading.

上级 ec557ed6
...@@ -193,6 +193,8 @@ ...@@ -193,6 +193,8 @@
editor.storage.get( function ( state ) { editor.storage.get( function ( state ) {
if ( isLoadingFromHash ) return;
if ( state !== undefined ) { if ( state !== undefined ) {
editor.fromJSON( state ); editor.fromJSON( state );
...@@ -324,6 +326,7 @@ ...@@ -324,6 +326,7 @@
// //
var isLoadingFromHash = false;
var hash = window.location.hash; var hash = window.location.hash;
if ( hash.substr( 1, 5 ) === 'file=' ) { if ( hash.substr( 1, 5 ) === 'file=' ) {
...@@ -336,13 +339,13 @@ ...@@ -336,13 +339,13 @@
loader.crossOrigin = ''; loader.crossOrigin = '';
loader.load( file, function ( text ) { loader.load( file, function ( text ) {
var json = JSON.parse( text );
editor.clear(); editor.clear();
editor.fromJSON( json ); editor.fromJSON( JSON.parse( text ) );
} ); } );
isLoadingFromHash = true;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册