Skip to content

Commit 82a8abd

Browse files
committed
Load JSON-LD from hash fragments.
Supports `startTab` and `json-ld` (for the document).
1 parent 0d4e360 commit 82a8abd

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

playground/next/editor.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,5 +539,12 @@ window.app = createApp({
539539
'@context': this.doc['@context']
540540
};
541541
setEditorValue(this.contextEditor, this.contextDoc);
542+
},
543+
gatherHash() {
544+
const url = new URL(window.location);
545+
const hash = new URLSearchParams(url.hash.slice(1));
546+
this.doc = JSON.parse(hash.get('json-ld') || {});
547+
setEditorValue(this.mainEditor, this.doc);
548+
this.outputTab = hash.get('startTab').slice(4);
542549
}
543550
}).mount();

playground/next/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ <h2 class="ui massive header">JSON-LD Playground</h2>
2929
<code>Shift+Tab</code>) to navigate out of the editor.</p>
3030
</div>
3131

32-
<div class="ui container" v-scope v-effect="setOutputTab()">
32+
<div class="ui container" v-scope v-effect="setOutputTab()" @vue:mounted="gatherHash()">
3333
<div class="ui buttons">
3434
<button class="ui large basic right pointing label">Examples</button>
3535
<button id="btn-person" class="ui button"

0 commit comments

Comments
 (0)