Fix loading of the hash of a custom theme, even if the custom theme is not loaded via the URL. Fixes 352

This commit is contained in:
Pieter Vander Vennet 2021-06-17 00:37:57 +02:00
parent 9a73ae4c47
commit 6c3b8b2020
2 changed files with 5 additions and 7 deletions

View file

@ -215,7 +215,7 @@ export class InitUiElements {
}
static LoadLayoutFromHash(userLayoutParam: UIEventSource<string>) {
static LoadLayoutFromHash(userLayoutParam: UIEventSource<string>): [LayoutConfig, string]{
try {
let hash = location.hash.substr(1);
const layoutFromBase64 = userLayoutParam.data;
@ -247,7 +247,7 @@ export class InitUiElements {
// @ts-ignore
const layoutToUse = new LayoutConfig(json, false);
userLayoutParam.setData(layoutToUse.id);
return layoutToUse;
return [layoutToUse, btoa(Utils.MinifyJSON(JSON.stringify(json)))];
} catch (e) {
new FixedUiElement("Error: could not parse the custom layout:<br/> " + e).AttachTo("centermessage");