Fixed exporting the currently active save not using exportEncoding
This commit is contained in:
parent
01ade0984c
commit
55c4476edf
1 changed files with 15 additions and 14 deletions
|
@ -59,7 +59,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import projInfo from "data/projInfo.json";
|
import projInfo from "data/projInfo.json";
|
||||||
import Modal from "components/Modal.vue";
|
import Modal from "components/Modal.vue";
|
||||||
import player, { PlayerData } from "game/player";
|
import player, { PlayerData, stringifySave } from "game/player";
|
||||||
import settings from "game/settings";
|
import settings from "game/settings";
|
||||||
import { getUniqueID, loadSave, save, newSave } from "util/save";
|
import { getUniqueID, loadSave, save, newSave } from "util/save";
|
||||||
import { ComponentPublicInstance, computed, nextTick, ref, shallowReactive, watch } from "vue";
|
import { ComponentPublicInstance, computed, nextTick, ref, shallowReactive, watch } from "vue";
|
||||||
|
@ -68,6 +68,7 @@ import Text from "./fields/Text.vue";
|
||||||
import Save from "./Save.vue";
|
import Save from "./Save.vue";
|
||||||
import Draggable from "vuedraggable";
|
import Draggable from "vuedraggable";
|
||||||
import LZString from "lz-string";
|
import LZString from "lz-string";
|
||||||
|
import { ProxyState } from "util/proxies";
|
||||||
|
|
||||||
export type LoadablePlayerData = Omit<Partial<PlayerData>, "id"> & { id: string; error?: unknown };
|
export type LoadablePlayerData = Omit<Partial<PlayerData>, "id"> & { id: string; error?: unknown };
|
||||||
|
|
||||||
|
@ -189,21 +190,21 @@ const saves = computed(() =>
|
||||||
function exportSave(id: string) {
|
function exportSave(id: string) {
|
||||||
let saveToExport;
|
let saveToExport;
|
||||||
if (player.id === id) {
|
if (player.id === id) {
|
||||||
saveToExport = save();
|
saveToExport = stringifySave(player[ProxyState]);
|
||||||
} else {
|
} else {
|
||||||
saveToExport = JSON.stringify(saves.value[id]);
|
saveToExport = JSON.stringify(saves.value[id]);
|
||||||
switch (projInfo.exportEncoding) {
|
}
|
||||||
default:
|
switch (projInfo.exportEncoding) {
|
||||||
console.warn(`Unknown save encoding: ${projInfo.exportEncoding}. Defaulting to lz`);
|
default:
|
||||||
case "lz":
|
console.warn(`Unknown save encoding: ${projInfo.exportEncoding}. Defaulting to lz`);
|
||||||
saveToExport = LZString.compressToUTF16(saveToExport);
|
case "lz":
|
||||||
break;
|
saveToExport = LZString.compressToUTF16(saveToExport);
|
||||||
case "base64":
|
break;
|
||||||
saveToExport = btoa(unescape(encodeURIComponent(saveToExport)));
|
case "base64":
|
||||||
break;
|
saveToExport = btoa(unescape(encodeURIComponent(saveToExport)));
|
||||||
case "plain":
|
break;
|
||||||
break;
|
case "plain":
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put on clipboard. Using the clipboard API asks for permissions and stuff
|
// Put on clipboard. Using the clipboard API asks for permissions and stuff
|
||||||
|
|
Loading…
Reference in a new issue