Skip to content

Commit ee68ab5

Browse files
committed
Merge remote-tracking branch 'origin/main' into cesium.com
2 parents 1aa79e2 + d4b8184 commit ee68ab5

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/sandcastle/src/Gallery/loadFromUrl.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ export function loadFromUrl(
4343
) {
4444
const searchParams = new URLSearchParams(window.location.search);
4545

46+
const codeParam = searchParams.get("code");
47+
if (codeParam) {
48+
// This is a legacy support type url that was used by ion.
49+
// Ideally we use the #c= param as that results in shorter urls
50+
// The code query parameter is a Base64 encoded JSON string with `code` and `html` properties.
51+
const json = JSON.parse(window.atob(codeParam.replaceAll(" ", "+")));
52+
53+
return {
54+
title: "New Sandcastle",
55+
code: json.code,
56+
html: json.html,
57+
};
58+
}
59+
4660
if (window.location.hash.indexOf("#c=") === 0) {
4761
const base64String = window.location.hash.substr(3);
4862
const { code, html } = decodeBase64Data(base64String);

0 commit comments

Comments
 (0)