2
0
Эх сурвалжийг харах

Editor: Fixed duplicate loading.

Mr.doob 9 жил өмнө
parent
commit
56f512797f

+ 6 - 3
editor/index.html

@@ -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 @@
 
 
 			//
 			//
 
 
+			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 @@
 					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;
+
 				}
 				}
 
 
 			}
 			}