Skip to content

Commit 7454ba1

Browse files
authored
sync hash between main window URL & custom widget iframes src (#1949)
1 parent 51c4cd5 commit 7454ba1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/components/custom-widget/ko/customWidgetViewModel.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,11 @@ export class CustomWidgetViewModel {
2121
this.src = ko.observable();
2222
this.styles = ko.observable();
2323
this.instanceId = ko.observable();
24+
25+
window.addEventListener("hashchange", () => {
26+
const srcNew = new URL(this.src());
27+
srcNew.hash = window.location.hash;
28+
this.src(srcNew.toString());
29+
});
2430
}
2531
}

src/components/custom-widget/ko/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ export async function buildWidgetSource(
3434
};
3535
url.searchParams.append(APIM_EDITOR_DATA_KEY, encodeURIComponent(JSON.stringify(data)));
3636

37-
return {override: developmentSrc, src: url.toString()};
37+
const src = url.toString() + window.location.hash;
38+
39+
return {override: developmentSrc, src};
3840
}

0 commit comments

Comments
 (0)