Skip to content

Commit 56f5127

Browse files
committed
Editor: Fixed duplicate loading.
1 parent ec557ed commit 56f5127

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

editor/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@
193193

194194
editor.storage.get( function ( state ) {
195195

196+
if ( isLoadingFromHash ) return;
197+
196198
if ( state !== undefined ) {
197199

198200
editor.fromJSON( state );
@@ -324,6 +326,7 @@
324326

325327
//
326328

329+
var isLoadingFromHash = false;
327330
var hash = window.location.hash;
328331

329332
if ( hash.substr( 1, 5 ) === 'file=' ) {
@@ -336,13 +339,13 @@
336339
loader.crossOrigin = '';
337340
loader.load( file, function ( text ) {
338341

339-
var json = JSON.parse( text );
340-
341342
editor.clear();
342-
editor.fromJSON( json );
343+
editor.fromJSON( JSON.parse( text ) );
343344

344345
} );
345346

347+
isLoadingFromHash = true;
348+
346349
}
347350

348351
}

0 commit comments

Comments
 (0)