From 4869f042a982c9762095f341e736b59b6e42227a Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 4 Sep 2021 17:15:48 -0500 Subject: [PATCH] Fixed issues with input fields in Saves Manager --- src/components/fields/Text.vue | 24 +++++++++++++++++++----- src/components/system/Save.vue | 2 +- src/components/system/SavesManager.vue | 7 ++++++- src/data/layers/aca/c.ts | 2 +- src/game/layers.ts | 1 + src/util/layers.ts | 3 +++ 6 files changed, 31 insertions(+), 8 deletions(-) diff --git a/src/components/fields/Text.vue b/src/components/fields/Text.vue index 1e71298..f57b8c3 100644 --- a/src/components/fields/Text.vue +++ b/src/components/fields/Text.vue @@ -5,16 +5,18 @@ diff --git a/src/components/system/Save.vue b/src/components/system/Save.vue index 4ae1439..9b23384 100644 --- a/src/components/system/Save.vue +++ b/src/components/system/Save.vue @@ -49,7 +49,7 @@
Last played {{ dateFormat.format(time) }}
- +
Error: Failed to load save with id {{ save.id }}
diff --git a/src/components/system/SavesManager.vue b/src/components/system/SavesManager.vue index 93073e4..c811900 100644 --- a/src/components/system/SavesManager.vue +++ b/src/components/system/SavesManager.vue @@ -20,7 +20,7 @@ { try { const playerData = JSON.parse(decodeURIComponent(escape(atob(text)))); + if (typeof playerData !== "object") { + this.importingFailed = true; + return; + } const id = getUniqueID(); playerData.id = id; localStorage.setItem( diff --git a/src/data/layers/aca/c.ts b/src/data/layers/aca/c.ts index 1c2f6d2..e9142ea 100644 --- a/src/data/layers/aca/c.ts +++ b/src/data/layers/aca/c.ts @@ -468,7 +468,7 @@ export default {
Name your points!
- + I have {{ format(player.points) }} {{ player.layers.c.thingy }} points!
diff --git a/src/game/layers.ts b/src/game/layers.ts index 495aa50..7a43e17 100644 --- a/src/game/layers.ts +++ b/src/game/layers.ts @@ -566,6 +566,7 @@ export function addLayer(layer: RawLayer, player?: Partial): void { } if (layer.hotkeys) { for (const id in layer.hotkeys) { + layer.hotkeys[id].layer = layer.id; setDefault(layer.hotkeys[id], "press", undefined, false); setDefault(layer.hotkeys[id], "unlocked", function() { return layers[this.layer].unlocked; diff --git a/src/util/layers.ts b/src/util/layers.ts index e790ee5..cf7caec 100644 --- a/src/util/layers.ts +++ b/src/util/layers.ts @@ -395,6 +395,9 @@ export const defaultLayerProperties = { } as Omit & Partial> & ThisType; document.onkeydown = function(e) { + if ((e.target as HTMLElement | null)?.tagName === "INPUT") { + return; + } if (player.hasWon && !player.keepGoing) { return; }