File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -562,15 +562,25 @@ window.app = createApp({
562562 } ;
563563 setEditorValue ( this . contextEditor , this . contextDoc ) ;
564564 } ,
565- gatherHash ( ) {
565+ async gatherHash ( ) {
566566 const url = new URL ( window . location ) ;
567567 const hash = new URLSearchParams ( url ?. hash . slice ( 1 ) ) ;
568568 this . contextDoc = JSON . parse ( hash . get ( 'context' ) ) || { } ;
569569 setEditorValue ( this . contextEditor , this . contextDoc ) ;
570570 this . frameDoc = JSON . parse ( hash . get ( 'frame' ) ) || { } ;
571571 setEditorValue ( this . frameEditor , this . frameDoc ) ;
572- this . doc = JSON . parse ( hash . get ( 'json-ld' ) ) || { } ;
573- setEditorValue ( this . mainEditor , this . doc ) ;
572+ // the `json-ld` parameter can be JSON or a URL
573+ const jsonLdOrUrl = hash . get ( 'json-ld' ) ;
574+ try {
575+ this . doc = JSON . parse ( jsonLdOrUrl ) ;
576+ setEditorValue ( this . mainEditor , this . doc ) ;
577+ } catch {
578+ this . remoteDocURL = jsonLdOrUrl ;
579+ await this . retrieveDoc ( this . mainEditor , 'doc' , this . remoteDocURL ) ;
580+ }
581+ if ( hash . get ( 'copyContext' ) === 'true' ) {
582+ this . copyContext ( ) ;
583+ }
574584 this . outputTab = hash . get ( 'startTab' ) ?. slice ( 4 ) ;
575585 }
576586} ) . mount ( ) ;
You can’t perform that action at this time.
0 commit comments