fix: export VIZ_PRESETS to window and add safe preset fallbacks so event listeners and upload work reliably

This commit is contained in:
Jannik committed 2026-08-08 15:14:46 +02:00
1 parent b0e629bc56
commit 62e56dbbdf
2 files changed
+13 -2

No files matched your search

+3 -2
View File
@@ -44,7 +44,7 @@
exportAbortController: null,
// Active Settings
config: Object.assign({}, window.VIZ_PRESETS.trap_nation)
config: Object.assign({}, (typeof window !== 'undefined' && window.VIZ_PRESETS && window.VIZ_PRESETS.trap_nation) || (typeof VIZ_PRESETS !== 'undefined' && VIZ_PRESETS.trap_nation) || {})
};
// DOM Elements
@@ -1106,7 +1106,8 @@
}
function applyPreset(presetKeyOrObj) {
let p = typeof presetKeyOrObj === 'string' ? window.VIZ_PRESETS[presetKeyOrObj] : presetKeyOrObj;
const presetsObj = (typeof window !== 'undefined' && window.VIZ_PRESETS) || (typeof VIZ_PRESETS !== 'undefined' ? VIZ_PRESETS : {});
let p = typeof presetKeyOrObj === 'string' ? presetsObj[presetKeyOrObj] : presetKeyOrObj;
if (!p) return;
Object.assign(state.config, p);
+10
View File
@@ -507,3 +507,13 @@ const VIZ_PRESETS = {
showProgressBar: false
}
};
if (typeof window !== 'undefined') {
window.VIZ_PRESETS = VIZ_PRESETS;
}
if (typeof globalThis !== 'undefined') {
globalThis.VIZ_PRESETS = VIZ_PRESETS;
}
if (typeof module !== 'undefined' && module.exports) {
module.exports = VIZ_PRESETS;
}